/*!
 * jQuery JavaScript Library v1.6.2
 * http://jquery.com/
 *
 * Copyright 2011, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2011, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Thu Jun 30 14:16:56 2011 -0400
 */
(function(a9,K){var aq=a9.document,br=a9.navigator,bi=a9.location;var b=(function(){var bC=function(bX,bY){return new bC.fn.init(bX,bY,bA)},bS=a9.jQuery,bE=a9.$,bA,bW=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,bK=/\S/,bG=/^\s+/,bB=/\s+$/,bF=/\d/,bx=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bL=/^[\],:{}\s]*$/,bU=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bN=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bH=/(?:^|:|,)(?:\s*\[)+/g,bv=/(webkit)[ \/]([\w.]+)/,bP=/(opera)(?:.*version)?[ \/]([\w.]+)/,bO=/(msie) ([\w.]+)/,bQ=/(mozilla)(?:.*? rv:([\w.]+))?/,by=/-([a-z])/ig,bR=function(bX,bY){return bY.toUpperCase()},bV=br.userAgent,bT,bz,e,bJ=Object.prototype.toString,bD=Object.prototype.hasOwnProperty,bw=Array.prototype.push,bI=Array.prototype.slice,bM=String.prototype.trim,bs=Array.prototype.indexOf,bu={};bC.fn=bC.prototype={constructor:bC,init:function(bX,b1,b0){var bZ,b2,bY,b3;if(!bX){return this}if(bX.nodeType){this.context=this[0]=bX;this.length=1;return this}if(bX==="body"&&!b1&&aq.body){this.context=aq;this[0]=aq.body;this.selector=bX;this.length=1;return this}if(typeof bX==="string"){if(bX.charAt(0)==="<"&&bX.charAt(bX.length-1)===">"&&bX.length>=3){bZ=[null,bX,null]}else{bZ=bW.exec(bX)}if(bZ&&(bZ[1]||!b1)){if(bZ[1]){b1=b1 instanceof bC?b1[0]:b1;b3=(b1?b1.ownerDocument||b1:aq);bY=bx.exec(bX);if(bY){if(bC.isPlainObject(b1)){bX=[aq.createElement(bY[1])];bC.fn.attr.call(bX,b1,true)}else{bX=[b3.createElement(bY[1])]}}else{bY=bC.buildFragment([bZ[1]],[b3]);bX=(bY.cacheable?bC.clone(bY.fragment):bY.fragment).childNodes}return bC.merge(this,bX)}else{b2=aq.getElementById(bZ[2]);if(b2&&b2.parentNode){if(b2.id!==bZ[2]){return b0.find(bX)}this.length=1;this[0]=b2}this.context=aq;this.selector=bX;return this}}else{if(!b1||b1.jquery){return(b1||b0).find(bX)}else{return this.constructor(b1).find(bX)}}}else{if(bC.isFunction(bX)){return b0.ready(bX)}}if(bX.selector!==K){this.selector=bX.selector;this.context=bX.context}return bC.makeArray(bX,this)},selector:"",jquery:"1.6.2",length:0,size:function(){return this.length},toArray:function(){return bI.call(this,0)},get:function(bX){return bX==null?this.toArray():(bX<0?this[this.length+bX]:this[bX])},pushStack:function(bY,b0,bX){var bZ=this.constructor();if(bC.isArray(bY)){bw.apply(bZ,bY)}else{bC.merge(bZ,bY)}bZ.prevObject=this;bZ.context=this.context;if(b0==="find"){bZ.selector=this.selector+(this.selector?" ":"")+bX}else{if(b0){bZ.selector=this.selector+"."+b0+"("+bX+")"}}return bZ},each:function(bY,bX){return bC.each(this,bY,bX)},ready:function(bX){bC.bindReady();bz.done(bX);return this},eq:function(bX){return bX===-1?this.slice(bX):this.slice(bX,+bX+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bI.apply(this,arguments),"slice",bI.call(arguments).join(","))},map:function(bX){return this.pushStack(bC.map(this,function(bZ,bY){return bX.call(bZ,bY,bZ)}))},end:function(){return this.prevObject||this.constructor(null)},push:bw,sort:[].sort,splice:[].splice};bC.fn.init.prototype=bC.fn;bC.extend=bC.fn.extend=function(){var b6,bZ,bX,bY,b3,b4,b2=arguments[0]||{},b1=1,b0=arguments.length,b5=false;if(typeof b2==="boolean"){b5=b2;b2=arguments[1]||{};b1=2}if(typeof b2!=="object"&&!bC.isFunction(b2)){b2={}}if(b0===b1){b2=this;--b1}for(;b1<b0;b1++){if((b6=arguments[b1])!=null){for(bZ in b6){bX=b2[bZ];bY=b6[bZ];if(b2===bY){continue}if(b5&&bY&&(bC.isPlainObject(bY)||(b3=bC.isArray(bY)))){if(b3){b3=false;b4=bX&&bC.isArray(bX)?bX:[]}else{b4=bX&&bC.isPlainObject(bX)?bX:{}}b2[bZ]=bC.extend(b5,b4,bY)}else{if(bY!==K){b2[bZ]=bY}}}}}return b2};bC.extend({noConflict:function(bX){if(a9.$===bC){a9.$=bE}if(bX&&a9.jQuery===bC){a9.jQuery=bS}return bC},isReady:false,readyWait:1,holdReady:function(bX){if(bX){bC.readyWait++}else{bC.ready(true)}},ready:function(bX){if((bX===true&&!--bC.readyWait)||(bX!==true&&!bC.isReady)){if(!aq.body){return setTimeout(bC.ready,1)}bC.isReady=true;if(bX!==true&&--bC.readyWait>0){return}bz.resolveWith(aq,[bC]);if(bC.fn.trigger){bC(aq).trigger("ready").unbind("ready")}}},bindReady:function(){if(bz){return}bz=bC._Deferred();if(aq.readyState==="complete"){return setTimeout(bC.ready,1)}if(aq.addEventListener){aq.addEventListener("DOMContentLoaded",e,false);a9.addEventListener("load",bC.ready,false)}else{if(aq.attachEvent){aq.attachEvent("onreadystatechange",e);a9.attachEvent("onload",bC.ready);var bX=false;try{bX=a9.frameElement==null}catch(bY){}if(aq.documentElement.doScroll&&bX){bt()}}}},isFunction:function(bX){return bC.type(bX)==="function"},isArray:Array.isArray||function(bX){return bC.type(bX)==="array"},isWindow:function(bX){return bX&&typeof bX==="object"&&"setInterval" in bX},isNaN:function(bX){return bX==null||!bF.test(bX)||isNaN(bX)},type:function(bX){return bX==null?String(bX):bu[bJ.call(bX)]||"object"},isPlainObject:function(bY){if(!bY||bC.type(bY)!=="object"||bY.nodeType||bC.isWindow(bY)){return false}if(bY.constructor&&!bD.call(bY,"constructor")&&!bD.call(bY.constructor.prototype,"isPrototypeOf")){return false}var bX;for(bX in bY){}return bX===K||bD.call(bY,bX)},isEmptyObject:function(bY){for(var bX in bY){return false}return true},error:function(bX){throw bX},parseJSON:function(bX){if(typeof bX!=="string"||!bX){return null}bX=bC.trim(bX);if(a9.JSON&&a9.JSON.parse){return a9.JSON.parse(bX)}if(bL.test(bX.replace(bU,"@").replace(bN,"]").replace(bH,""))){return(new Function("return "+bX))()}bC.error("Invalid JSON: "+bX)},parseXML:function(bZ,bX,bY){if(a9.DOMParser){bY=new DOMParser();bX=bY.parseFromString(bZ,"text/xml")}else{bX=new ActiveXObject("Microsoft.XMLDOM");bX.async="false";bX.loadXML(bZ)}bY=bX.documentElement;if(!bY||!bY.nodeName||bY.nodeName==="parsererror"){bC.error("Invalid XML: "+bZ)}return bX},noop:function(){},globalEval:function(bX){if(bX&&bK.test(bX)){(a9.execScript||function(bY){a9["eval"].call(a9,bY)})(bX)}},camelCase:function(bX){return bX.replace(by,bR)},nodeName:function(bY,bX){return bY.nodeName&&bY.nodeName.toUpperCase()===bX.toUpperCase()},each:function(b0,b3,bZ){var bY,b1=0,b2=b0.length,bX=b2===K||bC.isFunction(b0);if(bZ){if(bX){for(bY in b0){if(b3.apply(b0[bY],bZ)===false){break}}}else{for(;b1<b2;){if(b3.apply(b0[b1++],bZ)===false){break}}}}else{if(bX){for(bY in b0){if(b3.call(b0[bY],bY,b0[bY])===false){break}}}else{for(;b1<b2;){if(b3.call(b0[b1],b1,b0[b1++])===false){break}}}}return b0},trim:bM?function(bX){return bX==null?"":bM.call(bX)}:function(bX){return bX==null?"":bX.toString().replace(bG,"").replace(bB,"")},makeArray:function(b0,bY){var bX=bY||[];if(b0!=null){var bZ=bC.type(b0);if(b0.length==null||bZ==="string"||bZ==="function"||bZ==="regexp"||bC.isWindow(b0)){bw.call(bX,b0)}else{bC.merge(bX,b0)}}return bX},inArray:function(bZ,b0){if(bs){return bs.call(b0,bZ)}for(var bX=0,bY=b0.length;bX<bY;bX++){if(b0[bX]===bZ){return bX}}return -1},merge:function(b1,bZ){var b0=b1.length,bY=0;if(typeof bZ.length==="number"){for(var bX=bZ.length;bY<bX;bY++){b1[b0++]=bZ[bY]}}else{while(bZ[bY]!==K){b1[b0++]=bZ[bY++]}}b1.length=b0;return b1},grep:function(bY,b3,bX){var bZ=[],b2;bX=!!bX;for(var b0=0,b1=bY.length;b0<b1;b0++){b2=!!b3(bY[b0],b0);if(bX!==b2){bZ.push(bY[b0])}}return bZ},map:function(bX,b4,b5){var b2,b3,b1=[],bZ=0,bY=bX.length,b0=bX instanceof bC||bY!==K&&typeof bY==="number"&&((bY>0&&bX[0]&&bX[bY-1])||bY===0||bC.isArray(bX));if(b0){for(;bZ<bY;bZ++){b2=b4(bX[bZ],bZ,b5);if(b2!=null){b1[b1.length]=b2}}}else{for(b3 in bX){b2=b4(bX[b3],b3,b5);if(b2!=null){b1[b1.length]=b2}}}return b1.concat.apply([],b1)},guid:1,proxy:function(b1,b0){if(typeof b0==="string"){var bZ=b1[b0];b0=b1;b1=bZ}if(!bC.isFunction(b1)){return K}var bX=bI.call(arguments,2),bY=function(){return b1.apply(b0,bX.concat(bI.call(arguments)))};bY.guid=b1.guid=b1.guid||bY.guid||bC.guid++;return bY},access:function(bX,b5,b3,bZ,b2,b4){var bY=bX.length;if(typeof b5==="object"){for(var b0 in b5){bC.access(bX,b0,b5[b0],bZ,b2,b3)}return bX}if(b3!==K){bZ=!b4&&bZ&&bC.isFunction(b3);for(var b1=0;b1<bY;b1++){b2(bX[b1],b5,bZ?b3.call(bX[b1],b1,b2(bX[b1],b5)):b3,b4)}return bX}return bY?b2(bX[0],b5):K},now:function(){return(new Date()).getTime()},uaMatch:function(bY){bY=bY.toLowerCase();var bX=bv.exec(bY)||bP.exec(bY)||bO.exec(bY)||bY.indexOf("compatible")<0&&bQ.exec(bY)||[];return{browser:bX[1]||"",version:bX[2]||"0"}},sub:function(){function bX(b0,b1){return new bX.fn.init(b0,b1)}bC.extend(true,bX,this);bX.superclass=this;bX.fn=bX.prototype=this();bX.fn.constructor=bX;bX.sub=this.sub;bX.fn.init=function bZ(b0,b1){if(b1&&b1 instanceof bC&&!(b1 instanceof bX)){b1=bX(b1)}return bC.fn.init.call(this,b0,b1,bY)};bX.fn.init.prototype=bX.fn;var bY=bX(aq);return bX},browser:{}});bC.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(bY,bX){bu["[object "+bX+"]"]=bX.toLowerCase()});bT=bC.uaMatch(bV);if(bT.browser){bC.browser[bT.browser]=true;bC.browser.version=bT.version}if(bC.browser.webkit){bC.browser.safari=true}if(bK.test("\xA0")){bG=/^[\s\xA0]+/;bB=/[\s\xA0]+$/}bA=bC(aq);if(aq.addEventListener){e=function(){aq.removeEventListener("DOMContentLoaded",e,false);bC.ready()}}else{if(aq.attachEvent){e=function(){if(aq.readyState==="complete"){aq.detachEvent("onreadystatechange",e);bC.ready()}}}}function bt(){if(bC.isReady){return}try{aq.documentElement.doScroll("left")}catch(bX){setTimeout(bt,1);return}bC.ready()}return bC})();var a="done fail isResolved isRejected promise then always pipe".split(" "),aF=[].slice;b.extend({_Deferred:function(){var bu=[],bv,bs,bt,e={done:function(){if(!bt){var bx=arguments,by,bB,bA,bz,bw;if(bv){bw=bv;bv=0}for(by=0,bB=bx.length;by<bB;by++){bA=bx[by];bz=b.type(bA);if(bz==="array"){e.done.apply(e,bA)}else{if(bz==="function"){bu.push(bA)}}}if(bw){e.resolveWith(bw[0],bw[1])}}return this},resolveWith:function(bx,bw){if(!bt&&!bv&&!bs){bw=bw||[];bs=1;try{while(bu[0]){bu.shift().apply(bx,bw)}}finally{bv=[bx,bw];bs=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return !!(bs||bv)},cancel:function(){bt=1;bu=[];return this}};return e},Deferred:function(bs){var e=b._Deferred(),bu=b._Deferred(),bt;b.extend(e,{then:function(bw,bv){e.done(bw).fail(bv);return this},always:function(){return e.done.apply(e,arguments).fail.apply(this,arguments)},fail:bu.done,rejectWith:bu.resolveWith,reject:bu.resolve,isRejected:bu.isResolved,pipe:function(bw,bv){return b.Deferred(function(bx){b.each({done:[bw,"resolve"],fail:[bv,"reject"]},function(bz,bC){var by=bC[0],bB=bC[1],bA;if(b.isFunction(by)){e[bz](function(){bA=by.apply(this,arguments);if(bA&&b.isFunction(bA.promise)){bA.promise().then(bx.resolve,bx.reject)}else{bx[bB](bA)}})}else{e[bz](bx[bB])}})}).promise()},promise:function(bw){if(bw==null){if(bt){return bt}bt=bw={}}var bv=a.length;while(bv--){bw[a[bv]]=e[a[bv]]}return bw}});e.done(bu.cancel).fail(e.cancel);delete e.cancel;if(bs){bs.call(e,e)}return e},when:function(bx){var bs=arguments,bt=0,bw=bs.length,bv=bw,e=bw<=1&&bx&&b.isFunction(bx.promise)?bx:b.Deferred();function bu(by){return function(bz){bs[by]=arguments.length>1?aF.call(arguments,0):bz;if(!(--bv)){e.resolveWith(e,aF.call(bs,0))}}}if(bw>1){for(;bt<bw;bt++){if(bs[bt]&&b.isFunction(bs[bt].promise)){bs[bt].promise().then(bu(bt),e.reject)}else{--bv}}if(!bv){e.resolveWith(e,bs)}}else{if(e!==bx){e.resolveWith(e,bw?[bx]:[])}}return e.promise()}});b.support=(function(){var bC=aq.createElement("div"),bJ=aq.documentElement,bv,bK,bD,bt,bB,bw,bz,bs,bA,bE,by,bI,bG,bu,bx,bF,bL;bC.setAttribute("className","t");bC.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";bv=bC.getElementsByTagName("*");bK=bC.getElementsByTagName("a")[0];if(!bv||!bv.length||!bK){return{}}bD=aq.createElement("select");bt=bD.appendChild(aq.createElement("option"));bB=bC.getElementsByTagName("input")[0];bz={leadingWhitespace:(bC.firstChild.nodeType===3),tbody:!bC.getElementsByTagName("tbody").length,htmlSerialize:!!bC.getElementsByTagName("link").length,style:/top/.test(bK.getAttribute("style")),hrefNormalized:(bK.getAttribute("href")==="/a"),opacity:/^0.55$/.test(bK.style.opacity),cssFloat:!!bK.style.cssFloat,checkOn:(bB.value==="on"),optSelected:bt.selected,getSetAttribute:bC.className!=="t",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};bB.checked=true;bz.noCloneChecked=bB.cloneNode(true).checked;bD.disabled=true;bz.optDisabled=!bt.disabled;try{delete bC.test}catch(bH){bz.deleteExpando=false}if(!bC.addEventListener&&bC.attachEvent&&bC.fireEvent){bC.attachEvent("onclick",function(){bz.noCloneEvent=false});bC.cloneNode(true).fireEvent("onclick")}bB=aq.createElement("input");bB.value="t";bB.setAttribute("type","radio");bz.radioValue=bB.value==="t";bB.setAttribute("checked","checked");bC.appendChild(bB);bs=aq.createDocumentFragment();bs.appendChild(bC.firstChild);bz.checkClone=bs.cloneNode(true).cloneNode(true).lastChild.checked;bC.innerHTML="";bC.style.width=bC.style.paddingLeft="1px";bA=aq.getElementsByTagName("body")[0];by=aq.createElement(bA?"div":"body");bI={visibility:"hidden",width:0,height:0,border:0,margin:0};if(bA){b.extend(bI,{position:"absolute",left:-1000,top:-1000})}for(bF in bI){by.style[bF]=bI[bF]}by.appendChild(bC);bE=bA||bJ;bE.insertBefore(by,bE.firstChild);bz.appendChecked=bB.checked;bz.boxModel=bC.offsetWidth===2;if("zoom" in bC.style){bC.style.display="inline";bC.style.zoom=1;bz.inlineBlockNeedsLayout=(bC.offsetWidth===2);bC.style.display="";bC.innerHTML="<div style='width:4px;'></div>";bz.shrinkWrapBlocks=(bC.offsetWidth!==2)}bC.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";bG=bC.getElementsByTagName("td");bL=(bG[0].offsetHeight===0);bG[0].style.display="";bG[1].style.display="none";bz.reliableHiddenOffsets=bL&&(bG[0].offsetHeight===0);bC.innerHTML="";if(aq.defaultView&&aq.defaultView.getComputedStyle){bw=aq.createElement("div");bw.style.width="0";bw.style.marginRight="0";bC.appendChild(bw);bz.reliableMarginRight=(parseInt((aq.defaultView.getComputedStyle(bw,null)||{marginRight:0}).marginRight,10)||0)===0}by.innerHTML="";bE.removeChild(by);if(bC.attachEvent){for(bF in {submit:1,change:1,focusin:1}){bx="on"+bF;bL=(bx in bC);if(!bL){bC.setAttribute(bx,"return;");bL=(typeof bC[bx]==="function")}bz[bF+"Bubbles"]=bL}}by=bs=bD=bt=bA=bw=bC=bB=null;return bz})();b.boxModel=b.support.boxModel;var aM=/^(?:\{.*\}|\[.*\])$/,aw=/([a-z])([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?b.cache[e[b.expando]]:e[b.expando];return !!e&&!T(e)},data:function(bu,bs,bw,bv){if(!b.acceptData(bu)){return}var bz=b.expando,by=typeof bs==="string",bx,bA=bu.nodeType,e=bA?b.cache:bu,bt=bA?bu[b.expando]:bu[b.expando]&&b.expando;if((!bt||(bv&&bt&&!e[bt][bz]))&&by&&bw===K){return}if(!bt){if(bA){bu[b.expando]=bt=++b.uuid}else{bt=b.expando}}if(!e[bt]){e[bt]={};if(!bA){e[bt].toJSON=b.noop}}if(typeof bs==="object"||typeof bs==="function"){if(bv){e[bt][bz]=b.extend(e[bt][bz],bs)}else{e[bt]=b.extend(e[bt],bs)}}bx=e[bt];if(bv){if(!bx[bz]){bx[bz]={}}bx=bx[bz]}if(bw!==K){bx[b.camelCase(bs)]=bw}if(bs==="events"&&!bx[bs]){return bx[bz]&&bx[bz].events}return by?bx[b.camelCase(bs)]||bx[bs]:bx},removeData:function(bv,bt,bw){if(!b.acceptData(bv)){return}var by=b.expando,bz=bv.nodeType,bs=bz?b.cache:bv,bu=bz?bv[b.expando]:b.expando;if(!bs[bu]){return}if(bt){var bx=bw?bs[bu][by]:bs[bu];if(bx){delete bx[bt];if(!T(bx)){return}}}if(bw){delete bs[bu][by];if(!T(bs[bu])){return}}var e=bs[bu][by];if(b.support.deleteExpando||bs!=a9){delete bs[bu]}else{bs[bu]=null}if(e){bs[bu]={};if(!bz){bs[bu].toJSON=b.noop}bs[bu][by]=e}else{if(bz){if(b.support.deleteExpando){delete bv[b.expando]}else{if(bv.removeAttribute){bv.removeAttribute(b.expando)}else{bv[b.expando]=null}}}}},_data:function(bs,e,bt){return b.data(bs,e,bt,true)},acceptData:function(bs){if(bs.nodeName){var e=b.noData[bs.nodeName.toLowerCase()];if(e){return !(e===true||bs.getAttribute("classid")!==e)}}return true}});b.fn.extend({data:function(bv,bx){var bw=null;if(typeof bv==="undefined"){if(this.length){bw=b.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,bt;for(var bu=0,bs=e.length;bu<bs;bu++){bt=e[bu].name;if(bt.indexOf("data-")===0){bt=b.camelCase(bt.substring(5));a2(this[0],bt,bw[bt])}}}}return bw}else{if(typeof bv==="object"){return this.each(function(){b.data(this,bv)})}}var by=bv.split(".");by[1]=by[1]?"."+by[1]:"";if(bx===K){bw=this.triggerHandler("getData"+by[1]+"!",[by[0]]);if(bw===K&&this.length){bw=b.data(this[0],bv);bw=a2(this[0],bv,bw)}return bw===K&&by[1]?this.data(by[0]):bw}else{return this.each(function(){var bA=b(this),bz=[by[0],bx];bA.triggerHandler("setData"+by[1]+"!",bz);b.data(this,bv,bx);bA.triggerHandler("changeData"+by[1]+"!",bz)})}},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function a2(bu,bt,bv){if(bv===K&&bu.nodeType===1){var bs="data-"+bt.replace(aw,"$1-$2").toLowerCase();bv=bu.getAttribute(bs);if(typeof bv==="string"){try{bv=bv==="true"?true:bv==="false"?false:bv==="null"?null:!b.isNaN(bv)?parseFloat(bv):aM.test(bv)?b.parseJSON(bv):bv}catch(bw){}b.data(bu,bt,bv)}else{bv=K}}return bv}function T(bs){for(var e in bs){if(e!=="toJSON"){return false}}return true}function be(bv,bu,bx){var bt=bu+"defer",bs=bu+"queue",e=bu+"mark",bw=b.data(bv,bt,K,true);if(bw&&(bx==="queue"||!b.data(bv,bs,K,true))&&(bx==="mark"||!b.data(bv,e,K,true))){setTimeout(function(){if(!b.data(bv,bs,K,true)&&!b.data(bv,e,K,true)){b.removeData(bv,bt,true);bw.resolve()}},0)}}b.extend({_mark:function(bs,e){if(bs){e=(e||"fx")+"mark";b.data(bs,e,(b.data(bs,e,K,true)||0)+1,true)}},_unmark:function(bv,bu,bs){if(bv!==true){bs=bu;bu=bv;bv=false}if(bu){bs=bs||"fx";var e=bs+"mark",bt=bv?0:((b.data(bu,e,K,true)||1)-1);if(bt){b.data(bu,e,bt,true)}else{b.removeData(bu,e,true);be(bu,bs,"mark")}}},queue:function(bs,e,bu){if(bs){e=(e||"fx")+"queue";var bt=b.data(bs,e,K,true);if(bu){if(!bt||b.isArray(bu)){bt=b.data(bs,e,b.makeArray(bu),true)}else{bt.push(bu)}}return bt||[]}},dequeue:function(bu,bt){bt=bt||"fx";var e=b.queue(bu,bt),bs=e.shift(),bv;if(bs==="inprogress"){bs=e.shift()}if(bs){if(bt==="fx"){e.unshift("inprogress")}bs.call(bu,function(){b.dequeue(bu,bt)})}if(!e.length){b.removeData(bu,bt+"queue",true);be(bu,bt,"queue")}}});b.fn.extend({queue:function(e,bs){if(typeof e!=="string"){bs=e;e="fx"}if(bs===K){return b.queue(this[0],e)}return this.each(function(){var bt=b.queue(this,e,bs);if(e==="fx"&&bt[0]!=="inprogress"){b.dequeue(this,e)}})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(bs,e){bs=b.fx?b.fx.speeds[bs]||bs:bs;e=e||"fx";return this.queue(e,function(){var bt=this;setTimeout(function(){b.dequeue(bt,e)},bs)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(bA,bt){if(typeof bA!=="string"){bt=bA;bA=K}bA=bA||"fx";var e=b.Deferred(),bs=this,bv=bs.length,by=1,bw=bA+"defer",bx=bA+"queue",bz=bA+"mark",bu;function bB(){if(!(--by)){e.resolveWith(bs,[bs])}}while(bv--){if((bu=b.data(bs[bv],bw,K,true)||(b.data(bs[bv],bx,K,true)||b.data(bs[bv],bz,K,true))&&b.data(bs[bv],bw,b._Deferred(),true))){by++;bu.done(bB)}}bB();return e.promise()}});var aK=/[\n\t\r]/g,ac=/\s+/,aO=/\r/g,g=/^(?:button|input)$/i,D=/^(?:button|input|object|select|textarea)$/i,l=/^a(?:rea)?$/i,ak=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,a5=/\:|^on/,a0,aU;b.fn.extend({attr:function(e,bs){return b.access(this,e,bs,true,b.attr)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,bs){return b.access(this,e,bs,true,b.prop)},removeProp:function(e){e=b.propFix[e]||e;return this.each(function(){try{this[e]=K;delete this[e]}catch(bs){}})},addClass:function(bv){var bx,bt,bs,bu,bw,by,e;if(b.isFunction(bv)){return this.each(function(bz){b(this).addClass(bv.call(this,bz,this.className))})}if(bv&&typeof bv==="string"){bx=bv.split(ac);for(bt=0,bs=this.length;bt<bs;bt++){bu=this[bt];if(bu.nodeType===1){if(!bu.className&&bx.length===1){bu.className=bv}else{bw=" "+bu.className+" ";for(by=0,e=bx.length;by<e;by++){if(!~bw.indexOf(" "+bx[by]+" ")){bw+=bx[by]+" "}}bu.className=b.trim(bw)}}}}return this},removeClass:function(bw){var bx,bt,bs,bv,bu,by,e;if(b.isFunction(bw)){return this.each(function(bz){b(this).removeClass(bw.call(this,bz,this.className))})}if((bw&&typeof bw==="string")||bw===K){bx=(bw||"").split(ac);for(bt=0,bs=this.length;bt<bs;bt++){bv=this[bt];if(bv.nodeType===1&&bv.className){if(bw){bu=(" "+bv.className+" ").replace(aK," ");for(by=0,e=bx.length;by<e;by++){bu=bu.replace(" "+bx[by]+" "," ")}bv.className=b.trim(bu)}else{bv.className=""}}}}return this},toggleClass:function(bu,bs){var bt=typeof bu,e=typeof bs==="boolean";if(b.isFunction(bu)){return this.each(function(bv){b(this).toggleClass(bu.call(this,bv,this.className,bs),bs)})}return this.each(function(){if(bt==="string"){var bx,bw=0,bv=b(this),by=bs,bz=bu.split(ac);while((bx=bz[bw++])){by=e?by:!bv.hasClass(bx);bv[by?"addClass":"removeClass"](bx)}}else{if(bt==="undefined"||bt==="boolean"){if(this.className){b._data(this,"__className__",this.className)}this.className=this.className||bu===false?"":b._data(this,"__className__")||""}}})},hasClass:function(e){var bu=" "+e+" ";for(var bt=0,bs=this.length;bt<bs;bt++){if((" "+this[bt].className+" ").replace(aK," ").indexOf(bu)>-1){return true}}return false},val:function(bu){var e,bs,bt=this[0];if(!arguments.length){if(bt){e=b.valHooks[bt.nodeName.toLowerCase()]||b.valHooks[bt.type];if(e&&"get" in e&&(bs=e.get(bt,"value"))!==K){return bs}bs=bt.value;return typeof bs==="string"?bs.replace(aO,""):bs==null?"":bs}return K}var bv=b.isFunction(bu);return this.each(function(bx){var bw=b(this),by;if(this.nodeType!==1){return}if(bv){by=bu.call(this,bx,bw.val())}else{by=bu}if(by==null){by=""}else{if(typeof by==="number"){by+=""}else{if(b.isArray(by)){by=b.map(by,function(bz){return bz==null?"":bz+""})}}}e=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type];if(!e||!("set" in e)||e.set(this,by,"value")===K){this.value=by}})}});b.extend({valHooks:{option:{get:function(e){var bs=e.attributes.value;return !bs||bs.specified?e.value:e.text}},select:{get:function(e){var bx,bv=e.selectedIndex,by=[],bz=e.options,bu=e.type==="select-one";if(bv<0){return null}for(var bs=bu?bv:0,bw=bu?bv+1:bz.length;bs<bw;bs++){var bt=bz[bs];if(bt.selected&&(b.support.optDisabled?!bt.disabled:bt.getAttribute("disabled")===null)&&(!bt.parentNode.disabled||!b.nodeName(bt.parentNode,"optgroup"))){bx=b(bt).val();if(bu){return bx}by.push(bx)}}if(bu&&!by.length&&bz.length){return b(bz[bv]).val()}return by},set:function(bs,bt){var e=b.makeArray(bt);b(bs).find("option").each(function(){this.selected=b.inArray(b(this).val(),e)>=0});if(!e.length){bs.selectedIndex=-1}return e}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attrFix:{tabindex:"tabIndex"},attr:function(bx,bu,by,bw){var bs=bx.nodeType;if(!bx||bs===3||bs===8||bs===2){return K}if(bw&&bu in b.attrFn){return b(bx)[bu](by)}if(!("getAttribute" in bx)){return b.prop(bx,bu,by)}var bt,e,bv=bs!==1||!b.isXMLDoc(bx);if(bv){bu=b.attrFix[bu]||bu;e=b.attrHooks[bu];if(!e){if(ak.test(bu)){e=aU}else{if(a0&&bu!=="className"&&(b.nodeName(bx,"form")||a5.test(bu))){e=a0}}}}if(by!==K){if(by===null){b.removeAttr(bx,bu);return K}else{if(e&&"set" in e&&bv&&(bt=e.set(bx,by,bu))!==K){return bt}else{bx.setAttribute(bu,""+by);return by}}}else{if(e&&"get" in e&&bv&&(bt=e.get(bx,bu))!==null){return bt}else{bt=bx.getAttribute(bu);return bt===null?K:bt}}},removeAttr:function(bs,e){var bt;if(bs.nodeType===1){e=b.attrFix[e]||e;if(b.support.getSetAttribute){bs.removeAttribute(e)}else{b.attr(bs,e,"");bs.removeAttributeNode(bs.getAttributeNode(e))}if(ak.test(e)&&(bt=b.propFix[e]||e) in bs){bs[bt]=false}}},attrHooks:{type:{set:function(e,bs){if(g.test(e.nodeName)&&e.parentNode){b.error("type property can't be changed")}else{if(!b.support.radioValue&&bs==="radio"&&b.nodeName(e,"input")){var bt=e.value;e.setAttribute("type",bs);if(bt){e.value=bt}return bs}}}},tabIndex:{get:function(bs){var e=bs.getAttributeNode("tabIndex");return e&&e.specified?parseInt(e.value,10):D.test(bs.nodeName)||l.test(bs.nodeName)&&bs.href?0:K}},value:{get:function(bs,e){if(a0&&b.nodeName(bs,"button")){return a0.get(bs,e)}return e in bs?bs.value:null},set:function(bs,bt,e){if(a0&&b.nodeName(bs,"button")){return a0.set(bs,bt,e)}bs.value=bt}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(bw,bu,bx){var bs=bw.nodeType;if(!bw||bs===3||bs===8||bs===2){return K}var bt,e,bv=bs!==1||!b.isXMLDoc(bw);if(bv){bu=b.propFix[bu]||bu;e=b.propHooks[bu]}if(bx!==K){if(e&&"set" in e&&(bt=e.set(bw,bx,bu))!==K){return bt}else{return(bw[bu]=bx)}}else{if(e&&"get" in e&&(bt=e.get(bw,bu))!==K){return bt}else{return bw[bu]}}},propHooks:{}});aU={get:function(bs,e){return b.prop(bs,e)?e.toLowerCase():K},set:function(bs,bu,e){var bt;if(bu===false){b.removeAttr(bs,e)}else{bt=b.propFix[e]||e;if(bt in bs){bs[bt]=true}bs.setAttribute(e,e.toLowerCase())}return e}};if(!b.support.getSetAttribute){b.attrFix=b.propFix;a0=b.attrHooks.name=b.attrHooks.title=b.valHooks.button={get:function(bt,bs){var e;e=bt.getAttributeNode(bs);return e&&e.nodeValue!==""?e.nodeValue:K},set:function(bt,bu,bs){var e=bt.getAttributeNode(bs);if(e){e.nodeValue=bu;return bu}}};b.each(["width","height"],function(bs,e){b.attrHooks[e]=b.extend(b.attrHooks[e],{set:function(bt,bu){if(bu===""){bt.setAttribute(e,"auto");return bu}}})})}if(!b.support.hrefNormalized){b.each(["href","src","width","height"],function(bs,e){b.attrHooks[e]=b.extend(b.attrHooks[e],{get:function(bu){var bt=bu.getAttribute(e,2);return bt===null?K:bt}})})}if(!b.support.style){b.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||K},set:function(e,bs){return(e.style.cssText=""+bs)}}}if(!b.support.optSelected){b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(bs){var e=bs.parentNode;if(e){e.selectedIndex;if(e.parentNode){e.parentNode.selectedIndex}}}})}if(!b.support.checkOn){b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}})}b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,bs){if(b.isArray(bs)){return(e.checked=b.inArray(b(e).val(),bs)>=0)}}})});var aW=/\.(.*)$/,bb=/^(?:textarea|input|select)$/i,N=/\./g,bf=/ /g,aC=/[^\w\s.|`]/g,G=function(e){return e.replace(aC,"\\$&")};b.event={add:function(bu,by,bD,bw){if(bu.nodeType===3||bu.nodeType===8){return}if(bD===false){bD=bh}else{if(!bD){return}}var bs,bC;if(bD.handler){bs=bD;bD=bs.handler}if(!bD.guid){bD.guid=b.guid++}var bz=b._data(bu);if(!bz){return}var bE=bz.events,bx=bz.handle;if(!bE){bz.events=bE={}}if(!bx){bz.handle=bx=function(bF){return typeof b!=="undefined"&&(!bF||b.event.triggered!==bF.type)?b.event.handle.apply(bx.elem,arguments):K}}bx.elem=bu;by=by.split(" ");var bB,bv=0,e;while((bB=by[bv++])){bC=bs?b.extend({},bs):{handler:bD,data:bw};if(bB.indexOf(".")>-1){e=bB.split(".");bB=e.shift();bC.namespace=e.slice(0).sort().join(".")}else{e=[];bC.namespace=""}bC.type=bB;if(!bC.guid){bC.guid=bD.guid}var bt=bE[bB],bA=b.event.special[bB]||{};if(!bt){bt=bE[bB]=[];if(!bA.setup||bA.setup.call(bu,bw,e,bx)===false){if(bu.addEventListener){bu.addEventListener(bB,bx,false)}else{if(bu.attachEvent){bu.attachEvent("on"+bB,bx)}}}}if(bA.add){bA.add.call(bu,bC);if(!bC.handler.guid){bC.handler.guid=bD.guid}}bt.push(bC);b.event.global[bB]=true}bu=null},global:{},remove:function(bG,bB,bt,bx){if(bG.nodeType===3||bG.nodeType===8){return}if(bt===false){bt=bh}var bJ,bw,by,bD,bE=0,bu,bz,bC,bv,bA,e,bI,bF=b.hasData(bG)&&b._data(bG),bs=bF&&bF.events;if(!bF||!bs){return}if(bB&&bB.type){bt=bB.handler;bB=bB.type}if(!bB||typeof bB==="string"&&bB.charAt(0)==="."){bB=bB||"";for(bw in bs){b.event.remove(bG,bw+bB)}return}bB=bB.split(" ");while((bw=bB[bE++])){bI=bw;e=null;bu=bw.indexOf(".")<0;bz=[];if(!bu){bz=bw.split(".");bw=bz.shift();bC=new RegExp("(^|\\.)"+b.map(bz.slice(0).sort(),G).join("\\.(?:.*\\.)?")+"(\\.|$)")}bA=bs[bw];if(!bA){continue}if(!bt){for(bD=0;bD<bA.length;bD++){e=bA[bD];if(bu||bC.test(e.namespace)){b.event.remove(bG,bI,e.handler,bD);bA.splice(bD--,1)}}continue}bv=b.event.special[bw]||{};for(bD=bx||0;bD<bA.length;bD++){e=bA[bD];if(bt.guid===e.guid){if(bu||bC.test(e.namespace)){if(bx==null){bA.splice(bD--,1)}if(bv.remove){bv.remove.call(bG,e)}}if(bx!=null){break}}}if(bA.length===0||bx!=null&&bA.length===1){if(!bv.teardown||bv.teardown.call(bG,bz)===false){b.removeEvent(bG,bw,bF.handle)}bJ=null;delete bs[bw]}}if(b.isEmptyObject(bs)){var bH=bF.handle;if(bH){bH.elem=null}delete bF.events;delete bF.handle;if(b.isEmptyObject(bF)){b.removeData(bG,K,true)}}},customEvent:{getData:true,setData:true,changeData:true},trigger:function(e,by,bw,bD){var bB=e.type||e,bt=[],bs;if(bB.indexOf("!")>=0){bB=bB.slice(0,-1);bs=true}if(bB.indexOf(".")>=0){bt=bB.split(".");bB=bt.shift();bt.sort()}if((!bw||b.event.customEvent[bB])&&!b.event.global[bB]){return}e=typeof e==="object"?e[b.expando]?e:new b.Event(bB,e):new b.Event(bB);e.type=bB;e.exclusive=bs;e.namespace=bt.join(".");e.namespace_re=new RegExp("(^|\\.)"+bt.join("\\.(?:.*\\.)?")+"(\\.|$)");if(bD||!bw){e.preventDefault();e.stopPropagation()}if(!bw){b.each(b.cache,function(){var bF=b.expando,bE=this[bF];if(bE&&bE.events&&bE.events[bB]){b.event.trigger(e,by,bE.handle.elem)}});return}if(bw.nodeType===3||bw.nodeType===8){return}e.result=K;e.target=bw;by=by!=null?b.makeArray(by):[];by.unshift(e);var bC=bw,bu=bB.indexOf(":")<0?"on"+bB:"";do{var bz=b._data(bC,"handle");e.currentTarget=bC;if(bz){bz.apply(bC,by)}if(bu&&b.acceptData(bC)&&bC[bu]&&bC[bu].apply(bC,by)===false){e.result=false;e.preventDefault()}bC=bC.parentNode||bC.ownerDocument||bC===e.target.ownerDocument&&a9}while(bC&&!e.isPropagationStopped());if(!e.isDefaultPrevented()){var bv,bA=b.event.special[bB]||{};if((!bA._default||bA._default.call(bw.ownerDocument,e)===false)&&!(bB==="click"&&b.nodeName(bw,"a"))&&b.acceptData(bw)){try{if(bu&&bw[bB]){bv=bw[bu];if(bv){bw[bu]=null}b.event.triggered=bB;bw[bB]()}}catch(bx){}if(bv){bw[bu]=bv}b.event.triggered=K}}return e.result},handle:function(by){by=b.event.fix(by||a9.event);var bs=((b._data(this,"events")||{})[by.type]||[]).slice(0),bx=!by.exclusive&&!by.namespace,bv=Array.prototype.slice.call(arguments,0);bv[0]=by;by.currentTarget=this;for(var bu=0,e=bs.length;bu<e;bu++){var bw=bs[bu];if(bx||by.namespace_re.test(bw.namespace)){by.handler=bw.handler;by.data=bw.data;by.handleObj=bw;var bt=bw.handler.apply(this,bv);if(bt!==K){by.result=bt;if(bt===false){by.preventDefault();by.stopPropagation()}}if(by.isImmediatePropagationStopped()){break}}}return by.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(bv){if(bv[b.expando]){return bv}var bs=bv;bv=b.Event(bs);for(var bt=this.props.length,bx;bt;){bx=this.props[--bt];bv[bx]=bs[bx]}if(!bv.target){bv.target=bv.srcElement||aq}if(bv.target.nodeType===3){bv.target=bv.target.parentNode}if(!bv.relatedTarget&&bv.fromElement){bv.relatedTarget=bv.fromElement===bv.target?bv.toElement:bv.fromElement}if(bv.pageX==null&&bv.clientX!=null){var bu=bv.target.ownerDocument||aq,bw=bu.documentElement,e=bu.body;bv.pageX=bv.clientX+(bw&&bw.scrollLeft||e&&e.scrollLeft||0)-(bw&&bw.clientLeft||e&&e.clientLeft||0);bv.pageY=bv.clientY+(bw&&bw.scrollTop||e&&e.scrollTop||0)-(bw&&bw.clientTop||e&&e.clientTop||0)}if(bv.which==null&&(bv.charCode!=null||bv.keyCode!=null)){bv.which=bv.charCode!=null?bv.charCode:bv.keyCode}if(!bv.metaKey&&bv.ctrlKey){bv.metaKey=bv.ctrlKey}if(!bv.which&&bv.button!==K){bv.which=(bv.button&1?1:(bv.button&2?3:(bv.button&4?2:0)))}return bv},guid:100000000,proxy:b.proxy,special:{ready:{setup:b.bindReady,teardown:b.noop},live:{add:function(e){b.event.add(this,p(e.origType,e.selector),b.extend({},e,{handler:ai,guid:e.handler.guid}))},remove:function(e){b.event.remove(this,p(e.origType,e.selector),e)}},beforeunload:{setup:function(bt,bs,e){if(b.isWindow(this)){this.onbeforeunload=e}},teardown:function(bs,e){if(this.onbeforeunload===e){this.onbeforeunload=null}}}}};b.removeEvent=aq.removeEventListener?function(bs,e,bt){if(bs.removeEventListener){bs.removeEventListener(e,bt,false)}}:function(bs,e,bt){if(bs.detachEvent){bs.detachEvent("on"+e,bt)}};b.Event=function(bs,e){if(!this.preventDefault){return new b.Event(bs,e)}if(bs&&bs.type){this.originalEvent=bs;this.type=bs.type;this.isDefaultPrevented=(bs.defaultPrevented||bs.returnValue===false||bs.getPreventDefault&&bs.getPreventDefault())?i:bh}else{this.type=bs}if(e){b.extend(this,e)}this.timeStamp=b.now();this[b.expando]=true};function bh(){return false}function i(){return true}b.Event.prototype={preventDefault:function(){this.isDefaultPrevented=i;var bs=this.originalEvent;if(!bs){return}if(bs.preventDefault){bs.preventDefault()}else{bs.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=i;var bs=this.originalEvent;if(!bs){return}if(bs.stopPropagation){bs.stopPropagation()}bs.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=i;this.stopPropagation()},isDefaultPrevented:bh,isPropagationStopped:bh,isImmediatePropagationStopped:bh};var ab=function(bt){var bu=bt.relatedTarget,e=false,bs=bt.type;bt.type=bt.data;if(bu!==this){if(bu){e=b.contains(this,bu)}if(!e){b.event.handle.apply(this,arguments);bt.type=bs}}},aR=function(e){e.type=e.data;b.event.handle.apply(this,arguments)};b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(bs,e){b.event.special[bs]={setup:function(bt){b.event.add(this,e,bt&&bt.selector?aR:ab,bs)},teardown:function(bt){b.event.remove(this,e,bt&&bt.selector?aR:ab)}}});if(!b.support.submitBubbles){b.event.special.submit={setup:function(bs,e){if(!b.nodeName(this,"form")){b.event.add(this,"click.specialSubmit",function(bv){var bu=bv.target,bt=bu.type;if((bt==="submit"||bt==="image")&&b(bu).closest("form").length){aT("submit",this,arguments)}});b.event.add(this,"keypress.specialSubmit",function(bv){var bu=bv.target,bt=bu.type;if((bt==="text"||bt==="password")&&b(bu).closest("form").length&&bv.keyCode===13){aT("submit",this,arguments)}})}else{return false}},teardown:function(e){b.event.remove(this,".specialSubmit")}}}if(!b.support.changeBubbles){var bk,k=function(bs){var e=bs.type,bt=bs.value;if(e==="radio"||e==="checkbox"){bt=bs.checked}else{if(e==="select-multiple"){bt=bs.selectedIndex>-1?b.map(bs.options,function(bu){return bu.selected}).join("-"):""}else{if(b.nodeName(bs,"select")){bt=bs.selectedIndex}}}return bt},Z=function Z(bu){var bs=bu.target,bt,bv;if(!bb.test(bs.nodeName)||bs.readOnly){return}bt=b._data(bs,"_change_data");bv=k(bs);if(bu.type!=="focusout"||bs.type!=="radio"){b._data(bs,"_change_data",bv)}if(bt===K||bv===bt){return}if(bt!=null||bv){bu.type="change";bu.liveFired=K;b.event.trigger(bu,arguments[1],bs)}};b.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(bu){var bt=bu.target,bs=b.nodeName(bt,"input")?bt.type:"";if(bs==="radio"||bs==="checkbox"||b.nodeName(bt,"select")){Z.call(this,bu)}},keydown:function(bu){var bt=bu.target,bs=b.nodeName(bt,"input")?bt.type:"";if((bu.keyCode===13&&!b.nodeName(bt,"textarea"))||(bu.keyCode===32&&(bs==="checkbox"||bs==="radio"))||bs==="select-multiple"){Z.call(this,bu)}},beforeactivate:function(bt){var bs=bt.target;b._data(bs,"_change_data",k(bs))}},setup:function(bt,bs){if(this.type==="file"){return false}for(var e in bk){b.event.add(this,e+".specialChange",bk[e])}return bb.test(this.nodeName)},teardown:function(e){b.event.remove(this,".specialChange");return bb.test(this.nodeName)}};bk=b.event.special.change.filters;bk.focus=bk.beforeactivate}function aT(bs,bu,e){var bt=b.extend({},e[0]);bt.type=bs;bt.originalEvent={};bt.liveFired=K;b.event.handle.call(bu,bt);if(bt.isDefaultPrevented()){e[0].preventDefault()}}if(!b.support.focusinBubbles){b.each({focus:"focusin",blur:"focusout"},function(bu,e){var bs=0;b.event.special[e]={setup:function(){if(bs++===0){aq.addEventListener(bu,bt,true)}},teardown:function(){if(--bs===0){aq.removeEventListener(bu,bt,true)}}};function bt(bv){var bw=b.event.fix(bv);bw.type=e;bw.originalEvent={};b.event.trigger(bw,null,bw.target);if(bw.isDefaultPrevented()){bv.preventDefault()}}})}b.each(["bind","one"],function(bs,e){b.fn[e]=function(by,bz,bx){var bw;if(typeof by==="object"){for(var bv in by){this[e](bv,bz,by[bv],bx)}return this}if(arguments.length===2||bz===false){bx=bz;bz=K}if(e==="one"){bw=function(bA){b(this).unbind(bA,bw);return bx.apply(this,arguments)};bw.guid=bx.guid||b.guid++}else{bw=bx}if(by==="unload"&&e!=="one"){this.one(by,bz,bx)}else{for(var bu=0,bt=this.length;bu<bt;bu++){b.event.add(this[bu],by,bw,bz)}}return this}});b.fn.extend({unbind:function(bv,bu){if(typeof bv==="object"&&!bv.preventDefault){for(var bt in bv){this.unbind(bt,bv[bt])}}else{for(var bs=0,e=this.length;bs<e;bs++){b.event.remove(this[bs],bv,bu)}}return this},delegate:function(e,bs,bu,bt){return this.live(bs,bu,bt,e)},undelegate:function(e,bs,bt){if(arguments.length===0){return this.unbind("live")}else{return this.die(bs,null,bt,e)}},trigger:function(e,bs){return this.each(function(){b.event.trigger(e,bs,this)})},triggerHandler:function(e,bs){if(this[0]){return b.event.trigger(e,bs,this[0],true)}},toggle:function(bu){var bs=arguments,e=bu.guid||b.guid++,bt=0,bv=function(bw){var bx=(b.data(this,"lastToggle"+bu.guid)||0)%bt;b.data(this,"lastToggle"+bu.guid,bx+1);bw.preventDefault();return bs[bx].apply(this,arguments)||false};bv.guid=e;while(bt<bs.length){bs[bt++].guid=e}return this.click(bv)},hover:function(e,bs){return this.mouseenter(e).mouseleave(bs||e)}});var aP={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};b.each(["live","die"],function(bs,e){b.fn[e]=function(bC,bz,bE,bv){var bD,bA=0,bB,bu,bG,bx=bv||this.selector,bt=bv?this:b(this.context);if(typeof bC==="object"&&!bC.preventDefault){for(var bF in bC){bt[e](bF,bz,bC[bF],bx)}return this}if(e==="die"&&!bC&&bv&&bv.charAt(0)==="."){bt.unbind(bv);return this}if(bz===false||b.isFunction(bz)){bE=bz||bh;bz=K}bC=(bC||"").split(" ");while((bD=bC[bA++])!=null){bB=aW.exec(bD);bu="";if(bB){bu=bB[0];bD=bD.replace(aW,"")}if(bD==="hover"){bC.push("mouseenter"+bu,"mouseleave"+bu);continue}bG=bD;if(aP[bD]){bC.push(aP[bD]+bu);bD=bD+bu}else{bD=(aP[bD]||bD)+bu}if(e==="live"){for(var by=0,bw=bt.length;by<bw;by++){b.event.add(bt[by],"live."+p(bD,bx),{data:bz,selector:bx,handler:bE,origType:bD,origHandler:bE,preType:bG})}}else{bt.unbind("live."+p(bD,bx),bE)}}return this}});function ai(bC){var bz,bu,bI,bw,e,bE,bB,bD,bA,bH,by,bx,bG,bF=[],bv=[],bs=b._data(this,"events");if(bC.liveFired===this||!bs||!bs.live||bC.target.disabled||bC.button&&bC.type==="click"){return}if(bC.namespace){bx=new RegExp("(^|\\.)"+bC.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")}bC.liveFired=this;var bt=bs.live.slice(0);for(bB=0;bB<bt.length;bB++){e=bt[bB];if(e.origType.replace(aW,"")===bC.type){bv.push(e.selector)}else{bt.splice(bB--,1)}}bw=b(bC.target).closest(bv,bC.currentTarget);for(bD=0,bA=bw.length;bD<bA;bD++){by=bw[bD];for(bB=0;bB<bt.length;bB++){e=bt[bB];if(by.selector===e.selector&&(!bx||bx.test(e.namespace))&&!by.elem.disabled){bE=by.elem;bI=null;if(e.preType==="mouseenter"||e.preType==="mouseleave"){bC.type=e.preType;bI=b(bC.relatedTarget).closest(e.selector)[0];if(bI&&b.contains(bE,bI)){bI=bE}}if(!bI||bI!==bE){bF.push({elem:bE,handleObj:e,level:by.level})}}}}for(bD=0,bA=bF.length;bD<bA;bD++){bw=bF[bD];if(bu&&bw.level>bu){break}bC.currentTarget=bw.elem;bC.data=bw.handleObj.data;bC.handleObj=bw.handleObj;bG=bw.handleObj.origHandler.apply(bw.elem,arguments);if(bG===false||bC.isPropagationStopped()){bu=bw.level;if(bG===false){bz=false}if(bC.isImmediatePropagationStopped()){break}}}return bz}function p(bs,e){return(bs&&bs!=="*"?bs+".":"")+e.replace(N,"`").replace(bf,"&")}b.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").split(" "),function(bs,e){b.fn[e]=function(bu,bt){if(bt==null){bt=bu;bu=null}return arguments.length>0?this.bind(e,bu,bt):this.trigger(e)};if(b.attrFn){b.attrFn[e]=true}});
/*!
 * Sizzle CSS Selector Engine
 *  Copyright 2011, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var bC=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bD=0,bG=Object.prototype.toString,bx=false,bw=true,bE=/\\/g,bK=/\W/;[0,0].sort(function(){bw=false;return 0});var bu=function(bP,e,bS,bT){bS=bS||[];e=e||aq;var bV=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bP||typeof bP!=="string"){return bS}var bM,bX,b0,bL,bW,bZ,bY,bR,bO=true,bN=bu.isXML(e),bQ=[],bU=bP;do{bC.exec("");bM=bC.exec(bU);if(bM){bU=bM[3];bQ.push(bM[1]);if(bM[2]){bL=bM[3];break}}}while(bM);if(bQ.length>1&&by.exec(bP)){if(bQ.length===2&&bz.relative[bQ[0]]){bX=bH(bQ[0]+bQ[1],e)}else{bX=bz.relative[bQ[0]]?[e]:bu(bQ.shift(),e);while(bQ.length){bP=bQ.shift();if(bz.relative[bP]){bP+=bQ.shift()}bX=bH(bP,bX)}}}else{if(!bT&&bQ.length>1&&e.nodeType===9&&!bN&&bz.match.ID.test(bQ[0])&&!bz.match.ID.test(bQ[bQ.length-1])){bW=bu.find(bQ.shift(),e,bN);e=bW.expr?bu.filter(bW.expr,bW.set)[0]:bW.set[0]}if(e){bW=bT?{expr:bQ.pop(),set:bA(bT)}:bu.find(bQ.pop(),bQ.length===1&&(bQ[0]==="~"||bQ[0]==="+")&&e.parentNode?e.parentNode:e,bN);bX=bW.expr?bu.filter(bW.expr,bW.set):bW.set;if(bQ.length>0){b0=bA(bX)}else{bO=false}while(bQ.length){bZ=bQ.pop();bY=bZ;if(!bz.relative[bZ]){bZ=""}else{bY=bQ.pop()}if(bY==null){bY=e}bz.relative[bZ](b0,bY,bN)}}else{b0=bQ=[]}}if(!b0){b0=bX}if(!b0){bu.error(bZ||bP)}if(bG.call(b0)==="[object Array]"){if(!bO){bS.push.apply(bS,b0)}else{if(e&&e.nodeType===1){for(bR=0;b0[bR]!=null;bR++){if(b0[bR]&&(b0[bR]===true||b0[bR].nodeType===1&&bu.contains(e,b0[bR]))){bS.push(bX[bR])}}}else{for(bR=0;b0[bR]!=null;bR++){if(b0[bR]&&b0[bR].nodeType===1){bS.push(bX[bR])}}}}}else{bA(b0,bS)}if(bL){bu(bL,bV,bS,bT);bu.uniqueSort(bS)}return bS};bu.uniqueSort=function(bL){if(bF){bx=bw;bL.sort(bF);if(bx){for(var e=1;e<bL.length;e++){if(bL[e]===bL[e-1]){bL.splice(e--,1)}}}}return bL};bu.matches=function(e,bL){return bu(e,null,null,bL)};bu.matchesSelector=function(e,bL){return bu(bL,null,null,[e]).length>0};bu.find=function(bR,e,bS){var bQ;if(!bR){return[]}for(var bN=0,bM=bz.order.length;bN<bM;bN++){var bO,bP=bz.order[bN];if((bO=bz.leftMatch[bP].exec(bR))){var bL=bO[1];bO.splice(1,1);if(bL.substr(bL.length-1)!=="\\"){bO[1]=(bO[1]||"").replace(bE,"");bQ=bz.find[bP](bO,e,bS);if(bQ!=null){bR=bR.replace(bz.match[bP],"");break}}}}if(!bQ){bQ=typeof e.getElementsByTagName!=="undefined"?e.getElementsByTagName("*"):[]}return{set:bQ,expr:bR}};bu.filter=function(bV,bU,bY,bO){var bQ,e,bM=bV,b0=[],bS=bU,bR=bU&&bU[0]&&bu.isXML(bU[0]);while(bV&&bU.length){for(var bT in bz.filter){if((bQ=bz.leftMatch[bT].exec(bV))!=null&&bQ[2]){var bZ,bX,bL=bz.filter[bT],bN=bQ[1];e=false;bQ.splice(1,1);if(bN.substr(bN.length-1)==="\\"){continue}if(bS===b0){b0=[]}if(bz.preFilter[bT]){bQ=bz.preFilter[bT](bQ,bS,bY,b0,bO,bR);if(!bQ){e=bZ=true}else{if(bQ===true){continue}}}if(bQ){for(var bP=0;(bX=bS[bP])!=null;bP++){if(bX){bZ=bL(bX,bQ,bP,bS);var bW=bO^!!bZ;if(bY&&bZ!=null){if(bW){e=true}else{bS[bP]=false}}else{if(bW){b0.push(bX);e=true}}}}}if(bZ!==K){if(!bY){bS=b0}bV=bV.replace(bz.match[bT],"");if(!e){return[]}break}}}if(bV===bM){if(e==null){bu.error(bV)}else{break}}bM=bV}return bS};bu.error=function(e){throw"Syntax error, unrecognized expression: "+e};var bz=bu.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(bQ,bL){var bN=typeof bL==="string",bP=bN&&!bK.test(bL),bR=bN&&!bP;if(bP){bL=bL.toLowerCase()}for(var bM=0,e=bQ.length,bO;bM<e;bM++){if((bO=bQ[bM])){while((bO=bO.previousSibling)&&bO.nodeType!==1){}bQ[bM]=bR||bO&&bO.nodeName.toLowerCase()===bL?bO||false:bO===bL}}if(bR){bu.filter(bL,bQ,true)}},">":function(bQ,bL){var bP,bO=typeof bL==="string",bM=0,e=bQ.length;if(bO&&!bK.test(bL)){bL=bL.toLowerCase();for(;bM<e;bM++){bP=bQ[bM];if(bP){var bN=bP.parentNode;bQ[bM]=bN.nodeName.toLowerCase()===bL?bN:false}}}else{for(;bM<e;bM++){bP=bQ[bM];if(bP){bQ[bM]=bO?bP.parentNode:bP.parentNode===bL}}if(bO){bu.filter(bL,bQ,true)}}},"":function(bN,bL,bP){var bO,bM=bD++,e=bI;if(typeof bL==="string"&&!bK.test(bL)){bL=bL.toLowerCase();bO=bL;e=bs}e("parentNode",bL,bM,bN,bO,bP)},"~":function(bN,bL,bP){var bO,bM=bD++,e=bI;if(typeof bL==="string"&&!bK.test(bL)){bL=bL.toLowerCase();bO=bL;e=bs}e("previousSibling",bL,bM,bN,bO,bP)}},find:{ID:function(bL,bM,bN){if(typeof bM.getElementById!=="undefined"&&!bN){var e=bM.getElementById(bL[1]);return e&&e.parentNode?[e]:[]}},NAME:function(bM,bP){if(typeof bP.getElementsByName!=="undefined"){var bL=[],bO=bP.getElementsByName(bM[1]);for(var bN=0,e=bO.length;bN<e;bN++){if(bO[bN].getAttribute("name")===bM[1]){bL.push(bO[bN])}}return bL.length===0?null:bL}},TAG:function(e,bL){if(typeof bL.getElementsByTagName!=="undefined"){return bL.getElementsByTagName(e[1])}}},preFilter:{CLASS:function(bN,bL,bM,e,bQ,bR){bN=" "+bN[1].replace(bE,"")+" ";if(bR){return bN}for(var bO=0,bP;(bP=bL[bO])!=null;bO++){if(bP){if(bQ^(bP.className&&(" "+bP.className+" ").replace(/[\t\n\r]/g," ").indexOf(bN)>=0)){if(!bM){e.push(bP)}}else{if(bM){bL[bO]=false}}}}return false},ID:function(e){return e[1].replace(bE,"")},TAG:function(bL,e){return bL[1].replace(bE,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){bu.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bL=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bL[1]+(bL[2]||1))-0;e[3]=bL[3]-0}else{if(e[2]){bu.error(e[0])}}e[0]=bD++;return e},ATTR:function(bO,bL,bM,e,bP,bQ){var bN=bO[1]=bO[1].replace(bE,"");if(!bQ&&bz.attrMap[bN]){bO[1]=bz.attrMap[bN]}bO[4]=(bO[4]||bO[5]||"").replace(bE,"");if(bO[2]==="~="){bO[4]=" "+bO[4]+" "}return bO},PSEUDO:function(bO,bL,bM,e,bP){if(bO[1]==="not"){if((bC.exec(bO[3])||"").length>1||/^\w/.test(bO[3])){bO[3]=bu(bO[3],null,null,bL)}else{var bN=bu.filter(bO[3],bL,bM,true^bP);if(!bM){e.push.apply(e,bN)}return false}}else{if(bz.match.POS.test(bO[0])||bz.match.CHILD.test(bO[0])){return true}}return bO},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bM,bL,e){return !!bu(e[3],bM).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(bM){var e=bM.getAttribute("type"),bL=bM.type;return bM.nodeName.toLowerCase()==="input"&&"text"===bL&&(e===bL||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(bL){var e=bL.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===bL.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(bL){var e=bL.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===bL.type},button:function(bL){var e=bL.nodeName.toLowerCase();return e==="input"&&"button"===bL.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(bL,e){return e===0},last:function(bM,bL,e,bN){return bL===bN.length-1},even:function(bL,e){return e%2===0},odd:function(bL,e){return e%2===1},lt:function(bM,bL,e){return bL<e[3]-0},gt:function(bM,bL,e){return bL>e[3]-0},nth:function(bM,bL,e){return e[3]-0===bL},eq:function(bM,bL,e){return e[3]-0===bL}},filter:{PSEUDO:function(bM,bR,bQ,bS){var e=bR[1],bL=bz.filters[e];if(bL){return bL(bM,bQ,bR,bS)}else{if(e==="contains"){return(bM.textContent||bM.innerText||bu.getText([bM])||"").indexOf(bR[3])>=0}else{if(e==="not"){var bN=bR[3];for(var bP=0,bO=bN.length;bP<bO;bP++){if(bN[bP]===bM){return false}}return true}else{bu.error(e)}}}},CHILD:function(e,bN){var bQ=bN[1],bL=e;switch(bQ){case"only":case"first":while((bL=bL.previousSibling)){if(bL.nodeType===1){return false}}if(bQ==="first"){return true}bL=e;case"last":while((bL=bL.nextSibling)){if(bL.nodeType===1){return false}}return true;case"nth":var bM=bN[2],bT=bN[3];if(bM===1&&bT===0){return true}var bP=bN[0],bS=e.parentNode;if(bS&&(bS.sizcache!==bP||!e.nodeIndex)){var bO=0;for(bL=bS.firstChild;bL;bL=bL.nextSibling){if(bL.nodeType===1){bL.nodeIndex=++bO}}bS.sizcache=bP}var bR=e.nodeIndex-bT;if(bM===0){return bR===0}else{return(bR%bM===0&&bR/bM>=0)}}},ID:function(bL,e){return bL.nodeType===1&&bL.getAttribute("id")===e},TAG:function(bL,e){return(e==="*"&&bL.nodeType===1)||bL.nodeName.toLowerCase()===e},CLASS:function(bL,e){return(" "+(bL.className||bL.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bP,bN){var bM=bN[1],e=bz.attrHandle[bM]?bz.attrHandle[bM](bP):bP[bM]!=null?bP[bM]:bP.getAttribute(bM),bQ=e+"",bO=bN[2],bL=bN[4];return e==null?bO==="!=":bO==="="?bQ===bL:bO==="*="?bQ.indexOf(bL)>=0:bO==="~="?(" "+bQ+" ").indexOf(bL)>=0:!bL?bQ&&e!==false:bO==="!="?bQ!==bL:bO==="^="?bQ.indexOf(bL)===0:bO==="$="?bQ.substr(bQ.length-bL.length)===bL:bO==="|="?bQ===bL||bQ.substr(0,bL.length+1)===bL+"-":false},POS:function(bO,bL,bM,bP){var e=bL[2],bN=bz.setFilters[e];if(bN){return bN(bO,bM,bL,bP)}}}};var by=bz.match.POS,bt=function(bL,e){return"\\"+(e-0+1)};for(var bv in bz.match){bz.match[bv]=new RegExp(bz.match[bv].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bz.leftMatch[bv]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bz.match[bv].source.replace(/\\(\d+)/g,bt))}var bA=function(bL,e){bL=Array.prototype.slice.call(bL,0);if(e){e.push.apply(e,bL);return e}return bL};try{Array.prototype.slice.call(aq.documentElement.childNodes,0)[0].nodeType}catch(bJ){bA=function(bO,bN){var bM=0,bL=bN||[];if(bG.call(bO)==="[object Array]"){Array.prototype.push.apply(bL,bO)}else{if(typeof bO.length==="number"){for(var e=bO.length;bM<e;bM++){bL.push(bO[bM])}}else{for(;bO[bM];bM++){bL.push(bO[bM])}}}return bL}}var bF,bB;if(aq.documentElement.compareDocumentPosition){bF=function(bL,e){if(bL===e){bx=true;return 0}if(!bL.compareDocumentPosition||!e.compareDocumentPosition){return bL.compareDocumentPosition?-1:1}return bL.compareDocumentPosition(e)&4?-1:1}}else{bF=function(bS,bR){if(bS===bR){bx=true;return 0}else{if(bS.sourceIndex&&bR.sourceIndex){return bS.sourceIndex-bR.sourceIndex}}var bP,bL,bM=[],e=[],bO=bS.parentNode,bQ=bR.parentNode,bT=bO;if(bO===bQ){return bB(bS,bR)}else{if(!bO){return -1}else{if(!bQ){return 1}}}while(bT){bM.unshift(bT);bT=bT.parentNode}bT=bQ;while(bT){e.unshift(bT);bT=bT.parentNode}bP=bM.length;bL=e.length;for(var bN=0;bN<bP&&bN<bL;bN++){if(bM[bN]!==e[bN]){return bB(bM[bN],e[bN])}}return bN===bP?bB(bS,e[bN],-1):bB(bM[bN],bR,1)};bB=function(bL,e,bM){if(bL===e){return bM}var bN=bL.nextSibling;while(bN){if(bN===e){return -1}bN=bN.nextSibling}return 1}}bu.getText=function(e){var bL="",bN;for(var bM=0;e[bM];bM++){bN=e[bM];if(bN.nodeType===3||bN.nodeType===4){bL+=bN.nodeValue}else{if(bN.nodeType!==8){bL+=bu.getText(bN.childNodes)}}}return bL};(function(){var bL=aq.createElement("div"),bM="script"+(new Date()).getTime(),e=aq.documentElement;bL.innerHTML="<a name='"+bM+"'/>";e.insertBefore(bL,e.firstChild);if(aq.getElementById(bM)){bz.find.ID=function(bO,bP,bQ){if(typeof bP.getElementById!=="undefined"&&!bQ){var bN=bP.getElementById(bO[1]);return bN?bN.id===bO[1]||typeof bN.getAttributeNode!=="undefined"&&bN.getAttributeNode("id").nodeValue===bO[1]?[bN]:K:[]}};bz.filter.ID=function(bP,bN){var bO=typeof bP.getAttributeNode!=="undefined"&&bP.getAttributeNode("id");return bP.nodeType===1&&bO&&bO.nodeValue===bN}}e.removeChild(bL);e=bL=null})();(function(){var e=aq.createElement("div");e.appendChild(aq.createComment(""));if(e.getElementsByTagName("*").length>0){bz.find.TAG=function(bL,bP){var bO=bP.getElementsByTagName(bL[1]);if(bL[1]==="*"){var bN=[];for(var bM=0;bO[bM];bM++){if(bO[bM].nodeType===1){bN.push(bO[bM])}}bO=bN}return bO}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bz.attrHandle.href=function(bL){return bL.getAttribute("href",2)}}e=null})();if(aq.querySelectorAll){(function(){var e=bu,bN=aq.createElement("div"),bM="__sizzle__";bN.innerHTML="<p class='TEST'></p>";if(bN.querySelectorAll&&bN.querySelectorAll(".TEST").length===0){return}bu=function(bY,bP,bT,bX){bP=bP||aq;if(!bX&&!bu.isXML(bP)){var bW=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(bY);if(bW&&(bP.nodeType===1||bP.nodeType===9)){if(bW[1]){return bA(bP.getElementsByTagName(bY),bT)}else{if(bW[2]&&bz.find.CLASS&&bP.getElementsByClassName){return bA(bP.getElementsByClassName(bW[2]),bT)}}}if(bP.nodeType===9){if(bY==="body"&&bP.body){return bA([bP.body],bT)}else{if(bW&&bW[3]){var bS=bP.getElementById(bW[3]);if(bS&&bS.parentNode){if(bS.id===bW[3]){return bA([bS],bT)}}else{return bA([],bT)}}}try{return bA(bP.querySelectorAll(bY),bT)}catch(bU){}}else{if(bP.nodeType===1&&bP.nodeName.toLowerCase()!=="object"){var bQ=bP,bR=bP.getAttribute("id"),bO=bR||bM,b0=bP.parentNode,bZ=/^\s*[+~]/.test(bY);if(!bR){bP.setAttribute("id",bO)}else{bO=bO.replace(/'/g,"\\$&")}if(bZ&&b0){bP=bP.parentNode}try{if(!bZ||b0){return bA(bP.querySelectorAll("[id='"+bO+"'] "+bY),bT)}}catch(bV){}finally{if(!bR){bQ.removeAttribute("id")}}}}}return e(bY,bP,bT,bX)};for(var bL in e){bu[bL]=e[bL]}bN=null})()}(function(){var e=aq.documentElement,bM=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(bM){var bO=!bM.call(aq.createElement("div"),"div"),bL=false;try{bM.call(aq.documentElement,"[test!='']:sizzle")}catch(bN){bL=true}bu.matchesSelector=function(bQ,bS){bS=bS.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!bu.isXML(bQ)){try{if(bL||!bz.match.PSEUDO.test(bS)&&!/!=/.test(bS)){var bP=bM.call(bQ,bS);if(bP||!bO||bQ.document&&bQ.document.nodeType!==11){return bP}}}catch(bR){}}return bu(bS,null,null,[bQ]).length>0}}})();(function(){var e=aq.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bz.order.splice(1,0,"CLASS");bz.find.CLASS=function(bL,bM,bN){if(typeof bM.getElementsByClassName!=="undefined"&&!bN){return bM.getElementsByClassName(bL[1])}};e=null})();function bs(bL,bQ,bP,bT,bR,bS){for(var bN=0,bM=bT.length;bN<bM;bN++){var e=bT[bN];if(e){var bO=false;e=e[bL];while(e){if(e.sizcache===bP){bO=bT[e.sizset];break}if(e.nodeType===1&&!bS){e.sizcache=bP;e.sizset=bN}if(e.nodeName.toLowerCase()===bQ){bO=e;break}e=e[bL]}bT[bN]=bO}}}function bI(bL,bQ,bP,bT,bR,bS){for(var bN=0,bM=bT.length;bN<bM;bN++){var e=bT[bN];if(e){var bO=false;e=e[bL];while(e){if(e.sizcache===bP){bO=bT[e.sizset];break}if(e.nodeType===1){if(!bS){e.sizcache=bP;e.sizset=bN}if(typeof bQ!=="string"){if(e===bQ){bO=true;break}}else{if(bu.filter(bQ,[e]).length>0){bO=e;break}}}e=e[bL]}bT[bN]=bO}}}if(aq.documentElement.contains){bu.contains=function(bL,e){return bL!==e&&(bL.contains?bL.contains(e):true)}}else{if(aq.documentElement.compareDocumentPosition){bu.contains=function(bL,e){return !!(bL.compareDocumentPosition(e)&16)}}else{bu.contains=function(){return false}}}bu.isXML=function(e){var bL=(e?e.ownerDocument||e:0).documentElement;return bL?bL.nodeName!=="HTML":false};var bH=function(e,bR){var bP,bN=[],bO="",bM=bR.nodeType?[bR]:bR;while((bP=bz.match.PSEUDO.exec(e))){bO+=bP[0];e=e.replace(bz.match.PSEUDO,"")}e=bz.relative[e]?e+"*":e;for(var bQ=0,bL=bM.length;bQ<bL;bQ++){bu(e,bM[bQ],bN)}return bu.filter(bO,bN)};b.find=bu;b.expr=bu.selectors;b.expr[":"]=b.expr.filters;b.unique=bu.uniqueSort;b.text=bu.getText;b.isXMLDoc=bu.isXML;b.contains=bu.contains})();var Y=/Until$/,am=/^(?:parents|prevUntil|prevAll)/,a7=/,/,bn=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,H=b.expr.match.POS,au={children:true,contents:true,next:true,prev:true};b.fn.extend({find:function(e){var bt=this,bv,bs;if(typeof e!=="string"){return b(e).filter(function(){for(bv=0,bs=bt.length;bv<bs;bv++){if(b.contains(bt[bv],this)){return true}}})}var bu=this.pushStack("","find",e),bx,by,bw;for(bv=0,bs=this.length;bv<bs;bv++){bx=bu.length;b.find(e,this[bv],bu);if(bv>0){for(by=bx;by<bu.length;by++){for(bw=0;bw<bx;bw++){if(bu[bw]===bu[by]){bu.splice(by--,1);break}}}}}return bu},has:function(bs){var e=b(bs);return this.filter(function(){for(var bu=0,bt=e.length;bu<bt;bu++){if(b.contains(this,e[bu])){return true}}})},not:function(e){return this.pushStack(aB(this,e,false),"not",e)},filter:function(e){return this.pushStack(aB(this,e,true),"filter",e)},is:function(e){return !!e&&(typeof e==="string"?b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(bB,bs){var by=[],bv,bt,bA=this[0];if(b.isArray(bB)){var bx,bu,bw={},e=1;if(bA&&bB.length){for(bv=0,bt=bB.length;bv<bt;bv++){bu=bB[bv];if(!bw[bu]){bw[bu]=H.test(bu)?b(bu,bs||this.context):bu}}while(bA&&bA.ownerDocument&&bA!==bs){for(bu in bw){bx=bw[bu];if(bx.jquery?bx.index(bA)>-1:b(bA).is(bx)){by.push({selector:bu,elem:bA,level:e})}}bA=bA.parentNode;e++}}return by}var bz=H.test(bB)||typeof bB!=="string"?b(bB,bs||this.context):0;for(bv=0,bt=this.length;bv<bt;bv++){bA=this[bv];while(bA){if(bz?bz.index(bA)>-1:b.find.matchesSelector(bA,bB)){by.push(bA);break}else{bA=bA.parentNode;if(!bA||!bA.ownerDocument||bA===bs||bA.nodeType===11){break}}}}by=by.length>1?b.unique(by):by;return this.pushStack(by,"closest",bB)},index:function(e){if(!e||typeof e==="string"){return b.inArray(this[0],e?b(e):this.parent().children())}return b.inArray(e.jquery?e[0]:e,this)},add:function(e,bs){var bu=typeof e==="string"?b(e,bs):b.makeArray(e&&e.nodeType?[e]:e),bt=b.merge(this.get(),bu);return this.pushStack(C(bu[0])||C(bt[0])?bt:b.unique(bt))},andSelf:function(){return this.add(this.prevObject)}});function C(e){return !e||!e.parentNode||e.parentNode.nodeType===11}b.each({parent:function(bs){var e=bs.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(bs,e,bt){return b.dir(bs,"parentNode",bt)},next:function(e){return b.nth(e,2,"nextSibling")},prev:function(e){return b.nth(e,2,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(bs,e,bt){return b.dir(bs,"nextSibling",bt)},prevUntil:function(bs,e,bt){return b.dir(bs,"previousSibling",bt)},siblings:function(e){return b.sibling(e.parentNode.firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.makeArray(e.childNodes)}},function(e,bs){b.fn[e]=function(bw,bt){var bv=b.map(this,bs,bw),bu=P.call(arguments);if(!Y.test(e)){bt=bw}if(bt&&typeof bt==="string"){bv=b.filter(bt,bv)}bv=this.length>1&&!au[e]?b.unique(bv):bv;if((this.length>1||a7.test(bt))&&am.test(e)){bv=bv.reverse()}return this.pushStack(bv,e,bu.join(","))}});b.extend({filter:function(bt,e,bs){if(bs){bt=":not("+bt+")"}return e.length===1?b.find.matchesSelector(e[0],bt)?[e[0]]:[]:b.find.matches(bt,e)},dir:function(bt,bs,bv){var e=[],bu=bt[bs];while(bu&&bu.nodeType!==9&&(bv===K||bu.nodeType!==1||!b(bu).is(bv))){if(bu.nodeType===1){e.push(bu)}bu=bu[bs]}return e},nth:function(bv,e,bt,bu){e=e||1;var bs=0;for(;bv;bv=bv[bt]){if(bv.nodeType===1&&++bs===e){break}}return bv},sibling:function(bt,bs){var e=[];for(;bt;bt=bt.nextSibling){if(bt.nodeType===1&&bt!==bs){e.push(bt)}}return e}});function aB(bu,bt,e){bt=bt||0;if(b.isFunction(bt)){return b.grep(bu,function(bw,bv){var bx=!!bt.call(bw,bv,bw);return bx===e})}else{if(bt.nodeType){return b.grep(bu,function(bw,bv){return(bw===bt)===e})}else{if(typeof bt==="string"){var bs=b.grep(bu,function(bv){return bv.nodeType===1});if(bn.test(bt)){return b.filter(bt,bs,!e)}else{bt=b.filter(bt,bs)}}}}return b.grep(bu,function(bw,bv){return(b.inArray(bw,bt)>=0)===e})}var ad=/ jQuery\d+="(?:\d+|null)"/g,an=/^\s+/,S=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,d=/<([\w:]+)/,w=/<tbody/i,V=/<|&#?\w+;/,O=/<(?:script|object|embed|option|style)/i,n=/checked\s*(?:[^=]|=\s*.checked.)/i,bj=/\/(java|ecma)script/i,aJ=/^\s*<!(?:\[CDATA\[|\-\-)/,at={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};at.optgroup=at.option;at.tbody=at.tfoot=at.colgroup=at.caption=at.thead;at.th=at.td;if(!b.support.htmlSerialize){at._default=[1,"div<div>","</div>"]}b.fn.extend({text:function(e){if(b.isFunction(e)){return this.each(function(bt){var bs=b(this);bs.text(e.call(this,bt,bs.text()))})}if(typeof e!=="object"&&e!==K){return this.empty().append((this[0]&&this[0].ownerDocument||aq).createTextNode(e))}return b.text(this)},wrapAll:function(e){if(b.isFunction(e)){return this.each(function(bt){b(this).wrapAll(e.call(this,bt))})}if(this[0]){var bs=b(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bs.insertBefore(this[0])}bs.map(function(){var bt=this;while(bt.firstChild&&bt.firstChild.nodeType===1){bt=bt.firstChild}return bt}).append(this)}return this},wrapInner:function(e){if(b.isFunction(e)){return this.each(function(bs){b(this).wrapInner(e.call(this,bs))})}return this.each(function(){var bs=b(this),bt=bs.contents();if(bt.length){bt.wrapAll(e)}else{bs.append(e)}})},wrap:function(e){return this.each(function(){b(this).wrapAll(e)})},unwrap:function(){return this.parent().each(function(){if(!b.nodeName(this,"body")){b(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bs){this.parentNode.insertBefore(bs,this)})}else{if(arguments.length){var e=b(arguments[0]);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bs){this.parentNode.insertBefore(bs,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,b(arguments[0]).toArray());return e}}},remove:function(e,bu){for(var bs=0,bt;(bt=this[bs])!=null;bs++){if(!e||b.filter(e,[bt]).length){if(!bu&&bt.nodeType===1){b.cleanData(bt.getElementsByTagName("*"));b.cleanData([bt])}if(bt.parentNode){bt.parentNode.removeChild(bt)}}}return this},empty:function(){for(var e=0,bs;(bs=this[e])!=null;e++){if(bs.nodeType===1){b.cleanData(bs.getElementsByTagName("*"))}while(bs.firstChild){bs.removeChild(bs.firstChild)}}return this},clone:function(bs,e){bs=bs==null?false:bs;e=e==null?bs:e;return this.map(function(){return b.clone(this,bs,e)})},html:function(bu){if(bu===K){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ad,""):null}else{if(typeof bu==="string"&&!O.test(bu)&&(b.support.leadingWhitespace||!an.test(bu))&&!at[(d.exec(bu)||["",""])[1].toLowerCase()]){bu=bu.replace(S,"<$1></$2>");try{for(var bt=0,bs=this.length;bt<bs;bt++){if(this[bt].nodeType===1){b.cleanData(this[bt].getElementsByTagName("*"));this[bt].innerHTML=bu}}}catch(bv){this.empty().append(bu)}}else{if(b.isFunction(bu)){this.each(function(bw){var e=b(this);e.html(bu.call(this,bw,e.html()))})}else{this.empty().append(bu)}}}return this},replaceWith:function(e){if(this[0]&&this[0].parentNode){if(b.isFunction(e)){return this.each(function(bu){var bt=b(this),bs=bt.html();bt.replaceWith(e.call(this,bu,bs))})}if(typeof e!=="string"){e=b(e).detach()}return this.each(function(){var bt=this.nextSibling,bs=this.parentNode;b(this).remove();if(bt){b(bt).before(e)}else{b(bs).append(e)}})}else{return this.length?this.pushStack(b(b.isFunction(e)?e():e),"replaceWith",e):this}},detach:function(e){return this.remove(e,true)},domManip:function(by,bC,bB){var bu,bv,bx,bA,bz=by[0],bs=[];if(!b.support.checkClone&&arguments.length===3&&typeof bz==="string"&&n.test(bz)){return this.each(function(){b(this).domManip(by,bC,bB,true)})}if(b.isFunction(bz)){return this.each(function(bE){var bD=b(this);by[0]=bz.call(this,bE,bC?bD.html():K);bD.domManip(by,bC,bB)})}if(this[0]){bA=bz&&bz.parentNode;if(b.support.parentNode&&bA&&bA.nodeType===11&&bA.childNodes.length===this.length){bu={fragment:bA}}else{bu=b.buildFragment(by,this,bs)}bx=bu.fragment;if(bx.childNodes.length===1){bv=bx=bx.firstChild}else{bv=bx.firstChild}if(bv){bC=bC&&b.nodeName(bv,"tr");for(var bt=0,e=this.length,bw=e-1;bt<e;bt++){bB.call(bC?a8(this[bt],bv):this[bt],bu.cacheable||(e>1&&bt<bw)?b.clone(bx,true,true):bx)}}if(bs.length){b.each(bs,bm)}}return this}});function a8(e,bs){return b.nodeName(e,"table")?(e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody"))):e}function t(e,by){if(by.nodeType!==1||!b.hasData(e)){return}var bx=b.expando,bu=b.data(e),bv=b.data(by,bu);if((bu=bu[bx])){var bz=bu.events;bv=bv[bx]=b.extend({},bu);if(bz){delete bv.handle;bv.events={};for(var bw in bz){for(var bt=0,bs=bz[bw].length;bt<bs;bt++){b.event.add(by,bw+(bz[bw][bt].namespace?".":"")+bz[bw][bt].namespace,bz[bw][bt],bz[bw][bt].data)}}}}}function ae(bs,e){var bt;if(e.nodeType!==1){return}if(e.clearAttributes){e.clearAttributes()}if(e.mergeAttributes){e.mergeAttributes(bs)}bt=e.nodeName.toLowerCase();if(bt==="object"){e.outerHTML=bs.outerHTML}else{if(bt==="input"&&(bs.type==="checkbox"||bs.type==="radio")){if(bs.checked){e.defaultChecked=e.checked=bs.checked}if(e.value!==bs.value){e.value=bs.value}}else{if(bt==="option"){e.selected=bs.defaultSelected}else{if(bt==="input"||bt==="textarea"){e.defaultValue=bs.defaultValue}}}}e.removeAttribute(b.expando)}b.buildFragment=function(bw,bu,bs){var bv,e,bt,bx;if(bu&&bu[0]){bx=bu[0].ownerDocument||bu[0]}if(!bx.createDocumentFragment){bx=aq}if(bw.length===1&&typeof bw[0]==="string"&&bw[0].length<512&&bx===aq&&bw[0].charAt(0)==="<"&&!O.test(bw[0])&&(b.support.checkClone||!n.test(bw[0]))){e=true;bt=b.fragments[bw[0]];if(bt&&bt!==1){bv=bt}}if(!bv){bv=bx.createDocumentFragment();b.clean(bw,bx,bv,bs)}if(e){b.fragments[bw[0]]=bt?bv:1}return{fragment:bv,cacheable:e}};b.fragments={};b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,bs){b.fn[e]=function(bt){var bw=[],bz=b(bt),by=this.length===1&&this[0].parentNode;if(by&&by.nodeType===11&&by.childNodes.length===1&&bz.length===1){bz[bs](this[0]);return this}else{for(var bx=0,bu=bz.length;bx<bu;bx++){var bv=(bx>0?this.clone(true):this).get();b(bz[bx])[bs](bv);bw=bw.concat(bv)}return this.pushStack(bw,e,bz.selector)}}});function bc(e){if("getElementsByTagName" in e){return e.getElementsByTagName("*")}else{if("querySelectorAll" in e){return e.querySelectorAll("*")}else{return[]}}}function av(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecked=e.checked}}function E(e){if(b.nodeName(e,"input")){av(e)}else{if("getElementsByTagName" in e){b.grep(e.getElementsByTagName("input"),av)}}}b.extend({clone:function(bv,bx,bt){var bw=bv.cloneNode(true),e,bs,bu;if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(bv.nodeType===1||bv.nodeType===11)&&!b.isXMLDoc(bv)){ae(bv,bw);e=bc(bv);bs=bc(bw);for(bu=0;e[bu];++bu){ae(e[bu],bs[bu])}}if(bx){t(bv,bw);if(bt){e=bc(bv);bs=bc(bw);for(bu=0;e[bu];++bu){t(e[bu],bs[bu])}}}e=bs=null;return bw},clean:function(bt,bv,bE,bx){var bC;bv=bv||aq;if(typeof bv.createElement==="undefined"){bv=bv.ownerDocument||bv[0]&&bv[0].ownerDocument||aq}var bF=[],by;for(var bB=0,bw;(bw=bt[bB])!=null;bB++){if(typeof bw==="number"){bw+=""}if(!bw){continue}if(typeof bw==="string"){if(!V.test(bw)){bw=bv.createTextNode(bw)}else{bw=bw.replace(S,"<$1></$2>");var bH=(d.exec(bw)||["",""])[1].toLowerCase(),bu=at[bH]||at._default,bA=bu[0],bs=bv.createElement("div");bs.innerHTML=bu[1]+bw+bu[2];while(bA--){bs=bs.lastChild}if(!b.support.tbody){var e=w.test(bw),bz=bH==="table"&&!e?bs.firstChild&&bs.firstChild.childNodes:bu[1]==="<table>"&&!e?bs.childNodes:[];for(by=bz.length-1;by>=0;--by){if(b.nodeName(bz[by],"tbody")&&!bz[by].childNodes.length){bz[by].parentNode.removeChild(bz[by])}}}if(!b.support.leadingWhitespace&&an.test(bw)){bs.insertBefore(bv.createTextNode(an.exec(bw)[0]),bs.firstChild)}bw=bs.childNodes}}var bD;if(!b.support.appendChecked){if(bw[0]&&typeof(bD=bw.length)==="number"){for(by=0;by<bD;by++){E(bw[by])}}else{E(bw)}}if(bw.nodeType){bF.push(bw)}else{bF=b.merge(bF,bw)}}if(bE){bC=function(bI){return !bI.type||bj.test(bI.type)};for(bB=0;bF[bB];bB++){if(bx&&b.nodeName(bF[bB],"script")&&(!bF[bB].type||bF[bB].type.toLowerCase()==="text/javascript")){bx.push(bF[bB].parentNode?bF[bB].parentNode.removeChild(bF[bB]):bF[bB])}else{if(bF[bB].nodeType===1){var bG=b.grep(bF[bB].getElementsByTagName("script"),bC);bF.splice.apply(bF,[bB+1,0].concat(bG))}bE.appendChild(bF[bB])}}}return bF},cleanData:function(bs){var bv,bt,e=b.cache,bA=b.expando,by=b.event.special,bx=b.support.deleteExpando;for(var bw=0,bu;(bu=bs[bw])!=null;bw++){if(bu.nodeName&&b.noData[bu.nodeName.toLowerCase()]){continue}bt=bu[b.expando];if(bt){bv=e[bt]&&e[bt][bA];if(bv&&bv.events){for(var bz in bv.events){if(by[bz]){b.event.remove(bu,bz)}else{b.removeEvent(bu,bz,bv.handle)}}if(bv.handle){bv.handle.elem=null}}if(bx){delete bu[b.expando]}else{if(bu.removeAttribute){bu.removeAttribute(b.expando)}}delete e[bt]}}}});function bm(e,bs){if(bs.src){b.ajax({url:bs.src,async:false,dataType:"script"})}else{b.globalEval((bs.text||bs.textContent||bs.innerHTML||"").replace(aJ,"/*$0*/"))}if(bs.parentNode){bs.parentNode.removeChild(bs)}}var ah=/alpha\([^)]*\)/i,ap=/opacity=([^)]*)/,z=/([A-Z]|^ms)/g,ba=/^-?\d+(?:px)?$/i,bl=/^-?\d/,I=/^[+\-]=/,ag=/[^+\-\.\de]+/g,a4={position:"absolute",visibility:"hidden",display:"block"},aj=["Left","Right"],aY=["Top","Bottom"],W,aE,aS;b.fn.css=function(e,bs){if(arguments.length===2&&bs===K){return this}return b.access(this,e,bs,true,function(bu,bt,bv){return bv!==K?b.style(bu,bt,bv):b.css(bu,bt)})};b.extend({cssHooks:{opacity:{get:function(bt,bs){if(bs){var e=W(bt,"opacity","opacity");return e===""?"1":e}else{return bt.style.opacity}}}},cssNumber:{fillOpacity:true,fontWeight:true,lineHeight:true,opacity:true,orphans:true,widows:true,zIndex:true,zoom:true},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(bu,bt,bA,bv){if(!bu||bu.nodeType===3||bu.nodeType===8||!bu.style){return}var by,bz,bw=b.camelCase(bt),bs=bu.style,bB=b.cssHooks[bw];bt=b.cssProps[bw]||bw;if(bA!==K){bz=typeof bA;if(bz==="number"&&isNaN(bA)||bA==null){return}if(bz==="string"&&I.test(bA)){bA=+bA.replace(ag,"")+parseFloat(b.css(bu,bt));bz="number"}if(bz==="number"&&!b.cssNumber[bw]){bA+="px"}if(!bB||!("set" in bB)||(bA=bB.set(bu,bA))!==K){try{bs[bt]=bA}catch(bx){}}}else{if(bB&&"get" in bB&&(by=bB.get(bu,false,bv))!==K){return by}return bs[bt]}},css:function(bv,bu,bs){var bt,e;bu=b.camelCase(bu);e=b.cssHooks[bu];bu=b.cssProps[bu]||bu;if(bu==="cssFloat"){bu="float"}if(e&&"get" in e&&(bt=e.get(bv,true,bs))!==K){return bt}else{if(W){return W(bv,bu)}}},swap:function(bu,bt,bv){var e={};for(var bs in bt){e[bs]=bu.style[bs];bu.style[bs]=bt[bs]}bv.call(bu);for(bs in bt){bu.style[bs]=e[bs]}}});b.curCSS=b.css;b.each(["height","width"],function(bs,e){b.cssHooks[e]={get:function(bv,bu,bt){var bw;if(bu){if(bv.offsetWidth!==0){return o(bv,e,bt)}else{b.swap(bv,a4,function(){bw=o(bv,e,bt)})}return bw}},set:function(bt,bu){if(ba.test(bu)){bu=parseFloat(bu);if(bu>=0){return bu+"px"}}else{return bu}}}});if(!b.support.opacity){b.cssHooks.opacity={get:function(bs,e){return ap.test((e&&bs.currentStyle?bs.currentStyle.filter:bs.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(bv,bw){var bu=bv.style,bs=bv.currentStyle;bu.zoom=1;var e=b.isNaN(bw)?"":"alpha(opacity="+bw*100+")",bt=bs&&bs.filter||bu.filter||"";bu.filter=ah.test(bt)?bt.replace(ah,e):bt+" "+e}}}b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bt,bs){var e;b.swap(bt,{display:"inline-block"},function(){if(bs){e=W(bt,"margin-right","marginRight")}else{e=bt.style.marginRight}});return e}}}});if(aq.defaultView&&aq.defaultView.getComputedStyle){aE=function(bv,bt){var bs,bu,e;bt=bt.replace(z,"-$1").toLowerCase();if(!(bu=bv.ownerDocument.defaultView)){return K}if((e=bu.getComputedStyle(bv,null))){bs=e.getPropertyValue(bt);if(bs===""&&!b.contains(bv.ownerDocument.documentElement,bv)){bs=b.style(bv,bt)}}return bs}}if(aq.documentElement.currentStyle){aS=function(bv,bt){var bw,bs=bv.currentStyle&&bv.currentStyle[bt],e=bv.runtimeStyle&&bv.runtimeStyle[bt],bu=bv.style;if(!ba.test(bs)&&bl.test(bs)){bw=bu.left;if(e){bv.runtimeStyle.left=bv.currentStyle.left}bu.left=bt==="fontSize"?"1em":(bs||0);bs=bu.pixelLeft+"px";bu.left=bw;if(e){bv.runtimeStyle.left=e}}return bs===""?"auto":bs}}W=aE||aS;function o(bt,bs,e){var bv=bs==="width"?bt.offsetWidth:bt.offsetHeight,bu=bs==="width"?aj:aY;if(bv>0){if(e!=="border"){b.each(bu,function(){if(!e){bv-=parseFloat(b.css(bt,"padding"+this))||0}if(e==="margin"){bv+=parseFloat(b.css(bt,e+this))||0}else{bv-=parseFloat(b.css(bt,"border"+this+"Width"))||0}})}return bv+"px"}bv=W(bt,bs,bs);if(bv<0||bv==null){bv=bt.style[bs]||0}bv=parseFloat(bv)||0;if(e){b.each(bu,function(){bv+=parseFloat(b.css(bt,"padding"+this))||0;if(e!=="padding"){bv+=parseFloat(b.css(bt,"border"+this+"Width"))||0}if(e==="margin"){bv+=parseFloat(b.css(bt,e+this))||0}})}return bv+"px"}if(b.expr&&b.expr.filters){b.expr.filters.hidden=function(bt){var bs=bt.offsetWidth,e=bt.offsetHeight;return(bs===0&&e===0)||(!b.support.reliableHiddenOffsets&&(bt.style.display||b.css(bt,"display"))==="none")};b.expr.filters.visible=function(e){return !b.expr.filters.hidden(e)}}var j=/%20/g,al=/\[\]$/,bq=/\r?\n/g,bo=/#.*$/,az=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,aV=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,aI=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,aL=/^(?:GET|HEAD)$/,c=/^\/\//,L=/\?/,a3=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,q=/^(?:select|textarea)/i,h=/\s+/,bp=/([?&])_=[^&]*/,J=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,A=b.fn.load,X={},r={},aA,s;try{aA=bi.href}catch(ar){aA=aq.createElement("a");aA.href="";aA=aA.href}s=J.exec(aA.toLowerCase())||[];function f(e){return function(bv,bx){if(typeof bv!=="string"){bx=bv;bv="*"}if(b.isFunction(bx)){var bu=bv.toLowerCase().split(h),bt=0,bw=bu.length,bs,by,bz;for(;bt<bw;bt++){bs=bu[bt];bz=/^\+/.test(bs);if(bz){bs=bs.substr(1)||"*"}by=e[bs]=e[bs]||[];by[bz?"unshift":"push"](bx)}}}}function aQ(bs,bB,bw,bA,by,bu){by=by||bB.dataTypes[0];bu=bu||{};bu[by]=true;var bx=bs[by],bt=0,e=bx?bx.length:0,bv=(bs===X),bz;for(;bt<e&&(bv||!bz);bt++){bz=bx[bt](bB,bw,bA);if(typeof bz==="string"){if(!bv||bu[bz]){bz=K}else{bB.dataTypes.unshift(bz);bz=aQ(bs,bB,bw,bA,bz,bu)}}}if((bv||!bz)&&!bu["*"]){bz=aQ(bs,bB,bw,bA,"*",bu)}return bz}b.fn.extend({load:function(bt,bw,bx){if(typeof bt!=="string"&&A){return A.apply(this,arguments)}else{if(!this.length){return this}}var bv=bt.indexOf(" ");if(bv>=0){var e=bt.slice(bv,bt.length);bt=bt.slice(0,bv)}var bu="GET";if(bw){if(b.isFunction(bw)){bx=bw;bw=K}else{if(typeof bw==="object"){bw=b.param(bw,b.ajaxSettings.traditional);bu="POST"}}}var bs=this;b.ajax({url:bt,type:bu,dataType:"html",data:bw,complete:function(bz,by,bA){bA=bz.responseText;if(bz.isResolved()){bz.done(function(bB){bA=bB});bs.html(e?b("<div>").append(bA.replace(a3,"")).find(e):bA)}if(bx){bs.each(bx,[bA,by,bz])}}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||q.test(this.nodeName)||aV.test(this.type))}).map(function(e,bs){var bt=b(this).val();return bt==null?null:b.isArray(bt)?b.map(bt,function(bv,bu){return{name:bs.name,value:bv.replace(bq,"\r\n")}}):{name:bs.name,value:bt.replace(bq,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bs){b.fn[bs]=function(bt){return this.bind(bs,bt)}});b.each(["get","post"],function(e,bs){b[bs]=function(bt,bv,bw,bu){if(b.isFunction(bv)){bu=bu||bw;bw=bv;bv=K}return b.ajax({type:bs,url:bt,data:bv,success:bw,dataType:bu})}});b.extend({getScript:function(e,bs){return b.get(e,K,bs,"script")},getJSON:function(e,bs,bt){return b.get(e,bs,bt,"json")},ajaxSetup:function(bt,e){if(!e){e=bt;bt=b.extend(true,b.ajaxSettings,e)}else{b.extend(true,bt,b.ajaxSettings,e)}for(var bs in {context:1,url:1}){if(bs in e){bt[bs]=e[bs]}else{if(bs in b.ajaxSettings){bt[bs]=b.ajaxSettings[bs]}}}return bt},ajaxSettings:{url:aA,isLocal:aI.test(s[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a9.String,"text html":true,"text json":b.parseJSON,"text xml":b.parseXML}},ajaxPrefilter:f(X),ajaxTransport:f(r),ajax:function(bw,bu){if(typeof bw==="object"){bu=bw;bw=K}bu=bu||{};var bA=b.ajaxSetup({},bu),bP=bA.context||bA,bD=bP!==bA&&(bP.nodeType||bP instanceof b)?b(bP):b.event,bO=b.Deferred(),bK=b._Deferred(),by=bA.statusCode||{},bz,bE={},bL={},bN,bv,bI,bB,bF,bx=0,bt,bH,bG={readyState:0,setRequestHeader:function(bQ,bR){if(!bx){var e=bQ.toLowerCase();bQ=bL[e]=bL[e]||bQ;bE[bQ]=bR}return this},getAllResponseHeaders:function(){return bx===2?bN:null},getResponseHeader:function(bQ){var e;if(bx===2){if(!bv){bv={};while((e=az.exec(bN))){bv[e[1].toLowerCase()]=e[2]}}e=bv[bQ.toLowerCase()]}return e===K?null:e},overrideMimeType:function(e){if(!bx){bA.mimeType=e}return this},abort:function(e){e=e||"abort";if(bI){bI.abort(e)}bC(0,e);return this}};function bC(bV,bT,bW,bS){if(bx===2){return}bx=2;if(bB){clearTimeout(bB)}bI=K;bN=bS||"";bG.readyState=bV?4:0;var bQ,b0,bZ,bU=bW?bg(bA,bG,bW):K,bR,bY;if(bV>=200&&bV<300||bV===304){if(bA.ifModified){if((bR=bG.getResponseHeader("Last-Modified"))){b.lastModified[bz]=bR}if((bY=bG.getResponseHeader("Etag"))){b.etag[bz]=bY}}if(bV===304){bT="notmodified";bQ=true}else{try{b0=F(bA,bU);bT="success";bQ=true}catch(bX){bT="parsererror";bZ=bX}}}else{bZ=bT;if(!bT||bV){bT="error";if(bV<0){bV=0}}}bG.status=bV;bG.statusText=bT;if(bQ){bO.resolveWith(bP,[b0,bT,bG])}else{bO.rejectWith(bP,[bG,bT,bZ])}bG.statusCode(by);by=K;if(bt){bD.trigger("ajax"+(bQ?"Success":"Error"),[bG,bA,bQ?b0:bZ])}bK.resolveWith(bP,[bG,bT]);if(bt){bD.trigger("ajaxComplete",[bG,bA]);if(!(--b.active)){b.event.trigger("ajaxStop")}}}bO.promise(bG);bG.success=bG.done;bG.error=bG.fail;bG.complete=bK.done;bG.statusCode=function(bQ){if(bQ){var e;if(bx<2){for(e in bQ){by[e]=[by[e],bQ[e]]}}else{e=bQ[bG.status];bG.then(e,e)}}return this};bA.url=((bw||bA.url)+"").replace(bo,"").replace(c,s[1]+"//");bA.dataTypes=b.trim(bA.dataType||"*").toLowerCase().split(h);if(bA.crossDomain==null){bF=J.exec(bA.url.toLowerCase());bA.crossDomain=!!(bF&&(bF[1]!=s[1]||bF[2]!=s[2]||(bF[3]||(bF[1]==="http:"?80:443))!=(s[3]||(s[1]==="http:"?80:443))))}if(bA.data&&bA.processData&&typeof bA.data!=="string"){bA.data=b.param(bA.data,bA.traditional)}aQ(X,bA,bu,bG);if(bx===2){return false}bt=bA.global;bA.type=bA.type.toUpperCase();bA.hasContent=!aL.test(bA.type);if(bt&&b.active++===0){b.event.trigger("ajaxStart")}if(!bA.hasContent){if(bA.data){bA.url+=(L.test(bA.url)?"&":"?")+bA.data}bz=bA.url;if(bA.cache===false){var bs=b.now(),bM=bA.url.replace(bp,"$1_="+bs);bA.url=bM+((bM===bA.url)?(L.test(bA.url)?"&":"?")+"_="+bs:"")}}if(bA.data&&bA.hasContent&&bA.contentType!==false||bu.contentType){bG.setRequestHeader("Content-Type",bA.contentType)}if(bA.ifModified){bz=bz||bA.url;if(b.lastModified[bz]){bG.setRequestHeader("If-Modified-Since",b.lastModified[bz])}if(b.etag[bz]){bG.setRequestHeader("If-None-Match",b.etag[bz])}}bG.setRequestHeader("Accept",bA.dataTypes[0]&&bA.accepts[bA.dataTypes[0]]?bA.accepts[bA.dataTypes[0]]+(bA.dataTypes[0]!=="*"?", */*; q=0.01":""):bA.accepts["*"]);for(bH in bA.headers){bG.setRequestHeader(bH,bA.headers[bH])}if(bA.beforeSend&&(bA.beforeSend.call(bP,bG,bA)===false||bx===2)){bG.abort();return false}for(bH in {success:1,error:1,complete:1}){bG[bH](bA[bH])}bI=aQ(r,bA,bu,bG);if(!bI){bC(-1,"No Transport")}else{bG.readyState=1;if(bt){bD.trigger("ajaxSend",[bG,bA])}if(bA.async&&bA.timeout>0){bB=setTimeout(function(){bG.abort("timeout")},bA.timeout)}try{bx=1;bI.send(bE,bC)}catch(bJ){if(status<2){bC(-1,bJ)}else{b.error(bJ)}}}return bG},param:function(e,bt){var bs=[],bv=function(bw,bx){bx=b.isFunction(bx)?bx():bx;bs[bs.length]=encodeURIComponent(bw)+"="+encodeURIComponent(bx)};if(bt===K){bt=b.ajaxSettings.traditional}if(b.isArray(e)||(e.jquery&&!b.isPlainObject(e))){b.each(e,function(){bv(this.name,this.value)})}else{for(var bu in e){v(bu,e[bu],bt,bv)}}return bs.join("&").replace(j,"+")}});function v(bt,bv,bs,bu){if(b.isArray(bv)){b.each(bv,function(bx,bw){if(bs||al.test(bt)){bu(bt,bw)}else{v(bt+"["+(typeof bw==="object"||b.isArray(bw)?bx:"")+"]",bw,bs,bu)}})}else{if(!bs&&bv!=null&&typeof bv==="object"){for(var e in bv){v(bt+"["+e+"]",bv[e],bs,bu)}}else{bu(bt,bv)}}}b.extend({active:0,lastModified:{},etag:{}});function bg(bA,bz,bw){var bs=bA.contents,by=bA.dataTypes,bt=bA.responseFields,bv,bx,bu,e;for(bx in bt){if(bx in bw){bz[bt[bx]]=bw[bx]}}while(by[0]==="*"){by.shift();if(bv===K){bv=bA.mimeType||bz.getResponseHeader("content-type")}}if(bv){for(bx in bs){if(bs[bx]&&bs[bx].test(bv)){by.unshift(bx);break}}}if(by[0] in bw){bu=by[0]}else{for(bx in bw){if(!by[0]||bA.converters[bx+" "+by[0]]){bu=bx;break}if(!e){e=bx}}bu=bu||e}if(bu){if(bu!==by[0]){by.unshift(bu)}return bw[bu]}}function F(bE,bw){if(bE.dataFilter){bw=bE.dataFilter(bw,bE.dataType)}var bA=bE.dataTypes,bD={},bx,bB,bt=bA.length,by,bz=bA[0],bu,bv,bC,bs,e;for(bx=1;bx<bt;bx++){if(bx===1){for(bB in bE.converters){if(typeof bB==="string"){bD[bB.toLowerCase()]=bE.converters[bB]}}}bu=bz;bz=bA[bx];if(bz==="*"){bz=bu}else{if(bu!=="*"&&bu!==bz){bv=bu+" "+bz;bC=bD[bv]||bD["* "+bz];if(!bC){e=K;for(bs in bD){by=bs.split(" ");if(by[0]===bu||by[0]==="*"){e=bD[by[1]+" "+bz];if(e){bs=bD[bs];if(bs===true){bC=e}else{if(e===true){bC=bs}}break}}}}if(!(bC||e)){b.error("No conversion from "+bv.replace(" "," to "))}if(bC!==true){bw=bC?bC(bw):e(bs(bw))}}}}return bw}var ay=b.now(),u=/(\=)\?(&|$)|\?\?/i;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return b.expando+"_"+(ay++)}});b.ajaxPrefilter("json jsonp",function(bA,bx,bz){var bu=bA.contentType==="application/x-www-form-urlencoded"&&(typeof bA.data==="string");if(bA.dataTypes[0]==="jsonp"||bA.jsonp!==false&&(u.test(bA.url)||bu&&u.test(bA.data))){var by,bt=bA.jsonpCallback=b.isFunction(bA.jsonpCallback)?bA.jsonpCallback():bA.jsonpCallback,bw=a9[bt],e=bA.url,bv=bA.data,bs="$1"+bt+"$2";if(bA.jsonp!==false){e=e.replace(u,bs);if(bA.url===e){if(bu){bv=bv.replace(u,bs)}if(bA.data===bv){e+=(/\?/.test(e)?"&":"?")+bA.jsonp+"="+bt}}}bA.url=e;bA.data=bv;a9[bt]=function(bB){by=[bB]};bz.always(function(){a9[bt]=bw;if(by&&b.isFunction(bw)){a9[bt](by[0])}});bA.converters["script json"]=function(){if(!by){b.error(bt+" was not called")}return by[0]};bA.dataTypes[0]="json";return"script"}});b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){b.globalEval(e);return e}}});b.ajaxPrefilter("script",function(e){if(e.cache===K){e.cache=false}if(e.crossDomain){e.type="GET";e.global=false}});b.ajaxTransport("script",function(bt){if(bt.crossDomain){var e,bs=aq.head||aq.getElementsByTagName("head")[0]||aq.documentElement;return{send:function(bu,bv){e=aq.createElement("script");e.async="async";if(bt.scriptCharset){e.charset=bt.scriptCharset}e.src=bt.url;e.onload=e.onreadystatechange=function(bx,bw){if(bw||!e.readyState||/loaded|complete/.test(e.readyState)){e.onload=e.onreadystatechange=null;if(bs&&e.parentNode){bs.removeChild(e)}e=K;if(!bw){bv(200,"success")}}};bs.insertBefore(e,bs.firstChild)},abort:function(){if(e){e.onload(0,1)}}}}});var B=a9.ActiveXObject?function(){for(var e in M){M[e](0,1)}}:false,y=0,M;function aH(){try{return new a9.XMLHttpRequest()}catch(bs){}}function af(){try{return new a9.ActiveXObject("Microsoft.XMLHTTP")}catch(bs){}}b.ajaxSettings.xhr=a9.ActiveXObject?function(){return !this.isLocal&&aH()||af()}:aH;(function(e){b.extend(b.support,{ajax:!!e,cors:!!e&&("withCredentials" in e)})})(b.ajaxSettings.xhr());if(b.support.ajax){b.ajaxTransport(function(e){if(!e.crossDomain||b.support.cors){var bs;return{send:function(by,bt){var bx=e.xhr(),bw,bv;if(e.username){bx.open(e.type,e.url,e.async,e.username,e.password)}else{bx.open(e.type,e.url,e.async)}if(e.xhrFields){for(bv in e.xhrFields){bx[bv]=e.xhrFields[bv]}}if(e.mimeType&&bx.overrideMimeType){bx.overrideMimeType(e.mimeType)}if(!e.crossDomain&&!by["X-Requested-With"]){by["X-Requested-With"]="XMLHttpRequest"}try{for(bv in by){bx.setRequestHeader(bv,by[bv])}}catch(bu){}bx.send((e.hasContent&&e.data)||null);bs=function(bH,bB){var bC,bA,bz,bF,bE;try{if(bs&&(bB||bx.readyState===4)){bs=K;if(bw){bx.onreadystatechange=b.noop;if(B){delete M[bw]}}if(bB){if(bx.readyState!==4){bx.abort()}}else{bC=bx.status;bz=bx.getAllResponseHeaders();bF={};bE=bx.responseXML;if(bE&&bE.documentElement){bF.xml=bE}bF.text=bx.responseText;try{bA=bx.statusText}catch(bG){bA=""}if(!bC&&e.isLocal&&!e.crossDomain){bC=bF.text?200:404}else{if(bC===1223){bC=204}}}}}catch(bD){if(!bB){bt(-1,bD)}}if(bF){bt(bC,bA,bF,bz)}};if(!e.async||bx.readyState===4){bs()}else{bw=++y;if(B){if(!M){M={};b(a9).unload(B)}M[bw]=bs}bx.onreadystatechange=bs}},abort:function(){if(bs){bs(0,1)}}}}})}var Q={},a6,m,ax=/^(?:toggle|show|hide)$/,aN=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,aZ,aD=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],a1,R=a9.webkitRequestAnimationFrame||a9.mozRequestAnimationFrame||a9.oRequestAnimationFrame;b.fn.extend({show:function(bu,bx,bw){var bt,bv;if(bu||bu===0){return this.animate(aX("show",3),bu,bx,bw)}else{for(var bs=0,e=this.length;bs<e;bs++){bt=this[bs];if(bt.style){bv=bt.style.display;if(!b._data(bt,"olddisplay")&&bv==="none"){bv=bt.style.display=""}if(bv===""&&b.css(bt,"display")==="none"){b._data(bt,"olddisplay",x(bt.nodeName))}}}for(bs=0;bs<e;bs++){bt=this[bs];if(bt.style){bv=bt.style.display;if(bv===""||bv==="none"){bt.style.display=b._data(bt,"olddisplay")||""}}}return this}},hide:function(bt,bw,bv){if(bt||bt===0){return this.animate(aX("hide",3),bt,bw,bv)}else{for(var bs=0,e=this.length;bs<e;bs++){if(this[bs].style){var bu=b.css(this[bs],"display");if(bu!=="none"&&!b._data(this[bs],"olddisplay")){b._data(this[bs],"olddisplay",bu)}}}for(bs=0;bs<e;bs++){if(this[bs].style){this[bs].style.display="none"}}return this}},_toggle:b.fn.toggle,toggle:function(bt,bs,bu){var e=typeof bt==="boolean";if(b.isFunction(bt)&&b.isFunction(bs)){this._toggle.apply(this,arguments)}else{if(bt==null||e){this.each(function(){var bv=e?bt:b(this).is(":hidden");b(this)[bv?"show":"hide"]()})}else{this.animate(aX("toggle",3),bt,bs,bu)}}return this},fadeTo:function(e,bu,bt,bs){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:bu},e,bt,bs)},animate:function(bv,bs,bu,bt){var e=b.speed(bs,bu,bt);if(b.isEmptyObject(bv)){return this.each(e.complete,[false])}bv=b.extend({},bv);return this[e.queue===false?"each":"queue"](function(){if(e.queue===false){b._mark(this)}var bz=b.extend({},e),bG=this.nodeType===1,bD=bG&&b(this).is(":hidden"),bw,bA,by,bF,bE,bC,bx,bB,bH;bz.animatedProperties={};for(by in bv){bw=b.camelCase(by);if(by!==bw){bv[bw]=bv[by];delete bv[by]}bA=bv[bw];if(b.isArray(bA)){bz.animatedProperties[bw]=bA[1];bA=bv[bw]=bA[0]}else{bz.animatedProperties[bw]=bz.specialEasing&&bz.specialEasing[bw]||bz.easing||"swing"}if(bA==="hide"&&bD||bA==="show"&&!bD){return bz.complete.call(this)}if(bG&&(bw==="height"||bw==="width")){bz.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(b.css(this,"display")==="inline"&&b.css(this,"float")==="none"){if(!b.support.inlineBlockNeedsLayout){this.style.display="inline-block"}else{bF=x(this.nodeName);if(bF==="inline"){this.style.display="inline-block"}else{this.style.display="inline";this.style.zoom=1}}}}}if(bz.overflow!=null){this.style.overflow="hidden"}for(by in bv){bE=new b.fx(this,bz,by);bA=bv[by];if(ax.test(bA)){bE[bA==="toggle"?bD?"show":"hide":bA]()}else{bC=aN.exec(bA);bx=bE.cur();if(bC){bB=parseFloat(bC[2]);bH=bC[3]||(b.cssNumber[by]?"":"px");if(bH!=="px"){b.style(this,by,(bB||1)+bH);bx=((bB||1)/bE.cur())*bx;b.style(this,by,bx+bH)}if(bC[1]){bB=((bC[1]==="-="?-1:1)*bB)+bx}bE.custom(bx,bB,bH)}else{bE.custom(bx,bA,"")}}}return true})},stop:function(bs,e){if(bs){this.queue([])}this.each(function(){var bu=b.timers,bt=bu.length;if(!e){b._unmark(true,this)}while(bt--){if(bu[bt].elem===this){if(e){bu[bt](true)}bu.splice(bt,1)}}});if(!e){this.dequeue()}return this}});function bd(){setTimeout(ao,0);return(a1=b.now())}function ao(){a1=K}function aX(bs,e){var bt={};b.each(aD.concat.apply([],aD.slice(0,e)),function(){bt[this]=bs});return bt}b.each({slideDown:aX("show",1),slideUp:aX("hide",1),slideToggle:aX("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,bs){b.fn[e]=function(bt,bv,bu){return this.animate(bs,bt,bv,bu)}});b.extend({speed:function(bt,bu,bs){var e=bt&&typeof bt==="object"?b.extend({},bt):{complete:bs||!bs&&bu||b.isFunction(bt)&&bt,duration:bt,easing:bs&&bu||bu&&!b.isFunction(bu)&&bu};e.duration=b.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in b.fx.speeds?b.fx.speeds[e.duration]:b.fx.speeds._default;e.old=e.complete;e.complete=function(bv){if(b.isFunction(e.old)){e.old.call(this)}if(e.queue!==false){b.dequeue(this)}else{if(bv!==false){b._unmark(this)}}};return e},easing:{linear:function(bt,bu,e,bs){return e+bs*bt},swing:function(bt,bu,e,bs){return((-Math.cos(bt*Math.PI)/2)+0.5)*bs+e}},timers:[],fx:function(bs,e,bt){this.options=e;this.elem=bs;this.prop=bt;e.orig=e.orig||{}}});b.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(b.fx.step[this.prop]||b.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var e,bs=b.css(this.elem,this.prop);return isNaN(e=parseFloat(bs))?!bs||bs==="auto"?0:bs:e},custom:function(bx,bw,bu){var e=this,bt=b.fx,bv;this.startTime=a1||bd();this.start=bx;this.end=bw;this.unit=bu||this.unit||(b.cssNumber[this.prop]?"":"px");this.now=this.start;this.pos=this.state=0;function bs(by){return e.step(by)}bs.elem=this.elem;if(bs()&&b.timers.push(bs)&&!aZ){if(R){aZ=true;bv=function(){if(aZ){R(bv);bt.tick()}};R(bv)}else{aZ=setInterval(bt.tick,bt.interval)}}},show:function(){this.options.orig[this.prop]=b.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());b(this.elem).show()},hide:function(){this.options.orig[this.prop]=b.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(bv){var bu=a1||bd(),e=true,bw=this.elem,bs=this.options,bt,by;if(bv||bu>=bs.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();bs.animatedProperties[this.prop]=true;for(bt in bs.animatedProperties){if(bs.animatedProperties[bt]!==true){e=false}}if(e){if(bs.overflow!=null&&!b.support.shrinkWrapBlocks){b.each(["","X","Y"],function(bz,bA){bw.style["overflow"+bA]=bs.overflow[bz]})}if(bs.hide){b(bw).hide()}if(bs.hide||bs.show){for(var bx in bs.animatedProperties){b.style(bw,bx,bs.orig[bx])}}bs.complete.call(bw)}return false}else{if(bs.duration==Infinity){this.now=bu}else{by=bu-this.startTime;this.state=by/bs.duration;this.pos=b.easing[bs.animatedProperties[this.prop]](this.state,by,0,1,bs.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};b.extend(b.fx,{tick:function(){for(var bs=b.timers,e=0;e<bs.length;++e){if(!bs[e]()){bs.splice(e--,1)}}if(!bs.length){b.fx.stop()}},interval:13,stop:function(){clearInterval(aZ);aZ=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){b.style(e.elem,"opacity",e.now)},_default:function(e){if(e.elem.style&&e.elem.style[e.prop]!=null){e.elem.style[e.prop]=(e.prop==="width"||e.prop==="height"?Math.max(0,e.now):e.now)+e.unit}else{e.elem[e.prop]=e.now}}}});if(b.expr&&b.expr.filters){b.expr.filters.animated=function(e){return b.grep(b.timers,function(bs){return e===bs.elem}).length}}function x(bu){if(!Q[bu]){var e=aq.body,bs=b("<"+bu+">").appendTo(e),bt=bs.css("display");bs.remove();if(bt==="none"||bt===""){if(!a6){a6=aq.createElement("iframe");a6.frameBorder=a6.width=a6.height=0}e.appendChild(a6);if(!m||!a6.createElement){m=(a6.contentWindow||a6.contentDocument).document;m.write((aq.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>");m.close()}bs=m.createElement(bu);m.body.appendChild(bs);bt=b.css(bs,"display");e.removeChild(a6)}Q[bu]=bt}return Q[bu]}var U=/^t(?:able|d|h)$/i,aa=/^(?:body|html)$/i;if("getBoundingClientRect" in aq.documentElement){b.fn.offset=function(bF){var bv=this[0],by;if(bF){return this.each(function(e){b.offset.setOffset(this,bF,e)})}if(!bv||!bv.ownerDocument){return null}if(bv===bv.ownerDocument.body){return b.offset.bodyOffset(bv)}try{by=bv.getBoundingClientRect()}catch(bC){}var bE=bv.ownerDocument,bt=bE.documentElement;if(!by||!b.contains(bt,bv)){return by?{top:by.top,left:by.left}:{top:0,left:0}}var bz=bE.body,bA=aG(bE),bx=bt.clientTop||bz.clientTop||0,bB=bt.clientLeft||bz.clientLeft||0,bs=bA.pageYOffset||b.support.boxModel&&bt.scrollTop||bz.scrollTop,bw=bA.pageXOffset||b.support.boxModel&&bt.scrollLeft||bz.scrollLeft,bD=by.top+bs-bx,bu=by.left+bw-bB;return{top:bD,left:bu}}}else{b.fn.offset=function(bC){var bw=this[0];if(bC){return this.each(function(bD){b.offset.setOffset(this,bC,bD)})}if(!bw||!bw.ownerDocument){return null}if(bw===bw.ownerDocument.body){return b.offset.bodyOffset(bw)}b.offset.initialize();var bz,bt=bw.offsetParent,bs=bw,bB=bw.ownerDocument,bu=bB.documentElement,bx=bB.body,by=bB.defaultView,e=by?by.getComputedStyle(bw,null):bw.currentStyle,bA=bw.offsetTop,bv=bw.offsetLeft;while((bw=bw.parentNode)&&bw!==bx&&bw!==bu){if(b.offset.supportsFixedPosition&&e.position==="fixed"){break}bz=by?by.getComputedStyle(bw,null):bw.currentStyle;bA-=bw.scrollTop;bv-=bw.scrollLeft;if(bw===bt){bA+=bw.offsetTop;bv+=bw.offsetLeft;if(b.offset.doesNotAddBorder&&!(b.offset.doesAddBorderForTableAndCells&&U.test(bw.nodeName))){bA+=parseFloat(bz.borderTopWidth)||0;bv+=parseFloat(bz.borderLeftWidth)||0}bs=bt;bt=bw.offsetParent}if(b.offset.subtractsBorderForOverflowNotVisible&&bz.overflow!=="visible"){bA+=parseFloat(bz.borderTopWidth)||0;bv+=parseFloat(bz.borderLeftWidth)||0}e=bz}if(e.position==="relative"||e.position==="static"){bA+=bx.offsetTop;bv+=bx.offsetLeft}if(b.offset.supportsFixedPosition&&e.position==="fixed"){bA+=Math.max(bu.scrollTop,bx.scrollTop);bv+=Math.max(bu.scrollLeft,bx.scrollLeft)}return{top:bA,left:bv}}}b.offset={initialize:function(){var e=aq.body,bs=aq.createElement("div"),bv,bx,bw,by,bt=parseFloat(b.css(e,"marginTop"))||0,bu="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";b.extend(bs.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});bs.innerHTML=bu;e.insertBefore(bs,e.firstChild);bv=bs.firstChild;bx=bv.firstChild;by=bv.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(bx.offsetTop!==5);this.doesAddBorderForTableAndCells=(by.offsetTop===5);bx.style.position="fixed";bx.style.top="20px";this.supportsFixedPosition=(bx.offsetTop===20||bx.offsetTop===15);bx.style.position=bx.style.top="";bv.style.overflow="hidden";bv.style.position="relative";this.subtractsBorderForOverflowNotVisible=(bx.offsetTop===-5);this.doesNotIncludeMarginInBodyOffset=(e.offsetTop!==bt);e.removeChild(bs);b.offset.initialize=b.noop},bodyOffset:function(e){var bt=e.offsetTop,bs=e.offsetLeft;b.offset.initialize();if(b.offset.doesNotIncludeMarginInBodyOffset){bt+=parseFloat(b.css(e,"marginTop"))||0;bs+=parseFloat(b.css(e,"marginLeft"))||0}return{top:bt,left:bs}},setOffset:function(bu,bD,bx){var by=b.css(bu,"position");if(by==="static"){bu.style.position="relative"}var bw=b(bu),bs=bw.offset(),e=b.css(bu,"top"),bB=b.css(bu,"left"),bC=(by==="absolute"||by==="fixed")&&b.inArray("auto",[e,bB])>-1,bA={},bz={},bt,bv;if(bC){bz=bw.position();bt=bz.top;bv=bz.left}else{bt=parseFloat(e)||0;bv=parseFloat(bB)||0}if(b.isFunction(bD)){bD=bD.call(bu,bx,bs)}if(bD.top!=null){bA.top=(bD.top-bs.top)+bt}if(bD.left!=null){bA.left=(bD.left-bs.left)+bv}if("using" in bD){bD.using.call(bu,bA)}else{bw.css(bA)}}};b.fn.extend({position:function(){if(!this[0]){return null}var bt=this[0],bs=this.offsetParent(),bu=this.offset(),e=aa.test(bs[0].nodeName)?{top:0,left:0}:bs.offset();bu.top-=parseFloat(b.css(bt,"marginTop"))||0;bu.left-=parseFloat(b.css(bt,"marginLeft"))||0;e.top+=parseFloat(b.css(bs[0],"borderTopWidth"))||0;e.left+=parseFloat(b.css(bs[0],"borderLeftWidth"))||0;return{top:bu.top-e.top,left:bu.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||aq.body;while(e&&(!aa.test(e.nodeName)&&b.css(e,"position")==="static")){e=e.offsetParent}return e})}});b.each(["Left","Top"],function(bs,e){var bt="scroll"+e;b.fn[bt]=function(bw){var bu,bv;if(bw===K){bu=this[0];if(!bu){return null}bv=aG(bu);return bv?("pageXOffset" in bv)?bv[bs?"pageYOffset":"pageXOffset"]:b.support.boxModel&&bv.document.documentElement[bt]||bv.document.body[bt]:bu[bt]}return this.each(function(){bv=aG(this);if(bv){bv.scrollTo(!bs?bw:b(bv).scrollLeft(),bs?bw:b(bv).scrollTop())}else{this[bt]=bw}})}});function aG(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}b.each(["Height","Width"],function(bs,e){var bt=e.toLowerCase();b.fn["inner"+e]=function(){var bu=this[0];return bu&&bu.style?parseFloat(b.css(bu,bt,"padding")):null};b.fn["outer"+e]=function(bv){var bu=this[0];return bu&&bu.style?parseFloat(b.css(bu,bt,bv?"margin":"border")):null};b.fn[bt]=function(bv){var bw=this[0];if(!bw){return bv==null?null:this}if(b.isFunction(bv)){return this.each(function(bA){var bz=b(this);bz[bt](bv.call(this,bA,bz[bt]()))})}if(b.isWindow(bw)){var bx=bw.document.documentElement["client"+e];return bw.document.compatMode==="CSS1Compat"&&bx||bw.document.body["client"+e]||bx}else{if(bw.nodeType===9){return Math.max(bw.documentElement["client"+e],bw.body["scroll"+e],bw.documentElement["scroll"+e],bw.body["offset"+e],bw.documentElement["offset"+e])}else{if(bv===K){var by=b.css(bw,bt),bu=parseFloat(by);return b.isNaN(bu)?by:bu}else{return this.css(bt,typeof bv==="string"?bv:bv+"px")}}}}});a9.jQuery=a9.$=b})(window);jQuery.Buffer=function(){var b=function(c){if(c){this.assign(c)}this._bufferedCommandList=[];this._bufferedCommands={}};b._buffers=[];b._pool=[];b.bufferForElement=function(c){if(c._jquery_buffer){return c._jquery_buffer}return this.bufferFromPool().assign(c)};b.bufferFromPool=function(){var c=null;if(this._pool.length===0){c=new b()}else{c=this._pool.pop()}b._buffers.push(c);if(!this.flushingScheduled){this.scheduleFlushing()}return c};b.returnToPool=function(c){c.unassign();this._pool.push(c)};b.scheduleFlushing=function(){this.flushingScheduled=true};b.flush=function(){var e=this._buffers,d,c=e.length;for(d=0;d<c;d++){e[d].flush();this.returnToPool(e[d])}this._buffers=[];this.flushingScheduled=false};b.prototype.assign=function(c){if(this._el){this.unassign()}this._el=c;this._el._jquery_buffer=this;return this};b.prototype.unassign=function(){if(!this._el){return}this._el._jquery_buffer=undefined;this._el=undefined;return this};b.prototype.flush=function(){var f=this._bufferedCommandList,e=f.length,d,g;for(d=0;d<e;d++){g=f[d];this[g](this._bufferedCommands[g]);delete this._bufferedCommands[g]}this._bufferedCommandList.length=0;this.unassign()};b.prototype.$=function(c,d){if(!d){d=this._el}if(c===""||c===undefined){c=d;d=undefined}return jQuery(c,d)};b.prototype.bufferedCommand=function(c){if(!this._bufferedCommands[c]){this._bufferedCommands[c]={};this._bufferedCommandList.push(c)}return this._bufferedCommands[c]};b.prototype.hasBufferedCommand=function(c){return !!this._bufferedCommands[c]};b.prototype.html=function(d){var c=this.bufferedCommand("flushContent");if(d===undefined){return c.text||c.html||this.$().html()}c.text=undefined;c.html=d};b.prototype.text=function(d){var c=this.bufferedCommand("flushContent");if(d===undefined){return c.text||c.html||this.$().text()}c.text=d;c.html=undefined};b.prototype.flushContent=function(c){if(c.text!==undefined){this.$().text(c.text)}else{if(c.html!==undefined){this.$().html(c.html)}}};b.prototype.attr=function(f,g){if(typeof f==="object"){for(var d in f){this.attr(d,f[d])}return}if(f==="class"){if(g===undefined){return this.setClass().join(" ")}else{if(typeof g==="string"||jQuery.isArray(g)){var c=this.bufferedCommand("flushClassNames");c.classNames=this._hashFromClassNames(g);return}else{return this.setClass(g)}}}else{if(f==="html"){return this.html(g)}else{if(f==="text"){return this.text(g)}else{if(f==="style"){return this.resetStyles(g)}}}}var e=this.bufferedCommand("flushAttributes");if(!e.attr){e.attr={}}e.attr[f]=g};b.prototype.flushAttributes=function(f){var c=f.attr,g=this.$(),d;for(var e in c){if(!c.hasOwnProperty(e)){continue}d=c[e];if(d!==null){g.attr(e,d)}else{g.removeAttr(e)}}};b.prototype._STYLE_REGEX=/-?\s*([^:\s]+)\s*:\s*([^;]+)\s*;?/g;b.prototype._camelizeStyleName=function(c){var d=c.match(/^-(webkit|moz|o)-/),e=c.camelize();if(d){return e.substr(0,1).toUpperCase()+e.substr(1)}else{return e}};b.prototype._dasherizeStyleName=function(c){var d=SC.String.dasherize(c);if(d.match(/^(webkit|moz|ms|o)-/)){d="-"+d}return d};b.prototype._loadStyles=function(c){if(!c){c=this.$().attr("style")}if(c&&(c=c.toString()).length>0){if(SC.browser.isIE){c=c.toLowerCase()}var f={};var e=this._STYLE_REGEX,d;e.lastIndex=0;while(d=e.exec(c)){f[this._camelizeStyleName(d[1])]=d[2]}return f}else{return{}}};b.prototype.resetStyles=function(d){var c=this.bufferedCommand("flushStyles");c._styles=this._loadStyles(d||" ")};b.prototype.styles=function(){var c=this.bufferedCommand("flushStyles");if(!c._styles){c._styles=this._loadStyles()}return c._styles};b.prototype.css=function(e,f){if(typeof e==="object"){for(var c in e){this.css(c,e[c])}return}var d=this.bufferedCommand("flushStyles");if(!d._styles){d._styles=this._loadStyles()}d._styles[e]=f};b.prototype.flushStyles=function(e){var g=e._styles;var i="";var d,h,f=[],c=0;for(d in g){if(!g.hasOwnProperty(d)){continue}h=g[d];if(h===null){continue}if(typeof h==="number"&&d!=="zIndex"&&d!=="fontWeight"&&d!=="opacity"){h+="px"}f[c++]=this._dasherizeStyleName(d)+": "+h}this.$().attr("style",f.join("; "))};b.prototype._hashFromClassNames=function(f){if(typeof f==="string"){f=f.split(" ")}var d,c=f.length,e={};for(d=0;d<c;d++){e[f[d]]=true}return e};b.prototype.setClass=function(g,c){var f=this.bufferedCommand("flushClassNames"),e;if(g===undefined){if(!f.classNames){f.classNames=this._hashFromClassNames(this._el.className)}var h=f.classNames,d=[];for(e in h){if(e&&h[e]){d.push(e)}}return d}if(typeof g==="object"){if(!f.classNames){f.classNames=this._hashFromClassNames(this._el.className)}for(e in g){f.classNames[e]=g[e]}return}if(!f.classNames){f.classNames=this._hashFromClassNames(this._el.className)}f.classNames[g]=c||false};b.prototype.hasClass=function(d){var c=this.bufferedCommand("flushClassNames");if(!c.classNames){c.classNames=this._hashFromClassNames(this._el.className)}return !!c.classNames[d]};b.prototype.addClass=function(f){if(!f){return}var e=this.bufferedCommand("flushClassNames");if(!e.classNames){e.classNames=this._hashFromClassNames(this._el.className)}if(typeof f==="string"){f=f.split(" ")}var d,c=f.length;for(d=0;d<c;d++){e.classNames[jQuery.trim(f[d])]=true}};b.prototype.removeClass=function(d){var c=this.bufferedCommand("flushClassNames");if(d===undefined){c.classNames={}}else{if(!c.classNames){c.classNames=this._hashFromClassNames(this._el.className)}c.classNames[d]=false}};b.prototype.resetClassNames=function(d){var c=this.bufferedCommand("flushClassNames");c.classNames={}};b.prototype.flushClassNames=function(e){var f=[];var g=e.classNames,d;for(d in g){if(g[d]){f.push(d)}}this.$().attr("class",f.join(" "))};function a(d){for(var c in d){if(typeof d[c]==="function"){d[c].displayName=c}}}a(b);a(b.prototype);return b}();(function(){jQuery.buffer=jQuery.bufferedJQuery=jQuery.sub();jQuery.bufferedJQuery.fn.extend({html:function(d){if(d===undefined){if(this.length<1){return undefined}return jQuery.Buffer.bufferForElement(this[0]).html()}var a=this.length,c,b;for(c=0;c<a;c++){b=jQuery.Buffer.bufferForElement(this[c]);b.html(d)}return this},text:function(d){if(d===undefined){if(this.length<1){return undefined}return jQuery.Buffer.bufferForElement(this[0]).text()}var a=this.length,c,b;for(c=0;c<a;c++){b=jQuery.Buffer.bufferForElement(this[c]);b.text(d)}return this},attr:function(d,e){var b;if(typeof e==="undefined"&&typeof d==="string"){if(this.length<1){return false}b=jQuery.Buffer.bufferForElement(this[0]);return b.attr(d)}var a=this.length,c;for(c=0;c<a;c++){b=jQuery.Buffer.bufferForElement(this[c]);b.attr(d,e)}return this},hasClass:function(a){if(this.length<1){return false}return jQuery.Buffer.bufferForElement(this[0]).hasClass(a)},setClass:function(e,c){var a=this.length,d,b;for(d=0;d<a;d++){b=jQuery.Buffer.bufferForElement(this[d]);b.setClass(e,c)}return this},addClass:function(d){var a=this.length,c,b;for(c=0;c<a;c++){b=jQuery.Buffer.bufferForElement(this[c]);b.addClass(d)}return this},removeClass:function(d){var a=this.length,c,b;for(c=0;c<a;c++){b=jQuery.Buffer.bufferForElement(this[c]);b.removeClass(d)}return this},resetClassNames:function(){var a=this.length,c,b;for(c=0;c<a;c++){b=jQuery.Buffer.bufferForElement(this[c]);b.resetClassNames()}return this},css:function(d,e){var a=this.length,c,b;for(c=0;c<a;c++){b=jQuery.Buffer.bufferForElement(this[c]);b.css(d,e)}return this},styles:function(){if(this.length<1){return null}return jQuery.Buffer.bufferForElement(this[0]).styles()},resetStyles:function(){if(this.length<1){return null}jQuery.Buffer.bufferForElement(this[0]).resetStyles();return this}})})();jQuery.Buffer._flush=function(){jQuery.Buffer.flush()};jQuery.Buffer.scheduleFlushing=function(){SC.RunLoop.currentRunLoop.invokeOnce(jQuery.Buffer._flush);this.flushingScheduled=true};if(!window.require){window.require=function require(){}}if(!window.sc_require){window.sc_require=require}if(!window.sc_resource){window.sc_resource=function sc_resource(){}}sc_require("license");window.YES=true;window.NO=false;if(typeof console==="undefined"){window.console={};console.log=console.info=console.warn=console.error=function(){}}window.SC=window.SC||{};window.SproutCore=window.SproutCore||SC;SC=window.SC;SC.VERSION="1.9.2";SC._baseMixin=function(c){var f=Array.prototype.slice.call(arguments,1),a,e=f[0]||{},g=1,d=f.length,i,b,h;if(d===1){e=this||{};g=0}for(;g<d;g++){if(!(i=f[g])){continue}for(h in i){if(!i.hasOwnProperty(h)){continue}b=i[h];if(e===b){continue}if(b!==undefined&&(c||(e[h]===undefined))){e[h]=b}}if(i.hasOwnProperty("toString")){e.toString=i.toString}}return e};SC.mixin=function(){var a=Array.prototype.slice.call(arguments);a.unshift(true);return SC._baseMixin.apply(this,a)};SC.supplement=function(){var a=Array.prototype.slice.call(arguments);a.unshift(false);return SC._baseMixin.apply(this,a)};SC.extend=SC.mixin;SC.mixin({T_ERROR:"error",T_OBJECT:"object",T_NULL:"null",T_CLASS:"class",T_HASH:"hash",T_FUNCTION:"function",T_UNDEFINED:"undefined",T_NUMBER:"number",T_BOOL:"boolean",T_ARRAY:"array",T_STRING:"string",T_DATE:"date",T_REGEXP:"regexp",typeOf:function(a){if(a===undefined){return SC.T_UNDEFINED}if(a===null){return SC.T_NULL}var b=jQuery.type(a);if(b==="function"){return a.isClass?SC.T_CLASS:SC.T_FUNCTION}else{if(b==="object"){if(SC.Error&&(a instanceof SC.Error)){return SC.T_ERROR}else{if(a instanceof SC.Object){return SC.T_OBJECT}else{return SC.T_HASH}}}}return b},none:function(a){return a==null},empty:function(a){return a===null||a===undefined||a===""},isArray:function(a){if(!a||a.setInterval){return false}if(Array.isArray&&Array.isArray(a)){return true}if(a.objectAt){return true}if(a.length!==undefined&&jQuery.type(a)==="object"){return true}return false},makeArray:function(a){return SC.isArray(a)?a:SC.A(a)},A:function(c){if(c===null||c===undefined){return[]}if(c.slice instanceof Function){if(typeof(c)==="string"){return[c]}else{return c.slice()}}if(c.toArray){return c.toArray()}if(!SC.isArray(c)){return[c]}var b=[],a=c.length;while(--a>=0){b[a]=c[a]}return b},guidKey:"SproutCore"+(SC.VERSION+Math.random()).replace(/\D/g,""),_guidPrefixes:{number:"nu",string:"st"},_guidCaches:{number:{},string:{}},_numberGuids:[],_stringGuids:{},_keyCache:{},guidFor:function(e){var b,c,d=typeof e;if(e===undefined){return"(undefined)"}if(e===null){return"(null)"}if(d===SC.T_NUMBER||d===SC.T_STRING){b=this._guidCaches[d];c=b[e];if(!c){c="st"+(jQuery.uuid++);b[e]=c}return c}else{if(d===SC.T_BOOL){return(e)?"(true)":"(false)"}}var a=this.guidKey;if(e[a]){return e[a]}if(e===Object){return"(Object)"}if(e===Array){return"(Array)"}return SC.generateGuid(e,"sc")},keyFor:function(d,c){var b,a=this._keyCache[d];if(!a){a=this._keyCache[d]={}}b=a[c];if(!b){b=a[c]=d+"_"+c}return b},generateGuid:function(c,b){var a=(b+(jQuery.uuid++));if(c){c[this.guidKey]=a}return a},hashFor:function(){var a=arguments.length,c="",e,d,b;for(b=0;b<a;++b){e=arguments[b];c+=(e&&(d=e.hash)&&(typeof d===SC.T_FUNCTION))?d.call(e):this.guidFor(e)}return c===""?null:c},isEqual:function(d,c){return this.hashFor(d)===this.hashFor(c)},compare:function(s,p){if(s===p){return 0}var j=SC.typeOf(s);var g=SC.typeOf(p);var b=SC.ORDER_DEFINITION_MAPPING;if(!b){var d=SC.ORDER_DEFINITION;b=SC.ORDER_DEFINITION_MAPPING={};var q,n;for(q=0,n=d.length;q<n;++q){b[d[q]]=q}delete SC.ORDER_DEFINITION}var t=b[j];var c=b[g];if(t<c){return -1}if(t>c){return 1}switch(j){case SC.T_BOOL:case SC.T_NUMBER:if(s<p){return -1}if(s>p){return 1}return 0;case SC.T_STRING:var k=s.localeCompare(p);if(k<0){return -1}if(k>0){return 1}return 0;case SC.T_ARRAY:var o=s.length;var m=p.length;var e=Math.min(o,m);var a=0;var h=0;var f=arguments.callee;while(a===0&&h<e){a=f(s[h],p[h]);h++}if(a!==0){return a}if(o<m){return -1}if(o>m){return 1}return 0;case SC.T_OBJECT:if(s.constructor.isComparable===YES){return s.constructor.compare(s,p)}return 0;default:return 0}},K:function(){return this},EMPTY_ARRAY:[],EMPTY_HASH:{},EMPTY_RANGE:{start:0,length:0},beget:function(c){if(c===null||c===undefined){return null}var a=SC.K;a.prototype=c;var b=new a();a.prototype=null;if(typeof c.didBeget==="function"){b=c.didBeget(b)}return b},copy:function(d,b){var c=d,a;if(d){if(d.isCopyable){return d.copy(b)}if(d.clone){return d.clone()}}switch(jQuery.type(d)){case"array":c=d.slice();if(b){a=c.length;while(a--){c[a]=SC.copy(c[a],true)}}break;case"object":c={};for(var e in d){c[e]=b?SC.copy(d[e],true):d[e]}}return c},merge:function(){var c={},b=arguments.length,a;for(a=0;a<b;a++){SC.mixin(c,arguments[a])}return c},keys:function(c){var a=[];for(var b in c){a.push(b)}return a},inspect:function(d){var a,b=[];for(var c in d){a=d[c];if(a==="toString"){continue}if(SC.typeOf(a)===SC.T_FUNCTION){a="function() { ... }"}b.push(c+": "+a)}return"{"+b.join(" , ")+"}"},tupleForPropertyPath:function(e,a){if(typeof e==="object"&&(e instanceof Array)){return e}var c;var b=e.indexOf("*");if(b<0){b=e.lastIndexOf(".")}c=(b>=0)?e.slice(b+1):e;var d=this.objectForPropertyPath(e,a,b);return(d&&c)?[d,c]:null},objectForPropertyPath:function(f,c,d){var g,b,e,a;if(!c){c=window}if(SC.typeOf(f)===SC.T_STRING){if(d===undefined){d=f.length}g=0;while((c)&&(g<d)){b=f.indexOf(".",g);if((b<0)||(b>d)){b=d}e=f.slice(g,b);c=c.get?c.get(e):c[e];g=b+1}if(g<d){c=undefined}}else{g=0;a=f.length;e=null;while((g<a)&&c){e=f[g++];if(e){c=(c.get)?c.get(e):c[e]}}if(g<a){c=undefined}}return c},requiredObjectForPropertyPath:function(c,a,b){var d=SC.objectForPropertyPath(c,a,b);if(!d){throw c+" could not be found"}return d}});SC.clone=SC.copy;SC.$A=SC.A;SC.didLoad=SC.K;SC.ORDER_DEFINITION=[SC.T_ERROR,SC.T_UNDEFINED,SC.T_NULL,SC.T_BOOL,SC.T_NUMBER,SC.T_STRING,SC.T_ARRAY,SC.T_HASH,SC.T_OBJECT,SC.T_FUNCTION,SC.T_CLASS];SC.Function={property:function(b,c){b.dependentKeys=SC.$A(c);var a=SC.guidFor(b);b.cacheKey="__cache__"+a;b.lastSetValueKey="__lastValue__"+a;b.isProperty=true;return b},cacheable:function(a,b){a.isProperty=true;if(!a.dependentKeys){a.dependentKeys=[]}a.isCacheable=(b===undefined)?true:b;return a},idempotent:function(a,b){a.isProperty=true;if(!a.dependentKeys){this.dependentKeys=[]}a.isVolatile=(b===undefined)?true:b;return a},enhance:function(a){a.isEnhancement=true;return a},observes:function(c,a){var f=a.length,b=null,e=null;while(--f>=0){var d=a[f];if((d.indexOf(".")<0)&&(d.indexOf("*")<0)){if(!b){b=c.localPropertyPaths=[]}b.push(d)}else{if(!e){e=c.propertyPaths=[]}e.push(d)}}return c}};sc_require("system/function");SC.mixin(Function.prototype,{property:function(){return SC.Function.property(this,arguments)},cacheable:function(a){return SC.Function.cacheable(this,a)},idempotent:function(a){return SC.Function.idempotent(this,a)},enhance:function(){return SC.Function.enhance(this)},observes:function(a){return SC.Function.observes(this,arguments)}});SC.ObserverSet={add:function(j,a,c){var b=SC.guidFor(j),f=SC.guidFor(a),i=this._members,d=this.members,g=i[b],h,e;if(!g){g=i[b]={}}h=g[f];if(h===undefined){g[f]=d.length;e=[j,a,c];d.push(e)}else{}},remove:function(g,h){var e=SC.guidFor(g),b=SC.guidFor(h);var d=this._members[e],a=this.members;if(!d){return false}var c=d[b];if(c===undefined){return false}if(c!==a.length-1){var f=(a[c]=a[a.length-1]);this._members[SC.guidFor(f[0])][SC.guidFor(f[1])]=c}a.pop();delete this._members[e][b];return true},invokeMethods:function(){var b=this.members,d;for(var c=0,a=b.length;c<a;c++){d=b[c];d[1].call(d[0])}},clone:function(){var c=SC.ObserverSet.create(),d=this.members;c._members=SC.clone(this._members);var e=c.members;for(var b=0,a=d.length;b<a;b++){e[b]=SC.clone(d[b]);e[b].length=3}return c},create:function(){return new SC.ObserverSet.constructor()},getMembers:function(){return this.members.slice(0)},constructor:function(){this._members={};this.members=[]}};SC.ObserverSet.constructor.prototype=SC.ObserverSet;SC.ObserverSet.slice=SC.ObserverSet.clone;SC.ObserverSet.copy=SC.ObserverSet.clone;SC._ChainObserver=function(b,a){this.property=b;this.root=a||this};SC._ChainObserver.createChain=function(f,m,g,a,b){var d=m.split("."),j=new SC._ChainObserver(d[0]),h=j;for(var e=1,c=d.length;e<c;e++){h=h.next=new SC._ChainObserver(d[e],j)}var k=j.tails=[h];j.objectDidChange(f);k.forEach(function(i){i.target=g;i.method=a;i.context=b});j.tails=null;return j};SC._ChainObserver.prototype={isChainObserver:true,object:null,property:null,next:null,root:null,target:null,method:null,tail:function(){if(this._tail){return this._tail}var a=this;while(a.next){a=a.next}this._tail=a;return a},objectDidChange:function(a){if(a===this.object){return}if(this.object){if(this.property==="@each"&&this.object._removeContentObserver){this.object._removeContentObserver(this)}else{if(this.object.removeObserver){this.object.removeObserver(this.property,this,this.propertyDidChange)}}}this.object=a;if(this.property==="@each"&&this.next){if(this.object&&this.object._addContentObserver){this.object._addContentObserver(this)}}else{if(this.object&&this.object.addObserver){this.object.addObserver(this.property,this,this.propertyDidChange)}this.propertyDidChange()}},propertyDidChange:function(){var b=this.object;var e=this.property;var d=(b&&b.get)?b.get(e):null;if(this.next){this.next.objectDidChange(d)}var f=this.target,g=this.method,c=this.context;if(f&&g){var a=b?b.propertyRevision:null;if(c){g.call(f,b,e,d,c,a)}else{g.call(f,b,e,d,a)}}},destroyChain:function(){var a=this.object;if(a){if(this.property==="@each"&&this.next&&a._removeContentObserver){a._removeContentObserver(this)}if(a.removeObserver){a.removeObserver(this.property,this,this.propertyDidChange)}}if(this.next){this.next.destroyChain()}this.next=this.target=this.method=this.object=this.context=null;return null}};sc_require("ext/function");sc_require("private/observer_set");sc_require("private/chain_observer");SC.LOG_OBSERVERS=NO;SC.OBSERVES_HANDLER_ADD=0;SC.OBSERVES_HANDLER_REMOVE=1;SC.Observable={isObservable:YES,automaticallyNotifiesObserversFor:function(a){return YES},get:function(c){var b=this[c],a;if(b===undefined){return this.unknownProperty(c)}else{if(b&&b.isProperty){if(b.isCacheable){a=this._kvo_cache;if(!a){a=this._kvo_cache={}}return(a[b.cacheKey]!==undefined)?a[b.cacheKey]:(a[b.cacheKey]=b.call(this,c))}else{return b.call(this,c)}}else{return b}}},set:function(i,g){var b=this[i],j=this.automaticallyNotifiesObserversFor(i),f=g,d,a,h,e;if(g===undefined&&SC.typeOf(i)===SC.T_HASH){var c=i;for(i in c){if(!c.hasOwnProperty(i)){continue}this.set(i,c[i])}return this}if(!j&&this._kvo_cacheable&&(a=this._kvo_cache)){d=this._kvo_cachedep;if(!d||(d=d[i])===undefined){d=this._kvo_computeCachedDependentsFor(i)}if(d){h=d.length;while(--h>=0){e=d[h];a[e.cacheKey]=a[e.lastSetValueKey]=undefined}}}if(b&&b.isProperty){a=this._kvo_cache;if(b.isVolatile||!a||(a[b.lastSetValueKey]!==g)){if(!a){a=this._kvo_cache={}}a[b.lastSetValueKey]=g;if(j){this.propertyWillChange(i)}f=b.call(this,i,g);if(b.isCacheable){a[b.cacheKey]=f}if(j){this.propertyDidChange(i,f,YES)}}}else{if(b===undefined){if(j){this.propertyWillChange(i)}this.unknownProperty(i,g);if(j){this.propertyDidChange(i,f)}}else{if(this[i]!==g){if(j){this.propertyWillChange(i)}f=this[i]=g;if(j){this.propertyDidChange(i,f)}}}}return this},unknownProperty:function(a,b){if(!(b===undefined)){this[a]=b}return b},beginPropertyChanges:function(){this._kvo_changeLevel=(this._kvo_changeLevel||0)+1;return this},endPropertyChanges:function(){this._kvo_changeLevel=(this._kvo_changeLevel||1)-1;var b=this._kvo_changeLevel,a=this._kvo_changes;if((b<=0)&&a&&(a.length>0)&&!SC.Observers.isObservingSuspended){this._notifyPropertyObservers()}return this},propertyWillChange:function(a){return this},propertyDidChange:function(n,l,c){this._kvo_revision=(this._kvo_revision||0)+1;var b=this._kvo_changeLevel||0,h,m,i,d,f=SC.LOG_OBSERVERS&&(this.LOG_OBSERVING!==NO);var j=this._kvo_property_chains;if(j){var g=j[n];if(g){this.beginPropertyChanges();g=SC.clone(g);g.forEach(function(o){o.notifyPropertyDidChange()});this.endPropertyChanges()}}var a=this._kvo_cache;if(a){if(!c){d=this[n];if(d&&d.isProperty){a[d.cacheKey]=a[d.lastSetValueKey]=undefined}}if(this._kvo_cacheable){h=this._kvo_cachedep;if(!h||(h=h[n])===undefined){h=this._kvo_computeCachedDependentsFor(n)}if(h){m=h.length;while(--m>=0){i=h[m];a[i.cacheKey]=a[i.lastSetValueKey]=undefined}}}}var e=SC.Observers.isObservingSuspended;if((b>0)||e){var k=this._kvo_changes;if(!k){k=this._kvo_changes=SC.CoreSet.create()}k.add(n);if(e){if(f){SC.Logger.log("%@%@: will not notify observers because observing is suspended".fmt(SC.KVO_SPACES,this))}SC.Observers.objectHasPendingChanges(this)}}else{this._notifyPropertyObservers(n)}return this},registerDependentKey:function(h,c){var e=this._kvo_dependents,i=this._kvo_chain_dependents,b=this[h],j,g,a,f,d;if(typeof c==="object"&&(c instanceof Array)){j=c;a=0}else{j=arguments;a=1}g=j.length;if(!e){this._kvo_dependents=e={}}while(--g>=a){f=j[g];if(f.indexOf(".")>=0){SC._PropertyChain.createChain(f,this,h).activate()}else{d=e[f];if(!d){d=e[f]=[]}d.push(h)}}},registerDependentKeyWithChain:function(c,a){var d=this._chainsFor(c),b;d.add(a)},removeDependentKeyWithChain:function(c,a){var d=this._chainsFor(c),b;d.remove(a);if(d.get("length")===0){delete this._kvo_property_chains[c]}},_chainsFor:function(a){this._kvo_property_chains=this._kvo_property_chains||{};var b=this._kvo_property_chains[a]||SC.CoreSet.create();this._kvo_property_chains[a]=b;return b},_kvo_addCachedDependents:function(b,f,h,c){var a=f.length,e,d,g;while(--a>=0){d=f[a];c.add(d);e=this[d];if(e&&(e instanceof Function)&&e.isProperty){if(e.isCacheable){b.push(e)}if((g=h[d])&&g.length>0){this._kvo_addCachedDependents(b,g,h,c)}}}},_kvo_computeCachedDependentsFor:function(c){var d=this._kvo_cachedep,f=this._kvo_dependents,e=f?f[c]:null,a,b;if(!d){d=this._kvo_cachedep={}}if(!e||e.length===0){return d[c]=null}a=d[c]=[];b=SC._TMP_SEEN_SET=(SC._TMP_SEEN_SET||SC.CoreSet.create());b.add(c);this._kvo_addCachedDependents(a,e,f,b);b.clear();if(a.length===0){a=d[c]=null}return a},_kvo_for:function(c,b){var a=this[c];if(!this._kvo_cloned){this._kvo_cloned={}}if(!a){a=this[c]=(b===undefined)?[]:b.create();this._kvo_cloned[c]=YES}else{if(!this._kvo_cloned[c]){a=this[c]=a.copy();this._kvo_cloned[c]=YES}}return a},addObserver:function(c,f,h,b){var d,a,e,g;if(h===undefined){h=f;f=this}if(!f){f=this}if(typeof h==="string"){h=f[h]}if(!h){throw"You must pass a method to addObserver()"}c=c.toString();if(c.indexOf(".")>=0){a=SC._ChainObserver.createChain(this,c,f,h,b);a.masterTarget=f;a.masterMethod=h;this._kvo_for(SC.keyFor("_kvo_chains",c)).push(a)}else{if((this[c]===undefined)&&(c.indexOf("@")===0)){this.get(c)}if(f===this){f=null}d=SC.keyFor("_kvo_observers",c);this._kvo_for(d,SC.ObserverSet).add(f,h,b);this._kvo_for("_kvo_observed_keys",SC.CoreSet).add(c)}if(this.didAddObserver){this.didAddObserver(c,f,h)}return this},removeObserver:function(c,f,h){var d,e,b,g,a;if(h===undefined){h=f;f=this}if(!f){f=this}if(typeof h==="string"){h=f[h]}if(!h){throw"You must pass a method to removeObserver()"}c=c.toString();if(c.indexOf(".")>=0){d=SC.keyFor("_kvo_chains",c);if(e=this[d]){e=this._kvo_for(d);a=e.length;while(--a>=0){b=e[a];if(b&&(b.masterTarget===f)&&(b.masterMethod===h)){e[a]=b.destroyChain()}}}}else{if(f===this){f=null}d=SC.keyFor("_kvo_observers",c);if(g=this[d]){g=this._kvo_for(d);g.remove(f,h);if(g.getMembers().length===0){this._kvo_for("_kvo_observed_keys",SC.CoreSet).remove(c)}}}if(this.didRemoveObserver){this.didRemoveObserver(c,f,h)}return this},hasObserverFor:function(b){SC.Observers.flush(this);var d=this[SC.keyFor("_kvo_observers",b)],c=this[SC.keyFor("_kvo_local",b)],a;if(c&&c.length>0){return YES}if(d&&d.getMembers().length>0){return YES}return NO},initObservable:function(){if(this._observableInited){return}this._observableInited=YES;var f,m,k,j,h,e,l,g,c,n,b,i,d,a;if(m=this._observers){g=m.length;for(f=0;f<g;f++){k=m[f];h=this[k];e=h.propertyPaths;l=(e)?e.length:0;for(c=0;c<l;c++){n=e[c];this.addObservesHandler(h,n)}}}this.bindings=[];if(m=this._bindings){for(f=0,a=m.length;f<a;f++){k=m[f];j=this[k];d=k.slice(0,-7);this[k]=this.bind(d,j)}}if(m=this._properties){for(f=0,a=m.length;f<a;f++){k=m[f];if(j=this[k]){if(j.isCacheable){this._kvo_cacheable=YES}if(j.dependentKeys&&(j.dependentKeys.length>0)){this.registerDependentKey(k,j.dependentKeys)}}}}delete this._observers;delete this._bindings;delete this._properties},addObservesHandler:function(a,b){this._configureObservesHandler(SC.OBSERVES_HANDLER_ADD,a,b);return this},removeObservesHandler:function(a,b){this._configureObservesHandler(SC.OBSERVES_HANDLER_REMOVE,a,b);return this},_configureObservesHandler:function(d,b,e){var c,a;switch(d){case SC.OBSERVES_HANDLER_ADD:d="addObserver";break;case SC.OBSERVES_HANDLER_REMOVE:d="removeObserver";break;default:throw"invalid action provided: "+d}c=e.indexOf(".");if(c<0){this[d](e,this,b)}else{if(e.indexOf("*")===0){this[d](e.slice(1),this,b)}else{a=null;if(c===0){a=this;e=e.slice(1)}else{if(c===4&&e.slice(0,5)==="this."){a=this;e=e.slice(5)}else{if(c<0&&e.length===4&&e==="this"){a=this;e=""}else{if(c>0&&e[0]===e.charAt(0).toLowerCase()){a=this}}}}SC.Observers[d](e,this,b,a)}}},observersForKey:function(a){SC.Observers.flush(this);var b=this[SC.keyFor("_kvo_observers",a)];return b?b.getMembers():[]},_notifyPropertyObservers:function(t){if(!this._observableInited){this.initObservable()}SC.Observers.flush(this);var g=SC.LOG_OBSERVERS&&!(this.LOG_OBSERVING===NO),o,r,m,d,n,l,q,p,j,a,f,s,c,i,e,b,h,k;if(g){h=SC.KVO_SPACES=(SC.KVO_SPACES||"")+"  ";SC.Logger.log('%@%@: notifying observers after change to key "%@"'.fmt(h,this,t))}d=this["_kvo_observers_*"];this._kvo_changeLevel=(this._kvo_changeLevel||0)+1;while(((r=this._kvo_changes)&&(r.length>0))||t){q=++this.propertyRevision;if(!r){r=SC.CoreSet.create()}this._kvo_changes=null;if(t==="*"){r.add("*");r.addEach(this._kvo_for("_kvo_observed_keys",SC.CoreSet))}else{if(t){r.add(t)}}if(m=this._kvo_dependents){for(n=0;n<r.length;n++){t=r[n];l=m[t];if(l&&(i=l.length)){if(g){SC.Logger.log("%@...including dependent keys for %@: %@".fmt(h,t,l))}k=this._kvo_cache;if(!k){k=this._kvo_cache={}}while(--i>=0){r.add(t=l[i]);if(e=this[t]){this[e.cacheKey]=undefined;k[e.cacheKey]=k[e.lastSetValueKey]=undefined}}}}}while(r.length>0){t=r.pop();o=this[SC.keyFor("_kvo_observers",t)];if(o){p=SC.clone(o.getMembers());j=p.length;for(f=0;f<j;f++){a=p[f];if(a[3]===q){continue}if(!a[1]){SC.Logger.log(a)}s=a[0]||this;c=a[1];b=a[2];a[3]=q;if(g){SC.Logger.log('%@...firing observer on %@ for key "%@"'.fmt(h,s,t))}if(b!==undefined){c.call(s,this,t,null,b,q)}else{c.call(s,this,t,null,q)}}}p=this[SC.keyFor("_kvo_local",t)];if(p){j=p.length;for(f=0;f<j;f++){a=p[f];c=this[a];if(c){if(g){SC.Logger.log('%@...firing local observer %@.%@ for key "%@"'.fmt(h,this,a,t))}c.call(this,this,t,null,q)}}}if(d&&t!=="*"){p=SC.clone(d.getMembers());j=p.length;for(f=0;f<j;f++){a=p[f];s=a[0]||this;c=a[1];b=a[2];if(g){SC.Logger.log('%@...firing * observer on %@ for key "%@"'.fmt(h,s,t))}if(b!==undefined){c.call(s,this,t,null,b,q)}else{c.call(s,this,t,null,q)}}}if(this.propertyObserver){if(g){SC.Logger.log('%@...firing %@.propertyObserver for key "%@"'.fmt(h,this,t))}this.propertyObserver(this,t,null,q)}}if(r){r.destroy()}t=null}this._kvo_changeLevel=(this._kvo_changeLevel||1)-1;if(g){SC.KVO_SPACES=h.slice(0,-2)}return YES},bind:function(a,c,e){var d,b;if(e!==undefined){c=[c,e]}b=typeof c;if(b==="string"||(b==="object"&&(c instanceof Array))){d=this[a+"BindingDefault"]||SC.Binding;d=d.beget().from(c)}else{d=c.beget()}d=d.to(a,this).connect();this.bindings.push(d);return d},didChangeFor:function(a){var b,f,e,j,d,c,h,i,g;a=SC.hashFor(a);b=this._kvo_didChange_valueCache;if(!b){b=this._kvo_didChange_valueCache={}}f=this._kvo_didChange_revisionCache;if(!f){f=this._kvo_didChange_revisionCache={}}e=b[a]||{};j=f[a]||{};d=false;c=this._kvo_revision||0;h=arguments.length;while(--h>=1){i=arguments[h];if(j[i]!=c){g=this.get(i);if(e[i]!==g){d=true;e[i]=g}}j[i]=c}b[a]=e;f[a]=j;return d},setIfChanged:function(a,b){if(b===undefined&&SC.typeOf(a)===SC.T_HASH){var c=a;for(a in c){if(!c.hasOwnProperty(a)){continue}this.setIfChanged(a,c[a])}return this}return(this.get(a)!==b)?this.set(a,b):this},getPath:function(b){var a=SC.tupleForPropertyPath(b,this);if(a===null||a[0]===null){return undefined}return SC.get(a[0],a[1])},setPath:function(c,b){if(c.indexOf(".")>=0){var a=SC.tupleForPropertyPath(c,this);if(!a||!a[0]){return null}a[0].set(a[1],b)}else{this.set(c,b)}return this},setPathIfChanged:function(c,b){if(c.indexOf(".")>=0){var a=SC.tupleForPropertyPath(c,this);if(!a||!a[0]){return null}if(a[0].get(a[1])!==b){a[0].set(a[1],b)}}else{this.setIfChanged(c,b)}return this},getEach:function(){var d=SC.A(arguments),c=[],a,b;for(a=0,b=d.length;a<b;a++){c[c.length]=this.getPath(d[a])}return c},incrementProperty:function(b,a){if(!a){a=1}this.set(b,(this.get(b)||0)+a);return this.get(b)},decrementProperty:function(b,a){if(!a){a=1}this.set(b,(this.get(b)||0)-a);return this.get(b)},toggleProperty:function(a,b,c){if(b===undefined){b=true}if(c===undefined){c=false}b=(this.get(a)==b)?c:b;this.set(a,b);return this.get(a)},notifyPropertyChange:function(a,b){this.propertyWillChange(a);this.propertyDidChange(a,b);return this},allPropertiesDidChange:function(){this._kvo_cache=null;this._notifyPropertyObservers("*");return this},addProbe:function(a){this.addObserver(a,SC.logChange)},removeProbe:function(a){this.removeObserver(a,SC.logChange)},logProperty:function(){var b=SC.$A(arguments),d,c,a;for(a=0,c=b.length;a<c;a++){d=b[a];SC.Logger.log("%@:%@: ".fmt(SC.guidFor(this),d),this.get(d))}},propertyRevision:1};SC.logChange=function logChange(c,a,b){SC.Logger.log("CHANGE: %@[%@] => %@".fmt(c,a,c.get(a)))};SC.mixin(SC,{get:function(a,b){if(!a){return undefined}if(b===undefined){return this[a]}if(a.get){return a.get(b)}return a[b]},getPath:function(a,b){if(b===undefined){b=a;a=window}return SC.objectForPropertyPath(b,a)}});SC.mixin(Array.prototype,SC.Observable);SC.Enumerator=function(a){this.enumerable=a;this.reset();return this};SC.Enumerator.prototype={nextObject:function(){var c=this._index;var a=this._length;if(c>=a){return undefined}var b=this.enumerable.nextObject(c,this._previousObject,this._context);this._previousObject=b;this._index=c+1;if(c>=a){this._context=SC.Enumerator._pushContext(this._context)}return b},reset:function(){var b=this.enumerable;if(!b){throw SC.$error("Enumerator has been destroyed")}this._length=b.get?b.get("length"):b.length;var a=this._length;this._index=0;this._previousObject=null;this._context=(a>0)?SC.Enumerator._popContext():null},destroy:function(){this.enumerable=this._length=this._index=this._previousObject=this._context=null}};SC.Enumerator.create=function(a){return new SC.Enumerator(a)};SC.Enumerator._popContext=function(){var a=this._contextCache?this._contextCache.pop():null;return a||{}};SC.Enumerator._pushContext=function(b){this._contextCache=this._contextCache||[];var a=this._contextCache;a.push(b);return null};sc_require("core");sc_require("ext/function");sc_require("system/enumerator");SC.Enumerable={isEnumerable:YES,nextObject:function(a,c,b){return this.objectAt?this.objectAt(a):this[a]},firstObject:function(){if(this.get("length")===0){return undefined}if(this.objectAt){return this.objectAt(0)}var b=SC.Enumerator._popContext(),a;a=this.nextObject(0,null,b);b=SC.Enumerator._pushContext(b);return a}.property().cacheable(),lastObject:function(){var a=this.get("length");if(a===0){return undefined}if(this.objectAt){return this.objectAt(a-1)}}.property().cacheable(),enumerator:function(){return SC.Enumerator.create(this)},forEach:function(g,f){if(typeof g!=="function"){throw new TypeError()}var b=this.get?this.get("length"):this.length;if(f===undefined){f=null}var e=null;var c=SC.Enumerator._popContext();for(var a=0;a<b;a++){var d=this.nextObject(a,e,c);g.call(f,d,a,this);e=d}e=null;c=SC.Enumerator._pushContext(c);return this},getEach:function(a){return this.map(function(b){return b?(b.get?b.get(a):b[a]):null},this)},setEach:function(a,b){this.forEach(function(c){if(c){if(c.set){c.set(a,b)}else{c[a]=b}}},this);return this},map:function(h,g){if(typeof h!=="function"){throw new TypeError()}var b=this.get?this.get("length"):this.length;if(g===undefined){g=null}var c=[];var f=null;var d=SC.Enumerator._popContext();for(var a=0;a<b;a++){var e=this.nextObject(a,f,d);c[a]=h.call(g,e,a,this);f=e}f=null;d=SC.Enumerator._pushContext(d);return c},mapProperty:function(a){return this.map(function(b){return b?(b.get?b.get(a):b[a]):null})},filter:function(h,g){if(typeof h!=="function"){throw new TypeError()}var b=this.get?this.get("length"):this.length;if(g===undefined){g=null}var c=[];var f=null;var d=SC.Enumerator._popContext();for(var a=0;a<b;a++){var e=this.nextObject(a,f,d);if(h.call(g,e,a,this)){c.push(e)}f=e}f=null;d=SC.Enumerator._pushContext(d);return c},sortProperty:function(b){var c=(typeof b===SC.T_STRING)?arguments:b,a=c.length,d;if(this instanceof Array){d=this}else{d=[];this.forEach(function(e){d.push(e)})}if(!d){return[]}return d.sort(function(g,f){var e,i,k,j,h=0;for(e=0;h===0&&e<a;e++){i=c[e];k=g?(g.get?g.get(i):g[i]):null;j=f?(f.get?f.get(i):f[i]):null;h=SC.compare(k,j)}return h})},filterProperty:function(j,f){var d=this.get?this.get("length"):this.length;var e=[];var i=null;var b=SC.Enumerator._popContext();for(var g=0;g<d;g++){var c=this.nextObject(g,i,b);var h=c?(c.get?c.get(j):c[j]):null;var a=(f===undefined)?!!h:SC.isEqual(h,f);if(a){e.push(c)}i=c}i=null;b=SC.Enumerator._pushContext(b);return e},find:function(h,d){var c=this.get?this.get("length"):this.length;if(d===undefined){d=null}var g=null,b,i=NO,e=null;var a=SC.Enumerator._popContext();for(var f=0;f<c&&!i;f++){b=this.nextObject(f,g,a);if(i=h.call(d,b,f,this)){e=b}g=b}b=g=null;a=SC.Enumerator._pushContext(a);return e},findProperty:function(i,f){var c=this.get?this.get("length"):this.length;var j=NO,d=null,h=null,b,g;var a=SC.Enumerator._popContext();for(var e=0;e<c&&!j;e++){b=this.nextObject(e,h,a);g=b?(b.get?b.get(i):b[i]):null;j=(f===undefined)?!!g:SC.isEqual(g,f);if(j){d=b}h=b}h=b=null;a=SC.Enumerator._pushContext(a);return d},every:function(h,g){if(typeof h!=="function"){throw new TypeError()}var b=this.get?this.get("length"):this.length;if(g===undefined){g=null}var c=YES;var f=null;var d=SC.Enumerator._popContext();for(var a=0;c&&(a<b);a++){var e=this.nextObject(a,f,d);if(!h.call(g,e,a,this)){c=NO}f=e}f=null;d=SC.Enumerator._pushContext(d);return c},everyProperty:function(i,e){var c=this.get?this.get("length"):this.length;var d=YES;var h=null;var a=SC.Enumerator._popContext();for(var f=0;d&&(f<c);f++){var b=this.nextObject(f,h,a);var g=b?(b.get?b.get(i):b[i]):null;d=(e===undefined)?!!g:SC.isEqual(g,e);h=b}h=null;a=SC.Enumerator._pushContext(a);return d},some:function(h,g){if(typeof h!=="function"){throw new TypeError()}var b=this.get?this.get("length"):this.length;if(g===undefined){g=null}var c=NO;var f=null;var d=SC.Enumerator._popContext();for(var a=0;(!c)&&(a<b);a++){var e=this.nextObject(a,f,d);if(h.call(g,e,a,this)){c=YES}f=e}f=null;d=SC.Enumerator._pushContext(d);return c},someProperty:function(i,e){var c=this.get?this.get("length"):this.length;var d=NO;var h=null;var a=SC.Enumerator._popContext();for(var f=0;!d&&(f<c);f++){var b=this.nextObject(f,h,a);var g=b?(b.get?b.get(i):b[i]):null;d=(e===undefined)?!!g:SC.isEqual(g,e);h=b}h=null;a=SC.Enumerator._pushContext(a);return d},reduce:function(g,h,i){if(typeof g!=="function"){throw new TypeError()}var c=this.get?this.get("length"):this.length;if(c===0&&h===undefined){throw new TypeError()}var d=h;var f=null;var a=SC.Enumerator._popContext();for(var e=0;e<c;e++){var b=this.nextObject(e,f,a);if(b!==null){if(d===undefined){d=b}else{d=g.call(null,d,b,e,this,i)}}f=b}f=null;a=SC.Enumerator._pushContext(a);if(d===undefined){throw new TypeError()}return d},invoke:function(h){var e=this.get?this.get("length"):this.length;if(e<=0){return[]}var i;var g=[];var c=arguments.length;if(c>1){for(i=1;i<c;i++){g.push(arguments[i])}}var f=[];var j=null;var b=SC.Enumerator._popContext();for(i=0;i<e;i++){var d=this.nextObject(i,j,b);var a=d?d[h]:null;if(a){f[i]=a.apply(d,g)}j=d}j=null;b=SC.Enumerator._pushContext(b);return f},invokeWhile:function(d,i){var f=this.get?this.get("length"):this.length;if(f<=0){return null}var j;var h=[];var c=arguments.length;if(c>2){for(j=2;j<c;j++){h.push(arguments[j])}}var g=d;var k=null;var b=SC.Enumerator._popContext();for(j=0;(g===d)&&(j<f);j++){var e=this.nextObject(j,k,b);var a=e?e[i]:null;if(a){g=a.apply(e,h)}k=e}k=null;b=SC.Enumerator._pushContext(b);return g},toArray:function(){var a=[];this.forEach(function(b){a.push(b)},this);return a},groupBy:function(i){var c=this.get?this.get("length"):this.length,d=[],h=null,a=SC.Enumerator._popContext(),e=[],j=[],f,b,g;for(f=0;f<c;f++){b=this.nextObject(f,h,a);g=b?(b.get?b.get(i):b[i]):null;if(SC.none(e[g])){e[g]=[];j.push(g)}e[g].push(b);h=b}h=null;a=SC.Enumerator._pushContext(a);for(f=0,c=j.length;f<c;f++){d.push(e[j[f]])}return d}};SC._buildReducerFor=function(a,b){return function(d,e){var f=this[a];if(SC.typeOf(f)!==SC.T_FUNCTION){return this.unknownProperty?this.unknownProperty(d,e):null}else{var c=SC.Enumerable.reduce.call(this,f,null,b);return c}}.property("[]")};SC.Reducers={"[]":function(a,b){return this}.property(),enumerableContentDidChange:function(c,a,b){if(!SC.none(c)){if(c===0){this.notifyPropertyChange("firstObject")}if(!SC.none(a)&&c+a===this.get("length")-1){this.notifyPropertyChange("lastObject")}}this.notifyPropertyChange("[]")},reducedProperty:function(i,g,f){if(!i||typeof i!==SC.T_STRING||i.charAt(0)!=="@"){return undefined}var d=i.match(/^@([^(]*)(\(([^)]*)\))?$/);if(!d||d.length<2){return undefined}var h=d[1];var j=d[3];h="reduce"+h.slice(0,1).toUpperCase()+h.slice(1);var a=this[h];if(SC.typeOf(a)!==SC.T_FUNCTION){return undefined}if(f===NO){return SC.Enumerable.reduce.call(this,a,null,j)}var c=SC._buildReducerFor(h,j);var b=this.constructor.prototype;if(b){b[i]=c;var e=b._properties||[];e.push(i);b._properties=e;this.registerDependentKey(i,"[]")}return SC.Enumerable.reduce.call(this,a,null,j)},reduceMax:function(a,d,b,f,c){if(c&&d){d=d.get?d.get(c):d[c]}if(a===null){return d}return(d>a)?d:a},reduceMaxObject:function(b,f,c,g,d){var a=b,h=f;if(d){if(f){h=f.get?f.get(d):f[d]}if(b){a=b.get?b.get(d):b[d]}}if(a===null){return f}return(h>a)?f:b},reduceMin:function(a,d,b,f,c){if(c&&d){d=d.get?d.get(c):d[c]}if(a===null){return d}return(d<a)?d:a},reduceMinObject:function(b,f,c,g,d){var a=b,h=f;if(d){if(f){h=f.get?f.get(d):f[d]}if(b){a=b.get?b.get(d):b[d]}}if(a===null){return f}return(h<a)?f:b},reduceAverage:function(b,g,d,h,f){if(f&&g){g=g.get?g.get(f):g[f]}var c=(b||0)+g;var a=h.get?h.get("length"):h.length;if(d>=a-1){c=c/a}return c},reduceSum:function(a,d,b,f,c){if(c&&d){d=d.get?d.get(c):d[c]}return(a===null)?d:a+d}};SC.mixin(SC.Enumerable,SC.Reducers);SC.mixin(Array.prototype,SC.Reducers);Array.prototype.isEnumerable=YES;(function(){var a={nextObject:SC.Enumerable.nextObject,enumerator:SC.Enumerable.enumerator,firstObject:SC.Enumerable.firstObject,lastObject:SC.Enumerable.lastObject,sortProperty:SC.Enumerable.sortProperty,mapProperty:function(g){var e=this.length;var f=[];for(var d=0;d<e;d++){var h=this[d];f[d]=h?(h.get?h.get(g):h[g]):null}return f},filterProperty:function(h,j){var f=this.length;var g=[];for(var e=0;e<f;e++){var i=this[e];var k=i?(i.get?i.get(h):i[h]):null;var d=(j===undefined)?!!k:SC.isEqual(k,j);if(d){g.push(i)}}return g},groupBy:function(h){var e=this.length,g=[],j=[],f=[],d,i,k;for(d=0;d<e;d++){i=this[d];k=i?(i.get?i.get(h):i[h]):null;if(SC.none(j[k])){j[k]=[];f.push(k)}j[k].push(i)}for(d=0,e=f.length;d<e;d++){g.push(j[f[d]])}return g},find:function(j,i){if(typeof j!=="function"){throw new TypeError()}var e=this.length;if(i===undefined){i=null}var g,f=null,h=NO;for(var d=0;d<e&&!h;d++){g=this[d];if(h=j.call(i,g,d,this)){f=g}}g=null;return f},findProperty:function(g,j){var e=this.length;var h,k,i=NO,f=null;for(var d=0;d<e&&!i;d++){k=(h=this[d])?(h.get?h.get(g):h[g]):null;i=(j===undefined)?!!k:SC.isEqual(k,j);if(i){f=h}}h=null;return f},everyProperty:function(g,i){var e=this.length;var f=YES;for(var d=0;f&&(d<e);d++){var h=this[d];var j=h?(h.get?h.get(g):h[g]):null;f=(i===undefined)?!!j:SC.isEqual(j,i)}return f},someProperty:function(g,i){var e=this.length;var f=NO;for(var d=0;!f&&(d<e);d++){var h=this[d];var j=h?(h.get?h.get(g):h[g]):null;f=(i===undefined)?!!j:SC.isEqual(j,i)}return f},invoke:function(f){var e=this.length;if(e<=0){return[]}var d;var h=[];var j=arguments.length;if(j>1){for(d=1;d<j;d++){h.push(arguments[d])}}var g=[];for(d=0;d<e;d++){var i=this[d];var k=i?i[f]:null;if(k){g[d]=k.apply(i,h)}}return g},invokeWhile:function(f,k){var h=this.length;if(h<=0){return null}var l;var j=[];var e=arguments.length;if(e>2){for(l=2;l<e;l++){j.push(arguments[l])}}var i=f;for(l=0;(i===f)&&(l<h);l++){var g=this[l];var d=g?g[k]:null;if(d){i=d.apply(g,j)}}return i},toArray:function(){var e=this.length;if(e<=0){return[]}var f=[];for(var d=0;d<e;d++){var g=this[d];f.push(g)}return f},getEach:function(g){var f=[];var e=this.length;for(var d=0;d<e;d++){var h=this[d];f[d]=h?(h.get?h.get(g):h[g]):null}return f},setEach:function(f,g){var e=this.length;for(var d=0;d<e;d++){var h=this[d];if(h){if(h.set){h.set(f,g)}else{h[f]=g}}}return this}};var c={forEach:function(h,g){if(typeof h!=="function"){throw new TypeError()}if(g===undefined){g=null}for(var e=0,d=this.length;e<d;e++){var f=this[e];h.call(g,f,e,this)}return this},map:function(j,h){if(typeof j!=="function"){throw new TypeError()}if(h===undefined){h=null}var e=[];for(var f=0,d=this.length;f<d;f++){var g=this[f];e[f]=j.call(h,g,f,this)}return e},filter:function(j,h){if(typeof j!=="function"){throw new TypeError()}if(h===undefined){h=null}var e=[];for(var f=0,d=this.length;f<d;f++){var g=this[f];if(j.call(h,g,f,this)){e.push(g)}}return e},every:function(i,h){if(typeof i!=="function"){throw new TypeError()}var e=this.length;if(h===undefined){h=null}var f=YES;for(var d=0;f&&(d<e);d++){var g=this[d];if(!i.call(h,g,d,this)){f=NO}}return f},some:function(i,h){if(typeof i!=="function"){throw new TypeError()}var e=this.length;if(h===undefined){h=null}var f=NO;for(var d=0;(!f)&&(d<e);d++){var g=this[d];if(i.call(h,g,d,this)){f=YES}}return f},reduce:function(j,f,i){if(typeof j!=="function"){throw new TypeError()}var e=this.length;if(e===0&&f===undefined){throw new TypeError()}var g=f;for(var d=0;d<e;d++){var h=this[d];if(h!==null){if(g===undefined){g=h}else{g=j.call(null,g,h,d,this,i)}}}if(g===undefined){throw new TypeError()}return g}};for(var b in c){if(!c.hasOwnProperty(b)){continue}if(!Array.prototype[b]||((typeof Prototype==="object")&&Prototype.Version.match(/^1\.6/))){Array.prototype[b]=c[b]}}SC.mixin(Array.prototype,a)})();SC.RangeObserver={isRangeObserver:YES,toString:function(){var a=this.indexes?this.indexes.toString():"SC.IndexSet<..>";return a.replace("IndexSet","RangeObserver(%@)".fmt(SC.guidFor(this)))},create:function(d,f,e,g,c,a){var b=SC.beget(this);b.source=d;b.indexes=f?f.frozenCopy():null;b.target=e;b.method=(typeof g==="string")?e[g]:g;b.context=c;b.isDeep=a||false;b.beginObserving();return b},extend:function(d){var c=SC.beget(this),b=arguments;for(var e=0,a=b.length;e<a;e++){SC.mixin(c,b[e])}return c},destroy:function(a){this.endObserving();return this},update:function(a,b){if(this.indexes&&this.indexes.isEqual(b)){return this}this.indexes=b?b.frozenCopy():null;this.endObserving().beginObserving();return this},beginObserving:function(){if(!this.isDeep){return this}var c=this.observing=this.observing||SC.CoreSet.create();var a=this._beginObservingForEach,b=this.source;if(!a){a=this._beginObservingForEach=function(d){var e=b.objectAt(d);if(e&&e.addObserver){c.push(e);e._kvo_needsRangeObserver=true}}}this.indexes.forEach(a);this.isObserving=false;SC.Observers.addPendingRangeObserver(this);return this},setupPending:function(b){var e=this.observing;if(this.isObserving||!e||(e.get("length")===0)){return true}if(e.contains(b)){this.isObserving=true;var c=this._setupPendingForEach;if(!c){var d=this.source,f=this.objectPropertyDidChange,a=this;c=this._setupPendingForEach=function(g){var j=d.objectAt(g),h=SC.guidFor(j),i;if(j&&j.addObserver){e.push(j);j.addObserver("*",a,f);i=a[h];if(i==null){a[h]=g}else{if(i.isIndexSet){i.add(g)}else{a[h]=SC.IndexSet.create(i).add(g)}}}}}this.indexes.forEach(c);return true}else{return false}},endObserving:function(){if(!this.isDeep){return this}var e=this.observing;if(this.isObserving){var b=this.objectPropertyDidChange,c=this.source,a,f,d;if(e){f=e.length;for(a=0;a<f;a++){d=e[a];d.removeObserver("*",this,b);this[SC.guidFor(d)]=null}e.length=0}this.isObserving=false}if(e){e.clear()}return this},rangeDidChange:function(b){var a=this.indexes;if(!b||!a||a.intersects(b)){this.endObserving();this.method.call(this.target,this.source,null,"[]",b,this.context);this.beginObserving()}return this},objectPropertyDidChange:function(d,f,g,a){var e=this.context,h=this.method,c=SC.guidFor(d),b=this[c];if(b&&!b.isIndexSet){b=this[c]=SC.IndexSet.create(b).freeze()}h.call(this.target,this.source,d,f,b,e||a,a)}};sc_require("ext/function");sc_require("mixins/observable");sc_require("mixins/enumerable");sc_require("system/range_observer");SC.OUT_OF_RANGE_EXCEPTION="Index out of range";SC.CoreArray={isSCArray:YES,replace:function(a,c,b){throw"replace() must be implemented to support SC.Array"},indexOf:function(d,c){var b,a=this.get("length");if(c===undefined){c=0}else{c=(c<0)?Math.ceil(c):Math.floor(c)}if(c<0){c+=a}for(b=c;b<a;b++){if(this.objectAt(b,YES)===d){return b}}return -1},lastIndexOf:function(d,c){var b,a=this.get("length");if(c===undefined){c=a-1}else{c=(c<0)?Math.ceil(c):Math.floor(c)}if(c<0){c+=a}for(b=c;b>=0;b--){if(this.objectAt(b)===d){return b}}return -1},objectAt:function(a){if(a<0){return undefined}if(a>=this.get("length")){return undefined}return this.get(a)},"[]":function(a,b){if(b!==undefined){this.replace(0,this.get("length"),b)}return this}.property(),insertAt:function(a,b){if(a>this.get("length")){throw SC.OUT_OF_RANGE_EXCEPTION}this.replace(a,0,[b]);return this},removeAt:function(d,a){var c=0,b=[];if(typeof d===SC.T_NUMBER){if((d<0)||(d>=this.get("length"))){throw SC.OUT_OF_RANGE_EXCEPTION}if(a===undefined){this.replace(d,1,b);return this}else{d=SC.IndexSet.create(d,a)}}this.beginPropertyChanges();d.forEachRange(function(f,e){f-=c;c+=e;this.replace(f,e,b)},this);this.endPropertyChanges();return this},removeObject:function(b){var c=this.get("length")||0;while(--c>=0){var a=this.objectAt(c);if(a==b){this.removeAt(c)}}return this},removeObjects:function(a){this.beginPropertyChanges();a.forEach(function(b){this.removeObject(b)},this);this.endPropertyChanges();return this},slice:function(b,d){var a=[];var c=this.get("length");if(SC.none(b)){b=0}if(SC.none(d)||(d>c)){d=c}while(b<d){a[a.length]=this.objectAt(b++)}return a},pushObject:function(a){this.insertAt(this.get("length"),a);return a},pushObjects:function(a){this.beginPropertyChanges();a.forEach(function(b){this.pushObject(b)},this);this.endPropertyChanges();return this},popObject:function(){var a=this.get("length");if(a===0){return null}var b=this.objectAt(a-1);this.removeAt(a-1);return b},shiftObject:function(){if(this.get("length")===0){return null}var a=this.objectAt(0);this.removeAt(0);return a},unshiftObject:function(a){this.insertAt(0,a);return a},unshiftObjects:function(a){this.beginPropertyChanges();a.forEach(function(b){this.unshiftObject(b)},this);this.endPropertyChanges();return this},isEqual:function(a){if(!a){return false}if(a==this){return true}var b=a.get("length");if(b!=this.get("length")){return false}while(--b>=0){if(!SC.isEqual(a.objectAt(b),this.objectAt(b))){return false}}return true},compact:function(){return this.without(null)},without:function(b){if(this.indexOf(b)<0){return this}var a=[];this.forEach(function(c){if(c!==b){a[a.length]=c}});return a},uniq:function(){var a=[];this.forEach(function(b){if(a.indexOf(b)<0){a[a.length]=b}});return a},flatten:function(){var a=[];this.forEach(function(b){if(b&&b.isEnumerable){a=a.pushObjects(b.flatten())}else{a.pushObject(b)}});return a},max:function(){return Math.max.apply(Math,this)},min:function(){return Math.min.apply(Math,this)},rangeObserverClass:SC.RangeObserver,contains:function(a){return this.indexOf(a)>=0},addRangeObserver:function(d,f,h,e){var a=this._array_rangeObservers;if(!a){a=this._array_rangeObservers=SC.CoreSet.create()}if(this._array_oldLength===undefined){this._array_oldLength=this.get("length")}var g=this.rangeObserverClass;var b=NO;var c=g.create(this,d,f,h,e,b);a.add(c);if(!this._array_isNotifyingRangeObservers){this._array_isNotifyingRangeObservers=YES;this.addObserver("[]",this,this._array_notifyRangeObservers)}return c},updateRangeObserver:function(b,a){return b.update(this,a)},removeRangeObserver:function(c){var b=c.destroy(this);var a=this._array_rangeObservers;if(a){a.remove(c)}return b},addArrayObservers:function(a){this._modifyObserverSet("add",a)},removeArrayObservers:function(a){this._modifyObserverSet("remove",a)},_modifyObserverSet:function(h,c){var e,b;var g=c.target||this;var a=c.willChange||"arrayWillChange";var f=c.didChange||"arrayDidChange";var d=c.context;if(typeof a==="string"){a=g[a]}if(typeof f==="string"){f=g[f]}e=this._kvo_for("_kvo_array_will_change",SC.ObserverSet);b=this._kvo_for("_kvo_array_did_change",SC.ObserverSet);e[h](g,a,d);b[h](g,f,d)},arrayContentWillChange:function(b,i,a){this._teardownContentObservers(b,i);var f,d,h,j;var g,c;var e=this._kvo_array_will_change;if(e){d=e.members;h=d.length;for(j=0;j<h;j++){f=d[j];g=f[0];c=f[1];c.call(g,b,i,a,this)}}},arrayContentDidChange:function(b,n,a){var d=this._array_rangeObservers,h,c,l;this.beginPropertyChanges();this.notifyPropertyChange("length");if(d&&d.length>0){l=this._array_rangeChanges;if(!l){l=this._array_rangeChanges=SC.IndexSet.create()}if(n===a){c=n}else{c=this.get("length")-b;if(n>a){c+=(n-a)}}l.add(b,c)}this._setupContentObservers(b,a);var g,f,k,m;var i,e;var j=this._kvo_array_did_change;if(j){if(b===undefined){b=0;n=this.get("length");a=0}f=j.members;k=f.length;for(m=0;m<k;m++){g=f[m];i=g[0];e=g[1];e.call(i,b,n,a,this)}}this.notifyPropertyChange("[]");this.endPropertyChanges();return this},_setupContentObservers:function(f,e){var c=this._kvo_for("_kvo_content_observed_keys",SC.CoreSet);var d;var b;if(c.get("length")>0){d=this.slice(f,f+e);var a=this;c.forEach(function(g){b=SC.keyFor("_kvo_content_observers",g);a._kvo_for(b).forEach(function(h){d.forEach(function(i){a._resumeChainObservingForItemWithChainObserver(i,h)})})})}},_teardownContentObservers:function(e,a){var c=this._kvo_for("_kvo_content_observed_keys",SC.CoreSet);var d;var b;if(c.get("length")>0){d=this.slice(e,e+a);c.forEach(function(f){b=SC.keyFor("_kvo_content_observers",f);d.forEach(function(g){g._kvo_for(b).forEach(function(h){h.destroyChain()})})})}},teardownEnumerablePropertyChains:function(b){var a=this._kvo_enumerable_property_chains;if(a){a.forEach(function(g){var d,c=b.get("length"),i=SC.guidFor(g),f,h,e="_kvo_enumerable_property_clones";g.notifyPropertyDidChange();for(d=0;d<c;d++){h=b.objectAt(d);f=h[e][i];f.deactivate();delete h[e][i]}},this)}return this},setupEnumerablePropertyChains:function(b){var a=this._kvo_enumerable_property_chains;if(a){a.forEach(function(e){var d,c=b.get("length");e.notifyPropertyDidChange();c=b.get("length");for(d=0;d<c;d++){this._clonePropertyChainToItem(e,b.objectAt(d))}},this)}return this},registerDependentKeyWithChain:function(e,c){var b="_kvo_enumerable_property_chains",f,d,g,a;f=this._kvo_for(b,SC.CoreSet);f.add(c);this.forEach(function(h){this._clonePropertyChainToItem(c,h)},this)},_clonePropertyChainToItem:function(c,d){var e=SC.clone(c),b="_kvo_enumerable_property_clones",a;e.object=d;a=d[b]=d[b]||{};a[SC.guidFor(c)]=e;e.activate(d)},removeDependentKeyWithChain:function(f,d){var b="_kvo_enumerable_property_chains",c="_kvo_enumerable_property_clones",g,e,h,a;this.forEach(function(i){i.removeDependentKeyWithChain(f,d);a=i[c];h=a[SC.guidFor(d)];h.deactivate(i)},this)},_resumeChainObservingForItemWithChainObserver:function(d,a){var b=SC.clone(a.next);var c=b.property;b.object=d;d.addObserver(c,b,b.propertyDidChange);if(a.root.tails){a.root.tails.pushObject(b.tail())}b.propertyDidChange();d._kvo_for(SC.keyFor("_kvo_content_observers",c)).push(b)},_addContentObserver:function(a){var b=a.next.property;this._kvo_for("_kvo_content_observed_keys",SC.CoreSet).push(b);var c=SC.keyFor("_kvo_content_observers",b);this._kvo_for(c).push(a);this._setupContentObservers(0,a.object.get("length"))},_removeContentObserver:function(a){var e,c;var d=this._kvo_content_observed_keys;var b=a.next.property;if(d.contains(b)){c=SC.keyFor("_kvo_content_observers",b);e=this._kvo_for(c);e.removeObject(a);this._teardownContentObservers(0,a.object.get("length"));if(e.length===0){this._kvo_for("_kvo_content_observed_keys").remove(b)}}},_array_notifyRangeObservers:function(){var c=this._array_rangeObservers,d=this._array_rangeChanges,b=c?c.length:0,a,e;if(b>0&&d&&d.length>0){for(a=0;a<b;a++){c[a].rangeDidChange(d)}d.clear()}}};SC.Array=SC.mixin({},SC.Enumerable,SC.CoreArray);sc_require("mixins/array");SC.supplement(Array.prototype,SC.CoreArray);SC.mixin(Array.prototype,{replace:function(b,e,d){if(this.isFrozen){throw SC.FROZEN_ERROR}var c;var a=d?(d.get?d.get("length"):d.length):0;this.arrayContentWillChange(b,e,a);if(a===0){this.splice(b,e)}else{c=[b,e].concat(d);this.splice.apply(this,c)}this.beginPropertyChanges();this.arrayContentDidChange(b,e,a);this.enumerableContentDidChange(b,e,a-e);this.endPropertyChanges();return this},unknownProperty:function(b,c){var a=this.reducedProperty(b,c);if((c!==undefined)&&a===undefined){a=this[b]=c}return a}});if(Array.prototype.indexOf===SC.CoreArray.indexOf){Array.prototype.indexOf=function(d,c){var b,a=this.length;if(c===undefined){c=0}else{c=(c<0)?Math.ceil(c):Math.floor(c)}if(c<0){c+=a}for(b=c;b<a;b++){if(this[b]===d){return b}}return -1}}if(Array.prototype.lastIndexOf===SC.CoreArray.lastIndexOf){Array.prototype.lastIndexOf=function(d,c){var b,a=this.length;if(c===undefined){c=a-1}else{c=(c<0)?Math.ceil(c):Math.floor(c)}if(c<0){c+=a}for(b=c;b>=0;b--){if(this[b]===d){return b}}return -1}}if(!Date.now){Date.now=function(){return new Date().getTime()}}SC.String={_scs_valueForKey:function(e,g,c){var a,f,d,b=e.indexOf(":");if(b>-1){a=e.substr(b+1);e=e.substr(0,b)}f=g[e];d=g[e+"Formatter"];if(d){f=d(f,a)}else{if(a){throw"String.fmt was given a formatting string, but key `"+e+"` has no formatter! String: "+c}}return f},fmt:function(b,a){var c=0,d=undefined,e;if(a){d=a[0]}return b.replace(/%\{(.*?)\}/g,function(f,g){e=YES;if(!d){throw"Cannot use named parameters with `fmt` without a data hash. String: '"+b+"'"}return SC.String._scs_valueForKey(g,d,b)}).replace(/%@([0-9]+)?/g,function(g,f){if(e){throw"Invalid attempt to use both named parameters and indexed parameters. String: '"+b+"'"}f=f?parseInt(f,10)-1:c++;if(a[f]!==undefined){return a[f]}else{return""}})},w:function(f){var d=[],e=f.split(" "),b=e.length,c,a=0;for(a=0;a<b;++a){c=e[a];if(c.length!==0){d.push(c)}}return d}};sc_require("system/string");SC.mixin(String.prototype,{fmt:function(){return SC.String.fmt(this,arguments)},w:function(){return SC.String.w(this)}});SC.Comparable={isComparable:YES,compare:function(d,c){throw"%@.compare() is not implemented".fmt(this.toString())}};SC.Copyable={isCopyable:YES,copy:function(a){var b=SC._object_className(this.constructor);throw"%@.copy() is not implemented".fmt(b)},frozenCopy:function(){var a=this.get?this.get("isFrozen"):this.isFrozen;if(a===YES){return this}else{if(a===undefined){throw"%@ does not support freezing".fmt(this)}else{return this.copy().freeze()}}}};SC.mixin(Array.prototype,SC.Copyable);Array.prototype.copy=function(b){var c=this.slice(),a;if(b){a=c.length;while(a--){c[a]=SC.copy(c[a],true)}}return c};SC.FROZEN_ERROR=new Error("Cannot modify a frozen object");SC.Freezable={isFreezable:YES,isFrozen:NO,freeze:function(){if(this.set){this.set("isFrozen",YES)}else{this.isFrozen=YES}return this}};SC.mixin(Array.prototype,SC.Freezable);sc_require("mixins/enumerable");sc_require("mixins/observable");sc_require("mixins/freezable");sc_require("mixins/copyable");SC.Set=SC.mixin({},SC.Enumerable,SC.Observable,SC.Freezable,{create:function(c){var d,b,e=SC.Set._pool,f=this.isObservable,a;if(!f&&c===undefined&&e.length>0){return e.pop()}else{d=SC.beget(this);if(f){d.initObservable()}if(c&&c.isEnumerable&&c.get("length")>0){d.isObservable=NO;if(c.isSCArray){a=c.get("length");for(b=0;b<a;b++){d.add(c.objectAt(b))}}else{if(c.isSet){a=c.length;for(b=0;b<a;b++){d.add(c[b])}}else{c.forEach(function(g){d.add(g)},this)}}d.isObservable=f}}return d},isSet:YES,length:0,firstObject:function(){return(this.length>0)?this[0]:undefined}.property(),clear:function(){if(this.isFrozen){throw SC.FROZEN_ERROR}this.length=0;return this},contains:function(b){if(b===null){return NO}var a=this[SC.hashFor(b)];return(!SC.none(a)&&(a<this.length)&&(this[a]===b))},isEqual:function(a){if(!a||!a.isSet||(a.get("length")!==this.get("length"))){return NO}var b=this.get("length");while(--b>=0){if(!a.contains(this[b])){return NO}}return YES},addSetObserver:function(a){if(!this.setObservers){this.setObservers=SC.CoreSet.create()}this.setObservers.add(a)},removeSetObserver:function(a){if(!this.setObservers){return}this.setObservers.remove(a)},add:function(e){if(this.isFrozen){throw SC.FROZEN_ERROR}if(SC.none(e)){return this}var c,d=((c=e.hash)&&(typeof c==="function"))?c.call(e):SC.guidFor(e),b=this[d],a=this.length;if((b>=a)||(this[b]!==e)){this[a]=e;this[d]=a;this.length=a+1;if(this.setObservers){this.didAddItem(e)}}if(this.isObservable){this.enumerableContentDidChange()}return this},addEach:function(c){if(this.isFrozen){throw SC.FROZEN_ERROR}if(!c||!c.isEnumerable){throw"%@.addEach must pass enumerable".fmt(this)}var a,b=this.isObservable;if(b){this.beginPropertyChanges()}if(c.isSCArray){a=c.get("length");while(--a>=0){this.add(c.objectAt(a))}}else{if(c.isSet){a=c.length;while(--a>=0){this.add(c[a])}}else{c.forEach(function(d){this.add(d)},this)}}if(b){this.endPropertyChanges()}return this},remove:function(f){if(this.isFrozen){throw SC.FROZEN_ERROR}if(f===null||f===undefined){return this}var c,d=(f&&(c=f.hash)&&(typeof c===SC.T_FUNCTION))?c.call(f):SC.guidFor(f),b=this[d],a=this.length,e;if((b===null||b===undefined)||(b>=a)||(this[b]!==f)){return this}delete this[d];if(b<(a-1)){e=this[b]=this[a-1];d=(e&&(c=e.hash)&&(typeof c===SC.T_FUNCTION))?c.call(e):SC.guidFor(e);this[d]=b}this.length=a-1;if(this.isObservable){this.enumerableContentDidChange()}if(this.setObservers){this.didRemoveItem(f)}return this},pop:function(){if(this.isFrozen){throw SC.FROZEN_ERROR}var a=(this.length>0)?this[this.length-1]:null;this.remove(a);return a},removeEach:function(c){if(this.isFrozen){throw SC.FROZEN_ERROR}if(!c||!c.isEnumerable){throw"%@.addEach must pass enumerable".fmt(this)}var a,b=this.isObservable;if(b){this.beginPropertyChanges()}if(c.isSCArray){a=c.get("length");while(--a>=0){this.remove(c.objectAt(a))}}else{if(c.isSet){a=c.length;while(--a>=0){this.remove(c[a])}}else{c.forEach(function(d){this.remove(d)},this)}}if(b){this.endPropertyChanges()}return this},copy:function(){return this.constructor.create(this)},destroy:function(){this.isFrozen=NO;if(!this.isObservable){SC.Set._pool.push(this.clear())}return this},forEach:function(c,d){var b=this.length;if(!d){d=this}for(var a=0;a<b;a++){c.call(d,this[a],a,this)}return this},toString:function(){var b=this.length,a,c=[];for(a=0;a<b;a++){c[a]=this[a]}return"SC.Set<%@>".fmt(c.join(","))},didAddItem:function(c){var d=this.setObservers;if(!d){return}var b=d.length,a;for(a=0;a<b;a++){d[a].didAddItem(this,c)}},didRemoveItem:function(c){var d=this.setObservers;if(!d){return}var b=d.length,a;for(a=0;a<b;a++){d[a].didRemoveItem(this,c)}},_pool:[],isObservable:YES});SC.Set.constructor=SC.Set;SC.Set.clone=SC.Set.copy;SC.Set.push=SC.Set.unshift=SC.Set.add;SC.Set.shift=SC.Set.pop;SC.Set.addObject=SC.Set.add;SC.Set.removeObject=SC.Set.remove;SC.Set._pool=[];SC.CoreSet=SC.beget(SC.Set);SC.CoreSet.isObservable=NO;SC.CoreSet.constructor=SC.CoreSet;sc_require("mixins/observable");sc_require("system/set");SC.Observers={queue:[],addObserver:function(c,d,e,b){var a;if(typeof c==="string"){a=SC.tupleForPropertyPath(c,b)}else{a=c}if(a&&a[0].addObserver){a[0].addObserver(a[1],d,e)}else{this.queue.push([c,d,e,b])}},removeObserver:function(f,g,h,d){var c,b,a,e;a=SC.tupleForPropertyPath(f,d);if(a){a[0].removeObserver(a[1],g,h)}c=this.queue.length;b=this.queue,newQueue=undefined;while(--c>=0){e=b[c];if(e[0]!==f||e[1]!==g||e[2]!==h||e[3]!==d){if(!newQueue){newQueue=[]}newQueue.push(e)}}this.queue=newQueue||this.queue},addPendingRangeObserver:function(a){var b=this.rangeObservers;if(!b){b=this.rangeObservers=SC.CoreSet.create()}b.add(a);return this},_TMP_OUT:[],flush:function(b){var g=this.queue,d,a=g.length;if(g&&a>0){var k=(this.queue=[]);for(d=0;d<a;d++){var l=g[d];if(!l){continue}var h=SC.tupleForPropertyPath(l[0],l[3]);if(h&&h[0].addObserver){h[0].addObserver(h[1],l[1],l[2])}else{k.push(l)}}}if(b._kvo_needsRangeObserver){var j=this.rangeObservers,f=j?j.get("length"):0,c=this._TMP_OUT,e;for(d=0;d<f;d++){e=j[d];if(e.setupPending(b)){c.push(e)}}if(c.length>0){j.removeEach(c)}c.length=0;b._kvo_needsRangeObserver=false}},isObservingSuspended:0,_pending:SC.CoreSet.create(),objectHasPendingChanges:function(a){this._pending.add(a)},suspendPropertyObserving:function(){this.isObservingSuspended++},resumePropertyObserving:function(){var c;if(--this.isObservingSuspended<=0){c=this._pending;this._pending=SC.CoreSet.create();var b,a=c.length;for(b=0;b<a;b++){c[b]._notifyPropertyObservers()}c.clear();c=null}}};sc_require("core");sc_require("mixins/observable");sc_require("private/observer_queue");sc_require("mixins/array");sc_require("system/set");SC.BENCHMARK_OBJECTS=NO;SC._detect_base=function _detect_base(c,b,a){return function d(){var f=b[a],e;if(!f){throw new Error("No '"+a+"' method was found on the superclass")}if(c.isEnhancement){e=Array.prototype.slice.call(arguments,1)}else{e=arguments}return f.apply(this,e)}};SC._object_extend=function _object_extend(g,f,n){if(!f){throw"SC.Object.extend expects a non-null value.  Did you forget to 'sc_require' something?  Or were you passing a Protocol to extend() as if it were a mixin?"}g._kvo_cloned=null;var x,m,t,e,h=g.concatenatedProperties,k=SC.K,c,b;m=(h)?h.length:0;var a=(m>0)?{}:null;while(--m>=0){x=h[m];c=g[x];b=f[x];if(c){if(!(c instanceof Array)){c=SC.$A(c)}a[x]=(b)?c.concat(b):b}else{if(!(b instanceof Array)){b=SC.$A(b)}a[x]=b}}var w=g._bindings,l=NO,u=g._observers,v=NO,i=g._properties,d=NO,q,j,o,p;var s=g.outlets,r=NO;if(f.outlets){s=(s||SC.EMPTY_ARRAY).concat(f.outlets);r=YES}for(x in f){if(x==="_kvo_cloned"){continue}if(!f.hasOwnProperty(x)){continue}p=(a.hasOwnProperty(x)?a[x]:null)||f[x];if(x.length>7&&x.slice(-7)==="Binding"){if(!l){w=(w||SC.EMPTY_ARRAY).slice();l=YES}if(w===null){w=(g._bindings||SC.EMPTY_ARRAY).slice()}w[w.length]=x}else{if(p&&(p instanceof Function)){if(!p.superclass&&(p!==(e=g[x]))){p.superclass=e||k;p.base=n?SC._detect_base(p,n,x):e||k}if(p.propertyPaths){if(!v){u=(u||SC.EMPTY_ARRAY).slice();v=YES}u[u.length]=x}if(q=p.localPropertyPaths){j=q.length;while(--j>=0){o=g._kvo_for(SC.keyFor("_kvo_local",q[j]),SC.CoreSet);o.add(x);g._kvo_for("_kvo_observed_keys",SC.CoreSet).add(q[j])}}if(p.dependentKeys){if(!d){i=(i||SC.EMPTY_ARRAY).slice();d=YES}i[i.length]=x}if(p.autoconfiguredOutlet){if(!r){s=(s||SC.EMPTY_ARRAY).slice();r=YES}s[s.length]=x}if(p.isEnhancement){p=SC._enhance(g[x]||k,p)}}}g[x]=p}if(f.hasOwnProperty("toString")){x="toString";p=(a.hasOwnProperty(x)?a[x]:null)||f[x];if(!p.superclass&&(p!==(e=g[x]))){p.superclass=p.base=e||k}g[x]=p}g._bindings=w||[];g._observers=u||[];g._properties=i||[];g.outlets=s||[];return g};SC._enhance=function(b,a){return function(){var d=Array.prototype.slice.call(arguments,0),c=this;d.unshift(function(){return b.apply(c,arguments)});return a.apply(this,d)}};SC.Object=function(a){this.__sc_super__=SC.Object.prototype;return this._object_init(a)};SC.mixin(SC.Object,{mixin:function(b){var a=arguments.length,c;for(c=0;c<a;c++){SC.mixin(this,arguments[c])}return this},superclass:null,extend:function(e){var d=SC.BENCHMARK_OBJECTS;if(d){SC.Benchmark.start("SC.Object.extend")}var g,c=function(h){this.__sc_super__=c.prototype;return this._object_init(h)};for(g in this){if(!this.hasOwnProperty(g)){continue}c[g]=this[g]}if(this.hasOwnProperty("toString")){c.toString=this.toString}c.superclass=this;c.__sc_super__=this.prototype;SC.generateGuid(c,"sc");c.subclasses=SC.Set.create();this.subclasses.add(c);var f=(c.prototype=SC.beget(this.prototype)),b,a=arguments.length;for(b=0;b<a;b++){SC._object_extend(f,arguments[b],c.__sc_super__)}f.constructor=c;if(d){SC.Benchmark.end("SC.Object.extend")}return c},reopen:function(b){var a;a=SC._object_extend(this.prototype,b,this.__sc_super__);if(this.subclasses){this.subclasses.forEach(function(d,c){var e,f;for(e in b){if(!b.hasOwnProperty(e)){continue}f=b[e];if(d.prototype.hasOwnProperty(e)){delete b[e]}if(f&&(f instanceof Function)&&(f.isEnhancement)){delete b[e]}}d.reopen(b)},this)}return a},create:function(){var b=this,a=new b(arguments);if(SC.ObjectDesigner){SC.ObjectDesigner.didCreateObject(a,SC.$A(arguments))}return a},isClass:YES,subclasses:SC.Set.create(),toString:function(){return SC._object_className(this)},subclassOf:function(b){if(this===b){return NO}var a=this;while(a=a.superclass){if(a===b){return YES}}return NO},hasSubclass:function(a){return(a&&a.subclassOf)?a.subclassOf(this):NO},kindOf:function(a){return(this===a)||this.subclassOf(a)},design:function(){if(this.isDesign){return this}var a=this.extend.apply(this,arguments);a.isDesign=YES;if(SC.ObjectDesigner){SC.ObjectDesigner.didLoadDesign(a,this,SC.A(arguments))}return a}});SC.Object.prototype={_kvo_enabled:YES,_object_init:function(c){var b,a=(c)?c.length:0;for(b=0;b<a;b++){SC._object_extend(this,c[b],this.__sc_super__)}SC.generateGuid(this,"sc");this.init();var d=this.initMixin;a=(d)?d.length:0;for(b=0;b<a;b++){d[b].call(this)}return this},mixin:function(){var b,a=arguments.length,c;for(b=0;b<a;b++){SC._object_extend(this,arguments[b])}this._observableInited=NO;this.initObservable();for(b=0;b<a;b++){c=arguments[b].initMixin;if(c){c.call(this)}}return this},init:function(){this.initObservable();return this},isDestroyed:NO,destroy:function(){if(this.get("isDestroyed")){return this}this.set("isDestroyed",YES);var b,c=this.destroyMixin,a=(c)?c.length:0;for(b=0;b<a;b++){c[b].call(this)}this.bindings.invoke("disconnect");this.bindings=null;return this},isObject:true,respondsTo:function(a){return !!(this[a] instanceof Function)},tryToPerform:function(b,c,a){return this.respondsTo(b)&&(this[b](c,a)!==NO)},superclass:function(b){var a=arguments.callee.caller;if(!a){throw"superclass cannot determine the caller method"}return a.superclass?a.superclass.apply(this,arguments):null},instanceOf:function(a){return this.constructor===a},kindOf:function(a){return this.constructor.kindOf(a)},toString:function(){if(!this._object_toString){var a=SC._object_className(this.constructor),b=a+":"+SC.guidFor(this);if(a){this._object_toString=b}else{return b}}return this._object_toString},awake:function(){var d=this.outlets,b,a,c;for(b=0,a=d.length;b<a;++b){c=d[b];this.get(c)}this.bindings.invoke("sync")},invokeOnce:function(a){SC.RunLoop.currentRunLoop.invokeOnce(this,a);return this},invokeLast:function(a){SC.RunLoop.currentRunLoop.invokeLast(this,a);return this},invokeNext:function(a){SC.RunLoop.currentRunLoop.invokeNext(this,a);return this},concatenatedProperties:["concatenatedProperties","initMixin","destroyMixin"]};SC.Object.prototype.constructor=SC.Object;SC.mixin(SC.Object.prototype,SC.Observable);function findClassNames(){if(SC._object_foundObjectClassNames){return}SC._object_foundObjectClassNames=true;var b=[],c=false;var a=function(d,f,j){var l,i,h;j--;if(b.indexOf(f)>=0){return}b.push(f);for(var g in f){if(g=="__scope__"){continue}if(g=="superclass"){continue}if(g=="__SC__"){g="SC"}if(!g.match(/^[A-Z0-9]/)){continue}if(g=="SC"){if(c){continue}c=true}l=(d)?[d,g].join("."):g;i=f[g];try{h=SC.typeOf(i)}catch(k){break}switch(h){case SC.T_CLASS:if(!i._object_className){i._object_className=l}if(j>=0){a(l,i,j)}break;case SC.T_OBJECT:if(j>=0){a(l,i,j)}break;case SC.T_HASH:if(((d)||(l==="SC"))&&(j>=0)){a(l,i,j)}break;default:break}}};window.__SC__=SC;a(null,window,2)}SC.instanceOf=function(a,b){return !!(a&&a.constructor===b)};SC.kindOf=function(a,b){if(a&&!a.isClass){a=a.constructor}return !!(a&&a.kindOf&&a.kindOf(b))};SC._object_className=function(b){if(SC.isReady===NO){return""}if(!b._object_className){findClassNames()}if(b._object_className){return b._object_className}var a=b;while(a&&!a._object_className){a=a.superclass}return(a&&a._object_className)?a._object_className:"Anonymous"};sc_require("system/object");SC._PropertyChain=SC.Object.extend({object:null,property:null,target:null,toInvalidate:null,nextProperty:null,activate:function(b){var a=this.get("object"),c=this.get("property"),d;if(!b){b=this.get("target")}if(a&&a!==b){this.deactivate()}this.set("object",b);if(b&&c!=="@each"){b.registerDependentKeyWithChain(c,this)}if(this.next){d=b?b.get(c):undefined;this.next.activate(d)}return this},deactivate:function(){var a=this.get("object"),b=this.get("property");if(a){a.removeDependentKeyWithChain(b,this)}if(this.next){this.next.deactivate()}return this},notifyPropertyDidChange:function(){var d=this.get("target"),c=this.get("toInvalidate"),b,a;d.propertyDidChange(c);if(this.next){b=this.get("object");a=b.get(this.get("property"));this.next.activate(a)}}});SC._PropertyChain.createChain=function(h,g,e){var f=h.split(".");var a=f.length,d=1;var b=SC._PropertyChain.create({property:f[0],target:g,toInvalidate:e,nextProperty:f[1]});b.set("length",a);var c=b;while(--a>=1){c=c.next=SC._PropertyChain.create({property:f[d],target:g,toInvalidate:e,nextProperty:f[++d]});c.set("length",a)}return b};sc_require("ext/function");sc_require("system/object");SC.LOG_BINDINGS=NO;SC.BENCHMARK_BINDING_NOTIFICATIONS=NO;SC.BENCHMARK_BINDING_SETUP=NO;SC.MULTIPLE_PLACEHOLDER="@@MULT@@";SC.NULL_PLACEHOLDER="@@NULL@@";SC.EMPTY_PLACEHOLDER="@@EMPTY@@";SC.Binding={beget:function(b){var a=SC.beget(this);a.parentBinding=this;if(b!==undefined){a=a.from(b)}return a},builder:function(){var b=this,a=function(c){return b.beget().from(c)};a.beget=function(){return b.beget()};return a},from:function(b,a){if(!b){return this}var c=(this===SC.Binding)?this.beget():this;c._fromPropertyPath=b;c._fromRoot=a;c._fromTuple=null;return c},to:function(b,a){var c=(this===SC.Binding)?this.beget():this;c._toPropertyPath=b;c._toRoot=a;c._toTuple=null;return c},connect:function(){if(this.isConnected){return this}this.isConnected=YES;this._connectionPending=YES;this._syncOnConnect=YES;SC.Binding._connectQueue.add(this);if(!SC.RunLoop.isRunLoopInProgress()){this._scheduleSync()}return this},_connect:function(){if(!this._connectionPending){return}this._connectionPending=NO;var c,a,b=SC.BENCHMARK_BINDING_SETUP;if(b){SC.Benchmark.start("SC.Binding.connect()")}c=this._fromPropertyPath;a=this._fromRoot;if(typeof c==="string"){if(c.indexOf(".")===0){c=c.slice(1);if(!a){a=this._toRoot}}else{if(c.indexOf("*")===0){c=[this._fromRoot||this._toRoot,c.slice(1)];a=null}}}this._fromObserverData=[c,this,this.fromPropertyDidChange,a];SC.Observers.addObserver.apply(SC.Observers,this._fromObserverData);if(!this._oneWay){c=this._toPropertyPath;a=this._toRoot;this._toObserverData=[c,this,this.toPropertyDidChange,a];SC.Observers.addObserver.apply(SC.Observers,this._toObserverData)}if(b){SC.Benchmark.end("SC.Binding.connect()")}if(this._syncOnConnect){this._syncOnConnect=NO;if(b){SC.Benchmark.start("SC.Binding.connect().sync")}this.sync();if(b){SC.Benchmark.end("SC.Binding.connect().sync")}}},disconnect:function(){if(!this.isConnected){return this}if(this._connectionPending){this._connectionPending=NO}else{SC.Observers.removeObserver.apply(SC.Observers,this._fromObserverData);if(!this._oneWay){SC.Observers.removeObserver.apply(SC.Observers,this._toObserverData)}}this.isConnected=NO;return this},fromPropertyDidChange:function(c,b){var a=c?c.get(b):null;if(a!==this._bindingValue||b==="[]"){this._setBindingValue(c,b);this._changePending=YES;SC.Binding._changeQueue.add(this);this._scheduleSync()}},toPropertyDidChange:function(c,b){if(this._oneWay){return}var a=c.get(b);if(a!==this._transformedBindingValue){this._setBindingValue(c,b);this._changePending=YES;SC.Binding._changeQueue.add(this);this._scheduleSync()}},_scheduleSync:function(){if(SC.RunLoop.isRunLoopInProgress()||SC.Binding._syncScheduled){return}SC.Binding._syncScheduled=YES;setTimeout(function(){SC.run();SC.Binding._syncScheduled=NO},1)},_setBindingValue:function(b,a){this._bindingSource=b;this._bindingKey=a},_computeBindingValue:function(){var g=this._bindingSource,e=this._bindingKey,c,b;this._bindingValue=c=(g?g.getPath(e):null);var f=this._transforms;if(f){var a=f.length,d;for(b=0;b<a;b++){d=f[b];c=d(c,this)}}if(this._noError&&SC.typeOf(c)===SC.T_ERROR){c=null}this._transformedBindingValue=c},_connectQueue:SC.CoreSet.create(),_alternateConnectQueue:SC.CoreSet.create(),_changeQueue:SC.CoreSet.create(),_alternateChangeQueue:SC.CoreSet.create(),_changePending:NO,flushPendingChanges:function(){if(this._isFlushing){return NO}this._isFlushing=YES;SC.Observers.suspendPropertyObserving();var b=NO,c=SC.LOG_BINDINGS,a,d;while((a=this._connectQueue).length>0){this._connectQueue=this._alternateConnectQueue;this._alternateConnectQueue=a;while(d=a.pop()){d._connect()}}while((a=this._changeQueue).length>0){if(c){SC.Logger.log("Begin: Trigger changed bindings")}b=YES;this._changeQueue=this._alternateChangeQueue;this._alternateChangeQueue=a;while(d=a.pop()){d.applyBindingValue()}if(c){SC.Logger.log("End: Trigger changed bindings")}}this._isFlushing=NO;SC.Observers.resumePropertyObserving();return b},applyBindingValue:function(){this._changePending=NO;this._computeBindingTargets();this._computeBindingValue();var a=this._bindingValue,b=this._transformedBindingValue,c=SC.BENCHMARK_BINDING_NOTIFICATIONS,d=SC.LOG_BINDINGS;if(!this._oneWay&&this._fromTarget){if(d){SC.Logger.log("%@: %@ -> %@".fmt(this,a,b))}if(c){SC.Benchmark.start(this.toString()+"->")}this._fromTarget.setPathIfChanged(this._fromPropertyKey,a);if(c){SC.Benchmark.end(this.toString()+"->")}}if(this._toTarget){if(d){SC.Logger.log("%@: %@ <- %@".fmt(this,a,b))}if(c){SC.Benchmark.start(this.toString()+"<-")}this._toTarget.setPathIfChanged(this._toPropertyKey,b);if(c){SC.Benchmark.start(this.toString()+"<-")}}},sync:function(){if(!this.isConnected){return this}if(this._connectionPending){this._syncOnConnect=YES}else{this._computeBindingTargets();var c=this._fromTarget,b=this._fromPropertyKey;if(!c||!b){return this}if(!c.isObservable){SC.Logger.warn("Cannot bind '%@' to property '%@' on non-observable '%@'".fmt(this._toPropertyPath,b,c));return this}var a=c.getPath(b);if(a!==this._bindingValue||b==="[]"){this._setBindingValue(c,b);this._changePending=YES;SC.Binding._changeQueue.add(this)}}return this},_syncOnConnect:NO,_computeBindingTargets:function(){if(!this._fromTarget){var c,b,a;c=this._fromPropertyPath;b=this._fromRoot;if(typeof c==="string"){if(c.indexOf(".")===0){c=c.slice(1);if(!b){b=this._toRoot}}else{if(c.indexOf("*")===0){c=[b||this._toRoot,c.slice(1)];b=null}}}a=SC.tupleForPropertyPath(c,b);if(a){this._fromTarget=a[0];this._fromPropertyKey=a[1]}}if(!this._toTarget){c=this._toPropertyPath;b=this._toRoot;a=SC.tupleForPropertyPath(c,b);if(a){this._toTarget=a[0];this._toPropertyKey=a[1]}}},oneWay:function(c,a){if((a===undefined)&&(SC.typeOf(c)===SC.T_BOOL)){a=c;c=null}var b=this.from(c);if(b===SC.Binding){b=b.beget()}b._oneWay=(a===undefined)?YES:a;return b},transform:function(b){var c=(this===SC.Binding)?this.beget():this;var a=c._transforms;if(a&&(a===c.parentBinding._transform)){a=c._transforms=a.slice()}if(!a){a=c._transforms=[]}a.push(b);return c},resetTransforms:function(){var a=(this===SC.Binding)?this.beget():this;a._transforms=null;return a},noError:function(c,a){if((a===undefined)&&(SC.typeOf(c)===SC.T_BOOL)){a=c;c=null}var b=this.from(c);if(b===SC.Binding){b=b.beget()}b._noError=(a===undefined)?YES:a;return b},single:function(b,a){if(a===undefined){a=SC.MULTIPLE_PLACEHOLDER}return this.from(b).transform(function(e,d){if(e&&e.isEnumerable){var c=e.get("length");e=(c>1)?a:(c<=0)?null:e.firstObject()}return e})},notEmpty:function(b,a){if(a===undefined){a=SC.EMPTY_PLACEHOLDER}return this.from(b).transform(function(d,c){if(SC.none(d)||(d==="")||(SC.isArray(d)&&(d.get?d.get("length"):d.length)===0)){d=a}return d})},notNull:function(b,a){if(a===undefined){a=SC.EMPTY_PLACEHOLDER}return this.from(b).transform(function(d,c){if(SC.none(d)){d=a}return d})},multiple:function(a){return this.from(a).transform(function(b){if(!SC.isArray(b)){b=(b==null)?[]:[b]}return b})},bool:function(a){return this.from(a).transform(function(b){var c=SC.typeOf(b);if(c===SC.T_ERROR){return b}return(c==SC.T_ARRAY)?(b.length>0):(b==="")?NO:!!b})},and:function(b,a){var c=SC.Object.create({valueABinding:b,valueBBinding:a,and:function(){return(this.get("valueA")&&this.get("valueB"))}.property("valueA","valueB").cacheable()});return this.from("and",c).oneWay()},or:function(b,a){var c=SC.Object.create({valueABinding:b,valueBBinding:a,or:function(){return(this.get("valueA")||this.get("valueB"))}.property("valueA","valueB").cacheable()});return this.from("or",c).oneWay()},not:function(a){return this.from(a).transform(function(b){var c=SC.typeOf(b);if(c===SC.T_ERROR){return b}return !((c==SC.T_ARRAY)?(b.length>0):(b==="")?NO:!!b)})},isNull:function(a){return this.from(a).transform(function(b){var c=SC.typeOf(b);return(c===SC.T_ERROR)?b:SC.none(b)})},toString:function(){var c=this._fromRoot?"<%@>:%@".fmt(this._fromRoot,this._fromPropertyPath):this._fromPropertyPath;var b=this._toRoot?"<%@>:%@".fmt(this._toRoot,this._toPropertyPath):this._toPropertyPath;var a=this._oneWay?"[oneWay]":"";return"SC.Binding%@(%@ -> %@)%@".fmt(SC.guidFor(this),c,b,a)}};SC.binding=function(b,a){return SC.Binding.from(b,a)};sc_require("ext/function");SC.Error=SC.Object.extend({code:-1,message:"",errorValue:null,errorObject:function(){return this}.property().cacheable(),label:null,toString:function(){return"SC.Error:%@:%@ (%@)".fmt(SC.guidFor(this),this.get("message"),this.get("code"))},isError:YES});SC.Error.desc=function(d,a,e,c){var b={message:d};if(a!==undefined){b.label=a}if(c!==undefined){b.code=c}if(e!==undefined){b.errorValue=e}return this.create(b)};SC.$error=function(b,a,d,e){return SC.Error.desc(b,a,d,e)};SC.ok=function(a){return(a!==false)&&!(a&&a.isError)};SC.$ok=SC.ok;SC.val=function(a){if(a&&a.isError){return a.get?a.get("errorValue"):null}else{return a}};SC.$val=SC.val;SC.Error.HAS_MULTIPLE_VALUES=-100;sc_require("mixins/enumerable");sc_require("mixins/observable");sc_require("mixins/freezable");sc_require("mixins/copyable");SC.IndexSet=SC.mixin({},SC.Enumerable,SC.Observable,SC.Freezable,SC.Copyable,{_sc_sliceContent:function(e){if(e.length<1000){return e.slice()}var d=0,a=[],b=e[0];while(b!==0){a[d]=b;d=(b<0)?(0-b):b;b=e[d]}a[d]=0;this._hint(0,d,a);return a},create:function(c,b){var a=SC.beget(this);a.initObservable();a.registerDependentKey("min","[]");if(c&&c.isIndexSet){a._content=this._sc_sliceContent(c._content);a.max=c.max;a.length=c.length;a.source=c.source}else{a._content=[0];if(c!==undefined){a.add(c,b)}}return a},isIndexSet:YES,HINT_SIZE:256,length:0,max:0,min:function(){var a=this._content,b=a[0];return(b===0)?-1:(b>0)?0:Math.abs(b)}.property("[]").cacheable(),firstObject:function(){return(this.get("length")>0)?this.get("min"):undefined}.property(),rangeStartForIndex:function(c){var f=this._content,a=this.get("max"),b,e,d;if(c>=a){return a}if(Math.abs(f[c])>c){return c}d=c-(c%SC.IndexSet.HINT_SIZE);b=f[d];if(b<0||b>c){b=d}e=f[b];if(e===undefined){e=this.rangeStartForIndex(b)}else{e=Math.abs(e)}while(e<c){b=e;e=Math.abs(f[b])}return b},isEqual:function(c){if(c===this){return YES}if(!c||!c.isIndexSet||(c.max!==this.max)||(c.length!==this.length)){return NO}var e=this._content,b=c._content,d=0,a=e[d];do{if(b[d]!==a){return NO}d=Math.abs(a);a=e[d]}while(d!==0);return YES},indexBefore:function(b){if(b===0){return -1}b--;var c=this._content,a=this.get("max"),d=this.rangeStartForIndex(b);if(!c){return null}while((d===a)||(c[d]<0)){if(d===0){return -1}b=d-1;d=this.rangeStartForIndex(b)}return b},indexAfter:function(b){var d=this._content,a=this.get("max"),e,c;if(!d||(b>=a)){return -1}b++;e=this.rangeStartForIndex(b);c=d[e];while(c<0){if(c===0){return -1}b=e=Math.abs(c);c=d[e]}return b},contains:function(g,c){var b,f,a,e,d;if(c===undefined){if(g===null||g===undefined){return NO}if(typeof g===SC.T_NUMBER){c=1}else{if(g&&g.isIndexSet){if(g===this){return YES}b=g._content;f=0;a=b[f];while(a!==0){if((a>0)&&!this.contains(f,a-f)){return NO}f=Math.abs(a);a=b[f]}return YES}else{c=g.length;g=g.start}}}e=this.rangeStartForIndex(g);d=this._content[e];return(d>0)&&(e<=g)&&(d>=(g+c))},intersects:function(f,c){var b,e,a,d;if(c===undefined){if(typeof f===SC.T_NUMBER){c=1}else{if(f&&f.isIndexSet){if(f===this){return YES}b=f._content;e=0;a=b[e];while(a!==0){if((a>0)&&this.intersects(e,a-e)){return YES}e=Math.abs(a);a=b[e]}return NO}else{c=f.length;f=f.start}}}e=this.rangeStartForIndex(f);b=this._content;a=b[e];d=f+c;while(e<d){if(a===0){return NO}if((a>0)&&(a>f)){return YES}e=Math.abs(a);a=b[e]}return NO},without:function(b,a){if(b===this){return SC.IndexSet.create()}return this.clone().remove(b,a)},replace:function(c,a){if(a===undefined){if(typeof c===SC.T_NUMBER){a=1}else{if(c&&c.isIndexSet){this._content=this._sc_sliceContent(c._content);this.beginPropertyChanges().set("max",c.max).set("length",c.length).set("source",c.source).enumerableContentDidChange();this.endPropertyChanges();return this}else{a=c.length;c=c.start}}}var b=this.length;this._content.length=1;this._content[0]=0;this.length=this.max=0;return this.add(c,a)},add:function(a,b){if(this.isFrozen){throw SC.FROZEN_ERROR}var e,i,d;if(a&&a.isIndexSet){e=a._content;if(!e){return this}i=0;d=e[0];while(d!==0){if(d>0){this.add(i,d-i)}i=d<0?0-d:d;d=e[i]}return this}else{if(b===undefined){if(a===null||a===undefined){return this}else{if(typeof a===SC.T_NUMBER){b=1}else{b=a.length;a=a.start}}}else{if(b===null){b=1}}}if(b<=0){return this}var f=this.get("max"),c=f,h,g;e=this._content;if(a===f){if(a>0){i=this.rangeStartForIndex(a-1);d=e[i];if(d>0){delete e[f];e[i]=f=a+b;a=i}else{e[f]=f=a+b}}else{e[a]=f=b}e[f]=0;this.set("max",f);this.set("length",this.length+b);b=f-a}else{if(a>f){e[f]=0-a;e[a]=a+b;e[a+b]=0;this.set("max",a+b);this.set("length",this.length+b);b=a+b-f;a=f}else{i=this.rangeStartForIndex(a);d=e[i];f=a+b;h=0;if((a>0)&&(i===a)&&(d<=0)){i=this.rangeStartForIndex(a-1);d=e[i]}if(d<0){e[i]=0-a;if(Math.abs(d)>f){e[a]=0-f;e[f]=d}else{e[a]=d}}else{a=i;if(d>f){f=d}}i=a;while(i<f){g=e[i];if(g===0){e[f]=0;d=f;h+=f-i}else{d=Math.abs(g);if(d>f){e[f]=g;d=f}if(g<0){h+=d-i}}delete e[i];i=d}if((i=e[f])>0){delete e[f];f=i}e[a]=f;if(f>c){this.set("max",f)}this.set("length",this.get("length")+h);b=f-a}}this._hint(a,b);if(h!==0){this.enumerableContentDidChange()}return this},remove:function(a,b){if(this.isFrozen){throw SC.FROZEN_ERROR}if(b===undefined){if(a===null||a===undefined){return this}else{if(typeof a===SC.T_NUMBER){b=1}else{if(a.isIndexSet){a.forEachRange(this.remove,this);return this}else{b=a.length;a=a.start}}}}if(b<=0){return this}var f=this.get("max"),c=f,e=this._content,j,d,i,g,h;if(a>=f){return this}j=this.rangeStartForIndex(a);d=e[j];h=a+b;i=0;if((a>0)&&(j===a)&&(d>0)){j=this.rangeStartForIndex(a-1);d=e[j]}if(d>0){e[j]=a;if(d>h){e[a]=h;e[h]=d}else{e[a]=d}}else{a=j;d=Math.abs(d);if(d>h){h=d}}j=a;while(j<h){g=e[j];if(g===0){e[h]=0;d=h}else{d=Math.abs(g);if(d>h){e[h]=g;d=h}if(g>0){i+=d-j}}delete e[j];j=d}if((j=e[h])<0){delete e[h];h=Math.abs(j)}if(e[h]===0){delete e[h];e[a]=0;this.set("max",a)}else{e[a]=0-h}this.set("length",this.get("length")-i);b=h-a;this._hint(a,b);if(i!==0){this.enumerableContentDidChange()}return this},_hint:function(g,d,c){if(c===undefined){c=this._content}var b=SC.IndexSet.HINT_SIZE,a=Math.abs(c[g]),f=g-(g%b)+b,e=g+d;while(f<e){while((a!==0)&&(a<=f)){g=a;a=Math.abs(c[g])}if(a===0){delete c[f]}else{if(f!==g){c[f]=g}}f+=b}},clear:function(){if(this.isFrozen){throw SC.FROZEN_ERROR}var a=this.length;this._content.length=1;this._content[0]=0;this.set("length",0).set("max",0);if(a>0){this.enumerableContentDidChange()}},addEach:function(b){if(this.isFrozen){throw SC.FROZEN_ERROR}this.beginPropertyChanges();var a=b.get("length");if(b.isSCArray){while(--a>=0){this.add(b.objectAt(a))}}else{if(b.isEnumerable){b.forEach(function(c){this.add(c)},this)}}this.endPropertyChanges();return this},removeEach:function(b){if(this.isFrozen){throw SC.FROZEN_ERROR}this.beginPropertyChanges();var a=b.get("length");if(b.isSCArray){while(--a>=0){this.remove(b.objectAt(a))}}else{if(b.isEnumerable){b.forEach(function(c){this.remove(c)},this)}}this.endPropertyChanges();return this},clone:function(){return SC.IndexSet.create(this)},inspect:function(){var e=this._content,b=e.length,a=0,c=[],d;for(a=0;a<b;a++){d=e[a];if(d!==undefined){c.push("%@:%@".fmt(a,d))}}return"SC.IndexSet<%@>".fmt(c.join(" , "))},forEachRange:function(f,d){var b=this._content,e=0,a=b[e],c=this.source;if(d===undefined){d=null}while(a!==0){if(a>0){f.call(d,e,a-e,this,c)}e=Math.abs(a);a=b[e]}return this},forEachIn:function(b,c,j,f){var g=this._content,i=0,h=0,d=b+c,a=this.source,e=g[i];if(f===undefined){f=null}while(e!==0){if(i<b){i=b}while((i<e)&&(i<d)){j.call(f,i++,h++,this,a)}if(i>=d){i=e=0}else{i=Math.abs(e);e=g[i]}}return this},lengthIn:function(g,d){var a=0;if(d===undefined){if(g===null||g===undefined){return 0}else{if(typeof g===SC.T_NUMBER){d=1}else{if(g.isIndexSet){g.forEachRange(function(i,h){a+=this.lengthIn(i,h)},this);return a}else{d=g.length;g=g.start}}}}if(this.get("length")===0){return 0}var c=this._content,f=0,b=c[f],e=g+d;while(f<e&&b!==0){if(b>0){a+=(b>e)?e-f:b-f}f=Math.abs(b);b=c[f]}return a},source:null,indexOf:function(d,c){var f=this.source;if(!f){throw"%@.indexOf() requires source".fmt(this)}var b=f.get("length"),e=this._content,g=e[0]<0?Math.abs(e[0]):0,a;while(g>=0&&g<b){a=f.indexOf(d,g);if(a<0){return -1}if(this.contains(a)){return a}g=a+1}return -1},lastIndexOf:function(d,c){var e=this.source;if(!e){throw"%@.lastIndexOf() requires source".fmt(this)}var b=e.get("length"),f=this.max-1,a;if(f>=b){f=b-1}while(f>=0){a=e.lastIndexOf(d,f);if(a<0){return -1}if(this.contains(a)){return a}f=a+1}return -1},forEachObject:function(g,e){var d=this.source;if(!d){throw"%@.forEachObject() requires source".fmt(this)}var c=this._content,f=0,a=0,b=c[f];if(e===undefined){e=null}while(b!==0){while(f<b){g.call(e,d.objectAt(f),f,d,this);f++}f=Math.abs(b);b=c[f]}return this},addObject:function(c,d){var e=this.source;if(!e){throw"%@.addObject() requires source".fmt(this)}var b=e.get("length"),f=0,a;while(f>=0&&f<b){a=e.indexOf(c,f);if(a>=0){this.add(a);if(d){return this}f=a++}else{return this}}return this},addObjects:function(b,a){b.forEach(function(c){this.addObject(c,a)},this);return this},removeObject:function(c,d){var e=this.source;if(!e){throw"%@.removeObject() requires source".fmt(this)}var b=e.get("length"),f=0,a;while(f>=0&&f<b){a=e.indexOf(c,f);if(a>=0){this.remove(a);if(d){return this}f=a+1}else{return this}}return this},removeObjects:function(b,a){b.forEach(function(c){this.removeObject(c,a)},this);return this},LOG_OBSERVING:NO,forEach:function(g,e){var c=this._content,f=0,a=0,d=this.source,b=c[f];if(e===undefined){e=null}while(b!==0){while(f<b){g.call(e,f++,a++,this,d)}f=Math.abs(b);b=c[f]}return this},nextObject:function(f,b,c){var e=this._content,d=c.next,a=this.get("max");if(b===null){b=d=0}else{if(b>=a){delete c.next;return null}else{b++}}if(b===d){do{b=Math.abs(d);d=e[b]}while(d<0);c.next=d}return b},toString:function(){var a=[];this.forEachRange(function(c,b){a.push(b===1?c:"%@..%@".fmt(c,c+b-1))},this);return"SC.IndexSet<%@>".fmt(a.join(","))},max:0});SC.IndexSet.slice=SC.IndexSet.copy=SC.IndexSet.clone;SC.IndexSet.EMPTY=SC.IndexSet.create().freeze();SC.json={encode:function(a){return JSON.stringify(a)},decode:function(a){return JSON.parse(a)}};if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());sc_require("ext/function");SC.LOGGER_LOG_DELIMITER=", ";SC.LOGGER_LOG_ERROR="ERROR: ";SC.LOGGER_LOG_INFO="INFO:  ";SC.LOGGER_LOG_WARN="WARN:  ";SC.LOGGER_LOG_DEBUG="DEBUG: ";SC.LOGGER_LOG_GROUP_HEADER="** %@";SC.LOGGER_LOG_GROUP_INDENTATION="    ";SC.LOGGER_RECORDED_LOG_TIMESTAMP_PREFIX="%@:  ";SC.LOGGER_LEVEL_DEBUG="debug";SC.LOGGER_LEVEL_INFO="info";SC.LOGGER_LEVEL_WARN="warn";SC.LOGGER_LEVEL_ERROR="error";SC.LOGGER_LEVEL_NONE="none";SC.Logger=SC.Object.create({messagePrefix:null,outputMessagePrefix:null,recordedMessagePrefix:null,logOutputLevel:null,logRecordingLevel:SC.LOGGER_LEVEL_NONE,recordedLogMessages:null,recordedLogMessagesMaximumLength:500,recordedLogMessagesPruningMinimumLength:100,debugEnabled:NO,exists:function(){return !SC.none(this.get("reporter"))}.property("reporter").cacheable(),fallBackOnAlert:NO,reporter:console,debug:function(a,b){SC.Logger._handleMessage(SC.LOGGER_LEVEL_DEBUG,YES,a,arguments)},debugWithoutFmt:function(){this._handleMessage(SC.LOGGER_LEVEL_DEBUG,NO,null,arguments)},debugGroup:function(a,b){SC.Logger._handleGroup(SC.LOGGER_LEVEL_DEBUG,a,arguments)},debugGroupEnd:function(){SC.Logger._handleGroupEnd(SC.LOGGER_LEVEL_DEBUG)},info:function(a,b){SC.Logger._handleMessage(SC.LOGGER_LEVEL_INFO,YES,a,arguments)},infoWithoutFmt:function(){this._handleMessage(SC.LOGGER_LEVEL_INFO,NO,null,arguments)},infoGroup:function(a,b){SC.Logger._handleGroup(SC.LOGGER_LEVEL_INFO,a,arguments)},infoGroupEnd:function(){SC.Logger._handleGroupEnd(SC.LOGGER_LEVEL_INFO)},warn:function(a,b){SC.Logger._handleMessage(SC.LOGGER_LEVEL_WARN,YES,a,arguments)},warnWithoutFmt:function(){this._handleMessage(SC.LOGGER_LEVEL_WARN,NO,null,arguments)},warnGroup:function(a,b){SC.Logger._handleGroup(SC.LOGGER_LEVEL_WARN,a,arguments)},warnGroupEnd:function(){SC.Logger._handleGroupEnd(SC.LOGGER_LEVEL_WARN)},error:function(a,b){SC.Logger._handleMessage(SC.LOGGER_LEVEL_ERROR,YES,a,arguments)},errorWithoutFmt:function(){this._handleMessage(SC.LOGGER_LEVEL_ERROR,NO,null,arguments)},errorGroup:function(a,b){SC.Logger._handleGroup(SC.LOGGER_LEVEL_ERROR,a,arguments)},errorGroupEnd:function(){SC.Logger._handleGroupEnd(SC.LOGGER_LEVEL_ERROR)},outputRecordedLogMessages:function(n){if(!this.get("exists")){return}var r=this.get("reporter"),k=this.get("recordedLogMessages"),a=0,d=SC.LOGGER_RECORDED_LOG_TIMESTAMP_PREFIX,q,o,b,c,g,h,e,f,t,m,l,p,s;if(k){for(q=0,o=k.length;q<o;++q){b=k[q];c=b.type;if(n){g=d.fmt(b.timestamp.toUTCString())}h=b.message;if(h){e=b.originalArguments;this._outputMessage(c,g,a,h,e)}else{m=b.indentation;t=b.title;l=m-a;if(r.group){if(Math.abs(l)>1){for(p=0,s=(l-1);p<s;++p){if(l>0){r.group()}else{r.groupEnd()}}}if(l>0){f=g?g:"";f+=t;r.group(f)}else{r.groupEnd()}}else{if(l>0){this._outputGroup(c,g,m-1,t)}}a=m}}}},stringifyRecordedLogMessages:function(){var j="",f=this.get("recordedLogMessages"),m=0,h=SC.LOGGER_RECORDED_LOG_TIMESTAMP_PREFIX,d=this._LOG_FALLBACK_PREFIX_MAPPING,c=SC.LOGGER_LOG_GROUP_HEADER,e,a,o,l,r,q,g,p,n,k,b;if(f){for(e=0,a=f.length;e<a;++e){o=f[e];l=o.type;g=h.fmt(o.timestamp.toUTCString());g+=d[l]||"";r=o.message;if(r){q=o.originalArguments;p=g+this._indentation(m);p+=q?this._argumentsToString(q):r}else{k=o.indentation;n=o.title;b=k-m;if(b>0){p=g+this._indentation(m)+c.fmt(n)}m=k}j+=p+"\n"}}return j},log:function(){var a=this.get("reporter"),c=arguments[0],d=this.get("messagePrefix"),e=this.get("outputMessagePrefix"),b=NO;if(c&&SC.typeOf(c)===SC.T_STRING){if(d||e){if(d){c=d+c}if(e){c=e+c}arguments[0]=c}}if(this.get("exists")){if(typeof a.log==="function"){a.log.apply(a,arguments);b=YES}else{if(a.log){a.log(this._argumentsToArray(arguments));b=YES}}}if(!b&&this.get("fallBackOnAlert")){if(this.get("exists")&&(typeof a.alert==="function")){a.alert(arguments);b=YES}else{alert(arguments);b=YES}}return b},group:function(b){var a=this.get("reporter");if(this.get("exists")&&(typeof a.group==="function")){a.group(b)}},groupEnd:function(){var a=this.get("reporter");if(this.get("exists")&&(typeof a.groupEnd==="function")){a.groupEnd()}},dir:function(){var a=this.get("reporter");if(this.get("exists")&&(typeof a.dir==="function")){a.dir.apply(a,arguments)}else{this.log.apply(this,arguments)}},dirxml:function(){var a=this.get("reporter");if(this.get("exists")&&(typeof a.dirxml==="function")){a.dirxml.apply(a,arguments)}else{this.log.apply(this,arguments)}},profile:function(b){var a=this.get("reporter");if(this.get("exists")&&(typeof a.profile==="function")){a.profile(b);return YES}return NO},profileEnd:function(b){var a=this.get("reporter");if(this.get("exists")&&(typeof a.profileEnd==="function")){a.profileEnd(b);return YES}return NO},time:function(b){var a=this.get("reporter");if(this.get("exists")&&(typeof a.time==="function")){a.time(b);return YES}return NO},timeEnd:function(b){var a=this.get("reporter");if(this.get("exists")&&(typeof a.timeEnd==="function")){a.timeEnd(b);return YES}return NO},trace:function(){var a=this.get("reporter");if(this.get("exists")&&(typeof a.trace==="function")){a.trace();return YES}return NO},init:function(){arguments.callee.base.apply(this,arguments);if(!this.get("logOutputLevel")){if(SC.buildMode==="debug"){this.set("logOutputLevel",SC.LOGGER_LEVEL_DEBUG)}else{this.set("logOutputLevel",SC.LOGGER_LEVEL_INFO)}}this.debugEnabledDidChange()},debugEnabledDidChange:function(){if(this.get("debugEnabled")){this.set("logOutputLevel",SC.LOGGER_LEVEL_DEBUG)}}.observes("debugEnabled"),_handleMessage:function(l,n,p,o){var a=this._shouldOutputType(l),d=this._shouldRecordType(l),e,f,j,k,b,m,h,c,g;if(!(a||d)){return}e=(o&&o.length>1);if(n&&(SC.none(p)||(typeof p!=="string"))){n=NO}if(n){if(e){k=[];for(f=1,j=o.length;f<j;++f){k.push(o[f])}p=p.fmt.apply(p,k)}}h=this.get("messagePrefix");if(h){p=h+p}if(a){c=this.get("outputMessagePrefix");k=n?null:o;this._outputMessage(l,null,this._outputIndentationLevel,(c?c+p:p),k)}if(d){g=this.get("recordedMessagePrefix");m={type:l,message:p?(g?g+p:p):YES,timestamp:new Date()};if(!n&&e){m.originalArguments=o}this._addRecordedMessageEntry(m)}},_handleGroup:function(l,n,q){var a=this._shouldOutputType(l),e=this._shouldRecordType(l),f,g,j,k,p,d,c,h,b,m,o;if(!(a||e)){return}f=(q&&q.length>1);if(n&&f){k=[];for(g=1,j=q.length;g<j;++g){k.push(q[g])}n=n.fmt.apply(n,k)}if(a){this._outputGroup(l,null,this._outputIndentationLevel,n);this._outputIndentationLevel++}if(e){m=++this._recordingIndentationLevel;o={type:l,indentation:m,beginGroup:YES,title:n,timestamp:new Date()};this._addRecordedMessageEntry(o)}},_handleGroupEnd:function(d){var g=this._shouldOutputType(d),c=this._shouldRecordType(d),a,f,b,e;if(!(g||c)){return}if(g){this._outputIndentationLevel--;if(this.get("exists")){a=this.get("reporter");f=a.groupEnd;if(f){f.call(a)}}}if(c){b=--this._recordingIndentationLevel;e={type:d,indentation:b,timestamp:new Date()};this._addRecordedMessageEntry(e)}},_shouldOutputType:function(a){var c=this._LOG_LEVEL_MAPPING,d=c[a]||0,b=c[this.get("logOutputLevel")]||0;return(d<=b)},_shouldRecordType:function(a){var c=this._LOG_LEVEL_MAPPING,d=c[a]||0,b=c[this.get("logRecordingLevel")]||0;return(d<=b)},_outputMessage:function(h,g,i,l,k){if(!this.get("exists")){return}var d=this.get("reporter"),b,a,c,e,f,j;a=!d.group;c=d[h];if(c){if(!k){b=g?g:"";if(a){b+=this._indentation(i)}b+=l;d[h](b)}else{f=this._argumentsToArray(k);e="";if(g){e=g}if(a){e+=this._indentation(i)}if(e){f.splice(0,0,e)}if(c.apply){c.apply(d,f)}else{d[h](f)}}}else{if(d.log){e="";if(g){e=g}e+=this._LOG_FALLBACK_PREFIX_MAPPING[h]||"";if(a){e+=this._indentation(i)}if(!k){d.log(e+l)}else{f=this._argumentsToArray(k);if(e){f.splice(0,0,e)}d.log(f)}}}},_outputGroup:function(d,f,c,g){if(!this.get("exists")){return}var b=this.get("reporter"),e=b.group,a;if(e){a=f?f:"";a+=g;e.call(b,a)}else{if(b.log){a="";if(f){a=f}a+=this._LOG_FALLBACK_PREFIX_MAPPING[d]||"";a+=this._indentation(c);a+=SC.LOGGER_LOG_GROUP_HEADER.fmt(g);b.log(a)}}},_addRecordedMessageEntry:function(c){var b=this.get("recordedLogMessages"),a;if(!b){b=[];this.set("recordedLogMessages",b)}b.push(c);a=b.length;if(a>this.get("recordedLogMessagesMaximumLength")){b.splice(0,(a-this.get("recordedLogMessagesPruningMinimumLength")))}b.enumerableContentDidChange()},_argumentsToArray:function(c){var b=[],d,a;if(c){for(d=0,a=c.length;d<a;++d){b[d]=c[d]}}return b},_argumentsToString:function(){var c="",b=SC.LOGGER_LOG_DELIMITER,d,a;for(d=0,a=(arguments.length-1);d<a;++d){c+=arguments[d]+b}c+=arguments[a];return c},_indentation:function(d){if(!d||d<0){d=0}var b="",a=SC.LOGGER_LOG_GROUP_INDENTATION,c;for(c=0;c<d;++c){b+=a}return b},_outputIndentationLevel:0,_recordingIndentationLevel:0,_LOG_LEVEL_MAPPING:{debug:4,info:3,warn:2,error:1,none:0},_LOG_FALLBACK_PREFIX_MAPPING:{debug:SC.LOGGER_LOG_DEBUG,info:SC.LOGGER_LOG_INFO,warn:SC.LOGGER_LOG_WARN,error:SC.LOGGER_LOG_ERROR}});SC.debug=SC.Logger.debug;SC.info=SC.Logger.info;SC.warn=SC.Logger.warn;SC.error=SC.Logger.error;sc_require("ext/function");sc_require("private/observer_set");SC.RunLoop=SC.Object.extend({beginRunLoop:function(){this._start=new Date().getTime();if(SC.LOG_BINDINGS||SC.LOG_OBSERVERS){SC.Logger.log("-- SC.RunLoop.beginRunLoop at %@".fmt(this._start))}this._runLoopInProgress=YES;this._flushinvokeNextQueue();return this},isRunLoopInProgress:function(){return this._runLoopInProgress}.property(),endRunLoop:function(){if(SC.LOG_BINDINGS||SC.LOG_OBSERVERS){SC.Logger.log("-- SC.RunLoop.endRunLoop ~ flushing application queues")}this.flushAllPending();this._start=null;if(SC.LOG_BINDINGS||SC.LOG_OBSERVERS){SC.Logger.log("-- SC.RunLoop.endRunLoop ~ End")}SC.RunLoop.lastRunLoopEnd=Date.now();this._runLoopInProgress=NO;return this},flushAllPending:function(){var a;do{a=this.flushApplicationQueues();if(!a){a=this._flushinvokeLastQueue()}}while(a)},invokeOnce:function(b,c){if(c===undefined){c=b;b=this}var a;if(typeof c==="string"){c=b[c]}if(!this._invokeQueue){this._invokeQueue=SC.ObserverSet.create()}if(c){this._invokeQueue.add(b,c,undefined,a)}return this},invokeLast:function(b,c){if(c===undefined){c=b;b=this}var a;if(typeof c==="string"){c=b[c]}if(!this._invokeLastQueue){this._invokeLastQueue=SC.ObserverSet.create()}this._invokeLastQueue.add(b,c,undefined,a);return this},invokeNext:function(a,b){if(b===undefined){b=a;a=this}if(typeof b==="string"){b=a[b]}if(!this._invokeNextQueue){this._invokeNextQueue=SC.ObserverSet.create()}this._invokeNextQueue.add(a,b);return this},flushApplicationQueues:function(){var b=NO,a=this._invokeQueue;if(a&&a.getMembers().length){this._invokeQueue=null;b=YES;a.invokeMethods()}return SC.Binding.flushPendingChanges()||b},_flushinvokeLastQueue:function(){var a=this._invokeLastQueue,b=NO;if(a&&a.getMembers().length){this._invokeLastQueue=null;b=YES;if(b){a.invokeMethods()}}return b},_flushinvokeNextQueue:function(){var a=this._invokeNextQueue,b=NO;if(a&&a.getMembers().length){this._invokeNextQueue=null;b=YES;if(b){a.invokeMethods()}}return b}});SC.RunLoop.currentRunLoop=null;SC.RunLoop.runLoopClass=SC.RunLoop;SC.RunLoop.begin=function(){var a=this.currentRunLoop;if(!a){a=this.currentRunLoop=this.runLoopClass.create()}a.beginRunLoop();return this};SC.RunLoop.end=function(){var a=this.currentRunLoop;if(!a){throw"SC.RunLoop.end() called outside of a runloop!"}a.endRunLoop();return this};SC.RunLoop.kill=function(){this.currentRunLoop=this.runLoopClass.create();return this};SC.RunLoop.isRunLoopInProgress=function(){if(this.currentRunLoop){return this.currentRunLoop.get("isRunLoopInProgress")}return NO};SC.run=function(g,f,b){var a=SC.RunLoop.isRunLoopInProgress();if(SC.ExceptionHandler&&SC.ExceptionHandler.enabled){try{if(b||!a){SC.RunLoop.begin()}if(g){g.call(f)}if(b||!a){SC.RunLoop.end()}}catch(d){var c=SC.ExceptionHandler.handleException(d);if(!c&&!SC.browser.isIE){throw d}}}else{if(b||!a){SC.RunLoop.begin()}if(g){g.call(f)}if(b||!a){SC.RunLoop.end()}}};SC.RunLoop.wrapFunction=function(b){var a=function(){var c=SC.RunLoop.isRunLoopInProgress();if(!c){SC.RunLoop.begin()}var d=arguments.callee.wrapped.apply(this,arguments);if(!c){SC.RunLoop.end()}return d};a.wrapped=b;return a};SC.DROP_ON=1;SC.DROP_BEFORE=2;SC.DROP_AFTER=4;SC.DROP_ANY=7;SC.ALIGN_LEFT="left";SC.ALIGN_RIGHT="right";SC.ALIGN_CENTER="center";SC.ALIGN_TOP="top";SC.ALIGN_MIDDLE="middle";SC.ALIGN_BOTTOM="bottom";SC.ALIGN_TOP_LEFT="top-left";SC.ALIGN_TOP_RIGHT="top-right";SC.ALIGN_BOTTOM_LEFT="bottom-left";SC.ALIGN_BOTTOM_RIGHT="bottom-right";SC.mixin({data:$.data,removeData:$.removeData,STRINGS:{},stringsFor:function(b,a){SC.mixin(SC.STRINGS,a);return this}});SC.Controller=SC.Object.extend({isEditable:YES,destroyContentOnReplace:NO,contentObjectDidChanged:function(){var b,a;if(!this.get("destroyContentOnReplace")){return}b=this._oldContent;a=this.get("content");if(b&&a!==b&&b.destroy){b.destroy()}this._oldContent=a}.observes("content")});SC.SelectionSupport={hasSelectionSupport:YES,allowsSelection:YES,allowsMultipleSelection:YES,allowsEmptySelection:YES,firstSelectableObject:function(){return this.get("firstObject")}.property(),selection:function(d,f){var c=this._scsel_selection,g=c?c.get("length"):0,e,b=this.get("arrangedObjects"),a;if((f===undefined)||!this.get("allowsSelection")){f=c}a=(f&&f.isEnumerable)?f.get("length"):0;if((a>1)&&!this.get("allowsMultipleSelection")){if(g>1){f=SC.SelectionSet.create().addObject(c.get("firstObject")).freeze();a=1}else{f=c;a=g}}if((a===0)&&!this.get("allowsEmptySelection")&&b&&b.get("length")!==0){if(g===0){f=this.get("firstSelectableObject");if(f){f=SC.SelectionSet.create().addObject(f).freeze()}else{f=SC.SelectionSet.EMPTY}a=f.get("length")}else{f=c;a=g}}if(a===0){f=SC.SelectionSet.EMPTY}if(f!==c){f=f.frozenCopy()}this._scsel_selection=f;return f}.property("arrangedObjects","allowsEmptySelection","allowsMultipleSelection","allowsSelection").cacheable(),hasSelection:function(){var a=this.get("selection");return !!a&&(a.get("length")>0)}.property("selection").cacheable(),selectObjects:function(b,c){if(!b||b.get("length")===0){if(!c){this.set("selection",SC.SelectionSet.EMPTY)}return this}var a=this.get("selection");if(c&&a){a=a.copy()}else{a=SC.SelectionSet.create()}a.addObjects(b).freeze();this.set("selection",a);return this},selectObject:function(a,b){if(a===null){if(!b){this.set("selection",null)}return this}else{return this.selectObjects([a],b)}},deselectObjects:function(b){if(!b||b.get("length")===0){return this}var a=this.get("selection");if(!a||a.get("length")===0){return this}a=a.copy().removeObjects(b).freeze();this.set("selection",a.freeze());return this},deselectObject:function(a){if(!a){return this}else{return this.deselectObjects([a])}},updateSelectionAfterContentChange:function(){var a=this.get("arrangedObjects");var b=this.get("selection");var d=this.get("allowsEmptySelection");var c;if(!b){return this}c=b.indexSetForSource(a);if((c&&(c.get("length")!==b.get("length")))||(!c&&(b.get("length")>0))){b=b.copy().constrain(a).freeze();this.set("selection",b)}if((b.get("length")===0)&&a&&(a.get("length")>0)&&!d){this.selectObject(this.get("firstSelectableObject"),NO)}return this}};sc_require("controllers/controller");sc_require("mixins/selection_support");SC.ArrayController=SC.Controller.extend(SC.Array,SC.SelectionSupport,{content:null,isEditable:YES,orderBy:null,allowsSingleContent:YES,destroyOnRemoval:NO,arrangedObjects:function(){return this}.property().cacheable(),canRemoveContent:function(){var b=this.get("content"),a;a=!!b&&this.get("isEditable")&&this.get("hasContent");if(a){return !b.isEnumerable||(SC.typeOf(b.removeObject)===SC.T_FUNCTION)}else{return NO}}.property("content","isEditable","hasContent"),canReorderContent:function(){var b=this.get("content"),a;a=!!b&&this.get("isEditable")&&!this.get("orderBy");return a&&!!b.isSCArray}.property("content","isEditable","orderBy"),canAddContent:function(){var b=this.get("content"),a;a=b&&this.get("isEditable")&&b.isEnumerable;if(a){return(SC.typeOf(b.addObject)===SC.T_FUNCTION)||(SC.typeOf(b.pushObject)===SC.T_FUNCTION)}else{return NO}}.property("content","isEditable"),hasContent:function(){var a=this.get("content");return !!a&&(!!a.isEnumerable||!!this.get("allowsSingleContent"))}.property("content","allowSingleContent"),status:function(){var b=this.get("content"),a=b?b.get("status"):null;return a?a:SC.Record.READY}.property().cacheable(),addObject:function(a){if(!this.get("canAddContent")){throw"%@ cannot add content".fmt(this)}var b=this.get("content");if(b.isSCArray){b.pushObject(a)}else{if(b.addObject){b.addObject(a)}else{throw"%@.content does not support addObject".fmt(this)}}return this},removeObject:function(a){if(!this.get("canRemoveContent")){throw"%@ cannot remove content".fmt(this)}var b=this.get("content");if(b.isEnumerable){b.removeObject(a)}else{this.set("content",null)}if(this.get("destroyOnRemoval")&&a.destroy){a.destroy()}return this},length:function(){var a=this._scac_observableContent();return a?a.get("length"):0}.property().cacheable(),objectAt:function(a){var b=this._scac_observableContent();return b?b.objectAt(a):undefined},replace:function(g,f,d){if(!d||d.get("length")===0){if(!this.get("canRemoveContent")){throw"%@ cannot remove objects from the current content".fmt(this)}}else{if(!this.get("canReorderContent")){throw"%@ cannot add or reorder the current content".fmt(this)}}var c=this.get("content");var b=[],a,e;if(this.get("destroyOnRemoval")){for(a=0;a<f;a++){b.push(c.objectAt(a+g))}}if(c){c.replace(g,f,d)}for(a=0,e=b.length;a<e;a++){b[a].destroy()}b=null;return this},indexOf:function(b,a){var c=this._scac_observableContent();return c?c.indexOf(b,a):-1},init:function(){arguments.callee.base.apply(this,arguments);this._scac_contentDidChange()},_scac_cached:NO,_scac_observableContent:function(){var c=this._scac_cached;if(c){return c}var f=this.get("content"),e,b,a;if(SC.none(f)){return(this._scac_cached=[])}if(!f.isEnumerable){c=this.get("allowsSingleContent")?[f]:[];return(this._scac_cached=c)}var g=this.get("orderBy");if(!g){if(f.isSCArray){return(this._scac_cached=f)}else{throw"%@.orderBy is required for unordered content".fmt(this)}}var d=SC.typeOf(g);if(d===SC.T_STRING){g=[g]}else{if(d===SC.T_FUNCTION){e=g}else{if(d!==SC.T_ARRAY){throw"%@.orderBy must be Array, String, or Function".fmt(this)}}}e=e||function(p,o){var k,q,n,h,r;for(var m=0,j=g.get("length");m<j&&!k;m++){q=g.objectAt(m);if(q.search(/(ASC|DESC)/)===0){n=q.match(/^(ASC )?(DESC )?(.*)$/);q=n[3]}else{n=q.match(/^(\S*)\s*(DESC)?(?:ASC)?$/);q=n[1]}a=n[2]?-1:1;if(p){h=p.isObservable?p.get(q):p[q]}if(o){r=o.isObservable?o.get(q):o[q]}k=SC.compare(h,r)*a}return k};return(this._scac_cached=f.toArray().sort(e))},propertyWillChange:function(a){if(a==="content"){this.arrayContentWillChange(0,this.get("length"),0)}else{return arguments.callee.base.apply(this,arguments)}},_scac_arrayContentWillChange:function(d,c,a){this.arrayContentWillChange(d,c,a);if(this._kvo_enumerable_property_chains){var b=this.slice(d,d+c);this.teardownEnumerablePropertyChains(b)}},_scac_arrayContentDidChange:function(d,c,a){this._scac_cached=NO;this.arrayContentDidChange(d,c,a);if(this._kvo_enumerable_property_chains){var b=this.slice(d,d+a);this.setupEnumerablePropertyChains(b)}this.updateSelectionAfterContentChange()},_scac_contentDidChange:function(){this._scac_cached=NO;var h=this.get("content"),d=!!this.get("orderBy"),i=this._scac_content,a=this._scac_length||0,g=this._scac_arrayContentDidChange,c=this._scac_arrayContentWillChange,b=this._scac_contentStatusDidChange,f=this._scac_enumerableDidChange,e;if(h===i){return this}if(i){if(i.isSCArray){i.removeArrayObservers({target:this,didChange:g,willChange:c})}else{if(i.isEnumerable){i.removeObserver("[]",this,f)}}i.removeObserver("status",this,b);this.teardownEnumerablePropertyChains(i)}this._scac_cached=NO;this._scac_content=h;if(h){if(h.isSCArray){h.addArrayObservers({target:this,didChange:g,willChange:c});e=h.get("length")}else{if(h.isEnumerable){h.addObserver("[]",this,f);e=h.get("length")}else{e=1}}h.addObserver("status",this,b);this.setupEnumerablePropertyChains(h)}else{e=SC.none(h)?0:1}this._scac_length=e;this._scac_contentStatusDidChange();this.arrayContentDidChange(0,0,e);this.updateSelectionAfterContentChange()}.observes("content"),_scac_enumerableDidChange:function(){var a=this.get("content"),c=a?a.get("length"):0,b=this._scac_length;this._scac_length=c;this.beginPropertyChanges();this._scac_cached=NO;this.arrayContentDidChange(0,b,c);this.enumerableContentDidChange(0,b-1);this.endPropertyChanges();this.updateSelectionAfterContentChange()}.observes("orderBy"),_scac_contentStatusDidChange:function(){this.notifyPropertyChange("status")}});sc_require("controllers/controller");SC.ObjectController=SC.Controller.extend({content:null,allowsMultipleContent:NO,hasContent:function(){return !SC.none(this.get("observableContent"))}.property("observableContent"),isEditable:YES,observableContent:function(){var b=this.get("content"),a,c;if(b&&b.isEnumerable){a=b.get("length");c=this.get("allowsMultipleContent");if(a===1){b=b.firstObject()}else{if(a===0||!c){b=null}}if(b&&!c&&b.isEnumerable){b=null}}return b}.property("content","allowsMultipleContent").cacheable(),destroy:function(){var a=this.get("observableContent");if(a&&SC.typeOf(a.destroy)===SC.T_FUNCTION){a.destroy()}this.set("content",null);return this},contentPropertyDidChange:function(b,a){if(a==="*"){this.allPropertiesDidChange()}else{this.notifyPropertyChange(a)}},unknownProperty:function(b,d){if(b==="content"){if(d!==undefined){this.content=d}return this.content}var c=this.get("observableContent"),f,e,a;if(c===null||c===undefined){return undefined}if(d===undefined){if(c.isEnumerable){d=c.getEach(b);f=d.get("length");if(f>0){a=YES;e=d.objectAt(0);while((--f>0)&&a){if(e!==d.objectAt(f)){a=NO}}if(a){d=e}}else{d=undefined}}else{d=(c.isObservable)?c.get(b):c[b]}}else{if(!this.get("isEditable")){throw"%@.%@ is not editable".fmt(this,b)}if(c.isEnumerable){c.setEach(b,d)}else{if(c.isObservable){c.set(b,d)}else{c[b]=d}}}return d},init:function(){arguments.callee.base.apply(this,arguments);if(this.get("content")){this._scoc_contentDidChange()}if(this.get("observableContent")){this._scoc_observableContentDidChange()}},_scoc_contentDidChange:function(){var b=this._scoc_content,c=this.get("content");if(b!==c){this._scoc_content=c;var a=this._scoc_enumerableContentDidChange;if(b&&b.isEnumerable){b.removeObserver("[]",this,a)}if(c&&c.isEnumerable){c.addObserver("[]",this,a)}}}.observes("content"),_scoc_observableContentDidChange:function(){var b=this._scoc_observableContent,d=this.get("observableContent"),a=this.contentPropertyDidChange,c=this._scoc_enumerableContentDidChange;if(b===d){return this}this._scoc_observableContent=d;if(b){if(b.isEnumerable){b.removeObserver("[]",this,c)}else{if(b.isObservable){b.removeObserver("*",this,a)}}}if(d){if(d.isEnumerable){d.addObserver("[]",this,c)}else{if(d.isObservable){d.addObserver("*",this,a)}}}if((b&&b.isEnumerable)||(d&&d.isEnumerable)){this._scoc_enumerableContentDidChange()}else{this.contentPropertyDidChange(d,"*")}}.observes("observableContent"),_scoc_enumerableContentDidChange:function(){var b=this.get("observableContent"),c=this._scoc_observableContentItems,a=this.contentPropertyDidChange;if(c){c.forEach(function(d){if(d.isObservable){d.removeObserver("*",this,a)}},this);c.clear()}if(b&&b.isEnumerable){if(!c){c=SC.Set.create()}b.forEach(function(d){if(c.contains(d)){return}c.add(d);if(d.isObservable){d.addObserver("*",this,a)}},this)}else{c=null}this._scoc_observableContentItems=c;this.contentPropertyDidChange(b,"*");return this}});SC.mixin(Function.prototype,{invokeLater:function(e,a){if(a===undefined){a=1}var d=this;if(arguments.length>2){var b=SC.$A(arguments).slice(2,arguments.length);b.unshift(e);var c=d;d=function(){return c.apply(this,b.slice(1))}}return SC.Timer.schedule({target:e,action:d,interval:a})}});SC.mixin(SC.Object.prototype,{invokeLater:function(d,a){var c,b;if(SC.typeOf(d)===SC.T_STRING){d=this[d]}if(a===undefined){a=1}if(arguments.length>2){b=SC.$A(arguments).slice(2);c=function(){return d.apply(this,b)}}else{c=d}return SC.Timer.schedule({target:this,action:c,interval:a})},invokeOnceLater:function(i,c){var d,g,b,e=this._sc_invokeOnceLaterTimers,h,a;if(SC.typeOf(i)===SC.T_STRING){i=this[i]}if(c===undefined){c=1}if(!e){e=this._sc_invokeOnceLaterTimers={}}b=SC.guidFor(i);h=e[b];if(h){h.invalidate()}if(arguments.length>2){d=SC.$A(arguments).slice(2)}else{d=arguments}g=function(){delete e[b];return i.apply(this,d)};a=SC.Timer.schedule({target:this,action:g,interval:c});e[b]=a;return a},invokeWith:function(b,c,d){if(d===undefined){d=c;c=this}if(!c){c=this}if(SC.typeOf(d)===SC.T_STRING){d=c[d]}var a=this.getPath(b);d.call(c,a,this);return this}});SC.RunLoop=SC.RunLoop.extend({startTime:function(){if(!this._start){this._start=Date.now()}return this._start}.property(),endRunLoop:function(){this.fireExpiredTimers();var a=arguments.callee.base.apply(this,arguments);this.scheduleNextTimeout();return a},scheduleTimer:function(b,a){this._timerQueue=b.removeFromTimerQueue(this._timerQueue);this._timerQueue=b.scheduleInTimerQueue(this._timerQueue,a);return this},cancelTimer:function(a){this._timerQueue=a.removeFromTimerQueue(this._timerQueue);return this},TIMER_ARRAY:[],fireExpiredTimers:function(){if(!this._timerQueue||this._firing){return NO}var d=this.get("startTime"),e=this.TIMER_ARRAY,c,b,a;this._firing=YES;this._timerQueue=this._timerQueue.collectExpiredTimers(e,d);b=e.length;for(c=0;c<b;c++){e[c].fire()}a=e.length>0;e.length=0;this._firing=NO;return a},scheduleNextTimeout:function(){var d=this._timerQueue;var b=NO;if(!d){if(this._timeout){clearTimeout(this._timeout)}}else{var c=d._timerQueueRunTime;if(this._timeoutAt!==c){if(this._timeout){clearTimeout(this._timeout)}var a=Math.max(0,c-Date.now());this._timeout=setTimeout(this._timeoutDidFire,a);this._timeoutAt=c}b=YES}return b},_timeoutDidFire:function(){var a=SC.RunLoop.currentRunLoop;a._timeout=a._timeoutAt=null;SC.run()}});SC.RunLoop.currentRunLoop=SC.RunLoop.create();SC.RunLoop.runLoopClass=SC.RunLoop;SC.Locale=SC.Object.extend({init:function(){if(!this.language){SC.Locale._assignLocales()}if(!this.hasStrings){var c=this._deprecatedLanguageCodes||[];c.push(this.language);var b=c.length;var a=null;while(!a&&--b>=0){a=String[c[b]]}if(a){this.hasStrings=YES;this.strings=a}}},hasStrings:NO,strings:{},metrics:{},toString:function(){if(!this.language){SC.Locale._assignLocales()}return"SC.Locale["+this.language+"]"+SC.guidFor(this)},locWithDefault:function(b,c){var a=this.strings[b];if(SC.typeOf(a)===SC.T_STRING){return a}else{if(SC.typeOf(c)===SC.T_STRING){return c}}return b},locMetric:function(b){var a=this.metrics[b];if(SC.typeOf(a)===SC.T_NUMBER){return a}else{if(a===undefined){SC.warn('No localized metric found for key "'+b+'"');return undefined}else{SC.warn('Unexpected metric type for key "'+b+'"');return undefined}}},locLayout:function(c,b){var e,g,f,m,l,a=SC.Locale.layoutKeys,k=this.metrics,j=SC.typeOf,d=SC.T_NUMBER,h={};if(b){SC.mixin(h,b)}for(e=0,g=a.length;e<g;++e){f=a[e];m=c+"."+f;l=k[m];if(j(l)===d){if(b&&b[f]){throw"locLayout():  There is a localized value for the key '"+m+"' but a value for '"+f+"' was also specified in the non-localized hash"}h[f]=l}}return h}});SC.Locale.mixin({useAutodetectedLanguage:NO,preferredLanguage:null,layoutKeys:["left","top","right","bottom","width","height","minWidth","minHeight","centerX","centerY"],createCurrentLocale:function(){var c=(String.useAutodetectedLanguage!==undefined)?String.useAutodetectedLanguage:this.useAutodetectedLanguage;var b=(String.preferredLanguage!==undefined)?String.preferredLanguage:this.preferredLanguage;var d=((c)?SC.browser.language:null)||b||SC.browser.language||"en";d=SC.Locale.normalizeLanguage(d);var a=this.localeClassFor(d);if(d!=this.currentLanguage){this.currentLanguage=d;this.currentLocale=a.create()}return this.currentLocale},localeClassFor:function(c){c=SC.Locale.normalizeLanguage(c);var b,a=this.locales[c];if(!a&&((b=c.split("-")[0])!==c)&&(a=this.locales[b])){a=this.locales[c]=a.extend()}if(!a){a=this.locales[c]=this.locales.en.extend()}return a},define:function(b,c){var a;if(c===undefined&&(SC.typeOf(b)!==SC.T_STRING)){a=this;c=b}else{a=SC.Locale.localeClassFor(b)}SC.mixin(a.prototype,c);return a},options:function(){return this.prototype},addStrings:function(b){var a=this.prototype.strings;if(a){if(!this.prototype.hasOwnProperty("strings")){a=this.prototype.strings=SC.clone(a)}}else{a=this.prototype.strings={}}if(b){this.prototype.strings=SC.mixin(a,b)}this.prototype.hasStrings=YES;return this},addMetrics:function(b){var a=this.prototype.metrics;if(a){if(!this.prototype.hasOwnProperty(a)){a=this.prototype.metrics=SC.clone(a)}}else{a=this.prototype.metrics={}}if(b){this.prototype.metrics=SC.mixin(a,b)}return this},_map:{english:"en",french:"fr",german:"de",japanese:"ja",jp:"ja",spanish:"es"},normalizeLanguage:function(a){if(!a){return"en"}return SC.Locale._map[a.toLowerCase()]||a},_assignLocales:function(){for(var a in this.locales){this.locales[a].prototype.language=a}},toString:function(){if(!this.prototype.language){SC.Locale._assignLocales()}return"SC.Locale["+this.prototype.language+"]"},extend:function(){var a=SC.Object.extend.apply(this,arguments);a.addStrings=SC.Locale.addStrings;a.define=SC.Locale.define;a.options=SC.Locale.options;a.toString=SC.Locale.toString;return a}});SC.Locale.locales={en:SC.Locale.extend({_deprecatedLanguageCodes:["English"]}),fr:SC.Locale.extend({_deprecatedLanguageCodes:["French"]}),de:SC.Locale.extend({_deprecatedLanguageCodes:["German"]}),ja:SC.Locale.extend({_deprecatedLanguageCodes:["Japanese","jp"]}),es:SC.Locale.extend({_deprecatedLanguageCodes:["Spanish"]})};SC.stringsFor=function(c,b){var a=SC.Locale.localeClassFor(c);a.addStrings(b);return this};SC.metricsFor=function(c,b){var a=SC.Locale.localeClassFor(c);a.addMetrics(b);return this};sc_require("system/locale");SC.STRING_TITLEIZE_REGEXP=(/([\s|\-|\_|\n])([^\s|\-|\_|\n]?)/g);SC.STRING_DECAMELIZE_REGEXP=(/([a-z])([A-Z])/g);SC.STRING_DASHERIZE_REGEXP=(/[ _]/g);SC.STRING_DASHERIZE_CACHE={};SC.STRING_TRIM_LEFT_REGEXP=(/^\s+/g);SC.STRING_TRIM_RIGHT_REGEXP=(/\s+$/g);SC.mixin(SC.String,{capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1)},camelize:function(d){var b=d.replace(SC.STRING_TITLEIZE_REGEXP,function(f,g,e){return e?e.toUpperCase():""});var c=b.charAt(0),a=c.toLowerCase();return c!==a?a+b.slice(1):b},decamelize:function(a){return a.replace(SC.STRING_DECAMELIZE_REGEXP,"$1_$2").toLowerCase()},dasherize:function(c){var a=SC.STRING_DASHERIZE_CACHE,b=a[c];if(b){return b}else{b=SC.String.decamelize(c).replace(SC.STRING_DASHERIZE_REGEXP,"-");a[c]=b}return b},loc:function(d){if(!SC.Locale.currentLocale){SC.Locale.createCurrentLocale()}var b=SC.Locale.currentLocale.locWithDefault(d);if(SC.typeOf(b)!==SC.T_STRING){b=d}var a=SC.$A(arguments);a.shift();if(a.length>0&&a[0]&&a[0].isSCArray){a=a[0]}try{return SC.String.fmt(b,a)}catch(c){SC.error("Error processing string with key: "+d);SC.error("Localized String: "+b);SC.error("Error: "+c)}},locMetric:function(b){var a=SC.Locale,c=a.currentLocale;if(!c){a.createCurrentLocale();c=a.currentLocale}return c.locMetric(b)},locLayout:function(b,c){var a=SC.Locale,d=a.currentLocale;if(!d){a.createCurrentLocale();d=a.currentLocale}return d.locLayout(b,c)},locWithDefault:function(d,c){if(!SC.Locale.currentLocale){SC.Locale.createCurrentLocale()}var b=SC.Locale.currentLocale.locWithDefault(d,c);if(SC.typeOf(b)!==SC.T_STRING){b=d}var a=SC.$A(arguments);a.shift();a.shift();return SC.String.fmt(b,a)},trim:jQuery.trim,trimLeft:function(a){return a.replace(SC.STRING_TRIM_LEFT_REGEXP,"")},trimRight:function(a){return a.replace(SC.STRING_TRIM_RIGHT_REGEXP,"")},mult:function(d,c){if(SC.typeOf(c)!==SC.T_NUMBER||c<1){return null}var a="";for(var b=0;b<c;b+=1){a+=d}return a}});if(String.prototype.trim){SC.supplement(String.prototype,{trim:function(){return SC.String.trim(this,arguments)},trimLeft:function(){return SC.String.trimLeft(this,arguments)},trimRight:function(){return SC.String.trimRight(this,arguments)}})}SC.mixin(String.prototype,{loc:function(){return SC.String.loc(this.toString(),SC.$A(arguments))},locMetric:function(){return SC.String.locMetric(this.toString())},locLayout:function(a){return SC.String.locLayout(this.toString(),a)}});sc_require("system/string");SC.supplement(String.prototype,{capitalize:function(){return SC.String.capitalize(this,arguments)},camelize:function(){return SC.String.camelize(this,arguments)},decamelize:function(){return SC.String.decamelize(this,arguments)},dasherize:function(){return SC.String.dasherize(this,arguments)},loc:function(){var a=SC.$A(arguments);a.unshift(this);return SC.String.loc.apply(SC.String,a)},locWithDefault:function(b){var a=SC.$A(arguments);a.unshift(this);return SC.String.locWithDefault.apply(SC.String,a)},mult:function(a){return SC.String.mult(this,a)}});SC.ActionSupport={target:null,action:null,actionContext:null,fireAction:function(b){var c=this.get("target")||null,a=this.getPath("pane.rootResponder");if(b===undefined){b=this.get("action")}if(b&&a){return a.sendAction(b,c,this,this.get("pane"),this.get("actionContext"),this)}return false}};SC.DelegateSupport={delegateFor:function(c){var b=1,a=arguments.length,d;while(b<a){d=arguments[b];if(d&&d[c]!==undefined){return d}b++}return(this[c]!==undefined)?this:null},invokeDelegateMethod:function(c,a,b){b=SC.A(arguments);b=b.slice(2,b.length);if(!c||!c[a]){c=this}var d=c[a];return d?d.apply(c,b):null},getDelegateProperty:function(d,e){var b=1,a=arguments.length,c;while(b<a){c=arguments[b++];if(c&&c[d]!=undefined){return c.get?c.get(d):c[d]}}return(this[d]!=undefined)?this.get(d):undefined}};SC.Responder=SC.Object.extend({isResponder:YES,pane:null,responderContext:null,nextResponder:null,isFirstResponder:NO,hasFirstResponder:NO,acceptsFirstResponder:YES,becomingFirstResponder:NO,becomeFirstResponder:function(){var a=this.get("pane")||this.get("responderContext")||this.pane();if(a&&this.get("acceptsFirstResponder")){if(a.get("firstResponder")!==this){a.makeFirstResponder(this)}}return this},resignFirstResponder:function(a){var b=this.get("pane")||this.get("responderContext");if(b&&(b.get("firstResponder")===this)){b.makeFirstResponder(null,a)}return YES},willLoseFirstResponder:function(a){},didBecomeFirstResponder:function(a){}});sc_require("system/responder");SC.ResponderContext={isResponderContext:YES,trace:NO,defaultResponder:null,nextResponder:function(){return this.get("defaultResponder")}.property("defaultResponder").cacheable(),firstResponder:null,nextResponderFor:function(a){var b=a.get("nextResponder");if(typeof b===SC.T_STRING){b=SC.objectForPropertyPath(b,this)}else{if(!b&&(a!==this)){b=this}}return b},responderNameFor:function(a){if(!a){return"(No Responder)"}else{if(a._scrc_name){return a._scrc_name}}var b=this.NAMESPACE;this._findResponderNamesFor(this,3,b?[this.NAMESPACE]:[]);return a._scrc_name||a.toString()},_findResponderNamesFor:function(a,e,d){var b,c;for(b in a){if(b==="nextResponder"){continue}c=a[b];if(c&&c.isResponder){if(c._scrc_name){continue}d.push(b);c._scrc_name=d.join(".");if(e>0){this._findResponderNamesFor(c,e-1,d)}d.pop()}}},makeFirstResponder:function(b,a){var f=this.get("firstResponder"),d=this.get("nextResponder"),e=this.get("trace"),c;if(this._locked){if(e){SC.Logger.log("%@: AFTER ACTION: makeFirstResponder => %@".fmt(this,this.responderNameFor(b)))}this._pendingResponder=b;return}if(e){SC.Logger.log("%@: makeFirstResponder => %@".fmt(this,this.responderNameFor(b)))}if(b){b.set("becomingFirstResponder",YES)}this._locked=YES;this._pendingResponder=null;c=b?b:null;while(c){if(c.get("hasFirstResponder")){break}c=(c===d)?null:this.nextResponderFor(c)}if(!c){c=d}this._notifyWillLoseFirstResponder(f,f,c,a);if(f){f.set("isFirstResponder",NO)}this.beginPropertyChanges();this.set("firstResponder",b);if(b){b.set("isFirstResponder",YES)}this._notifyDidBecomeFirstResponder(b,b,c);this.endPropertyChanges();this._locked=NO;if(this._pendingResponder){this.makeFirstResponder(this._pendingResponder);this._pendingResponder=null}if(b){b.set("becomingFirstResponder",NO)}return this},_notifyWillLoseFirstResponder:function(c,e,b,a){if(!e||e===b){return}e.willLoseFirstResponder(c,a);e.set("hasFirstResponder",NO);var d=this.nextResponderFor(e);if(d){this._notifyWillLoseFirstResponder(c,d,b)}},_notifyDidBecomeFirstResponder:function(b,d,a){if(!d||d===a){return}var c=this.nextResponderFor(d);if(c){this._notifyDidBecomeFirstResponder(b,c,a)}d.set("hasFirstResponder",YES);d.didBecomeFirstResponder(b)},resetFirstResponder:function(){var a=this.get("firstResponder");if(!a){return}a.willLoseFirstResponder();a.didBecomeFirstResponder()},sendAction:function(g,d,c){var a=this.get("firstResponder"),e=this.get("nextResponder"),f=this.get("trace"),h=NO,b;this._locked=YES;if(f){SC.Logger.log("%@: begin action '%@' (%@, %@)".fmt(this,g,d,c))}if(!h&&!a&&this.tryToPerform){h=this.tryToPerform(g,d,c)}while(!h&&a){if(a.tryToPerform){h=a.tryToPerform(g,d,c)}if(!h){a=(a===e)?null:this.nextResponderFor(a)}}if(f){if(!h){SC.Logger.log("%@:  action '%@' NOT HANDLED".fmt(this,g))}else{SC.Logger.log("%@: action '%@' handled by %@".fmt(this,g,this.responderNameFor(a)))}}this._locked=NO;if(b=this._pendingResponder){this._pendingResponder=null;this.makeFirstResponder(b)}return a}};SC.bodyOverflowArbitrator=SC.Object.create({requestHidden:function(b,a){this._makeRequest(b,-1-9*!!a)},requestVisible:function(b,a){this._makeRequest(b,1+9*!!a)},withdrawRequest:function(b){if(!b){return}var a=SC.guidFor(b);if(this._requests[a]){delete this._requests[a]}this.setOverflow()},setOverflow:function(){var a=this._decideOverflow();if(a!==undefined){document.body.style.overflow=a?"auto":"hidden"}},_makeRequest:function(c,b){if(!c){return}var a=SC.guidFor(c);this._requests[a]=b;this.setOverflow()},_requests:{},_decideOverflow:function(){var a,e,c,f,b=this._requests,g;for(var d in b){if((g=b[d])<0){a=YES}if(g<-1){c=YES}if(g>0){e=YES}if(g>1){f=YES}}if(f){return YES}if(e&&c){return NO}if(e){return YES}if(a){return NO}return undefined}});SC.mixin(SC.browser,{compare:function(c,a){var f,g,e;if(typeof c==="number"||typeof a==="number"){SC.warn("SC.browser.compare(): Versions compared against Numbers may not provide accurate results.  Use a String of decimal separated Numbers instead.");c=String(c);a=String(a)}f=function(h){return Number(h.match(/^[0-9]+/))};g=SC.A(c.split(".")).map(f);e=SC.A(a.split(".")).map(f);for(var d=0;d<e.length;d++){var b=g[d]-e[d];if(isNaN(b)){return 0}if(b!==0){return b}}return 0},compareVersion:function(){SC.warn("SC.browser.compareVersion() has been deprecated.  Please use SC.browser.compare() instead.  Example: SC.browser.compareVersion(16,0,912) < 0 becomes SC.browser.compare(SC.browser.engineVersion, '16.0.912').");if(this._versionSplit===undefined){var d=function(e){return Number(e.match(/^[0-9]+/))};this._versionSplit=SC.A(this.version.split(".")).map(d)}var c=SC.A(arguments).map(Number);for(var b=0;b<c.length;b++){var a=this._versionSplit[b]-c[b];if(isNaN(a)){return 0}if(a!==0){return a}}return 0}});SC.Builder=function(a){return SC.Builder.create(a)};SC.Builder.create=function create(c){var b=SC.mixin(SC.beget(this.fn),c||{});if(c.hasOwnProperty("toString")){b.toString=c.toString}var a=function(){var d=SC.beget(b);d.defaultClass=this;d.constructor=a;return d.init.apply(d,arguments)};a.fn=a.prototype=b;a.extend=SC.Builder.create;a.mixin=SC.Builder.mixin;return a};SC.Builder.mixin=function(){var b=arguments.length,a;for(a=0;a<b;a++){SC.mixin(this,arguments[a])}return this};SC.Builder.fn={init:function(a){if(a!==undefined){if(SC.typeOf(a)===SC.T_ARRAY){var b=a.length;while(--b>=0){this[b]=a.objectAt?a.objectAt(b):a[b]}this.length=a.length}else{this[0]=a;this.length=1}}return this},size:function(){return this.length},pushStack:function(){var a=this.constructor.apply(this,arguments);a.prevObject=this;return a},end:function(){return this.prevObject||this.constructor()},toString:function(){return"%@$(%@)".fmt(this.defaultClass.toString(),SC.A(this).invoke("toString").join(","))},mixin:SC.Builder.mixin};(function(){var a=SC.Enumerable,c=SC.Builder.fn,b,d;for(b in a){if(!a.hasOwnProperty(b)){continue}d=Array.prototype[b]||a[b];c[b]=d}})();sc_require("system/builder");SC.$=SC.CoreQuery=jQuery;SC.mixin(SC.$.fn,{isCoreQuery:YES,toString:function(){var c=[],b=this.length,a=0;for(a=0;a<b;a++){c[a]="%@: %@".fmt(a,this[a]?this[a].toString():"(null)")}return"<$:%@>(%@)".fmt(SC.guidFor(this),c.join(" , "))},isVisible:function(){return Array.prototype.every.call(this,function(a){return SC.$.isVisible(a)})},view:function(){return this.map(function(){var b=null,a=SC.viewKey,d=this,c;while(!b&&d&&(d!==document)){if(d.nodeType===1&&(c=d.getAttribute("id"))){b=SC.View.views[c]}d=d.parentNode}d=null;return b})},within:function(a){if(this.filter(a).length){return true}return !!this.has(a).length}});(function(){var c={},f={find:function(h,g){return(g!==undefined)?SC.Enumerable.find.call(this,h,g):c.find.call(this,h)},filter:function(h,g){return(g!==undefined)?this.pushStack(SC.Enumerable.filter.call(this,h,g)):c.filter.call(this,h)},filterProperty:function(g,h){return this.pushStack(SC.Enumerable.filterProperty.call(this,g,h))},indexOf:SC.$.index,map:function(h,g){return(g!==undefined)?SC.Enumerable.map.call(this,h,g):c.map.call(this,h)}};var d=SC.$.fn,a=SC.Enumerable,e;for(var b in a){if(a.hasOwnProperty(b)){e=a[b];if(b in f){c[b]=d[b];e=f[b]}d[b]=e}}})();SC.mixin(SC.$,{isVisible:function(a){var b=SC.$;return("hidden"!=a.type)&&(b.css(a,"display")!="none")&&(b.css(a,"visibility")!="hidden")}});sc_require("system/core_query");SC.Event=function(d){var c,b;if(d){this.originalEvent=d;var g=SC.Event._props,f;b=g.length;c=b;while(--c>=0){f=g[c];this[f]=d[f]}}this.timeStamp=this.timeStamp||Date.now();if(!this.target){this.target=this.srcElement||document}if(this.target.nodeType===3){this.target=this.target.parentNode}if(!this.relatedTarget&&this.fromElement){this.relatedTarget=(this.fromElement===this.target)?this.toElement:this.fromElement}if(SC.none(this.pageX)&&!SC.none(this.clientX)){var h=document.documentElement,a=document.body;this.pageX=this.clientX+(h&&h.scrollLeft||a&&a.scrollLeft||0)-(h.clientLeft||0);this.pageY=this.clientY+(h&&h.scrollTop||a&&a.scrollTop||0)-(h.clientTop||0)}if(!this.which&&((this.charCode||d.charCode===0)?this.charCode:this.keyCode)){this.which=this.charCode||this.keyCode}if(!this.metaKey&&this.ctrlKey){this.metaKey=this.ctrlKey}if(!this.which&&this.button){this.which=((this.button&1)?1:((this.button&2)?3:((this.button&4)?2:0)))}if(this.type==="mousewheel"||this.type==="DOMMouseScroll"||this.type==="MozMousePixelScroll"){var e=SC.Event.MOUSE_WHEEL_MULTIPLIER;if(SC.browser.isWebkit&&d.wheelDelta!==undefined){this.wheelDelta=0-(d.wheelDeltaY||d.wheelDeltaX);this.wheelDeltaY=0-(d.wheelDeltaY||0);this.wheelDeltaX=0-(d.wheelDeltaX||0)}else{if(!SC.none(d.detail)&&SC.browser.isMozilla){if(d.axis&&(d.axis===d.HORIZONTAL_AXIS)){this.wheelDeltaX=d.detail;this.wheelDeltaY=this.wheelDelta=0}else{this.wheelDeltaY=this.wheelDelta=d.detail;this.wheelDeltaX=0}}else{this.wheelDelta=this.wheelDeltaY=SC.browser.isIE||SC.browser.isOpera?0-d.wheelDelta:d.wheelDelta;this.wheelDeltaX=0}}this.wheelDelta*=e;this.wheelDeltaX*=e;this.wheelDeltaY*=e}return this};SC.mixin(SC.Event,{MOUSE_WHEEL_MULTIPLIER:function(){var b=1,a=SC.browser.engineVersion;if(SC.browser.name===SC.BROWSER.safari){b=0.4;if(SC.browser.compare(a,"533.17")>0&&SC.browser.compare(a,"534")<0){b=0.004}else{if(SC.browser.compare(a,"533")<0){b=40}}}else{if(SC.browser.name===SC.BROWSER.ie){b=0.3}else{if(SC.browser.name===SC.BROWSER.chrome){b=0.4}}}return b}(),MOUSE_WHEEL_DELTA_LIMIT:1000,_MOUSE_WHEEL_LIMIT_INVALIDATED:NO,create:function(a){return new SC.Event(a)},add:function(f,e,g,h,d,a){if(f&&f.isCoreQuery){if(f.length>0){f.forEach(function(i){this.add(i,e,g,h,d)},this);return this}else{f=f[0]}}if(!f){return this}if(!a){a=NO}if(f.nodeType===3||f.nodeType===8){return SC.Event}if(SC.browser.name===SC.BROWSER.ie&&f.setInterval){f=window}if(SC.typeOf(g)===SC.T_FUNCTION){d=h;h=g;g=null}else{if(g&&SC.typeOf(h)===SC.T_STRING){h=g[h]}}var c=SC.data(f,"sc_events")||SC.data(f,"sc_events",{}),b=c[e];if(!b){b=c[e]={};this._addEventListener(f,e,a)}b[SC.hashFor(g,h)]=[g,h,d];SC.Event._global[e]=YES;f=c=b=null;return this},remove:function(f,e,g,h){if(f&&f.isCoreQuery){if(f.length>0){f.forEach(function(i){this.remove(i,e,g,h)},this);return this}else{f=f[0]}}if(!f){return this}if(f.nodeType===3||f.nodeType===8){return SC.Event}var a,d,c=SC.data(f,"sc_events");if(!c){return this}if(e===undefined){for(e in c){this.remove(f,e)}}else{if(a=c[e]){var b=NO;if(g||h){if(SC.typeOf(g)===SC.T_FUNCTION){h=g;g=null}else{if(SC.typeOf(h)===SC.T_STRING){h=g[h]}}delete a[SC.hashFor(g,h)];d=null;for(d in a){break}if(d===null){b=YES}}else{b=YES}if(b){delete c[e];this._removeEventListener(f,e)}d=null;for(d in c){break}if(!d){SC.removeData(f,"sc_events");delete this._elements[SC.guidFor(f)]}}}f=c=a=null;return this},NO_BUBBLE:["blur","focus","change"],simulateEvent:function(d,c,b){var a=SC.Event.create({type:c,target:d,preventDefault:function(){this.cancelled=YES},stopPropagation:function(){this.bubbles=NO},allowDefault:function(){this.hasCustomEventHandling=YES},timeStamp:Date.now(),bubbles:(this.NO_BUBBLE.indexOf(c)<0),cancelled:NO,normalized:YES});if(b){SC.mixin(a,b)}return a},trigger:function(c,b,i,j){if(c&&c.isCoreQuery){if(c.length>0){c.forEach(function(m){this.trigger(m,b,i,j)},this);return this}else{c=c[0]}}if(!c){return this}if(c.nodeType===3||c.nodeType===8){return undefined}i=SC.A(i);var h,k=SC.typeOf(c[b]||null)===SC.T_FUNCTION,a,g,d,l;a=i[0];if(!a||!a.preventDefault){a=this.simulateEvent(c,b);i.unshift(a)}a.type=b;g=c;do{h=SC.Event.handle.apply(g,i);g=(g===document)?null:(g.parentNode||document)}while(!h&&a.bubbles&&g);g=null;d=c["on"+b];l=SC.$.nodeName(c,"a")&&b==="click";if((!k||l)&&d&&d.apply(c,i)===NO){h=NO}if(k&&j!==NO&&h!==NO&&!l){this.triggered=YES;try{c[b]()}catch(f){}}this.triggered=NO;return h},handle:function(b){if((typeof SC==="undefined")||SC.Event.triggered){return YES}var c,g,e,i,d,h,j,k,a,f;h=SC.A(arguments);h[0]=b=SC.Event.normalizeEvent(b||window.event);d=(SC.data(this,"sc_events")||{})[b.type];if(!d){return NO}for(j in d){k=d[j];a=k[1];b.handler=a;b.data=b.context=k[2];f=k[0]||this;g=a.apply(f,h);if(c!==NO){c=g}if(g===NO){b.preventDefault();b.stopPropagation()}}return c},unload:function(){var a,b=this._elements;for(a in b){this.remove(b[a])}for(a in b){delete b[a]}delete this._elements},special:{ready:{setup:function(){SC._bindReady();return},teardown:function(){return}},mouseenter:{setup:function(){if(SC.browser.name===SC.BROWSER.ie){return NO}SC.Event.add(this,"mouseover",SC.Event.special.mouseenter.handler);return YES},teardown:function(){if(SC.browser.name===SC.BROWSER.ie){return NO}SC.Event.remove(this,"mouseover",SC.Event.special.mouseenter.handler);return YES},handler:function(a){if(SC.Event._withinElement(a,this)){return YES}a.type="mouseenter";return SC.Event.handle.apply(this,arguments)}},mouseleave:{setup:function(){if(SC.browser.name===SC.BROWSER.ie){return NO}SC.Event.add(this,"mouseout",SC.Event.special.mouseleave.handler);return YES},teardown:function(){if(SC.browser.name===SC.BROWSER.ie){return NO}SC.Event.remove(this,"mouseout",SC.Event.special.mouseleave.handler);return YES},handler:function(a){if(SC.Event._withinElement(a,this)){return YES}a.type="mouseleave";return SC.Event.handle.apply(this,arguments)}}},KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,_withinElement:function(d,c){var b=d.relatedTarget;while(b&&b!==c){try{b=b.parentNode}catch(a){b=c}}return b===c},_addEventListener:function(e,d,a){var f,c=this.special[d];if(!a){a=NO}if(!c||c.setup.call(e)===NO){var b=SC.guidFor(e);this._elements[b]=e;f=SC.data(e,"listener")||SC.data(e,"listener",function(){return SC.Event.handle.apply(SC.Event._elements[b],arguments)});if(e.addEventListener){e.addEventListener(d,f,a)}else{if(e.attachEvent){e.attachEvent("on"+d,f)}}}e=c=f=null},_removeEventListener:function(c,b){var d,a=SC.Event.special[b];if(!a||(a.teardown.call(c)===NO)){d=SC.data(c,"listener");if(d){if(c.removeEventListener){c.removeEventListener(b,d,NO)}else{if(c.detachEvent){c.detachEvent("on"+b,d)}}}}c=a=d=null},_elements:{},normalizeEvent:function(a){if(a===window.event){return SC.Event.create(a)}else{return a.normalized?a:SC.Event.create(a)}},_global:{},_props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view which touches targetTouches changedTouches animationName elapsedTime dataTransfer".split(" ")});SC.Event.prototype={hasCustomEventHandling:NO,touchesForView:function(a){if(this.touchContext){return this.touchContext.touchesForView(a)}},touchesForResponder:function(a){if(this.touchContext){return this.touchContext.touchesForView(a)}},averagedTouchesForView:function(a){if(this.touchContext){return this.touchContext.averagedTouchesForView(a)}return null},allowDefault:function(){this.hasCustomEventHandling=YES;return this},preventDefault:function(){var a=this.originalEvent;if(a){if(a.preventDefault){a.preventDefault()}a.returnValue=NO}this.hasCustomEventHandling=YES;return this},stopPropagation:function(){var a=this.originalEvent;if(a){if(a.stopPropagation){a.stopPropagation()}a.cancelBubble=YES}this.hasCustomEventHandling=YES;return this},stop:function(){return this.preventDefault().stopPropagation()},normalized:YES,getCharString:function(){if(SC.browser.name===SC.BROWSER.ie&&SC.browser.compare(SC.browser.version,"9.0")<0){if(this.keyCode==8||this.keyCode==9||(this.keyCode>=37&&this.keyCode<=40)){return String.fromCharCode(0)}else{return(this.keyCode>0)?String.fromCharCode(this.keyCode):null}}else{return(this.charCode>0)?String.fromCharCode(this.charCode):null}},commandCodes:function(){var e=this.keyCode,b=null,c=null,a="",d;if(e&&e!==this.charCode){b=SC.FUNCTION_KEYS[e];if(!b&&(this.altKey||this.ctrlKey||this.metaKey)){b=SC.PRINTABLE_KEYS[e]}if(b){if(this.altKey){a+="alt_"}if(this.ctrlKey||this.metaKey){a+="ctrl_"}if(this.shiftKey){a+="shift_"}}}if(!b){e=this.which;c=b=String.fromCharCode(e);d=b.toLowerCase();if(this.metaKey){a="meta_";b=d}else{b=null}}if(b){b=a+b}return[b,c]}};SC.Event.observe=SC.Event.add;SC.Event.stopObserving=SC.Event.remove;SC.Event.fire=SC.Event.trigger;if(SC.browser.name===SC.BROWSER.ie){SC.Event.add(window,"unload",SC.Event.prototype,SC.Event.unload)}SC.MODIFIER_KEYS={16:"shift",17:"ctrl",18:"alt"};SC.FUNCTION_KEYS={8:"backspace",9:"tab",13:"return",19:"pause",27:"escape",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",44:"printscreen",45:"insert",46:"delete",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scrolllock"};SC.PRINTABLE_KEYS={32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",188:",",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:'"'};SC.SYSTEM_CURSOR="default";SC.AUTO_CURSOR=SC.DEFAULT_CURSOR="auto";SC.CROSSHAIR_CURSOR="crosshair";SC.HAND_CURSOR=SC.POINTER_CURSOR="pointer";SC.MOVE_CURSOR="move";SC.E_RESIZE_CURSOR="e-resize";SC.NE_RESIZE_CURSOR="ne-resize";SC.NW_RESIZE_CURSOR="nw-resize";SC.N_RESIZE_CURSOR="n-resize";SC.SE_RESIZE_CURSOR="se-resize";SC.SW_RESIZE_CURSOR="sw-resize";SC.S_RESIZE_CURSOR="s-resize";SC.W_RESIZE_CURSOR="w-resize";SC.IBEAM_CURSOR=SC.TEXT_CURSOR="text";SC.WAIT_CURSOR="wait";SC.HELP_CURSOR="help";SC.Cursor=SC.Object.extend({init:function(){arguments.callee.base.apply(this,arguments);var a=this.get("cursorStyle")||SC.DEFAULT_CURSOR,c=this.constructor.sharedStyleSheet(),b=SC.guidFor(this);if(c.insertRule){c.insertRule("."+b+" {cursor: "+a+";}",c.cssRules?c.cssRules.length:0)}else{if(c.addRule){c.addRule("."+b,"cursor: "+a)}}this.cursorStyle=a;this.className=b;return this},className:null,cursorStyle:SC.DEFAULT_CURSOR,cursorStyleDidChange:function(){var d,f,c,e,g,b,a;d=this.get("cursorStyle")||SC.DEFAULT_CURSOR;f=this._rule;if(f){f.style.cursor=d;return}c="."+this.get("className");e=this.constructor.sharedStyleSheet();g=(e.cssRules?e.cssRules:e.rules)||[];for(b=0,a=g.length;b<a;++b){f=g[b];if(f.selectorText===c){this._rule=f;f.style.cursor=d;break}}}.observes("cursorStyle")});SC.Cursor.sharedStyleSheet=function(){var b,a=this._styleSheet;if(!a){a=document.createElement("style");a.type="text/css";b=document.getElementsByTagName("head")[0];if(!b){b=document.documentElement}b.appendChild(a);a=document.styleSheets[document.styleSheets.length-1];this._styleSheet=a}return a};SC.Theme={isTheme:YES,classNames:SC.CoreSet.create(),_extend_class_names:function(b){if(b){if(SC.typeOf(b)===SC.T_HASH&&!b.isSet){for(var a in b){if(b[a]){this.classNames.add(a)}else{this.classNames.remove(a)}}}else{if(typeof b==="string"){this.classNames.addEach(b.split(" "))}else{this.classNames.addEach(b)}}}},_extend_self:function(b){if(b.classNames){this._extend_class_names(b.classNames)}var a,c,d;for(a in b){if(a==="classNames"){continue}if(!b.hasOwnProperty(a)){continue}c=b[a];if(c instanceof Function&&!c.base&&(c!==(d=this[a]))){c.base=d}this[a]=c}},create:function(){var c=SC.beget(this);c.baseTheme=this;if(this.themes===SC.Theme.themes){c.themes={}}else{c.themes=SC.beget(this.themes)}c._privateThemes={};c._specializedThemes={};c.classNames=SC.clone(this.classNames);var e=arguments,b=e.length,a,d;for(a=0;a<b;a++){c._extend_self(e[a])}if(c.name){c.classNames.add(c.name)}return c},subtheme:function(a){var b=this.create({name:a});this.addTheme(b);return b},invisibleSubtheme:function(a){var b=this.create({name:a});this._privateThemes[a]=b;return b},themes:{},find:function(a){if(this===SC.Theme){return this.themes[a]}var b;b=this._privateThemes[a];if(b){return b}b=this._specializedThemes[a];if(b){return b}b=this.themes[a];if(b&&!this._specializedThemes[a]){return(this._specializedThemes[a]=b.create({classNames:this.classNames}))}b=SC.Theme.themes[a];if(b){return b}return null},addTheme:function(a){this.themes[a.name]=a}};SC.BaseTheme=SC.Theme.create({name:""});SC.Theme.themes["sc-base"]=SC.BaseTheme;SC.defaultTheme="sc-base";sc_require("mixins/delegate_support");SC.CoreView=SC.Responder.extend(SC.DelegateSupport);sc_require("system/browser");sc_require("system/event");sc_require("system/cursor");sc_require("system/responder");sc_require("system/theme");sc_require("system/string");sc_require("views/view/base");SC.CONTEXT_MENU_ENABLED=YES;SC.TABBING_ONLY_INSIDE_DOCUMENT=NO;SC.FROM_THEME="__FROM_THEME__";SC.EMPTY_CHILD_VIEWS_ARRAY=[];SC.EMPTY_CHILD_VIEWS_ARRAY.needsClone=YES;SC.CoreView.reopen({concatenatedProperties:["outlets","displayProperties","classNames","renderMixin","didCreateLayerMixin","willDestroyLayerMixin","classNameBindings","attributeBindings"],ariaRole:null,ariaHidden:null,pane:function(){var a=this;while(a&&!a.isPane){a=a.get("parentView")}return a}.property("parentView").cacheable(),page:null,parentView:null,isVisible:YES,isVisibleBindingDefault:SC.Binding.bool(),isVisibleInWindow:YES,childViews:SC.EMPTY_CHILD_VIEWS_ARRAY,layer:function(a,c){if(c!==undefined){this._view_layer=c}else{c=this._view_layer;if(!c){var b=this.get("parentView");if(b){b=b.get("layer")}this._view_layer=c=this.findLayerInParentLayer(b)}}return c}.property("isVisibleInWindow").cacheable(),$:function(b){var a=this.get("layer");if(!a){return SC.$()}else{if(b===undefined){return SC.$(a)}else{return SC.$(b,a)}}},containerLayer:function(){return this.get("layer")}.property("layer").cacheable(),layerId:function(a,b){if(b){this._layerId=b}if(this._layerId){return this._layerId}return SC.guidFor(this)}.property().cacheable(),findLayerInParentLayer:function(a){var b="#"+this.get("layerId");return jQuery(b,a)[0]||jQuery(b)[0]},isDescendantOf:function(a){var b=this.get("parentView");if(this===a){return YES}else{if(b){return b.isDescendantOf(a)}else{return NO}}},displayDidChange:function(){this.set("layerNeedsUpdate",YES);return this},_sc_isVisibleDidChange:function(){this.displayDidChange()}.observes("isVisible"),layerNeedsUpdate:NO,_view_layerNeedsUpdateDidChange:function(){if(this.get("layerNeedsUpdate")){this.invokeOnce(this.updateLayerIfNeeded)}}.observes("layerNeedsUpdate"),updateLayerIfNeeded:function(b){var c=this.get("layerNeedsUpdate"),a=c&&(b||this.get("isVisibleInWindow"));if(a){if(this.get("layer")){this.beginPropertyChanges();this.set("layerNeedsUpdate",NO);this.updateLayer();this.endPropertyChanges()}}return this},updateLayer:function(f){var c,b,a,d;var e=f||this.renderContext(this.get("layer"));this._renderLayerSettings(e,NO);d=!this.update;if(d){this.render(e,NO)}else{this.update(e.$())}if(c=this.renderMixin){a=c.length;for(b=0;b<a;++b){c[b].call(this,e,NO)}}e.update();if(e._innerHTMLReplaced){var g=this.get("pane");if(g&&g.get("isPaneAttached")){this._notifyDidAppendToDocument()}}if(this.useStaticLayout){this.viewDidResize()}if(this.didUpdateLayer){this.didUpdateLayer()}if(this.designer&&this.designer.viewDidUpdateLayer){this.designer.viewDidUpdateLayer()}return this},parentViewDidResize:function(){if(!this.get("hasLayout")){this.notifyPropertyChange("frame")}this.viewDidResize()},viewDidResize:function(){},renderContext:function(a){return SC.RenderContext(a)},createLayer:function(){if(this.get("layer")){return this}var a=this.renderContext(this.get("tagName"));this.renderToContext(a);this.set("layer",a.element());this._notifyDidCreateLayer();return this},_notifyDidCreateLayer:function(){this.notifyPropertyChange("layer");if(this.get("useStaticLayout")){this.viewDidResize()}if(this.didCreateLayer){this.didCreateLayer()}var c=this.didCreateLayerMixin,b,a,d=this.get("childViews"),e;if(c){b=c.length;for(a=0;a<b;++a){c[a].call(this)}}b=d.length;for(a=0;a<b;++a){e=d[a];if(!e){continue}e.notifyPropertyChange("layer");if(this.get("useStaticLayout")){if(!e.get("isFixedLayout")){e.viewDidResize()}}e._notifyDidCreateLayer()}},destroyLayer:function(){var a=this.get("layer");if(a){this._notifyWillDestroyLayer();if(a.parentNode){a.parentNode.removeChild(a)}a=null}return this},replaceLayer:function(){this.destroyLayer();this.set("layerLocationNeedsUpdate",YES);this.invokeOnce(this.updateLayerLocationIfNeeded)},parentViewDidChange:function(){this.parentViewDidResize();this.updateLayerLocation()},layerLocationNeedsUpdate:NO,updateLayerLocationIfNeeded:function(a){if(this.get("layerLocationNeedsUpdate")){this.updateLayerLocation()}return this},updateLayerLocation:function(){var e=this.get("layer"),d=this.get("parentView"),b=d?d.get("containerLayer"):null;if(e&&e.parentNode&&e.parentNode!==b){e.parentNode.removeChild(e)}if(!d){if(e&&e.parentNode){e.parentNode.removeChild(e)}}else{if(!b){if(e){if(e.parentNode){e.parentNode.removeChild(e)}this.destroyLayer()}}else{if(!e){this.createLayer();e=this.get("layer");if(!e){return}}var f=d.get("childViews"),c=f.objectAt(f.indexOf(this)+1),a=(c)?c.get("layer"):null;if(c&&(!a||a.parentNode!==b)){c.updateLayerLocationIfNeeded();a=c.get("layer")||null}if((e.parentNode!==b)||(e.nextSibling!==a)){b.insertBefore(e,a)}}}b=d=e=a=null;this.set("layerLocationNeedsUpdate",NO);return this},_notifyWillDestroyLayer:function(){if(this.willDestroyLayer){this.willDestroyLayer()}var c=this.willDestroyLayerMixin,b,a,d=this.get("childViews");if(c){b=c.length;for(a=0;a<b;++a){c[a].call(this)}}b=d.length;for(a=0;a<b;++a){d[a]._notifyWillDestroyLayer()}this.set("layer",null)},renderToContext:function(e,f){var d,c,b,a;this.beginPropertyChanges();this.set("layerNeedsUpdate",NO);if(SC.none(f)){f=YES}this._renderLayerSettings(e,f);d=!this.update;if(d){this.render(e,f)}else{if(f){this.render(e)}else{this.update(e.$())}}if(f&&!this._didRenderChildViews){this.renderChildViews(e,f)}this._didRenderChildViews=NO;if(c=this.renderMixin){a=c.length;for(b=0;b<a;++b){c[b].call(this,e,f)}}this.endPropertyChanges()},_renderLayerSettings:function(a,b){a.resetClassNames();a.resetStyles();this.applyAttributesToContext(a)},applyAttributesToContext:function(a){if(!this.get("layer")){this._applyClassNameBindings();this._applyAttributeBindings(a)}a.addClass(this.get("classNames"));if(this.get("isTextSelectable")){a.addClass("allow-select")}if(!this.get("isVisible")){a.addClass("sc-hidden")}if(this.get("isFirstResponder")){a.addClass("focus")}a.id(this.get("layerId"));a.attr("role",this.get("ariaRole"));var b=this.get("ariaHidden");if(b!==null){if(b===NO){a.removeAttr("aria-hidden")}else{a.attr("aria-hidden",b)}}},_applyClassNameBindings:function(){var a=this.get("classNameBindings"),b=this.get("classNames"),c;if(!a){return}a.forEach(function(f){var e;var d=function(){var h=this._classStringForProperty(f);var g=this.$();if(e){g.removeClass(e);b.removeObject(e)}if(h){g.addClass(h);b.push(h);e=h}else{e=null}};this.addObserver(f.split(":")[0],this,d);c=this._classStringForProperty(f);if(c){b.push(c);e=c}},this)},_applyAttributeBindings:function(a){var e=this.get("attributeBindings"),c,d,b;if(!e){return}e.forEach(function(g){var f=function(){d=this.$();var h=d.attr(g);c=this.get(g);b=typeof c;if((b==="string"||b==="number")&&c!==h){d.attr(g,c)}else{if(c&&b==="boolean"){d.attr(g,g)}else{if(c===NO){d.removeAttr(g)}}}};this.addObserver(g,this,f);c=this.get(g);b=typeof c;if(b==="string"||b==="number"){a.attr(g,c)}else{if(c&&b==="boolean"){a.attr(g,g)}}},this)},_classStringForProperty:function(c){var a=c.split(":"),b=a[1];c=a[0];var d=SC.getPath(this,c);if(d===YES){if(b){return b}return SC.String.dasherize(c.split(".").get("lastObject"))}else{if(d!==NO&&d!==undefined&&d!==null){return d}else{return null}}},prepareContext:function(a,b){if(b!==false){b=YES}if(b){this.renderToContext(a)}else{this.updateLayer(a)}},renderChildViews:function(e,f){var d=this.get("childViews"),b=d.length,a,c;for(a=0;a<b;++a){c=d[a];if(!c){continue}e=e.begin(c.get("tagName"));c.renderToContext(e,f);e=e.end()}this._didRenderChildViews=YES;return e},render:function(){},_notifyDidAppendToDocument:function(){if(!this.get("hasLayout")){this.notifyPropertyChange("frame")}if(this.didAppendToDocument){this.didAppendToDocument()}var c=0,d,a,b=this.get("childViews");for(c=0,a=b.length;c<a;c++){d=b[c];if(d._notifyDidAppendToDocument){d._notifyDidAppendToDocument()}}},childViewsObserver:function(){var c=this.get("childViews"),b,a,d;for(b=0,a=c.length;b<a;b++){d=c[b];if(d._notifyDidAppendToDocument){d._notifyDidAppendToDocument()}}}.observes("childViews"),attributeBindings:null,tagName:"div",classNames:[],classNameBindings:null,toolTip:null,displayToolTip:function(){var a=this.get("toolTip");return(a&&this.get("localize"))?SC.String.loc(a):(a||"")}.property("toolTip","localize").cacheable(),isTextSelectable:NO,displayProperties:["ariaHidden"],nextResponder:function(){return this.get("parentView")}.property("parentView").cacheable(),acceptsFirstResponder:NO,init:function(){var e=this.get("parentView"),g,b,d,f;arguments.callee.base.apply(this,arguments);SC.View.views[this.get("layerId")]=this;this.classNames=this.get("classNames").slice();this.childViews=this.get("childViews").slice();this.createChildViews();f=this.get("displayProperties");for(var c=0,a=f.length;c<a;c++){this.addObserver(f[c],this,this.displayDidChange)}},awake:function(){arguments.callee.base.apply(this,arguments);var c=this.get("childViews"),b=c.length,a;for(a=0;a<b;++a){if(!c[a]){continue}c[a].awake()}},frame:function(){return this.computeFrameWithParentFrame(null)}.property("useStaticLayout").cacheable(),computeFrameWithParentFrame:function(){var a,b=this.get("parentView"),c;if(a=this.get("layer")){c=SC.offset(a);if(b){c=b.convertFrameFromView(c,null)}c.width=a.offsetWidth;c.height=a.offsetHeight;return c}if(this.get("hasLayout")){return null}else{return{x:0,y:0,width:0,height:0}}},clippingFrame:function(){var d=this.get("frame"),a=d,b,c;if(!d){return null}b=this.get("parentView");if(b){c=b.get("clippingFrame");if(!c){return{x:0,y:0,width:d.width,height:d.height}}a=SC.intersectRects(c,d)}a.x-=d.x;a.y-=d.y;return a}.property("parentView","frame").cacheable(),_sc_view_clippingFrameDidChange:function(){var d=this.get("childViews"),b=d.length,a,c;for(a=0;a<b;++a){c=d[a];c.notifyPropertyChange("clippingFrame");c._sc_view_clippingFrameDidChange()}},removeChild:function(b){b.set("parentView",null);var c=this.get("childViews"),a=c.indexOf(b);if(a>=0){c.removeAt(a)}return this},removeAllChildren:function(){var b=this.get("childViews"),a;while(a=b.objectAt(b.get("length")-1)){this.removeChild(a)}return this},removeFromParent:function(){var a=this.get("parentView");if(a){a.removeChild(this)}return this},destroy:function(){if(this.get("isDestroyed")){return this}this._destroy();return arguments.callee.base.apply(this,arguments)},_destroy:function(){this.destroyLayer();var c=this.get("childViews"),b=c.length,a;if(b){c=c.slice();for(a=0;a<b;++a){c[a].destroy()}}delete SC.View.views[this.get("layerId")];delete this._CQ;delete this.page;if(this.get("parentView")){this.removeFromParent()}this.set("owner",null);return this},createChildViews:function(){var f=this.get("childViews"),b=f.length,a,e,d,c;this.beginPropertyChanges();for(a=0;a<b;++a){if(e=(c=f[a])){if(typeof e===SC.T_STRING){c=this[e]}else{e=null}if(!c){SC.Logger.error("No view with name "+e+" has been found in "+this.toString());continue}c=this.createChildView(c);if(e){this[e]=c}}f[a]=c}this.endPropertyChanges();return this},createChildView:function(a,b){if(!a.isClass){b=a}else{if(!b){b={}}else{b=SC.clone(b)}}b.owner=b.parentView=this;if(a.isClass&&a.prototype.hasVisibility){b.isVisibleInWindow=this.get("isVisibleInWindow")}if(!b.page){b.page=this.page}if(a.isClass){a=a.create(b)}return a},isView:YES,selectStart:function(a){return this.get("isTextSelectable")},contextMenu:function(a){if(this.get("isContextMenuEnabled")){a.allowDefault();return YES}}});SC.CoreView.mixin({isViewClass:YES,design:function(){if(this.isDesign){return this}var a=this.extend.apply(this,arguments);a.isDesign=YES;if(SC.ViewDesigner){SC.ViewDesigner.didLoadDesign(a,this,SC.A(arguments))}return a},extend:function(){var a=arguments[arguments.length-1];if(a&&!SC.none(a.theme)){a.themeName=a.theme;delete a.theme}return SC.Object.extend.apply(this,arguments)},layout:function(a){this.prototype.layout=a;return this},classNames:function(a){a=(this.prototype.classNames||[]).concat(a);this.prototype.classNames=a;return this},tagName:function(a){this.prototype.tagName=a;return this},childView:function(a){var b=this.prototype.childViews||[];if(b===this.superclass.prototype.childViews){b=b.slice()}b.push(a);this.prototype.childViews=b;return this},bind:function(b,d){var c=this.prototype,a=this.superclass.prototype;var e=c._bindings;if(!e||e===a._bindings){e=c._bindings=(e||[]).slice()}b=b+"Binding";c[b]=d;e.push(b);return this},prop:function(a,b){this.prototype[a]=b;return this},localization:function(b,a){if(a){b.rootElement=SC.$(a)[0]}return b},viewFor:function(d,c){var b=SC.$A(arguments);if(SC.none(d)){b.shift()}else{b[0]={rootElement:SC.$(d)[0]}}var a=this.create.apply(this,arguments);b=b[0]=null;return a},create:function(){var b=arguments[arguments.length-1];if(b&&b.theme){b.themeName=b.theme;delete b.theme}var c=this,a=new c(arguments);if(SC.ViewDesigner){SC.ViewDesigner.didCreateView(a,SC.$A(arguments))}return a},loc:function(e){var b=e.childViews;delete e.childViews;this.applyLocalizedAttributes(e);if(SC.ViewDesigner){SC.ViewDesigner.didLoadLocalization(this,SC.$A(arguments))}var d=this.prototype.childViews,a=d.length,c;while(--a>=0){c=d[a];e=b[a];if(e&&c&&typeof c===SC.T_STRING){SC.String.loc(c,e)}}return this},applyLocalizedAttributes:function(a){SC.mixin(this.prototype,a)},views:{}});SC.outlet=function(b,a){return function(c){return(this[c]=SC.objectForPropertyPath(b,(a!==undefined)?a:this))}.property()};SC.CoreView.unload=function(){var a=SC.View.views;if(a){for(var b in a){if(!a.hasOwnProperty(b)){continue}delete a[b]}}};SC.View=SC.CoreView.extend({classNames:["sc-view"],displayProperties:["isFirstResponder"]});if(SC.browser.isIE){SC.Event.add(window,"unload",SC.View,SC.View.unload)}sc_require("views/view");sc_require("views/view/layout_style");SC.ANIMATABLE_PROPERTIES={top:YES,left:YES,bottom:YES,right:YES,width:YES,height:YES,centerX:YES,centerY:YES,opacity:YES,scale:YES,rotate:YES,rotateX:YES,rotateY:YES,rotateZ:YES};SC.View.reopen({didCreateLayerMixin:function(){if(SC.platform.supportsCSSTransitions){this.resetAnimation()}},animate:function(o,k,d,n){var f,p;if(typeof o===SC.T_STRING){f={};f[o]=k;p=d}else{f=o;p=k;n=d}var c=SC.typeOf(p);if(c===SC.T_NUMBER){p={duration:p}}else{if(c!==SC.T_HASH){throw"Must provide options hash or duration!"}}if(n){p.callback=n}else{if(p.callback){n=p.callback}}if(p.duration===0){var i=this.adjust(f);if(n){this.layoutStyleCalculator.invokeOnceLater("runAnimationCallback",1,n,null,NO)}return i}var a=p.timing;if(a){if(typeof a!==SC.T_STRING){p.timing="cubic-bezier("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"}}else{p.timing="linear"}var g=SC.clone(this.get("layout")),h=NO,j,m,b,e,l;if(!g.animate){g.animate={}}for(l in f){if(!f.hasOwnProperty(l)||!SC.ANIMATABLE_PROPERTIES[l]){continue}j=f[l];m=g[l];e=g.animate[l];if(SC.none(j)){throw"Can only animate to an actual value!"}if(m!==j||(e&&e.duration!==p.duration)){h=YES;g.animate[l]=p;g[l]=j}}if(h){this.set("layout",g)}else{if(n){this.layoutStyleCalculator.invokeOnceLater("runAnimationCallback",1,n,null,NO)}}return this},resetAnimation:function(){var c=this.get("layout"),e=c.animate,d=NO,b;if(!e){return}var a;for(b in e){d=YES;delete e[b]}if(d){this.set("layout",c);this.notifyPropertyChange("layout")}return this},transitionDidEnd:function(a){this.get("layoutStyleCalculator").transitionDidEnd(a)}});sc_require("ext/string");sc_require("views/view");sc_require("views/view/animation");SC.CSS_TRANSFORM_MAP={rotate:function(a){return null},rotateX:function(a){if(SC.typeOf(a)===SC.T_NUMBER){a+="deg"}return"rotateX("+a+")"},rotateY:function(a){if(SC.typeOf(a)===SC.T_NUMBER){a+="deg"}return"rotateY("+a+")"},rotateZ:function(a){if(SC.typeOf(a)===SC.T_NUMBER){a+="deg"}return"rotateZ("+a+")"},scale:function(a){if(SC.typeOf(a)===SC.T_ARRAY){a=a.join(", ")}return"scale("+a+")"}};SC.View.reopen({layoutStyleCalculator:null,layoutStyle:function(){var a={layout:this.get("layout"),turbo:this.get("hasAcceleratedLayer"),staticLayout:this.get("useStaticLayout")};var b=this.get("layoutStyleCalculator");b.set(a);return b.calculate()}.property().cacheable()});SC.View.LayoutStyleCalculator=SC.Object.extend({_layoutDidUpdate:function(){var g=this.get("layout");if(!g){return}this.dims=SC._VIEW_DEFAULT_DIMS;this.loc=this.dims.length;var n=(this.right=g.right);this.hasRight=(n!=null);var c=(this.left=g.left);this.hasLeft=(c!=null);var j=(this.top=g.top);this.hasTop=(j!=null);var a=(this.bottom=g.bottom);this.hasBottom=(a!=null);var b=(this.width=g.width);this.hasWidth=(b!=null);var o=(this.height=g.height);this.hasHeight=(o!=null);this.minWidth=((g.minWidth===undefined)?null:g.minWidth);var m=(this.maxWidth=(g.maxWidth===undefined)?null:g.maxWidth);this.hasMaxWidth=(m!=null);this.minHeight=(g.minHeight===undefined)?null:g.minHeight;var l=(this.maxHeight=(g.maxHeight===undefined)?null:g.maxHeight);this.hasMaxHeight=(l!=null);var f=(this.centerX=g.centerX);this.hasCenterX=(f!=null);var e=(this.centerY=g.centerY);this.hasCenterY=(e!=null);var d=(this.borderTop=((g.borderTop!==undefined)?g.borderTop:g.border)||0);var k=(this.borderRight=((g.borderRight!==undefined)?g.borderRight:g.border)||0);var i=(this.borderBottom=((g.borderBottom!==undefined)?g.borderBottom:g.border)||0);var h=(this.borderLeft=((g.borderLeft!==undefined)?g.borderLeft:g.border)||0);this.zIndex=(g.zIndex!=null)?g.zIndex.toString():null;this.opacity=(g.opacity!=null)?g.opacity.toString():null;this.backgroundPosition=(g.backgroundPosition!=null)?g.backgroundPosition:null;this.ret={marginTop:null,marginLeft:null}}.observes("layout"),_invalidAutoValue:function(b){var a=SC.Error.desc("%@.layout() you cannot use %@:auto if staticLayout is disabled".fmt(this.get("view"),b),"%@".fmt(this.get("view")),-1);SC.Logger.error(a.toString());throw a},_handleMistakes:function(){var c=this.get("layout");if(!this.staticLayout){if(this.width===SC.LAYOUT_AUTO){this._invalidAutoValue("width")}if(this.height===SC.LAYOUT_AUTO){this._invalidAutoValue("height")}}if(SC.platform.supportsCSSTransforms){var d=c.animate,a,b;if(d){for(b in d){if(SC.CSS_TRANSFORM_MAP[b]){if(this._pendingAnimations&&this._pendingAnimations["-"+SC.platform.cssPrefix+"-transform"]){throw"Animations of transforms must be executed simultaneously!"}if(a&&d[b].duration!==a){SC.Logger.warn("Can't animate transforms with different durations! Using first duration specified.");d[b].duration=a}a=d[b].duration}}}}},_calculatePosition:function(n){var g=null,a=this.get("turbo"),r=this.ret;var d,k,j,c,i,m,b,f,e,l,q,h,o,p;if(n==="x"){d="left";k="right";j="width";c="maxWidth";i="marginLeft";l="borderLeft";h="borderRight";m=this.hasLeft;b=this.hasRight;f=this.hasWidth;e=this.hasMaxWidth}else{d="top";k="bottom";j="height";c="maxHeight";i="marginTop";l="borderTop";h="borderBottom";m=this.hasTop;b=this.hasBottom;f=this.hasHeight;e=this.hasMaxHeight}r[d]=this._cssNumber(this[d]);r[k]=this._cssNumber(this[k]);q=this._cssNumber(this[l]);o=this._cssNumber(this[h]);r[l+"Width"]=q||null;r[h+"Width"]=o||null;p=this[j];if(p>=1){p-=(q+o)}r[j]=this._cssNumber(p);if(m){if(a){g=r[d];r[d]=0}if(b&&f){r[k]=null}}else{if(!b||(b&&!f&&!e)){r[d]=0}}if(!f&&!b){r[k]=0}return g},_calculateCenter:function(n){var i=this.ret,q,a,c,o,f,g,l,m,e;if(n==="x"){q="width";a="centerX";c="left";o="right";f="marginLeft";g="borderLeft";m="borderRight"}else{q="height";a="centerY";c="top";o="bottom";f="marginTop";g="borderTop";m="borderBottom"}i[c]="50%";l=this._cssNumber(this[g]);e=this._cssNumber(this[m]);i[g+"Width"]=l||null;i[m+"Width"]=e||null;var k=this[q],j=this[a],b=this[c];var h=SC.isPercentage(k),d=SC.isPercentage(j,YES);if(k>1){k-=(l+e)}if((h&&d)||(!h&&!d)){var p=j-k/2;i[f]=(h)?Math.floor(p*100)+"%":Math.floor(p)}else{SC.Logger.warn("You have to set "+q+" and "+a+" using both percentages or pixels");i[f]="50%"}i[q]=this._cssNumber(k)||0;i[o]=null},_calculateTransforms:function(e,h){if(SC.platform.supportsCSSTransforms){var g=this.get("layout");var b=SC.platform.domCSSPrefix+"Transform";var d=[];if(this.turbo){d.push("translateX("+(e||0)+"px)","translateY("+(h||0)+"px)");if(SC.platform.supportsCSS3DTransforms){d.push("translateZ(0px)")}}var f=SC.CSS_TRANSFORM_MAP;for(var a in f){var c=g[a];if(c!=null){d.push(f[a](c))}}this.ret[b]=d.length>0?d.join(" "):null}},_calculateAnimations:function(e,c){var d=this.layout,h=d.animate,g;if(!h){return}if(this.getPath("view.isAnimatable")){return}var f=[],b;this._animatedTransforms=[];if(!this._pendingAnimations){this._pendingAnimations={}}var i="-"+SC.platform.cssPrefix+"-transform";if(SC.platform.supportsCSSTransitions){for(g in h){b=h[g];var j=SC.CSS_TRANSFORM_MAP[g];var a=(g==="top"&&c!=null)||(g==="left"&&e!=null);if(SC.platform.supportsCSSTransforms&&(a||j)){this._animatedTransforms.push(g);g=i}b.css=g+" "+b.duration+"s "+b.timing;if(!this._pendingAnimations[g]){this._pendingAnimations[g]=b;f.push(b.css)}}this.ret[SC.platform.domCSSPrefix+"Transition"]=f.join(", ")}else{for(g in h){this._pendingAnimations[g]=h[g]}}delete d.animate},_cssNumber:function(a){if(a==null){return null}else{if(a===SC.LAYOUT_AUTO){return SC.LAYOUT_AUTO}else{if(SC.isPercentage(a)){return(a*100)+"%"}else{return Math.floor(a)}}}},calculate:function(){var d=this.get("layout"),b=null,l=this.get("staticLayout"),c=null,e=null,a=this.get("turbo"),g=this.ret,j=this.dims,f=this.loc,h=this.get("view"),k,i;this._handleMistakes(d);if(l&&d===SC.View.prototype.layout){return{}}if(this.hasLeft||this.hasRight||!this.hasCenterX){e=this._calculatePosition("x")}else{this._calculateCenter("x")}if(this.hasTop||this.hasBottom||!this.hasCenterY){c=this._calculatePosition("y")}else{this._calculateCenter("y")}g.minWidth=this.minWidth;g.maxWidth=this.maxWidth;g.minHeight=this.minHeight;g.maxHeight=this.maxHeight;g.zIndex=this.zIndex;g.opacity=this.opacity;g.backgroundPosition=this.backgroundPosition;this._calculateTransforms(e,c);this._calculateAnimations(e,c);for(k in g){i=g[k];if(typeof i===SC.T_NUMBER){g[k]=(i+"px")}}return g},willRenderAnimations:function(){if(SC.platform.supportsCSSTransitions){var h=this.get("view"),f=h.get("layer"),a=f?f.style:null,b=h.get("layoutStyle"),l=this._activeAnimations,c,e=this._pendingAnimations,d,n=this._animatedTransforms,g=n?n.length:0,k,o=[],m,j,i;if(e){if(!l){l={}}for(k in e){if(!e.hasOwnProperty(k)){continue}d=e[k];c=l[k];i=NO;if(b[k]!==(a?a[k]:null)){i=YES}if(c&&(c.duration!==d.duration||c.timing!==d.timing)){i=YES}if(i&&c){if(m=c.callback){if(g>0){this.runAnimationCallback(m,null,YES);this._animatedTransforms=null}else{this.runAnimationCallback(m,null,YES)}}this.removeAnimationFromLayout(k,YES)}l[k]=d;o.push(k)}if(!this._groupedAnimations){this._groupedAnimations={}}this._groupedAnimations[k]=o;this._activeAnimations=l;this._pendingAnimations=null}}},didRenderAnimations:function(){if(!SC.platform.supportsCSSTransitions){var a,b;for(a in this._pendingAnimations){b=this._pendingAnimations[a].callback;if(b){this.invokeOnceLater("runAnimationCallback",1,b,null,NO)}this.removeAnimationFromLayout(a,NO,YES)}this._activeAnimations=this._pendingAnimations=null}},runAnimationCallback:function(d,b,c){var a=this.get("view");if(d){if(SC.typeOf(d)!==SC.T_HASH){d={action:d}}d.source=a;if(!d.target){d.target=this}}SC.View.runCallback(d,{event:b,view:a,isCancelled:c})},transitionDidEnd:function(c){var e=c.originalEvent.propertyName,d,h,b;h=this._activeAnimations?this._activeAnimations[e]:null;if(h){if(h.callback){this.invokeOnceLater("runAnimationCallback",1,h.callback,c,NO)}this.removeAnimationFromLayout(e,YES);var g;d=this._groupedAnimations&&this._groupedAnimations[e];if(d){for(var f=0,a=d.length;f<a;f++){g=d[f];delete this._activeAnimations[g]}delete this._groupedAnimations[e]}}},removeAnimationFromLayout:function(c,h,b){if(h){var e=this.getPath("view.layer"),g=[],d;for(d in this._activeAnimations){if(d!==c){g.push(this._activeAnimations[d].css)}}if(e){e.style[SC.platform.domCSSPrefix+"Transition"]=g.join(", ")}}var f=this.getPath("view.layout"),a;if(c==="-"+SC.platform.cssPrefix+"-transform"&&this._animatedTransforms&&this._animatedTransforms.length>0){for(a=0;a<this._animatedTransforms.length;a++){delete f["animate"+SC.String.capitalize(this._animatedTransforms[a])]}this._animatedTransforms=null}delete f["animate"+SC.String.capitalize(c)]}});SC.CoreView.runCallback=function(g){var b=SC.$A(arguments).slice(1),a=SC.typeOf(g.action);if(a==SC.T_FUNCTION){g.action.apply(g.target,b)}else{if(a===SC.T_STRING){if(g.action.indexOf(".")>=0){var f=g.action.split(".");var d=f.pop();var e=SC.objectForPropertyPath(f,window);var c=e.get?e.get(d):e[d];if(c&&SC.typeOf(c)==SC.T_FUNCTION){c.apply(e,b)}else{throw"SC.runCallback could not find a function at %@".fmt(g.action)}}}}};SC.View.runCallback=SC.CoreView.runCallback;sc_require("views/view");sc_require("views/view/layout_style");SC.LAYOUT_HORIZONTAL="sc-layout-horizontal";SC.LAYOUT_VERTICAL="sc-layout-vertical";SC._VIEW_DEFAULT_DIMS=["marginTop","marginLeft"];SC.FULL_WIDTH={left:0,right:0};SC.FULL_HEIGHT={top:0,bottom:0};SC.ANCHOR_CENTER={centerX:0,centerY:0};SC.LAYOUT_AUTO="auto";SC.View.reopen({hasLayout:YES,concatenatedProperties:["layoutProperties"],backgroundColor:null,displayProperties:["backgroundColor"],useStaticLayout:NO,init:function(a){a();this.layoutStyleCalculator=SC.View.LayoutStyleCalculator.create({view:this});this._previousLayout=this.get("layout")}.enhance(),propertyDidChange:function(b,d,c){var a=false;if(typeof this.layout==="function"&&this._kvo_dependents){var e=this._kvo_dependents[b];if(e&&e.indexOf("layout")!=-1){a=true}}if(b==="layout"||a){this.layoutDidChange()}arguments.callee.base.apply(this,arguments)},adjust:function(a,d){var b=this.get("layout"),c=NO,f,e;if(a===undefined){return this}if(SC.typeOf(a)===SC.T_STRING){f=b[a];if(d===undefined||f==d){return this}b=SC.clone(b);if(d===null){delete b[a]}else{b[a]=d}c=YES}else{e=a;for(a in e){if(!e.hasOwnProperty(a)){continue}d=e[a];f=b[a];if(d===undefined||f==d){continue}if(!c){b=SC.clone(b)}if(d===null){delete b[a]}else{b[a]=d}c=YES}}if(c){this.set("layout",b)}return this},layout:{top:0,left:0,bottom:0,right:0},isFixedLayout:function(){return this.get("isFixedPosition")&&this.get("isFixedSize")}.property("isFixedPosition","isFixedSize").cacheable(),isFixedPosition:function(){var b=this.get("layout"),a;a=(((b.left!==undefined)&&(b.top!==undefined))&&((b.left!==SC.LAYOUT_AUTO)&&(b.top!==SC.LAYOUT_AUTO)));if(a){a=(!SC.isPercentage(b.top)&&!SC.isPercentage(b.left))}return a}.property("layout").cacheable(),isFixedSize:function(){var b=this.get("layout"),a;a=(((b.width!==undefined)&&(b.height!==undefined))&&((b.width!==SC.LAYOUT_AUTO)&&(b.height!==SC.LAYOUT_AUTO)));if(a){a=(!SC.isPercentage(b.width)&&!SC.isPercentage(b.height))}return a}.property("layout").cacheable(),convertFrameToView:function(i,d){var c=0,b=0,g=0,e=0,a=this,h;while(a){h=a.get("frame");c+=h.x;b+=h.y;a=a.get("layoutView")}if(d){a=d;while(a){h=a.get("frame");g+=h.x;e+=h.y;a=a.get("layoutView")}}c=i.x+c-g;b=i.y+b-e;return{x:c,y:b,width:i.width,height:i.height}},convertFrameFromView:function(i,d){var c=0,b=0,g=0,e=0,a=this,h;while(a&&(h=a.get("frame"))){c+=h.x;b+=h.y;a=a.get("parentView")}if(d){a=d;while(a){h=a.get("frame");g+=h.x;e+=h.y;a=a.get("parentView")}}c=i.x-c+g;b=i.y-b+e;return{x:c,y:b,width:i.width,height:i.height}},scrollToVisible:function(){var a=this.get("parentView");while(a&&!a.get("isScrollable")){a=a.get("parentView")}if(a){a.scrollToVisible();return a.scrollToVisible(this)}else{return NO}},_adjustForBorder:function(e,c){var f=((c.borderTop!==undefined)?c.borderTop:c.border)||0,d=((c.borderLeft!==undefined)?c.borderLeft:c.border)||0,b=((c.borderBottom!==undefined)?c.borderBottom:c.border)||0,a=((c.borderRight!==undefined)?c.borderRight:c.border)||0;e.x+=d;e.y+=f;e.width-=(d+a);e.height-=(f+b);return e},computeFrameWithParentFrame:function(m,g){var o,p=this.get("layout");if(this.get("useStaticLayout")){o=m();return o?this._adjustForBorder(o,p):null}else{o={}}var n,s,l=SC.LAYOUT_AUTO,k=this.get("parentView"),h,c,a=p.right,b=p.left,r=p.top,e=p.bottom,q=p.width,d=p.height,j=p.centerX,i=p.centerY;if(q===l){n=SC.Error.desc(("%@.layout() cannot use width:auto if staticLayout is disabled").fmt(this),"%@".fmt(this),-1);SC.Logger.error(n.toString());throw n}if(d===l){n=SC.Error.desc(("%@.layout() cannot use height:auto if staticLayout is disabled").fmt(this),"%@".fmt(this),-1);SC.Logger.error(n.toString());throw n}if(!g){g=this.computeParentDimensions(p)}h=g.height;c=g.width;if(!SC.none(b)){if(SC.isPercentage(b)){o.x=c*b}else{o.x=b}if(q!==undefined){if(q===l){o.width=l}else{if(SC.isPercentage(q)){o.width=c*q}else{o.width=q}}}else{o.width=c-o.x;if(a&&SC.isPercentage(a)){o.width=o.width-(a*c)}else{o.width=o.width-(a||0)}}}else{if(!SC.none(a)){if(SC.none(q)){if(SC.isPercentage(a)){o.width=c-(c*a)}else{o.width=c-a}o.x=0}else{if(q===l){o.width=l}else{if(SC.isPercentage(q)){o.width=c*q}else{o.width=(q||0)}}if(SC.isPercentage(q)){o.x=c-(a*c)-o.width}else{o.x=c-a-o.width}}}else{if(!SC.none(j)){if(q===l){o.width=l}else{if(SC.isPercentage(q)){o.width=q*c}else{o.width=(q||0)}}if(SC.isPercentage(j)){o.x=(c-o.width)/2+(j*c)}else{o.x=(c-o.width)/2+j}}else{o.x=0;if(SC.none(q)){o.width=c}else{if(q===l){o.width=l}if(SC.isPercentage(q)){o.width=q*c}else{o.width=(q||0)}}}}}if(!SC.none(r)){if(SC.isPercentage(r)){o.y=r*h}else{o.y=r}if(d!==undefined){if(d===l){o.height=l}else{if(SC.isPercentage(d)){o.height=d*h}else{o.height=d}}}else{if(e&&SC.isPercentage(e)){o.height=h-o.y-(e*h)}else{o.height=h-o.y-(e||0)}}}else{if(!SC.none(e)){if(SC.none(d)){if(SC.isPercentage(e)){o.height=h-(e*h)}else{o.height=h-e}o.y=0}else{if(d===l){o.height=l}if(d&&SC.isPercentage(d)){o.height=d*h}else{o.height=(d||0)}if(SC.isPercentage(e)){o.y=h-(e*h)-o.height}else{o.y=h-e-o.height}}}else{if(!SC.none(i)){if(d===l){o.height=l}if(d&&SC.isPercentage(d)){o.height=d*h}else{o.height=(d||0)}if(SC.isPercentage(i)){o.y=(h-o.height)/2+(i*h)}else{o.y=(h-o.height)/2+i}}else{o.y=0;if(SC.none(d)){o.height=h}else{if(d===l){o.height=l}if(SC.isPercentage(d)){o.height=d*h}else{o.height=d||0}}}}}o.x=Math.floor(o.x);o.y=Math.floor(o.y);if(o.height!==l){o.height=Math.floor(o.height)}if(o.width!==l){o.width=Math.floor(o.width)}if(o.height===l||o.width===l){s=this.get("layer");if(o.height===l){o.height=s?s.clientHeight:0}if(o.width===l){o.width=s?s.clientWidth:0}}o=this._adjustForBorder(o,p);if(k&&k.isScrollContainer){k=k.get("parentView");o.x-=k.get("horizontalScrollOffset");o.y-=k.get("verticalScrollOffset")}if(!SC.none(p.maxHeight)&&(o.height>p.maxHeight)){o.height=p.maxHeight}if(!SC.none(p.minHeight)&&(o.height<p.minHeight)){o.height=p.minHeight}if(!SC.none(p.maxWidth)&&(o.width>p.maxWidth)){o.width=p.maxWidth}if(!SC.none(p.minWidth)&&(o.width<p.minWidth)){o.width=p.minWidth}if(o.height<0){o.height=0}if(o.width<0){o.width=0}return o}.enhance(),computeParentDimensions:function(e){var b,c=this.get("parentView"),a=(c)?c.get("frame"):null;if(a){b={width:a.width,height:a.height}}else{var d=e||{};b={width:(d.left||0)+(d.width||0)+(d.right||0),height:(d.top||0)+(d.height||0)+(d.bottom||0)}}return b},borderFrame:function(){var d=this.get("layout"),f=this.get("frame"),a=d.border,e=((d.topBorder!==undefined)?d.topBorder:d.border)||0,c=((d.rightBorder!==undefined)?d.rightBorder:d.border)||0,g=((d.bottomBorder!==undefined)?d.bottomBorder:d.border)||0,b=((d.leftBorder!==undefined)?d.leftBorder:d.border)||0;return{x:f.x-b,y:f.y-e,width:f.width+b+c,height:f.height+e+g}}.property("frame").cacheable(),parentViewDidResize:function(){var b,a;a=this.useStaticLayout||!this.get("isFixedSize");b=!this.get("isFixedPosition");if(a){this.viewDidResize()}else{if(b){this._viewFrameDidChange()}}},viewDidResize:function(){this._viewFrameDidChange();var d=this.childViews,b,a,c;for(a=0;a<(b=d.length);++a){c=d[a];c.tryToPerform("parentViewDidResize")}},_viewFrameDidChange:function(){this.notifyPropertyChange("frame");this._sc_view_clippingFrameDidChange()},beginLiveResize:function(){if(this.willBeginLiveResize){this.willBeginLiveResize()}var d=this.get("childViews"),b=d.length,a,c;for(a=0;a<b;++a){c=d[a];if(c.beginLiveResize){c.beginLiveResize()}}return this},endLiveResize:function(){var d=this.get("childViews"),b=d.length,a,c;for(a=b-1;a>=0;--a){c=d[a];if(c.endLiveResize){c.endLiveResize()}}if(this.didEndLiveResize){this.didEndLiveResize()}return this},layoutView:function(){return this.get("parentView")}.property("parentView").cacheable(),layoutDidChange:function(){var g=this._previousLayout,f=this.get("layout"),i=YES,d,c,a,b;if(!SC.none(f.rotate)){if(SC.none(f.rotateX)){f.rotateX=f.rotate;SC.Logger.warn("Please set rotateX instead of rotate")}}if(!SC.none(f.rotateX)){f.rotate=f.rotateX}else{delete f.rotate}var h=f.animations;if(h){if(!SC.none(h.rotate)){if(SC.none(h.rotateX)){h.rotateX=h.rotate;SC.Logger.warn("Please animate rotateX instead of rotate")}}if(!SC.none(h.rotateX)){h.rotate=h.rotateX}else{delete h.rotate}}if(g&&g!==f){d=g.width;if(d!==undefined){a=f.width;if(d===a){c=g.height;if(g!==undefined){b=f.height;if(c===b){i=NO}}}}}this.beginPropertyChanges();this.notifyPropertyChange("hasAcceleratedLayer");this.notifyPropertyChange("layoutStyle");if(i){this.viewDidResize()}else{this._viewFrameDidChange()}this.endPropertyChanges();var e=this.get("layoutView");if(e){e.set("childViewsNeedLayout",YES);e.layoutDidChangeFor(this);if(e.get("childViewsNeedLayout")){e.invokeOnce(e.layoutChildViewsIfNeeded)}}this._previousLayout=f;return this},childViewsNeedLayout:NO,layoutDidChangeFor:function(b){var a=this._needLayoutViews;if(!a){a=this._needLayoutViews=SC.CoreSet.create()}a.add(b)},layoutChildViewsIfNeeded:function(a){if(!a){a=this.get("isVisibleInWindow")}if(a&&this.get("childViewsNeedLayout")){this.set("childViewsNeedLayout",NO);this.layoutChildViews()}return this},layoutChildViews:function(){var c=this._needLayoutViews,a=c?c.length:0,b;for(b=0;b<a;++b){c[b].updateLayout()}c.clear()},updateLayout:function(){var b=this.get("layer"),a;if(b){a=this.renderContext(b);this.renderLayout(a,NO);a.update();if(this.useStaticLayout){this.viewDidResize()}}b=null;return this},renderLayout:function(a,b){this.get("layoutStyleCalculator").willRenderAnimations();a.addStyle(this.get("layoutStyle"));this.get("layoutStyleCalculator").didRenderAnimations()},_renderLayerSettings:function(b,a,c){b(a,c);this.renderLayout(a,c)}.enhance(),applyAttributesToContext:function(b,a){b(a);if(this.get("useStaticLayout")){a.addClass("sc-static-layout")}if(this.get("backgroundColor")){a.css("backgroundColor",this.get("backgroundColor"))}}.enhance()});SC.View.mixin({convertLayoutToAnchoredLayout:function(f,m){var h={top:0,left:0,width:m.width,height:m.height},d=m.width,k=m.height,l=f.right,a=f.left,j=f.top,g=f.bottom,i=f.width,e=f.height,c=f.centerX,b=f.centerY;if(!SC.none(a)){if(SC.isPercentage(a)){h.left=a*d}else{h.left=a}if(i!==undefined){if(i===SC.LAYOUT_AUTO){h.width=SC.LAYOUT_AUTO}else{if(SC.isPercentage(i)){h.width=i*d}else{h.width=i}}}else{if(l&&SC.isPercentage(l)){h.width=d-h.left-(l*d)}else{h.width=d-h.left-(l||0)}}}else{if(!SC.none(l)){if(SC.none(i)){h.left=0;if(l&&SC.isPercentage(l)){h.width=d-(l*d)}else{h.width=d-(l||0)}}else{if(i===SC.LAYOUT_AUTO){h.width=SC.LAYOUT_AUTO}else{if(SC.isPercentage(i)){h.width=i*d}else{h.width=i}if(SC.isPercentage(l)){h.left=d-(h.width+l)}else{h.left=d-(h.width+l)}}}}else{if(!SC.none(c)){if(i&&SC.isPercentage(i)){h.width=(i*d)}else{h.width=(i||0)}h.left=((d-h.width)/2);if(SC.isPercentage(c)){h.left=h.left+c*d}else{h.left=h.left+c}}else{if(!SC.none(i)){h.left=0;if(i===SC.LAYOUT_AUTO){h.width=SC.LAYOUT_AUTO}else{if(SC.isPercentage(i)){h.width=i*d}else{h.width=i}}}else{h.left=0;h.width=0}}}}if(f.minWidth!==undefined){h.minWidth=f.minWidth}if(f.maxWidth!==undefined){h.maxWidth=f.maxWidth}if(!SC.none(j)){if(SC.isPercentage(j)){h.top=j*k}else{h.top=j}if(e!==undefined){if(e===SC.LAYOUT_AUTO){h.height=SC.LAYOUT_AUTO}else{if(SC.isPercentage(e)){h.height=e*k}else{h.height=e}}}else{h.height=k-h.top;if(g&&SC.isPercentage(g)){h.height=h.height-(g*k)}else{h.height=h.height-(g||0)}}}else{if(!SC.none(g)){if(SC.none(e)){h.top=0;if(g&&SC.isPercentage(g)){h.height=k-(g*k)}else{h.height=k-(g||0)}}else{if(e===SC.LAYOUT_AUTO){h.height=SC.LAYOUT_AUTO}else{if(SC.isPercentage(e)){h.height=e*k}else{h.height=e}h.top=k-h.height;if(SC.isPercentage(g)){h.top=h.top-(g*k)}else{h.top=h.top-g}}}}else{if(!SC.none(b)){if(e&&SC.isPercentage(e)){h.height=(e*k)}else{h.height=(e||0)}h.top=((k-h.height)/2);if(SC.isPercentage(b)){h.top=h.top+b*k}else{h.top=h.top+b}}else{if(!SC.none(e)){h.top=0;if(e===SC.LAYOUT_AUTO){h.height=SC.LAYOUT_AUTO}else{if(SC.isPercentage(e)){h.height=e*k}else{h.height=e}}}else{h.top=0;h.height=0}}}}if(h.top){h.top=Math.floor(h.top)}if(h.bottom){h.bottom=Math.floor(h.bottom)}if(h.left){h.left=Math.floor(h.left)}if(h.right){h.right=Math.floor(h.right)}if(h.width!==SC.LAYOUT_AUTO){h.width=Math.floor(h.width)}if(h.height!==SC.LAYOUT_AUTO){h.height=Math.floor(h.height)}if(f.minHeight!==undefined){h.minHeight=f.minHeight}if(f.maxHeight!==undefined){h.maxHeight=f.maxHeight}return h},convertLayoutToCustomLayout:function(b,a,c){}});sc_require("views/view");sc_require("views/view/layout");sc_require("views/view/layout_style");SC.View.reopen({wantsAcceleratedLayer:NO,hasAcceleratedLayer:function(){if(this.get("wantsAcceleratedLayer")&&SC.platform.supportsAcceleratedLayers){var c=this.get("layout"),d=c.animate,b=SC.LAYOUT_AUTO,a;if(d&&(d.top||d.left)){for(a in d){if(SC.CSS_TRANSFORM_MAP[a]&&((d.top&&d.top.duration!==d[a].duration)||(d.left&&d.left.duration!==d[a].duration))){return NO}}}return this.get("isFixedLayout")}return NO}.property("wantsAcceleratedLayer").cacheable()});sc_require("views/view");SC.View.reopen({cursor:function(a,c){var b;if(c){this._setCursor=c}if(this._setCursor!==undefined){return this._setCursor}b=this.get("parentView");if(this.get("shouldInheritCursor")&&b){return b.get("cursor")}return null}.property("parentView","shouldInheritCursor").cacheable(),applyAttributesToContext:function(b,a){var c=this.get("cursor");if(c){a.addClass(c.get("className"))}b(a)}.enhance(),shouldInheritCursor:YES});sc_require("views/view");SC.View.reopen({isEnabled:YES,isEnabledBindingDefault:SC.Binding.oneWay().bool(),isEnabledInPane:function(){var a=this.get("isEnabled"),b;if(a&&(b=this.get("parentView"))){a=b.get("isEnabledInPane")}return a}.property("parentView","isEnabled"),_sc_view_isEnabledDidChange:function(){if(!this.get("isEnabled")&&this.get("isFirstResponder")){this.resignFirstResponder()}}.observes("isEnabled"),applyAttributesToContext:function(b,a){var c=this.get("isEnabled");b(a);a.setClass("disabled",!c);a.attr("aria-disabled",!c?"true":null)}.enhance()});sc_require("views/view");SC.View.reopen({isKeyResponder:NO,willLoseKeyResponderTo:function(a){},willBecomeKeyResponderFrom:function(a){},didLoseKeyResponderTo:function(a){},didBecomeKeyResponderFrom:function(a){},interpretKeyEvents:function(b){var a=b.commandCodes(),d=a[0],e=a[1],g;if(!d&&!e){return null}if(d){var h=SC.MODIFIED_KEY_BINDINGS[d]||SC.BASE_KEY_BINDINGS[d.match(/[^_]+$/)[0]];if(h){var f=this,c=this.get("pane"),i=null;while(f&&!(i=f.tryToPerform(h,b))){f=(f===c)?null:f.get("nextResponder")}return i}}if(e&&this.respondsTo("insertText")){g=this.insertText(e,b);return g?(g===YES?this:g):null}return null},insertText:function(a){return NO},performKeyEquivalent:function(f,d){var e=NO,g=this.get("childViews"),b=g.length,a=-1,c;while(!e&&(++a<b)){c=g[a];e=c.tryToPerform("performKeyEquivalent",f,d)}return e},firstKeyView:null,_getFirstKeyView:function(){var a=this.get("firstKeyView");if(a){return a}var b=this.get("childViews");if(b){return b[0]}},lastKeyView:null,_getLastKeyView:function(){var d=this.get("lastKeyView");if(d){return d}var a,b=this.get("firstKeyView");if(b){while(a=b._getNextKeyView()){b=a}return b}else{var c=this.get("childViews");if(c){return c[c.length-1]}}},nextKeyView:undefined,_getNextKeyView:function(){var b=this.get("parentView"),a=this.get("nextKeyView");if(b&&b.get("lastKeyView")===this){return null}if(a!==undefined){return a}if(b){var c=b.get("childViews");return c[c.indexOf(this)+1]}},nextValidKeyView:function(){var b=this,a;while(a!==this){a=null;if(b.get("isVisibleInWindow")){a=b._getFirstKeyView()}if(!a){a=b._getNextKeyView()}if(!a){while(b=b.get("parentView")){if(a=b._getNextKeyView()){break}}}if(!a){if(!SC.TABBING_ONLY_INSIDE_DOCUMENT){break}else{a=this.get("pane")}}if(a.get("isVisibleInWindow")&&a.get("acceptsFirstResponder")){return a}b=a}return null}.property("nextKeyView"),previousKeyView:undefined,_getPreviousKeyView:function(){var b=this.get("parentView"),a=this.get("previousKeyView");if(b&&b.get("firstKeyView")===this){return null}if(a!==undefined){return a}if(b){var c=b.get("childViews");return c[c.indexOf(this)-1]}},previousValidKeyView:function(){var b=this,a;while(a!==this){if(b.get("parentView")){a=b._getPreviousKeyView()}else{if(!SC.TABBING_ONLY_INSIDE_DOCUMENT){break}else{a=b}}if(a){do{b=a;a=a._getLastKeyView()}while(a&&a.get("isVisibleInWindow"));if(!a){a=b}}else{a=b.get("parentView")}if(a.get("isVisibleInWindow")&&a.get("acceptsFirstResponder")){return a}b=a}return null}.property("previousKeyView")});sc_require("views/view");SC.View.reopen({_lastLayerId:null,layerIdDidChange:function(){var a=this.get("layer"),b=this.get("layerId"),c=this._lastLayerId;if(b!==c){if(c&&SC.View.views[c]===this){delete SC.View.views[c]}this._lastLayerId=b;SC.View.views[b]=this;if(a){a.id=b}}}.observes("layerId"),parentViewDidChange:function(){this.recomputeIsVisibleInWindow();this.resetBuildState();this.set("layerLocationNeedsUpdate",YES);this.invokeOnce(this.updateLayerLocationIfNeeded);this._invalidatePaneCacheForSelfAndAllChildViews();return this},_invalidatePaneCacheForSelfAndAllChildViews:function(){var d,c=this.get("childViews"),b=c.length,a;this.notifyPropertyChange("pane");for(a=0;a<b;++a){d=c[a];if(d._invalidatePaneCacheForSelfAndAllChildViews){d._invalidatePaneCacheForSelfAndAllChildViews()}}},insertBefore:function(b,d){b.beginPropertyChanges();if(b.get("parentView")){b.removeFromParent()}if(this.willAddChild){this.willAddChild(b,d)}if(b.willAddToParent){b.willAddToParent(this,d)}b.set("parentView",this);var a,c=this.get("childViews");if(c.needsClone){this.set(c=[])}a=(d)?c.indexOf(d):c.length;if(a<0){a=c.length}c.insertAt(a,b);if(b.parentViewDidChange){b.parentViewDidChange()}if(b.layoutDidChange){b.layoutDidChange()}b.endPropertyChanges();this.invokeLast(function(){var e=b.get("pane");if(e&&e.get("isPaneAttached")){b._notifyDidAppendToDocument()}});if(this.didAddChild){this.didAddChild(b,d)}if(b.didAddToParent){b.didAddToParent(this,d)}return this},removeChild:function(b,a){if(!a){return this}if(a.parentView!==this){throw"%@.removeChild(%@) must belong to parent".fmt(this,a)}if(a.willRemoveFromParent){a.willRemoveFromParent()}if(this.willRemoveChild){this.willRemoveChild(a)}b(a);if(a.parentViewDidChange){a.parentViewDidChange()}if(this.didRemoveChild){this.didRemoveChild(a)}if(a.didRemoveFromParent){a.didRemoveFromParent(this)}return this}.enhance(),replaceChild:function(a,b){a.beginPropertyChanges();b.beginPropertyChanges();this.beginPropertyChanges();this.insertBefore(a,b).removeChild(b);this.endPropertyChanges();b.endPropertyChanges();a.endPropertyChanges();return this},replaceAllChildren:function(c){var b=c.get("length"),a;this.beginPropertyChanges();this.destroyLayer().removeAllChildren();for(a=0;a<b;a++){this.appendChild(c.objectAt(a))}this.replaceLayer();this.endPropertyChanges();return this},appendChild:function(a){return this.insertBefore(a,null)},buildInChild:function(a){a.willBuildInToView(this);this.appendChild(a);a.buildInToView(this)},buildOutChild:function(a){a.buildOutFromView(this)},buildInDidFinishFor:function(a){},buildOutDidFinishFor:function(a){this.removeChild(a)},isBuildingIn:NO,isBuildingOut:NO,buildIn:function(){this.buildInDidFinish()},buildOut:function(){this.buildOutDidFinish()},resetBuild:function(){},buildOutDidCancel:function(){},buildInDidCancel:function(){},buildInDidFinish:function(){this.isBuildingIn=NO;this._buildingInTo.buildInDidFinishFor(this);this._buildingInTo=null},buildOutDidFinish:function(){this.isBuildingOut=NO;this._buildingOutFrom.buildOutDidFinishFor(this);this._buildingOutFrom=null},resetBuildState:function(){if(this.isBuildingIn){this.buildInDidCancel();this.isBuildingIn=NO}if(this.isBuildingOut){this.buildOutDidCancel();this.isBuildingOut=NO}this.buildingInTo=null;this.buildingOutFrom=null;this.resetBuild()},willBuildInToView:function(a){if(this.isBuildingOut){this.buildOutDidCancel()}},buildInToView:function(a){if(this.isBuildingIn){return}this._buildingInTo=a;this.isBuildingOut=NO;this.isBuildingIn=YES;this.buildIn()},buildOutFromView:function(a){if(this.isBuildingOut){return}if(this.isBuildingIn){this.buildInDidCancel()}this.isBuildingOut=YES;this.isBuildingIn=NO;this._buildingOutFrom=a;this.buildOut()}});sc_require("views/view");SC.View.reopen({init:function(a){a();this._lastTheme=this.get("theme")}.enhance(),themeName:null,baseThemeName:null,theme:function(){var b=this.get("baseTheme"),a=this.get("themeName");if(a){var c;if(b){c=b.find(a);if(c){return c}}c=SC.Theme.find(a);if(c){return c}return b.invisibleSubtheme(a)}return b}.property("baseTheme","themeName").cacheable(),_sc_view_themeDidChange:function(){if(this._lastTheme===this.get("theme")){return}this._lastTheme=this.get("theme");var c=this.childViews,b=c.length,a;for(a=0;a<b;a++){c[a].notifyPropertyChange("baseTheme")}if(this.get("layer")){this.replaceLayer()}}.observes("theme"),baseTheme:function(){var b;var a=this.get("baseThemeName");if(a){return SC.Theme.find(a)}else{b=this.get("parentView");var c=b&&b.get("theme");return c||SC.Theme.find(SC.defaultTheme)}}.property("baseThemeName","parentView").cacheable(),renderDelegate:function(c,d){if(d){this._setRenderDelegate=d}if(this._setRenderDelegate){return this._setRenderDelegate}var a=this.get("renderDelegateName"),b;if(a){b=this.get("theme")[a];if(!b){throw'%@: Unable to locate render delegate "%@" in theme.'.fmt(this,a)}return b}return null}.property("renderDelegateName","theme"),renderDelegateName:null,renderDelegateProxy:function(){return SC.View._RenderDelegateProxy.createForView(this)}.property("renderDelegate").cacheable(),render:function(b,c){var a=this.get("renderDelegate");if(a){if(c){a.render(this.get("renderDelegateProxy"),b)}else{a.update(this.get("renderDelegateProxy"),b.$())}}},applyAttributesToContext:function(f,e){var g=this.get("theme");var c=g.classNames,b,a=c.length;for(b=0;b<a;b++){e.addClass(c[b])}f(e);var d=this.get("renderDelegate");if(d&&d.className){e.addClass(d.className)}}.enhance(),invokeRenderDelegateMethod:function(c,b){var a=this.get("renderDelegate");if(!a){return undefined}if(SC.typeOf(a[c])!==SC.T_FUNCTION){return undefined}b=SC.$A(arguments);b.shift();b.unshift(this.get("renderDelegateProxy"));return a[c].apply(a,b)}});SC.View._RenderDelegateProxy={isViewRenderDelegateProxy:YES,createForView:function(c){var d=SC.beget(this);var f=c.get("displayProperties"),e={};for(var b=0,a=f.length;b<a;b++){e[f[b]]=YES}e.theme=YES;d._displayPropertiesLookup=e;d.renderState={};d._view=c;return d},get:function(b){if(this[b]!==undefined){return this[b]}var a="display"+b.capitalize();if(this._displayPropertiesLookup[a]){return this._view.get(a)}else{if(this._displayPropertiesLookup[b]){return this._view.get(b)}}return undefined},didChangeFor:function(d){var b=arguments.length,a;for(a=1;a<b;a++){var e=arguments[a],c="display"+e.capitalize();if(this._displayPropertiesLookup[c]){if(this._view.didChangeFor(d,c)){return YES}}else{if(this._displayPropertiesLookup[e]){if(this._view.didChangeFor(d,e)){return YES}}}}return NO}};SC.propertyFromRenderDelegate=function(a,b){return function(f,g){if(g!==undefined){this["_set_rd_"+f]=g}var d=this["_set_rd_"+f];if(d!==undefined){return d}var c=this.get("renderDelegate");if(c&&c.get){var e=this.get("renderDelegateProxy");d=c.getPropertyFor(e,a)}if(d!==undefined){return d}return b}.property("renderDelegate").cacheable()};sc_require("views/view");SC.View.reopen({acceptsMultitouch:NO,hasTouch:NO,touchBoundary:{left:25,right:25,top:25,bottom:25},_touchBoundaryFrame:function(){var b=this.get("touchBoundary"),a;a=this.get("parentView").convertFrameToView(this.get("frame"),null);a.x-=b.left;a.y-=b.top;a.width+=b.left+b.right;a.height+=b.top+b.bottom;return a}.property("touchBoundary","clippingFrame").cacheable(),touchIsInBoundary:function(a){return SC.pointInRect({x:a.pageX,y:a.pageY},this.get("_touchBoundaryFrame"))}});sc_require("views/view");SC.View.reopen({hasVisibility:YES,isVisibleInWindow:NO,isContextMenuEnabled:function(){return SC.CONTEXT_MENU_ENABLED}.property(),recomputeIsVisibleInWindow:function(d){var f=this.get("isVisibleInWindow"),h=this.get("isVisible"),e;if(h){if(d===undefined){e=this.get("parentView");d=e?e.get("isVisibleInWindow"):NO}h=h&&d}if(f!==h){this.set("isVisibleInWindow",h);var g=this.get("childViews"),b=g.length,a,c;for(a=0;a<b;a++){c=g[a];if(c.recomputeIsVisibleInWindow){c.recomputeIsVisibleInWindow(h)}}if(h){if(this.get("childViewsNeedLayout")){this.invokeOnce(this.layoutChildViewsIfNeeded)}}else{if(this.get("isFirstResponder")){this.resignFirstResponder()}}}this.updateLayerIfNeeded(YES);return this},_sc_isVisibleDidChange:function(){this.displayDidChange();this.recomputeIsVisibleInWindow()}.observes("isVisible")});sc_require("views/view");sc_require("views/view/acceleration");sc_require("views/view/cursor");sc_require("views/view/enabled");sc_require("views/view/keyboard");sc_require("views/view/layout");sc_require("views/view/manipulation");sc_require("views/view/theming");sc_require("views/view/touch");sc_require("views/view/visibility");sc_require("mixins/responder_context");SC.MIXED_STATE="__MIXED__";SC.Pane=SC.View.extend(SC.ResponderContext,{isPane:YES,page:null,rootResponder:null,sendEvent:function(c,a,d){var b;if(!d){d=this.get("firstResponder")}while(d){if(c==="touchStart"){if(a.touchResponder===d){d=null;break}if(!d.get("hasTouch")||d.get("acceptsMultitouch")){if(d.tryToPerform("touchStart",a)){break}}}else{if(c==="touchEnd"&&!d.get("acceptsMultitouch")){if(!d.get("hasTouch")){if(d.tryToPerform("touchEnd",a)){break}}}else{if(d.tryToPerform(c,a)){break}}}d=(d===this)?null:d.get("nextResponder")}if(!d&&(d=this.get("defaultResponder"))){if(typeof d===SC.T_STRING){d=SC.objectForPropertyPath(d)}if(!d){d=null}else{d=d.tryToPerform(c,a)?d:null}}else{if(!d&&!(d=this.get("defaultResponder"))){d=this.tryToPerform(c,a)?this:null}}return a.mouseHandler||d},nextResponder:function(){return null}.property().cacheable(),firstResponder:null,acceptsKeyPane:YES,isKeyPane:NO,becomeKeyPane:function(){if(this.get("isKeyPane")){return this}if(this.rootResponder){this.rootResponder.makeKeyPane(this)}return this},resignKeyPane:function(){if(!this.get("isKeyPane")){return this}if(this.rootResponder){this.rootResponder.makeKeyPane(null)}return this},makeFirstResponder:function(c,b,a){if(!b){b=this}var e=this.get("firstResponder"),d=this.get("isKeyPane");if(e===b){return this}if(SC.platform.touch&&b&&b.kindOf(SC.TextFieldView)&&!b.get("focused")){return this}if(d){if(e){e.tryToPerform("willLoseKeyResponderTo",b)}if(b){b.tryToPerform("willBecomeKeyResponderFrom",e)}}if(e){e.beginPropertyChanges();e.set("isKeyResponder",NO)}if(b){b.beginPropertyChanges();b.set("isKeyResponder",d)}c(b,a);if(e){e.endPropertyChanges()}if(b){b.endPropertyChanges()}if(d){if(b){b.tryToPerform("didBecomeKeyResponderFrom",e)}if(e){e.tryToPerform("didLoseKeyResponderTo",b)}}return this}.enhance(),willLoseKeyPaneTo:function(a){this._forwardKeyChange(this.get("isKeyPane"),"willLoseKeyResponderTo",a,NO);return this},willBecomeKeyPaneFrom:function(a){this._forwardKeyChange(!this.get("isKeyPane"),"willBecomeKeyResponderFrom",a,YES);return this},didBecomeKeyResponderFrom:function(a){},didLoseKeyPaneTo:function(b){var a=this.get("isKeyPane");this.set("isKeyPane",NO);this._forwardKeyChange(a,"didLoseKeyResponderTo",b);return this},didBecomeKeyPaneFrom:function(b){var a=this.get("isKeyPane");this.set("isKeyPane",YES);this._forwardKeyChange(!a,"didBecomeKeyResponderFrom",b,YES);return this},isMainPane:NO,focusFrom:function(a){},blurTo:function(a){},blurMainTo:function(a){this.set("isMainPane",NO)},focusMainFrom:function(a){this.set("isMainPane",YES)},append:function(){return this.appendTo(document.body)},remove:function(){if(!this.get("isVisibleInWindow")){return this}if(!this.get("isPaneAttached")){return this}var b=this.get("layer");if(b&&b.parentNode){b.parentNode.removeChild(b)}b=null;this._removeIntercept();this.resignKeyPane();var a=this.rootResponder;if(this.get("isMainPane")){a.makeMainPane(null)}a.panes.remove(this);this.rootResponder=null;this.set("isPaneAttached",NO);this.parentViewDidChange();return this},insert:function(b){var a=this.get("layer");if(!a){a=this.createLayer().get("layer")}b(a);if(!this.get("isPaneAttached")){this.paneDidAttach()}return this},appendTo:function(a){return this.insert(function(b){jQuery(a).append(b)})},paneDidAttach:function(){var a=(this.rootResponder=SC.RootResponder.responder);a.panes.add(this);this.set("isPaneAttached",YES);this.recomputeDependentProperties();this._notifyDidAppendToDocument();this._addIntercept();return this},recomputeDependentProperties:function(){},isPaneAttached:NO,wantsTouchIntercept:NO,hasTouchIntercept:function(){return this.get("wantsTouchIntercept")&&SC.platform.touch}.property("wantsTouchIntercept").cacheable(),zIndex:0,touchZ:99,_addIntercept:function(){if(this.get("hasTouchIntercept")){var b=document.createElement("div");var a=b.style;a.position="absolute";a.left="0px";a.top="0px";a.right="0px";a.bottom="0px";a.webkitTransform="translateZ(0px)";a.zIndex=this.get("zIndex")+this.get("touchZ");b.className="touch-intercept";b.id="touch-intercept-"+SC.guidFor(this);this._touchIntercept=b;document.body.appendChild(b)}},_removeIntercept:function(){if(this._touchIntercept){document.body.removeChild(this._touchIntercept);this._touchIntercept=null}},hideTouchIntercept:function(){if(this._touchIntercept){this._touchIntercept.style.display="none"}},showTouchIntercept:function(){if(this._touchIntercept){this._touchIntercept.style.display="block"}},recomputeIsVisibleInWindow:function(){if(this.get("designer")&&SC.suppressMain){return arguments.callee.base.apply(this,arguments)}var d=this.get("isVisibleInWindow"),f=this.get("isVisible")&&this.get("isPaneAttached");if(d!==f){this.set("isVisibleInWindow",f);var e=this.get("childViews"),b=e.length,a,c;for(a=0;a<b;a++){c=e[a];if(c.recomputeIsVisibleInWindow){c.recomputeIsVisibleInWindow(f)}}if(f){if(this.get("childViewsNeedLayout")){this.invokeOnce(this.layoutChildViewsIfNeeded)}}else{if(this.get("isKeyPane")){this.resignKeyPane()}}}this.updateLayerIfNeeded(YES);return this},updateLayerLocation:function(){if(this.get("designer")&&SC.suppressMain){return arguments.callee.base.apply(this,arguments)}return this},init:function(){if(this.hasTouchIntercept===YES){SC.Logger.warn("Do not set hasTouchIntercept directly. Use wantsTouchIntercept instead.");this.hasTouchIntercept=SC.platform.touch}var a=!!this.get("layer");arguments.callee.base.apply(this,arguments);if(a){this.paneDidAttach()}},classNames:["sc-pane"]});sc_require("panes/pane");SC.Pane.reopen({performKeyEquivalent:function(c,a){var b=arguments.callee.base.apply(this,arguments);if(!b){var d=this.get("defaultResponder");if(d){if(d.performKeyEquivalent){b=d.performKeyEquivalent(c,a)}if(!b&&d.tryToPerform){b=d.tryToPerform(c,a)}}}return b},keyDown:function(a){var b;if(a.keyCode===9&&!this.get("firstResponder")){if(a.shiftKey){b=this.get("previousValidKeyView")}else{b=this.get("nextValidKeyView")}if(b){this.makeFirstResponder(b);return YES}else{if(!SC.TABBING_ONLY_INSIDE_DOCUMENT){a.allowDefault()}}}return NO},_forwardKeyChange:function(d,b,g,f){var c,a,e;if(d&&(a=this.get("firstResponder"))){e=(g)?g.get("firstResponder"):null;c=this.get("firstResponder");if(c&&c[b]){c[b](e)}if((f!==undefined)&&a){a.set("isKeyResponder",f)}}}});sc_require("panes/pane");SC.Pane.reopen({currentWindowSize:null,computeParentDimensions:function(c){if(this.get("designer")&&SC.suppressMain){return arguments.callee.base.apply(this,arguments)}var d={x:0,y:0,width:1000,height:1000},b=this.get("layout");if(document&&document.body){d.width=document.body.clientWidth;d.height=document.body.clientHeight;if(SC.browser.name===SC.BROWSER.ie&&SC.browser.compareVersion(SC.browser.version,"7")===0){var a=SC.platform.get("scrollbarSize");if(document.body.scrollWidth>d.width){d.width-=a}if(document.body.scrollHeight>d.height){d.height-=a}}}if(b.minHeight||b.minWidth){if(b.minHeight){d.height=Math.max(d.height,b.minHeight)}if(b.minWidth){d.width=Math.max(d.width,b.minWidth)}}return d},frame:function(){if(this.get("designer")&&SC.suppressMain){return arguments.callee.base.apply(this,arguments)}return this.computeFrameWithParentFrame(null)}.property(),windowSizeDidChange:function(b,a){this.set("currentWindowSize",a);this.setBodyOverflowIfNeeded();this.parentViewDidResize();return this},setBodyOverflowIfNeeded:function(e){var d=this.get("layout"),b=this.get("currentWindowSize");if(!d||!b||!b.width||!b.height){return}var a=d.minWidth,c=d.minHeight;if(e===true||a||c){if((c&&b.height<c)||(a&&b.width<a)){SC.bodyOverflowArbitrator.requestVisible(this)}else{SC.bodyOverflowArbitrator.requestHidden(this)}}},paneLayoutDidChange:function(){this.invokeOnce(this.updateLayout);this.setBodyOverflowIfNeeded()}.observes("layout"),recomputeDependentProperties:function(a){this.set("currentWindowSize",this.rootResponder.computeWindowSize());a()}.enhance()});sc_require("panes/pane");SC.Pane.reopen({prependTo:function(a){return this.insert(function(b){jQuery(a).prepend(b)})},removeFromParent:function(){throw SC.Error.desc("SC.Pane cannot be removed from its parent, since it's the root. Did you mean remove()?")}});sc_require("panes/pane");SC.Pane.reopen({recomputeDependentProperties:function(a){this.recomputeIsVisibleInWindow();a()}.enhance()});SC.Application=SC.Responder.extend(SC.ResponderContext,{});SC.Color=SC.Object.extend(SC.Copyable,{original:null,a:1,r:0,g:0,b:0,hue:function(c,d){var e=SC.Color.clampToDeviceGamut,a=SC.Color.rgbToHsl(e(this.get("r")),e(this.get("g")),e(this.get("b"))),b;if(d!==undefined){a[0]=(d%360+360)%360;b=SC.Color.hslToRgb(a[0],a[1],a[2]);this.beginPropertyChanges();this.set("r",b[0]);this.set("g",b[1]);this.set("b",b[2]);this.endPropertyChanges()}return a[0]}.property("r","g","b").cacheable(),saturation:function(c,d){var e=SC.Color.clampToDeviceGamut,a=SC.Color.rgbToHsl(e(this.get("r")),e(this.get("g")),e(this.get("b"))),b;if(d!==undefined){a[1]=SC.Color.clamp(d,0,1);b=SC.Color.hslToRgb(a[0],a[1],a[2]);this.beginPropertyChanges();this.set("r",b[0]);this.set("g",b[1]);this.set("b",b[2]);this.endPropertyChanges()}return a[1]}.property("r","g","b").cacheable(),luminosity:function(c,d){var e=SC.Color.clampToDeviceGamut,a=SC.Color.rgbToHsl(e(this.get("r")),e(this.get("g")),e(this.get("b"))),b;if(d!==undefined){a[2]=SC.Color.clamp(d,0,1);b=SC.Color.hslToRgb(a[0],a[1],a[2]);this.beginPropertyChanges();this.set("r",b[0]);this.set("g",b[1]);this.set("b",b[2]);this.endPropertyChanges()}return a[2]}.property("r","g","b").cacheable(),isEqualTo:function(a){return this.get("r")===a.get("r")&&this.get("g")===a.get("g")&&this.get("b")===a.get("b")&&this.get("a")===a.get("a")},toArgb:function(){var a=SC.Color.clampToDeviceGamut;return"#"+[a(255*this.get("a")),a(this.get("r")),a(this.get("g")),a(this.get("b"))].map(function(b){b=b.toString(16);return b.length===1?"0"+b:b}).join("")},toHex:function(){var a=SC.Color.clampToDeviceGamut;return"#"+[a(this.get("r")),a(this.get("g")),a(this.get("b"))].map(function(b){b=b.toString(16);return b.length===1?"0"+b:b}).join("")},toRgb:function(){var a=SC.Color.clampToDeviceGamut;return"rgb("+a(this.get("r"))+","+a(this.get("g"))+","+a(this.get("b"))+")"},toRgba:function(){var a=SC.Color.clampToDeviceGamut;return"rgba("+a(this.get("r"))+","+a(this.get("g"))+","+a(this.get("b"))+","+this.get("a")+")"},toHsl:function(){var a=Math.round;return"hsl("+a(this.get("hue"))+","+a(this.get("saturation")*100)+"%,"+a(this.get("luminosity")*100)+"%)"},toHsla:function(){var a=Math.round;return"hsla("+a(this.get("hue"))+","+a(this.get("saturation")*100)+"%,"+a(this.get("luminosity")*100)+"%,"+this.get("a")+")"},cssText:function(){var a=SC.Color.supportsRgba||SC.Color.supportsArgb;return(this.a===1||!a)?this.toHex():SC.Color.supportsRgba?this.toRgba():this.toArgb()}.property("r","g","b","a").cacheable(),copy:function(){return SC.Color.create({original:this.get("original"),r:this.get("r"),g:this.get("g"),b:this.get("b"),a:this.get("a")})},sub:function(a){return SC.Color.create({r:this.get("r")-a.get("r"),g:this.get("g")-a.get("g"),b:this.get("b")-a.get("b"),a:this.get("a")-a.get("a")})},add:function(a){return SC.Color.create({r:this.get("r")+a.get("r"),g:this.get("g")+a.get("g"),b:this.get("b")+a.get("b"),a:this.get("a")+a.get("a")})},mult:function(b){var a=Math.round;return SC.Color.create({r:a(this.get("r")*b),g:a(this.get("g")*b),b:a(this.get("b")*b),a:this.get("a")*b})}});SC.Color.mixin({supportsRgba:(function(){var c=document.getElementsByTagName("script")[0].style,b=c.cssText,a;c.cssText="background-color:rgba(5,2,1,.5)";a=c.backgroundColor.indexOf("rgba")!==-1;c.cssText=b;return a}()),supportsArgb:(function(){var c=document.getElementsByTagName("script")[0].style,b=c.cssText,a;c.cssText='filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#55000000", endColorstr="#55000000");';a=c.backgroundColor.indexOf("#55000000")!==-1;c.cssText=b;return a}()),clamp:function(c,b,a){return Math.max(Math.min(c,a),b)},clampInt:function(c,b,a){return Math.round(SC.Color.clamp(c,b,a))},clampToDeviceGamut:function(a){return SC.Color.clampInt(a,0,255)},hsvToRgb:function(j,x,u){j/=360;var a,l,o,e=Math.floor(j*6),m=j*6-e,d=u*(1-x),c=u*(1-(x*m)),w=u*(1-(x*(1-m))),n=[[u,w,d],[c,u,d],[d,u,w],[d,c,u],[w,d,u],[u,d,c]],k=SC.Color.clampToDeviceGamut;e=e%6;a=k(n[e][0]*255);l=k(n[e][1]*255);o=k(n[e][2]*255);return[a,l,o]},rgbToHsv:function(a,f,j){a/=255;f/=255;j/=255;var k=Math.max(a,f,j),c=Math.min(a,f,j),i=k-c,e,m=k===0?0:i/k,l=k;if(k===c){e=0}else{switch(k){case a:e=(f-j)/i+(f<j?6:0);break;case f:e=(j-a)/i+2;break;case j:e=(a-f)/i+4;break}e/=6}e*=360;return[e,m,l]},hslToRgb:function(f,e,b){f/=360;var d,c,a=SC.Color.hueToRgb,g=SC.Color.clampToDeviceGamut;c=b<=0.5?b*(e+1):b+e-b*e;d=b*2-c;return[g(a(d,c,f+1/3)*255),g(a(d,c,f)*255),g(a(d,c,f-1/3)*255)]},hueToRgb:function(b,a,c){if(c<0){c++}if(c>1){c--}if(c<1/6){return b+(a-b)*c*6}if(c<1/2){return a}if(c<2/3){return b+(a-b)*(2/3-c)*6}return b},rgbToHsl:function(a,i,k){a/=255;i/=255;k/=255;var m=Math.max(a,i,k),e=Math.min(a,i,k),f,n,c=(m+e)/2,j=m-e;if(m===e){f=n=0}else{n=c>0.5?j/(2-m-e):j/(m+e);switch(m){case a:f=(i-k)/j+(i<k?6:0);break;case i:f=(k-a)/j+2;break;case k:f=(a-i)/j+4;break}f/=6}f*=360;return[f,n,c]},PARSE_RGBA:/^rgba\(\s*([\d]+%?)\s*,\s*([\d]+%?)\s*,\s*([\d]+%?)\s*,\s*([.\d]+)\s*\)$/,PARSE_RGB:/^rgb\(\s*([\d]+%?)\s*,\s*([\d]+%?)\s*,\s*([\d]+%?)\s*\)$/,PARSE_HSLA:/^hsla\(\s*(-?[\d]+)\s*\s*,\s*([\d]+)%\s*,\s*([\d]+)%\s*,\s*([.\d]+)\s*\)$/,PARSE_HSL:/^hsl\(\s*(-?[\d]+)\s*,\s*([\d]+)%\s*,\s*([\d]+)%\s*\)$/,PARSE_HEX:/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,PARSE_ARGB:/^#[0-9a-fA-F]{8}$/,KEYWORDS:{aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#00FFFF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blue:"#0000FF",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#FF00FF",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",green:"#008000",greenyellow:"#ADFF2F",grey:"#808080",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#00FF00",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",red:"#FF0000",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFFFFF",whitesmoke:"#F5F5F5",yellow:"#FFFF00",yellowgreen:"#9ACD32"},from:function(f){var k=SC.Color,j=f,i,h,c,d=1,e=function(b){var a=parseInt(b,10);return b.slice(-1)==="%"?k.clampInt(a*2.55,0,255):k.clampInt(a,0,255)};if(k.KEYWORDS.hasOwnProperty(f)){f=k.KEYWORDS[f]}if(k.PARSE_RGB.test(f)){f=f.match(k.PARSE_RGB);i=e(f[1]);h=e(f[2]);c=e(f[3])}else{if(k.PARSE_RGBA.test(f)){f=f.match(k.PARSE_RGBA);i=e(f[1]);h=e(f[2]);c=e(f[3]);d=parseFloat(f[4],10)}else{if(k.PARSE_HEX.test(f)){if(f.length===4){f="#"+f.charAt(1)+f.charAt(1)+f.charAt(2)+f.charAt(2)+f.charAt(3)+f.charAt(3)}i=parseInt(f.slice(1,3),16);h=parseInt(f.slice(3,5),16);c=parseInt(f.slice(5,7),16)}else{if(k.PARSE_ARGB.test(f)){i=parseInt(f.slice(3,5),16);h=parseInt(f.slice(5,7),16);c=parseInt(f.slice(7,9),16);d=parseInt(f.slice(1,3),16)/255}else{if(k.PARSE_HSL.test(f)){f=f.match(k.PARSE_HSL);f=k.hslToRgb(((parseInt(f[1],10)%360+360)%360),k.clamp(parseInt(f[2],10)/100,0,1),k.clamp(parseInt(f[3],10)/100,0,1));i=f[0];h=f[1];c=f[2]}else{if(k.PARSE_HSLA.test(f)){f=f.match(k.PARSE_HSLA);d=parseFloat(f[4],10);f=k.hslToRgb(((parseInt(f[1],10)%360+360)%360),k.clamp(parseInt(f[2],10)/100,0,1),k.clamp(parseInt(f[3],10)/100,0,1));i=f[0];h=f[1];c=f[2]}else{if(f==="transparent"){i=h=c=0;d=0}else{return NO}}}}}}}return SC.Color.create({original:j,r:k.clampInt(i,0,255),g:k.clampInt(h,0,255),b:k.clampInt(c,0,255),a:k.clamp(d,0,1)})}});SC.BENCHMARK_LOG_READY=YES;sc_require("system/event");SC.mixin({isReady:NO,suppressOnReady:SC.suppressOnReady?YES:NO,suppressMain:SC.suppressMain?YES:NO,ready:function(b,c){var a=SC._readyQueue;if(c===undefined){c=b;b=null}else{if(SC.typeOf(c)===SC.T_STRING){c=b[c]}}if(SC.isReady){jQuery(document).ready(function(){c.call(b)})}else{if(!a){SC._readyQueue=[]}SC._readyQueue.push(function(){c.call(b)})}return this},onReady:{done:function(){if(SC.isReady){return}SC.isReady=true;SC.RunLoop.begin();SC.Locale.createCurrentLocale();var d=SC.Locale.currentLanguage.toLowerCase();jQuery("body").addClass(d);jQuery("html").attr("lang",d);jQuery("#loading").remove();var c=SC._readyQueue,b,a;if(c){for(b=0,a=c.length;b<a;b++){c[b].call()}SC._readyQueue=null}if(window.main&&!SC.suppressMain&&(SC.mode===SC.APP_MODE)){window.main()}SC.RunLoop.end()}}});if(!SC.suppressOnReady){jQuery.event.special.ready._default=SC.onReady.done}SC.APP_MODE="APP_MODE";SC.TEST_MODE="TEST_MODE";SC.mode=SC.APP_MODE;SC.platform=SC.Object.create({scrollbarSize:function(){var a=document.createElement("DIV"),d;a.innerHTML="<div style='height:1px;'></div>";a.style.cssText="position:absolute;width:100px;height:100px;overflow-y:visible;";d=a.childNodes[0];document.body.appendChild(a);var b=d.innerWidth||d.clientWidth;a.style.overflowY="scroll";var c=d.innerWidth||d.clientWidth;document.body.removeChild(a);return b-c}.property().cacheable(),touch:!SC.none(window.ontouchstart)||SC.browser.name===SC.BROWSER.android,bounceOnScroll:SC.browser.os===SC.OS.ios,pinchToZoom:SC.browser.os===SC.OS.ios,input:{placeholder:("placeholder" in document.createElement("input"))},input:function(d){var e={},c=d.length,f=document.createElement("input"),b,a;for(a=0;a<c;a++){b=d[a];e[b]=!!(b in f)}return e}(["autocomplete","readonly","list","size","required","multiple","maxlength","pattern","min","max","step","placeholder"]),standalone:!!navigator.standalone,cssPrefix:null,domCSSPrefix:null,simulateTouchEvents:function(){if(this.touch){return}SC.Logger.log("Simulating touch events");SC.platform.touch=YES;SC.platform.bounceOnScroll=YES;document.body.className=document.body.className+" touch";this._simtouch_counter=1;this.removeEvents(["click","dblclick","mouseout","mouseover","mousewheel"]);this.replaceEvent("mousemove",this._simtouch_mousemove);this.replaceEvent("mousedown",this._simtouch_mousedown);this.replaceEvent("mouseup",this._simtouch_mouseup);SC.platform.windowSizeDeterminesOrientation=YES;SC.device.orientationHandlingShouldChange()},removeEvents:function(d){var b,a=d.length,c;for(b=0;b<a;b++){c=d[b];SC.Event.remove(document,c,SC.RootResponder.responder,SC.RootResponder.responder[c])}},replaceEvent:function(a,b){SC.Event.remove(document,a,SC.RootResponder.responder,SC.RootResponder.responder[a]);SC.Event.add(document,a,this,b)},_simtouch_mousemove:function(a){if(!this._mousedown){if(a.altKey&&this._pinchCenter===null){this._pinchCenter={pageX:a.pageX,pageY:a.pageY,screenX:a.screenX,screenY:a.screenY,clientX:a.clientX,clientY:a.clientY}}else{if(!a.altKey&&this._pinchCenter!==null){this._pinchCenter=null}}return NO}var b=this.manufactureTouchEvent(a,"touchmove");return SC.RootResponder.responder.touchmove(b)},_simtouch_mousedown:function(a){this._mousedown=YES;var b=this.manufactureTouchEvent(a,"touchstart");return SC.RootResponder.responder.touchstart(b)},_simtouch_mouseup:function(a){var c=this.manufactureTouchEvent(a,"touchend"),b=SC.RootResponder.responder.touchend(c);this._mousedown=NO;this._simtouch_counter++;return b},manufactureTouchEvent:function(k,j){var c,l,f=this._simtouch_counter;c={type:j,target:k.target,identifier:f,pageX:k.pageX,pageY:k.pageY,screenX:k.screenX,screenY:k.screenY,clientX:k.clientX,clientY:k.clientY};k.touches=[c];if(k.altKey&&this._pinchCenter!==null){var h=this._pinchCenter.pageX+this._pinchCenter.pageX-k.pageX,g=this._pinchCenter.pageY+this._pinchCenter.pageY-k.pageY,e=this._pinchCenter.screenX+this._pinchCenter.screenX-k.screenX,d=this._pinchCenter.screenY+this._pinchCenter.screenY-k.screenY,b=this._pinchCenter.clientX+this._pinchCenter.clientX-k.clientX,a=this._pinchCenter.clientY+this._pinchCenter.clientY-k.clientY,i=this._simtouch_counter+1;l={type:j,target:k.target,identifier:i,pageX:h,pageY:g,screenX:e,screenY:d,clientX:b,clientY:a};k.touches=[c,l]}k.changedTouches=k.touches;return k},supportsCSSTransitions:NO,supportsCSSTransforms:NO,understandsCSS3DTransforms:NO,supportsCSS3DTransforms:NO,supportsAcceleratedLayers:NO,supportsHashChange:function(){return("onhashchange" in window)&&(document.documentMode===undefined||document.documentMode>7)}(),supportsHistory:function(){return !!(window.history&&window.history.pushState)}(),supportsCanvas:function(){return !!document.createElement("canvas").getContext}(),supportsOrientationChange:("onorientationchange" in window),windowSizeDeterminesOrientation:SC.browser.os===SC.OS.ios||!("onorientationchange" in window)});(function(){var a=navigator.userAgent.toLowerCase();if((/webkit/).test(a)){SC.platform.cssPrefix="webkit";SC.platform.domCSSPrefix="Webkit"}else{if((/opera/).test(a)){SC.platform.cssPrefix="opera";SC.platform.domCSSPrefix="O"}else{if((/msie/).test(a)&&!(/opera/).test(a)){SC.platform.cssPrefix="ms";SC.platform.domCSSPrefix="ms"}else{if((/mozilla/).test(a)&&!(/(compatible|webkit)/).test(a)){SC.platform.cssPrefix="moz";SC.platform.domCSSPrefix="Moz"}}}}})();(function(){var b=document.createElement("div");var a=["-moz-","-moz-","-o-","-ms-","-webkit-"],h=["moz","Moz","o","ms","webkit"];var f="",d=null,j,c;for(d=0,c=a.length;d<c;d++){j=a[d];f+=j+"transition:all 1s linear;";f+=j+"transform: translate(1px, 1px);";f+=j+"perspective: 500px;"}b.style.cssText=f;var k;for(d=0,c=h.length;d<c;d++){k=h[d];if(b.style[k+"TransitionProperty"]!==undefined){SC.platform.supportsCSSTransitions=YES}if(b.style[k+"Transform"]!==undefined){SC.platform.supportsCSSTransforms=YES}if(b.style[k+"Perspective"]!==undefined||b.style[k+"PerspectiveProperty"]!==undefined){SC.platform.understandsCSS3DTransforms=YES;SC.platform.supportsCSS3DTransforms=YES}}try{if(window.media&&window.media.matchMedium){if(!window.media.matchMedium("(-webkit-transform-3d)")){SC.platform.supportsCSS3DTransforms=NO}}else{if(window.styleMedia&&window.styleMedia.matchMedium){if(!window.styleMedia.matchMedium("(-webkit-transform-3d)")){SC.platform.supportsCSS3DTransforms=NO}}}}catch(g){SC.platform.supportsCSS3DTransforms=NO}if(SC.platform.supportsCSSTransforms&&SC.platform.cssPrefix==="webkit"){SC.platform.supportsAcceleratedLayers=YES}})();sc_require("system/ready");sc_require("system/platform");SC.CAPTURE_BACKSPACE_KEY=NO;SC.RootResponder=SC.Object.extend({panes:null,init:function(){arguments.callee.base.apply(this,arguments);this.panes=SC.Set.create();if(SC.platform.supportsCSSTransitions){this[SC.platform.cssPrefix+"TransitionEnd"]=this.transitionEnd;this["transitionend"]=this.transitionEnd}},mainPane:null,makeMainPane:function(b){var a=this.get("mainPane");if(a===b){return this}this.beginPropertyChanges();if(this.get("keyPane")===a){this.makeKeyPane(b)}this.set("mainPane",b);if(a){a.blurMainTo(b)}if(b){b.focusMainFrom(a)}this.endPropertyChanges();return this},menuPane:null,makeMenuPane:function(b){if(b&&!b.get("acceptsMenuPane")){return this}else{var a=this.get("menuPane");if(a===b){return this}this.set("menuPane",b)}return this},keyPane:null,previousKeyPanes:[],makeKeyPane:function(f){var e,a,d;if(f){if(!f.get("acceptsKeyPane")){return this}else{a=this.get("keyPane");if(a===f){return this}else{if(a){d=this.get("previousKeyPanes");d.push(a)}e=f}}}else{a=this.get("keyPane");d=this.get("previousKeyPanes");e=null;var c;while(d.length>0){c=d.pop();if(c.get("isPaneAttached")&&c.get("acceptsKeyPane")){e=c;break}}}if(!e){var b=this.get("mainPane");if(b&&b.get("acceptsKeyPane")){e=b}}if(a){a.willLoseKeyPaneTo(e)}if(e){e.willBecomeKeyPaneFrom(a)}this.set("keyPane",e);if(e){e.didBecomeKeyPaneFrom(a)}if(a){a.didLoseKeyPaneTo(e)}return this},currentWindowSize:null,computeWindowSize:function(){var c,b,a;if(!this._bod||!this._docElement){b=document.body;a=document.documentElement;this._bod=b;this._docElement=a}else{b=this._bod;a=this._docElement}if(window.innerHeight){c={width:window.innerWidth,height:window.innerHeight}}else{if(a&&a.clientHeight){c={width:a.clientWidth,height:a.clientHeight}}else{if(b){c={width:b.clientWidth,height:b.clientHeight}}}}return c},resize:function(){this._resize();return YES},_resize:function(){var a=this.computeWindowSize(),b=this.get("currentWindowSize");this.set("currentWindowSize",a);if(!SC.rectsEqual(a,b)){SC.device.windowSizeDidChange(a);if(this.panes){SC.run(function(){this.panes.invoke("windowSizeDidChange",b,a)},this)}}},hasFocus:NO,focus:function(b){if(!this.get("hasFocus")){SC.$("body").addClass("sc-focus").removeClass("sc-blur");if(!SC.TABBING_ONLY_INSIDE_DOCUMENT&&!SC.browser.isIE8OrLower){var a=SC.RootResponder.responder.get("keyPane");if(a){var c=a.get("nextValidKeyView");if(c){a.makeFirstResponder(c)}}}SC.run(function(){this.set("hasFocus",YES)},this)}return YES},focusin:function(a){if(this._focusTimeout){clearTimeout(this._focusTimeout)}this.focus(a)},focusout:function(a){var b=this;this._focusTimeout=setTimeout(function(){b.blur(a)},300)},blur:function(a){if(this.get("hasFocus")){SC.$("body").addClass("sc-blur").removeClass("sc-focus");SC.run(function(){this.set("hasFocus",NO)},this)}return YES},dragDidStart:function(a){this._mouseDownView=a;this._drag=a},defaultResponder:null,sendAction:function(d,e,c,f,b,a){e=this.targetForAction(d,e,c,f,a);if(e&&e.isResponderContext){return !!e.sendAction(d,c,b,a)}else{return e&&e.tryToPerform(d,c)}},_responderFor:function(d,b,a){var c=d?d.get("defaultResponder"):null;if(d){d=a||d.get("firstResponder")||d;do{if(d.respondsTo(b)){return d}}while((d=d.get("nextResponder")))}if(typeof c===SC.T_STRING){c=SC.objectForPropertyPath(c)}if(!c){return null}else{if(c.isResponderContext){return c}else{if(c.respondsTo(b)){return c}else{return null}}}},targetForAction:function(c,f,e,g,a){if(!c||(SC.typeOf(c)!==SC.T_STRING)){return null}if(f){if(SC.typeOf(f)===SC.T_STRING){f=SC.objectForPropertyPath(f)||SC.objectForPropertyPath(f,e)}if(f&&!f.isResponderContext){if(f.respondsTo&&!f.respondsTo(c)){f=null}else{if(SC.typeOf(f[c])!==SC.T_FUNCTION){f=null}}}return f}if(g){f=this._responderFor(g,c,a);if(f){return f}}var b=this.get("keyPane"),d=this.get("mainPane");if(b&&(b!==g)){f=this._responderFor(b,c)}if(!f&&d&&(d!==b)){f=this._responderFor(d,c)}if(!f&&(f=this.get("defaultResponder"))){if(SC.typeOf(f)===SC.T_STRING){f=SC.objectForPropertyPath(f);if(f){this.set("defaultResponder",f)}}if(f&&!f.isResponderContext){if(f.respondsTo&&!f.respondsTo(c)){f=null}else{if(SC.typeOf(f[c])!==SC.T_FUNCTION){f=null}}}}return f},targetViewForEvent:function(a){return a.target?SC.$(a.target).view()[0]:null},sendEvent:function(c,a,d){var e,b;SC.run(function(){if(d){e=d.get("pane")}else{e=this.get("menuPane")||this.get("keyPane")||this.get("mainPane")}b=(e)?e.sendEvent(c,a,d):null},this);return b},listenFor:function(d,c,b,a){b=b?b:this;d.forEach(function(e){var f=b[e];if(f){SC.Event.add(c,e,b,f,null,a)}},this);c=null;return b},setup:function(){this.listenFor(["touchstart","touchmove","touchend","touchcancel"],document);this.listenFor(["keydown","keyup","beforedeactivate","mousedown","mouseup","click","dblclick","mousemove","selectstart","contextmenu"],document).listenFor(["resize"],window);if(SC.browser.isIE8OrLower){this.listenFor(["focusin","focusout"],document)}else{this.listenFor(["focus","blur"],window)}this.listenFor(["webkitAnimationStart","webkitAnimationIteration","webkitAnimationEnd"],document);if(SC.platform.supportsCSSTransitions){this.listenFor(["transitionend",SC.platform.cssPrefix+"TransitionEnd"],document)}if(this.keypress){if(SC.CAPTURE_BACKSPACE_KEY&&SC.browser.isMozilla){var b=this;document.onkeypress=function(f){f=SC.Event.normalizeEvent(f);return b.keypress.call(b,f)}}else{SC.Event.add(document,"keypress",this,this.keypress)}}["drag","selectstart"].forEach(function(f){var g=this[f];if(g){if(SC.browser.isIE){var e=this;document.body["on"+f]=function(h){return g.call(e,SC.Event.normalizeEvent(event||window.event))};SC.Event.add(window,"unload",this,function(){document.body["on"+f]=null})}else{SC.Event.add(document,f,this,g)}}},this);var a="mousewheel";if(SC.browser.isMozilla){if(SC.browser.compare(SC.browser.engineVersion,"1.9.1")<0){a="DOMMouseScroll"}else{a="MozMousePixelScroll"}}SC.Event.add(document,a,this,this.mousewheel);this.set("currentWindowSize",this.computeWindowSize());if(SC.browser.os===SC.OS.ios&&SC.browser.name===SC.BROWSER.safari){if(SC.platform&&!SC.platform.touch){SC.platform.simulateTouchEvents()}var c=SC.RunLoop.prototype.endRunLoop,d;d=function(){if(c){c.apply(this,arguments)}var i=SC.RootResponder.responder._touches,h,e,j,f,l,m=NO;if(i){for(h in i){if(i[h]._rescuedElement){continue}j=e=i[h].target;while(e&&(e=e.parentNode)&&!m){m=(e===document.body)}if(!m&&j){if(j.parentNode&&j.cloneNode){var k=j.cloneNode(true);j.parentNode.replaceChild(k,j);j.swapNode=k}var g=SC.touchHoldingPen;if(!g){g=SC.touchHoldingPen=document.createElement("div");g.style.display="none";document.body.appendChild(g)}g.appendChild(j);i[h]._rescuedElement=j}}}};SC.RunLoop.prototype.endRunLoop=d}},_touchedViews:{},_touches:{},touchesForView:function(a){if(this._touchedViews[SC.guidFor(a)]){return this._touchedViews[SC.guidFor(a)].touches}},averagedTouchesForView:function(h,g){var m=this.touchesForView(h),b=h._scrr_averagedTouches||(h._scrr_averagedTouches={});if((!m||m.length===0)&&!g){b.x=0;b.y=0;b.d=0;b.touchCount=0}else{var e=this._averagedTouches_touches||(this._averagedTouches_touches=[]);e.length=0;if(m){var d,f=m.length;for(d=0;d<f;d++){e.push(m[d])}}if(g){e.push(g)}var j,c,a=0,o=0,n,l,k=0;f=e.length;for(j=0;j<f;j++){c=e[j];a+=c.pageX;o+=c.pageY}a/=f;o/=f;for(j=0;j<f;j++){c=e[j];n=Math.abs(c.pageX-a);l=Math.abs(c.pageY-o);k+=Math.pow(n*n+l*l,0.5)}k/=f;b.x=a;b.y=o;b.d=k;b.touchCount=f}return b},assignTouch:function(b,a){if(b.hasEnded){throw"Attempt to assign a touch that is already finished."}if(b.view===a){return}if(b.view){this.unassignTouch(b)}if(!this._touchedViews[SC.guidFor(a)]){this._touchedViews[SC.guidFor(a)]={view:a,touches:SC.CoreSet.create([]),touchCount:0};a.set("hasTouch",YES)}b.view=a;this._touchedViews[SC.guidFor(a)].touches.add(b);this._touchedViews[SC.guidFor(a)].touchCount++},unassignTouch:function(c){var a,b;if(!c.view){return}a=c.view;b=this._touchedViews[SC.guidFor(a)];b.touches.remove(c);b.touchCount--;if(b.touchCount<1){a.set("hasTouch",NO);b.view=null;delete this._touchedViews[SC.guidFor(a)]}c.view=undefined},_flushQueuedTouchResponder:function(){if(this._queuedTouchResponder){var a=this._queuedTouchResponder;this._queuedTouchResponder=null;this.makeTouchResponder.apply(this,a)}},makeTouchResponder:function(f,d,c,k){if(this._isMakingTouchResponder){this._queuedTouchResponder=[f,d,c,k];return}this._isMakingTouchResponder=YES;var h=f.touchResponders,b;if(f.touchResponder===d){this._isMakingTouchResponder=NO;this._flushQueuedTouchResponder();return}var a;if(d){a=d.get("pane")}else{a=this.get("keyPane")||this.get("mainPane")}if(h.indexOf(d)<0){if(k){try{d=(a)?a.sendEvent("touchStart",f,d):null}catch(g){SC.Logger.error("Error in touchStart: "+g);d=null}}else{if(d&&((d.get?d.get("acceptsMultitouch"):d.acceptsMultitouch)||!d.hasTouch)){if(!d.touchStart(f)){d=null}}else{}}}if(!c||(h.indexOf(d)>-1&&h[h.length-1]!==d)){this.unassignTouch(f);var i=h.length-1,j=h[i];while(j&&j!==d){b=this.touchesForView(j);if((j.get?j.get("acceptsMultitouch"):j.acceptsMultitouch)||!b){if(j.touchCancelled){j.touchCancelled(f)}}i--;j=h[i];h.pop();f.touchResponder=h[i];f.nextTouchResponder=h[i-1]}}if(d){this.assignTouch(f,d);if(d!==f.touchResponder){h.push(d);f.touchResponder=d;f.nextTouchResponder=h[h.length-2]}}this._isMakingTouchResponder=NO;this._flushQueuedTouchResponder()},captureTouch:function(h,e,g){if(!e){e=this}var f=h.targetView,c=f,d=[],b,a;if(SC.LOG_TOUCH_EVENTS){SC.Logger.info("  -- Received one touch on %@".fmt(f.toString()))}while(c&&(c!==e)){d.unshift(c);c=c.get("nextResponder")}for(a=d.length,b=0;b<a;b++){c=d[b];if(SC.LOG_TOUCH_EVENTS){SC.Logger.info("  -- Checking %@ for captureTouch response…".fmt(c.toString()))}if(c.tryToPerform("captureTouch",h)){if(SC.LOG_TOUCH_EVENTS){SC.Logger.info("   -- Making %@ touch responder because it returns YES to captureTouch".fmt(c.toString()))}this.makeTouchResponder(h,c,g,YES);return}}if(SC.LOG_TOUCH_EVENTS){SC.Logger.info("   -- Didn't find a view that returned YES to captureTouch, so we're calling touchStart")}this.makeTouchResponder(h,f,g,YES)},endMissingTouches:function(e){var b,a=e.length,d={},c=[];for(b=0;b<a;b++){d[e[b].identifier]=YES}for(b in this._touches){var f=this._touches[b].identifier;if(!d[f]){c.push(this._touches[b])}}for(b=0,a=c.length;b<a;b++){this.endTouch(c[b]);this.finishTouch(c[b])}},_touchCount:0,endTouch:function(b,g,c){if(!g){g="touchEnd"}var a,f,d,e;this.unassignTouch(b);if(b.touchResponder){e=b.touchResponder;f=b.touchResponders;a=f.length-1;d=f[a];while(d){if(d[g]){d[g](b,c)}if(b.touchResponder!==e){break}a--;d=f[a];g="touchCancelled"}}},finishTouch:function(b){var a;this.unassignTouch(b);if(a=b._rescuedElement){if(a.swapNode&&a.swapNode.parentNode){a.swapNode.parentNode.replaceChild(a,a.swapNode)}else{if(a.parentNode===SC.touchHoldingPen){SC.touchHoldingPen.removeChild(a)}}delete b._rescuedElement;a.swapNode=null;a=null}b.touchResponders=null;b.touchResponder=null;b.nextTouchResponder=null;b.hasEnded=YES;if(this._touches[b.identifier]){delete this._touches[b.identifier]}},touchstart:function(a){if(this.ignoreTouchHandle(a)){return YES}var b=NO;SC.run(function(){this.endMissingTouches(a.touches);var e,h=a.changedTouches,d=h.length,g,f,i,c;a.touchContext=this;for(e=0;e<d;e++){i=h[e];c=SC.Touch.create(i,this);if(!c.targetView){continue}if(c.hidesTouchIntercept){b=YES}c.timeStamp=a.timeStamp;this._touches[i.identifier]=c;c.event=a;this.captureTouch(c,this);c.event=null}},this);if(b){return YES}return a.hasCustomEventHandling},touchmove:function(a){if(this.ignoreTouchHandle(a)){return YES}SC.run(function(){var c=a.changedTouches,b,n,l,f=c.length,k,j,i,m,g={},e,h,d=NO;if(this._drag){b=SC.Touch.create(a.changedTouches[0],this);this._drag.tryToPerform("mouseDragged",b)}for(l=0;l<f;l++){b=c[l];n=this._touches[b.identifier];if(!n){continue}if(n.hidesTouchIntercept){d=YES}n.pageX=b.pageX;n.pageY=b.pageY;n.clientX=b.clientX;n.clientY=b.clientY;n.screenX=b.screenX;n.screenY=b.screenY;n.timeStamp=a.timeStamp;n.event=a;if(n.touchResponder){k=n.touchResponder;h=SC.guidFor(k);if(!g[h]){g[h]={view:k,touches:[]}}g[h].touches.push(n)}}if(d){a.allowDefault();return YES}for(l in g){k=g[l].view;j=g[l].touches;a.viewChangedTouches=j;i=this.touchesForView(k);m=i.firstObject();a.pageX=m.pageX;a.pageY=m.pageY;a.clientX=m.clientX;a.clientY=m.clientY;a.screenX=m.screenX;a.screenY=m.screenY;a.touchContext=this;k.tryToPerform("touchesDragged",a,i)}c=a.changedTouches;f=c.length;for(l=0;l<f;l++){b=c[l];n=this._touches[b.identifier];if(n){n.event=null}}},this);return a.hasCustomEventHandling},touchend:function(a){var b=NO;if(this.ignoreTouchHandle(a)){return YES}SC.run(function(){var h=a.changedTouches,g,n,l,i=h.length,j,c,f=a.isCancel?"touchCancelled":"touchEnd",k,m,d,e;for(l=0;l<i;l++){g=h[l];g.type="touchend";n=this._touches[g.identifier];if(!n){continue}n.timeStamp=a.timeStamp;n.pageX=g.pageX;n.pageY=g.pageY;n.clientX=g.clientX;n.clientY=g.clientY;n.screenX=g.screenX;n.screenY=g.screenY;n.type="touchend";n.event=a;if(SC.LOG_TOUCH_EVENTS){SC.Logger.info("-- Received touch end")}if(n.hidesTouchIntercept){n.unhideTouchIntercept();b=YES}if(this._drag){this._drag.tryToPerform("mouseUp",g);this._drag=null}this.endTouch(n,f,a);this.finishTouch(n)}},this);if(b){return YES}return a.hasCustomEventHandling},touchcancel:function(a){a.isCancel=YES;this.touchend(a)},ignoreTouchHandle:function(b){if(SC.browser.isMobileSafari){var a=b.target.tagName;if(a==="INPUT"||a==="TEXTAREA"||a==="A"||a==="SELECT"){b.allowDefault();return YES}}return NO},attemptKeyEquivalent:function(b){var d=null;var c=b.commandCodes()[0];if(!c){return NO}var f=this.get("menuPane"),a=this.get("keyPane"),e=this.get("mainPane");if(f){d=f.performKeyEquivalent(c,b);if(d){return d}}if(a){d=a.performKeyEquivalent(c,b);if(d||a.get("isModal")){return d}}if(!d&&e&&(e!==a)){d=e.performKeyEquivalent(c,b);if(d||e.get("isModal")){return d}}return d},_lastModifiers:null,_handleModifierChanges:function(b){var a;a=this._lastModifiers=(this._lastModifiers||{alt:false,ctrl:false,shift:false});var c=false;if(b.altKey!==a.alt){a.alt=b.altKey;c=true}if(b.ctrlKey!==a.ctrl){a.ctrl=b.ctrlKey;c=true}if(b.shiftKey!==a.shift){a.shift=b.shiftKey;c=true}b.modifiers=a;return(c)?(this.sendEvent("flagsChanged",b)?b.hasCustomEventHandling:YES):YES},_isFunctionOrNonPrintableKey:function(a){return !!(a.altKey||a.ctrlKey||a.metaKey||((a.charCode!==a.which)&&SC.FUNCTION_KEYS[a.which]))},_isModifierKey:function(a){return !!SC.MODIFIER_KEYS[a.charCode]},keydown:function(a){if(SC.none(a)){return YES}var e=a.keyCode;if(SC.browser.isMozilla&&a.keyCode===9){this.keydownCounter=1}if(e===229){this._IMEInputON=YES;return this.sendEvent("keyDown",a)}if(e===27&&this._drag){this._drag.cancelDrag();this._drag=null;this._mouseDownView=null;return YES}if(SC.browser.isMozilla&&(a.which===8)){return true}var b=this._handleModifierChanges(a),d=a.target||a.srcElement,c=(a.which===8)&&!SC.allowsBackspaceToPreviousPage&&(d===document.body);if(this._isModifierKey(a)){return(c?NO:b)}b=YES;if(this._isFunctionOrNonPrintableKey(a)){if(e>=37&&e<=40&&SC.browser.isMozilla){return YES}b=this.sendEvent("keyDown",a);if(!b){b=!this.attemptKeyEquivalent(a)}else{b=a.hasCustomEventHandling;if(b){c=NO}}}return c?NO:b},keypress:function(b){var c,e=b.keyCode,f=SC.browser.isMozilla;if(f&&b.keyCode===9){this.keydownCounter++;if(this.keydownCounter==2){return YES}}if(f&&(b.which===8)){b.which=e;c=this.sendEvent("keyDown",b);return c?(SC.allowsBackspaceToPreviousPage||b.hasCustomEventHandling):YES}else{var d=(e>=37&&e<=40&&f),a=b.charCode;if((a!==undefined&&a===0&&b.keyCode!==9)&&!d){return YES}if(d){b.which=e}if(d||!this._isFunctionOrNonPrintableKey(b)){return this.sendEvent("keyDown",b)?b.hasCustomEventHandling:YES}}},keyup:function(a){if(this._ffevt){this._ffevt=null}var b=this._handleModifierChanges(a);if(this._isModifierKey(a)){return b}if(this._IMEInputON&&a.keyCode===13){a.isIMEInput=YES;this.sendEvent("keyDown",a);this._IMEInputON=NO}return this.sendEvent("keyUp",a)?a.hasCustomEventHandling:YES},beforedeactivate:function(c){var b=c.toElement;if(b&&b.tagName&&b.tagName!=="IFRAME"){var a=SC.$(b).view()[0];if(a&&a.get("blocksIEDeactivate")){return NO}}return YES},mousedown:function(e){var d;if(SC.platform.touch){e.allowDefault();this._lastMouseDownCustomHandling=YES;return YES}this._clickCount+=1;if(!this._lastMouseUpAt||((Date.now()-this._lastMouseUpAt)>250)){this._clickCount=1}else{var c=this._lastMouseDownX-e.clientX,a=this._lastMouseDownY-e.clientY,g=Math.sqrt(c*c+a*a);if(g>8){this._clickCount=1}}e.clickCount=this._clickCount;this._lastMouseDownX=e.clientX;this._lastMouseDownY=e.clientY;var b=this.targetViewForEvent(e);if(b){d=b.getPath("pane.firstResponder")}if(d&&d.get("blurOnMouseDown")&&d!==b){d.resignFirstResponder(e)}b=this._mouseDownView=this.sendEvent("mouseDown",e,b);if(b&&b.respondsTo("mouseDragged")){this._mouseCanDrag=YES}var f=b?e.hasCustomEventHandling:YES;this._lastMouseDownCustomHandling=f;return f},mouseup:function(b){var f=NO;if(SC.platform.touch){b.allowDefault();this._lastMouseUpCustomHandling=YES;return YES}if(this._drag){this._drag.tryToPerform("mouseUp",b);this._drag=null}var e=null,a=this._mouseDownView,d=this.targetViewForEvent(b);b.clickCount=this._clickCount;if(a){e=this.sendEvent("mouseUp",b,a);if(!e&&(this._clickCount===2)){e=this.sendEvent("doubleClick",b,a);f=YES}if(!e){e=this.sendEvent("click",b,a);f=YES}}if(!e&&!f){if(this._clickCount===2){e=this.sendEvent("doubleClick",b,d)}if(!e){e=this.sendEvent("click",b,d)}}this._mouseCanDrag=NO;this._mouseDownView=null;this._lastMouseUpAt=Date.now();var c=e?b.hasCustomEventHandling:YES;this._lastMouseUpCustomHandling=c;return c},click:function(a){if(!this._lastMouseUpCustomHandling||!this._lastMouseDownCustomHandling){a.preventDefault();a.stopPropagation();return NO}return YES},dblclick:function(a){if(SC.browser.isIE8OrLower){this._clickCount=2;this.mouseup(a)}},mousewheel:function(b){var a=this.targetViewForEvent(b),c=this.sendEvent("mouseWheel",b,a);return(c)?b.hasCustomEventHandling:YES},_lastHovered:null,mousemove:function(a){if(SC.platform.touch){a.allowDefault();return YES}if(SC.browser.isIE){if(this._lastMoveX===a.clientX&&this._lastMoveY===a.clientY){return}}this._lastMoveX=a.clientX;this._lastMoveY=a.clientY;SC.run(function(){if(this._drag){if(SC.browser.isIE){if(this._lastMouseDownX!==a.clientX||this._lastMouseDownY!==a.clientY){this._drag.tryToPerform("mouseDragged",a)}}else{this._drag.tryToPerform("mouseDragged",a)}}else{var d=this._lastHovered||[],e=[],g,f,b,c=this.targetViewForEvent(a);while(c&&(c!==this)){e.push(c);c=c.get("nextResponder")}for(f=0,b=d.length;f<b;f++){c=d[f];g=c.respondsTo("mouseExited");if(g&&e.indexOf(c)===-1){c.tryToPerform("mouseExited",a)}}for(f=0,b=e.length;f<b;f++){c=e[f];if(d.indexOf(c)!==-1){c.tryToPerform("mouseMoved",a)}else{c.tryToPerform("mouseEntered",a)}}this._lastHovered=e;if(this._mouseDownView){if(SC.browser.isIE){if(this._lastMouseDownX!==a.clientX&&this._lastMouseDownY!==a.clientY){this._mouseDownView.tryToPerform("mouseDragged",a)}}else{this._mouseDownView.tryToPerform("mouseDragged",a)}}}},this)},_mouseCanDrag:YES,selectstart:function(b){var c=this.targetViewForEvent(b),a=this.sendEvent("selectStart",b,c);if(c&&c.respondsTo("mouseDragged")){return(a!==null?YES:NO)&&!this._mouseCanDrag}else{return(a!==null?YES:NO)}},drag:function(){return false},contextmenu:function(b){var a=this.targetViewForEvent(b);a=this.sendEvent("contextMenu",b,a);ret=a?b.hasCustomEventHandling:YES;return ret},webkitAnimationStart:function(b){try{var a=this.targetViewForEvent(b);this.sendEvent("animationDidStart",b,a)}catch(c){SC.Logger.warn("Exception during animationDidStart: %@".fmt(c));throw c}return a?b.hasCustomEventHandling:YES},webkitAnimationIteration:function(b){try{var a=this.targetViewForEvent(b);this.sendEvent("animationDidIterate",b,a)}catch(c){SC.Logger.warn("Exception during animationDidIterate: %@".fmt(c));throw c}return a?b.hasCustomEventHandling:YES},webkitAnimationEnd:function(b){try{var a=this.targetViewForEvent(b);this.sendEvent("animationDidEnd",b,a)}catch(c){SC.Logger.warn("Exception during animationDidEnd: %@".fmt(c));throw c}return a?b.hasCustomEventHandling:YES},transitionEnd:function(b){try{var a=this.targetViewForEvent(b);this.sendEvent("transitionDidEnd",b,a)}catch(c){SC.Logger.warn("Exception during transitionDidEnd: %@".fmt(c));throw c}return a?b.hasCustomEventHandling:YES}});SC.Touch=function(d,a){this.touchContext=a;this.identifier=d.identifier;var c=d.target,b;if(c&&SC.$(c).hasClass("touch-intercept")){d.target.style.webkitTransform="translate3d(0px,-5000px,0px)";c=document.elementFromPoint(d.pageX,d.pageY);if(c){b=SC.$(c).view()[0]}this.hidesTouchIntercept=NO;if(c.tagName==="INPUT"){this.hidesTouchIntercept=d.target}else{d.target.style.webkitTransform="translate3d(0px,0px,0px)"}}else{b=d.target?SC.$(d.target).view()[0]:null}this.targetView=b;this.target=c;this.hasEnded=NO;this.type=d.type;this.clickCount=1;this.view=undefined;this.touchResponder=this.nextTouchResponder=undefined;this.touchResponders=[];this.startX=this.pageX=d.pageX;this.startY=this.pageY=d.pageY;this.clientX=d.clientX;this.clientY=d.clientY;this.screenX=d.screenX;this.screenY=d.screenY};SC.Touch.prototype={unhideTouchIntercept:function(){var a=this.hidesTouchIntercept;if(a){setTimeout(function(){a.style.webkitTransform="translate3d(0px,0px,0px)"},500)}},allowDefault:function(){if(this.event){this.event.hasCustomEventHandling=YES}},preventDefault:function(){if(this.event){this.event.preventDefault()}},stopPropagation:function(){if(this.event){this.event.stopPropagation()}},stop:function(){if(this.event){this.event.stop()}},end:function(){this.touchContext.endTouch(this)},makeTouchResponder:function(b,c,a){this.touchContext.makeTouchResponder(this,b,c,a)},captureTouch:function(a,b){this.touchContext.captureTouch(this,a,b)},touchesForView:function(a){return this.touchContext.touchesForView(a)},touchesForResponder:function(a){return this.touchContext.touchesForView(a)},averagedTouchesForView:function(a,b){return this.touchContext.averagedTouchesForView(a,(b?this:null))}};SC.mixin(SC.Touch,{create:function(b,a){return new SC.Touch(b,a)}});SC.ready(SC.RootResponder,SC.RootResponder.ready=function(){var a;a=SC.RootResponder.responder=SC.RootResponder.create();a.setup()});sc_require("system/core_query");sc_require("system/ready");sc_require("system/root_responder");sc_require("system/platform");SC.PORTRAIT_ORIENTATION="portrait";SC.LANDSCAPE_ORIENTATION="landscape";SC.NO_ORIENTATION="desktop";SC.device=SC.Object.create({orientation:SC.NO_ORIENTATION,isOffline:NO,mouseLocation:function(){var a=SC.RootResponder.responder,c=a._lastMoveX,b=a._lastMoveY;if(SC.empty(c)||SC.empty(b)){return null}return{x:c,y:b}}.property(),init:function(){arguments.callee.base.apply(this,arguments);if(navigator&&navigator.onLine===false){this.set("isOffline",YES)}},setup:function(){var a=SC.RootResponder.responder;a.listenFor(["online","offline"],window,this);this.orientationHandlingShouldChange()},orientationHandlingShouldChange:function(){if(SC.platform.windowSizeDeterminesOrientation){SC.Event.remove(window,"orientationchange",this,this.orientationchange);this.windowSizeDidChange(SC.RootResponder.responder.get("currentWindowSize"))}else{if(SC.platform.supportsOrientationChange){SC.Event.add(window,"orientationchange",this,this.orientationchange);this.orientationchange()}}},windowSizeDidChange:function(a){if(SC.platform.windowSizeDeterminesOrientation){if(!SC.browser.iOS){SC.run(function(){if(SC.platform.touch){if(a.height>=a.width){SC.device.set("orientation",SC.PORTRAIT_ORIENTATION)}else{SC.device.set("orientation",SC.LANDSCAPE_ORIENTATION)}}else{SC.device.set("orientation",SC.NO_ORIENTATION)}})}else{SC.run(function(){if(a.width===window.screen.width){SC.device.set("orientation",SC.PORTRAIT_ORIENTATION)}else{SC.device.set("orientation",SC.LANDSCAPE_ORIENTATION)}})}return YES}return NO},orientationchange:function(a){SC.run(function(){if(window.orientation===0||window.orientation===180){SC.device.set("orientation",SC.PORTRAIT_ORIENTATION)}else{SC.device.set("orientation",SC.LANDSCAPE_ORIENTATION)}})},orientationObserver:function(){var a=SC.$(document.body),b=this.get("orientation");if(b===SC.PORTRAIT_ORIENTATION){a.addClass("portrait")}else{a.removeClass("portrait")}if(b===SC.LANDSCAPE_ORIENTATION){a.addClass("landscape")}else{a.removeClass("landscape")}}.observes("orientation"),online:function(a){this.set("isOffline",NO)},offline:function(a){this.set("isOffline",YES)}});SC.ready(function(){SC.device.setup()});SC.MODIFIED_KEY_BINDINGS={"ctrl_.":"cancel",shift_tab:"insertBacktab",shift_left:"moveLeftAndModifySelection",shift_right:"moveRightAndModifySelection",shift_up:"moveUpAndModifySelection",shift_down:"moveDownAndModifySelection",alt_left:"moveLeftAndModifySelection",alt_right:"moveRightAndModifySelection",alt_up:"moveUpAndModifySelection",alt_down:"moveDownAndModifySelection",ctrl_a:"selectAll"};SC.BASE_KEY_BINDINGS={escape:"cancel",backspace:"deleteBackward","delete":"deleteForward","return":"insertNewline",tab:"insertTab",left:"moveLeft",right:"moveRight",up:"moveUp",down:"moveDown",home:"moveToBeginningOfDocument",end:"moveToEndOfDocument",pagedown:"pageDown",pageup:"pageUp"};SC.Page=SC.Object.extend({owner:null,get:function(a){var b=this[a];if(b&&b.isClass){this[a]=b=b.create({page:this});if(!this.get("inDesignMode")){b.awake()}return b}else{return arguments.callee.base.apply(this,arguments)}},awake:function(){var b,a;for(a in this){if(!this.hasOwnProperty(a)){continue}b=this[a];if(b&&b.isViewClass){this[a]=b=b.create({page:this})}}return this},getIfConfigured:function(b){var a=this[b];return(a&&a.isViewClass)?null:this.get(b)},loc:function(c){var a,b;for(b in c){if(!c.hasOwnProperty(b)){continue}a=this[b];if(!a||!a.isViewClass){continue}a.loc(c[b])}return this}});SC.Page.design=SC.Page.create;SC.Page.localization=function(a){return a};sc_require("system/builder");SC.MODE_REPLACE="replace";SC.MODE_APPEND="append";SC.MODE_PREPEND="prepend";SC.NON_PIXEL_PROPERTIES=["zIndex","fontWeight","opacity"];SC.COMBO_STYLES={WebkitTransition:["WebkitTransitionProperty","WebkitTransitionDuration","WebkitTransitionDelay","WebkitTransitionTimingFunction"]};SC.RenderContext=SC.Builder.create({SELF_CLOSING:SC.CoreSet.create().addEach(["area","base","basefront","br","hr","input","img","link","meta"]),init:function(e,d){var b,a;if(d){this.prevObject=d;this.strings=d.strings;this.offset=d.length+d.offset}if(!this.strings){this.strings=[]}if(e===undefined){e="div";a=YES}else{if(e==="div"||e==="label"||e==="a"){a=YES}else{if(SC.typeOf(e)===SC.T_STRING){e=e.toLowerCase();a=YES}}}if(a){this._tagName=e;this._needsTag=YES;this.needsContent=YES;var f=this;while(f){f.length++;f=f.prevObject}this.strings.push(null);this._selfClosing=this.SELF_CLOSING.contains(e)}else{this._elem=e;this._needsTag=NO;this.length=0;this.needsContent=NO}return this},strings:null,offset:0,length:0,updateMode:SC.MODE_REPLACE,needsContent:NO,get:function(b){var a=this.strings||[];return(b===undefined)?a.slice(this.offset,this.length):a[b+this.offset]},push:function(d){var b=this.strings,a=arguments.length;if(!b){this.strings=b=[]}if(a>1){b.push.apply(b,arguments)}else{b.push(d)}var e=this;while(e){e.length+=a;e=e.prevObject}this.needsContent=YES;return this},text:function(c){var b=arguments.length,a=0;for(a=0;a<b;a++){this.push(SC.RenderContext.escapeHTML(arguments[a]))}return this},join:function(b){if(this._needsTag){this.end()}var a=this.strings;return a?a.join(b||""):""},begin:function(a){return SC.RenderContext(a,this)},element:function(){return this._elem?this._elem:SC.$(this.join())[0]},remove:function(a){if(!a){return}var b,c=this._elem;if(!c||!c.removeChild){return}b=document.getElementById(a);if(b){b=c.removeChild(b);b=null}},update:function(){var c=this._elem,g=this.updateMode,e,d,a,f,b;this._innerHTMLReplaced=NO;if(!c){return}e=this.$();if(this.length>0){this._innerHTMLReplaced=YES;if(g===SC.MODE_REPLACE){e.html(this.join())}else{a=c.cloneNode(false);a.innerHTML=this.join();f=a.firstChild;while(f){b=f.nextSibling;c.insertBefore(f,b);f=b}f=b=a=null}}if(this._idDidChange&&(d=this._id)){e.attr("id",d)}jQuery.Buffer.flush();c=this._elem=null;return this.prevObject||this},_DEFAULT_ATTRS:{},end:function(){var n="",b="",d,l,j,h,k=this._attrs,e=this._classNames,a=this._id,m=this._styles,i,g;n="<"+this._tagName;if(k||e||m||a){if(!k){k=this._DEFAULT_ATTRS}if(a){k.id=a}if(e){k["class"]=e.join(" ")}if(m){for(j in m){if(!m.hasOwnProperty(j)){continue}h=m[j];if(h===null){continue}if(typeof h===SC.T_NUMBER&&!SC.NON_PIXEL_PROPERTIES.contains(j)){h+="px"}b=b+this._dasherizeStyleName(j)+": "+h+"; "}k.style=b}n=n+" ";for(j in k){if(!k.hasOwnProperty(j)){continue}h=k[j];if(h===null){continue}n=n+j+'="'+h+'" '}if(k===this._DEFAULT_ATTRS){delete k.style;delete k["class"];delete k.id}}i=this.strings;g=(this._selfClosing===NO)?NO:(this.length===1);n=n+(g?" />":">");i[this.offset]=n;if(!g){i.push("</"+this._tagName+">");var f=this;while(f){f.length++;f=f.prevObject}}this._elem=null;return this.prevObject||this},tag:function(a,b){return this.begin(a,b).end()},tagName:function(a){if(a===undefined){if(!this._tagName&&this._elem){this._tagName=this._elem.tagName}return this._tagName}else{this._tagName=a;this._tagNameDidChange=YES;return this}},id:function(a){if(a===undefined){if(!this._id&&this._elem){this._id=this._elem.id}return this._id}else{this._id=a;this._idDidChange=YES;return this}},classNames:function(b,a){if(this._elem){if(b){this.$().resetClassNames().addClass(b);return this}else{return this.$().attr("class").split(" ")}}if(b===undefined){if(this._cloneClassNames){this._classNames=(this._classNames||[]).slice();this._cloneClassNames=NO}if(!this._classNames){this._classNames=[]}return this._classNames}else{this._classNames=b;this._cloneClassNames=a||NO;this._classNamesDidChange=YES;return this}},hasClass:function(a){if(this._elem){return this.$().hasClass(a)}return this.classNames().indexOf(a)>=0},addClass:function(f){if(f===undefined||f===null){SC.Logger.warn("You are adding an undefined or empty class"+this.toString());return this}if(this._elem){if(SC.typeOf(f)===SC.T_STRING){this.$().addClass(f)}else{var c,b=f.length;for(c=0;c<b;c++){this.$().addClass(f[c])}}return this}var g=this.classNames();if(SC.typeOf(f)===SC.T_STRING){if(g.indexOf(f)<0){g.push(f);this._classNamesDidChange=YES}}else{var d;for(var e=0,a=f.length;e<a;e++){d=f[e];if(g.indexOf(d)<0){g.push(d);this._classNamesDidChange=YES}}}return this},removeClass:function(b){if(this._elem){this.$().removeClass(b);return this}var c=this._classNames,a;if(c&&(a=c.indexOf(b))>=0){if(this._cloneClassNames){c=this._classNames=c.slice();this._cloneClassNames=NO}c[a]=null;this._classNamesDidChange=YES}return this},resetClassNames:function(){if(this._elem){this.$().resetClassNames();return this}this._classNames=[];this._classNamesDidChange=YES;return this},setClass:function(d,c){if(this._elem){this.$().setClass(d,c);return this}var f,a,b,e;if(c!==undefined){return c?this.addClass(d):this.removeClass(d)}else{f=this._classNames;if(!f){f=this._classNames=[]}if(this._cloneClassNames){f=this._classNames=f.slice();this._cloneClassNames=NO}e=NO;for(b in d){if(!d.hasOwnProperty(b)){continue}a=f.indexOf(b);if(d[b]){if(a<0){f.push(b);e=YES}}else{if(a>=0){f[a]=null;e=YES}}}if(e){this._classNamesDidChange=YES}}return this},_STYLE_REGEX:/-?\s*([^:\s]+)\s*:\s*([^;]+)\s*;?/g,styles:function(d,e){if(this._elem){if(d){this.$().resetStyles().css(d)}return this.$().styles()}var a,c,b;if(d===undefined){if(!this._styles&&this._elem){a=this.$().attr("style");if(a&&(a=a.toString()).length>0){if(SC.browser.name===SC.BROWSER.ie){a=a.toLowerCase()}d={};c=this._STYLE_REGEX;c.lastIndex=0;while(b=c.exec(a)){d[this._camelizeStyleName(b[1])]=b[2]}this._styles=d;this._cloneStyles=NO}else{this._styles={}}}else{if(!this._styles){this._styles={}}else{if(this._cloneStyles){this._styles=SC.clone(this._styles);this._cloneStyles=NO}}}return this._styles}else{this._styles=d;this._cloneStyles=e||NO;this._stylesDidChange=YES;return this}},_deleteComboStyles:function(e,d){var g=SC.COMBO_STYLES[d],f=NO,c;if(g){for(var a=0,b=g.length;a<b;a++){c=g[a];if(e[c]){delete e[c];f=YES}}}return f},resetStyles:function(){this.styles({});return this},addStyle:function(a,e){if(this._elem){this.$().css(a,e);return this}var b,d=NO,c=this.styles();if(typeof a===SC.T_STRING){if(e===undefined){return c[a]}else{d=this._deleteComboStyles(c,a);if(c[a]!==e){c[a]=e;d=YES}if(d){this._stylesDidChange=YES}}}else{for(b in a){if(!a.hasOwnProperty(b)){continue}d=d||this._deleteComboStyles(c,b);e=a[b];if(c[b]!==e){c[b]=e;d=YES}}if(d){this._stylesDidChange=YES}}return this},removeStyle:function(a){if(this._elem){this.$().css(a,null);return this}if(!this._styles){return this}var b=this.styles();if(b[a]){b[a]=null;this._stylesDidChange=YES}},attr:function(a,e){if(this._elem){this.$().attr(a,e);return this}var c,b=this._attrs,d=NO;if(!b){this._attrs=b={}}if(typeof a===SC.T_STRING){if(e===undefined){return b[a]}else{if(b[a]!==e){b[a]=e;this._attrsDidChange=YES}}}else{for(c in a){if(!a.hasOwnProperty(c)){continue}e=a[c];if(b[c]!==e){b[c]=e;d=YES}}if(d){this._attrsDidChange=YES}}return this},removeAttr:function(a){if(this._elem){this.$().removeAttr(a);return this}},$:function(c){var a,b=this._elem;a=!b?SC.$.buffer([]):(c===undefined)?SC.$.buffer(b):SC.$.buffer(c,b);b=null;return a},_camelizeStyleName:function(a){var b=a.match(/^-(webkit|moz|o)-/),c=SC.String.camelize(a);if(b){return c.substr(0,1).toUpperCase()+c.substr(1)}else{return c}},_dasherizeStyleName:function(a){var b=SC.String.dasherize(a);if(b.match(/^(webkit|moz|ms|o)-/)){b="-"+b}return b}});SC.RenderContext.fn.html=SC.RenderContext.fn.push;SC.RenderContext.fn.css=SC.RenderContext.fn.addStyle;(function(){var b=/[&<>]/g,a=function(c){switch(c){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;"}};SC.RenderContext.escapeHTML=function(c){if(!c){return""}if(SC.typeOf(c)===SC.T_NUMBER){c=c.toString()}return c.replace(b,a)}})();(function(){var b=0;var c=["ms","moz","webkit","o"];for(var a=0;a<c.length&&!window.requestAnimationFrame;++a){window.requestAnimationFrame=window[c[a]+"RequestAnimationFrame"];window.cancelRequestAnimationFrame=window[c[a]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame){window.requestAnimationFrame=function(h,e){var d=new Date().getTime();var f=Math.max(0,16-(d-b));var g=window.setTimeout(function(){h(d+f)},f);b=d+f;return g}}if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(d){clearTimeout(d)}}}());SC.SelectionSet=SC.Object.extend(SC.Enumerable,SC.Freezable,SC.Copyable,{isSelectionSet:YES,length:function(){var a=0,b=this._sets,c=this._objects;if(c){a+=c.get("length")}if(b){b.forEach(function(d){a+=d.get("length")})}return a}.property().cacheable(),sources:function(){var c=[],d=this._sets,b=d?d.length:0,a,f,e;for(a=0;a<b;a++){f=d[a];if(f&&f.get("length")>0&&f.source){c.push(f.source)}}return c}.property().cacheable(),indexSetForSource:function(e){if(!e||!e.isSCArray){return null}var b=this._indexSetCache,d=this._objects,c,a;if(!b){b=this._indexSetCache={}}c=b[SC.guidFor(e)];if(c&&c._sourceRevision&&(c._sourceRevision!==e.propertyRevision)){c=null}if(!c){c=this._indexSetForSource(e,NO);if(c&&c.get("length")===0){c=null}if(d){if(c){c=c.copy()}d.forEach(function(f){if((a=e.indexOf(f))>=0){if(!c){c=SC.IndexSet.create()}c.add(a)}},this)}if(c){c=b[SC.guidFor(e)]=c.frozenCopy();c._sourceRevision=e.propertyRevision}}return c},_indexSetForSource:function(f,g){if(g===undefined){g=YES}var d=SC.guidFor(f),c=this[d],e=this._sets,a=e?e.length:0,b=null;if(c>=a){c=null}if(SC.none(c)){if(g&&!this.isFrozen){this.propertyWillChange("sources");if(!e){e=this._sets=[]}b=e[a]=SC.IndexSet.create();b.source=f;this[d]=a;this.propertyDidChange("sources")}}else{b=e?e[c]:null}return b},add:function(a,b,d){if(this.isFrozen){throw SC.FROZEN_ERROR}var g,f,j,i,c,e,h,k;if(b===undefined&&d===undefined){if(!a){throw"Must pass params to SC.SelectionSet.add()"}if(a.isIndexSet){return this.add(a.source,a)}if(a.isSelectionSet){g=a._sets;k=a._objects;f=g?g.length:0;this.beginPropertyChanges();for(j=0;j<f;j++){i=g[j];if(i&&i.get("length")>0){this.add(i.source,i)}}if(k){this.addObjects(k)}this.endPropertyChanges();return this}}i=this._indexSetForSource(a,YES);c=this.get("length");h=i.get("length");e=c-h;i.add(b,d);this._indexSetCache=null;e+=i.get("length");if(e!==c){this.propertyDidChange("length");this.enumerableContentDidChange();if(h===0){this.notifyPropertyChange("sources")}}return this},remove:function(a,b,d){if(this.isFrozen){throw SC.FROZEN_ERROR}var g,f,j,i,c,e,h,k;if(b===undefined&&d===undefined){if(!a){throw"Must pass params to SC.SelectionSet.remove()"}if(a.isIndexSet){return this.remove(a.source,a)}if(a.isSelectionSet){g=a._sets;k=a._objects;f=g?g.length:0;this.beginPropertyChanges();for(j=0;j<f;j++){i=g[j];if(i&&i.get("length")>0){this.remove(i.source,i)}}if(k){this.removeObjects(k)}this.endPropertyChanges();return this}}i=this._indexSetForSource(a,YES);c=this.get("length");e=c-i.get("length");if(i&&(k=this._objects)){if(d!==undefined){b=SC.IndexSet.create(b,d);d=undefined}k.forEach(function(l){j=a.indexOf(l);if(b.contains(j)){k.remove(l);e--}},this)}i.remove(b,d);h=i.get("length");e+=h;this._indexSetCache=null;if(e!==c){this.propertyDidChange("length");this.enumerableContentDidChange();if(h===0){this.notifyPropertyChange("sources")}}return this},contains:function(b,d,a){if(d===undefined&&a===undefined){return this.containsObject(b)}var c=this.indexSetForSource(b);if(!c){return NO}return c.contains(d,a)},intersects:function(b,d,a){var c=this.indexSetForSource(b,NO);if(!c){return NO}return c.intersects(d,a)},_TMP_ARY:[],addObject:function(b){var c=this._TMP_ARY,a;c[0]=b;a=this.addObjects(c);c.length=0;return a},addObjects:function(a){var d=this._objects,b,c;if(!d){d=this._objects=SC.CoreSet.create()}b=d.get("length");d.addEach(a);c=d.get("length");this._indexSetCache=null;if(c!==b){this.propertyDidChange("length");this.enumerableContentDidChange()}return this},removeObject:function(b){var c=this._TMP_ARY,a;c[0]=b;a=this.removeObjects(c);c.length=0;return a},removeObjects:function(b){var e=this._objects,c,d,a;if(!e){return this}c=e.get("length");e.removeEach(b);d=e.get("length");if(a=this._sets){a.forEach(function(f){c+=f.get("length");f.removeObjects(b);d+=f.get("length")},this)}this._indexSetCache=null;if(d!==c){this.propertyDidChange("length");this.enumerableContentDidChange()}return this},containsObject:function(c){var e=this._objects;if(e&&e.contains(c)){return YES}var d=this._sets,b=d?d.length:0,a,f;for(a=0;a<b;a++){f=d[a];if(f&&f.indexOf(c)>=0){return YES}}return NO},constrain:function(e){var g,b,a,d;this.beginPropertyChanges();this.get("sources").forEach(function(h){if(h===e){return}var i=this._indexSetForSource(e,NO);if(i){this.remove(e,i)}},this);g=this._indexSetForSource(e,NO);if(g&&((a=g.get("max"))>(b=e.get("length")))){this.remove(e,b,a-b)}if(d=this._objects){var c,f;for(c=d.length-1;c>=0;c--){f=d[c];if(e.indexOf(f)<0){this.removeObject(f)}}}this.endPropertyChanges();return this},isEqual:function(g){var f,d,b,a,c,e;if(!g||!g.isSelectionSet){return NO}if(g===this){return YES}if((this._sets===g._sets)&&(this._objects===g._objects)){return YES}if(this.get("length")!==g.get("length")){return NO}f=this._objects;d=g._objects;if(f||d){if((f?f.get("length"):0)!==(d?d.get("length"):0)){return NO}if(f&&!f.isEqual(d)){return NO}}c=this.get("sources");a=c.get("length");for(b=0;b<a;b++){e=c.objectAt(b);f=this._indexSetForSource(e,NO);d=this._indexSetForSource(e,NO);if(!!d!==!!f){return NO}if(f&&!f.isEqual(d)){return NO}}return YES},clear:function(){if(this.isFrozen){throw SC.FROZEN_ERROR}if(this._sets){this._sets.length=0}if(this._objects){this._objects=null}this._indexSetCache=null;this.propertyDidChange("length");this.enumerableContentDidChange();this.notifyPropertyChange("sources");return this},copy:function(){var c=this.constructor.create(),d=this._sets,b=d?d.length:0,a,e;if(d&&b>0){d=c._sets=d.slice();for(a=0;a<b;a++){if(!(e=d[a])){continue}e=d[a]=e.copy();c[SC.guidFor(e.source)]=a}}if(this._objects){c._objects=this._objects.copy()}return c},freeze:function(){if(this.get("isFrozen")){return this}var a=this._sets,b=a?a.length:0,c;while(--b>=0){c=a[b];if(c){c.freeze()}}if(this._objects){this._objects.freeze()}this.set("isFrozen",YES);return this},toString:function(){var a=this._sets||[];a=a.map(function(b){return b.toString().replace("SC.IndexSet",SC.guidFor(b.source))},this);if(this._objects){a.push(this._objects.toString())}return"SC.SelectionSet:%@<%@>".fmt(SC.guidFor(this),a.join(","))},firstObject:function(){var b=this._sets,c=this._objects;if(b&&b.get("length")>0){var e=b?b[0]:null,d=e?e.source:null,a=e?e.firstObject():-1;if(d&&a>=0){return d.objectAt(a)}}return c?c.firstObject():undefined}.property(),nextObject:function(c,e,b){var d,a;if(c===0){d=b.objects=[];this.forEach(function(f){d.push(f)},this);b.max=d.length}d=b.objects;a=d[c];if(c+1>=b.max){b.objects=b.max=null}return a},forEach:function(g,e){var c=this._sets,d=this._objects,b=c?c.length:0,f,a;for(a=0;a<b;a++){f=c[a];if(f){f.forEachObject(g,e)}}if(d){d.forEach(g,e)}return this}});SC.SelectionSet.prototype.clone=SC.SelectionSet.prototype.copy;SC.SelectionSet.EMPTY=SC.SelectionSet.create().freeze();sc_require("mixins/delegate_support");SC.SparseArray=SC.Object.extend(SC.Observable,SC.Enumerable,SC.Array,SC.DelegateSupport,{_requestingLength:0,_requestingIndex:0,length:function(){var a=this.delegate;if(a&&SC.none(this._length)&&a.sparseArrayDidRequestLength){this._requestingLength++;a.sparseArrayDidRequestLength(this);this._requestingLength--}return this._length||0}.property().cacheable(),provideLength:function(b){var a;if(SC.none(b)){this._sa_content=null}if(b!==this._length){a=this._length;this._length=b;if(this._requestingLength<=0){this.arrayContentDidChange(0,a||0,b||0)}}return this},rangeWindowSize:1,requestedRangeIndex:null,init:function(){arguments.callee.base.apply(this,arguments);this.requestedRangeIndex=[];this._TMP_PROVIDE_ARRAY=[];this._TMP_PROVIDE_RANGE={length:1};this._TMP_RANGE={}},objectAt:function(a,d){var c=this._sa_content,b;if(!c){c=this._sa_content=[]}if((b=c[a])===undefined){if(!d){this.requestIndex(a)}b=c[a]}return b},definedIndexes:function(d){var c=SC.IndexSet.create(),e=this._sa_content,b,a;if(!e){return c.freeze()}if(d){d.forEach(function(f){if(e[f]!==undefined){c.add(f)}})}else{a=e.length;for(b=0;b<a;b++){if(e[b]!==undefined){c.add(b)}}}return c.freeze()},_TMP_RANGE:{},requestIndex:function(b){var c=this.delegate;if(!c){return this}var a=this.get("rangeWindowSize"),e=b;if(a>1){e=e-Math.floor(e%a)}if(a<1){a=1}this._requestingIndex++;if(c.sparseArrayDidRequestRange){var d=this._TMP_RANGE;if(this.wasRangeRequested(e)===-1){d.start=e;d.length=a;this.requestedRangeIndex.push(e);c.sparseArrayDidRequestRange(this,d)}}else{if(c.sparseArrayDidRequestIndex){while(--a>=0){c.sparseArrayDidRequestIndex(this,e+a)}}}this._requestingIndex--;return this},wasRangeRequested:function(c){var b,a;for(b=0,a=this.requestedRangeIndex.length;b<a;b++){if(this.requestedRangeIndex[b]===c){return b}}return -1},rangeRequestCompleted:function(b){var a=this.wasRangeRequested(b);if(a>=0){this.requestedRangeIndex.removeAt(a,1);return YES}return NO},provideObjectsInRange:function(b,e){var c=this._sa_content;if(!c){c=this._sa_content=[]}var d=b.start,a=b.length;while(--a>=0){c[d+a]=e.objectAt(a)}if(this._requestingIndex<=0){this.arrayContentDidChange(b.start,b.length,b.length)}return this},provideObjectAtIndex:function(c,b){var d=this._TMP_PROVIDE_ARRAY,a=this._TMP_PROVIDE_RANGE;d[0]=b;a.start=c;return this.provideObjectsInRange(a,d)},objectsDidChangeInRange:function(a){var b=this._sa_content;if(b){if(a.start===0&&SC.maxRange(a)>=b.length){this._sa_content=null}else{var d=a.start,c=Math.min(d+a.length,b.length);while(--c>=d){b[c]=undefined}}}this.arrayContentDidChange(a.start,a.length,a.length);return this},indexOf:function(d){var e,b,a=this.delegate;if(a&&a.sparseArrayDidRequestIndexOf){b=a.sparseArrayDidRequestIndexOf(this,d)}if(SC.none(b)){e=this._sa_content;if(!e){e=this._sa_content=[]}b=e.indexOf(d)}return b},replace:function(b,g,e){e=e||[];var c=this.delegate;if(c){if(!c.sparseArrayShouldReplace||!c.sparseArrayShouldReplace(this,b,g,e)){return this}}var d=this._sa_content;if(!d){d=this._sa_content=[]}d.replace(b,g,e);var a=e?(e.get?e.get("length"):e.length):0;var f=a-g;this.arrayContentWillChange(b,g,a);if(!SC.none(this._length)){this.propertyWillChange("length");this._length+=f;this.propertyDidChange("length")}this.beginPropertyChanges();this.arrayContentDidChange(b,g,a);this.enumerableContentDidChange(b,g,f);this.endPropertyChanges();return this},reset:function(){var a;this._sa_content=null;a=this._length;this._length=null;this.arrayContentDidChange(0,a,0);this.invokeDelegateMethod(this.delegate,"sparseArrayDidReset",this);return this}});SC.SparseArray.array=function(a){return this.create({_length:a||0})};SC.Timer=SC.Object.extend({target:null,action:null,isPooled:NO,interval:0,startTime:null,repeats:NO,until:null,isPaused:NO,isScheduled:NO,isValid:YES,lastFireTime:0,fireTime:function(){if(!this.get("isValid")){return -1}var e=this.get("startTime");if(!e||e===0){return -1}var a=this.get("interval"),c=this.get("lastFireTime");if(c<e){c=e}var b;if(this.get("repeats")){if(a===0){b=c}else{b=e+(Math.floor((c-e)/a)+1)*a}}else{b=e+a}var d=this.get("until");if(d&&d>0&&b>d){b=d}return b}.property("interval","startTime","repeats","until","isValid","lastFireTime").cacheable(),schedule:function(){if(!this.get("isValid")){return this}this.beginPropertyChanges();if(!this.startTime){this.set("startTime",SC.RunLoop.currentRunLoop.get("startTime"))}var a=this.get("fireTime"),b=this.get("lastFireTime");if(a>=b){this.set("isScheduled",YES);SC.RunLoop.currentRunLoop.scheduleTimer(this,a)}this.endPropertyChanges();return this},invalidate:function(){this.beginPropertyChanges();this.set("isValid",NO);var a=SC.RunLoop.currentRunLoop;if(a){a.cancelTimer(this)}this.action=this.target=null;this.endPropertyChanges();if(this.get("isPooled")){SC.Timer.returnTimerToPool(this)}return this},fire:function(){var b=Date.now();this.set("lastFireTime",b);var a=this.get("fireTime");if(!this.get("isPaused")){this.performAction()}if(a>b){this.schedule()}else{this.invalidate()}},performAction:function(){var a=SC.typeOf(this.action);if(a==SC.T_FUNCTION){this.action.call((this.target||this),this)}else{if(a===SC.T_STRING){if(this.action.indexOf(".")>=0){var e=this.action.split(".");var c=e.pop();var d=SC.objectForPropertyPath(e,window);var b=d.get?d.get(c):d[c];if(b&&SC.typeOf(b)==SC.T_FUNCTION){b.call(d,this)}else{throw"%@: Timer could not find a function at %@".fmt(this,this.action)}}else{SC.RootResponder.responder.sendAction(this.action,this.target,this)}}}},init:function(){arguments.callee.base.apply(this,arguments);if(this.startTime instanceof Date){this.startTime=this.startTime.getTime()}if(this.until instanceof Date){this.until=this.until.getTime()}},RESET_DEFAULTS:{target:null,action:null,isPooled:NO,isPaused:NO,isScheduled:NO,isValid:YES,interval:0,repeats:NO,until:null,startTime:null,lastFireTime:0},reset:function(b){if(!b){b=SC.EMPTY_HASH}this.propertyWillChange("fireTime");var c=this.RESET_DEFAULTS;for(var a in c){if(!c.hasOwnProperty(a)){continue}this[a]=SC.none(b[a])?c[a]:b[a]}this.propertyDidChange("fireTime");return this},removeFromTimerQueue:function(c){var b=this._timerQueuePrevious,a=this._timerQueueNext;if(!b&&!a&&c!==this){return c}if(b){b._timerQueueNext=a}if(a){a._timerQueuePrevious=b}this._timerQueuePrevious=this._timerQueueNext=null;return(c===this)?a:c},scheduleInTimerQueue:function(c,b){this._timerQueueRunTime=b;var a=c;var d=null;while(a&&a._timerQueueRunTime<b){d=a;a=a._timerQueueNext}if(d){d._timerQueueNext=this;this._timerQueuePrevious=d}if(a){a._timerQueuePrevious=this;this._timerQueueNext=a}return(a===c)?this:c},collectExpiredTimers:function(c,a){if(this._timerQueueRunTime>a){return this}c.push(this);var b=this._timerQueueNext;this._timerQueueNext=null;if(b){b._timerQueuePrevious=null}return b?b.collectExpiredTimers(c,a):null}});SC.Timer.schedule=function(a){var b;if(!a||SC.none(a.isPooled)||a.isPooled){b=this.timerFromPool(a)}else{b=this.create(a)}return b.schedule()};SC.Timer.timerFromPool=function(a){var b=this._timerPool;if(!b){b=this._timerPool=[]}var c=b.pop();if(!c){c=this.create()}return c.reset(a)};SC.Timer.returnTimerToPool=function(a){if(!this._timerPool){this._timerPool=[]}this._timerPool.push(a);return this};sc_require("system/browser");SC.mixin({normalizeURL:function(a){if(a.slice(0,1)=="/"){a=window.location.protocol+"//"+window.location.host+a}else{if((a.slice(0,5)=="http:")||(a.slice(0,6)=="https:")){}else{a=window.location.href+"/"+a}}return a},isPercentage:function(a){return(a<1&&a>0)},minX:function(a){return a.x||0},maxX:function(a){return(a.x||0)+(a.width||0)},midX:function(a){return(a.x||0)+((a.width||0)/2)},minY:function(a){return a.y||0},maxY:function(a){return(a.y||0)+(a.height||0)},midY:function(a){return(a.y||0)+((a.height||0)/2)},centerX:function(b,a){return(a.width-b.width)/2},centerY:function(b,a){return(a.height-b.height)/2},offset:function(d,c){var f,b,h,a;c=c||"document";if(c==="parent"){a=jQuery(d).position()}else{a=jQuery(d).offset();if(SC.browser.isMobileSafari){f=navigator.userAgent;b=f.indexOf("Mobile/");h=f.substring(b+7,b+9);if(parseInt(SC.browser.mobileSafari,0)<=532||(h<="8A")){a.left-=window.pageXOffset;a.top-=window.pageYOffset}}if(c==="viewport"){if(SC.browser.isIE8OrLower){a.left-=$(window).scrollLeft();a.top-=$(window).scrollTop()}else{a.left-=window.pageXOffset;a.top-=window.pageYOffset}}}try{a.x=a.left;a.y=a.top}catch(g){a={x:a.left,y:a.top}}delete a.left;delete a.top;return a},viewportOffset:function(b){var a=SC.offset(b,"viewport");return{x:a.left,y:a.top}}});SC.mixin({ZERO_POINT:{x:0,y:0},pointInRect:function(a,b){return(a.x>=SC.minX(b))&&(a.y>=SC.minY(b))&&(a.x<=SC.maxX(b))&&(a.y<=SC.maxY(b))},rectsEqual:function(b,a,c){if(!b||!a){return(b==a)}if(!c&&c!==0){c=0.1}if((b.y!=a.y)&&(Math.abs(b.y-a.y)>c)){return NO}if((b.x!=a.x)&&(Math.abs(b.x-a.x)>c)){return NO}if((b.width!=a.width)&&(Math.abs(b.width-a.width)>c)){return NO}if((b.height!=a.height)&&(Math.abs(b.height-a.height)>c)){return NO}return YES},intersectRects:function(b,a){var c={x:Math.max(SC.minX(b),SC.minX(a)),y:Math.max(SC.minY(b),SC.minY(a)),width:Math.min(SC.maxX(b),SC.maxX(a)),height:Math.min(SC.maxY(b),SC.maxY(a))};c.width=Math.max(0,c.width-c.x);c.height=Math.max(0,c.height-c.y);return c},unionRects:function(b,a){var c={x:Math.min(SC.minX(b),SC.minX(a)),y:Math.min(SC.minY(b),SC.minY(a)),width:Math.max(SC.maxX(b),SC.maxX(a)),height:Math.max(SC.maxY(b),SC.maxY(a))};c.width=Math.max(0,c.width-c.x);c.height=Math.max(0,c.height-c.y);return c},cloneRect:function(a){return{x:a.x,y:a.y,width:a.width,height:a.height}},stringFromRect:function(a){if(!a){return"(null)"}else{return"{x:"+a.x+", y:"+a.y+", width:"+a.width+", height:"+a.height+"}"}}});sc_require("panes/pane");sc_require("panes/keyboard");sc_require("panes/layout");sc_require("panes/manipulation");sc_require("panes/visibility");SC.MainPane=SC.Pane.extend({layout:{top:0,left:0,bottom:0,right:0,minHeight:200,minWidth:200},init:function(){var c={x:0,y:0,width:1000,height:1000},a=this.get("layout"),b=false;if(document&&document.body){c.width=document.body.clientWidth;c.height=document.body.clientHeight;if(a.minHeight||a.minWidth){if((a.minHeight&&c.height<a.minHeight)||(a.minWidth&&c.width<a.minWidth)){SC.bodyOverflowArbitrator.requestVisible(this)}else{SC.bodyOverflowArbitrator.requestHidden(this)}}}arguments.callee.base.apply(this,arguments)},paneDidAttach:function(){var b=arguments.callee.base.apply(this,arguments),a=this.rootResponder;a.makeMainPane(this);if(!a.get("keyRootView")){a.makeKeyPane(this)}return b},acceptsKeyPane:YES,classNames:["sc-main"]});SC.routes=SC.Object.create({wantsHistory:NO,usesHistory:null,baseURI:document.baseURI,_didSetup:NO,_location:null,_firstRoute:null,_extractParametersAndRoute:function(d,b){var a={},j=d.route||"",f,c,e,h,g,k;f=(j.indexOf("?")<0&&j.indexOf("&")>=0)?"&":"?";c=j.split(f);j=c.shift();a=this.deparam(c.join("&"),b||false);for(k in d){if(d.hasOwnProperty(k)&&k!=="route"){a[k]=""+d[k]}}a.params=f+$.param(a);a.route=j;return a},location:function(a,b){this._skipRoute=NO;return this._extractLocation(a,b)}.property(),informLocation:function(a,b){this._skipRoute=YES;var c=this.location.lastSetValueKey;if(c&&this._kvo_cache){this._kvo_cache[c]=b}return this._extractLocation(a,b)}.property(),_extractLocation:function(c,d){var a,b;if(d!==undefined){if(d===null){d=""}if(typeof(d)==="object"){a=this._extractParametersAndRoute(d);d=a.route+a.params}if(!SC.empty(d)||(this._location&&this._location!==d)){b=encodeURI(d);if(this.usesHistory){if(b.length>0){b="/"+b}window.history.pushState(null,null,this.get("baseURI")+b)}else{window.location.hash=b}}this._location=d}return this._location},ping:function(){var a;if(!this._didSetup){this._didSetup=YES;if(this.get("wantsHistory")&&SC.platform.supportsHistory){this.usesHistory=YES;this.popState();SC.Event.add(window,"popstate",this,this.popState)}else{this.usesHistory=NO;if(SC.platform.supportsHashChange){this.hashChange();SC.Event.add(window,"hashchange",this,this.hashChange)}else{a=this;this._invokeHashChange=function(){a.hashChange();setTimeout(a._invokeHashChange,100)};this._invokeHashChange()}}}},hashChange:function(a){var b=window.location.hash;b=(b&&b.length>0)?b.slice(1,b.length):"";if(!SC.browser.isMozilla){b=decodeURI(b)}if(this.get("location")!==b&&!this._skipRoute){SC.run(function(){this.set("location",b)},this)}this._skipRoute=false},popState:function(a){var b=this.get("baseURI"),c=document.location.href;if(c.slice(0,b.length)===b){c=c.slice(b.length+1,c.length);if(this.get("location")!==c&&!this._skipRoute){SC.run(function(){this.set("location",c)},this)}}this._skipRoute=false},add:function(a,b,c){if(!this._didSetup){this.invokeLast(this.ping)}if(c===undefined&&SC.typeOf(b)===SC.T_FUNCTION){c=b;b=null}else{if(SC.typeOf(c)===SC.T_STRING){c=b[c]}}if(!this._firstRoute){this._firstRoute=this._Route.create()}this._firstRoute.add(a.split("/"),b,c);return this},locationDidChange:function(){this.trigger()}.observes("location"),trigger:function(){var a=this._firstRoute,b=this.get("location"),d,c;if(a){d=this._extractParametersAndRoute({route:b});b=d.route;delete d.route;delete d.params;c=a.routeForParts(b.split("/"),d);if(c&&c.method){c.method.call(c.target||this,d)}}},deparam:function(k,g){var j={},b={"true":!0,"false":!1,"null":null},f=k.replace(/\+/g," ").split("&"),l=f.length,n,d,p,c,o,h,q,m,e=decodeURIComponent,a=Object.prototype.toString;for(n=0;n<l;++n){d=f[n].split("="),p=e(d[0]),o=j,q=p.split("]["),m=p.length-1;if(/\[/.test(q[0])&&/\]$/.test(q[m])){q[m]=q[m].replace(/\]$/,"");q=q.shift().split("[").concat(q);m=q.length-1}else{m=0}if(d.length===2){c=e(d[1]);if(g){c=c&&!isNaN(c)?+c:c==="undefined"?undefined:b[c]!==undefined?b[c]:c}if(m){for(h=0;h<m;++h){p=q[h]===""?o.length:q[h];o=o[p]=h<m?o[p]||(q[h+1]&&isNaN(q[h+1])?{}:[]):c}}else{if(a.apply(j[p])==="[object Array]"){j[p].push(c)}else{if(j[p]!==undefined){j[p]=[j[p],c]}else{j[p]=c}}}}else{if(p){j[p]=g?undefined:""}}}return j},_Route:SC.Object.extend({target:null,method:null,staticRoutes:null,dynamicRoutes:null,wildcardRoutes:null,add:function(c,b,e){var a,d;c=SC.clone(c);if(!c||c.length===0){this.target=b;this.method=e}else{a=c.shift();switch(a.slice(0,1)){case":":a=a.slice(1,a.length);if(!this.dynamicRoutes){this.dynamicRoutes={}}if(!this.dynamicRoutes[a]){this.dynamicRoutes[a]=this.constructor.create()}d=this.dynamicRoutes[a];break;case"*":a=a.slice(1,a.length);if(!this.wildcardRoutes){this.wildcardRoutes={}}d=this.wildcardRoutes[a]=this.constructor.create();break;default:if(!this.staticRoutes){this.staticRoutes={}}if(!this.staticRoutes[a]){this.staticRoutes[a]=this.constructor.create()}d=this.staticRoutes[a]}if(d){d.add(c,b,e)}}},routeForParts:function(d,e){var b,c,a;d=SC.clone(d);if(!d||d.length===0){return this.method?this:null}else{b=d.shift();if(this.staticRoutes&&this.staticRoutes[b]){return this.staticRoutes[b].routeForParts(d,e)}else{for(c in this.dynamicRoutes){a=this.dynamicRoutes[c].routeForParts(d,e);if(a){e[c]=b;return a}}for(c in this.wildcardRoutes){d.unshift(b);e[c]=d.join("/");return this.wildcardRoutes[c].routeForParts(null,e)}return null}}}})});SC.SCANNER_OUT_OF_BOUNDS_ERROR=new Error("Out of bounds.");SC.SCANNER_INT_ERROR=new Error("Not an int.");SC.SCANNER_SKIP_ERROR=new Error("Did not find the string to skip.");SC.SCANNER_SCAN_ARRAY_ERROR=new Error("Did not find any string of the given array to scan.");SC.DATETIME_COMPAREDATE_TIMEZONE_ERROR=new Error("Can't compare the dates of two DateTimes that don't have the same timezone.");SC.DATETIME_ISO8601="%Y-%m-%dT%H:%M:%S%Z";SC.Scanner=SC.Object.extend({string:null,scanLocation:0,scan:function(a){if(this.scanLocation+a>this.length){throw SC.SCANNER_OUT_OF_BOUNDS_ERROR}var b=this.string.substr(this.scanLocation,a);this.scanLocation+=a;return b},scanInt:function(c,e){if(e===undefined){e=c}var d=this.scan(e);var b=new RegExp("^\\d{"+c+","+e+"}");var a=d.match(b);if(!a){throw SC.SCANNER_INT_ERROR}if(a[0].length<e){this.scanLocation+=a[0].length-e}return parseInt(a[0],10)},skipString:function(a){if(this.scan(a.length)!==a){throw SC.SCANNER_SKIP_ERROR}return YES},scanArray:function(c){for(var b=0,a=c.length;b<a;b++){if(this.scan(c[b].length)===c[b]){return b}this.scanLocation-=c[b].length}throw SC.SCANNER_SCAN_ARRAY_ERROR}});SC.DateTime=SC.Object.extend(SC.Freezable,SC.Copyable,{_ms:0,timezone:0,isFrozen:YES,adjust:function(b,a){var c;b=b?SC.clone(b):{};c=(b.timezone!==undefined)?b.timezone:(this.timezone!==undefined)?this.timezone:0;return this.constructor._adjust(b,this._ms,c,a)._createFromCurrentState()},advance:function(a){return this.constructor._advance(a,this._ms,this.timezone)._createFromCurrentState()},unknownProperty:function(a){return this.constructor._get(a,this._ms,this.timezone)},toFormattedString:function(a){return this.constructor._toFormattedString(a,this._ms,this.timezone)},toISO8601:function(){return this.constructor._toFormattedString(SC.DATETIME_ISO8601,this._ms,this.timezone)},toString:function(){return"UTC: "+new Date(this._ms).toUTCString()+", timezone: "+this.timezone},isEqual:function(a){return this.constructor.compare(this,a)===0},copy:function(){return this},toTimezone:function(a){if(a===undefined){a=0}return this.advance({timezone:a-this.timezone})}});SC.DateTime.mixin(SC.Comparable,{recordFormat:SC.DATETIME_ISO8601,dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],_englishDayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],AMPMNames:["AM","PM"],_date:new Date(),_tz:0,timezone:new Date().getTimezoneOffset(),_dt_cache:{},_dt_cache_index:-1,_DT_CACHE_MAX_LENGTH:1000,_setCalcState:function(a,c){var b={milliseconds:this._date.getTime(),timezone:this._tz};if(a!==undefined){this._date.setTime(a)}if(c!==undefined){this._tz=c}return b},_setCalcStateFromHash:function(c,b){var d=(b!==undefined)?b:this._tz;var a=this._toMilliseconds(c,this._ms,d);return this._setCalcState(a,d)},_get:function(u,b,n){var l,s,h,o,e,j,k,f,p,a;var c,i;var r=this._date;var q,g=null;q=this._setCalcState(b,n);if(u==="milliseconds"){g=r.getTime()}else{if(u==="timezone"){g=this._tz}}if(g===null){p=u.slice(0,4);a=u.slice(4);if(p==="last"||p==="next"){c=this._get("dayOfWeek",b,n);i=this._englishDayNames.indexOf(a);if(i>=0){var t=i-c;if(p==="last"&&t>=0){t-=7}if(p==="next"&&t<0){t+=7}this._advance({day:t},b,n);g=this._createFromCurrentState()}}}if(g===null){if(n!==undefined){this._setCalcState(r.getTime()-(n*60000),0)}switch(u){case"year":g=r.getUTCFullYear();break;case"month":g=r.getUTCMonth()+1;break;case"day":g=r.getUTCDate();break;case"dayOfWeek":g=r.getUTCDay();break;case"hour":g=r.getUTCHours();break;case"minute":g=r.getUTCMinutes();break;case"second":g=r.getUTCSeconds();break;case"millisecond":g=r.getUTCMilliseconds();break}if((g===null)&&(u==="isLeapYear")){e=this._get("year");g=(e%4===0&&e%100!==0)||e%400===0}if((g===null)&&(u==="daysInMonth")){switch(this._get("month")){case 4:case 6:case 9:case 11:g=30;break;case 2:g=this._get("isLeapYear")?29:28;break;default:g=31;break}}if((g===null)&&(u==="dayOfYear")){l=r.getTime();h=this._get("day");this._setCalcStateFromHash({day:1});for(o=this._get("month")-1;o>0;o--){this._setCalcStateFromHash({month:o});h+=this._get("daysInMonth")}r.setTime(l);g=h}if((g===null)&&(u.slice(0,4)==="week")){j=u.length===4?1:parseInt(u.slice("4"),10);k=this._get("dayOfWeek");f=this._get("dayOfYear")-1;if(j===0){g=parseInt((f-k+7)/7,10)}else{g=parseInt((f-(k-1+7)%7+7)/7,10)}}}this._setCalcState(q.milliseconds,q.timezone);return g},_adjust:function(c,f,e,a){var d=c?SC.clone(c):{};var b=this._toMilliseconds(c,f,e,a);this._setCalcState(b,e);return this},_advance:function(a,f,d){var c=a?SC.clone(a):{};var e;for(var b in c){c[b]+=this._get(b,f,d)}e=(c.timezone!==undefined)?c.timezone:d;return this._adjust(c,f,e,NO)},_toMilliseconds:function(j,c,h,f){var a=j?SC.clone(j):{};var i=this._date;var g=i.getTime();var b,e;if(!SC.none(c)){i.setTime(c)}e=(h!==undefined)?h:(this.timezone!==undefined)?this.timezone:0;i.setTime(i.getTime()-(e*60000));if(f===undefined||f===YES){if(!SC.none(a.hour)&&SC.none(a.minute)){a.minute=0}if(!(SC.none(a.hour)&&SC.none(a.minute))&&SC.none(a.second)){a.second=0}if(!(SC.none(a.hour)&&SC.none(a.minute)&&SC.none(a.second))&&SC.none(a.millisecond)){a.millisecond=0}}if(SC.none(a.year)){a.year=i.getUTCFullYear()}if(SC.none(a.month)){a.month=i.getUTCMonth()+1}if(SC.none(a.day)){a.day=i.getUTCDate()}if(SC.none(a.hour)){a.hour=i.getUTCHours()}if(SC.none(a.minute)){a.minute=i.getUTCMinutes()}if(SC.none(a.second)){a.second=i.getUTCSeconds()}if(SC.none(a.millisecond)){a.millisecond=i.getUTCMilliseconds()}b=Date.UTC(a.year,a.month-1,a.day,a.hour,a.minute,a.second,a.millisecond);i.setTime(b+(e*60000));b=i.getTime();i.setTime(g);return b},create:function(){var i=arguments.length===0?{}:arguments[0];var d;if(SC.typeOf(i)===SC.T_NUMBER){i={milliseconds:i}}d=(i.timezone!==undefined)?i.timezone:this.timezone;if(d===undefined){d=0}if(!SC.none(i.milliseconds)){var h="nu"+i.milliseconds+d,a=this._dt_cache;var e=a[h];if(!e){var f,g=this._dt_cache_index,b=this;e=a[h]=new b([{_ms:i.milliseconds,timezone:d}]);g=this._dt_cache_index=(g+1)%this._DT_CACHE_MAX_LENGTH;f=a[g];if(f!==undefined&&a[f]){delete a[f]}a[g]=h}return e}else{var c=new Date();return this.create({milliseconds:this._toMilliseconds(i,c.getTime(),d,i.resetCascadingly),timezone:d})}},_createFromCurrentState:function(){return this.create({milliseconds:this._date.getTime(),timezone:this._tz})},parse:function(o,c){var p=new RegExp("(?:%([aAbBcdDhHiIjmMpsSUWwxXyYZ%])|(.))","g");var n,j,a={},b={},i=SC.Scanner.create({string:o});if(SC.none(c)){c=SC.DATETIME_ISO8601}try{while((j=p.exec(c))!==null){switch(j[1]){case"a":b.dayOfWeek=i.scanArray(this.abbreviatedDayNames);break;case"A":b.dayOfWeek=i.scanArray(this.dayNames);break;case"b":a.month=i.scanArray(this.abbreviatedMonthNames)+1;break;case"B":a.month=i.scanArray(this.monthNames)+1;break;case"c":throw"%c is not implemented";case"d":case"D":a.day=i.scanInt(1,2);break;case"h":case"H":a.hour=i.scanInt(1,2);break;case"i":case"I":a.hour=i.scanInt(1,2);break;case"j":throw"%j is not implemented";case"m":a.month=i.scanInt(1,2);break;case"M":a.minute=i.scanInt(1,2);break;case"p":a.meridian=i.scanArray(this.AMPMNames);break;case"S":a.second=i.scanInt(1,2);break;case"s":a.millisecond=i.scanInt(1,3);break;case"U":throw"%U is not implemented";case"W":throw"%W is not implemented";case"w":throw"%w is not implemented";case"x":throw"%x is not implemented";case"X":throw"%X is not implemented";case"y":a.year=i.scanInt(2);a.year+=(a.year>70?1900:2000);break;case"Y":a.year=i.scanInt(4);break;case"Z":var g=i.scan(1);if(g==="Z"){a.timezone=0}else{if(g==="+"||g==="-"){var k=i.scanInt(2);if(i.scan(1)!==":"){i.scan(-1)}var f=i.scanInt(2);a.timezone=(g==="+"?-1:1)*(k*60+f)}}break;case"%":i.skipString("%");break;default:i.skipString(j[0]);break}}}catch(l){SC.Logger.log("SC.DateTime.createFromString "+l.toString());return null}if(!SC.none(a.meridian)&&!SC.none(a.hour)){if((a.meridian===1&&a.hour!==12)||(a.meridian===0&&a.hour===12)){a.hour=(a.hour+12)%24}delete a.meridian}n=this.create(a);if(!SC.none(b.dayOfWeek)&&n.get("dayOfWeek")!==b.dayOfWeek){return null}return n},_pad:function(b,a){var c=""+b;if(a===undefined){a=2}while(c.length<a){c="0"+c}return c},__toFormattedString:function(b,e,c){var a,d;switch(b[1]){case"a":return this.abbreviatedDayNames[this._get("dayOfWeek")];case"A":return this.dayNames[this._get("dayOfWeek")];case"b":return this.abbreviatedMonthNames[this._get("month")-1];case"B":return this.monthNames[this._get("month")-1];case"c":return this._date.toString();case"d":return this._pad(this._get("day"));case"D":return this._get("day");case"h":return this._get("hour");case"H":return this._pad(this._get("hour"));case"i":a=this._get("hour");return(a===12||a===0)?12:(a+12)%12;case"I":a=this._get("hour");return this._pad((a===12||a===0)?12:(a+12)%12);case"j":return this._pad(this._get("dayOfYear"),3);case"m":return this._pad(this._get("month"));case"M":return this._pad(this._get("minute"));case"p":return this._get("hour")>11?this.AMPMNames[1]:this.AMPMNames[0];case"S":return this._pad(this._get("second"));case"s":return this._pad(this._get("millisecond"),3);case"u":return this._pad(this._get("utc"));case"U":return this._pad(this._get("week0"));case"W":return this._pad(this._get("week1"));case"w":return this._get("dayOfWeek");case"x":return this._date.toDateString();case"X":return this._date.toTimeString();case"y":return this._pad(this._get("year")%100);case"Y":return this._get("year");case"Z":d=-1*c;return(d>=0?"+":"-")+this._pad(parseInt(Math.abs(d)/60,10))+":"+this._pad(Math.abs(d)%60);case"%":return"%"}},_toFormattedString:function(c,e,b){var a=this;var d=(b!==undefined)?b:(this.timezone!==undefined)?this.timezone:0;this._setCalcState(e-(b*60000),0);return c.replace(/\%([aAbBcdDhHiIjmMpsSUWwxXyYZ\%])/g,function(){var f=a.__toFormattedString.call(a,arguments,e,b);return f})},compare:function(d,c){var f=d.get("milliseconds");var e=c.get("milliseconds");return f<e?-1:f===e?0:1},compareDate:function(d,c){if(d.get("timezone")!==c.get("timezone")){throw SC.DATETIME_COMPAREDATE_TIMEZONE_ERROR}var f=d.adjust({hour:0}).get("milliseconds");var e=c.adjust({hour:0}).get("milliseconds");return f<e?-1:f===e?0:1}});SC.Binding.dateTime=function(a){return this.transform(function(b,c){return b?b.toFormattedString(a):null})};SC.stringsFor("English",{"_SC.DateTime.dayNames":"Sunday Monday Tuesday Wednesday Thursday Friday Saturday","_SC.DateTime.abbreviatedDayNames":"Sun Mon Tue Wed Thu Fri Sat","_SC.DateTime.monthNames":"January February March April May June July August September October November December","_SC.DateTime.abbreviatedMonthNames":"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec","_SC.DateTime.AMPMNames":"AM PM"});SC.DateTime.mixin({_setup:function(){SC.DateTime.dayNames=SC.String.w(SC.String.loc("_SC.DateTime.dayNames"));SC.DateTime.abbreviatedDayNames=SC.String.w(SC.String.loc("_SC.DateTime.abbreviatedDayNames"));SC.DateTime.monthNames=SC.String.w(SC.String.loc("_SC.DateTime.monthNames"));SC.DateTime.abbreviatedMonthNames=SC.String.w(SC.String.loc("_SC.DateTime.abbreviatedMonthNames"));SC.DateTime.AMPMNames=SC.String.w(SC.String.loc("_SC.DateTime.AMPMNames"))}});jQuery(document).ready(function(){SC.DateTime._setup()});SC.Response=SC.Object.extend({isResponse:YES,isError:NO,errorValue:function(){return this}.property().cacheable(),errorObject:null,request:null,originalRequest:function(){var a=this.get("request");while(a.get("source")){a=a.get("source")}return a}.property("request").cacheable(),type:function(){return this.getPath("request.type")}.property("request").cacheable(),address:function(){return this.getPath("request.address")}.property("request").cacheable(),isJSON:function(){return this.getPath("request.isJSON")||NO}.property("request").cacheable(),isXML:function(){return this.getPath("request.isXML")||NO}.property("request").cacheable(),listeners:function(){return this.getPath("request.listeners")}.property("request").cacheable(),status:-100,headers:null,body:function(){var a=this.get("encodedBody");if(a&&this.get("isJSON")){try{a=SC.json.decode(a)}catch(b){return SC.Error.create({message:b.name+": "+b.message,label:"Response",errorValue:this})}}return a}.property("encodedBody").cacheable(),response:function(){return this.get("body")}.property("body").cacheable(),isCancelled:NO,timedOut:null,timeoutTimer:null,fire:function(){var a=this.get("request"),c=a?a.get("source"):null;if(c&&c.willSend){c.willSend(a,this)}a.freeze();if(!this.get("isCancelled")){this.invokeTransport()}var b=a.get("timeout");if(b){var d=SC.Timer.schedule({target:this,action:"timeoutReached",interval:b,repeats:NO});this.set("timeoutTimer",d)}if(!this.get("isCancelled")&&c&&c.didSend){c.didSend(a,this)}},invokeTransport:function(){this.receive(function(a){this.set("status",200)},this)},receive:function(e,a){if(!this.get("timedOut")){var d=this.get("timeoutTimer");if(d){d.invalidate()}this.set("timedOut",NO)}var b=this.get("request");var c=b?b.get("source"):null;SC.run(function(){if(c&&c.willReceive){c.willReceive(b,this)}e.call(a,!this.get("isCancelled"));if(!this.get("isCancelled")&&c&&c.didReceive){c.didReceive(b,this)}if(!this.get("isCancelled")){this.notify()}},this);SC.Request.manager.transportDidClose(this);return this},cancel:function(){if(!this.get("isCancelled")){this.set("isCancelled",YES);this.cancelTransport();SC.Request.manager.transportDidClose(this)}},timeoutReached:function(){if(this.get("timedOut")===null){this.set("timedOut",YES);this.cancelTransport();this.receive(function(b){if(!b){return}var a=SC.$error("HTTP Request timed out","Request",0);a.set("errorValue",this);this.set("isError",YES);this.set("errorObject",a);this.set("status",0)},this);return YES}return NO},cancelTransport:function(){},_notifyListeners:function(h,b){var j=h[b],g,f,a;if(!j){return NO}var d=NO;var e=j.length;for(var c=0;c<e;c++){var k=j[c];g=(k.args||[]).copy();g.unshift(this);f=k.target;a=k.action;if(SC.typeOf(a)===SC.T_STRING){a=f[a]}d=a.apply(f,g)}return d},notify:function(){var b=this.get("listeners"),a=this.get("status"),c=Math.floor(a/100)*100,d=NO;if(!b){return this}d=this._notifyListeners(b,a);if(!d&&c!==a){d=this._notifyListeners(b,c)}if(!d&&a!==0){d=this._notifyListeners(b,0)}return this},toString:function(){var a=arguments.callee.base.apply(this,arguments);return"%@<%@ %@, status=%@".fmt(a,this.get("type"),this.get("address"),this.get("status"))}});SC.XHRResponse=SC.Response.extend({headers:function(){var c=this.get("rawRequest"),b=c?c.getAllResponseHeaders():null,a={};if(!b){return a}b.split("\n").forEach(function(g){var d=g.indexOf(":"),e,f;if(d>=0){e=g.slice(0,d);f=g.slice(d+1).trim();a[e]=f}},this);return a}.property("status").cacheable(),header:function(a){var b=this.get("rawRequest");return b?b.getResponseHeader(a):null},encodedBody:function(){var a=this.get("rawRequest");if(!a){return null}if(this.get("isXML")){return a.responseXML}return a.responseText}.property("status").cacheable(),cancelTransport:function(){var a=this.get("rawRequest");if(a){a.abort()}this.set("rawRequest",null)},invokeTransport:function(){var d,n,b,g,h=this.get("request"),e,a,f,c;g=this.createRequest();this.set("rawRequest",g);f=!!h.get("isAsynchronous");if(f){if(window.XMLHttpRequestProgressEvent){n=h.get("listeners");if(n){for(var o in n){if(isNaN(parseInt(o,10))){b=n[o];for(var k=0,l=b.length;k<l;k++){d=b[k];var m=o.split(".");if(SC.none(m[1])){SC.Event.add(g,m[0],d.target,d.action,d.args)}else{SC.Event.add(g[m[0]],m[1],d.target,d.action,d.args)}}}}}SC.Event.add(g,"loadend",this,this.finishRequest)}else{if(window.XMLHttpRequest&&g.addEventListener){SC.Event.add(g,"readystatechange",this,this.finishRequest)}else{e=this;a=function(){if(!e){return null}var i=e.finishRequest();if(i){e=null}return i};g.onreadystatechange=a}}}g.open(this.get("type"),this.get("address"),f);c=this.getPath("request.headers");for(var j in c){g.setRequestHeader(j,c[j])}g.send(this.getPath("request.encodedBody"));if(!f){this.finishRequest()}return g},createRequest:function(){var a;if(window.XMLHttpRequest){a=new XMLHttpRequest()}else{try{a=new ActiveXObject("MSXML2.XMLHTTP.6.0")}catch(b){}try{if(!a){a=new ActiveXObject("MSXML2.XMLHTTP")}}catch(b){}}return a},finishRequest:function(o){var c,l,a,e=this.get("rawRequest"),h=e.readyState,f,m,d,b;if(h===4&&!this.get("timedOut")){this.receive(function(i){if(!i){return}d=-1;try{d=e.status||0}catch(q){}if((d<200)||(d>=300)){try{b=e.statusText||""}catch(p){b=""}m=SC.$error(b||"HTTP Request failed","Request",d);m.set("errorValue",this);this.set("isError",YES);this.set("errorObject",m)}this.set("status",d)},this);if(window.XMLHttpRequestProgressEvent){SC.Event.remove(e,"loadend",this,this.finishRequest);f=this.get("request");l=f.get("listeners");if(l){for(var n in l){if(isNaN(parseInt(n,10))){a=l[n];for(var g=0,j=a.length;g<j;g++){c=a[g];var k=n.split(".");if(SC.none(k[1])){SC.Event.remove(e,k[0],c.target,c.action,c.args)}else{SC.Event.remove(e[k[0]],k[1],c.target,c.action,c.args)}}}}}}else{if(window.XMLHttpRequest&&e.addEventListener){SC.Event.remove(e,"readystatechange",this,this.finishRequest)}else{e.onreadystatechange=null}}return YES}return NO}});sc_require("system/response");SC.Request=SC.Object.extend(SC.Copyable,SC.Freezable,{isAsynchronous:YES,isJSON:NO,isXML:NO,attachIdentifyingHeaders:YES,headers:function(){var a=this._headers;if(!a){a=this._headers={}}return a}.property().cacheable(),responseClass:SC.XHRResponse,source:null,address:null,type:"GET",timeout:null,body:null,encodedBody:function(){var a=this.get("body");if(a&&this.get("isJSON")){a=SC.json.encode(a)}return a}.property("isJSON","isXML","body").cacheable(),willSend:function(b,a){},didSend:function(b,a){},willReceive:function(b,a){},didReceive:function(b,a){},concatenatedProperties:"COPY_KEYS",COPY_KEYS:["attachIdentifyingHeaders","isAsynchronous","isJSON","isXML","address","type","timeout","body","responseClass","willSend","didSend","willReceive","didReceive"],copy:function(){var a={},d=this.COPY_KEYS,f=d.length,b,c,e;while(--f>=0){b=d[f];if(this.hasOwnProperty(b)){a[b]=this.get(b)}}if(this.hasOwnProperty("listeners")){a.listeners=SC.copy(this.get("listeners"))}if(this.hasOwnProperty("_headers")){a._headers=SC.copy(this._headers)}a.source=this.get("source")||this;return this.constructor.create(a)},header:function(a,b){var d,c;if(SC.typeOf(a)===SC.T_STRING){c=this._headers;if(arguments.length===1){return c?c[a]:null}else{this.propertyWillChange("headers");if(!c){c=this._headers={}}c[a]=b;this.propertyDidChange("headers");return this}}else{if(b===undefined){c=a;this.beginPropertyChanges();for(d in c){if(!c.hasOwnProperty(d)){continue}this.header(d,c[d])}this.endPropertyChanges();return this}}return this},clearHeaders:function(){this.propertyWillChange("headers");this._headers={};this.propertyDidChange("headers")},async:function(a){if(a===undefined){a=YES}return this.set("isAsynchronous",a)},timeoutAfter:function(a){return this.set("timeout",a)},json:function(a){if(a===undefined){a=YES}if(a){this.set("isXML",NO)}return this.set("isJSON",a)},xml:function(a){if(a===undefined){a=YES}if(a){this.set("isJSON",NO)}return this.set("isXML",a)},_prep:function(){var a=!!this.header("Content-Type");if(this.get("attachIdentifyingHeaders")){this.header("X-Requested-With","XMLHttpRequest");this.header("X-SproutCore-Version",SC.VERSION)}if(!a&&!!this.get("body")){if(this.get("isJSON")){this.header("Content-Type","application/json")}else{if(this.get("isXML")){this.header("Content-Type","text/xml")}}}return this},send:function(a){var b=this.get("timeout");if(b&&!this.get("isAsynchronous")){throw"Timeout values cannot be used with synchronous requests"}else{if(b===0){throw"The timeout value must either not be specified or must be greater than 0"}}if(a){this.set("body",a)}return SC.Request.manager.sendRequest(this.copy()._prep())},resend:function(){var a=this.get("source")?this:this.copy()._prep();return SC.Request.manager.sendRequest(a)},notify:function(e,d,c){var a;if(SC.typeOf(e)!==SC.T_NUMBER&&SC.typeOf(e)!==SC.T_STRING){a=SC.A(arguments).slice(2);c=d;d=e;e=0}else{a=SC.A(arguments).slice(3)}var b=this.get("listeners");if(!b){this.set("listeners",b={})}if(!b[e]){b[e]=[]}b[e].push({target:d,action:c,args:a});return this}});SC.Request.mixin({getUrl:function(a){return this.create().set("address",a).set("type","GET")},postUrl:function(b,a){var c=this.create().set("address",b).set("type","POST");if(a){c.set("body",a)}return c},deleteUrl:function(a){return this.create().set("address",a).set("type","DELETE")},putUrl:function(b,a){var c=this.create().set("address",b).set("type","PUT");if(a){c.set("body",a)}return c},patchUrl:function(b,a){var c=this.create().set("address",b).set("type","PATCH");if(a){c.set("body",a)}return c}});SC.Request.manager=SC.Object.create({maxRequests:6,inflight:[],pending:[],sendRequest:function(b){if(!b){return null}var a=b.get("responseClass").create({request:b});this.get("pending").pushObject(a);this.fireRequestIfNeeded();return a},cancel:function(b){var d=this.get("pending"),c=this.get("inflight"),a;if(d.indexOf(b)>=0){this.propertyWillChange("pending");d.removeObject(b);this.propertyDidChange("pending");return YES}else{if(c.indexOf(b)>=0){b.cancel();c.removeObject(b);this.fireRequestIfNeeded();return YES}}return NO},cancelAll:function(){if(this.get("pending").length||this.get("inflight").length){this.set("pending",[]);this.get("inflight").forEach(function(a){a.cancel()});this.set("inflight",[]);return YES}return NO},fireRequestIfNeeded:function(){var d=this.get("pending"),c=this.get("inflight"),a=this.get("maxRequests"),b;if((d.length>0)&&(c.length<a)){b=d.shiftObject();c.pushObject(b);b.fire()}},transportDidClose:function(a){this.get("inflight").removeObject(a);this.fireRequestIfNeeded()}});SC.FOCUS_ALL_CONTROLS=NO;SC.ready(function(){var a=SC.SAFARI_FOCUS_BEHAVIOR;if(a!==null&&a!==undefined){SC.FOCUS_ALL_CONTROLS=SC.SAFARI_FOCUS_BEHAVIOR}});SC.TreeItemContent={isTreeItemContent:YES,treeItemChildren:null,treeItemIsExpanded:YES,treeItemIsGrouped:NO,treeItemDisclosureState:function(b,a){return this.get("treeItemIsExpanded")?SC.BRANCH_OPEN:SC.BRANCH_CLOSED},treeItemCollapse:function(b,a){this.setIfChanged("treeItemIsExpanded",NO)},treeItemExpand:function(b,a){this.setIfChanged("treeItemIsExpanded",YES)},treeItemBranchIndexes:function(e,c){var d=this.get("treeItemChildren"),b,g,a,f;if(!d){return null}b=SC.IndexSet.create();g=d.get("length");for(a=0;a<g;a++){if(!(f=d.objectAt(a))){continue}if(!f.get("treeItemChildren")){continue}if(f.treeItemDisclosureState(this,a)!==SC.LEAF_NODE){b.add(a)}}return b.get("length")>0?b:null}};SC.BRANCH_OPEN=17;SC.BRANCH_CLOSED=18;SC.LEAF_NODE=32;SC.CollectionContent={isCollectionContent:YES,contentIndexIsSelected:function(b,c,a){var d=b.get("selection");return d?d.contains(c,a):NO},contentIndexIsEnabled:function(b,c,a){return b.get("isEnabled")},contentGroupIndexes:function(a,b){return null},contentIndexIsGroup:function(b,c,a){return NO},contentIndexOutlineLevel:function(b,c,a){return -1},contentIndexDisclosureState:function(b,c,a){return SC.LEAF_NODE},contentIndexExpand:function(b,c,a){SC.Logger.log("contentIndexExpand(%@, %@, %@)".fmt(b,c,a))},contentIndexCollapse:function(b,c,a){SC.Logger.log("contentIndexCollapse(%@, %@, %@)".fmt(b,c,a))}};sc_require("mixins/tree_item_content");sc_require("mixins/collection_content");SC.TreeItemObserver=SC.Object.extend(SC.Array,SC.CollectionContent,{item:null,delegate:null,parentObserver:null,parentItem:function(){var a=this.get("parentObserver");return a?a.get("item"):null}.property("parentObserver").cacheable(),index:null,outlineLevel:0,children:null,disclosureState:SC.BRANCH_OPEN,branchIndexes:function(){var e=this.get("item"),b,f,a,d,c;if(!e){return SC.IndexSet.EMPTY}else{if(e.isTreeItemContent){f=this.get("parentItem");a=this.get("index");return e.treeItemBranchIndexes(f,a)}else{d=this.get("children");if(!d){return null}c=SC.IndexSet.create();b=d.get("length");f=e;for(a=0;a<b;a++){if(!(e=d.objectAt(a))){continue}if(!this._computeChildren(e,f,a)){continue}if(this._computeDisclosureState(e,f,a)!==SC.LEAF_NODE){c.add(a)}}return c.get("length")>0?c:null}}}.property("children").cacheable(),isHeaderVisible:function(){return !!this.get("parentObserver")}.property("parentObserver").cacheable(),length:0,objectAt:function(f,c){var g=this.get("length"),i=this.get("item"),a=this._objectAtCache,h=f,e=0,d,b;if(f>=g){return undefined}if(this.get("isHeaderVisible")){if(f===0){return i}else{h--}}i=null;if(!a){a=this._objectAtCache=[]}if((i=a[f])!==undefined){return i}b=this.get("children");if(!b){return undefined}if(d=this.get("branchIndexes")){d.forEach(function(l){if(i||(l>h)){return}var k=this.branchObserverAt(l),j;if(!k){return}j=k.get("length");if(l+j>h){i=k.objectAt(h-l,c);h=-1}else{h-=j-1}},this)}if(h>=0){i=b.objectAt(h,c)}a[f]=i;return i},replace:function(a,b,j,d){var i=a,g=null,e,f,h;if(d===undefined){d=SC.DROP_BEFORE}if(this.get("isHeaderVisible")){i--}if(i<0){throw"Tree Item cannot replace itself"}if(e=this.get("branchIndexes")){e.forEach(function(k){if(g||(k>=i)){return}if(!(g=this.branchObserverAt(k))){return}f=g.get("length");if((k+f===i)&&d===SC.DROP_AFTER){i-=k}else{if(k+f>i){i-=k}else{i-=f-1;g=null}}},this)}if(g){g.replace(i,b,j,d);return this}h=i+b;if(b>1&&e){e.forEachIn(i,e.get("max")-i,function(k){if(k>h){return}if(!(g=this.branchObserverAt(k))){return}f=g.get("length");h-=f-1},this)}b=h-i;var c=this.get("children");if(!c){throw"cannot replace() tree item with no children"}if((b<0)||(h>c.get("length"))){throw"replace() range must lie within a single tree item"}c.replace(i,b,j,d);return this},observerContentDidChange:function(b,c,i){this.invalidateBranchObserversAt(b);this._objectAtCache=this._outlineLevelCache=null;this._disclosureStateCache=null;this._contentGroupIndexes=NO;this.notifyPropertyChange("branchIndexes");var d=this.get("length"),e=this._computeLength(),g=this.get("parentObserver"),f;if(d!==e){this.set("length",e)}if(!this._notifyParent){return this}if(g){f=SC.IndexSet.create(this.get("index"));g._childrenRangeDidChange(g.get("children"),null,"[]",f)}else{if(d===e){c=this.expandChildIndex(b+c);b=this.expandChildIndex(b);c=c-b;i=0}else{b=this.expandChildIndex(b);c=e-b;i=e-d}var h=c;var a=i+h;this.arrayContentDidChange(b,h,a)}},expandChildIndex:function(c){var b=c;if(this.get("isHeaderVisible")){c++}var a=this.get("branchIndexes");if(!a||a.get("length")===0){return b}a.forEachIn(0,c,function(d){b+=this.branchObserverAt(d).get("length")-1},this);return b},_contentGroupIndexes:NO,contentGroupIndexes:function(a,e){if(e!==this){return null}var c=this._contentGroupIndexes;if(c!==NO){return c}if(this.get("parentObserver")){return null}var d=this.get("item"),g,b,h,f;if(d&&d.isTreeItemContent){g=d.get("treeItemIsGrouped")}else{g=!!this.delegate.get("treeItemIsGrouped")}if(g){c=SC.IndexSet.create();b=this.get("branchIndexes");if(b){h=b.min();f=0;b.forEach(function(k){c.add(k+f,1);var j=this.branchObserverAt(k);if(j){f+=j.get("length")-1;h+=f}},this)}}else{c=null}this._contentGroupIndexes=c;return c},contentIndexIsGroup:function(b,d,a){var c=this.contentGroupIndexes(b,d);return c?c.contains(a):NO},contentIndexOutlineLevel:function(j,g,e){if(g!==this){return -1}var a=this._outlineLevelCache;if(a&&(a[e]!==undefined)){return a[e]}if(!a){a=this._outlineLevelCache=[]}var f=this.get("length"),k=e,d=0,h=null,c,b,i;if(e>=f){return -1}if(this.get("isHeaderVisible")){if(e===0){return a[0]=this.get("outlineLevel")-1}else{k--}}if(c=this.get("branchIndexes")){c.forEach(function(n){if((h!==null)||(n>k)){return}var m=this.branchObserverAt(n),l;if(!m){return}l=m.get("length");if(n+l>k){h=m.contentIndexOutlineLevel(j,m,k-n);k=-1}else{k-=l-1}},this)}if(k>=0){h=this.get("outlineLevel")}a[e]=h;return h},contentIndexDisclosureState:function(j,g,e){if(g!==this){return -1}var a=this._disclosureStateCache;if(a&&(a[e]!==undefined)){return a[e]}if(!a){a=this._disclosureStateCache=[]}var f=this.get("length"),k=e,d=0,h=null,c,b,i;if(e>=f){return SC.LEAF_NODE}if(this.get("isHeaderVisible")){if(e===0){return a[0]=this.get("disclosureState")}else{k--}}if(c=this.get("branchIndexes")){c.forEach(function(n){if((h!==null)||(n>k)){return}var m=this.branchObserverAt(n),l;if(!m){return}l=m.get("length");if(n+l>k){h=m.contentIndexDisclosureState(j,m,k-n);k=-1}else{k-=l-1}},this)}if(k>=0){h=SC.LEAF_NODE}a[e]=h;return h},contentIndexExpand:function(b,f,a){var c,g=a,d,e;if(f!==this){return}if(this.get("isHeaderVisible")){if(a===0){this._expand(this.get("item"));return}else{g--}}if(c=this.get("branchIndexes")){c.forEach(function(k){if(k>=g){return}var j=this.branchObserverAt(k),h;if(!j){return}h=j.get("length");if(k+h>g){j.contentIndexExpand(b,j,g-k);g=-1}else{g-=h-1}},this)}if(g>=0){d=this.get("children");e=d?d.objectAt(g):null;if(e){this._expand(e,this.get("item"),g)}}},contentIndexCollapse:function(b,f,a){var c,d,e,g=a;if(f!==this){return}if(this.get("isHeaderVisible")){if(a===0){this._collapse(this.get("item"));return}else{g--}}if(c=this.get("branchIndexes")){c.forEach(function(k){if(k>=g){return}var j=this.branchObserverAt(k),h;if(!j){return}h=j.get("length");if(k+h>g){j.contentIndexCollapse(b,j,g-k);g=-1}else{g-=h-1}},this)}if(g>=0){d=this.get("children");e=d?d.objectAt(g):null;if(e){this._collapse(e,this.get("item"),g)}}},branchObserverAt:function(d){var g=this._branchObserversByIndex,c=this._branchObserverIndexes,e,h,b,j,a,f,i;if(!g){g=this._branchObserversByIndex=[]}if(!c){c=this._branchObserverIndexes=SC.IndexSet.create()}if(e=g[d]){return e}a=this.get("children");j=a?a.objectAt(d):null;if(!j){return null}g[d]=e=SC.TreeItemObserver.create({item:j,delegate:this.get("delegate"),parentObserver:this,index:d,outlineLevel:this.get("outlineLevel")+1});c.add(d);return e},invalidateBranchObserversAt:function(c){var b=this._branchObserversByIndex,a=this._branchObserverIndexes;if(!b||b.length<=c){return this}if(c<0){c=0}a.forEachIn(c,a.get("max")-c,function(e){var d=b[e];if(d){d.destroy()}},this);b.length=c;return this},init:function(){arguments.callee.base.apply(this,arguments);var a=this.get("item");if(!a){throw"SC.TreeItemObserver.item cannot be null"}a.addObserver("*",this,this._itemPropertyDidChange);this._itemPropertyDidChange(a,"*");this._notifyParent=YES},destroy:function(){this.invalidateBranchObserversAt(0);this._objectAtCache=null;this._notifyParent=NO;var c=this.get("item");if(c){c.removeObserver("*",this,this._itemPropertyDidChange)}var a=this._children,b=this._childrenRangeObserver;if(a&&b){a.removeRangeObserver(b)}this.set("length",0);arguments.callee.base.apply(this,arguments)},_itemPropertyDidChange:function(f,b){var a=this.get("children"),e=this.get("disclosureState"),d=this.get("item"),c;this.beginPropertyChanges();c=this._computeDisclosureState(d);if(e!==c){this.set("disclosureState",c)}c=this._computeChildren(d);if(a!==c){this.set("children",c)}this.endPropertyChanges()},_childrenDidChange:function(){var c=this.get("disclosureState"),d=c===SC.BRANCH_OPEN?this.get("children"):null,b=this._children,a=this._childrenRangeObserver;if(b===d){return this}if(a){b.removeRangeObserver(a)}if(d){this._childrenRangeObserver=d.addRangeObserver(null,this,this._childrenRangeDidChange)}else{this._childrenRangeObserver=null}this._children=d;this._childrenRangeDidChange(d,null,"[]",null)}.observes("children","disclosureState"),_childrenRangeDidChange:function(f,i,h,d){var a=this.get("children"),e=a?a.get("length"):0,c=d?d.get("min"):0,g=d?d.get("max"):e,b=this._childrenLen||0;this._childrenLen=e;this.observerContentDidChange(c,g-c,e-b)},_computeDisclosureState:function(d,e,b){var c,a;if(!d||!this._computeChildren(d)){return SC.LEAF_NODE}else{if(d.isTreeItemContent){if(e===undefined){e=this.get("parentItem")}if(b===undefined){b=this.get("index")}return d.treeItemDisclosureState(e,b)}else{c=this._treeItemIsExpandedKey;if(!c){a=this.get("delegate");c=a?a.get("treeItemIsExpandedKey"):"treeItemIsExpanded";this._treeItemIsExpandedKey=c}return d.get(c)?SC.BRANCH_OPEN:SC.BRANCH_CLOSED}}},_collapse:function(d,e,b){var c,a;if(!d||!this._computeChildren(d)){return this}else{if(d.isTreeItemContent){if(e===undefined){e=this.get("parentItem")}if(b===undefined){b=this.get("index")}d.treeItemCollapse(e,b)}else{c=this._treeItemIsExpandedKey;if(!c){a=this.get("delegate");c=a?a.get("treeItemIsExpandedKey"):"treeItemIsExpanded";this._treeItemIsExpandedKey=c}d.setIfChanged(c,NO)}}return this},_expand:function(d,e,b){var c,a;if(!d||!this._computeChildren(d)){return this}else{if(d.isTreeItemContent){if(e===undefined){e=this.get("parentItem")}if(b===undefined){b=this.get("index")}d.treeItemExpand(e,b)}else{c=this._treeItemIsExpandedKey;if(!c){a=this.get("delegate");c=a?a.get("treeItemIsExpandedKey"):"treeItemIsExpanded";this._treeItemIsExpandedKey=c}d.setIfChanged(c,YES)}}return this},_computeChildren:function(c){var a,b;if(!c){return null}else{if(c.isTreeItemContent){return c.get("treeItemChildren")}else{b=this._treeItemChildrenKey;if(!b){a=this.get("delegate");b=a?a.get("treeItemChildrenKey"):"treeItemChildren";this._treeItemChildrenKey=b}return c.get(b)}}},_computeLength:function(){var b=this.get("isHeaderVisible")?1:0,d=this.get("disclosureState"),c=this.get("children"),a;if((d===SC.BRANCH_OPEN)&&c){b+=c.get("length");if(a=this.get("branchIndexes")){a.forEach(function(e){var f=this.branchObserverAt(e);b+=f.get("length")-1},this)}}return b}});sc_require("private/tree_item_observer");SC.TreeController=SC.ObjectController.extend(SC.SelectionSupport,{treeItemIsGrouped:NO,treeItemIsExpandedKey:"treeItemIsExpanded",treeItemChildrenKey:"treeItemChildren",arrangedObjects:function(){var a,b=this.get("content");if(b){a=SC.TreeItemObserver.create({item:b,delegate:this});a.bind("allowsSelection",this,"allowsSelection");a.bind("allowsMultipleSelection",this,"allowsMultipleSelection");a.bind("allowsEmptySelection",this,"allowsEmptySelection")}else{a=null}this._sctc_arrangedObjects=a;return a}.property().cacheable(),_sctc_invalidateArrangedObjects:function(){this.propertyWillChange("arrangedObjects");var a=this._sctc_arrangedObjects;if(a){a.destroy()}this._sctc_arrangedObjects=null;this.propertyDidChange("arrangedObjects")}.observes("content","treeItemIsExpandedKey","treeItemChildrenKey","treeItemIsGrouped"),_sctc_arrangedObjectsContentDidChange:function(){this.updateSelectionAfterContentChange()}.observes("*arrangedObjects.[]"),canSelectGroups:NO,firstSelectableObject:function(){var d=this.get("arrangedObjects"),c,b,a=0;if(!d){return null}if(this.get("canSelectGroups")){return d.get("firstObject")}c=d.contentGroupIndexes(null,d);b=d.get("length");while(c.contains(a)&&(a<b)){a++}return a>=b?null:d.objectAt(a)}.property()});SC.InlineTextFieldDelegate={editor:null,acquireEditor:function(a){var b=this.editor;if(b){if(b.get("isEditing")&&!b.commitEditing()&&!b.discardEditing()){return null}this.releaseEditor(b)}var c=a.exampleEditor?a.exampleEditor:SC.InlineTextFieldView,d=a.get("pane");b=this.editor=d.createChildView(c,{inlineEditorDelegate:this});d.appendChild(b);return b},releaseEditor:function(a){a.removeFromParent();this.editor=null;return YES}};SC.STRING_TITLEIZE_REGEXP=(/([\s|\-|\_|\n])([^\s|\-|\_|\n]?)/g);SC.STRING_HUMANIZE_REGEXP=(/[\-_]/g);SC.STRING_REGEXP_ESCAPED_REGEXP=(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g);SC.STRING_DASHERIZE_CACHE={top:"top",left:"left",right:"right",bottom:"bottom",width:"width",height:"height",minWidth:"min-width",maxWidth:"max-width"};SC.INFLECTION_CONSTANTS={PLURAL:[[/(quiz)$/i,"$1zes"],[/^(ox)$/i,"$1en"],[/([m|l])ouse$/i,"$1ice"],[/(matr|vert|ind)ix|ex$/i,"$1ices"],[/(x|ch|ss|sh)$/i,"$1es"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/(hive)$/i,"$1s"],[/(?:([^f])fe|([lr])f)$/i,"$1$2ves"],[/sis$/i,"ses"],[/([ti])um$/i,"$1a"],[/(buffal|tomat)o$/i,"$1oes"],[/(bu)s$/i,"$1ses"],[/(alias|status)$/i,"$1es"],[/(octop|vir)us$/i,"$1i"],[/(ax|test)is$/i,"$1es"],[/s$/i,"s"],[/$/,"s"]],SINGULAR:[[/(quiz)zes$/i,"$1"],[/(matr)ices$/i,"$1ix"],[/(vert|ind)ices$/i,"$1ex"],[/^(ox)en/i,"$1"],[/(alias|status)es$/i,"$1"],[/(octop|vir)i$/i,"$1us"],[/(cris|ax|test)es$/i,"$1is"],[/(shoe)s$/i,"$1"],[/(o)es$/i,"$1"],[/(bus)es$/i,"$1"],[/([m|l])ice$/i,"$1ouse"],[/(x|ch|ss|sh)es$/i,"$1"],[/(m)ovies$/i,"$1ovie"],[/(s)eries$/i,"$1eries"],[/([^aeiouy]|qu)ies$/i,"$1y"],[/([lr])ves$/i,"$1f"],[/(tive)s$/i,"$1"],[/(hive)s$/i,"$1"],[/([^f])ves$/i,"$1fe"],[/(^analy)ses$/i,"$1sis"],[/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i,"$1$2sis"],[/([ti])a$/i,"$1um"],[/(n)ews$/i,"$1ews"],[/s$/i,""]],IRREGULAR:[["move","moves"],["sex","sexes"],["child","children"],["man","men"],["person","people"]],UNCOUNTABLE:["sheep","fish","series","species","money","rice","information","info","equipment"]};SC.mixin(SC.String,{capitalizeEach:function(a){return a.replace(SC.STRING_TITLEIZE_REGEXP,function(c,b,d){return(d)?(b+d.toUpperCase()):b}).capitalize()},titleize:function(b){var a=b.replace(SC.STRING_DECAMELIZE_REGEXP,"$1_$2");return a.replace(SC.STRING_TITLEIZE_REGEXP,function(c,e,d){return d?" "+d.toUpperCase():" "}).capitalize()},classify:function(d){var a=d.replace(SC.STRING_TITLEIZE_REGEXP,function(e,g,f){return f?f.toUpperCase():""});var c=a.charAt(0),b=c.toUpperCase();return c!==b?b+a.slice(1):a},humanize:function(a){return SC.String.decamelize(a).replace(SC.STRING_HUMANIZE_REGEXP," ")},escapeForRegExp:function(a){return a.replace(SC.STRING_REGEXP_ESCAPED_REGEXP,"\\$1")},removeDiacritics:function(g){var a=SC.diacriticMappingTable;if(!a){SC.diacriticMappingTable={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Ā":"A","Ă":"A","Ą":"A","Ǎ":"A","Ǟ":"A","Ǡ":"A","Ǻ":"A","Ȁ":"A","Ȃ":"A","Ȧ":"A","Ḁ":"A","Ạ":"A","Ả":"A","Ấ":"A","Ầ":"A","Ẩ":"A","Ẫ":"A","Ậ":"A","Ắ":"A","Ằ":"A","Ẳ":"A","Ẵ":"A","Ặ":"A","Å":"A","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ç":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ḉ":"C","Ď":"D","Ḋ":"D","Ḍ":"D","Ḏ":"D","Ḑ":"D","Ḓ":"D","È":"E","É":"E","Ê":"E","Ë":"E","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ȩ":"E","Ḕ":"E","Ḗ":"E","Ḙ":"E","Ḛ":"E","Ḝ":"E","Ẹ":"E","Ẻ":"E","Ẽ":"E","Ế":"E","Ề":"E","Ể":"E","Ễ":"E","Ệ":"E","Ḟ":"F","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","Ǧ":"G","Ǵ":"G","Ḡ":"G","Ĥ":"H","Ȟ":"H","Ḣ":"H","Ḥ":"H","Ḧ":"H","Ḩ":"H","Ḫ":"H","Ì":"I","Í":"I","Î":"I","Ï":"I","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ḭ":"I","Ḯ":"I","Ỉ":"I","Ị":"I","Ĵ":"J","Ķ":"K","Ǩ":"K","Ḱ":"K","Ḳ":"K","Ḵ":"K","Ĺ":"L","Ļ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ḻ":"L","Ḽ":"L","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ñ":"N","Ń":"N","Ņ":"N","Ň":"N","Ǹ":"N","Ṅ":"N","Ṇ":"N","Ṉ":"N","Ṋ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ō":"O","Ŏ":"O","Ő":"O","Ơ":"O","Ǒ":"O","Ǫ":"O","Ǭ":"O","Ȍ":"O","Ȏ":"O","Ȫ":"O","Ȭ":"O","Ȯ":"O","Ȱ":"O","Ṍ":"O","Ṏ":"O","Ṑ":"O","Ṓ":"O","Ọ":"O","Ỏ":"O","Ố":"O","Ồ":"O","Ổ":"O","Ỗ":"O","Ộ":"O","Ớ":"O","Ờ":"O","Ở":"O","Ỡ":"O","Ợ":"O","Ṕ":"P","Ṗ":"P","Ŕ":"R","Ŗ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṙ":"R","Ṛ":"R","Ṝ":"R","Ṟ":"R","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","Ș":"S","Ṡ":"S","Ṣ":"S","Ṥ":"S","Ṧ":"S","Ṩ":"S","Ţ":"T","Ť":"T","Ț":"T","Ṫ":"T","Ṭ":"T","Ṯ":"T","Ṱ":"T","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","Ư":"U","Ǔ":"U","Ǖ":"U","Ǘ":"U","Ǚ":"U","Ǜ":"U","Ȕ":"U","Ȗ":"U","Ṳ":"U","Ṵ":"U","Ṷ":"U","Ṹ":"U","Ṻ":"U","Ụ":"U","Ủ":"U","Ứ":"U","Ừ":"U","Ử":"U","Ữ":"U","Ự":"U","Ṽ":"V","Ṿ":"V","Ŵ":"W","Ẁ":"W","Ẃ":"W","Ẅ":"W","Ẇ":"W","Ẉ":"W","Ẋ":"X","Ẍ":"X","Ý":"Y","Ŷ":"Y","Ÿ":"Y","Ȳ":"Y","Ẏ":"Y","Ỳ":"Y","Ỵ":"Y","Ỷ":"Y","Ỹ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","Ẑ":"Z","Ẓ":"Z","Ẕ":"Z","`":"`","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","ā":"a","ă":"a","ą":"a","ǎ":"a","ǟ":"a","ǡ":"a","ǻ":"a","ȁ":"a","ȃ":"a","ȧ":"a","ḁ":"a","ạ":"a","ả":"a","ấ":"a","ầ":"a","ẩ":"a","ẫ":"a","ậ":"a","ắ":"a","ằ":"a","ẳ":"a","ẵ":"a","ặ":"a","ḃ":"b","ḅ":"b","ḇ":"b","ç":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ḉ":"c","ď":"d","ḋ":"d","ḍ":"d","ḏ":"d","ḑ":"d","ḓ":"d","è":"e","é":"e","ê":"e","ë":"e","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","ȅ":"e","ȇ":"e","ȩ":"e","ḕ":"e","ḗ":"e","ḙ":"e","ḛ":"e","ḝ":"e","ẹ":"e","ẻ":"e","ẽ":"e","ế":"e","ề":"e","ể":"e","ễ":"e","ệ":"e","ḟ":"f","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","ǧ":"g","ǵ":"g","ḡ":"g","ĥ":"h","ȟ":"h","ḣ":"h","ḥ":"h","ḧ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ì":"i","í":"i","î":"i","ï":"i","ĩ":"i","ī":"i","ĭ":"i","į":"i","ǐ":"i","ȉ":"i","ȋ":"i","ḭ":"i","ḯ":"i","ỉ":"i","ị":"i","ĵ":"j","ǰ":"j","ķ":"k","ǩ":"k","ḱ":"k","ḳ":"k","ḵ":"k","ĺ":"l","ļ":"l","ľ":"l","ḷ":"l","ḹ":"l","ḻ":"l","ḽ":"l","ḿ":"m","ṁ":"m","ṃ":"m","ñ":"n","ń":"n","ņ":"n","ň":"n","ǹ":"n","ṅ":"n","ṇ":"n","ṉ":"n","ṋ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ō":"o","ŏ":"o","ő":"o","ơ":"o","ǒ":"o","ǫ":"o","ǭ":"o","ȍ":"o","ȏ":"o","ȫ":"o","ȭ":"o","ȯ":"o","ȱ":"o","ṍ":"o","ṏ":"o","ṑ":"o","ṓ":"o","ọ":"o","ỏ":"o","ố":"o","ồ":"o","ổ":"o","ỗ":"o","ộ":"o","ớ":"o","ờ":"o","ở":"o","ỡ":"o","ợ":"o","ṕ":"p","ṗ":"p","ŕ":"r","ŗ":"r","ř":"r","ȑ":"r","ȓ":"r","ṙ":"r","ṛ":"r","ṝ":"r","ṟ":"r","ś":"s","ŝ":"s","ş":"s","š":"s","ș":"s","ṡ":"s","ṣ":"s","ṥ":"s","ṧ":"s","ṩ":"s","ţ":"t","ť":"t","ț":"t","ṫ":"t","ṭ":"t","ṯ":"t","ṱ":"t","ẗ":"t","ù":"u","ú":"u","û":"u","ü":"u","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","ư":"u","ǔ":"u","ǖ":"u","ǘ":"u","ǚ":"u","ǜ":"u","ȕ":"u","ȗ":"u","ṳ":"u","ṵ":"u","ṷ":"u","ṹ":"u","ṻ":"u","ụ":"u","ủ":"u","ứ":"u","ừ":"u","ử":"u","ữ":"u","ự":"u","ṽ":"v","ṿ":"v","ŵ":"w","ẁ":"w","ẃ":"w","ẅ":"w","ẇ":"w","ẉ":"w","ẘ":"w","ẋ":"x","ẍ":"x","ý":"y","ÿ":"y","ŷ":"y","ȳ":"y","ẏ":"y","ẙ":"y","ỳ":"y","ỵ":"y","ỷ":"y","ỹ":"y","ź":"z","ż":"z","ž":"z","ẑ":"z","ẓ":"z","ẕ":"z"};a=SC.diacriticMappingTable}var d,e,b="",f=g.length;for(var c=0;c<=f;++c){d=g.charAt(c);e=a[d];b+=e||d}return b},pluralize:function(g){var k,e,b=g.split(/\s/).pop(),h=g.replace(b,""),a=b.charAt(0).match(/[A-Z]/)?true:false;b=b.toLowerCase();for(k=0,e=SC.INFLECTION_CONSTANTS.UNCOUNTABLE.length;k<e;k++){var f=SC.INFLECTION_CONSTANTS.UNCOUNTABLE[k];if(b==f){return g.toString()}}for(k=0,e=SC.INFLECTION_CONSTANTS.IRREGULAR.length;k<e;k++){var c=SC.INFLECTION_CONSTANTS.IRREGULAR[k][0],j=SC.INFLECTION_CONSTANTS.IRREGULAR[k][1];if((b==c)||(b==j)){if(a){j=j.capitalize()}return h+j}}for(k=0,e=SC.INFLECTION_CONSTANTS.PLURAL.length;k<e;k++){var i=SC.INFLECTION_CONSTANTS.PLURAL[k][0],d=SC.INFLECTION_CONSTANTS.PLURAL[k][1];if(i.test(b)){return g.replace(i,d)}}},singularize:function(g){var k,e,b=g.split(/\s/).pop(),h=g.replace(b,""),a=b.charAt(0).match(/[A-Z]/)?true:false;b=b.toLowerCase();for(k=0,e=SC.INFLECTION_CONSTANTS.UNCOUNTABLE.length;k<e;k++){var f=SC.INFLECTION_CONSTANTS.UNCOUNTABLE[k];if(b==f){return g.toString()}}for(k=0,e=SC.INFLECTION_CONSTANTS.IRREGULAR.length;k<e;k++){var c=SC.INFLECTION_CONSTANTS.IRREGULAR[k][0],j=SC.INFLECTION_CONSTANTS.IRREGULAR[k][1];if((b==c)||(b==j)){if(a){c=c.capitalize()}return h+c}}for(k=0,e=SC.INFLECTION_CONSTANTS.SINGULAR.length;k<e;k++){var i=SC.INFLECTION_CONSTANTS.SINGULAR[k][0],d=SC.INFLECTION_CONSTANTS.SINGULAR[k][1];if(i.test(b)){return g.replace(i,d)}}}});SC.String.strip=SC.String.trim;sc_require("system/string");SC.supplement(String.prototype,{capitalizeEach:function(){return SC.String.capitalizeEach(this,arguments)},titleize:function(a){return SC.String.titleize(this,arguments)},classify:function(a){return SC.String.classify(this,arguments)},humanize:function(a){return SC.String.humanize(this,arguments)},escapeForRegExp:function(a){return SC.String.escapeForRegExp(this,arguments)},removeDiacritics:function(a){return SC.String.removeDiacritics(this,arguments)},trim:function(a){return SC.String.trim(this,arguments)},trimLeft:function(a){return SC.String.trimLeft(this,arguments)},trimRight:function(a){return SC.String.trimRight(this,arguments)},pluralize:function(a){return SC.String.pluralize(this,arguments)},singularize:function(a){return SC.String.singularize(this,arguments)}});SC.Gesture=SC.Object.extend({name:"gesture",touchIsInGesture:function(b,a){return NO},touchStart:function(a){},touchesDragged:function(a,b){},touchEnd:function(a){},start:function(){if(!this.get("isActive")){this.set("isActive",YES);var b=SC.$A(arguments);b.unshift(this);var a=this.name+"Start";if(this.view[a]){this.view[a].apply(this.view,b)}}},end:function(){if(this.get("isActive")){this.set("isActive",NO);var b=SC.$A(arguments);b.unshift(this);var a=this.name+"End";if(this.view[a]){this.view[a].apply(this.view,b)}}},change:function(){if(this.get("isActive")){var b=SC.$A(arguments);b.unshift(this);var a=this.name+"Changed";if(this.view[a]){this.view[a].apply(this.view,b)}}},cancel:function(){if(this.get("isActive")){this.set("isActive",NO);var b=SC.$A(arguments);b.unshift(this);var a=this.name+"Cancelled";if(this.view[a]){this.view[a].apply(this.view,b)}}},trigger:function(){var b=SC.$A(arguments);b.unshift(this);var a=this.name;if(this.view[a]){this.view[a].apply(this.view,b)}},take:function(a){a.isTaken=YES;if(SC.none(a.touchResponder)||a.touchResponder!==this){a.makeTouchResponder(this,YES)}},release:function(a){a.isTaken=NO;if(a.nextTouchResponder){a.makeTouchResponder(a.nextTouchResponder)}},discardTouch:function(a){a.isTaken=YES;a.makeTouchResponder(null)},statusForTouch:function(c){var b=SC.guidFor(c.view)+this.name;var a=c[b];if(!a){a=c[b]={}}return a},unassignedTouchDidStart:function(a){if(a.isTaken){return}if(this.touchIsInGesture(a,this.statusForTouch(a))){this.take(a)}},unassignedTouchesDidChange:function(a,b){b.forEach(function(c){if(c.isTaken){return}if(this.touchIsInGesture(c,this.statusForTouch(c))){this.take(c)}},this)},unassignedTouchDidEnd:function(a){},interestedInTouch:function(b){var a=this.statusForTouch(b);if(a.isInterested){return}a.isInterested=YES;b.isInteresting++},uninterestedInTouch:function(b){var a=this.statusForTouch(b);if(!a.isInterested){return}a.isInterested=NO;b.isInteresting--}});sc_require("system/gesture");SC.PinchGesture=SC.Gesture.extend({name:"pinch",acceptsMultitouch:YES,scale:1,unassignedTouchesDidChange:function(a,b){if(b.length==2){this.take(b[0]);this.take(b[1])}},touchStart:function(b){var a=b.touchesForResponder(this);if(!a||a.length===0){return YES}else{if(a.length==1){this.start([a[0],b]);return YES}else{return NO}}},touchesDragged:function(a,c){var d=c.firstObject(),b=d.averagedTouchesForView(this);if(b.touchCount==2){if(!this._startDistance){this._startDistance=b.d}this.scale=b.d/this._startDistance;this.change(c,this.scale)}},touchEnd:function(b){this._startDistance=null;var a=b.touchesForResponder(this);this.trigger(a,this.scale);this.end(a,this.scale);if(a){a.forEach(function(c){this.release(c)},this)}}});sc_require("system/gesture");SC.SWIPE_HORIZONTAL="X";SC.SWIPE_VERTICAL="Y";SC.SWIPE_ANY="XY";SC.SWIPE_LEFT="LEFT";SC.SWIPE_RIGHT="RIGHT";SC.SWIPE_UP="UP";SC.SWIPE_DOWN="DOWN";SC.SwipeGesture=SC.Gesture.extend({name:"swipe",acceptsMultitouch:YES,direction:SC.SWIPE_HORIZONTAL,currentDirection:null,startDistance:5,swipeDistance:40,tolerance:0.5,touchIsInGesture:function(i,g){if(!g.flunked){var j=this.get("direction"),e=this.get("currentDirection"),a=this.get("startDistance"),h=i.pageX-i.startX,f=i.pageY-i.startY,c=Math.abs(h),b=Math.abs(f);if(Math.abs(h)>a||Math.abs(f)>a){if(!e){if(j==SC.SWIPE_ANY){if(c>b){e=SC.SWIPE_HORIZONTAL}else{if(b>c){e=SC.SWIPE_VERTICAL}else{return NO}}}else{e=j}this.set("currentDirection",e)}var l=(e==SC.SWIPE_HORIZONTAL)?h:f,k=(e==SC.SWIPE_HORIZONTAL)?f:h;if(Math.abs(l)*this.get("tolerance")>Math.abs(k)){return YES}}}return NO},touchStart:function(e){var b=this.get("currentDirection"),c=e["page"+b]-e["start"+b],a;if(c<0){a=(b===SC.SWIPE_HORIZONTAL)?SC.SWIPE_LEFT:SC.SWIPE_UP}else{a=(b===SC.SWIPE_HORIZONTAL)?SC.SWIPE_RIGHT:SC.SWIPE_DOWN}this.start(e,a,c);return YES},touchesDragged:function(j,e){var c=e.firstObject();var f=this.get("currentDirection"),a=(f===SC.SWIPE_HORIZONTAL?"Y":"X"),i=c["page"+f]-c["start"+f],g=c["page"+a]-c["start"+a],h;if(i<0){h=(f===SC.SWIPE_HORIZONTAL)?SC.SWIPE_LEFT:SC.SWIPE_UP}else{h=(f===SC.SWIPE_HORIZONTAL)?SC.SWIPE_RIGHT:SC.SWIPE_DOWN}if(Math.abs(i)<this.get("startDistance")||Math.abs(i)*this.get("tolerance")<Math.abs(g)){this.release(c);var b=c.touchesForResponder(this);if(!b||b.length===0){this.cancel(c,h,i)}}else{this.change(c,h,i)}},touchEnd:function(h){var f=this.get("currentDirection"),e=(f===SC.SWIPE_HORIZONTAL?"Y":"X"),g=h["page"+f]-h["start"+f],b=h["page"+e]-h["start"+e],a;if(g<0){a=(f===SC.SWIPE_HORIZONTAL)?SC.SWIPE_LEFT:SC.SWIPE_UP}else{a=(f===SC.SWIPE_HORIZONTAL)?SC.SWIPE_RIGHT:SC.SWIPE_DOWN}if(Math.abs(g)>this.get("swipeDistance")||Math.abs(g)*this.get("tolerance")<Math.abs(b)){this.trigger(h,a)}this.end(h,a,g);this.set("currentDirection",null);var c=h.touchesForResponder(this);if(c){c.forEach(function(d){this.release(d)},this)}},cancel:function(){arguments.callee.base.apply(this,arguments);this.set("currentDirection",null)}});sc_require("system/gesture");SC.TapGesture=SC.Gesture.extend({name:"tap",acceptsMultitouch:NO,_tapCount:null,_candidateTouch:null,_eventTimer:null,tapWiggle:10,tapDelay:200,touchIsInGesture:function(b,a){return !b.tapFlunked},touchStart:function(a){if(this._eventTimer){this._eventTimer.invalidate()}if(this._candidateTouch&&this._candidateTouch.touch.identifier!==a.identifier){this._cancelTap(a);return NO}this._candidateTouch={startTime:Date.now(),touch:a};this.start(a);return YES},touchesDragged:function(a,c){var e=c[0];var b=(c.length>1||!this._candidateTouch||e.identifier!==this._candidateTouch.touch.identifier);var d=this._calculateDragDistance(e)>this.get("tapWiggle");if(b||d){this._cancelTap(e)}},touchEnd:function(a){if(this._calculateDragDistance(a)>this.get("tapWiggle")||Date.now()-this._candidateTouch.startTime>this.get("tapDelay")){this._cancelTap(a)}else{this._addTap(a)}},_addTap:function(b){var a=this;if(this._eventTimer){this._eventTimer.invalidate()}this._tapCount=(this._tapCount||0)+1;this._candidateTouch=null;this._eventTimer=SC.Timer.schedule({target:a,action:function(){this._triggerTap(b)},interval:this.get("tapDelay")});this.change(b,this._tapCount);this.trigger(b,this._tapCount)},_cancelTap:function(a){a.tapFlunked=YES;this.release(a);this.cancel(a,this._tapCount);if(this._eventTimer){this._eventTimer.invalidate()}this._tapCount=null;this._candidateTouch=null;this._eventTimer=null},_triggerTap:function(a){this.end(a,this._tapCount);this._tapCount=null;this._candidateTouch=null;this._eventTimer=null},_calculateDragDistance:function(a){return Math.sqrt(Math.pow(a.pageX-a.startX,2)+Math.pow(a.pageY-a.startY,2))}});SC.AutoMixin={autoMixins:[],createChildView:function(b,c){if(!c){c={}}c.owner=c.parentView=this;c.isVisibleInWindow=this.get("isVisibleInWindow");if(!c.page){c.page=this.page}var a=this.get("autoMixins");a.push(c);b=b.create.apply(b,a);return b}};SC.mixin({_copy_computed_props:["maxWidth","maxHeight","paddingLeft","paddingRight","paddingTop","paddingBottom","fontFamily","fontSize","fontStyle","fontWeight","fontVariant","lineHeight","whiteSpace","letterSpacing","wordWrap"],stringFromLayout:function(e){var d=["maxHeight","maxWidth","minHeight","minWidth","centerY","centerX","width","height","bottom","right","top","left","zIndex","opacity","border","borderLeft","borderRight","borderTop","borderBottom"],a=[],c,b=d.length;while(--b>=0){c=d[b];if(e.hasOwnProperty(c)){a.push(c+":"+e[c])}}return"{"+a.join(", ")+"}"},heightForString:function(h,c,b,a,g){var e=this._heightCalcElement,f,i;if(!g){h=SC.RenderContext.escapeHTML(h)}f=(a&&SC.typeOf(a)===SC.T_ARRAY)?a.join(" "):"";if(!c){c=100}if(!e){e=this._heightCalcElement=document.createElement("div");document.body.insertBefore(e,null)}b=b+"; width: "+c+"px; left: "+(-1*c)+"px; position: absolute";var d=SC.$(e);d.attr("style",b);if(f!==""){d.attr("class",f)}e.innerHTML=h;i=e.clientHeight;e=null;return i},prepareStringMeasurement:function(o,a){var k=this._metricsCalculationElement,h,p,c,d;h=SC.A(a).join(" ");if(!k){var n=document.createElement("div");n.style.cssText="position:absolute; left:-10010px; top:-10px;width:10000px; height:0px; overflow:hidden;visibility:hidden;";k=this._metricsCalculationElement=document.createElement("div");n.appendChild(k);document.body.insertBefore(n,null)}d=SC.$(k);if(SC.typeOf(o)!=SC.T_STRING){var g=null;if(document.defaultView&&document.defaultView.getComputedStyle){g=document.defaultView.getComputedStyle(o,null)}else{g=o.currentStyle}var m=this._copy_computed_props;for(var j=0;j<m.length;j++){var b=m[j],f=g[b];k.style[b]=f}var l=k.style;if(l.font===""){var e="";if(l.fontStyle){e+=l.fontStyle+" "}if(l.fontVariant){e+=l.fontVariant+" "}if(l.fontWeight){e+=l.fontWeight+" "}if(l.fontSize){e+=l.fontSize}else{e+="10px"}if(l.lineHeight){e+="/"+l.lineHeight}e+=" ";if(l.fontFamily){e+=l.fontFamily}else{l+="sans-serif"}k.style.font=e}SC.mixin(k.style,{left:"0px",top:"0px",position:"absolute",bottom:"auto",right:"auto",width:"auto",height:"auto"});g=null}else{c=o;d.attr("style",c+"; position:absolute; left: 0px; top: 0px; bottom: auto; right: auto; width: auto; height: auto;")}k.className=h;k=null},teardownStringMeasurement:function(){var a=this._metricsCalculationElement;a.innerHTML="";a.className="";a.setAttribute("style","");a=null},measureString:function(c,b){var d=this._metricsCalculationElement,e=0;if(!d){throw"measureString requires a string measurement environment to be set up. Did you mean metricsForString?"}if(b){d.innerHTML=c}else{if(typeof d.innerText!="undefined"){d.innerText=c}else{d.textContent=c}}if(SC.browser.isIE){e=1}var a={width:d.clientWidth+e,height:d.clientHeight};if(SC.browser.isMozilla){a.width+=1}d=null;return a},metricsForString:function(c,d,e,b){SC.prepareStringMeasurement(d,e);var a=SC.measureString(c,b);SC.teardownStringMeasurement();return a}});sc_require("system/utils/string_measurement");SC.AutoResize={shouldAutoResize:YES,shouldMeasureSize:YES,shouldCacheSizes:NO,shouldResizeWidth:YES,shouldResizeHeight:NO,measuredSize:{width:0,height:0},maxWidth:null,maxHeight:null,shouldAutoFitText:NO,autoFitDiscreteFontSizes:NO,minFontSize:12,maxFontSize:20,calculatedFontSize:20,fontPropertyDidChange:function(){if(this.get("shouldAutoFitText")){this.invokeLast(this.fitTextToFrame)}}.observes("shouldAutoFitText","minFontSize","maxFontSize","measuredSize"),measuredSizeDidChange:function(){var c=this.get("measuredSize"),b=c.width,h=c.height,g,a,d=this.get("autoResizePadding")||0,f=this.get("maxWidth"),e=this.get("maxHeight");if(SC.typeOf(d)===SC.T_NUMBER){g=a=d}else{g=d.height;a=d.width}h+=g;b+=a;if(this.get("shouldAutoResize")){if(this.get("shouldResizeWidth")){if(f&&b>f){b=f}this.set("calculatedWidth",b);this.adjust("width",b)}if(this.get("shouldResizeHeight")){if(e&&h>e){h=e}this.set("calculatedHeight",h);this.adjust("height",h)}}}.observes("shouldAutoResize","measuredSize","autoResizePadding","maxWidth","minWidth","shouldResizeWidth","shouldResizeHeight"),initMixin:function(){},batchResizeId:null,scheduleMeasurement:function(){var a=this.get("batchResizeId");if(!this.get("shouldMeasureSize")||!this.get("isVisibleInWindow")||(this.get("autoResizeText")===this._lastMeasuredText&&a===this._lastMeasuredId)){return}SC.AutoResizeManager.scheduleMeasurementForView(this,a)}.observes("isVisibleInWindow","shouldMeasureSize","autoResizeText","batchResizeId"),_lastMeasuredText:null,_cachedMetrics:function(c,d){if(!this.get("shouldCacheSizes")){return}var b=SC.cacheSlotFor(this.get("batchResizeId")||this),a=this.get("autoResizeText");if(d){b[a]=d}else{d=b[a]}return d}.property("shouldCacheSizes","autoResizeText","batchResizeId").cacheable(),measureSize:function(d){var h,e=this.get("autoResizeLayer"),c=this.get("autoResizeText"),b=!this.get("escapeHTML"),g=this.get("batchResizeId"),a=this.get("_cachedMetrics"),f=this.get("maxFontSize");if(!e){return}if(a){h=a}else{if(SC.none(c)||c===""){h={width:0,height:0}}else{if(d){h=SC.measureString(c,b)}else{this.prepareLayerForStringMeasurement(e);h=SC.metricsForString(c,e,this.get("classNames"),b)}}}this.set("measuredSize",h);if(this.get("shouldCacheSizes")){this.setIfChanged("_cachedMetrics",h)}this._lastMeasuredText=c;this._lastMeasuredId=g;return h},prepareLayerForStringMeasurement:function(a){var b=this.get("maxFontSize");if(this.get("shouldAutoFitText")&&this.get("calculatedFontSize")!==b){a.style.fontSize=b+"px"}},viewDidResize:function(a){a();this.fontPropertyDidChange()}.enhance(),fitTextToFrame:function(){var q=this.get("autoResizeLayer");if(!q){return}var c=this.get("maxFontSize"),d=this.get("minFontSize");this.prepareLayerForStringMeasurement(q);var e=this.get("frame"),f=this.get("autoResizePadding")||0,j=e.width-1,g=e.height-1,p=this.get("measuredSize"),a=p.width,r=p.height;if(SC.typeOf(f)===SC.T_NUMBER){j-=f;g-=f}else{j-=f.width;g-=f.height}if(a<=j&&r<=g){return}if(this.get("autoFitDiscreteFontSizes")){h=d}else{var b=j/a,i=g/r,l=Math.floor(c*Math.min(b,i)),h,o=this.get("classNames"),n=!this.get("escapeHTML"),k=this.get("autoResizeText"),m;l=h=Math.min(c,Math.max(d,l));q.style.fontSize=l+"px";m=SC.metricsForString(k,q,o,n);if(m.width>j||m.height>g){for(l=l-1;l>=d;l--){q.style.fontSize=l+"px";m=SC.metricsForString(k,q,o,n);h=l;if(m.width<=j&&m.height<=g){break}}}else{if(m.width<j||m.height<g){for(l=l+1;l<=c;l++){q.style.fontSize=l+"px";m=SC.metricsForString(k,q,o,n);if(m.width<=j&&m.height<=g){h=l}if(m.width>=j||m.height>=g){break}}}}}q.style.fontSize=h+"px";this.set("calculatedFontSize",h)},applyAttributesToContext:function(b,a){b(a);if(this.get("shouldAutoFitText")){a.css("font-size",this.get("calculatedFontSize")+"px")}}.enhance(),didCreateLayer:function(a){a();this.scheduleMeasurement()}.enhance()};SC.AutoResizeManager={measurementQueue:SC.CoreSet.create(),scheduleMeasurementForView:function(a){this.measurementQueue.add(a);SC.RunLoop.currentRunLoop.invokeLast(this.doBatchResize)},cancelMeasurementForView:function(a,b){this.measurementQueue.remove(a)},doBatchResize:function(){if(this!==SC.AutoResizeManager){return SC.AutoResizeManager.doBatchResize()}var b,d,f,g=this.measurementQueue,h,c,e,a;while((a=g.get("length"))>0){h=NO;b=g[a-1].get("batchResizeId");for(e=a-1;e>=0;--e){d=g[e];if(d.get("batchResizeId")!==b){continue}if(d.get("isVisibleInWindow")&&d.get("shouldMeasureSize")&&(f=d.get("autoResizeLayer"))){c=d.get("autoResizeText");if(!SC.none(c)&&c!==""&&!d.get("_cachedMetrics")&&!h){d.prepareLayerForStringMeasurement(f);SC.prepareStringMeasurement(f,d.get("classNames"));h=YES}d.measureSize(YES)}g.remove(d);if(!b){break}}if(h){SC.teardownStringMeasurement()}}}};if(SC.Button){SC.Button.initMixin=function(){throw"SC.Button is deprecated as a mixin and is now a subclass of SC.TemplateView. Subclass SC.ButtonView instead."}}SC.ContentDisplay={concatenatedProperties:"contentDisplayProperties",displayProperties:["content"],contentDisplayProperties:[],initMixin:function(){this._display_contentDidChange()},destroyMixin:function(){if(!this._display_content){return}this._display_stopObservingContent(this._display_content);this._display_content=null},_display_beginObservingContent:function(a){var b=this._display_contentPropertyDidChange;if(SC.isArray(a)){a.invoke("addObserver","*",this,b)}else{if(a.addObserver){a.addObserver("*",this,b)}}},_display_stopObservingContent:function(a){var b=this._display_contentPropertyDidChange;if(SC.isArray(a)){a.invoke("removeObserver","*",this,b)}else{if(a.removeObserver){a.removeObserver("*",this,b)}}},_display_contentDidChange:function(d,a,c){if((c=this.get("content"))===this._display_content){return}var b=this._display_content;if(b){this._display_stopObservingContent(b)}b=this._display_content=c;if(b){this._display_beginObservingContent(b)}this.displayDidChange()}.observes("content","contentDisplayProperties"),_display_contentPropertyDidChange:function(e,c,d,b){if(c==="*"){this.displayDidChange()}else{var a=this.get("contentDisplayProperties");if(a&&a.indexOf(c)>=0){this.displayDidChange()}}}};SC.ContentValueSupport={hasContentValueSupport:YES,initMixin:function(){this._control_contentKeysDidChange()},value:null,content:null,contentKeys:null,_default_contentKeys:{contentValueKey:"value"},contentValueKey:null,contentPropertyDidChange:function(c,b){var a=this.get("contentKeys");if(a){var d;for(d in a){if(b==="*"||b===this.getDelegateProperty(d,this,this.get("displayDelegate"),a)){return this.updatePropertyFromContent(a[d],b,d,c)}}}else{return this.updatePropertyFromContent("value",b,"contentValueKey",c)}},updatePropertyFromContent:function(f,c,e,d){var a,b;if(e===undefined){e="content"+f.capitalize()+"Key"}if(this[e]){e=this.get(e)}else{if((a=this.get("displayDelegate"))&&(b=a[e])){e=a.get?a.get(e):b}else{return this}}if(c==="*"||c===e){if(d===undefined){d=this.get("content")}if(d){b=d.get?d.get(e):d[e]}else{b=null}this.setIfChanged(f,b)}return this},updateContentWithValueObserver:function(d,a){var f=this._reverseContentKeys;if(!a||a==="*"){for(a in f){this.updateContentWithValueObserver(this,a)}}var c=this.get(a);var b=this.get("content"),e=this.getDelegateProperty(f[a],this,this.displayDelegate);if(!e||!b){return this}if(typeof b.setIfChanged===SC.T_FUNCTION){b.setIfChanged(e,c)}else{if(b[e]!==c){b[e]=c}}},_control_content:null,_old_contentValueKeys:null,_old_contentKeys:null,_control_contentDidChange:function(h,l){var j=this.get("content"),b=this.get("contentKeys"),a,c=this._control_content,m=this._old_contentValueKeys,k=SC.typeOf(m),g=this.contentPropertyDidChange;if(c&&c.removeObserver&&m){if(k===SC.T_STRING){c.removeObserver(m,this,g);m=null}else{var d,e=m.get("length");for(d=0;d<e;d++){a=m[d];c.removeObserver(a,this,g)}m.clear()}}if(j&&j.addObserver){if(b){if(!m){m=SC.CoreSet.create()}for(a in b){a=this.getDelegateProperty(a,this,this.get("displayDelegate"));if(a){j.addObserver(a,this,g);m.add(a)}}}else{a=this.getDelegateProperty("contentValueKey",this,this.get("displayDelegate"));if(a){j.addObserver(a,this,g);if(m){m.add(a)}else{m=a}}}}this._control_content=j;this._old_contentValueKeys=m;l=(!l||l==="content")?"*":this.get(l);if(l){this.contentPropertyDidChange(j,l)}}.observes("content"),_old_contentKeys:null,_control_contentKeysDidChange:function(){var d,c={},a=this.get("contentKeys")||this._default_contentKeys,h,b=this._old_contentKeys,g=this._control_contentDidChange,e=this.updateContentWithValueObserver;for(d in b){h=b[d];this.removeObserver(h,this,e);this.removeObserver(d,this,g)}for(d in a){h=a[d];c[h]=d;this.addObserver(h,this,e);this.addObserver(d,this,g)}this._reverseContentKeys=c;this._old_contentKeys=a;this._control_contentDidChange()}.observes("contentKeys")};sc_require("mixins/content_value_support");sc_require("system/string");SC.AUTO_CONTROL_SIZE="__AUTO__";SC.JUMBO_CONTROL_SIZE="sc-jumbo-size";SC.HUGE_CONTROL_SIZE="sc-huge-size";SC.LARGE_CONTROL_SIZE="sc-large-size";SC.REGULAR_CONTROL_SIZE="sc-regular-size";SC.SMALL_CONTROL_SIZE="sc-small-size";SC.TINY_CONTROL_SIZE="sc-tiny-size";SC.Control=SC.mixin(SC.clone(SC.ContentValueSupport),{isControl:YES,isSelected:NO,isSelectedBindingDefault:SC.Binding.oneWay().bool(),isActive:NO,isActiveBindingDefault:SC.Binding.oneWay().bool(),fieldKey:null,fieldLabel:null,errorLabel:function(){var a,d,c,b;if(a=this.get("fieldLabel")){return a}d=this.get("fieldKey")||this.constructor.toString();c=d?SC.String.capitalize(SC.String.humanize(d)):"";b=SC.String.locWithDefault("FieldKey."+d,c);return SC.String.locWithDefault("ErrorLabel."+d,b)}.property("fieldLabel","fieldKey").cacheable(),controlSize:SC.REGULAR_CONTROL_SIZE,displayProperties:["isEnabled","isSelected","isActive","controlSize"],_CONTROL_TMP_CLASSNAMES:{},renderMixin:function(b,g){var d=this.get("isSelected"),c=!this.get("isEnabled"),e=this._CONTROL_TMP_CLASSNAMES;e.mixed=d===SC.MIXED_STATE;e.sel=d&&(d!==SC.MIXED_STATE);e.active=this.get("isActive");var f=this.get("controlSize");if(!f){f=SC.REGULAR_CONTROL_SIZE}if(g){b.setClass(e);if(!this.get("renderDelegate")){b.addClass(f)}}else{b.$().setClass(e);if(!this.get("renderDelegate")){b.$().addClass(f)}}if(!g&&this.$input){var a=this.$input();if(a.attr("type")!=="radio"){this.$input().attr("disabled",c)}}}});SC.Editable={isEditable:NO,isEditing:NO,beginEditing:function(){if(!this.get("isEditable")){return NO}if(this.get("isEditing")){return YES}this.beginPropertyChanges();this.set("isEditing",YES);this.becomeFirstResponder();this.endPropertyChanges();return YES},discardEditing:function(){return !this.get("isEditing")},commitEditing:function(){if(!this.get("isEditing")){return YES}this.set("isEditing",NO);this.resignFirstResponder();return YES}};SC.ALIGN_JUSTIFY="justify";SC.FlowedLayout={isFlowedLayout:YES,layoutDirection:SC.LAYOUT_HORIZONTAL,autoResize:YES,shouldResizeWidth:YES,shouldResizeHeight:YES,align:SC.ALIGN_LEFT,canWrap:YES,defaultFlowSpacing:{left:0,bottom:0,top:0,right:0},flowPadding:{left:0,bottom:0,right:0,top:0},_scfl_validFlowPadding:function(){var b=this.get("flowPadding")||{},a={};a.left=b.left||0;a.top=b.top||0;a.bottom=b.bottom||0;a.right=b.right||0;return a}.property("flowPadding").cacheable(),concatenatedProperties:["childMixins"],initMixin:function(){this._scfl_tileOnce()},_scfl_childViewsDidChange:function(a){this._scfl_tileOnce()}.observes("childViews"),_scfl_layoutPropertyDidChange:function(a){this._scfl_tileOnce()}.observes("layoutDirection","align","flowPadding","canWrap","defaultFlowSpacing","isVisibleInWindow"),layoutDidChangeFor:function(g){var b=g._scfl_lastLayout,a=g.get("layout"),d=g.get("frame");if(!b){return arguments.callee.base.apply(this,arguments)}var e=YES;if(b.left&&b.left!==a.left){e=NO}else{if(b.top&&b.top!==a.top){e=NO}else{if(!g.get("fillWidth")&&b.width&&b.width!==a.width){e=NO}else{if(!b.width&&!g.get("fillWidth")&&d.width!==g._scfl_lastFrame.width){e=NO}else{if(!g.get("fillHeight")&&b.height&&b.height!==a.height){e=NO}else{if(!b.height&&!g.get("fillHeight")&&d.height!==g._scfl_lastFrame.height){e=NO}}}}}}if(e){return arguments.callee.base.apply(this,arguments)}this._scfl_tileOnce();arguments.callee.base.apply(this,arguments)},observeChildLayout:function(a){if(a._scfl_isBeingObserved){return}a._scfl_isBeingObserved=YES;a.addObserver("flowSpacing",this,"_scfl_tileOnce");a.addObserver("isVisible",this,"_scfl_tileOnce");a.addObserver("useAbsoluteLayout",this,"_scfl_tileOnce");a.addObserver("calculatedWidth",this,"_scfl_tileOnce");a.addObserver("calculatedHeight",this,"_scfl_tileOnce");a.addObserver("startsNewRow",this,"_scfl_tileOnce");a.addObserver("isSpacer",this,"_scfl_tileOnce");a.addObserver("maxSpacerLength",this,"_scfl_tileOnce");a.addObserver("fillWidth",this,"_scfl_tileOnce");a.addObserver("fillHeight",this,"_scfl_tileOnce")},unobserveChildLayout:function(a){a._scfl_isBeingObserved=NO;a.removeObserver("flowSpacing",this,"_scfl_tileOnce");a.removeObserver("isVisible",this,"_scfl_tileOnce");a.removeObserver("useAbsoluteLayout",this,"_scfl_tileOnce");a.removeObserver("calculatedWidth",this,"_scfl_tileOnce");a.removeObserver("calculatedHeight",this,"_scfl_tileOnce");a.removeObserver("startsNewRow",this,"_scfl_tileOnce");a.removeObserver("isSpacer",this,"_scfl_tileOnce");a.removeObserver("maxSpacerLength",this,"_scfl_tileOnce");a.removeObserver("fillWidth",this,"_scfl_tileOnce");a.removeObserver("fillHeight",this,"_scfl_tileOnce")},shouldIncludeChildInFlow:function(a,b){return b.get("isVisible")&&!b.get("useAbsoluteLayout")},flowSpacingForChild:function(a,b){var c=b.get("flowSpacing");if(SC.none(c)){c=this.get("defaultFlowSpacing")}if(SC.none(c)){c=0}if(SC.typeOf(c)===SC.T_NUMBER){c={left:c,right:c,bottom:c,top:c}}else{c.left=c.left||0;c.right=c.right||0;c.top=c.top||0;c.bottom=c.bottom||0}return c},flowSizeForChild:function(a,d){var c=d.get("calculatedWidth"),g=d.get("calculatedHeight"),i=this.get("layoutDirection"),e={},h=d.get("frame"),b=d.get("layout");d._scfl_lastFrame=h;if(c){e.width=c}else{e.width=b.width||h.width}if(g){e.height=g}else{e.height=b.height||h.height}if(d.get("isSpacer")){e.maxSpacerLength=d.get("maxSpacerLength");if(i===SC.LAYOUT_HORIZONTAL){e.width=b.minWidth||0}else{e.height=b.minHeight||0}}if(i===SC.LAYOUT_HORIZONTAL&&d.get("fillHeight")){e.height=b.minHeight||0}else{if(i===SC.LAYOUT_VERTICAL&&d.get("fillWidth")){e.width=b.minWidth||0}}return e},clippingFrame:function(){return{left:0,top:0,width:this.get("calculatedWidth"),height:this.get("calculatedHeight")}}.property("calculatedWidth","calculatedHeight"),_scfl_maxCollapsedRowLength:0,_scfl_totalCollapsedRowSize:0,_scfl_calculatedSizeDidChange:function(){if(this.get("autoResize")){if(this.get("layoutDirection")==SC.LAYOUT_VERTICAL){if(this.get("shouldResizeHeight")){this.adjust("minHeight",this.get("_scfl_maximumCollapsedRowLength"))}if(this.get("shouldResizeWidth")){this.adjust("minWidth",this.get("_scfl_totalCollapsedRowSize"))}}else{if(this.get("shouldResizeWidth")){this.adjust("minWidth",this.get("_scfl_maximumCollapsedRowLength"))}if(this.get("shouldResizeHeight")){this.adjust("minHeight",this.get("_scfl_totalCollapsedRowSize"))}}}}.observes("autoResize","shouldResizeWidth","_scfl_maximumCollapsedRowLength","_scfl_totalCollapsedRowSize","shouldResizeHeight"),_scfl_createPlan:function(){var e=this.get("layoutDirection"),a=this.get("_scfl_validFlowPadding"),d=this.get("frame");var c=(e===SC.LAYOUT_VERTICAL);var b={rows:undefined,maximumCollapsedRowLength:0,totalCollapsedRowSize:0,isVertical:e===SC.LAYOUT_VERTICAL,isHorizontal:e===SC.LAYOUT_HORIZONTAL,flowPadding:a,planStartPadding:a[c?"left":"top"],planEndPadding:a[c?"right":"bottom"],rowStartPadding:a[c?"top":"left"],rowEndPadding:a[c?"bottom":"right"],maximumRowLength:undefined,fitToPlanSize:undefined,align:this.get("align")};if(c){b.maximumRowLength=d.height-b.rowStartPadding-b.rowEndPadding;b.fitToPlanSize=d.width-b.planStartPadding-b.planEndPadding}else{b.maximumRowLength=d.width-b.rowStartPadding-b.rowEndPadding;b.fitToPlanSize=d.height-b.planStartPadding-b.planEndPadding}return b},_scfl_distributeChildrenIntoRows:function(d){var b=this.get("childViews"),a,g,c=b.length,e=d.isVertical,i=[],f;f=-1;g=0;while(g<c&&g!==f){f=g;var h={plan:d,rowLength:undefined,rowSize:undefined,shouldExpand:undefined,items:undefined,position:undefined};g=this._scfl_distributeChildrenIntoRow(b,g,h);i.push(h)}d.rows=i},_scfl_distributeChildrenIntoRow:function(e,m,i){var o,t=e.length,b=i.plan,g,a,d,p=[],k=0,l=b.isVertical,j,f,c,n=this.get("canWrap"),h=NO,q=0,s=i.plan.maximumRowLength;for(o=m;o<t;o++){g=e[o];h=h||(p.length>0&&g.get("startsNewRow"));if(!this.shouldIncludeChildInFlow(o,g)){continue}a=this.flowSizeForChild(o,g);d=this.flowSpacingForChild(o,g);a.width+=d.left+d.right;a.height+=d.top+d.bottom;f=a[l?"height":"width"];if(!SC.none(a.maxSpacerLength)){c=a.maxSpacerLength+(l?d.top+d.bottom:d.left+d.right)}j=a[l?"width":"height"];if((h||(n&&k+f>s))&&p.length>0){break}var u={child:g,itemLength:f,maxSpacerLength:c,itemSize:j,spacing:d,position:undefined,fillRow:l?g.get("fillWidth"):g.get("fillHeight"),isSpacer:g.get("isSpacer"),left:undefined,top:undefined,width:undefined,height:undefined};p.push(u);k+=f;q=Math.max(f,q)}i.rowLength=k;var r=n?q:i.rowLength;i.plan.maximumCollapsedRowLength=Math.max(r,i.plan.maximumCollapsedRowLength);i.items=p;return o},_scfl_positionChildrenInRows:function(d){var c=d.rows,b=c.length,a;for(a=0;a<b;a++){this._scfl_positionChildrenInRow(c[a])}},_scfl_positionChildrenInRow:function(m){var g=m.items,e=g.length,j,l,d,k=0,a=0,c,f=m.plan.align,i=YES,b=0,h=NO;for(j=0;j<e;j++){l=g[j];if(l.isSpacer){a+=l.child.get("spaceUnits")||1}}if(f===SC.ALIGN_JUSTIFY){a+=e-1}c=Math.max(0,m.plan.maximumRowLength-m.rowLength)/a;while(c>0){for(j=0;j<e;j++){l=g[j];if(l.isSpacer){l.itemLength+=c*(l.child.get("spaceUnits")||1);if(l.itemLength>l.maxSpacerLength){b+=l.itemLength-l.maxSpacerLength;l.itemLength=l.maxSpacerLength}else{h=YES}}}if(!h){break}c=Math.round(b/a);b=0}d=0;if(a===0&&(f===SC.ALIGN_RIGHT||f===SC.ALIGN_BOTTOM)){d=m.plan.maximumRowLength-m.rowLength}else{if(a===0&&(f===SC.ALIGN_CENTER||f===SC.ALIGN_MIDDLE)){d=(m.plan.maximumRowLength/2)-(m.rowLength/2)}}d+=m.plan.rowStartPadding;for(j=0;j<e;j++){l=g[j];if(!l.fillRow){i=NO}k=Math.max(l.itemSize,k);l.position=d;d+=l.itemLength;if(f===SC.ALIGN_JUSTIFY&&j<e-1){d+=c}}m.shouldExpand=e>0?i:NO;m.rowLength=d-m.plan.rowStartPadding;m.rowSize=k;m.plan.totalCollapsedRowSize+=m.rowSize},_scfl_positionRows:function(d){var i=d.rows,c=i.length,f,h,b,a=0,g=0,e;for(f=0;f<c;f++){if(i[f].shouldExpand){a++}g+=i[f].rowSize}e=d.fitToPlanSize-g;b=d.planStartPadding;for(f=0;f<c;f++){h=i[f];if(h.shouldExpand&&e>0){h.rowSize+=e/a;a--}h.position=b;b+=h.rowSize}},_scfl_applyPlan:function(h){var n=h.rows,b,c,m,e=0,j=0,g,a,d,l,f,k,i=h.isVertical;c=n.length;for(b=0;b<c;b++){m=n[b];e=Math.max(e,m.rowLength);j+=m.rowSize;g=m.items;d=g.length;for(a=0;a<d;a++){l=g[a];l.child.beginPropertyChanges();k=l.fillRow?m.rowSize:l.itemSize;f={left:l.spacing.left+(i?m.position:l.position),top:l.spacing.top+(i?l.position:m.position),width:i?k:l.itemLength,height:i?l.itemLength:k};f.width-=l.spacing.left+l.spacing.right;f.height-=l.spacing.top+l.spacing.bottom;this.applyPlanToView(l.child,f);l.child._scfl_lastLayout=f;l.child.endPropertyChanges()}}j+=h.planStartPadding+h.planEndPadding;e+=h.rowStartPadding+h.rowEndPadding;this.beginPropertyChanges();this.set("calculatedHeight",i?e:j);this.set("calculatedWidth",i?j:e);this.set("_scfl_maximumCollapsedRowLength",h.maximumCollapsedRowLength);this.set("_scfl_totalCollapsedRowSize",h.totalCollapsedRowSize);this.endPropertyChanges()},applyPlanToView:function(a,b){a.adjust(b)},_scfl_tileOnce:function(){this.invokeLast(this._scfl_tile)},_scfl_tile:function(){if(!this.get("isVisibleInWindow")){return}var f=this._scfl_createPlan();this._scfl_distributeChildrenIntoRows(f);this._scfl_positionChildrenInRows(f);this._scfl_positionRows(f);this._scfl_applyPlan(f);this.setIfChanged("numberOfRows",f.rows.length);var d=this._scfl_isObserving||SC.CoreSet.create(),c=SC.CoreSet.create();var e=this.get("childViews"),b=e.length,a,g;for(a=0;a<b;a++){g=e[a];if(!d.contains(g)){this.observeChildLayout(g)}else{d.remove(g)}c.add(g)}b=d.length;for(a=0;a<b;a++){this.unobserveChildLayout(d[a])}},_scfl_frameDidChange:function(){var b=this.get("frame"),a=this._scfl_lastFrameSize||{};this._scfl_lastFrameSize=SC.clone(b);if(a.width==b.width&&a.height==b.height){return}this._scfl_tileOnce()}.observes("frame"),destroyMixin:function(){var c=this._scfl_isObserving;if(!c){return}var b=c.length,a;for(a=0;a<b;a++){this.unobserveChildLayout(c[a])}},reorder:function(b){if(!SC.typeOf(b)===SC.T_ARRAY){b=arguments}var c=b.length,d=this.childViews,a;this.beginPropertyChanges();while(c-->0){a=b[c];if(SC.typeOf(a)===SC.T_STRING){a=this.get(a)}d.removeObject(a);d.unshiftObject(a)}this.endPropertyChanges();this._scfl_childViewsDidChange();return this}};SC.Gesturable={concatenatedProperties:["gestures"],gestures:[],initMixin:function(){this.createGestures()},createGestures:function(){var e=this.get("gestures"),b,a=e.length,c,d=[];for(b=0;b<a;b++){if(SC.typeOf(e[b])===SC.T_STRING){c=this.get(e[b])}else{c=e[b]}if(!c){throw"Could not find gesture named '"+e[b]+"' on view."}if(c.isClass){c=c.create({view:this})}if(SC.typeOf(e[b])===SC.T_STRING){this[e[b]]=c}d.push(c)}this.set("gestures",d)},touchStart:function(a){this.gestureTouchStart(a)},touchesDragged:function(a,b){this.gestureTouchesDragged(a,b)},touchEnd:function(a){this.gestureTouchEnd(a)},gestureTouchStart:function(e){e.isInteresting=0;var d=this.get("gestures"),b,a=d.length,c;for(b=0;b<a;b++){c=d[b];c.unassignedTouchDidStart(e)}},gestureTouchesDragged:function(c,e){var f=this.get("gestures"),b,a=f.length,d;for(b=0;b<a;b++){d=f[b];d.unassignedTouchesDidChange(c,e)}},gestureTouchEnd:function(e){var d=this.get("gestures"),b,a=d.length,c;for(b=0;b<a;b++){c=d[b];c.unassignedTouchDidEnd(e)}}};SC.InlineEditable={isInlineEditable:YES,isEditable:YES,exampleEditor:SC.InlineTextFieldView,isEditing:NO,inlineEditorDelegate:SC.InlineTextFieldDelegate,_editor:null,beginEditing:function(){var a;a=this.delegateFor("inlineEditorShouldBeginEditing",this.inlineEditorDelegate);if(a&&!a.inlineEditorShouldBeginEditing(this,this.get("value"))){return NO}this._editor=this.invokeDelegateMethod(this.inlineEditorDelegate,"acquireEditor",this);if(this._editor){return this._editor.beginEditing(this)}else{return NO}},commitEditing:function(){return this._editor?this._editor.commitEditing():NO},discardEditing:function(){return this._editor?this._editor.discardEditing():NO},inlineEditorShouldBeginEditing:function(){return !this.get("isEditing")&&this.get("isEditable")},inlineEditorWillBeginEditing:function(b,c,a){b.set("value",this.get("value"))},inlineEditorDidBeginEditing:function(b,c,a){this.set("isEditing",YES)},inlineEditorWillCommmitEditing:function(b,c,a){if(this.inlineEditorWillEndEditing){this.inlineEditorWillEndEditing(b,c)}},inlineEditorDidCommitEditing:function(b,c,a){a.setIfChanged("value",c);if(this.inlineEditorDidEndEditing){this.inlineEditorDidEndEditing(b,c)}this._endEditing()},inlineEditorWillDiscardEditing:function(b,a){if(this.inlineEditorWillEndEditing){this.inlineEditorWillEndEditing(b,this.get("value"))}},inlineEditorDidDiscardEditing:function(b,a){if(this.inlineEditorDidEndEditing){this.inlineEditorDidEndEditing(b,this.get("value"))}this._endEditing()},_endEditing:function(){if(this._editor){this.invokeDelegateMethod(this.inlineEditorDelegate,"releaseEditor",this._editor);this._editor=null}this.set("isEditing",NO)}};SC.InlineEditor={isInlineEditor:YES,isEditing:NO,inlineEditorDelegate:null,_target:null,beginEditing:function(b){if(this.get("isEditing")||!b||!b.isInlineEditable){return NO}var a,c;c=this._target=b;a=this.delegateFor("inlineEditorWillBeginEditing",this.inlineEditorDelegate,c);if(a){a.inlineEditorWillBeginEditing(this,this.get("value"),c)}this.set("isEditing",YES);this.invokeLast(this._callDidBegin);this._didBeginInvoked=YES;return YES},_callDidBegin:function(){if(!this.get("isEditing")){return NO}this._didBeginInvoked=NO;var b=this._target,a;a=this.delegateFor("inlineEditorDidBeginEditing",this.inlineEditorDelegate,b);if(a){a.inlineEditorDidBeginEditing(this,this.get("value"),b)}},commitEditing:function(){if(!this.get("isEditing")){return NO}if(this._didBeginInvoked){this._callDidBegin()}var a,b=this._target;a=this.delegateFor("inlineEditorShouldCommitEditing",this.inlineEditorDelegate,b);if(a&&!a.inlineEditorShouldCommitEditing(this,this.get("value"),b)){return NO}a=this.delegateFor("inlineEditorWillCommitEditing",this.inlineEditorDelegate,b);if(a){a.inlineEditorWillCommitEditing(this,this.get("value"),b)}this._endEditing();a=this.delegateFor("inlineEditorDidCommitEditing",this.inlineEditorDelegate,b);if(a){a.inlineEditorDidCommitEditing(this,this.get("value"),b)}return YES},discardEditing:function(){if(!this.get("isEditing")){return NO}if(this._didBeginInvoked){this._callDidBegin()}var a,b=this._target;a=this.delegateFor("inlineEditorShouldDiscardEditing",this.inlineEditorDelegate,b);if(a&&!a.inlineEditorShouldDiscardEditing(this,b)){return NO}a=this.delegateFor("inlineEditorWillDiscardEditing",this.inlineEditorDelegate,b);if(a){a.inlineEditorWillDiscardEditing(this,b)}this._endEditing();a=this.delegateFor("inlineEditorDidDiscardEditing",this.inlineEditorDelegate,b);if(a){a.inlineEditorDidDiscardEditing(this,b)}return YES},_endEditing:function(){this.set("isEditing",NO);this._target=null}};SC.InlineEditorDelegate={acquireEditor:function(a){},releaseEditor:function(a){},inlineEditorShouldBeginEditing:function(a,b){},inlineEditorWillBeginEditing:function(b,c,a){},inlineEditorDidBeginEditing:function(b,c,a){},inlineEditorShouldCommitEditing:function(b,c,a){},inlineEditorWillCommitEditing:function(b,c,a){},inlineEditorDidCommitEditing:function(b,c,a){},inlineEditorShouldDiscardEditing:function(b,a){},inlineEditorWillDiscardEditing:function(b,a){},inlineEditorDidDiscardEditing:function(b,a){},inlineEditorWillEndEditing:function(b,c,a){},inlineEditorDidEndEditing:function(b,c,a){}};SC.SCALE_NONE="none";SC.FILL="fill";SC.FILL_PROPORTIONALLY="fillProportionally";SC.BEST_FIT="fitBest";SC.BEST_FIT_DOWN_ONLY="fitBestDown";SC.InnerFrame={align:SC.ALIGN_CENTER,innerFrameForSize:function(a,c,h,b){var e=this.get("align"),d=this.get("scale"),g,f,i;i={x:0,y:0,width:h,height:b};if(d===SC.FILL){return i}g=h/a;f=b/c;switch(d){case SC.FILL_PROPORTIONALLY:d=g>f?g:f;break;case SC.BEST_FIT:d=g<f?g:f;break;case SC.BEST_FIT_DOWN_ONLY:if((a>h)||(c>b)){d=g<f?g:f}else{d=1}break;case SC.SCALE_NONE:d=1;break;default:if(isNaN(window.parseFloat(d))||(window.parseFloat(d)<=0)){SC.Logger.warn("SC.InnerFrame: The scale '%@' was not understood.  Scale must be one of SC.FILL, SC.FILL_PROPORTIONALLY, SC.BEST_FIT, SC.BEST_FIT_DOWN_ONLY or a positive number greater than 0.00.".fmt(d));return i}}a*=d;c*=d;i.width=Math.round(a);i.height=Math.round(c);switch(e){case SC.ALIGN_LEFT:i.x=0;i.y=(b/2)-(c/2);break;case SC.ALIGN_RIGHT:i.x=h-a;i.y=(b/2)-(c/2);break;case SC.ALIGN_TOP:i.x=(h/2)-(a/2);i.y=0;break;case SC.ALIGN_BOTTOM:i.x=(h/2)-(a/2);i.y=b-c;break;case SC.ALIGN_TOP_LEFT:i.x=0;i.y=0;break;case SC.ALIGN_TOP_RIGHT:i.x=h-a;i.y=0;break;case SC.ALIGN_BOTTOM_LEFT:i.x=0;i.y=b-c;break;case SC.ALIGN_BOTTOM_RIGHT:i.x=h-a;i.y=b-c;break;default:if(e!==SC.ALIGN_CENTER&&e!==SC.ALIGN_MIDDLE){SC.Logger.warn("SC.InnerFrame: The align '%@' was not understood.  Align must be one of SC.ALIGN_CENTER/SC.ALIGN_MIDDLE, SC.ALIGN_LEFT, SC.ALIGN_RIGHT, SC.ALIGN_TOP, SC.ALIGN_BOTTOM, SC.ALIGN_TOP_LEFT, SC.ALIGN_TOP_RIGHT, SC.ALIGN_BOTTOM_LEFT or SC.ALIGN_BOTTOM_RIGHT.".fmt(e))}i.x=(h/2)-(a/2);i.y=(b/2)-(c/2)}return i},scale:SC.FILL};SC.StaticLayout={hasStaticLayout:YES};SC.Validatable={initMixin:function(){this._validatable_validatorDidChange()},validator:null,errorLabel:null,isValid:function(){return SC.typeOf(this.get("value"))!==SC.T_ERROR}.property("value"),ownerForm:null,performValidate:function(c){var a=SC.VALIDATE_OK;if(this._validator){var b=this.get("ownerForm");if(c){a=this._validator.validatePartial(b,this);if((a==SC.VALIDATE_NO_CHANGE)&&(this._validator.validateChange(b,this)==SC.VALIDATE_OK)){a=SC.VALIDATE_OK}}else{a=this._validator.validateChange(b,this)}}return a},performValidateSubmit:function(){return this._validator?this._validator.validateSubmit(this.get("ownerForm"),this):SC.VALIDATE_OK},performValidateKeyDown:function(a){var b=a.getCharString();if(!b){return YES}return this._validator?this._validator.validateKeyDown(this.get("ownerForm"),this,b):YES},validatorObject:function(){return this._validator}.property(),validateSubmit:function(){return this.performValidateSubmit()},objectForFieldValue:function(b,a){return this._validator?this._validator.objectForFieldValue(b,this.get("ownerForm"),this):b},fieldValueForObject:function(a){return this._validator?this._validator.fieldValueForObject(a,this.get("ownerForm"),this):a},_validatable_displayObserver:function(){this.displayDidChange()}.observes("isValid"),renderMixin:function(a){a.setClass("invalid",!this.get("isValid"))},_validatable_validatorDidChange:function(){var a=this.get("ownerForm");var b=SC.Validator.findFor(a,this,this.get("validator"));if(b!=this._validator){this.propertyWillChange("validatorObject");if(this._validator){this._validator.detachFrom(a,this)}this._validator=b;if(this._validator){this._validator.attachTo(a,this)}this.propertyDidChange("validatorObject")}}.observes("validator","ownerForm")};SC.RenderDelegate={create:function(){var c=SC.beget(this);var b,a=arguments.length;for(b=0;b<a;b++){c.mixin(arguments[b])}return c},reopen:function(b){var c,a;for(c in b){a=b[c];if(!b.hasOwnProperty(c)){continue}if(typeof a==="function"&&a!==this[c]){a.base=this[c]||SC.K}if(a&&a.isEnhancement&&a!==this[c]){a=SC._enhance(this[c]||SC.K,a)}this[c]=a}},get:function(a){return this[a]},getPropertyFor:function(b,a){if(this[a+"For"]){return this[a+"For"](b,a)}return this[a]},className:undefined,render:function(b,a){},update:function(b,a){}};SC.RenderDelegate.extend=SC.RenderDelegate.create;SC.RenderDelegate.mixin=SC.RenderDelegate.reopen;sc_require("render_delegates/render_delegate");SC.BaseTheme.canvasImageRenderDelegate=SC.RenderDelegate.create({className:"canvasImage",render:function(d,b){var c=d.get("width")||0,a=d.get("height")||0;b.attr("width",c);b.attr("height",a)},update:function(a,e){var g=e[0],i=a.get("image"),d=a.get("frame"),l=d.width,j=d.height,k=a.get("innerFrame"),m=a.get("backgroundColor"),o=a.get("renderState"),b;var n=![k.x,k.y,k.width,k.height].isEqual(o._lastInnerFrameValues),h=![g.width,g.height].isEqual(o._lastElemSizeValues),f=a.didChangeFor("canvasImageRenderDelegate","backgroundColor"),c=a.didChangeFor("canvasImageRenderDelegate","image")||(i&&i.complete)!==o._lastImageComplete;if(h||n||f||c){if(g&&g.getContext){g.height=j;g.width=l;b=g.getContext("2d");b.clearRect(0,0,l,j);if(m){b.fillStyle=m;b.fillRect(0,0,l,j)}if(i&&i.complete){b.drawImage(i,Math.floor(k.x),Math.floor(k.y),Math.floor(k.width),Math.floor(k.height))}}o._lastInnerFrameValues=[k.x,k.y,k.width,k.height];o._lastElemSizeValues=[g.width,g.height];o._lastImageComplete=i&&i.complete}}});sc_require("render_delegates/render_delegate");SC.BaseTheme.containerRenderDelegate=SC.RenderDelegate.create({render:function(b,a){},update:function(){}});sc_require("render_delegates/render_delegate");SC.RenderDelegate.reopen({sizes:[SC.TINY_CONTROL_SIZE,SC.SMALL_CONTROL_SIZE,SC.REGULAR_CONTROL_SIZE,SC.LARGE_CONTROL_SIZE,SC.HUGE_CONTROL_SIZE,SC.JUMBO_CONTROL_SIZE],sizeFor:function(f){var e=f.get("controlSize"),c,b,a;if(e){if(!this[e]){this[e]={}}c=this[e];if(!c.name){c.name=e}return c}var d=f.get("frame");if(!d){c=this["sc-regular-size"];if(!c){c=this["sc-regular-size"]={}}if(!c.name){c.name="sc-regular-size"}return c}for(b=0;b<a;b++){key=sizes[b];c=this[key];if(!c){continue}if((c.width===undefined&&c.height===undefined&&c.minHeight===undefined&&c.minWidth===undefined&&c.maxHeight===undefined&&c.maxWidth===undefined)||(c.width!==undefined&&d.width!==c.width)||(c.minWidth!==undefined&&d.width<c.minWidth)||(c.maxWidth!==undefined&&d.width>c.maxWidth)||(c.height!==undefined&&d.height!==c.height)||(c.minHeight!==undefined&&d.height<c.minHeight)||(c.maxHeight!==undefined&&d.height<c.maxHeight)){continue}if(!c.name){c.name=key}return c}c=this["sc-regular-size"];if(!c){c=this["sc-regular-size"]={}}if(!c.name){c.name="sc-regular-size"}return c},addSizeClassName:function(c,b){var a=this.sizeFor(c);if(a){b.addClass(a.name)}},updateSizeClassName:function(c,a){var b=this.sizeFor(c);if(b){a.addClass(b.name)}},getPropertyFor:function(c,a){var b=this.sizeFor(c);if(b){if(b[a+"For"]){return b[a+"For"](c,a)}else{if(b[a]!==undefined){return b[a]}}}if(this[a+"For"]){return this[a+"For"]}return this[a]}});sc_require("render_delegates/render_delegate");SC.BaseTheme.imageRenderDelegate=SC.RenderDelegate.create({className:"image",render:function(f,c){var e=f.get("image"),b=f.get("imageValue"),d=f.get("type")||SC.IMAGE_TYPE_URL,a=f.get("toolTip");c=c.begin("img");c.attr("src",e.src);if(b&&d===SC.IMAGE_TYPE_CSS_CLASS){c.addClass(b);this._last_class=b}if(a){c.attr("title",a);c.attr("alt",a)}c.addStyle(this.imageStyles(f));c=c.end()},update:function(e,a){var d=e.get("image"),c=e.get("imageValue"),b=e.get("toolTip");a=a.find("img");a.attr("src",d.src);if(c!==this._last_class){a.setClass(this._last_class,NO)}if(c){a.addClass(c);this._last_class=c}if(b){a.attr("title",b);a.attr("alt",b)}a.css(this.imageStyles(e))},imageStyles:function(b){var a=b.get("innerFrame");return{position:"absolute",left:Math.round(a.x),top:Math.round(a.y),width:Math.round(a.width),height:Math.round(a.height)}}});sc_require("render_delegates/render_delegate");SC.BaseTheme.labelRenderDelegate=SC.RenderDelegate.create({className:"label",render:function(d,c){this.addSizeClassName(d,c);var a=d.get("toolTip");if(a){c.attr("title",a)}c.addStyle({fontWeight:d.get("fontWeight")||null,textAlign:d.get("textAlign")||null});c.setClass("ellipsis",d.get("needsEllipsis")||NO);c.setClass("icon",d.get("icon")||NO);var b=this.htmlForTitleAndIcon(d);c.push(b);d.get("renderState")._lastHTMLForTitleAndIcon=b},update:function(d,a){this.updateSizeClassName(d,a);a.css({fontWeight:d.get("fontWeight")||null,textAlign:d.get("textAlign")||null});var b=d.get("toolTip");if(b){a.attr("title",b)}else{a.removeAttr("title")}a.setClass("ellipsis",d.get("needsEllipsis")||NO);var c=this.htmlForTitleAndIcon(d);if(d.get("renderState")._lastHTMLForTitleAndIcon!==c){a.html(c);d.get("renderState")._lastHTMLForTitleAndIcon=c}},htmlForTitleAndIcon:function(e){var d=e.get("title"),c=e.get("hint"),b=e.get("escapeHTML"),a=e.get("icon")||"";if(d&&b){d=SC.RenderContext.escapeHTML(d)}if(b){c=SC.RenderContext.escapeHTML(c)}if(c&&!d){d="<span class='sc-hint'>"+c+"</span>"}if(a){if(a.indexOf("/")>=0){a='<img src="'+a+'" alt="" class="icon" />'}else{a='<img src="'+SC.BLANK_IMAGE_URL+'" alt="" class="icon '+a+'" />'}}return a+(SC.none(d)?"":d)}});sc_require("core");SC.Benchmark={verbose:NO,enabled:YES,events:{},stats:{},globalStartTime:null,addEvent:function(a,b){if(!b){b=new Date().getTime()}this.events[a]=b},start:function(b,a,e,d){if(!this.enabled){return}var f=(e||Date.now()),c;if(a){c=this._subStatFor(b,a)}else{c=this._statFor(b)}if(d&&c._starts.length>0){c._starts.push("ignore")}else{c._starts.push(f)}c._times.push({start:f,_subStats:{}});return b},end:function(c,b,f){var e;if(!this.enabled){return}if(b){e=this._subStatFor(c,b)}else{e=this._statFor(c)}var g=e._starts.pop();if(!g){SC.Logger.log('SC.Benchmark "%@" ended without a matching start.  No information was saved.'.fmt(c));return}if(g=="ignore"){return}var a=(f||Date.now());var d=a-g;e._times[e._times.length-1].end=a;e._times[e._times.length-1].dur=d;e.amt+=d;e.runs++;if(this.verbose){this.log(c)}},setGlobalStartTime:function(a){this.globalStartTime=a},bench:function(e,d,a){if(!d){d="bench%@".fmt(this._benchCount++)}if(!a){a=1}var b;while(--a>=0){var c=SC.Benchmark.start(d);b=e();SC.Benchmark.end(c)}return b},install:function(a,d,b){a["b__"+d]=a[d];var c=a["b__"+d];a[d]=function(){var f="%@(%@)".fmt(d,$A(arguments).join(", "));SC.Benchmark.start(f,b);var e=c.apply(this,arguments);SC.Benchmark.end(f);return e}},restore:function(a,b){a[b]=a["b__"+b]},report:function(c){if(c){return this._genReport(c)}var b=[];for(var a in this.stats){if(!this.stats.hasOwnProperty(a)){continue}b.push(this._genReport(a))}return b.join("\n")},timelineReport:function(a){a=(a)?"SproutCore Application":a;var b=[a,"User-Agent: %@".fmt(navigator.userAgent),"Report Generated: %@ (%@)".fmt(new Date().toString(),Date.now()),""];var d=this._compileChartData(true);for(var c=0;c<d.length;c++){if(d[c][4]){b.push(this._timelineGenSubReport(d[c]))}else{b.push(this._timelineGenReport(d[c]))}}return b.join("\n")},getTimelineChartContent:function(){var l=this._compileChartData(false);var g=l.length;if(g===0){return}var c=this.globalStartTime?this.globalStartTime:l[0][1];var d=l[g-1][2]-c;var n=25+g*30;var q=Math.ceil(d/200)+1;var r=q*50;var m=10,s=300;var o="<div class = 'sc-benchmark-timeline-chart' style = 'position:relative;'>";o+="<div class = 'sc-benchmark-top'></div>";for(var p=0;p<q;p++){o+="<div class = 'sc-benchmark-tick' style = '";o+="left: "+(m+p*50)+"px; ";o+="height: "+n+"px;";o+="'></div>";o+="<div class = 'sc-benchmark-tick-label' style = '";o+="left: "+(m+p*50)+"px; ";o+="'>"+(p*200)+"ms</div>"}for(p=0;p<g;p++){o+="<div class = 'sc-benchmark-row ";o+=(p%2===0)?"even":"odd";o+="' style = '";o+="top: "+(50+(p*30))+"px; ";o+="'></div>";var j=document.createElement("div");var f=l[p][1];var e=l[p][2];var a=l[p][3];o+="<div class = 'sc-benchmark-bar' style = '";o+="left:"+(m+((f-c)/4))+"px; width: "+((a/4))+"px;";o+="top: "+(28+(p*30))+"px;";o+="' title = 'start: "+(f-c)+" ms, end: "+(e-c)+" ms, duration: "+a+" ms'";o+=">";o+="&nbsp;"+l[p][0]+" <span class='sc-benchmark-emphasis'>";o+=a+"ms (start: "+(f-c)+"ms)";o+="</span>";o+="</div>"}var b=this.events,k=0;for(p in b){var h=b[p]-c;o+="<div class = 'sc-benchmark-event idx"+(k%10)+"' style = '";o+="left: "+(m+h/4)+"px; height: "+n+"px; top: 20px;";o+="' title = '"+p+": "+h+"'></div>";k++}o+="</div>";return{html:o,totalCapturedTime:d,pointsCaptured:g,width:r+m+s,height:n}},getTimelineChartView:function(){var a=SC.ScrollView.create({contentView:SC.StaticContentView.extend({}),reload:function(){var b=SC.Benchmark.getTimelineChartContent();this.contentView.set("content",b.html);this.contentView.adjust({width:b.width,height:b.height});this.chartContent=b;SC.RunLoop.invokeLater(SC.Benchmark,function(){this.contentView.notifyPropertyChange("frame")})}});a.reload();return a},timelineChart:function(a){SC.RunLoop.begin();var c=0;this.hideChart();var b=this.getTimelineChartView();var e=b.chartContent.pointsCaptured,d=b.chartContent.totalCapturedTime;this._benchmarkChart=SC.Pane.create({classNames:["sc-benchmark-pane"],layout:{left:20,right:20,bottom:20,top:20},childViews:["title","exit"],exit:SC.ButtonView.extend({layout:{right:20,top:20,width:100,height:30},title:"Hide Chart",target:this,action:"hideChart"}),title:SC.LabelView.extend({classNames:["sc-benchmark-title"],layout:{left:20,top:23,right:200,height:30},value:((a)?a:"SproutCore Application")+(" - Total Captured Time: "+d+" ms - Points Captured: "+e),fontWeight:"bold"})}).append();b.set("layout",{left:20,top:60,bottom:20,right:20});this._benchmarkChart.appendChild(b);SC.RunLoop.end()},hideChart:function(){if(this._benchmarkChart){this._benchmarkChart.remove();this._benchmarkChart=null}return YES},tryToPerform:function(b,a){if(this[b]){return this[b](a)}return NO},log:function(d){var c=this.report(d).split("\n"),b=c.length,a;for(a=0;a<b;a++){SC.Logger.log(c[a])}},startProfile:function(a){if(!this.enabled){return}SC.Logger.profile(a)},endProfile:function(a){if(!this.enabled){return}SC.Logger.profileEnd(a)},loadPreloadEvents:function(){var f=SC.benchmarkPreloadEvents,e=[],b,a,c;if(typeof webkitPerformnce!=="undefined"){SC.mixin(f,webkitPerformane.timing)}if(!this.globalStartTime){var d=["navigation","navigationStart","headStart"];a=d.length;for(b=0;b<a;b++){if(f[d[b]]){this.globalStartTime=f[d[b]];break}}}this.javascriptStartTime=f.headStart;SC.mixin(this.events,f);this._hasLoadedPreloadEvents=true},_loadBenchmarksFromEvents:function(){if(!this._hasLoadedPreloadEvents){this.loadPreloadEvents()}var b=this.events;for(var a in b){if(a.substr(-3)!=="End"){continue}var c=a.substr(0,a.length-3);if(!b[c+"Start"]){continue}SC.Benchmark.start(c,undefined,b[c+"Start"]);SC.Benchmark.end(c,undefined,b[c+"End"]);delete b[c+"Start"];delete b[c+"End"]}},_compileChartData:function(g){this._loadBenchmarksFromEvents();var l=[],a;for(var m in this.stats){var e=this.stats[m];for(var f=0;f<e._times.length;f++){var n=e._times[f];a=(e._times.length>1)?(f+1)+" - "+m:m;l.push([a,n.start,n.end,n.dur,false]);if(g){var b=n._subStats;for(var c in b){var h=b[c];for(var d=0;d<h._times.length;d++){var o=h._times[d];a=(h._times.length>1)?(d+1)+" - "+c:c;l.push([a,o.start,o.end,o.dur,true])}}}}}l.sort(function(j,i){if(j[1]<i[1]){return -1}else{if(j[1]==i[1]){if(j[3]&&!i[3]){return -1}if(!j[3]&&i[3]){return 1}return 0}}return 1});return l},_genReport:function(a){var b=this._statFor(a);var d=(b.runs>0)?(Math.floor(b.amt*1000/b.runs)/1000):0;var c=b._times[b._times.length-1];return"BENCH %@ msec: %@ (%@x); latest: %@".fmt(d,(b.name||a),b.runs,c.end-c.start)},_timelineGenReport:function(a){if(this.globalStartTime){return"BENCH start: %@ msec, duration: %@ msec,  %@".fmt((a[1]-this.globalStartTime),a[3],a[0])}else{return"BENCH duration: %@ msec, %@".fmt(a[3],a[0])}},_timelineGenSubReport:function(a){if(this.globalStartTime){return"   CHECKPOINT BENCH start: %@ msec, duration: %@ msec,  %@".fmt((a[1]-this.globalStartTime),a[3],a[0])}else{return"   CHECKPOINT BENCH duration: %@ msec, %@".fmt(a[3],a[0])}},_subStatFor:function(d,c){var e=this.stats[c]._times.length;if(e===0){return}var a=this.stats[c]._times[this.stats[c]._times.length-1]._subStats;var b=a[d];if(!b){a[d]={runs:0,amt:0,name:d,_starts:[],_times:[]};b=a[d]}return b},_statFor:function(b){var a=this.stats[b];if(!a){a=this.stats[b]={runs:0,amt:0,name:b,_starts:[],_times:[]};a=this.stats[b]}return a},reset:function(){this.stats={}},_bench:function(b,a){SC.Benchmark.bench(b,a,1)},_benchCount:1};SC.Benchmark=SC.Benchmark;SC.Cookie=SC.Object.extend({name:null,value:"",expires:null,path:null,domain:null,secure:NO,isCookie:YES,destroy:function(){this.set("expires",-1);this.write();arguments.callee.base.apply(this,arguments)},write:function(){var d=this.get("name"),f=this.get("value"),a=this.get("expires"),h=this.get("path"),e=this.get("domain"),g=this.get("secure"),b="",c;if(a){if(typeof a===SC.T_NUMBER){c=new Date();c.setTime(c.getTime()+(a*24*60*60*1000))}else{if(SC.DateTime&&a.get&&a.get("milliseconds")){c=new Date(a.get("milliseconds"))}else{if(a.toUTCString&&a.toUTCString.apply){c=a}}}if(c){b="; expires="+c.toUTCString()}}if(!SC.none(h)){b+="; path="+h}if(!SC.none(e)){b+="; domain="+e}if(g===YES){b+="; secure"}document.cookie=d+"="+encodeURIComponent(f)+b;return this}});SC.Cookie.mixin({find:function(a){if(document.cookie&&document.cookie!==""){var d=document.cookie.split(";");for(var c=0;c<d.length;c++){var b=SC.String.trim(String(d[c]));if(b.substring(0,a.length+1)===(a+"=")){return SC.Cookie.create({name:a,value:decodeURIComponent(b.substring(a.length+1))})}}}return null}});SC.CookieMonster={nomNomNom:function(b){var a=SC.kindOf(b,SC.Cookie);if(a){SC.Logger.log("YUM!");return b.destroy()}SC.Logger.error("Y U PASS ME NO COOKIE? %@",b);return NO}};SC.mixin(SC.$.fn,{setClass:function(d,c){if(SC.none(d)){return this}var e=SC.typeOf(d)!==SC.T_STRING,a=this._fixupClass,b;this.each(function(){if(this.nodeType!==1){return}var h=this.className.split(/\s+/),g=NO;if(e){for(var f in d){if(d.hasOwnProperty(f)){g=a(h,f,d[f])||g}}}else{g=a(h,d,c)}if(g){this.className=h.join(" ")}});return this},_fixupClass:function(d,a,c){var b=d.indexOf(a);if(c){if(b<0){d.push(a);return YES}}else{if(b>=0){d[b]=null;return YES}}return NO}});SC.ExceptionHandler={enabled:(SC.buildMode!=="debug"),handleException:function(a){if(this.isShowingErrorDialog){return NO}this._displayErrorDialog(a);return NO},_displayErrorDialog:function(b){var a=this._errorDialogHTMLForException(b),c=document.createElement("div");c.style.cssText="left: 0px; right: 0px; top: 0px; bottom: 0px; position: absolute; background-color: white; background-color: rgba(255,255,255,0.6); z-index:100;";c.innerHTML=a;document.body.appendChild(c);this.isShowingErrorDialog=YES},_errorDialogHTMLForException:function(b){var a;a=['<div id="sc-error-dialog" style="position: absolute; width: 500px; left: 50%; top: 50%; margin-left: -250px; background-color: white; border: 1px solid black; font-family: Monaco, monospace; font-size: 9px; letter-spacing: 1px; padding: 10px">',"An error has occurred which prevents the application from running:","<br><br>",b.message,'<div id="sc-error-dialog-reload-button" onclick="window.location.reload();" style="float: right; font-family: Monaco, monospace; font-size: 9px; letter-spacing: 1px; border: 1px solid black; padding: 3px; clear: both; margin-top: 20px; cursor: pointer;">',"Reload","</div>","</div>"];return a.join("")},isShowingErrorDialog:NO};SC.IMAGE_ABORTED_ERROR=SC.$error("SC.Image.AbortedError","Image",-100);SC.IMAGE_FAILED_ERROR=SC.$error("SC.Image.FailedError","Image",-101);SC.imageQueue=SC.Object.create({loadLimit:4,activeRequests:0,loadImage:function(a,e,f,d){var b=SC.typeOf(e);if(SC.none(f)&&SC.typeOf(e)===SC.T_FUNCTION){e=null;f=e}if(SC.typeOf(f)===SC.T_STRING){f=e[f]}if(SC.none(d)){d=SC.none(e)&&SC.none(f)}var c=this._imageEntryFor(a);if(c.status===this.IMAGE_LOADED){if(f){f.call(e||c.image,c.url,c.image)}}else{if(e||f){this._addCallback(c,e,f)}c.retainCount++;this._scheduleImageEntry(c,d)}},releaseImage:function(a,d,e){var c=this._imageEntryFor(a,NO);if(!c){return this}if(--c.retainCount<=0){this._deleteEntry(c)}else{if(d||e){var b=SC.typeOf(d);if(SC.none(e)&&SC.typeOf(d)===SC.T_FUNCTION){d=null;e=d}if(SC.typeOf(e)===SC.T_STRING){e=d[e]}this._removeCallback(c,d,e)}}},reloadImage:function(a){var b=this._imageEntryFor(a,NO);if(b&&b.status===this.IMAGE_LOADED){b.status=this.IMAGE_WAITING}},loadNextImage:function(){var c=null,a;if(this.get("activeRequests")>=this.get("loadLimit")){return}a=this._foregroundQueue;while(a.length>0&&!c){c=a.shift()}if(!c){a=this._backgroundQueue;while(a.length>0&&!c){c=a.shift()}}this.set("isLoading",!!c);if(c){var b=c.image;if(!b){return}$(b).bind("abort",this._imageDidAbort);$(b).bind("error",this._imageDidError);$(b).bind("load",this._imageDidLoad);b.src=c.url;this._loading.push(c);this.incrementProperty("activeRequests");this.loadNextImage()}},_imageEntryFor:function(c,a){if(a===undefined){a=YES}var d=this._images[c];if(!d&&a){var b=new Image();d=this._images[c]={url:c,status:this.IMAGE_WAITING,callbacks:[],retainCount:0,image:b};b.entry=d}else{if(d&&d.image===null){d.image=new Image();d.image.entry=d}}return d},_deleteEntry:function(a){this._unscheduleImageEntry(a);delete this._images[a.url]},_addCallback:function(c,d,e){var b=c.callbacks;var a=b.find(function(f){return f[0]===d&&f[1]===e},this);if(!a){b.push([d,e])}b=null;return this},_removeCallback:function(b,c,d){var a=b.callbacks;a.forEach(function(f,e){if(f[0]===c&&f[1]===d){a[e]=null}},this);a=null;return this},_scheduleImageEntry:function(d,c){var b=this._backgroundQueue;var e=this._foregroundQueue;if(d.status===this.IMAGE_LOADED){return this}if((d.status===this.IMAGE_QUEUED)&&!c&&d.isBackground){b[b.indexOf(d)]=null;d.status=this.IMAGE_WAITING}if(d.status!==this.IMAGE_QUEUED){var a=(c)?b:e;a.push(d);d.status=this.IMAGE_QUEUED;d.isBackground=c}if(!this.isLoading){this.invokeLater(this.loadNextImage,100)}this.set("isLoading",YES);return this},_unscheduleImageEntry:function(b){if(b.status!==this.IMAGE_QUEUED){return this}var a=b.isBackground?this._backgroundQueue:this._foregroundQueue;a[a.indexOf(b)]=null;if(this._loading.indexOf(b)>=0){if(a.image){a.image.abort()}this.imageStatusDidChange(b,this.ABORTED)}return this},_imageDidAbort:function(){SC.run(function(){SC.imageQueue.imageStatusDidChange(this.entry,SC.imageQueue.ABORTED)},this)},_imageDidError:function(){SC.run(function(){SC.imageQueue.imageStatusDidChange(this.entry,SC.imageQueue.ERROR)},this)},_imageDidLoad:function(){SC.run(function(){SC.imageQueue.imageStatusDidChange(this.entry,SC.imageQueue.LOADED)},this)},imageStatusDidChange:function(c,a){if(!c){return}var b=c.url;var d;switch(a){case this.LOADED:d=c.image;break;case this.ABORTED:d=SC.IMAGE_ABORTED_ERROR;break;case this.ERROR:d=SC.IMAGE_FAILED_ERROR;break;default:d=SC.IMAGE_FAILED_ERROR;break}c.callbacks.forEach(function(f){var g=f[0],h=f[1];h.call(g,b,d)},this);c.callbacks=[];c.status=(a===this.LOADED)?this.IMAGE_LOADED:this.IMAGE_WAITING;var e=c.image;if(e){e.onload=e.onerror=e.onabort=null;if(a!==this.LOADED){c.image=null}}this._loading[this._loading.indexOf(c)]=null;if(this._loading.length>this.loadLimit*2){this._loading=this._loading.compact()}this.decrementProperty("activeRequests");this.loadNextImage()},init:function(){arguments.callee.base.apply(this,arguments);this._images={};this._loading=[];this._foregroundQueue=[];this._backgroundQueue=[]},IMAGE_LOADED:"loaded",IMAGE_QUEUED:"queued",IMAGE_WAITING:"waiting",ABORTED:"aborted",ERROR:"error",LOADED:"loaded"});SC.Math=SC.Object.create({near:function(c,b,a){if(!a){a=0.00001}return Math.abs(c-b)<=a},round:function(d,a){if(!a){a=0}var b=Math.pow(10,a);if(a<0){var c=b.toString();b=c.substring(0,c.indexOf("1")+1)}d=d.valueOf();return Math.round(d*b)/b}});SC.Task=SC.Object.extend({run:function(a){}});sc_require("tasks/task");SC.LOG_MODULE_LOADING=YES;SC.Module=SC.Object.create({isModuleReady:function(a){var b=SC.MODULE_INFO[a];return b?!!b.isReady:NO},loadModule:function(b,g,a){var c=SC.MODULE_INFO[b],h,f,i=SC.A(arguments).slice(3),d=SC.LOG_MODULE_LOADING,j,e;if(a===undefined&&SC.typeOf(g)===SC.T_FUNCTION){a=g;g=null}if(d){SC.debug("SC.Module: Attempting to load '%@'",b)}if(!c){throw"SC.Module: could not find module '%@'".fmt(b)}c.isPrefetching=NO;if(c.isLoaded&&!c.isWaitingForRunLoop){if(d){SC.debug("SC.Module: Module '%@' already loaded.",b)}if(!this._dependenciesMetForModule(b)){this._addCallbackForModule(b,g,a,i);this._loadDependenciesForModule(b);return NO}if(c.source){if(d){SC.debug("SC.Module: Evaluating JavaScript for module '%@'.",b)}this._evaluateStringLoadedModule(c);this._addCallbackForModule(b,g,a,i);this.invokeLast(function(){c.isReady=YES;this._moduleDidBecomeReady(b)});return NO}if(a){if(SC.isReady){SC.Module._invokeCallback(b,g,a,i)}else{SC.ready(SC.Module,function(){SC.Module._invokeCallback(b,g,a,i)})}}return YES}else{if(c.isWaitingForRunLoop){this._addCallbackForModule(b,g,a,i)}else{if(d){SC.debug("SC.Module: Module '%@' is not loaded, loading now.",b)}this._addCallbackForModule(b,g,a,i);if(!c.isLoading){this._loadDependenciesForModule(b);this._loadCSSForModule(b);this._loadJavaScriptForModule(b);c.isLoading=YES}return NO}}},_addCallbackForModule:function(b,e,f,a){var c=SC.MODULE_INFO[b];var d=c.callbacks||[];if(f){d.push(function(){SC.Module._invokeCallback(b,e,f,a)})}c.callbacks=d},prefetchModule:function(a){var b=SC.MODULE_INFO[a];if(b.isLoading||b.isLoaded){return}if(SC.LOG_MODULE_LOADING){SC.debug("SC.Module: Prefetching module '%@'.",a)}this._loadDependenciesForModule(a);this._loadCSSForModule(a);this._loadJavaScriptForModule(a);b.isLoading=YES;b.isPrefetching=YES},_executeLazilyInstantiatedModule:function(b,c,i){var h=SC.LAZY_INSTANTIATION[b];var g;var a;var j,d;if(SC.LOG_MODULE_LOADING){SC.debug("SC.Module: Module '%@' is marked for lazy instantiation, instantiating it now…",b)}d=h.length;for(j=0;j<d;j++){try{h[j]()}catch(f){SC.Logger.error("SC.Module: Failed to lazily instatiate entry for  '%@'".fmt(b))}}delete SC.LAZY_INSTANTIATION[b];g=this._targetForTargetName(c);a=this._methodForMethodNameInTarget(i,g);if(!a){throw"SC.Module: could not find callback for lazily instantiated module '%@'".fmt(b)}},_evaluateStringLoadedModule:function(b){var a=b.source;jQuery.globalEval(a);delete b.source;if(b.cssSource){var c=document.createElement("style");c.setAttribute("type","text/css");if(c.styleSheet){c.styleSheet.cssText=b.cssSource}else{var d=document.createTextNode(b.cssSource);c.appendChild(d)}document.getElementsByTagName("head")[0].appendChild(c)}b.isReady=YES},_loadCSSForModule:function(d){var f=document.getElementsByTagName("head")[0];var e=SC.MODULE_INFO[d];var h=e.styles||[];var b=h.length;var c;var g;var a;if(!f){f=document.documentElement}b=h.length;for(a=0;a<b;a++){c=h[a];if(c.length>0){if(SC.LOG_MODULE_LOADING){SC.debug("SC.Module: Loading CSS file in '%@' -> '%@'",d,c)}g=document.createElement("link");g.setAttribute("href",c);g.setAttribute("rel","stylesheet");g.setAttribute("type","text/css");f.appendChild(g)}}g=null},_loadJavaScriptForModule:function(b){var c=SC.MODULE_INFO[b];var d;var a;var e=c.dependencies;var f=YES;if(e&&e.length>0){f=this._dependenciesMetForModule(b)}if(c.isPrefetched){a=c.stringURL}else{if(f){a=c.scriptURL}else{a=c.stringURL}}if(a.length>0){if(SC.LOG_MODULE_LOADING){SC.debug("SC.Module: Loading JavaScript file in '%@' -> '%@'",b,a)}d=document.createElement("script");d.setAttribute("type","text/javascript");d.setAttribute("src",a);if(SC.browser.isIE){d.onreadystatechange=function(){if(this.readyState=="complete"||this.readyState=="loaded"){SC.run(function(){SC.Module._moduleDidLoad(b)})}}}else{d.onload=function(){SC.run(function(){SC.Module._moduleDidLoad(b)})}}document.body.appendChild(d)}},_dependenciesMetForModule:function(c){var e=SC.MODULE_INFO[c].dependencies||[];var b,a=e.length;var f;var d;for(b=0;b<a;b++){f=e[b];d=SC.MODULE_INFO[f];if(!d){throw"SC.loadModule: Unable to find dependency %@ for module %@.".fmt(f,c)}if(!d.isReady){return NO}}return YES},_loadDependenciesForModule:function(a){var b=SC.MODULE_INFO[a];var e=SC.LOG_MODULE_LOADING;var i=b.dependencies||[];var f=YES;var g=i.length;var j;var d;var c;var h;for(j=0;j<g;j++){d=i[j];c=SC.MODULE_INFO[d];if(!c){throw"SC.Module: could not find required module '%@' for module '%@'".fmt(d,a)}else{if(c.isLoading){f=NO;h=c.dependents;if(!h){c.dependents=h=[]}h.push(a)}else{if(c.isReady){continue}else{f=NO;h=c.dependents;if(!h){c.dependents=h=[]}h.push(a);if(e){SC.debug("SC.Module: '%@' depends on '%@', loading dependency…",a,d)}SC.Module.loadModule(d)}}}}},_invokeCallback:function(c,d,a,b){var g;var f;f=this._targetForTargetName(d);g=this._methodForMethodNameInTarget(a,f);if(!g){if(SC.LAZY_INSTANTIATION[c]){this._executeLazilyInstantiatedModule(c,d,a);f=this._targetForTargetName(d);g=this._methodForMethodNameInTarget(a,f)}else{throw"SC.Module: could not find callback for '%@'".fmt(c)}}if(!b){b=[]}b.unshift(c);var e=!!SC.RunLoop.currentRunLoop;if(e){SC.run(function(){g.apply(f,b)})}else{g.apply(f,b)}},_invokeCallbacksForModule:function(c){var e=SC.MODULE_INFO[c],d;if(!e){return}if(SC.LOG_MODULE_LOADING){SC.debug("SC.Module: Module '%@' has completed loading, invoking callbacks.",c)}d=e.callbacks||[];for(var b=0,a=d.length;b<a;++b){d[b]()}},_evaluateAndInvokeCallbacks:function(a){var d=SC.MODULE_INFO;var b=d[a];var c=SC.LOG_MODULE_LOADING;if(c){SC.debug("SC.Module: Evaluating and invoking callbacks for '%@'.",a)}if(b.source){this._evaluateStringLoadedModule(b)}b.isWaitingForRunLoop=YES;this.invokeLast(function(){b.isReady=YES;this._moduleDidBecomeReady(a)})},_moduleDidBecomeReady:function(a){var c=SC.MODULE_INFO;var b=c[a];var d=SC.LOG_MODULE_LOADING;b.isWaitingForRunLoop=NO;if(SC.isReady){SC.Module._invokeCallbacksForModule(a);delete b.callbacks}else{SC.ready(SC,function(){SC.Module._invokeCallbacksForModule(a);delete b.callbacks})}var g=b.dependents||[];var e,i;for(var h=0,f=g.length;h<f;h++){e=g[h];i=c[e];if(i.isLoaded&&this._dependenciesMetForModule(e)){if(d){SC.debug("SC.Module: Now that %@ has loaded, all dependencies for a dependent %@ are met.",a,e)}this._evaluateAndInvokeCallbacks(e)}}},_moduleDidLoad:function(b){var c=SC.MODULE_INFO[b];var e=SC.LOG_MODULE_LOADING;var d;var f,a;if(e){SC.debug("SC.Module: Module '%@' finished loading.",b)}if(!c){if(e){SC.debug("SC._moduleDidLoad() called for unknown module '@'.",b)}c=SC.MODULE_INFO[b]={isLoaded:YES,isReady:YES};return}if(c.isLoaded){if(e){SC.debug("SC._moduleDidLoad() called more than once for module '%@'. Skipping.",b)}return}delete c.isLoading;c.isLoaded=YES;if(!c.isPrefetching){d=this._dependenciesMetForModule(b);if(d){this._evaluateAndInvokeCallbacks(b)}else{if(e){SC.debug("SC.Module: Dependencies for '%@' not met yet, waiting to evaluate.",b)}}}else{delete c.isPrefetching;if(e){SC.debug("SC.Module: Module '%@' was prefetched, not evaluating until needed.",b)}}},_targetForTargetName:function(a){if(SC.typeOf(a)===SC.T_STRING){return SC.objectForPropertyPath(a)}return a},_methodForMethodNameInTarget:function(a,b){if(SC.typeOf(a)===SC.T_STRING){return SC.objectForPropertyPath(a,b)}return a},methodsForSuspend:"loadModule _moduleDidLoad prefetchModule _moduleDidBecomeReady".w(),suspend:function(){this._suspendCount=(this._suspendCount||0)+1;if(this._suspendCount!==1){return}var a=this.get("methodsForSuspend"),e,d,c,b;for(b=0;c=a[b];b++){if(!this[e="__replacement_"+c+"__"]){(this[e]=function(){(this._bufferedCalls||(this._bufferedCalls=[])).push({method:arguments.callee.methodName,arguments:arguments})}).methodName=c}if(!this[d="__saved_"+c+"__"]){this[d]=this[c]}this[c]=this[e]}},resume:function(){this._suspendCount=(this._suspendCount||0)-1;if(this._suspendCount<0){SC.warn("SC.Module.resume() was called without SC.Module having been in a suspended state. Call aborted.");this._suspendCount=0;return}if(this._suspendCount>0){return}var a=this.get("methodsForSuspend"),d=this._bufferedCalls,c,b,f,e;for(b=0;(c=a[b]);b++){this[c]=this["__saved_"+c+"__"]}for(b=0;e=d&&d[b];b++){this[e.method].apply(this,e.arguments)}if(d){d.length=0}}});SC.ready(function(){var d=SC.MODULE_INFO;var b;var c;var a;for(b in d){c=d[b];if(c.isPrefetched){a=SC.Module.PrefetchModuleTask.create({prefetchedModuleName:b});SC.backgroundTaskQueue.push(a)}}});SC.Module.PrefetchModuleTask=SC.Task.extend({prefetchedModuleName:null,run:function(){SC.Module.prefetchModule(this.prefetchedModuleName)}});sc_require("tasks/task");SC.TaskQueue=SC.Task.extend({init:function(){var a=this;this._doIdleEntry=function(){a._idleEntry()};this._suspendCount=0;this._tasks=[]},runWhenIdle:NO,runLimit:50,interval:50,isRunning:NO,minimumIdleDuration:500,_tasks:null,hasTasks:function(){return this._tasks.length>0}.property("taskCount").cacheable(),taskCount:function(){return this._tasks.length}.property().cacheable(),push:function(a){this._tasks.push(a);this.notifyPropertyChange("taskCount")},next:function(){if(this._tasks.length<1){return null}var a=this._tasks.shift();this.notifyPropertyChange("taskCount");return a},suspend:function(){this._suspendCount++},resume:function(){this._suspendCount--;if(this._suspendCount<=0){this._setupIdle()}},_taskCountDidChange:function(){this._setupIdle()}.observes("taskCount"),_runWhenIdleDidChange:function(){this._setupIdle()}.observes("runWhenIdle"),_setupIdle:function(){if(!this._suspendCount&&this.get("runWhenIdle")&&!this._idleIsScheduled&&this.get("taskCount")>0){setTimeout(this._doIdleEntry,this.get("interval"));this._idleIsScheduled=YES}},_idleEntry:function(){this._idleIsScheduled=NO;var a=SC.RunLoop.lastRunLoopEnd;if(!this.get("runWhenIdle")&&!this._suspendCount){return}if(Date.now()-a>this.get("minimumIdleDuration")){SC.run(this.run,this);SC.RunLoop.lastRunLoopEnd=a}this._setupIdle()},run:function(a){this.set("isRunning",YES);if(!a){a=this.get("runLimit")}var b,c=Date.now();while(b=this.next()){b.run(this);if(Date.now()-c>a){break}}this.set("isRunning",NO)}});SC.backgroundTaskQueue=SC.TaskQueue.create({runWhenIdle:YES});SC.TextSelection=SC.Object.extend(SC.Copyable,SC.Freezable,{start:-1,end:-1,length:function(){var b=this.get("start");var a=this.get("end");if((b)===-1||(a===-1)){return -1}else{return a-b}}.property("start","end").cacheable(),init:function(){arguments.callee.base.apply(this,arguments);this.freeze()},copy:function(){return SC.TextSelection.create({start:this.get("start"),end:this.get("end")})},toString:function(){var a=this.get("length");if(a&&a>0){if(a===1){return"[%@ character selected: {%@, %@}]".fmt(a,this.get("start"),this.get("end"))}else{return"[%@ characters selected: {%@, %@}]".fmt(a,this.get("start"),this.get("end"))}}else{return"[no text selected; caret at %@]".fmt(this.get("start"))}}});SC.UserDefaults=SC.Object.extend({ready:NO,userDomain:null,appDomain:null,_defaults:null,_safari3DB:null,defaults:function(a){this._defaults=a;this.allPropertiesDidChange()},readDefault:function(i){var a,d,b,j,h,k,g;i=this._normalizeKeyName(i);b=this._userKeyName(i);if(this._written){d=this._written[b]}a=SC.browser.isIE&&SC.browser.compare(SC.browser.engineVersion,"7")===0;if(a){j=document.body;try{j.load("SC.UserDefaults")}catch(c){SC.Logger.error("Couldn't load userDefaults in IE7: "+c.description)}}else{if(this.HTML5DB_noLocalStorage){g=this._safari3DB}else{j=window.localStorage;if(!j&&window.globalStorage){j=window.globalStorage[window.location.hostname]}}}if(j||g){h=["SC.UserDefaults",b].join("-at-");if(a){d=j.getAttribute(h.replace(/\W/gi,""))}else{if(g){d=this.dataHash[h]}else{d=j[h]}}if(!SC.none(d)){try{d=SC.json.decode(d)}catch(f){}}}k=this.delegate;if(k&&k.userDefaultsNeedsDefault){d=k.userDefaultsNeedsDefault(this,i,b)}if(SC.none(d)&&this._defaults){d=this._defaults[b]||this._defaults[i]}return d},writeDefault:function(k,i){var b,f,c,l,j,m,h;k=this._normalizeKeyName(k);f=this._userKeyName(k);c=this._written;if(!c){c=this._written={}}c[f]=i;b=SC.browser.isIE&&SC.browser.compare(SC.browser.engineVersion,"7")===0;if(b){l=document.body}else{if(this.HTML5DB_noLocalStorage){h=this._safari3DB}else{l=window.localStorage;if(!l&&window.globalStorage){l=window.globalStorage[window.location.hostname]}}}j=["SC.UserDefaults",f].join("-at-");if(l||h){var a=SC.json.encode(i);if(b){l.setAttribute(j.replace(/\W/gi,""),a);l.save("SC.UserDefaults")}else{if(h){var d=this;h.transaction(function(e){e.executeSql("delete from SCLocalStorage where key = ?",[j],function(){e.executeSql("insert into SCLocalStorage(key, value) VALUES ('"+j+"', '"+a+"');",[],d._nullDataHandler,d.killTransaction)})});this.dataHash[j]=a}else{try{l[j]=a}catch(g){SC.Logger.error("Failed using localStorage. "+g)}}}}m=this.delegate;if(m&&m.userDefaultsDidChange){m.userDefaultsDidChange(this,k,i,f)}return this},resetDefault:function(j){var b,a,f,c,k,i,h;b=this._normalizeKeyName(j);f=this._userKeyName(b);this.propertyWillChange(j);this.propertyWillChange(b);c=this._written;if(c){delete c[f]}a=SC.browser.isIE&&SC.browser.compare(SC.browser.engineVersion,"7")===0;if(a){k=document.body}else{if(this.HTML5DB_noLocalStorage){h=this._safari3DB}else{k=window.localStorage;if(!k&&window.globalStorage){k=window.globalStorage[window.location.hostname]}}}i=["SC.UserDefaults",f].join("-at-");if(k){if(a){k.setAttribute(i.replace(/\W/gi,""),null);k.save("SC.UserDefaults")}else{if(h){var d=this;h.transaction(function(e){e.executeSql("delete from SCLocalStorage where key = ?",[i],null)});delete this.dataHash[i]}else{try{delete k[i]}catch(g){SC.Logger.warn("Deleting local storage encountered a problem. "+g)}}}}this.propertyDidChange(j);this.propertyDidChange(b);return this},unknownProperty:function(a,b){if(b===undefined){return this.readDefault(a)}else{this.writeDefault(a,b);return b}},_normalizeKeyName:function(a){if(a.indexOf(":")<0){var b=this.get("appDomain")||"app";a=[b,a].join(":")}return a},_userKeyName:function(b){var a=this.get("userDomain")||"(anonymous)";return[a,b].join("-at-")},_domainDidChange:function(){var a=NO;if(this.get("userDomain")!==this._scud_userDomain){this._scud_userDomain=this.get("userDomain");a=YES}if(this.get("appDomain")!==this._scud_appDomain){this._scud_appDomain=this.get("appDomain");a=YES}if(a){this.allPropertiesDidChange()}}.observes("userDomain","appDomain"),init:function(){arguments.callee.base.apply(this,arguments);var a;jQuery.readyWait++;if(SC.userDefaults&&SC.userDefaults.get("dataHash")){var g=SC.userDefaults.get("dataHash");if(g){this.dataHash=SC.userDefaults.get("dataHash")}}this._scud_userDomain=this.get("userDomain");this._scud_appDomain=this.get("appDomain");a=SC.browser.isIE&&SC.browser.compare(SC.browser.engineVersion,"7")===0;if(a){document.body.addBehavior("#default#userData")}this.HTML5DB_noLocalStorage=SC.browser.isWebkit&&SC.browser.compare(SC.browser.engineVersion,"523")>0&&SC.browser.compare(SC.browser.engineVersion,"528")<0;if(this.HTML5DB_noLocalStorage){var b;try{if(!window.openDatabase){SC.Logger.error("Trying to load a database with safari version 3.1 to get SC.UserDefaults to work. You are either in a previous version or there is a problem with your browser.");return}else{var h="scdb",f="1.0",i="SproutCore database",j=65536;b=openDatabase(h,f,i,j)}}catch(d){SC.Logger.error("Trying to load a database with safari version 3.1 to get SC.UserDefaults to work. You are either in a previous version or there is a problem with your browser.");return}if(b){var c=this;b.transaction(function(e){e.executeSql("CREATE TABLE IF NOT EXISTS SCLocalStorage(key TEXT NOT NULL PRIMARY KEY, value TEXT NOT NULL);",[],c._nullDataHandler,c.killTransaction)});b.transaction(function(e){e.parent=c;e.executeSql("SELECT * from SCLocalStorage;",[],function(p,m){var n={},o;for(var l=0,k=m.rows.length;l<k;l++){o=m.rows.item(l);n[o.key]=o.value}p.parent.dataHash=n;SC.run(function(){jQuery.ready(true)})},c.killTransaction)});this._safari3DB=b}}else{jQuery.ready(true)}},_killTransaction:function(b,a){return true},_nullDataHandler:function(b,a){}});SC.userDefaults=SC.UserDefaults.create();SC.mixin({convertHsvToHex:function(d,c,a){var b=SC.Color.hsvToRgb(d,c,a);return SC.Color.create({r:b[0],g:b[1],b:b[2]}).toHex()},convertHexToHsv:function(b){var a=SC.Color.from(b);return a&&SC.Color.rgbToHsv(a.r,a.g,a.b)},PARSE_COLOR_RGBRE:/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i,PARSE_COLOR_HEXRE:/^\#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,expandColor:function(b){var c,e,d,a;c=this.parseColor(b);if(c){e=parseInt(c.slice(1,3),16);d=parseInt(c.slice(3,5),16);a=parseInt(c.slice(5,7),16);return[e,d,a]}},parseColor:function(d){var e=0,a="#",c,b;if(c=this.PARSE_COLOR_RGBRE.exec(d)){for(e=1;e<=3;e++){b=Math.max(0,Math.min(255,parseInt(c[e],0)));a+=this.toColorPart(b)}return a}if(c=this.PARSE_COLOR_HEXRE.exec(d)){if(c[1].length==3){for(e=0;e<3;e++){a+=c[1].charAt(e)+c[1].charAt(e)}return a}return"#"+c[1]}return false},toColorPart:function(a){if(a>255){a=255}var b=a.toString(16);if(a<16){return"0"+b}return b}});SC.mixin({_downloadFrames:0,download:function(d){var a=document.createElement("iframe"),c="DownloadFrame_"+this._downloadFrames;SC.$(a).attr("id",c);a.style.border="10px";a.style.width="0px";a.style.height="0px";a.style.position="absolute";a.style.top="-10000px";a.style.left="-10000px";if(!SC.browser.isSafari){SC.$(a).attr("src",d)}document.getElementsByTagName("body")[0].appendChild(a);if(SC.browser.isSafari){SC.$(a).attr("src",d)}this._downloadFrames=this._downloadFrames+1;if(!SC.browser.isSafari){var b=function(){document.body.removeChild(document.getElementById(c));c=null};b.invokeLater(null,2000)}a=null},getStyle:function(a,b){var c="";if(document.defaultView&&document.defaultView.getComputedStyle){c=document.defaultView.getComputedStyle(a,"").getPropertyValue(b)}else{if(a.currentStyle){b=b.replace(/\-(\w)/g,function(d,e){return e.toUpperCase()});c=a.currentStyle[b]}}return c},uniJapaneseConvert:function(e){var a,c="",b,d;for(b=0,d=e.length;b<d;b++){a=e.charCodeAt(b);a=((a>=65281&&a<=65392)?a-65248:a);a=(a===12540?45:a);c=c+String.fromCharCode(a)}return c},pointInElement:function(b,g,c,f){var h,d,a,e;g=jQuery(g);c=c||"border";h=SC.offset(g,f);if(c==="padding"){d=g.innerWidth();a=g.innerHeight();h.x+=window.parseInt(g.css("border-left-width").replace("px",""));h.y+=window.parseInt(g.css("border-top-width").replace("px",""))}else{d=g.outerWidth(c==="margin");a=g.outerHeight(c==="margin");if(c==="margin"){h.x-=window.parseInt(g.css("margin-left").replace("px",""));h.y-=window.parseInt(g.css("margin-top").replace("px",""))}}e={x:h.x,y:h.y,width:d,height:a};return SC.pointInRect(b,e)},switchScale:function(){$("head meta[name=viewport]").remove();if(window.innerWidth===window.screen.width){$("head").prepend('<meta name="viewport" content="width=device-width, initial-scale=0.5, maximum-scale=0.5, minimum-scale=0.5, user-scalable=0" />')}else{$("head").prepend('<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0" />')}}});SC.mixin({ZERO_RANGE:{start:0,length:0},RANGE_NOT_FOUND:{start:0,length:-1},valueInRange:function(b,a){return(b>=0)&&(b>=a.start)&&(b<(a.start+a.length))},minRange:function(a){return a.start},maxRange:function(a){return(a.length<0)?-1:(a.start+a.length)},unionRanges:function(c,b){if((c==null)||(c.length<0)){return b}if((b==null)||(b.length<0)){return c}var d=Math.min(c.start,b.start),a=Math.max(SC.maxRange(c),SC.maxRange(b));return{start:d,length:a-d}},intersectRanges:function(c,b){if((c==null)||(b==null)){return SC.RANGE_NOT_FOUND}if((c.length<0)||(b.length<0)){return SC.RANGE_NOT_FOUND}var d=Math.max(SC.minRange(c),SC.minRange(b)),a=Math.min(SC.maxRange(c),SC.maxRange(b));if(a<d){return SC.RANGE_NOT_FOUND}return{start:d,length:a-d}},subtractRanges:function(c,b){if((c==null)||(b==null)){return SC.RANGE_NOT_FOUND}if((c.length<0)||(b.length<0)){return SC.RANGE_NOT_FOUND}var a=Math.max(SC.minRange(c),SC.minRange(b)),d=Math.min(SC.maxRange(c),SC.maxRange(b));if(a<d){return SC.RANGE_NOT_FOUND}return{start:d,length:a-d}},cloneRange:function(a){return{start:a.start,length:a.length}},rangesEqual:function(b,a){if(b===a){return true}if(b==null){return a.length<0}if(a==null){return b.length<0}return(b.start==a.start)&&(b.length==a.length)}});SC.mixin({bestStringMetricsForMaxWidth:function(a,x,n,z,w){if(!x){SC.warn("When calling bestMetricsForWidth, the second argument, maxWidth, is required. There's no reason to call this without a maxWidth.");return undefined}x=Math.ceil(parseFloat(x));var A=arguments.callee,h=SC.typeOf(n||(n=""))!==SC.T_STRING,m=h?n.style.maxWidth:undefined,o=(!h||n.cacheableForMetrics)?SC.cacheSlotFor(n,z,w,a):undefined,r=h?(A._applyMaxToEl||(A._applyMaxToEl=function(l,i){l.style.maxWidth=i+"px";return l})):(A._applyMaxToStr||(A._applyMaxToStr=function(l,i){return l.replace(/max-width:[^;]*;/g,"")+" max-width:"+i+"px"})),u=h?(A._removeMaxFromEl||(A._removeMaxFromEl=function(i){i.style.maxWidth="none";return i})):(A._removeMaxFromStr||(A._removeMaxFromStr=function(i){return i.replace(/max-width:[^;]*;/g,"")+" max-width:none"})),p=false;if(o){o.list||(o.list=[{width:Infinity,height:0}]);for(var v=1,t=o.list.length,C,b,D;v<t&&!D;v++){C=o.list[v];b=o.list[v-1];if(!C||!C.width){continue}if(x>=C.width){if((b&&b.width)||(x<=C.maxWidth)){return C}D=C}}}var q=r(n,x),s=SC.metricsForString(a,q,z,w),y=s.height,d=o?o.parent.height||(o.parent.height=SC.metricsForString("W",q,z).height):SC.metricsForString("W",q,z).height,c=Math.round(y/d);if(p){c--;y=c*d}if(y>d){var g=p?Math.ceil(s.width*2.5):s.width,k=p?s.width:Math.floor(s.width/2.5),B,f=new Date()*1,j=0;while(g-k>1||(s.height>y&&!p)||(s.height<y&&p)){j++;B=(g+k)/2;q=r(q,B);s=SC.metricsForString(a,q,z,w);if(s.height>y){k=B}else{g=B}}s.width=Math.ceil(B);s.height=y;s.maxWidth=x;s.lineHeight=d;s.lines=c;s.searchPerformed=true;s.searchTime=new Date()*1-f;s.searchCount=j}else{if(p){s=SC.metricsForString(a,q=u(q),z,w)}s.maxWidth=x;s.lineHeight=d;s.lines=c;s.searchPerformed=false}s.browserCorrection=0;if(SC.browser.isIE){s.browserCorrection=1}if(SC.browser.isMozilla){s.browserCorrection=1}s.width=Math.min(x,s.width+s.browserCorrection);if(o){var e=o.list[c];if(e&&e.maxWidth<x){e.maxWidth=x}if(!e){e=o.list[c]=s}}if(h){q.style.maxWidth=m}D=p?D:s;return D},cacheSlotFor:function(){var e=arguments.callee.caller,f=e.cache||(e.cache={});if(!arguments[0]){return f}var b=(arguments[0] instanceof Array||arguments[0].callee)?arguments[0]:arguments,d=b.length,a,c;for(c=0;c<d;c++){if(typeof(a=b[c])==="object"){a=SC.guidFor(a)}f=f[a]||(f[a]={parent:f})}return f},cachedVersionOf:function(){var a=function(c){var b=function(){var d=SC.cacheSlotFor(arguments);return d.result||(d.result=arguments.callee.func.apply(this,arguments))};b.func=c;return b};return a(a)}()});sc_require("tasks/task");SC.didPreloadBundle=function(){};SC.PreloadBundleTask=SC.Task.extend({bundle:null,target:"SC",action:"preloaded",run:function(a){var b;if(b=this.get("bundle")){var c=Date.now();SC.Module.loadModule(this.get("bundle"),this.get("target"),this.get("action"))}}});sc_require("system/string");SC.VALIDATE_OK=YES;SC.VALIDATE_NO_CHANGE=NO;SC.Validator=SC.Object.extend({fieldValueForObject:function(b,c,a){return b},objectForFieldValue:function(c,b,a){return c},validate:function(a,b){return true},validateError:function(a,b){return SC.$error(SC.String.loc("Invalid.General(%@)",b.get("fieldValue")),b.get("fieldKey"))},validateChange:function(b,c,a){return this.validate(b,c)?SC.VALIDATE_OK:this.validateError(b,c)},validateSubmit:function(a,b){return this.validate(a,b)?SC.VALIDATE_OK:this.validateError(a,b)},validatePartial:function(a,b){if(!b.get("isValid")){return this.validate(a,b)?SC.VALIDATE_OK:this.validateError(a,b)}else{return SC.VALIDATE_NO_CHANGE}},validateKeyDown:function(b,c,a){return true},attachTo:function(a,b){},detachFrom:function(a,b){}});SC.Validator.mixin({OK:true,NO_CHANGE:false,findFor:function(e,g,f){var c;if(!f){return}if(f instanceof SC.Validator){c=f}else{if(f.isClass){c=f.create()}else{if(SC.typeOf(f)===SC.T_STRING){var b=null;var a=f.match(/^(.+)\[(.*)\]/);if(a){f=a[1];b=a[2]}f=SC.String.classify(f);var d=SC.Validator[f];if(SC.none(d)){throw"validator %@ not found for %@".fmt(f,g)}else{if(b){if(!e){throw"named validator (%@) could not be found for field %@ because the field does not belong to a form".fmt(b,g)}if(!e._validatorHash){e._validatorHash={}}c=(b)?e._validatorHash[b]:null;if(!c){c=d.create()}if(b){e._validatorHash[b]=c}}else{c=d.create()}}}}}return c},fieldValueForObject:function(a,b,c){if(this.prototype&&this.prototype.fieldValueForObject){return this.prototype.fieldValueForObject(a,b,c)}else{return null}},objectForFieldValue:function(b,a,c){if(this.prototype&&this.prototype.objectForFieldValue){return this.prototype.objectForFieldValue(b,a,c)}else{return null}}});sc_require("validators/validator");SC.Validator.CreditCard=SC.Validator.extend({fieldValueForObject:function(a,b,c){if(typeof(a)=="string"&&a.length==16){a=[a.slice(0,4),a.slice(4,8),a.slice(8,12),a.slice(12,16)].join(" ")}return a},objectForFieldValue:function(b,a,c){return b.replace(/[\s-\.\:]/g,"")},validate:function(a,b){return this.checkNumber(b.get("fieldValue"))},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return SC.$error(SC.String.loc("Invalid.CreditCard(%@)",a),a)},validateKeyDown:function(b,c,a){return !!a.match(/[0-9\- ]/)},checkNumber:function(h){if(!h||h.length===0){return YES}h=h.replace(/[^0-9]/g,"");var a="0123456789";var g=h.length;var f=parseInt(h,0);var l=h.toString();l=l.replace(/^\s+|\s+$/g,"");var k=0;var n=true;var b=false;var m;var d;for(var c=0;c<g;c++){m=""+l.substring(c,c+1);if(a.indexOf(m)=="-1"){n=false}}if(!n){b=false}if((g===0)&&(b)){b=false}else{if(g>=15){for(var e=g;e>0;e--){d=parseInt(f,0)%10;d=parseInt(d,0);k+=d;e--;f=f/10;d=parseInt(f,0)%10;d=d*2;switch(d){case 10:d=1;break;case 12:d=3;break;case 14:d=5;break;case 16:d=7;break;case 18:d=9;break;default:d=d}f=f/10;k+=d}if((k%10)===0){b=true}else{b=false}}}return b}});sc_require("validators/validator");SC.Validator.Date=SC.Validator.extend({format:"%b %d, %Y %i:%M:%S %p",fieldValueForObject:function(a,b,e){var d=this.get("format"),c;if(SC.typeOf(a)===SC.T_NUMBER){c=SC.DateTime.create(a)}else{if(a instanceof Date){c=a.getTime()}}if(c){a=c.toFormattedString(d)}return a},objectForFieldValue:function(c,a,e){var d=this.get("format"),b;if(c){b=SC.DateTime.parse(c,d);c=b?b._ms:null}return c}});sc_require("validators/validator");SC.Validator.DateTime=SC.Validator.extend({format:"%d/%m/%Y",fieldValueForObject:function(a,b,c){if(SC.kindOf(a,SC.DateTime)){a=a.toFormattedString(this.get("format"))}else{a=null}return a},objectForFieldValue:function(b,a,c){if(b){b=SC.DateTime.parse(b,this.get("format"))}return b}});sc_require("validators/validator");SC.Validator.Email=SC.Validator.extend({validate:function(a,b){return(b.get("fieldValue")||"").match(/.+@.+\...+/)},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return SC.$error(SC.String.loc("Invalid.Email(%@)",a),a)}});SC.Validator.EmailOrEmpty=SC.Validator.Email.extend({validate:function(a,c){var b=c.get("fieldValue");return(b&&b.length>0)?b.match(/.+@.+\...+/):true}});sc_require("validators/validator");SC.Validator.NotEmpty=SC.Validator.extend({validate:function(a,c){var b=c.get("fieldValue");if(SC.none(b)){return NO}if(!SC.none(b.length)){return b.length>0}return YES},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return SC.$error(SC.String.loc("Invalid.NotEmpty(%@)",SC.String.capitalize(a)),c.get("errorLabel"))}});sc_require("validators/validator");sc_require("system/utils/misc");SC.Validator.Number=SC.Validator.extend({places:0,fieldValueForObject:function(a,b,c){switch(SC.typeOf(a)){case SC.T_NUMBER:a=a.toFixed(this.get("places"));break;case SC.T_NULL:case SC.T_UNDEFINED:a="";break}return a},objectForFieldValue:function(c,b,d){var a;c=c.replace(/,/g,"");switch(SC.typeOf(c)){case SC.T_STRING:if(c.length===0){c=null}else{if(this.get("places")>0){c=parseFloat(c)}else{if(c.length===1&&c.match(/-/)){c=null}else{a=parseInt(c,0);if(isNaN(a)){c=SC.uniJapaneseConvert(c);c=parseInt(c,0);if(isNaN(c)){c=""}}else{c=a}}}}break;case SC.T_NULL:case SC.T_UNDEFINED:c=null;break}return c},validate:function(a,c){var b=c.get("fieldValue");return(b==="")||!(isNaN(b)||isNaN(parseFloat(b)))},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return SC.$error(SC.String.loc("Invalid.Number(%@)",a),a)},validateKeyDown:function(b,c,a){if(!a){a=""}var d=c.$input().val();if(!d){d=""}d+=a;if(this.get("places")===0){if(a.length===0){return true}else{return d.match(/^[\-{0,1}]?[0-9,\0]*/)[0]===d}}else{if(a.length===0){return true}else{return d.match(/^[\-{0,1}]?[0-9,\0]*\.?[0-9\0]+/)===d}}}});sc_require("validators/validator");SC.Validator.Password=SC.Validator.extend({attachTo:function(a,b){arguments.callee.base.apply(this,arguments);if(!this.fields){this.fields=[]}this.fields.push(b)},validate:function(e){if(!this.fields||this.fields.length===0){return true}var d=false;var b=false;var a=true;var c=this.fields[0].get("fieldValue");this.fields.forEach(function(g){var f=g.get("fieldValue");if(f!=c){a=false}if(!f||f.length===0){d=true}if(f&&f.length>0){b=true}});if(e){return(b===false)?false:a}else{return(d===true)?true:a}},updateFields:function(c,b){if(!this.fields||this.fields.length===0){return true}var a=SC.String.loc("Invalid.Password");var d=this._field;this.fields.forEach(function(e){var g=(b)?null:((e==d)?a:"");c.setErrorFor(e,g)});return(b)?SC.VALIDATE_OK:a},validateChange:function(b,c,a){return this.updateFields(b,this.validate(false))},validateSubmit:function(a,b){return this.updateFields(a,this.validate(true))},validatePartial:function(b,c){var a=!this._field.get("isValid");if(a){return this.updateFields(b,this.validate(false))}else{return SC.VALIDATE_NO_CHANGE}}});sc_require("validators/validator");SC.Validator.PositiveInteger=SC.Validator.extend({defaultValue:null,fieldValueForObject:function(a,b,c){switch(SC.typeOf(a)){case SC.T_NUMBER:a=a.toFixed(0);break;case SC.T_NULL:case SC.T_UNDEFINED:a=this.get("defaultValue");break}return a},objectForFieldValue:function(b,a,c){b=b.replace(/,/g,"");switch(SC.typeOf(b)){case SC.T_STRING:if(b.length===0){b=this.get("defaultValue")}else{b=parseInt(b,0)}break;case SC.T_NULL:case SC.T_UNDEFINED:b=this.get("defaultValue");break}if(isNaN(b)){return this.get("defaultValue")}return b},validate:function(a,c){var b=c.get("fieldValue");return(b==="")||!isNaN(b)},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return SC.$error(SC.String.loc("Invalid.Number(%@)",a),a)},validateKeyDown:function(b,c,a){var d=c.$input().val();if(!d){d=""}d+=a;if(a.length===0){return true}else{return d.match(/^[0-9\0]*/)[0]===d}}});SC.ContainerView=SC.View.extend({classNames:["sc-container-view"],renderDelegateName:"containerRenderDelegate",nowShowing:null,contentView:null,contentViewBindingDefault:SC.Binding.single(),replaceContent:function(a){this.removeAllChildren();if(a){this.appendChild(a)}},createChildViews:function(){var a=this.get("contentView");if(a){a=this.contentView=this.createChildView(a);this.childViews=[a]}},awake:function(){arguments.callee.base.apply(this,arguments);var a=this.get("nowShowing");if(a&&a.length>0){this.nowShowingDidChange()}},nowShowingDidChange:function(){var c=this.get("nowShowing");if(c===SC.CONTENT_SET_DIRECTLY){return}var a=(this._instantiatedLastView===YES)?this.get("contentView"):null;this._instantiatedLastView=NO;if(SC.typeOf(c)===SC.T_STRING&&c.length>0){if(c.indexOf(".")>0){c=SC.objectForPropertyPath(c)}else{var b=this.getPath(c);c=SC.kindOf(b,SC.CoreView)?b:SC.objectForPropertyPath(c,this.get("page"))}}if(SC.typeOf(c)===SC.T_CLASS){if(c.kindOf(SC.CoreView)){c=this.createChildView(c);this._instantiatedLastView=YES}else{c=null}}if(c&&!(c instanceof SC.CoreView)){c=null}this.set("contentView",c);if(a){a.destroy()}}.observes("nowShowing"),contentViewDidChange:function(){this.replaceContent(this.get("contentView"))}.observes("contentView")});sc_require("mixins/validatable");SC.FieldView=SC.View.extend(SC.Control,SC.Validatable,{fieldValue:function(){var a=this.get("value");if(SC.typeOf(a)===SC.T_ERROR){a=a.get("errorValue")}return this.fieldValueForObject(a)}.property("value","validator").cacheable(),$input:function(){var a=this._inputElementTagName();return this.$(a).andSelf().filter(a)},_inputElementTagName:function(){return"input"},setFieldValue:function(b){if(SC.none(b)){b=""}var a=this.$input();if(a.val()!==b){a.val(b)}return this},getFieldValue:function(){return this.$input().val()},_field_fieldValueDidChange:function(a){SC.run(function(){this.fieldValueDidChange(NO)},this)},fieldValueDidChange:function(a){var c=this.getFieldValue();var b=this.objectForFieldValue(c,a);this.setIfChanged("value",b)},_field_valueDidChange:function(){this.setFieldValue(this.get("fieldValue"))}.observes("fieldValue"),didCreateLayer:function(){this.setFieldValue(this.get("fieldValue"));this._addChangeEvent()},willDestroyLayer:function(){SC.Event.remove(this.$input(),"change",this,this._field_fieldValueDidChange)},mouseDown:function(a){this._field_isMouseDown=YES;a.allowDefault();return YES},mouseExited:function(a){if(this._field_isMouseDown){this.set("isActive",NO)}a.allowDefault();return YES},mouseEntered:function(a){this.set("isActive",this._field_isMouseDown);a.allowDefault();return YES},mouseUp:function(a){if(this._field_isMouseDown){this.set("isActive",NO)}this._field_isMouseDown=NO;a.allowDefault();return YES},keyDown:function(b){if(b.which===9||b.keyCode===9){var a=b.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return YES}if(this.performValidateKeyDown(b)){this._isKeyDown=YES;b.allowDefault()}else{b.stop()}return YES},acceptsFirstResponder:function(){if(SC.FOCUS_ALL_CONTROLS){return this.get("isEnabled")}return NO}.property("isEnabled"),_addChangeEvent:function(){SC.Event.add(this.$input(),"change",this,this._field_fieldValueDidChange)},_field_setFieldValue:function(b){this.propertyWillChange("fieldValue");if(this.fieldValueForObject){b=this.fieldValueForObject(b)}var a=this.setFieldValue(b);this.propertyDidChange("fieldValue");return a},_field_getFieldValue:function(){var a=this.getFieldValue();if(this.objectForFieldValue){a=this.objectForFieldValue(a)}return a}});SC.IMAGE_STATE_NONE="none";SC.IMAGE_STATE_LOADING="loading";SC.IMAGE_STATE_LOADED="loaded";SC.IMAGE_STATE_FAILED="failed";SC.IMAGE_TYPE_NONE="NONE";SC.IMAGE_TYPE_URL="URL";SC.IMAGE_TYPE_CSS_CLASS="CSS_CLASS";SC.BLANK_IMAGE_DATAURL="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==";SC.BLANK_IMAGE_URL=SC.browser.isIE&&SC.browser.compare(SC.browser.engineVersion,"8")<0?"/static/sproutcore/foundation/en/production/source/resources/blank.gif":SC.BLANK_IMAGE_DATAURL;SC.BLANK_IMAGE=new Image();SC.BLANK_IMAGE.src=SC.BLANK_IMAGE_URL;SC.BLANK_IMAGE.width=SC.BLANK_IMAGE.height=1;SC.ImageView=SC.View.extend(SC.Control,SC.InnerFrame,{classNames:"sc-image-view",displayProperties:["frame","image","innerFrame","toolTip","imageValue","type"],renderDelegateName:function(){return(this.get("useCanvas")?"canvasImage":"image")+"RenderDelegate"}.property("useCanvas").cacheable(),tagName:function(){return this.get("useCanvas")?"canvas":"div"}.property("useCanvas").cacheable(),canLoadInBackground:NO,image:SC.BLANK_IMAGE,imageValue:function(){var a=this.get("value");return a&&a.isEnumerable?a.firstObject():a}.property("value").cacheable(),innerFrame:function(){var c=this.get("image"),b=c.width,a=c.height,d=this.get("frame");if(SC.none(d)){return{x:0,y:0,width:0,height:0}}return this.innerFrameForSize(b,a,d.width,d.height)}.property("align","image","scale","frame").cacheable(),localize:YES,status:SC.IMAGE_STATE_NONE,type:function(){var a=this.get("imageValue");if(SC.ImageView.valueIsUrl(a)){return SC.IMAGE_TYPE_URL}else{if(!SC.none(a)){return SC.IMAGE_TYPE_CSS_CLASS}}return SC.IMAGE_TYPE_NONE}.property("imageValue").cacheable(),useCanvas:function(){return SC.platform.supportsCanvas&&!this.get("useStaticLayout")&&this.get("type")!==SC.IMAGE_TYPE_CSS_CLASS}.property("useStaticLayout","type").cacheable(),useImageQueue:YES,value:null,viewDidResize:function(){var b=this.get("layer"),c,a;if(b){c=b.offsetWidth;a=b.offsetHeight;if(this._cachedWidth!==c||this._cachedHeight!==a){this.notifyPropertyChange("frame");this._cachedWidth=c;this._cachedHeight=a}}},init:function(){arguments.callee.base.apply(this,arguments);this._image_valueDidChange();if(this.get("useImageCache")!==undefined){SC.Logger.warn("%@ has useImageCache set, please set useImageQueue instead".fmt(this));this.set("useImageQueue",this.get("useImageCache"))}},layerDidChange:function(){if(this.get("useCanvas")){this.set("layerNeedsUpdate",YES)}}.observes("layer"),_image_valueDidChange:function(){var b=this.get("imageValue"),a=this.get("type");if(b!==this._iv_value){this._iv_value=b;this.set("image",SC.BLANK_IMAGE);if(a!==SC.IMAGE_TYPE_CSS_CLASS){this.set("status",SC.IMAGE_STATE_LOADING);if(!this._loadImageUsingCache()){this._loadImage()}}}}.observes("imageValue"),_loadImageUsingCache:function(){var c=this.get("imageValue"),b=this.get("type");if(b===SC.IMAGE_TYPE_URL&&this.get("useImageQueue")){var a=this.get("isVisibleInWindow")||this.get("canLoadInBackground");SC.imageQueue.loadImage(c,this,this._loadImageUsingCacheDidComplete,a);return YES}return NO},_loadImageUsingCacheDidComplete:function(a,c){var b=this.get("imageValue");if(b===a){if(SC.ok(c)){this.didLoad(c)}else{this.didError(c)}}},_loadImage:function(){var d=this.get("imageValue"),b=this.get("type"),c=this,f,a;if(b===SC.IMAGE_TYPE_URL){f=new Image();var e=function(){SC.run(function(){c._loadImageDidComplete(d,SC.$error("SC.Image.FailedError","Image",-101))})};var g=function(){SC.run(function(){c._loadImageDidComplete(d,f)})};a=$(f);a.bind("error",e);a.bind("abort",e);a.bind("load",g);f.src=d;return YES}return NO},_loadImageDidComplete:function(a,c){var b=this.get("imageValue");if(b===a){if(SC.ok(c)){this.didLoad(c)}else{this.didError(c)}}},didLoad:function(a){this.set("status",SC.IMAGE_STATE_LOADED);if(!a){a=SC.BLANK_IMAGE}this.set("image",a)},didError:function(a){this.set("status",SC.IMAGE_STATE_FAILED);this.set("image",SC.BLANK_IMAGE)}});SC.ImageView.valueIsUrl=function(a){return a&&SC.typeOf(a)===SC.T_STRING?a.indexOf("/")>=0:NO};sc_require("views/field");sc_require("system/text_selection");sc_require("mixins/static_layout");sc_require("mixins/editable");SC.TextFieldView=SC.FieldView.extend(SC.StaticLayout,SC.Editable,{classNames:["sc-text-field-view"],isTextField:YES,applyImmediately:YES,commitOnBlur:YES,isPassword:NO,isTextArea:NO,focused:NO,hint:"",type:"text",isBrowserFocusable:YES,autoCorrect:YES,autoCapitalize:YES,formattedHint:function(){var a=this.get("hint");return typeof(a)==="string"&&this.get("localize")?SC.String.loc(a):a}.property("hint","localize").cacheable(),hintOnFocus:YES,localize:YES,isEditing:NO,defaultTabbingEnabled:YES,isContextMenuEnabled:YES,continuouslyUpdatesValue:null,allowsErrorAsValue:YES,leftAccessoryView:null,rightAccessoryView:null,spellCheckEnabled:YES,maxLength:5096,shouldRenderBorder:YES,supportsAutoResize:YES,autoResizeLayer:function(){return this.$input()[0]}.property("layer").cacheable(),autoResizeText:function(){return this.get("value")}.property("value").cacheable(),autoResizePadding:SC.propertyFromRenderDelegate("autoResizePadding",20),_hintON:YES,init:function(){var a=this.get("value");this._hintON=((!a||a&&a.length===0)&&!this.get("hintOnFocus"))?YES:NO;var b=this.get("continouslyUpdatesValue");if(b!==null&&b!==undefined){this.set("applyImmediately",b)}return arguments.callee.base.apply(this,arguments)},isEditable:YES,selection:function(l,j){var d=this.$input()[0],f,a,c;if(j===undefined){if(d){a=null;c=null;if(!d.value){a=c=0}else{try{if("selectionStart" in d){a=d.selectionStart}if("selectionEnd" in d){c=d.selectionEnd}}catch(g){return null}if(a===null||c===null){var k=document.selection;if(k){var i=k.type;if(i&&(i==="None"||i==="Text")){f=k.createRange();if(!this.get("isTextArea")){var b=f.text.length;a=Math.abs(f.moveStart("character",0-(d.value.length+1)));c=a+b}else{var h=f.duplicate();h.moveToElementText(d);h.setEndPoint("EndToStart",f);a=h.text.length;c=a+f.text.length}}}}}return SC.TextSelection.create({start:a,end:c})}else{return null}}else{if(!j||!j.kindOf||!j.kindOf(SC.TextSelection)){throw"When setting the selection, you must specify an SC.TextSelection instance."}if(d){if(d.setSelectionRange){d.setSelectionRange(j.get("start"),j.get("end"))}else{f=d.createTextRange();a=j.get("start");f.move("character",a);f.moveEnd("character",j.get("end")-a);f.select()}}return j}}.property("fieldValue").cacheable(),displayProperties:["isBrowserFocusable","formattedHint","fieldValue","isEditing","isEditable","leftAccessoryView","rightAccessoryView","isTextArea"],createChildViews:function(){arguments.callee.base.apply(this,arguments);this.accessoryViewObserver()},acceptsFirstResponder:function(){return this.get("isEnabled")}.property("isEnabled"),accessoryViewObserver:function(){var f,h=["leftAccessoryView","rightAccessoryView"],a=h.length,b,e,d,g;for(b=0;b<a;b++){e=h[b];d=this["_"+e];g=this.get(e);if(!(d&&g&&(d===g))){if(d){f=d.get("classNames");f=f.without("sc-text-field-accessory-view");d.set("classNames",f);this.removeChild(d);d=null;this["_"+e]=null}if(g){if(g.isClass){g=g.create({layoutView:this})}f=g.get("classNames");var c="sc-text-field-accessory-view";if(f.indexOf(c)<0){f=SC.clone(f);f.push(c);g.set("classNames",f)}this.appendChild(g);this["_"+e]=g}}}}.observes("leftAccessoryView","rightAccessoryView"),layoutChildViewsIfNeeded:function(a){if(!a){a=this.get("isVisibleInWindow")}if(a&&this.get("childViewsNeedLayout")){var b=this.get("rightAccessoryView");if(b&&b.get){var c=b.get("layout");if(c){c.left=null;if(!c.right){c.right=0}b.adjust(c)}}}arguments.callee.base.apply(this,arguments)},render:function(e,f){arguments.callee.base.apply(this,arguments);var a,d,c,b;a=this.get("fieldValue");if(SC.none(a)){a=""}a=String(a);e.setClass("not-empty",a.length>0);d=this._getAccessoryViewWidths();c=d.left;b=d.right;if(c){c+="px"}if(b){b+="px"}this._renderField(e,f,a,c,b)},_forceRenderFirstTime:NO,_renderFieldLikeFirstTime:function(){this.set("_forceRenderFirstTime",YES)}.observes("isTextArea"),_renderField:function(f,k,w,i,q){var r=this.get("formattedHint"),b=this.get("hintOnFocus"),n="",j=this.get("maxLength"),u=this.get("isTextArea"),B=this.get("isEnabled"),o=this.get("isEditable"),s=this.get("autoCorrect"),C=this.get("autoCapitalize"),l=this.get("isBrowserFocusable"),F="",e="",d="",E,x,g,A,c,m,h,a,v,t;f.setClass("text-area",u);a=SC.browser.isWebkit&&SC.browser.compare(SC.browser.engineVersion,"532")<0;f.setClass("oldWebKitFieldPadding",a);if(k||this._forceRenderFirstTime){this._forceRenderFirstTime=NO;v=B?(o?"":'readonly="readonly"'):'disabled="disabled"';E=this.get("layerId");F=this.get("spellCheckEnabled")?' spellcheck="true"':' spellcheck="false"';if(s!=null){d=" autocorrect="+(!s?'"off"':'"true"')}if(s!=null){e=" autocapitalize="+(!C?'"off"':'"true"')}if(l){t='tabindex="-1"'}if(SC.platform.input.placeholder&&!b){n=' placeholder="'+r+'"'}if(this.get("shouldRenderBorder")){f.push('<div class="border"></div>')}x="";if(i||q){x='style="';if(i){x+="left:"+i+";"}if(q){x+="right:"+q+";"}x+='"'}f.push('<div class="padding" '+x+">");w=this.get("escapeHTML")?SC.RenderContext.escapeHTML(w):w;if(this._hintON&&!SC.platform.input.placeholder&&(!w||(w&&w.length===0))){w=r;f.setClass("sc-hint",YES)}if(b){var y='<div aria-hidden="true" class="hint '+(u?"":"ellipsis")+'%@">'+r+"</div>";f.push(y.fmt(w?" sc-hidden":""))}h="field";if(u){f.push('<textarea aria-label="'+r+'" aria-multiline="true" class="'+h+'" name="'+E+'" '+v+n+F+d+t+e+' maxlength="'+j+'">'+w+"</textarea></div>")}else{g=this.get("type");if(this.get("isPassword")){g="password"}f.push('<input aria-label="'+r+'" class="'+h+'" type="'+g+'" name="'+E+'" '+v+' value="'+w+'"'+n+F+t+' maxlength="'+j+'" '+d+" "+e+"/></div>")}}else{var p=this.$input(),z=p[0],D=this.get("value");if(b){this.$(".hint")[0].innerHTML=r}else{if(!b){z.placeholder=r}}if(SC.browser.name===SC.BROWSER.ie&&SC.browser.version<=8&&!u){p.css("line-height",this.get("frame").height+"px")}if(!D||(D&&D.length===0)){if(this.get("isPassword")){z.type="password"}if(!SC.platform.input.placeholder&&this._hintON){if(!this.get("isFirstResponder")){f.setClass("sc-hint",YES);p.val(r)}else{f.setClass("sc-hint",NO);p.val("")}}}if(s!=null){p.attr("autoCorrect",!s?"off":"true")}else{p.attr("autoCorrect",null)}if(C!=null){p.attr("autoCapitalize",!C?"off":"true")}else{p.attr("autoCapitalize",null)}if(!b&&SC.platform.input.placeholder){p.attr("placeholder",r)}if(l){p.removeAttr("tabindex")}else{p.attr("tabindex","-1")}c=p[0];if(c){if(!B){c.disabled="true";c.readOnly=null}else{if(!o){c.disabled=null;c.readOnly="true"}else{c.disabled=null;c.readOnly=null}}m=c.parentNode.style;if(i){if(m.left!==i){m.left=i}}else{m.left=null}if(q){if(m.right!==q){m.right=q}}else{m.right=null}}}},_getAccessoryViewWidths:function(){var c={},k=["left","right"],d=k.length,f,g,l,j,a,h,e,b;for(f=0;f<d;f++){g=k[f];l=this["_"+g+"AccessoryView"];if(l&&l.isObservable){b=l.get("frame");if(b){a=b.width;if(a){h=l.get("layout");if(h){e=h[g];a+=e}c[g]=a}}}}return c},didCreateLayer:function(){arguments.callee.base.apply(this,arguments);if(!SC.platform.input.placeholder){this.invokeLast(this._setInitialPlaceHolderIE)}if(this.get("isTextArea")){this.invokeLast(this._addTextAreaEvents)}else{this._addTextAreaEvents();if(SC.browser.isMozilla){var a=this.$input();SC.Event.add(a,"keypress",this,this._firefox_dispatch_keypress)}}if(this.get("hintOnFocus")||(SC.browser.name===SC.BROWSER.ie&&SC.browser.version<=8&&!this.get("isTextArea"))){this.invokeLast(this._fixupTextLayout)}},_fixupTextLayout:function(){var a=this.get("frame").height;if(SC.browser.name===SC.BROWSER.ie&&SC.browser.version<=8&&!this.get("isTextArea")){this.$input().css("line-height",a+"px")}if(this.get("hintOnFocus")&&!this.get("isTextArea")){this.$(".hint").css("line-height",this.$(".hint").outerHeight()+"px")}},_setInitialPlaceHolderIE:function(){if(!SC.platform.input.placeholder&&this._hintON){var a=this.$input(),b=a.val();if(!b||(b&&b.length===0)){a.val(this.get("formattedHint"))}}},_addTextAreaEvents:function(){var a=this.$input();SC.Event.add(a,"focus",this,this._textField_fieldDidFocus);SC.Event.add(a,"blur",this,this._textField_fieldDidBlur);SC.Event.add(a,"select",this,this._textField_selectionDidChange);SC.Event.add(a,"input",this,this._textField_inputDidChange)},willDestroyLayer:function(){arguments.callee.base.apply(this,arguments);var a=this.$input();SC.Event.remove(a,"focus",this,this._textField_fieldDidFocus);SC.Event.remove(a,"blur",this,this._textField_fieldDidBlur);SC.Event.remove(a,"select",this,this._textField_selectionDidChange);SC.Event.remove(a,"keypress",this,this._firefox_dispatch_keypress);SC.Event.remove(a,"input",this,this._textField_inputDidChange)},_textField_fieldDidFocus:function(a){SC.run(function(){this.set("focused",YES);this.fieldDidFocus(a);var b=this.get("value");if(!SC.platform.input.placeholder&&((!b)||(b&&b.length===0))){this._hintON=NO}},this)},_textField_fieldDidBlur:function(a){SC.run(function(){this.set("focused",NO);this.fieldDidBlur(this._origEvent||a);var b=this.get("value");if(!SC.platform.input.placeholder&&!this.get("hintOnFocus")&&((!b)||(b&&b.length===0))){this._hintON=YES}},this)},fieldDidFocus:function(a){this.becomeFirstResponder();this.beginEditing(a);if(this._didHideInterceptForPane){this._didHideInterceptForPane.showTouchIntercept();this._didHideInterceptForPane=null}var b=this.get("pane");if(b&&b.get("hasTouchIntercept")){b.hideTouchIntercept();this._didHideInterceptForPane=this.get("pane")}},fieldDidBlur:function(a){this.resignFirstResponder(a);if(this.get("commitOnBlur")){this.commitEditing(a)}var b=this._didHideInterceptForPane;if(b){b.showTouchIntercept();b=null}},_field_fieldValueDidChange:function(a){if(this.get("focused")){SC.run(function(){this.fieldValueDidChange(NO)},this)}this.updateHintOnFocus()},_textField_inputDidChange:function(){var a=SC.empty(this._fieldValueDidChangeTimer)||!this._fieldValueDidChangeTimer.get("isValid");if(this.get("applyImmediately")&&a){this.invokeLater(this.fieldValueDidChange,10)}},updateHintOnFocus:function(){var a=this.get("hintOnFocus");if(!a){return}if(this.getFieldValue()){this.$(".hint").addClass("sc-hidden")}else{this.$(".hint").removeClass("sc-hidden")}}.observes("value"),_topOffsetForFirefoxCursorFix:3,_firefox_dispatch_keypress:function(a){var d=this.get("selection"),e=this.get("value"),c=e?e.length:0,b;if(!d||((d.get("length")===0&&(d.get("start")===0)||d.get("end")===c))){b=SC.RootResponder.responder;if(a.keyCode===9){return}b.keypress.call(b,a);a.stopPropagation()}},_textField_selectionDidChange:function(){this.notifyPropertyChange("selection")},didBecomeKeyResponderFrom:function(a){if(this.get("isVisibleInWindow")){var b=this.$input()[0];try{if(b){b.focus()}}catch(c){}if(!this._txtFieldMouseDown){this.invokeLast(this._selectRootElement)}}},_selectRootElement:function(){var b=this.$input()[0],a;if(b){a=SC.browser.os===SC.OS.mac&&SC.browser.compare(SC.browser.osVersion,"10.7")===0;if(!(SC.browser.name===SC.BROWSER.safari&&a&&SC.buildLocale==="ko-kr")){b.select()}}else{this._textField_selectionDidChange()}},didLoseKeyResponderTo:function(a){var b=this.$input()[0];if(b){b.blur()}this.invokeLater("scrollToOriginIfNeeded",100)},scrollToOriginIfNeeded:function(){var b=this.get("pane");if(!b){return}var a=b.get("firstResponder");if(!a||!a.get("isTextField")){document.body.scrollTop=document.body.scrollLeft=0}},keyDown:function(a){return this.interpretKeyEvents(a)||NO},insertText:function(c,a){var f=a.which,d=a.keyCode,b=false;if(!SC.platform.input.maxlength&&this.get("isTextArea")){var e=this.get("value");if(e&&((!SC.browser.isMozilla&&f>47)||(SC.browser.isMozilla&&((f>32&&f<43)||f>47)&&!(d>36&&d<41)))&&(e.length>=this.get("maxLength"))){b=true}}if((this.performValidateKeyDown(a)||SC.platform.touch)&&!b){this._isKeyDown=YES;a.allowDefault()}else{a.stop()}if(this.get("applyImmediately")){this._fieldValueDidChangeTimer=this.invokeLater(this.fieldValueDidChange,10)}return YES},insertTab:function(b){if(!this.get("defaultTabbingEnabled")){return NO}var a=b.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return YES},insertNewline:function(a){if(this.get("isTextArea")){a.allowDefault();return YES}return NO},deleteForward:function(a){a.allowDefault();return YES},deleteBackward:function(a){a.allowDefault();return YES},moveLeft:function(a){a.allowDefault();return YES},moveRight:function(a){a.allowDefault();return YES},selectAll:function(a){a.allowDefault();return YES},moveUp:function(a){if(this.get("isTextArea")){a.allowDefault();return YES}return NO},moveDown:function(a){if(this.get("isTextArea")){a.allowDefault();return YES}return NO},keyUp:function(a){if(SC.browser.isMozilla&&a.keyCode===SC.Event.KEY_RETURN){this.fieldValueDidChange()}this.notifyPropertyChange("selection");this._isKeyDown=NO;a.allowDefault();return YES},mouseDown:function(a){var b=this.get("fieldValue");this._txtFieldMouseDown=YES;this.becomeFirstResponder();if(!this.get("isEnabled")){a.stop();return YES}else{return arguments.callee.base.apply(this,arguments)}},mouseUp:function(a){this._txtFieldMouseDown=NO;this.notifyPropertyChange("selection");if(!this.get("isEnabled")){a.stop();return YES}return arguments.callee.base.apply(this,arguments)},touchStart:function(a){return this.mouseDown(a)},touchEnd:function(a){return this.mouseUp(a)},mouseWheel:function(a){if(this.get("isTextArea")){a.allowDefault();return YES}else{return NO}},selectStart:function(a){return YES},_inputElementTagName:function(){if(this.get("isTextArea")){return"textarea"}else{return"input"}},_valueObserver:function(){var b=this.get("value"),a;if(b&&b.length>0){this._hintON=NO;a=this.get("maxLength");if(!SC.platform.input.maxlength&&b.length>a){this.set("value",b.substr(0,a))}}else{if(!this.get("hintOnFocus")){this._hintON=YES}}}.observes("value")});sc_require("views/text_field");sc_require("system/utils/misc");sc_require("delegates/inline_text_field");sc_require("mixins/inline_editor");SC.InlineTextFieldView=SC.TextFieldView.extend(SC.InlineEditor,{classNames:["inline-editor"],_topOffsetForFirefoxCursorFix:0,blurOnMouseDown:YES,_updateViewStyle:function(b){var c="",a=SC.getStyle(b,"font-size");if(a&&a.length>0){c=c+"font-size: "+a+" !important; "}a=SC.getStyle(b,"font-family");if(a&&a.length>0){c=c+"font-family: "+a+" !important; "}a=SC.getStyle(b,"font-weight");if(a&&a.length>0){c=c+"font-weight: "+a+" !important; "}a=SC.getStyle(b,"z-index");if(a&&a.length>0){c=c+"z-index: "+a+" !important; "}a=SC.getStyle(b,"line-height");if(a&&a.length>0){c=c+"line-height: "+a+" !important; "}a=SC.getStyle(b,"text-align");if(a&&a.length>0){c=c+"text-align: "+a+" !important; "}a=SC.getStyle(b,"top-margin");if(a&&a.length>0){c=c+"top-margin: "+a+" !important; "}a=SC.getStyle(b,"bottom-margin");if(a&&a.length>0){c=c+"bottom-margin: "+a+" !important; "}a=SC.getStyle(b,"left-margin");if(a&&a.length>0){c=c+"left-margin: "+a+" !important; "}a=SC.getStyle(b,"right-margin");if(a&&a.length>0){c=c+"right-margin: "+a+" !important; "}return c},_updateViewPaddingStyle:function(b){var c="",a=SC.getStyle(b,"padding-top");if(a&&a.length>0){c=c+"top: "+a+" !important; "}a=SC.getStyle(b,"padding-bottom");if(a&&a.length>0){c=c+"bottom: "+a+" !important; "}a=SC.getStyle(b,"padding-left");if(a&&a.length>0){c=c+"left: "+a+" !important; "}a=SC.getStyle(b,"padding-right");if(a&&a.length>0){c=c+"right: "+a+" !important; "}return c},updateStyle:function(d){if(d.length){d=d[0]}var a=document.getElementById("sc-inline-text-field-style"),c=this._updateViewStyle(d),e=this._updateViewPaddingStyle(d),f=".inline-editor input{"+c+"}.inline-editor textarea{"+c+"}.inline-editor .padding{"+e+"}";if(!a){var b=document.getElementsByTagName("head")[0];a=document.createElement("style");a.type="text/css";a.media="screen";a.id="sc-inline-text-field-style";b.appendChild(a)}if(a.styleSheet){a.styleSheet.cssText=f}else{a.innerHTML=f}},positionOverTargetView:function(j,d,c,b,e){var g;if(!c){c=j.get("pane")}if(!e){e=j.$()[0]}if(!b){var h=j.get("frame");b=SC.offset(e);b.height=h.height;b.width=h.width}var i={},a=c.$()[0],f=j.get("layout");i.height=b.height;i.width=b.width;g=SC.browser.isIE&&SC.browser.compare(SC.browser.engineVersion,"7")===0;if(d&&f.left){i.left=b.x-f.left-a.offsetLeft-1;if(g){i.left--}}else{i.left=b.x-a.offsetLeft-1;if(g){i.left--}}if(d&&f.top){i.top=b.y-f.top-a.offsetTop;if(g){i.top=i.top-2}}else{i.top=b.y-a.offsetTop;if(g){i.top=i.top-2}}this.set("layout",i)},multiline:NO,isTextArea:function(){return this.get("multiline")}.property("multiline").cacheable(),beginEditing:function(b,a){if(!b(a)){return NO}var d=a.get("pane"),c=this.get("exampleElement");this.beginPropertyChanges();if(c){if(c.length){c=c[0]}}else{c=a.$()[0]}this.updateStyle(c);this.positionOverTargetView(a,this.get("isCollection"),d,this.get("exampleFrame"),c);this._previousFirstResponder=d?d.get("firstResponder"):null;this.becomeFirstResponder();this.endPropertyChanges();return YES}.enhance(),blurEditor:function(a){if(!this.get("isEditing")){return YES}return this.commitOnBlur?this.commitEditing():this.discardEditing()},_endEditing:function(b){var a=b();if(this.get("isFirstResponder")){var c=this.get("pane");if(c&&this._previousFirstResponder){c.makeFirstResponder(this._previousFirstResponder)}else{this.resignFirstResponder()}}this._previousFirstResponder=null;return a}.enhance(),mouseDown:function(a){arguments.callee.base.call(this,a);return this.get("isEditing")},touchStart:function(a){this.mouseDown(a)},keyDown:function(a){var b=this.interpretKeyEvents(a);this.fieldValueDidChange(true);return !b?NO:b},insertText:null,_scitf_blurInput:function(){var a=this.$input()[0];if(a){a.blur()}a=null},willRemoveFromParent:function(){return this._scitf_blurInput()},willLoseFirstResponder:function(b,a){if(b!==this){return}this._previousFirstResponder=null;this._origEvent=a;this._scitf_blurInput();return this.blurEditor(a)},cancel:function(){this.discardEditing();return YES},insertNewline:function(a){if(this.get("isTextArea")){return arguments.callee.base.apply(this,arguments)}else{this.commitEditing();return YES}},insertTab:function(a){var c=this.target;this.resignFirstResponder();this.commitEditing();if(c){var b=c.get("nextValidKeyView");if(b&&b.beginEditing){b.beginEditing()}}return YES},insertBacktab:function(a){var c=this.target;this.resignFirstResponder();this.commitEditing();if(c){var b=c.get("previousValidKeyView");if(b&&b.beginEditing){b.beginEditing()}}return YES}});SC.mixin(SC.InlineTextFieldView,{inlineEditorDelegate:SC.InlineTextFieldDelegate,label:null,editor:null,beginEditing:function(c){var a,d,b,e,f;if(SC.typeOf(c)===SC.T_HASH){b=c;if(!b.delegate||!b.exampleElement||!b.frame){SC.error("Delegate, exampleElement, and frame options are required.");return NO}c=b.delegate;e=b.value}else{e=c.get("value")}f=SC.beget(c);f.mixin({inlineEditorWillBeginEditing:function(){if(c.inlineEditorWillBeginEditing){c.inlineEditorWillBeginEditing.apply(c,arguments)}},inlineEditorDidBeginEditing:function(){if(c.inlineEditorDidBeginEditing){c.inlineEditorDidBeginEditing.apply(c,arguments)}},inlineEditorWillCommitEditing:function(h,i,g){if(c.inlineEditorWillCommitEditing){c.inlineEditorWillCommitEditing(h,i,g)}if(c.inlineEditorWillEndEditing){c.inlineEditorWillEndEditing(h,i)}},inlineEditorDidCommitEditing:function(h,i,g){if(c.inlineEditorDidCommitEditing){c.inlineEditorDidCommitEditing(h,i,g)}if(c.inlineEditorDidEndEditing){c.inlineEditorDidEndEditing(h,i)}SC.InlineTextFieldView._endEditing()},inlineEditorWillDiscardEditing:function(h,g){if(c.inlineEditorWillDiscardEditing){c.inlineEditorWillDiscardEditing(h,g)}if(c.inlineEditorWillEndEditing){c.inlineEditorWillEndEditing(h,this.get("value"))}},inlineEditorDidDiscardEditing:function(h,g){if(c.inlineEditorDidDiscardEditing){c.inlineEditorDidDiscardEditing(h,g)}if(c.inlineEditorDidEndEditing){c.inlineEditorDidEndEditing(h,this.get("value"))}SC.InlineTextFieldView._endEditing()}});if(c.inlineEditorShouldBeginEditing&&!c.inlineEditorShouldBeginEditing(c,e)){return NO}this.editor=d=this.inlineEditorDelegate.acquireEditor(c);d.set("value",e);if(b){d.set("exampleElement",b.exampleElement);d.set("exampleFrame",b.frame);d.set("multiline",b.multiline);d.set("escapeHTML",b.escapeHTML);d.set("isCollection",b.isCollection);d.set("commitOnBLur",b.commitOnBlur);d.set("validator",b.validator)}if(d){return d.beginEditing(f)}else{return NO}},commitEditing:function(){return this.inlineEditorDelegate.editor?this.inlineEditorDelegate.editor.commitEditing():NO},discardEditing:function(){return this.inlineEditorDelegate.editor?this.inlineEditorDelegate.editor.discardEditing():NO},_endEditing:function(){this.inlineEditorDelegate.releaseEditor(this.editor);this.editor=null}});sc_require("mixins/inline_editable");sc_require("mixins/inline_editor_delegate");sc_require("delegates/inline_text_field");SC.REGULAR_WEIGHT="normal";SC.BOLD_WEIGHT="bold";SC.LabelView=SC.View.extend(SC.Control,SC.InlineEditable,{classNames:["sc-label-view"],displayProperties:["displayTitle","displayHint","escapeHTML","textAlign","fontWeight","icon","needsEllipsis","toolTip"],inlineEditorDelegate:SC.InlineTextFieldDelegate,isEditable:NO,exampleEditor:SC.InlineTextFieldView,fontWeight:null,escapeHTML:YES,escapeHTMLBindingDefault:SC.Binding.oneWay().bool(),localize:NO,localizeBindingDefault:SC.Binding.oneWay().bool(),formatter:null,value:"",hint:null,hintEnabled:function(){return this.get("isEditable")}.property("isEditable").cacheable(),icon:null,textAlign:null,supportsAutoResize:YES,autoResizeLayer:function(){return this.get("layer")}.property("layer").cacheable(),autoResizeText:function(){return this.get("displayTitle")}.property("displayTitle").cacheable(),autoResizePadding:SC.propertyFromRenderDelegate("autoResizePadding",10),renderDelegateName:"labelRenderDelegate",displayTitle:function(){var g,e;g=this.get("value");e=this.getDelegateProperty("formatter",this.displayDelegate);if(e){var f=(SC.typeOf(e)===SC.T_FUNCTION)?e(g,this):e.fieldValueForObject(g,this);if(!SC.none(f)){g=f}}if(SC.typeOf(g)===SC.T_ARRAY){var d=[];for(var b=0,c=g.get("length");b<c;b++){var a=g.objectAt(b);if(!SC.none(a)&&a.toString){a=a.toString()}d.push(a)}g=d.join(",")}if(!SC.none(g)&&g.toString){g=g.toString()}if(g&&this.getDelegateProperty("localize",this.displayDelegate)){g=SC.String.loc(g)}return g}.property("value","localize","formatter").cacheable(),displayHint:function(){var b=this.get("hint"),a=this.get("isEditable");if(a){if(b&&this.getDelegateProperty("localize",this.displayDelegate)){b=SC.String.loc(b)}}else{b=null}return b}.property("hint","localize","isEditable").cacheable(),hintValue:function(){var a=this.get("hint");return a}.property("hint").cacheable(),doubleClick:function(a){return this.beginEditing()},inlineEditorDidBeginEditing:function(b,c,d,a){this._oldOpacity=this.get("layout").opacity||1;this.adjust("opacity",0);b(c,d,a)}.enhance(),inlineEditorDidEndEditing:function(){this.adjust("opacity",this._oldOpacity);this._oldOpacity=null}});SC.allowsBackspaceToPreviousPage=NO;SC.HORIZONTAL_ORIENTATION="horizontal";SC.VERTICAL_ORIENTATION="vertical";SC.BORDER_BEZEL="sc-bezel-border";SC.BORDER_BLACK="sc-black-border";SC.BORDER_GRAY="sc-gray-border";SC.BORDER_TOP="sc-top-border";SC.BORDER_BOTTOM="sc-bottom-border";SC.BORDER_NONE=null;SC.Border={borderTop:0,borderRight:0,borderBottom:0,borderLeft:0,borderStyle:SC.BORDER_GRAY,hasBorder:YES,displayProperties:["borderStyle"],_BORDER_REGEXP:(/-border$/),initMixin:function(){this._sc_border_borderStyleDidChange();this._sc_border_borderDimensionsDidChange()},renderMixin:function(a,c){var b=this.get("borderStyle");if(b){if(this._BORDER_REGEXP.exec(b)){a.addClass(b)}else{a.addStyle("border","1px "+b+" solid")}}},_sc_border_borderStyleDidChange:function(){var a=this.get("borderStyle"),b=SC.Border.dimensions[a];if(b){this.beginPropertyChanges();this.set("borderTop",b);this.set("borderRight",b);this.set("borderBottom",b);this.set("borderLeft",b);this.endPropertyChanges()}},_sc_border_borderDimensionsDidChange:function(){var d=this.get("borderTop"),a=this.get("borderRight"),b=this.get("borderBottom"),c=this.get("borderLeft");this.adjust({borderTop:d,borderRight:a,borderBottom:b,borderLeft:c})}.observes("borderTop","borderRight","borderBottom","borderLeft")};SC.mixin(SC.Border,{dimensions:{"sc-bezel-border":1,"sc-black-border":1,"sc-gray-border":1,"sc-top-border":1,"sc-bottom-border":1}});SC.CollectionFastPath={initMixin:function(){this._indexMap={};this._viewMap={}},poolForExampleView:function(a){var b="_pool_"+SC.guidFor(a);if(!this[b]){this[b]=[]}return this[b]},createItemViewFromExampleView:function(c,b){var a=this.createItemView(c,null,b);if(a.isPoolable){a.owningPool=this.poolForExampleView(c)}a.createdFromExampleView=c;return a},configureItemView:function(b,a){b.beginPropertyChanges();b.setIfChanged("content",a.content);b.setIfChanged("contentIndex",a.contentIndex);b.setIfChanged("parentView",a.parentView);b.setIfChanged("layerId",a.layerId);b.setIfChanged("isEnabled",a.isEnabled);b.setIfChanged("isSelected",a.isSelected);b.setIfChanged("outlineLevel",a.outlineLevel);b.setIfChanged("layout",a.layout);b.setIfChanged("disclosureState",a.disclosureState);b.setIfChanged("isVisibleInWindow",a.isVisibleInWindow);b.setIfChanged("isGroupView",a.isGroupView);b.setIfChanged("page",this.page);b.endPropertyChanges()},wakePooledView:function(b,a){this.configureItemView(b,a);if(b.awakeFromPool){b.awakeFromPool(b.owningPool,this)}},allocateItemView:function(d,b){var a;if(d.prototype.isPoolable){var c=this.poolForExampleView(d);if(c.length>0){a=c.pop();this.wakePooledView(a,b)}}if(!a){a=this.createItemViewFromExampleView(d,b)}return a},releaseItemView:function(b){if(!b.isPoolable){b.destroy();return}var a=b.owningPool;a.push(b);if(b.hibernateInPool){b.hibernateInPool(a,this)}},contentIndexIsGroup:function(a,d,c){var e=this.get("contentDelegate");var b=this.get("_contentGroupIndexes"),f=NO;f=b&&b.contains(c);if(f){f=e.contentIndexIsGroup(this,this.get("content"),c)}return f},exampleViewForItem:function(f,d){var b=this.get("contentDelegate"),c=this.get("_contentGroupIndexes"),e,a,g=this.contentIndexIsGroup(this,this.get("content"),d);if(g){e=this.get("contentGroupExampleViewKey");if(e&&f){a=f.get(e)}if(!a){a=this.get("groupExampleView")||this.get("exampleView")}}else{e=this.get("contentExampleViewKey");if(e&&f){a=f.get(e)}if(!a){a=this.get("exampleView")}}return a},setAttributesForItem:function(f,d,c){var b=this.get("contentDelegate"),g=this.contentIndexIsGroup(this,this.get("content"),d),a=this.exampleViewForItem(f,d),e=this.get("content");c.createdFromExampleView=a;c.parentView=this.get("containerView")||this;c.contentIndex=d;c.owner=c.displayDelegate=this;c.content=f;c.page=this.page;c.layerId=this.layerIdFor(d);c.isEnabled=b.contentIndexIsEnabled(this,e,d);c.isSelected=b.contentIndexIsSelected(this,e,d);c.outlineLevel=b.contentIndexOutlineLevel(this,e,d);c.disclosureState=b.contentIndexDisclosureState(this,e,d);c.isVisibleInWindow=this.get("isVisibleInWindow");c.isGroupView=g;c.layout=this.layoutForContentIndex(d);if(!c.layout){c.layout=a.prototype.layout}},mappedViewsForItem:function(a,b){if(!b){b=this._viewMap}return b[SC.guidFor(a)]},mappedViewForItem:function(c,b,d){if(!d){d=this._viewMap}var a=d[SC.guidFor(c)];if(!a){return undefined}return a[b]},mapView:function(e,c,b,f){if(!f){f=this._viewMap}var d=SC.guidFor(e),a=f[d];if(!a){a=f[d]={_length:0}}a[c]=b;a._length++},unmapView:function(e,c,f){if(!f){f=this._viewMap}var d=SC.guidFor(e),a=f[d];if(!a){return}if(a[c]){var b=a[c];delete a[c];a._length--;if(a._length<=0){delete f[d]}}},itemViewForContentIndex:function(b){var d=this.get("content");if(!d){return}var c=d.objectAt(b);var e=this.exampleViewForItem(c,b),a=this._indexMap[b];if(a&&a.createdFromExampleView!==e){this.removeItemView(a);this.unmapView(c,b);a=null}if(!a){a=this.addItemView(e,c,b)}return a},nearestMappedViewIndexForItem:function(e,c,f){var b=this.mappedViewsForItem(e,f);if(!b){return null}var d=null,h=-1,g=0;for(var a in b){a=parseInt(a,10);if(isNaN(a)){continue}g=Math.abs(c-a);if(h<0||g<h){h=g;d=a}}return d},remapItemViews:function(b){var j=this._viewMap,a=(this._viewMap={}),i=(this._indexMap={}),k=[],h=this.get("content"),n;if(!h){return}var f=this._itemsToAdd;b.forEach(function(o){n=h.objectAt(o);var q=this.mappedViewsForItem(n,j);if(q){if(q[o]){var p=q[o];this.unmapView(n,o,j);this.mapView(n,o,p,a);i[o]=p}else{k.push(o)}}else{f.push(o)}},this);for(var m=0,g=k.length;m<g;m++){var l=k[m];n=h.objectAt(l);var e=this.nearestMappedViewIndexForItem(n,l,j),c;if(!SC.none(e)){c=this.mappedViewForItem(n,e,j);var d=this.exampleViewForItem(n,l);if(d===c.createdFromExampleView){this.unmapView(n,e,j);this.mapView(n,l,c,a);i[l]=c}else{f.push(l)}}else{f.push(l)}}return j},reloadIfNeeded:function(f,b){var d=this.get("content"),e;if(!f||!f.isIndexSet){f=this.get("nowShowing")}if(!b){e=this._invalidIndexes;if(!e||!this.get("isVisibleInWindow")){return this}this._invalidIndexes=NO;if(e.isIndexSet&&e.contains(f)){e=YES}if(this.willReload){this.willReload(e===YES?null:e)}}var g=this._itemsToAdd||(this._itemsToAdd=[]);var a=this.remapItemViews(f);this.processRemovals(a);if(e){this.processUpdates(e===YES?f:e)}this.processAdds();if(!b){this.clearDOMPools()}g.length=0;if(!b){var c=this.computeLayout();if(c){this.adjust(c)}if(this.didReload){this.didReload(e===YES?null:e)}}return this},processRemovals:function(c){var f=this.get("content");for(var d in c){var b=c[d];for(var e in b){e=parseInt(e,10);if(isNaN(e)){continue}var a=b[e];if(this._indexMap[e]===a){delete this._indexMap[e]}a._isInCollection=NO;this.removeItemView(a)}}},processUpdates:function(e){var b=this._itemsToUpdate,d=this.get("content"),c,a;e.forEach(function(f){c=d.objectAt(f);if(a=this.mappedViewForItem(c,f)){if(!a._isInCollection){return}var g=this.exampleViewForItem(c,f);this.updateItemView(a,g,c,f)}},this)},processAdds:function(){var f=this.get("content");var g=this._itemsToAdd,b,a=g.length,e,d;for(b=0;b<a;b++){e=g[b];d=f.objectAt(e);var h=this.exampleViewForItem(d,e);var c=this.addItemView(h,d,e)}},clearDOMPools:function(){var a=this._domPools||(this._domPools={});for(var b in a){this.clearDOMPool(a[b])}},domPoolSize:10,clearDOMPool:function(c){var b,a=c.length,d;for(b=this.domPoolSize;b<a;b++){d=c[b];this.removeChild(d);this.releaseItemView(d)}c.length=Math.min(c.length,this.domPoolSize)},domPoolForExampleView:function(d){var c=this._domPools||(this._domPools={}),a=SC.guidFor(d);var b=c[a];if(!b){b=c[a]=[]}return b},itemFromDOMPool:function(c){var b=this.domPoolForExampleView(c);if(b.length<1){return null}var a=b.shift();if(a.wakeFromDOMPool){a.wakeFromDOMPool()}return a},sendToDOMPool:function(a){var b=this.domPoolForExampleView(a.createdFromExampleView);b.push(a);var c=a.get("frame");a.adjust({top:-c.height});a.set("layerId",SC.guidFor(a));if(a.sleepInDOMPool){a.sleepInDOMPool()}},addItemView:function(e,d,c){var a,b=this._TMP_ATTRS||(this._TMP_ATTRS={});this.setAttributesForItem(d,c,b);if(a=this.itemFromDOMPool(e)){this.configureItemView(a,b);a._isInCollection=YES;this.mapView(d,c,a);this._indexMap[c]=a;return a}a=this.allocateItemView(e,b);this.appendChild(a);a._isInCollection=YES;this.mapView(d,c,a);this._indexMap[c]=a;return a},removeItemView:function(a){if(a.get("layerIsCacheable")){this.sendToDOMPool(a)}else{this.removeChild(a)}a._isInCollection=NO},updateItemView:function(d,e,c,b){if(!d.get("layerIsCacheable")||d.createdFromExampleView!==e){this.unmapView(d,b);delete this._indexMap[b];this.removeItemView(d,c,b);var f=this.addItemView(e,c,b)}else{var a=this._TMP_ATTRS||(this._TMP_ATTRS={});this.setAttributesForItem(c,b,a);this.configureItemView(d,a)}},_lastTopUpdate:0,_lastLeftUpdate:0,_tolerance:100,touchScrollDidChange:function(g,f){if(Date.now()-this._lastTouchScrollTime<25){return}var h=this.get("clippingFrame");var e=this._inScrollClippingFrame||(this._inScrollClippingFrame={x:0,y:0,width:0,height:0});e.x=h.x;e.y=h.y;e.width=h.width;e.height=h.height;e.x=g;e.y=f;var d=this.contentIndexesInRect(e);if(!d){return}var b=this.get("length"),a=d.get("max"),c=d.get("min");if(a>b||c<0){d=d.copy();d.remove(b,a-b).remove(c,0-c).freeze()}if(this._lastNowShowing){if(d.contains(this._lastNowShowing)&&this._lastNowShowing.contains(d)){return}}this._lastNowShowing=d;this.reloadIfNeeded(d,YES);this._lastTouchScrollTime=Date.now()}};SC.CollectionGroup={classNames:["sc-collection-group"]};SC.CollectionRowDelegate={isCollectionRowDelegate:YES,itemHeight:24,rowSpacing:0,rowPadding:0,rowHeight:function(b,c){var a=this.get("rowPadding");var d=this.get("itemHeight");if(c!==undefined){this.set("itemHeight",c-a*2);return c}return d+a*2}.property("itemHeight","rowPadding"),customRowHeightIndexes:null,contentIndexRowHeight:function(a,b,c){return this.get("rowHeight")}};SC.CollectionViewDelegate={isCollectionViewDelegate:YES,collectionViewSelectionForProposedSelection:function(a,b){return b},collectionViewShouldSelectIndexes:function(a,b,c){return b},collectionViewShouldDeselectIndexes:function(a,b){return b},collectionViewShouldDeleteIndexes:function(a,b){return b},collectionViewDeleteContent:function(a,c,b){if(!c){return NO}if(SC.typeOf(c.destroyAt)===SC.T_FUNCTION){c.destroyAt(b);a.selectPreviousItem(NO,1);return YES}else{if(SC.typeOf(c.removeAt)===SC.T_FUNCTION){c.removeAt(b);a.selectPreviousItem(NO,1);return YES}else{return NO}}},collectionViewShouldBeginDrag:function(a){return YES},collectionViewDragDataTypes:function(a){return[]},collectionViewDragDataForType:function(a,c,b){return null},collectionViewComputeDragOperations:function(a,b,c){return c},collectionViewValidateDragOperation:function(b,d,e,c,a){return(a&SC.DROP_ON)?SC.DRAG_NONE:e},collectionViewPerformDragOperation:function(b,d,e,c,a){return SC.DRAG_NONE},collectionViewDragViewFor:function(a,b){return null},ghostActsLikeCursor:NO};SC.NavigationBuilder={isNavigationBuilder:YES,navigationTransitions:NO,initMixin:function(){var b=SC.Animatable;if(b&&!this.isAnimatable){this.mixin(b)}else{if(!b){SC.Logger.error("SC.NavigationView and SC.NavigationBuilder require SC.Animatable to perform animations, but it is not present. Please ensure your app or framework references it.")}}var a=this.get("navigationTransitions");if(!a&&SC.Animatable){a={left:{duration:0.25,timing:SC.Animatable.TRANSITION_EASE_IN_OUT,action:"navigationBuildDidFinish"},transform:{duration:0.25,timing:SC.Animatable.TRANSITION_EASE_IN_OUT,action:"navigationBuildDidFinish"}}}if(SC.Animatable){SC.mixin(this.transitions,a)}},metrics:function(){var a=this.computeFrameWithParentFrame();return a},transform:function(a){if(SC.platform.supportsCSS3DTransforms){this.adjust("transform","translate3d("+a+"px,0px,0px)")}else{this.adjust("transform","translate("+a+"px,0px)")}},buildInNavigation:function(){var a=this.metrics();this.disableAnimation();this.transform(this.get("buildDirection")===SC.TO_LEFT?a.width:-a.width);this.enableAnimation();this.invokeLater("transform",10,0)},buildOutNavigation:function(){var a=this.metrics();this.transform(this.get("buildDirection")===SC.TO_LEFT?-a.width:a.width)},buildIn:function(){this.buildInNavigation()},buildOut:function(){this.buildOutNavigation()},resetBuild:function(){this.transform(0)},navigationBuildDidFinish:function(){if(this.isBuildingIn){this.buildInDidFinish()}else{if(this.isBuildingOut){this.buildOutDidFinish()}}}};SC.Scrollable={isScrollable:true,verticalLineScroll:20,horizontalLineScroll:20,verticalPageScroll:function(){return this.get("innerFrame").height}.property("innerFrame"),horizontalPageScroll:function(){return this.get("innerFrame").width}.property("innerFrame"),hasVerticalScroller:function(){return this.get("scrollFrame").height>this.get("innerFrame").height}.property("scrollFrame"),hasHorizontalScroller:function(){return this.get("scrollFrame").width>this.get("innerFrame").width}.property("scrollFrame"),scrollBy:function(a){var b=this.get("scrollFrame");var c=this.get("innerFrame");if(!this.get("hasVerticalScroller")){a.y=0}if(b.height<=c.height){a.y=0}if(!this.get("hasHorizontalScroller")){a.x=0}if(b.width<=c.width){a.x=0}var d={x:b.x-(a.x||0),y:b.y-(a.y||0)};this.set("scrollFrame",d);d=this.get("scrollFrame");return{x:d.x-b.x,y:d.y-b.y}},scrollTo:function(a,b){this.set("scrollFrame",{x:0-a,y:0-b})},scrollToVisible:function(b){var e=this.get("innerFrame");var d=this.get("scrollFrame");var a=this.convertFrameFromView(b.get("frame"),b);a.x-=(e.x+d.x);a.y-=(e.y+d.y);var c={x:0-d.x,y:0-d.y,width:e.width,height:e.height};c.y-=Math.max(0,SC.minY(c)-SC.minY(a));c.x-=Math.max(0,SC.minX(c)-SC.minX(a));c.y+=Math.max(0,SC.maxY(a)-SC.maxY(c));c.x+=Math.max(0,SC.maxX(a)-SC.maxX(c));this.scrollTo(c.x,c.y)},scrollDownLine:function(a){if(a===undefined){a=1}return this.scrollBy({y:this.get("verticalLineScroll")*a}).y},scrollUpLine:function(a){if(a===undefined){a=1}return 0-this.scrollBy({y:0-this.get("verticalLineScroll")*a}).y},scrollRightLine:function(a){if(a===undefined){a=1}return this.scrollTo({y:this.get("horizontalLineScroll")*a}).x},scrollLeftLine:function(a){if(a===undefined){a=1}return 0-this.scrollTo({y:0-this.get("horizontalLineScroll")*a}).x},scrollDownPage:function(a){if(a===undefined){a=1}return this.scrollBy({y:this.get("verticalPageScroll")*a}).y},scrollUpPage:function(a){if(a===undefined){a=1}return 0-this.scrollBy({y:0-this.get("verticalPageScroll")*a}).y},scrollRightPage:function(a){if(a===undefined){a=1}return this.scrollTo({y:this.get("horizontalPageScroll")*a}).x},scrollLeftPage:function(a){if(a===undefined){a=1}return 0-this.scrollTo({y:0-this.get("horizontalPageScroll")*a}).x}};SC.ModalPane=SC.Pane.extend({classNames:"sc-modal",_openPaneCount:0,paneWillAppend:function(e){var d;this._openPaneCount++;if(!this.get("isVisibleInWindow")){this.append()}var c=SC.RootResponder.responder.panes;for(var b=0,a=c.length;b<a;b++){d=c[b];if(d!==e){this._hideShowTextfields(d,NO)}}return this},paneDidRemove:function(e){var d;this._openPaneCount--;var c=SC.RootResponder.responder.panes;for(var b=0,a=c.length;b<a;b++){d=c[b];if(d!==e){this._hideShowTextfields(d,YES)}}if(this._openPaneCount<=0){this._openPaneCount=0;if(this.get("isVisibleInWindow")){this.remove()}}},_hideShowTextfields:function(c,b){var a;for(a in SC.View.views){a=SC.View.views[a];if(a!==c&&a.get("pane")===c&&a.get("isTextField")){if(b){if(a._scmp_isBrowserFocusable!==undefined){b=a._scmp_isBrowserFocusable;delete a._scmp_isBrowserFocusable}}else{a._scmp_isBrowserFocusable=a.get("isBrowserFocusable")}a.set("isBrowserFocusable",b)}}},mouseDown:function(b){var a=this.get("owner");if(a&&a.modalPaneDidClick){a.modalPaneDidClick(b)}},touchStart:function(a){this.mouseDown(a)}});sc_require("panes/modal");SC.PanelPane=SC.Pane.extend({isPanelPane:YES,classNames:["sc-panel"],acceptsKeyPane:YES,ariaRole:"dialog",ariaLabel:null,ariaLabelledBy:null,ariaDescribedBy:null,isModal:YES,modalPane:SC.ModalPane.extend({classNames:"for-sc-panel"}),contentView:null,contentViewBindingDefault:SC.Binding.single(),replaceContent:function(a){this.removeAllChildren();if(a){this.appendChild(a)}},createChildViews:function(){var a=this.contentView;if(a){a=this.contentView=this.createChildView(a);this.childViews=[a]}},contentViewDidChange:function(){this.replaceContent(this.get("contentView"))}.observes("contentView"),renderDelegateName:"panelRenderDelegate",_modalPane:function(){var a=this.get("modalPane");if(a&&a.isClass){a=a.create({owner:this});this.set("modalPane",a)}return a},appendTo:function(a){var b;if(!this.get("isVisibleInWindow")&&this.get("isModal")&&(b=this._modalPane())){this._isShowingModal=YES;b.paneWillAppend(this)}return arguments.callee.base.apply(this,arguments)},remove:function(){var b,a=arguments.callee.base.apply(this,arguments);if(this._isShowingModal){this._isShowingModal=NO;if(b=this._modalPane()){b.paneDidRemove(this)}}return a},destroy:function(){var a=this.get("modalPane");if(a&&!a.isClass){a.destroy()}arguments.callee.base.apply(this,arguments)},_isModalDidChange:function(){var b,a=this.get("isModal");if(a){if(!this._isShowingModal&&this.get("isVisibleInWindow")&&(b=this._modalPane())){this._isShowingModal=YES;b.paneWillAppend(this)}}else{if(this._isShowingModal&&(b=this._modalPane())){this._isShowingModal=NO;b.paneDidRemove(this)}}}.observes("isModal"),paneDidAttach:function(){var a=arguments.callee.base.apply(this,arguments);this.becomeKeyPane();return a},displayProperties:["ariaLabel","ariaLabelledBy","ariaDescribedBy"]});SC.TOGGLE_BEHAVIOR="toggle";SC.PUSH_BEHAVIOR="push";SC.TOGGLE_ON_BEHAVIOR="on";SC.TOGGLE_OFF_BEHAVIOR="off";SC.HOLD_BEHAVIOR="hold";SC.ButtonView=SC.View.extend(SC.Control,{acceptsFirstResponder:function(){if(SC.FOCUS_ALL_CONTROLS){return this.get("isEnabled")}return NO}.property("isEnabled"),classNames:["sc-button-view"],themeName:"square",value:null,toggleOnValue:YES,toggleOffValue:NO,localize:NO,localizeBindingDefault:SC.Binding.bool(),title:"",tooltip:"",contentTitleKey:null,icon:null,contentIconKey:null,needsEllipsis:YES,displayTitle:function(){var a=this.get("title");return(a&&this.get("localize"))?SC.String.loc(a):(a||"")}.property("title","localize").cacheable(),keyEquivalent:null,buttonBehavior:SC.PUSH_BEHAVIOR,holdInterval:100,isDefault:NO,isDefaultBindingDefault:SC.Binding.oneWay().bool(),isCancel:NO,isCancelBindingDefault:SC.Binding.oneWay().bool(),action:null,target:null,supportFocusRing:NO,supportsAutoResize:YES,autoResizeLayer:function(){var a=this.invokeRenderDelegateMethod("getRenderedAutoResizeLayer",this.$());return a||this.get("layer")}.property("layer").cacheable(),autoResizeText:function(){return this.get("displayTitle")}.property("displayTitle").cacheable(),autoResizePadding:SC.propertyFromRenderDelegate("autoResizePadding",10),_labelMinWidthIE7:0,triggerActionAfterDelay:function(a){if(!this.get("isEnabled")){return NO}this.set("isActive",YES);this.invokeLater("triggerAction",200,a);return YES},triggerAction:function(a){this._action(a,YES);this.didTriggerAction();this.set("isActive",NO)},didTriggerAction:function(){},init:function(){arguments.callee.base.apply(this,arguments);var a=this.get("keyEquivalent");if(a){this._defaultKeyEquivalent=a}if(!SC.none(this.get("value"))){this._button_valueDidChange()}},ariaRole:"button",displayProperties:["icon","displayTitle","value","displayToolTip","isDefault","isCancel","escapeHTML","needsEllipsis","tooltip","supportFocusRing","buttonBehavior"],renderDelegateName:"buttonRenderDelegate",contentKeys:{contentValueKey:"value",contentTitleKey:"title",contentIconKey:"icon"},_button_displayObserver:function(){this.displayDidChange()}.observes("title","icon","value"),performKeyEquivalent:function(c,b){if(!this.get("isVisibleInWindow")){return NO}if(!this.get("isEnabled")){return NO}var a=this.get("keyEquivalent");if(a){if(a===c){return this.triggerAction(b)}}else{if((this.get("isDefault")&&(c==="return"))||(this.get("isCancel")&&(c==="escape"))){return this.triggerAction(b)}}return NO},computeIsSelectedForValue:function(d){var b=this.get("toggleOnValue"),c,a;if(SC.typeOf(d)===SC.T_ARRAY){if(d.length===1){c=(d[0]==b)}else{c=null;d.find(function(e){a=(e==b);if(c===null){c=a}else{if(a!==c){c=SC.MIXED_STATE}}return c===SC.MIXED_STATE})}}else{if(d===SC.MIXED_STATE){c=SC.MIXED_STATE}else{c=(d===b)}}return c},_button_valueDidChange:function(){var b=this.get("value"),a=this.computeIsSelectedForValue(b);this.set("isSelected",a)}.observes("value"),_button_isSelectedDidChange:function(){var c=this.get("isSelected"),b=this.computeIsSelectedForValue(this.get("value"));if((c!==SC.MIXED_STATE)&&(b!==c)){var a=(c)?"toggleOnValue":"toggleOffValue";this.set("value",this.get(a))}}.observes("isSelected"),_defaultKeyEquivalent:null,_isDefaultOrCancelDidChange:function(){var b=!!this.get("isDefault"),a=!b&&this.get("isCancel");if(b){this.set("keyEquivalent","return")}else{if(a){this.set("keyEquivalent","escape")}else{this.set("keyEquivalent",this._defaultKeyEquivalent)}}}.observes("isDefault","isCancel"),mouseDown:function(a){var b=this.get("buttonBehavior");if(!this.get("isEnabled")){return YES}this.set("isActive",YES);this._isMouseDown=YES;if(b===SC.HOLD_BEHAVIOR){this._action(a)}else{if(!this._isFocused&&(b!==SC.PUSH_BEHAVIOR)){this._isFocused=YES;this.becomeFirstResponder()}}return YES},mouseExited:function(a){if(this._isMouseDown){this.set("isActive",NO)}return YES},mouseEntered:function(a){if(this._isMouseDown){this.set("isActive",YES)}return YES},mouseUp:function(b){if(this._isMouseDown){this.set("isActive",NO)}this._isMouseDown=false;if(this.get("buttonBehavior")!==SC.HOLD_BEHAVIOR){var a=this.$().within(b.target);if(a&&this.get("isEnabled")){this._action(b)}}return YES},touchStart:function(b){var a=this.get("buttonBehavior");if(!this.get("isEnabled")){return YES}this.set("isActive",YES);if(a===SC.HOLD_BEHAVIOR){this._action(b)}else{if(!this._isFocused&&(a!==SC.PUSH_BEHAVIOR)){this._isFocused=YES;this.becomeFirstResponder()}}b.preventDefault();return YES},touchesDragged:function(a,b){if(!this.touchIsInBoundary(a)){if(!this._touch_exited){this.set("isActive",NO)}this._touch_exited=YES}else{if(this._touch_exited){this.set("isActive",YES)}this._touch_exited=NO}a.preventDefault();return YES},touchEnd:function(a){this._touch_exited=NO;this.set("isActive",NO);if(this.get("buttonBehavior")!==SC.HOLD_BEHAVIOR){if(this.touchIsInBoundary(a)&&this.get("isEnabled")){this._action()}}a.preventDefault();return YES},keyDown:function(b){if(!this.get("isEnabled")){return YES}if(b.which===9||b.keyCode===9){var a=b.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return YES}if(b.which===13||b.which===32){this.triggerActionAfterDelay(b);return YES}b.allowDefault();return NO},_action:function(a,c){switch(this.get("buttonBehavior")){case SC.TOGGLE_BEHAVIOR:var b=this.get("isSelected");if(b){this.set("value",this.get("toggleOffValue"))}else{this.set("value",this.get("toggleOnValue"))}break;case SC.TOGGLE_ON_BEHAVIOR:this.set("value",this.get("toggleOnValue"));break;case SC.TOGGLE_OFF_BEHAVIOR:this.set("value",this.get("toggleOffValue"));break;case SC.HOLD_BEHAVIOR:this._runHoldAction(a,c);break;default:this._runAction(a)}},_runAction:function(a){var c=this.get("action"),d=this.get("target")||null,b;if(c){if(c&&(SC.typeOf(c)===SC.T_FUNCTION)){this.action(a);return}else{b=this.getPath("pane.rootResponder");if(b){b.sendAction(c,d,this,this.get("pane"),null,this)}}}},_runHoldAction:function(a,b){if(this.get("isActive")){this._runAction();if(!b){SC.RunLoop.begin();this.invokeLater("_runHoldAction",this.get("holdInterval"),a);SC.RunLoop.end()}}},didBecomeKeyResponderFrom:function(a){if(!this._isFocused){this._isFocused=YES;this.becomeFirstResponder();if(this.get("isVisibleInWindow")){this.$().focus()}}},willLoseKeyResponderTo:function(a){if(this._isFocused){this._isFocused=NO}},didAppendToDocument:function(){if(SC.browser.isIE&&SC.browser.compare(SC.browser.engineVersion,"7")===0&&this.get("useStaticLayout")){var e=this.get("layout"),d=this.$(),a=0;if(d&&d[0]&&(a=d[0].clientWidth)&&a!==0&&this._labelMinWidthIE7===0){var c=this.$(".sc-button-label"),h=parseInt(c.css("paddingRight"),0),b=parseInt(c.css("paddingLeft"),0),g=parseInt(c.css("marginRight"),0),f=parseInt(c.css("marginLeft"),0);if(g=="auto"){SC.Logger.log(g+","+f+","+h+","+b)}if(!h&&isNaN(h)){h=0}if(!b&&isNaN(b)){b=0}if(!g&&isNaN(g)){g=0}if(!f&&isNaN(f)){f=0}this._labelMinWidthIE7=a-(h+b)-(g+f);c.css("minWidth",this._labelMinWidthIE7+"px")}else{this.invokeLater(this.didAppendToDocument,1)}}}});SC.ButtonView.CLICK_AND_HOLD_DELAY=SC.browser.isIE?600:300;SC.REGULAR_BUTTON_HEIGHT=24;sc_require("panes/panel");sc_require("views/button");SC.BUTTON1_STATUS="button1";SC.BUTTON2_STATUS="button2";SC.BUTTON3_STATUS="button3";SC.AlertPane=SC.PanelPane.extend({classNames:["sc-alert"],ariaRole:"alertdialog",delegate:null,icon:"sc-icon-alert-48",message:"",ariaLabel:function(){return this.get("message")}.property("message").cacheable(),description:"",displayDescription:function(){var a=this.get("description");if(!a||a.length===0){return a}a=SC.RenderContext.escapeHTML(a);return'<p class="description">'+a.split("\n").join('</p><p class="description">')+"</p>"}.property("description").cacheable(),caption:"",displayCaption:function(){var a=this.get("caption");if(!a||a.length===0){return a}a=SC.RenderContext.escapeHTML(a);return'<p class="caption">'+a.split("\n").join('</p><p class="caption">')+"</p>"}.property("caption").cacheable(),button1:SC.outlet("contentView.childViews.1.childViews.1"),button2:SC.outlet("contentView.childViews.1.childViews.0"),button3:SC.outlet("contentView.childViews.2.childViews.0"),buttonThreeWrapper:SC.outlet("contentView.childViews.2"),layout:{top:0.3,centerX:0,width:500},contentView:SC.View.extend({useStaticLayout:YES,layout:{left:0,right:0,top:0,height:"auto"},childViews:[SC.View.extend(SC.StaticLayout,{classNames:["info"],render:function(a,c){var b=this.get("pane");if(b.get("icon")=="blank"){a.addClass("plain")}a.push('<img src="'+SC.BLANK_IMAGE_URL+'" class="icon '+b.get("icon")+'" />');a.begin("h1").attr("class","header").text(b.get("message")||"").end();a.push(b.get("displayDescription")||"");a.push(b.get("displayCaption")||"");a.push('<div class="separator"></div>')}}),SC.View.extend({layout:{bottom:13,height:24,right:18,width:466},childViews:["cancelButton","okButton"],classNames:["text-align-right"],cancelButton:SC.ButtonView.extend({useStaticLayout:YES,actionKey:SC.BUTTON2_STATUS,localize:YES,layout:{right:5,height:"auto",width:"auto",bottom:0},isCancel:YES,action:"dismiss",isVisible:NO}),okButton:SC.ButtonView.extend({useStaticLayout:YES,actionKey:SC.BUTTON1_STATUS,localize:YES,layout:{left:0,height:"auto",width:"auto",bottom:0},isDefault:YES,action:"dismiss",isVisible:NO})}),SC.View.extend({layout:{bottom:13,height:24,left:18,width:150},childViews:[SC.ButtonView.extend({useStaticLayout:YES,actionKey:SC.BUTTON3_STATUS,localize:YES,layout:{left:0,height:"auto",width:"auto",bottom:0},action:"dismiss",isVisible:NO})]})]}),dismiss:function(b){var a=this.delegate,c,d,e;if(a&&a.alertPaneDidDismiss){a.alertPaneDidDismiss(this,b.get("actionKey"))}if(d=(b&&b.get("customAction"))){if(SC.typeOf(d)===SC.T_FUNCTION){d.call(d)}else{c=this.getPath("pane.rootResponder");if(c){e=b.get("customTarget");c.sendAction(d,e||a,this,this,null,this)}}}this.remove()},alertInfoDidChange:function(){var a=this.getPath("contentView.childViews.0");if(a){a.displayDidChange()}}.observes("icon","message","displayDescription","displayCaption")});SC.AlertPane.mixin({show:function(f){f=SC.AlertPane._argumentsCall.apply(this,arguments);var a=this.create(f),j=0,g=f.buttons,e,h,b,d,c;if(g){g.forEach(function(k){j++;if(!k){return}e=a.get("button%@".fmt(j));h=k.title;b=k.action;d=k.target;c=f.themeName||"capsule";e.set("title".fmt(j),h);if(b){e.set("customAction".fmt(j),b)}if(d){e.set("customTarget".fmt(j),d)}e.set("isVisible",!!h);e.set("themeName",c)})}else{e=a.get("button1");e.set("title","OK");e.set("isVisible",YES)}var i=a.append();a.adjust("height",a.childViews[0].$().height());a.updateLayout();return i},warn:function(a){a=SC.AlertPane._argumentsCall.apply(this,arguments);a.icon="sc-icon-alert-48";return this.show(a)},info:function(a){a=SC.AlertPane._argumentsCall.apply(this,arguments);a.icon="sc-icon-info-48";return this.show(a)},error:function(a){a=SC.AlertPane._argumentsCall.apply(this,arguments);a.icon="sc-icon-error-48";return this.show(a)},plain:function(a){a=SC.AlertPane._argumentsCall.apply(this,arguments);a.icon="blank";return this.show(a)},_argumentsCall:function(b){var a=b;if(SC.typeOf(b)!==SC.T_HASH){var c=this._normalizeArguments(arguments);a={message:c[0],description:c[1],caption:c[2],delegate:c[7],icon:(c[6]||"sc-icon-alert-48"),themeName:"capsule"};if(SC.typeOf(c[3])===SC.T_STRING||SC.typeOf(c[4])===SC.T_STRING||SC.typeOf(c[5])===SC.T_STRING){a.buttons=[{title:c[3]},{title:c[4]},{title:c[5]}]}}return a},_normalizeArguments:function(b){b=SC.A(b);var a=b.length,c=b[a-1];if(SC.typeOf(c)!==SC.T_STRING){b[a-1]=null}else{c=null}b[7]=c;return b}});sc_require("panes/panel");SC.PalettePane=SC.PanelPane.extend({classNames:["sc-palette"],isModal:NO,modalPane:SC.ModalPane,isAnchored:NO,_mouseOffsetX:null,_mouseOffsetY:null,mouseDown:function(a){var b=this.get("frame");this._mouseOffsetX=b?(b.x-a.pageX):0;this._mouseOffsetY=b?(b.y-a.pageY):0;return YES},mouseDragged:function(a){if(!this.isAnchored){this.set("layout",{width:this.layout.width,height:this.layout.height,left:this._mouseOffsetX+a.pageX,top:this._mouseOffsetY+a.pageY});this.updateLayout()}return YES},touchStart:function(a){return this.mouseDown(a)},touchesDragged:function(a){return this.mouseDragged(a)}});sc_require("panes/palette");SC.PICKER_MENU="menu";SC.PICKER_FIXED="fixed";SC.PICKER_POINTER="pointer";SC.PICKER_MENU_POINTER="menu-pointer";SC.POINTER_LAYOUT=["perfectRight","perfectLeft","perfectTop","perfectBottom"];SC.PickerPane=SC.PalettePane.extend({classNames:["sc-picker"],isAnchored:YES,isModal:YES,pointerPos:"perfectRight",pointerPosX:0,pointerPosY:0,anchorElement:null,anchorCached:null,preferType:null,preferMatrix:null,pointerOffset:null,extraRightOffset:0,removeTarget:null,removeAction:null,repositionOnWindowResize:YES,_anchorView:null,_anchorHTMLElement:null,popup:function(c,b,d,a){if(c){if(c.isView){this._anchorView=c;this._setupScrollObservers(c)}else{this._anchorHTMLElement=c}}this.beginPropertyChanges();if(b){this.set("preferType",b)}if(d){this.set("preferMatrix",d)}if(a){this.set("pointerOffset",a)}this.endPropertyChanges();this.positionPane();this._hideOverflow();return this.append()},positionPane:function(f){f=f&&this.get("anchorCached");var b=f?this.get("anchorCached"):this.get("anchorElement"),c=this.get("preferType"),d=this.get("preferMatrix"),e=this.get("layout"),a;if(b){if(!f){b=this.computeAnchorRect(b);this.set("anchorCached",b)}if(b.x===0&&b.y===0){return}a=SC.cloneRect(b);if(c){switch(c){case SC.PICKER_MENU:case SC.PICKER_FIXED:if(!d||d.length!==3){this.set("preferMatrix",[1,4,3])}a.x+=((this.preferMatrix[2]===0)?a.width:0)+this.preferMatrix[0];a.y+=((this.preferMatrix[2]===3)?a.height:0)+this.preferMatrix[1];break;default:a.y+=a.height;break}}else{a.y+=a.height}a=this.fitPositionToScreen(a,this.get("frame"),b);this.adjust({width:a.width,height:a.height,left:a.x,top:a.y})}else{this.adjust({width:e.width,height:e.height,centerX:0,centerY:0})}this.updateLayout();return this},computeAnchorRect:function(c){var e,b,d,a=SC.RootResponder.responder.computeWindowSize();if(c.getBoundingClientRect){e=c.getBoundingClientRect();b={x:e.left,y:e.top,width:e.width,height:e.height};if(b.width===undefined||b.height===undefined){d=SC.$(c);b.width=d.outerWidth();b.height=d.outerHeight()}}else{b=SC.offset(c);d=SC.$(c);b.width=d.outerWidth();b.height=d.outerHeight()}b.height=(a.height-b.y)<b.height?(a.height-b.y):b.height;if(!SC.browser.isIE&&window.scrollX>0||window.scrollY>0){b.x+=window.scrollX;b.y+=window.scrollY}else{if(SC.browser.isIE&&(document.documentElement.scrollTop>0||document.documentElement.scrollLeft>0)){b.x+=document.documentElement.scrollLeft;b.y+=document.documentElement.scrollTop}}return b},fitPositionToScreen:function(h,c,b){var a=SC.RootResponder.responder.computeWindowSize(),g={x:0,y:0,width:a.width,height:a.height};var d=SC.RootResponder.responder.mainPane;if(d){var e=d.layout.minWidth,f=d.layout.minHeight;if(e&&g.width<e){g.width=d.layout.minWidth}if(f&&g.height<f){g.height=d.layout.minHeight}}c.x=h.x;c.y=h.y;if(this.preferType){switch(this.preferType){case SC.PICKER_MENU:c=this.fitPositionToScreenMenu(g,c,this.get("isSubMenu"));break;case SC.PICKER_MENU_POINTER:this.setupPointer(b);c=this.fitPositionToScreenMenuPointer(g,c,b);break;case SC.PICKER_POINTER:this.setupPointer(b);c=this.fitPositionToScreenPointer(g,c,b);break;case SC.PICKER_FIXED:break;default:break}}else{c=this.fitPositionToScreenDefault(g,c,b)}this.displayDidChange();return c},fitPositionToScreenDefault:function(c,d,b){if(SC.maxX(d)>c.width){var e=Math.max(SC.maxX(b),d.width);d.x=Math.min(e,c.width)-d.width}if(SC.minX(d)<0){d.x=SC.minX(Math.max(b,0));if(SC.maxX(d)>c.width){d.x=Math.max(0,c.width-d.width)}}if(SC.maxY(d)>c.height){e=Math.max((b.y-d.height),0);if(e>c.height){d.y=Math.max(0,c.height-d.height)}else{d.y=e}}if(SC.minY(d)<0){e=Math.min(SC.maxY(b),(c.height-b.height));d.y=Math.max(e,0)}return d},fitPositionToScreenMenu:function(c,b,a){if(a){b.x-=this.get("submenuOffsetX");b.y-=Math.floor(this.get("menuHeightPadding")/2)}if((b.x+b.width)>(c.width-20)){if(a){b.x=b.x-(b.width*2)}else{b.x=c.width-b.width-20}}if(b.x<7){b.x=7}if(b.y<7){b.height+=b.y;b.y=7}if(b.height+b.y+35>=c.height){if(b.height+50>=c.height){b.y=SC.MenuPane.VERTICAL_OFFSET;b.height=c.height-(SC.MenuPane.VERTICAL_OFFSET*2)}else{b.y+=(c.height-(b.height+b.y+35))}}return b},fitPositionToScreenMenuPointer:function(c,d,b){d=this.fitPositionToScreenPointer(c,d,b);if(d.height+d.y+35>=c.height){d.height=c.height-d.y-(SC.MenuPane.VERTICAL_OFFSET*2)}return d},fitPositionToScreenPointer:function(o,l,n){var h=[this.pointerOffset[0],this.pointerOffset[1],this.pointerOffset[2],this.pointerOffset[3]];var e=[[n.x+n.width+h[0],n.y+parseInt(n.height/2,0)-40],[n.x-l.width+h[1],n.y+parseInt(n.height/2,0)-40],[n.x+parseInt((n.width/2)-(l.width/2),0),n.y-l.height+h[2]],[n.x+parseInt((n.width/2)-(l.width/2),0),n.y+n.height+h[3]]];var c=[[n.x+n.width+l.width+h[0],n.y+parseInt(n.height/2,0)+l.height-24],[n.x+h[1],n.y+parseInt(n.height/2,0)+l.height-24],[n.x+parseInt((n.width/2)-(l.width/2),0)+l.width,n.y+h[2]],[n.x+parseInt((n.width/2)-(l.width/2),0)+l.width,n.y+n.height+l.height+h[3]]];var g=[[e[0][1]>0?0:0-e[0][1],c[0][0]<o.width?0:c[0][0]-o.width,c[0][1]<o.height?0:c[0][1]-o.height,e[0][0]>0?0:0-e[0][0]],[e[1][1]>0?0:0-e[1][1],c[1][0]<o.width?0:c[1][0]-o.width,c[1][1]<o.height?0:c[1][1]-o.height,e[1][0]>0?0:0-e[1][0]],[e[2][1]>0?0:0-e[2][1],c[2][0]<o.width?0:c[2][0]-o.width,c[2][1]<o.height?0:c[2][1]-o.height,e[2][0]>0?0:0-e[2][0]],[e[3][1]>0?0:0-e[3][1],c[3][0]<o.width?0:c[3][0]-o.width,c[3][1]<o.height?0:c[3][1]-o.height,e[3][0]>0?0:0-e[3][0]]];var d=this.preferMatrix;if(d[4]===-1){l.x=n.x+parseInt(n.width/2,0);l.y=n.y+parseInt(n.height/2,0)-parseInt(l.height/2,0);this.set("pointerPos",SC.POINTER_LAYOUT[0]+" fallback");this.set("pointerPosY",parseInt(l.height/2,0)-40)}else{l.x=e[d[4]][0];l.y=e[d[4]][1];this.set("pointerPos",SC.POINTER_LAYOUT[d[4]]);this.set("pointerPosY",0)}this.set("pointerPosX",0);for(var j=0,b,k=SC.POINTER_LAYOUT.length;j<k;j++){b=d[j];if(g[b][0]===0&&g[b][1]===0&&g[b][2]===0&&g[b][3]===0){if(d[4]!==b){l.x=e[b][0];l.y=e[b][1];this.set("pointerPosY",0);this.set("pointerPos",SC.POINTER_LAYOUT[b])}j=SC.POINTER_LAYOUT.length}else{if((b===0||b===1)&&g[b][0]===0&&g[b][1]===0&&g[b][2]<l.height-91&&g[b][3]===0){if(d[4]!==b){l.x=e[b][0];this.set("pointerPos",SC.POINTER_LAYOUT[b])}l.y=e[b][1]-g[b][2];this.set("pointerPosY",g[b][2]);j=SC.POINTER_LAYOUT.length}else{if((b===0||b===1)&&g[b][0]===0&&g[b][1]===0&&g[b][2]<=l.height-51&&g[b][3]===0){if(d[4]!==b){l.x=e[b][0]}l.y=e[b][1]-(l.height-51);this.set("pointerPosY",(l.height-53));this.set("pointerPos",SC.POINTER_LAYOUT[b]+" extra-low");j=SC.POINTER_LAYOUT.length}else{if((b===2||b===3)&&g[b][0]===0&&g[b][1]<=parseInt(l.width/2,0)-this.get("extraRightOffset")&&g[b][2]===0&&g[b][3]===0){if(d[4]!==b){l.y=e[b][1]}l.x=e[b][0]-(parseInt(l.width/2,0)-this.get("extraRightOffset"));this.set("pointerPos",SC.POINTER_LAYOUT[b]+" extra-right");j=SC.POINTER_LAYOUT.length}else{if((b===2||b===3)&&g[b][0]===0&&g[b][1]===0&&g[b][2]===0&&g[b][3]<=parseInt(l.width/2,0)-this.get("extraRightOffset")){if(d[4]!==b){l.y=e[b][1]}l.x=e[b][0]+(parseInt(l.width/2,0)-this.get("extraRightOffset"));this.set("pointerPos",SC.POINTER_LAYOUT[b]+" extra-left");j=SC.POINTER_LAYOUT.length}}}}}}return l},setupPointer:function(f){var g=this.pointerOffset,e=SC.PickerPane;if(!g||g.length!==4){if(this.get("preferType")==SC.PICKER_MENU_POINTER){switch(this.get("controlSize")){case SC.TINY_CONTROL_SIZE:this.set("pointerOffset",e.TINY_PICKER_MENU_POINTER_OFFSET);this.set("extraRightOffset",e.TINY_PICKER_MENU_EXTRA_RIGHT_OFFSET);break;case SC.SMALL_CONTROL_SIZE:this.set("pointerOffset",e.SMALL_PICKER_MENU_POINTER_OFFSET);this.set("extraRightOffset",e.SMALL_PICKER_MENU_EXTRA_RIGHT_OFFSET);break;case SC.REGULAR_CONTROL_SIZE:this.set("pointerOffset",e.REGULAR_PICKER_MENU_POINTER_OFFSET);this.set("extraRightOffset",e.REGULAR_PICKER_MENU_EXTRA_RIGHT_OFFSET);break;case SC.LARGE_CONTROL_SIZE:this.set("pointerOffset",e.LARGE_PICKER_MENU_POINTER_OFFSET);this.set("extraRightOffset",e.LARGE_PICKER_MENU_EXTRA_RIGHT_OFFSET);break;case SC.HUGE_CONTROL_SIZE:this.set("pointerOffset",e.HUGE_PICKER_MENU_POINTER_OFFSET);this.set("extraRightOffset",e.HUGE_PICKER_MENU_EXTRA_RIGHT_OFFSET);break}}else{var d=(f.width<16)?((f.width<4)?9:6):0,b=(f.height<16)?((f.height<4)?9:6):0,c=e.PICKER_POINTER_OFFSET;var h=[c[0]+d,c[1]-d,c[2]-b,c[3]+b];this.set("pointerOffset",h);this.set("extraRightOffset",e.PICKER_EXTRA_RIGHT_OFFSET)}}if(!this.preferMatrix||this.preferMatrix.length!==5){this.set("preferMatrix",this.get("preferType")===SC.PICKER_MENU_POINTER?[3,2,1,0,3]:[0,1,2,3,2])}},displayProperties:["preferType","pointerPos","pointerPosY"],renderDelegateName:"pickerRenderDelegate",modalPaneDidClick:function(a){var d=this.get("frame"),e=this.get("removeTarget")||null,c=this.get("removeAction"),b=this.get("rootResponder");if(!this.clickInside(d,a)){if(c){b.sendAction(c,e,this,this,null,this)}else{this.remove()}return YES}return NO},mouseDown:function(a){return this.modalPaneDidClick(a)},clickInside:function(b,a){return SC.pointInRect({x:a.pageX,y:a.pageY},b)},windowSizeDidChange:function(b,a){if(this.repositionOnWindowResize){this.positionPane()}},remove:function(){if(this.get("isVisibleInWindow")&&this.get("isPaneAttached")){this._withdrawOverflowRequest()}this._removeScrollObservers();return arguments.callee.base.apply(this,arguments)},anchorElement:function(a,b){var c;if(b===undefined){c=this._anchorView;return c?c.get("layer"):this._anchorHTMLElement}else{if(!b){throw"You must set 'anchorElement' to either a view or a DOM element"}else{if(b.isView){this._anchorView=b;this._anchorHTMLElement=null}else{this._anchorView=null;this._anchorHTMLElement=b}}}}.property("layer").cacheable(),_hideOverflow:function(){var b=SC.$(document.body),a=SC.$(".sc-main"),d=parseInt(a.css("minWidth"),0),e=parseInt(a.css("minHeight"),0),c=SC.RootResponder.responder.get("currentWindowSize");if(c.width>=d&&c.height>=e){SC.bodyOverflowArbitrator.requestHidden(this)}},_withdrawOverflowRequest:function(){SC.bodyOverflowArbitrator.withdrawRequest(this)},_getScrollViewOfView:function(b){var a=b;while(YES){if(!a){return null}if(a.isScrollable){return a}a=a.get("parentView")}},_setupScrollObservers:function(b){var a=this._getScrollViewOfView(b);if(a){a.addObserver("horizontalScrollOffset",this,this._scrollOffsetDidChange);a.addObserver("verticalScrollOffset",this,this._scrollOffsetDidChange);this._scrollView=a}},_removeScrollObservers:function(){var a=this._scrollView;if(a){a.removeObserver("horizontalScrollOffset",this,this._scrollOffsetDidChange);a.removeObserver("verticalScrollOffset",this,this._scrollOffsetDidChange)}},_scrollOffsetDidChange:function(){this.positionPane()}});SC.PickerPane.PICKER_POINTER_OFFSET=[9,-9,-18,18];SC.PickerPane.PICKER_EXTRA_RIGHT_OFFSET=20;SC.PickerPane.TINY_PICKER_MENU_POINTER_OFFSET=[9,-9,-18,18];SC.PickerPane.TINY_PICKER_MENU_EXTRA_RIGHT_OFFSET=12;SC.PickerPane.SMALL_PICKER_MENU_POINTER_OFFSET=[9,-9,-8,8];SC.PickerPane.SMALL_PICKER_MENU_EXTRA_RIGHT_OFFSET=11;SC.PickerPane.REGULAR_PICKER_MENU_POINTER_OFFSET=[9,-9,-12,12];SC.PickerPane.REGULAR_PICKER_MENU_EXTRA_RIGHT_OFFSET=12;SC.PickerPane.LARGE_PICKER_MENU_POINTER_OFFSET=[9,-9,-16,16];SC.PickerPane.LARGE_PICKER_MENU_EXTRA_RIGHT_OFFSET=17;SC.PickerPane.HUGE_PICKER_MENU_POINTER_OFFSET=[9,-9,-18,18];SC.PickerPane.HUGE_PICKER_MENU_EXTRA_RIGHT_OFFSET=12;SC.SeparatorView=SC.View.extend({classNames:["sc-separator-view"],tagName:"span",layoutDirection:SC.LAYOUT_HORIZONTAL,render:function(a,b){if(b){a.push("<span></span>")}a.addClass(this.get("layoutDirection"))}});sc_require("views/button");sc_require("views/separator");SC.MenuItemView=SC.View.extend(SC.ContentDisplay,{classNames:["sc-menu-item"],displayProperties:["title","isEnabled","isSeparator","isChecked"],ariaRole:"menuitem",escapeHTML:YES,acceptsFirstResponder:YES,blocksIEDeactivate:YES,isContextMenuEnabled:NO,content:null,isSeparator:function(){return this.getContentProperty("itemSeparatorKey")===YES}.property("content").cacheable(),isEnabled:function(){return this.getContentProperty("itemIsEnabledKey")!==NO&&this.getContentProperty("itemSeparatorKey")!==YES}.property("content.isEnabled").cacheable(),isChecked:function(){return this.getContentProperty("itemCheckboxKey")}.property(),subMenu:function(){var c=this.get("content"),b,a;if(!c){return null}a=this.get("parentMenu");b=c.get(a.itemSubMenuKey);if(b){if(SC.kindOf(b,SC.MenuPane)){b.set("isModal",NO);b.set("isSubMenu",YES);b.set("parentMenu",a);return b}else{return SC.MenuPane.create({layout:{width:200},items:b,isModal:NO,isSubMenu:YES,parentMenu:a,controlSize:a.get("controlSize"),exampleView:a.get("exampleView")})}}return null}.property("content").cacheable(),hasSubMenu:function(){return !!this.get("subMenu")}.property("subMenu").cacheable(),init:function(){arguments.callee.base.apply(this,arguments);this.contentDidChange()},render:function(b,h){var c=this.get("content"),a,f,e=this.get("parentMenu"),d=this.get("itemWidth")||e.layout.width,g=this.get("itemHeight")||SC.DEFAULT_MENU_ITEM_HEIGHT;this.set("itemWidth",d);this.set("itemHeight",g);if(this.get("isSeparator")){b.attr("role","separator")}else{if(this.get("isChecked")){b.attr("role","menuitemcheckbox");b.attr("aria-checked",true)}}b=b.begin("a").addClass("menu-item");if(this.get("isSeparator")){b.push('<span class="separator"></span>');b.addClass("disabled")}else{f=c.get(e.itemIconKey);if(f){this.renderImage(b,f);b.addClass("has-icon")}f=this.get("title");if(SC.typeOf(f)!==SC.T_STRING){f=f.toString()}this.renderLabel(b,f);if(this.get("isChecked")){b.push('<div class="checkbox"></div>')}if(this.get("hasSubMenu")){this.renderBranch(b)}f=this.getContentProperty("itemShortCutKey");if(f){this.renderShortcut(b,f)}}b=b.end()},renderImage:function(b,d){var a,c;if(d&&SC.ImageView.valueIsUrl(d)){a=d;c=""}else{c=d;a=SC.BLANK_IMAGE_URL}b.begin("img").addClass("image").addClass(c).attr("src",a).end()},renderLabel:function(b,a){if(this.get("escapeHTML")){a=SC.RenderContext.escapeHTML(a)}b.push("<span class='value ellipsis'>"+a+"</span>")},renderBranch:function(a){a.push('<span class="has-branch"></span>')},renderShortcut:function(b,a){b.push('<span class = "shortcut">'+a+"</span>")},showSubMenu:function(){var a=this.get("subMenu");if(a){a.set("mouseHasEntered",NO);a.popup(this,[0,0,0])}this._subMenuTimer=null},title:function(){var b=this.getContentProperty("itemTitleKey"),a=this.getPath("parentMenu.localize");if(a&&b){b=SC.String.loc(b)}return b||""}.property("content.title").cacheable(),getContentProperty:function(b){var a=this.get("content"),c=this.get("parentMenu");if(a){return a.get(c.get(b))}},mouseUp:function(b){var a;a=this.getPath("parentMenu.rootMenu.targetMenuItem");if(a){a.performAction()}return YES},performAction:function(){if(!this.get("isEnabled")){this.getPath("parentMenu.rootMenu").remove();return YES}if(this.get("hasSubMenu")){return NO}var b=this.getContentProperty("itemDisableMenuFlashKey"),a;if(b){this.sendAction()}else{this._flashCounter=0;a=this.getPath("parentMenu.rootMenu");a._isFlashing=YES;this.invokeLater(this.flashHighlight,25);this.invokeLater(this.sendAction,150)}return YES},sendAction:function(){var c=this.getContentProperty("itemActionKey"),d=this.getContentProperty("itemTargetKey"),b=this.getPath("parentMenu.rootMenu"),a;this.getPath("parentMenu.rootMenu").remove();b._isFlashing=NO;c=(c===undefined)?b.get("action"):c;d=(d===undefined)?b.get("target"):d;b.set("selectedItem",this.get("content"));if(SC.typeOf(c)===SC.T_FUNCTION){c.apply(d,[b])}else{a=this.getPath("pane.rootResponder")||SC.RootResponder.responder;if(a){a.sendAction(c,d,b)}}},flashHighlight:function(){var a=this._flashCounter,b=this.$();if(a%2===0){b.addClass("focus")}else{b.removeClass("focus")}if(a<=2){this.invokeLater(this.flashHighlight,50);this._flashCounter++}},mouseDown:function(a){return YES},mouseEntered:function(a){var c=this.get("parentMenu"),b=c.get("rootMenu");if(b._isFlashing){return}c.set("mouseHasEntered",YES);this.set("mouseHasEntered",YES);c.set("currentMenuItem",this);if(this.get("isEnabled")){this.becomeFirstResponder()}if(this.get("hasSubMenu")){this._subMenuTimer=this.invokeLater(this.showSubMenu,100)}return YES},mouseExited:function(a){var b,c;if(this.get("hasSubMenu")){c=this._subMenuTimer;if(c){c.invalidate()}else{this.invokeLater(this.checkMouseLocation,100)}}else{b=this.get("parentMenu");if(b.get("currentMenuItem")===this){b.set("currentMenuItem",null)}}return YES},touchStart:function(a){this.mouseEntered(a);return YES},touchEnd:function(a){return this.mouseUp(a)},touchEntered:function(a){return this.mouseEntered(a)},touchExited:function(a){return this.mouseExited(a)},checkMouseLocation:function(){var b=this.get("subMenu"),c=this.get("parentMenu"),a,d;if(!b.get("mouseHasEntered")){a=c.get("currentMenuItem");if(a===this||a===null){d=c.get("previousMenuItem");if(d){d.resignFirstResponder()}this.resignFirstResponder();b.remove()}}},moveUp:function(b,a){var c=this.get("parentMenu");if(c){c.moveUp(this)}return YES},moveDown:function(b,a){var c=this.get("parentMenu");if(c){c.moveDown(this)}return YES},moveRight:function(b,a){this.showSubMenu();return YES},insertText:function(b,a){var c=this.get("parentMenu");if(c){c.insertText(b,a)}},keyDown:function(a){return this.interpretKeyEvents(a)},keyUp:function(a){return YES},cancel:function(a){this.getPath("parentMenu.rootMenu").remove();return YES},didBecomeFirstResponder:function(a){if(a!==this){return}var b=this.get("parentMenu");if(b){b.set("currentSelectedMenuItem",this)}},willLoseFirstResponder:function(a){if(a!==this){return}var b=this.get("parentMenu");if(b){b.set("currentSelectedMenuItem",null);b.set("previousSelectedMenuItem",this)}},insertNewline:function(b,a){this.mouseUp(a)},closeParent:function(){this.$().removeClass("focus");var a=this.get("parentMenu");if(a){a.remove()}},clickInside:function(b,a){return SC.pointInRect({x:a.pageX,y:a.pageY},b)},contentDidChange:function(){var b=this.get("content"),a=this._content;if(b===a){return}var c=this.contentPropertyDidChange;if(a&&a.removeObserver){a.removeObserver("*",this,c)}this._content=b;if(b&&b.addObserver){b.addObserver("*",this,c)}this.contentPropertyDidChange(b,"*")}.observes("content"),contentPropertyDidChange:function(g,j){var b=this.get("parentMenu");if(!b){return}var a=SC.MenuItemView._contentPropertyToMenuItemPropertyMapping,h=SC.keys(a),e,f,d,c;if(j==="*"){for(e=0,f=h.length;e<f;++e){d=h[e];c=a[d];this.notifyPropertyChange(c)}}else{for(e=0,f=h.length;e<f;++e){d=h[e];if(b.get(d)===j){c=a[d];this.notifyPropertyChange(c)}}}}});SC.MenuItemView._contentPropertyToMenuItemPropertyMapping={itemTitleKey:"title",itemIsEnabledKey:"isEnabled",itemSeparatorKey:"isSeparator",itemSubMenuKey:"subMenu"};sc_require("panes/picker");sc_require("views/menu_item");SC.MenuPane=SC.PickerPane.extend({classNames:["sc-menu"],ariaRole:"menu",items:[],controlSize:SC.REGULAR_CONTROL_SIZE,itemHeight:SC.propertyFromRenderDelegate("itemHeight",20),itemSeparatorHeight:SC.propertyFromRenderDelegate("itemSeparatorHeight",9),menuHeight:0,menuHeightPadding:SC.propertyFromRenderDelegate("menuHeightPadding",6),submenuOffsetX:SC.propertyFromRenderDelegate("submenuOffsetX",2),selectedItem:null,exampleView:SC.MenuItemView,anchor:null,isSubMenu:NO,localize:YES,acceptsMenuPane:YES,isContextMenuEnabled:NO,popup:function(b,c){var a;this.beginPropertyChanges();if(b){if(b.isView){this._anchorView=b;this._setupScrollObservers(b)}else{this._anchorHTMLElement=b}}if(c){this.set("preferMatrix",c)}this.adjust("height",this.get("menuHeight"));this.positionPane();this.set("defaultResponder",this);this.endPropertyChanges();this._hideOverflow();this.append()},remove:function(){var a=this.get("parentMenu");this.set("currentMenuItem",null);this.closeOpenMenus();this.resignMenuPane();if(a){a.becomeMenuPane()}return arguments.callee.base.apply(this,arguments)},itemTitleKey:"title",itemIsEnabledKey:"isEnabled",itemValueKey:"value",itemIconKey:"icon",itemHeightKey:"height",itemSubMenuKey:"subMenu",itemSeparatorKey:"isSeparator",itemTargetKey:"target",itemActionKey:"action",itemCheckboxKey:"checkbox",itemShortCutKey:"shortcut",itemKeyEquivalentKey:"keyEquivalent",itemDisableMenuFlashKey:"disableMenuFlash",itemLayerIdKey:"layerId",itemExampleViewKey:"exampleView",menuItemKeys:["itemTitleKey","itemValueKey","itemIsEnabledKey","itemIconKey","itemSeparatorKey","itemActionKey","itemCheckboxKey","itemShortCutKey","itemHeightKey","itemSubMenuKey","itemKeyEquivalentKey","itemTargetKey","itemLayerIdKey"],preferType:SC.PICKER_MENU,isModal:YES,_menuView:null,init:function(){return arguments.callee.base.apply(this,arguments)},displayProperties:["controlSize"],renderDelegateName:"menuRenderDelegate",createChildViews:function(){var b,a,c;b=this._menuScrollView=this.createChildView(SC.MenuScrollView,{borderStyle:SC.BORDER_NONE,controlSize:this.get("controlSize")});a=this._menuView=SC.View.create({parentViewDidResize:function(){this.notifyPropertyChange("frame")},viewDidResize:function(){}});c=this.get("menuItemViews");a.set("layout",{top:0,left:0,height:this.get("menuHeight")});a.replaceAllChildren(c);b.set("contentView",a);this.childViews=[b];return this},paneDidAttach:function(){var a=(this.rootResponder=SC.RootResponder.responder);a.panes.add(this);this.set("currentWindowSize",a.computeWindowSize());this.set("isPaneAttached",YES);this.parentViewDidChange();this._notifyDidAppendToDocument();this.becomeMenuPane();return this},becomeMenuPane:function(){if(this.rootResponder){this.rootResponder.makeMenuPane(this)}return this},resignMenuPane:function(){if(this.rootResponder){this.rootResponder.makeMenuPane(null)}return this},menuItemViews:function(){return this.createMenuItemViews()}.property("displayItems").cacheable(),createMenuItemViews:function(){var i=[],q=this.get("displayItems"),a=this.get("exampleView"),t,d,l,k,e,p,n,g,b,j,r,c,f,m,h,o,v,u,s;if(!q){return i}n=this.get("itemHeightKey");g=this.get("itemSeparatorKey");k=this.get("itemExampleViewKey");b=this.get("itemHeight");f=this.get("itemKeyEquivalentKey");j=this.get("itemSeparatorHeight");v=this.get("itemLayerIdKey");c=Math.floor(this.get("menuHeightPadding")/2);r=c;h=this.menuItemKeys.map(SC._menu_fetchKeys,this);s=q.get("length");for(o=0;o<s;o++){t=q[o];p=t.get(n);if(!p){p=t.get(g)?j:b}u={layout:{height:p,top:r},contentDisplayProperties:h,content:t,parentMenu:this};if(t.get(v)){u.layerId=t.get(v)}e=t.get(k);if(e){d=e}else{d=a}l=this._menuView.createChildView(d,u);i[o]=l;r+=p;m=t.get(f);if(m){if(SC.typeOf(m)===SC.T_ARRAY){m.forEach(function(w){this._keyEquivalents[w]=l},this)}else{this._keyEquivalents[m]=l}}}this.set("menuHeight",r+c);return i},menuItemViewForContentIndex:function(a){var b=this.get("menuItemViews");if(!b){return undefined}return b.objectAt(a)},_keyEquivalents:{},rootMenu:function(){if(this.get("isSubMenu")){return this.getPath("parentMenu.rootMenu")}return this}.property("isSubMenu").cacheable(),windowSizeDidChange:function(b,a){this.remove();return arguments.callee.base.apply(this,arguments)},displayItems:function(){var d=this.get("items"),c=this.get("localize"),h=this.get("itemHeight"),b,e=[],a,f,g;if(!d){return null}b=d.get("length");for(a=0;a<b;a++){f=d.objectAt(a);if(!f){continue}g=SC.typeOf(f);if(g===SC.T_STRING){f=SC.Object.create({title:f,value:f,isEnabled:YES})}else{if(g===SC.T_HASH){f=SC.Object.create(f)}else{if(g===SC.T_ARRAY){f=this.convertArrayMenuItemToObject(f)}}}f.contentIndex=a;e.push(f)}return e}.property("items").cacheable(),_sc_menu_itemsDidChange:function(){var a=this.get("menuItemViews");this._menuView.replaceAllChildren(a);this._menuView.adjust("height",this.get("menuHeight"))}.observes("items"),convertArrayMenuItemToObject:function(f){SC.Logger.warn("Support for Array-based menu items has been deprecated.  Please update your menus to use a hash.");var e,c=SC._menu_fetchKeys,b=SC._menu_fetchItem,h,d=SC.Object.create(),a,g;e=this.menuItemKeys.map(c,this);d[e[0]]=f[0];d[e[1]]=f[1];d[e[2]]=f[2];d[e[3]]=f[3];d[e[4]]=f[4];d[e[5]]=f[5];d[e[6]]=f[6];d[e[7]]=f[7];d[e[8]]=f[8];d[e[9]]=f[9];d[e[10]]=f[10];d[e[11]]=f[11];d[e[12]]=f[12];return d},currentMenuItem:function(a,b){if(b!==undefined){if(this._currentMenuItem!==null){this.set("previousMenuItem",this._currentMenuItem)}this._currentMenuItem=b;this.setPath("rootMenu.targetMenuItem",b);return b}return this._currentMenuItem}.property().cacheable(),_sc_menu_currentMenuItemDidChange:function(){var a=this.get("currentMenuItem"),b=this.get("previousMenuItem");if(b){if(b.get("hasSubMenu")&&a===null){}else{b.resignFirstResponder();this.closeOpenMenusFor(b)}}if(a&&a.get("isEnabled")){a.scrollToVisible()}}.observes("currentMenuItem"),closeOpenMenusFor:function(a){if(!a){return}var b=a.get("parentMenu");while(b&&a){b=a.get("subMenu");if(b){b.remove();a.resignFirstResponder();a=b.get("previousMenuItem")}}},closeOpenMenus:function(){this.closeOpenMenusFor(this.get("previousMenuItem"))},mouseDown:function(a){this.modalPaneDidClick(a);return YES},mouseEntered:function(a){this.set("mouseHasEntered",YES)},keyUp:function(a){var b=this.interpretKeyEvents(a);return !b?NO:b},moveUp:function(){var c=this.get("currentMenuItem"),d=this.get("menuItemViews"),b,e,a;if(!c){a=d.get("length")-1}else{b=c.getPath("content.contentIndex");if(b===0){return YES}a=b-1}while(a>=0){if(d[a].get("isEnabled")){this.set("currentMenuItem",d[a]);d[a].becomeFirstResponder();break}a--}return YES},moveDown:function(){var d=this.get("currentMenuItem"),e=this.get("menuItemViews"),b=e.get("length"),c,f,a;if(!d){a=0}else{c=d.getPath("content.contentIndex");if(c===b){return YES}a=c+1}while(a<b){if(e[a].get("isEnabled")){this.set("currentMenuItem",e[a]);e[a].becomeFirstResponder();break}a++}return YES},moveToBeginningOfDocument:function(){var c=this.get("menuItemViews"),b=c.get("length"),a=0;while(a<b){if(c[a].get("isEnabled")){this.set("currentMenuItem",c[a]);c[a].becomeFirstResponder();break}++a}return YES},moveToEndOfDocument:function(){var c=this.get("menuItemViews"),b=c.get("length"),a=b-1;while(a>=0){if(c[a].get("isEnabled")){this.set("currentMenuItem",c[a]);c[a].becomeFirstResponder();break}--a}return YES},pageDown:function(){var c=this.get("currentMenuItem"),h,e=this.get("menuItemViews"),b=e.get("length"),a=0,g,d=0,f;if(this._menuScrollView&&this._menuScrollView.verticalScrollerView2){if(c){a=c.getPath("content.contentIndex")}g=a;f=this._menuScrollView.get("verticalPageScroll");for(a;a<b;a++){h=e[a];d+=h.get("layout").height;if(d>f){break}else{if(h.get("isEnabled")){g=a}}}h=e[g];this.set("currentMenuItem",h);h.becomeFirstResponder()}else{this.moveToEndOfDocument()}return YES},pageUp:function(){var c=this.get("currentMenuItem"),h,e=this.get("menuItemViews"),b=e.get("length"),a=b-1,g,d=0,f;if(this._menuScrollView&&this._menuScrollView.verticalScrollerView){if(c){a=c.getPath("content.contentIndex")}g=a;f=this._menuScrollView.get("verticalPageScroll");for(a;a>=0;a--){h=e[a];d+=h.get("layout").height;if(d>f){break}else{if(h.get("isEnabled")){g=a}}}h=e[g];this.set("currentMenuItem",h);h.becomeFirstResponder()}else{this.moveToBeginningOfDocument()}return YES},insertText:function(b,a){var d=this._timer,c=this._keyBuffer;if(d){d.invalidate()}d=this._timer=SC.Timer.schedule({target:this,action:"clearKeyBuffer",interval:500,isPooled:NO});c=c||"";c+=b.toUpperCase();this.selectMenuItemForString(c);this._keyBuffer=c;return YES},performKeyEquivalent:function(d,a,b){if(!b&&!this.get("isVisibleInWindow")){return NO}var c=this._keyEquivalents[d];if(c){c.performAction(YES);return YES}if(d==="escape"||d==="return"){this.remove();return YES}return NO},selectMenuItemForString:function(c){var d=this.get("menuItemViews"),f,g,b,a,e;if(!d){return}e=c.length;a=d.get("length");for(b=0;b<a;b++){f=d.objectAt(b);g=f.get("title");if(!g){continue}g=g.replace(/ /g,"").substr(0,e).toUpperCase();if(g===c){this.set("currentMenuItem",f);f.becomeFirstResponder();break}}},clearKeyBuffer:function(){this._keyBuffer=""},modalPaneDidClick:function(a){this.remove();return YES}});SC._menu_fetchKeys=function(a){return this.get(a)};SC._menu_fetchItem=function(a){if(!a){return null}return this.get?this.get(a):this[a]};SC.MenuPane.VERTICAL_OFFSET=23;sc_require("panes/panel");SC.SheetPane=SC.PanelPane.extend({classNames:["sc-sheet"],modalPane:SC.ModalPane,transitionDuration:200,_state:"NO_VIEW",init:function(){arguments.callee.base.apply(this,arguments);if(SC.Animatable){SC.SheetPane.ANIMATABLE_AVAILABLE=YES;this.mixin(SC.Animatable);if(!this.transitions){this.transitions={}}if(!this.transitions.top){this.transitions.top={duration:this.transitionDuration===200?0.3:this.transitionDuration/1000,action:"_complete",target:this}}}},append:function(){var a=this.get("layout");if(!a.height||!a.top){a=SC.View.convertLayoutToAnchoredLayout(a,this.computeParentDimensions())}a.top=-1*a.height;if(this.disableAnimation){this.disableAnimation()}this.adjust(a);this.updateLayout();if(this.enableAnimation){this.enableAnimation()}return arguments.callee.base.apply(this,arguments)},remove:function(){var b=this,a=arguments;this.invokeLater(function(){a.callee.base.apply(b,a)},this.transitionDuration);this.slideUp();return this},paneDidAttach:function(){var a=arguments.callee.base.apply(this,arguments);this.slideDown();return a},slideDown:function(){this._state=SC.SheetPane.ANIMATING;this._direction=SC.SheetPane.SLIDE_DOWN;if(SC.SheetPane.ANIMATABLE_AVAILABLE){this.transitions.top.timing=SC.Animatable.TRANSITION_EASE_OUT;this.adjust("top",0)}else{this._start=Date.now();this._end=this._start+this.get("transitionDuration");this.tick()}},slideUp:function(){this._state=SC.SheetPane.ANIMATING;this._direction=SC.SheetPane.SLIDE_UP;if(SC.SheetPane.ANIMATABLE_AVAILABLE){var a=this.get("layout");this.transitions.top.timing=SC.Animatable.TRANSITION_EASE_IN;this.adjust("top",-1*a.height)}else{this._start=Date.now();this._end=this._start+this.get("transitionDuration");this.tick()}},_complete:function(){var a=this._direction;if(a===SC.SheetPane.SLIDE_DOWN){if(!SC.SheetPane.ANIMATABLE_AVAILABLE){this.adjust("top",0)}this.adjust({centerX:0,left:null});if(SC.browser.isMozilla){this.parentViewDidChange()}}else{var b=this.get("layout");if(!SC.SheetPane.ANIMATABLE_AVAILABLE){this.adjust("top",-1*b.height)}}this._state=SC.SheetPane.READY;this.updateLayout()},blurTo:function(a){this.setFirstResponder("")},tick:function(){this._timer=null;var b=Date.now();var e=(b-this._start)/(this._end-this._start),g=this,a=this._direction,c=this.get("layout"),d,f;if(e<0){e=0}if(e>=1){this._complete();return this}f=Math.floor(c.height*e);if(a==SC.SheetPane.SLIDE_DOWN){g.adjust("top",0-(c.height-f))}else{if(a==SC.SheetPane.SLIDE_UP){g.adjust("top",0-f)}}this._timer=this.invokeLater(this.tick,20);g.updateLayout();return this}});SC.SheetPane.mixin({ANIMATABLE_AVAILABLE:NO,NO_VIEW:"NO_VIEW",ANIMATING:"ANIMATING",READY:"READY",SLIDE_DOWN:"SLIDEDOWN",SLIDE_UP:"SLIDEUP"});SC.BaseTheme.buttonRenderDelegate=SC.RenderDelegate.create({className:"button","sc-small-size":{height:18,autoResizePadding:{width:15,height:0}},"sc-regular-size":{height:24,autoResizePadding:{width:20,height:0}},"sc-huge-size":{height:30,autoResizePadding:{width:30,height:0}},"sc-jumbo-size":{height:44,autoResizePadding:{width:50,height:0}},render:function(a,f){this.addSizeClassName(a,f);var e,b=a.get("toolTip"),g=a.get("isSelected")||NO,j=a.get("isActive")||NO,h=a.get("isDefault")||NO,i=a.get("isCancel")||NO,d=(a.get("buttonBehavior")===SC.TOGGLE_BEHAVIOR),c=SC.guidFor(a)+"-label";f.setClass({icon:!!a.get("icon"),def:h,cancel:i&&!h,active:j,sel:g});if(b){f.attr("title",b);f.attr("alt",b)}this.includeSlices(a,f,SC.THREE_SLICE);if(a.get("isSegment")){f.attr("aria-selected",g.toString())}else{if(d){f.attr("aria-pressed",j.toString())}}f.attr("aria-labelledby",c);f=f.begin("label").addClass("sc-button-label").id(c);a.get("theme").labelRenderDelegate.render(a,f);f=f.end();if(a.get("supportFocusRing")){f=f.begin("div").addClass("focus-ring");this.includeSlices(a,f,SC.THREE_SLICE);f=f.end()}},update:function(e,a){var d=(e.get("buttonBehavior")===SC.TOGGLE_BEHAVIOR);this.updateSizeClassName(e,a);if(e.get("isActive")){a.addClass("active")}var c=e.get("isDefault"),b=e.get("isCancel");if(e.get("isSegment")){a.attr("aria-selected",e.get("isSelected").toString())}else{if(d){a.attr("aria-pressed",e.get("isActive").toString())}}a.attr("title",e.get("toolTip"));a.setClass("icon",!!e.get("icon"));a.setClass("def",!!c);a.setClass("cancel",!!b&&!c);e.get("theme").labelRenderDelegate.update(e,a.find("label"))},getRenderedAutoResizeLayer:function(a,b){return b.find(".sc-button-label")[0]}});SC.BaseTheme.checkboxRenderDelegate=SC.RenderDelegate.create({className:"checkbox",render:function(a,c){this.addSizeClassName(a,c);var e=a.get("theme"),f,b;b=SC.guidFor(a)+"-label";var d=a.get("isSelected")||NO;var i=a.get("isActive");var h=!a.get("isEnabled");var g;if(d===SC.MIXED_STATE){g="mixed"}else{if(d){g="true"}else{g="false"}}c.attr("role","checkbox");c.attr("aria-checked",g);c.attr("aria-labelledby",b);c.setClass({sel:d,active:i,disabled:h});c.push('<span class = "button"></span>');c=c.begin("span").addClass("label").id(b);e.labelRenderDelegate.render(a,c);c=c.end()},update:function(g,c){this.updateSizeClassName(g,c);var f=g.get("theme");var d=g.get("isSelected");var e=g.get("isActive");var b=!g.get("isEnabled");var a;if(d===SC.MIXED_STATE){a="mixed"}else{if(d){a="true"}else{a="false"}}c.attr("aria-checked",a);f.labelRenderDelegate.update(g,c.find("span.label"));c.setClass({sel:d,active:e,disabled:b})}});SC.BaseTheme.collectionRenderDelegate=SC.RenderDelegate.create({className:"collection",render:function(b,a){a.setClass("focus",b.get("hasFirstResponder"));a.setClass("disabled",!b.get("isEnabled"));a.setClass("active",b.get("isActive"))},update:function(b,a){a.setClass("focus",b.get("hasFirstResponder"));a.setClass("disabled",!b.get("isEnabled"));a.setClass("active",b.get("isActive"))}});SC.BaseTheme.disclosureRenderDelegate=SC.RenderDelegate.create({className:"disclosure",render:function(g,a){this.addSizeClassName(g,a);var f=g.get("theme"),d=g.get("value"),b=["sc-button-label","sc-disclosure-label"];var e=SC.guidFor(g)+"-label";a.attr("aria-expanded",d);a.attr("aria-labelledby",e);if(g.get("isSelected")){a.addClass("sel")}var c="";c+=g.get("isSelected")?"open":"closed";if(g.get("isActive")){c+=" active"}a.push('<img src = "'+SC.BLANK_IMAGE_URL+'" class = "disclosure button '+c+'" />');a=a.begin("span").addClass(b).id(e);f.labelRenderDelegate.render(g,a);a=a.end()},update:function(d,a){this.updateSizeClassName(d,a);var c=d.get("theme"),b=d.get("value");a.attr("aria-expanded",b);if(d.get("isSelected")){a.addClass("sel")}a.find("img").setClass({open:d.get("isSelected"),closed:!d.get("isSelected"),active:d.get("isActive")});c.labelRenderDelegate.update(d,a.find("span.sc-disclosure-label"))}});SC.THREE_SLICE=["left","middle","right"];SC.NINE_SLICE=["top-left","top","top-right","left","middle","right","bottom-left","bottom","bottom-right"];SC.RenderDelegate.reopen({includeSlices:function(e,c,d){for(var b=0,a=d.length;b<a;b++){c.push('<div class="'+d[b]+'"></div>')}}});SC.BaseTheme.imageButtonRenderDelegate=SC.RenderDelegate.create({className:"image-button",render:function(d,b){var c=d.get("image"),a=d.get("toolTip");this.addSizeClassName(d,b);b.addClass("no-min-width");if(a){b.attr("title",a);b.attr("alt",a)}if(c){b.push("<div class='img "+c+"'></div>")}else{b.push("<div class='img'></div>")}},update:function(d,b){var c,a;this.updateSizeClassName(d,b);if(d.didChangeFor("imageButtonRenderDelegate","toolTip")){a=d.get("toolTip");b.attr("title",a);b.attr("alt",a)}c=d.get("image");if(c&&d.didChangeFor("imageButtonRenderDelegate","image")){b.children()[0].className="img "+c}}});SC.BaseTheme.MASTER_DETAIL_DIVIDER_WIDTH=1;SC.BaseTheme.masterDetailRenderDelegate=SC.RenderDelegate.create({className:"master-detail",dividerWidth:1,render:function(b,a){a.setClass("round-toolbars",SC.platform.touch)},update:function(b,a){a.setClass("round-toolbars",SC.platform.touch)}});SC.BaseTheme.panelRenderDelegate=SC.RenderDelegate.create({className:"panel",render:function(e,b){b=b.begin("div").addClass("panel-background");this.includeSlices(e,b,SC.NINE_SLICE);b=b.end();var a=e.get("ariaLabel"),c=e.get("ariaLabelledBy"),d=e.get("ariaDescribedBy");if(a){b.attr("aria-label",a)}if(c){b.attr("aria-labelledby",c)}if(d){b.attr("aria-describedby",d)}},update:function(e,c){var a=e.get("ariaLabel"),b=e.get("ariaLabelledBy"),d=e.get("ariaDescribedBy");if(a){c.attr("aria-label",a)}if(b){c.attr("aria-labelledby",b)}if(d){c.attr("aria-describedby",d)}}});sc_require("render_delegates/panel");SC.BaseTheme.pickerRenderDelegate=SC.RenderDelegate.create({className:"picker",render:function(f,c){var a=f.get("theme").panelRenderDelegate;a.render(f,c);var b=f.get("preferType");var e=f.get("pointerPos");var d=f.get("pointerPosY");if(b==SC.PICKER_POINTER||b==SC.PICKER_MENU_POINTER){c.push('<div class="sc-pointer '+e+'" style="margin-top: '+d+'px"></div>');c.addClass(e)}},update:function(g,f){var a=g.get("theme").panelRenderDelegate;a.update(g,f);var b=g.get("preferType");var e=g.get("pointerPos");var d=g.get("pointerPosY");if(b==SC.PICKER_POINTER||b==SC.PICKER_MENU_POINTER){var c=f.find(".sc-pointer");c.attr("class","sc-pointer "+e);c.attr("style","margin-top: "+d+"px");f.addClass(e)}}});sc_require("render_delegates/picker");SC.BaseTheme.menuRenderDelegate=SC.BaseTheme.pickerRenderDelegate.create({className:"menu",render:function(c,b,a){this.addSizeClassName(b,a);c(b,a)}.enhance(),update:function(c,b,a){this.updateSizeClassName(b,a);c(b,a)}.enhance(),itemHeight:20,itemSeparatorHeight:9,menuHeightPadding:6,menuWidthPadding:50,minimumMenuWidth:50,submenuOffsetX:2,verticalOffset:23,"sc-tiny-size":{itemHeight:10,itemSeparatorHeight:2,menuHeightPadding:2,submenuOffsetX:0},"sc-small-size":{itemHeight:16,itemSeparatorHeight:7,menuHeightPadding:4,submenuOffsetX:2},"sc-large-size":{itemHeight:60,itemSeparatorHeight:20,menuHeightPadding:0,submenuOffsetX:4},"sc-huge-size":{itemHeight:20,itemSeparatorHeight:9,menuHeightPadding:0,submenuOffsetX:0}});SC.BaseTheme.popupButtonRenderDelegate=SC.BaseTheme.buttonRenderDelegate.create({render:function(b,a){a.attr("aria-haspopup","true");arguments.callee.base.apply(this,arguments)},update:function(b,a){arguments.callee.base.apply(this,arguments)}});SC.BaseTheme.PROGRESS_OFFSET=0.5;SC.BaseTheme.PROGRESS_OFFSET_RANGE=42;SC.BaseTheme.progressRenderDelegate=SC.RenderDelegate.create({className:"progress",render:function(h,c){this.addSizeClassName(h,c);var a=h.get("isIndeterminate"),g=h.get("theme"),b=h.get("maximum"),e=h.get("minimum"),d=h.get("ariaValue");var f;if(a){f=1}else{f=h.get("value")}c.attr("aria-valuemax",b);c.attr("aria-valuemin",e);c.attr("aria-valuenow",d);c.attr("aria-valuetext",d);c.setClass({indeterminate:a,running:h.get("isRunning")&&a,disabled:!h.get("isEnabled"),"sc-empty":(f<=0),"sc-complete":(f>=1&&!a)});c=c.begin("div").addClass("track");this.includeSlices(h,c,SC.THREE_SLICE);c=c.end();c=c.begin("div").addClass("content");c.css("width",(f*100)+"%");this.includeSlices(h,c,SC.THREE_SLICE);c=c.end()},update:function(a,b){this.updateSizeClassName(a,b);var e=a.get("theme"),i,j=a.get("maximum"),f=a.get("minimum"),c=a.get("ariaValue"),d=a.get("isIndeterminate"),k=a.get("isRunning"),h=a.get("isEnabled"),g=a.get("isVisibleInWindow");b.attr("aria-valuemax",j);b.attr("aria-valuemin",f);b.attr("aria-valuenow",c);b.attr("aria-valuetext",c);if(d){i=1}else{i=a.get("value")}b.setClass({indeterminate:d,running:k&&d,disabled:!h,"sc-empty":(i<=0),"sc-complete":(i>=1&&!d)});b.find(".content").css("width",(i*100)+"%");if(!SC.platform.supportsCSSTransitions){if(!this._queue[b[0].id]){this._queue[b[0].id]={offset:0,element:SC.$(b).find(".content .middle"),shouldAnimate:false}}if(d&&k&&g){this._queue[b[0].id].shouldAnimate=true;this.animate(a)}else{if(!d){this._queue[b[0].id].element.css("background-position","")}else{this._queue[b[0].id].shouldAnimate=false}}}},_queue:{},_animating:false,animate:function(b){var a=this;if(this._animating){return}function c(){var h,e,f,d=a._queue,j=0,g;var i;for(i in d){if(d.hasOwnProperty(i)){g=d[i];if(g.shouldAnimate){a._animating=true;j++;e=g.offset||0;h=(e+SC.BaseTheme.PROGRESS_OFFSET)%SC.BaseTheme.PROGRESS_OFFSET_RANGE;f=Math.round(h);if(f>Math.round(e)){g.element.css("background-position",f+"px 0px")}g.offset=h}}}if(j===0){a._animating=false}else{window.requestAnimationFrame(c)}}c()}});SC.BaseTheme.radioRenderDelegate=SC.RenderDelegate.create({className:"radio",render:function(f,b){this.addSizeClassName(f,b);var e=f.get("theme");var a=f.get("isSelected"),c=f.get("width"),d=SC.guidFor(f)+"-label";b.setClass({active:f.get("isActive"),mixed:f.get("isMixed"),sel:f.get("isSelected"),disabled:!f.get("isEnabled")});b.attr("role","radio");b.attr("aria-checked",a);b.attr("aria-labelledby",d);b.attr("aria-disabled",f.get("isEnabled")?"false":"true");if(c){b.css("width",c)}b.push('<span class = "button"></span>');b=b.begin("span").addClass("sc-button-label").id(d);e.labelRenderDelegate.render(f,b);b=b.end()},update:function(f,a){this.updateSizeClassName(f,a);var e=f.get("theme");var b=f.get("isSelected"),c=f.get("width"),d=f.get("value");a.setClass({active:f.get("isActive"),mixed:f.get("isMixed"),sel:f.get("isSelected"),disabled:!f.get("isEnabled")});a.attr("aria-disabled",f.get("isEnabled")?"false":"true");a.attr("aria-checked",b);a.css("width",c?c:null);e.labelRenderDelegate.update(f,a.find(".sc-button-label"))}});SC.BaseTheme.radioGroupRenderDelegate=SC.RenderDelegate.create({className:"radio-group",render:function(h,e){this.addSizeClassName(h,e);var g=h.get("theme"),d=SC.guidFor(this),c=h.get("items"),b,a=c.length,f;e.addClass(h.get("layoutDirection"));e.attr("role","radiogroup");e.attr("aria-disabled",h.get("isEnabled")?"false":"true");for(b=0;b<a;b++){f=c[b];e=e.begin("div").addClass("radio-"+b).attr("index",b).addClass(g.classNames).addClass(g.radioRenderDelegate.className).addClass("sc-radio-button");g.radioRenderDelegate.render(f,e);e=e.end()}h.get("renderState").radioCount=b},update:function(a,d){this.updateSizeClassName(a,d);var e=a.get("theme"),b=SC.guidFor(this),g=a.get("items"),h,f=g.length,i;d.addClass(a.get("layoutDirection"));d.attr("aria-disabled",a.get("isEnabled")?"false":"true");if(a.get("renderState").radioCount!==f){var c=SC.RenderContext(d[0]);this.render(a,c);c.update();return}for(h=0;h<f;h++){i=g[h];e.radioRenderDelegate.update(i,d.find(".radio-"+h))}},updateRadioAtIndex:function(d,a,b){var c=d.get("items")[b];d.get("theme").radioRenderDelegate.update(c,a.find(".radio-"+b))},indexForEvent:function(d,b,a){var c=$(a.target).closest(".sc-radio-button").attr("index");if(isNaN(c)){return undefined}return parseInt(c,0)}});SC.BaseTheme.segmentRenderDelegate=SC.RenderDelegate.create({className:"segment",render:function(e,b){var c=e.get("theme"),d,a;a={"sc-first-segment":e.get("isFirstSegment"),"sc-middle-segment":e.get("isMiddleSegment"),"sc-last-segment":e.get("isLastSegment"),"sc-overflow-segment":e.get("isOverflowSegment"),vertical:e.get("layoutDirection")!==SC.LAYOUT_HORIZONTAL};if(!SC.none(e.get("index"))){a["sc-segment-"+e.get("index")]=YES}b.setClass(a);d=c.buttonRenderDelegate;d.render(e,b)},update:function(e,a){var c=e.get("theme"),d,b={};b={"sc-first-segment":e.get("isFirstSegment"),"sc-middle-segment":e.get("isMiddleSegment"),"sc-last-segment":e.get("isLastSegment"),"sc-overflow-segment":e.get("isOverflowSegment")||NO,vertical:e.get("layoutDirection")!==SC.LAYOUT_HORIZONTAL};if(!SC.none(e.get("index"))){b["sc-segment-"+e.get("index")]=YES}a.setClass(b);d=c.buttonRenderDelegate;d.update(e,a)}});SC.BaseTheme.segmentedRenderDelegate=SC.RenderDelegate.create({className:"segmented",render:function(b,a){this.addSizeClassName(b,a);a.addStyle("text-align",b.get("align"))},update:function(b,a){this.updateSizeClassName(b,a);a.css("text-align",b.get("align"))}});SC.BaseTheme.sliderRenderDelegate=SC.RenderDelegate.create({className:"slider",render:function(f,c){this.addSizeClassName(f,c);var b=SC.BLANK_IMAGE_URL,a=f.get("maximum"),e=f.get("minimum"),d=f.get("ariaValue");c.attr("aria-valuemax",a);c.attr("aria-valuemin",e);c.attr("aria-valuenow",d);if(e!==0||a!==100){c.attr("aria-valuetext",d)}c.attr("aria-orientation","horizontal");c=c.begin("span").addClass("track");this.includeSlices(f,c,SC.THREE_SLICE);c.push('<img src="'+b+'" class="sc-handle" style="left: '+f.get("value")+'%" /></span>');c=c.end();f.get("renderState")._cachedHandle=null},update:function(h,b){this.updateSizeClassName(h,b);var a=h.get("maximum"),d=h.get("minimum"),c=h.get("ariaValue");b.attr("aria-valuemax",a);b.attr("aria-valuemin",d);b.attr("aria-valuenow",c);if(d!==0||a!==100){b.attr("aria-valuetext",c)}b.attr("aria-orientation","horizontal");if(h.didChangeFor("sliderRenderDelegate","value")){var f=h.get("renderState")._cachedHandle;if(!f){f=h.get("renderState")._cachedHandle=b.find(".sc-handle")}var g=h.get("frame"),e=h.get("value");f.css("left",e+"%")}}});SC.BaseTheme.SourceList=SC.BaseTheme.subtheme("source-list");SC.BaseTheme.toolbarRenderDelegate=SC.RenderDelegate.create({className:"toolbar",render:function(b,a){},update:function(){}});SC.BaseTheme.wellRenderDelegate=SC.RenderDelegate.create({className:"well",render:function(b,a){this.includeSlices(b,a,SC.NINE_SLICE)},update:function(){}});SC.BaseTheme.workspaceRenderDelegate=SC.RenderDelegate.create({className:"workspace",render:function(){},update:function(){}});SC.DRAG_LINK=4;SC.DRAG_COPY=1;SC.DRAG_MOVE=2;SC.DRAG_NONE=0;SC.DRAG_ANY=15;SC.DRAG_DATA=8;SC.DRAG_AUTOSCROLL_ZONE_THICKNESS=20;SC.View.reopen({init:function(a){a();if(this.get("isDropTarget")){SC.Drag.addDropTarget(this)}if(this.get("isScrollable")){SC.Drag.addScrollableView(this)}}.enhance(),destroy:function(a){if(this.get("isDropTarget")){SC.Drag.removeDropTarget(this)}if(this.get("isScrollable")){SC.Drag.removeScrollableView(this)}return a()}.enhance()});SC.Drag=SC.Object.extend({source:null,ghostView:null,ghostActsLikeCursor:NO,dragView:null,ghost:YES,sourceIsDraggable:YES,slideBack:YES,ghostOffset:{x:0,y:0},location:{},dataTypes:function(){if(this.dataSource){return this.dataSource.get("dragDataTypes")||[]}var d=this.data;if(d){var a=[];for(var b in d){if(d.hasOwnProperty(b)){a.push(b)}}return a}var c=this.get("source");if(c&&c.dragDataTypes){return c.get("dragDataTypes")||[]}return[]}.property().cacheable(),hasDataType:function(a){return(this.get("dataTypes").indexOf(a)>=0)},dataForType:function(a){if(this.dataSource){return this.dataSource.dragDataForType(this,a)}else{if(this.data){return this.data[a]}else{var b=this.get("source");if(b&&SC.typeOf(b.dragDataForType)===SC.T_FUNCTION){return b.dragDataForType(this,a)}else{return null}}}},dataSource:null,data:null,allowedDragOperations:SC.DRAG_ANY,_dragInProgress:YES,_dragViewWasVisible:null,startDrag:function(){if(this.get("sourceIsDraggable")){this._createGhostView()}var h=this.event;var e={x:h.pageX,y:h.pageY};this.set("location",e);if(this.get("sourceIsDraggable")){var b=this._getDragView();var i=b.get("parentView");var g=i?i.convertFrameToView(b.get("frame"),null):b.get("frame");if(this.get("ghost")){this._dragViewWasVisible=b.get("isVisible");b.set("isVisible",NO)}if(this.ghostActsLikeCursor){this.ghostOffset={x:14,y:14}}else{this.ghostOffset={x:(e.x-g.x),y:(e.y-g.y)}}if(!this._ghostViewHidden){this._positionGhostView(h)}if(h.makeTouchResponder){var j=this;SC.Timer.schedule({target:h,action:function(){if(!h.hasEnded){h.makeTouchResponder(j,YES)}},interval:1})}else{this.ghostView.rootResponder.dragDidStart(this,h)}}var a=this.source;if(a&&a.dragDidBegin){a.dragDidBegin(this,e)}var c=this._dropTargets();for(var f=0,d=c.length;f<d;f++){c[f].tryToPerform("dragStarted",this,h)}},cancelDrag:function(){var b=this._lastTarget,c=this.get("location");if(b&&b.dragExited){b.dragExited(this,this._lastMouseDraggedEvent)}if(this.get("sourceIsDraggable")){this._destroyGhostView();if(this.get("ghost")){if(this._dragViewWasVisible){this._getDragView().set("isVisible",YES)}this._dragViewWasVisible=null}}var a=this.source;if(a&&a.dragDidEnd){a.dragDidEnd(this,c,SC.DRAG_NONE)}this._lastTarget=null;this._dragInProgress=NO},touchStart:function(a){return YES},mouseDragged:function(a){var b=this._autoscroll(a);var f=this.get("location");if(!b&&(a.pageX===f.x)&&(a.pageY===f.y)){return}f={x:a.pageX,y:a.pageY};this.set("location",f);this._lastMouseDraggedEvent=a;var d=this.source;var c=this._lastTarget;var e=this._findDropTarget(a);var g=SC.DRAG_NONE;while(e&&(e!==c)&&(g===SC.DRAG_NONE)){if(e&&d&&d.dragSourceOperationMaskFor){g=d.dragSourceOperationMaskFor(this,e)}else{g=SC.DRAG_ANY}if((g!==SC.DRAG_NONE)&&e&&e.computeDragOperations){g=g&e.computeDragOperations(this,a,g)}else{g=SC.DRAG_NONE}this.allowedDragOperations=g;if(g===SC.DRAG_NONE){e=this._findNextDropTarget(e)}}if(e!==c){if(c&&c.dragExited){c.dragExited(this,a)}if(e){if(e.dragEntered){e.dragEntered(this,a)}if(e.dragUpdated){e.dragUpdated(this,a)}}this._lastTarget=e}else{if(e&&e.dragUpdated){e.dragUpdated(this,a)}}if(d&&d.dragDidMove){d.dragDidMove(this,f)}if(this.get("sourceIsDraggable")&&!this._ghostViewHidden){this._positionGhostView(a)}},touchesDragged:function(a){this.mouseDragged(a)},mouseUp:function(l){var g={x:l.pageX,y:l.pageY},h=this._lastTarget,d=this.allowedDragOperations;this.set("location",g);try{if(h&&h.acceptDragOperation&&h.acceptDragOperation(this,d)){d=h.performDragOperation?h.performDragOperation(this,d):SC.DRAG_NONE}else{d=SC.DRAG_NONE}}catch(i){SC.Logger.error("Exception in SC.Drag.mouseUp(acceptDragOperation|performDragOperation): %@".fmt(i))}try{if(h&&h.dragExited){h.dragExited(this,l)}}catch(j){SC.Logger.error("Exception in SC.Drag.mouseUp(target.dragExited): %@".fmt(j))}var c=this._dropTargets();for(var k=0,f=c.length;k<f;k++){try{c[k].tryToPerform("dragEnded",this,l)}catch(b){SC.Logger.error("Exception in SC.Drag.mouseUp(dragEnded on %@): %@".fmt(c[k],b))}}if(this.get("sourceIsDraggable")){this._destroyGhostView();if(this.get("ghost")){if(this._dragViewWasVisible){this._getDragView().set("isVisible",YES)}this._dragViewWasVisible=null}}var a=this.source;if(a&&a.dragDidEnd){a.dragDidEnd(this,g,d)}this._lastTarget=null;this._dragInProgress=NO},touchEnd:function(a){this.mouseUp(a)},_getDragView:function(){if(!this.dragView){if(!this.source||!this.source.isView){throw"Source can't be used as dragView, because it's not a view."}this.dragView=this.source}return this.dragView},_createGhostView:function(){var c=this,b=this._getDragView(),d=b.get("frame"),a;a=this.ghostView=SC.Pane.create({classNames:["sc-ghost-view"],layout:{top:d.y,left:d.x,width:d.width,height:d.height},owner:this,didCreateLayer:function(){if(b){var e=b.get("layer");if(e){e=e.cloneNode(true);e.style.top="0px";e.style.left="0px";this.get("layer").appendChild(e)}}}});a.append()},_positionGhostView:function(a){var c=this.get("location");c.x-=this.ghostOffset.x;c.y-=this.ghostOffset.y;var b=this.ghostView;if(b){b.adjust({top:c.y,left:c.x});b.invokeOnce("updateLayout")}},_ghostViewHidden:NO,hideGhostView:function(){if(this.ghostView&&!this._ghostViewHidden){this.ghostView.remove();this._ghostViewHidden=YES}},unhideGhostView:function(){if(this._ghostViewHidden){this._ghostViewHidden=NO;this._createGhostView()}},_destroyGhostView:function(){if(this.ghostView){this.ghostView.remove();this.ghostView=null;this._ghostViewHidden=NO}},_dropTargets:function(){if(this._cachedDropTargets){return this._cachedDropTargets}var b=[];var d=SC.Drag._dropTargets;for(var c in d){if(d.hasOwnProperty(c)){b.push(d[c])}}var f={};var e=SC.Drag._dropTargets;var a=function(g){if(!g){return 0}var i=SC.guidFor(g);var h=f[i];if(!h){h=1;while(g=g.get("parentView")){if(e[SC.guidFor(g)]!==undefined){h=h+1}if(g.isPane&&g.isMainPane){h=h+10000}}f[i]=h}return h};b.sort(function(h,g){if(h===g){return 0}h=a(h);g=a(g);return(h>g)?-1:1});this._cachedDropTargets=b;return b},_findDropTarget:function(c){var g={x:c.pageX,y:c.pageY};var e,f;var d=this._dropTargets();for(var b=0,a=d.length;b<a;b++){e=d[b];if(!e.get("isVisibleInWindow")){continue}f=e.convertFrameToView(e.get("clippingFrame"),null);if(SC.pointInRect(g,f)){return e}}return null},_findNextDropTarget:function(a){var b=SC.Drag._dropTargets;while(a=a.get("parentView")){if(b[SC.guidFor(a)]){return a}}return null},_autoscroll:function(l){if(!l){l=this._lastAutoscrollEvent}if(!this._dragInProgress){return NO}var g=l?{x:l.pageX,y:l.pageY}:this.get("location"),h=this._findScrollableView(g),m=null,k,c,d,i,b,a,e;while(h&&!m){k=h.get("canScrollVertical")?1:0;c=h.get("canScrollHorizontal")?1:0;if(k||c){a=h.get("containerView");if(a){e=h.convertFrameToView(a.get("frame"),null)}else{k=c=0}}if(k){i=SC.maxY(e);d=i-SC.DRAG_AUTOSCROLL_ZONE_THICKNESS;if(g.y>=d&&g.y<=i){k=1}else{d=SC.minY(e);i=d+SC.DRAG_AUTOSCROLL_ZONE_THICKNESS;if(g.y>=d&&g.y<=i){k=-1}else{k=0}}}if(c){i=SC.maxX(e);d=i-SC.DRAG_AUTOSCROLL_ZONE_THICKNESS;if(g.x>=d&&g.x<=i){c=1}else{d=SC.minX(e);i=d+SC.DRAG_AUTOSCROLL_ZONE_THICKNESS;if(g.x>=d&&g.x<=i){c=-1}else{c=0}}}if(k||c){m=h}else{h=this._findNextScrollableView(h)}}if(m&&(this._lastScrollableView===m)){if((Date.now()-this._hotzoneStartTime)>100){this._horizontalScrollAmount*=1.05;this._verticalScrollAmount*=1.05}}else{this._lastScrollableView=m;this._horizontalScrollAmount=15;this._verticalScrollAmount=15;this._hotzoneStartTime=(m)?Date.now():null;c=k=0}if(m&&(c||k)){var j={x:c*this._horizontalScrollAmount,y:k*this._verticalScrollAmount};m.scrollBy(j)}if(m){if(l){this._lastAutoscrollEvent={pageX:l.pageX,pageY:l.pageY}}this.invokeLater(this._autoscroll,100,null);return YES}else{this._lastAutoscrollEvent=null;return NO}},_scrollableViews:function(){if(this._cachedScrollableView){return this._cachedScrollableView}var a=[];var c=SC.Drag._scrollableViews;for(var b in c){if(c.hasOwnProperty(b)){a.push(c[b])}}a=a.sort(function(f,d){var e=f;while(e=e.get("parentView")){if(d===e){return -1}}return 1});this._cachedScrollableView=a;return a},_findScrollableView:function(f){var c=this._scrollableViews(),b=c?c.length:0,d,e,a;for(a=0;a<b;a++){d=c[a];if(!d.get("isVisibleInWindow")){continue}e=d.convertFrameToView(d.get("clippingFrame"),null);if(SC.pointInRect(f,e)){return d}}return null},_findNextScrollableView:function(a){var b=SC.Drag._scrollableViews;while(a=a.get("parentView")){if(b[SC.guidFor(a)]){return a}}return null}});SC.Drag.mixin({start:function(b){var a=this.create(b);a.startDrag();return a},_dropTargets:{},_scrollableViews:{},addDropTarget:function(a){this._dropTargets[SC.guidFor(a)]=a},removeDropTarget:function(a){delete this._dropTargets[SC.guidFor(a)]},addScrollableView:function(a){this._scrollableViews[SC.guidFor(a)]=a},removeScrollableView:function(a){delete this._scrollableViews[SC.guidFor(a)]}});SC.UndoManager=SC.Object.extend({undoActionName:function(){return this.undoStack?this.undoStack.name:null}.property("undoStack"),redoActionName:function(){return this.redoStack?this.redoStack.name:null}.property("redoStack"),canUndo:function(){return this.undoStack!=null}.property("undoStack"),canRedo:function(){return this.redoStack!=null}.property("redoStack"),undo:function(){this._undoOrRedo("undoStack","isUndoing")},redo:function(){this._undoOrRedo("redoStack","isRedoing")},isUndoing:NO,isRedoing:NO,groupingLevel:0,registerUndo:function(b,a){this.beginUndoGroup(a);this._activeGroup.actions.push(b);this.endUndoGroup(a)},beginUndoGroup:function(b){if(this._activeGroup){this.groupingLevel++}else{var a=this.isUndoing?"redoStack":"undoStack";this._activeGroup={name:b,actions:[],prev:this.get(a)};this.set(a,this._activeGroup);this.groupingLevel=1}},endUndoGroup:function(a){if(!this._activeGroup){raise("endUndoGroup() called outside group.")}if(this.groupingLevel>1){this.groupingLevel--}else{this._activeGroup=null;this.groupingLevel=0}this.propertyDidChange(this.isUndoing?"redoStack":"undoStack")},setActionName:function(a){if(!this._activeGroup){raise("setActionName() called outside group.")}this._activeGroup.name=a},_activeGroup:null,undoStack:null,redoStack:null,_undoOrRedo:function(a,c){if(this._activeGroup){return false}if(this.get(a)==null){return true}this.set(c,true);var e=this.get(a);this.set(a,e.prev);var b;var d=e.actions.length>1;if(d){this.beginUndoGroup(e.name)}while(b=e.actions.pop()){b()}if(d){this.endUndoGroup(e.name)}this.set(c,false)}});SC.CheckboxView=SC.ButtonView.extend(SC.StaticLayout,{classNames:["sc-checkbox-view","sc-checkbox-control"],ariaRole:"checkbox",themeName:null,renderDelegateName:"checkboxRenderDelegate",needsEllipsis:NO,acceptsFirstResponder:function(){if(SC.FOCUS_ALL_CONTROLS){return this.get("isEnabled")}return NO}.property("isEnabled"),_toggleValue:function(){var a=this.get("value")===this.get("toggleOnValue");this.set("value",a?this.get("toggleOffValue"):this.get("toggleOnValue"))},mouseDown:function(a){if(!this.get("isEnabled")){return YES}this.set("isActive",YES);this._isMouseDown=YES;if(a&&this.get("acceptsFirstResponder")){a.allowDefault()}return YES},mouseUp:function(a){if(!this.get("isEnabled")){return YES}this.set("isActive",NO);this._isMouseDown=NO;if(this.get("buttonBehavior")!==SC.HOLD_BEHAVIOR){if(this.$().within(a.target)){this._toggleValue();this._action(a)}}return YES},keyDown:function(b){if(!this.get("isEnabled")){return YES}if(b.which===9||b.keyCode===9){var a=b.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return YES}if(b.which===13||b.which===32){this._toggleValue();if(this.get("buttonBehavior")!==SC.HOLD_BEHAVIOR){if(this.$().within(b.target)){this._action(b)}}return YES}b.allowDefault();return NO},touchStart:function(a){return this.mouseDown(a)},touchEnd:function(a){return this.mouseUp(a)}});SC.LIST_ITEM_ACTION_CANCEL="sc-list-item-cancel-action";SC.LIST_ITEM_ACTION_REFRESH="sc-list-item-cancel-refresh";SC.LIST_ITEM_ACTION_EJECT="sc-list-item-cancel-eject";SC.ListItemView=SC.View.extend(SC.InlineEditable,SC.Control,{classNames:["sc-list-item-view"],displayProperties:["disclosureState","escapeHTML","isDropTarget"],content:null,contentIndex:null,hasContentIcon:NO,hasContentRightIcon:NO,hasContentBranch:NO,contentCheckboxKey:null,icon:null,isDropTarget:NO,contentIconKey:null,rightIcon:null,contentRightIconKey:null,contentValueKey:null,escapeHTML:YES,contentUnreadCountKey:null,contentIsBranchKey:null,outlineIndent:16,outlineLevel:0,disclosureState:SC.LEAF_NODE,validator:null,contentKeys:{contentValueKey:"title",contentCheckboxKey:"checkbox",contentIconKey:"icon",contentRightIconKey:"rightIcon",contentUnreadCountKey:"count",contentIsBranchKey:"branch"},contentPropertyDidChange:function(){if(this.get("contentIsEditable")!==this.contentIsEditable()){this.notifyPropertyChange("contentIsEditable")}this.displayDidChange()},contentIsEditable:function(){var a=this.get("content");return a&&(a.get?a.get("isEditable")!==NO:NO)}.property("content").cacheable(),inlineEditorDelegate:SC.InlineTextFieldDelegate,$label:function(){return this.$("label")},_isInsideElementWithClassName:function(e,a){var c=this.get("layer");if(!c){return NO}var d=SC.$(a.target);var b=NO;while(!b&&d.length>0&&(d[0]!==c)){if(d.hasClass(e)){b=YES}d=d.parent()}d=c=null;return b},_isInsideCheckbox:function(b){var a=this.displayDelegate;var c=this.getDelegateProperty("contentCheckboxKey",a);return c&&this._isInsideElementWithClassName("sc-checkbox-view",b)},_isInsideDisclosure:function(a){if(this.get("disclosureState")===SC.LEAF_NODE){return NO}return this._isInsideElementWithClassName("sc-disclosure-view",a)},_isInsideRightIcon:function(c){var b=this.displayDelegate;var a=this.getDelegateProperty("hasContentRightIcon",b)||!SC.none(this.rightIcon);return a&&this._isInsideElementWithClassName("right-icon",c)},mouseDown:function(a){if(!this.get("contentIsEditable")){return NO}if(this._isInsideCheckbox(a)){this._addCheckboxActiveState();this._isMouseDownOnCheckbox=YES;this._isMouseInsideCheckbox=YES;return YES}else{if(this._isInsideDisclosure(a)){this._addDisclosureActiveState();this._isMouseDownOnDisclosure=YES;this._isMouseInsideDisclosure=YES;return YES}else{if(this._isInsideRightIcon(a)){this._addRightIconActiveState();this._isMouseDownOnRightIcon=YES;this._isMouseInsideRightIcon=YES;return YES}}}return NO},mouseUp:function(h){var c=NO,i,d,b,a,g,f;if(this._isMouseDownOnCheckbox){if(this._isInsideCheckbox(h)){i=this.displayDelegate;d=this.getDelegateProperty("contentCheckboxKey",i);b=this.get("content");if(b&&b.get){var e=b.get(d);e=(e===SC.MIXED_STATE)?YES:!e;b.set(d,e);this.displayDidChange()}}this._removeCheckboxActiveState();c=YES}else{if(this._isMouseDownOnDisclosure){if(this._isInsideDisclosure(h)){a=this.get("disclosureState");g=this.get("contentIndex");f=(!SC.none(g))?SC.IndexSet.create(g):null;i=this.get("displayDelegate");if(a===SC.BRANCH_OPEN){if(f&&i&&i.collapse){i.collapse(f)}else{this.set("disclosureState",SC.BRANCH_CLOSED)}this.displayDidChange()}else{if(a===SC.BRANCH_CLOSED){if(f&&i&&i.expand){i.expand(f)}else{this.set("disclosureState",SC.BRANCH_OPEN)}this.displayDidChange()}}}this._removeDisclosureActiveState();c=YES}else{if(this._isMouseDownOnRightIcon){this._removeRightIconActiveState();c=YES}}}this._isMouseInsideCheckbox=this._isMouseDownOnCheckbox=NO;this._isMouseDownOnDisclosure=this._isMouseInsideDisclosure=NO;this._isMouseInsideRightIcon=this._isMouseDownOnRightIcon=NO;return c},mouseMoved:function(a){if(this._isMouseDownOnCheckbox&&this._isInsideCheckbox(a)){this._addCheckboxActiveState();this._isMouseInsideCheckbox=YES}else{if(this._isMouseDownOnCheckbox){this._removeCheckboxActiveState();this._isMouseInsideCheckbox=NO}else{if(this._isMouseDownOnDisclosure&&this._isInsideDisclosure(a)){this._addDisclosureActiveState();this._isMouseInsideDisclosure=YES}else{if(this._isMouseDownOnDisclosure){this._removeDisclosureActiveState();this._isMouseInsideDisclosure=NO}else{if(this._isMouseDownOnRightIcon&&this._isInsideRightIcon(a)){this._addRightIconActiveState();this._isMouseInsideRightIcon=YES}else{if(this._isMouseDownOnRightIcon){this._removeRightIconActiveState();this._isMouseInsideRightIcon=NO}}}}}}return NO},touchStart:function(a){return this.mouseDown(a)},touchEnd:function(a){return this.mouseUp(a)},touchEntered:function(a){return this.mouseEntered(a)},touchExited:function(a){return this.mouseExited(a)},_addCheckboxActiveState:function(){if(this.get("isEnabled")){if(this._checkboxRenderDelegate){var a=this._checkboxRenderSource;a.set("isActive",YES);this._checkboxRenderDelegate.update(a,this.$(".sc-checkbox-view"))}else{this.$(".sc-checkbox-view").addClass("active")}}},_removeCheckboxActiveState:function(){if(this._checkboxRenderer){var a=this._checkboxRenderSource;a.set("isActive",NO);this._checkboxRenderDelegate.update(a,this.$(".sc-checkbox-view"))}else{this.$(".sc-checkbox-view").removeClass("active")}},_addDisclosureActiveState:function(){if(this.get("isEnabled")){if(this._disclosureRenderDelegate){var a=this._disclosureRenderSource;a.set("isActive",YES);this._disclosureRenderDelegate.update(a,this.$(".sc-disclosure-view"))}else{this.$(".sc-disclosure-view").addClass("active")}}},_removeDisclosureActiveState:function(){if(this._disclosureRenderer){var a=this._disclosureRenderSource;a.set("isActive",NO);this._disclosureRenderDelegate.update(a,this.$(".sc-disclosure-view"))}else{this.$(".sc-disclosure-view").addClass("active")}},_addRightIconActiveState:function(){this.$("img.right-icon").setClass("active",YES)},_removeRightIconActiveState:function(){this.$("img.right-icon").removeClass("active")},contentHitTest:function(b){var a=this.displayDelegate;var c=this.getDelegateProperty("contentValueKey",a);if(!c){return NO}var e=this.$label()[0];if(!e){return NO}var f=b.target,d=this.get("layer");while(f&&(f!==d)&&(f!==window)){if(f===e){return YES}f=f.parentNode}return NO},beginEditing:function(d,c){var f=this.$label(),e=this.get("parentView");if(c&&this.scrollToVisible()){var b=this.get("owner"),a=this.get("contentIndex");this.invokeLast(function(){var g=b.itemViewForContentIndex(a);if(g&&g.beginEditing){g.beginEditing(NO)}});return YES}else{if(!e||!f||f.get("length")===0){return NO}else{return d()}}}.enhance(),inlineEditorWillBeginEditing:function(d,o,n){var p=this.get("content"),i=this.get("displayDelegate"),h=this.getDelegateProperty("contentValueKey",i),j=this.get("parentView"),a=this.$label(),e=this.get("validator"),r,k,g,b,l,c,m,s,q,t;k=(h&&p)?(p.get?p.get(h):p[h]):p;r=this.computeFrameWithParentFrame(null);c=this._oldLineHeight=a.css("lineHeight");b=a.css("fontSize");l=this.$().css("top");if(l){l=parseInt(l.substring(0,l.length-2),0)}else{l=0}s=0;if(b&&c){q=b*1.5;if(q<c){a.css({lineHeight:"1.5"});s=(c-q)/2}else{oldLineHeight=null}}a=a[0];g=SC.offset(a);r.x=g.x;r.y=g.y+l+s;r.height=a.offsetHeight;r.width=a.offsetWidth;m=this.get("escapeHTML");d.set({value:k,exampleFrame:r,exampleElement:a,multiline:NO,isCollection:YES,validator:e,escapeHTML:m})},inlineEditorShouldBeginEditing:function(a){return YES},inlineEditorDidBeginEditing:function(b,d,e,a){b(d,e,a);var c=this.$label();this._oldOpacity=c.css("opacity");c.css("opacity",0);if(this._oldLineHeight){c.css({lineHeight:this._oldLineHeight})}}.enhance(),inlineEditorDidCommitEditing:function(d,f,c){var e=this.get("content");var a=this.displayDelegate;var b=this.getDelegateProperty("contentValueKey",a);if(b&&e){if(e.set){e.set(b,f)}else{e[b]=f}}else{this.set("content",f)}this.displayDidChange();this._endEditing()},_endEditing:function(a){this.$label().css("opacity",this._oldOpacity);a()}.enhance(),render:function(c,a){var f=this.get("content"),m=this.displayDelegate,b=this.get("outlineLevel"),e=this.get("outlineIndent"),l,j,i,n=[];n.push((this.get("contentIndex")%2===0)?"even":"odd");c.setClass("disabled",!this.get("isEnabled"));c.setClass("drop-target",this.get("isDropTarget"));i=c.begin("div").addClass("sc-outline");if(b>=0&&e>0){i.addStyle("left",e*(b+1))}j=this.get("disclosureState");if(j!==SC.LEAF_NODE){this.renderDisclosure(i,j);n.push("has-disclosure")}l=this.getDelegateProperty("contentCheckboxKey",m);if(l){j=f?(f.get?f.get(l):f[l]):NO;if(j!==null){this.renderCheckbox(i,j);n.push("has-checkbox")}}if(this.getDelegateProperty("hasContentIcon",m)){l=this.getDelegateProperty("contentIconKey",m);j=(l&&f)?(f.get?f.get(l):f[l]):null;if(j){this.renderIcon(i,j);n.push("has-icon")}}else{if(this.get("icon")){j=this.get("icon");this.renderIcon(i,j);n.push("has-icon")}}l=this.getDelegateProperty("contentValueKey",m);j=(l&&f)?(f.get?f.get(l):f[l]):f;if(j&&SC.typeOf(j)!==SC.T_STRING){j=j.toString()}if(this.get("escapeHTML")){j=SC.RenderContext.escapeHTML(j)}this.renderLabel(i,j);if(this.getDelegateProperty("hasContentRightIcon",m)){l=this.getDelegateProperty("contentRightIconKey",m);j=(l&&f)?(f.get?f.get(l):f[l]):null;this.renderRightIcon(i,j);n.push("has-right-icon")}l=this.getDelegateProperty("contentUnreadCountKey",m);j=(l&&f)?(f.get?f.get(l):f[l]):null;if(!SC.none(j)&&(j!==0)){this.renderCount(i,j);var d=["zero","one","two","three","four","five"];var k=j.toString().length;var h=d.length;var g=(k<h)?d[k]:d[h-1];n.push("has-count "+g+"-digit")}l=this.getDelegateProperty("listItemActionProperty",m);j=(l&&f)?(f.get?f.get(l):f[l]):null;if(j){this.renderAction(i,j);n.push("has-action")}if(this.getDelegateProperty("hasContentBranch",m)){l=this.getDelegateProperty("contentIsBranchKey",m);j=(l&&f)?(f.get?f.get(l):f[l]):NO;this.renderBranch(i,j);n.push("has-branch")}c.addClass(n);c=i.end()},renderDisclosure:function(a,d){var c=this.get("theme").disclosureRenderDelegate;a=a.begin("div").addClass("sc-disclosure-view").addClass("sc-regular-size").addClass(this.get("theme").classNames).addClass(c.get("className"));var b=this._disclosureRenderSource;if(!b){this._disclosureRenderSource=b=SC.Object.create({renderState:{},theme:this.get("theme")})}b.set("isSelected",d===SC.BRANCH_OPEN).set("isEnabled",this.get("isEnabled")).set("title","");c.render(b,a);a=a.end();this._disclosureRenderDelegate=c},renderCheckbox:function(a,d){var c=this.get("theme").checkboxRenderDelegate;a=a.begin("div").addClass("sc-checkbox-view").addClass("sc-regular-size").addClass(this.get("theme").classNames).addClass(c.get("className"));var b=this._checkboxRenderSource;if(!b){b=this._checkboxRenderSource=SC.Object.create({renderState:{},theme:this.get("theme")})}b.set("isSelected",d&&(d!==SC.MIXED_STATE)).set("isEnabled",this.get("isEnabled")&&this.get("contentIsEditable")).set("isActive",this._checkboxIsActive).set("title","");c.render(b,a);a=a.end();this._checkboxRenderDelegate=c},renderIcon:function(c,e){var b=null,d=null,a=[];if(e&&SC.ImageView.valueIsUrl(e)){b=e;d=""}else{d=e;b=SC.BLANK_IMAGE_URL}a.push(d,"icon");c.begin("img").addClass(a).attr("src",b).end()},renderLabel:function(b,a){b.push("<label>",a||"","</label>")},renderRightIcon:function(c,e){var b=null,d=null,a=[];if(e&&SC.ImageView.valueIsUrl(e)){b=e;d=""}else{d=e;b=SC.BLANK_IMAGE_URL}a.push("right-icon",d);c.begin("img").addClass(a).attr("src",b).end()},renderCount:function(a,b){a.push('<span class="count"><span class="inner">',b.toString(),"</span></span>")},renderAction:function(a,b){a.push('<img src="',SC.BLANK_IMAGE_URL,'" class="action" />')},renderBranch:function(c,b){var a=[];a.push("branch",b?"branch-visible":"branch-hidden");c.begin("span").addClass(a).push("&nbsp;").end()}});SC.ListItemView._deprecatedRenderWarningHasBeenIssued=false;sc_require("mixins/collection_view_delegate");sc_require("views/list_item");SC.DRAG_REORDER=16;SC.BENCHMARK_RELOAD=NO;SC.CollectionView=SC.View.extend(SC.CollectionViewDelegate,SC.CollectionContent,{classNames:["sc-collection-view"],displayProperties:["hasFirstResponder","isEnabled","isActive"],renderDelegateName:"collectionRenderDelegate",ACTION_DELAY:200,useFastPath:NO,content:null,contentBindingDefault:SC.Binding.multiple(),length:0,nowShowing:function(){return this.computeNowShowing()}.property("length","clippingFrame").cacheable(),selection:null,isSelectable:YES,isSelectableBindingDefault:SC.Binding.bool(),isEnabled:YES,isEnabledBindingDefault:SC.Binding.bool(),isEditable:YES,isEditableBindingDefault:SC.Binding.bool(),canReorderContent:NO,canReorderContentBindingDefault:SC.Binding.bool(),canDeleteContent:NO,canDeleteContentBindingDefault:SC.Binding.bool(),canEditContent:NO,canEditContentBindingDefault:SC.Binding.bool(),isDropTarget:NO,useToggleSelection:NO,actOnSelect:NO,selectOnMouseDown:YES,exampleView:SC.ListItemView,contentExampleViewKey:null,groupExampleView:null,contentGroupExampleViewKey:null,action:null,target:null,contentValueKey:null,acceptsFirstResponder:NO,isActive:NO,calculatedHeight:0,calculatedWidth:0,computeLayout:function(){return null},layoutForContentIndex:function(a){return null},allContentIndexes:function(){return SC.IndexSet.create(0,this.get("length")).freeze()}.property("length").cacheable(),contentIndexesInRect:function(a){return null},computeNowShowing:function(){var c=this.contentIndexesInRect(this.get("clippingFrame"));if(!c){c=this.get("allContentIndexes")}else{var b=this.get("length"),a=c.get("max");if(a>b){c=c.copy().remove(b,a-b).freeze()}}return c},showInsertionPoint:function(a,b){},hideInsertionPoint:function(){},delegate:null,selectionDelegate:function(){var a=this.get("delegate"),b=this.get("content");return this.delegateFor("isCollectionViewDelegate",a,b)}.property("delegate","content").cacheable(),contentDelegate:function(){var a=this.get("delegate"),b=this.get("content");return this.delegateFor("isCollectionContent",a,b)}.property("delegate","content").cacheable(),_contentGroupIndexes:function(){return this.get("contentDelegate").contentGroupIndexes(this,this.get("content"))}.property("contentDelegate","content").cacheable(),contentRangeDidChange:function(d,b,c,a){if(!b&&(c==="[]")){this.notifyPropertyChange("_contentGroupIndexes");this.reload(a)}else{this.contentPropertyDidChange(b,c,a)}},contentPropertyDidChange:function(c,b,a){},updateContentRangeObserver:function(){var d=this.get("nowShowing"),a=this._cv_contentRangeObserver,c=this.get("content");if(!c){return}if(a){c.updateRangeObserver(a,d)}else{var b=this.contentRangeDidChange;a=c.addRangeObserver(d,this,b,null);this._cv_contentRangeObserver=a}},removeContentRangeObserver:function(){var b=this.get("content"),a=this._cv_contentRangeObserver;if(a){if(b){b.removeRangeObserver(a)}this._cv_contentRangeObserver=null}},contentLengthDidChange:function(){var a=this.get("content");this.set("length",a?a.get("length"):0);this.computeLayout()},_cv_contentDidChange:function(){var b=this.get("content"),a=this.contentLengthDidChange;if(b===this._content){return}this.removeContentRangeObserver();if(this._content){this._content.removeObserver("length",this,a)}this._content=b;if(b){b.addObserver("length",this,a)}this.contentLengthDidChange();this.contentRangeDidChange(b,null,"[]",null)}.observes("content"),_invalidIndexes:NO,reload:function(a){var b=this._invalidIndexes;if(a&&b!==YES){if(b){b.add(a)}else{b=this._invalidIndexes=a.clone()}}else{this._invalidIndexes=YES}if(this.get("isVisibleInWindow")){this.invokeOnce(this.reloadIfNeeded)}return this},reloadIfNeeded:function(){var x=this._invalidIndexes;if(!x||!this.get("isVisibleInWindow")){return this}this._invalidIndexes=NO;var u=this.get("content"),v,w,n,z=this.computeLayout(),y=SC.BENCHMARK_RELOAD,c=this.get("nowShowing"),A=this._sc_itemViews,o=this.get("containerView")||this,a,r,t,s,l,p,h,q,e,m,k,B,d,b,g,j,f;if(x.isIndexSet&&x.contains(c)){x=YES}if(this.willReload){this.willReload(x===YES?null:x)}a=this.get("exampleView");t=a?a.isReusableInCollections:NO;r=this.get("groupExampleView");s=r?r.isReusableInCollections:NO;if(x.isIndexSet){if(y){SC.Benchmark.start(y="%@#reloadIfNeeded (Partial)".fmt(this),YES)}p=[];h=[];q=[];x.forEach(function(i){n=A?A[i]:null;if(c.contains(i)){if(n&&n.parentView===o){h.push(i)}else{q.push(i)}}else{if(n&&n.parentView===o){p.push(i)}}},this);for(v=0,w=p.length;v<w;++v){m=p[v];n=A?A[m]:null;delete A[m];g=this.get("contentDelegate");j=this.get("_contentGroupIndexes");f=j&&j.contains(m);if(f){f=g.contentIndexIsGroup(this,u,m)}l=f?s:t;if(l){b=f?this._GROUP_VIEW_POOL:this._VIEW_POOL;b.push(n);n.destroyLayer()}B=n.get("layer");if(B&&B.parentNode){B.parentNode.removeChild(B)}o.removeChild(n);if(!l){n.destroy()}}for(v=0,w=h.length;v<w;++v){m=h[v];n=A?A[m]:null;k=this.itemViewForContentIndex(m,YES);n.destroyLayer();o.replaceChild(k,n)}for(v=0,w=q.length;v<w;++v){m=q[v];k=this.itemViewForContentIndex(m,YES);o.insertBefore(k,null)}if(y){SC.Benchmark.end(y)}}else{if(y){SC.Benchmark.start(y="%@#reloadIfNeeded (Full)".fmt(this),YES)}if(A){A.length=0}e=o.get("childViews");if(e){e=e.copy()}o.beginPropertyChanges();if(this.willRemoveAllChildren){this.willRemoveAllChildren()}o.destroyLayer().removeAllChildren();if(e){for(v=0,w=e.length;v<w;++v){k=e[v];f=k.get("isGroupView");l=f?s:t;if(l){b=f?this._GROUP_VIEW_POOL:this._VIEW_POOL;b.push(k);k.destroyLayer()}else{k.destroy()}}}e=[];c.forEach(function(i){e.push(this.itemViewForContentIndex(i,YES))},this);o.set("childViews",e);o.replaceLayer();o.endPropertyChanges();if(y){SC.Benchmark.end(y)}}if(z){this.adjust(z)}if(this.didReload){this.didReload(x===YES?null:x)}return this},_TMP_ATTRS:{},_COLLECTION_CLASS_NAMES:["sc-collection-item"],_GROUP_COLLECTION_CLASS_NAMES:["sc-collection-item","sc-group-item"],_VIEW_POOL:null,_GROUP_VIEW_POOL:null,itemViewForContentIndex:function(l,a){var v;var u=this._sc_itemViews;if(!u){u=this._sc_itemViews=[]}else{if(!a&&(v=u[l])){return v}}var n=this.get("content"),p=n.objectAt(l),h=this.get("contentDelegate"),j=this.get("_contentGroupIndexes"),i=NO,w,k,q,f,r,d,b,c,t,g,e,o,s;i=j&&j.contains(l);if(i){i=h.contentIndexIsGroup(this,n,l)}if(i){w=this.get("contentGroupExampleViewKey");if(w&&p){k=p.get(w)}if(!k){k=this.get("groupExampleView")||this.get("exampleView")}r="_GROUP_VIEW_POOL"}else{w=this.get("contentExampleViewKey");if(w&&p){k=p.get(w)}if(!k){k=this.get("exampleView")}r="_VIEW_POOL"}c=this.get("containerView")||this;f=this.layerIdFor(l);t=h.contentIndexIsEnabled(this,n,l);g=h.contentIndexIsSelected(this,n,l);e=h.contentIndexOutlineLevel(this,n,l);o=h.contentIndexDisclosureState(this,n,l);s=this.isVisibleInWindow;q=this.layoutForContentIndex(l);if(k&&k.isReusableInCollections){d=this[r];if(!d){d=this[r]=[]}if(d.length>0){v=d.pop();b=v.prepareForReuse;if(b){b.call(v)}v.beginPropertyChanges();v.set("contentIndex",l);v.set("layerId",f);v.set("isEnabled",t);v.set("isSelected",g);v.set("outlineLevel",e);v.set("disclosureState",o);v.set("isVisibleInWindow",s);v.set("parentView",c);SC.View.views[f]=v;if(q){v.set("layout",q)}else{v.set("layout",k.prototype.layout)}v.set("content",p);v.endPropertyChanges()}}if(!v){var m=this._TMP_ATTRS;m.contentIndex=l;m.content=p;m.owner=m.displayDelegate=this;m.parentView=c;m.page=this.page;m.layerId=f;m.isEnabled=t;m.isSelected=g;m.outlineLevel=e;m.disclosureState=o;m.isGroupView=i;m.isVisibleInWindow=s;if(i){m.classNames=this._GROUP_COLLECTION_CLASS_NAMES}else{m.classNames=this._COLLECTION_CLASS_NAMES}if(q){m.layout=q}else{delete m.layout}v=this.createItemView(k,l,m)}u[l]=v;return v},itemViewForContentObject:function(a){return this.itemViewForContentIndex(this.get("content").indexOf(a))},_TMP_LAYERID:[],createItemView:function(c,a,b){return c.create(b)},layerIdFor:function(a){var b=this._TMP_LAYERID;b[0]=SC.guidFor(this);b[1]=a;return b.join("-")},contentIndexForLayerId:function(c){if(!c||!(c=c.toString())){return null}var b=this._baseLayerId;if(!b){b=this._baseLayerId=SC.guidFor(this)+"-"}if((c.length<=b.length)||(c.indexOf(b)!==0)){return null}var a=Number(c.slice(c.lastIndexOf("-")+1));return isNaN(a)?null:a},itemViewForEvent:function(j){var d=this.getPath("pane.rootResponder");if(!d){return null}var c=SC.guidFor(this)+"-",a=c.length,e=j.target,g=this.get("layer"),f=null,b,i,h;while(e&&e!==document&&e!==g){b=e?SC.$(e).attr("id"):null;if(b&&(f=this.contentIndexForLayerId(b))!==null){break}e=e.parentNode}if(f===null||(e===g)){e=g=null;return null}if(f>=this.get("length")){throw"layout for item view %@ was found when item view does not exist (%@)".fmt(b,this)}return this.itemViewForContentIndex(f)},expand:function(b){if(!b){return this}var a=this.get("contentDelegate"),c=this.get("content");b.forEach(function(d){var e=a.contentIndexDisclosureState(this,c,d);if(e===SC.BRANCH_CLOSED){a.contentIndexExpand(this,c,d)}},this);return this},collapse:function(b){if(!b){return this}var a=this.get("contentDelegate"),c=this.get("content");b.forEach(function(d){var e=a.contentIndexDisclosureState(this,c,d);if(e===SC.BRANCH_OPEN){a.contentIndexCollapse(this,c,d)}},this);return this},_cv_selectionDidChange:function(){var c=this.get("selection"),b=this._cv_selection,a=this._cv_selectionContentDidChange;if(c===b){return}if(b){b.removeObserver("[]",this,a)}if(c){c.addObserver("[]",this,a)}this._cv_selection=c;this._cv_selectionContentDidChange()}.observes("selection"),_cv_selectionContentDidChange:function(){var c=this.get("selection"),b=this._cv_selindexes,a=this.get("content"),d;this._cv_selindexes=c?c.frozenCopy():null;if(b){b=b.indexSetForSource(a)}if(c){c=c.indexSetForSource(a)}if(c&&b){d=c.without(b).add(b.without(c))}else{d=c||b}if(d&&d.get("length")>0){this.reloadSelectionIndexes(d)}},_invalidSelection:NO,reloadSelectionIndexes:function(a){var b=this._invalidSelection;if(a&&(b!==YES)){if(b){b.add(a)}else{b=this._invalidSelection=a.copy()}}else{this._invalidSelection=YES}if(this.get("isVisibleInWindow")){this.invokeOnce(this.reloadSelectionIndexesIfNeeded)}return this},reloadSelectionIndexesIfNeeded:function(){var e=this._invalidSelection;if(!e||!this.get("isVisibleInWindow")){return this}var d=this.get("nowShowing"),b=this._invalidIndexes,a=this.get("content"),c=this.get("selection");this._invalidSelection=NO;if(b===YES||!d){return this}if(e===YES){e=d}if(b&&b.isIndexSet){e=e.without(b)}e.forEach(function(f){if(!d.contains(f)){return}var g=this.itemViewForContentIndex(f,NO);if(g){g.set("isSelected",c?c.contains(a,f):NO)}},this);return this},select:function(c,f){var d=this.get("content"),a=this.get("selectionDelegate"),b=this.get("_contentGroupIndexes"),e;if(!this.get("isSelectable")||!this.get("isEnabled")){return this}if(SC.typeOf(c)===SC.T_NUMBER){c=SC.IndexSet.create(c,1)}if(c&&c.get("length")>0){if(b&&b.get("length")>0){c=c.copy().remove(b)}c=a.collectionViewShouldSelectIndexes(this,c,f);if(!c||c.get("length")===0){return this}}else{c=null}if(f&&(e=this.get("selection"))){e=e.copy()}else{e=SC.SelectionSet.create()}if(c&&c.get("length")>0){if(c.get("length")===1){e.addObject(d.objectAt(c.get("firstObject")))}else{e.add(d,c)}}e=a.collectionViewSelectionForProposedSelection(this,e);if(!e){e=SC.SelectionSet.create()}this._selectionAnchor=null;this.set("selection",e.freeze());return this},deselect:function(b){var d=this.get("selection"),c=this.get("content"),a=this.get("selectionDelegate");if(!this.get("isSelectable")||!this.get("isEnabled")){return this}if(!d||d.get("length")===0){return this}if(SC.typeOf(b)===SC.T_NUMBER){b=SC.IndexSet.create(b,1)}b=a.collectionViewShouldDeselectIndexes(this,b);if(!b||b.get("length")===0){return this}d=d.copy().remove(c,b);d=a.collectionViewSelectionForProposedSelection(this,d);if(!d){d=SC.SelectionSet.create()}this.set("selection",d.freeze());return this},_findNextSelectableItemFromIndex:function(h,a){var c=this.get("length"),d=SC.IndexSet.create(),e=this.get("content"),i=this.get("selectionDelegate"),g=this.get("_contentGroupIndexes"),f,b;if(!g&&(i.collectionViewShouldSelectIndexes===this.collectionViewShouldSelectIndexes)){return h}while(h<c){if(!g||!g.contains(h)){d.add(h);f=i.collectionViewShouldSelectIndexes(this,d);if(f&&f.get("length")>=1){return h}d.remove(h)}h++}if(a===undefined){b=this.get("selection");a=b?b.get("max"):-1}return a},_findPreviousSelectableItemFromIndex:function(b,h){var c=SC.IndexSet.create(),f=this.get("content"),a=this.get("selectionDelegate"),e=this.get("_contentGroupIndexes"),d;if(SC.none(b)){b=-1}if(!e&&(a.collectionViewShouldSelectIndexes===this.collectionViewShouldSelectIndexes)){return b}while(b>=0){if(!e||!e.contains(b)){c.add(b);d=a.collectionViewShouldSelectIndexes(this,c);if(d&&d.get("length")>=1){return b}c.remove(b)}b--}if(h===undefined){var g=this.get("selection");h=g?g.get("min"):-1}if(SC.none(h)){h=-1}return h},selectPreviousItem:function(h,b){if(SC.none(b)){b=1}if(SC.none(h)){h=false}var f=this.get("selection"),e=this.get("content");if(f){f=f.indexSetForSource(e)}var g=f?f.get("min"):-1,a=f?f.get("max")-1:-1,d=this._selectionAnchor;if(SC.none(d)){d=g}if(h){if(a>d){a=a-b}else{g=this._findPreviousSelectableItemFromIndex(g-b)}if(SC.none(g)||(g<0)){g=0}if(!e.objectAt(g)){g=f?f.get("min"):-1}if(a<g){a=g}}else{g=this._findPreviousSelectableItemFromIndex(g-b);if(SC.none(g)||(g<0)){g=0}if(!e.objectAt(g)){g=f?f.get("min"):-1}a=g;d=null}var c=g;f=SC.IndexSet.create(g,a+1-g);this.scrollToContentIndex(c);this.select(f);this._selectionAnchor=d;return this},selectNextItem:function(h,i){if(SC.none(i)){i=1}if(SC.none(h)){h=false}var b=this.get("selection"),g=this.get("content");if(b){b=b.indexSetForSource(g)}var a=b?b.get("min"):-1,d=b?b.get("max")-1:-1,e=this._selectionAnchor,c=this.get("length");if(SC.none(e)){e=a}if(h){if(a<e){a=a+i}else{d=this._findNextSelectableItemFromIndex(d+i,d)}if(d>=c){d=c-1}if(!g.objectAt(d)){d=b?b.get("max")-1:-1}if(a>d){a=d}}else{d=this._findNextSelectableItemFromIndex(d+i,d);if(d>=c){d=c-1}if(!g.objectAt(d)){d=b?b.get("max")-1:-1}a=d;e=null}var f=d;b=SC.IndexSet.create(a,d-a+1);this.scrollToContentIndex(f);this.select(b);this._selectionAnchor=e;return this},deleteSelection:function(){if(!this.get("canDeleteContent")){return NO}var d=this.get("selection"),c=this.get("content"),a=this.get("selectionDelegate"),b=d&&c?d.indexSetForSource(c):null;if(!c||!b||b.get("length")===0){return NO}b=a.collectionViewShouldDeleteIndexes(this,b);if(!b||b.get("length")===0){return NO}a.collectionViewDeleteContent(this,this.get("content"),b);return YES},scrollToContentIndex:function(b){var a=this.itemViewForContentIndex(b);if(a){this.scrollToItemView(a)}return this},scrollToItemView:function(a){if(a){a.scrollToVisible()}return this},keyDown:function(a){var b=this.interpretKeyEvents(a);return !b?NO:b},keyUp:function(){return true},insertText:function(b,a){if(b===" "){var c=this.get("selection");if(c&&c.get("length")>0){this.invokeLater(this._cv_action,0,null,a)}return YES}else{return NO}},selectAll:function(a){var b=this.get("content"),c=b?SC.IndexSet.create(0,b.get("length")):null;this.select(c,NO);return YES},deselectAll:function(){var a=this.get("content"),b=a?SC.IndexSet.create(0,a.get("length")):null;this.deselect(b,NO);return YES},deleteBackward:function(a){return this.deleteSelection()},deleteForward:function(a){return this.deleteSelection()},moveDown:function(b,a){this.selectNextItem(false,this.get("itemsPerRow")||1);this._cv_performSelectAction(null,a,this.ACTION_DELAY);return true},moveUp:function(b,a){this.selectPreviousItem(false,this.get("itemsPerRow")||1);this._cv_performSelectAction(null,a,this.ACTION_DELAY);return true},moveLeft:function(k){if(k.ctrlKey||k.metaKey){return NO}if((this.get("itemsPerRow")||1)>1){this.selectPreviousItem(false,1);this._cv_performSelectAction(null,k,this.ACTION_DELAY)}else{var c=this.get("selection"),i=this.get("content"),g=c?c.indexSetForSource(i):null;if(g){var l=undefined,f=false,h=undefined;if(g.get("length")===1){h=g.get("firstObject");l=this.get("contentDelegate");var b=l.contentIndexDisclosureState(this,i,h);if(b!==SC.BRANCH_OPEN){f=true}}if(f){var a=l.contentIndexOutlineLevel(this,i,h)-1;if(a>=0){var e=-1;while(e<0){var d=this._findPreviousSelectableItemFromIndex(h-1);if(d<0){return false}h=d;var j=l.contentIndexOutlineLevel(this,i,h);if(j===a){e=d}}if(e!==-1){this.select(h)}}}else{this.collapse(g)}}}return true},moveRight:function(a){if(a.ctrlKey||a.metaKey){return NO}if((this.get("itemsPerRow")||1)>1){this.selectNextItem(false,1);this._cv_performSelectAction(null,a,this.ACTION_DELAY)}else{var d=this.get("selection"),c=this.get("content"),b=d?d.indexSetForSource(c):null;if(b){this.expand(b)}}return true},moveDownAndModifySelection:function(b,a){this.selectNextItem(true,this.get("itemsPerRow")||1);this._cv_performSelectAction(null,a,this.ACTION_DELAY);return true},moveUpAndModifySelection:function(b,a){this.selectPreviousItem(true,this.get("itemsPerRow")||1);this._cv_performSelectAction(null,a,this.ACTION_DELAY);return true},moveLeftAndModifySelection:function(b,a){if((this.get("itemsPerRow")||1)>1){this.selectPreviousItem(true,1);this._cv_performSelectAction(null,a,this.ACTION_DELAY)}return true},moveRightAndModifySelection:function(b,a){if((this.get("itemsPerRow")||1)>1){this.selectNextItem(true,1);this._cv_performSelectAction(null,a,this.ACTION_DELAY)}return true},insertNewline:function(d,c){var b=this.get("isEditable")&&this.get("canEditContent"),g,f,h,a,e;if(b){g=this.get("selection");f=this.get("content");if(g&&g.get("length")===1){h=g.indexSetForSource(f);a=h?h.get("min"):-1;b=a>=0}}if(b){e=this.itemViewForContentIndex(a);b=e&&SC.typeOf(e.beginEditing)===SC.T_FUNCTION}if(b){this.scrollToContentIndex(a);e=this.itemViewForContentIndex(a);e.beginEditing()}else{this.invokeLater(this._cv_action,0,e,null)}return YES},insertTab:function(b){var a=this.get("nextValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return YES},insertBacktab:function(b){var a=this.get("previousValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return YES},mouseDown:function(j){var g=this.get("content");if(!g){return this.get("isSelectable")}var h=this.itemViewForEvent(j),e=h?h.get("contentIndex"):-1,c,d,b,a,k,f=NO,i=g.get("allowsMultipleSelection");if(!this.get("isEnabled")){return e>-1}if(!this.get("isSelectable")){return NO}this.becomeFirstResponder();if(this.get("useToggleSelection")){if(this.get("selectOnMouseDown")){if(!h){return}b=this.get("selection");a=b&&b.containsObject(h.get("content"));if(a){this.deselect(e)}else{if(!i){this.select(e,NO);f=YES}else{this.select(e,YES);f=YES}}if(f&&this.get("actOnSelect")){this._cv_performSelectAction(h,j)}}return YES}if(!h){if(this.get("allowDeselectAll")){this.select(null,false)}return YES}b=this.get("selection");if(b){b=b.indexSetForSource(g)}c=this.mouseDownInfo={event:j,itemView:h,contentIndex:e,at:Date.now()};a=b?b.contains(e):NO;c.modifierKeyPressed=k=j.ctrlKey||j.metaKey;if(k&&a){c.shouldDeselect=e>=0}else{if(j.shiftKey&&b&&b.get("length")>0&&i){b=this._findSelectionExtendedByShift(b,e);d=this._selectionAnchor;this.select(b);this._selectionAnchor=d}else{if(!k&&a){c.shouldReselect=e>=0}else{if((j.shiftKey||k)&&!i){this.select(null,false)}if(this.get("selectOnMouseDown")){this.select(e,k)}else{c.shouldSelect=e>=0}}}}c.previousContentIndex=e;return YES},mouseUp:function(i){var j=this.itemViewForEvent(i),d=this.mouseDownInfo,f=this.get("content"),e=j?j.get("contentIndex"):-1,c,a,b,g,k,h=f.get("allowsMultipleSelection");if(!this.get("isEnabled")){return e>-1}if(!this.get("isSelectable")){return NO}if(this.get("useToggleSelection")){if(!j||this.get("selectOnMouseDown")){return NO}c=this.get("selection");a=c&&c.containsObject(j.get("content"));if(a){this.deselect(e)}else{if(!h){this.select(e,NO)}else{this.select(e,YES)}}}else{if(d){k=d.contentIndex;e=(j)?j.get("contentIndex"):-1;if(d.shouldSelect){this.select(k,d.modifierKeyPressed)}if(d.shouldDeselect){this.deselect(k)}if(d.shouldReselect){b=this.get("isEditable")&&this.get("canEditContent");if(b){c=this.get("selection");b=c&&(c.get("length")===1)}if(b){g=this.itemViewForContentIndex(k);b=g&&(!g.contentHitTest||g.contentHitTest(i));b=(b&&g.beginEditing)?g.beginEditing():NO}if(!b){if(this._cv_reselectTimer){this._cv_reselectTimer.invalidate()}this._cv_reselectTimer=this.invokeLater(this.select,300,k,false)}}this._cleanupMouseDown()}}this._cv_performSelectAction(j,i,0,i.clickCount);return NO},_cleanupMouseDown:function(){var b=this.mouseDownInfo,a;if(b){for(a in b){if(!b.hasOwnProperty(a)){continue}delete b[a]}}this.mouseDownInfo=null},mouseMoved:function(c){var a=this.itemViewForEvent(c),b=this._lastHoveredItem;if(a!==b){if(b&&b.mouseExited){b.mouseExited(c)}if(a&&a.mouseEntered){a.mouseEntered(c)}}this._lastHoveredItem=a;if(a&&a.mouseMoved){a.mouseMoved(c)}return YES},mouseExited:function(b){var a=this._lastHoveredItem;this._lastHoveredItem=null;if(a&&a.mouseExited){a.mouseExited(b)}return YES},touchStart:function(d,a){var b=this.itemViewForEvent(d),c=b?b.get("contentIndex"):-1;if(!this.get("isEnabled")){return c>-1}this.becomeFirstResponder();this._touchSelectedView=b;if(!this.get("useToggleSelection")){if(b&&!b.get("isSelected")){b.set("isSelected",YES)}}return YES},touchesDragged:function(a,b){b.forEach(function(c){if(Math.abs(c.pageX-c.startX)>5||Math.abs(c.pageY-c.startY)>5){c.makeTouchResponder(c.nextTouchResponder)}},this)},touchEnd:function(e){var b=this._touchSelectedView,d=b?b.get("contentIndex"):-1,a=NO,c;if(!this.get("isEnabled")){return d>-1}if(b){b.set("isSelected",NO)}if(d>-1){if(this.get("useToggleSelection")){c=this.get("selection");a=c&&c.containsObject(b.get("content"))}if(a){this.deselect(d)}else{this.select(d,NO);this._cv_performSelectAction(b,e,0)}}this._touchSelectedView=null},touchCancelled:function(a){if(this._touchSelectedView){this._touchSelectedView.set("isSelected",NO);this._touchSelectedView=null}},_findSelectionExtendedByShift:function(e,h){if(!e||e.get("length")===0){return SC.IndexSet.create(h)}var d=this.get("content"),g=d.get("length")-1,c=e.get("min"),a=e.get("max")-1,f=this.mouseDownInfo,b=this._selectionAnchor;if(SC.none(b)){b=-1}if(h<c){c=h;if(b<0){this._selectionAnchor=b=a}}else{if(h>a){a=h;if(b<0){this._selectionAnchor=b=c}}else{if(h>=c&&h<=a){if(b<0){this._selectionAnchor=b=c}if(h===b){c=a=h}else{if(h>b){c=b;a=h}else{if(h<b){c=h;a=b}}}}}}return SC.IndexSet.create(c,a-c+1)},reorderDataType:function(){return"SC.CollectionView.Reorder."+SC.guidFor(this)}.property().cacheable(),dragContent:null,proposedInsertionIndex:null,proposedDropOperation:null,mouseDragged:function(h){var i=this.get("selectionDelegate"),e=this.get("content"),a=this.get("selection"),c=this.mouseDownInfo,f=this.get("_contentGroupIndexes"),d,b,g;if(!c||c.contentIndex<0){return YES}if((Date.now()-c.at)<123){return YES}if(i.collectionViewShouldBeginDrag(this)){if(!this.get("selectOnMouseDown")){d=SC.IndexSet.create(c.contentIndex)}else{d=a?a.indexSetForSource(e):null}if(d&&f&&f.get("length")>0){d=d.copy().remove(f);if(d.get("length")===0){d=null}else{d.freeze()}}if(!d){return YES}else{d=d.frozenCopy()}d={content:e,indexes:d};this.set("dragContent",d);b=this.get("dragDataTypes");if(b&&b.get("length")>0){g=i.collectionViewDragViewFor(this,d.indexes);if(!g){g=this._cv_dragViewFor(d.indexes)}g.createLayer();SC.Drag.start({event:c.event,source:this,dragView:g,ghost:NO,ghostActsLikeCursor:i.ghostActsLikeCursor,slideBack:YES,dataSource:this});this._cleanupMouseDown();this._lastInsertionIndex=null}else{this.set("dragContent",null)}return YES}},_cv_dragViewFor:function(f){var c=this.get("nowShowing").without(f),d=this.get("layer").cloneNode(false),b=SC.View.create({layer:d,parentView:this}),a=0,e;c=this.get("nowShowing").without(c);SC.$(d).css("backgroundColor","transparent").css("border","none").css("top",0).css("left",0);c.forEach(function(j){var k=this.itemViewForContentIndex(j),g,h;if(k){g=k.get("isSelected");k.set("isSelected",NO);k.updateLayerIfNeeded();h=k.get("layer");if(h){h=h.cloneNode(true)}k.set("isSelected",g);k.updateLayerIfNeeded()}if(h){d.appendChild(h);e=k.get("layout");if(e.height+e.top>a){a=e.height+e.top}}h=null},this);b.set("layout",{height:a});d=null;return b},dragDataTypes:function(){var a=this.get("selectionDelegate"),b=a.collectionViewDragDataTypes(this),c;if(this.get("canReorderContent")){b=b?b.copy():[];c=this.get("reorderDataType");if(b.indexOf(c)<0){b.push(c)}}return b?b:[]}.property(),dragDataForType:function(c,b){if(this.get("canReorderContent")){if(b===this.get("reorderDataType")){return this.get("dragContent")}}var a=this.get("selectionDelegate");return a.collectionViewDragDataForType(this,c,b)},computeDragOperations:function(c,b){var d=SC.DRAG_NONE,a=this.get("selectionDelegate");if(this.get("canReorderContent")){if(c.get("dataTypes").indexOf(this.get("reorderDataType"))>=0){d=SC.DRAG_REORDER}}d=a.collectionViewComputeDragOperations(this,c,d);if(d&SC.DRAG_REORDER){d=SC.DRAG_MOVE}return d},_computeDropOperationState:function(c,l,e){var g=this.convertFrameFromView(c.get("location"),null),k=SC.DROP_BEFORE,m=this.get("selectionDelegate"),d=this.get("canReorderContent"),n,h,a,i,f,b;var j=this.insertionIndexForLocation(g,SC.DROP_ON);if(SC.typeOf(j)===SC.T_ARRAY){k=j[1];j=j[0]}if(k===SC.DROP_ON){this.set("proposedInsertionIndex",j);this.set("proposedDropOperation",k);b=m.collectionViewValidateDragOperation(this,c,e,j,k);j=this.get("proposedInsertionIndex");k=this.get("proposedDropOperation");this._dropInsertionIndex=this._dropOperation=null;if(b!==SC.DRAG_NONE){return[j,k,b]}else{k=SC.DROP_BEFORE;j=this.insertionIndexForLocation(g,SC.DROP_BEFORE);if(SC.typeOf(j)===SC.T_ARRAY){k=j[1];j=j[0]}}}if((j>=0)&&d&&(k!==SC.DROP_ON)){n=c.dataForType(this.get("reorderDataType"));if(n){h=this.get("content");if(k===SC.DROP_BEFORE){a=n.indexes.contains(j-1);i=n.indexes.contains(j)}else{a=n.indexes.contains(j);i=n.indexes.contains(j-1)}if(a&&i){if(SC.none(this._lastInsertionIndex)){if(k===SC.DROP_BEFORE){while((j>=0)&&n.indexes.contains(j)){j--}}else{f=h?h.get("length"):0;while((j<f)&&n.indexes.contains(j)){j++}}}else{j=this._lastInsertionIndex}}if(j>=0){e=SC.DRAG_REORDER}}}this.set("proposedInsertionIndex",j);this.set("proposedDropOperation",k);e=m.collectionViewValidateDragOperation(this,c,e,j,k);j=this.get("proposedInsertionIndex");k=this.get("proposedDropOperation");this._dropInsertionIndex=this._dropOperation=null;return[j,k,e]},dragUpdated:function(f,b){var h=f.get("allowedDragOperations"),g=this._computeDropOperationState(f,b,h),a=g[0],c=g[1],e=g[2];if(e!==SC.DRAG_NONE){if((this._lastInsertionIndex!==a)||(this._lastDropOperation!==c)){var d=this.itemViewForContentIndex(a);this.showInsertionPoint(d,c)}this._lastInsertionIndex=a;this._lastDropOperation=c}else{this.hideInsertionPoint();this._lastInsertionIndex=this._lastDropOperation=null}return(e&SC.DRAG_REORDER)?SC.DRAG_MOVE:e},dragExited:function(){this.hideInsertionPoint();this._lastInsertionIndex=this._lastDropOperation=null},acceptDragOperation:function(a,b){return YES},performDragOperation:function(e,g){var a=this._computeDropOperationState(e,null,g),k=a[0],j=a[1],h=a[2],l=this.get("selectionDelegate"),c,m,d,i,b,f;if(h&SC.DRAG_REORDER){g=(g&SC.DRAG_MOVE)?SC.DRAG_REORDER:SC.DRAG_NONE}else{g=g&h}if(g===SC.DRAG_NONE){return g}c=l.collectionViewPerformDragOperation(this,e,g,k,j);if((c===SC.DRAG_NONE)&&(g&SC.DRAG_REORDER)){d=e.dataForType(this.get("reorderDataType"));if(!d){return SC.DRAG_NONE}i=this.get("content");f=d.indexes;if(f.get("length")===1){if(((j===SC.DROP_BEFORE)||(j===SC.DROP_AFTER))&&(f.get("min")===k)){return SC.DRAG_MOVE}}i.beginPropertyChanges();m=[];b=0;d.indexes.forEach(function(n){m.push(i.objectAt(n-b));i.removeAt(n-b);b++;if(n<k){k--}},this);if(j===SC.DROP_AFTER){k++}i.replace(k,0,m,j);this.select(SC.IndexSet.create(k,m.length));i.endPropertyChanges();g=SC.DRAG_MOVE}return g},collectionViewShouldBeginDrag:function(a){return this.get("canReorderContent")},insertionIndexForLocation:function(a,b){return -1},_cv_isVisibleInWindowDidChange:function(){if(this.get("isVisibleInWindow")){if(this._invalidIndexes){this.invokeOnce(this.reloadIfNeeded)}if(this._invalidSelection){this.invokeOnce(this.reloadSelectionIndexesIfNeeded)}}}.observes("isVisibleInWindow"),collectionViewShouldSelectItem:function(a,b){return this.get("isSelectable")},_TMP_DIFF1:SC.IndexSet.create(),_TMP_DIFF2:SC.IndexSet.create(),_cv_nowShowingDidChange:function(){var b=this.get("nowShowing"),a=this._sccv_lastNowShowing,d,e,c;if(a!==b){if(a&&b){e=this._TMP_DIFF1.add(a).remove(b);c=this._TMP_DIFF2.add(b).remove(a);d=e.add(c)}else{d=a||b}}if(d&&d.get("length")>0){this._sccv_lastNowShowing=b?b.frozenCopy():null;this.updateContentRangeObserver();this.reload(d)}if(e){e.clear()}if(c){c.clear()}}.observes("nowShowing"),init:function(){arguments.callee.base.apply(this,arguments);if(this.useFastPath){this.mixin(SC.CollectionFastPath)}if(this.get("canReorderContent")){this._cv_canReorderContentDidChange()}this._sccv_lastNowShowing=this.get("nowShowing").clone();if(this.content){this._cv_contentDidChange()}if(this.selection){this._cv_selectionDidChange()}},_cv_canReorderContentDidChange:function(){if(this.get("canReorderContent")){if(!this.get("isDropTarget")){this.set("isDropTarget",YES)}SC.Drag.addDropTarget(this)}}.observes("canReorderContent"),_cv_performSelectAction:function(b,d,c,a){var e;if(c===undefined){c=0}if(a===undefined){a=1}if((a>1)||this.get("actOnSelect")){if(this._cv_reselectTimer){this._cv_reselectTimer.invalidate()}e=this.get("selection");e=e?e.toArray():[];if(this._cv_actionTimer){this._cv_actionTimer.invalidate()}this._cv_actionTimer=this.invokeLater(this._cv_action,c,b,d,e)}},_cv_action:function(b,a,c){var d=this.get("action");var e=this.get("target")||null;this._cv_actionTimer=null;if(d){if(SC.typeOf(d)===SC.T_FUNCTION){return this.action(b,a)}var f=this.get("pane");if(f){f.rootResponder.sendAction(d,e,this,f,c)}}else{if(!b){return}else{if(SC.typeOf(b._action)==SC.T_FUNCTION){return b._action(a)}else{if(SC.typeOf(b.action)==SC.T_FUNCTION){return b.action(a)}}}}}});SC.DateFieldView=SC.TextFieldView.extend({value:null,showDate:YES,showTime:NO,formatTime:"%I:%M %p",formatDate:"%d/%m/%Y",formatDateTime:"%d/%m/%Y %I:%M %p",_dtConstants:["%a","%b","%d","%H","%I","%j","%m","%M","%p","%S","%U","%W","%y","%Y"],_wtConstants:[3,3,2,2,2,3,2,2,2,2,2,2,2,4],activeSelection:0,format:function(){var a=this.get("showTime");var b=this.get("showDate");if(a===YES&&b===YES){return this.get("formatDateTime")}if(a===YES){return this.get("formatTime")}return this.get("formatDate")}.property("showTime","showDate").cacheable(),validator:function(){return SC.Validator.DateTime.extend({format:this.get("format")})}.property("format").cacheable(),tabsSelections:function(){var f=[];var d=this.get("format");var i=this.get("_dtConstants");var b=this.get("_wtConstants");if(SC.empty(d)){throw"The format string is empty, and must be a valid string."}var g,j,c,e=0,a=0,h=0;while(e<d.length&&d.indexOf("%",e)!==-1){g=d.indexOf("%",e);j=d.substring(g,g+2);e=g+2;c=i.indexOf(j);if(c===-1){throw"SC.DateFieldView: The format's key '%@' is not supported.".fmt(j)}a=a+g-h;f.push(SC.Object.create({key:j,textSelection:SC.TextSelection.create({start:a,end:a+b[c]})}));a=a+b[c];h=e}g=j=c=null;return f}.property("format").cacheable(),updateTextSelectionObserver:function(){var a=this.get("activeSelection");var b=this.get("tabsSelections");if(this.get("isEditing")){this.selection(null,b[a].get("textSelection"))}}.observes("activeSelection","value"),updateValue:function(b,c){var e=(c===0)?-1:1;var d=this.get("value"),a;switch(b){case"%a":case"%d":case"%j":this.set("value",d.advance({day:e}));break;case"%b":case"%m":this.set("value",d.advance({month:e}));break;case"%H":case"%I":this.set("value",d.advance({hour:e}));break;case"%M":this.set("value",d.advance({minute:e}));break;case"%p":a=d.get("hour")>=12?-12:12;this.set("value",d.advance({hour:a}));break;case"%S":this.set("value",d.advance({second:e}));break;case"%U":this.set("value",d.advance({week1:e}));break;case"%W":this.set("value",d.advance({week0:e}));break;case"%y":case"%Y":this.set("value",d.advance({year:e}));break}},_selectRootElement:function(){},keyDown:function(a){if(this.interpretKeyEvents(a)){a.stop();return YES}return arguments.callee.base.apply(this,arguments)},ctrl_a:function(){return YES},moveUp:function(b){var a=this.get("activeSelection");var c=this.get("tabsSelections");this.updateValue(c[a].get("key"),1);return YES},moveDown:function(b){var a=this.get("activeSelection");var c=this.get("tabsSelections");this.updateValue(c[a].get("key"),0);return YES},insertText:function(a){return YES},moveRight:function(a){var c=this.get("tabsSelections");var b=this.get("activeSelection")+1;if(b===c.length){b=0}this.set("activeSelection",b);return YES},moveLeft:function(a){var c=this.get("tabsSelections");var b=this.get("activeSelection")-1;if(b===-1){b=c.length-1}this.set("activeSelection",b);return YES},insertTab:function(a){var c=this.get("tabsSelections");var b=this.get("activeSelection")+1;if(b<c.length){this.set("activeSelection",b);return YES}return NO},insertBacktab:function(a){var b=this.get("activeSelection")-1;if(b!==-1){this.set("activeSelection",b);return YES}return NO},mouseUp:function(b){var c=arguments.callee.base.apply(this,arguments);var e=this.get("selection");if(SC.none(e)){this.set("activeSelection",0)}else{var h=e.get("start");var g=this.get("tabsSelections");var a=g.length,f;for(var d=0;d<a;d++){f=g[d].get("textSelection");if(h>=f.get("start")&&h<=f.get("end")){this.set("activeSelection",d)}}}return c},deleteBackward:function(a){return YES},deleteForward:function(a){return YES}});SC.DisclosureView=SC.ButtonView.extend({classNames:["sc-disclosure-view"],renderDelegateName:"disclosureRenderDelegate",buttonBehavior:SC.TOGGLE_BEHAVIOR,toggleOnValue:YES,toggleOffValue:NO,valueBindingDefault:SC.Binding.bool(),keyDown:function(a){if(a.which===37||a.which===38){this.set("value",this.get("toggleOffValue"));return YES}if(a.which===39||a.which===40){this.set("value",this.get("toggleOnValue"));return YES}arguments.callee.base.apply(this,arguments)}});sc_require("views/collection");sc_require("mixins/collection_row_delegate");SC.ListView=SC.CollectionView.extend(SC.CollectionRowDelegate,{classNames:["sc-list-view"],acceptsFirstResponder:YES,showAlternatingRows:NO,render:function(a,b){a.setClass("alternating",this.get("showAlternatingRows"));return arguments.callee.base.apply(this,arguments)},rowDelegate:function(){var a=this.delegate,b=this.get("content");return this.delegateFor("isCollectionRowDelegate",a,b)}.property("delegate","content").cacheable(),_sclv_rowDelegateDidChange:function(){var d=this._sclv_rowDelegate,b=this.get("rowDelegate"),c=this._sclv_rowHeightDidChange,a=this._sclv_customRowHeightIndexesDidChange;if(d===b){return this}this._sclv_rowDelegate=b;if(d){d.removeObserver("rowHeight",this,c);d.removeObserver("customRowHeightIndexes",this,a)}if(!b){throw"Internal Inconsistancy: ListView must always have CollectionRowDelegate"}b.addObserver("rowHeight",this,c);b.addObserver("customRowHeightIndexes",this,a);this._sclv_rowHeightDidChange()._sclv_customRowHeightIndexesDidChange();return this}.observes("rowDelegate"),_sclv_rowHeightDidChange:function(){var b=this.get("rowDelegate"),a=b.get("rowHeight"),c;if(a===this._sclv_rowHeight){return this}this._sclv_rowHeight=a;c=SC.IndexSet.create(0,this.get("length"));this.rowHeightDidChangeForIndexes(c);return this},_sclv_customRowHeightIndexesDidChange:function(){var a=this.get("rowDelegate"),b=a.get("customRowHeightIndexes"),d=this._sclv_customRowHeightIndexes,c=this._sclv_customRowHeightIndexesContentDidChange;if((b===d)||(d&&d.isEqual(b))){return this}if(d&&this._sclv_isObservingCustomRowHeightIndexes){d.removeObserver("[]",this,c)}if(this._sclv_isObservingCustomRowHeightIndexes=b&&!b.get("isFrozen")){b.addObserver("[]",this,c)}this._sclv_customRowHeightIndexesContentDidChange();return this},_sclv_customRowHeightIndexesContentDidChange:function(){var a=this.get("rowDelegate"),b=a.get("customRowHeightIndexes"),c=this._sclv_customRowHeightIndexes,d;if(b&&c){d=b.copy().add(c)}else{d=b||c}this._sclv_customRowHeightIndexes=b?b.frozenCopy():null;this.rowHeightDidChangeForIndexes(d);return this},rowOffsetForContentIndex:function(h){if(h===0){return 0}var j=this.get("rowDelegate"),a=j.get("rowHeight"),f,e,c,b,i,g,d;e=h*a;f=this.get("rowSpacing");if(f){e+=h*f}if(j.customRowHeightIndexes&&(c=j.get("customRowHeightIndexes"))){b=this._sclv_offsetCache;if(!b){b=[];i=g=0;c.forEach(function(k){i+=this.rowHeightForContentIndex(k)-a;b[k+1]=i;g=k},this);this._sclv_max=g+1;this._sclv_offsetCache=b}i=b[h];if(i===undefined){i=b[h]=b[h-1];if(i===undefined){g=this._sclv_max;if(h<g){g=c.indexBefore(h)+1}i=b[h]=b[g]||0}}e+=i}return e},rowHeightForContentIndex:function(a){var b=this.get("rowDelegate"),e,c,f,d;if(b.customRowHeightIndexes&&(d=b.get("customRowHeightIndexes"))){c=this._sclv_heightCache;if(!c){c=[];f=this.get("content");d.forEach(function(g){c[g]=b.contentIndexRowHeight(this,f,g)},this);this._sclv_heightCache=c}e=c[a];if(e===undefined){e=b.get("rowHeight")}}else{e=b.get("rowHeight")}return e},rowHeightDidChangeForIndexes:function(b){var a=this.get("length");this._sclv_heightCache=this._sclv_offsetCache=null;if(b&&b.isIndexSet){b=b.get("min")}this.reload(SC.IndexSet.create(b,a-b));return this},_sclv_lengthDidChange:function(){this.adjust(this.computeLayout())}.observes("length"),computeLayout:function(){var a=this._sclv_layout;if(!a){a=this._sclv_layout={}}a.minHeight=this.rowOffsetForContentIndex(this.get("length"));this.set("calculatedHeight",a.minHeight);return a},layoutForContentIndex:function(b){var a=this.get("rowDelegate");return{top:this.rowOffsetForContentIndex(b),height:this.rowHeightForContentIndex(b)-a.get("rowPadding")*2,left:0,right:0}},contentIndexesInRect:function(h){var a=this.get("rowDelegate").get("rowHeight"),g=SC.minY(h),b=SC.maxY(h),i=h.height||0,f=this.get("length"),e,c,d;c=(g-(g%a))/a;e=this.rowOffsetForContentIndex(c);while(c>0&&e>g){c--;e-=this.rowHeightForContentIndex(c)}e+=this.rowHeightForContentIndex(c);while(c<f&&e<=g){c++;e+=this.rowHeightForContentIndex(c)}if(c<0){c=0}if(c>=f){c=f}d=c+((i-(i%a))/a);if(d>f){d=f}e=this.rowOffsetForContentIndex(d);while(d>=c&&e>=b){d--;e-=this.rowHeightForContentIndex(d)}e+=this.rowHeightForContentIndex(d);while(d<f&&e<b){d++;e+=this.rowHeightForContentIndex(d)}d++;if(d<c){d=c}if(d>f){d=f}return SC.IndexSet.create(c,d-c)},insertionPointView:SC.View.extend({classNames:"sc-list-insertion-point",render:function(a,b){if(b){a.push('<div class="anchor"></div>')}}}),showInsertionPoint:function(g,f){var h=this._insertionPointView;if(!h){h=this._insertionPointView=this.get("insertionPointView").create()}var d=g.get("contentIndex"),e=this.get("length"),c=SC.clone(g.get("layout")),a=g.get("outlineLevel"),b=g.get("outlineIndent")||0,i;if((d>=e)&&d>0){i=this.itemViewForContentIndex(e-1);if(i.get("isGroupView")){a=1;b=i.get("outlineIndent")}}if(SC.none(a)){a=-1}if(f&SC.DROP_ON){if(g!==this._lastDropOnView){this.hideInsertionPoint();g.set("isDropTarget",YES);this._lastDropOnView=g}}else{if(this._lastDropOnView){this._lastDropOnView.set("isDropTarget",NO);this._lastDropOnView=null}if(f&SC.DROP_AFTER){c.top+=c.height}c.height=2;c.right=0;c.left=((a+1)*b)+12;delete c.width;h.set("layout",c);this.appendChild(h)}},hideInsertionPoint:function(){if(this._lastDropOnView){this._lastDropOnView.set("isDropTarget",NO);this._lastDropOnView=null}var a=this._insertionPointView;if(a){a.removeFromParent().destroy()}this._insertionPointView=null},insertionIndexForLocation:function(g,k){var b={x:g.x,y:g.y,width:1,height:1},f=this.contentIndexesInRect(b),h=f.get("min"),i=this.get("length"),c,l,m,e,o,d,n,j,a;if(SC.none(h)||h<0){if((i===0)||(g.y<=this.rowOffsetForContentIndex(0))){h=0}else{if(g.y>=this.rowOffsetForContentIndex(i)){h=i}}}c=this.rowOffsetForContentIndex(h);l=c+this.rowHeightForContentIndex(h);if(k==SC.DROP_ON){if(this.get("isEditable")){m=Math.min(Math.floor((l-c)*0.2),5)}else{m=0}if(g.y>=(c+m)||g.y<=(l+m)){return[h,SC.DROP_ON]}}if(h>0){j=this.itemViewForContentIndex(h-1);n=(j?j.get("outlineIndent"):0)||0;d=j?j.get("outlineLevel"):0;if(h<i){j=this.itemViewForContentIndex(h);e=j?j.get("outlineLevel"):0;o=(j?j.get("outlineIndent"):0)||0;o*=e}else{e=j.get("isGroupView")?1:0;o=n*e}n*=d;if((e!==d)&&(o!==n)){if(n>o){h--;k=SC.DROP_AFTER}}}if(k===SC.DROP_BEFORE){j=(h<i)?this.itemViewForContentIndex(h):null;if(!j||j.get("isGroupView")){if(h>0){j=this.itemViewForContentIndex(h-1);if(!j.get("isGroupView")||(j.get("disclosureState")===SC.BRANCH_OPEN)){h=h-1;k=SC.DROP_AFTER}else{h=-1}}else{h=-1}}if(h<0){k=SC.DRAG_NONE}}return[h,k]},mouseWheel:function(a){var b=SC.InlineTextFieldView.editor;if(b&&b.get("isEditing")){if(b.get("delegate").get("displayDelegate")===this){SC.InlineTextFieldView.commitEditing()}}return NO},init:function(){arguments.callee.base.apply(this,arguments);this._sclv_rowDelegateDidChange()}});sc_require("views/list");SC.GridView=SC.ListView.extend({classNames:["sc-grid-view"],layout:{left:0,right:0,top:0,bottom:0},rowHeight:48,columnWidth:64,exampleView:SC.LabelView,insertionOrientation:SC.HORIZONTAL_ORIENTATION,itemsPerRow:function(){var b=this.get("frame"),a=this.get("columnWidth")||0;return(a<=0)?1:Math.floor(b.width/a)}.property("frame","columnWidth").cacheable(),contentIndexesInRect:function(e){var d=this.get("rowHeight")||48,b=this.get("itemsPerRow"),c=Math.floor(SC.minY(e)/d)*b,a=Math.ceil(SC.maxY(e)/d)*b;return SC.IndexSet.create(c,a-c)},layoutForContentIndex:function(g){var d=this.get("rowHeight")||48,a=this.get("frame").width,b=this.get("itemsPerRow"),e=Math.floor(a/b),f=Math.floor(g/b),c=g-(b*f);return{left:c*e,top:f*d,height:d,width:e}},computeLayout:function(){var e=this.get("content"),d=(e)?e.get("length"):0,c=this.get("rowHeight")||48,a=this.get("itemsPerRow"),f=Math.ceil(d/a);var b=this._cachedLayoutHash;if(!b){b=this._cachedLayoutHash={}}b.minHeight=f*c;this.calculatedHeight=b.minHeight;return b},insertionPointClass:SC.View.extend({classNames:["grid-insertion-point"],render:function(a,b){if(b){a.push('<span class="anchor"></span>')}}}),showInsertionPoint:function(c,e){if(!c){return}if(e&SC.DROP_ON){if(c!==this._lastDropOnView){this.hideInsertionPoint();c.set("isDropTarget",YES);this._lastDropOnView=c}}else{if(this._lastDropOnView){this._lastDropOnView.set("isDropTarget",NO);this._lastDropOnView=null}if(!this._insertionPointView){this._insertionPointView=this.insertionPointClass.create()}var b=this._insertionPointView;var a=c.get("frame");var d={height:a.height-6,x:a.x,y:a.y+6,width:0};if(!SC.rectsEqual(b.get("frame"),d)){b.set("frame",d)}if(b.parentNode!==c.parentNode){c.parentNode.appendChild(b)}}},hideInsertionPoint:function(){if(this._lastDropOnView){this._lastDropOnView.set("isDropTarget",NO);this._lastDropOnView=null}var a=this._insertionPointView;if(a){a.removeFromParent().destroy()}this._insertionPointView=null},insertionIndexForLocation:function(d,j){var e=this.get("frame"),g=this.get("clippingFrame"),k=this.get("itemsPerRow"),a=Math.floor(e.width/k),m=Math.floor((d.y-e.y-g.y)/this.get("rowHeight"));var i=SC.DROP_BEFORE,c=(d.x-e.x-g.x),b=Math.floor(c/a),l=(c/a)-b;if(j===SC.DROP_ON){if(l>0.8){b++}if((l>=0.2)&&(l<=0.8)){i=SC.DROP_ON}}else{if(l>0.45){b++}}var h=(m*k)+b;return[h,i]},_gv_frameDidChange:function(){var e=this.get("frame"),c;c=e.width;if(this._lastFrameWidth&&c!==this._lastFrameWidth){this.notifyPropertyChange("itemsPerRow");var a,b,d=this.get("nowShowing");d.forEach(function(f){b=this.itemViewForContentIndex(f);b.adjust(this.layoutForContentIndex(f))},this)}this._lastFrameWidth=c}.observes("frame")});SC.ImageButtonView=SC.ButtonView.extend({classNames:["sc-image-button-view"],themeName:null,renderDelegateName:"imageButtonRenderDelegate",displayProperties:["image"],image:null});SC.ANCHOR_TOP={top:0};SC.ANCHOR_LEFT={left:0};SC.ANCHOR_TOP_LEFT={top:0,left:0};SC.ANCHOR_BOTTOM={bottom:0};SC.ANCHOR_RIGHT={right:0};SC.ANCHOR_BOTTOM_RIGHT={bottom:0,right:0};SC.ToolbarView=SC.View.extend({classNames:["sc-toolbar-view"],ariaRole:"toolbar",renderDelegateName:"toolbarRenderDelegate",anchorLocation:null,layout:{left:0,height:32,right:0},init:function(){if(this.anchorLocation){this.layout=SC.merge(this.layout,this.anchorLocation)}arguments.callee.base.apply(this,arguments)}});sc_require("views/toolbar");SC.WorkspaceView=SC.View.extend({classNames:["sc-workspace-view"],displayProperties:["hasTopToolbar","hasBottomToolbar"],renderDelegateName:"workspaceRenderDelegate",topToolbar:SC.ToolbarView.extend(),bottomToolbar:null,contentView:SC.View.extend(),autoResizeToolbars:NO,defaultToolbarSize:44,largeToolbarSize:44,smallToolbarSize:30,toolbarSize:function(){if(!this.get("autoResizeToolbars")){return this.get("defaultToolbarSize")}if(this.get("orientation")===SC.HORIZONTAL_ORIENTATION){return this.get("smallToolbarSize")}return this.get("largeToolbarSize")}.property("autoHideMaster","orientation"),orientation:function(){var a=this.get("frame");if(a.width>a.height){return SC.HORIZONTAL_ORIENTATION}else{return SC.VERTICAL_ORIENTATION}}.property("frame").cacheable(),masterIsHidden:NO,masterIsHiddenDidChange:function(){var a,b=this.get("masterIsHidden");if(a=this.get("topToolbar")){a.set("masterIsHidden",b)}if(a=this.get("bottomToolbar")){a.set("masterIsHidden",b)}}.observes("masterIsHidden"),_scmd_tilePropertyDidChange:function(){this.invokeOnce("_scws_tile")}.observes("toolbarSize"),createChildViews:function(){arguments.callee.base.apply(this,arguments);var a=this.get("topToolbar");if(a){a=this.topToolbar=this.activeTopToolbar=this.createChildView(a);this.appendChild(a)}var c=this.get("bottomToolbar");if(c){c=this.bottomToolbar=this.activeBottomToolbar=this.createChildView(c);this.appendChild(c)}var b=this.get("contentView");b=this.contentView=this.activeContentView=this.createChildView(b);this.appendChild(b);this.invokeOnce("_scws_tile")},_scws_tile:function(){var b=0,e=0,a=this.get("topToolbar"),f=this.get("bottomToolbar"),d=this.get("contentView"),c=this.get("toolbarSize");if(a){a.set("layout",{left:0,right:0,top:0,height:c});b+=c}if(f){f.set("layout",{left:0,right:0,bottom:0,height:c});e+=c}this.contentView.set("layout",{left:0,right:0,top:b,bottom:e})},hasTopToolbar:function(){if(this.get("topToolbar")){return YES}return NO}.property("topToolbar").cacheable(),hasBottomToolbar:function(){if(this.get("bottomToolbar")){return YES}return NO}.property("bottomToolbar").cacheable(),childDidChange:function(){this._scws_tile()},activeTopToolbar:null,activeBottomToolbar:null,activeContentView:null,topToolbarDidChange:function(){var b=this.activeTopToolbar,a=this.get("topToolbar");if(b){this.removeChild(b)}if(a){this.appendChild(a)}this.activeTopToolbar=a;this.invokeLast("childDidChange")}.observes("topToolbar"),bottomToolbarDidChange:function(){var b=this.activeBottomToolbar,a=this.get("bottomToolbar");if(b){this.removeChild(b)}if(a){this.appendChild(a)}this.activeBottomToolbar=a;this.invokeLast("childDidChange")}.observes("bottomToolbar"),contentViewDidChange:function(){var b=this.activeContentView,a=this.get("contentView");if(b){this.removeChild(b)}if(a){this.appendChild(a)}this.activeContentView=a;this.invokeLast("childDidChange")}.observes("contentView")});sc_require("views/workspace");sc_require("views/toolbar");SC.MasterDetailView=SC.View.extend({classNames:["sc-master-detail-view"],renderDelegateName:"masterDetailRenderDelegate",masterView:SC.WorkspaceView.extend({topToolbar:SC.ToolbarView.extend({}),contentView:SC.View.extend({backgroundColor:"white"})}),detailView:SC.WorkspaceView.extend({topToolbar:SC.ToolbarView.extend({childViews:["showHidePicker"],showHidePicker:SC.ButtonView.extend({layout:{left:7,centerY:0,height:30,width:100},controlSize:SC.AUTO_CONTROL_SIZE,title:"Picker",action:"toggleMasterPicker",isVisible:NO,isVisibleBinding:".parentView.masterIsHidden"})})}),autoHideMaster:function(){if(SC.platform.touch){return YES}return NO}.property().cacheable(),masterWidth:250,dividerWidth:SC.propertyFromRenderDelegate("dividerWidth",1),masterIsHidden:function(){if(!this.get("autoHideMaster")){return NO}if(this.get("orientation")===SC.HORIZONTAL_ORIENTATION){return NO}return YES}.property("autoHideMaster","orientation"),orientation:SC.VERTICAL_ORIENTATION,_scmd_frameDidChange:function(){var b=this.get("frame"),a;if(b.width>b.height){a=SC.HORIZONTAL_ORIENTATION}else{a=SC.VERTICAL_ORIENTATION}this.setIfChanged("orientation",a)}.observes("frame"),init:function(){arguments.callee.base.apply(this,arguments);this._scmd_frameDidChange();this._scmd_masterIsHiddenDidChange()},toggleMasterPicker:function(a){if(!this.get("masterIsHidden")){return}if(this._picker&&this._picker.get("isVisibleInWindow")){this.hideMasterPicker()}else{this.showMasterPicker(a)}},showMasterPicker:function(b){if(this._picker&&this._picker.get("isVisibleInWindow")){return}if(!this._picker){var a=this.get("pickerPane");this._picker=a.create({})}this._picker.set("contentView",this.get("masterView"));this._picker.set("extraRightOffset",this.get("pointerDistanceFromEdge"));this.showPicker(this._picker,b)},hideMasterPicker:function(){if(this._picker&&this._picker.get("isVisibleInWindow")){this.hidePicker(this._picker)}},showPicker:function(b,a){b.popup(a,SC.PICKER_POINTER,[3,0,1,2,3],[9,-9,-18,18])},hidePicker:function(a){a.remove()},pickerPane:SC.PickerPane.extend({layout:{width:250,height:480},themeName:"popover"}),_picker:null,pointerDistanceFromEdge:46,_scmd_masterIsHiddenDidChange:function(){var a=this.get("masterIsHidden");this.get("masterView").set("masterIsHidden",a);this.get("detailView").set("masterIsHidden",a)}.observes("masterIsHidden"),_scmd_orientationDidChange:function(){this.invokeOnce("_scmd_tile")}.observes("orientation"),_scmd_retileProperties:function(){this.invokeOnce("_scmd_tile")}.observes("masterIsHidden","masterWidth"),createChildViews:function(){var b=this.get("masterView");b=this.masterView=this.createChildView(b);var a=this.get("detailView");a=this.detailView=this.createChildView(a);this.appendChild(a);this.invokeOnce("_scmd_tile")},_masterIsDrawn:NO,_scmd_tile:function(){var b=!this.get("masterIsHidden");var e=this.get("masterWidth"),d=this.get("masterView"),c=this.get("detailView");if(b){this.hideMasterPicker();if(!this._masterIsDrawn){if(this._picker){this._picker.set("contentView",null)}this.appendChild(d);this._masterIsDrawn=YES}d.set("layout",{left:0,top:0,bottom:0,width:e});var a=this.get("dividerWidth");c.set("layout",{left:e+a,right:0,top:0,bottom:0})}else{if(this._masterIsDrawn){this.removeChild(d);this._masterIsDrawn=NO}c.set("layout",{left:0,right:0,top:0,bottom:0})}}});SC.ScrollerView=SC.View.extend({classNames:["sc-scroller-view"],displayProperties:["thumbPosition","thumbLength","isEnabled","controlsHidden"],ariaRole:"scrollbar",shouldScrollToClick:NO,_touchScrollValue:NO,value:function(a,c){var b=this.get("minimum");if(c!==undefined){this._scs_value=c}c=this._scs_value||b;return Math.max(Math.min(c,this.get("maximum")),b)}.property("maximum","minimum").cacheable(),displayValue:function(){var a;if(this.get("_touchScrollValue")){a=this.get("_touchScrollValue")}else{a=this.get("value")}return a}.property("value","_touchScrollValue").cacheable(),proportion:0,maximum:100,minimum:0,isEnabled:function(a,b){if(b!==undefined){this._scsv_isEnabled=b}if(this._scsv_isEnabled!==undefined){return this._scsv_isEnabled}return this.get("proportion")<1}.property("proportion").cacheable(),_scsv_isEnabled:undefined,layoutDirection:SC.LAYOUT_VERTICAL,hasButtons:YES,scrollbarThickness:14,capLength:18,capOverlap:14,buttonLength:41,buttonOverlap:11,minimumThumbLength:20,render:function(c,a){var i="vertical",b={},k="",p=this.get("parentView"),h=this.get("layoutDirection"),e,m,g,f,n,l,j,d,o;switch(h){case SC.LAYOUT_VERTICAL:b["sc-vertical"]=YES;break;case SC.LAYOUT_HORIZONTAL:b["sc-horizontal"]=YES;i="horizontal";break}b.disabled=!this.get("isEnabled");b["controls-hidden"]=this.get("controlsHidden");c.setClass(b);m=this.get("thumbLength");e=this.get("thumbPosition");if(a){c.push('<div class="track"></div>','<div class="cap"></div>');this.renderButtons(c,this.get("hasButtons"));this.renderThumb(c,h,m,e);c.attr("aria-orientation",i);c.attr("aria-valuemax",this.get("maximum"));c.attr("aria-valuemin",this.get("minimum"));c.attr("aria-valuenow",this.get("value"));c.attr("aria-controls",p.getPath("contentView.layerId"))}else{if(this.get("controlsHidden")){return}f=this.$(".thumb");this.adjustThumb(f,e,m);c.attr("aria-valuenow",this.get("value"))}},renderThumb:function(d,e,b,c){var a;if(e===SC.LAYOUT_HORIZONTAL){a="width: "+b+"px; left: "+c+"px;"}else{a="height: "+b+"px; top: "+c+"px;"}d.push('<div class="thumb" style="%@">'.fmt(a),'<div class="thumb-center"></div>','<div class="thumb-top"></div>','<div class="thumb-bottom"></div></div>')},renderButtons:function(b,a){if(a){b.push('<div class="button-bottom"></div><div class="button-top"></div>')}else{b.push('<div class="endcap"></div>')}},touchScrollDidStart:function(a){this.set("_touchScrollValue",a)},touchScrollDidEnd:function(a){this.set("_touchScrollValue",NO)},touchScrollDidChange:function(a){this.set("_touchScrollValue",a)},adjustThumb:function(b,a,c){this.adjustThumbPosition(b,a);this.adjustThumbSize(b,c)},adjustThumbPosition:function(b,a){if(this._thumbPosition===a){return}switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:b.css("top",a);break;case SC.LAYOUT_HORIZONTAL:b.css("left",a);break}this._thumbPosition=a},adjustThumbSize:function(a,b){if(this._thumbSize===b){return}switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:a.css("height",Math.max(b,this.get("minimumThumbLength")));break;case SC.LAYOUT_HORIZONTAL:a.css("width",Math.max(b,this.get("minimumThumbLength")));break}this._thumbSize=b},trackLength:function(){var a=this.get("scrollerLength");a-=this.capLength-this.capOverlap;a-=this.buttonLength-this.buttonOverlap;return a}.property("scrollerLength").cacheable(),scrollerLength:function(){switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:return this.get("frame").height;case SC.LAYOUT_HORIZONTAL:return this.get("frame").width}return 0}.property("frame").cacheable(),thumbLength:function(){var a;a=Math.floor(this.get("trackLength")*this.get("proportion"));a=isNaN(a)?0:a;return Math.max(a,this.get("minimumThumbLength"))}.property("trackLength","proportion").cacheable(),thumbPosition:function(){var g=this.get("displayValue"),c=this.get("maximum"),b=this.get("trackLength"),d=this.get("thumbLength"),f=this.get("capLength"),e=this.get("capOverlap"),a;a=(g/c)*(b-d);a+=f-e;return Math.floor(isNaN(a)?0:a)}.property("displayValue","maximum","trackLength","thumbLength").cacheable(),controlsHidden:function(){return this.get("proportion")>=1}.property("proportion").cacheable(),valueForPosition:function(g){var b=this.get("maximum"),a=this.get("trackLength"),c=this.get("thumbLength"),f=this.get("capLength"),d=this.get("capOverlap"),e;e=g-(f-d);e=e/(a-c);e=e*b;return e},mouseDown:function(j){if(!this.get("isEnabled")){return NO}this._altIsDown=j.altKey;this._shiftIsDown=j.shiftKey;var e=j.target,c=this.get("thumbPosition"),i,d,g,f=this.get("scrollerLength");if(e.className.indexOf("thumb")>=0){d=this.convertFrameFromView({x:j.pageX,y:j.pageY});d.x-=c;d.y-=c;this._thumbDragging=YES;this._thumbOffset=d;this._mouseDownLocation={x:j.pageX,y:j.pageY};this._thumbPositionAtDragStart=this.get("thumbPosition");this._valueAtDragStart=this.get("value")}else{if(e.className.indexOf("button-top")>=0){this.decrementProperty("value",(this._altIsDown?f:30));this.makeButtonActive(".button-top");this.startMouseDownTimer("scrollUp");this._isScrollingUp=YES}else{if(e.className.indexOf("button-bottom")>=0){this.incrementProperty("value",(this._altIsDown?f:30));this.makeButtonActive(".button-bottom");this.startMouseDownTimer("scrollDown");this._isScrollingDown=YES}else{var l=this.get("shouldScrollToClick");if(j.altKey){l=!l}var a=this.get("trackLength"),h=this.get("thumbLength"),b=this.convertFrameFromView({x:j.pageX,y:j.pageY}),k;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:this._mouseDownLocation=k=b.y;break;case SC.LAYOUT_HORIZONTAL:this._mouseDownLocation=k=b.x;break}if(l){this.set("value",this.valueForPosition(k-(h/2)));c=this.get("thumbPosition");this._thumbDragging=YES;this._thumbOffset={x:b.x-c,y:b.y-c};this._mouseDownLocation={x:j.pageX,y:j.pageY};this._thumbPositionAtDragStart=c;this._valueAtDragStart=this.get("value")}else{if(k<c){this.decrementProperty("value",f);this.startMouseDownTimer("page")}else{this.incrementProperty("value",f);this.startMouseDownTimer("page")}}}}}return YES},mouseUp:function(a){var c=this._scs_buttonActive,b=NO,d;if(c){c.removeClass("active");b=YES}d=this._mouseDownTimer;if(d){d.invalidate();this._mouseDownTimer=null}this._thumbDragging=NO;this._isScrollingDown=NO;this._isScrollingUp=NO;return b},mouseDragged:function(m){var k,b,l,c,i=m.target,e=this._thumbPositionAtDragStart,g=this._isScrollingUp,o=this._isScrollingDown,d=this._scs_buttonActive,a;if(this._thumbDragging){switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:l=(m.pageY-this._mouseDownLocation.y);break;case SC.LAYOUT_HORIZONTAL:l=(m.pageX-this._mouseDownLocation.x);break}if(m.altKey){if(!this._altIsDown||(this._shiftIsDown!==m.shiftKey)){e=this._thumbPositionAtDragStart=e+l;l=0;this._mouseDownLocation={x:m.pageX,y:m.pageY};this._valueAtDragStart=this.get("value")}if(m.shiftKey){l=-l}this.set("value",Math.round(this._valueAtDragStart+l*2))}else{c=e+l;b=this.get("trackLength")-this.get("thumbLength");this.set("value",Math.round((c/b)*this.get("maximum")))}}else{if(g||o){var n=NO,f=NO;var j=this.$(".button-top")[0].getBoundingClientRect();var h=this.$(".button-bottom")[0].getBoundingClientRect();switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:if(m.clientY<j.bottom){n=YES}else{f=YES}break;case SC.LAYOUT_HORIZONTAL:if(m.clientX<j.right){n=YES}else{f=YES}break}if((n||f)&&n!==g){if(d){d.removeClass("active")}this._mouseDownTimerAction=n?"scrollUp":"scrollDown";if(n){this.makeButtonActive(".button-top")}else{if(f){this.makeButtonActive(".button-bottom")}}this._isScrollingUp=n;this._isScrollingDown=f}}}this._altIsDown=m.altKey;this._shiftIsDown=m.shiftKey;return YES},startMouseDownTimer:function(b,a){var c;this._mouseDownTimerAction=b;this._mouseDownTimer=SC.Timer.schedule({target:this,action:this.mouseDownTimerDidFire,interval:a?0:300})},mouseDownTimerDidFire:function(){var d=this.get("scrollerLength"),a=SC.device.get("mouseLocation"),c=this.get("thumbPosition"),b=this.get("thumbLength"),e=50;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:a=this.convertFrameFromView(a).y;break;case SC.LAYOUT_HORIZONTAL:a=this.convertFrameFromView(a).x;break}switch(this._mouseDownTimerAction){case"scrollDown":this.incrementProperty("value",this._altIsDown?d:30);break;case"scrollUp":this.decrementProperty("value",this._altIsDown?d:30);break;case"page":e=150;if(a<c){this.decrementProperty("value",d)}else{if(a>c+b){this.incrementProperty("value",d)}}}this._mouseDownTimer=SC.Timer.schedule({target:this,action:this.mouseDownTimerDidFire,interval:e})},makeButtonActive:function(a){this._scs_buttonActive=this.$(a).addClass("active")}});SC.TouchScrollerView=SC.ScrollerView.extend({classNames:["sc-touch-scroller-view"],scrollbarThickness:12,capLength:5,capOverlap:0,hasButtons:NO,buttonOverlap:36,adjustThumb:function(d,b,f){var c=this.$(".thumb-inner");var a=this.get("scrollerLength")-this.capLength,e=this.get("minimum")+this.capLength;if(b+f>a){b=Math.min(a-20,b);f=a-b}if(b<e){f-=e-b;b=e}switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:if(this._thumbPosition!==b){d.css("-webkit-transform","translate3d(0px,"+b+"px,0px)")}if(this._thumbSize!==f){c.css("-webkit-transform","translate3d(0px,"+Math.round(f-1044)+"px,0px)")}break;case SC.LAYOUT_HORIZONTAL:if(this._thumbPosition!==b){d.css("-webkit-transform","translate3d("+b+"px,0px,0px)")}if(this._thumbSize!==f){c.css("-webkit-transform","translate3d("+Math.round(f-1044)+"px,0px,0px)")}break}this._thumbPosition=b;this._thumbSize=f},render:function(c,a){var b=[],e,j,g,f,k,i,h,d,l;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:b.push("sc-vertical");break;case SC.LAYOUT_HORIZONTAL:b.push("sc-horizontal");break}if(!this.get("isEnabled")){b.push("disabled")}if(this.get("controlsHidden")){b.push("controls-hidden")}c.addClass(b);j=this.get("thumbLength");e=this.get("thumbPosition");if(a){c.push('<div class="track"></div><div class="cap"></div>');this.renderButtons(c,this.get("hasButtons"));this.renderThumb(c,this.get("layoutDirection"),j)}else{if(this.get("controlsHidden")){return}f=this.$(".thumb");this.adjustThumb(f,e,j)}},renderThumb:function(b,c,a){a-=1044;c=(c===SC.LAYOUT_HORIZONTAL?"X":"Y");b.push('<div class="thumb"><div class="thumb-top"></div><div class="thumb-clip">'+'<div class="thumb-inner" style="-webkit-transform: translate%@(%@px);">'.fmt(c,a)+'<div class="thumb-center"></div><div class="thumb-bottom"></div></div></div></div>')}});sc_require("views/scroller");SC.NORMAL_SCROLL_DECELERATION=0.95;SC.FAST_SCROLL_DECELERATION=0.85;SC.ScrollView=SC.View.extend({classNames:["sc-scroll-view"],isScrollable:YES,contentView:null,horizontalAlign:SC.ALIGN_LEFT,verticalAlign:SC.ALIGN_TOP,horizontalScrollOffset:function(b,d){if(d!==undefined){var c=this.minimumHorizontalScrollOffset(),a=this.get("maximumHorizontalScrollOffset");this._scroll_horizontalScrollOffset=Math.max(c,Math.min(a,d))}return this._scroll_horizontalScrollOffset||0}.property().cacheable(),verticalScrollOffset:function(b,d){if(d!==undefined){var c=this.get("minimumVerticalScrollOffset"),a=this.get("maximumVerticalScrollOffset");this._scroll_verticalScrollOffset=Math.max(c,Math.min(a,d))}return this._scroll_verticalScrollOffset||0}.property().cacheable(),maximumScrollOffset:function(b,a,c){if(b>=a){return b-a}if(c===SC.ALIGN_LEFT||c===SC.ALIGN_TOP){return 0}else{if(c===SC.ALIGN_MIDDLE||c===SC.ALIGN_CENTER){return 0-Math.round((a-b)/2)}else{return 0-(a-b)}}},minimumScrollOffset:function(b,a,c){if(b>a){return 0}if(c===SC.ALIGN_LEFT||c===SC.ALIGN_TOP){return 0}else{if(c===SC.ALIGN_MIDDLE||c===SC.ALIGN_CENTER){return 0-Math.round((a-b)/2)}else{return 0-(a-b)}}},maximumHorizontalScrollOffset:function(){var c=this.get("contentView");var b=c?c.get("frame").width:0,a=c?c.get("calculatedWidth"):0;if(a){b=c.calculatedWidth}b*=this._scale;var d=this.get("containerView").get("frame").width;if(!this.get("canScrollHorizontal")){b=Math.min(b,d)}return this.maximumScrollOffset(b,d,this.get("horizontalAlign"))}.property(),maximumVerticalScrollOffset:function(){var a=this.get("contentView"),c=(a&&a.get("frame"))?a.get("frame").height:0,b=a?a.get("calculatedHeight"):0;if(b){c=b}c*=this._scale;var d=this.get("containerView").get("frame").height;if(!this.get("canScrollVertical")){c=Math.min(c,d)}return this.maximumScrollOffset(c,d,this.get("verticalAlign"))}.property(),minimumHorizontalScrollOffset:function(){var c=this.get("contentView");var b=c?c.get("frame").width:0,a=c?c.get("calculatedWidth"):0;if(a){b=a}b*=this._scale;var d=this.get("containerView").get("frame").width;if(!this.get("canScrollHorizontal")){b=Math.min(b,d)}return this.minimumScrollOffset(b,d,this.get("horizontalAlign"))}.property(),minimumVerticalScrollOffset:function(){var a=this.get("contentView");var c=(a&&a.get("frame"))?a.get("frame").height:0,b=a?a.get("calculatedHeight"):0;if(b){c=a.calculatedHeight}c*=this._scale;var d=this.get("containerView").get("frame").height;if(!this.get("canScrollVertical")){c=Math.min(c,d)}return this.minimumScrollOffset(c,d,this.get("verticalAlign"))}.property(),verticalLineScroll:20,horizontalLineScroll:20,verticalPageScroll:function(){return this.get("frame").height}.property("frame"),horizontalPageScroll:function(){return this.get("frame").width}.property("frame"),hasHorizontalScroller:YES,horizontalScrollerView:SC.ScrollerView,horizontalTouchScrollerView:SC.TouchScrollerView,isHorizontalScrollerVisible:YES,canScrollHorizontal:function(){return !!(this.get("hasHorizontalScroller")&&this.get("horizontalScrollerView")&&this.get("isHorizontalScrollerVisible"))}.property("isHorizontalScrollerVisible").cacheable(),autohidesHorizontalScroller:YES,hasVerticalScroller:YES,verticalScrollerView:SC.ScrollerView,verticalTouchScrollerView:SC.TouchScrollerView,isVerticalScrollerVisible:YES,canScrollVertical:function(){return !!(this.get("hasVerticalScroller")&&this.get("verticalScrollerView")&&this.get("isVerticalScrollerVisible"))}.property("isVerticalScrollerVisible").cacheable(),autohidesVerticalScroller:YES,verticalScrollerBottom:0,verticalOverlay:function(){if(SC.platform.touch){return YES}return NO}.property().cacheable(),horizontalOverlay:function(){if(SC.platform.touch){return YES}return NO}.property().cacheable(),verticalScrollerLayout:null,horizontalScrollerLayout:null,containerView:SC.ContainerView.extend({}),scrollTo:function(a,b){if(b===undefined&&SC.typeOf(a)===SC.T_HASH){b=a.y;a=a.x}if(!SC.none(a)){this.set("horizontalScrollOffset",a)}if(!SC.none(b)){this.set("verticalScrollOffset",b)}return this},scrollBy:function(a,b){if(b===undefined&&SC.typeOf(a)===SC.T_HASH){b=a.y;a=a.x}a=(a)?this.get("horizontalScrollOffset")+a:null;b=(b)?this.get("verticalScrollOffset")+b:null;return this.scrollTo(a,b)},scrollToVisible:function(b){if(arguments.length===0){return arguments.callee.base.apply(this,arguments)}var c=this.get("contentView");if(!c){return NO}var a=b.get("frame");if(!a){return NO}a=c.convertFrameFromView(a,b.get("parentView"));return this.scrollToRect(a)},scrollToRect:function(b){var a=SC.cloneRect(this.get("containerView").get("frame"));a.x=this.get("horizontalScrollOffset");a.y=this.get("verticalScrollOffset");var d=a.x,c=a.y;a.y-=Math.max(0,SC.minY(a)-SC.minY(b));a.x-=Math.max(0,SC.minX(a)-SC.minX(b));a.y+=Math.max(0,SC.maxY(b)-SC.maxY(a));a.x+=Math.max(0,SC.maxX(b)-SC.maxX(a));if((d!==a.x)||(c!==a.y)){this.scrollTo(a.x,a.y);return YES}else{return NO}},scrollDownLine:function(a){if(a===undefined){a=1}return this.scrollBy(null,this.get("verticalLineScroll")*a)},scrollUpLine:function(a){if(a===undefined){a=1}return this.scrollBy(null,0-this.get("verticalLineScroll")*a)},scrollRightLine:function(a){if(a===undefined){a=1}return this.scrollTo(this.get("horizontalLineScroll")*a,null)},scrollLeftLine:function(a){if(a===undefined){a=1}return this.scrollTo(0-this.get("horizontalLineScroll")*a,null)},scrollDownPage:function(a){if(a===undefined){a=1}return this.scrollBy(null,this.get("verticalPageScroll")*a)},scrollUpPage:function(a){if(a===undefined){a=1}return this.scrollBy(null,0-(this.get("verticalPageScroll")*a))},scrollRightPage:function(a){if(a===undefined){a=1}return this.scrollBy(this.get("horizontalPageScroll")*a,null)},scrollLeftPage:function(a){if(a===undefined){a=1}return this.scrollBy(0-(this.get("horizontalPageScroll")*a),null)},tile:function(){var c=this.get("hasHorizontalScroller")?this.get("horizontalScrollerView"):null;var h=c&&this.get("isHorizontalScrollerVisible");var j=this.get("hasVerticalScroller")?this.get("verticalScrollerView"):null;var f=j&&this.get("isVerticalScrollerVisible");var e=this.get("containerView");var m={left:0,top:0};var l,g,b,n,d,a;var i=((h)?c.get("scrollbarThickness"):0);var k=(f)?j.get("scrollbarThickness"):0;if(h){a=this.get("horizontalScrollerLayout");g={left:(a?a.left:0),bottom:(a?a.bottom:0),right:(a?a.right+k-1:k-1),height:i};c.set("layout",g);n=this.get("horizontalOverlay");m.bottom=n?0:(g.bottom+i)}else{m.bottom=0}if(c){c.set("isVisible",h)}if(f){i=i+this.get("verticalScrollerBottom");d=this.get("verticalScrollerLayout");g={top:(d?d.top:0),bottom:(d?d.bottom+i:i),right:(d?d.right:0),width:k};j.set("layout",g);b=this.get("verticalOverlay");m.right=b?0:(g.right+k)}else{m.right=0}if(j){j.set("isVisible",f)}e.adjust(m)},scrollerVisibilityDidChange:function(){this.tile()}.observes("isVerticalScrollerVisible","isHorizontalScrollerVisible"),_scroll_wheelDeltaX:0,_scroll_wheelDeltaY:0,mouseWheel:function(a){var c=this.get("horizontalScrollOffset"),f=this.get("maximumHorizontalScrollOffset"),e=this.get("maximumVerticalScrollOffset"),b=NO,d=this.get("verticalScrollOffset");b=((this.get("canScrollHorizontal")&&(a.wheelDeltaX<0&&c>0)||(a.wheelDeltaX>0&&c<f))||(this.get("canScrollVertical")&&(a.wheelDeltaY<0&&d>0)||(a.wheelDeltaY>0&&d<e)));if(b){this._scroll_wheelDeltaX+=a.wheelDeltaX;this._scroll_wheelDeltaY+=a.wheelDeltaY;this.invokeLater(this._scroll_mouseWheel,10)}return b},_scroll_mouseWheel:function(){this.scrollBy(this._scroll_wheelDeltaX,this._scroll_wheelDeltaY);if(SC.WHEEL_MOMENTUM&&this._scroll_wheelDeltaY>0){this._scroll_wheelDeltaY=Math.floor(this._scroll_wheelDeltaY*0.95);this._scroll_wheelDeltaY=Math.max(this._scroll_wheelDeltaY,0);this.invokeLater(this._scroll_mouseWheel,10)}else{if(SC.WHEEL_MOMENTUM&&this._scroll_wheelDeltaY<0){this._scroll_wheelDeltaY=Math.ceil(this._scroll_wheelDeltaY*0.95);this._scroll_wheelDeltaY=Math.min(this._scroll_wheelDeltaY,0);this.invokeLater(this._scroll_mouseWheel,10)}else{this._scroll_wheelDeltaY=0;this._scroll_wheelDeltaX=0}}},canScale:NO,_scale:1,scale:function(a,b){if(b!==undefined){this._scale=Math.min(Math.max(this.get("minimumScale"),b),this.get("maximumScale"))}return this._scale}.property().cacheable(),minimumScale:0.25,maximumScale:2,autoScaleRange:NO,_scale_css:"",updateScale:function(b){var a=this.get("contentView");if(!a){return}if(a.isScalable){this.get("contentView").applyScale(b);this._scale_css=""}else{this._scale_css="scale3d("+b+", "+b+", 1)"}},acceptsMultitouch:YES,decelerationRate:SC.NORMAL_SCROLL_DECELERATION,alwaysBounceHorizontal:NO,alwaysBounceVertical:YES,delaysContentTouches:YES,_touchScrollDidChange:function(){if(this.get("contentView").touchScrollDidChange){this.get("contentView").touchScrollDidChange(this._scroll_horizontalScrollOffset,this._scroll_verticalScrollOffset)}if(this.verticalScrollerView&&this.verticalScrollerView.touchScrollDidChange){this.verticalScrollerView.touchScrollDidChange(this._scroll_verticalScrollOffset)}if(this.horizontalScrollerView&&this.horizontalScrollerView.touchScrollDidChange){this.horizontalScrollerView.touchScrollDidChange(this._scroll_horizontalScrollOffset)}},_touchScrollDidStart:function(){if(this.get("contentView").touchScrollDidStart){this.get("contentView").touchScrollDidStart(this._scroll_horizontalScrollOffset,this._scroll_verticalScrollOffset)}if(this.verticalScrollerView&&this.verticalScrollerView.touchScrollDidStart){this.verticalScrollerView.touchScrollDidStart(this._touch_verticalScrollOffset)}if(this.horizontalScrollerView&&this.horizontalScrollerView.touchScrollDidStart){this.horizontalScrollerView.touchScrollDidStart(this._touch_horizontalScrollOffset)}},_touchScrollDidEnd:function(){if(this.get("contentView").touchScrollDidEnd){this.get("contentView").touchScrollDidEnd(this._scroll_horizontalScrollOffset,this._scroll_verticalScrollOffset)}if(this.verticalScrollerView&&this.verticalScrollerView.touchScrollDidEnd){this.verticalScrollerView.touchScrollDidEnd(this._touch_verticalScrollOffset)}if(this.horizontalScrollerView&&this.horizontalScrollerView.touchScrollDidEnd){this.horizontalScrollerView.touchScrollDidEnd(this._touch_horizontalScrollOffset)}},_applyCSSTransforms:function(b){var a="";this.updateScale(this._scale);a+="translate3d("+-this._scroll_horizontalScrollOffset+"px, "+-Math.round(this._scroll_verticalScrollOffset)+"px,0) ";a+=this._scale_css;if(b){var c=b.style;c.webkitTransform=a;c.webkitTransformOrigin="top left"}},captureTouch:function(a){return YES},touchGeneration:0,touchStart:function(b){var a=++this.touchGeneration;if(!this.tracking&&this.get("delaysContentTouches")){this.invokeLater(this.beginTouchesInContent,150,a)}else{if(!this.tracking){this.invokeLater(this.beginTouchesInContent,1,a)}}this.beginTouchTracking(b,YES);return YES},beginTouchesInContent:function(b){if(b!==this.touchGeneration){return}var c=this.touch,a;if(c&&this.tracking&&!this.dragging&&!c.touch.scrollHasEnded&&!c.touch.hasEnded){c.touch.captureTouch(this,YES);if(!c.touch.touchResponder){c.touch.makeTouchResponder(this)}else{if(c.needsScrollEnd){this._touchScrollDidEnd()}}}},beginTouchTracking:function(f,q){var p=f.averagedTouchesForView(this,q);var j=this._scroll_verticalScrollOffset||0,a=this._scroll_horizontalScrollOffset||0,l=a,k=j,e=NO,o=0,r=0,n,i;if(this.touch&&this.touch.timeout){clearTimeout(this.touch.timeout);this.touch.timeout=null;l=this.touch.startClipOffset.x;k=this.touch.startClipOffset.y;e=YES}i=this.get("contentView");if(i){n=i.get("frame");o=n.width;r=n.height}if(i.calculatedWidth&&i.calculatedWidth!==0){o=i.calculatedWidth}if(i.calculatedHeight&&i.calculatedHeight!==0){r=i.calculatedHeight}var g=this.get("containerView").get("frame"),h=g.width,m=g.height;var b=this.convertFrameToView(this.get("frame"),null),d=(a+(p.x-b.x))/this._scale,c=(j+(p.y-b.y))/this._scale;this.touch={startTime:f.timeStamp,notCalculated:YES,enableScrolling:{x:o*this._scale>h||this.get("alwaysBounceHorizontal"),y:r*this._scale>m||this.get("alwaysBounceVertical")},scrolling:{x:NO,y:NO},enableBouncing:SC.platform.bounceOnScroll,startClipOffset:{x:l,y:k},lastScrollOffset:{x:a,y:j},startTouchOffset:{x:p.x,y:p.y},scrollVelocity:{x:0,y:0},startTouchOffsetInContent:{x:d,y:c},containerSize:{width:h,height:m},contentSize:{width:o,height:r},startScale:this._scale,startDistance:p.d,canScale:this.get("canScale")&&SC.platform.pinchToZoom,minimumScale:this.get("minimumScale"),maximumScale:this.get("maximumScale"),globalFrame:b,layer:i.get("layer"),resistanceCoefficient:0.998,resistanceAsymptote:320,decelerationFromEdge:0.05,accelerationToEdge:0.1,scrollTolerance:{x:15,y:15},scaleTolerance:5,secondaryScrollTolerance:30,scrollLock:500,decelerationRate:this.get("decelerationRate"),lastEventTime:f.timeStamp,touch:(q?f:(this.touch?this.touch.touch:null)),needsScrollEnd:e};if(!this.tracking){this.tracking=YES;this.dragging=NO}},_adjustForEdgeResistance:function(f,d,b,c,a){var e;if(f<d){e=f-d}else{if(f>b){e=b-f}else{return f}}e=Math.pow(c,Math.abs(e))*a;if(f<d){e=e-a}else{e=-e+a}return Math.min(Math.max(d,f),b)+e},touchesDragged:function(a,c){var b=a.averagedTouchesForView(this);this.updateTouchScroll(b.x,b.y,b.d,a.timeStamp)},updateTouchScroll:function(k,j,e,h){var g=this.touch,a=k-g.globalFrame.x,m=j-g.globalFrame.y,v,n,w,o,C,A,c=g.scrolling,r=this.get("horizontalAlign"),l=this.get("verticalAlign");var d=((this._scroll_horizontalScrollOffset||0)+a)/this._scale,b=((this._scroll_verticalScrollOffset||0)+m)/this._scale;var z=d-g.startTouchOffsetInContent.x,y=b-g.startTouchOffsetInContent.y;var i=g.dragging;if(!c.x&&Math.abs(z)>g.scrollTolerance.x&&g.enableScrolling.x){i=YES;c.x=YES;g.scrollTolerance.y=g.secondaryScrollTolerance;g.startTouchOffset.x=k;z=0}if(!c.y&&Math.abs(y)>g.scrollTolerance.y&&g.enableScrolling.y){i=YES;c.y=YES;g.scrollTolerance.x=g.secondaryScrollTolerance;g.startTouchOffset.y=j;y=0}if(i&&!g.dragging){g.dragging=YES;this.dragging=YES;this._touchScrollDidStart()}if(!c.x&&!c.y&&!g.canScale){return}if(c.x&&!c.y){if(z>g.scrollLock&&!c.y){g.enableScrolling.y=NO}}if(c.y&&!c.x){if(y>g.scrollLock&&!c.x){g.enableScrolling.x=NO}}if(g.canScale){var q=g.startDistance,x=e-q;if(Math.abs(x)>g.scaleTolerance){c.y=YES;c.x=YES;var B=g.startScale*(e/Math.max(q,50));var s=this._adjustForEdgeResistance(B,g.minimumScale,g.maximumScale,g.resistanceCoefficient,g.resistanceAsymptote);this.dragging=YES;this._scale=s;var u=d*this._scale,t=b*this._scale}}C=this.minimumScrollOffset(g.contentSize.width*this._scale,g.containerSize.width,r);A=this.minimumScrollOffset(g.contentSize.height*this._scale,g.containerSize.height,l);o=this.maximumScrollOffset(g.contentSize.width*this._scale,g.containerSize.width,r);n=this.maximumScrollOffset(g.contentSize.height*this._scale,g.containerSize.height,l);w=g.startTouchOffsetInContent.x*this._scale-a;v=g.startTouchOffsetInContent.y*this._scale-m;if(g.enableBouncing){w=this._adjustForEdgeResistance(w,C,o,g.resistanceCoefficient,g.resistanceAsymptote);v=this._adjustForEdgeResistance(v,A,n,g.resistanceCoefficient,g.resistanceAsymptote)}else{w=Math.max(C,Math.min(o,w));v=Math.max(A,Math.min(n,v))}if(c.x){this._scroll_horizontalScrollOffset=w}if(c.y){this._scroll_verticalScrollOffset=v}this._applyCSSTransforms(g.layer);this._touchScrollDidChange();if(h-g.lastEventTime>=1||g.notCalculated){g.notCalculated=NO;var f=this._scroll_horizontalScrollOffset;var p=this._scroll_verticalScrollOffset;g.scrollVelocity.x=((f-g.lastScrollOffset.x)/Math.max(1,h-g.lastEventTime));g.scrollVelocity.y=((p-g.lastScrollOffset.y)/Math.max(1,h-g.lastEventTime));g.lastScrollOffset.x=f;g.lastScrollOffset.y=p;g.lastEventTime=h}},touchEnd:function(c){var a=this.touch,b=c.averagedTouchesForView(this);c.scrollHasEnded=YES;if(b.touchCount>0){this.beginTouchTracking(c,NO)}else{if(this.dragging){a.dragging=NO;a.lastEventTime=c.timeStamp;this.startDecelerationAnimation()}else{if(a.needsScrollEnd){this._touchScrollDidEnd()}c.captureTouch(this,YES);if(c.touchResponder&&c.touchResponder!==this){c.end()}else{if(!c.touchResponder||c.touchResponder===this){if(c.nextTouchResponder){c.makeTouchResponder(c.nextTouchResponder)}}else{}}this.touch=null}this.tracking=NO;this.dragging=NO}},touchCancelled:function(c){var a=this.touch,b=c.averagedTouchesForView(this);if(!this.touch||!this.touch.timeout){this.beginPropertyChanges();this.set("scale",this._scale);this.set("verticalScrollOffset",this._scroll_verticalScrollOffset);this.set("horizontalScrollOffset",this._scroll_horizontalScrollOffset);this.endPropertyChanges();this.tracking=NO;if(this.dragging){this._touchScrollDidEnd()}this.dragging=NO;this.touch=null}},startDecelerationAnimation:function(a){var b=this.touch;b.decelerationVelocity={x:b.scrollVelocity.x*10,y:b.scrollVelocity.y*10};this.decelerateAnimation()},bouncyBounce:function(c,e,d,f,g,b,a){if(e<d){if(c<0){c=c+((d-e)*g)}else{c=Math.min((d-e)*b+a,d-e-0.01)}}else{if(e>f){if(c>0){c=c-((e-f)*g)}else{c=-Math.min((e-f)*b+a,e-f-0.01)}}}return c},decelerateAnimation:function(){var c=this.touch,y=this._scale,n=c.contentSize,o=c.containerSize,m=this.get("horizontalAlign"),e=this.get("verticalAlign"),x=this.minimumScrollOffset(n.width*this._scale,o.width,m),w=this.minimumScrollOffset(n.height*this._scale,o.height,e),i=this.maximumScrollOffset(n.width*this._scale,o.width,m),h=this.maximumScrollOffset(n.height*this._scale,o.height,e),a=Date.now(),f=Math.max(a-c.lastEventTime,1),s=this._scroll_horizontalScrollOffset+c.decelerationVelocity.x*(f/10),q=this._scroll_verticalScrollOffset+c.decelerationVelocity.y*(f/10);var r=c.decelerationFromEdge,u=c.accelerationToEdge;var l=!c.enableBouncing,k=!c.enableBouncing;if(s>=x&&s<=i){l=YES}if(q>=w&&q<=h){k=YES}s/=this._scale;q/=this._scale;var j=0;j=this.bouncyBounce(j,y,c.minimumScale,c.maximumScale,r,u,0);this._scale=y=y+j;s*=this._scale;q*=this._scale;x=this.minimumScrollOffset(n.width*this._scale,o.width,m);w=this.minimumScrollOffset(n.height*this._scale,o.height,e);i=this.maximumScrollOffset(n.width*this._scale,o.width,m);h=this.maximumScrollOffset(n.height*this._scale,o.height,e);if(l&&(s<x||s>i)){s=Math.max(x,Math.min(s,i));c.decelerationVelocity.x=0}if(k&&(q<w||q>h)){q=Math.max(w,Math.min(q,h));c.decelerationVelocity.y=0}this._scroll_horizontalScrollOffset=s;this._scroll_verticalScrollOffset=q;this._applyCSSTransforms(c.layer);this._touchScrollDidChange();var v=c.decelerationRate,b=Math.pow(v,(f/10));c.decelerationVelocity.y*=b;c.decelerationVelocity.x*=b;c.decelerationVelocity.x=this.bouncyBounce(c.decelerationVelocity.x,s,x,i,r,u,0.3);c.decelerationVelocity.y=this.bouncyBounce(c.decelerationVelocity.y,q,w,h,r,u,0.3);var p=Math.abs(c.decelerationVelocity.x),d=Math.abs(c.decelerationVelocity.y);if(d<0.05&&p<0.05&&Math.abs(j)<0.05){c.timeout=null;this.touch=null;this._touchScrollDidEnd();this.beginPropertyChanges();this.set("scale",this._scale);this.set("verticalScrollOffset",this._scroll_verticalScrollOffset);this.set("horizontalScrollOffset",this._scroll_horizontalScrollOffset);this.endPropertyChanges();return}var g=this;c.lastEventTime=Date.now();this.touch.timeout=setTimeout(function(){SC.run(g.decelerateAnimation(),g)},30)},createChildViews:function(){var b=[],a;if(SC.none(a=this.containerView)){a=SC.ContainerView}b.push(this.containerView=this.createChildView(a,{contentView:this.contentView,isScrollContainer:YES}));this.contentView=this.containerView.get("contentView");a=SC.platform.touch?this.get("horizontalTouchScrollerView"):this.get("horizontalScrollerView");if(a){if(this.get("hasHorizontalScroller")){a=this.horizontalScrollerView=this.createChildView(a,{layoutDirection:SC.LAYOUT_HORIZONTAL,valueBinding:"*owner.horizontalScrollOffset"});b.push(a)}else{this.horizontalScrollerView=null}}a=SC.platform.touch?this.get("verticalTouchScrollerView"):this.get("verticalScrollerView");if(a){if(this.get("hasVerticalScroller")){a=this.verticalScrollerView=this.createChildView(a,{layoutDirection:SC.LAYOUT_VERTICAL,valueBinding:"*owner.verticalScrollOffset"});b.push(a)}else{this.verticalScrollerView=null}}this.childViews=b;this.contentViewDidChange();this.tile()},init:function(){arguments.callee.base.apply(this,arguments);this._scroll_contentView=this.get("contentView");var a=this._scroll_contentView;if(a){a.addObserver("frame",this,this.contentViewFrameDidChange);a.addObserver("calculatedWidth",this,this.contentViewFrameDidChange);a.addObserver("calculatedHeight",this,this.contentViewFrameDidChange)}if(this.get("isVisibleInWindow")){this._scsv_registerAutoscroll()}},_scsv_registerAutoscroll:function(){if(this.get("isVisibleInWindow")){SC.Drag.addScrollableView(this)}else{SC.Drag.removeScrollableView(this)}}.observes("isVisibleInWindow"),contentViewDidChange:function(){var d=this.get("contentView"),a=this._scroll_contentView,b=this.contentViewFrameDidChange,c=this.contentViewLayerDidChange;if(d!==a){if(a){a.removeObserver("calculatedWidth",this,this.contentViewFrameDidChange);a.removeObserver("calculatedHeight",this,this.contentViewFrameDidChange);a.removeObserver("frame",this,b);a.removeObserver("layer",this,c)}this._scroll_contentView=d;if(d){d.addObserver("frame",this,b);d.addObserver("calculatedWidth",this,this.contentViewFrameDidChange);d.addObserver("calculatedHeight",this,this.contentViewFrameDidChange);d.addObserver("layer",this,c)}this.containerView.set("contentView",d);this.contentViewFrameDidChange()}}.observes("contentView"),render:function(a,b){this.invokeLast(this.adjustElementScroll);if(b){a.push('<div class="corner"></div>')}return arguments.callee.base.apply(this,arguments)},oldMaxHOffset:0,oldMaxVOffset:0,contentViewFrameDidChange:function(b){var o=this.get("contentView"),l=(o)?o.get("frame"):null,h=this._scale,c=0,q=0,j,i,m,r,n;if(!o||!l){return}c=o.get("calculatedWidth")||l.width||0;q=o.get("calculatedHeight")||l.height||0;c*=h;q*=h;if(!b&&(c===this._scroll_contentWidth)&&(q===this._scroll_contentHeight)){return}this._scroll_contentWidth=c;this._scroll_contentHeight=q;j=this.getPath("containerView.frame");i=j.width;m=j.height;if(this.get("hasHorizontalScroller")&&(o=this.get("horizontalScrollerView"))){if(this.get("autohidesHorizontalScroller")){this.set("isHorizontalScrollerVisible",c>i)}o.setIfChanged("maximum",c-i);o.setIfChanged("proportion",i/c)}if(this.get("hasVerticalScroller")&&(o=this.get("verticalScrollerView"))){if(this.get("autohidesVerticalScroller")){this.set("isVerticalScrollerVisible",q>m)}o.setIfChanged("maximum",q-m);o.setIfChanged("proportion",m/q)}if(!this.get("isVerticalScrollerVisible")&&(this.get("verticalScrollOffset")!==0)&&this.get("autohidesVerticalScroller")){this.set("verticalScrollOffset",0)}if(!this.get("isHorizontalScrollerVisible")&&(this.get("horizontalScrollOffset")!==0)&&this.get("autohidesHorizontalScroller")){this.set("horizontalScrollOffset",0)}var p=this.get("maximumVerticalScrollOffset"),k=this.get("verticalScrollOffset"),g=this.get("maximumHorizontalScrollOffset"),a=this.get("horizontalScrollOffset"),e=p<k,d=g<a;if(e||d){this.forceDimensionsRecalculation(d,e,k,a)}this.notifyPropertyChange("maximumVerticalScrollOffset");this.notifyPropertyChange("maximumHorizontalScrollOffset")},frameDidChange:function(){this.contentViewFrameDidChange(YES)}.observes("frame"),contentViewLayerDidChange:function(){if(this._verticalScrollOffset!==0){this._verticalScrollOffset=-1}if(this._horizontalScrollOffset!==0){this._horizontalScrollOffset=-1}this.invokeLast(this.adjustElementScroll)},_scroll_horizontalScrollOffsetDidChange:function(){this.invokeLast(this.adjustElementScroll)}.observes("horizontalScrollOffset"),_scroll_verticalScrollOffsetDidChange:function(){this.invokeLast(this.adjustElementScroll)}.observes("verticalScrollOffset"),adjustElementScroll:function(){var a=this.get("containerView"),d=this.get("contentView"),c=this.get("verticalScrollOffset"),b=this.get("horizontalScrollOffset");if(d){if(SC.platform.touch){this._applyCSSTransforms(d.get("layer"))}if(d._viewFrameDidChange){d._viewFrameDidChange()}}if(a&&!SC.platform.touch){a=a.$()[0];if(a){if(c!==this._verticalScrollOffset){a.scrollTop=c;this._verticalScrollOffset=c}if(b!==this._horizontalScrollOffset){a.scrollLeft=b;this._horizontalScrollOffset=b}}}},forceDimensionsRecalculation:function(b,c,e,a){var f=a;var d=e;this.scrollTo(0,0);if(b&&c){this.scrollTo(this.get("maximumHorizontalScrollOffset"),this.get("maximumVerticalScrollOffset"))}if(b&&!c){this.scrollTo(this.get("maximumHorizontalScrollOffset"),d)}if(!b&&c){this.scrollTo(f,this.get("maximumVerticalScrollOffset"))}},_scroll_verticalScrollOffset:0,_scroll_horizontalScrollOffset:0});sc_require("views/scroll");SC.MenuScrollerView=SC.ScrollerView.extend({classNames:["sc-menu-scroller-view"],scrollDown:NO,value:function(a,c){if(c!==undefined){this._value=c}else{var b=this._value||0;return Math.min(b,this.get("maximum"))}}.property("maximum").cacheable(),maximum:0,isEnabled:YES,layoutDirection:SC.LAYOUT_VERTICAL,verticalLineScroll:20,ownerScrollValueKey:function(){return"verticalScrollOffset"}.property("layoutDirection").cacheable(),init:function(){switch(this.get("controlSize")){case SC.TINY_CONTROL_SIZE:this.set("scrollerThickness",SC.MenuScrollerView.TINY_SCROLLER_THICKNESS);break;case SC.SMALL_CONTROL_SIZE:this.set("scrollerThickness",SC.MenuScrollerView.SMALL_SCROLLER_THICKNESS);break;case SC.REGULAR_CONTROL_SIZE:this.set("scrollerThickness",SC.MenuScrollerView.REGULAR_SCROLLER_THICKNESS);break;case SC.LARGE_CONTROL_SIZE:this.set("scrollerThickness",SC.MenuScrollerView.LARGE_SCROLLER_THICKNESS);break;case SC.HUGE_CONTROL_SIZE:this.set("scrollerThickness",SC.MenuScrollerView.HUGE_SCROLLER_THICKNESS);break}return arguments.callee.base.apply(this,arguments)},render:function(a,c){a.addClass("sc-vertical");a.addClass(this.get("controlSize"));if(c){var b=this.get("scrollDown")?"arrowDown":"arrowUp";a.push('<span class="scrollArrow '+b+'">&nbsp;</span>')}a.setClass("disabled",!this.get("isEnabled"))},didCreateLayer:function(){},willDestroyLayer:function(){var a=this._sc_scroller_scrollDidChange;SC.Event.remove(this.$(),"scroll",this,a)},mouseEntered:function(a){this.set("isMouseOver",YES);this._invokeScrollOnMouseOver()},mouseExited:function(a){this.set("isMouseOver",NO)},_sc_scroller_valueDidChange:function(){}.observes("value"),_sc_scroller_armScrollTimer:function(){if(!this._sc_scrollTimer){SC.RunLoop.begin();var a=this._sc_scroller_scrollDidChange;this._sc_scrollTimer=this.invokeLater(a,50);SC.RunLoop.end()}},_sc_scroller_scrollDidChange:function(){var b=Date.now(),d=this._sc_lastScroll,c=this.get("layer"),a=0;if(d&&(b-d)<50){return this._sc_scroller_armScrollTimer()}this._sc_scrollTimer=null;this._sc_lastScroll=b;SC.RunLoop.begin();if(!this.get("isEnabled")){return}this._sc_scrollValue=a=c.scrollTop;this.set("value",a);SC.RunLoop.end()},_scrollMenu:function(){var b=this.get("value"),a;if(this.get("scrollDown")){a=b+this.verticalLineScroll;if(a<=this.get("maximum")){this.set("value",a)}}else{a=b-this.verticalLineScroll;if(a>=0){this.set("value",a)}else{if(b<=this.verticalLineScroll&&b>0){this.set("value",0)}}}return YES},_invokeScrollOnMouseOver:function(){this._scrollMenu();if(this.get("isMouseOver")){this.invokeLater(this._invokeScrollOnMouseOver,50)}}});SC.MenuScrollerView.REGULAR_SCROLLER_THICKNESS=18;SC.MenuScrollerView.TINY_SCROLLER_THICKNESS=10;SC.MenuScrollerView.SMALL_SCROLLER_THICKNESS=14;SC.MenuScrollerView.LARGE_SCROLLER_THICKNESS=23;SC.MenuScrollerView.HUGE_SCROLLER_THICKNESS=26;SC.MenuScrollView=SC.ScrollView.extend({classNames:["sc-menu-scroll-view"],maximumHorizontalScrollOffset:0,hasHorizontalScroller:NO,horizontalScrollerView:SC.MenuScrollerView,isHorizontalScrollerVisible:NO,canScrollHorizontal:NO,autohidesHorizontalScroller:NO,hasVerticalScroller:YES,verticalScrollerView:SC.MenuScrollerView,verticalScrollerView2:SC.MenuScrollerView,isVerticalScrollerVisible:YES,canScrollVertical:YES,autohidesVerticalScroller:YES,verticalScrollerBottom:0,controlSize:SC.REGULAR_CONTROL_SIZE,containerView:SC.ContainerView,scrollToVisible:function(b){if(arguments.length===0){return arguments.callee.base.apply(this,arguments)}var e=this.get("contentView");if(!e){return NO}var a=b.get("frame");if(!a){return NO}a=e.convertFrameFromView(a,b.get("parentView"));var c=this.get("verticalScrollerView2");if(c&&c.get("isVisible")){a.height+=c.get("frame").height}var d=this.get("verticalScrollerView");if(d&&d.get("isVisible")){a.top-=d.get("frame").height}return this.scrollToRect(a)},tile:function(){var g,s,h,b,q,i,c;g=this.get("hasVerticalScroller");s=g?this.get("verticalScrollerView"):null;h=g?this.get("verticalScrollerView2"):null;b=s&&this.get("isVerticalScrollerVisible");q=this.get("containerView");i={left:0,top:0};if(b){c=0;var a=s.get("scrollerThickness")||h.get("scrollerThickness");var j=this.get("contentView"),o,p=(j)?j.get("frame"):null,k=(p)?p.height:0,r=this.containerView.$()[0],l=this.get("verticalScrollOffset"),e={height:0,top:0,right:0,left:0},n={height:a,top:0,right:0,left:0},d={height:a,bottom:0,right:0,left:0},m={height:0,bottom:0,right:0,left:0};if(r){c=r.offsetHeight}if(l===0){i.top=0;i.bottom=a;s.set("layout",e);h.set("layout",d)}else{if(l>=(k-c-a)){i.top=a;i.bottom=0;s.set("layout",n);h.set("layout",m)}else{i.top=a;i.bottom=a;s.set("layout",n);h.set("layout",d)}}}if(s){s.set("isVisible",b);h.set("isVisible",b)}q.set("layout",i)},scrollerVisibilityDidChange:function(){this.tile()}.observes("isVerticalScrollerVisible","isHorizontalScrollerVisible","verticalScrollOffset"),createChildViews:function(){var c=[],b,a,d=this.get("controlSize");if(SC.none(b=this.containerView)){b=SC.ContainerView}c.push(this.containerView=this.createChildView(b,{contentView:this.contentView}));this.contentView=this.containerView.get("contentView");if((b=this.verticalScrollerView)&&(a=this.verticalScrollerView2)){if(this.get("hasVerticalScroller")){b=this.verticalScrollerView=this.createChildView(b,{layout:{top:0,left:0,right:0},controlSize:d,valueBinding:"*owner.verticalScrollOffset"});c.push(b);a=this.verticalScrollerView2=this.createChildView(a,{scrollDown:YES,layout:{bottom:0,left:0,right:0},controlSize:d,valueBinding:"*owner.verticalScrollOffset"});c.push(a)}else{this.verticalScrollerView=null;this.verticalScrollerView2=null}}this.childViews=c;this.contentViewFrameDidChange();this.tile()},init:function(){arguments.callee.base.apply(this,arguments);this._scroll_contentView=this.get("contentView");var a=this._scroll_contentView;if(a){a.addObserver("frame",this,this.contentViewFrameDidChange)}if(this.get("isVisibleInWindow")){this._scsv_registerAutoscroll()}},_scsv_registerAutoscroll:function(){if(this.get("isVisibleInWindow")){SC.Drag.addScrollableView(this)}else{SC.Drag.removeScrollableView(this)}}.observes("isVisibleInWindow"),contentViewFrameDidChange:function(){var c=this.get("contentView"),b,h=(c)?c.get("frame"):null,e=(h)?h.width:0,a=(h)?h.height:0,i=this.get("frame"),d,g;this._scroll_contentWidth=e;this._scroll_contentHeight=a;if(this.get("hasVerticalScroller")&&(c=this.get("verticalScrollerView"))&&(b=this.get("verticalScrollerView2"))){a-=1;if(this.get("autohidesVerticalScroller")){this.set("isVerticalScrollerVisible",a>i.height)}a-=this.get("verticalScrollerBottom");d=0;g=this.containerView.$()[0];if(g){d=g.offsetHeight}a=a-d;c.setIfChanged("maximum",a);b.setIfChanged("maximum",a)}},_scroll_horizontalScrollOffsetDidChange:function(){},_scroll_verticalScrollOffsetDidChange:function(){var b=this.get("verticalScrollOffset");var a=this.get("contentView");if(a){a.$().css("top",(0-b)+"px")}}.observes("verticalScrollOffset")});sc_require("views/workspace");SC.TO_LEFT="TOLEFT";SC.TO_RIGHT="TORIGHT";SC.NavigationView=SC.WorkspaceView.extend({_views:null,_current:null,navigationContentView:SC.View,init:function(){arguments.callee.base.apply(this,arguments);this._views=[]},createChildViews:function(){arguments.callee.base.apply(this,arguments);var a=this.get("navigationContentView");if(a.isClass){a=this.createChildView(a)}this._defaultContent=this.navigationContentView=a;this.contentView.appendChild(a)},changeNavigationContent:function(a){var c=null,b=null;if(a){c=a.get("topToolbar");b=a.get("bottomToolbar")}if(c&&c.isClass){a.set("topToolbar",c=c.create())}if(b&&b.isClass){a.set("bottomToolbar",b=b.create())}this.beginPropertyChanges();this._current=a;this.set("navigationContentView",a?a:this._defaultContent);this.set("topToolbar",c);this.set("bottomToolbar",b);this.endPropertyChanges()},push:function(a){this._currentDirection=this._current?SC.TO_LEFT:null;if(this._current){this._views.push(this._current)}this.changeNavigationContent(a)},pop:function(){this._currentDirection=SC.TO_RIGHT;var a=this._views.pop();this.changeNavigationContent(a)},popToView:function(b){this._currentDirection=SC.TO_RIGHT;var d=this._views,a=d.length-1,c=d[a];while(c&&c!==b){this._views.pop();a--;c=d[a]}this.changeNavigationContent(c)},topToolbarDidChange:function(){var b=this.activeTopToolbar,a=this.get("topToolbar");if(b){if(this._currentDirection!==null){b.set("buildDirection",this._currentDirection);this.buildOutChild(b)}else{this.removeChild(b)}}if(a){if(this._currentDirection!==null){a.set("buildDirection",this._currentDirection);this.buildInChild(a)}else{this.appendChild(a)}}this.activeTopToolbar=a;this.invokeOnce("childDidChange")}.observes("topToolbar"),bottomToolbarDidChange:function(){var b=this.activeBottomToolbar,a=this.get("bottomToolbar");if(b){if(this._currentDirection!==null){b.set("buildDirection",this._currentDirection);this.buildOutChild(b)}else{this.removeChild(b)}}if(a){if(this._currentDirection!==null){a.set("buildDirection",this._currentDirection);this.buildInChild(a)}else{this.appendChild(a)}}this.activeBottomToolbar=a;this.invokeOnce("childDidChange")}.observes("topToolbar"),contentViewDidChange:function(){var b=this.activeNavigationContentView,a=this.get("navigationContentView");if(!a.isNavigationBuilder){a.mixin(SC.NavigationBuilder)}this._pendingBuildOut=b;this._pendingBuildIn=a;this.activeNavigationContentView=a;this.invokeOnce("childDidChange")}.observes("navigationContentView"),childDidChange:function(){var a=this._pendingBuildIn,b=this._pendingBuildOut;if(b){if(this._currentDirection!==null){b.set("buildDirection",this._currentDirection);this.contentView.buildOutChild(b)}else{this.contentView.removeChild(b)}}this._scws_tile();if(a){if(this._currentDirection!==null){a.set("buildDirection",this._currentDirection);this.contentView.buildInChild(a)}else{this.contentView.appendChild(a)}}}});sc_require("views/toolbar");SC.NavigationBarView=SC.ToolbarView.extend(SC.Gesturable,{init:function(){arguments.callee.base.apply(this,arguments);if(!SC.Animatable){SC.Logger.error("NavigationBarView requires SC.Animatable. Please make your app or framework require the animation framework. CRASH.")}},mixinAnimatable:function(){this.mixin(SC.Animatable);this.transitions=this.navigationTransitions},navigationTransitions:{opacity:{duration:0.25,action:"didFinishTransition"}},style:{opacity:1},gestures:["swipeGesture"],swipeGesture:SC.SwipeGesture,swipe:function(d,h,f){var e=(f===SC.SWIPE_LEFT)?"isSwipeLeft":"isSwipeRight",c=this.get("childViews"),g,b,a=c.get("length");for(b=0;b<a;b++){g=c[b];if(g.get(e)){h.makeTouchResponder(g);h.end();return}}},resetBuild:function(){if(!this.isAnimatable){this.mixinAnimatable()}},didFinishTransition:function(){if(this.isBuildingIn){this.buildInDidFinish()}else{if(this.isBuildingOut){this.buildOutDidFinish()}}},preBuildIn:function(){this.disableAnimation();this.adjust("opacity",0).updateLayout();this.enableAnimation();var c=this.get("childViews"),d,b,a=c.get("length");for(b=0;b<a;b++){d=c[b];if(d.disableNavigationTransition){continue}if(!d._nv_mixedIn){this.mixinNavigationChild(d)}d.disableAnimation();d.transform(this.buildDirection===SC.TO_LEFT?100:-100);d.enableAnimation()}},buildIn:function(){this.preBuildIn();this.invokeLater("startBuildIn",10)},startBuildIn:function(){this.adjust("opacity",1);var c=this.get("childViews"),d,b,a=c.get("length");for(b=0;b<a;b++){d=c[b];if(d.disableNavigationTransition){continue}d.transform(0)}},buildOut:function(){this.adjust("opacity",0);var c=this.get("childViews"),d,b,a=c.get("length");for(b=0;b<a;b++){d=c[b];if(d.disableNavigationTransition){continue}if(!d._nv_mixedIn){this.mixinNavigationChild(d)}d.transform(this.buildDirection===SC.TO_LEFT?-100:100)}},mixinNavigationChild:function(a){if(a.isAnimatable){return}a.mixin(SC.Animatable);a.mixin({transitions:{transform:{timing:SC.Animatable.TRANSITION_EASE_IN_OUT,duration:0.25}},naturalLayout:a.get("layout"),transform:function(b){if(SC.platform.supportsCSS3DTransforms){this.adjust("transform","translate3d("+b+"px,0px,0px)")}else{this.adjust("transform","translate("+b+"px,0px)")}}});a._nv_mixedIn=YES}});sc_require("views/button");SC.PopupButtonView=SC.ButtonView.extend({classNames:["sc-popup-button"],renderDelegateName:"popupButtonRenderDelegate",preferMatrix:null,menu:null,shouldLoadInBackground:NO,init:function(){arguments.callee.base.apply(this,arguments);this._setupMenu();if(this.get("shouldLoadInBackground")){SC.backgroundTaskQueue.push(SC.PopupButtonMenuLoader.create({popupButton:this}))}},_setupMenu:function(){var a=this.get("instantiatedMenu");if(this.isActiveBinding){this.isActiveBinding.disconnect()}this.isActiveBinding=null;if(a&&!a.isClass){this.isActiveBinding=this.bind("isActive",a,"isVisibleInWindow")}},_popup_menuDidChange:function(){this._setupMenu()}.observes("menu"),isActive:NO,_instantiateMenu:function(){var a=this.get("menu");if(!a||!a.isClass){return}this.menu=a.create();this._setupMenu()},instantiatedMenu:function(){var a=this.get("menu");if(a&&a.isClass){this._instantiateMenu();a=this.get("menu")}return a}.property("menu").cacheable(),action:function(a){var b=this.get("instantiatedMenu");if(!b){return NO}b.popup(this,this.get("preferMatrix"));return YES},mouseDown:function(a){if(!this.get("isEnabled")){return YES}this._isMouseDown=YES;this._action();this._menuRenderedTimestamp=0;var b=this;setTimeout(function(){SC.run(function(){b._menuRenderedTimestamp=Date.now()})},1);this.becomeFirstResponder();return YES},mouseUp:function(b){var d=new Date().getTime(),c=this._menuRenderedTimestamp,e=this.get("instantiatedMenu"),f=SC.platform.touch,a;if(c===0){c=Date.now()}if(e){a=e.getPath("rootMenu.targetMenuItem");if(a){if(!a.performAction()){e.remove()}}else{if(!f&&(d-c>SC.ButtonView.CLICK_AND_HOLD_DELAY)){e.remove()}}}this._isMouseDown=NO;arguments.callee.base.apply(this,arguments);return YES},mouseExited:function(a){return YES},performKeyEquivalent:function(b,a){if(!this.get("isEnabled")){return NO}var c=this.get("instantiatedMenu");return(!!c&&c.performKeyEquivalent(b,a,YES))}});SC.PopupButtonMenuLoader=SC.Task.extend({popupButton:null,run:function(){if(this.popupButton){this.popupButton._instantiateMenu()}}});SC.ProgressView=SC.View.extend(SC.Control,{classNames:["sc-progress-view"],displayProperties:["displayValue","ariaValue","minimum","maximum","isEnabled","isIndeterminate","isRunning","isVisibleInWindow"],renderDelegateName:"progressRenderDelegate",value:0.5,valueBindingDefault:SC.Binding.single().notEmpty(),displayValue:function(){var b=this.get("minimum")||0,c=this.get("maximum")||1,a=this.get("value")||0;a=(a-b)/(c-b);if(a>1){a=1}if(isNaN(a)){a=0}if(a<b){a=0}if(a>c){a=1}return a}.property("value","maximum","minimum").cacheable(),ariaRole:"progressbar",ariaValue:function(){return this.get("value")}.property("value").cacheable(),minimum:0,minimumBindingDefault:SC.Binding.single().notEmpty(),contentMinimumKey:null,maximum:1,maximumBindingDefault:SC.Binding.single().notEmpty(),contentMaximumKey:null,isIndeterminate:NO,isIndeterminateBindingDefault:SC.Binding.bool(),isRunning:NO,isRunningBindingDefault:SC.Binding.bool(),contentIsIndeterminateKey:null,contentPropertyDidChange:function(c,a){var b=this.get("content");this.beginPropertyChanges().updatePropertyFromContent("value",a,"contentValueKey",b).updatePropertyFromContent("minimum",a,"contentMinimumKey",b).updatePropertyFromContent("maximum",a,"contentMaximumKey",b).updatePropertyFromContent("isIndeterminate",a,"contentIsIndeterminateKey",b).endPropertyChanges()},didCreateLayer:function(){if(this.get("isIndeterminate")&&this.get("isRunning")&&this.get("isVisibleInWindow")){this.displayDidChange()}}});SC.RadioView=SC.View.extend(SC.Control,{acceptsFirstResponder:function(){if(SC.FOCUS_ALL_CONTROLS){return this.get("isEnabled")}return NO}.property("isEnabled"),classNames:["sc-radio-view"],ariaRole:"radiogroup",displayProperties:["displayItems","isEnabled","layoutDirection"],renderDelegateName:"radioGroupRenderDelegate",itemAriaLabeledByKey:null,itemAriaLabelKey:null,value:null,layoutDirection:SC.LAYOUT_VERTICAL,escapeHTML:YES,items:[],itemTitleKey:null,itemWidthKey:null,itemValueKey:null,itemIsEnabledKey:null,itemIconKey:null,itemsDidChange:function(){if(this._items){this._items.removeObserver("[]",this,this.itemContentDidChange)}this._items=this.get("items");if(this._items){this._items.addObserver("[]",this,this.itemContentDidChange)}this.itemContentDidChange()}.observes("items"),itemContentDidChange:function(){this._renderAsFirstTime=YES;this.notifyPropertyChange("displayItems")},displayItems:function(){var k=this.get("items"),p=this.get("value"),h=SC.isArray(p),f=this.get("localize"),d=this.get("itemTitleKey"),e=this.get("itemValueKey"),o=this.get("itemWidthKey"),c=this.get("layoutDirection")===SC.LAYOUT_HORIZONTAL,j=this.get("itemIsEnabledKey"),w=this.get("itemIconKey"),g=this.get("itemAriaLabeledByKey"),y=this.get("itemAriaLabelKey"),v=this._displayItems||[],q=(k)?k.get("length"):0,t,x,l,m,i,u,s,n,b,a,r;for(i=0;i<q;i++){t=k.objectAt(i);if(SC.typeOf(t)===SC.T_ARRAY){x=t[0];m=t[1]}else{if(t){if(d){x=t.get?t.get(d):t[d]}else{x=(t.toString)?t.toString():null}if(o&&c){l=t.get?t.get(o):t[o]}if(e){m=t.get?t.get(e):t[e]}else{m=t}if(j){u=t.get?t.get(j):t[j]}else{u=YES}if(w){s=t.get?t.get(w):t[w]}else{s=null}if(g){a=t.get?t.get(g):t[g]}else{a=null}if(y){r=t.get?t.get(y):t[y]}else{r=null}}else{x=m=s=null;u=NO}}u=u&&this.get("isEnabled");if(t){n=(h)?(p.indexOf(m)>=0):(p===m)}else{n=NO}if(f){x=SC.String.loc(x)}v.push(SC.Object.create({title:x,icon:s,width:l,value:m,isEnabled:u,isSelected:(h&&p.indexOf(m)>=0&&p.length===1)||(p===m),isMixed:(h&&p.indexOf(m)>=0),isActive:this._activeRadioButton===i,theme:this.get("theme"),renderState:{}}))}return v}.property("isEnabled","value","items","itemTitleKey","itemWidthKey","itemValueKey","itemIsEnabledKey","localize","itemIconKey","itemAriaLabeledByKey","itemAriaLabelKey").cacheable(),mouseDown:function(a){if(!this.get("isEnabled")){return YES}var d=this.get("renderDelegate"),c=this.get("renderDelegateProxy"),f=this.$(),b=d.indexForEvent(c,f,a);this._activeRadioButton=b;if(b!==undefined){var e=this.get("displayItems")[b];if(e.get("isEnabled")){e.set("isActive",YES);d.updateRadioAtIndex(c,f,b)}}a.allowDefault();return YES},mouseUp:function(a){if(!this.get("isEnabled")){return YES}var d=this.get("renderDelegate"),c=this.get("renderDelegateProxy"),f=this.$(),g=this.get("displayItems"),b=d.indexForEvent(c,f,a);if(this._activeRadioButton!==undefined&&b!==this._activeRadioButton){g[this._activeRadioButton].set("isActive",NO);d.updateRadioAtIndex(c,f,this._activeRadioButton)}this._activeRadioButton=undefined;if(b!==undefined){var e=this.get("displayItems")[b];if(e.get("isEnabled")){e.set("isActive",NO);d.updateRadioAtIndex(c,f,b);this.set("value",e.value)}}a.allowDefault();return YES},keyDown:function(j){if(!this.get("isEnabled")){return YES}if(j.which===9||j.keyCode===9){var h=j.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");if(h){h.becomeFirstResponder()}else{j.allowDefault()}return YES}if(j.which>=37&&j.which<=40){var g=this.get("renderDelegate"),f=this.get("renderDelegateProxy"),c=this.$(),e=this.get("displayItems"),b=this.get("value");for(var d=0,a=e.length;d<a;d++){if(b===e[d].value){break}}if(j.which===37||j.which===38){if(d<=0){d=e.length-1}else{d--}}if(j.which===39||j.which===40){if(d>=e.length-1){d=0}else{d++}}g.updateRadioAtIndex(f,c,d);this.set("value",e[d].value)}j.allowDefault();return NO},touchStart:function(a){return this.mouseDown(a)},touchEnd:function(a){return this.mouseUp(a)}});SC.SceneView=SC.ContainerView.extend({scenes:["master","detail"],nowShowing:null,transitionDuration:200,_state:"NO_VIEW",replaceContent:function(a){if(a&&this._state===this.READY){this.animateScene(a)}else{this.replaceScene(a)}return this},replaceScene:function(c){var d=this._targetView,e=this.STANDARD_LAYOUT,b=this.get("scenes"),a=b?b.indexOf(this.get("nowShowing")):-1;this._targetView=c;this._targetIndex=a;if(this._timer){this._timer.invalidate()}this._leftView=this._rightView=this._start=this._end=null;this._timer=null;this.removeAllChildren();if(d){d.set("layout",e)}if(c){c.set("layout",e)}if(c){this.appendChild(c)}this._state=c?this.READY:this.NO_VIEW},animateScene:function(b){var c=this._targetView,f=this._targetIndex,a=this.get("scenes"),e=a?a.indexOf(this.get("nowShowing")):-1,d;if(f<0||e<0||f===e){return this.replaceScene(b)}this._targetView=b;this._targetIndex=e;if(e>f){this._leftView=c;this._rightView=b;this._target=-1}else{this._leftView=b;this._rightView=c;this._target=1}this.removeAllChildren();if(c){this.appendChild(c)}if(b){this.appendChild(b)}this._start=Date.now();this._end=this._start+this.get("transitionDuration");this._state=this.ANIMATING;this.tick()},tick:function(){this._timer=null;var a=Date.now(),d=(a-this._start)/(this._end-this._start),g=this._target,f=this._leftView,b=this._rightView,c,e;if(d<0){d=0}if(!this.get("isVisibleInWindow")||(d>=1)){return this.replaceScene(this._targetView)}c=SC.clone(this.get("frame"));e=Math.floor(c.width*d);if(g>0){c.left=0-(c.width-e);f.set("layout",c);c=SC.clone(c);c.left=e;b.set("layout",c)}else{c.left=0-e;f.set("layout",c);c=SC.clone(c);c.left=c.width-e;b.set("layout",c)}this._timer=this.invokeLater(this.tick,20);return this},NO_VIEW:"NO_VIEW",ANIMATING:"ANIMATING",READY:"READY",STANDARD_LAYOUT:{top:0,left:0,bottom:0,right:0}});SC.SegmentView=SC.View.extend(SC.Control,{ariaRole:"button",isSegment:YES,classNames:["sc-segment-view"],toolTip:null,isEnabled:YES,isActive:NO,isSelected:NO,layoutDirection:SC.LAYOUT_HORIZONTAL,controlSize:null,supportFocusRing:NO,displayProperties:["icon","displayTitle","value","displayToolTip","isDefault","isCancel","width","isSegment","isFirstSegment","isMiddleSegment","isLastSegment","isOverflowSegment","index","layoutDirection"],renderDelegateName:"segmentRenderDelegate",useStaticLayout:YES,title:"",value:null,icon:null,localize:NO,keyEquivalent:null,escapeHTML:YES,needsEllipsis:YES,displayTitle:function(){var a=this.get("title");if(this.get("localize")){a=SC.String.loc(a)}return a}.property("title","localize").cacheable(),width:null,localItem:null,widthDidChange:function(){this.adjust("width",this.get("width"))}.observes("width"),updateItem:function(d,c){var g=d.get("itemKeys"),f,a=d.get("viewKeys"),e,b;for(b=g.get("length")-1;b>=0;b--){f=d.get(g.objectAt(b));e=a.objectAt(b);if(!SC.none(c.get(f))){this.set(e,c.get(f))}}this.set("localItem",c)}});sc_require("views/segment");SC.SegmentedView=SC.View.extend(SC.Control,{acceptsFirstResponder:function(){if(SC.FOCUS_ALL_CONTROLS){return this.get("isEnabled")}return NO}.property("isEnabled").cacheable(),ariaRole:"group",classNames:["sc-segmented-view"],theme:"square",value:null,isEnabled:YES,allowsEmptySelection:NO,allowsMultipleSelection:NO,selectSegmentWhenTriggeringAction:NO,localize:YES,align:SC.ALIGN_CENTER,layoutDirection:SC.LAYOUT_HORIZONTAL,items:null,itemTitleKey:null,itemValueKey:null,itemIsEnabledKey:null,itemIconKey:null,itemWidthKey:null,itemActionKey:null,itemTargetKey:null,itemLayerIdKey:null,itemKeyEquivalentKey:null,shouldHandleOverflow:YES,overflowTitle:"&raquo;",overflowToolTip:"More&hellip;",overflowIcon:null,segmentViewClass:SC.SegmentView,itemKeys:["itemTitleKey","itemValueKey","itemIsEnabledKey","itemIconKey","itemWidthKey","itemToolTipKey","itemKeyEquivalentKey","itemLayerIdKey"],viewKeys:["title","value","isEnabled","icon","width","toolTip","keyEquivalent","layerId"],init:function(){arguments.callee.base.apply(this,arguments);var d=this.get("overflowTitle"),a=this.get("overflowToolTip"),b=this.get("overflowIcon"),c;c=this.get("segmentViewClass").create({controlSize:this.get("controlSize"),localize:this.get("localize"),title:d,toolTip:a,icon:b,isLastSegment:YES,isOverflowSegment:YES,layoutDirection:this.get("layoutDirection"),isVisible:this.get("shouldHandleOverflow")});this.set("overflowView",c);this.appendChild(c);this.itemsDidChange()},shouldHandleOverflowDidChange:function(){if(this.get("shouldHandleOverflow")){this.invokeLast(this.remeasure)}else{this.get("overflowView").set("isVisible",NO)}}.observes("shouldHandleOverflow"),itemsDidChange:function(){var m=this.get("items")||[],r,c,h,o=this.get("childViews"),k,d=o.lastObject(),p=this.get("value"),b,q=this.get("itemKeys"),a,n=this.get("viewKeys"),f,l=this.get("segmentViewClass"),g,e;if(o.get("length")-1>m.get("length")){for(g=o.get("length")-2;g>=m.get("length");g--){k=o.objectAt(g);c=k.get("localItem");if(c instanceof SC.Object){for(e=q.get("length")-1;e>=0;e--){a=this.get(q.objectAt(e));if(a){c.removeObserver(a,this,this.itemContentDidChange)}}}if(SC.isArray(p)){p.removeObject(c)}else{if(p===c){p=null}}this.removeChild(k)}this.set("value",p)}else{if(o.get("length")-1<m.get("length")){for(g=o.get("length")-1;g<m.get("length");g++){k=l.create({controlSize:this.get("controlSize"),localize:this.get("localize"),layoutDirection:this.get("layoutDirection")});this.insertBefore(k,d)}}}o=this.get("childViews");for(g=0;g<m.get("length");g++){c=m.objectAt(g);k=o.objectAt(g);h=k.get("localItem");if(h instanceof SC.Object&&!m.contains(h)){for(e=q.get("length")-1;e>=0;e--){a=this.get(q.objectAt(e));if(a){h.removeObserver(a,this,this.itemContentDidChange)}}}if(SC.none(c)){continue}if(SC.typeOf(c)===SC.T_STRING){c=SC.Object.create({title:c.humanize().titleize(),value:c});this.set("itemTitleKey","title");this.set("itemValueKey","value")}else{if(SC.typeOf(c)===SC.T_HASH){c=SC.Object.create(c)}else{if(c instanceof SC.Object){for(e=q.get("length")-1;e>=0;e--){a=this.get(q.objectAt(e));if(a){c.removeObserver(a,this,this.itemContentDidChange);c.addObserver(a,this,this.itemContentDidChange,g)}}}else{SC.Logger.error("SC.SegmentedView items may be Strings, Objects (ie. Hashes) or SC.Objects only")}}}b=NO;if(SC.isArray(p)?p.indexOf(c.get(this.get("itemValueKey")))>=0:p===c.get(this.get("itemValueKey"))){b=YES}k.set("isSelected",b);k.set("index",g);k.set("isFirstSegment",g===0);k.set("isMiddleSegment",g<m.get("length")-1&&g>0);k.set("isLastSegment",g===m.get("length")-1);k.updateItem(this,c)}if(this.get("shouldHandleOverflow")){this.invokeLast(this.remeasure)}}.observes("*items.[]"),itemContentDidChange:function(e,d,b,c){var a=this.get("items"),f=this.get("childViews"),g;g=f.objectAt(c);if(g){g.updateItem(this,e)}else{SC.Logger.warn("Item content change was observed on item without matching segment child view.")}if(this.get("shouldHandleOverflow")){this.invokeLast(this.remeasure)}},viewDidResize:function(){var b=this.get("layoutDirection")===SC.LAYOUT_HORIZONTAL,a=b?this.$().width():this.$().height();if(this.get("shouldHandleOverflow")&&(this.isOverflowing||a<=this.cachedMinimumDim)){this.adjustOverflow()}},isVisibleInWindowDidChange:function(){if(this.get("shouldHandleOverflow")){this.invokeLast(this.remeasure)}}.observes("isVisibleInWindow"),remeasure:function(){if(!this.get("shouldHandleOverflow")){return}var a=this.get("renderDelegate"),d=this.get("childViews"),c;if(this.get("isVisibleInWindow")){c=d.lastObject();c.set("isVisible",YES);for(var b=d.get("length")-1;b>=0;b--){d.objectAt(b).set("isVisible",YES)}this.cachedDims=this.segmentDimensions();this.cachedOverflowDim=this.overflowSegmentDim();this.adjustOverflow()}},adjustOverflow:function(){if(!this.get("shouldHandleOverflow")){return}var f=this.get("childViews"),e,h=this.get("value"),b=f.lastObject(),g=this.get("layoutDirection")===SC.LAYOUT_HORIZONTAL,k=g?this.$().width():this.$().height(),d=0,j,a,c;this.isOverflowing=NO;b.set("isSelected",NO);this.overflowItems=[];a=this.cachedDims.length;for(c=0;c<a;c++){e=f.objectAt(c);d+=this.cachedDims[c];j=(c===a-1)?d:d+this.cachedOverflowDim;if(j>k){overflowItem={};localItem=e.get("localItem");overflowItem[this.get("itemTitleKey")]=localItem.get(this.get("itemTitleKey"));overflowItem[this.get("itemIconKey")]=localItem.get(this.get("itemIconKey"));overflowItem[this.get("itemIsEnabledKey")]=localItem.get(this.get("itemIsEnabledKey"));overflowItem[this.get("itemKeyEquivalentKey")]=localItem.get(this.get("itemKeyEquivalentKey"));overflowItem[this.get("itemValueKey")]=localItem.get(this.get("itemValueKey"));this.overflowItems.pushObject(overflowItem);this.isOverflowing=YES;e.set("isVisible",NO);if(c===0){b.set("isFirstSegment",YES)}if(SC.isArray(h)?h.indexOf(e.get("value"))>=0:h===e.get("value")){b.set("isSelected",YES)}}else{e.set("isVisible",YES);if(c===0){b.set("isFirstSegment",NO)}}}if(this.isOverflowing){b.set("isVisible",YES)}else{b.set("isVisible",NO)}this.cachedMinimumDim=d+this.cachedOverflowDim},segmentDimensions:function(){var b=this.get("childViews"),a,e,h=[],g=this.get("layoutDirection")===SC.LAYOUT_HORIZONTAL;for(var c=0,d=b.length;c<d-1;c++){a=b[c];e=a.get("frame");h[c]=g?e.width:e.height}return h},overflowSegmentDim:function(){var b=this.get("childViews"),a,c,d=this.get("layoutDirection")===SC.LAYOUT_HORIZONTAL;a=b.length&&b[b.length-1];if(a){c=a.get("frame");return d?c.width:c.height}return 0},indexForClientPosition:function(b,h){var d=this.get("childViews"),g,e,c,f,a;a={x:b,y:h};for(e=0,g=d.length;e<g;e++){c=d[e];f=c.get("layer").getBoundingClientRect();f={x:f.left,y:f.top,width:(f.right-f.left),height:(f.bottom-f.top)};if(SC.pointInRect(a,f)){return e}}return -1},displayProperties:["align"],renderDelegateName:"segmentedRenderDelegate",displayItemIndexForEvent:function(b){var c=this.get("renderDelegate");var a=b.clientX;var f=b.clientY;if(a===0&&f===0){var d=b.target;if(d){var e=SC.offset(d);a=e.x+Math.round(d.offsetWidth/2);f=e.y+Math.round(d.offsetHeight/2)}}if(c&&c.indexForClientPosition){return c.indexForClientPosition(this,a,f)}return this.indexForClientPosition(b.clientX,b.clientY)},keyDown:function(c){var g,h,d,e,f,b;if(c.which===9||c.keyCode===9){var a=c.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");if(a){a.becomeFirstResponder()}else{c.allowDefault()}return YES}if(!this.get("allowsMultipleSelection")){g=this.get("childViews");e=g.get("length");f=this.get("value");b=SC.isArray(f);if(c.which===39||c.which===40){if(f){for(d=0;d<e-2;d++){h=g.objectAt(d);if(b?(f.indexOf(h.get("value"))>=0):(h.get("value")===f)){this.triggerItemAtIndex(d+1)}}}else{this.triggerItemAtIndex(0)}return YES}else{if(c.which===37||c.which===38){if(f){for(d=1;d<e-1;d++){h=g.objectAt(d);if(b?(f.indexOf(h.get("value"))>=0):(h.get("value")===f)){this.triggerItemAtIndex(d-1)}}}else{this.triggerItemAtIndex(e-2)}return YES}}}return NO},mouseDown:function(a){var c=this.get("childViews"),e,d=c.get("length")-1,b;if(!this.get("isEnabled")){return YES}b=this.displayItemIndexForEvent(a);if(b>=0){e=c.objectAt(b);if(e.get("isEnabled")){e.set("isActive",YES)}this.activeChildView=e;if(b===d){this.showOverflowMenu()}else{this._isMouseDown=YES}}return YES},mouseUp:function(a){var c,b;b=this.displayItemIndexForEvent(a);if(this._isMouseDown&&(b>=0)){this.triggerItemAtIndex(b);c=this.activeChildView;if(c){c.set("isActive",NO);this.activeChildView=null}}this._isMouseDown=NO;return YES},mouseMoved:function(a){var d=this.get("childViews"),e=d.get("length")-1,c,f,b;if(this._isMouseDown){b=this.displayItemIndexForEvent(a);c=this.activeChildView;f=d.objectAt(b);if(f&&f!==c){if(c){c.set("isActive",NO)}if(f.get("isEnabled")){f.set("isActive",YES)}this.activeChildView=f;if(b===e){this.showOverflowMenu();this._isMouseDown=NO}}}return YES},mouseEntered:function(a){var c=this.get("childViews"),e,d=c.get("length")-1,b;if(this._isMouseDown){b=this.displayItemIndexForEvent(a);if(b===d){this.showOverflowMenu();this._isMouseDown=NO}else{if(b>=0){e=c.objectAt(b);if(e.get("isEnabled")){e.set("isActive",YES)}this.activeChildView=e}}}return YES},mouseExited:function(a){var b;if(this._isMouseDown){b=this.activeChildView;if(b){b.set("isActive",NO)}this.activeChildView=null}return YES},touchStart:function(e){var b=this.get("childViews"),d,c=b.get("length")-1,a;if(!this.get("isEnabled")){return YES}a=this.displayItemIndexForEvent(e);if(a>=0){d=b.objectAt(a);d.set("isActive",YES);this.activeChildView=d;if(a===c){this.showOverflowMenu()}else{this._isTouching=YES}}return YES},touchEnd:function(c){var b,a;a=this.displayItemIndexForEvent(c);if(this._isTouching&&(a>=0)){this.triggerItemAtIndex(a);b=this.activeChildView;b.set("isActive",NO);this.activeChildView=null;this._isTouching=NO}return YES},touchesDragged:function(a,e){var h=this.touchIsInBoundary(a),d=this.get("childViews"),f=d.get("length")-1,c,g,b;if(h){if(!this._isTouching){this._touchDidEnter(a)}b=this.displayItemIndexForEvent(a);c=this.activeChildView;g=d[b];if(g&&g!==c){if(c){c.set("isActive",NO)}g.set("isActive",YES);this.activeChildView=g;if(b===f){this.showOverflowMenu();this._isMouseDown=NO}}}else{if(this._isTouching){this._touchDidExit(a)}}this._isTouching=h;return YES},_touchDidExit:function(a){var b;if(this.isTouching){b=this.activeChildView;b.set("isActive",NO);this.activeChildView=null}return YES},_touchDidEnter:function(a){var c=this.get("childViews"),e,d=c.get("length")-1,b;b=this.displayItemIndexForEvent(a);if(b===d){this.showOverflowMenu();this._isTouching=NO}else{if(b>=0){e=c.objectAt(b);e.set("isActive",YES);this.activeChildView=e}}return YES},triggerItemAtIndex:function(i){var k=this.get("childViews"),g,b,l,c,h,f;g=k.objectAt(i);if(!g.get("isEnabled")){return this}h=this.get("allowsEmptySelection");f=this.get("allowsMultipleSelection");b=g.get("value");l=c=this.get("value");if(SC.empty(l)){l=[]}else{if(!SC.isArray(l)){l=[l]}}if(!f){if(h&&(l.get("length")===1)&&(l.objectAt(0)===b)){l=[]}else{l=[b]}}else{if(l.indexOf(b)>=0){if(l.get("length")>1||(l.objectAt(0)!==b)||h){l=l.without(b)}}else{l=l.concat([b])}}switch(l.get("length")){case 0:l=null;break;case 1:l=l.objectAt(0);break;default:break}var n=this.get("itemActionKey"),a=this.get("itemTargetKey"),e,j=null,d=this.getPath("pane.rootResponder"),m;if(n&&(m=this.get("items").objectAt(i))){e=m.get?m.get(n):m[n];if(a){j=m.get?m.get(a):m[a]}if(d){d.sendAction(e,j,this,this.get("pane"),l)}}if(c!==undefined&&(!e||this.get("selectSegmentWhenTriggeringAction"))){this.set("value",l)}e=this.get("action");if(e&&d){d.sendAction(e,this.get("target"),this,this.get("pane"),l)}},selectOverflowItem:function(b){var a=b.get("selectedItem");this.triggerItemAtIndex(a.get("index"));b.removeObserver("selectedItem",this,"selectOverflowItem");this.activeChildView.set("isActive",NO);this.activeChildView=null},showOverflowMenu:function(){var f=this.get("childViews"),b=f.get("length")-1,o=this.overflowItems,k,j,e,h;k=o.get("length");j=f.get("length")-1-k;h=this.get("value");e=SC.isArray(h);for(var c=0;c<k;c++){var n=o.objectAt(c),l=this.get("itemValueKey");if(e?h.indexOf(n[l])>=0:h===n[l]){n.isChecked=YES}else{n.isChecked=NO}n.index=j+c}var m=this;var a=SC.MenuPane.create({layout:{width:200},items:o,itemTitleKey:this.get("itemTitleKey"),itemIconKey:this.get("itemIconKey"),itemIsEnabledKey:this.get("itemIsEnabledKey"),itemKeyEquivalentKey:this.get("itemKeyEquivalentKey"),itemCheckboxKey:"isChecked",modalPaneDidClick:function(){arguments.callee.base.apply(this,arguments);this.removeObserver("selectedItem",m,"selectOverflowItem");m.activeChildView.set("isActive",NO);m.activeChildView=null}});var d=this.get("layer");var g=d.childNodes[d.childNodes.length-1];a.popup(g);a.addObserver("selectedItem",this,"selectOverflowItem")},valueDidChange:function(){var d=this.get("value"),c,f=this.get("childViews"),g=Infinity,e=f.lastObject(),h,a;if(this.overflowItems){c=this.overflowItems.get("length");g=f.get("length")-1-c;e.set("isSelected",NO)}for(var b=f.get("length")-2;b>=0;b--){h=f.objectAt(b);if(SC.isArray(d)?d.indexOf(h.get("value"))>=0:d===h.get("value")){h.set("isSelected",YES);if(b>=g){e.set("isSelected",YES)}}else{h.set("isSelected",NO)}}}.observes("value")});sc_require("views/button");SC.SelectView=SC.ButtonView.extend({acceptsFirstResponder:function(){return this.get("isEnabled")}.property("isEnabled"),escapeHTML:YES,escapeHTMLBindingDefault:SC.Binding.oneWay().bool(),items:[],itemsBindingDefault:SC.Binding.multiple(),itemTitleKey:null,itemSortKey:null,itemValueKey:null,itemIconKey:null,itemSeparatorKey:"separator",itemIsEnabledKey:"isEnabled",localize:YES,disableSort:YES,classNames:["sc-select-view"],menu:null,_itemList:[],_itemIdx:null,value:null,checkboxEnabled:YES,showCheckbox:YES,emptyName:null,_defaultVal:null,_defaultTitle:null,_defaultIcon:null,theme:"popup",displayProperties:["icon","value","controlSize","items","escapeHTML","emptyName"],preferMatrix:null,CUSTOM_MENU_ITEM_HEIGHT:20,isActiveBinding:"*menu.isVisibleInWindow",isDefaultPosition:NO,lastMenuWidth:null,exampleView:null,customViewMenuOffsetWidth:0,needsEllipsis:YES,menuPaneHeightPadding:0,menuItemPadding:35,isContextMenuEnabled:NO,supportFocusRing:YES,leftAlign:function(){switch(this.get("controlSize")){case SC.TINY_CONTROL_SIZE:return SC.SelectView.TINY_OFFSET_X;case SC.SMALL_CONTROL_SIZE:return SC.SelectView.SMALL_OFFSET_X;case SC.REGULAR_CONTROL_SIZE:return SC.SelectView.REGULAR_OFFSET_X;case SC.LARGE_CONTROL_SIZE:return SC.SelectView.LARGE_OFFSET_X;case SC.HUGE_CONTROL_SIZE:return SC.SelectView.HUGE_OFFSET_X}return 0}.property("controlSize"),sortObjects:function(b){if(!this.get("disableSort")){var a=this.get("itemSortKey")||this.get("itemTitleKey");b=b.sort(function(d,c){if(a){d=d.get?d.get(a):d[a];c=c.get?c.get(a):c[a]}return(d<c)?-1:((d>c)?1:0)})}return b},render:function(b,g){arguments.callee.base.apply(this,arguments);var q,d,l,r,t,y,h,f,w,i,o,a,n,e,k,x,s,p,u,m,j,v,c;l=this.get("items")||[];l=this.sortObjects(l);r=l.length;t=this.get("itemTitleKey");y=this.get("itemIconKey");h=this.get("itemValueKey");f=this.get("itemSeparatorKey");w=this.get("showCheckbox");j=this.get("itemIsEnabledKey");q=this.get("escapeHTML");i=this.get("value");o=this.get("localize");n=[];e=YES;k=0;v=this.get("emptyName");if(!SC.none(v)){v=o?SC.String.loc(v):v;v=q?SC.RenderContext.escapeHTML(v):v;u=SC.Object.create({separator:NO,title:v,icon:null,value:null,isEnabled:YES,checkbox:NO,target:this,action:"displaySelectedItem"});if(SC.none(i)){this.set("title",v)}n.push(u)}l.forEach(function(z){if(z||z===0){a=f?(z.get?z.get(f):z[f]):NO;if(!a){x=t?(z.get?z.get(t):z[t]):z.toString();x=o?SC.String.loc(x):x;x=q?SC.RenderContext.escapeHTML(x):x;s=y?(z.get?z.get(y):z[y]):null;if(SC.none(z[y])){s=null}p=h?(z.get?z.get(h):z[h]):z;if(!SC.none(i)&&!SC.none(p)){c=false;if(SC.kindOf(i,SC.Record)&&SC.kindOf(p,SC.Record)){c=i.get("storeKey")===p.get("storeKey")}if(i===p||c){this.set("title",x);this.set("icon",s)}}if(p===this.get("value")){this.set("_itemIdx",k);e=!w?NO:YES}else{e=NO}m=(z.get?z.get(j):z[j]);if(NO!==m){m=YES}if(SC.none(this._defaultVal)&&m){this._defaultVal=p;this._defaultTitle=x;this._defaultIcon=s}}u=SC.Object.create({separator:a,title:x,icon:s,value:p,isEnabled:m,checkbox:e,target:this,action:"displaySelectedItem"});n.push(u)}k+=1;this.set("_itemList",n)},this);if(g){this.invokeLast(function(){var z=this.get("value");if(SC.none(z)){if(SC.none(v)){this.set("value",this._defaultVal);this.set("title",this._defaultTitle);this.set("icon",this._defaultIcon)}else{this.set("title",v)}}})}this.changeSelectPreferMatrix(this.get("_itemIdx"))},_action:function(l){var i,a,j,k,q,n,y,e,x,c,m,s,o,v,f,g,b,w,h,r;i=this.$(".sc-button-label")[0];var z=SC.SelectView.MENU_WIDTH_OFFSET;if(!this.get("isDefaultPosition")){switch(this.get("controlSize")){case SC.TINY_CONTROL_SIZE:z+=SC.SelectView.TINY_POPUP_MENU_WIDTH_OFFSET;break;case SC.SMALL_CONTROL_SIZE:z+=SC.SelectView.SMALL_POPUP_MENU_WIDTH_OFFSET;break;case SC.REGULAR_CONTROL_SIZE:z+=SC.SelectView.REGULAR_POPUP_MENU_WIDTH_OFFSET;break;case SC.LARGE_CONTROL_SIZE:z+=SC.SelectView.LARGE_POPUP_MENU_WIDTH_OFFSET;break;case SC.HUGE_CONTROL_SIZE:z+=SC.SelectView.HUGE_POPUP_MENU_WIDTH_OFFSET;break}}a=this.get("layer").offsetWidth+z;a=this.get("layer").offsetWidth;j=i.scrollWidth;k=this.get("lastMenuWidth");if(j){q=i.offsetWidth;if(j&&q){a=a+j-q}}if(!k||(a>k)){k=a}n=this.get("_itemList");var t=this.get("customViewClassName");var p=this.get("customViewMenuOffsetWidth");var d="sc-view sc-pane sc-panel sc-palette sc-picker sc-menu select-button sc-scroll-view sc-menu-scroll-view sc-container-view menuContainer sc-button-view sc-menu-item sc-regular-size";d=t?(d+" "+t):d;SC.prepareStringMeasurement("",d);for(m=0,w=n.length;m<w;++m){x=n.objectAt(m);y=SC.measureString(x.title).width;if(!e||(y>e)){e=y}}SC.teardownStringMeasurement();k=(e+this.menuItemPadding>k)?e+this.menuItemPadding:k;var u=SC.RootResponder.responder.get("currentWindowSize").width;if(k>u){k=(u-25)}this.set("lastMenuWidth",k);s=this.get("value");o=this.get("_itemList");v=this.get("controlSize");f=this.get("menuPaneHeightPadding");r=this.get("escapeHTML");g=this.get("exampleView")||SC.MenuItemView.extend({escapeHTML:r});b=SC.MenuPane.create({classNames:["select-button"],items:o,exampleView:g,isEnabled:YES,menuHeightPadding:f,preferType:SC.PICKER_MENU,itemHeightKey:"height",layout:{width:k},controlSize:v,itemWidth:k});if(!b){return NO}b.popup(this,this.preferMatrix);this.set("menu",b);h=this._itemIdx;if(!SC.empty(h)&&h>-1){g=b.menuItemViewForContentIndex(h);if(g){g.becomeFirstResponder()}}this.set("isActive",YES);return YES},displaySelectedItem:function(a){var b=a.get("selectedItem");this.set("value",b.get("value"));this.set("title",b.get("title"));this.set("_itemIdx",b.get("contentIndex"))},changeSelectPreferMatrix:function(){var c=0,g=0;switch(this.get("controlSize")){case SC.TINY_CONTROL_SIZE:c=SC.SelectView.TINY_OFFSET_Y;g=SC.MenuPane.TINY_MENU_ITEM_HEIGHT;break;case SC.SMALL_CONTROL_SIZE:c=SC.SelectView.SMALL_OFFSET_Y;g=SC.MenuPane.SMALL_MENU_ITEM_HEIGHT;break;case SC.REGULAR_CONTROL_SIZE:c=SC.SelectView.REGULAR_OFFSET_Y;g=SC.MenuPane.REGULAR_MENU_ITEM_HEIGHT;break;case SC.LARGE_CONTROL_SIZE:c=SC.SelectView.LARGE_OFFSET_Y;g=SC.MenuPane.LARGE_MENU_ITEM_HEIGHT;break;case SC.HUGE_CONTROL_SIZE:c=SC.SelectView.HUGE_OFFSET_Y;g=SC.MenuPane.HUGE_MENU_ITEM_HEIGHT;break}var e=c,b=this.get("_itemIdx"),a=this.get("leftAlign"),f,d;if(this.get("isDefaultPosition")){f=[1,0,3];this.set("preferMatrix",f)}else{if(b){e=b*g+c}d=[a,-e,2];this.set("preferMatrix",d)}},mouseDown:function(a){if(!this.get("isEnabled")){return YES}this.set("isActive",YES);this._isMouseDown=YES;this.becomeFirstResponder();this._action();return YES},mouseUp:function(b){var d=this.get("menu"),a,c;if(d){a=d.getPath("rootMenu.targetMenuItem");if(a&&d.get("mouseHasEntered")){if(!a.performAction()){d.remove()}}else{if(b.timeStamp-this._mouseDownTimestamp>400){d.remove()}}}this._isMouseDown=NO;this.set("isActive",NO);return YES},mouseExited:function(){return YES},keyDown:function(a){if(this.interpretKeyEvents(a)){return YES}else{return arguments.callee.base.apply(this,arguments)}},interpretKeyEvents:function(a){if(a){if((a.keyCode===38||a.keyCode===40)){this._action()}else{if(a.keyCode===27){this.resignFirstResponder()}}}return arguments.callee.base.apply(this,arguments)},_button_isSelectedDidChange:function(){}.observes("isSelected")});SC.SelectView.TINY_OFFSET_X=0;SC.SelectView.TINY_OFFSET_Y=0;SC.SelectView.TINY_POPUP_MENU_WIDTH_OFFSET=0;SC.SelectView.SMALL_OFFSET_X=-18;SC.SelectView.SMALL_OFFSET_Y=3;SC.SelectView.SMALL_POPUP_MENU_WIDTH_OFFSET=7;SC.SelectView.REGULAR_OFFSET_X=-17;SC.SelectView.REGULAR_OFFSET_Y=0;SC.SelectView.REGULAR_POPUP_MENU_WIDTH_OFFSET=4;SC.SelectView.LARGE_OFFSET_X=-17;SC.SelectView.LARGE_OFFSET_Y=6;SC.SelectView.LARGE_POPUP_MENU_WIDTH_OFFSET=3;SC.SelectView.HUGE_OFFSET_X=0;SC.SelectView.HUGE_OFFSET_Y=0;SC.SelectView.HUGE_POPUP_MENU_WIDTH_OFFSET=0;SC.SelectView.MENU_WIDTH_OFFSET=-2;sc_require("views/button");SC.SelectButtonView=SC.ButtonView.extend({init:function(){arguments.callee.base.apply(this,arguments)},escapeHTML:YES,objects:[],objectsBindingDefault:SC.Binding.multiple(),nameKey:null,sortKey:null,valueKey:null,iconKey:null,isEnabledKey:"isEnabled",localize:YES,disableSort:YES,classNames:["select-button"],menu:null,itemList:[],itemIdx:null,value:null,checkboxEnabled:YES,separatorPosition:null,_defaultVal:null,_defaultTitle:null,_defaultIcon:null,theme:"popup",displayProperties:["icon","value","controlSize","objects","objects.[]"],preferMatrix:null,SELECT_BUTTON_SPRITE_WIDTH:28,isActiveBinding:"*menu.isVisibleInWindow",isDefaultPosition:NO,lastMenuWidth:null,customView:null,customViewClassName:null,customViewMenuOffsetWidth:0,needsEllipsis:YES,menuPaneHeightPadding:0,supportFocusRing:YES,isContextMenuEnabled:NO,leftAlign:function(){switch(this.get("controlSize")){case SC.TINY_CONTROL_SIZE:return SC.SelectButtonView.TINY_OFFSET_X;case SC.SMALL_CONTROL_SIZE:return SC.SelectButtonView.SMALL_OFFSET_X;case SC.REGULAR_CONTROL_SIZE:return SC.SelectButtonView.REGULAR_OFFSET_X;case SC.LARGE_CONTROL_SIZE:return SC.SelectButtonView.LARGE_OFFSET_X;case SC.HUGE_CONTROL_SIZE:return SC.SelectButtonView.HUGE_OFFSET_X}return 0}.property("controlSize"),sortObjects:function(b){if(!this.get("disableSort")){var a=this.get("sortKey")||this.get("nameKey");b=b.sort(function(d,c){if(a){d=d.get?d.get(a):d[a];c=c.get?c.get(a):c[a]}return(d<c)?-1:((d>c)?1:0)})}return b},render:function(b,e){arguments.callee.base.apply(this,arguments);var c,a,n,p,t,f,r,g,l,s,k,d,i,u,o,m,q,j,h;c=this.layout.width;if(e&&c){this.adjust({width:c-this.SELECT_BUTTON_SPRITE_WIDTH})}a=this.get("objects");a=this.sortObjects(a);n=a.length;p=this.get("nameKey");t=this.get("iconKey");f=this.get("valueKey");h=this.get("isEnabledKey");r=this.get("checkboxEnabled");g=this.get("value");l=this.get("localize");s=this.get("separatorPosition");k=[];d=YES;i=0;a.forEach(function(v){if(v){u=p?(v.get?v.get(p):v[p]):v.toString();u=l?SC.String.loc(u):u;o=t?(v.get?v.get(t):v[t]):null;if(SC.none(v[t])){o=null}m=(f)?(v.get?v.get(f):v[f]):v;if(!SC.none(g)&&!SC.none(m)){if(this._equals(g,m)){this.set("title",u);this.set("icon",o)}}if(this._equals(m,this.get("value"))){if(s>0&&s<n&&i>=n-s){i++}this.set("itemIdx",i);d=!r?NO:YES}else{d=NO}j=(h)?(v.get?v.get(h):v[h]):v;if(NO!==j){j=YES}if(i===0){this._defaultVal=m;this._defaultTitle=u;this._defaultIcon=o}var w=SC.Object.create({title:u,icon:o,value:m,isEnabled:j,checkbox:d,target:this,action:"displaySelectedItem"});k.push(w)}i+=1;if(s&&i===(n-s)){var x=SC.Object.create({separator:YES});k.push(x)}this.set("itemList",k)},this);if(e){b.attr("aria-haspopup","true");this.invokeLast(function(){var v=this.get("value");if(SC.none(v)){this.set("value",this._defaultVal);this.set("title",this._defaultTitle);this.set("icon",this._defaultIcon)}})}this.changeSelectButtonPreferMatrix(this.itemIdx)},_equals:function(b,a){var c=YES;if(b&&SC.typeOf(b)===SC.T_HASH&&a&&SC.typeOf(a)===SC.T_HASH){for(var d in b){if(b[d]!==a[d]){c=NO}}}else{c=(b===a)}return c},_action:function(o){var i,a,l,m,t,q,A,e,z,c,p,u,r,x,f,g,n,b,y,h,k,B,j;i=this.$(".sc-button-label")[0];B=SC.SelectButtonView.MENU_WIDTH_OFFSET;if(!this.get("isDefaultPosition")){switch(this.get("controlSize")){case SC.TINY_CONTROL_SIZE:B+=SC.SelectButtonView.TINY_POPUP_MENU_WIDTH_OFFSET;break;case SC.SMALL_CONTROL_SIZE:B+=SC.SelectButtonView.SMALL_POPUP_MENU_WIDTH_OFFSET;break;case SC.REGULAR_CONTROL_SIZE:B+=SC.SelectButtonView.REGULAR_POPUP_MENU_WIDTH_OFFSET;break;case SC.LARGE_CONTROL_SIZE:B+=SC.SelectButtonView.LARGE_POPUP_MENU_WIDTH_OFFSET;break;case SC.HUGE_CONTROL_SIZE:B+=SC.SelectButtonView.HUGE_POPUP_MENU_WIDTH_OFFSET;break}}a=this.get("layer").offsetWidth+B;l=i.scrollWidth;m=this.get("lastMenuWidth");if(l){t=i.offsetWidth;if(l&&t){a=a+l-t}}if(!m||(a>m)){m=a}q=this.get("itemList");var v=this.get("customViewClassName"),s=this.get("customViewMenuOffsetWidth"),d="sc-view sc-pane sc-panel sc-palette sc-picker sc-menu select-button menu sc-scroll-view sc-menu-scroll-view sc-container-view sc-menu-item menu-item value sc-regular-size";d=v?(d+" "+v):d;h=(this.get("customView")||SC.MenuItemView).create();k=h.get("escapeHTML");j=document.body;for(p=0,y=q.length;p<y;++p){z=q.objectAt(p);c=document.createElement("div");c.style.cssText="top:-10000px; left: -10000px;  position: absolute;";c.className=d;c.innerHTML=k?SC.RenderContext.escapeHTML(z.title):z.title;j.appendChild(c);A=c.offsetWidth+s;if(!e||(A>e)){e=A}j.removeChild(c)}e=(e>m)?e:m;var w=SC.RootResponder.responder.get("currentWindowSize").width;if(e>w){e=(w-25)}this.set("lastMenuWidth",m);u=this.get("value");r=this.get("itemList");x=this.get("controlSize");g=this.get("customView");n=g?g:SC.MenuItemView;b=SC.MenuPane.create({classNames:["select-button"],items:r,exampleView:n,isEnabled:YES,preferType:SC.PICKER_MENU,itemHeightKey:"height",layout:{width:e},controlSize:x,itemWidth:m,performKeyEquivalent:function(D,C){switch(D){case"tab":case"shift_tab":return YES;default:return arguments.callee.base.apply(this,arguments)}}});if(!b){return NO}b.popup(this,this.preferMatrix);this.set("menu",b);g=b.menuItemViewForContentIndex(this.get("itemIdx"));b.set("currentMenuItem",g);if(g){g.becomeFirstResponder()}this.set("isActive",YES);return YES},displaySelectedItem:function(a){var b=this.getPath("menu.selectedItem");if(!b){return NO}this.set("value",b.get("value"));this.set("title",b.get("title"));this.set("itemIdx",b.get("contentIndex"));return YES},changeSelectButtonPreferMatrix:function(){var b=0,h=0,d=0,e=0,i,f;switch(this.get("controlSize")){case SC.TINY_CONTROL_SIZE:b=SC.SelectButtonView.TINY_OFFSET_Y;h=SC.MenuPane.TINY_MENU_ITEM_HEIGHT;d=SC.MenuPane.TINY_MENU_ITEM_SEPARATOR_HEIGHT;break;case SC.SMALL_CONTROL_SIZE:b=SC.SelectButtonView.SMALL_OFFSET_Y;h=SC.MenuPane.SMALL_MENU_ITEM_HEIGHT;d=SC.MenuPane.SMALL_MENU_ITEM_SEPARATOR_HEIGHT;break;case SC.REGULAR_CONTROL_SIZE:b=SC.SelectButtonView.REGULAR_OFFSET_Y;h=SC.MenuPane.REGULAR_MENU_ITEM_HEIGHT;d=SC.MenuPane.REGULAR_MENU_ITEM_SEPARATOR_HEIGHT;break;case SC.LARGE_CONTROL_SIZE:b=SC.SelectButtonView.LARGE_OFFSET_Y;h=SC.MenuPane.LARGE_MENU_ITEM_HEIGHT;d=SC.MenuPane.LARGE_MENU_ITEM_SEPARATOR_HEIGHT;break;case SC.HUGE_CONTROL_SIZE:b=SC.SelectButtonView.HUGE_OFFSET_Y;h=SC.MenuPane.HUGE_MENU_ITEM_HEIGHT;d=SC.MenuPane.HUGE_MENU_ITEM_SEPARATOR_HEIGHT;break}var g=b,a=this.get("itemIdx"),k=this.get("leftAlign"),j,c;if(this.get("isDefaultPosition")){j=[1,0,3];this.set("preferMatrix",j)}else{if(a){g=a*h+b;i=this.get("separatorPosition");f=this.get("objects").length;if(i>0&&i<f&&a>=f-i){e=h-d;g-=e}}c=[k,-g,2];this.set("preferMatrix",c)}},mouseDown:function(a){if(!this.get("isEnabled")){return YES}this.set("isActive",YES);this._isMouseDown=YES;this.becomeFirstResponder();this._action();this._menuRenderedTimestamp=0;var b=this;setTimeout(function(){SC.run(function(){b._menuRenderedTimestamp=Date.now()})},1);return YES},_recordMouseDownTimestamp:function(){this._menuRenderedTimestamp=new Date().getTime()},mouseUp:function(b){var d=new Date().getTime(),c=this._menuRenderedTimestamp,e=this.get("menu"),f=SC.platform.touch,a;if(c===0){c=Date.now()}if(e){a=e.getPath("rootMenu.targetMenuItem");if(a&&a.get("mouseHasEntered")){if(!a.performAction()){e.remove()}}else{if(!f&&(d-c>SC.ButtonView.CLICK_AND_HOLD_DELAY)){if(!e.get("mouseHasEntered")&&!this.get("isDefaultPosition")){a=e.get("currentMenuItem");if(a&&!a.performAction()){e.remove()}}else{e.remove()}}}}this._isMouseDown=NO;this.set("isActive",NO);return YES},mouseExited:function(){return YES},keyDown:function(a){if(this.interpretKeyEvents(a)){return YES}else{return arguments.callee.base.apply(this,arguments)}},interpretKeyEvents:function(a){if(a){if((a.keyCode===38||a.keyCode===40)){this._action()}else{if(a.keyCode===27){this.resignFirstResponder()}}}return arguments.callee.base.apply(this,arguments)},acceptsFirstResponder:function(){return this.get("isEnabled")}.property("isEnabled"),insertTab:function(b){var a=this.get("nextValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return YES},insertBacktab:function(b){var a=this.get("previousValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return YES},_button_isSelectedDidChange:function(){}.observes("isSelected"),didAppendToDocument:function(){}});SC.SelectButtonView.TINY_OFFSET_X=0;SC.SelectButtonView.TINY_OFFSET_Y=0;SC.SelectButtonView.TINY_POPUP_MENU_WIDTH_OFFSET=0;SC.SelectButtonView.SMALL_OFFSET_X=-18;SC.SelectButtonView.SMALL_OFFSET_Y=3;SC.SelectButtonView.SMALL_POPUP_MENU_WIDTH_OFFSET=7;SC.SelectButtonView.REGULAR_OFFSET_X=-17;SC.SelectButtonView.REGULAR_OFFSET_Y=3;SC.SelectButtonView.REGULAR_POPUP_MENU_WIDTH_OFFSET=4;SC.SelectButtonView.LARGE_OFFSET_X=-17;SC.SelectButtonView.LARGE_OFFSET_Y=6;SC.SelectButtonView.LARGE_POPUP_MENU_WIDTH_OFFSET=3;SC.SelectButtonView.HUGE_OFFSET_X=0;SC.SelectButtonView.HUGE_OFFSET_Y=0;SC.SelectButtonView.HUGE_POPUP_MENU_WIDTH_OFFSET=0;SC.SelectButtonView.MENU_WIDTH_OFFSET=-2;SC.MenuPane.TINY_MENU_ITEM_HEIGHT=10;SC.MenuPane.TINY_MENU_ITEM_SEPARATOR_HEIGHT=2;SC.MenuPane.TINY_MENU_HEIGHT_PADDING=2;SC.MenuPane.TINY_SUBMENU_OFFSET_X=0;SC.MenuPane.SMALL_MENU_ITEM_HEIGHT=16;SC.MenuPane.SMALL_MENU_ITEM_SEPARATOR_HEIGHT=7;SC.MenuPane.SMALL_MENU_HEIGHT_PADDING=4;SC.MenuPane.SMALL_SUBMENU_OFFSET_X=2;SC.MenuPane.REGULAR_MENU_ITEM_HEIGHT=22;SC.MenuPane.REGULAR_MENU_ITEM_SEPARATOR_HEIGHT=9;SC.MenuPane.REGULAR_MENU_HEIGHT_PADDING=6;SC.MenuPane.REGULAR_SUBMENU_OFFSET_X=2;SC.MenuPane.LARGE_MENU_ITEM_HEIGHT=31;SC.MenuPane.LARGE_MENU_ITEM_SEPARATOR_HEIGHT=20;SC.MenuPane.LARGE_MENU_HEIGHT_PADDING=0;SC.MenuPane.LARGE_SUBMENU_OFFSET_X=4;SC.MenuPane.HUGE_MENU_ITEM_HEIGHT=20;SC.MenuPane.HUGE_MENU_ITEM_SEPARATOR_HEIGHT=9;SC.MenuPane.HUGE_MENU_HEIGHT_PADDING=0;SC.MenuPane.HUGE_SUBMENU_OFFSET_X=0;SC.SelectFieldView=SC.FieldView.extend({displayProperties:["objects","nameKey","valueKey","isEnabled"],acceptsFirstResponder:function(){return this.get("isEnabled")}.property("isEnabled"),tagName:"select",classNames:["sc-select-field-view"],objects:[],objectsBindingDefault:SC.Binding.multiple(),nameKey:null,sortKey:null,valueKey:null,emptyName:null,localize:NO,cpDidChange:YES,disableSort:NO,validateMenuItem:function(b,a){return YES},sortObjects:function(b){if(!this.get("disableSort")){var a=this.get("sortKey")||this.get("nameKey");if(a){b=b.sortProperty(a)}else{b=b.sort(function(d,c){if(a){d=d.get?d.get(a):d[a];c=c.get?c.get(a):c[a]}return(d<c)?-1:((d>c)?1:0)})}}return b},render:function(c,a){if(a||this.get("cpDidChange")){this.set("cpDidChange",NO);var f=this.get("nameKey");var j=this.get("valueKey");var i=this.get("objects");var b=this.get("value");var d,g;if(!this.get("isEnabled")){c.attr("disabled","disabled")}var h=this.get("localize");if(!j&&b){b=SC.guidFor(b)}if((b===null)||(b==="")){b="***"}if(i){i=this.sortObjects(i);if(!a){g=this.$input()[0];if(!g){return}g.innerHTML=""}var e=this.get("emptyName");if(e){if(h){e=SC.String.loc(e)}if(a){c.push('<option value="***">'+e+"</option>",'<option disabled="disabled"></option>')}else{d=document.createElement("option");d.value="***";d.innerHTML=e;g.appendChild(d);d=document.createElement("option");d.disabled="disabled";g.appendChild(d)}}i.forEach(function(n,m){if(n){var l=f?(n.get?n.get(f):n[f]):n.toString();if(h){l=SC.String.loc(l)}var o=(j)?(n.get?n.get(j):n[j]):n;if(!e&&m===0&&b==="***"){this.set("value",o)}if(o!==null&&o!==undefined){o=(SC.guidFor(o))?SC.guidFor(o):o.toString()}var k=(this.validateMenuItem&&this.validateMenuItem(o,l))?"":'disabled="disabled" ';if(a){c.push("<option "+k+'value="'+o+'">'+l+"</option>")}else{d=document.createElement("option");d.value=o;d.innerHTML=l;if(k.length>0){d.disable="disabled"}g.appendChild(d)}}else{if(a){c.push('<option disabled="disabled"></option>')}else{d=document.createElement("option");d.disabled="disabled";g.appendChild(d)}}},this);this.setFieldValue(b)}else{this.set("value",null)}}else{this.$().prop("disabled",!this.get("isEnabled"))}},_objectsObserver:function(){this.set("cpDidChange",YES)}.observes("objects"),_objectArrayObserver:function(){this.set("cpDidChange",YES);this.propertyDidChange("objects")}.observes("*objects.[]"),_nameKeyObserver:function(){this.set("cpDidChange",YES)}.observes("nameKey"),_valueKeyObserver:function(){this.set("cpDidChange",YES)}.observes("valueKey"),_isEnabledObserver:function(){this.set("cpDidChange",YES)}.observes("isEnabled"),$input:function(){return this.$()},mouseDown:function(a){if(!this.get("isEnabled")){a.stop();return YES}else{return arguments.callee.base.apply(this,arguments)}},touchStart:function(a){return this.mouseDown(a)},touchEnd:function(a){return this.mouseUp(a)},getFieldValue:function(){var f=arguments.callee.base.apply(this,arguments);var c=this.get("valueKey");var e=this.get("objects");var d=null;var a;if(f=="***"){f=null}else{if(f&&e){var g=(SC.typeOf(e.length)===SC.T_FUNCTION)?e.length():e.length;while(!d&&(--g>=0)){a=e.objectAt?e.objectAt(g):e[g];if(a===null||a===undefined){continue}if(c){a=(a.get)?a.get(c):a[c]}var b=(a!==null&&a!==undefined)?(SC.guidFor(a)?SC.guidFor(a):a.toString()):null;if(f==b){d=a}}}}return(c||d)?d:f},setFieldValue:function(a){if(SC.none(a)){a="***"}else{a=((a!==null&&a!==undefined)?(SC.guidFor(a)?SC.guidFor(a):a.toString()):null)}this.$input().val(a);return this},fieldDidFocus:function(){var a=this.get("isFocused");if(!a){this.set("isFocused",true)}},fieldDidBlur:function(){var a=this.get("isFocused");if(a){this.set("isFocused",false)}},_isFocusedObserver:function(){this.$().setClass("focus",this.get("isFocused"))}.observes("isFocused"),didCreateLayer:function(){var a=this.$input();if(this.get("isEnabled")===false){this.$()[0].disabled=true}SC.Event.add(a,"blur",this,this.fieldDidBlur);SC.Event.add(a,"focus",this,this.fieldDidFocus);SC.Event.add(a,"change",this,this._field_fieldValueDidChange)},willDestroyLayer:function(){var a=this.$input();SC.Event.remove(a,"focus",this,this.fieldDidFocus);SC.Event.remove(a,"blur",this,this.fieldDidBlur);SC.Event.remove(a,"change",this,this._field_fieldValueDidChange)}});SC.SliderView=SC.View.extend(SC.Control,{classNames:"sc-slider-view",ariaRole:"slider",value:0.5,valueBindingDefault:SC.Binding.single().notEmpty(),minimum:0,minimumBindingDefault:SC.Binding.single().notEmpty(),contentMinimumKey:null,maximum:1,maximumBindingDefault:SC.Binding.single().notEmpty(),contentMaximumKey:null,step:0.1,displayProperties:["displayValue","ariaValue","minimum","maximum","step","frame"],ariaValue:function(){return this.get("value")}.property("value").cacheable(),renderDelegateName:"sliderRenderDelegate",displayValue:function(){var b=this.get("minimum"),a=this.get("maximum"),d=this.get("value"),c=this.get("step");d=Math.min(Math.max(d,b),a);if(!SC.none(c)&&c!==0){d=Math.round(d/c)*c}if(d!==0){d=Math.floor((d-b)/(a-b)*100)}return d}.property("value","minimum","maximum","step").cacheable(),_isMouseDown:NO,mouseDown:function(a){if(!this.get("isEnabled")){return YES}this.set("isActive",YES);this._isMouseDown=YES;return this._triggerHandle(a,YES)},mouseDragged:function(a){return this._isMouseDown?this._triggerHandle(a):YES},mouseUp:function(a){if(this._isMouseDown){this.set("isActive",NO)}var b=this._isMouseDown?this._triggerHandle(a):YES;this._isMouseDown=NO;return b},mouseWheel:function(b){if(!this.get("isEnabled")){return YES}var d=this.get("minimum"),a=this.get("maximum"),e=this.get("step"),c=this.get("value")+((b.wheelDeltaX+b.wheelDeltaY)*e),f=Math.round(c/e)*e;if(c<d){this.setIfChanged("value",d)}else{if(c>a){this.setIfChanged("value",a)}else{this.setIfChanged("value",c)}}return YES},touchStart:function(a){return this.mouseDown(a)},touchEnd:function(a){return this.mouseUp(a)},touchesDragged:function(a){return this.mouseDragged(a)},_triggerHandle:function(i,e){var a=this.get("frame").width,c=this.get("minimum"),f=this.get("maximum"),b=this.get("step"),h=this.get("value"),d;if(e){d=this.convertFrameFromView({x:i.pageX}).x;this._evtDiff=i.pageX-d}else{d=i.pageX-this._evtDiff}d=Math.max(0,Math.min(d/a,1));if(e){var g=this.get("value");g=(g-c)/(f-c);if(Math.abs(g*a-d*a)<16){this._offset=g-d}else{this._offset=0}}d=Math.max(0,Math.min(d+this._offset,1));d=c+((f-c)*d);if(b!==0){d=Math.round(d/b)*b}if(Math.abs(h-d)>=0.01){this.set("value",d)}return YES},acceptsFirstResponder:function(){if(SC.FOCUS_ALL_CONTROLS){return this.get("isEnabled")}return NO}.property("isEnabled"),keyDown:function(h){if(h.which===9||h.keyCode===9){var f=h.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");if(f){f.becomeFirstResponder()}else{h.allowDefault()}return YES}if(h.which>=33&&h.which<=40){var d=this.get("minimum"),g=this.get("maximum"),b=this.get("step"),i=g-d,a=0,c,e=this.get("value");if(h.which===37||h.which===38||h.which===34){if(b===0){if(i<100){a=e-1}else{c=Math.abs(i/100);if(c<2){c=2}a=e-c}}else{a=e-b}}if(h.which===39||h.which===40||h.which===33){if(b===0){if(i<100){a=e+2}else{c=Math.abs(i/100);if(c<2){c=2}a=e+c}}else{a=e+b}}if(h.which===36){a=g}if(h.which===35){a=d}if(a>=d&&a<=g){this.set("value",a)}}else{h.allowDefault();return NO}return YES},contentKeys:{contentValueKey:"value",contentMinimumKey:"minimum",contentMaximumKey:"maximum",contentIsIndeterminateKey:"isIndeterminate"}});sc_require("mixins/collection_group");sc_require("views/disclosure");SC.SourceListGroupView=SC.View.extend(SC.Control,SC.CollectionGroup,{classNames:["sc-source-list-group"],content:null,isGroupVisible:YES,hasGroupTitle:YES,groupTitleKey:null,groupVisibleKey:null,render:function(a,b){a.push('<div role="button" class="sc-source-list-label sc-disclosure-view sc-button-view button disclosure no-disclosure">','<img src="'+SC.BLANK_IMAGE_URL+'" class="button" />','<span class="label"></span></div>')},createChildViews:function(){},contentPropertyDidChange:function(f,c){var e=this.get("content");var h=this.outlet("labelView");if(e===null){h.setIfChanged("isVisible",NO);this.setIfChanged("hasGroupTitle",NO);return}else{h.setIfChanged("isVisible",YES);this.setIfChanged("hasGroupTitle",YES)}var b=this.getDelegateProperty("groupTitleKey",this.displayDelegate);if((c=="*")||(b&&(c==b))){var g=(e&&e.get&&b)?e.get(b):e;if(g!=this._title){this._title=g;if(g){g=g.capitalize()}h.set("title",g)}}var d=this.getDelegateProperty("groupVisibleKey",this.displayDelegate);if((c=="*")||(d&&(c==d))){if(d){h.removeClassName("no-disclosure");var a=(e&&e.get)?!!e.get(d):YES;if(a!=this.get("isGroupVisible")){this.set("isGroupVisible",a);h.set("value",a)}}else{h.addClassName("no-disclosure")}}},disclosureValueDidChange:function(c){if(c==this.get("isGroupVisible")){return}var b=this.get("content");var a=this.getDelegateProperty("groupVisibleKey",this.displayDelegate);if(b&&b.set&&a){b.set(a,c)}this.set("isGroupVisible",c);if(this.owner&&this.owner.updateChildren){this.owner.updateChildren(true)}},labelView:SC.DisclosureView.extend({value:YES,_valueObserver:function(){if(this.owner){this.owner.disclosureValueDidChange(this.get("value"))}}.observes("value")})});sc_require("views/list");sc_require("views/source_list_group");SC.SourceListView=SC.ListView.extend({theme:"source-list",classNames:["sc-source-list"],rowHeight:32,selectOnMouseDown:NO,actOnSelect:YES});SC.SplitDividerView=SC.View.extend({classNames:["sc-split-divider-view"],mouseDown:function(a){var b=this.get("splitView");return(b)?b.mouseDownInThumbView(a,this):arguments.callee.base.apply(this,arguments)},doubleClick:function(a){var b=this.get("splitView");return(b)?b.doubleClickInThumbView(a,this):arguments.callee.base.apply(this,arguments)},touchStart:function(a){return this.mouseDown(a)}});sc_require("views/split_divider");SC.RESIZE_BOTH="resize-both";SC.RESIZE_TOP_LEFT="resize-top-left";SC.RESIZE_BOTTOM_RIGHT="resize-bottom-right";SC.SplitView=SC.View.extend({classNames:["sc-split-view"],displayProperties:["layoutDirection"],delegate:null,layoutDirection:SC.LAYOUT_HORIZONTAL,canCollapseViews:YES,autoresizeBehavior:SC.RESIZE_BOTTOM_RIGHT,defaultThickness:0.5,topLeftMinThickness:null,topLeftMaxThickness:null,bottomRightMinThickness:null,bottomRightMaxThickness:null,dividerThickness:null,isSplitView:YES,topLeftView:SC.View,dividerView:SC.SplitDividerView,bottomRightView:SC.View,topLeftThickness:function(){var a=this.get("topLeftView");return a?this.thicknessForView(a):0}.property("topLeftView").cacheable(),bottomRightThickness:function(){var a=this.get("bottomRightView");return a?this.thicknessForView(a):0}.property("bottomRightView").cacheable(),thumbViewCursor:null,canCollapseView:function(a){return this.invokeDelegateMethod(this.delegate,"splitViewCanCollapse",this,a)},thicknessForView:function(a){var c=this.get("layoutDirection"),b=a.get("frame");return(c===SC.LAYOUT_HORIZONTAL)?b.width:b.height},createChildViews:function(){var e=[],c=["topLeftView","dividerView","bottomRightView"],b=c.length,a,d;for(d=0;d<b;++d){if(a=this.get(c[d])){a=this[c[d]]=this.createChildView(a,{layoutView:this,rootElementPath:[d]});e.push(a)}}this.set("childViews",e);return this},updateChildLayout:function(){var b=this.get("topLeftView"),c=this.get("bottomRightView"),i=this.get("dividerView"),e=this.get("autoresizeBehavior"),j=this.get("layoutDirection"),a=this.get("frame"),d=this._desiredTopLeftThickness,k=this.get("dividerThickness"),h=(j===SC.LAYOUT_HORIZONTAL)?a.width:a.height,l=h-k-d,g,f;k=(!SC.none(k))?k:7;f=b.get("isCollapsed")||NO;b.setIfChanged("isVisible",!f);g=SC.clone(b.get("layout"));if(j===SC.LAYOUT_HORIZONTAL){g.top=0;g.left=0;g.bottom=0;switch(e){case SC.RESIZE_BOTH:throw"SC.RESIZE_BOTH is currently unsupported.";case SC.RESIZE_TOP_LEFT:g.right=l+k;delete g.width;break;case SC.RESIZE_BOTTOM_RIGHT:delete g.right;delete g.height;g.width=d;break}}else{g.top=0;g.left=0;g.right=0;switch(e){case SC.RESIZE_BOTH:throw"SC.RESIZE_BOTH is currently unsupported.";case SC.RESIZE_TOP_LEFT:g.bottom=l+k;delete g.height;break;case SC.RESIZE_BOTTOM_RIGHT:g.height=d;delete g.bottom;delete g.width;break}}b.set("layout",g);if(i){g=SC.clone(i.get("layout"));if(j===SC.LAYOUT_HORIZONTAL){g.width=k;g.top=0;g.bottom=0;delete g.height;switch(e){case SC.RESIZE_BOTH:throw"SC.RESIZE_BOTH is currently unsupported.";case SC.RESIZE_TOP_LEFT:g.right=l;delete g.left;delete g.centerX;delete g.centerY;break;case SC.RESIZE_BOTTOM_RIGHT:g.left=d;delete g.right;delete g.centerX;delete g.centerY;break}}else{g.height=k;g.left=0;g.right=0;delete g.width;switch(e){case SC.RESIZE_BOTH:throw"SC.RESIZE_BOTH is currently unsupported.";case SC.RESIZE_TOP_LEFT:g.bottom=l;delete g.top;delete g.centerX;delete g.centerY;break;case SC.RESIZE_BOTTOM_RIGHT:g.top=d;delete g.bottom;delete g.centerX;delete g.centerY;break}}i.set("layout",g)}f=c.get("isCollapsed")||NO;c.setIfChanged("isVisible",!f);g=SC.clone(c.get("layout"));if(j===SC.LAYOUT_HORIZONTAL){g.top=0;g.bottom=0;g.right=0;switch(e){case SC.RESIZE_BOTH:throw"SC.RESIZE_BOTH is currently unsupported.";case SC.RESIZE_BOTTOM_RIGHT:g.left=d+k;delete g.width;break;case SC.RESIZE_TOP_LEFT:g.width=l;delete g.left;break}}else{g.left=0;g.right=0;g.bottom=0;switch(e){case SC.RESIZE_BOTH:throw"SC.RESIZE_BOTH is currently unsupported.";case SC.RESIZE_BOTTOM_RIGHT:g.top=d+k;delete g.height;break;case SC.RESIZE_TOP_LEFT:delete g.top;g.height=l;break}}c.set("layout",g);this.notifyPropertyChange("topLeftThickness").notifyPropertyChange("bottomRightThickness")},renderLayout:function(b,a){if(a||this._recalculateDivider){var f=this.get("layoutDirection"),c=this.get("frame"),e=this.$(),i=this.get("defaultThickness"),d=this.get("autoresizeBehavior"),h=this.get("dividerThickness"),g;if(!this.get("thumbViewCursor")){this.set("thumbViewCursor",SC.Cursor.create())}h=!SC.none(h)?h:7;if(this._recalculateDivider===undefined&&i<1){this._recalculateDivider=YES}else{if(this._recalculateDivider){this._recalculateDivider=NO}}if(e[0]){g=(f===SC.LAYOUT_HORIZONTAL)?e[0].offsetWidth:e[0].offsetHeight}else{g=(f===SC.LAYOUT_HORIZONTAL)?c.width:c.height}if(SC.none(i)||(i>0&&i<1)){i=Math.floor((g-(h))*(i||0.5))}if(d===SC.RESIZE_BOTTOM_RIGHT){this._desiredTopLeftThickness=i}else{this._desiredTopLeftThickness=g-h-i}this._topLeftView=this.get("topLeftView");this._bottomRightView=this.get("bottomRightView");this._topLeftViewThickness=this.thicknessForView(this.get("topLeftView"));this._bottomRightThickness=this.thicknessForView(this.get("bottomRightView"));this._dividerThickness=this.get("dividerThickness");this._layoutDirection=this.get("layoutDirection");this._updateTopLeftThickness(0);this._setCursorStyle();this.updateChildLayout()}arguments.callee.base.apply(this,arguments)},render:function(a,b){arguments.callee.base.apply(this,arguments);if(this._inLiveResize){this._setCursorStyle()}if(this.get("layoutDirection")===SC.LAYOUT_HORIZONTAL){a.addClass("sc-horizontal")}else{a.addClass("sc-vertical")}},mouseDownInThumbView:function(a,c){var b=this.getPath("pane.rootResponder");if(!b){return NO}b.dragDidStart(this);this._mouseDownX=a.pageX;this._mouseDownY=a.pageY;this._thumbView=c;this._topLeftView=this.get("topLeftView");this._bottomRightView=this.get("bottomRightView");this._topLeftViewThickness=this.thicknessForView(this.get("topLeftView"));this._bottomRightThickness=this.thicknessForView(this.get("bottomRightView"));this._dividerThickness=this.get("dividerThickness");this._layoutDirection=this.get("layoutDirection");this.beginLiveResize();this._inLiveResize=YES;return YES},mouseDragged:function(a){var b=(this._layoutDirection===SC.LAYOUT_HORIZONTAL)?a.pageX-this._mouseDownX:a.pageY-this._mouseDownY;this._updateTopLeftThickness(b);return YES},mouseUp:function(a){if(this._inLiveResize===YES){this._thumbView=null;this._inLiveResize=NO;this.endLiveResize();return YES}this._setCursorStyle();return NO},touchesDragged:function(a){return this.mouseDragged(a)},touchEnd:function(a){return this.mouseUp(a)},doubleClickInThumbView:function(b,d){var a=this._topLeftView,c=a.get("isCollapsed")||NO;if(!c&&!this.canCollapseView(a)){a=this._bottomRightView;c=a.get("isCollapsed")||NO;if(!c&&!this.canCollapseView(a)){return NO}}if(!c){this._uncollapsedThickness=this.thicknessForView(a);if(a===this._topLeftView){this._updateTopLeftThickness(this.topLeftThickness()*-1)}else{this._updateBottomRightThickness(this.bottomRightThickness()*-1)}if(!a.get("isCollapsed")){this._uncollapsedThickness=null}}else{if(a===this._topLeftView){this._updateTopLeftThickness(this._uncollapsedThickness)}else{this._updateBottomRightThickness(this._uncollapsedThickness)}a._uncollapsedThickness=null}this._setCursorStyle();return true},_updateTopLeftThickness:function(e){var a=this._topLeftView,c=this._bottomRightView,f=this.thicknessForView(a),g=this.thicknessForView(c),j=this._dividerThickness,i=0,b=this._topLeftViewThickness+e,m=this._layoutDirection,o=this.canCollapseView(c),l=b,k=this.get("topLeftMaxThickness"),d=this.get("topLeftMinThickness"),n,h,p;if(!a.get("isCollapsed")){i+=f}if(!c.get("isCollapsed")){i+=g}if(!SC.none(k)){l=Math.min(k,l)}if(!SC.none(d)){l=Math.max(d,l)}k=this.get("bottomRightMaxThickness");d=this.get("bottomRightMinThickness");n=i-l;if(!SC.none(k)){n=Math.min(k,n)}if(!SC.none(d)){n=Math.max(d,n)}l=i-n;l=this.invokeDelegateMethod(this.delegate,"splitViewConstrainThickness",this,a,l);l=Math.min(l,i);l=Math.max(0,l);h=a.get("collapseAtThickness");if(!h){h=0}p=c.get("collapseAtThickness");p=SC.none(p)?i:(i-p);if((b<=h)&&this.canCollapseView(a)){k=c.get("maxThickness");if(!k||(j+i)<=k){l=0}}else{if(b>=p&&this.canCollapseView(c)){k=a.get("maxThickness");if(!k||(j+i)<=k){l=i}}}if(l!=this.thicknessForView(a)){this._desiredTopLeftThickness=l;a.set("isCollapsed",l===0);c.set("isCollapsed",l>=i);this.updateChildLayout();this.displayDidChange()}},_updateBottomRightThickness:function(e){var a=this._topLeftView,c=this._bottomRightView,f=this.thicknessForView(a),g=this.thicknessForView(c),j=this._dividerThickness,i=0,b=this._topLeftViewThickness+e,m=this._layoutDirection,o=this.canCollapseView(c),l=b,k=this.get("topLeftMaxThickness"),d=this.get("topLeftMinThickness"),n,h,p;if(!a.get("isCollapsed")){i+=f}if(!c.get("isCollapsed")){i+=g}if(!SC.none(k)){l=Math.min(k,l)}if(!SC.none(d)){l=Math.max(d,l)}k=this.get("bottomRightMaxThickness");d=this.get("bottomRightMinThickness");n=i-l;if(!SC.none(k)){n=Math.min(k,n)}if(!SC.none(d)){n=Math.max(d,n)}l=i-n;l=this.invokeDelegateMethod(this.delegate,"splitViewConstrainThickness",this,a,l);l=Math.min(l,i);l=Math.max(0,l);h=a.get("collapseAtThickness");if(!h){h=0}p=c.get("collapseAtThickness");p=SC.none(p)?i:(i-p);if((b<=h)&&this.canCollapseView(a)){k=c.get("maxThickness");if(!k||(j+i)<=k){l=0}}else{if(b>=p&&this.canCollapseView(c)){k=a.get("maxThickness");if(!k||(j+i)<=k){l=i}}}if(l!=this.thicknessForView(a)){this._desiredTopLeftThickness=l;a.set("isCollapsed",l===0);c.set("isCollapsed",l>=i);this.updateChildLayout();this.displayDidChange()}},_setCursorStyle:function(){var e=this._topLeftView,f=this._bottomRightView,b=this.get("thumbViewCursor"),c=this.thicknessForView(e),d=this.thicknessForView(f),a=this.get("dividerView");this._layoutDirection=this.get("layoutDirection");if(e.get("isCollapsed")||c===this.get("topLeftMinThickness")||d==this.get("bottomRightMaxThickness")){b.set("cursorStyle",this._layoutDirection===SC.LAYOUT_HORIZONTAL?"e-resize":"s-resize")}else{if(f.get("isCollapsed")||c===this.get("topLeftMaxThickness")||d==this.get("bottomRightMinThickness")){b.set("cursorStyle",this._layoutDirection===SC.LAYOUT_HORIZONTAL?"w-resize":"n-resize")}else{if(SC.browser.isIE){b.set("cursorStyle",this._layoutDirection===SC.LAYOUT_HORIZONTAL?"e-resize":"n-resize")}else{b.set("cursorStyle",this._layoutDirection===SC.LAYOUT_HORIZONTAL?"ew-resize":"ns-resize")}}}a.set("cursor",b);if(this._inLiveResize){this.set("cursor",b)}}.observes("layoutDirection"),splitViewCanCollapse:function(b,a){if(b.get("canCollapseViews")===NO){return NO}if(a.get("canCollapse")===NO){return NO}return YES},splitViewConstrainThickness:function(c,a,b){return b},_forceSplitCalculation:function(){this.updateLayout()}.observes("*pane.isPaneAttached"),viewDidResize:function(){arguments.callee.base.apply(this,arguments);this.notifyPropertyChange("topLeftThickness").notifyPropertyChange("bottomRightThickness")}.observes("layout")});SC.mixin(SC.View.prototype,{splitView:function(){var a=this;while(a&&!a.isSplitView){a=a.get("parentView")}return a}.property("parentView").cacheable()});sc_require("views/collection");SC.StackedView=SC.CollectionView.extend({classNames:["sc-stacked-view"],layout:{top:0,left:0,right:0,height:1},computeNowShowing:function(a){return this.get("allContentIndexes")},updateHeight:function(a){if(a){this._updateHeight()}else{this.invokeLast(this._updateHeight)}return this},_updateHeight:function(){var e=this.get("childViews"),b=e.get("length"),c,d,a;if(b===0){a=1}else{c=e.objectAt(b-1);d=c?c.get("layer"):null;a=d?(d.offsetTop+d.offsetHeight):1;d=null}this.adjust("height",a)},didReload:function(a){return this.updateHeight()},didCreateLayer:function(){return this.updateHeight()}});SC.StaticContentView=SC.View.extend(SC.StaticLayout,{classNames:["sc-static-content-view"],displayProperties:["content"],content:null,contentLayoutDidChange:function(){this._viewFrameDidChange()},useStaticLayout:YES,frame:function(){var a=this.get("layer"),b;if(!a){return{x:0,y:0,width:0,height:0}}if(a.getBoundingClientRect&&!SC.browser.isIE8OrLower){b=a.getBoundingClientRect();return{x:0,y:0,width:b.width,height:b.height}}else{return{x:0,y:0,width:a.clientWidth,height:a.clientHeight}}}.property("content").cacheable(),parentViewDidResize:function(){this.contentLayoutDidChange()},didUpdateLayer:function(){this.contentLayoutDidChange()},render:function(a,c){var b=this.get("content");a.push(b||"")},touchStart:function(a){a.allowDefault();return YES},touchEnd:function(a){a.allowDefault();return YES}});sc_require("views/segmented");SC.TOP_LOCATION="top";SC.TOP_TOOLBAR_LOCATION="top-toolbar";SC.BOTTOM_LOCATION="bottom";SC.TabView=SC.View.extend({classNames:["sc-tab-view"],displayProperties:["nowShowing"],nowShowing:null,items:[],isEnabled:YES,itemTitleKey:null,itemValueKey:null,itemIsEnabledKey:null,itemIconKey:null,itemWidthKey:null,itemToolTipKey:null,tabHeight:SC.REGULAR_BUTTON_HEIGHT,tabLocation:SC.TOP_LOCATION,userDefaultKey:null,_tab_nowShowingDidChange:function(){var a=this.get("nowShowing");this.get("containerView").set("nowShowing",a);this.get("segmentedView").set("value",a);return this}.observes("nowShowing"),_tab_saveUserDefault:function(){var a=this.get("nowShowing");var b=this.get("userDefaultKey");if(b){SC.userDefaults.set([b,"nowShowing"].join(":"),a)}}.observes("nowShowing"),_tab_itemsDidChange:function(){this.get("segmentedView").set("items",this.get("items"));return this}.observes("items"),init:function(){arguments.callee.base.apply(this,arguments);this._tab_nowShowingDidChange()._tab_itemsDidChange()},awake:function(){arguments.callee.base.apply(this,arguments);var a=this.get("userDefaultKey");if(a){a=[a,"nowShowing"].join(":");var b=SC.userDefaults.get(a);if(!SC.none(b)){this.set("nowShowing",b)}}},createChildViews:function(){var e=[],d,c,b=this.get("tabLocation"),a=this.get("tabHeight"),f=this.get("controlSize");if(b===SC.TOP_LOCATION){c={top:a/2+1,left:0,right:0,bottom:0,border:1}}else{if(b===SC.TOP_TOOLBAR_LOCATION){c={top:a+1,left:0,right:0,bottom:0,border:1}}else{c={top:0,left:0,right:0,bottom:(a/2)-1,border:1}}}d=this.containerView.extend({layout:c,ariaRole:"tabpanel"});this.containerView=this.createChildView(d);c=(b===SC.TOP_LOCATION||b===SC.TOP_TOOLBAR_LOCATION)?{height:a,left:0,right:0,top:0}:{height:a,left:0,right:0,bottom:0};this.segmentedView=this.get("segmentedView").extend({layout:c,controlSize:f,_sc_tab_segmented_valueDidChange:function(){var g=this.get("parentView");if(g){g.set("nowShowing",this.get("value"))}}.observes("value"),init:function(){var g=this.get("parentView");if(g){SC._TAB_ITEM_KEYS.forEach(function(h){this[h]=g.get(h)},this)}return arguments.callee.base.apply(this,arguments)}});this.segmentedView=this.createChildView(this.segmentedView);e.push(this.segmentedView);e.push(this.containerView);this.set("childViews",e);return this},containerView:SC.ContainerView.extend({renderDelegateName:"wellRenderDelegate"}),segmentedView:SC.SegmentedView});SC._TAB_ITEM_KEYS=["itemTitleKey","itemValueKey","itemIsEnabledKey","itemIconKey","itemWidthKey","itemToolTipKey","itemActionKey","itemTargetKey"];SC.ThumbView=SC.View.extend({classNames:["sc-thumb-view"],isEnabled:YES,isEnabledBindingDefault:SC.Binding.bool(),prepareContext:function(a,c){var b=this.get("splitView");if(b){this.set("cursor",b.get("thumbViewCursor"))}return arguments.callee.base.apply(this,arguments)},mouseDown:function(a){if(!this.get("isEnabled")){return NO}var b=this.get("splitView");return(b)?b.mouseDownInThumbView(a,this):arguments.callee.base.apply(this,arguments)},touchStart:function(a){return this.mouseDown(a)}});SC.WebView=SC.View.extend(SC.Control,{classNames:"sc-web-view",displayProperties:["value","shouldAutoResize"],shouldAutoResize:NO,render:function(a,d){var c=this.get("value"),b;if(d){a.push('<iframe src="'+c+'" style="position: absolute; width: 100%; height: 100%; border: 0px; margin: 0px; padding: 0px;"></iframe>')}else{if(c!==this._lastSrc){b=this.$("iframe");b.attr("src","javascript:;");b.attr("src",c)}}this._lastSrc=c},didCreateLayer:function(){var a=this.$("iframe");SC.Event.add(a,"load",this,this.iframeDidLoad)},willDestroyLayer:function(){var a=this.$("iframe");SC.Event.remove(a,"load",this,this.iframeDidLoad)},iframeDidLoad:function(){if(this.get("shouldAutoResize")===YES){var a;var c=this.$("iframe")[0];if(c&&c.contentWindow){a=c.contentWindow;if(a&&a.document&&a.document.documentElement){var b=a.document.documentElement;if(!SC.browser.isIE){this.$().width(b.scrollWidth);this.$().height(b.scrollHeight)}else{this.$().width(b.scrollWidth+12);this.$().height(b.scrollHeight+5)}}}}}});SC.WELL_CONTAINER_PADDING=15;SC.WellView=SC.ContainerView.extend({classNames:"sc-well-view",contentLayout:{top:SC.WELL_CONTAINER_PADDING,bottom:SC.WELL_CONTAINER_PADDING,left:SC.WELL_CONTAINER_PADDING,right:SC.WELL_CONTAINER_PADDING},renderDelegateName:"wellRenderDelegate",createChildViews:function(){var a=this.get("contentView");if(a){a=this.contentView=this.createChildView(a);a.set("layout",this.contentLayout);this.childViews=[a]}},contentViewDidChange:function(){var a=this.get("contentView");a.set("layout",this.contentLayout);this.replaceContent(a)}.observes("contentView")});SC.MIXED_STATE="__MIXED__";SC.DataSource=SC.Object.extend({fetch:function(a,b){return NO},retrieveRecords:function(a,c,b){return this._handleEach(a,c,this.retrieveRecord,b)},commitRecords:function(c,b,g,f,h){var e,a,d;if(b.length>0){d=this.createRecords.call(this,c,b,h)}if(g.length>0){e=this.updateRecords.call(this,c,g,h);d=SC.none(d)?e:(d===e)?d:SC.MIXED_STATE}if(f.length>0){a=this.destroyRecords.call(this,c,f,h);d=SC.none(d)?a:(d===a)?d:SC.MIXED_STATE}return d||NO},cancel:function(a,b){return NO},updateRecords:function(a,b,c){return this._handleEach(a,b,this.updateRecord,null,c)},createRecords:function(a,b,c){return this._handleEach(a,b,this.createRecord,null,c)},destroyRecords:function(a,b,c){return this._handleEach(a,b,this.destroyRecord,null,c)},_handleEach:function(h,e,c,a,b){var f=e.length,i,g,j,d;for(i=0;i<f;i++){d=a?a[i]:b;j=c.call(this,h,e[i],d);if(g===undefined){g=j}else{if(g===YES){g=(j===YES)?YES:SC.MIXED_STATE}else{if(g===NO){g=(j===NO)?NO:SC.MIXED_STATE}}}}return !SC.none(g)?g:null},updateRecord:function(a,b,c){return NO},retrieveRecord:function(a,b,c){return NO},createRecord:function(a,b,c){return NO},destroyRecord:function(a,b,c){return NO}});sc_require("data_sources/data_source");SC.CascadeDataSource=SC.DataSource.extend({dataSources:null,from:function(a){var b=this.get("dataSources");if(!b){this.set("dataSources",b=[])}b.push(a);return this},fetch:function(c,g){var e=this.get("dataSources"),b=e?e.length:0,d=NO,h,f,a;for(a=0;(d!==YES)&&a<b;a++){f=e.objectAt(a);h=f.fetch?f.fetch.apply(f,arguments):NO;d=this._handleResponse(d,h)}return d},retrieveRecords:function(h,d,b){var c=this.get("dataSources"),e=c?c.length:0,f=NO,i,a,g;for(g=0;(f!==YES)&&g<e;g++){a=c.objectAt(g);i=a.retrieveRecords.apply(a,arguments);f=this._handleResponse(f,i)}return f},commitRecords:function(j,c,h,e,d){var b=this.get("dataSources"),f=b?b.length:0,g=NO,k,a,i;for(i=0;(g!==YES)&&i<f;i++){a=b.objectAt(i);k=a.commitRecords.apply(a,arguments);g=this._handleResponse(g,k)}return g},cancel:function(c,f){var e=this.get("dataSources"),b=e?e.length:0,d=NO,h,g,a;for(a=0;(d!==YES)&&a<b;a++){g=e.objectAt(a);h=g.cancel.apply(g,arguments);d=this._handleResponse(d,h)}return d},init:function(){arguments.callee.base.apply(this,arguments);var b=this.get("dataSources"),a=b?b.get("length"):0,c;while(--a>=0){c=b[a];if(SC.typeOf(c)===SC.T_STRING){b[a]=this.get(c)}}},_handleResponse:function(b,a){if(a===YES){return YES}else{if(b===NO){return(a===NO)?NO:SC.MIXED_STATE}else{return SC.MIXED_STATE}}}});sc_require("core");sc_require("models/record");SC.Query=SC.Object.extend(SC.Copyable,SC.Freezable,{isQuery:YES,conditions:null,orderBy:null,recordType:null,recordTypes:null,expandedRecordTypes:function(){var b=SC.CoreSet.create(),a,c;if(a=this.get("recordType")){this._scq_expandRecordType(a,b)}else{if(a=this.get("recordTypes")){a.forEach(function(d){this._scq_expandRecordType(d,b)},this)}else{this._scq_expandRecordType(SC.Record,b)}}c=SC.Query._scq_queriesWithExpandedRecordTypes;if(!c){c=SC.Query._scq_queriesWithExpandedRecordTypes=SC.CoreSet.create()}c.add(this);return b.freeze()}.property("recordType","recordTypes").cacheable(),_scq_expandRecordType:function(b,a){if(a.contains(b)){return}a.add(b);if(SC.typeOf(b)===SC.T_STRING){b=SC.objectForPropertyPath(b)}b.subclasses.forEach(function(c){this._scq_expandRecordType(c,a)},this)},parameters:null,location:"local",scope:null,isRemote:function(){return this.get("location")===SC.Query.REMOTE}.property("location").cacheable(),isLocal:function(){return this.get("location")===SC.Query.LOCAL}.property("location").cacheable(),isEditable:NO,contains:function(a,d){var e,b=YES;if(e=this.get("recordTypes")){b=e.find(function(f){return SC.kindOf(a,f)})}else{if(e=this.get("recordType")){b=SC.kindOf(a,e)}}if(!b){return NO}var c=this.get("scope");if(c&&!c.contains(a)){return NO}if(!this._isReady){this.parse()}if(!this._isReady){return NO}if(d===undefined){d=this.parameters||this}return this._tokenTree.evaluate(a,d)},containsRecordTypes:function(a){var b=this.get("recordType");if(b){return !!a.find(function(c){return SC.kindOf(c,b)})}else{if(b=this.get("recordTypes")){return !!b.find(function(c){return !!a.find(function(d){return SC.kindOf(d,c)})})}else{return YES}}},compare:function(g,d){var c=0,f,b,a,h,e;if(g===d){return 0}if(!this._isReady){this.parse()}if(!this._isReady){return SC.compare(g.get("storeKey"),d.get("storeKey"))}b=this._order;if(SC.typeOf(b)===SC.T_FUNCTION){c=b.call(null,g,d)}else{a=b?b.length:0;for(h=0;c===0&&(h<a);h++){f=b[h].propertyName;e=/\./.test(f)?"getPath":"get";if(SC.Query.comparisons[f]){c=SC.Query.comparisons[f](g[e](f),d[e](f))}else{c=SC.compare(g[e](f),d[e](f))}if((c!==0)&&b[h].descending){c=(-1)*c}}}if(c!==0){return c}else{return SC.compare(g.get("storeKey"),d.get("storeKey"))}},_isReady:NO,parse:function(){var c=this.get("conditions"),d=this.get("queryLanguage"),b,a;b=this._tokenList=this.tokenizeString(c,d);a=this._tokenTree=this.buildTokenTree(b,d);this._order=this.buildOrder(this.get("orderBy"));this._isReady=!!a&&!a.error;if(a&&a.error){throw a.error}return this._isReady},queryWithScope:function(c){var b=SC.keyFor("__query__",SC.guidFor(this)),a=c[b];if(!a){c[b]=a=this.copy();a.set("scope",c);a.freeze()}return a},copyKeys:["conditions","orderBy","recordType","recordTypes","parameters","location","scope"],concatenatedProperties:["copyKeys"],copy:function(){var d={},c=this.get("copyKeys"),f=c?c.length:0,b,e,a;while(--f>=0){b=c[f];e=this.get(b);if(e!==undefined){d[b]=e}}a=this.constructor.create(d);d=null;return a},queryLanguage:{UNKNOWN:{firstCharacter:/[^\s'"\w\d\(\)\{\}]/,notAllowed:/[\-\s'"\w\d\(\)\{\}]/},PROPERTY:{firstCharacter:/[a-zA-Z_]/,notAllowed:/[^a-zA-Z_0-9\.]/,evalType:"PRIMITIVE",evaluate:function(e,b){var f=this.tokenValue.split(".");var a=f.length;if(a<2){return e.get(this.tokenValue)}var c=e;for(var d=0;d<a;d++){if(!c){return}if(c.get){c=c.get(f[d])}else{c=c[f[d]]}}return c}},NUMBER:{firstCharacter:/[\d\-]/,notAllowed:/[^\d\-\.]/,format:/^-?\d+$|^-?\d+\.\d+$/,evalType:"PRIMITIVE",evaluate:function(b,a){return parseFloat(this.tokenValue)}},STRING:{firstCharacter:/['"]/,delimited:true,evalType:"PRIMITIVE",evaluate:function(b,a){return this.tokenValue}},PARAMETER:{firstCharacter:/\{/,lastCharacter:"}",delimited:true,evalType:"PRIMITIVE",evaluate:function(b,a){return a[this.tokenValue]}},"%@":{rememberCount:true,reservedWord:true,evalType:"PRIMITIVE",evaluate:function(b,a){return a[this.tokenValue]}},OPEN_PAREN:{firstCharacter:/\(/,singleCharacter:true},CLOSE_PAREN:{firstCharacter:/\)/,singleCharacter:true},AND:{reservedWord:true,leftType:"BOOLEAN",rightType:"BOOLEAN",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return d&&b}},OR:{reservedWord:true,leftType:"BOOLEAN",rightType:"BOOLEAN",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return d||b}},NOT:{reservedWord:true,rightType:"BOOLEAN",evalType:"BOOLEAN",evaluate:function(c,a){var b=this.rightSide.evaluate(c,a);return !b}},"=":{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return SC.isEqual(d,b)}},"!=":{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return !SC.isEqual(d,b)}},"<":{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return SC.compare(d,b)==-1}},"<=":{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return SC.compare(d,b)!=1}},">":{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return SC.compare(d,b)==1}},">=":{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return SC.compare(d,b)!=-1}},BEGINS_WITH:{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var b=this.leftSide.evaluate(c,a);var d=this.rightSide.evaluate(c,a);return(b&&b.indexOf(d)===0)}},ENDS_WITH:{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(d,b){var c=this.leftSide.evaluate(d,b);var a=this.rightSide.evaluate(d,b);return(c&&c.length>=a.length&&c.lastIndexOf(a)===(c.length-a.length))}},CONTAINS:{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,a){var d=this.leftSide.evaluate(e,a)||[];var g=this.rightSide.evaluate(e,a);var c=SC.typeOf(d);if(c===SC.T_STRING){return(d.indexOf(g)!==-1)}else{if(c===SC.T_ARRAY||d.toArray){if(c!==SC.T_ARRAY){d=d.toArray()}var f=false;var b=0;while(f===false&&b<d.length){if(g==d[b]){f=true}b++}return f}}}},ANY:{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(d,a){var f=this.leftSide.evaluate(d,a);var b=this.rightSide.evaluate(d,a);var e=false;var c=0;while(e===false&&c<b.length){if(f==b[c]){e=true}c++}return e}},MATCHES:{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return b.test(d)}},TYPE_IS:{reservedWord:true,rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(d,a){var c=SC.Store.recordTypeFor(d.storeKey);var b=this.rightSide.evaluate(d,a);var e=SC.objectForPropertyPath(b);return c==e}},"null":{reservedWord:true,evalType:"PRIMITIVE",evaluate:function(b,a){return null}},"undefined":{reservedWord:true,evalType:"PRIMITIVE",evaluate:function(b,a){return undefined}},"false":{reservedWord:true,evalType:"PRIMITIVE",evaluate:function(b,a){return false}},"true":{reservedWord:true,evalType:"PRIMITIVE",evaluate:function(b,a){return true}},YES:{reservedWord:true,evalType:"PRIMITIVE",evaluate:function(b,a){return true}},NO:{reservedWord:true,evalType:"PRIMITIVE",evaluate:function(b,a){return false}}},tokenizeString:function(u,p){var j=[],r=null,g=null,f=null,s=null,a=null,h=null,d=null,v=null,q=false,b=false,l=false,m=false,n={};function e(t,c){g=p[t];if(g.format&&!g.format.test(c)){t="UNKNOWN"}if(g.delimited){m=true}if(!g.delimited){for(var i in p){if(p[i].reservedWord&&i==c){t=i}}}g=p[t];if(g&&g.rememberCount){if(!n[t]){n[t]=0}c=n[t];n[t]+=1}j.push({tokenType:t,tokenValue:c});a=null;h=null;d=null}if(!u){return[]}var k=u.length;for(var o=0;o<k;o++){q=(o===k-1);r=u.charAt(o);m=false;if(a){g=p[a];b=g.delimited?r===v:g.notAllowed.test(r);if(!b){d+=r}if(b||q){e(a,d)}if(q&&!b){m=true}}if(!a&&!m){for(f in p){g=p[f];if(g.firstCharacter&&g.firstCharacter.test(r)){a=f}}if(a){g=p[a];d=r;if(g.delimited){d="";if(g.lastCharacter){v=g.lastCharacter}else{v=r}}if(g.singleCharacter||q){e(a,d)}}}}return j},buildTokenTree:function(k,a){var o=k.slice();var q=0;var s=[];var c=false;var p=[];if(!k||k.length===0){return{evaluate:function(){return true}}}function r(i){var v=i;if(v<0){return false}var l=a[o[v].tokenType];if(!l){p.push("logic for token '"+o[v].tokenType+"' is not defined");return false}o[v].evaluate=l.evaluate;return l}function b(v,i){var w=i;var l=r(w);if(!l){return false}if(v=="left"){return l.leftType}if(v=="right"){return l.rightType}}function n(i){var v=i;var l=r(v);if(!l){return false}else{return l.evalType}}function f(i){o.splice(i,1);if(i<=q){q--}}function t(i){var l=i||q;if(l>0){return true}else{return false}}function j(i){var l=i;if(l<0){return true}return(b("left",l)&&!o[l].leftSide)||(b("right",l)&&!o[l].rightSide)}function h(l,v){var i=(v<l)?"left":"right";if(l<0||v<0){return false}if(!b(i,l)){return false}if(!n(v)){return false}if(b(i,l)==n(v)){return true}else{return false}}function m(i){var l=i;if(!j(l)){return false}if(!t(l)){return false}if(h(l,l-1)){return true}else{return false}}function d(i){var l=i;if(j(l)){return false}if(!t(l)){return false}if(!j(l-1)){return false}if(h(l-1,l)){return true}else{return false}}function g(i){var l=i;if(l<1){return false}o[l].leftSide=o[l-1];f(l-1)}function u(i){var l=i;if(l<1){return false}o[l-1].rightSide=o[l];f(l)}function e(i){f(i);f(s.pop())}for(q=0;q<o.length;q++){c=false;if(o[q].tokenType=="UNKNOWN"){p.push("found unknown token: "+o[q].tokenValue)}if(o[q].tokenType=="OPEN_PAREN"){s.push(q)}if(o[q].tokenType=="CLOSE_PAREN"){e(q)}if(m(q)){g(q)}if(d(q)){u(q);c=true}if(c){q--}}if(o.length==1){o=o[0]}else{p.push("string did not resolve to a single tree")}if(p.length>0){return{error:p.join(",\n"),tree:o}}else{return o}},buildOrder:function(a){if(!a){return[]}else{if(SC.typeOf(a)===SC.T_FUNCTION){return a}else{var d=a.split(",");for(var b=0;b<d.length;b++){var c=d[b];c=c.replace(/^\s+|\s+$/,"");c=c.replace(/\s+/,",");c=c.split(",");d[b]={propertyName:c[0]};if(c[1]&&c[1]=="DESC"){d[b].descending=true}}return d}}}});SC.Query.mixin({LOCAL:"local",REMOTE:"remote",storeKeyFor:function(a){return a?a.get("storeKey"):null},containsRecords:function(g,e,d){var f=[];for(var b=0,a=e.get("length");b<a;b++){var c=e.objectAt(b);if(c&&g.contains(c)){f.push(c.get("storeKey"))}}f=SC.Query.orderStoreKeys(f,g,d);return f},orderStoreKeys:function(c,d,a){if(c){var b=c.sort(function(f,e){return SC.Query.compareStoreKeys(d,a,f,e)})}return c},compareStoreKeys:function(f,c,e,d){var b=c.materializeRecord(e),a=c.materializeRecord(d);return f.compare(b,a)},build:function(h,c,g,d){var a=null,f,b,i,e;if(c&&c.isQuery){if(c.get("location")===h){return c}else{return c.copy().set("location",h).freeze()}}if(typeof c===SC.T_STRING){f=SC.objectForPropertyPath(c);if(!f){throw"%@ did not resolve to a class".fmt(c)}c=f}else{if(c&&c.isEnumerable){f=[];c.forEach(function(j){if(typeof j===SC.T_STRING){j=SC.objectForPropertyPath(j)}if(!j){throw"cannot resolve record types: %@".fmt(c)}f.push(j)},this);c=f}else{if(!c){c=SC.Record}}}if(d===undefined){d=null}if(g===undefined){g=null}if(!d&&(typeof g!==SC.T_STRING)){a=g;g=null}if(!d&&!a){e=SC.Query._scq_recordTypeCache;if(!e){e=SC.Query._scq_recordTypeCache={}}b=e[h];if(!b){b=e[h]={}}if(c.isEnumerable){i=c.map(function(j){return SC.guidFor(j)});i=i.sort().join(":")}else{i=SC.guidFor(c)}if(g){i=[i,g].join("::")}f=b[i];if(!f){if(c.isEnumerable){a={recordTypes:c.copy()}}else{a={recordType:c}}a.location=h;a.conditions=g;f=b[i]=SC.Query.create(a).freeze()}}else{if(!a){a={}}if(!a.location){a.location=h}if(c&&c.isEnumerable){a.recordTypes=c}else{a.recordType=c}if(g){a.conditions=g}if(d){a.parameters=d}f=SC.Query.create(a).freeze()}return f},local:function(c,a,b){return this.build(SC.Query.LOCAL,c,a,b)},remote:function(c,a,b){return this.build(SC.Query.REMOTE,c,a,b)},_scq_didDefineRecordType:function(){var a=SC.Query._scq_queriesWithExpandedRecordTypes;if(a){a.forEach(function(b){b.notifyPropertyChange("expandedRecordTypes")},this);a.clear()}}});SC.Query.comparisons={};SC.Query.registerComparison=function(a,b){SC.Query.comparisons[a]=b};SC.Query.registerQueryExtension=function(b,a){SC.Query.prototype.queryLanguage[b]=a};SC.Q=SC.Query.from;sc_require("system/query");SC.Record=SC.Object.extend({isRecord:YES,isParentRecord:NO,primaryKey:"guid",id:function(a,b){if(b!==undefined){this.writeAttribute(this.get("primaryKey"),b);return b}else{return SC.Store.idFor(this.storeKey)}}.property("storeKey").cacheable(),status:function(){return this.store.readStatus(this.storeKey)}.property("storeKey").cacheable(),store:null,storeKey:null,isDestroyed:function(){return !!(this.get("status")&SC.Record.DESTROYED)}.property("status").cacheable(),isEditable:function(a,b){if(b!==undefined){this._screc_isEditable=b}if(this.get("status")&SC.Record.READY){return this._screc_isEditable}else{return NO}}.property("status").cacheable(),_screc_isEditable:YES,isLoaded:function(){var b=SC.Record,a=this.get("status");return !((a===b.EMPTY)||(a===b.BUSY_LOADING)||(a===b.ERROR))}.property("status").cacheable(),relationships:null,attributes:function(){var a=this.get("store"),b=this.storeKey;return a.readEditableDataHash(b)}.property(),readOnlyAttributes:function(){var a=this.get("store"),c=this.storeKey,b=a.readDataHash(c);if(b){b=SC.clone(b,YES)}return b}.property(),nestedRecordNamespace:null,isNestedRecord:function(){var c=this.get("store"),d,b=this.get("storeKey"),a=c.parentStoreKeyExists(b);d=a?YES:NO;return d}.property().cacheable(),parentRecord:function(){var a=this.storeKey,b=this.get("store");return b.materializeParentRecord(a)}.property(),refresh:function(e,g){var c=this.get("store"),f,d,b=this.get("storeKey"),a=c.parentStoreKeyExists();d=e||(SC.none(e)&&SC.none(a));if(d){c.refreshRecord(null,null,b,g)}else{if(a){f=c.materializeRecord(a);f.refresh(e,g)}}return this},destroy:function(e){var c=this.get("store"),f,d,b=this.get("storeKey"),a=c.parentStoreKeyExists();d=e||(SC.none(e)&&SC.none(a));if(d){c.destroyRecord(null,null,b);this.notifyPropertyChange("status");this.propagateToAggregates()}else{if(a){f=c.materializeRecord(a);f.destroy(e)}}return this},recordDidChange:function(a){var b=this.get("parentRecord");if(b){b.recordDidChange()}this.get("store").recordDidChange(null,null,this.get("storeKey"),a);this.notifyPropertyChange("status");this.propagateToAggregates();return this},toJSON:function(){return this.get("attributes")},_editLevel:0,beginEditing:function(){this._editLevel++;return this},endEditing:function(a){if(--this._editLevel<=0){this._editLevel=0;this.recordDidChange(a)}return this},readAttribute:function(c){var a=this.get("store"),d=this.storeKey;var b=a.readDataHash(d);return b?b[c]:undefined},writeAttribute:function(c,f,e){var a=this.get("store"),d=this.storeKey,b;b=a.readEditableDataHash(d);if(!b){throw SC.Record.BAD_STATE_ERROR}if(f!==b[c]){if(!e){this.beginEditing()}b[c]=f;if(c===this.get("primaryKey")){SC.Store.replaceIdFor(d,f);this.propertyDidChange("id")}if(!e){this.endEditing(c)}else{a.dataHashDidChange(d,null,undefined,c)}}return this},propagateToAggregates:function(){var m=this.get("storeKey"),d=SC.Store.recordTypeFor(m),f=d.__sc_aggregate_keys,k,g,l,b,c,j;if(!f){f=[];for(l in this){b=this[l];if(b&&b.isRecordAttribute&&b.aggregate===YES){f.push(l)}}d.__sc_aggregate_keys=f}var i=SC.Record,a=i.DIRTY,e=i.READY_NEW,n=i.DESTROYED,o=i.READY_CLEAN,h;h=function(t){var p,q,r,s;if(t){p=this.get("status");if((p&a)||(p&e)||(p&n)){q=t.get("store");r=t.get("storeKey");s=q.peekStatus(r);if(s===o){t.get("store").recordDidChange(t.constructor,null,t.get("storeKey"),null,YES)}}}};for(k=0,g=f.length;k<g;++k){l=f[k];c=this.get(l);j=SC.kindOf(c,SC.ManyArray)?c:[c];j.forEach(h,this)}},storeDidChangeProperties:function(a,b){if(a){this.notifyPropertyChange("status")}else{if(b){this.beginPropertyChanges();b.forEach(function(e){this.notifyPropertyChange(e)},this);this.notifyPropertyChange("status");this.endPropertyChanges()}else{this.allPropertiesDidChange()}var d=this.relationships,c=d?d.length:0;while(--c>=0){d[c].recordPropertyDidChange(b)}}},normalize:function(a){var c=this.primaryKey,b=this.get("id"),f=this.get("store"),e=this.get("storeKey"),i={},r,o,d,q,j,p,l,g,n,h,m;var k=f.readEditableDataHash(e)||{};k[c]=b;q=f.readDataHash(e);for(r in this){o=this[r];if(o){d=o.typeClass;if(d){h=o.get("key")||r;i[h]=YES;l=SC.typeOf(d.call(o))===SC.T_CLASS;g=o.isNestedRecordTransform;if(!l&&!g){j=this.get(r);if(j!==undefined&&(j!==null||a)){m=this[r];if(SC.instanceOf(m,SC.RecordAttribute)){j=m.fromType(this,r,j)}k[h]=j}else{if(!a){i[h]=NO}}}else{if(g){j=this.get(r);if(j&&j.normalize){j.normalize()}}else{if(l){j=q[h];if(j!==undefined){k[h]=j}else{n=o.get("defaultValue");if(SC.typeOf(n)===SC.T_FUNCTION){k[h]=n(this,r,n)}else{k[h]=n}}}}}}}}for(r in k){if(!i[r]){SC.debug("%@:  Deleting key from underlying data hash due to normalization:  %@",this,r);delete k[r]}}return this},unknownProperty:function(b,d){if(d!==undefined){var c=this.get("storeKey"),e=SC.Store.recordTypeFor(c);if(e.ignoreUnknownProperties===YES){this[b]=d;return d}var a=this.get("primaryKey");this.writeAttribute(b,d);if(b===a){SC.Store.replaceIdFor(c,d)}}return this.readAttribute(b)},commitRecord:function(g,e,h){var c=this.get("store"),f,d,b=this.get("storeKey"),a=c.parentStoreKeyExists();d=e||(SC.none(e)&&SC.none(a));if(d){c.commitRecord(undefined,undefined,this.get("storeKey"),g,h)}else{if(a){f=c.materializeRecord(a);f.commitRecord(g,e,h)}}return this},isError:function(){return !!(this.get("status")&SC.Record.ERROR)}.property("status").cacheable(),errorValue:function(){return this.get("isError")?SC.val(this.get("errorObject")):null}.property("isError").cacheable(),errorObject:function(){if(this.get("isError")){var a=this.get("store");return a.readError(this.get("storeKey"))||SC.Record.GENERIC_ERROR}else{return null}}.property("isError").cacheable(),set:function(a,c){var b=this[a];if(b&&b.isProperty&&b.get&&!b.get("isEditable")){return this}return arguments.callee.base.apply(this,arguments)},toString:function(){var a=this.get("store").readDataHash(this.get("storeKey"));return"%@(%@) %@".fmt(this.constructor.toString(),SC.inspect(a),this.statusString())},statusString:function(){var b=[],a=this.get("status");for(var c in SC.Record){if(c.match(/[A-Z_]$/)&&SC.Record[c]===a){b.push(c)}}return b.join(" ")},registerNestedRecord:function(f,e,g){var c,d=this.get("storeKey"),b,a,h;if(SC.none(g)){g=e}if(f&&f.get&&f.get("isRecord")){a=f}else{h=this._materializeNestedRecordType(f,e);a=this.createNestedRecord(h,f,d,g)}if(a){this.isParentRecord=YES;c=this.get("store");b=a.get("storeKey");c.registerChildToParent(d,b,g)}return a},unregisterNestedRecord:function(d){var b,a,c;c=this.get("store");b=this.getPath(d);a=b.get("storeKey");c.unregisterChildFromParent(a)},_materializeNestedRecordType:function(d,c){var a,e,b;if(SC.typeOf(d)===SC.T_HASH){a=this.get("nestedRecordNamespace");if(d.type&&!SC.none(a)){e=a[d.type]}}if(!e&&c&&this[c]){e=this[c].get("typeClass")}if(!e||!SC.kindOf(e,SC.Record)){throw"SC.Child: Error during transform: Invalid record type."}return e},createNestedRecord:function(b,e,g,i){var h=this.get("store"),a,c,d,f=null;e=e||{};if(SC.none(h)){throw"Error: during the creation of a child record: NO STORE ON PARENT!"}a=e[b.prototype.primaryKey];if(!a){this.generateIdForChild(f)}if(!a){a=g+"."+i}c=h.storeKeyExists(b,a);if(c){h.writeDataHash(c,e);f=h.materializeRecord(c)}else{f=h.createRecord(b,e,a)}return f},_nestedRecordKey:0,generateIdForChild:function(a){}});SC.Record.mixin({ignoreUnknownProperties:NO,CLEAN:1,DIRTY:2,EMPTY:256,ERROR:4096,READY:512,READY_CLEAN:513,READY_DIRTY:514,READY_NEW:515,DESTROYED:1024,DESTROYED_CLEAN:1025,DESTROYED_DIRTY:1026,BUSY:2048,BUSY_LOADING:2052,BUSY_CREATING:2056,BUSY_COMMITTING:2064,BUSY_REFRESH:2080,BUSY_REFRESH_CLEAN:2081,BUSY_REFRESH_DIRTY:2082,BUSY_DESTROYING:2112,BAD_STATE_ERROR:SC.$error("Internal Inconsistency"),RECORD_EXISTS_ERROR:SC.$error("Record Exists"),NOT_FOUND_ERROR:SC.$error("Not found "),BUSY_ERROR:SC.$error("Busy"),GENERIC_ERROR:SC.$error("Generic Error"),_nextChildKey:0,attr:function(a,b){return SC.RecordAttribute.attr(a,b)},fetch:function(b,a){return SC.FetchedAttribute.attr(b,a)},toMany:function(d,b){b=b||{};var c=b.nested||b.isNested;var a;this._throwUnlessRecordTypeDefined(d,"toMany");if(c){a=SC.ChildrenAttribute.attr(d,b)}else{a=SC.ManyAttribute.attr(d,b)}return a},toOne:function(d,b){b=b||{};var c=b.nested||b.isNested;var a;this._throwUnlessRecordTypeDefined(d,"toOne");if(c){a=SC.ChildAttribute.attr(d,b)}else{a=SC.SingleAttribute.attr(d,b)}return a},_throwUnlessRecordTypeDefined:function(b,a){if(!b){throw"Attempted to create "+a+" attribute with undefined recordType. Did you forget to sc_require a dependency?"}},storeKeysById:function(){var b=SC.keyFor("storeKey",SC.guidFor(this)),a=this[b];if(!a){a=this[b]={}}return a},storeKeyFor:function(c){var b=this.storeKeysById(),a=b[c];if(!a){a=SC.Store.generateStoreKey();SC.Store.idsByStoreKey[a]=c;SC.Store.recordTypesByStoreKey[a]=this;b[c]=a}return a},storeKeyExists:function(c){var b=this.storeKeysById(),a=b[c];return a},find:function(a,b){return a.find(this,b)},extend:function(){var a=SC.Object.extend.apply(this,arguments);if(SC.Query){SC.Query._scq_didDefineRecordType(a)}return a}});sc_require("data_sources/data_source");sc_require("models/record");SC.FixturesDataSource=SC.DataSource.extend({simulateRemoteResponse:NO,latency:50,cancel:function(a,b){return NO},fetch:function(a,b){if(b.get("location")!==SC.Query.LOCAL){throw SC.$error("SC.Fixture data source can only fetch local queries")}if(!b.get("recordType")&&!b.get("recordTypes")){throw SC.$error("SC.Fixture data source can only fetch queries with one or more record types")}if(this.get("simulateRemoteResponse")){this.invokeLater(this._fetch,this.get("latency"),a,b)}else{this._fetch(a,b)}},_fetch:function(a,c){var d=c.get("recordType"),b=c.get("recordTypes")||[d];b.forEach(function(e){if(SC.typeOf(e)===SC.T_STRING){e=SC.objectForPropertyPath(e)}if(e){this.loadFixturesFor(a,e)}},this);a.dataSourceDidFetchQuery(c)},retrieveRecords:function(a,c){var d=this.get("latency"),b=this.hasFixturesFor(c);if(!b){return b}if(this.get("simulateRemoteResponse")){this.invokeLater(this._retrieveRecords,d,a,c)}else{this._retrieveRecords(a,c)}return b},_retrieveRecords:function(a,b){b.forEach(function(d){var c=[],g=SC.Store.recordTypeFor(d),f=a.idFor(d),e=this.fixtureForStoreKey(a,d);c.push(d);a.dataSourceDidComplete(d,e,f)},this)},updateRecords:function(a,c,e){var d=this.get("latency"),b=this.hasFixturesFor(c);if(!b){return b}if(this.get("simulateRemoteResponse")){this.invokeLater(this._updateRecords,d,a,c)}else{this._updateRecords(a,c)}return b},_updateRecords:function(a,b){b.forEach(function(c){var d=a.readDataHash(c);this.setFixtureForStoreKey(a,c,d);a.dataSourceDidComplete(c)},this)},createRecords:function(a,b,d){var c=this.get("latency");if(this.get("simulateRemoteResponse")){this.invokeLater(this._createRecords,c,a,b)}else{this._createRecords(a,b)}return YES},_createRecords:function(a,b){b.forEach(function(e){var g=a.idFor(e),f=a.recordTypeFor(e),d=a.readDataHash(e),c=this.fixturesFor(f);if(!g){g=this.generateIdFor(f,d,a,e)}this._invalidateCachesFor(f,e,g);c[g]=d;a.dataSourceDidComplete(e,null,g)},this)},destroyRecords:function(a,c,e){var d=this.get("latency"),b=this.hasFixturesFor(c);if(!b){return b}if(this.get("simulateRemoteResponse")){this.invokeLater(this._destroyRecords,d,a,c)}else{this._destroyRecords(a,c)}return b},_destroyRecords:function(a,b){b.forEach(function(d){var f=a.idFor(d),e=a.recordTypeFor(d),c=this.fixturesFor(e);this._invalidateCachesFor(e,d,f);if(f){delete c[f]}a.dataSourceDidDestroy(d)},this)},loadFixturesFor:function(a,g,c){var b=[],e,d,f;e=this.fixturesFor(g);for(d in e){f=g.storeKeyFor(d);if(a.peekStatus(f)===SC.Record.EMPTY){b.push(e[d])}if(c){c.push(f)}}if(b&&b.length>0){a.loadRecords(g,b)}return this},generateIdFor:function(d,b,a,c){return"@id%@".fmt(SC.Store.generateStoreKey())},fixtureForStoreKey:function(a,c){var e=a.idFor(c),d=a.recordTypeFor(c),b=this.fixturesFor(d);return b?b[e]:null},setFixtureForStoreKey:function(a,d,c){var f=a.idFor(d),e=a.recordTypeFor(d),b=this.fixturesFor(e);this._invalidateCachesFor(e,d,f);b[f]=c;return this},fixturesFor:function(h){if(!this._fixtures){this._fixtures={}}var f=this._fixtures[SC.guidFor(h)];if(f){return f}var e=h?h.FIXTURES:null,b=e?e.length:0,c=h?h.prototype.primaryKey:"guid",a,d,g;this._fixtures[SC.guidFor(h)]=f={};for(a=0;a<b;a++){d=e[a];g=d[c];if(!g){g=this.generateIdFor(h,d)}f[g]=d}return f},fixturesLoadedFor:function(c){if(!this._fixtures){return NO}var a=[],b=this._fixtures[SC.guidFor(c)];return b?YES:NO},reset:function(){this._fixtures=null;return this},hasFixturesFor:function(b){var a=NO;b.forEach(function(d){if(a!==SC.MIXED_STATE){var e=SC.Store.recordTypeFor(d),c=e?e.FIXTURES:null;if(c&&c.length&&c.length>0){if(a===NO){a=YES}}else{if(a===YES){a=SC.MIXED_STATE}}}},this);return a},_invalidateCachesFor:function(d,b,c){var a=this._storeKeyCache;if(a){delete a[SC.guidFor(d)]}return this}});SC.Record.fixtures=SC.FixturesDataSource.create();SC.RelationshipSupport={_srs_inverseDidRelinquishRelationships:function(d,c,a,b){c.forEach(function(e){this._srs_inverseDidRelinquishRelationship(d,e,a,b)},this)},_srs_inverseDidRelinquishRelationship:function(h,g,f,b){var e=h.storeKeyFor(g),c=this.readDataHash(e),a=f.inverse,d=h.prototype;if(!c||!a){return}if(SC.instanceOf(d[a],SC.SingleAttribute)){delete c[a]}else{if(SC.instanceOf(d[a],SC.ManyAttribute)&&SC.typeOf(c[a])===SC.T_ARRAY){c[a].removeObject(b)}}this.pushRetrieve(h,g,c,undefined,true)},_srs_inverseDidAddRelationships:function(d,c,a,b){c.forEach(function(e){this._srs_inverseDidAddRelationship(d,e,a,b)},this)},_srs_inverseDidAddRelationship:function(b,a,i,k){var j=b.storeKeyFor(a),g=this.readDataHash(j),d=this.peekStatus(j),f=b.prototype,h=i.inverse,l=f[h],c=f[f.primaryKey],e=false;l=(l&&l.get&&l.get("key")||l.key)||h;if((d===SC.Record.EMPTY)&&(SC.typeOf(i.lazilyInstantiate)===SC.T_FUNCTION&&i.lazilyInstantiate()||SC.typeOf(i.lazilyInstantiate)!==SC.T_FUNCTION&&i.lazilyInstantiate)){if(!SC.none(c)&&c.typeClass&&SC.typeOf(c.typeClass())===SC.T_CLASS){e=true}g={};g[f.primaryKey]=a}if(!g||!h){return}if(SC.instanceOf(f[h],SC.SingleAttribute)){g[l]=k}else{if(SC.instanceOf(f[h],SC.ManyAttribute)){g[l]=g[l]||[];if(g[l].indexOf(k)<0){g[l].push(k)}}}this.pushRetrieve(b,a,g,undefined,!e)},_srs_pushIterator:function(d,b,i,f){var e=d.prototype,g,c,h,a;if(typeof i==="undefined"){i=d.storeKeyFor(b)}c=this.readDataHash(i)||{};for(h in e){g=e[h];if(g&&g.typeClass&&g.inverse&&g.isMaster){a=g.typeClass();if(SC.typeOf(a)!==SC.T_CLASS){continue}f.apply(this,[a,c,g,g.get&&g.get("key")||h])}}},pushDestroy:function(a,e,d,c){var b;this._srs_pushIterator(e,d,c,function(f,g,i,h){b=[g[h]||null].flatten().compact().uniq();this._srs_inverseDidRelinquishRelationships(f,b,i,d)});return a(e,d,c)}.enhance(),pushRetrieve:function(b,h,g,c,e,f){if(!f){var d,a;this._srs_pushIterator(h,g,e,function(i,j,l,k){d=[j[k]||null].flatten().compact().uniq();a=[c[k]||null].flatten().compact().uniq();this._srs_inverseDidRelinquishRelationships(i,d.filter(function(m){return a.indexOf(m)===-1}),l,g);this._srs_inverseDidAddRelationships(i,a,l,g)})}e=e||h.storeKeyFor(g);return b(h,g,c,e)}.enhance()};sc_require("models/record");SC.RecordAttribute=SC.Object.extend({isRecordAttribute:YES,defaultValue:null,type:String,key:null,isRequired:NO,isEditable:YES,useIsoDate:YES,aggregate:NO,lazilyInstantiate:NO,typeClass:function(){var a=this.get("type");if(SC.typeOf(a)===SC.T_STRING){a=SC.requiredObjectForPropertyPath(a)}return a}.property("type").cacheable(),transform:function(){var a=this.get("typeClass")||String,c=SC.RecordAttribute.transforms,b;while(a&&!(b=c[SC.guidFor(a)])){if(a.superclass.hasOwnProperty("create")){a=a.superclass}else{a=SC.T_FUNCTION}}return b}.property("typeClass").cacheable(),toType:function(e,j,h){var c=this.get("transform"),g=this.get("typeClass"),b;if(c&&c.to){h=c.to(h,this,g,e,j);if(!SC.none(h)&&(b=c.observesChildren)){var d,f=b.length,a={record:e,key:j};for(d=0;d<f;d++){h.addObserver(b[d],this,this._SCRA_childObserver,a)}}}return h},_SCRA_childObserver:function(d,b,c,a){this.call(a.record,a.key,d);a.record.notifyPropertyChange(a.key)},fromType:function(a,c,e){var b=this.get("transform"),d=this.get("typeClass");if(b&&b.from){e=b.from(e,this,d,a,c)}return e},call:function(a,b,c){var d=this.get("key")||b,e;if((c!==undefined)&&this.get("isEditable")){e=this.fromType(a,b,c);a.writeAttribute(d,e)}c=a.readAttribute(d);if(SC.none(c)&&(c=this.get("defaultValue"))){if(typeof c===SC.T_FUNCTION){c=c(a,b,this)}}c=this.toType(a,b,c);return c},apply:function(b,a){return this.call.apply(b,a)},isProperty:YES,isCacheable:YES,dependentKeys:[],init:function(){arguments.callee.base.apply(this,arguments);this.cacheKey="__cache__recattr__"+SC.guidFor(this);this.lastSetValueKey="__lastValue__recattr__"+SC.guidFor(this)}});SC.RecordAttribute.mixin({attr:function(a,b){if(!b){b={}}if(!b.type){b.type=a||String}return this.create(b)},transforms:{},registerTransform:function(a,b){SC.RecordAttribute.transforms[SC.guidFor(a)]=b}});SC.RecordAttribute.registerTransform(Boolean,{to:function(a){return SC.none(a)?null:!!a}});SC.RecordAttribute.registerTransform(Number,{to:function(a){return SC.none(a)?null:Number(a)}});SC.RecordAttribute.registerTransform(String,{to:function(a){if(!(typeof a===SC.T_STRING)&&!SC.none(a)&&a.toString){a=a.toString()}return a}});SC.RecordAttribute.registerTransform(Array,{to:function(a){if(!SC.isArray(a)&&!SC.none(a)){a=[]}return a},observesChildren:["[]"]});SC.RecordAttribute.registerTransform(Object,{to:function(a){if(!(typeof a==="object")&&!SC.none(a)){a={}}return a}});SC.RecordAttribute.registerTransform(SC.Record,{to:function(e,a,d,c){var b=c.get("store");if(SC.none(e)||(e==="")){return null}else{return b.find(d,e)}},from:function(a){return a?a.get("id"):null}});SC.RecordAttribute.registerTransform(SC.T_FUNCTION,{to:function(e,a,d,c){d=d.apply(c);var b=c.get("store");return b.find(d,e)},from:function(a){return a.get("id")}});SC.RecordAttribute.registerTransform(Date,{to:function(i,a){if(SC.none(i)){return i}var c;i=i.toString()||"";if(a.get("useIsoDate")){var e="([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?",h=i.match(new RegExp(e)),g=0,b=new Date(h[1],0,1),f;if(h[3]){b.setMonth(h[3]-1)}if(h[5]){b.setDate(h[5])}if(h[7]){b.setHours(h[7])}if(h[8]){b.setMinutes(h[8])}if(h[10]){b.setSeconds(h[10])}if(h[12]){b.setMilliseconds(Number("0."+h[12])*1000)}if(h[14]){g=(Number(h[16])*60)+Number(h[17]);g*=((h[15]==="-")?1:-1)}g-=b.getTimezoneOffset();f=(Number(b)+(g*60*1000));c=new Date();c.setTime(Number(f))}else{c=new Date(Date.parse(i))}return c},_dates:{},_zeropad:function(a){return((a<0)?"-":"")+((a<10)?"0":"")+Math.abs(a)},from:function(b){if(SC.none(b)){return null}var a=this._dates[b.getTime()];if(a){return a}var d=this._zeropad,c=0-b.getTimezoneOffset()/60;c=(c===0)?"Z":"%@:00".fmt(d(c));this._dates[b.getTime()]=a="%@-%@-%@T%@:%@:%@%@".fmt(d(b.getFullYear()),d(b.getMonth()+1),d(b.getDate()),d(b.getHours()),d(b.getMinutes()),d(b.getSeconds()),c);return a}});if(SC.DateTime&&!SC.RecordAttribute.transforms[SC.guidFor(SC.DateTime)]){SC.RecordAttribute.registerTransform(SC.DateTime,{to:function(c,a){if(a.get("useUnixTime")){if(SC.typeOf(c)===SC.T_STRING){c=parseInt(c)}if(isNaN(c)||SC.typeOf(c)!==SC.T_NUMBER){c=0}return SC.DateTime.create({milliseconds:c*1000,timezone:0})}if(SC.none(c)||SC.instanceOf(c,SC.DateTime)){return c}if(SC.none(c)||SC.instanceOf(c,Date)){return SC.DateTime.create(c.getTime())}var b=a.get("format");return SC.DateTime.parse(c,b?b:SC.DateTime.recordFormat)},from:function(b,a){if(SC.none(b)){return b}if(a.get("useUnixTime")){return b.get("milliseconds")/1000}var c=a.get("format");return b.toFormattedString(c?c:SC.DateTime.recordFormat)}})}SC.RecordAttribute.registerTransform(SC.Set,{to:function(e,a,d,b,c){return SC.Set.create(e)},from:function(e,a,d,b,c){return e.toArray()},observesChildren:["[]"]});sc_require("models/record");sc_require("models/record_attribute");SC.ChildAttribute=SC.RecordAttribute.extend({isNestedRecordTransform:YES,toType:function(b,d,e){var c=null,a,f=this.get("typeClass");if(!b){throw"SC.Child: Error during transform: Unable to retrieve parent record."}if(!SC.none(e)){c=b.registerNestedRecord(e,d)}return c},fromType:function(b,e,f){var a,c,d;if(b){if(b.readAttribute(e)){b.unregisterNestedRecord(e)}if(SC.none(f)){b.writeAttribute(e,f);d=f}else{d=b.registerNestedRecord(f,e);if(d){a=d.get("storeKey");c=d.get("store");b.writeAttribute(e,c.readDataHash(a))}else{if(f){b.writeAttribute(e,f)}}}}return d},call:function(a,b,c){var d=this.get("key")||b;if(c!==undefined){c=this.fromType(a,b,c)}else{c=a.readAttribute(d);if(SC.none(c)&&(c=this.get("defaultValue"))){if(typeof c===SC.T_FUNCTION){c=this.defaultValue(a,b,this);if(a.attributes()){a.writeAttribute(d,c,true)}}}else{c=this.toType(a,b,c)}}return c}});sc_require("models/record");SC.ChildRecord=SC.Record.extend({});SC.ChildRecord.extend=function(){return SC.Record.extend.apply(this,arguments)};SC.ChildArray=SC.Object.extend(SC.Enumerable,SC.Array,{defaultRecordType:null,record:null,propertyName:null,children:null,store:function(){return this.getPath("record.store")}.property("record").cacheable(),storeKey:function(){return this.getPath("record.storeKey")}.property("record").cacheable(),readOnlyChildren:function(){return this.get("record").readAttribute(this.get("propertyName"))}.property(),editableChildren:function(){var a=this.get("store"),d=this.get("storeKey"),c=this.get("propertyName"),b,e;b=a.readEditableProperty(d,c);if(!b){e=a.readEditableDataHash(d);b=e[c]=[]}return b}.property(),length:function(){var a=this.get("readOnlyChildren");return a?a.length:0}.property("readOnlyChildren"),objectAt:function(b){var g=this._records,e=this.get("readOnlyChildren"),h,c,d=this.get("propertyName"),f=this.get("record");var a=e?e.length:0;if(!e){return undefined}if(g&&(c=g[b])){return c}if(!g){this._records=g=[]}if(b>=a){return undefined}h=e.objectAt(b);if(!h){return undefined}g[b]=c=f.registerNestedRecord(h,d,d+"."+b);return c},replace:function(j,a,i){var b=this.get("editableChildren"),g=i?(i.get?i.get("length"):i.length):0,f=this.get("record"),d,e=this.get("propertyName"),h,c;d=this._processRecordsToHashes(i);if(d!==this._prevChildren){this._performRecordPropertyChange(null,false)}b.replace(j,a,d);f.recordDidChange(e);return this},_processRecordsToHashes:function(c){var b,a;c=c||[];c.forEach(function(e,d){if(e.isNestedRecord){b=e.get("store");a=e.storeKey;c[d]=b.readDataHash(a)}});return c},normalize:function(){this.forEach(function(b,a){if(b.normalize){b.normalize()}})},recordPropertyDidChange:function(a){this._performRecordPropertyChange(a,true);return this},_performRecordPropertyChange:function(e,h){if(e&&!e.contains(this.get("propertyName"))){return this}var b=this.get("readOnlyChildren"),a=0,c=0;var d=this._prevChildren,g=this._childrenContentDidChange;h=SC.none(h)?true:h;if(b===d){return this}if(d){d.removeArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:g});a=d.get("length")}if(b){b.addArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:g});c=b.get("length")}this._prevChildren=b;if(h){this.arrayContentWillChange(0,a,c);this._childrenContentDidChange(0,a,c)}return this},_childrenContentDidChange:function(c,a,b){this._records=null;this.arrayContentDidChange(c,a,b)},init:function(){arguments.callee.base.apply(this,arguments);this.recordPropertyDidChange()}});sc_require("models/record");sc_require("models/record_attribute");sc_require("models/child_attribute");sc_require("system/child_array");SC.ChildrenAttribute=SC.ChildAttribute.extend({toType:function(b,d,e){var g=this.get("key")||d,f=SC.keyFor("__kidsArray__",SC.guidFor(this)),c=b[f],h=this.get("typeClass"),a;if(!c){c=SC.ChildArray.create({record:b,propertyName:g,defaultRecordType:h});b[f]=c;a=b.get("relationships");if(!a){b.set("relationships",a=[])}a.push(c)}return c},fromType:function(b,e,f){var a,c,g=SC.keyFor("__kidsArray__",SC.guidFor(this)),d=b[g];if(b){b.writeAttribute(e,f);if(d){d=d.recordPropertyDidChange()}}return d},call:function(a,c,d){var e=this.get("key")||c,b,f=SC.keyFor("__kid__",SC.guidFor(this));if(d!==undefined){d=this.fromType(a,c,d)}else{d=a.readAttribute(e);if(SC.none(d)&&(d=this.get("defaultValue"))){if(typeof d===SC.T_FUNCTION){d=this.defaultValue(a,c,this);if(a.attributes()){if(d instanceof Array){d=this.toType(a,c,d).replace(0,d.length,d)}else{a.writeAttribute(e,d,true)}}}}else{d=this.toType(a,c,d)}}return d}});sc_require("models/record");sc_require("models/record_attribute");SC.FetchedAttribute=SC.RecordAttribute.extend({paramValueKey:"link",paramOwnerKey:"owner",paramRelKey:"rel",queryKey:null,isEditable:NO,toType:function(d,i,g){var h=d.get("store");if(!h){return null}var b=this.get("paramValueKey"),a=this.get("paramOwnerKey"),f=this.get("paramRelKey"),e=this.get("queryKey")||this.get("typeClass"),c={};if(b){c[b]=g}if(a){c[a]=d}if(f){c[f]=this.get("key")||i}return h.findAll(e,c)},fromType:function(a,b,c){return c}});SC.ManyArray=SC.Object.extend(SC.Enumerable,SC.Array,{recordType:null,record:null,propertyName:null,manyAttribute:null,store:function(){return this.get("record").get("store")}.property("record").cacheable(),storeKey:function(){return this.get("record").get("storeKey")}.property("record").cacheable(),readOnlyStoreIds:function(){return this.get("record").readAttribute(this.get("propertyName"))}.property(),editableStoreIds:function(){var a=this.get("store"),d=this.get("storeKey"),c=this.get("propertyName"),b,e;b=a.readEditableProperty(d,c);if(!b){e=a.readEditableDataHash(d);b=e[c]=[]}if(b!==this._prevStoreIds){this.recordPropertyDidChange()}return b}.property(),isEditable:function(){var a=this.manyAttribute;return a?a.get("isEditable"):NO}.property("manyAttribute").cacheable(),inverse:function(){var a=this.manyAttribute;return a?a.get("inverse"):null}.property("manyAttribute").cacheable(),isMaster:function(){var a=this.manyAttribute;return a?a.get("isMaster"):null}.property("manyAttribute").cacheable(),orderBy:function(){var a=this.manyAttribute;return a?a.get("orderBy"):null}.property("manyAttribute").cacheable(),length:function(){var a=this.get("readOnlyStoreIds");return a?a.get("length"):0}.property("readOnlyStoreIds"),objectAt:function(a){var g=this._records,f=this.get("readOnlyStoreIds"),c=this.get("store"),h=this.get("recordType"),e,d,b;if(!f||!c){return undefined}if(g&&(d=g[a])){return d}if(!g){this._records=g=[]}b=f.objectAt(a);if(b){e=c.storeKeyFor(h,b);if(c.readStatus(e)===SC.Record.EMPTY){c.retrieveRecord(h,null,e)}g[a]=d=c.materializeRecord(e)}return d},replace:function(n,d,m){if(!this.get("isEditable")){throw"%@.%@[] is not editable".fmt(this.get("record"),this.get("propertyName"))}var c=this.get("editableStoreIds"),k=m?(m.get?m.get("length"):m.length):0,h=this.get("record"),e=this.get("propertyName"),g,a,b,f,l,j;a=[];for(g=0;g<k;g++){a[g]=m.objectAt(g).get("id")}f=this.get("inverse");if(f&&d>0){b=SC.ManyArray._toRemove;if(b){SC.ManyArray._toRemove=null}else{b=[]}for(g=0;g<d;g++){b[g]=this.objectAt(n+g)}}c.replace(n,d,a);if(f){for(g=0;g<d;g++){j=b[g];l=j?j[f]:null;if(l&&l.inverseDidRemoveRecord){l.inverseDidRemoveRecord(j,f,h,e)}}if(b){b.length=0;if(!SC.ManyArray._toRemove){SC.ManyArray._toRemove=b}}for(g=0;g<k;g++){j=m.objectAt(g);l=j?j[f]:null;if(l&&l.inverseDidAddRecord){l.inverseDidAddRecord(j,f,h,e)}}}if(h&&(!f||this.get("isMaster"))){h.recordDidChange(e)}this.enumerableContentDidChange(n,d,k-d);return this},removeInverseRecord:function(c){if(!c){return this}var e=c.get("id"),d=this.get("editableStoreIds"),a=(d&&e)?d.indexOf(e):-1,b;if(a>=0){d.removeAt(a);if(this.get("isMaster")&&(b=this.get("record"))){b.recordDidChange(this.get("propertyName"))}}return this},addInverseRecord:function(d){if(!d){return this}var e=this.get("editableStoreIds"),f=this.get("orderBy"),b=e.get("length"),a,c;if(f){a=this._findInsertionLocation(d,0,b,f)}else{a=b}e.insertAt(a,d.get("id"));if(this.get("isMaster")&&(c=this.get("record"))){c.recordDidChange(this.get("propertyName"))}return this},_findInsertionLocation:function(g,d,c,f){var b=d+Math.floor((c-d)/2),e=this.objectAt(b),a=this._compare(g,e,f);if(a<0){if(b===0){return b}else{return this._findInsertionLocation(g,0,b-1,f)}}else{if(a>0){if(b>=c){return b+1}else{return this._findInsertionLocation(g,b+1,c,f)}}else{return b}}},_compare:function(f,e,i){var h=SC.typeOf(i),g,d,c;if(h===SC.T_FUNCTION){g=i(f,e)}else{if(h===SC.T_STRING){g=SC.compare(f,e)}else{c=i.get("length");g=0;for(d=0;(g===0)&&(d<c);d++){g=SC.compare(f,e)}}}return g},recordPropertyDidChange:function(d){if(d&&!d.contains(this.get("propertyName"))){return this}var g=this.get("readOnlyStoreIds"),a,b;var c=this._prevStoreIds,e=this._storeIdsContentDidChange;if(g===c){return this}if(c){c.removeArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:e});a=c.get("length")}else{a=0}if(g){g.addArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:e});b=g.get("length")}else{b=0}this.arrayContentWillChange(0,a,b);this._prevStoreIds=g;this._storeIdsContentDidChange(0,a,b)},_storeIdsContentDidChange:function(c,a,b){this._records=null;this.arrayContentDidChange(c,a,b)},unknownProperty:function(b,c){var a;if(SC.typeOf(b)===SC.T_STRING){a=this.reducedProperty(b,c)}return a===undefined?arguments.callee.base.apply(this,arguments):a},init:function(){arguments.callee.base.apply(this,arguments);this.recordPropertyDidChange()}});sc_require("models/record");sc_require("models/record_attribute");sc_require("system/many_array");SC.ManyAttribute=SC.RecordAttribute.extend({inverse:null,isMaster:YES,orderBy:null,toType:function(b,d,f){var e=this.get("typeClass"),h=this.get("key")||d,g=SC.keyFor("__manyArray__",SC.guidFor(this)),c=b[g],a;if(!c){c=SC.ManyArray.create({recordType:e,record:b,propertyName:h,manyAttribute:this});b[g]=c;a=b.get("relationships");if(!a){b.set("relationships",a=[])}a.push(c)}return c},fromType:function(b,e,f){var c=[];if(!SC.isArray(f)){throw"Expects toMany attribute to be an array"}var a=f.get("length");for(var d=0;d<a;d++){c[d]=f.objectAt(d).get("id")}return c},inverseDidRemoveRecord:function(a,b,c,d){var e=a.get(b);if(e){e.removeInverseRecord(c)}},inverseDidAddRecord:function(a,b,c,d){var e=a.get(b);if(e){e.addInverseRecord(c)}}});sc_require("models/record");sc_require("models/record_attribute");SC.SingleAttribute=SC.RecordAttribute.extend({inverse:null,isMaster:YES,call:function(c,i,b){var a=this.get("key")||i,h,g,j,f,e,d;if(b!==undefined&&this.get("isEditable")){if(b&&!SC.kindOf(b,SC.Record)){throw"%@ is not an instance of SC.Record".fmt(b)}h=this.get("inverse");if(h){j=this._scsa_call(c,i)}d=this.fromType(c,i,b);c.writeAttribute(a,d,!this.get("isMaster"));e=b;if(h&&(j!==b)){if(j&&(f=j[h])){f.inverseDidRemoveRecord(j,h,c,i)}if(b&&(f=b[h])){f.inverseDidAddRecord(b,h,c,i)}}}else{e=this._scsa_call(c,i,b)}return e},_scsa_call:SC.RecordAttribute.prototype.call,inverseDidRemoveRecord:function(c,f,g,h){var b=this.get("inverse"),e=this._scsa_call(c,f),d=this.get("isMaster"),a;c.writeAttribute(this.get("key")||f,null,!d);c.notifyPropertyChange(f);if((e!==g)||(h!==b)){if(e&&(a=e[b])){a.inverseDidRemoveRecord(e,b,c,f)}}},inverseDidAddRecord:function(a,h,c,g){var e=this.get("inverse"),i=this._scsa_call(a,h),f=this.get("isMaster"),d,b;b=this.fromType(a,h,c);a.writeAttribute(this.get("key")||h,b,!f);a.notifyPropertyChange(h);if((i!==c)||(g!==e)){if(i&&(d=i[e])){d.inverseDidRemoveRecord(i,e,a,h)}}}});sc_require("models/record");SC.Store=SC.Object.extend({name:null,nestedStores:null,dataSource:null,isNested:NO,commitRecordsAutomatically:NO,from:function(a){this.set("dataSource",a);return this},_getDataSource:function(){var a=this.get("dataSource");if(typeof a===SC.T_STRING){a=SC.requiredObjectForPropertyPath(a);if(a.isClass){a=a.create()}this.set("dataSource",a)}return a},cascade:function(a){var b=SC.A(arguments);a=SC.CascadeDataSource.create({dataSources:b});return this.from(a)},chain:function(b,c){if(!b){b={}}b.parentStore=this;if(c){if(SC.typeOf(c)!=="class"){throw new Error("%@ is not a valid class".fmt(c))}if(!SC.kindOf(c,SC.NestedStore)){throw new Error("%@ is not a type of SC.NestedStore".fmt(c))}}else{c=SC.NestedStore}b.childRecords=this.childRecords?SC.clone(this.childRecords):{};b.parentRecords=this.parentRecords?SC.clone(this.parentRecords):{};var a=c.create(b),d=this.nestedStores;if(!d){d=this.nestedStores=[]}d.push(a);return a},willDestroyNestedStore:function(a){if(this.nestedStores){this.nestedStores.removeObject(a)}return this},hasNestedStore:function(a){while(a&&(a!==this)){a=a.get("parentStore")}return a===this},dataHashes:null,statuses:null,revisions:null,editables:null,changelog:null,recordErrors:null,queryErrors:null,childRecords:null,parentRecords:null,storeKeyEditState:function(b){var c=this.editables,a=this.locks;return(c&&c[b])?SC.Store.EDITABLE:SC.Store.LOCKED},readDataHash:function(a){return this.dataHashes[a]},readEditableDataHash:function(b){var a=this.dataHashes[b];if(!a){return a}var c=this.editables;if(!c){c=this.editables=[]}if(!c[b]){c[b]=1;a=this.dataHashes[b]=SC.clone(a,YES)}return a},readEditableProperty:function(c,a){var e=this.readEditableDataHash(c),d=this.editables[c],b=e[a];if(d===1){d=this.editables[c]={}}if(!d[a]){b=e[a];if(b&&b.isCopyable){b=e[a]=b.copy(YES)}d[a]=YES}return b},writeDataHash:function(c,e,a){if(e){this.dataHashes[c]=e}if(a){this.statuses[c]=a}var d=this.editables;if(!d){d=this.editables=[]}d[c]=1;var b=this;this._propagateToChildren(c,function(f){b.writeDataHash(f,null,a)});return this},removeDataHash:function(b,a){this.dataHashes[b]=null;this.statuses[b]=a||SC.Record.EMPTY;var c=this.editables;if(c){c[b]=0}return this},readStatus:function(a){this.readDataHash(a);return this.statuses[a]||SC.Record.EMPTY},peekStatus:function(a){return this.statuses[a]||SC.Record.EMPTY},writeStatus:function(b,a){return this.writeDataHash(b,null,a)},dataHashDidChange:function(e,b,a,h){if(!b){b=SC.Store.generateStoreKey()}var c,f,g,i;c=SC.typeOf(e)===SC.T_ARRAY;if(c){f=e.length}else{f=1;i=e}var d=this;for(g=0;g<f;g++){if(c){i=e[g]}this.revisions[i]=b;this._notifyRecordPropertyChange(i,a,h);this._propagateToChildren(i,function(j){d.dataHashDidChange(j,null,a,h)})}return this},_notifyRecordPropertyChange:function(m,e,l){var a=this.records,g=this.get("nestedStores"),h=SC.Store,c,b,f,k,j,d,n;f=g?g.length:0;for(k=0;k<f;k++){j=g[k];d=j.peekStatus(m);b=j.storeKeyEditState(m);if(b===h.INHERITED){j._notifyRecordPropertyChange(m,e,l)}else{if(d&SC.Record.BUSY){if(j.get("hasChanges")){throw h.CHAIN_CONFLICT_ERROR}j.reset()}}}var i=this.recordPropertyChanges;if(!i){i=this.recordPropertyChanges={storeKeys:SC.CoreSet.create(),records:SC.CoreSet.create(),hasDataChanges:SC.CoreSet.create(),propertyForStoreKeys:{}}}i.storeKeys.add(m);if(a&&(c=a[m])){i.records.push(m);if(!e){i.hasDataChanges.push(m)}if(l){if(!(n=i.propertyForStoreKeys[m])){n=i.propertyForStoreKeys[m]=SC.CoreSet.create()}if(n!=="*"){n.add(l)}}else{i.propertyForStoreKeys[m]="*"}}this.invokeOnce(this.flush);return this},flush:function(){if(!this.recordPropertyChanges){return this}var i=this.recordPropertyChanges,h=i.storeKeys,l=i.hasDataChanges,a=i.records,f=i.propertyForStoreKeys,d=SC.CoreSet.create(),c,b,e,j,g,k,m;h.forEach(function(n){if(a.contains(n)){e=l.contains(n)?NO:YES;c=this.records[n];m=f?f[n]:null;if(m==="*"){m=null}a.remove(n);if(c){c.storeDidChangeProperties(e,m)}}b=SC.Store.recordTypeFor(n);d.add(b)},this);if(h.get("length")>0){this._notifyRecordArrays(h,d)}h.clear();l.clear();a.clear();this.recordPropertyChanges.propertyForStoreKeys={};return this},reset:function(){this.dataHashes={};this.revisions={};this.statuses={};this.chainedChanges=this.locks=this.editables=null;this.changelog=null;this.recordErrors=null;this.queryErrors=null;var c=this.get("dataSource");if(c&&c.reset){c.reset()}var a=this.records,b;if(a){for(b in a){if(!a.hasOwnProperty(b)){continue}this._notifyRecordPropertyChange(parseInt(b,10),NO)}}this.set("hasChanges",NO)},commitChangesFromNestedStore:function(j,t,d){if(!d){this._verifyLockRevisions(t,j.locks)}var p=t.length,o,f,c,l,e,b,h,a,q,r,g,m,k;b=this.revisions;c=this.dataHashes;l=this.statuses;e=this.editables;h=this.parentRecords?this.parentRecords:this.parentRecords={};a=this.childRecords?this.childRecords:this.childRecords={};if(!e){e=this.editables=[]}q=j.dataHashes;g=j.revisions;r=j.statuses;m=j.parentRecords||{};k=j.childRecords||{};for(o=0;o<p;o++){f=t[o];c[f]=q[f];l[f]=r[f];b[f]=g[f];h[f]=m[f];a[f]=k[f];e[f]=0;this._notifyRecordPropertyChange(f,NO)}var n=this.changelog,s=j.changelog;if(s){if(!n){n=this.changelog=SC.CoreSet.create()}n.addEach(s)}this.changelog=n;if(!this.get("parentStore")){this.flush()}return this},_verifyLockRevisions:function(f,h){var a=f.length,c=this.revisions,e,g,d,b;if(h&&c){for(e=0;e<a;e++){g=f[e];d=h[g]||1;b=c[g]||1;if(d<b){throw SC.Store.CHAIN_CONFLICT_ERROR}}}return this},find:function(b,a){if(SC.typeOf(b)===SC.T_STRING){b=SC.objectForPropertyPath(b)}if((arguments.length===1)&&!(b&&b.get&&b.get("isRecord"))){if(!b){throw new Error("SC.Store#find() must pass recordType or query")}if(!b.isQuery){b=SC.Query.local(b)}return this._findQuery(b,YES,YES)}else{return this._findRecord(b,a)}},findAll:function(c,a,b){SC.Logger.warn("SC.Store#findAll() will be removed in a future version of SproutCore.  Use SC.Store#find() instead");if(!c||!c.isQuery){c=SC.Query.local(c,a,b)}return this._findQuery(c,YES,YES)},_findQuery:function(f,a,e){var b=this._scst_recordArraysByQuery,d=SC.guidFor(f),c,g;if(!b){b=this._scst_recordArraysByQuery={}}c=b[d];if(!c&&a){b[d]=c=SC.RecordArray.create({store:this,query:f});g=this.get("recordArrays");if(!g){this.set("recordArrays",g=SC.Set.create())}g.add(c);if(e){this.refreshQuery(f)}}this.flush();return c},_findRecord:function(c,b){var a;if(c&&c.get&&c.get("isRecord")){a=c.get("storeKey")}else{a=b?c.storeKeyFor(b):null}if(a&&(this.readStatus(a)===SC.Record.EMPTY)){a=this.retrieveRecord(c,b)}return a?this.materializeRecord(a):null},recordArrayWillDestroy:function(b){var a=this._scst_recordArraysByQuery,c=this.get("recordArrays");if(a){delete a[SC.guidFor(b.get("query"))]}if(c){c.remove(b)}return this},refreshQuery:function(d){if(!d){throw new Error("refreshQuery() requires a query")}var a=this._scst_recordArraysByQuery,c=a?a[SC.guidFor(d)]:null,b=this._getDataSource();if(b&&b.fetch){if(c){c.storeWillFetchQuery(d)}b.fetch.call(b,this,d)}return this},_notifyRecordArrays:function(b,a){var c=this.get("recordArrays");if(!c){return this}c.forEach(function(d){if(d){d.storeDidChangeStoreKeys(b,a)}},this);return this},recordsFor:function(f){var d=[],a=f.storeKeysById(),e,c,b;for(e in a){c=a[e];if(this.readStatus(c)!==SC.RECORD_EMPTY){d.push(c)}}if(d.length>0){b=SC.RecordArray.create({store:this,storeKeys:d})}else{b=d}return b},_TMP_REC_ATTRS:{},materializeRecord:function(d){var a=this.records,c,e,b;if(!a){a=this.records={}}c=a[d];if(c){return c}e=SC.Store.recordTypeFor(d);if(!e){return null}b=this._TMP_REC_ATTRS;b.storeKey=d;b.store=this;c=a[d]=e.create(b);return c},createRecord:function(d,f,b){var m,l,n,e,k=SC.Record,h,j,i;f=(f?f:{});if(!b&&(m=d.prototype.primaryKey)){b=f[m];j=d.prototype[m]?d.prototype[m].defaultValue:null;if(!b&&SC.typeOf(j)===SC.T_FUNCTION){b=f[m]=j()}}n=b?d.storeKeyFor(b):SC.Store.generateStoreKey();e=this.readStatus(n);if((e&k.BUSY)||(e&k.READY)||(e===k.DESTROYED_DIRTY)){throw b?k.RECORD_EXISTS_ERROR:k.BAD_STATE_ERROR}else{if(!b&&(e===SC.DESTROYED_CLEAN||e===SC.ERROR)){throw k.BAD_STATE_ERROR}}this.writeDataHash(n,f,k.READY_NEW);SC.Store.replaceRecordTypeFor(n,d);this.dataHashDidChange(n);i=this.materializeRecord(n);l=d.prototype;for(var a in l){var g=l[a];if(g&&g.isRecordAttribute){var c=g.key||a;if(!f.hasOwnProperty(c)){if(f.hasOwnProperty(a)){f[c]=f[a];delete f[a]}else{j=g.defaultValue;if(j){if(SC.typeOf(j)===SC.T_FUNCTION){f[c]=SC.copy(j(i,c),YES)}else{f[c]=SC.copy(j,YES)}}}}else{if(c!==a&&f.hasOwnProperty(a)){delete f[a]}}}}h=this.changelog;if(!h){h=SC.Set.create()}h.add(n);this.changelog=h;if(this.get("commitRecordsAutomatically")){this.invokeLast(this.commitRecords)}if(i){i.propagateToAggregates()}return i},createRecords:function(d,i,a){var g=[],c,b,e,f=i.length,h;e=SC.typeOf(d)===SC.T_ARRAY;if(!e){c=d}for(h=0;h<f;h++){if(e){c=d[h]||SC.Record}b=a?a[h]:undefined;g.push(this.createRecord(c,i[h],b))}return g},unloadRecord:function(g,f,e,c){if(e===undefined){e=g.storeKeyFor(f)}var b=this.readStatus(e),a=SC.Record;c=c||a.EMPTY;if((b===a.BUSY_DESTROYING)||(b&a.DESTROYED)){return this}else{if(b&a.BUSY){throw a.BUSY_ERROR}else{b=c}}this.removeDataHash(e,b);this.dataHashDidChange(e);var d=this;this._propagateToChildren(e,function(h){d.unloadRecord(null,null,h,c)});return this},unloadRecords:function(d,a,g,e){var h,f,i,b,c,j;if(g===undefined){f=SC.typeOf(d)===SC.T_ARRAY;if(!f){c=d}if(a===undefined){h=f?d.length:1;for(i=0;i<h;i++){if(f){c=d[i]}g=this.storeKeysFor(c);this.unloadRecords(undefined,undefined,g,e)}}else{h=a.length;for(i=0;i<h;i++){if(f){c=d[i]||SC.Record}b=a?a[i]:undefined;this.unloadRecord(c,b,undefined,e)}}}else{h=g.length;for(i=0;i<h;i++){j=g?g[i]:undefined;this.unloadRecord(undefined,undefined,j,e)}}return this},destroyRecord:function(g,f,e){if(e===undefined){e=g.storeKeyFor(f)}var b=this.readStatus(e),c,a=SC.Record;if((b===a.BUSY_DESTROYING)||(b&a.DESTROYED)){return this}else{if(b===a.EMPTY){throw a.NOT_FOUND_ERROR}else{if(b&a.BUSY){throw a.BUSY_ERROR}else{if(b===a.READY_NEW){b=a.DESTROYED_CLEAN}else{b=a.DESTROYED_DIRTY}}}}this.writeStatus(e,b);this.dataHashDidChange(e);c=this.changelog;if(!c){c=this.changelog=SC.Set.create()}((b&a.DIRTY)?c.add(e):c.remove(e));this.changelog=c;if(this.get("commitRecordsAutomatically")){this.invokeLast(this.commitRecords)}var d=this;this._propagateToChildren(e,function(h){d.destroyRecord(null,null,h)});return this},destroyRecords:function(d,a,f){var g,e,h,b,c,i;if(f===undefined){g=a.length;e=SC.typeOf(d)===SC.T_ARRAY;if(!e){c=d}for(h=0;h<g;h++){if(e){c=d[h]||SC.Record}b=a?a[h]:undefined;this.destroyRecord(c,b,undefined)}}else{g=f.length;for(h=0;h<g;h++){i=f?f[h]:undefined;this.destroyRecord(undefined,undefined,i)}}return this},registerChildToParent:function(c,g,f){var e,b,d,h,a;b=this.childRecords||{};e=this.parentRecords||{};d=b[g];if(d){h=e[d];delete h[g]}a=e[c]||{};a[g]=f||YES;e[c]=a;b[g]=c;this.writeStatus(g,this.statuses[c]);this.childRecords=b;this.parentRecords=e},unregisterChildFromParent:function(c){var a,b;a=this.childRecords;b=a[c];if(b){delete this.parentRecords[b][c]}this.removeDataHash(c);delete this.records[c];delete a[c]},materializeParentRecord:function(c){var b,a;if(SC.none(c)){return null}a=this.childRecords;b=a?this.childRecords[c]:null;if(SC.none(b)){return null}return this.materializeRecord(b)},parentStoreKeyExists:function(b){if(SC.none(b)){return}var a=this.childRecords||{};return a[b]},_propagateToChildren:function(d,c){if(SC.none(this.parentRecords)){return}var b=this.parentRecords[d]||{};if(SC.none(c)){return}for(var a in b){if(b.hasOwnProperty(a)){c(parseInt(a,10))}}},recordDidChange:function(h,g,f,d,c){if(f===undefined){f=h.storeKeyFor(g)}var b=this.readStatus(f),e,a=SC.Record;if(b&a.BUSY){throw a.BUSY_ERROR}else{if(!(b&a.READY)){throw a.NOT_FOUND_ERROR}else{if(b!=a.READY_NEW){this.writeStatus(f,a.READY_DIRTY)}}}this.dataHashDidChange(f,null,c,d);e=this.changelog;if(!e){e=this.changelog=SC.Set.create()}e.add(f);this.changelog=e;if(this.get("commitRecordsAutomatically")){this.invokeLast(this.commitRecords)}return this},recordsDidChange:function(d,a,f){var g,e,h,b,c,i;if(f===undefined){g=a.length;e=SC.typeOf(d)===SC.T_ARRAY;if(!e){c=d}for(h=0;h<g;h++){if(e){c=d[h]||SC.Record}b=a?a[h]:undefined;i=f?f[h]:undefined;this.recordDidChange(c,b,i)}}else{g=f.length;for(h=0;h<g;h++){i=f?f[h]:undefined;this.recordDidChange(undefined,undefined,i)}}return this},retrieveRecords:function(f,m,b,c,q){var l=this._getDataSource(),h=SC.typeOf(f)===SC.T_ARRAY,k=SC.typeOf(q)===SC.T_ARRAY,o=(!b)?m.length:b.length,r=[],p=SC.Store.generateStoreKey(),g=SC.Record,a,j,e,n,i,d;if(!h){a=f}for(j=0;j<o;j++){if(b){e=b[j]}else{if(h){a=f[j]}e=a.storeKeyFor(m[j])}d=k?q[j]:q;n=this.readStatus(e);if((n==g.EMPTY)||(n==g.ERROR)||(n==g.DESTROYED_CLEAN)){this.writeStatus(e,g.BUSY_LOADING);this.dataHashDidChange(e,p,YES);r.push(e);this._setCallbackForStoreKey(e,d,k,b)}else{if(c){if(n&g.READY){this.writeStatus(e,g.BUSY_REFRESH|(n&3));this.dataHashDidChange(e,p,YES);r.push(e);this._setCallbackForStoreKey(e,d,k,b)}else{if((n==g.BUSY_DESTROYING)||(n==g.BUSY_CREATING)||(n==g.BUSY_COMMITTING)){throw g.BUSY_ERROR}else{if(n==g.DESTROYED_DIRTY){throw g.BAD_STATE_ERROR}}}}}}i=NO;if(l){i=l.retrieveRecords.call(l,this,r,m)}if(!i){o=r.length;p=SC.Store.generateStoreKey();for(j=0;j<o;j++){e=r[j];n=this.readStatus(e);if(n===g.BUSY_LOADING){this.writeStatus(e,g.ERROR);this.dataHashDidChange(e,p,YES)}else{if(n&g.BUSY_REFRESH){this.writeStatus(e,g.READY|(n&3));this.dataHashDidChange(e,p,YES)}}}r.length=0}return r},_TMP_RETRIEVE_ARRAY:[],_callback_queue:{},_setCallbackForStoreKey:function(d,e,b,c){var a=this._callback_queue;if(b){a[d]={callback:e,otherKeys:c}}else{a[d]=e}},_retreiveCallbackForStoreKey:function(c){var a=this._callback_queue,e=a[c],d,b;if(e){if(SC.typeOf(e)===SC.T_FUNCTION){e.call();delete a[c]}else{if(SC.typeOf(e)==SC.T_HASH){e.completed=YES;b=e.storeKeys;b.forEach(function(f){if(!a[f].completed){d=YES}});if(d){e.callback.call();b.forEach(function(f){delete a[f]})}}}}},_cancelCallback:function(b){var a=this._callback_queue;if(a[b]){delete a[b]}},retrieveRecord:function(g,f,b,c,e){var d=this._TMP_RETRIEVE_ARRAY,a;if(b){d[0]=b;b=d;f=null}else{d[0]=f;f=d}a=this.retrieveRecords(g,f,b,c,e);d.length=0;return a[0]},refreshRecord:function(d,c,a,b){return !!this.retrieveRecord(d,c,a,YES,b)},refreshRecords:function(b,c,d,e){var a=this.retrieveRecords(b,c,d,YES,e);return a&&a.length>0},commitRecords:function(f,n,b,q,t){var m=this._getDataSource(),h=SC.typeOf(f)===SC.T_ARRAY,k=SC.typeOf(t)===SC.T_ARRAY,c=[],j=[],l=[],r=SC.Store.generateStoreKey(),g=SC.Record,a,i,e,o,u,s,p,d;if(!f&&!n&&!b){b=this.changelog}p=b?b.get("length"):(n?n.get("length"):0);for(i=0;i<p;i++){if(b){e=b[i]}else{if(h){a=f[i]||SC.Record}else{a=f}e=a.storeKeyFor(n[i])}d=k?t[i]:t;o=this.readStatus(e);if(o==g.ERROR){throw g.NOT_FOUND_ERROR}else{if(o==g.READY_NEW){this.writeStatus(e,g.BUSY_CREATING);this.dataHashDidChange(e,r,YES);c.push(e);this._setCallbackForStoreKey(e,d,k,b)}else{if(o==g.READY_DIRTY){this.writeStatus(e,g.BUSY_COMMITTING);this.dataHashDidChange(e,r,YES);j.push(e);this._setCallbackForStoreKey(e,d,k,b)}else{if(o==g.DESTROYED_DIRTY){this.writeStatus(e,g.BUSY_DESTROYING);this.dataHashDidChange(e,r,YES);l.push(e);this._setCallbackForStoreKey(e,d,k,b)}else{if(o==g.DESTROYED_CLEAN){this.dataHashDidChange(e,r,YES)}}}}}}if(m&&(p>0||q)){s=m.commitRecords.call(m,this,c,j,l,q)}if(s&&!f&&!n){if(b===this.changelog){this.changelog=null}else{this.changelog.removeEach(b)}}return s},commitRecord:function(g,f,b,c,e){var d=this._TMP_RETRIEVE_ARRAY,a;if(f===undefined&&b===undefined){return NO}if(b!==undefined){d[0]=b;b=d;f=null}else{d[0]=f;f=d}a=this.commitRecords(g,f,b,c,e);d.length=0;return a},cancelRecords:function(e,b,i){var a=this._getDataSource(),g=SC.typeOf(e)===SC.T_ARRAY,k=SC.Record,j=[],f,h,l,c,d,m;h=(i===undefined)?b.length:i.length;for(l=0;l<h;l++){if(g){d=e[l]||SC.Record}else{d=e||SC.Record}c=b?b[l]:undefined;if(i===undefined){m=d.storeKeyFor(c)}else{m=i?i[l]:undefined}if(m){f=this.readStatus(m);if((f==k.EMPTY)||(f==k.ERROR)){throw k.NOT_FOUND_ERROR}j.push(m);this._cancelCallback(m)}}if(a){a.cancel.call(a,this,j)}return this},cancelRecord:function(e,d,b){var c=this._TMP_RETRIEVE_ARRAY,a;if(b!==undefined){c[0]=b;b=c;d=null}else{c[0]=d;d=c}a=this.cancelRecords(e,d,b);c.length=0;return this},loadRecord:function(g,d,f){var a=SC.Record,c,b,e;g=g||SC.Record;b=g.prototype.primaryKey;f=f||d[b];c=e=g.storeKeyFor(f);if(this.readStatus(e)&a.BUSY){this.dataSourceDidComplete(e,d,f)}else{this.pushRetrieve(g,f,d,e)}return c},loadRecords:function(d,m,a){var f=SC.typeOf(d)===SC.T_ARRAY,g=m.get("length"),h=[],i=SC.Record,c,b,k,j,e,l;if(!f){c=d||SC.Record;k=c.prototype.primaryKey}for(j=0;j<g;j++){e=m.objectAt(j);if(f){c=d.objectAt(j)||SC.Record;k=c.prototype.primaryKey}b=(a)?a.objectAt(j):e[k];h[j]=this.loadRecord(c,e,b)}return h},readError:function(a){var b=this.recordErrors;return b?b[a]:undefined},readQueryError:function(a){var b=this.queryErrors;return b?b[SC.guidFor(a)]:undefined},dataSourceDidCancel:function(c){var b=this.readStatus(c),a=SC.Record;if(!(b&a.BUSY)){throw a.BAD_STATE_ERROR}switch(b){case a.BUSY_LOADING:b=a.EMPTY;break;case a.BUSY_CREATING:b=a.READY_NEW;break;case a.BUSY_COMMITTING:b=a.READY_DIRTY;break;case a.BUSY_REFRESH_CLEAN:b=a.READY_CLEAN;break;case a.BUSY_REFRESH_DIRTY:b=a.READY_DIRTY;break;case a.BUSY_DESTROYING:b=a.DESTROYED_DIRTY;break;default:throw a.BAD_STATE_ERROR}this.writeStatus(c,b);this.dataHashDidChange(c,null,YES);this._cancelCallback(c);return this},dataSourceDidComplete:function(g,f,e){var c=this.readStatus(g),b=SC.Record,d;if(!(c&b.BUSY)){throw b.BAD_STATE_ERROR}if(c===b.BUSY_DESTROYING){throw b.BAD_STATE_ERROR}else{c=b.READY_CLEAN}this.writeStatus(g,c);if(f){this.writeDataHash(g,f,c)}if(e){SC.Store.replaceIdFor(g,e)}d=f||e?NO:YES;this.dataHashDidChange(g,null,d);var a=this.materializeRecord(g);if(a!=null){a.notifyPropertyChange("status")}this._retreiveCallbackForStoreKey(g);return this},dataSourceDidDestroy:function(d){var c=this.readStatus(d),b=SC.Record;if(!(c&b.BUSY)){throw b.BAD_STATE_ERROR}else{c=b.DESTROYED_CLEAN}this.removeDataHash(d,c);this.dataHashDidChange(d);var a=this.materializeRecord(d);if(a!=null){a.notifyPropertyChange("status")}this._retreiveCallbackForStoreKey(d);return this},dataSourceDidError:function(e,d){var c=this.readStatus(e),f=this.recordErrors,b=SC.Record;if(!(c&b.BUSY)){throw b.BAD_STATE_ERROR}else{c=b.ERROR}if(d&&d.isError){if(!f){f=this.recordErrors=[]}f[e]=d}this.writeStatus(e,c);this.dataHashDidChange(e,null,YES);var a=this.materializeRecord(e);if(a!=null){a.notifyPropertyChange("status")}this._retreiveCallbackForStoreKey(e);return this},pushRetrieve:function(f,e,c,d){var b=SC.Record,a;if(d===undefined){d=f.storeKeyFor(e)}a=this.readStatus(d);if(a==b.EMPTY||a==b.ERROR||a==b.READY_CLEAN||a==b.DESTROYED_CLEAN){a=b.READY_CLEAN;if(c===undefined){this.writeStatus(d,a)}else{this.writeDataHash(d,c,a)}if(e&&this.idFor(d)!==e){SC.Store.replaceIdFor(d,e)}this.dataHashDidChange(d);return d}return NO},pushDestroy:function(e,d,c){var b=SC.Record,a;if(c===undefined){c=e.storeKeyFor(d)}a=this.readStatus(c);if(a==b.EMPTY||a==b.ERROR||a==b.READY_CLEAN||a==b.DESTROYED_CLEAN){a=b.DESTROYED_CLEAN;this.removeDataHash(c,a);this.dataHashDidChange(c);return c}return NO},pushError:function(g,f,c,d){var b=SC.Record,a,e=this.recordErrors;if(d===undefined){d=g.storeKeyFor(f)}a=this.readStatus(d);if(a==b.EMPTY||a==b.ERROR||a==b.READY_CLEAN||a==b.DESTROYED_CLEAN){a=b.ERROR;if(c&&c.isError){if(!e){e=this.recordErrors=[]}e[d]=c}this.writeStatus(d,a);this.dataHashDidChange(d,null,YES);return d}return NO},loadQueryResults:function(c,a){if(c.get("location")===SC.Query.LOCAL){throw new Error("Cannot load query results for a local query")}var b=this._findQuery(c,YES,NO);if(b){b.set("storeKeys",a)}this.dataSourceDidFetchQuery(c);return this},dataSourceDidFetchQuery:function(a){return this._scstore_dataSourceDidFetchQuery(a,YES)},_scstore_dataSourceDidFetchQuery:function(d,a){var c=this._findQuery(d,a,NO),b=this.get("nestedStores"),e=b?b.get("length"):0;if(c){c.storeDidFetchQuery(d)}while(--e>=0){b[e]._scstore_dataSourceDidFetchQuery(d,NO)}return this},dataSourceDidCancelQuery:function(a){return this._scstore_dataSourceDidCancelQuery(a,YES)},_scstore_dataSourceDidCancelQuery:function(d,a){var c=this._findQuery(d,a,NO),b=this.get("nestedStores"),e=b?b.get("length"):0;if(c){c.storeDidCancelQuery(d)}while(--e>=0){b[e]._scstore_dataSourceDidCancelQuery(d,NO)}return this},dataSourceDidErrorQuery:function(b,a){var c=this.queryErrors;if(a&&a.isError){if(!c){c=this.queryErrors={}}c[SC.guidFor(b)]=a}return this._scstore_dataSourceDidErrorQuery(b,YES)},_scstore_dataSourceDidErrorQuery:function(d,a){var c=this._findQuery(d,a,NO),b=this.get("nestedStores"),e=b?b.get("length"):0;if(c){c.storeDidErrorQuery(d)}while(--e>=0){b[e]._scstore_dataSourceDidErrorQuery(d,NO)}return this},init:function(){arguments.callee.base.apply(this,arguments);this.reset()},toString:function(){var b=this.get("name");if(!b){return arguments.callee.base.apply(this,arguments)}else{var a=arguments.callee.base.apply(this,arguments);return"%@ (%@)".fmt(b,a)}},idFor:function(a){return SC.Store.idFor(a)},recordTypeFor:function(a){return SC.Store.recordTypeFor(a)},storeKeyFor:function(b,a){return b.storeKeyFor(a)},storeKeyExists:function(b,a){return b.storeKeyExists(a)},storeKeysFor:function(f){var a=[],e=f&&f.isEnumerable,c,d,b;if(!this.statuses){return a}for(d in SC.Store.recordTypesByStoreKey){c=SC.Store.recordTypesByStoreKey[d];if(e){b=f.contains(c)}else{b=c===f}if(b&&this.statuses[d]){a.push(parseInt(d,10))}}return a},storeKeys:function(){var a=[],b;if(!this.statuses){return a}for(b in this.statuses){if(this.statuses[b]!=SC.Record.EMPTY){a.push(parseInt(b,10))}}return a},statusString:function(a){var b=this.materializeRecord(a);return b.statusString()}});SC.Store.mixin({CHAIN_CONFLICT_ERROR:new Error("Nested Store Conflict"),NO_PARENT_STORE_ERROR:new Error("Parent Store Required"),NESTED_STORE_UNSUPPORTED_ERROR:new Error("Unsupported In Nested Store"),NESTED_STORE_RETRIEVE_DIRTY_ERROR:new Error("Cannot Retrieve Dirty Record in Nested Store"),EDITABLE:"editable",LOCKED:"locked",INHERITED:"inherited",idsByStoreKey:[],recordTypesByStoreKey:{},queriesByStoreKey:[],nextStoreKey:1,generateStoreKey:function(){return this.nextStoreKey++},idFor:function(a){return this.idsByStoreKey[a]},queryFor:function(a){return this.queriesByStoreKey[a]},recordTypeFor:function(a){return this.recordTypesByStoreKey[a]},replaceIdFor:function(c,a){var d=this.idsByStoreKey[c],e,b;if(d!==a){e=this.recordTypeFor(c);if(!e){throw new Error("replaceIdFor: storeKey %@ does not exist".fmt(c))}this.idsByStoreKey[c]=a;b=e.storeKeysById();delete b[d];b[a]=c}return this},replaceRecordTypeFor:function(a,b){this.recordTypesByStoreKey[a]=b;return this}});SC.Store.prototype.nextStoreIndex=1;SC.Store._getDefaultStore=function(){var a=this._store;if(!a){this._store=a=SC.Store.create()}return a};SC.Store.updateRecords=function(f,g,h,c){SC.Logger.warn("SC.Store.updateRecords() is deprecated.  Use loadRecords() instead");var d=this._getDefaultStore(),b=f.length,a,e;if(!h){h=[];for(a=0;a<b;a++){h[a]=f[a].recordType}}e=d.loadRecords(h,f);b=e.length;for(a=0;a<b;a++){e[a]=d.materializeRecord(e[a])}return e};SC.Store.find=function(a,b){return this._getDefaultStore().find(b,a)};SC.Store.findAll=function(a,b){return this._getDefaultStore().findAll(a,b)};sc_require("system/store");SC.NestedStore=SC.Store.extend({hasChanges:NO,parentStore:null,isNested:YES,lockOnRead:YES,locks:null,chainedChanges:null,find:function(a){if(a&&a.isQuery&&a.get("location")!==SC.Query.LOCAL){throw"SC.Store#find() can only accept LOCAL queries in nested stores"}return arguments.callee.base.apply(this,arguments)},commitChanges:function(b){if(this.get("hasChanges")){var a=this.get("parentStore");a.commitChangesFromNestedStore(this,this.chainedChanges,b)}this.reset();return this},discardChanges:function(){var c,f;if((c=this.records)&&(f=this.locks)){var b=this.get("parentStore"),h=b.revisions;var g=this.revisions,e,d,a;for(e in c){if(!c.hasOwnProperty(e)){continue}if(!(d=f[e])){continue}a=h[e];if((a!==d)||(g[e]>a)){this._notifyRecordPropertyChange(parseInt(e,10))}}}this.reset();this.flush();return this},destroy:function(){this.discardChanges();var a=this.get("parentStore");if(a){a.willDestroyNestedStore(this)}arguments.callee.base.apply(this,arguments);return this},reset:function(){var c,d,a;var b=this.get("parentStore");if(!b){throw SC.Store.NO_PARENT_STORE_ERROR}this.dataHashes=SC.beget(b.dataHashes);this.revisions=SC.beget(b.revisions);this.statuses=SC.beget(b.statuses);this.childRecords=b.childRecords?SC.beget(b.childRecords):{};this.parentRecords=b.parentRecords?SC.beget(b.parentRecords):{};this.chainedChanges=this.locks=this.editables=null;this.changelog=null;this.set("hasChanges",NO)},refreshQuery:function(b){var a=this.get("parentStore");if(a){a.refreshQuery(b)}return this},readError:function(b){var a=this.get("parentStore");return a?a.readError(b):null},readQueryError:function(b){var a=this.get("parentStore");return a?a.readQueryError(b):null},storeKeyEditState:function(b){var c=this.editables,a=this.locks;return(c&&c[b])?SC.Store.EDITABLE:(a&&a[b])?SC.Store.LOCKED:SC.Store.INHERITED},_lock:function(j){var k=this.locks,f,h,d,a,l,g,e,i;if(k&&k[j]){return this}if(!k){k=this.locks=[]}h=this.editables;if(h){h[j]=0}var b=this.get("parentStore"),c;while(b&&(c=b.storeKeyEditState(j))===SC.Store.INHERITED){b=b.get("parentStore")}if(b&&c===SC.Store.EDITABLE){d=this.childRecords[j];if(d){this._lock(d);a=this.parentRecords[d];if(a){l=a[j];g=l?SC.tupleForPropertyPath(l,this.dataHashes[d]):null;if(g){e=g[0];i=g[1]}this.dataHashes[j]=e&&i?e[i]:null}}else{this.dataHashes[j]=SC.clone(b.dataHashes[j],YES)}if(!h){h=this.editables=[]}h[j]=1}else{this.dataHashes[j]=b.dataHashes[j]}this.statuses[j]=this.statuses[j];f=this.revisions[j]=this.revisions[j];k[j]=f||1;return this},readDataHash:function(a){if(this.get("lockOnRead")){this._lock(a)}return this.dataHashes[a]},readEditableDataHash:function(a){this._lock(a);return arguments.callee.base.apply(this,arguments)},writeDataHash:function(d,f,b){var c=this.locks,g=NO,a;if(f){this.dataHashes[d]=f}else{this._lock(d);g=YES}if(b){this.statuses[d]=b}else{if(!g){this.statuses[d]=(this.statuses[d]||SC.Record.READY_NEW)}}if(!g){a=this.revisions[d]=this.revisions[d];if(!c){c=this.locks=[]}if(!c[d]){c[d]=a||1}}var e=this.editables;if(!e){e=this.editables=[]}e[d]=1;return this},removeDataHash:function(c,a){var b=this.locks;if(!b){b=this.locks=[]}if(!b[c]){b[c]=this.revisions[c]||1}return arguments.callee.base.apply(this,arguments)},dataHashDidChange:function(d,b,a,h){if(!b){b=SC.Store.generateStoreKey()}var c,e,g,i;c=SC.typeOf(d)===SC.T_ARRAY;if(c){e=d.length}else{e=1;i=d}var f=this.chainedChanges;if(!f){f=this.chainedChanges=SC.Set.create()}for(g=0;g<e;g++){if(c){i=d[g]}this._lock(i);this.revisions[i]=b;f.add(i);this._notifyRecordPropertyChange(i,a,h)}this.setIfChanged("hasChanges",YES);return this},commitChangesFromNestedStore:function(e,f,a){arguments.callee.base.apply(this,arguments);var b=this.get("parentStore"),h=b.revisions,c;var k=this.locks,g=this.chainedChanges,d,j;if(!k){k=this.locks=[]}if(!g){g=this.chainedChanges=SC.Set.create()}d=f.length;for(c=0;c<d;c++){j=f[c];if(!k[j]){k[j]=h[j]||1}g.add(j)}this.setIfChanged("hasChanges",g.get("length")>0);this.flush();return this},queryFor:function(c,a,b){return this.get("parentStore").queryFor(c,a,b)},findAll:function(e,b,d,c,a){if(!a){a=this}return this.get("parentStore").findAll(e,b,d,c,a)},retrieveRecords:function(f,m,b,c){var a=this.get("parentStore"),k,d,p,o=(!b)?m.length:b.length,i=SC.Record,n;if(c){for(k=0;k<o;k++){d=!b?a.storeKeyFor(f,m[k]):b[k];n=this.peekStatus(d);if(n&i.DIRTY){throw SC.Store.NESTED_STORE_RETRIEVE_DIRTY_ERROR}else{var g=this.dataHashes,j=this.revisions,h=this.statuses,l=this.editables,r=this.locks;var e=NO;var q=NO;if(g&&g.hasOwnProperty(d)){delete g[d];e=YES}if(j&&j.hasOwnProperty(d)){delete j[d];e=YES}if(l){delete l[d]}if(r){delete r[d]}if(h&&h.hasOwnProperty(d)){delete h[d];if(!e){q=YES}e=YES}if(e){this._notifyRecordPropertyChange(d,q)}}}}return a.retrieveRecords(f,m,b,c)},commitRecords:function(a,b,c){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},commitRecord:function(c,b,a){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},cancelRecords:function(a,b,c){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},cancelRecord:function(c,b,a){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},dataSourceDidCancel:function(a){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},dataSourceDidComplete:function(c,b,a){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},dataSourceDidDestroy:function(a){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},dataSourceDidError:function(b,a){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},pushRetrieve:function(d,c,a,b){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},pushDestroy:function(c,b,a){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},pushError:function(d,c,a,b){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR}});sc_require("models/record");SC.RecordArray=SC.Object.extend(SC.Enumerable,SC.Array,{store:null,query:null,storeKeys:null,status:SC.Record.EMPTY,isEditable:function(){var a=this.get("query");return a?a.get("isEditable"):YES}.property("query").cacheable(),length:function(){this.flush();var a=this.get("storeKeys");return a?a.get("length"):0}.property("storeKeys").cacheable(),_scra_records:null,objectAt:function(a){this.flush();var f=this._scra_records,e=this.get("storeKeys"),b=this.get("store"),d,c;if(!e||!b){return undefined}if(f&&(c=f[a])){return c}if(!f){this._scra_records=f=[]}d=e.objectAt(a);if(d){if(b.peekStatus(d)===SC.Record.EMPTY){b.retrieveRecord(null,null,d)}f[a]=c=b.materializeRecord(d)}return c},forEach:function(h,d){this.flush();var e=this._scra_records,b=this.get("storeKeys"),f=this.get("store"),c=b?b.get("length"):0,g,i,a;if(!b||!f){return this}if(!e){e=this._scra_records=[]}if(!d){d=this}for(g=0;g<c;g++){a=e[g];if(!a){a=e[g]=f.materializeRecord(b.objectAt(g))}h.call(d,a,g,this)}return this},replace:function(b,g,f){this.flush();var e=this.get("storeKeys"),a=f?(f.get?f.get("length"):f.length):0,c,d;if(!e){throw"Unable to edit an SC.RecordArray that does not have its storeKeys property set."}if(!this.get("isEditable")){throw SC.RecordArray.NOT_EDITABLE}d=[];for(c=0;c<a;c++){d[c]=f.objectAt(c).get("storeKey")}e.replace(b,g,d);return this},contains:function(a){return this.indexOf(a)>=0},indexOf:function(b,a){if(!SC.kindOf(b,SC.Record)){SC.Logger.warn("Using indexOf on %@ with an object that is not an SC.Record".fmt(b));return -1}this.flush();var d=b.get("storeKey"),c=this.get("storeKeys");return c?c.indexOf(d,a):-1},lastIndexOf:function(b,a){if(!SC.kindOf(b,SC.Record)){SC.Logger.warn("Using lastIndexOf on %@ with an object that is not an SC.Record".fmt(b));return -1}this.flush();var d=b.get("storeKey"),c=this.get("storeKeys");return c?c.lastIndexOf(d,a):-1},add:function(a){if(!SC.kindOf(a,SC.Record)){return this}if(this.indexOf(a)<0){this.pushObject(a)}return this},remove:function(a){if(!SC.kindOf(a,SC.Record)){return this}this.removeObject(a);return this},find:function(a,b,c){if(b&&b.isQuery){return this.get("store").find(b.queryWithScope(this))}else{return a.apply(this,SC.$A(arguments).slice(1))}}.enhance(),refresh:function(){this.get("store").refreshQuery(this.get("query"));return this},reload:function(){this.flush(YES);return this},destroy:function(){if(!this.get("isDestroyed")){this.get("store").recordArrayWillDestroy(this)}arguments.callee.base.apply(this,arguments)},storeWillFetchQuery:function(c){var b=this.get("status"),a=SC.Record;if((b===a.EMPTY)||(b===a.ERROR)){b=a.BUSY_LOADING}if(b&a.READY){b=a.BUSY_REFRESH}this.setIfChanged("status",b);return this},storeDidFetchQuery:function(a){this.setIfChanged("status",SC.Record.READY_CLEAN);return this},storeDidCancelQuery:function(c){var b=this.get("status"),a=SC.Record;if(b===a.BUSY_LOADING){b=a.EMPTY}else{if(b===a.BUSY_REFRESH){b=a.READY_CLEAN}}this.setIfChanged("status",b);return this},storeDidErrorQuery:function(a){this.setIfChanged("status",SC.Record.ERROR);return this},storeDidChangeStoreKeys:function(b,a){var c=this.get("query");if(c.get("location")!==SC.Query.LOCAL){return this}if(!c.containsRecordTypes(a)){return this}var d=this._scq_changedStoreKeys;if(!d){d=this._scq_changedStoreKeys=SC.IndexSet.create()}d.addEach(b);this.set("needsFlush",YES);if(this.get("storeKeys")){this.flush()}return this},flush:function(a){if(this._insideFlush){this.set("needsFlush",YES);return this}if(!this.get("needsFlush")&&!a){return this}this.set("needsFlush",NO);var j=this.get("query"),m=this.get("store");if(!m||!j||j.get("location")!==SC.Query.LOCAL){return this}this._insideFlush=YES;var h=this.get("storeKeys"),f=this._scq_changedStoreKeys,g=NO,k=SC.Record,p=[],b=new Date(),d,e,c,q,o,i;var l=h;if(h&&!a){if(f){f.forEach(function(r){if(p.length>0||new Date()-b>SC.RecordArray.QUERY_MATCHING_THRESHOLD){p.push(r);return}e=m.peekStatus(r);if(!(e&k.EMPTY)&&!((e&k.DESTROYED)||(e===k.BUSY_DESTROYING))){d=m.materializeRecord(r);i=!!(d&&j.contains(d))}else{i=NO}if(i){if(h.indexOf(r)<0){if(!g){h=h.copy()}h.pushObject(r)}}else{if(h.indexOf(r)>=0){if(!g){h=h.copy()}h.removeObject(r)}}},this);g=YES}}else{if(o=j.get("scope")){q=o.flush().get("storeKeys")}else{if(c=j.get("expandedRecordTypes")){q=SC.IndexSet.create();c.forEach(function(r){q.addEach(m.storeKeysFor(r))})}}h=[];q.forEach(function(r){if(p.length>0||new Date()-b>SC.RecordArray.QUERY_MATCHING_THRESHOLD){p.push(r);return}e=m.peekStatus(r);if(!(e&k.EMPTY)&&!((e&k.DESTROYED)||(e===k.BUSY_DESTROYING))){d=m.materializeRecord(r);if(d&&j.contains(d)){h.push(r)}}});g=YES}if(p.length>0){var n=this;window.setTimeout(function(){SC.run(function(){if(!n||n.get("isDestroyed")){return}n.set("needsFlush",YES);n._scq_changedStoreKeys=SC.IndexSet.create().addEach(p);n.flush()})},1)}if(f){f.clear()}if(g){if(h&&(h===l)){h=h.copy()}h=SC.Query.orderStoreKeys(h,j,m);if(SC.compare(l,h)!==0){this.set("storeKeys",SC.clone(h))}}this._insideFlush=NO;return this},needsFlush:YES,isError:function(){return !!(this.get("status")&SC.Record.ERROR)}.property("status").cacheable(),errorValue:function(){return this.get("isError")?SC.val(this.get("errorObject")):null}.property("isError").cacheable(),errorObject:function(){if(this.get("isError")){var a=this.get("store");return a.readQueryError(this.get("query"))||SC.Record.GENERIC_ERROR}else{return null}}.property("isError").cacheable(),propertyWillChange:function(b){if(b==="storeKeys"){var c=this.get("storeKeys");var a=c?c.get("length"):0;this.arrayContentWillChange(0,a,0)}return arguments.callee.base.apply(this,arguments)},_storeKeysDidChange:function(){var e=this.get("storeKeys");var d=this._prevStoreKeys,b,c,g=this._storeKeysContentDidChange,a=this._storeKeysStateDidChange;if(e===d){return}if(d){d.removeArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:this._storeKeysContentDidChange});b=d.get("length")}else{b=0}this._prevStoreKeys=e;if(e){e.addArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:this._storeKeysContentDidChange});c=e.get("length")}else{c=0}this._storeKeysContentDidChange(0,b,c)}.observes("storeKeys"),addArrayObservers:function(){this.flush();return SC.Array.addArrayObservers.apply(this,arguments)},_storeKeysContentDidChange:function(c,a,b){if(this._scra_records){this._scra_records.length=0}this.arrayContentDidChange(c,a,b)},init:function(){arguments.callee.base.apply(this,arguments);this._storeKeysDidChange()}});SC.RecordArray.mixin({NOT_EDITABLE:SC.Error.desc("SC.RecordArray is not editable"),QUERY_MATCHING_THRESHOLD:100});Function.prototype.handleEvents=function(){this.isEventHandler=YES;this.events=arguments;return this};Function.prototype.stateObserves=function(){this.isStateObserveHandler=YES;this.args=SC.A(arguments);return this};SC.StatechartDelegate={isStatechartDelegate:YES,statechartUpdateLocationForState:function(b,a,c){SC.routes.set("location",a)},statechartAcquireLocationForState:function(a,b){return SC.routes.get("location")},statechartBindStateToRoute:function(b,d,a,c){SC.routes.add(a,d,c)},statechartShouldStateHandleTriggeredRoute:function(a,c,b){return YES},statechartStateCancelledHandlingTriggeredRoute:function(a,c,b){}};SC.StatePathMatcher=SC.Object.extend({state:null,expression:null,tokens:null,init:function(){arguments.callee.base.apply(this,arguments);this._parseExpression()},_parseExpression:function(){var h=this.expression?this.expression.split("."):[],b=h.length,f=0,c,e=null,d,g=[];for(;f<b;f+=1){c=h[f];if(c.indexOf("~")>=0){c=c.split("~");if(c.length>2){throw"Invalid use of '~' at part %@".fmt(f)}d=SC.StatePathMatcher._ExpandToken.create({start:c[0],end:c[1]})}else{if(c==="this"){if(g.length>0){throw"Invalid use of 'this' at part %@".fmt(f)}d=SC.StatePathMatcher._ThisToken.create()}else{d=SC.StatePathMatcher._BasicToken.create({value:c})}}d.owner=this;g.push(d)}this.set("tokens",g);var a=SC.clone(g);this._chain=e=a.pop();while(d=a.pop()){e.nextToken=d;e=d}},lastPart:function(){var c=this.get("tokens"),a=c?c.length:0,b=a>0?c[a-1]:null;return b.get("lastPart")}.property("tokens").cacheable(),match:function(a){this._stack=a.split(".");if(SC.empty(a)||SC.typeOf(a)!==SC.T_STRING){return NO}return this._chain.match()},_pop:function(){this._lastPopped=this._stack.pop();return this._lastPopped}});SC.StatePathMatcher._Token=SC.Object.extend({type:null,owner:null,nextToken:null,lastPart:null,match:function(){return NO}});SC.StatePathMatcher._BasicToken=SC.StatePathMatcher._Token.extend({type:"basic",value:null,lastPart:function(){return this.value}.property("value").cacheable(),match:function(){var a=this.owner._pop(),b=this.nextToken;if(this.value!==a){return NO}return b?b.match():YES}});SC.StatePathMatcher._ExpandToken=SC.StatePathMatcher._Token.extend({type:"expand",start:null,end:null,lastPart:function(){return this.end}.property("end").cacheable(),match:function(){var d=this.start,a=this.end,b,c=this.nextToken;b=this.owner._pop();if(b!==a){return NO}while(b=this.owner._pop()){if(b===d){return c?c.match():YES}}return NO}});SC.StatePathMatcher._ThisToken=SC.StatePathMatcher._Token.extend({type:"this",lastPart:"this",match:function(){var e=this.owner.state,c=e.get("substates"),a=c.length,d=0,b;b=this.owner._lastPopped;if(!b||this.owner._stack.length!==0){return NO}for(;d<a;d+=1){if(c[d].get("name")===b){return YES}}return NO}});SC.Async=SC.Object.extend({func:null,arg1:null,arg2:null,tryToPerform:function(d){var c=this.get("func"),b=this.get("arg1"),a=this.get("arg2"),e=SC.typeOf(c);if(e===SC.T_STRING){d.tryToPerform(c,b,a)}else{if(e===SC.T_FUNCTION){c.apply(d,[b,a])}}}});SC.Async.mixin({perform:function(c,b,a){return SC.Async.create({func:c,arg1:b,arg2:a})}});SC.State=SC.Object.extend({name:null,parentState:null,historyState:null,initialSubstate:null,substatesAreConcurrent:NO,substates:null,statechart:null,stateIsInitialized:NO,currentSubstates:null,enteredSubstates:null,representRoute:null,trace:function(){var a=this.getPath("statechart.statechartTraceKey");return this.getPath("statechart.%@".fmt(a))}.property().cacheable(),owner:function(){var c=this.get("statechart"),b=c?c.get("statechartOwnerKey"):null,a=c?c.get(b):null;return a?a:c}.property().cacheable(),statechartDelegate:function(){return this.getPath("statechart.statechartDelegate")}.property().cacheable(),location:function(b,c){var d=this.get("statechart"),a=this.get("statechartDelegate");if(c!==undefined){a.statechartUpdateLocationForState(d,c,this)}return a.statechartAcquireLocationForState(d,this)}.property().idempotent(),init:function(){arguments.callee.base.apply(this,arguments);this._registeredEventHandlers={};this._registeredStringEventHandlers={};this._registeredRegExpEventHandlers=[];this._registeredStateObserveHandlers={};this._registeredSubstatePaths={};this._registeredSubstates=[];this._isEnteringState=NO;this._isExitingState=NO;var b=this.get("statechart"),c=b?b.get("statechartOwnerKey"):null,a=b?b.get("statechartTraceKey"):null;if(b){b.addObserver(c,this,"_statechartOwnerDidChange");b.addObserver(a,this,"_statechartTraceDidChange")}},destroy:function(){var c=this.get("statechart"),d=c?c.get("statechartOwnerKey"):null,a=c?c.get("statechartTraceKey"):null;if(c){c.removeObserver(d,this,"_statechartOwnerDidChange");c.removeObserver(a,this,"_statechartTraceDidChange")}var b=this.get("substates");if(b){b.forEach(function(e){e.destroy()})}this._teardownAllStateObserveHandlers();this.set("substates",null);this.set("currentSubstates",null);this.set("enteredSubstates",null);this.set("parentState",null);this.set("historyState",null);this.set("initialSubstate",null);this.set("statechart",null);this.notifyPropertyChange("trace");this.notifyPropertyChange("owner");this._registeredEventHandlers=null;this._registeredStringEventHandlers=null;this._registeredRegExpEventHandlers=null;this._registeredStateObserveHandlers=null;this._registeredSubstatePaths=null;this._registeredSubstates=null;arguments.callee.base.apply(this,arguments)},initState:function(){if(this.get("stateIsInitialized")){return}this._registerWithParentStates();this._setupRouteHandling();var l=null,k=null,b=null,m=[],j=NO,h=this.get("initialSubstate"),f=this.get("substatesAreConcurrent"),d=this.get("statechart"),c=0,g=0,e=NO,a=null;this.set("substates",m);if(SC.kindOf(h,SC.HistoryState)&&h.isClass){a=this.createSubstate(h);this.set("initialSubstate",a);if(SC.none(a.get("defaultState"))){this.stateLogError("Initial substate is invalid. History state requires the name of a default state to be set");this.set("initialSubstate",null);a=null}}for(l in this){k=this[l];e=SC.typeOf(k)===SC.T_FUNCTION;if(e&&k.isEventHandler){this._registerEventHandler(l,k);continue}if(e&&k.isStateObserveHandler){this._registerStateObserveHandler(l,k);continue}if(e&&k.statePlugin){k=k.apply(this)}if(SC.kindOf(k,SC.State)&&k.isClass&&this[l]!==this.constructor){b=this._addSubstate(l,k);if(l===h){this.set("initialSubstate",b);j=YES}else{if(a&&a.get("defaultState")===l){a.set("defaultState",b);j=YES}}}}if(!SC.none(h)&&!j){this.stateLogError("Unable to set initial substate %@ since it did not match any of state's %@ substates".fmt(h,this))}if(m.length===0){if(!SC.none(h)){this.stateLogWarning("Unable to make %@ an initial substate since state %@ has no substates".fmt(h,this))}}else{if(m.length>0){b=this._addEmptyInitialSubstateIfNeeded();if(!b&&h&&f){this.set("initialSubstate",null);this.stateLogWarning("Can not use %@ as initial substate since substates are all concurrent for state %@".fmt(h,this))}}}this.notifyPropertyChange("substates");this.set("currentSubstates",[]);this.set("enteredSubstates",[]);this.set("stateIsInitialized",YES)},_setupRouteHandling:function(){var b=this.get("representRoute"),c=this.get("statechart"),a=this.get("statechartDelegate");if(!b){return}if(this.get("isConcurrentState")){this.stateLogError("State %@ cannot handle route '%@' since state is concurrent".fmt(this,b));return}a.statechartBindStateToRoute(c,this,b,this.routeTriggered)},routeTriggered:function(f){if(this._isEnteringState){return}var e=this.get("statechart"),b=this.get("statechartDelegate"),d=this.get("location");var a={state:this,location:d,params:f,handler:this.routeTriggered};var c=this.createStateRouteHandlerContext(a);if(b.statechartShouldStateHandleTriggeredRoute(e,this,c)){if(this.get("trace")&&d){this.stateLogTrace("will handle route '%@'".fmt(d))}this.handleTriggeredRoute(c)}else{b.statechartStateCancelledHandlingTriggeredRoute(e,this,c)}},createStateRouteHandlerContext:function(a){return SC.StateRouteHandlerContext.create(a)},handleTriggeredRoute:function(a){this.gotoState(this,a)},_addEmptyInitialSubstateIfNeeded:function(){var c=this.get("initialSubstate"),b=this.get("substatesAreConcurrent");if(c||b){return null}var a=this.createSubstate(SC.EmptyState);this.set("initialSubstate",a);this.get("substates").push(a);this[a.get("name")]=a;a.initState();this.stateLogWarning("state %@ has no initial substate defined. Will default to using an empty state as initial substate".fmt(this));return a},_addSubstate:function(c,d,a){var b=this.get("substates");a=SC.clone(a)||{};a.name=c;d=this.createSubstate(d,a);b.push(d);this[c]=d;d.initState();return d},addSubstate:function(c,e,b){if(SC.empty(c)){this.stateLogError("Can not add substate. name required");return null}if(this[c]!==undefined){this.stateLogError("Can not add substate '%@'. Already a defined property".fmt(c));return null}if(!this.get("stateIsInitialized")){this.stateLogError("Can not add substate '%@'. this state is not yet initialized".fmt(c));return null}var a=arguments.length;if(a===1){e=SC.State}else{if(a===2&&SC.typeOf(e)===SC.T_HASH){b=e;e=SC.State}}var d=SC.kindOf(e,SC.State)&&e.isClass;if(!d){this.stateLogError("Can not add substate '%@'. must provide a state class".fmt(c));return null}e=this._addSubstate(c,e,b);this._addEmptyInitialSubstateIfNeeded();this.notifyPropertyChange("substates");return e},createSubstate:function(b,a){a=a||{};return b.create({parentState:this,statechart:this.get("statechart")},a)},_registerEventHandler:function(b,e){var d=e.events,f=null,a=d.length,c=0;this._registeredEventHandlers[b]=e;for(;c<a;c+=1){f=d[c];if(SC.typeOf(f)===SC.T_STRING){this._registeredStringEventHandlers[f]={name:b,handler:e};continue}if(f instanceof RegExp){this._registeredRegExpEventHandlers.push({name:b,handler:e,regexp:f});continue}this.stateLogError("Invalid event %@ for event handler %@ in state %@".fmt(f,b,this))}},_registerStateObserveHandler:function(d,f){var e=0,c=f.args,b=c.length,a,g=YES;for(;e<b;e+=1){a=c[e];if(SC.typeOf(a)!==SC.T_STRING||SC.empty(a)){this.stateLogError("Invalid argument %@ for state observe handler %@ in state %@".fmt(a,d,this));g=NO}}if(!g){return}this._registeredStateObserveHandlers[d]=f.args},_registerWithParentStates:function(){var a=this.get("parentState");while(!SC.none(a)){a._registerSubstate(this);a=a.get("parentState")}},_registerSubstate:function(b){var c=b.pathRelativeTo(this);if(SC.none(c)){return}this._registeredSubstates.push(b);var a=this._registeredSubstatePaths;if(a[b.get("name")]===undefined){a[b.get("name")]={}}var d=a[b.get("name")];d[c]=b},pathRelativeTo:function(b){var c=this.get("name"),a=this.get("parentState");while(!SC.none(a)&&a!==b){c="%@.%@".fmt(a.get("name"),c);a=a.get("parentState")}if(a!==b&&b!==this){this.stateLogError("Can not generate relative path from %@ since it not a parent state of %@".fmt(b,this));return null}return c},getSubstate:function(f,h,e){if(!f){return null}var b=SC.typeOf(f);if(b===SC.T_OBJECT){return this._registeredSubstates.indexOf(f)>-1?f:null}if(b!==SC.T_STRING){this.stateLogError("Can not find matching subtype. value must be an object or string: %@".fmt(f));return null}var d=SC.StatePathMatcher.create({state:this,expression:f}),c=[],g;if(d.get("tokens").length===0){return null}var j=this._registeredSubstatePaths[d.get("lastPart")];if(!j){return this._notifySubstateNotFound(h,e,f)}for(g in j){if(d.match(g)){c.push(j[g])}}if(c.length===1){return c[0]}if(c.length>1){var i=[];for(g in j){i.push(g)}if(h){return this._notifySubstateNotFound(h,e,f,i)}var a="Can not find substate matching '%@' in state %@. Ambiguous with the following: %@";this.stateLogError(a.fmt(f,this.get("fullPath"),i.join(", ")))}return this._notifySubstateNotFound(h,e,f)},_notifySubstateNotFound:function(d,c,b,a){return d?d.call(c||this,this,b,a):null},getState:function(a){if(a===this.get("name")){return this}if(SC.kindOf(a,SC.State)){return a}return this.getSubstate(a,this._handleSubstateNotFound)},_handleSubstateNotFound:function(d,c,a){var b=this.get("parentState");if(b){return b.getState(c)}if(a){var e="Can not find state matching '%@'. Ambiguous with the following: %@";this.stateLogError(e.fmt(c,a.join(", ")))}return null},gotoState:function(c,a){var b=this.getState(c);if(!b){var d="can not go to state %@ from state %@. Invalid value.";this.stateLogError(d.fmt(c,this));return}var e=this.findFirstRelativeCurrentState(b);this.get("statechart").gotoState(b,e,false,a)},gotoHistoryState:function(d,a,b){var c=this.getState(d);if(!c){var e="can not go to history state %@ from state %@. Invalid value.";this.stateLogError(e.fmt(d,this));return}var f=this.findFirstRelativeCurrentState(c);this.get("statechart").gotoHistoryState(c,f,a,b)},resumeGotoState:function(){this.get("statechart").resumeGotoState()},stateIsCurrentSubstate:function(a){if(SC.typeOf(a)===SC.T_STRING){a=this.get("statechart").getState(a)}var b=this.get("currentSubstates");return !!b&&b.indexOf(a)>=0},stateIsEnteredSubstate:function(b){if(SC.typeOf(b)===SC.T_STRING){b=this.get("statechart").getState(b)}var a=this.get("enteredSubstates");return !!a&&a.indexOf(b)>=0},isRootState:function(){return this.getPath("statechart.rootState")===this}.property(),isCurrentState:function(){return this.stateIsCurrentSubstate(this)}.property("currentSubstates").cacheable(),isConcurrentState:function(){return this.getPath("parentState.substatesAreConcurrent")}.property(),isEnteredState:function(){return this.stateIsEnteredSubstate(this)}.property("enteredSubstates").cacheable(),hasSubstates:function(){return this.getPath("substates.length")>0}.property("substates"),hasCurrentSubstates:function(){var a=this.get("currentSubstates");return !!a&&a.get("length")>0}.property("currentSubstates").cacheable(),hasEnteredSubstates:function(){var a=this.get("enteredSubstates");return !!a&&a.get("length")>0}.property("enteredSubstates").cacheable(),findFirstRelativeCurrentState:function(b){if(this.get("isCurrentState")){return this}var a=this.get("currentSubstates")||[],d=a.get("length"),c=this.get("parentState");if(d===0){return c?c.findFirstRelativeCurrentState():null}if(d>1){b=this.getSubstate(b);if(b){return b.findFirstRelativeCurrentState()}}return a[0]},reenter:function(){if(this.get("isEnteredState")){this.gotoState(this)}else{SC.Logger.error("Can not re-enter state %@ since it is not an entered state in the statechart".fmt(this))}},tryToHandleEvent:function(a,e,d){var c=this.get("trace"),h=this.get("statechart"),g;if(this._registeredEventHandlers[a]){this.stateLogWarning("state %@ can not handle event '%@' since it is a registered event handler".fmt(this,a));return NO}if(this._registeredStateObserveHandlers[a]){this.stateLogWarning("state %@ can not handle event '%@' since it is a registered state observe handler".fmt(this,a));return NO}if(SC.typeOf(this[a])===SC.T_FUNCTION){if(c){this.stateLogTrace("will handle event '%@'".fmt(a))}h.stateWillTryToHandleEvent(this,a,a);g=(this[a](e,d)!==NO);h.stateDidTryToHandleEvent(this,a,a,g);return g}var j=this._registeredStringEventHandlers[a];if(j){if(c){this.stateLogTrace("%@ will handle event '%@'".fmt(j.name,a))}h.stateWillTryToHandleEvent(this,a,j.name);g=(j.handler.call(this,a,e,d)!==NO);h.stateDidTryToHandleEvent(this,a,j.name,g);return g}var f=this._registeredRegExpEventHandlers.length,b=0;for(;b<f;b+=1){j=this._registeredRegExpEventHandlers[b];if(a.match(j.regexp)){if(c){this.stateLogTrace("%@ will handle event '%@'".fmt(j.name,a))}h.stateWillTryToHandleEvent(this,a,j.name);g=(j.handler.call(this,a,e,d)!==NO);h.stateDidTryToHandleEvent(this,a,j.name,g);return g}}if(SC.typeOf(this["unknownEvent"])===SC.T_FUNCTION){if(c){this.stateLogTrace("unknownEvent will handle event '%@'".fmt(a))}h.stateWillTryToHandleEvent(this,a,"unknownEvent");g=(this.unknownEvent(a,e,d)!==NO);h.stateDidTryToHandleEvent(this,a,"unknownEvent",g);return g}return NO},enterState:function(a){},stateWillBecomeEntered:function(a){this._isEnteringState=YES},stateDidBecomeEntered:function(a){this._setupAllStateObserveHandlers();this._isEnteringState=NO},exitState:function(a){},stateWillBecomeExited:function(a){this._isExitingState=YES;this._teardownAllStateObserveHandlers()},stateDidBecomeExited:function(a){this._isExitingState=NO},_setupAllStateObserveHandlers:function(){this._configureAllStateObserveHandlers("addObserver")},_teardownAllStateObserveHandlers:function(){this._configureAllStateObserveHandlers("removeObserver")},_configureAllStateObserveHandlers:function(b){var g,h,f,a,j,d,c,e;for(g in this._registeredStateObserveHandlers){h=this._registeredStateObserveHandlers[g];for(c=0;c<h.length;c+=1){j=h[c];d=g;a=j.indexOf(".");if(a<0){this[b](j,this,d)}else{if(j.indexOf("*")===0){this[b](j.slice(1),this,d)}else{e=null;if(a===0){e=this;j=j.slice(1)}else{if(a===4&&j.slice(0,5)==="this."){e=this;j=j.slice(5)}else{if(a<0&&j.length===4&&j==="this"){e=this;j=""}}}SC.Observers[b](j,this,d,e)}}}}},performAsync:function(c,b,a){return SC.Async.perform(c,b,a)},respondsToEvent:function(d){if(this._registeredEventHandlers[d]){return false}if(SC.typeOf(this[d])===SC.T_FUNCTION){return true}if(this._registeredStringEventHandlers[d]){return true}if(this._registeredStateObserveHandlers[d]){return false}var a=this._registeredRegExpEventHandlers.length,b=0,c;for(;b<a;b+=1){c=this._registeredRegExpEventHandlers[b];if(d.match(c.regexp)){return true}}return SC.typeOf(this["unknownEvent"])===SC.T_FUNCTION},fullPath:function(){var a=this.getPath("statechart.rootState");if(!a){return this.get("name")}return this.pathRelativeTo(a)}.property("name","parentState").cacheable(),toString:function(){return this.get("fullPath")},_enteredSubstatesDidChange:function(){this.notifyPropertyChange("enteredSubstates")}.observes("*enteredSubstates.[]"),_currentSubstatesDidChange:function(){this.notifyPropertyChange("currentSubstates")}.observes("*currentSubstates.[]"),_statechartTraceDidChange:function(){this.notifyPropertyChange("trace")},_statechartOwnerDidChange:function(){this.notifyPropertyChange("owner")},stateLogTrace:function(b){var a=this.get("statechart");a.statechartLogTrace("%@: %@".fmt(this,b))},stateLogWarning:function(b){var a=this.get("statechart");a.statechartLogWarning(b)},stateLogError:function(b){var a=this.get("statechart");a.statechartLogError(b)}});SC.State.plugin=function(c){var a=SC.A(arguments);a.shift();var b=function(){var d=SC.objectForPropertyPath(c);if(!d){console.error("SC.State.plugin: Unable to determine path %@".fmt(c));return undefined}if(!d.isClass||!d.kindOf(SC.State)){console.error("SC.State.plugin: Unable to extend. %@ must be a class extending from SC.State".fmt(c));return undefined}return d.extend.apply(d,a)};b.statePlugin=YES;return b};SC.State.design=SC.State.extend;sc_require("system/state");SC.EMPTY_STATE_NAME="__EMPTY_STATE__";SC.EmptyState=SC.State.extend({name:SC.EMPTY_STATE_NAME,enterState:function(){var a="No initial substate was defined for state %@. Entering default empty state";this.stateLogWarning(a.fmt(this.get("parentState")))}});sc_require("system/state");SC.HistoryState=SC.Object.extend({isRecursive:NO,defaultState:null,statechart:null,parentState:null,state:function(){var b=this.get("defaultState"),a=this.getPath("parentState.historyState");return !!a?a:b}.property().cacheable(),parentHistoryStateDidChange:function(){this.notifyPropertyChange("state")}.observes("*parentState.historyState")});SC.StateRouteHandlerContext=SC.Object.extend({state:null,location:null,params:null,handler:null,retry:function(){var b=this.get("state"),c=this.get("params"),a=this.get("handler");if(SC.typeOf(a)===SC.T_STRING){a=b[a]}if(SC.typeOf(a)===SC.T_FUNCTION){a.apply(b,[c])}}});sc_require("system/state");sc_require("mixins/statechart_delegate");SC.StatechartManager={isResponderContext:YES,isStatechart:YES,statechartIsInitialized:NO,name:null,rootState:null,rootStateExample:SC.State,initialState:null,statesAreConcurrent:NO,monitorIsActive:NO,monitor:null,statechartTraceKey:"trace",trace:NO,statechartOwnerKey:"owner",owner:null,autoInitStatechart:YES,suppressStatechartWarnings:NO,delegate:null,statechartDelegate:function(){var a=this.get("delegate");return this.delegateFor("isStatechartDelegate",a)}.property("delegate"),initMixin:function(){if(this.get("autoInitStatechart")){this.initStatechart()}},destroyMixin:function(){var b=this.get("rootState"),a=this.get("statechartTraceKey");this.removeObserver(a,this,"_statechartTraceDidChange");b.destroy();this.set("rootState",null)},initStatechart:function(){if(this.get("statechartIsInitialized")){return}this._gotoStateLocked=NO;this._sendEventLocked=NO;this._pendingStateTransitions=[];this._pendingSentEvents=[];this.sendAction=this.sendEvent;if(this.get("monitorIsActive")){this.set("monitor",SC.StatechartMonitor.create({statechart:this}))}var a=this.get("statechartTraceKey");this.addObserver(a,this,"_statechartTraceDidChange");this._statechartTraceDidChange();var d=this.get("allowStatechartTracing"),c=this.get("rootState"),e;if(d){this.statechartLogTrace("BEGIN initialize statechart")}if(!c){c=this._constructRootStateClass()}else{if(SC.typeOf(c)===SC.T_FUNCTION&&c.statePlugin){c=c.apply(this)}}if(!(SC.kindOf(c,SC.State)&&c.isClass)){e="Unable to initialize statechart. Root state must be a state class";this.statechartLogError(e);throw e}c=this.createRootState(c,{statechart:this,name:SC.ROOT_STATE_NAME});this.set("rootState",c);c.initState();if(SC.kindOf(c.get("initialSubstate"),SC.EmptyState)){e="Unable to initialize statechart. Root state must have an initial substate explicilty defined";this.statechartLogError(e);throw e}if(!SC.empty(this.get("initialState"))){var b="initialState";this.set(b,c.get(this.get(b)))}this.set("statechartIsInitialized",YES);this.gotoState(c);if(d){this.statechartLogTrace("END initialize statechart")}},createRootState:function(b,a){if(!a){a={}}b=b.create(a);return b},currentStates:function(){return this.getPath("rootState.currentSubstates")}.property().cacheable(),firstCurrentState:function(){var a=this.get("currentStates");return a?a.objectAt(0):null}.property("currentStates").cacheable(),currentStateCount:function(){return this.getPath("currentStates.length")}.property("currentStates").cacheable(),stateIsCurrentState:function(a){return this.get("rootState").stateIsCurrentSubstate(a)},enteredStates:function(){return this.getPath("rootState.enteredSubstates")}.property().cacheable(),stateIsEntered:function(a){return this.get("rootState").stateIsEnteredSubstate(a)},doesContainState:function(a){return !SC.none(this.getState(a))},getState:function(b){var a=this.get("rootState");return a===b?a:a.getSubstate(b)},gotoState:function(b,k,l,c){if(!this.get("statechartIsInitialized")){this.statechartLogError("can not go to state %@. statechart has not yet been initialized".fmt(b));return}if(this.get("isDestroyed")){this.statechartLogError("can not go to state %@. statechart is destroyed".fmt(this));return}var i=this._processGotoStateArgs(arguments);b=i.state;k=i.fromCurrentState;l=i.useHistory;c=i.context;var n=null,j=[],m=[],f=this.get("allowStatechartTracing"),a=this.get("rootState"),h=b,e=k,d;b=this.getState(b);if(SC.none(b)){this.statechartLogError("Can not to goto state %@. Not a recognized state in statechart".fmt(h));return}if(this._gotoStateLocked){this._pendingStateTransitions.push({state:b,fromCurrentState:k,useHistory:l,context:c});return}this._gotoStateLocked=YES;if(k){k=this.getState(k);if(SC.none(k)||!k.get("isCurrentState")){d="Can not to goto state %@. %@ is not a recognized current state in statechart";this.statechartLogError(d.fmt(h,e));this._gotoStateLocked=NO;return}}else{k=b.findFirstRelativeCurrentState();if(!k){k=this.get("firstCurrentState")}}if(f){this.statechartLogTrace("BEGIN gotoState: %@".fmt(b));d="starting from current state: %@";d=d.fmt(k?k:"---");this.statechartLogTrace(d);d="current states before: %@";d=d.fmt(this.getPath("currentStates.length")>0?this.get("currentStates"):"---");this.statechartLogTrace(d)}if(!SC.none(k)){j=this._createStateChain(k)}m=this._createStateChain(b);n=this._findPivotState(j,m);if(n){if(f){this.statechartLogTrace("pivot state = %@".fmt(n))}if(n.get("substatesAreConcurrent")&&n!==b){this.statechartLogError("Can not go to state %@ from %@. Pivot state %@ has concurrent substates.".fmt(b,k,n));this._gotoStateLocked=NO;return}}var g=[];this._traverseStatesToExit(j.shift(),j,n,g);if(n!==b){this._traverseStatesToEnter(m.pop(),m,n,l,g)}else{this._traverseStatesToExit(n,[],null,g);this._traverseStatesToEnter(n,null,null,l,g)}this._gotoStateActions=g;this._executeGotoStateActions(b,g,null,c)},gotoStateActive:function(){return this._gotoStateLocked}.property(),gotoStateSuspended:function(){return this._gotoStateLocked&&!!this._gotoStateSuspendedPoint}.property(),resumeGotoState:function(){if(!this.get("gotoStateSuspended")){this.statechartLogError("Can not resume goto state since it has not been suspended");return}var a=this._gotoStateSuspendedPoint;this._executeGotoStateActions(a.gotoState,a.actions,a.marker,a.context)},_executeGotoStateActions:function(g,f,b,c){var e=null,a=f.length,d=null;b=SC.none(b)?0:b;for(;b<a;b+=1){this._currentGotoStateAction=e=f[b];switch(e.action){case SC.EXIT_STATE:d=this._exitState(e.state,c);break;case SC.ENTER_STATE:d=this._enterState(e.state,e.currentState,c);break}if(SC.kindOf(d,SC.Async)){this._gotoStateSuspendedPoint={gotoState:g,actions:f,marker:b+1,context:c};d.tryToPerform(e.state);return}}this.beginPropertyChanges();this.notifyPropertyChange("currentStates");this.notifyPropertyChange("enteredStates");this.endPropertyChanges();if(this.get("allowStatechartTracing")){this.statechartLogTrace("current states after: %@".fmt(this.get("currentStates")));this.statechartLogTrace("END gotoState: %@".fmt(g))}this._cleanupStateTransition()},_cleanupStateTransition:function(){this._currentGotoStateAction=null;this._gotoStateSuspendedPoint=null;this._gotoStateActions=null;this._gotoStateLocked=NO;this._flushPendingStateTransition()},_exitState:function(d,b){var c;if(d.get("currentSubstates").indexOf(d)>=0){c=d.get("parentState");while(c){c.get("currentSubstates").removeObject(d);c=c.get("parentState")}}c=d;while(c){c.get("enteredSubstates").removeObject(d);c=c.get("parentState")}if(this.get("allowStatechartTracing")){this.statechartLogTrace("<-- exiting state: %@".fmt(d))}d.set("currentSubstates",[]);d.stateWillBecomeExited(b);var a=this.exitState(d,b);d.stateDidBecomeExited(b);if(this.get("monitorIsActive")){this.get("monitor").pushExitedState(d)}d._traverseStatesToExit_skipState=NO;return a},exitState:function(b,a){return b.exitState(a)},_enterState:function(d,e,b){var c=d.get("parentState");if(c&&!d.get("isConcurrentState")){c.set("historyState",d)}if(e){c=d;while(c){c.get("currentSubstates").pushObject(d);c=c.get("parentState")}}c=d;while(c){c.get("enteredSubstates").pushObject(d);c=c.get("parentState")}if(this.get("allowStatechartTracing")){this.statechartLogTrace("--> entering state: %@".fmt(d))}d.stateWillBecomeEntered(b);var a=this.enterState(d,b);d.stateDidBecomeEntered(b);if(this.get("monitorIsActive")){this.get("monitor").pushEnteredState(d)}return a},enterState:function(b,a){if(b.enterStateByRoute&&SC.kindOf(a,SC.StateRouteHandlerContext)){return b.enterStateByRoute(a)}else{return b.enterState(a)}},gotoHistoryState:function(f,e,c,d){if(!this.get("statechartIsInitialized")){this.statechartLogError("can not go to state %@'s history state. Statechart has not yet been initialized".fmt(f));return}var b=this._processGotoStateArgs(arguments);f=b.state;e=b.fromCurrentState;c=b.useHistory;d=b.context;f=this.getState(f);if(!f){this.statechartLogError("Can not to goto state %@'s history state. Not a recognized state in statechart".fmt(f));return}var a=f.get("historyState");if(!c){if(a){this.gotoState(a,e,d)}else{this.gotoState(f,e,d)}}else{this.gotoState(f,e,YES,d)}},sendEvent:function(b,g,f){if(this.get("isDestroyed")){this.statechartLogError("can send event %@. statechart is destroyed".fmt(b));return}var c=NO,l=NO,h=this.get("currentStates").slice(),k={},j=0,e=0,a=null,d=this.get("allowStatechartTracing");if(this._sendEventLocked||this._goStateLocked){this._pendingSentEvents.push({event:b,arg1:g,arg2:f});return}this._sendEventLocked=YES;if(d){this.statechartLogTrace("BEGIN sendEvent: '%@'".fmt(b))}j=h.get("length");for(;e<j;e+=1){l=NO;a=h[e];if(!a.get("isCurrentState")){continue}while(!l&&a){if(!k[a.get("fullPath")]){l=a.tryToHandleEvent(b,g,f);k[a.get("fullPath")]=YES}if(!l){a=a.get("parentState")}else{c=YES}}}this._sendEventLocked=NO;if(d){if(!c){this.statechartLogTrace("No state was able handle event %@".fmt(b))}this.statechartLogTrace("END sendEvent: '%@'".fmt(b))}var m=this._flushPendingSentEvents();return c?this:(m?this:null)},stateWillTryToHandleEvent:function(c,b,a){this._stateHandleEventInfo={state:c,event:b,handler:a}},stateDidTryToHandleEvent:function(c,b,a,d){this._stateHandleEventInfo=null},_createStateChain:function(b){var a=[];while(b){a.push(b);b=b.get("parentState")}return a},_findPivotState:function(c,b){if(c.length===0||b.length===0){return null}var a=c.find(function(e,d){if(b.indexOf(e)>=0){return YES}});return a},_traverseStatesToExit:function(b,k,d,h){if(!b||b===d){return}var e=this.get("allowStatechartTracing");if(b.get("substatesAreConcurrent")){var f=0,g=b.get("currentSubstates"),j=g.length,c=null;for(;f<j;f+=1){c=g[f];if(c._traverseStatesToExit_skipState===YES){continue}var a=this._createStateChain(c);this._traverseStatesToExit(a.shift(),a,b,h)}}h.push({action:SC.EXIT_STATE,state:b});if(b.get("isCurrentState")){b._traverseStatesToExit_skipState=YES}this._traverseStatesToExit(k.shift(),k,d,h)},_traverseStatesToEnter:function(b,e,i,g,d){if(!b){return}var c=this.get("allowStatechartTracing");if(i){if(b!==i){this._traverseStatesToEnter(e.pop(),e,i,g,d)}else{this._traverseStatesToEnter(e.pop(),e,null,g,d)}}else{if(!e||e.length===0){var h={action:SC.ENTER_STATE,state:b,currentState:NO};d.push(h);var f=b.get("initialSubstate"),a=b.get("historyState");if(b.get("substatesAreConcurrent")){this._traverseConcurrentStatesToEnter(b.get("substates"),null,g,d)}else{if(b.get("hasSubstates")&&a&&g){this._traverseStatesToEnter(a,null,null,g,d)}else{if(f){if(SC.kindOf(f,SC.HistoryState)){if(!g){g=f.get("isRecursive")}f=f.get("state")}this._traverseStatesToEnter(f,null,null,g,d)}else{h.currentState=YES}}}}else{if(e.length>0){d.push({action:SC.ENTER_STATE,state:b});var j=e.pop();this._traverseStatesToEnter(j,e,null,g,d);if(b.get("substatesAreConcurrent")){this._traverseConcurrentStatesToEnter(b.get("substates"),j,g,d)}}}}},respondsTo:function(d){var b=this.get("currentStates"),a=b.get("length"),c=0,e=null;for(;c<a;c+=1){e=b.objectAt(c);while(e){if(e.respondsToEvent(d)){return true}e=e.get("parentState")}}return SC.typeOf(this[d])===SC.T_FUNCTION},tryToPerform:function(d,c,b){if(!this.respondsTo(d)){return NO}if(SC.typeOf(this[d])===SC.T_FUNCTION){var a=this[d](c,b);if(a!==NO){return YES}}return !!this.sendEvent(d,c,b)},invokeStateMethod:function(k,j,c){if(k==="unknownEvent"){this.statechartLogError("can not invoke method unkownEvent");return}j=SC.A(arguments);j.shift();var f=j.length,m=f>0?j[f-1]:null,l=SC.typeOf(m)===SC.T_FUNCTION?j.pop():null,e=this.get("currentStates"),d=0,b=null,h={},a,n=undefined,g=0;f=e.get("length");for(;d<f;d+=1){b=e.objectAt(d);while(b){if(h[b.get("fullPath")]){break}h[b.get("fullPath")]=YES;a=b[k];if(SC.typeOf(a)===SC.T_FUNCTION&&!a.isEventHandler){n=a.apply(b,j);if(l){l.call(this,b,n)}g+=1;break}b=b.get("parentState")}}return g===1?n:undefined},_traverseConcurrentStatesToEnter:function(d,c,f,b){var e=0,a=d.length,g=null;for(;e<a;e+=1){g=d[e];if(g!==c){this._traverseStatesToEnter(g,null,null,f,b)}}},_flushPendingStateTransition:function(){if(!this._pendingStateTransitions){this.statechartLogError("Unable to flush pending state transition. _pendingStateTransitions is invalid");return}var a=this._pendingStateTransitions.shift();if(!a){return}this.gotoState(a.state,a.fromCurrentState,a.useHistory,a.context)},_flushPendingSentEvents:function(){var a=this._pendingSentEvents.shift();if(!a){return null}return this.sendEvent(a.event,a.arg1,a.arg2)},_monitorIsActiveDidChange:function(){if(this.get("monitorIsActive")&&SC.none(this.get("monitor"))){this.set("monitor",SC.StatechartMonitor.create())}}.observes("monitorIsActive"),_processGotoStateArgs:function(b){var d={state:null,fromCurrentState:null,useHistory:false,context:null},a=null,c=null;b=SC.$A(b);b=b.filter(function(e){return !(e===undefined)});a=b.length;if(a<1){return d}d.state=b[0];if(a===2){c=b[1];switch(SC.typeOf(c)){case SC.T_BOOL:d.useHistory=c;break;case SC.T_HASH:case SC.T_OBJECT:if(!SC.kindOf(c,SC.State)){d.context=c}break;default:d.fromCurrentState=c}}else{if(a===3){c=b[1];if(SC.typeOf(c)===SC.T_BOOL){d.useHistory=c;d.context=b[2]}else{d.fromCurrentState=c;c=b[2];if(SC.typeOf(c)===SC.T_BOOL){d.useHistory=c}else{d.context=c}}}else{d.fromCurrentState=b[1];d.useHistory=b[2];d.context=b[3]}}return d},_constructRootStateClass:function(){var d="rootStateExample",e=this.get(d),b=this.get("initialState"),c=this.get("statesAreConcurrent"),a=0,i,g,f,h={};if(SC.typeOf(e)===SC.T_FUNCTION&&e.statePlugin){e=e.apply(this)}if(!(SC.kindOf(e,SC.State)&&e.isClass)){this._logStatechartCreationError("Invalid root state example");return null}if(c&&!SC.empty(b)){this._logStatechartCreationError("Can not assign an initial state when states are concurrent")}else{if(c){h.substatesAreConcurrent=YES}else{if(SC.typeOf(b)===SC.T_STRING){h.initialSubstate=b}else{this._logStatechartCreationError("Must either define initial state or assign states as concurrent");return null}}}for(i in this){if(i===d){continue}g=this[i];f=SC.typeOf(g)===SC.T_FUNCTION;if(f&&g.statePlugin){g=g.apply(this)}if(SC.kindOf(g,SC.State)&&g.isClass&&this[i]!==this.constructor){h[i]=g;a+=1}}if(a===0){this._logStatechartCreationError("Must define one or more states");return null}return e.extend(h)},_logStatechartCreationError:function(a){SC.Logger.error("Unable to create statechart for %@: %@.".fmt(this,a))},statechartLogTrace:function(a){SC.Logger.info("%@: %@".fmt(this.get("statechartLogPrefix"),a))},statechartLogError:function(a){SC.Logger.error("ERROR %@: %@".fmt(this.get("statechartLogPrefix"),a))},statechartLogWarning:function(a){if(this.get("suppressStatechartWarnings")){return}SC.Logger.warn("WARN %@: %@".fmt(this.get("statechartLogPrefix"),a))},statechartLogPrefix:function(){var b=SC._object_className(this.constructor),a=this.get("name"),c;if(SC.empty(a)){c="%@<%@>".fmt(b,SC.guidFor(this))}else{c="%@<%@, %@>".fmt(b,a,SC.guidFor(this))}return c}.property().cacheable(),allowStatechartTracing:function(){var a=this.get("statechartTraceKey");return this.get(a)}.property().cacheable(),_statechartTraceDidChange:function(){this.notifyPropertyChange("allowStatechartTracing")},details:function(){var b={initialized:this.get("statechartIsInitialized")};if(this.get("name")){b.name=this.get("name")}if(!this.get("statechartIsInitialized")){return b}b["current-states"]=[];this.get("currentStates").forEach(function(f){b["current-states"].push(f.get("fullPath"))});var a={active:this.get("gotoStateActive"),suspended:this.get("gotoStateSuspended")};if(this._gotoStateActions){a["transition-sequence"]=[];var e=this._gotoStateActions,c=function(g){var f=g.action===SC.ENTER_STATE?"enter":"exit";return"%@ %@".fmt(f,g.state.get("fullPath"))};e.forEach(function(f){a["transition-sequence"].push(c(f))});a["current-transition"]=c(this._currentGotoStateAction)}b["state-transition"]=a;if(this._stateHandleEventInfo){var d=this._stateHandleEventInfo;b["handling-event"]={state:d.state.get("fullPath"),event:d.event,handler:d.handler}}else{b["handling-event"]=false}return b}.property(),toStringWithDetails:function(){var b="",c=this.toString(),a=this.get("details");b+=c+"\n";b+=this._hashToString(a,2);return b},_hashToString:function(d,a){var e="";for(var b in d){var c=d[b];if(c instanceof Array){e+=this._arrayToString(b,c,a)+"\n"}else{if(c instanceof Object){e+="%@%@:\n".fmt(" ".mult(a),b);e+=this._hashToString(c,a+2)}else{e+="%@%@: %@\n".fmt(" ".mult(a),b,c)}}}return e},_arrayToString:function(b,d,a){if(d.length===0){return"%@%@: []".fmt(" ".mult(a),b)}var c="%@%@: [\n".fmt(" ".mult(a),b);d.forEach(function(f,e){c+="%@%@\n".fmt(" ".mult(a+2),f)},this);c+=" ".mult(a)+"]";return c}};SC.mixin(SC.StatechartManager,SC.StatechartDelegate,SC.DelegateSupport);SC.ROOT_STATE_NAME="__ROOT_STATE__";SC.EXIT_STATE=0;SC.ENTER_STATE=1;SC.Statechart=SC.Object.extend(SC.StatechartManager,{autoInitStatechart:NO});SC.Statechart.design=SC.Statechart.extend;var Handlebars={};Handlebars.VERSION="1.0.beta.2";Handlebars.helpers={};Handlebars.partials={};Handlebars.registerHelper=function(b,c,a){if(a){c.not=a}this.helpers[b]=c};Handlebars.registerPartial=function(a,b){this.partials[a]=b};Handlebars.registerHelper("helperMissing",function(a){if(arguments.length===2){return undefined}else{throw new Error("Could not find property '"+a+"'")}});Handlebars.registerHelper("blockHelperMissing",function(f,d){var a=d.inverse||function(){},h=d.fn;var c="";var g=Object.prototype.toString.call(f);if(g==="[object Function]"){f=f()}if(f===true){return h(this)}else{if(f===false||f==null){return a(this)}else{if(g==="[object Array]"){if(f.length>0){for(var e=0,b=f.length;e<b;e++){c=c+h(f[e])}}else{c=a(this)}return c}else{return h(f)}}}});Handlebars.registerHelper("each",function(f,d){var g=d.fn,a=d.inverse;var c="";if(f&&f.length>0){for(var e=0,b=f.length;e<b;e++){c=c+g(f[e])}}else{c=a(this)}return c});Handlebars.registerHelper("if",function(b,a){if(!b||Handlebars.Utils.isEmpty(b)){return a.inverse(this)}else{return a.fn(this)}});Handlebars.registerHelper("unless",function(c,b){var d=b.fn,a=b.inverse;b.fn=a;b.inverse=d;return Handlebars.helpers["if"].call(this,c,b)});Handlebars.registerHelper("with",function(b,a){return a.fn(b)});Handlebars.registerHelper("log",function(a){Handlebars.log(a)});var handlebars=(function(){var f={trace:function c(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,statements:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,OPEN_PARTIAL:24,params:25,hash:26,param:27,STRING:28,INTEGER:29,BOOLEAN:30,hashSegments:31,hashSegment:32,ID:33,EQUALS:34,pathSegments:35,SEP:36,"$accept":0,"$end":1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",28:"STRING",29:"INTEGER",30:"BOOLEAN",33:"ID",34:"EQUALS",36:"SEP"},productions_:[0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[25,2],[25,1],[27,1],[27,1],[27,1],[27,1],[26,1],[31,2],[31,1],[32,3],[32,3],[32,3],[32,3],[21,1],[35,3],[35,1]],performAction:function b(g,j,k,n,m,i,l){var h=i.length-1;switch(m){case 1:return i[h-1];break;case 2:this.$=new n.ProgramNode(i[h-2],i[h]);break;case 3:this.$=new n.ProgramNode(i[h]);break;case 4:this.$=new n.ProgramNode([]);break;case 5:this.$=[i[h]];break;case 6:i[h-1].push(i[h]);this.$=i[h-1];break;case 7:this.$=new n.InverseNode(i[h-2],i[h-1],i[h]);break;case 8:this.$=new n.BlockNode(i[h-2],i[h-1],i[h]);break;case 9:this.$=i[h];break;case 10:this.$=i[h];break;case 11:this.$=new n.ContentNode(i[h]);break;case 12:this.$=new n.CommentNode(i[h]);break;case 13:this.$=new n.MustacheNode(i[h-1][0],i[h-1][1]);break;case 14:this.$=new n.MustacheNode(i[h-1][0],i[h-1][1]);break;case 15:this.$=i[h-1];break;case 16:this.$=new n.MustacheNode(i[h-1][0],i[h-1][1]);break;case 17:this.$=new n.MustacheNode(i[h-1][0],i[h-1][1],true);break;case 18:this.$=new n.PartialNode(i[h-1]);break;case 19:this.$=new n.PartialNode(i[h-2],i[h-1]);break;case 20:break;case 21:this.$=[[i[h-2]].concat(i[h-1]),i[h]];break;case 22:this.$=[[i[h-1]].concat(i[h]),null];break;case 23:this.$=[[i[h-1]],i[h]];break;case 24:this.$=[[i[h]],null];break;case 25:i[h-1].push(i[h]);this.$=i[h-1];break;case 26:this.$=[i[h]];break;case 27:this.$=i[h];break;case 28:this.$=new n.StringNode(i[h]);break;case 29:this.$=new n.IntegerNode(i[h]);break;case 30:this.$=new n.BooleanNode(i[h]);break;case 31:this.$=new n.HashNode(i[h]);break;case 32:i[h-1].push(i[h]);this.$=i[h-1];break;case 33:this.$=[i[h]];break;case 34:this.$=[i[h-2],i[h]];break;case 35:this.$=[i[h-2],new n.StringNode(i[h])];break;case 36:this.$=[i[h-2],new n.IntegerNode(i[h])];break;case 37:this.$=[i[h-2],new n.BooleanNode(i[h])];break;case 38:this.$=new n.IdNode(i[h]);break;case 39:i[h-2].push(i[h]);this.$=i[h-2];break;case 40:this.$=[i[h]];break}},table:[{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,33:[1,25],35:24},{17:26,21:23,33:[1,25],35:24},{17:27,21:23,33:[1,25],35:24},{17:28,21:23,33:[1,25],35:24},{21:29,33:[1,25],35:24},{1:[2,1]},{6:30,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,31],21:23,33:[1,25],35:24},{10:32,20:[1,33]},{10:34,20:[1,33]},{18:[1,35]},{18:[2,24],21:40,25:36,26:37,27:38,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,38],28:[2,38],29:[2,38],30:[2,38],33:[2,38],36:[1,46]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],36:[2,40]},{18:[1,47]},{18:[1,48]},{18:[1,49]},{18:[1,50],21:51,33:[1,25],35:24},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:52,33:[1,25],35:24},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:40,26:53,27:54,28:[1,41],29:[1,42],30:[1,43],31:39,32:44,33:[1,45],35:24},{18:[2,23]},{18:[2,26],28:[2,26],29:[2,26],30:[2,26],33:[2,26]},{18:[2,31],32:55,33:[1,56]},{18:[2,27],28:[2,27],29:[2,27],30:[2,27],33:[2,27]},{18:[2,28],28:[2,28],29:[2,28],30:[2,28],33:[2,28]},{18:[2,29],28:[2,29],29:[2,29],30:[2,29],33:[2,29]},{18:[2,30],28:[2,30],29:[2,30],30:[2,30],33:[2,30]},{18:[2,33],33:[2,33]},{18:[2,40],28:[2,40],29:[2,40],30:[2,40],33:[2,40],34:[1,57],36:[2,40]},{33:[1,58]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,59]},{18:[1,60]},{18:[2,21]},{18:[2,25],28:[2,25],29:[2,25],30:[2,25],33:[2,25]},{18:[2,32],33:[2,32]},{34:[1,57]},{21:61,28:[1,62],29:[1,63],30:[1,64],33:[1,25],35:24},{18:[2,39],28:[2,39],29:[2,39],30:[2,39],33:[2,39],36:[2,39]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,34],33:[2,34]},{18:[2,35],33:[2,35]},{18:[2,36],33:[2,36]},{18:[2,37],33:[2,37]}],defaultActions:{16:[2,1],37:[2,23],53:[2,21]},parseError:function d(h,g){throw new Error(h)},parse:function e(o){var x=this,l=[0],G=[null],s=[],H=this.table,h="",q=0,E=0,j=0,n=2,u=1;this.lexer.setInput(o);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;if(typeof this.lexer.yylloc=="undefined"){this.lexer.yylloc={}}var i=this.lexer.yylloc;s.push(i);if(typeof this.yy.parseError==="function"){this.parseError=this.yy.parseError}function w(p){l.length=l.length-2*p;G.length=G.length-p;s.length=s.length-p}function v(){var p;p=x.lexer.lex()||1;if(typeof p!=="number"){p=x.symbols_[p]||p}return p}var D,z,k,C,I,t,B={},y,F,g,m;while(true){k=l[l.length-1];if(this.defaultActions[k]){C=this.defaultActions[k]}else{if(D==null){D=v()}C=H[k]&&H[k][D]}if(typeof C==="undefined"||!C.length||!C[0]){if(!j){m=[];for(y in H[k]){if(this.terminals_[y]&&y>2){m.push("'"+this.terminals_[y]+"'")}}var A="";if(this.lexer.showPosition){A="Parse error on line "+(q+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+m.join(", ")}else{A="Parse error on line "+(q+1)+": Unexpected "+(D==1?"end of input":("'"+(this.terminals_[D]||D)+"'"))}this.parseError(A,{text:this.lexer.match,token:this.terminals_[D]||D,line:this.lexer.yylineno,loc:i,expected:m})}if(j==3){if(D==u){throw new Error(A||"Parsing halted.")}E=this.lexer.yyleng;h=this.lexer.yytext;q=this.lexer.yylineno;i=this.lexer.yylloc;D=v()}while(1){if((n.toString()) in H[k]){break}if(k==0){throw new Error(A||"Parsing halted.")}w(1);k=l[l.length-1]}z=D;D=n;k=l[l.length-1];C=H[k]&&H[k][n];j=3}if(C[0] instanceof Array&&C.length>1){throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+D)}switch(C[0]){case 1:l.push(D);G.push(this.lexer.yytext);s.push(this.lexer.yylloc);l.push(C[1]);D=null;if(!z){E=this.lexer.yyleng;h=this.lexer.yytext;q=this.lexer.yylineno;i=this.lexer.yylloc;if(j>0){j--}}else{D=z;z=null}break;case 2:F=this.productions_[C[1]][1];B.$=G[G.length-F];B._$={first_line:s[s.length-(F||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(F||1)].first_column,last_column:s[s.length-1].last_column};t=this.performAction.call(B,h,E,q,this.yy,C[1],G,s);if(typeof t!=="undefined"){return t}if(F){l=l.slice(0,-1*F*2);G=G.slice(0,-1*F);s=s.slice(0,-1*F)}l.push(this.productions_[C[1]][0]);G.push(B.$);s.push(B._$);g=H[l[l.length-2]][l[l.length-1]];l.push(g);break;case 3:return true}}return true}};var a=(function(){var j=({EOF:1,parseError:function l(o,n){if(this.yy.parseError){this.yy.parseError(o,n)}else{throw new Error(o)}},setInput:function(n){this._input=n;this._more=this._less=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};return this},input:function(){var o=this._input[0];this.yytext+=o;this.yyleng++;this.match+=o;this.matched+=o;var n=o.match(/\n/);if(n){this.yylineno++}this._input=this._input.slice(1);return o},unput:function(n){this._input=n+this._input;return this},more:function(){this._more=true;return this},pastInput:function(){var n=this.matched.substr(0,this.matched.length-this.match.length);return(n.length>20?"...":"")+n.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var n=this.match;if(n.length<20){n+=this._input.substr(0,20-n.length)}return(n.substr(0,20)+(n.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var n=this.pastInput();var o=new Array(n.length+1).join("-");return n+this.upcomingInput()+"\n"+o+"^"},next:function(){if(this.done){return this.EOF}if(!this._input){this.done=true}var r,p,o,n;if(!this._more){this.yytext="";this.match=""}var s=this._currentRules();for(var q=0;q<s.length;q++){p=this._input.match(this.rules[s[q]]);if(p){n=p[0].match(/\n.*/g);if(n){this.yylineno+=n.length}this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-1:this.yylloc.last_column+p[0].length};this.yytext+=p[0];this.match+=p[0];this.matches=p;this.yyleng=this.yytext.length;this._more=false;this._input=this._input.slice(p[0].length);this.matched+=p[0];r=this.performAction.call(this,this.yy,this,s[q],this.conditionStack[this.conditionStack.length-1]);if(r){return r}else{return}}}if(this._input===""){return this.EOF}else{this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}},lex:function g(){var n=this.next();if(typeof n!=="undefined"){return n}else{return this.lex()}},begin:function h(n){this.conditionStack.push(n)},popState:function m(){return this.conditionStack.pop()},_currentRules:function k(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules}});j.performAction=function i(r,o,q,n){var p=n;switch(q){case 0:this.begin("mu");if(o.yytext){return 14}break;case 1:return 14;break;case 2:return 24;break;case 3:return 16;break;case 4:return 20;break;case 5:return 19;break;case 6:return 19;break;case 7:return 23;break;case 8:return 23;break;case 9:o.yytext=o.yytext.substr(3,o.yyleng-5);this.begin("INITIAL");return 15;break;case 10:return 22;break;case 11:return 34;break;case 12:return 33;break;case 13:return 33;break;case 14:return 36;break;case 15:break;case 16:this.begin("INITIAL");return 18;break;case 17:this.begin("INITIAL");return 18;break;case 18:o.yytext=o.yytext.substr(1,o.yyleng-2).replace(/\\"/g,'"');return 28;break;case 19:return 30;break;case 20:return 30;break;case 21:return 29;break;case 22:return 33;break;case 23:o.yytext=o.yytext.substr(1,o.yyleng-2);return 33;break;case 24:return"INVALID";break;case 25:return 5;break}};j.rules=[/^[^\x00]*?(?=(\{\{))/,/^[^\x00]+/,/^\{\{>/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s/.])/,/^\[.*\]/,/^./,/^$/];j.conditions={mu:{rules:[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:false},INITIAL:{rules:[0,1,25],inclusive:true}};return j})();f.lexer=a;return f})();Handlebars.Parser=handlebars;Handlebars.parse=function(a){Handlebars.Parser.yy=Handlebars.AST;return Handlebars.Parser.parse(a)};Handlebars.print=function(a){return new Handlebars.PrintVisitor().accept(a)};Handlebars.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(b,a){}};Handlebars.log=function(b,a){Handlebars.logger.log(b,a)};(function(){Handlebars.AST={};Handlebars.AST.ProgramNode=function(c,b){this.type="program";this.statements=c;if(b){this.inverse=new Handlebars.AST.ProgramNode(b)}};Handlebars.AST.MustacheNode=function(d,c,b){this.type="mustache";this.id=d[0];this.params=d.slice(1);this.hash=c;this.escaped=!b};Handlebars.AST.PartialNode=function(c,b){this.type="partial";this.id=c;this.context=b};var a=function(b,c){if(b.original!==c.original){throw new Handlebars.Exception(b.original+" doesn't match "+c.original)}};Handlebars.AST.BlockNode=function(c,b,d){a(c.id,d);this.type="block";this.mustache=c;this.program=b};Handlebars.AST.InverseNode=function(c,b,d){a(c.id,d);this.type="inverse";this.mustache=c;this.program=b};Handlebars.AST.ContentNode=function(b){this.type="content";this.string=b};Handlebars.AST.HashNode=function(b){this.type="hash";this.pairs=b};Handlebars.AST.IdNode=function(f){this.type="ID";this.original=f.join(".");var d=[],g=0;for(var e=0,b=f.length;e<b;e++){var c=f[e];if(c===".."){g++}else{if(c==="."||c==="this"){this.isScoped=true}else{d.push(c)}}}this.parts=d;this.string=d.join(".");this.depth=g;this.isSimple=(d.length===1)&&(g===0)};Handlebars.AST.StringNode=function(b){this.type="STRING";this.string=b};Handlebars.AST.IntegerNode=function(b){this.type="INTEGER";this.integer=b};Handlebars.AST.BooleanNode=function(b){this.type="BOOLEAN";this.bool=b};Handlebars.AST.CommentNode=function(b){this.type="comment";this.comment=b}})();Handlebars.Exception=function(b){var a=Error.prototype.constructor.apply(this,arguments);for(var c in a){if(a.hasOwnProperty(c)){this[c]=a[c]}}};Handlebars.Exception.prototype=new Error;Handlebars.SafeString=function(a){this.string=a};Handlebars.SafeString.prototype.toString=function(){return this.string.toString()};(function(){var c={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};var d=/&(?!\w+;)|[<>"'`]/g;var b=/[&<>"'`]/;var a=function(e){return c[e]||"&amp;"};Handlebars.Utils={escapeExpression:function(e){if(e instanceof Handlebars.SafeString){return e.toString()}else{if(e==null||e===false){return""}}if(!b.test(e)){return e}return e.replace(d,a)},isEmpty:function(e){if(typeof e==="undefined"){return true}else{if(e===null){return true}else{if(e===false){return true}else{if(Object.prototype.toString.call(e)==="[object Array]"&&e.length===0){return true}else{return false}}}}}}})();Handlebars.Compiler=function(){};Handlebars.JavaScriptCompiler=function(){};(function(f,e){f.OPCODE_MAP={appendContent:1,getContext:2,lookupWithHelpers:3,lookup:4,append:5,invokeMustache:6,appendEscaped:7,pushString:8,truthyOrFallback:9,functionOrFallback:10,invokeProgram:11,invokePartial:12,push:13,assignToHash:15,pushStringParam:16};f.MULTI_PARAM_OPCODES={appendContent:1,getContext:1,lookupWithHelpers:2,lookup:1,invokeMustache:3,pushString:1,truthyOrFallback:1,functionOrFallback:1,invokeProgram:3,invokePartial:1,push:1,assignToHash:1,pushStringParam:1};f.DISASSEMBLE_MAP={};for(var h in f.OPCODE_MAP){var g=f.OPCODE_MAP[h];f.DISASSEMBLE_MAP[g]=h}f.multiParamSize=function(i){return f.MULTI_PARAM_OPCODES[f.DISASSEMBLE_MAP[i]]};f.prototype={compiler:f,disassemble:function(){var t=this.opcodes,r,n;var q=[],v,m,w;for(var s=0,o=t.length;s<o;s++){r=t[s];if(r==="DECLARE"){m=t[++s];w=t[++s];q.push("DECLARE "+m+" = "+w)}else{v=f.DISASSEMBLE_MAP[r];var u=f.multiParamSize(r);var k=[];for(var p=0;p<u;p++){n=t[++s];if(typeof n==="string"){n='"'+n.replace("\n","\\n")+'"'}k.push(n)}v=v+" "+k.join(" ");q.push(v)}}return q.join("\n")},guid:0,compile:function(i,k){this.children=[];this.depths={list:[]};this.options=k;var l=this.options.knownHelpers;this.options.knownHelpers={helperMissing:true,blockHelperMissing:true,each:true,"if":true,unless:true,"with":true,log:true};if(l){for(var j in l){this.options.knownHelpers[j]=l[j]}}return this.program(i)},accept:function(i){return this[i.type](i)},program:function(m){var k=m.statements,o;this.opcodes=[];for(var n=0,j=k.length;n<j;n++){o=k[n];this[o.type](o)}this.isSimple=j===1;this.depths.list=this.depths.list.sort(function(l,i){return l-i});return this},compileProgram:function(m){var j=new this.compiler().compile(m,this.options);var n=this.guid++;this.usePartial=this.usePartial||j.usePartial;this.children[n]=j;for(var o=0,k=j.depths.list.length;o<k;o++){depth=j.depths.list[o];if(depth<2){continue}else{this.addDepth(depth-1)}}return n},block:function(o){var l=o.mustache;var n,p,j,k;var m=this.setupStackForMustache(l);var i=this.compileProgram(o.program);if(o.program.inverse){k=this.compileProgram(o.program.inverse);this.declare("inverse",k)}this.opcode("invokeProgram",i,m.length,!!l.hash);this.declare("inverse",null);this.opcode("append")},inverse:function(k){var j=this.setupStackForMustache(k.mustache);var i=this.compileProgram(k.program);this.declare("inverse",i);this.opcode("invokeProgram",null,j.length,!!k.mustache.hash);this.opcode("append")},hash:function(n){var m=n.pairs,p,o;this.opcode("push","{}");for(var k=0,j=m.length;k<j;k++){p=m[k];o=p[1];this.accept(o);this.opcode("assignToHash",p[0])}},partial:function(i){var j=i.id;this.usePartial=true;if(i.context){this.ID(i.context)}else{this.opcode("push","depth0")}this.opcode("invokePartial",j.original);this.opcode("append")},content:function(i){this.opcode("appendContent",i.string)},mustache:function(i){var j=this.setupStackForMustache(i);this.opcode("invokeMustache",j.length,i.id.original,!!i.hash);if(i.escaped){this.opcode("appendEscaped")}else{this.opcode("append")}},ID:function(m){this.addDepth(m.depth);this.opcode("getContext",m.depth);this.opcode("lookupWithHelpers",m.parts[0]||null,m.isScoped||false);for(var k=1,j=m.parts.length;k<j;k++){this.opcode("lookup",m.parts[k])}},STRING:function(i){this.opcode("pushString",i.string)},INTEGER:function(i){this.opcode("push",i.integer)},BOOLEAN:function(i){this.opcode("push",i.bool)},comment:function(){},pushParams:function(l){var j=l.length,k;while(j--){k=l[j];if(this.options.stringParams){if(k.depth){this.addDepth(k.depth)}this.opcode("getContext",k.depth||0);this.opcode("pushStringParam",k.string)}else{this[k.type](k)}}},opcode:function(i,l,k,j){this.opcodes.push(f.OPCODE_MAP[i]);if(l!==undefined){this.opcodes.push(l)}if(k!==undefined){this.opcodes.push(k)}if(j!==undefined){this.opcodes.push(j)}},declare:function(i,j){this.opcodes.push("DECLARE");this.opcodes.push(i);this.opcodes.push(j)},addDepth:function(i){if(i===0){return}if(!this.depths[i]){this.depths[i]=true;this.depths.list.push(i)}},setupStackForMustache:function(i){var j=i.params;this.pushParams(j);if(i.hash){this.hash(i.hash)}this.ID(i.id);return j}};e.prototype={nameLookup:function(k,i,j){if(/^[0-9]+$/.test(i)){return k+"["+i+"]"}else{if(e.isValidJavaScriptVariableName(i)){return k+"."+i}else{return k+"['"+i+"']"}}},appendToBuffer:function(i){if(this.environment.isSimple){return"return "+i+";"}else{return"buffer += "+i+";"}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(i,j,l,k){this.environment=i;this.options=j||{};this.name=this.environment.name;this.isChild=!!l;this.context=l||{programs:[],aliases:{self:"this"},registers:{list:[]}};this.preamble();this.stackSlot=0;this.stackVars=[];this.compileChildren(i,j);var n=i.opcodes,m;this.i=0;for(b=n.length;this.i<b;this.i++){m=this.nextOpcode(0);if(m[0]==="DECLARE"){this.i=this.i+2;this[m[1]]=m[2]}else{this.i=this.i+m[1].length;this[m[0]].apply(this,m[1])}}return this.createFunctionContext(k)},nextOpcode:function(r){var o=this.environment.opcodes,m=o[this.i+r],l,p;var q,i;if(m==="DECLARE"){l=o[this.i+1];p=o[this.i+2];return["DECLARE",l,p]}else{l=f.DISASSEMBLE_MAP[m];q=f.multiParamSize(m);i=[];for(var k=0;k<q;k++){i.push(o[this.i+k+1+r])}return[l,i]}},eat:function(i){this.i=this.i+i.length},preamble:function(){var i=[];if(!this.isChild){var j=this.namespace;var k="helpers = helpers || "+j+".helpers;";if(this.environment.usePartial){k=k+" partials = partials || "+j+".partials;"}i.push(k)}else{i.push("")}if(!this.environment.isSimple){i.push(", buffer = "+this.initializeBuffer())}else{i.push("")}this.lastContext=0;this.source=i},createFunctionContext:function(p){var q=this.stackVars;if(!this.isChild){q=q.concat(this.context.registers.list)}if(q.length>0){this.source[1]=this.source[1]+", "+q.join(", ")}if(!this.isChild){var k=[];for(var o in this.context.aliases){this.source[1]=this.source[1]+", "+o+"="+this.context.aliases[o]}}if(this.source[1]){this.source[1]="var "+this.source[1].substring(2)+";"}if(!this.isChild){this.source[1]+="\n"+this.context.programs.join("\n")+"\n"}if(!this.environment.isSimple){this.source.push("return buffer;")}var r=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"];for(var n=0,j=this.environment.depths.list.length;n<j;n++){r.push("depth"+this.environment.depths.list[n])}if(p){r.push(this.source.join("\n  "));return Function.apply(this,r)}else{var m="function "+(this.name||"")+"("+r.join(",")+") {\n  "+this.source.join("\n  ")+"}";Handlebars.log(Handlebars.logger.DEBUG,m+"\n\n");return m}},appendContent:function(i){this.source.push(this.appendToBuffer(this.quotedString(i)))},append:function(){var i=this.popStack();this.source.push("if("+i+" || "+i+" === 0) { "+this.appendToBuffer(i)+" }");if(this.environment.isSimple){this.source.push("else { "+this.appendToBuffer("''")+" }")}},appendEscaped:function(){var j=this.nextOpcode(1),i="";this.context.aliases.escapeExpression="this.escapeExpression";if(j[0]==="appendContent"){i=" + "+this.quotedString(j[1][0]);this.eat(j)}this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"+i))},getContext:function(i){if(this.lastContext!==i){this.lastContext=i}},lookupWithHelpers:function(k,l){if(k){var i=this.nextStack();this.usingKnownHelper=false;var j;if(!l&&this.options.knownHelpers[k]){j=i+" = "+this.nameLookup("helpers",k,"helper");this.usingKnownHelper=true}else{if(l||this.options.knownHelpersOnly){j=i+" = "+this.nameLookup("depth"+this.lastContext,k,"context")}else{j=i+" = "+this.nameLookup("helpers",k,"helper")+" || "+this.nameLookup("depth"+this.lastContext,k,"context")}}j+=";";this.source.push(j)}else{this.pushStack("depth"+this.lastContext)}},lookup:function(j){var i=this.topStack();this.source.push(i+" = ("+i+" === null || "+i+" === undefined || "+i+" === false ? "+i+" : "+this.nameLookup(i,j,"context")+");")},pushStringParam:function(i){this.pushStack("depth"+this.lastContext);this.pushString(i)},pushString:function(i){this.pushStack(this.quotedString(i))},push:function(i){this.pushStack(i)},invokeMustache:function(k,j,i){this.populateParams(k,this.quotedString(j),"{}",null,i,function(l,n,m){if(!this.usingKnownHelper){this.context.aliases.helperMissing="helpers.helperMissing";this.context.aliases.undef="void 0";this.source.push("else if("+m+"=== undef) { "+l+" = helperMissing.call("+n+"); }");if(l!==m){this.source.push("else { "+l+" = "+m+"; }")}}})},invokeProgram:function(k,l,j){var i=this.programExpression(this.inverse);var m=this.programExpression(k);this.populateParams(l,null,m,i,j,function(n,p,o){if(!this.usingKnownHelper){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";this.source.push("else { "+n+" = blockHelperMissing.call("+p+"); }")}})},populateParams:function(p,k,t,q,x,w){var l=x||this.options.stringParams||q||this.options.data;var j=this.popStack(),v;var n=[],m,o,u;if(l){this.register("tmp1",t);u="tmp1"}else{u="{ hash: {} }"}if(l){var s=(x?this.popStack():"{}");this.source.push("tmp1.hash = "+s+";")}if(this.options.stringParams){this.source.push("tmp1.contexts = [];")}for(var r=0;r<p;r++){m=this.popStack();n.push(m);if(this.options.stringParams){this.source.push("tmp1.contexts.push("+this.popStack()+");")}}if(q){this.source.push("tmp1.fn = tmp1;");this.source.push("tmp1.inverse = "+q+";")}if(this.options.data){this.source.push("tmp1.data = data;")}n.push(u);this.populateCall(n,j,k||j,w)},populateCall:function(l,o,n,i){var k=["depth0"].concat(l).join(", ");var m=["depth0"].concat(n).concat(l).join(", ");var j=this.nextStack();if(this.usingKnownHelper){this.source.push(j+" = "+o+".call("+k+");")}else{this.context.aliases.functionType='"function"';this.source.push("if(typeof "+o+" === functionType) { "+j+" = "+o+".call("+k+"); }")}i.call(this,j,m,o);this.usingKnownHelper=false},invokePartial:function(i){this.pushStack("self.invokePartial("+this.nameLookup("partials",i,"partial")+", '"+i+"', "+this.popStack()+", helpers, partials);")},assignToHash:function(i){var j=this.popStack();var k=this.topStack();this.source.push(k+"['"+i+"'] = "+j+";")},compiler:e,compileChildren:function(j,n){var p=j.children,r,q;for(var o=0,k=p.length;o<k;o++){r=p[o];q=new this.compiler();this.context.programs.push("");var m=this.context.programs.length;r.index=m;r.name="program"+m;this.context.programs[m]=q.compile(r,n,this.context)}},programExpression:function(k){if(k==null){return"self.noop"}var p=this.environment.children[k],o=p.depths.list;var n=[p.index,p.name,"data"];for(var m=0,j=o.length;m<j;m++){depth=o[m];if(depth===1){n.push("depth0")}else{n.push("depth"+(depth-1))}}if(o.length===0){return"self.program("+n.join(", ")+")"}else{n.shift();return"self.programWithDepth("+n.join(", ")+")"}},register:function(i,j){this.useRegister(i);this.source.push(i+" = "+j+";")},useRegister:function(i){if(!this.context.registers[i]){this.context.registers[i]=true;this.context.registers.list.push(i)}},pushStack:function(i){this.source.push(this.nextStack()+" = "+i+";");return"stack"+this.stackSlot},nextStack:function(){this.stackSlot++;if(this.stackSlot>this.stackVars.length){this.stackVars.push("stack"+this.stackSlot)}return"stack"+this.stackSlot},popStack:function(){return"stack"+this.stackSlot--},topStack:function(){return"stack"+this.stackSlot},quotedString:function(i){return'"'+i.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")+'"'}};var a=("break case catch continue default delete do else finally for function if in instanceof new return switch this throw try typeof var void while with null true false").split(" ");var d=e.RESERVED_WORDS={};for(var c=0,b=a.length;c<b;c++){d[a[c]]=true}e.isValidJavaScriptVariableName=function(i){if(!e.RESERVED_WORDS[i]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(i)){return true}return false}})(Handlebars.Compiler,Handlebars.JavaScriptCompiler);Handlebars.precompile=function(d,c){c=c||{};var b=Handlebars.parse(d);var a=new Handlebars.Compiler().compile(b,c);return new Handlebars.JavaScriptCompiler().compile(a,c)};Handlebars.compile=function(b,a){a=a||{};var d;function c(){var g=Handlebars.parse(b);var f=new Handlebars.Compiler().compile(g,a);var e=new Handlebars.JavaScriptCompiler().compile(f,a,undefined,true);return Handlebars.template(e)}return function(f,e){if(!d){d=c()}return d.call(this,f,e)}};Handlebars.VM={template:function(a){var b={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(d,e,f){var c=this.programs[d];if(f){return Handlebars.VM.program(e,f)}else{if(c){return c}else{c=this.programs[d]=Handlebars.VM.program(e);return c}}},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(d,c){c=c||{};return a.call(b,Handlebars,d,c.helpers,c.partials,c.data)}},programWithDepth:function(b,d,c){var a=Array.prototype.slice.call(arguments,2);return function(f,e){e=e||{};return b.apply(this,[f,e.data||d].concat(a))}},program:function(a,b){return function(d,c){c=c||{};return a(d,c.data||b)}},noop:function(){return""},invokePartial:function(a,b,d,e,c){if(a===undefined){throw new Handlebars.Exception("The partial "+b+" could not be found")}else{if(a instanceof Function){return a(d,{helpers:e,partials:c})}else{if(!Handlebars.compile){throw new Handlebars.Exception("The partial "+b+" could not be compiled when running in vm mode")}else{c[b]=Handlebars.compile(a);return c[b](d,{helpers:e,partials:c})}}}}};Handlebars.template=Handlebars.VM.template;sc_require("handlebars");SC.Handlebars={};SC.Handlebars.Compiler=function(){};SC.Handlebars.Compiler.prototype=SC.beget(Handlebars.Compiler.prototype);SC.Handlebars.Compiler.prototype.compiler=SC.Handlebars.Compiler;SC.Handlebars.JavaScriptCompiler=function(){};SC.Handlebars.JavaScriptCompiler.prototype=SC.beget(Handlebars.JavaScriptCompiler.prototype);SC.Handlebars.JavaScriptCompiler.prototype.compiler=SC.Handlebars.JavaScriptCompiler;SC.Handlebars.JavaScriptCompiler.prototype.nameLookup=function(c,a,b){if(b==="context"){return"SC.get("+c+", "+this.quotedString(a)+")"}else{return Handlebars.JavaScriptCompiler.prototype.nameLookup.call(this,c,a,b)}};SC.Handlebars.Compiler.prototype.mustache=function(a){if(a.params.length||a.hash){return Handlebars.Compiler.prototype.mustache.call(this,a)}else{var b=new Handlebars.AST.IdNode(["bind"]);if(a.escaped){a.hash=a.hash||new Handlebars.AST.HashNode([]);a.hash.pairs.push(["escaped",new Handlebars.AST.StringNode("true")])}a=new Handlebars.AST.MustacheNode([b].concat([a.id]),a.hash,!a.escaped);return Handlebars.Compiler.prototype.mustache.call(this,a)}};SC.Handlebars.compile=function(e){var c=Handlebars.parse(e);var d={data:true,stringParams:true};var b=new SC.Handlebars.Compiler().compile(c,d);var a=new SC.Handlebars.JavaScriptCompiler().compile(b,d,undefined,true);return Handlebars.template(a)};Handlebars.registerHelper("helperMissing",function(c,b){var a;a="%@ Handlebars error: Could not find property '%@' on object %@.";throw a.fmt(b.data.view,c,this)});sc_require("ext/handlebars");(function(){var a=function(l,m,i,b){var e=m.data,j=m.fn,d=m.inverse,k=e.view;if(this.isObservable){var f=k.createChildView(SC._BindableSpan,{preserveContext:i,shouldDisplayFunc:b,displayTemplate:j,inverseTemplate:d,property:l,previousContext:this,tagName:(m.hash.tagName||"span"),isEscaped:m.hash.escaped});var h,g;k.get("childViews").push(f);h=function(){if(f.get("layer")){f.rerender()}else{this.removeObserver(l,g)}};g=function(){this.invokeOnce(h)};this.addObserver(l,g);var c=f.renderContext(f.get("tagName"));f.renderToContext(c);return new Handlebars.SafeString(c.join())}else{return SC.getPath(this,l)}};Handlebars.registerHelper("bind",function(c,b){return a.call(this,c,b,false,function(d){return !SC.none(d)})});Handlebars.registerHelper("boundIf",function(c,b){if(b){return a.call(this,c,b,true,function(d){if(SC.typeOf(d)===SC.T_ARRAY){if(d.length!==0){return true}return false}else{return !!d}})}else{throw"Cannot use boundIf helper without a block."}})})();Handlebars.registerHelper("with",function(b,a){return Handlebars.helpers.bind.call(a.contexts[0],b,a)});Handlebars.registerHelper("if",function(b,a){return Handlebars.helpers.boundIf.call(a.contexts[0],b,a)});Handlebars.registerHelper("unless",function(c,b){var d=b.fn,a=b.inverse;b.fn=a;b.inverse=d;return Handlebars.helpers.boundIf.call(b.contexts[0],c,b)});Handlebars.registerHelper("bindAttr",function(f){var e=f.hash;var b=f.data.view;var d=[];var c=jQuery.uuid++;var h=e["class"];if(h!=null){var a=SC.Handlebars.bindClasses(this,h,b,c);d.push('class="'+a.join(" ")+'"');delete e["class"]}var g=SC.keys(e);g.forEach(function(i){var m=e[i];var l=this.getPath(m);var k,j;k=function k(){var n=this.getPath(m);var p=b.$("[data-handlebars-id='"+c+"']");if(p.length===0){this.removeObserver(m,j);return}var o=p.attr(i);if(n===NO&&o){p.removeAttr(i)}else{if(n===YES&&o!==i){p.attr(i,i)}else{if(o!==n){p.attr(i,n)}}}};j=function(){this.invokeOnce(k)};this.addObserver(m,j);if(l===YES){l=i}if(l!==NO){if(SC.typeOf(l)===SC.T_STRING){l=l.replace(/"/g,"&quot;")}d.push(i+'="'+l+'"')}},this);d.push('data-handlebars-id="'+c+'"');return new Handlebars.SafeString(d.join(" "))});SC.Handlebars.bindClasses=function(b,h,g,a){var f=[],e,i,c;var d=function(j){var k=b.getPath(j);if(k===YES){return SC.String.dasherize(j.split(".").get("lastObject"))}else{if(k!==NO&&k!==undefined&&k!==null){return k}else{return null}}};h.split(" ").forEach(function(m){var l;var k,j;k=function(){e=d(m);c=a?g.$("[data-handlebars-id='"+a+"']"):g.$();if(c.length===0){b.removeObserver(m,j)}else{if(l){c.removeClass(l)}if(e){c.addClass(e);l=e}else{l=null}}};j=function(){this.invokeOnce(k)};b.addObserver(m,j);i=d(m);if(i){f.push(i);l=i}});return f};sc_require("ext/handlebars");Handlebars.registerHelper("collection",function(k,l){var j=l.fn;var f=l.data;var d=l.inverse;var e=l.hash;var g,a;g=k?SC.getPath(this,k)||SC.getPath(k):SC.TemplateCollectionView;var i={};if(e){var c={},h;for(var b in e){if(e.hasOwnProperty(b)){h=b.match(/^item(.)(.*)$/);if(h){c[h[1].toLowerCase()+h[2]]=e[b];delete e[b]}}}i=SC.clone(e);i.itemViewOptions=c}if(j){i.itemViewTemplate=j}if(d){i.inverseTemplate=d}if(g.isClass){a=g.extend(i)}else{a=SC.mixin(g,i)}l.fn=function(){return""};return Handlebars.helpers.view.call(this,a,l)});Handlebars.registerHelper("each",function(b,a){a.hash.contentBinding=SC.Binding.from("*"+b,this).oneWay();a.hash.itemContextProperty="content";return Handlebars.helpers.collection.call(this,null,a)});sc_require("ext/handlebars");Handlebars.registerHelper("loc",function(a){return SC.String.loc(a)});sc_require("ext/handlebars");SC.Handlebars.ViewHelper=SC.Object.create({helper:function(l,m,n){var c=n.inverse;var e=n.data;var j=e.view;var i=n.fn;var d=n.hash;var b;if(m.isClass||m.isObject){b=m;if(!b){throw"Null or undefined object was passed to the #view helper. Did you mean to pass a property path string?"}}else{if(m.charAt(0)==="."){b=SC.objectForPropertyPath(m.slice(1),j)}else{b=SC.getPath(l,m);if(!b){b=SC.getPath(m)}}if(!b){throw"Unable to find view at path '"+m+"'"}}if(d.id){d.layerId=d.id}var k={id:d.id,"class":d["class"],classBinding:d.classBinding};delete d.id;delete d["class"];delete d.classBinding;if(b.isClass){b=b.extend(d)}else{SC.mixin(b,d)}var g=e.view;var h=g.get("childViews");var f=g.createChildView(b);if(i){f.template=i}h.pushObject(f);var a=SC.RenderContext(f.get("tagName"));this.applyAttributes(k,f,a);f.applyAttributesToContext(a);f.render(a,YES);return new Handlebars.SafeString(a.join())},applyAttributes:function(a,f,b){var e=a.id;var d=a["class"];if(d){b.addClass(d.split(" "))}if(e){f.set("layerId",e);b.id(e)}var c=a.classBinding;if(c){SC.Handlebars.bindClasses(f,c,f).forEach(function(g){b.setClass(g,YES)})}}});Handlebars.registerHelper("view",function(b,a){return SC.Handlebars.ViewHelper.helper(this,b,a)});sc_require("handlebars");sc_require("ext/handlebars");sc_require("ext/handlebars/bind");sc_require("ext/handlebars/collection");sc_require("ext/handlebars/localization");sc_require("ext/handlebars/view");SC.TEMPLATES=SC.Object.create();SC.TemplateView=SC.CoreView.extend({acceptsFirstResponder:YES,templateName:null,templates:SC.TEMPLATES,template:function(b,d){if(d!==undefined){return d}var a=this.get("templateName"),c=this.get("templates").get(a);if(!c){return function(){return""}}return c}.property("templateName").cacheable(),context:function(a,b){if(b!==undefined){return b}return this}.property().cacheable(),render:function(b){var e,a,c=this.get("template"),d=this.get("context");this._didRenderChildViews=YES;e={view:this,isRenderData:true};a=c(d,{data:e});b.push(a)},update:function(){},mouseDown:function(){if(this.mouseUp){return YES}return NO}});sc_require("views/template");SC.Button=SC.TemplateView.extend(SC.ActionSupport,{classNames:["sc-button"],mouseDown:function(){this.set("isActive",true);this._isMouseDown=YES},mouseExited:function(){this.set("isActive",false)},mouseEntered:function(){if(this._isMouseDown){this.set("isActive",true)}},rootResponder:function(){var a=this.get("pane");return a.get("rootResponder")}.property("pane").cacheable(),mouseUp:function(a){if(this.get("isActive")){this.fireAction();this.set("isActive",false)}this._isMouseDown=NO},touchStart:function(a){this.mouseDown(a)},touchEnd:function(a){this.mouseUp(a)}});sc_require("views/template");SC.Checkbox=SC.TemplateView.extend({title:null,value:null,displayTitle:function(){var a=this.get("title");return a?SC.String.loc(a):null}.property("title").cacheable(),classNames:["sc-checkbox"],template:SC.Handlebars.compile('<label><input type="checkbox">{{displayTitle}}</label>'),didCreateLayer:function(){var a=this;this.$("input").bind("change",function(){a.domValueDidChange(this)})},domValueDidChange:function(a){this.set("value",$(a).prop("checked"))},value:function(a,b){if(b!==undefined){this.$("input").prop("checked",b)}else{b=this.$("input").prop("checked")}return b}.property()});SC.CheckboxSupport={didCreateLayer:function(){this.$("input").change(jQuery.proxy(function(){SC.RunLoop.begin();this.notifyPropertyChange("value");SC.RunLoop.end()},this))},value:function(a,b){if(b!==undefined){this.$("input").prop("checked",b)}else{b=this.$("input").prop("checked")}return b}.property().idempotent()};sc_require("views/template");SC.TextFieldSupport={$input:function(){return this.$("input")},_value:null,value:function(b,c){var a=this.$input();if(c!==undefined){if(this._value!==c){this._value=c}if(a.val()!==c){a.val(c)}}else{if(a.length>0){c=this._value=a.val()}else{c=this._value}}return c}.property().idempotent(),didCreateLayer:function(){var b=this.$input(),a=this;b.val(this._value);if(SC.browser.isIE){SC.Event.add(b,"focusin",this,this.focusIn);SC.Event.add(b,"focusout",this,this.focusOut)}else{SC.Event.add(b,"focus",this,this.focusIn);SC.Event.add(b,"blur",this,this.focusOut)}},willDestroyLayerMixin:function(){var a=this.$input();if(SC.browser.isIE){SC.Event.remove(a,"focusin",this,this.focusIn);SC.Event.remove(a,"focusout",this,this.focusOut)}else{SC.Event.remove(a,"focus",this,this.focusIn);SC.Event.remove(a,"blur",this,this.focusOut)}},focusIn:function(a){this.becomeFirstResponder();this.tryToPerform("focus",a)},focusOut:function(a){this.resignFirstResponder();this.tryToPerform("blur",a)},touchStart:function(a){a.allowDefault();return YES},touchEnd:function(a){a.allowDefault();return YES},willLoseFirstResponder:function(){this.notifyPropertyChange("value")},domValueDidChange:function(a){this.set("value",a.val())},keyUp:function(a){this.domValueDidChange(this.$input());if(a.keyCode===SC.Event.KEY_RETURN){return this.tryToPerform("insertNewline",a)}else{if(a.keyCode===SC.Event.KEY_ESC){return this.tryToPerform("cancel",a)}}},selectStart:function(){return true}};SC.TextField=SC.TemplateView.extend(SC.TextFieldSupport,{classNames:["sc-text-field"],isMultiline:NO,template:function(){return SC.Handlebars.compile(this.get("isMultiline")?"<textarea></textarea>":'<input type="text">')}.property("isMultiline").cacheable(),$input:function(){var a=this.get("isMultiline")?"textarea":"input";return this.$(a)}});SC.TemplatePane=SC.Object.extend({});SC.TemplatePane.mixin({append:function(a){var b=SC.MainPane.extend({childViews:["contentView"],contentView:SC.TemplateView.design(a),touchStart:function(c){c.allowDefault()},touchesDragged:function(c,d){c.allowDefault()},touchEnd:function(c){c.allowDefault()}});b=b.create().append();b.awake();return b}});sc_require("views/template");SC._BindableSpan=SC.TemplateView.extend({tagName:"span",shouldDisplayFunc:null,preserveContext:NO,displayTemplate:null,inverseTemplate:null,property:null,render:function(d){var h=this.get("isEscaped");var a=this.get("shouldDisplayFunc"),f=this.get("property"),e=this.get("preserveContext"),b=this.get("previousContext");var c=this.get("inverseTemplate"),g=this.get("displayTemplate");var i;if(f===""){i=b}else{i=b.getPath(f)}if(a(i)){this.set("template",g);if(e){this.set("context",b)}else{if(g){this.set("context",i)}else{if(i==null){i=""}else{i=String(i)}if(h){i=Handlebars.Utils.escapeExpression(i)}d.push(i);return}}}else{if(c){this.set("template",c);if(e){this.set("context",b)}else{this.set("context",i)}}else{this.set("template",function(){return""})}}return arguments.callee.base.apply(this,arguments)},rerender:function(){var b,a,e,f;e=this.get("childViews");a=e.get("length");for(b=a-1;b>=0;b--){f=e[b];f.$().remove();f.removeFromParent();f.destroy()}var c=this.renderContext(this.get("tagName"));var d;this.renderToContext(c);d=c.element();this.$().replaceWith(d);this.set("layer",d);this._notifyDidCreateLayer()}});sc_require("views/template");SC.TemplateCollectionView=SC.TemplateView.extend({tagName:"ul",content:null,template:SC.Handlebars.compile(""),emptyView:null,init:function(){var a=arguments.callee.base.apply(this,arguments);this._sctcv_contentDidChange();return a},didCreateLayer:function(){if(this._sctcv_layerCreated){return}this._sctcv_layerCreated=true;var a=this.get("content");if(a){this.arrayContentDidChange(0,0,a.get("length"))}},itemView:"SC.TemplateView",itemViewTemplate:null,itemViewTemplateName:null,inverseTemplate:function(b,d){if(d!==undefined){return d}var a=this.get("inverseTemplateName"),c=this.get("templates").get(a);if(!c){return function(){return""}}return c}.property("inverseTemplateName").cacheable(),inverseTemplateName:null,itemContext:null,itemViewClass:function(){var c=this.get("itemView");var a=this.get("itemViewTemplate");var d=this.get("itemViewTemplateName");var b={};if(SC.typeOf(c)===SC.T_STRING){c=SC.objectForPropertyPath(c)}if(!a&&d){a=this.get("templates").get(d)}if(a){b.template=a}if(c.prototype.tagName===SC.TemplateView.prototype.tagName){b.tagName=this.get("itemTagName")}return c.extend(b)}.property("itemView").cacheable(),_sctcv_contentDidChange:function(){this.$().empty();var c=this._content,a=0;var d=this.get("content"),b=0;if(c){c.removeArrayObservers({target:this,willChange:"arrayContentWillChange",didChange:"arrayContentDidChange"});a=c.get("length")}if(d){d.addArrayObservers({target:this,willChange:"arrayContentWillChange",didChange:"arrayContentDidChange"});b=d.get("length")}this.arrayContentWillChange(0,a,b);this._content=this.get("content");this.arrayContentDidChange(0,a,b)}.observes("content"),arrayContentWillChange:function(h,d,f){var c=this.get("emptyView");if(c){c.$().remove();c.removeFromParent()}var e=this.get("childViews"),g,b,a;a=e.get("length");for(b=h+d-1;b>=h;b--){g=e[b];if(g){g.$().remove();g.removeFromParent();g.destroy()}}},arrayContentDidChange:function(e,l,t){if(!this.get("layer")){return}var m=this.get("content"),f=this.get("itemViewClass"),o=this.get("childViews"),a=[],r,s,h,p,g,q,k,j,n;if(m){var i=m.slice(e,e+t);h=this.get("itemViewOptions")||{};p=this.$();g=p.find("li")[e-1]||null;n=i.get("length");var d={id:h.id,"class":h["class"],classBinding:h.classBinding};r=function(u){arguments.callee.base.apply(this,arguments);SC.Handlebars.ViewHelper.applyAttributes(d,this,u)};h=SC.clone(h);delete h.id;delete h["class"];delete h.classBinding;for(j=0;j<n;j++){q=i.objectAt(j);s=this.createChildView(f.extend(h,{content:q,render:r,tagName:h.tagName||f.prototype.tagName}));var c=s.get("contextProperty");if(c){s.set("context",s.get(c))}k=s.createLayer().$();if(!g){p.append(k)}else{k.insertAfter(g)}g=k;a.push(s)}o.replace(e,0,a)}var b=this.get("inverseTemplate");if(o.get("length")===0&&b){s=this.createChildView(SC.TemplateView.extend({template:b,content:this}));this.set("emptyView",s);s.createLayer().$().appendTo(p);this.childViews=[s]}this.invokeLast("invalidateFrame")},itemTagName:function(){switch(this.get("tagName")){case"dl":return"dt";case"ul":case"ol":return"li";case"table":case"thead":case"tbody":case"tfoot":return"tr";case"select":return"option";default:return SC.TemplateView.prototype.tagName}}.property("tagName"),invalidateFrame:function(){this.notifyPropertyChange("frame")}});
/*!
 * ==========================================================================
 * SproutCore -- JavaScript Application Framework
 * Copyright ©2008-2011 Apple Inc. All rights reserved.
 * Copyright 2006-2011, Strobe Inc. and contributors.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a 
 * copy of this software and associated documentation files (the "Software"), 
 * to deal in the Software without restriction, including without limitation 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
 * and/or sell copies of the Software, and to permit persons to whom the 
 * Software is furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in 
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 * 
 * SproutCore and the SproutCore logo are trademarks of Strobe Inc.
 * 
 * For more information about SproutCore, visit http://www.sproutcore.com
 * 
 * ==========================================================================
 */
SC.EmptyTheme=SC.BaseTheme.create({name:"sc-empty"});SC.Theme.addTheme(SC.EmptyTheme);SC.AceTheme=SC.BaseTheme.create({name:"ace",description:"A SproutCore built-in theme by Alex Iskander and contributors. Only supports browsers that implement CSS3."});SC.Theme.addTheme(SC.AceTheme);SC.AceTheme.PointLeft=SC.AceTheme.subtheme("point-left","point-left");SC.AceTheme.PointRight=SC.AceTheme.subtheme("point-right","point-right");SC.AceTheme.Capsule=SC.AceTheme.subtheme("capsule","capsule");SC.AceTheme.Dark=SC.AceTheme.subtheme("dark");SC.defaultTheme="ace";sc_require("theme");SC.AceTheme.Dark.PointLeft=SC.AceTheme.Dark.subtheme("point-left","point-left");SC.AceTheme.Dark.PointRight=SC.AceTheme.Dark.subtheme("point-right","point-right");SC.AceTheme.Dark.PointRight=SC.AceTheme.Dark.subtheme("capsule","capsule");SC.AceTheme.SourceList=SC.AceTheme.subtheme("source-list");sc_require("theme");SC.AceTheme.Popover=SC.AceTheme.Dark.subtheme("popover");SC.AceTheme.addTheme(SC.AceTheme.Popover);SC.AceTheme.SolidPopover=SC.AceTheme.Popover.subtheme("solid");SC.AceTheme.addTheme(SC.AceTheme.SolidPopover.create({name:"solid-popover"}));sc_require("resources/picker/popover/popover");SC.AceTheme.Popover.pickerRenderDelegate=SC.RenderDelegate.create({className:"picker",render:function(e,b){var a=e.get("preferType");var d=e.get("pointerPos");var c=e.get("pointerPosY");if(a==SC.PICKER_POINTER||a==SC.PICKER_MENU_POINTER){b.addClass(d)}},update:function(e,d){var a=e.get("preferType");var c=e.get("pointerPos");var b=e.get("pointerPosY");if(a==SC.PICKER_POINTER||a==SC.PICKER_MENU_POINTER){d.addClass(c)}}});SC.AceTheme.Popover.workspaceRenderDelegate=SC.RenderDelegate.create({className:"workspace",render:function(b,a){a.setClass({"top-toolbar":b.get("hasTopToolbar"),"bottom-toolbar":b.get("hasBottomToolbar")});a=a.begin("div").addClass("popover-background");this.includeSlices(b,a,SC.NINE_SLICE);a.push("<div class = 'sc-pointer'></div>");a=a.end()},update:function(b,a){a.setClass({"top-toolbar":b.get("hasTopToolbar"),"bottom-toolbar":b.get("hasBottomToolbar")})}});SearchController=function(){var f=null,n=null,i=null,m=null,o=null,k=null,p=0,a=0,h=0,e=new Array(),j=null,c=0;function d(r,s){console.log("Handling query...");e=new Array();if(r.items){for(var q=0;q<r.items.length;q++){e.push({title:r.items[q].title,url:r.items[q].formattedUrl,summary:r.items[q].snippet})}console.log("in Handling query:");p=r.queries.request[0].count;a=r.queries.request[0].totalResults;h=r.queries.request[0].startIndex;j=r.queries.request[0].searchTerms;c=parseInt(r.queries.request[0].filter);if(s){s()}}else{SC.AlertPane.error({message:"Tõrge!",description:"Andmevahetusel tekkis viga! Korda otsingut!"})}}function b(){console.log("Preparing Items...");var r='<ul class="result"><li class="title">{0}</li><li class="summary">{1}</li><li class="url"><a href="http://{2}" target="_blank">{3}</a></li></ul>';var s="";for(var q=0;q<e.length;q++){s+=r.replace("{0}",e[q].title).replace("{1}",e[q].summary).replace("{2}",e[q].url).replace("{3}",e[q].url)}i.set("content",s);g()}function g(){console.log("Preparing pagination...");if(m){if(h<=1){m.set("isEnabled",false)}else{m.set("isEnabled",true)}}if(o){if(h+p<a){o.set("isEnabled",true)}else{o.set("isEnabled",false)}}if(k&&p>0){k.set("value","Näitan tulemusi "+h+" - "+(h+p-1)+"  "+a+"-st.")}}function l(){n.set("isVisible",!n.get("isVisible"))}return{switchTabs:function(){f.tabsToggle()},loadNextResults:function(){h+=10;this.search(j,h,10,c,function(){b()},function(){SC.AlertPane.error({message:"Tõrge!",description:"Andmevahetusel tekkis viga! Korda otsingut!"})})},loadPreviousResults:function(){h-=10;this.search(j,h,10,c,function(){b()},function(){SC.AlertPane.error({message:"Tõrge!",description:"Andmevahetusel tekkis viga! Korda otsingut!"})})},search:function(q,w,u,t,v,s){l();var r="https://www.googleapis.com/customsearch/v1?key=AIzaSyAvnr_EiOfpj0Ub97QkQIEek6npmDFoZko&cx=002647590579739994937:ntvk68za0vo&q={query}&num={num}&start={start}&filter={filter}&callback=?";r=r.replace("{query}",q).replace("{num}",u).replace("{start}",w).replace("{filter}",t);console.log("Searching...");console.log(r);$.getJSON(r,null,function(x,z,y){console.log("Request succeeded!");d(x,v)}).fail(function(){console.log("Request failed!");if(s){s()}}).always(function(){console.log("Request complete!");l()})},registerTabHostView:function(q){f=q;console.log("TabHostView registered!")},registerItemsView:function(q){i=q;b();console.log("ItemsView registered!")},registerNextButtonView:function(q){o=q;g();console.log("NextButtonView registered!")},registerPrevButtonView:function(q){m=q;g();console.log("PrevButtonView registered!")},registerResultsCountView:function(q){k=q;console.log("ResultsCountView registered!")},registerLoadingPanel:function(q){n=q;console.log("LoadingPanel registered!")}}};sc_require("controllers/search_controller");GoogleSearch=SC.Application.create({NAMESPACE:"GoogleSearch",VERSION:"0.1.0",store:SC.Store.create().from(SC.Record.fixtures),searchController:new SearchController});GoogleSearch.Theme=SC.AceTheme.create({name:"google-search"});SC.Theme.addTheme(GoogleSearch.Theme);SC.defaultTheme="google-search";GoogleSearch.IntroView=SC.Pane.extend({childViews:["titleLabel","usageInfo"],layout:{centerX:0,left:0,right:0,top:0,height:125},titleLabel:SC.LabelView.design({classNames:["heading-xlarge"],layout:{centerX:0,left:0,right:0,top:25,bottom:45,height:40},textAlign:SC.ALIGN_CENTER,tagName:"h1",value:"Google Custom-Search API - SproutCore"}),usageInfo:SC.LabelView.design({classNames:["heading-large"],layout:{centerX:0,left:0,right:0,top:70,bottom:0,height:30},textAlign:SC.ALIGN_CENTER,tagName:"h2",value:"Sisesta otsisõna ja vajuta otsi."})});GoogleSearch.ItemsView=SC.StaticContentView.extend({classNames:["result-items"],content:"<section></section>",tagName:"section",init:function(){arguments.callee.base.apply(this,arguments);GoogleSearch.get("searchController").registerItemsView(this)}});GoogleSearch.NextButtonView=SC.ButtonView.extend({buttonBehavior:SC.PUSH_BEHAVIOR,title:"Järgmised",init:function(){arguments.callee.base.apply(this,arguments);GoogleSearch.get("searchController").registerNextButtonView(this)}});GoogleSearch.PrevButtonView=SC.ButtonView.extend({buttonBehavior:SC.PUSH_BEHAVIOR,title:"Eelmised",init:function(){arguments.callee.base.apply(this,arguments);GoogleSearch.get("searchController").registerPrevButtonView(this)}});GoogleSearch.ResultsCountView=SC.LabelView.extend({classNames:["text-italic"],textAlign:SC.ALIGN_CENTER,value:"",init:function(){arguments.callee.base.apply(this,arguments);GoogleSearch.get("searchController").registerResultsCountView(this)}});sc_require("views/items_view");sc_require("views/prev_button");sc_require("views/next_button");sc_require("views/results_count");GoogleSearch.ResultsTabView=SC.View.extend({childViews:"resultsCountView resultsItemsScrollView prevButton nextButton".w(),layout:{left:0,right:0,top:0,bottom:0},resultsCountView:GoogleSearch.ResultsCountView.design({layout:{centerX:0,width:670,top:50}}),resultsItemsScrollView:SC.ScrollView.design({classNames:["result-items-view"],layout:{centerX:0,width:670,top:80,bottom:50},hasHorizontalScroller:NO,hasVerticalScroller:YES,borderStyle:SC.BORDER_NONE,contentView:GoogleSearch.ItemsView.design({layout:{top:0,left:0,right:0,bottom:0,width:670}})}),prevButton:GoogleSearch.PrevButtonView.design({layout:{centerX:-60,bottom:10,width:100,height:24},defaultResponder:"GoogleSearch.ResultsTabView",action:"prevButtonClick"}),nextButton:GoogleSearch.NextButtonView.design({layout:{centerX:60,bottom:10,width:100,height:24},defaultResponder:"GoogleSearch.ResultsTabView",action:"nextButtonClick"}),prevButtonClick:function(a){console.log("PrevButton Click!");GoogleSearch.get("searchController").loadPreviousResults()},nextButtonClick:function(a){console.log("NextButton Click!");GoogleSearch.get("searchController").loadNextResults()}});GoogleSearch.SearchView=SC.View.extend({childViews:"searchFieldLabel searchField searchButton resetButton filterBox".w(),layout:{width:670},defaultResponder:"GoogleSearch.TabHostView",searchFieldLabel:SC.LabelView.design({layout:{left:0,right:0,top:0},textAlign:SC.ALIGN_LEFT,tagName:"p",value:"Otsisõna"}),searchField:SC.TextFieldView.design({layout:{left:0,width:450,top:22,height:24},errorLabel:"Sisesta otsisõna!",validator:SC.Validator.NotEmpty.create()}),searchButton:SC.ButtonView.design({layout:{left:460,width:100,top:22,height:24},buttonBehavior:SC.PUSH_BEHAVIOR,title:"Otsi",defaultResponder:"GoogleSearch.SearchView",action:"searchButtonClick"}),resetButton:SC.ButtonView.design({layout:{left:570,width:100,top:22,height:24},buttonBehavior:SC.PUSH_BEHAVIOR,title:"Tühjenda",defaultResponder:"GoogleSearch.SearchView",action:"resetButtonClick"}),filterBox:SC.CheckboxView.design({layout:{left:0,right:0,top:55},buttonBehavior:SC.PUSH_BEHAVIOR,title:"Filtreeri korduvad tulemused"}),resetButtonClick:function(a){if(this.get("filterBox").isSelected){this.get("filterBox").set("isSelected",false)}this.get("searchField").setFieldValue("")},searchButtonClick:function(a){var b=this.get("searchField").getFieldValue();var c=(this.get("filterBox").isSelected)?1:0;if(this.get("searchField").performValidate()===SC.VALIDATE_OK){GoogleSearch.get("searchController").search(b,1,10,c,function(){GoogleSearch.get("searchController").switchTabs()},function(){SC.AlertPane.error({message:"Tõrge!",description:"Andmevahetusel tekkis viga! Korda otsingut!"})})}else{SC.AlertPane.error({message:"Otsisõna sisestamata!",description:"Sisesta otsisõna ja vajuta otsi."})}}});sc_require("views/search");GoogleSearch.SearchTabView=SC.View.extend({childViews:["searchView"],layout:{left:0,right:0,top:0,bottom:0},searchView:GoogleSearch.SearchView.design({layout:{centerX:0,centerY:0,top:50,width:670}})});sc_require("views/results_tab");sc_require("views/search_tab");GoogleSearch.TabHostView=SC.TabView.extend({layout:{centerX:0,left:0,right:0,top:125,bottom:0},classNames:["bg-white"],tabLocation:SC.TOP_LOCATION,nowShowing:"GoogleSearch.SearchTabView",itemTitleKey:"title",itemValueKey:"value",items:[{title:"Otsi",value:"GoogleSearch.SearchTabView"},{title:"Tulemused",value:"GoogleSearch.ResultsTabView"}],tabsToggle:function(){(this.get("nowShowing")==="GoogleSearch.ResultsTabView")?this.set("nowShowing","GoogleSearch.SearchTabView"):this.set("nowShowing","GoogleSearch.ResultsTabView")}});sc_require("views/intro");sc_require("views/tab_host");GoogleSearch.mainPage=SC.Page.design({mainPane:SC.MainPane.design({childViews:["headerView","tabHostView","loadingView"],headerView:GoogleSearch.IntroView.design(),tabHostView:GoogleSearch.TabHostView.design(),loadingView:SC.LabelView.design({layout:{top:0,left:0},classNames:["loading-panel"],value:"Laadin tulemusi...",isVisible:false})})});sc_require("controllers/search_controller");GoogleSearch.main=function main(){GoogleSearch.getPath("mainPage.mainPane").append();GoogleSearch.get("searchController").registerTabHostView(GoogleSearch.get("mainPage").get("mainPane").get("tabHostView"));GoogleSearch.get("searchController").registerLoadingPanel(GoogleSearch.get("mainPage").get("mainPane").get("loadingView"))};function main(){GoogleSearch.main()};