Skip to content

Instantly share code, notes, and snippets.

@lfcharger72000
Created November 28, 2016 19:30
Show Gist options
  • Save lfcharger72000/22d72d107c2c9849ad6c4d6716b99ba1 to your computer and use it in GitHub Desktop.
Save lfcharger72000/22d72d107c2c9849ad6c4d6716b99ba1 to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
function findClassNames(){if(SC._object_foundObjectClassNames)return;SC._object_foundObjectClassNames=!0;var e=[],t=!1,n=function(r,i,s){var o,u,a;s--;if(e.indexOf(i)>=0)return;e.push(i);for(var f in i){if(f=="__scope__")continue;if(f=="superclass")continue;f=="__SC__"&&(f="SC");if(!f.match(/^[A-Z0-9]/))continue;if(f=="SC"){if(t)continue;t=!0}o=r?[r,f].join("."):f,u=i[f];try{a=SC.typeOf(u)}catch(l){break}switch(a){case SC.T_CLASS:u._object_className||(u._object_className=o),s>=0&&n(o,u,s);break;case SC.T_OBJECT:s>=0&&n(o,u,s);break;case SC.T_HASH:(r||o==="SC")&&s>=0&&n(o,u,s);break;default:}}};window.__SC__=SC,n(null,window,2)}function LZ(e){return(e<0||e>9?"":"0")+e}function handleSuccess(e,t,n){var r=e.getPath("request.addressPrefix")+e.getPath("request.address"),i={status:e.get("status"),type:"default",headers:e.get("headers"),url:r,text:function(){var t=e.get("encodedBody"),n=Promise.resolve(t);return n},json:function(){var t=e.get("encodedBody"),n=JSON.parse(t),r=Promise.resolve(n);return r}};t(i)}function handleFailure(e,t,n){var r=e.get("encodedBody"),i=new TypeError(r);n(i)}function main(){CloudOS.main()}(function(e,t){function u(e){var t=o[e]={},n,r;e=e.split(/\s+/);for(n=0,r=e.length;n<r;n++)t[e[n]]=!0;return t}function c(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(l,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:s.isNumeric(r)?+r:f.test(r)?s.parseJSON(r):r}catch(o){}s.data(e,n,r)}else r=t}return r}function h(e){for(var t in e){if(t==="data"&&s.isEmptyObject(e[t]))continue;if(t!=="toJSON"
)return!1}return!0}function p(e,t,n){var r=t+"defer",i=t+"queue",o=t+"mark",u=s._data(e,r);u&&(n==="queue"||!s._data(e,i))&&(n==="mark"||!s._data(e,o))&&setTimeout(function(){!s._data(e,i)&&!s._data(e,o)&&(s.removeData(e,r,!0),u.fire())},0)}function H(){return!1}function B(){return!0}function W(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function X(e,t,n){t=t||0;if(s.isFunction(t))return s.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return s.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=s.grep(e,function(e){return e.nodeType===1});if(q.test(t))return s.filter(t,r,!n);t=s.filter(t,r)}return s.grep(e,function(e,r){return s.inArray(e,t)>=0===n})}function V(e){var t=$.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function at(e,t){return s.nodeName(e,"table")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ft(e,t){if(t.nodeType!==1||!s.hasData(e))return;var n,r,i,o=s._data(e),u=s._data(t,o),a=o.events;if(a){delete u.handle,u.events={};for(n in a)for(r=0,i=a[n].length;r<i;r++)s.event.add(t,n,a[n][r])}u.data&&(u.data=s.extend({},u.data))}function lt(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?t.outerHTML=e.outerHTML:n!=="input"||e.type!=="checkbox"&&e.type!=="radio"?n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=
e.text):(e.checked&&(t.defaultChecked=t.checked=e.checked),t.value!==e.value&&(t.value=e.value)),t.removeAttribute(s.expando),t.removeAttribute("_submit_attached"),t.removeAttribute("_change_attached")}function ct(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function ht(e){if(e.type==="checkbox"||e.type==="radio")e.defaultChecked=e.checked}function pt(e){var t=(e.nodeName||"").toLowerCase();t==="input"?ht(e):t!=="script"&&typeof e.getElementsByTagName!="undefined"&&s.grep(e.getElementsByTagName("input"),ht)}function dt(e){var t=n.createElement("div");return ut.appendChild(t),t.innerHTML=e.outerHTML,t.firstChild}function kt(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=t==="width"?1:0,o=4;if(r>0){if(n!=="border")for(;i<o;i+=2)n||(r-=parseFloat(s.css(e,"padding"+xt[i]))||0),n==="margin"?r+=parseFloat(s.css(e,n+xt[i]))||0:r-=parseFloat(s.css(e,"border"+xt[i]+"Width"))||0;return r+"px"}r=Tt(e,t);if(r<0||r==null)r=e.style[t];if(bt.test(r))return r;r=parseFloat(r)||0;if(n)for(;i<o;i+=2)r+=parseFloat(s.css(e,"padding"+xt[i]))||0,n!=="padding"&&(r+=parseFloat(s.css(e,"border"+xt[i]+"Width"))||0),n==="margin"&&(r+=parseFloat(s.css(e,n+xt[i]))||0);return r+"px"}function Bt(){return setTimeout(jt,0),Ht=s.now()}function jt(){Ht=t}function Ft(e,t){var n={};return s.each(Pt.concat.apply([],Pt.slice(0,t)),function(){n[this]=e}),n}function It(e){if(!Lt[e]){var t=n.body,r=s("<"+e+">").appendTo(t),i=r.css("display");r.remove();if(i==="none"||i===""){At||(At=n.createElement("iframe")
,At.frameBorder=At.width=At.height=0),t.appendChild(At);if(!Ot||!At.createElement)Ot=(At.contentWindow||At.contentDocument).document,Ot.write((s.support.boxModel?"<!doctype html>":"")+"<html><body>"),Ot.close();r=Ot.createElement(e),Ot.body.appendChild(r),i=s.css(r,"display"),t.removeChild(At)}Lt[e]=i}return Lt[e]}function zt(e){return s.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n=e.document,r=e.navigator,i=e.location,s=function(){function H(){if(i.isReady)return;try{n.documentElement.doScroll("left")}catch(e){setTimeout(H,1);return}i.ready()}var i=function(e,t){return new i.fn.init(e,t,u)},s=e.jQuery,o=e.$,u,a=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,f=/\S/,l=/^\s+/,c=/\s+$/,h=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,p=/^[\],:{}\s]*$/,d=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,v=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,m=/(?:^|:|,)(?:\s*\[)+/g,g=/(webkit)[ \/]([\w.]+)/,y=/(opera)(?:.*version)?[ \/]([\w.]+)/,b=/(msie) ([\w.]+)/,w=/(mozilla)(?:.*? rv:([\w.]+))?/,E=/-([a-z]|[0-9])/ig,S=/^-ms-/,x=function(e,t){return(t+"").toUpperCase()},T=r.userAgent,N,C,k,L=Object.prototype.toString,A=Object.prototype.hasOwnProperty,O=Array.prototype.push,M=Array.prototype.slice,_=String.prototype.trim,D=Array.prototype.indexOf,P={};return i.fn=i.prototype={constructor:i,init:function(e,r,s){var o,u,f,l;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(e==="body"&&!r&&n.body)return this.context=n,this[0]=n.body,this.selector=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?
o=[null,e,null]:o=a.exec(e);if(o&&(o[1]||!r)){if(o[1])return r=r instanceof i?r[0]:r,l=r?r.ownerDocument||r:n,f=h.exec(e),f?i.isPlainObject(r)?(e=[n.createElement(f[1])],i.fn.attr.call(e,r,!0)):e=[l.createElement(f[1])]:(f=i.buildFragment([o[1]],[l]),e=(f.cacheable?i.clone(f.fragment):f.fragment).childNodes),i.merge(this,e);u=n.getElementById(o[2]);if(u&&u.parentNode){if(u.id!==o[2])return s.find(e);this.length=1,this[0]=u}return this.context=n,this.selector=e,this}return!r||r.jquery?(r||s).find(e):this.constructor(r).find(e)}return i.isFunction(e)?s.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),i.makeArray(e,this))},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return M.call(this,0)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=this.constructor();return i.isArray(e)?O.apply(r,e):i.merge(r,e),r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return i.each(this,e,t)},ready:function(e){return i.bindReady(),C.add(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(M.apply(this,arguments),"slice",M.call(arguments).join(","))},map:function(e){return this.pushStack(i.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:O,sort:[].sort
,splice:[].splice},i.fn.init.prototype=i.fn,i.extend=i.fn.extend=function(){var e,n,r,s,o,u,a=arguments[0]||{},f=1,l=arguments.length,c=!1;typeof a=="boolean"&&(c=a,a=arguments[1]||{},f=2),typeof a!="object"&&!i.isFunction(a)&&(a={}),l===f&&(a=this,--f);for(;f<l;f++)if((e=arguments[f])!=null)for(n in e){r=a[n],s=e[n];if(a===s)continue;c&&s&&(i.isPlainObject(s)||(o=i.isArray(s)))?(o?(o=!1,u=r&&i.isArray(r)?r:[]):u=r&&i.isPlainObject(r)?r:{},a[n]=i.extend(c,u,s)):s!==t&&(a[n]=s)}return a},i.extend({noConflict:function(t){return e.$===i&&(e.$=o),t&&e.jQuery===i&&(e.jQuery=s),i},isReady:!1,readyWait:1,holdReady:function(e){e?i.readyWait++:i.ready(!0)},ready:function(e){if(e===!0&&!--i.readyWait||e!==!0&&!i.isReady){if(!n.body)return setTimeout(i.ready,1);i.isReady=!0;if(e!==!0&&--i.readyWait>0)return;C.fireWith(n,[i]),i.fn.trigger&&i(n).trigger("ready").off("ready")}},bindReady:function(){if(C)return;C=i.Callbacks("once memory");if(n.readyState==="complete")return setTimeout(i.ready,1);if(n.addEventListener)n.addEventListener("DOMContentLoaded",k,!1),e.addEventListener("load",i.ready,!1);else if(n.attachEvent){n.attachEvent("onreadystatechange",k),e.attachEvent("onload",i.ready);var t=!1;try{t=e.frameElement==null}catch(r){}n.documentElement.doScroll&&t&&H()}},isFunction:function(e){return i.type(e)==="function"},isArray:Array.isArray||function(e){return i.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):P[L.call(e)]||"object"},isPlainObject:function(e){if(!
e||i.type(e)!=="object"||e.nodeType||i.isWindow(e))return!1;try{if(e.constructor&&!A.call(e,"constructor")&&!A.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||A.call(e,r)},isEmptyObject:function(e){for(var t in e)return!1;return!0},error:function(e){throw new Error(e)},parseJSON:function(t){if(typeof t!="string"||!t)return null;t=i.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(p.test(t.replace(d,"@").replace(v,"]").replace(m,"")))return(new Function("return "+t))();i.error("Invalid JSON: "+t)},parseXML:function(n){if(typeof n!="string"||!n)return null;var r,s;try{e.DOMParser?(s=new DOMParser,r=s.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&i.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&f.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(S,"ms-").replace(E,x)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toUpperCase()===t.toUpperCase()},each:function(e,n,r){var s,o=0,u=e.length,a=u===t||i.isFunction(e);if(r){if(a){for(s in e)if(n.apply(e[s],r)===!1)break}else for(;o<u;)if(n.apply(e[o++],r)===!1)break}else if(a){for(s in e)if(n.call(e[s],s,e[s])===!1)break}else for(;o<u;)if(n.call(e[o],o,e[o++])===!1)break;return e},trim:_?function(e){return e==null?"":_.call(e)}:function(e){return e==null?"":e.toString().replace(l,"").replace(c,"")},makeArray:function(e,t){var n=t||[];if(e!=null){var r=
i.type(e);e.length==null||r==="string"||r==="function"||r==="regexp"||i.isWindow(e)?O.call(n,e):i.merge(n,e)}return n},inArray:function(e,t,n){var r;if(t){if(D)return D.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=e.length,i=0;if(typeof n.length=="number")for(var s=n.length;i<s;i++)e[r++]=n[i];else while(n[i]!==t)e[r++]=n[i++];return e.length=r,e},grep:function(e,t,n){var r=[],i;n=!!n;for(var s=0,o=e.length;s<o;s++)i=!!t(e[s],s),n!==i&&r.push(e[s]);return r},map:function(e,n,r){var s,o,u=[],a=0,f=e.length,l=e instanceof i||f!==t&&typeof f=="number"&&(f>0&&e[0]&&e[f-1]||f===0||i.isArray(e));if(l)for(;a<f;a++)s=n(e[a],a,r),s!=null&&(u[u.length]=s);else for(o in e)s=n(e[o],o,r),s!=null&&(u[u.length]=s);return u.concat.apply([],u)},guid:1,proxy:function(e,n){if(typeof n=="string"){var r=e[n];n=e,e=r}if(!i.isFunction(e))return t;var s=M.call(arguments,2),o=function(){return e.apply(n,s.concat(M.call(arguments)))};return o.guid=e.guid=e.guid||o.guid||i.guid++,o},access:function(e,n,r,s,o,u,a){var f,l=r==null,c=0,h=e.length;if(r&&typeof r=="object"){for(c in r)i.access(e,n,c,r[c],1,u,s);o=1}else if(s!==t){f=a===t&&i.isFunction(s),l&&(f?(f=n,n=function(e,t,n){return f.call(i(e),n)}):(n.call(e,s),n=null));if(n)for(;c<h;c++)n(e[c],r,f?s.call(e[c],c,n(e[c],r)):s,a);o=1}return o?e:l?n.call(e):h?n(e[0],r):u},now:function(){return(new Date).getTime()},uaMatch:function(e){e=e.toLowerCase();var t=g.exec(e)||y.exec(e)||b.exec(e)||e.indexOf("compatible")<0&&w.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"
}},sub:function(){function e(t,n){return new e.fn.init(t,n)}i.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,s){return s&&s instanceof i&&!(s instanceof e)&&(s=e(s)),i.fn.init.call(this,r,s,t)},e.fn.init.prototype=e.fn;var t=e(n);return e},browser:{}}),i.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){P["[object "+t+"]"]=t.toLowerCase()}),N=i.uaMatch(T),N.browser&&(i.browser[N.browser]=!0,i.browser.version=N.version),i.browser.webkit&&(i.browser.safari=!0),f.test(" ")&&(l=/^[\s\xA0]+/,c=/[\s\xA0]+$/),u=i(n),n.addEventListener?k=function(){n.removeEventListener("DOMContentLoaded",k,!1),i.ready()}:n.attachEvent&&(k=function(){n.readyState==="complete"&&(n.detachEvent("onreadystatechange",k),i.ready())}),i}(),o={};s.Callbacks=function(e){e=e?o[e]||u(e):{};var n=[],r=[],i,a,f,l,c,h,p=function(t){var r,i,o,u,a;for(r=0,i=t.length;r<i;r++)o=t[r],u=s.type(o),u==="array"?p(o):u==="function"&&(!e.unique||!v.has(o))&&n.push(o)},d=function(t,s){s=s||[],i=!e.memory||[t,s],a=!0,f=!0,h=l||0,l=0,c=n.length;for(;n&&h<c;h++)if(n[h].apply(t,s)===!1&&e.stopOnFalse){i=!0;break}f=!1,n&&(e.once?i===!0?v.disable():n=[]:r&&r.length&&(i=r.shift(),v.fireWith(i[0],i[1])))},v={add:function(){if(n){var e=n.length;p(arguments),f?c=n.length:i&&i!==!0&&(l=e,d(i[0],i[1]))}return this},remove:function(){if(n){var t=arguments,r=0,i=t.length;for(;r<i;r++)for(var s=0;s<n.length;s++)if(t[r]===n[s]){f&&s<=c&&(c--,s<=h&&h--),n.splice(s--,1);if(e.unique)break}}return this},has:function(e){if(n){var t=0,r=n.length
;for(;t<r;t++)if(e===n[t])return!0}return!1},empty:function(){return n=[],this},disable:function(){return n=r=i=t,this},disabled:function(){return!n},lock:function(){return r=t,(!i||i===!0)&&v.disable(),this},locked:function(){return!r},fireWith:function(t,n){return r&&(f?e.once||r.push([t,n]):(!e.once||!i)&&d(t,n)),this},fire:function(){return v.fireWith(this,arguments),this},fired:function(){return!!a}};return v};var a=[].slice;s.extend({Deferred:function(e){var t=s.Callbacks("once memory"),n=s.Callbacks("once memory"),r=s.Callbacks("memory"),i="pending",o={resolve:t,reject:n,notify:r},u={done:t.add,fail:n.add,progress:r.add,state:function(){return i},isResolved:t.fired,isRejected:n.fired,then:function(e,t,n){return a.done(e).fail(t).progress(n),this},always:function(){return a.done.apply(a,arguments).fail.apply(a,arguments),this},pipe:function(e,t,n){return s.Deferred(function(r){s.each({done:[e,"resolve"],fail:[t,"reject"],progress:[n,"notify"]},function(e,t){var n=t[0],i=t[1],o;s.isFunction(n)?a[e](function(){o=n.apply(this,arguments),o&&s.isFunction(o.promise)?o.promise().then(r.resolve,r.reject,r.notify):r[i+"With"](this===a?r:this,[o])}):a[e](r[i])})}).promise()},promise:function(e){if(e==null)e=u;else for(var t in u)e[t]=u[t];return e}},a=u.promise({}),f;for(f in o)a[f]=o[f].fire,a[f+"With"]=o[f].fireWith;return a.done(function(){i="resolved"},n.disable,r.lock).fail(function(){i="rejected"},t.disable,r.lock),e&&e.call(a,a),a},when:function(e){function c(e){return function(n){t[e]=arguments.length>1?a.call(arguments,0):n,--o||f.resolveWith(f,t)}}function h(e){return function(
t){i[e]=arguments.length>1?a.call(arguments,0):t,f.notifyWith(l,i)}}var t=a.call(arguments,0),n=0,r=t.length,i=new Array(r),o=r,u=r,f=r<=1&&e&&s.isFunction(e.promise)?e:s.Deferred(),l=f.promise();if(r>1){for(;n<r;n++)t[n]&&t[n].promise&&s.isFunction(t[n].promise)?t[n].promise().then(c(n),f.reject,h(n)):--o;o||f.resolveWith(f,t)}else f!==e&&f.resolveWith(f,r?[e]:[]);return l}}),s.support=function(){var t,r,i,o,u,a,f,l,c,h,p,d,v=n.createElement("div"),m=n.documentElement;v.setAttribute("className","t"),v.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",r=v.getElementsByTagName("*"),i=v.getElementsByTagName("a")[0];if(!r||!r.length||!i)return{};o=n.createElement("select"),u=o.appendChild(n.createElement("option")),a=v.getElementsByTagName("input")[0],t={leadingWhitespace:v.firstChild.nodeType===3,tbody:!v.getElementsByTagName("tbody").length,htmlSerialize:!!v.getElementsByTagName("link").length,style:/top/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:a.value==="on",optSelected:u.selected,getSetAttribute:v.className!=="t",enctype:!!n.createElement("form").enctype,html5Clone:n.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},s.boxModel=t.boxModel=n.compatMode==="CSS1Compat",a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,
o.disabled=!0,t.optDisabled=!u.disabled;try{delete v.test}catch(g){t.deleteExpando=!1}!v.addEventListener&&v.attachEvent&&v.fireEvent&&(v.attachEvent("onclick",function(){t.noCloneEvent=!1}),v.cloneNode(!0).fireEvent("onclick")),a=n.createElement("input"),a.value="t",a.setAttribute("type","radio"),t.radioValue=a.value==="t",a.setAttribute("checked","checked"),a.setAttribute("name","t"),v.appendChild(a),f=n.createDocumentFragment(),f.appendChild(v.lastChild),t.checkClone=f.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=a.checked,f.removeChild(a),f.appendChild(v);if(v.attachEvent)for(p in{submit:1,change:1,focusin:1})h="on"+p,d=h in v,d||(v.setAttribute(h,"return;"),d=typeof v[h]=="function"),t[p+"Bubbles"]=d;return f.removeChild(v),f=o=u=v=a=null,s(function(){var r,i,o,u,a,f,c,h,p,m,g,y,b,w=n.getElementsByTagName("body")[0];if(!w)return;h=1,b="padding:0;margin:0;border:",g="position:absolute;top:0;left:0;width:1px;height:1px;",y=b+"0;visibility:hidden;",p="style='"+g+b+"5px solid #000;",m="<div "+p+"display:block;'><div style='"+b+"0;display:block;overflow:hidden;'></div></div>"+"<table "+p+"' cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",r=n.createElement("div"),r.style.cssText=y+"width:0;height:0;position:static;top:0;margin-top:"+h+"px",w.insertBefore(r,w.firstChild),v=n.createElement("div"),r.appendChild(v),v.innerHTML="<table><tr><td style='"+b+"0;display:none'></td><td>t</td></tr></table>",l=v.getElementsByTagName("td"),d=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",t.reliableHiddenOffsets=d&&l[0].offsetHeight===0
,e.getComputedStyle&&(v.innerHTML="",c=n.createElement("div"),c.style.width="0",c.style.marginRight="0",v.style.width="2px",v.appendChild(c),t.reliableMarginRight=(parseInt((e.getComputedStyle(c,null)||{marginRight:0}).marginRight,10)||0)===0),typeof v.style.zoom!="undefined"&&(v.innerHTML="",v.style.width=v.style.padding="1px",v.style.border=0,v.style.overflow="hidden",v.style.display="inline",v.style.zoom=1,t.inlineBlockNeedsLayout=v.offsetWidth===3,v.style.display="block",v.style.overflow="visible",v.innerHTML="<div style='width:5px;'></div>",t.shrinkWrapBlocks=v.offsetWidth!==3),v.style.cssText=g+y,v.innerHTML=m,i=v.firstChild,o=i.firstChild,a=i.nextSibling.firstChild.firstChild,f={doesNotAddBorder:o.offsetTop!==5,doesAddBorderForTableAndCells:a.offsetTop===5},o.style.position="fixed",o.style.top="20px",f.fixedPosition=o.offsetTop===20||o.offsetTop===15,o.style.position=o.style.top="",i.style.overflow="hidden",i.style.position="relative",f.subtractsBorderForOverflowNotVisible=o.offsetTop===-5,f.doesNotIncludeMarginInBodyOffset=w.offsetTop!==h,e.getComputedStyle&&(v.style.marginTop="1%",t.pixelMargin=(e.getComputedStyle(v,null)||{marginTop:0}).marginTop!=="1%"),typeof r.style.zoom!="undefined"&&(r.style.zoom=1),w.removeChild(r),c=v=r=null,s.extend(t,f)}),t}();var f=/^(?:\{.*\}|\[.*\])$/,l=/([A-Z])/g;s.extend({cache:{},uuid:0,expando:"jQuery"+(s.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?s.cache[e[s.expando]]:e[s.expando],!!e&&!h(e)},data:function(e,n,r,i
){if(!s.acceptData(e))return;var o,u,a,f=s.expando,l=typeof n=="string",c=e.nodeType,h=c?s.cache:e,p=c?e[f]:e[f]&&f,d=n==="events";if((!p||!h[p]||!d&&!i&&!h[p].data)&&l&&r===t)return;p||(c?e[f]=p=++s.uuid:p=f),h[p]||(h[p]={},c||(h[p].toJSON=s.noop));if(typeof n=="object"||typeof n=="function")i?h[p]=s.extend(h[p],n):h[p].data=s.extend(h[p].data,n);return o=u=h[p],i||(u.data||(u.data={}),u=u.data),r!==t&&(u[s.camelCase(n)]=r),d&&!u[n]?o.events:(l?(a=u[n],a==null&&(a=u[s.camelCase(n)])):a=u,a)},removeData:function(e,t,n){if(!s.acceptData(e))return;var r,i,o,u=s.expando,a=e.nodeType,f=a?s.cache:e,l=a?e[u]:u;if(!f[l])return;if(t){r=n?f[l]:f[l].data;if(r){s.isArray(t)||(t in r?t=[t]:(t=s.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,o=t.length;i<o;i++)delete r[t[i]];if(!(n?h:s.isEmptyObject)(r))return}}if(!n){delete f[l].data;if(!h(f[l]))return}s.support.deleteExpando||!f.setInterval?delete f[l]:f[l]=null,a&&(s.support.deleteExpando?delete e[u]:e.removeAttribute?e.removeAttribute(u):e[u]=null)},_data:function(e,t,n){return s.data(e,t,n,!0)},acceptData:function(e){if(e.nodeName){var t=s.noData[e.nodeName.toLowerCase()];if(t)return t!==!0&&e.getAttribute("classid")===t}return!0}}),s.fn.extend({data:function(e,n){var r,i,o,u,a,f=this[0],l=0,h=null;if(e===t){if(this.length){h=s.data(f);if(f.nodeType===1&&!s._data(f,"parsedAttrs")){o=f.attributes;for(a=o.length;l<a;l++)u=o[l].name,u.indexOf("data-")===0&&(u=s.camelCase(u.substring(5)),c(f,u,h[u]));s._data(f,"parsedAttrs",!0)}}return h}return typeof e=="object"?this.each(function(){s.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+
r[1]:"",i=r[1]+"!",s.access(this,function(n){if(n===t)return h=this.triggerHandler("getData"+i,[r[0]]),h===t&&f&&(h=s.data(f,e),h=c(f,e,h)),h===t&&r[1]?this.data(r[0]):h;r[1]=n,this.each(function(){var t=s(this);t.triggerHandler("setData"+i,r),s.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){s.removeData(this,e)})}}),s.extend({_mark:function(e,t){e&&(t=(t||"fx")+"mark",s._data(e,t,(s._data(e,t)||0)+1))},_unmark:function(e,t,n){e!==!0&&(n=t,t=e,e=!1);if(t){n=n||"fx";var r=n+"mark",i=e?0:(s._data(t,r)||1)-1;i?s._data(t,r,i):(s.removeData(t,r,!0),p(t,n,"mark"))}},queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=s._data(e,t),n&&(!r||s.isArray(n)?r=s._data(e,t,s.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=s.queue(e,t),r=n.shift(),i={};r==="inprogress"&&(r=n.shift()),r&&(t==="fx"&&n.unshift("inprogress"),s._data(e,t+".run",i),r.call(e,function(){s.dequeue(e,t)},i)),n.length||(s.removeData(e,t+"queue "+t+".run",!0),p(e,t,"queue"))}}),s.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?s.queue(this[0],e):n===t?this:this.each(function(){var t=s.queue(this,e,n);e==="fx"&&t[0]!=="inprogress"&&s.dequeue(this,e)})},dequeue:function(e){return this.each(function(){s.dequeue(this,e)})},delay:function(e,t){return e=s.fx?s.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){
function h(){--u||r.resolveWith(i,[i])}typeof e!="string"&&(n=e,e=t),e=e||"fx";var r=s.Deferred(),i=this,o=i.length,u=1,a=e+"defer",f=e+"queue",l=e+"mark",c;while(o--)if(c=s.data(i[o],a,t,!0)||(s.data(i[o],f,t,!0)||s.data(i[o],l,t,!0))&&s.data(i[o],a,s.Callbacks("once memory"),!0))u++,c.add(h);return h(),r.promise(n)}});var d=/[\n\t\r]/g,v=/\s+/,m=/\r/g,g=/^(?:button|input)$/i,y=/^(?:button|input|object|select|textarea)$/i,b=/^a(?:rea)?$/i,w=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,E=s.support.getSetAttribute,S,x,T;s.fn.extend({attr:function(e,t){return s.access(this,s.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){s.removeAttr(this,e)})},prop:function(e,t){return s.access(this,s.prop,e,t,arguments.length>1)},removeProp:function(e){return e=s.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,u,a;if(s.isFunction(e))return this.each(function(t){s(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(v);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{o=" "+i.className+" ";for(u=0,a=t.length;u<a;u++)~o.indexOf(" "+t[u]+" ")||(o+=t[u]+" ");i.className=s.trim(o)}}}return this},removeClass:function(e){var n,r,i,o,u,a,f;if(s.isFunction(e))return this.each(function(t){s(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(v);for(r=0,i=this.length;r<i;r++){o=this[r];if(o.
nodeType===1&&o.className)if(e){u=(" "+o.className+" ").replace(d," ");for(a=0,f=n.length;a<f;a++)u=u.replace(" "+n[a]+" "," ");o.className=s.trim(u)}else o.className=""}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return s.isFunction(e)?this.each(function(n){s(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,o=0,u=s(this),a=t,f=e.split(v);while(i=f[o++])a=r?a:!u.hasClass(i),u[a?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&s._data(this,"__className__",this.className),this.className=this.className||e===!1?"":s._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(d," ").indexOf(t)>-1)return!0;return!1},val:function(e){var n,r,i,o=this[0];if(!arguments.length){if(o)return n=s.valHooks[o.type]||s.valHooks[o.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(o,"value"))!==t?r:(r=o.value,typeof r=="string"?r.replace(m,""):r==null?"":r);return}return i=s.isFunction(e),this.each(function(r){var o=s(this),u;if(this.nodeType!==1)return;i?u=e.call(this,r,o.val()):u=e,u==null?u="":typeof u=="number"?u+="":s.isArray(u)&&(u=s.map(u,function(e){return e==null?"":e+""})),n=s.valHooks[this.type]||s.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,u,"value")===t)this.value=u})}}),s.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r,i,o=e.selectedIndex,u=[],a=e.
options,f=e.type==="select-one";if(o<0)return null;n=f?o:0,r=f?o+1:a.length;for(;n<r;n++){i=a[n];if(i.selected&&(s.support.optDisabled?!i.disabled:i.getAttribute("disabled")===null)&&(!i.parentNode.disabled||!s.nodeName(i.parentNode,"optgroup"))){t=s(i).val();if(f)return t;u.push(t)}}return f&&!u.length&&a.length?s(a[o]).val():u},set:function(e,t){var n=s.makeArray(t);return s(e).find("option").each(function(){this.selected=s.inArray(s(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(e,n,r,i){var o,u,a,f=e.nodeType;if(!e||f===3||f===8||f===2)return;if(i&&n in s.attrFn)return s(e)[n](r);if(typeof e.getAttribute=="undefined")return s.prop(e,n,r);a=f!==1||!s.isXMLDoc(e),a&&(n=n.toLowerCase(),u=s.attrHooks[n]||(w.test(n)?x:S));if(r!==t){if(r===null){s.removeAttr(e,n);return}return u&&"set"in u&&a&&(o=u.set(e,r,n))!==t?o:(e.setAttribute(n,""+r),r)}return u&&"get"in u&&a&&(o=u.get(e,n))!==null?o:(o=e.getAttribute(n),o===null?t:o)},removeAttr:function(e,t){var n,r,i,o,u,a=0;if(t&&e.nodeType===1){r=t.toLowerCase().split(v),o=r.length;for(;a<o;a++)i=r[a],i&&(n=s.propFix[i]||i,u=w.test(i),u||s.attr(e,i,""),e.removeAttribute(E?i:n),u&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(g.test(e.nodeName)&&e.parentNode)s.error("type property can't be changed");else if(!s.support.radioValue&&t==="radio"&&s.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return S&&s.nodeName(e,"button")?S.get(e,t):t in e?e.value:null},set:function(
e,t,n){if(S&&s.nodeName(e,"button"))return S.set(e,t,n);e.value=t}}},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(e,n,r){var i,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;return u=a!==1||!s.isXMLDoc(e),u&&(n=s.propFix[n]||n,o=s.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&(i=o.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):y.test(e.nodeName)||b.test(e.nodeName)&&e.href?0:t}}}}),s.attrHooks.tabindex=s.propHooks.tabIndex,x={get:function(e,n){var r,i=s.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?s.removeAttr(e,n):(r=s.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},E||(T={name:!0,id:!0,coords:!0},S=s.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(T[n]?r.nodeValue!=="":r.specified)?r.nodeValue:t},set:function(e,t,r){var i=e.getAttributeNode(r);return i||(i=n.createAttribute(r),e.setAttributeNode(i)),i.nodeValue=t+""}},s.attrHooks.tabindex.set=S.set,s.each(["width","height"],function(e,t){s.attrHooks[t]=s.extend(s.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),s.attrHooks.contenteditable={get:S.get,set:function(e,t,n){t===""&&
(t="false"),S.set(e,t,n)}}),s.support.hrefNormalized||s.each(["href","src","width","height"],function(e,n){s.attrHooks[n]=s.extend(s.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),s.support.style||(s.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=""+t}}),s.support.optSelected||(s.propHooks.selected=s.extend(s.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),s.support.enctype||(s.propFix.enctype="encoding"),s.support.checkOn||s.each(["radio","checkbox"],function(){s.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),s.each(["radio","checkbox"],function(){s.valHooks[this]=s.extend(s.valHooks[this],{set:function(e,t){if(s.isArray(t))return e.checked=s.inArray(s(e).val(),t)>=0}})});var N=/^(?:textarea|input|select)$/i,C=/^([^\.]*)?(?:\.(.+))?$/,k=/(?:^|\s)hover(\.\S+)?\b/,L=/^key/,A=/^(?:mouse|contextmenu)|click/,O=/^(?:focusinfocus|focusoutblur)$/,M=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,_=function(e){var t=M.exec(e);return t&&(t[1]=(t[1]||"").toLowerCase(),t[3]=t[3]&&new RegExp("(?:^|\\s)"+t[3]+"(?:\\s|$)")),t},D=function(e,t){var n=e.attributes||{};return(!t[1]||e.nodeName.toLowerCase()===t[1])&&(!t[2]||(n.id||{}).value===t[2])&&(!t[3]||t[3].test((n["class"]||{}).value))},P=function(e){return s.event.special.hover?e:e.replace(k,"mouseenter$1 mouseleave$1")};s.event={add:function(e,n,r,i,o){var u,a,f,l,c,h,p,d,v,m,g,y;if(e.nodeType===3||e.nodeType===8||!n||!
r||!(u=s._data(e)))return;r.handler&&(v=r,r=v.handler,o=v.selector),r.guid||(r.guid=s.guid++),f=u.events,f||(u.events=f={}),a=u.handle,a||(u.handle=a=function(e){return typeof s=="undefined"||!!e&&s.event.triggered===e.type?t:s.event.dispatch.apply(a.elem,arguments)},a.elem=e),n=s.trim(P(n)).split(" ");for(l=0;l<n.length;l++){c=C.exec(n[l])||[],h=c[1],p=(c[2]||"").split(".").sort(),y=s.event.special[h]||{},h=(o?y.delegateType:y.bindType)||h,y=s.event.special[h]||{},d=s.extend({type:h,origType:c[1],data:i,handler:r,guid:r.guid,selector:o,quick:o&&_(o),namespace:p.join(".")},v),g=f[h];if(!g){g=f[h]=[],g.delegateCount=0;if(!y.setup||y.setup.call(e,i,p,a)===!1)e.addEventListener?e.addEventListener(h,a,!1):e.attachEvent&&e.attachEvent("on"+h,a)}y.add&&(y.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),o?g.splice(g.delegateCount++,0,d):g.push(d),s.event.global[h]=!0}e=null},global:{},remove:function(e,t,n,r,i){var o=s.hasData(e)&&s._data(e),u,a,f,l,c,h,p,d,v,m,g,y;if(!o||!(d=o.events))return;t=s.trim(P(t||"")).split(" ");for(u=0;u<t.length;u++){a=C.exec(t[u])||[],f=l=a[1],c=a[2];if(!f){for(f in d)s.event.remove(e,f+t[u],n,r,!0);continue}v=s.event.special[f]||{},f=(r?v.delegateType:v.bindType)||f,g=d[f]||[],h=g.length,c=c?new RegExp("(^|\\.)"+c.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(p=0;p<g.length;p++)y=g[p],(i||l===y.origType)&&(!n||n.guid===y.guid)&&(!c||c.test(y.namespace))&&(!r||r===y.selector||r==="**"&&y.selector)&&(g.splice(p--,1),y.selector&&g.delegateCount--,v.remove&&v.remove.call(e,y));g.length===0&&h!==g.length&&((!v.teardown||v.teardown.call
(e,c)===!1)&&s.removeEvent(e,f,o.handle),delete d[f])}s.isEmptyObject(d)&&(m=o.handle,m&&(m.elem=null),s.removeData(e,["events","handle"],!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,i,o){if(!i||i.nodeType!==3&&i.nodeType!==8){var u=n.type||n,a=[],f,l,c,h,p,d,v,m,g,y;if(O.test(u+s.event.triggered))return;u.indexOf("!")>=0&&(u=u.slice(0,-1),l=!0),u.indexOf(".")>=0&&(a=u.split("."),u=a.shift(),a.sort());if((!i||s.event.customEvent[u])&&!s.event.global[u])return;n=typeof n=="object"?n[s.expando]?n:new s.Event(u,n):new s.Event(u),n.type=u,n.isTrigger=!0,n.exclusive=l,n.namespace=a.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+a.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,d=u.indexOf(":")<0?"on"+u:"";if(!i){f=s.cache;for(c in f)f[c].events&&f[c].events[u]&&s.event.trigger(n,r,f[c].handle.elem,!0);return}n.result=t,n.target||(n.target=i),r=r!=null?s.makeArray(r):[],r.unshift(n),v=s.event.special[u]||{};if(v.trigger&&v.trigger.apply(i,r)===!1)return;g=[[i,v.bindType||u]];if(!o&&!v.noBubble&&!s.isWindow(i)){y=v.delegateType||u,h=O.test(y+u)?i:i.parentNode,p=null;for(;h;h=h.parentNode)g.push([h,y]),p=h;p&&p===i.ownerDocument&&g.push([p.defaultView||p.parentWindow||e,y])}for(c=0;c<g.length&&!n.isPropagationStopped();c++)h=g[c][0],n.type=g[c][1],m=(s._data(h,"events")||{})[n.type]&&s._data(h,"handle"),m&&m.apply(h,r),m=d&&h[d],m&&s.acceptData(h)&&m.apply(h,r)===!1&&n.preventDefault();return n.type=u,!o&&!n.isDefaultPrevented()&&(!v._default||v._default.apply(i.ownerDocument,r)===!1)&&(u!=="click"||!s.nodeName(i,"a"))&&s.acceptData(i)&&d&&i[u]&&(u!=="focus"&&
u!=="blur"||n.target.offsetWidth!==0)&&!s.isWindow(i)&&(p=i[d],p&&(i[d]=null),s.event.triggered=u,i[u](),s.event.triggered=t,p&&(i[d]=p)),n.result}return},dispatch:function(n){n=s.event.fix(n||e.event);var r=(s._data(this,"events")||{})[n.type]||[],i=r.delegateCount,o=[].slice.call(arguments,0),u=!n.exclusive&&!n.namespace,a=s.event.special[n.type]||{},f=[],l,c,h,p,d,v,m,g,y,b,w;o[0]=n,n.delegateTarget=this;if(a.preDispatch&&a.preDispatch.call(this,n)===!1)return;if(i&&(!n.button||n.type!=="click")){p=s(this),p.context=this.ownerDocument||this;for(h=n.target;h!=this;h=h.parentNode||this)if(h.disabled!==!0){v={},g=[],p[0]=h;for(l=0;l<i;l++)y=r[l],b=y.selector,v[b]===t&&(v[b]=y.quick?D(h,y.quick):p.is(b)),v[b]&&g.push(y);g.length&&f.push({elem:h,matches:g})}}r.length>i&&f.push({elem:this,matches:r.slice(i)});for(l=0;l<f.length&&!n.isPropagationStopped();l++){m=f[l],n.currentTarget=m.elem;for(c=0;c<m.matches.length&&!n.isImmediatePropagationStopped();c++){y=m.matches[c];if(u||!n.namespace&&!y.namespace||n.namespace_re&&n.namespace_re.test(y.namespace))n.data=y.data,n.handleObj=y,d=((s.event.special[y.origType]||{}).handle||y.handler).apply(m.elem,o),d!==t&&(n.result=d,d===!1&&(n.preventDefault(),n.stopPropagation()))}}return a.postDispatch&&a.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=
null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,r){var i,s,o,u=r.button,a=r.fromElement;return e.pageX==null&&r.clientX!=null&&(i=e.target.ownerDocument||n,s=i.documentElement,o=i.body,e.pageX=r.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=r.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?r.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[s.expando])return e;var r,i,o=e,u=s.event.fixHooks[e.type]||{},a=u.props?this.props.concat(u.props):this.props;e=s.Event(o);for(r=a.length;r;)i=a[--r],e[i]=o[i];return e.target||(e.target=o.srcElement||n),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey===t&&(e.metaKey=e.ctrlKey),u.filter?u.filter(e,o):e},special:{ready:{setup:s.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){s.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=s.extend(new s.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?s.event.trigger(i,null,t):s.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},s.event.handle=s.event.dispatch,s.removeEvent=n.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){e.detachEvent&&e.
detachEvent("on"+t,n)},s.Event=function(e,t){if(!(this instanceof s.Event))return new s.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?B:H):this.type=e,t&&s.extend(this,t),this.timeStamp=e&&e.timeStamp||s.now(),this[s.expando]=!0},s.Event.prototype={preventDefault:function(){this.isDefaultPrevented=B;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=B;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=B,this.stopPropagation()},isDefaultPrevented:H,isPropagationStopped:H,isImmediatePropagationStopped:H},s.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){s.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n=this,r=e.relatedTarget,i=e.handleObj,o=i.selector,u;if(!r||r!==n&&!s.contains(n,r))e.type=i.origType,u=i.handler.apply(this,arguments),e.type=t;return u}}}),s.support.submitBubbles||(s.event.special.submit={setup:function(){if(s.nodeName(this,"form"))return!1;s.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=s.nodeName(n,"input")||s.nodeName(n,"button")?n.form:t;r&&!r._submit_attached&&(s.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),r._submit_attached=!0)})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&s.event.simulate
("submit",this.parentNode,e,!0))},teardown:function(){if(s.nodeName(this,"form"))return!1;s.event.remove(this,"._submit")}}),s.support.changeBubbles||(s.event.special.change={setup:function(){if(N.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")s.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),s.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1,s.event.simulate("change",this,e,!0))});return!1}s.event.add(this,"beforeactivate._change",function(e){var t=e.target;N.test(t.nodeName)&&!t._change_attached&&(s.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&s.event.simulate("change",this.parentNode,e,!0)}),t._change_attached=!0)})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return s.event.remove(this,"._change"),N.test(this.nodeName)}}),s.support.focusinBubbles||s.each({focus:"focusin",blur:"focusout"},function(e,t){var r=0,i=function(e){s.event.simulate(t,e.target,s.event.fix(e),!0)};s.event.special[t]={setup:function(){r++===0&&n.addEventListener(e,i,!0)},teardown:function(){--r===0&&n.removeEventListener(e,i,!0)}}}),s.fn.extend({on:function(e,n,r,i,o){var u,a;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=H;else if(!
i)return this;return o===1&&(u=i,i=function(e){return s().off(e),u.apply(this,arguments)},i.guid=u.guid||(u.guid=s.guid++)),this.each(function(){s.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){if(e&&e.preventDefault&&e.handleObj){var i=e.handleObj;return s(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this}if(typeof e=="object"){for(var o in e)this.off(o,n,e[o]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=H),this.each(function(){s.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return s(this.context).on(e,this.selector,t,n),this},die:function(e,t){return s(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length==1?this.off(e,"**"):this.off(t,e,n)},trigger:function(e,t){return this.each(function(){s.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return s.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||s.guid++,r=0,i=function(n){var i=(s._data(this,"lastToggle"+e.guid)||0)%r;return s._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),s.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu"
.split(" "),function(e,t){s.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},s.attrFn&&(s.attrFn[t]=!0),L.test(t)&&(s.event.fixHooks[t]=s.event.keyHooks),A.test(t)&&(s.event.fixHooks[t]=s.event.mouseHooks)}),function(){function S(e,t,n,i,s,o){for(var u=0,a=i.length;u<a;u++){var f=i[u];if(f){var l=!1;f=f[e];while(f){if(f[r]===n){l=i[f.sizset];break}f.nodeType===1&&!o&&(f[r]=n,f.sizset=u);if(f.nodeName.toLowerCase()===t){l=f;break}f=f[e]}i[u]=l}}}function x(e,t,n,i,s,o){for(var u=0,a=i.length;u<a;u++){var f=i[u];if(f){var l=!1;f=f[e];while(f){if(f[r]===n){l=i[f.sizset];break}if(f.nodeType===1){o||(f[r]=n,f.sizset=u);if(typeof t!="string"){if(f===t){l=!0;break}}else if(h.filter(t,[f]).length>0){l=f;break}}f=f[e]}i[u]=l}}}var e=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,r="sizcache"+(Math.random()+"").replace(".",""),i=0,o=Object.prototype.toString,u=!1,a=!0,f=/\\/g,l=/\r\n/g,c=/\W/;[0,0].sort(function(){return a=!1,0});var h=function(t,r,i,s){i=i||[],r=r||n;var u=r;if(r.nodeType!==1&&r.nodeType!==9)return[];if(!t||typeof t!="string")return i;var a,f,l,c,p,m,g,b,w=!0,E=h.isXML(r),S=[],x=t;do{e.exec(""),a=e.exec(x);if(a){x=a[3],S.push(a[1]);if(a[2]){c=a[3];break}}}while(a);if(S.length>1&&v.exec(t))if(S.length===2&&d.relative[S[0]])f=T(S[0]+S[1],r,s);else{f=d.relative[S[0]]?[r]:h(S.shift(),r);while(S.length)t=S.shift(),d.relative[t]&&(t+=S.shift()),f=T(t,f,s)}else{!s&&S.length>1&&r.nodeType===9&&!E&&d.match.ID.test(S[0])&&!d.match.ID.test
(S[S.length-1])&&(p=h.find(S.shift(),r,E),r=p.expr?h.filter(p.expr,p.set)[0]:p.set[0]);if(r){p=s?{expr:S.pop(),set:y(s)}:h.find(S.pop(),S.length!==1||S[0]!=="~"&&S[0]!=="+"||!r.parentNode?r:r.parentNode,E),f=p.expr?h.filter(p.expr,p.set):p.set,S.length>0?l=y(f):w=!1;while(S.length)m=S.pop(),g=m,d.relative[m]?g=S.pop():m="",g==null&&(g=r),d.relative[m](l,g,E)}else l=S=[]}l||(l=f),l||h.error(m||t);if(o.call(l)==="[object Array]")if(!w)i.push.apply(i,l);else if(r&&r.nodeType===1)for(b=0;l[b]!=null;b++)l[b]&&(l[b]===!0||l[b].nodeType===1&&h.contains(r,l[b]))&&i.push(f[b]);else for(b=0;l[b]!=null;b++)l[b]&&l[b].nodeType===1&&i.push(f[b]);else y(l,i);return c&&(h(c,u,i,s),h.uniqueSort(i)),i};h.uniqueSort=function(e){if(w){u=a,e.sort(w);if(u)for(var t=1;t<e.length;t++)e[t]===e[t-1]&&e.splice(t--,1)}return e},h.matches=function(e,t){return h(e,null,null,t)},h.matchesSelector=function(e,t){return h(t,null,null,[e]).length>0},h.find=function(e,t,n){var r,i,s,o,u,a;if(!e)return[];for(i=0,s=d.order.length;i<s;i++){u=d.order[i];if(o=d.leftMatch[u].exec(e)){a=o[1],o.splice(1,1);if(a.substr(a.length-1)!=="\\"){o[1]=(o[1]||"").replace(f,""),r=d.find[u](o,t,n);if(r!=null){e=e.replace(d.match[u],"");break}}}}return r||(r=typeof t.getElementsByTagName!="undefined"?t.getElementsByTagName("*"):[]),{set:r,expr:e}},h.filter=function(e,n,r,i){var s,o,u,a,f,l,c,p,v,m=e,g=[],y=n,b=n&&n[0]&&h.isXML(n[0]);while(e&&n.length){for(u in d.filter)if((s=d.leftMatch[u].exec(e))!=null&&s[2]){l=d.filter[u],c=s[1],o=!1,s.splice(1,1);if(c.substr(c.length-1)==="\\")continue;y===g&&(g=[]);if(d.preFilter[u]){s=d.preFilter
[u](s,y,r,g,i,b);if(!s)o=a=!0;else if(s===!0)continue}if(s)for(p=0;(f=y[p])!=null;p++)f&&(a=l(f,s,p,y),v=i^a,r&&a!=null?v?o=!0:y[p]=!1:v&&(g.push(f),o=!0));if(a!==t){r||(y=g),e=e.replace(d.match[u],"");if(!o)return[];break}}if(e===m){if(o!=null)break;h.error(e)}m=e}return y},h.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};var p=h.getText=function(e){var t,n,r=e.nodeType,i="";if(r){if(r===1||r===9||r===11){if(typeof e.textContent=="string")return e.textContent;if(typeof e.innerText=="string")return e.innerText.replace(l,"");for(e=e.firstChild;e;e=e.nextSibling)i+=p(e)}else if(r===3||r===4)return e.nodeValue}else for(t=0;n=e[t];t++)n.nodeType!==8&&(i+=p(n));return i},d=h.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(e,t){var n=typeof t=="string",r=n&&!c.test(t),i=n&&!r;r&&(t=t.toLowerCase());for(var s=0,o=e.length
,u;s<o;s++)if(u=e[s]){while((u=u.previousSibling)&&u.nodeType!==1);e[s]=i||u&&u.nodeName.toLowerCase()===t?u||!1:u===t}i&&h.filter(t,e,!0)},">":function(e,t){var n,r=typeof t=="string",i=0,s=e.length;if(r&&!c.test(t)){t=t.toLowerCase();for(;i<s;i++){n=e[i];if(n){var o=n.parentNode;e[i]=o.nodeName.toLowerCase()===t?o:!1}}}else{for(;i<s;i++)n=e[i],n&&(e[i]=r?n.parentNode:n.parentNode===t);r&&h.filter(t,e,!0)}},"":function(e,t,n){var r,s=i++,o=x;typeof t=="string"&&!c.test(t)&&(t=t.toLowerCase(),r=t,o=S),o("parentNode",t,s,e,r,n)},"~":function(e,t,n){var r,s=i++,o=x;typeof t=="string"&&!c.test(t)&&(t=t.toLowerCase(),r=t,o=S),o("previousSibling",t,s,e,r,n)}},find:{ID:function(e,t,n){if(typeof t.getElementById!="undefined"&&!n){var r=t.getElementById(e[1]);return r&&r.parentNode?[r]:[]}},NAME:function(e,t){if(typeof t.getElementsByName!="undefined"){var n=[],r=t.getElementsByName(e[1]);for(var i=0,s=r.length;i<s;i++)r[i].getAttribute("name")===e[1]&&n.push(r[i]);return n.length===0?null:n}},TAG:function(e,t){if(typeof t.getElementsByTagName!="undefined")return t.getElementsByTagName(e[1])}},preFilter:{CLASS:function(e,t,n,r,i,s){e=" "+e[1].replace(f,"")+" ";if(s)return e;for(var o=0,u;(u=t[o])!=null;o++)u&&(i^(u.className&&(" "+u.className+" ").replace(/[\t\n\r]/g," ").indexOf(e)>=0)?n||r.push(u):n&&(t[o]=!1));return!1},ID:function(e){return e[1].replace(f,"")},TAG:function(e,t){return e[1].replace(f,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){e[2]||h.error(e[0]),e[2]=e[2].replace(/^\+|\s*/g,"");var t=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/
.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=t[1]+(t[2]||1)-0,e[3]=t[3]-0}else e[2]&&h.error(e[0]);return e[0]=i++,e},ATTR:function(e,t,n,r,i,s){var o=e[1]=e[1].replace(f,"");return!s&&d.attrMap[o]&&(e[1]=d.attrMap[o]),e[4]=(e[4]||e[5]||"").replace(f,""),e[2]==="~="&&(e[4]=" "+e[4]+" "),e},PSEUDO:function(t,n,r,i,s){if(t[1]==="not"){if(!((e.exec(t[3])||"").length>1||/^\w/.test(t[3]))){var o=h.filter(t[3],n,r,!0^s);return r||i.push.apply(i,o),!1}t[3]=h(t[3],null,null,n)}else if(d.match.POS.test(t[0])||d.match.CHILD.test(t[0]))return!0;return t},POS:function(e){return e.unshift(!0),e}},filters:{enabled:function(e){return e.disabled===!1&&e.type!=="hidden"},disabled:function(e){return e.disabled===!0},checked:function(e){return e.checked===!0},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!!e.firstChild},empty:function(e){return!e.firstChild},has:function(e,t,n){return!!h(n[3],e).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){var t=e.getAttribute("type"),n=e.type;return e.nodeName.toLowerCase()==="input"&&"text"===n&&(t===n||t===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(e){var t=e.nodeName.toLowerCase();return(t==="input"||t==="button")&&"submit"===e.type},image:function(e){return e.nodeName.toLowerCase
()==="input"&&"image"===e.type},reset:function(e){var t=e.nodeName.toLowerCase();return(t==="input"||t==="button")&&"reset"===e.type},button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&"button"===e.type||t==="button"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(e,t){return t===0},last:function(e,t,n,r){return t===r.length-1},even:function(e,t){return t%2===0},odd:function(e,t){return t%2===1},lt:function(e,t,n){return t<n[3]-0},gt:function(e,t,n){return t>n[3]-0},nth:function(e,t,n){return n[3]-0===t},eq:function(e,t,n){return n[3]-0===t}},filter:{PSEUDO:function(e,t,n,r){var i=t[1],s=d.filters[i];if(s)return s(e,n,t,r);if(i==="contains")return(e.textContent||e.innerText||p([e])||"").indexOf(t[3])>=0;if(i==="not"){var o=t[3];for(var u=0,a=o.length;u<a;u++)if(o[u]===e)return!1;return!0}h.error(i)},CHILD:function(e,t){var n,i,s,o,u,a,f,l=t[1],c=e;switch(l){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(l==="first")return!0;c=e;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0;case"nth":n=t[2],i=t[3];if(n===1&&i===0)return!0;s=t[0],o=e.parentNode;if(o&&(o[r]!==s||!e.nodeIndex)){a=0;for(c=o.firstChild;c;c=c.nextSibling)c.nodeType===1&&(c.nodeIndex=++a);o[r]=s}return f=e.nodeIndex-i,n===0?f===0:f%n===0&&f/n>=0}},ID:function(e,t){return e.nodeType===1&&e.getAttribute("id")===t},TAG:function(e,t){return t==="*"&&e.nodeType===1||!!e.nodeName&&e.nodeName.toLowerCase()===t},CLASS:function(e,t){return(" "+
(e.className||e.getAttribute("class"))+" ").indexOf(t)>-1},ATTR:function(e,t){var n=t[1],r=h.attr?h.attr(e,n):d.attrHandle[n]?d.attrHandle[n](e):e[n]!=null?e[n]:e.getAttribute(n),i=r+"",s=t[2],o=t[4];return r==null?s==="!=":!s&&h.attr?r!=null:s==="="?i===o:s==="*="?i.indexOf(o)>=0:s==="~="?(" "+i+" ").indexOf(o)>=0:o?s==="!="?i!==o:s==="^="?i.indexOf(o)===0:s==="$="?i.substr(i.length-o.length)===o:s==="|="?i===o||i.substr(0,o.length+1)===o+"-":!1:i&&r!==!1},POS:function(e,t,n,r){var i=t[2],s=d.setFilters[i];if(s)return s(e,n,t,r)}}},v=d.match.POS,m=function(e,t){return"\\"+(t-0+1)};for(var g in d.match)d.match[g]=new RegExp(d.match[g].source+/(?![^\[]*\])(?![^\(]*\))/.source),d.leftMatch[g]=new RegExp(/(^(?:.|\r|\n)*?)/.source+d.match[g].source.replace(/\\(\d+)/g,m));d.match.globalPOS=v;var y=function(e,t){return e=Array.prototype.slice.call(e,0),t?(t.push.apply(t,e),t):e};try{Array.prototype.slice.call(n.documentElement.childNodes,0)[0].nodeType}catch(b){y=function(e,t){var n=0,r=t||[];if(o.call(e)==="[object Array]")Array.prototype.push.apply(r,e);else if(typeof e.length=="number")for(var i=e.length;n<i;n++)r.push(e[n]);else for(;e[n];n++)r.push(e[n]);return r}}var w,E;n.documentElement.compareDocumentPosition?w=function(e,t){return e===t?(u=!0,0):!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition?-1:1:e.compareDocumentPosition(t)&4?-1:1}:(w=function(e,t){if(e===t)return u=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,a=t.parentNode,f=o;if(o===a)return E(e,t);if(!o)return-1;if(!a)return 1
;while(f)i.unshift(f),f=f.parentNode;f=a;while(f)s.unshift(f),f=f.parentNode;n=i.length,r=s.length;for(var l=0;l<n&&l<r;l++)if(i[l]!==s[l])return E(i[l],s[l]);return l===n?E(e,s[l],-1):E(i[l],t,1)},E=function(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}),function(){var e=n.createElement("div"),r="script"+(new Date).getTime(),i=n.documentElement;e.innerHTML="<a name='"+r+"'/>",i.insertBefore(e,i.firstChild),n.getElementById(r)&&(d.find.ID=function(e,n,r){if(typeof n.getElementById!="undefined"&&!r){var i=n.getElementById(e[1]);return i?i.id===e[1]||typeof i.getAttributeNode!="undefined"&&i.getAttributeNode("id").nodeValue===e[1]?[i]:t:[]}},d.filter.ID=function(e,t){var n=typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id");return e.nodeType===1&&n&&n.nodeValue===t}),i.removeChild(e),i=e=null}(),function(){var e=n.createElement("div");e.appendChild(n.createComment("")),e.getElementsByTagName("*").length>0&&(d.find.TAG=function(e,t){var n=t.getElementsByTagName(e[1]);if(e[1]==="*"){var r=[];for(var i=0;n[i];i++)n[i].nodeType===1&&r.push(n[i]);n=r}return n}),e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!="undefined"&&e.firstChild.getAttribute("href")!=="#"&&(d.attrHandle.href=function(e){return e.getAttribute("href",2)}),e=null}(),n.querySelectorAll&&function(){var e=h,t=n.createElement("div"),r="__sizzle__";t.innerHTML="<p class='TEST'></p>";if(t.querySelectorAll&&t.querySelectorAll(".TEST").length===0)return;h=function(t,i,s,o){i=i||n;if(!o&&!h.isXML(i)){var u=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/
.exec(t);if(u&&(i.nodeType===1||i.nodeType===9)){if(u[1])return y(i.getElementsByTagName(t),s);if(u[2]&&d.find.CLASS&&i.getElementsByClassName)return y(i.getElementsByClassName(u[2]),s)}if(i.nodeType===9){if(t==="body"&&i.body)return y([i.body],s);if(u&&u[3]){var a=i.getElementById(u[3]);if(!a||!a.parentNode)return y([],s);if(a.id===u[3])return y([a],s)}try{return y(i.querySelectorAll(t),s)}catch(f){}}else if(i.nodeType===1&&i.nodeName.toLowerCase()!=="object"){var l=i,c=i.getAttribute("id"),p=c||r,v=i.parentNode,m=/^\s*[+~]/.test(t);c?p=p.replace(/'/g,"\\$&"):i.setAttribute("id",p),m&&v&&(i=i.parentNode);try{if(!m||v)return y(i.querySelectorAll("[id='"+p+"'] "+t),s)}catch(g){}finally{c||l.removeAttribute("id")}}}return e(t,i,s,o)};for(var i in e)h[i]=e[i];t=null}(),function(){var e=n.documentElement,t=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(t){var r=!t.call(n.createElement("div"),"div"),i=!1;try{t.call(n.documentElement,"[test!='']:sizzle")}catch(s){i=!0}h.matchesSelector=function(e,n){n=n.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!h.isXML(e))try{if(i||!d.match.PSEUDO.test(n)&&!/!=/.test(n)){var s=t.call(e,n);if(s||!r||e.document&&e.document.nodeType!==11)return s}}catch(o){}return h(n,null,null,[e]).length>0}}}(),function(){var e=n.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;d.order.splice(1,0,"CLASS"),d.find.CLASS=function(e,t,
n){if(typeof t.getElementsByClassName!="undefined"&&!n)return t.getElementsByClassName(e[1])},e=null}(),n.documentElement.contains?h.contains=function(e,t){return e!==t&&(e.contains?e.contains(t):!0)}:n.documentElement.compareDocumentPosition?h.contains=function(e,t){return!!(e.compareDocumentPosition(t)&16)}:h.contains=function(){return!1},h.isXML=function(e){var t=(e?e.ownerDocument||e:0).documentElement;return t?t.nodeName!=="HTML":!1};var T=function(e,t,n){var r,i=[],s="",o=t.nodeType?[t]:t;while(r=d.match.PSEUDO.exec(e))s+=r[0],e=e.replace(d.match.PSEUDO,"");e=d.relative[e]?e+"*":e;for(var u=0,a=o.length;u<a;u++)h(e,o[u],i,n);return h.filter(s,i)};h.attr=s.attr,h.selectors.attrMap={},s.find=h,s.expr=h.selectors,s.expr[":"]=s.expr.filters,s.unique=h.uniqueSort,s.text=h.getText,s.isXMLDoc=h.isXML,s.contains=h.contains}();var j=/Until$/,F=/^(?:parents|prevUntil|prevAll)/,I=/,/,q=/^.[^:#\[\.,]*$/,R=Array.prototype.slice,U=s.expr.match.globalPOS,z={children:!0,contents:!0,next:!0,prev:!0};s.fn.extend({find:function(e){var t=this,n,r;if(typeof e!="string")return s(e).filter(function(){for(n=0,r=t.length;n<r;n++)if(s.contains(t[n],this))return!0});var i=this.pushStack("","find",e),o,u,a;for(n=0,r=this.length;n<r;n++){o=i.length,s.find(e,this[n],i);if(n>0)for(u=o;u<i.length;u++)for(a=0;a<o;a++)if(i[a]===i[u]){i.splice(u--,1);break}}return i},has:function(e){var t=s(e);return this.filter(function(){for(var e=0,n=t.length;e<n;e++)if(s.contains(this,t[e]))return!0})},not:function(e){return this.pushStack(X(this,e,!1),"not",e)},filter:function(e){return this.pushStack(X(this,e,!0),"filter"
,e)},is:function(e){return!!e&&(typeof e=="string"?U.test(e)?s(e,this.context).index(this[0])>=0:s.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n=[],r,i,o=this[0];if(s.isArray(e)){var u=1;while(o&&o.ownerDocument&&o!==t){for(r=0;r<e.length;r++)s(o).is(e[r])&&n.push({selector:e[r],elem:o,level:u});o=o.parentNode,u++}return n}var a=U.test(e)||typeof e!="string"?s(e,t||this.context):0;for(r=0,i=this.length;r<i;r++){o=this[r];while(o){if(a?a.index(o)>-1:s.find.matchesSelector(o,e)){n.push(o);break}o=o.parentNode;if(!o||!o.ownerDocument||o===t||o.nodeType===11)break}}return n=n.length>1?s.unique(n):n,this.pushStack(n,"closest",e)},index:function(e){return e?typeof e=="string"?s.inArray(this[0],s(e)):s.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?s(e,t):s.makeArray(e&&e.nodeType?[e]:e),r=s.merge(this.get(),n);return this.pushStack(W(n[0])||W(r[0])?r:s.unique(r))},andSelf:function(){return this.add(this.prevObject)}}),s.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return s.dir(e,"parentNode")},parentsUntil:function(e,t,n){return s.dir(e,"parentNode",n)},next:function(e){return s.nth(e,2,"nextSibling")},prev:function(e){return s.nth(e,2,"previousSibling")},nextAll:function(e){return s.dir(e,"nextSibling")},prevAll:function(e){return s.dir(e,"previousSibling")},nextUntil:function(e,t,n){return s.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return s.dir(e,"previousSibling",n)},siblings:function(e){return s.sibling((e
.parentNode||{}).firstChild,e)},children:function(e){return s.sibling(e.firstChild)},contents:function(e){return s.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:s.makeArray(e.childNodes)}},function(e,t){s.fn[e]=function(n,r){var i=s.map(this,t,n);return j.test(e)||(r=n),r&&typeof r=="string"&&(i=s.filter(r,i)),i=this.length>1&&!z[e]?s.unique(i):i,(this.length>1||I.test(r))&&F.test(e)&&(i=i.reverse()),this.pushStack(i,e,R.call(arguments).join(","))}}),s.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?s.find.matchesSelector(t[0],e)?[t[0]]:[]:s.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&o.nodeType!==9&&(r===t||o.nodeType!==1||!s(o).is(r)))o.nodeType===1&&i.push(o),o=o[n];return i},nth:function(e,t,n,r){t=t||1;var i=0;for(;e;e=e[n])if(e.nodeType===1&&++i===t)break;return e},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var $="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",J=/ jQuery\d+="(?:\d+|null)"/g,K=/^\s+/,Q=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,G=/<([\w:]+)/,Y=/<tbody/i,Z=/<|&#?\w+;/,et=/<(?:script|style)/i,tt=/<(?:script|object|embed|option|style)/i,nt=new RegExp("<(?:"+$+")[\\s/>]","i"),rt=/checked\s*(?:[^=]|=\s*.checked.)/i,it=/\/(java|ecma)script/i,st=/^\s*<!(?:\[CDATA\[|\-\-)/,ot={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,"",""]},ut=V(n);ot.optgroup=ot.option,ot.tbody=ot.tfoot=ot.colgroup=ot.caption=ot.thead,ot.th=ot.td,s.support.htmlSerialize||(ot._default=[1,"div<div>","</div>"]),s.fn.extend({text:function(e){return s.access(this,function(e){return e===t?s.text(this):this.empty().append((this[0]&&this[0].ownerDocument||n).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(s.isFunction(e))return this.each(function(t){s(this).wrapAll(e.call(this,t))});if(this[0]){var t=s(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return s.isFunction(e)?this.each(function(t){s(this).wrapInner(e.call(this,t))}):this.each(function(){var t=s(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=s.isFunction(e);return this.each(function(n){s(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){s.nodeName(this,"body")||s(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){this.nodeType===1&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){this.nodeType===1&&this.insertBefore(e,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(
e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=s.clean(arguments);return e.push.apply(e,this.toArray()),this.pushStack(e,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=this.pushStack(this,"after",arguments);return e.push.apply(e,s.clean(arguments)),e}},remove:function(e,t){for(var n=0,r;(r=this[n])!=null;n++)if(!e||s.filter(e,[r]).length)!t&&r.nodeType===1&&(s.cleanData(r.getElementsByTagName("*")),s.cleanData([r])),r.parentNode&&r.parentNode.removeChild(r);return this},empty:function(){for(var e=0,t;(t=this[e])!=null;e++){t.nodeType===1&&s.cleanData(t.getElementsByTagName("*"));while(t.firstChild)t.removeChild(t.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return s.clone(this,e,t)})},html:function(e){return s.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(J,""):null;if(typeof e=="string"&&!et.test(e)&&(s.support.leadingWhitespace||!K.test(e))&&!ot[(G.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(Q,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(s.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return this[0]&&this[0].parentNode?s.isFunction(e)?this.each(function(t){var n=s(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=s(e).detach()),this.each(function(
){var t=this.nextSibling,n=this.parentNode;s(this).remove(),t?s(t).before(e):s(n).append(e)})):this.length?this.pushStack(s(s.isFunction(e)?e():e),"replaceWith",e):this},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){var i,o,u,a,f=e[0],l=[];if(!s.support.checkClone&&arguments.length===3&&typeof f=="string"&&rt.test(f))return this.each(function(){s(this).domManip(e,n,r,!0)});if(s.isFunction(f))return this.each(function(i){var o=s(this);e[0]=f.call(this,i,n?o.html():t),o.domManip(e,n,r)});if(this[0]){a=f&&f.parentNode,s.support.parentNode&&a&&a.nodeType===11&&a.childNodes.length===this.length?i={fragment:a}:i=s.buildFragment(e,this,l),u=i.fragment,u.childNodes.length===1?o=u=u.firstChild:o=u.firstChild;if(o){n=n&&s.nodeName(o,"tr");for(var c=0,h=this.length,p=h-1;c<h;c++)r.call(n?at(this[c],o):this[c],i.cacheable||h>1&&c<p?s.clone(u,!0,!0):u)}l.length&&s.each(l,function(e,t){t.src?s.ajax({type:"GET",global:!1,url:t.src,async:!1,dataType:"script"}):s.globalEval((t.text||t.textContent||t.innerHTML||"").replace(st,"/*$0*/")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),s.buildFragment=function(e,t,r){var i,o,u,a,f=e[0];return t&&t[0]&&(a=t[0].ownerDocument||t[0]),a.createDocumentFragment||(a=n),e.length===1&&typeof f=="string"&&f.length<512&&a===n&&f.charAt(0)==="<"&&!tt.test(f)&&(s.support.checkClone||!rt.test(f))&&(s.support.html5Clone||!nt.test(f))&&(o=!0,u=s.fragments[f],u&&u!==1&&(i=u)),i||(i=a.createDocumentFragment(),s.clean(e,a,i,r)),o&&(s.fragments[f]=u?i:1),{fragment:i,cacheable:o}},s.fragments={},s.each({appendTo:"append",prependTo:"prepend"
,insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){s.fn[e]=function(n){var r=[],i=s(n),o=this.length===1&&this[0].parentNode;if(o&&o.nodeType===11&&o.childNodes.length===1&&i.length===1)return i[t](this[0]),this;for(var u=0,a=i.length;u<a;u++){var f=(u>0?this.clone(!0):this).get();s(i[u])[t](f),r=r.concat(f)}return this.pushStack(r,e,i.selector)}}),s.extend({clone:function(e,t,n){var r,i,o,u=s.support.html5Clone||s.isXMLDoc(e)||!nt.test("<"+e.nodeName+">")?e.cloneNode(!0):dt(e);if((!s.support.noCloneEvent||!s.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!s.isXMLDoc(e)){lt(e,u),r=ct(e),i=ct(u);for(o=0;r[o];++o)i[o]&&lt(r[o],i[o])}if(t){ft(e,u);if(n){r=ct(e),i=ct(u);for(o=0;r[o];++o)ft(r[o],i[o])}}return r=i=null,u},clean:function(e,t,r,i){var o,u,a,f=[];t=t||n,typeof t.createElement=="undefined"&&(t=t.ownerDocument||t[0]&&t[0].ownerDocument||n);for(var l=0,c;(c=e[l])!=null;l++){typeof c=="number"&&(c+="");if(!c)continue;if(typeof c=="string")if(!Z.test(c))c=t.createTextNode(c);else{c=c.replace(Q,"<$1></$2>");var h=(G.exec(c)||["",""])[1].toLowerCase(),p=ot[h]||ot._default,d=p[0],v=t.createElement("div"),m=ut.childNodes,g;t===n?ut.appendChild(v):V(t).appendChild(v),v.innerHTML=p[1]+c+p[2];while(d--)v=v.lastChild;if(!s.support.tbody){var y=Y.test(c),b=h==="table"&&!y?v.firstChild&&v.firstChild.childNodes:p[1]==="<table>"&&!y?v.childNodes:[];for(a=b.length-1;a>=0;--a)s.nodeName(b[a],"tbody")&&!b[a].childNodes.length&&b[a].parentNode.removeChild(b[a])}!s.support.leadingWhitespace&&K.test(c)&&v.insertBefore(t.createTextNode(K.exec(c)[0
]),v.firstChild),c=v.childNodes,v&&(v.parentNode.removeChild(v),m.length>0&&(g=m[m.length-1],g&&g.parentNode&&g.parentNode.removeChild(g)))}var w;if(!s.support.appendChecked)if(c[0]&&typeof (w=c.length)=="number")for(a=0;a<w;a++)pt(c[a]);else pt(c);c.nodeType?f.push(c):f=s.merge(f,c)}if(r){o=function(e){return!e.type||it.test(e.type)};for(l=0;f[l];l++){u=f[l];if(i&&s.nodeName(u,"script")&&(!u.type||it.test(u.type)))i.push(u.parentNode?u.parentNode.removeChild(u):u);else{if(u.nodeType===1){var E=s.grep(u.getElementsByTagName("script"),o);f.splice.apply(f,[l+1,0].concat(E))}r.appendChild(u)}}}return f},cleanData:function(e){var t,n,r=s.cache,i=s.event.special,o=s.support.deleteExpando;for(var u=0,a;(a=e[u])!=null;u++){if(a.nodeName&&s.noData[a.nodeName.toLowerCase()])continue;n=a[s.expando];if(n){t=r[n];if(t&&t.events){for(var f in t.events)i[f]?s.event.remove(a,f):s.removeEvent(a,f,t.handle);t.handle&&(t.handle.elem=null)}o?delete a[s.expando]:a.removeAttribute&&a.removeAttribute(s.expando),delete r[n]}}}});var vt=/alpha\([^)]*\)/i,mt=/opacity=([^)]*)/,gt=/([A-Z]|^ms)/g,yt=/^[\-+]?(?:\d*\.)?\d+$/i,bt=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,wt=/^([\-+])=([\-+.\de]+)/,Et=/^margin/,St={position:"absolute",visibility:"hidden",display:"block"},xt=["Top","Right","Bottom","Left"],Tt,Nt,Ct;s.fn.css=function(e,n){return s.access(this,function(e,n,r){return r!==t?s.style(e,n,r):s.css(e,n)},e,n,arguments.length>1)},s.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Tt(e,"opacity");return n===""?"1":n}return e.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity
:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":s.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var o,u,a=s.camelCase(n),f=e.style,l=s.cssHooks[a];n=s.cssProps[a]||a;if(r===t)return l&&"get"in l&&(o=l.get(e,!1,i))!==t?o:f[n];u=typeof r,u==="string"&&(o=wt.exec(r))&&(r=+(o[1]+1)*+o[2]+parseFloat(s.css(e,n)),u="number");if(r==null||u==="number"&&isNaN(r))return;u==="number"&&!s.cssNumber[a]&&(r+="px");if(!l||!("set"in l)||(r=l.set(e,r))!==t)try{f[n]=r}catch(c){}},css:function(e,n,r){var i,o;n=s.camelCase(n),o=s.cssHooks[n],n=s.cssProps[n]||n,n==="cssFloat"&&(n="float");if(o&&"get"in o&&(i=o.get(e,!0,r))!==t)return i;if(Tt)return Tt(e,n)},swap:function(e,t,n){var r={},i,s;for(s in t)r[s]=e.style[s],e.style[s]=t[s];i=n.call(e);for(s in t)e.style[s]=r[s];return i}}),s.curCSS=s.css,n.defaultView&&n.defaultView.getComputedStyle&&(Nt=function(e,t){var n,r,i,o,u=e.style;return t=t.replace(gt,"-$1").toLowerCase(),(r=e.ownerDocument.defaultView)&&(i=r.getComputedStyle(e,null))&&(n=i.getPropertyValue(t),n===""&&!s.contains(e.ownerDocument.documentElement,e)&&(n=s.style(e,t))),!s.support.pixelMargin&&i&&Et.test(t)&&bt.test(n)&&(o=u.width,u.width=n,n=i.width,u.width=o),n}),n.documentElement.currentStyle&&(Ct=function(e,t){var n,r,i,s=e.currentStyle&&e.currentStyle[t],o=e.style;return s==null&&o&&(i=o[t])&&(s=i),bt.test(s)&&(n=o.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),o.left=t==="fontSize"?"1em":s,s=o.pixelLeft+"px",o.left=n,r&&(e.runtimeStyle.left=r)),s===""?"auto"
:s}),Tt=Nt||Ct,s.each(["height","width"],function(e,t){s.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth!==0?kt(e,t,r):s.swap(e,St,function(){return kt(e,t,r)})},set:function(e,t){return yt.test(t)?t+"px":t}}}),s.support.opacity||(s.cssHooks.opacity={get:function(e,t){return mt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?parseFloat(RegExp.$1)/100+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=s.isNumeric(t)?"alpha(opacity="+t*100+")":"",o=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&s.trim(o.replace(vt,""))===""){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=vt.test(o)?o.replace(vt,i):o+" "+i}}),s(function(){s.support.reliableMarginRight||(s.cssHooks.marginRight={get:function(e,t){return s.swap(e,{display:"inline-block"},function(){return t?Tt(e,"margin-right"):e.style.marginRight})}})}),s.expr&&s.expr.filters&&(s.expr.filters.hidden=function(e){var t=e.offsetWidth,n=e.offsetHeight;return t===0&&n===0||!s.support.reliableHiddenOffsets&&(e.style&&e.style.display||s.css(e,"display"))==="none"},s.expr.filters.visible=function(e){return!s.expr.filters.hidden(e)}),s.each({margin:"",padding:"",border:"Width"},function(e,t){s.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+xt[r]+t]=i[r]||i[r-2]||i[0];return s}}});var Lt={},At,Ot,Mt=/^(?:toggle|show|hide)$/,_t=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,Dt,Pt=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],Ht;s.fn.extend({show:
function(e,t,n){var r,i;if(e||e===0)return this.animate(Ft("show",3),e,t,n);for(var o=0,u=this.length;o<u;o++)r=this[o],r.style&&(i=r.style.display,!s._data(r,"olddisplay")&&i==="none"&&(i=r.style.display=""),(i===""&&s.css(r,"display")==="none"||!s.contains(r.ownerDocument.documentElement,r))&&s._data(r,"olddisplay",It(r.nodeName)));for(o=0;o<u;o++){r=this[o];if(r.style){i=r.style.display;if(i===""||i==="none")r.style.display=s._data(r,"olddisplay")||""}}return this},hide:function(e,t,n){if(e||e===0)return this.animate(Ft("hide",3),e,t,n);var r,i,o=0,u=this.length;for(;o<u;o++)r=this[o],r.style&&(i=s.css(r,"display"),i!=="none"&&!s._data(r,"olddisplay")&&s._data(r,"olddisplay",i));for(o=0;o<u;o++)this[o].style&&(this[o].style.display="none");return this},_toggle:s.fn.toggle,toggle:function(e,t,n){var r=typeof e=="boolean";return s.isFunction(e)&&s.isFunction(t)?this._toggle.apply(this,arguments):e==null||r?this.each(function(){var t=r?e:s(this).is(":hidden");s(this)[t?"show":"hide"]()}):this.animate(Ft("toggle",3),e,t,n),this},fadeTo:function(e,t,n,r){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){function o(){i.queue===!1&&s._mark(this);var t=s.extend({},i),n=this.nodeType===1,r=n&&s(this).is(":hidden"),o,u,a,f,l,c,h,p,d,v,m;t.animatedProperties={};for(a in e){o=s.camelCase(a),a!==o&&(e[o]=e[a],delete e[a]);if((l=s.cssHooks[o])&&"expand"in l){c=l.expand(e[o]),delete e[o];for(a in c)a in e||(e[a]=c[a])}}for(o in e){u=e[o],s.isArray(u)?(t.animatedProperties[o]=u[1],u=e[o]=u[0]):t.animatedProperties[o]=t.specialEasing&&
t.specialEasing[o]||t.easing||"swing";if(u==="hide"&&r||u==="show"&&!r)return t.complete.call(this);n&&(o==="height"||o==="width")&&(t.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],s.css(this,"display")==="inline"&&s.css(this,"float")==="none"&&(!s.support.inlineBlockNeedsLayout||It(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}t.overflow!=null&&(this.style.overflow="hidden");for(a in e)f=new s.fx(this,t,a),u=e[a],Mt.test(u)?(m=s._data(this,"toggle"+a)||(u==="toggle"?r?"show":"hide":0),m?(s._data(this,"toggle"+a,m==="show"?"hide":"show"),f[m]()):f[u]()):(h=_t.exec(u),p=f.cur(),h?(d=parseFloat(h[2]),v=h[3]||(s.cssNumber[a]?"":"px"),v!=="px"&&(s.style(this,a,(d||1)+v),p=(d||1)/f.cur()*p,s.style(this,a,p+v)),h[1]&&(d=(h[1]==="-="?-1:1)*d+p),f.custom(p,d,v)):f.custom(p,u,""));return!0}var i=s.speed(t,n,r);return s.isEmptyObject(e)?this.each(i.complete,[!1]):(e=s.extend({},e),i.queue===!1?this.each(o):this.queue(i.queue,o))},stop:function(e,n,r){return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){function u(e,t,n){var i=t[n];s.removeData(e,n,!0),i.stop(r)}var t,n=!1,i=s.timers,o=s._data(this);r||s._unmark(!0,this);if(e==null)for(t in o)o[t]&&o[t].stop&&t.indexOf(".run")===t.length-4&&u(this,o,t);else o[t=e+".run"]&&o[t].stop&&u(this,o,t);for(t=i.length;t--;)i[t].elem===this&&(e==null||i[t].queue===e)&&(r?i[t](!0):i[t].saveState(),n=!0,i.splice(t,1));(!r||!n)&&s.dequeue(this,e)})}}),s.each({slideDown:Ft("show",1),slideUp:Ft("hide",1),slideToggle:Ft("toggle",1),fadeIn:{opacity:"show"
},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){s.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),s.extend({speed:function(e,t,n){var r=e&&typeof e=="object"?s.extend({},e):{complete:n||!n&&t||s.isFunction(e)&&e,duration:e,easing:n&&t||t&&!s.isFunction(t)&&t};r.duration=s.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in s.fx.speeds?s.fx.speeds[r.duration]:s.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(e){s.isFunction(r.old)&&r.old.call(this),r.queue?s.dequeue(this,r.queue):e!==!1&&s._unmark(this)},r},easing:{linear:function(e){return e},swing:function(e){return-Math.cos(e*Math.PI)/2+.5}},timers:[],fx:function(e,t,n){this.options=t,this.elem=e,this.prop=n,t.orig=t.orig||{}}}),s.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(s.fx.step[this.prop]||s.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]==null||!!this.elem.style&&this.elem.style[this.prop]!=null){var e,t=s.css(this.elem,this.prop);return isNaN(e=parseFloat(t))?!t||t==="auto"?0:t:e}return this.elem[this.prop]},custom:function(e,n,r){function u(e){return i.step(e)}var i=this,o=s.fx;this.startTime=Ht||Bt(),this.end=n,this.now=this.start=e,this.pos=this.state=0,this.unit=r||this.unit||(s.cssNumber[this.prop]?"":"px"),u.queue=this.options.queue,u.elem=this.elem,u.saveState=function(){s._data(i.elem,"fxshow"+i.prop)===t&&(i.options.hide?s._data(i.elem,"fxshow"+i.prop,i.start):i.options.show&&s._data(i.elem,"fxshow"+i.prop,i.end))},u()&&s.timers.push(u)&&!
Dt&&(Dt=setInterval(o.tick,o.interval))},show:function(){var e=s._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=e||s.style(this.elem,this.prop),this.options.show=!0,e!==t?this.custom(this.cur(),e):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),s(this.elem).show()},hide:function(){this.options.orig[this.prop]=s._data(this.elem,"fxshow"+this.prop)||s.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(e){var t,n,r,i=Ht||Bt(),o=!0,u=this.elem,a=this.options;if(e||i>=a.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),a.animatedProperties[this.prop]=!0;for(t in a.animatedProperties)a.animatedProperties[t]!==!0&&(o=!1);if(o){a.overflow!=null&&!s.support.shrinkWrapBlocks&&s.each(["","X","Y"],function(e,t){u.style["overflow"+t]=a.overflow[e]}),a.hide&&s(u).hide();if(a.hide||a.show)for(t in a.animatedProperties)s.style(u,t,a.orig[t]),s.removeData(u,"fxshow"+t,!0),s.removeData(u,"toggle"+t,!0);r=a.complete,r&&(a.complete=!1,r.call(u))}return!1}return a.duration==Infinity?this.now=i:(n=i-this.startTime,this.state=n/a.duration,this.pos=s.easing[a.animatedProperties[this.prop]](this.state,n,0,1,a.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update(),!0}},s.extend(s.fx,{tick:function(){var e,t=s.timers,n=0;for(;n<t.length;n++)e=t[n],!e()&&t[n]===e&&t.splice(n--,1);t.length||s.fx.stop()},interval:13,stop:function(){clearInterval(Dt),Dt=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){s.style(e.elem,"opacity",e.now)},_default:function(e){e.
elem.style&&e.elem.style[e.prop]!=null?e.elem.style[e.prop]=e.now+e.unit:e.elem[e.prop]=e.now}}}),s.each(Pt.concat.apply([],Pt),function(e,t){t.indexOf("margin")&&(s.fx.step[t]=function(e){s.style(e.elem,t,Math.max(0,e.now)+e.unit)})}),s.expr&&s.expr.filters&&(s.expr.filters.animated=function(e){return s.grep(s.timers,function(t){return e===t.elem}).length});var qt,Rt=/^t(?:able|d|h)$/i,Ut=/^(?:body|html)$/i;"getBoundingClientRect"in n.documentElement?qt=function(e,t,n,r){try{r=e.getBoundingClientRect()}catch(i){}if(!r||!s.contains(n,e))return r?{top:r.top,left:r.left}:{top:0,left:0};var o=t.body,u=zt(t),a=n.clientTop||o.clientTop||0,f=n.clientLeft||o.clientLeft||0,l=u.pageYOffset||s.support.boxModel&&n.scrollTop||o.scrollTop,c=u.pageXOffset||s.support.boxModel&&n.scrollLeft||o.scrollLeft,h=r.top+l-a,p=r.left+c-f;return{top:h,left:p}}:qt=function(e,t,n){var r,i=e.offsetParent,o=e,u=t.body,a=t.defaultView,f=a?a.getComputedStyle(e,null):e.currentStyle,l=e.offsetTop,c=e.offsetLeft;while((e=e.parentNode)&&e!==u&&e!==n){if(s.support.fixedPosition&&f.position==="fixed")break;r=a?a.getComputedStyle(e,null):e.currentStyle,l-=e.scrollTop,c-=e.scrollLeft,e===i&&(l+=e.offsetTop,c+=e.offsetLeft,s.support.doesNotAddBorder&&(!s.support.doesAddBorderForTableAndCells||!Rt.test(e.nodeName))&&(l+=parseFloat(r.borderTopWidth)||0,c+=parseFloat(r.borderLeftWidth)||0),o=i,i=e.offsetParent),s.support.subtractsBorderForOverflowNotVisible&&r.overflow!=="visible"&&(l+=parseFloat(r.borderTopWidth)||0,c+=parseFloat(r.borderLeftWidth)||0),f=r}if(f.position==="relative"||f.position==="static")l+=u.offsetTop
,c+=u.offsetLeft;return s.support.fixedPosition&&f.position==="fixed"&&(l+=Math.max(n.scrollTop,u.scrollTop),c+=Math.max(n.scrollLeft,u.scrollLeft)),{top:l,left:c}},s.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){s.offset.setOffset(this,e,t)});var n=this[0],r=n&&n.ownerDocument;return r?n===r.body?s.offset.bodyOffset(n):qt(n,r,r.documentElement):null},s.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return s.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(s.css(e,"marginTop"))||0,n+=parseFloat(s.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=s.css(e,"position");r==="static"&&(e.style.position="relative");var i=s(e),o=i.offset(),u=s.css(e,"top"),a=s.css(e,"left"),f=(r==="absolute"||r==="fixed")&&s.inArray("auto",[u,a])>-1,l={},c={},h,p;f?(c=i.position(),h=c.top,p=c.left):(h=parseFloat(u)||0,p=parseFloat(a)||0),s.isFunction(t)&&(t=t.call(e,n,o)),t.top!=null&&(l.top=t.top-o.top+h),t.left!=null&&(l.left=t.left-o.left+p),"using"in t?t.using.call(e,l):i.css(l)}},s.fn.extend({position:function(){if(!this[0])return null;var e=this[0],t=this.offsetParent(),n=this.offset(),r=Ut.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(s.css(e,"marginTop"))||0,n.left-=parseFloat(s.css(e,"marginLeft"))||0,r.top+=parseFloat(s.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(s.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||n.body;while(e&&!Ut.test(e.nodeName)&&s.css(e,"position")==="static")
e=e.offsetParent;return e})}}),s.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);s.fn[e]=function(i){return s.access(this,function(e,i,o){var u=zt(e);if(o===t)return u?n in u?u[n]:s.support.boxModel&&u.document.documentElement[i]||u.document.body[i]:e[i];u?u.scrollTo(r?s(u).scrollLeft():o,r?o:s(u).scrollTop()):e[i]=o},e,i,arguments.length,null)}}),s.each({Height:"height",Width:"width"},function(e,n){var r="client"+e,i="scroll"+e,o="offset"+e;s.fn["inner"+e]=function(){var e=this[0];return e?e.style?parseFloat(s.css(e,n,"padding")):this[n]():null},s.fn["outer"+e]=function(e){var t=this[0];return t?t.style?parseFloat(s.css(t,n,e?"margin":"border")):this[n]():null},s.fn[n]=function(e){return s.access(this,function(e,n,u){var a,f,l,c;if(s.isWindow(e))return a=e.document,f=a.documentElement[r],s.support.boxModel&&f||a.body&&a.body[r]||f;if(e.nodeType===9)return a=e.documentElement,a[r]>=a[i]?a[r]:Math.max(e.body[i],a[i],e.body[o],a[o]);if(u===t)return l=s.css(e,n),c=parseFloat(l),s.isNumeric(c)?c:l;s(e).css(n,u)},n,e,arguments.length,null)}}),e.jQuery=e.$=s,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return s})})(window),jQuery.Buffer=function(){function t(e){for(var t in e)typeof e[t]=="function"&&(e[t].displayName=t)}var e=function(e){e&&this.assign(e),this._bufferedCommandList=[],this._bufferedCommands={}};return e._buffers=[],e._pool=[],e.bufferForElement=function(e){return e._jquery_buffer?e._jquery_buffer:this.bufferFromPool().assign(e)},e.bufferFromPool=function(){var t=null;return this._pool
.length===0?t=new e:t=this._pool.pop(),e._buffers.push(t),this.flushingScheduled||this.scheduleFlushing(),t},e.returnToPool=function(e){e.unassign(),this._pool.push(e)},e.scheduleFlushing=function(){this.flushingScheduled=!0},e.flush=function(){var e=this._buffers,t,n=e.length;for(t=0;t<n;t++)e[t].flush(),this.returnToPool(e[t]);this._buffers=[],this.flushingScheduled=!1},e.prototype.assign=function(e){return this._el&&this.unassign(),this._el=e,this._el._jquery_buffer=this,this},e.prototype.unassign=function(){if(!this._el)return;return this._el._jquery_buffer=undefined,this._el=undefined,this},e.prototype.flush=function(){var e=this._bufferedCommandList,t=e.length,n,r;for(n=0;n<t;n++)r=e[n],this[r](this._bufferedCommands[r]),delete this._bufferedCommands[r];this._bufferedCommandList.length=0,this.unassign()},e.prototype.$=function(e,t){t||(t=this._el);if(e===""||e===undefined)e=t,t=undefined;return jQuery(e,t)},e.prototype.bufferedCommand=function(e){return this._bufferedCommands[e]||(this._bufferedCommands[e]={},this._bufferedCommandList.push(e)),this._bufferedCommands[e]},e.prototype.hasBufferedCommand=function(e){return!!this._bufferedCommands[e]},e.prototype.html=function(e){var t=this.bufferedCommand("flushContent");if(e===undefined)return t.text||t.html||this.$().html();t.text=undefined,t.html=e},e.prototype.text=function(e){var t=this.bufferedCommand("flushContent");if(e===undefined)return t.text||t.html||this.$().text();t.text=e,t.html=undefined},e.prototype.flushContent=function(e){e.text!==undefined?this.$().text(e.text):e.html!==undefined&&this.$().html(e.html)}
,e.prototype.attr=function(e,t){if(typeof e=="object"){for(var n in e)this.attr(n,e[n]);return}if(e==="class"){if(t===undefined)return this.setClass().join(" ");if(typeof t=="string"||jQuery.isArray(t)){var r=this.bufferedCommand("flushClassNames");r.classNames=this._hashFromClassNames(t);return}return this.setClass(t)}if(e==="html")return this.html(t);if(e==="text")return this.text(t);if(e==="style")return this.resetStyles(t);var i=this.bufferedCommand("flushAttributes");i.attr||(i.attr={}),i.attr[e]=t},e.prototype.flushAttributes=function(e){var t=e.attr,n=this.$(),r;for(var i in t){if(!t.hasOwnProperty(i))continue;r=t[i],r!==null?n.attr(i,r):n.removeAttr(i)}},e.prototype._STYLE_REGEX=/-?\s*([^:\s]+)\s*:\s*([^;]+)\s*;?/g,e.prototype._camelizeStyleName=function(e){var t=e.match(/^-(webkit|moz|o)-/),n=e.camelize();return t?n.substr(0,1).toUpperCase()+n.substr(1):n},e.prototype._dasherizeStyleName=function(e){var t=SC.String.dasherize(e);return t.match(/^(webkit|moz|ms|o)-/)&&(t="-"+t),t},e.prototype._loadStyles=function(e){e||(e=this.$().attr("style"));if(e&&(e=e.toString()).length>0){SC.browser.msie&&(e=e.toLowerCase());var t={},n=this._STYLE_REGEX,r;n.lastIndex=0;while(r=n.exec(e))t[this._camelizeStyleName(r[1])]=r[2];return t}return{}},e.prototype.resetStyles=function(e){var t=this.bufferedCommand("flushStyles");t._styles=this._loadStyles(e||" ")},e.prototype.styles=function(){var e=this.bufferedCommand("flushStyles");return e._styles||(e._styles=this._loadStyles()),e._styles},e.prototype.css=function(e,t){if(typeof e=="object"){for(var n in e)this.css(n,e[n]);return}var r=
this.bufferedCommand("flushStyles");r._styles||(r._styles=this._loadStyles()),r._styles[e]=t},e.prototype.flushStyles=function(e){var t=e._styles,n="",r,i,s=[],o=0;for(r in t){if(!t.hasOwnProperty(r))continue;i=t[r];if(i===null)continue;typeof i=="number"&&r!=="zIndex"&&r!=="fontWeight"&&r!=="opacity"&&(i+="px"),s[o++]=this._dasherizeStyleName(r)+": "+i}this.$().attr("style",s.join("; "))},e.prototype._hashFromClassNames=function(e){typeof e=="string"&&(e=e.split(" "));var t,n=e.length,r={};for(t=0;t<n;t++)r[e[t]]=!0;return r},e.prototype.setClass=function(e,t){var n=this.bufferedCommand("flushClassNames"),r;if(e===undefined){n.classNames||(n.classNames=this._hashFromClassNames(this._el.className));var i=n.classNames,s=[];for(r in i)r&&i[r]&&s.push(r);return s}if(typeof e=="object"){n.classNames||(n.classNames=this._hashFromClassNames(this._el.className));for(r in e)n.classNames[r]=e[r];return}n.classNames||(n.classNames=this._hashFromClassNames(this._el.className)),n.classNames[e]=t||!1},e.prototype.hasClass=function(e){var t=this.bufferedCommand("flushClassNames");return t.classNames||(t.classNames=this._hashFromClassNames(this._el.className)),!!t.classNames[e]},e.prototype.addClass=function(e){if(!e)return;var t=this.bufferedCommand("flushClassNames");t.classNames||(t.classNames=this._hashFromClassNames(this._el.className)),typeof e=="string"&&(e=e.split(" "));var n,r=e.length;for(n=0;n<r;n++)t.classNames[jQuery.trim(e[n])]=!0},e.prototype.removeClass=function(e){var t=this.bufferedCommand("flushClassNames");t.classNames||(t.classNames=this._hashFromClassNames(this._el.className
)),t.classNames[e]=!1},e.prototype.resetClassNames=function(e){var t=this.bufferedCommand("flushClassNames");t.classNames={}},e.prototype.flushClassNames=function(e){var t=[];if(e.classNames){var n=e.classNames,r;for(r in n)n[r]&&t.push(r)}this.$().attr("class",t.join(" "))},t(e),t(e.prototype),e}(),function(){jQuery.buffer=jQuery.bufferedJQuery=jQuery.sub(),jQuery.bufferedJQuery.fn.extend({html:function(e){if(e===undefined)return this.length<1?undefined:jQuery.Buffer.bufferForElement(this[0]).html();var t=this.length,n,r;for(n=0;n<t;n++)r=jQuery.Buffer.bufferForElement(this[n]),r.html(e);return this},text:function(e){if(e===undefined)return this.length<1?undefined:jQuery.Buffer.bufferForElement(this[0]).text();var t=this.length,n,r;for(n=0;n<t;n++)r=jQuery.Buffer.bufferForElement(this[n]),r.text(e);return this},attr:function(e,t){var n;if(typeof t=="undefined"&&typeof e=="string")return this.length<1?!1:(n=jQuery.Buffer.bufferForElement(this[0]),n.attr(e));var r=this.length,i;for(i=0;i<r;i++)n=jQuery.Buffer.bufferForElement(this[i]),n.attr(e,t);return this},hasClass:function(e){return this.length<1?!1:jQuery.Buffer.bufferForElement(this[0]).hasClass(e)},setClass:function(e,t){var n=this.length,r,i;for(r=0;r<n;r++)i=jQuery.Buffer.bufferForElement(this[r]),i.setClass(e,t);return this},addClass:function(e){var t=this.length,n,r;for(n=0;n<t;n++)r=jQuery.Buffer.bufferForElement(this[n]),r.addClass(e);return this},removeClass:function(e){var t=this.length,n,r;for(n=0;n<t;n++)r=jQuery.Buffer.bufferForElement(this[n]),r.removeClass(e);return this},resetClassNames:function(){var e=this
.length,t,n;for(t=0;t<e;t++)n=jQuery.Buffer.bufferForElement(this[t]),n.resetClassNames();return this},css:function(e,t){var n=this.length,r,i;for(r=0;r<n;r++)i=jQuery.Buffer.bufferForElement(this[r]),i.css(e,t);return this},styles:function(){return this.length<1?null:jQuery.Buffer.bufferForElement(this[0]).styles()},resetStyles:function(){return this.length<1?null:(jQuery.Buffer.bufferForElement(this[0]).resetStyles(),this)}})}(),jQuery.Buffer._flush=function(){jQuery.Buffer.flush()},jQuery.Buffer.scheduleFlushing=function(){SC.RunLoop.currentRunLoop.invokeOnce(jQuery.Buffer._flush),this.flushingScheduled=!0},window.require||(window.require=function(){}),window.sc_require||(window.sc_require=require),window.sc_resource||(window.sc_resource=function(){}),window.YES=!0,window.NO=!1,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.6.0",SC._baseMixin=function(e){var t=Array.prototype.slice.call(arguments,1),n,r=t[0]||{},i=1,s=t.length,o,u,a;s===1&&(r=this||{},i=0);for(;i<s;i++){if(!(o=t[i]))continue;for(a in o){if(!o.hasOwnProperty(a))continue;u=o[a];if(r===u)continue;u!==undefined&&(e||r[a]===undefined)&&(r[a]=u)}o.hasOwnProperty("toString")&&(r.toString=o.toString)}return r},SC.mixin=function(){var e=Array.prototype.slice.call(arguments);return e.unshift(!0),SC._baseMixin.apply(this,e)},SC.supplement=function(){var e=Array.prototype.slice.call(arguments);return e.unshift(!1),SC._baseMixin.apply(this,e)},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(e){if(e===undefined)return SC.T_UNDEFINED;if(e===null)return SC.T_NULL;var t=jQuery.type(e);return t==="function"?e.isClass?SC.T_CLASS:SC.T_FUNCTION:t==="object"?SC.Error&&e instanceof SC.Error?SC.T_ERROR:e instanceof SC.Object?SC.T_OBJECT:SC.T_HASH:t},none:function(e){return e==null},empty:function(e){return e===null||e===undefined||e===""},isArray:function(e){return!e||e.setInterval?!1:Array.isArray&&Array.isArray(e)?!0:e.objectAt?!0:e.length!==undefined&&jQuery.type(e)==="object"?!0:!1},makeArray:function(e){return SC.isArray(e)?e:SC.A(e)},A:function(e){if(e===null||e===undefined)return[];if(e.slice instanceof Function)return typeof e=="string"?[e]:e.slice();if(e.toArray)return e.toArray();if(!SC.isArray(e))return[e];var t=[],n=e.length;while(--n>=0)t[n]=e[n];return t},guidKey:"SproutCore"+(SC.VERSION+Math.random()).replace(/\D/g,""),_guidPrefixes:{number:"nu",string:"st"},_guidCaches:{number:{},string:{}},_numberGuids:[],_stringGuids:{},_keyCache:{},guidFor:function(e){var t,n,r=typeof e;if(e===null)return"(null)";if(r===SC.T_STRING||r===SC.T_NUMBER)return t=this._guidCaches[r],n=t[e],n||(n="st"+jQuery.uuid++,t[e]=n),n;if(e===undefined)return"(undefined)";if(r===SC.T_BOOL)return e?"(true)":"(false)";var i=this.guidKey,s=e[i];return s?s:e===Object?"(Object)":e===Array?"(Array)":SC.generateGuid(e,"sc")},keyFor:function(e,t){var n
,r=this._keyCache[e];return r||(r=this._keyCache[e]={}),n=r[t],n||(n=r[t]=e+"_"+t),n},generateGuid:function(e,t){var n=t+jQuery.uuid++;return e&&(e[this.guidKey]=n),n},hashFor:function(){var e=arguments.length,t="",n,r,i;for(i=0;i<e;++i)n=arguments[i],t+=n&&(r=n.hash)&&typeof r===SC.T_FUNCTION?r.call(n):this.guidFor(n);return t===""?null:t},isEqual:function(e,t){return this.hashFor(e)===this.hashFor(t)},compare:function(e,t){if(e===t)return 0;var n=SC.typeOf(e),r=SC.typeOf(t),i=SC.ORDER_DEFINITION_MAPPING;if(!i){var s=SC.ORDER_DEFINITION;i=SC.ORDER_DEFINITION_MAPPING={};var o,u;for(o=0,u=s.length;o<u;++o)i[s[o]]=o;delete SC.ORDER_DEFINITION}var a=i[n],f=i[r];if(a<f)return-1;if(a>f)return 1;switch(n){case SC.T_BOOL:case SC.T_NUMBER:if(e<t)return-1;if(e>t)return 1;return 0;case SC.T_STRING:var l=e.localeCompare(t);if(l<0)return-1;if(l>0)return 1;return 0;case SC.T_ARRAY:var c=e.length,h=t.length,p=Math.min(c,h),d=0,v=0,m=arguments.callee;while(d===0&&v<p)d=m(e[v],t[v]),v++;if(d!==0)return d;if(c<h)return-1;if(c>h)return 1;return 0;case SC.T_OBJECT:if(e.constructor.isComparable===YES)return e.constructor.compare(e,t);return 0;default:return 0}},K:function(){return this},EMPTY_ARRAY:[],EMPTY_HASH:{},EMPTY_RANGE:{start:0,length:0},beget:function(e){if(e===null||e===undefined)return null;var t=SC.K;t.prototype=e;var n=new t;return t.prototype=null,typeof e.didBeget=="function"&&(n=e.didBeget(n)),n[this.guidKey]=null,n},copy:function(e,t){var n=e,r;if(e){if(e.isCopyable)return e.copy(t);if(e.clone)return e.clone()}switch(jQuery.type(e)){case"array":n=e.slice();if(t){r=n.length;while(
r--)n[r]=SC.copy(n[r],!0)}break;case"object":n={};for(var i in e)n[i]=t?SC.copy(e[i],!0):e[i]}return n},merge:function(){var e={},t=arguments.length,n;for(n=0;n<t;n++)SC.mixin(e,arguments[n]);return e},keys:function(e){var t=[];for(var n in e)t.push(n);return t},inspect:function(e){var t,n=[];for(var r in e){t=e[r];if(t==="toString")continue;SC.typeOf(t)===SC.T_FUNCTION&&(t="function() { ... }"),n.push(r+": "+t)}return"{"+n.join(" , ")+"}"},tupleForPropertyPath:function(e,t){if(typeof e=="object"&&e instanceof Array)return e;var n,r=e.indexOf("*");r<0&&(r=e.lastIndexOf(".")),n=r>=0?e.slice(r+1):e;var i=this.objectForPropertyPath(e,t,r);return i&&n?[i,n]:null},objectForPropertyPath:function(e,t,n){var r,i,s,o;t||(t=window);if(typeof e=="string"){n===undefined&&(n=e.length),r=0;while(t&&r<n){i=e.indexOf(".",r);if(i<0||i>n)i=n;s=e.slice(r,i),t=t.get?t.get(s):t[s],r=i+1}r<n&&(t=undefined)}else{r=0,o=e.length,s=null;while(r<o&&t)s=e[r++],s&&(t=t.get?t.get(s):t[s]);r<o&&(t=undefined)}return t},requiredObjectForPropertyPath:function(e,t,n){var r=SC.objectForPropertyPath(e,t,n);if(!r)throw e+" could not be found";return r}}),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(e,t){e.dependentKeys=SC.$A(t);var n=SC.guidFor(e);return e.cacheKey="__cache__"+n,e.lastSetValueKey="__lastValue__"+n,e.isProperty=!0,e},cacheable:function(e,t){return e.isProperty=!0,e.dependentKeys||(e.dependentKeys=[]),e.isCacheable=t===undefined?!0
:t,e},idempotent:function(e,t){return e.isProperty=!0,e.dependentKeys||(this.dependentKeys=[]),e.isVolatile=t===undefined?!0:t,e},enhance:function(e){return e.isEnhancement=!0,e},observes:function(e,t){var n=t.length,r=null,i=null;while(--n>=0){var s=t[n];s.indexOf(".")<0&&s.indexOf("*")<0?(r||(r=e.localPropertyPaths=[]),r.push(s)):(i||(i=e.propertyPaths=[]),i.push(s))}return e}},SC.mixin(Function.prototype,{property:function(){return SC.Function.property(this,arguments)},cacheable:function(e){return SC.Function.cacheable(this,e)},idempotent:function(e){return SC.Function.idempotent(this,e)},enhance:function(){return SC.Function.enhance(this)},observes:function(e){return SC.Function.observes(this,arguments)}}),SC.ObserverSet={add:function(e,t,n){var r=SC.guidFor(e),i=SC.guidFor(t),s=this._members,o=this.members,u=s[r],a,f;u||(u=s[r]={}),a=u[i],a===undefined&&(u[i]=o.length,f=[e,t,n],o.push(f))},remove:function(e,t){var n=SC.guidFor(e),r=SC.guidFor(t),i=this._members[n],s=this.members;if(!i)return!1;var o=i[r];if(o===undefined)return!1;if(o!==s.length-1){var u=s[o]=s[s.length-1];this._members[SC.guidFor(u[0])][SC.guidFor(u[1])]=o}return s.pop(),delete this._members[n][r],!0},invokeMethods:function(){var e=this.members,t;for(var n=0,r=e.length;n<r;n++)t=e[n],t[1].call(t[0])},clone:function(){var e=SC.ObserverSet.create(),t=this.members;e._members=SC.clone(this._members);var n=e.members;for(var r=0,i=t.length;r<i;r++)n[r]=SC.clone(t[r]),n[r].length=3;return e},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(e,t){this.property=e,this.root=t||this},SC._ChainObserver.createChain=function(e,t,n,r,i){var s=t.split("."),o=new SC._ChainObserver(s[0]),u=o;for(var a=1,f=s.length;a<f;a++)u=u.next=new SC._ChainObserver(s[a],o);var l=o.tails=[u];return o.objectDidChange(e),l.forEach(function(e){e.target=n,e.method=r,e.context=i}),o.tails=null,o},SC._ChainObserver.prototype={isChainObserver:!0,object:null,property:null,next:null,root:null,target:null,method:null,tail:function(){if(this._tail)return this._tail;var e=this;while(e.next)e=e.next;return this._tail=e,e},objectDidChange:function(e){if(e===this.object)return;this.object&&(this.property==="@each"&&this.object._removeContentObserver?this.object._removeContentObserver(this):this.object.removeObserver&&this.object.removeObserver(this.property,this,this.propertyDidChange)),this.object=e,this.property==="@each"&&this.next?this.object&&this.object._addContentObserver&&this.object._addContentObserver(this):(this.object&&this.object.addObserver&&this.object.addObserver(this.property,this,this.propertyDidChange),this.propertyDidChange())},propertyDidChange:function(){var e=this.object,t=this.property,n=e&&e.get?e.get(t):null;this.next&&this.next.objectDidChange(n);var r=this.target,i=this.method,s=this.context;if(r&&i){var o=e?e.propertyRevision:null;s?i.call(r,e,t,n,s,o):i.call(r,e,t,n,o)}},destroyChain:function(){var e=this.object;return e&&
e.removeObserver&&e.removeObserver(this.property,this,this.propertyDidChange),this.next&&this.next.destroyChain(),this.next=this.target=this.method=this.object=this.context=null,null}},SC.LOG_OBSERVERS=NO,SC.OBSERVES_HANDLER_ADD=0,SC.OBSERVES_HANDLER_REMOVE=1,SC.Observable={isObservable:YES,automaticallyNotifiesObserversFor:function(e){return YES},get:function(e){var t=this[e],n;return t===undefined?this.unknownProperty(e):t&&t.isProperty?t.isCacheable?(n=this._kvo_cache,n||(n=this._kvo_cache={}),n[t.cacheKey]!==undefined?n[t.cacheKey]:n[t.cacheKey]=t.call(this,e)):t.call(this,e):t},set:function(e,t){var n=this[e],r=this.automaticallyNotifiesObserversFor(e),i=t,s,o,u,a;if(t===undefined&&SC.typeOf(e)===SC.T_HASH){var f=e;for(e in f){if(!f.hasOwnProperty(e))continue;this.set(e,f[e])}return this}if(!r&&this._kvo_cacheable&&(o=this._kvo_cache)){s=this._kvo_cachedep;if(!s||(s=s[e])===undefined)s=this._kvo_computeCachedDependentsFor(e);if(s){u=s.length;while(--u>=0)a=s[u],o[a.cacheKey]=o[a.lastSetValueKey]=undefined}}if(n&&n.isProperty){o=this._kvo_cache;if(n.isVolatile||!o||o[n.lastSetValueKey]!==t)o||(o=this._kvo_cache={}),o[n.lastSetValueKey]=t,r&&this.propertyWillChange(e,i),i=n.call(this,e,t),n.isCacheable&&(o[n.cacheKey]=i),r&&this.propertyDidChange(e,i,YES)}else n===undefined?(r&&this.propertyWillChange(e,i),this.unknownProperty(e,t),r&&this.propertyDidChange(e,i)):this[e]!==t&&(r&&this.propertyWillChange(e,i),i=this[e]=t,r&&this.propertyDidChange(e,i));return this},unknownProperty:function(e,t){return t!==undefined&&(this[e]=t),t},beginPropertyChanges:function(){return this
._kvo_changeLevel=(this._kvo_changeLevel||0)+1,this},endPropertyChanges:function(){this._kvo_changeLevel=(this._kvo_changeLevel||1)-1;var e=this._kvo_changeLevel,t=this._kvo_changes;return e<=0&&t&&t.length>0&&!SC.Observers.isObservingSuspended&&this._notifyPropertyObservers(),this},propertyWillChange:function(e,t){return this},propertyDidChange:function(e,t,n){this._kvo_revision=(this._kvo_revision||0)+1;var r=this._kvo_changeLevel||0,i,s,o,u,a=SC.LOG_OBSERVERS&&this.LOG_OBSERVING!==NO,f=this._kvo_property_chains;if(f){var l=f[e];l&&(this.beginPropertyChanges(),l=SC.clone(l),l.forEach(function(e){e.notifyPropertyDidChange()}),this.endPropertyChanges())}var c=this._kvo_cache;if(c){n||(u=this[e],u&&u.isProperty&&(c[u.cacheKey]=c[u.lastSetValueKey]=undefined));if(this._kvo_cacheable){i=this._kvo_cachedep;if(!i||(i=i[e])===undefined)i=this._kvo_computeCachedDependentsFor(e);if(i){s=i.length;while(--s>=0)o=i[s],c[o.cacheKey]=c[o.lastSetValueKey]=undefined}}}var h=SC.Observers.isObservingSuspended;if(r>0||h){var p=this._kvo_changes;p||(p=this._kvo_changes=SC.CoreSet.create()),p.add(e),h&&(a&&SC.Logger.log("%@%@: will not notify observers because observing is suspended".fmt(SC.KVO_SPACES,this)),SC.Observers.objectHasPendingChanges(this))}else this._notifyPropertyObservers(e);return this},registerDependentKey:function(e,t){var n=this._kvo_dependents,r=this._kvo_chain_dependents,i=this[e],s,o,u,a,f;typeof t=="object"&&t instanceof Array?(s=t,u=0):(s=arguments,u=1),o=s.length,n||(this._kvo_dependents=n={});while(--o>=u)a=s[o],a.indexOf(".")>=0?SC._PropertyChain.createChain(a,this,e).
activate():(f=n[a],f||(f=n[a]=[]),f.push(e))},registerDependentKeyWithChain:function(e,t){var n=this._chainsFor(e),r;n.add(t)},removeDependentKeyWithChain:function(e,t){var n=this._chainsFor(e),r;n.remove(t),n.get("length")===0&&delete this._kvo_property_chains[e]},_chainsFor:function(e){this._kvo_property_chains=this._kvo_property_chains||{};var t=this._kvo_property_chains[e]||SC.CoreSet.create();return this._kvo_property_chains[e]=t,t},_kvo_addCachedDependents:function(e,t,n){var r=t.length,i,s,o;while(--r>=0)s=t[r],i=this[s],i&&i instanceof Function&&i.isProperty&&(i.isCacheable&&e.push(i),(o=n[s])&&o.length>0&&this._kvo_addCachedDependents(e,o,n))},_kvo_computeCachedDependentsFor:function(e){var t=this._kvo_cachedep,n=this._kvo_dependents,r=n?n[e]:null,i;return t||(t=this._kvo_cachedep={}),!r||r.length===0?t[e]=null:(i=t[e]=[],this._kvo_addCachedDependents(i,r,n),i.length===0&&(i=t[e]=null),i)},_kvo_for:function(e,t){var n=this[e];return this._kvo_cloned||(this._kvo_cloned={}),n?this._kvo_cloned[e]||(n=this[e]=n.copy(),this._kvo_cloned[e]=YES):(n=this[e]=t===undefined?[]:t.create(),this._kvo_cloned[e]=YES),n},addObserver:function(e,t,n,r){var i,s,o,u;n===undefined&&(n=t,t=this),t||(t=this),typeof n=="string"&&(n=t[n]);if(!n)throw"You must pass a method to addObserver()";return e=e.toString(),e.indexOf(".")>=0?(s=SC._ChainObserver.createChain(this,e,t,n,r),s.masterTarget=t,s.masterMethod=n,this._kvo_for(SC.keyFor("_kvo_chains",e)).push(s)):(this[e]===undefined&&e.indexOf("@")===0&&this.get(e),t===this&&(t=null),i=SC.keyFor("_kvo_observers",e),this._kvo_for(i,SC.ObserverSet
).add(t,n,r),this._kvo_for("_kvo_observed_keys",SC.CoreSet).add(e)),this.didAddObserver&&this.didAddObserver(e,t,n),this},removeObserver:function(e,t,n){var r,i,s,o,u;n===undefined&&(n=t,t=this),t||(t=this),typeof n=="string"&&(n=t[n]);if(!n)throw"You must pass a method to removeObserver()";e=e.toString();if(e.indexOf(".")>=0){r=SC.keyFor("_kvo_chains",e);if(i=this[r]){i=this._kvo_for(r),u=i.length;while(--u>=0)s=i[u],s&&s.masterTarget===t&&s.masterMethod===n&&(i[u]=s.destroyChain())}}else{t===this&&(t=null),r=SC.keyFor("_kvo_observers",e);if(o=this[r])o=this._kvo_for(r),o.remove(t,n),o.getMembers().length===0&&this._kvo_for("_kvo_observed_keys",SC.CoreSet).remove(e)}return this.didRemoveObserver&&this.didRemoveObserver(e,t,n),this},hasObserverFor:function(e){SC.Observers.flush(this);var t=this[SC.keyFor("_kvo_observers",e)],n=this[SC.keyFor("_kvo_local",e)],r;return n&&n.length>0?YES:t&&t.getMembers().length>0?YES:NO},initObservable:function(){if(this._observableInited)return;this._observableInited=YES;var e,t,n,r,i,s,o,u,a,f,l,c,h,p;if(t=this._observers){u=t.length;for(e=0;e<u;e++){n=t[e],i=this[n],s=i.propertyPaths,o=s?s.length:0;for(a=0;a<o;a++)f=s[a],this.addObservesHandler(i,f)}}this.bindings=[];if(t=this._bindings)for(e=0,p=t.length;e<p;e++)n=t[e],r=this[n],h=n.slice(0,-7),this[n]=this.bind(h,r);if(t=this._properties)for(e=0,p=t.length;e<p;e++){n=t[e];if(r=this[n])r.isCacheable&&(this._kvo_cacheable=YES),r.dependentKeys&&r.dependentKeys.length>0&&this.registerDependentKey(n,r.dependentKeys)}},addObservesHandler:function(e,t){return this._configureObservesHandler(SC.OBSERVES_HANDLER_ADD
,e,t),this},removeObservesHandler:function(e,t){return this._configureObservesHandler(SC.OBSERVES_HANDLER_REMOVE,e,t),this},_configureObservesHandler:function(e,t,n){var r,i;switch(e){case SC.OBSERVES_HANDLER_ADD:e="addObserver";break;case SC.OBSERVES_HANDLER_REMOVE:e="removeObserver";break;default:throw"invalid action provided: "+e}r=n.indexOf("."),r<0?this[e](n,this,t):n.indexOf("*")===0?this[e](n.slice(1),this,t):(i=null,r===0?(i=this,n=n.slice(1)):r===4&&n.slice(0,5)==="this."?(i=this,n=n.slice(5)):r<0&&n.length===4&&n==="this"?(i=this,n=""):r>0&&n[0]===n.charAt(0).toLowerCase()&&(i=this),SC.Observers[e](n,this,t,i))},observersForKey:function(e){SC.Observers.flush(this);var t=this[SC.keyFor("_kvo_observers",e)];return t?t.getMembers():[]},_notifyPropertyObservers:function(e){this._observableInited||this.initObservable(),SC.Observers.flush(this);var t=SC.LOG_OBSERVERS&&this.LOG_OBSERVING!==NO,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b;t&&(y=SC.KVO_SPACES=(SC.KVO_SPACES||"")+" ",SC.Logger.log('%@%@: notifying observers after change to key "%@"'.fmt(y,this,e))),s=this["_kvo_observers_*"],this._kvo_changeLevel=(this._kvo_changeLevel||0)+1;while((r=this._kvo_changes)&&r.length>0||e){a=++this.propertyRevision,r||(r=SC.CoreSet.create()),this._kvo_changes=null,e==="*"?(r.add("*"),r.addEach(this._kvo_for("_kvo_observed_keys",SC.CoreSet))):e&&r.add(e);if(i=this._kvo_dependents)for(o=0;o<r.length;o++){e=r[o],u=i[e];if(u&&(v=u.length)){t&&SC.Logger.log("%@...including dependent keys for %@: %@".fmt(y,e,u)),b=this._kvo_cache,b||(b=this._kvo_cache={});while(--v>=0){r.add(e=u[v]);if(m=this[e
])this[m.cacheKey]=undefined,b[m.cacheKey]=b[m.lastSetValueKey]=undefined}}}while(r.length>0){e=r.pop(),n=this[SC.keyFor("_kvo_observers",e)];if(n){f=SC.clone(n.getMembers()),l=f.length;for(h=0;h<l;h++){c=f[h];if(c[3]===a)continue;c[1]||SC.Logger.log(c),p=c[0]||this,d=c[1],g=c[2],c[3]=a,t&&SC.Logger.log('%@...firing observer on %@ for key "%@"'.fmt(y,p,e)),g!==undefined?d.call(p,this,e,null,g,a):d.call(p,this,e,null,a)}}f=this[SC.keyFor("_kvo_local",e)];if(f){l=f.length;for(h=0;h<l;h++)c=f[h],d=this[c],d&&(t&&SC.Logger.log('%@...firing local observer %@.%@ for key "%@"'.fmt(y,this,c,e)),d.call(this,this,e,null,a))}if(s&&e!=="*"){f=SC.clone(s.getMembers()),l=f.length;for(h=0;h<l;h++)c=f[h],p=c[0]||this,d=c[1],g=c[2],t&&SC.Logger.log('%@...firing * observer on %@ for key "%@"'.fmt(y,p,e)),g!==undefined?d.call(p,this,e,null,g,a):d.call(p,this,e,null,a)}this.propertyObserver&&(t&&SC.Logger.log('%@...firing %@.propertyObserver for key "%@"'.fmt(y,this,e)),this.propertyObserver(this,e,null,a))}r&&r.destroy(),e=null}return this._kvo_changeLevel=(this._kvo_changeLevel||1)-1,t&&(SC.KVO_SPACES=y.slice(0,-2)),YES},bind:function(e,t,n){var r,i;return n!==undefined&&(t=[t,n]),i=typeof t,i==="string"||i==="object"&&t instanceof Array?(r=this[e+"BindingDefault"]||SC.Binding,r=r.beget().from(t)):r=t.beget(),r=r.to(e,this).connect(),this.bindings.push(r),r},didChangeFor:function(e){var t,n,r,i,s,o,u,a,f;e=SC.hashFor(e),t=this._kvo_didChange_valueCache,t||(t=this._kvo_didChange_valueCache={}),n=this._kvo_didChange_revisionCache,n||(n=this._kvo_didChange_revisionCache={}),r=t[e]||{},i=n[e]||{}
,s=!1,o=this._kvo_revision||0,u=arguments.length;while(--u>=1)a=arguments[u],i[a]!=o&&(f=this.get(a),r[a]!==f&&(s=!0,r[a]=f)),i[a]=o;return t[e]=r,n[e]=i,s},setIfChanged:function(e,t){if(t===undefined&&SC.typeOf(e)===SC.T_HASH){var n=e;for(e in n){if(!n.hasOwnProperty(e))continue;this.setIfChanged(e,n[e])}return this}return this.get(e)!==t?this.set(e,t):this},getPath:function(e){var t=SC.tupleForPropertyPath(e,this);return t===null||t[0]===null?undefined:SC.get(t[0],t[1])},setPath:function(e,t){if(e.indexOf(".")>=0){var n=SC.tupleForPropertyPath(e,this);if(!n||!n[0])return null;n[0].set(n[1],t)}else this.set(e,t);return this},setPathIfChanged:function(e,t){if(e.indexOf(".")>=0){var n=SC.tupleForPropertyPath(e,this);if(!n||!n[0])return null;n[0].get(n[1])!==t&&n[0].set(n[1],t)}else this.setIfChanged(e,t);return this},getEach:function(){var e=SC.A(arguments),t=[],n,r;for(n=0,r=e.length;n<r;n++)t[t.length]=this.getPath(e[n]);return t},incrementProperty:function(e,t){return t||(t=1),this.set(e,(this.get(e)||0)+t),this.get(e)},decrementProperty:function(e,t){return t||(t=1),this.set(e,(this.get(e)||0)-t),this.get(e)},toggleProperty:function(e,t,n){return t===undefined&&(t=!0),n===undefined&&(n=!1),t=this.get(e)==t?n:t,this.set(e,t),this.get(e)},notifyPropertyChange:function(e,t){return this.propertyWillChange(e,t),this.propertyDidChange(e,t),this},allPropertiesDidChange:function(){return this._kvo_cache=null,this._notifyPropertyObservers("*"),this},addProbe:function(e){this.addObserver(e,SC.logChange)},removeProbe:function(e){this.removeObserver(e,SC.logChange)},logProperty:function(
){var e=SC.$A(arguments),t,n,r;for(r=0,n=e.length;r<n;r++)t=e[r],SC.Logger.log("%@:%@: ".fmt(SC.guidFor(this),t),this.get(t))},propertyRevision:1},SC.logChange=function(t,n,r){SC.Logger.log("CHANGE: %@[%@] => %@".fmt(t,n,t.get(n)))},SC.mixin(SC,{get:function(e,t){return e?t===undefined?this[e]:e.get?e.get(t):e[t]:undefined},getPath:function(e,t){return t===undefined&&(t=e,e=window),SC.objectForPropertyPath(t,e)}}),SC.mixin(Array.prototype,SC.Observable),SC.Enumerator=function(e){return this.enumerable=e,this.reset(),this},SC.Enumerator.prototype={nextObject:function(){var e=this._index,t=this._length;if(e>=t)return undefined;var n=this.enumerable.nextObject(e,this._previousObject,this._context);return this._previousObject=n,this._index=e+1,e>=t&&(this._context=SC.Enumerator._pushContext(this._context)),n},reset:function(){var e=this.enumerable;if(!e)throw SC.$error("Enumerator has been destroyed");this._length=e.get?e.get("length"):e.length;var t=this._length;this._index=0,this._previousObject=null,this._context=t>0?SC.Enumerator._popContext():null},destroy:function(){this.enumerable=this._length=this._index=this._previousObject=this._context=null}},SC.Enumerator.create=function(e){return new SC.Enumerator(e)},SC.Enumerator._popContext=function(){var e=this._contextCache?this._contextCache.pop():null;return e||{}},SC.Enumerator._pushContext=function(e){this._contextCache=this._contextCache||[];var t=this._contextCache;return t.push(e),null},SC.Enumerable={isEnumerable:YES,nextObject:function(e,t,n){return this.objectAt?this.objectAt(e):this[e]},firstObject:function(){if(this
.get("length")===0)return undefined;if(this.objectAt)return this.objectAt(0);var e=SC.Enumerator._popContext(),t;return t=this.nextObject(0,null,e),e=SC.Enumerator._pushContext(e),t}.property(),lastObject:function(){var e=this.get("length");if(e===0)return undefined;if(this.objectAt)return this.objectAt(e-1)}.property(),enumerator:function(){return SC.Enumerator.create(this)},forEach:function(e,t){if(typeof e!="function")throw new TypeError;var n=this.get?this.get("length"):this.length;t===undefined&&(t=null);var r=null,i=SC.Enumerator._popContext();for(var s=0;s<n;s++){var o=this.nextObject(s,r,i);e.call(t,o,s,this),r=o}return r=null,i=SC.Enumerator._pushContext(i),this},getEach:function(e){return this.map(function(t){return t?t.get?t.get(e):t[e]:null},this)},setEach:function(e,t){return this.forEach(function(n){n&&(n.set?n.set(e,t):n[e]=t)},this),this},map:function(e,t){if(typeof e!="function")throw new TypeError;t===undefined&&(t=null);var n=this.get?this.get("length"):this.length,r=[],i=null,s=SC.Enumerator._popContext(),o,u;for(o=0;o<n;o++)u=this.nextObject(o,i,s),r[o]=e.call(t,u,o,this),i=u;return i=null,s=SC.Enumerator._pushContext(s),r},mapProperty:function(e){return this.map(function(t){return t?t.get?t.get(e):t[e]:null})},filter:function(e,t){if(typeof e!="function")throw new TypeError;var n=this.get?this.get("length"):this.length;t===undefined&&(t=null);var r=[],i=null,s=SC.Enumerator._popContext();for(var o=0;o<n;o++){var u=this.nextObject(o,i,s);e.call(t,u,o,this)&&r.push(u),i=u}return i=null,s=SC.Enumerator._pushContext(s),r},sortProperty:function(e){var t=typeof
e===SC.T_STRING?arguments:e,n=t.length,r;return this instanceof Array?r=this:(r=[],this.forEach(function(e){r.push(e)})),r?r.sort(function(e,r){var i,s,o,u,a=0;for(i=0;a===0&&i<n;i++)s=t[i],o=e?e.get?e.get(s):e[s]:null,u=r?r.get?r.get(s):r[s]:null,a=SC.compare(o,u);return a}):[]},filterProperty:function(e,t){var n=this.get?this.get("length"):this.length,r=[],i=null,s=SC.Enumerator._popContext();for(var o=0;o<n;o++){var u=this.nextObject(o,i,s),a=u?u.get?u.get(e):u[e]:null,f=t===undefined?!!a:SC.isEqual(a,t);f&&r.push(u),i=u}return i=null,s=SC.Enumerator._pushContext(s),r},find:function(e,t){var n=this.get?this.get("length"):this.length;t===undefined&&(t=null);var r=null,i,s=NO,o=null,u=SC.Enumerator._popContext();for(var a=0;a<n&&!s;a++){i=this.nextObject(a,r,u);if(s=e.call(t,i,a,this))o=i;r=i}return i=r=null,u=SC.Enumerator._pushContext(u),o},findProperty:function(e,t){var n=this.get?this.get("length"):this.length,r=NO,i=null,s=null,o,u,a=SC.Enumerator._popContext();for(var f=0;f<n&&!r;f++)o=this.nextObject(f,s,a),u=o?o.get?o.get(e):o[e]:null,r=t===undefined?!!u:SC.isEqual(u,t),r&&(i=o),s=o;return s=o=null,a=SC.Enumerator._pushContext(a),i},every:function(e,t){if(typeof e!="function")throw new TypeError;var n=this.get?this.get("length"):this.length;t===undefined&&(t=null);var r=YES,i=null,s=SC.Enumerator._popContext();for(var o=0;r&&o<n;o++){var u=this.nextObject(o,i,s);e.call(t,u,o,this)||(r=NO),i=u}return i=null,s=SC.Enumerator._pushContext(s),r},everyProperty:function(e,t){var n=this.get?this.get("length"):this.length,r=YES,i=null,s=SC.Enumerator._popContext();for(var o=0
;r&&o<n;o++){var u=this.nextObject(o,i,s),a=u?u.get?u.get(e):u[e]:null;r=t===undefined?!!a:SC.isEqual(a,t),i=u}return i=null,s=SC.Enumerator._pushContext(s),r},some:function(e,t){if(typeof e!="function")throw new TypeError;var n=this.get?this.get("length"):this.length;t===undefined&&(t=null);var r=NO,i=null,s=SC.Enumerator._popContext();for(var o=0;!r&&o<n;o++){var u=this.nextObject(o,i,s);e.call(t,u,o,this)&&(r=YES),i=u}return i=null,s=SC.Enumerator._pushContext(s),r},someProperty:function(e,t){var n=this.get?this.get("length"):this.length,r=NO,i=null,s=SC.Enumerator._popContext();for(var o=0;!r&&o<n;o++){var u=this.nextObject(o,i,s),a=u?u.get?u.get(e):u[e]:null;r=t===undefined?!!a:SC.isEqual(a,t),i=u}return i=null,s=SC.Enumerator._pushContext(s),r},reduce:function(e,t,n){if(typeof e!="function")throw new TypeError;var r=this.get?this.get("length"):this.length;if(r===0&&t===undefined)throw new TypeError;var i=t,s=null,o=SC.Enumerator._popContext();for(var u=0;u<r;u++){var a=this.nextObject(u,s,o);a!==null&&(i===undefined?i=a:i=e.call(null,i,a,u,this,n)),s=a}s=null,o=SC.Enumerator._pushContext(o);if(i===undefined)throw new TypeError;return i},invoke:function(e){var t=this.get?this.get("length"):this.length;if(t<=0)return[];var n,r=[],i=arguments.length;if(i>1)for(n=1;n<i;n++)r.push(arguments[n]);var s=[],o=null,u=SC.Enumerator._popContext();for(n=0;n<t;n++){var a=this.nextObject(n,o,u),f=a?a[e]:null;f&&(s[n]=f.apply(a,r)),o=a}return o=null,u=SC.Enumerator._pushContext(u),s},invokeWhile:function(e,t){var n=this.get?this.get("length"):this.length;if(n<=0)return null;var r,i=[]
,s=arguments.length;if(s>2)for(r=2;r<s;r++)i.push(arguments[r]);var o=e,u=null,a=SC.Enumerator._popContext();for(r=0;o===e&&r<n;r++){var f=this.nextObject(r,u,a),l=f?f[t]:null;l&&(o=l.apply(f,i)),u=f}return u=null,a=SC.Enumerator._pushContext(a),o},toArray:function(){var e=[];return this.forEach(function(t){e.push(t)},this),e},groupBy:function(e){var t=this.get?this.get("length"):this.length,n=[],r=null,i=SC.Enumerator._popContext(),s=[],o=[],u,a,f;for(u=0;u<t;u++)a=this.nextObject(u,r,i),f=a?a.get?a.get(e):a[e]:null,SC.none(s[f])&&(s[f]=[],o.push(f)),s[f].push(a),r=a;r=null,i=SC.Enumerator._pushContext(i);for(u=0,t=o.length;u<t;u++)n.push(s[o[u]]);return n}},SC._buildReducerFor=function(e,t){return function(n,r){var i=this[e];if(SC.typeOf(i)!==SC.T_FUNCTION)return this.unknownProperty?this.unknownProperty(n,r):null;var s=SC.Enumerable.reduce.call(this,i,null,t);return s}.property("[]")},SC.Reducers={"[]":function(e,t){return this}.property(),enumerableContentDidChange:function(e,t,n){this.notifyPropertyChange("[]")},reducedProperty:function(e,t,n){if(!e||typeof e!==SC.T_STRING||e.charAt(0)!=="@")return undefined;var r=e.match(/^@([^(]*)(\(([^)]*)\))?$/);if(!r||r.length<2)return undefined;var i=r[1],s=r[3];i="reduce"+i.slice(0,1).toUpperCase()+i.slice(1);var o=this[i];if(SC.typeOf(o)!==SC.T_FUNCTION)return undefined;if(n===NO)return SC.Enumerable.reduce.call(this,o,null,s);var u=SC._buildReducerFor(i,s),a=this.constructor.prototype;if(a){a[e]=u;var f=a._properties||[];f.push(e),a._properties=f,this.registerDependentKey(e,"[]")}return SC.Enumerable.reduce.call(this,o,null,s)}
,reduceMax:function(e,t,n,r,i){return i&&t&&(t=t.get?t.get(i):t[i]),e===null?t:t>e?t:e},reduceMaxObject:function(e,t,n,r,i){var s=e,o=t;return i&&(t&&(o=t.get?t.get(i):t[i]),e&&(s=e.get?e.get(i):e[i])),s===null?t:o>s?t:e},reduceMin:function(e,t,n,r,i){return i&&t&&(t=t.get?t.get(i):t[i]),e===null?t:t<e?t:e},reduceMinObject:function(e,t,n,r,i){var s=e,o=t;return i&&(t&&(o=t.get?t.get(i):t[i]),e&&(s=e.get?e.get(i):e[i])),s===null?t:o<s?t:e},reduceAverage:function(e,t,n,r,i){i&&t&&(t=t.get?t.get(i):t[i]);var s=(e||0)+t,o=r.get?r.get("length"):r.length;return n>=o-1&&(s/=o),s},reduceSum:function(e,t,n,r,i){return i&&t&&(t=t.get?t.get(i):t[i]),e===null?t:e+t}},SC.mixin(SC.Enumerable,SC.Reducers),SC.mixin(Array.prototype,SC.Reducers),Array.prototype.isEnumerable=YES,function(){var e={nextObject:SC.Enumerable.nextObject,enumerator:SC.Enumerable.enumerator,firstObject:SC.Enumerable.firstObject,lastObject:SC.Enumerable.lastObject,sortProperty:SC.Enumerable.sortProperty,mapProperty:function(e){var t=this.length,n=[];for(var r=0;r<t;r++){var i=this[r];n[r]=i?i.get?i.get(e):i[e]:null}return n},filterProperty:function(e,t){var n=this.length,r=[];for(var i=0;i<n;i++){var s=this[i],o=s?s.get?s.get(e):s[e]:null,u=t===undefined?!!o:SC.isEqual(o,t);u&&r.push(s)}return r},groupBy:function(e){var t=this.length,n=[],r=[],i=[],s,o,u;for(s=0;s<t;s++)o=this[s],u=o?o.get?o.get(e):o[e]:null,SC.none(r[u])&&(r[u]=[],i.push(u)),r[u].push(o);for(s=0,t=i.length;s<t;s++)n.push(r[i[s]]);return n},find:function(e,t){if(typeof e!="function")throw new TypeError;var n=this.length;t===undefined&&(t=null);var r,i=
null,s=NO;for(var o=0;o<n&&!s;o++){r=this[o];if(s=e.call(t,r,o,this))i=r}return r=null,i},findProperty:function(e,t){var n=this.length,r,i,s=NO,o=null;for(var u=0;u<n&&!s;u++)i=(r=this[u])?r.get?r.get(e):r[e]:null,s=t===undefined?!!i:SC.isEqual(i,t),s&&(o=r);return r=null,o},everyProperty:function(e,t){var n=this.length,r=YES;for(var i=0;r&&i<n;i++){var s=this[i],o=s?s.get?s.get(e):s[e]:null;r=t===undefined?!!o:SC.isEqual(o,t)}return r},someProperty:function(e,t){var n=this.length,r=NO;for(var i=0;!r&&i<n;i++){var s=this[i],o=s?s.get?s.get(e):s[e]:null;r=t===undefined?!!o:SC.isEqual(o,t)}return r},invoke:function(e){var t=this.length;if(t<=0)return[];var n,r=[],i=arguments.length;if(i>1)for(n=1;n<i;n++)r.push(arguments[n]);var s=[];for(n=0;n<t;n++){var o=this[n],u=o?o[e]:null;u&&(s[n]=u.apply(o,r))}return s},invokeWhile:function(e,t){var n=this.length;if(n<=0)return null;var r,i=[],s=arguments.length;if(s>2)for(r=2;r<s;r++)i.push(arguments[r]);var o=e;for(r=0;o===e&&r<n;r++){var u=this[r],a=u?u[t]:null;a&&(o=a.apply(u,i))}return o},toArray:function(){var e=this.length;if(e<=0)return[];var t=[];for(var n=0;n<e;n++){var r=this[n];t.push(r)}return t},getEach:function(e){var t=[],n=this.length;for(var r=0;r<n;r++){var i=this[r];t[r]=i?i.get?i.get(e):i[e]:null}return t},setEach:function(e,t){var n=this.length;for(var r=0;r<n;r++){var i=this[r];i&&(i.set?i.set(e,t):i[e]=t)}return this}},t={forEach:function(e,t){if(typeof e!="function")throw new TypeError;t===undefined&&(t=null);for(var n=0,r=this.length;n<r;n++){var i=this[n];e.call(t,i,n,this)}return this},map:function(e,t){if(typeof
e!="function")throw new TypeError;t===undefined&&(t=null);var n=[];for(var r=0,i=this.length;r<i;r++){var s=this[r];n[r]=e.call(t,s,r,this)}return n},filter:function(e,t){if(typeof e!="function")throw new TypeError;t===undefined&&(t=null);var n=[];for(var r=0,i=this.length;r<i;r++){var s=this[r];e.call(t,s,r,this)&&n.push(s)}return n},every:function(e,t){if(typeof e!="function")throw new TypeError;var n=this.length;t===undefined&&(t=null);var r=YES;for(var i=0;r&&i<n;i++){var s=this[i];e.call(t,s,i,this)||(r=NO)}return r},some:function(e,t){if(typeof e!="function")throw new TypeError;var n=this.length;t===undefined&&(t=null);var r=NO;for(var i=0;!r&&i<n;i++){var s=this[i];e.call(t,s,i,this)&&(r=YES)}return r},reduce:function(e,t,n){if(typeof e!="function")throw new TypeError;var r=this.length;if(r===0&&t===undefined)throw new TypeError;var i=t;for(var s=0;s<r;s++){var o=this[s];o!==null&&(i===undefined?i=o:i=e.call(null,i,o,s,this,n))}if(i===undefined)throw new TypeError;return i}};for(var n in t){if(!t.hasOwnProperty(n))continue;if(!Array.prototype[n]||typeof Prototype=="object"&&Prototype.Version.match(/^1\.6/))Array.prototype[n]=t[n]}SC.mixin(Array.prototype,e)}(),SC.RangeObserver={isRangeObserver:YES,toString:function(){var e=this.indexes?this.indexes.toString():"SC.IndexSet<..>";return e.replace("IndexSet","RangeObserver(%@)".fmt(SC.guidFor(this)))},create:function(e,t,n,r,i,s){var o=SC.beget(this);return o.source=e,o.indexes=t?t.frozenCopy():null,o.target=n,o.method=typeof r=="string"?n[r]:r,o.context=i,o.isDeep=s||!1,o.beginObserving(),o},extend:function(e){var t=SC.beget
(this),n=arguments;for(var r=0,i=n.length;r<i;r++)SC.mixin(t,n[r]);return t},destroy:function(e){return this.endObserving(),this},update:function(e,t){return this.indexes&&this.indexes.isEqual(t)?this:(this.indexes=t?t.frozenCopy():null,this.endObserving().beginObserving(),this)},beginObserving:function(){if(!this.isDeep)return this;var e=this.observing=this.observing||SC.CoreSet.create(),t=this._beginObservingForEach,n=this.source;return t||(t=this._beginObservingForEach=function(t){var r=n.objectAt(t);r&&r.addObserver&&(e.push(r),r._kvo_needsRangeObserver=!0)}),this.indexes.forEach(t),this.isObserving=!1,SC.Observers.addPendingRangeObserver(this),this},setupPending:function(e){var t=this.observing;if(this.isObserving||!t||t.get("length")===0)return!0;if(t.contains(e)){this.isObserving=!0;var n=this._setupPendingForEach;if(!n){var r=this.source,i=this.objectPropertyDidChange,s=this;n=this._setupPendingForEach=function(e){var n=r.objectAt(e),o=SC.guidFor(n),u;n&&n.addObserver&&(t.push(n),n.addObserver("*",s,i),u=s[o],u==null?s[o]=e:u.isIndexSet?u.add(e):s[o]=SC.IndexSet.create(u).add(e))}}return this.indexes.forEach(n),!0}return!1},endObserving:function(){if(!this.isDeep)return this;var e=this.observing;if(this.isObserving){var t=this.objectPropertyDidChange,n=this.source,r,i,s;if(e){i=e.length;for(r=0;r<i;r++)s=e[r],s.removeObserver("*",this,t),this[SC.guidFor(s)]=null;e.length=0}this.isObserving=!1}return e&&e.clear(),this},rangeDidChange:function(e){var t=this.indexes;if(!e||!t||t.intersects(e))this.endObserving(),this.method.call(this.target,this.source,null,"[]",e,this.
context),this.beginObserving();return this},objectPropertyDidChange:function(e,t,n,r){var i=this.context,s=this.method,o=SC.guidFor(e),u=this[o];u&&!u.isIndexSet&&(u=this[o]=SC.IndexSet.create(u).freeze()),s.call(this.target,this.source,e,t,u,i||r,r)}},SC.OUT_OF_RANGE_EXCEPTION="Index out of range",SC.CoreArray={isSCArray:YES,replace:function(e,t,n){throw"replace() must be implemented to support SC.Array"},indexOf:function(e,t){var n,r=this.get("length");t===undefined?t=0:t=t<0?Math.ceil(t):Math.floor(t),t<0&&(t+=r);for(n=t;n<r;n++)if(this.objectAt(n,YES)===e)return n;return-1},lastIndexOf:function(e,t){var n,r=this.get("length");t===undefined?t=r-1:t=t<0?Math.ceil(t):Math.floor(t),t<0&&(t+=r);for(n=t;n>=0;n--)if(this.objectAt(n)===e)return n;return-1},objectAt:function(e){return e<0?undefined:e>=this.get("length")?undefined:this.get(e)},"[]":function(e,t){return t!==undefined&&this.replace(0,this.get("length"),t),this}.property(),insertAt:function(e,t){if(e>this.get("length"))throw SC.OUT_OF_RANGE_EXCEPTION;return this.replace(e,0,[t]),this},removeAt:function(e,t){var n=0,r=[];if(typeof e===SC.T_NUMBER){if(e<0||e>=this.get("length"))throw SC.OUT_OF_RANGE_EXCEPTION;if(t===undefined)return this.replace(e,1,r),this;e=SC.IndexSet.create(e,t)}return this.beginPropertyChanges(),e.forEachRange(function(e,t){e-=n,n+=t,this.replace(e,t,r)},this),this.endPropertyChanges(),this},removeObject:function(e){var t=this.get("length")||0;while(--t>=0){var n=this.objectAt(t);n==e&&this.removeAt(t)}return this},removeObjects:function(e){return this.beginPropertyChanges(),e.forEach(function(e){
this.removeObject(e)},this),this.endPropertyChanges(),this},slice:function(e,t){var n=[],r=this.get("length");SC.none(e)&&(e=0);if(SC.none(t)||t>r)t=r;while(e<t)n[n.length]=this.objectAt(e++);return n},pushObject:function(e){return this.insertAt(this.get("length"),e),e},pushObjects:function(e){return this.beginPropertyChanges(),e.forEach(function(e){this.pushObject(e)},this),this.endPropertyChanges(),this},popObject:function(){var e=this.get("length");if(e===0)return null;var t=this.objectAt(e-1);return this.removeAt(e-1),t},shiftObject:function(){if(this.get("length")===0)return null;var e=this.objectAt(0);return this.removeAt(0),e},unshiftObject:function(e){return this.insertAt(0,e),e},unshiftObjects:function(e){return this.beginPropertyChanges(),e.forEach(function(e){this.unshiftObject(e)},this),this.endPropertyChanges(),this},isEqual:function(e){if(!e)return!1;if(e==this)return!0;var t=e.get("length");if(t!=this.get("length"))return!1;while(--t>=0)if(!SC.isEqual(e.objectAt(t),this.objectAt(t)))return!1;return!0},compact:function(){return this.without(null)},without:function(e){if(this.indexOf(e)<0)return this;var t=[];return this.forEach(function(n){n!==e&&(t[t.length]=n)}),t},uniq:function(){var e=[];return this.forEach(function(t){e.indexOf(t)<0&&(e[e.length]=t)}),e},flatten:function(){var e=[];return this.forEach(function(t){t&&t.isEnumerable?e=e.pushObjects(t.flatten()):e.pushObject(t)}),e},max:function(){return Math.max.apply(Math,this)},min:function(){return Math.min.apply(Math,this)},rangeObserverClass:SC.RangeObserver,contains:function(e){return this.indexOf(e)>=0
},addRangeObserver:function(e,t,n,r){var i=this._array_rangeObservers;i||(i=this._array_rangeObservers=SC.CoreSet.create()),this._array_oldLength===undefined&&(this._array_oldLength=this.get("length"));var s=this.rangeObserverClass,o=NO,u=s.create(this,e,t,n,r,o);return i.add(u),this._array_isNotifyingRangeObservers||(this._array_isNotifyingRangeObservers=YES,this.addObserver("[]",this,this._array_notifyRangeObservers)),u},updateRangeObserver:function(e,t){return e.update(this,t)},removeRangeObserver:function(e){var t=e.destroy(this),n=this._array_rangeObservers;return n&&n.remove(e),t},addArrayObservers:function(e){this._modifyObserverSet("add",e)},removeArrayObservers:function(e){this._modifyObserverSet("remove",e)},_modifyObserverSet:function(e,t){var n,r,i=t.target||this,s=t.willChange||"arrayWillChange",o=t.didChange||"arrayDidChange",u=t.context;typeof s=="string"&&(s=i[s]),typeof o=="string"&&(o=i[o]),n=this._kvo_for("_kvo_array_will_change",SC.ObserverSet),r=this._kvo_for("_kvo_array_did_change",SC.ObserverSet),n[e](i,s,u),r[e](i,o,u)},arrayContentWillChange:function(e,t,n){this._teardownContentObservers(e,t);var r,i,s,o,u,a,f=this._kvo_array_will_change;if(f){i=f.members,s=i.length;for(o=0;o<s;o++)r=i[o],u=r[0],a=r[1],a.call(u,e,t,n,this)}},arrayContentDidChange:function(e,t,n){var r=this._array_rangeObservers,i,s,o;this.beginPropertyChanges(),this.notifyPropertyChange("length"),r&&r.length>0&&(o=this._array_rangeChanges,o||(o=this._array_rangeChanges=SC.IndexSet.create()),t===n?s=t:(s=this.get("length")-e,t>n&&(s+=t-n)),o.add(e,s)),this._setupContentObservers(e,n);
var u,a,f,l,c,h,p=this._kvo_array_did_change;if(p){e===undefined&&(e=0,t=this.get("length"),n=0),a=p.members,f=a.length;for(l=0;l<f;l++)u=a[l],c=u[0],h=u[1],h.call(c,e,t,n,this)}return this.notifyPropertyChange("[]"),this.endPropertyChanges(),this},_setupContentObservers:function(e,t){var n=this._kvo_for("_kvo_content_observed_keys",SC.CoreSet),r,i;if(n.get("length")>0){r=this.slice(e,e+t);var s=this;n.forEach(function(e){i=SC.keyFor("_kvo_content_observers",e),s._kvo_for(i).forEach(function(e){r.forEach(function(t){s._resumeChainObservingForItemWithChainObserver(t,e)})})})}},_teardownContentObservers:function(e,t){var n=this._kvo_for("_kvo_content_observed_keys",SC.CoreSet),r,i;n.get("length")>0&&(r=this.slice(e,e+t),n.forEach(function(e){i=SC.keyFor("_kvo_content_observers",e),r.forEach(function(e){e._kvo_for(i).forEach(function(e){e.destroyChain()})})}))},teardownEnumerablePropertyChains:function(e){var t=this._kvo_enumerable_property_chains;return t&&t.forEach(function(t){var n,r=e.get("length"),i=SC.guidFor(t),s,o,u="_kvo_enumerable_property_clones";t.notifyPropertyDidChange();for(n=0;n<r;n++)o=e.objectAt(n),s=o[u][i],s.deactivate(),delete o[u][i]},this),this},setupEnumerablePropertyChains:function(e){var t=this._kvo_enumerable_property_chains;return t&&t.forEach(function(t){var n,r=e.get("length");t.notifyPropertyDidChange(),r=e.get("length");for(n=0;n<r;n++)this._clonePropertyChainToItem(t,e.objectAt(n))},this),this},registerDependentKeyWithChain:function(e,t){var n="_kvo_enumerable_property_chains",r,i,s,o;r=this._kvo_for(n,SC.CoreSet),r.add(t),this.forEach(function(
e){this._clonePropertyChainToItem(t,e)},this)},_clonePropertyChainToItem:function(e,t){var n=SC.clone(e),r="_kvo_enumerable_property_clones",i;n.object=t,i=t[r]=t[r]||{},i[SC.guidFor(e)]=n,n.activate(t)},removeDependentKeyWithChain:function(e,t){var n="_kvo_enumerable_property_chains",r="_kvo_enumerable_property_clones",i,s,o,u;this.forEach(function(n){n.removeDependentKeyWithChain(e,t),u=n[r],o=u[SC.guidFor(t)],o.deactivate(n)},this)},_resumeChainObservingForItemWithChainObserver:function(e,t){var n=SC.clone(t.next),r=n.property;n.object=e,e.addObserver(r,n,n.propertyDidChange),t.root.tails&&t.root.tails.pushObject(n.tail()),n.propertyDidChange(),e._kvo_for(SC.keyFor("_kvo_content_observers",r)).push(n)},_addContentObserver:function(e){var t=e.next.property;this._kvo_for("_kvo_content_observed_keys",SC.CoreSet).push(t);var n=SC.keyFor("_kvo_content_observers",t);this._kvo_for(n).push(e),this._setupContentObservers(0,e.object.get("length"))},_removeContentObserver:function(e){var t,n,r=this._kvo_content_observed_keys,i=e.next.property;r.contains(i)&&(n=SC.keyFor("_kvo_content_observers",i),t=this._kvo_for(n),t.removeObject(e),this._teardownContentObservers(0,e.object.get("length")),t.length===0&&this._kvo_for("_kvo_content_observed_keys").remove(i))},_array_notifyRangeObservers:function(){var e=this._array_rangeObservers,t=this._array_rangeChanges,n=e?e.length:0,r,i;if(n>0&&t&&t.length>0){for(r=0;r<n;r++)e[r].rangeDidChange(t);t.clear()}}},SC.Array=SC.mixin({},SC.Enumerable,SC.CoreArray),SC.supplement(Array.prototype,SC.CoreArray),SC.mixin(Array.prototype,{replace:function(e
,t,n){if(this.isFrozen)throw SC.FROZEN_ERROR;var r,i=n?n.get?n.get("length"):n.length:0;return this.arrayContentWillChange(e,t,i),i===0?this.splice(e,t):(r=[e,t].concat(n),this.splice.apply(this,r)),this.arrayContentDidChange(e,t,i),this.enumerableContentDidChange(e,t,i-t),this},unknownProperty:function(e,t){var n=this.reducedProperty(e,t);return t!==undefined&&n===undefined&&(n=this[e]=t),n}}),Array.prototype.indexOf===SC.CoreArray.indexOf&&(Array.prototype.indexOf=function(e,t){var n,r=this.length;t===undefined?t=0:t=t<0?Math.ceil(t):Math.floor(t),t<0&&(t+=r);for(n=t;n<r;n++)if(this[n]===e)return n;return-1}),Array.prototype.lastIndexOf===SC.CoreArray.lastIndexOf&&(Array.prototype.lastIndexOf=function(e,t){var n,r=this.length;t===undefined?t=r-1:t=t<0?Math.ceil(t):Math.floor(t),t<0&&(t+=r);for(n=t;n>=0;n--)if(this[n]===e)return n;return-1}),Date.now||(Date.now=function(){return(new Date).getTime()}),function(){var e=0,t=["ms","moz","webkit","o"],n;for(var r=0,i=t.length;r<i&&!window.requestAnimationFrame;++r)n=t[r],window.requestAnimationFrame=window[n+"RequestAnimationFrame"],window.cancelAnimationFrame=window[n+"CancelAnimationFrame"]||window[n+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t,n){var r=(new Date).getTime(),i=Math.max(0,16-(r-e)),s=window.setTimeout(function(){t(r+i)},i);return e=r+i,s}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}(),SC.String={_scs_valueForKey:function(e,t,n){var r,i,s,o=e.indexOf(":");o>-1&&(r=e.substr(o+1),e=e.substr(0,o)),i=t[e],s=t[e+"Formatter"
];if(s)i=s(i,r);else if(r)throw"String.fmt was given a formatting string, but key `"+e+"` has no formatter! String: "+n;return i},fmt:function(e,t){var n=0,r=undefined,i,s,o;return t&&(r=t[0]),s=e,o=e.replace(/%\{(.*?)\}/g,function(t,n){i=YES;if(!r)throw"Cannot use named parameters with `fmt` without a data hash. String: '"+e+"'";return SC.String._scs_valueForKey(n,r,e)}),s.match(/%@/)&&(o=o.replace(/%@([0-9]+)?/g,function(r,s){if(i)throw"Invalid attempt to use both named parameters and indexed parameters. String: '"+e+"'";return s=s?parseInt(s,10)-1:n++,t[s]})),o},w:function(e){var t=[],n=e.split(" "),r=n.length,i,s=0;for(s=0;s<r;++s)i=n[s],i.length!==0&&t.push(i);return t}},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(e,t){throw"%@.compare() is not implemented".fmt(this.toString())}},SC.Copyable={isCopyable:YES,copy:function(e){var t=SC._object_className(this.constructor);throw"%@.copy() is not implemented".fmt(t)},frozenCopy:function(){var e=this.get?this.get("isFrozen"):this.isFrozen;if(e===YES)return this;if(e===undefined)throw"%@ does not support freezing".fmt(this);return this.copy().freeze()}},SC.mixin(Array.prototype,SC.Copyable),Array.prototype.copy=function(e){var t=this.slice(),n;if(e){n=t.length;while(n--)t[n]=SC.copy(t[n],!0)}return t},SC.FROZEN_ERROR=new Error("Cannot modify a frozen object"),SC.Freezable={isFreezable:YES,isFrozen:NO,freeze:function(){return this.set?this.set("isFrozen",YES):this.isFrozen=YES,this}},SC.mixin(Array.prototype
,SC.Freezable),SC.Set=SC.mixin({},SC.Enumerable,SC.Observable,SC.Freezable,{create:function(e){var t,n,r=SC.Set._pool,i=this.isObservable,s;if(!i&&e===undefined&&r.length>0)return r.pop();t=SC.beget(this),i&&t.initObservable();if(e&&e.isEnumerable&&e.get("length")>0){t.isObservable=NO;if(e.isSCArray){s=e.get("length");for(n=0;n<s;n++)t.add(e.objectAt(n))}else if(e.isSet){s=e.length;for(n=0;n<s;n++)t.add(e[n])}else e.forEach(function(e){t.add(e)},this);t.isObservable=i}return t},isSet:YES,length:0,firstObject:function(){return this.length>0?this[0]:undefined}.property(),clear:function(){if(this.isFrozen)throw SC.FROZEN_ERROR;return this.length=0,this},contains:function(e){if(e===null)return NO;var t=this[SC.hashFor(e)];return!SC.none(t)&&t<this.length&&this[t]===e},isEqual:function(e){if(!e||!e.isSet||e.get("length")!==this.get("length"))return NO;var t=this.get("length");while(--t>=0)if(!e.contains(this[t]))return NO;return YES},addSetObserver:function(e){this.setObservers||(this.setObservers=SC.CoreSet.create()),this.setObservers.add(e)},removeSetObserver:function(e){if(!this.setObservers)return;this.setObservers.remove(e)},add:function(e){if(this.isFrozen)throw SC.FROZEN_ERROR;if(SC.none(e))return this;var t,n=(t=e.hash)&&typeof t=="function"?t.call(e):SC.guidFor(e),r=this[n],i=this.length;if(r>=i||this[r]!==e)this[i]=e,this[n]=i,this.length=i+1,this.setObservers&&this.didAddItem(e);return this.isObservable&&this.enumerableContentDidChange(),this},addEach:function(e){if(this.isFrozen)throw SC.FROZEN_ERROR;if(!e||!e.isEnumerable)throw"%@.addEach must pass enumerable".fmt(this
);var t,n=this.isObservable;n&&this.beginPropertyChanges();if(e.isSCArray){t=e.get("length");while(--t>=0)this.add(e.objectAt(t))}else if(e.isSet){t=e.length;while(--t>=0)this.add(e[t])}else e.forEach(function(e){this.add(e)},this);return n&&this.endPropertyChanges(),this},remove:function(e){if(this.isFrozen)throw SC.FROZEN_ERROR;if(e===null||e===undefined)return this;var t,n=e&&(t=e.hash)&&typeof t===SC.T_FUNCTION?t.call(e):SC.guidFor(e),r=this[n],i=this.length,s;return r===null||r===undefined||r>=i||this[r]!==e?this:(delete this[n],r<i-1&&(s=this[r]=this[i-1],n=s&&(t=s.hash)&&typeof t===SC.T_FUNCTION?t.call(s):SC.guidFor(s),this[n]=r),delete this[i-1],this.length=i-1,this.isObservable&&this.enumerableContentDidChange(),this.setObservers&&this.didRemoveItem(e),this)},pop:function(){if(this.isFrozen)throw SC.FROZEN_ERROR;var e=this.length,t=e>0?this[e-1]:null;return this.remove(t),t},removeEach:function(e){if(this.isFrozen)throw SC.FROZEN_ERROR;if(!e||!e.isEnumerable)throw"%@.addEach must pass enumerable".fmt(this);var t,n=this.isObservable;n&&this.beginPropertyChanges();if(e.isSCArray){t=e.get("length");while(--t>=0)this.remove(e.objectAt(t))}else if(e.isSet){t=e.length;while(--t>=0)this.remove(e[t])}else e.forEach(function(e){this.remove(e)},this);return n&&this.endPropertyChanges(),this},copy:function(){return this.constructor.create(this)},destroy:function(){return this.isFrozen=NO,this.isObservable||SC.Set._pool.push(this.clear()),this},forEach:function(e,t){var n=this.length;t||(t=this);for(var r=0;r<n;r++)e.call(t,this[r],r,this);return this},toString:function(){var e=
this.length,t,n=[];for(t=0;t<e;t++)n[t]=this[t];return"SC.Set<%@>".fmt(n.join(","))},didAddItem:function(e){var t=this.setObservers;if(!t)return;var n=t.length,r;for(r=0;r<n;r++)t[r].didAddItem(this,e)},didRemoveItem:function(e){var t=this.setObservers;if(!t)return;var n=t.length,r;for(r=0;r<n;r++)t[r].didRemoveItem(this,e)},_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.Observers={queue:[],addObserver:function(e,t,n,r){var i;typeof e=="string"?i=SC.tupleForPropertyPath(e,r):i=e,i&&i[0].addObserver?i[0].addObserver(i[1],t,n):this.queue.push([e,t,n,r])},removeObserver:function(e,t,n,r){var i,s,o,u;o=SC.tupleForPropertyPath(e,r),o&&o[0].removeObserver(o[1],t,n),i=this.queue.length,s=this.queue,newQueue=undefined;while(--i>=0){u=s[i];if(u[0]!==e||u[1]!==t||u[2]!==n||u[3]!==r)newQueue||(newQueue=[]),newQueue.push(u)}this.queue=newQueue||this.queue},addPendingRangeObserver:function(e){var t=this.rangeObservers;return t||(t=this.rangeObservers=SC.CoreSet.create()),t.add(e),this},_TMP_OUT:[],flush:function(e){var t=this.queue,n,r=t.length;if(t&&r>0){var i=this.queue=[];for(n=0;n<r;n++){var s=t[n];if(!s)continue;var o=SC.tupleForPropertyPath(s[0],s[3]);o&&o[0].addObserver?o[0].addObserver(o[1],s[1],s[2]):i.push(s)}}if(e._kvo_needsRangeObserver){var u=this.rangeObservers,a=u?u.get("length"):0,f=this._TMP_OUT,l;for(n=0;n<a;n++
)l=u[n],l.setupPending(e)&&f.push(l);f.length>0&&u.removeEach(f),f.length=0,e._kvo_needsRangeObserver=!1}},isObservingSuspended:0,_pending:SC.CoreSet.create(),objectHasPendingChanges:function(e){this._pending.add(e)},suspendPropertyObserving:function(){this.isObservingSuspended++},resumePropertyObserving:function(){var e;if(--this.isObservingSuspended<=0){e=this._pending,this._pending=SC.CoreSet.create();var t,n=e.length;for(t=0;t<n;t++)e[t]._notifyPropertyObservers();e.clear(),e=null}}},SC.BENCHMARK_OBJECTS=NO,SC._detect_base=function(t,n,r){return function(){var i=n[r],s;if(!i)throw new Error("No '"+r+"' method was found on the superclass");return t.isEnhancement?s=Array.prototype.slice.call(arguments,1):s=arguments,i.apply(this,s)}},SC._object_extend=function(t,n,r){if(!n)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?";t._kvo_cloned=null;var i,s,o,u,a=t.concatenatedProperties,f=SC.K,l,c;s=a?a.length:0;var h=s>0?{}:null;while(--s>=0)i=a[s],l=t[i],c=n[i],l?(l instanceof Array||(l=SC.$A(l)),h[i]=c?l.concat(c):c):(c instanceof Array||(c=SC.$A(c)),h[i]=c);var p=t._bindings,d=NO,v=t._observers,m=NO,g=t._properties,y=NO,b,w,E,S,x=t.outlets,T=NO;n.outlets&&(x=(x||SC.EMPTY_ARRAY).concat(n.outlets),T=YES);for(i in n){if(i==="_kvo_cloned")continue;if(!n.hasOwnProperty(i))continue;S=(h.hasOwnProperty(i)?h[i]:null)||n[i];if(i.length>7&&i.slice(-7)==="Binding")d||(p=(p||SC.EMPTY_ARRAY).slice(),d=YES),p===null&&(p=(t._bindings||SC.EMPTY_ARRAY).slice()),p[p.length]=i;else if(S&&
S instanceof Function){!S.superclass&&S!==(u=t[i])&&(S.superclass=u||f,S.base=r?SC._detect_base(S,r,i):u||f),S.propertyPaths&&(m||(v=(v||SC.EMPTY_ARRAY).slice(),m=YES),v[v.length]=i);if(b=S.localPropertyPaths){w=b.length;while(--w>=0)E=t._kvo_for(SC.keyFor("_kvo_local",b[w]),SC.CoreSet),E.add(i),t._kvo_for("_kvo_observed_keys",SC.CoreSet).add(b[w])}S.dependentKeys&&(y||(g=(g||SC.EMPTY_ARRAY).slice(),y=YES),g[g.length]=i),S.autoconfiguredOutlet&&(T||(x=(x||SC.EMPTY_ARRAY).slice(),T=YES),x[x.length]=i),S.isEnhancement&&(S=SC._enhance(t[i]||f,S))}t[i]=S}return n.hasOwnProperty("toString")&&(i="toString",S=(h.hasOwnProperty(i)?h[i]:null)||n[i],!S.superclass&&S!==(u=t[i])&&(S.superclass=S.base=u||f),t[i]=S),t._bindings=p||[],t._observers=v||[],t._properties=g||[],t.outlets=x||[],t},SC._enhance=function(e,t){return function(){var n=Array.prototype.slice.call(arguments,0),r=this;return n.unshift(function(){return e.apply(r,arguments)}),t.apply(this,n)}},SC.Object=function(e){return this.__sc_super__=SC.Object.prototype,this._object_init(e)},SC.mixin(SC.Object,{mixin:function(e){var t=arguments.length,n;for(n=0;n<t;n++)SC.mixin(this,arguments[n]);return this},superclass:null,extend:function(e){var t=SC.BENCHMARK_OBJECTS;t&&SC.Benchmark.start("SC.Object.extend");var n,r=function(e){return this.__sc_super__=r.prototype,this._object_init(e)};for(n in this){if(!this.hasOwnProperty(n))continue;r[n]=this[n]}this.hasOwnProperty("toString")&&(r.toString=this.toString),r.superclass=this,r.__sc_super__=this.prototype,SC.generateGuid(r,"sc"),r.subclasses=SC.Set.create(),this.subclasses.add(r);
var i=r.prototype=SC.beget(this.prototype),s,o=arguments.length;for(s=0;s<o;s++)SC._object_extend(i,arguments[s],r.__sc_super__);return i.constructor=r,t&&SC.Benchmark.end("SC.Object.extend"),r},reopen:function(e){return SC._object_extend(this.prototype,e,this.__sc_super__)},create:function(){var e=this,t=new e(arguments);return t},isClass:YES,subclasses:SC.Set.create(),toString:function(){return SC._object_className(this)},subclassOf:function(e){if(this===e)return NO;var t=this;while(t=t.superclass)if(t===e)return YES;return NO},hasSubclass:function(e){return e&&e.subclassOf?e.subclassOf(this):NO},kindOf:function(e){return this===e||this.subclassOf(e)},design:function(){if(this.isDesign)return this;var e=this.extend.apply(this,arguments);return e.isDesign=YES,e}}),SC.Object.prototype={_kvo_enabled:YES,_object_init:function(e){var t,n=e?e.length:0;for(t=0;t<n;t++)SC._object_extend(this,e[t],this.__sc_super__);SC.generateGuid(this,"sc"),this.init();var r=this.initMixin;n=r?r.length:0;for(t=0;t<n;t++)r[t].call(this);return this},mixin:function(){var e,t=arguments.length,n;for(e=0;e<t;e++)SC.mixin(this,arguments[e]);for(e=0;e<t;e++)n=arguments[e].initMixin,n&&n.call(this);return this},init:function(){return this.initObservable(),this},isDestroyed:NO,destroy:function(){if(this.get("isDestroyed"))return this;this.set("isDestroyed",YES);var e,t=this.destroyMixin,n=t?t.length:0;for(e=0;e<n;e++)t[e].call(this);return this.bindings.invoke("disconnect"),this.bindings=null,this},isObject:!0,respondsTo:function(e){return this[e]instanceof Function},tryToPerform:function(e,t,n){return this
.respondsTo(e)&&this[e](t,n)!==NO},superclass:function(e){var t=arguments.callee.caller;if(!t)throw"superclass cannot determine the caller method";return t.superclass?t.superclass.apply(this,arguments):null},instanceOf:function(e){return this.constructor===e},kindOf:function(e){return this.constructor.kindOf(e)},toString:function(){if(!this._object_toString){var e=SC._object_className(this.constructor),t=e+":"+SC.guidFor(this);if(!e)return t;this._object_toString=t}return this._object_toString},awake:function(){var e=this.outlets,t,n,r;for(t=0,n=e.length;t<n;++t)r=e[t],this.get(r);this.bindings.invoke("sync")},invokeOnce:function(e){return SC.RunLoop.currentRunLoop.invokeOnce(this,e),this},invokeLast:function(e){return SC.RunLoop.currentRunLoop.invokeLast(this,e),this},concatenatedProperties:["concatenatedProperties","initMixin","destroyMixin"]},SC.Object.prototype.constructor=SC.Object,SC.mixin(SC.Object.prototype,SC.Observable),SC.instanceOf=function(e,t){return!!e&&e.constructor===t},SC.kindOf=function(e,t){return e&&!e.isClass&&(e=e.constructor),!!(e&&e.kindOf&&e.kindOf(t))},SC._object_className=function(e){if(SC.isReady===NO)return"";e._object_className||findClassNames();if(e._object_className)return e._object_className;var t=e;while(t&&!t._object_className)t=t.superclass;return t&&t._object_className?t._object_className:"Anonymous"},SC._PropertyChain=SC.Object.extend({object:null,property:null,target:null,toInvalidate:null,nextProperty:null,activate:function(e){var t=this.get("object"),n=this.get("property"),r;return e||(e=this.get("target")),t&&t!==e&&this.deactivate(
),this.set("object",e),e&&n!=="@each"&&e.registerDependentKeyWithChain(n,this),this.next&&(r=e?e.get(n):undefined,this.next.activate(r)),this},deactivate:function(){var e=this.get("object"),t=this.get("property");return e&&e.removeDependentKeyWithChain(t,this),this.next&&this.next.deactivate(),this},notifyPropertyDidChange:function(){var e=this.get("target"),t=this.get("toInvalidate"),n,r;e.propertyDidChange(t),this.next&&(n=this.get("object"),r=n.get(this.get("property")),this.next.activate(r))}}),SC._PropertyChain.createChain=function(e,t,n){var r=e.split("."),i=r.length,s=1,o=SC._PropertyChain.create({property:r[0],target:t,toInvalidate:n,nextProperty:r[1]});o.set("length",i);var u=o;while(--i>=1)u=u.next=SC._PropertyChain.create({property:r[s],target:t,toInvalidate:n,nextProperty:r[++s]}),u.set("length",i);return o},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(e){var t=SC.beget(this);return t.parentBinding=this,e!==undefined&&(t=t.from(e)),t},builder:function(){var e=this,t=function(t){return e.beget().from(t)};return t.beget=function(){return e.beget()},t},from:function(e,t){if(!e)return this;var n=this===SC.Binding?this.beget():this;return n._fromPropertyPath=e,n._fromRoot=t,n._fromTuple=null,n},to:function(e,t){var n=this===SC.Binding?this.beget():this;return n._toPropertyPath=e,n._toRoot=t,n._toTuple=null,n},connect:function(){return this.isConnected?this:(this.isConnected=YES,this._connectionPending=YES
,this._syncOnConnect=YES,SC.Binding._connectQueue.add(this),SC.RunLoop.isRunLoopInProgress()||this._scheduleSync(),this)},_connect:function(){if(!this._connectionPending)return;this._connectionPending=NO;var e,t,n=SC.BENCHMARK_BINDING_SETUP;e=this._fromPropertyPath,t=this._fromRoot,typeof e=="string"&&(e.indexOf(".")===0?(e=e.slice(1),t||(t=this._toRoot)):e.indexOf("*")===0&&(e=[this._fromRoot||this._toRoot,e.slice(1)],t=null)),this._fromObserverData=[e,this,this.fromPropertyDidChange,t],SC.Observers.addObserver.apply(SC.Observers,this._fromObserverData),this._oneWay||(e=this._toPropertyPath,t=this._toRoot,this._toObserverData=[e,this,this.toPropertyDidChange,t],SC.Observers.addObserver.apply(SC.Observers,this._toObserverData)),this._syncOnConnect&&(this._syncOnConnect=NO,this.sync())},disconnect:function(){return this.isConnected?(this._connectionPending?this._connectionPending=NO:(SC.Observers.removeObserver.apply(SC.Observers,this._fromObserverData),this._oneWay||SC.Observers.removeObserver.apply(SC.Observers,this._toObserverData)),this.isConnected=NO,this):this},fromPropertyDidChange:function(e,t){var n=e?e.get(t):null;if(n!==this._bindingValue||t==="[]")this._setBindingValue(e,t),this._changePending=YES,SC.Binding._changeQueue.add(this),this._scheduleSync()},toPropertyDidChange:function(e,t){if(this._oneWay)return;var n=e.get(t);n!==this._transformedBindingValue&&(this._setBindingValue(e,t),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(e,t){this._bindingSource=e,this._bindingKey=t},_computeBindingValue:function(){var e=this._bindingSource,t=this._bindingKey,n,r;this._bindingValue=n=e?e.getPath(t):null;var i=this._transforms;if(i){var s=i.length,o;for(r=0;r<s;r++)o=i[r],n=o(n,this)}this._noError&&SC.typeOf(n)===SC.T_ERROR&&(n=null),this._transformedBindingValue=n},_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 e=NO,t=SC.LOG_BINDINGS,n,r;while((n=this._connectQueue).length>0){this._connectQueue=this._alternateConnectQueue,this._alternateConnectQueue=n;while(r=n.pop())r._connect()}while((n=this._changeQueue).length>0){e=YES,this._changeQueue=this._alternateChangeQueue,this._alternateChangeQueue=n;while(r=n.pop())r.applyBindingValue()}return this._isFlushing=NO,SC.Observers.resumePropertyObserving(),e},applyBindingValue:function(){this._changePending=NO,this._computeBindingTargets(),this._computeBindingValue();var e=this._bindingValue,t=this._transformedBindingValue,n=SC.BENCHMARK_BINDING_NOTIFICATIONS,r=SC.LOG_BINDINGS;!this._oneWay&&this._fromTarget&&this._fromTarget.setPathIfChanged(this._fromPropertyKey,e),this._toTarget&&this._toTarget.setPathIfChanged(this._toPropertyKey,t)},sync:function(){if(!this.isConnected)return this;if(this._connectionPending)this
._syncOnConnect=YES;else{this._computeBindingTargets();var e=this._fromTarget,t=this._fromPropertyKey;if(!e||!t)return this;if(!e.isObservable)return SC.Logger.warn("Cannot bind '%@' to property '%@' on non-observable '%@'".fmt(this._toPropertyPath,t,e)),this;var n=e.getPath(t);if(n!==this._bindingValue||t==="[]")this._setBindingValue(e,t),this._changePending=YES,SC.Binding._changeQueue.add(this)}return this},_syncOnConnect:NO,_computeBindingTargets:function(){if(!this._fromTarget){var e,t,n;e=this._fromPropertyPath,t=this._fromRoot,typeof e=="string"&&(e.indexOf(".")===0?(e=e.slice(1),t||(t=this._toRoot)):e.indexOf("*")===0&&(e=[t||this._toRoot,e.slice(1)],t=null)),n=SC.tupleForPropertyPath(e,t),n&&(this._fromTarget=n[0],this._fromPropertyKey=n[1])}this._toTarget||(e=this._toPropertyPath,t=this._toRoot,n=SC.tupleForPropertyPath(e,t),n&&(this._toTarget=n[0],this._toPropertyKey=n[1]))},oneWay:function(e,t){t===undefined&&SC.typeOf(e)===SC.T_BOOL&&(t=e,e=null);var n=this.from(e);return n===SC.Binding&&(n=n.beget()),n._oneWay=t===undefined?YES:t,n},transform:function(e){var t=this===SC.Binding?this.beget():this,n=t._transforms;return n&&n===t.parentBinding._transforms&&(n=t._transforms=n.slice()),n||(n=t._transforms=[]),n.push(e),t},resetTransforms:function(){var e=this===SC.Binding?this.beget():this;return e._transforms=null,e},noError:function(e,t){t===undefined&&SC.typeOf(e)===SC.T_BOOL&&(t=e,e=null);var n=this.from(e);return n===SC.Binding&&(n=n.beget()),n._noError=t===undefined?YES:t,n},single:function(e,t){return t===undefined&&(t=SC.MULTIPLE_PLACEHOLDER),this.from(e).transform
(function(e,n){if(e&&e.isEnumerable){var r=e.get("length");e=r>1?t:r<=0?null:e.firstObject()}return e})},notEmpty:function(e,t){return t===undefined&&(t=SC.EMPTY_PLACEHOLDER),this.from(e).transform(function(e,n){if(SC.none(e)||e===""||SC.isArray(e)&&e.length===0)e=t;return e})},notNull:function(e,t){return t===undefined&&(t=SC.EMPTY_PLACEHOLDER),this.from(e).transform(function(e,n){return SC.none(e)&&(e=t),e})},multiple:function(e){return this.from(e).transform(function(e){return SC.isArray(e)||(e=e==null?[]:[e]),e})},bool:function(e){return this.from(e).transform(function(e){var t=SC.typeOf(e);return t===SC.T_ERROR?e:t==SC.T_ARRAY?e.length>0:e===""?NO:!!e})},and:function(e,t){var n=SC.Object.create({valueABinding:e,valueBBinding:t,and:function(){return this.get("valueA")&&this.get("valueB")}.property("valueA","valueB").cacheable()});return this.from("and",n).oneWay()},or:function(e,t){var n=SC.Object.create({valueABinding:e,valueBBinding:t,or:function(){return this.get("valueA")||this.get("valueB")}.property("valueA","valueB").cacheable()});return this.from("or",n).oneWay()},not:function(e){return this.from(e).transform(function(e){var t=SC.typeOf(e);return t===SC.T_ERROR?e:!(t==SC.T_ARRAY?e.length>0:e===""?NO:!!e)})},isNull:function(e){return this.from(e).transform(function(e){var t=SC.typeOf(e);return t===SC.T_ERROR?e:SC.none(e)})},toString:function(){var e=this._fromRoot?"<%@>:%@".fmt(this._fromRoot,this._fromPropertyPath):this._fromPropertyPath,t=this._toRoot?"<%@>:%@".fmt(this._toRoot,this._toPropertyPath):this._toPropertyPath,n=this._oneWay?"[oneWay]":"";return"SC.Binding%@(%@ -> %@)%@"
.fmt(SC.guidFor(this),e,t,n)}},SC.binding=function(e,t){return SC.Binding.from(e,t)},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(e,t,n,r){var i={message:e};return t!==undefined&&(i.label=t),r!==undefined&&(i.code=r),n!==undefined&&(i.errorValue=n),this.create(i)},SC.$error=function(e,t,n,r){return SC.Error.desc(e,t,n,r)},SC.ok=function(e){return e!==!1&&(!e||!e.isError)},SC.$ok=SC.ok,SC.val=function(e){return e&&e.isError?e.get?e.get("errorValue"):null:e},SC.$val=SC.val,SC.Error.HAS_MULTIPLE_VALUES=-100,SC.IndexSet=SC.mixin({},SC.Enumerable,SC.Observable,SC.Freezable,SC.Copyable,{_sc_sliceContent:function(e){if(e.length<1e3)return e.slice();var t=0,n=[],r=e[0];while(r!==0)n[t]=r,t=r<0?0-r:r,r=e[t];return n[t]=0,this._hint(0,t,n),n},create:function(e,t){var n=SC.beget(this);return n.initObservable(),n.registerDependentKey("min","[]"),e&&e.isIndexSet?(n._content=this._sc_sliceContent(e._content),n.max=e.max,n.length=e.length,n.source=e.source):(n._content=[0],e!==undefined&&n.add(e,t)),n},isIndexSet:YES,HINT_SIZE:256,length:0,max:0,min:function(){var e=this._content,t=e[0];return t===0?-1:t>0?0:Math.abs(t)}.property("[]").cacheable(),firstObject:function(){return this.get("length")>0?this.get("min"):undefined}.property(),rangeStartForIndex:function(e){var t=this._content,n=this.get("max"),r,i,s;if(e>=n)return n;if(Math.abs(t[e])>e)return e;s=e-e%SC
.IndexSet.HINT_SIZE,r=t[s];if(r<0||r>e)r=s;i=Math.abs(t[r]);while(i<e)r=i,i=Math.abs(t[r]);return r},isEqual:function(e){if(e===this)return YES;if(!e||!e.isIndexSet||e.max!==this.max||e.length!==this.length)return NO;var t=this._content,n=e._content,r=0,i=t[r];do{if(n[r]!==i)return NO;r=Math.abs(i),i=t[r]}while(r!==0);return YES},indexBefore:function(e){if(e===0)return-1;e--;var t=this._content,n=this.get("max"),r=this.rangeStartForIndex(e);if(!t)return null;while(r===n||t[r]<0){if(r===0)return-1;e=r-1,r=this.rangeStartForIndex(e)}return e},indexAfter:function(e){var t=this._content,n=this.get("max"),r,i;if(!t||e>=n)return-1;e++,r=this.rangeStartForIndex(e),i=t[r];while(i<0){if(i===0)return-1;e=r=Math.abs(i),i=t[r]}return e},contains:function(e,t){var n,r,i,s,o;if(t===undefined){if(e===null||e===undefined)return NO;if(typeof e===SC.T_NUMBER)t=1;else{if(e&&e.isIndexSet){if(e===this)return YES;n=e._content,r=0,i=n[r];while(i!==0){if(i>0&&!this.contains(r,i-r))return NO;r=Math.abs(i),i=n[r]}return YES}t=e.length,e=e.start}}return s=this.rangeStartForIndex(e),o=this._content[s],o>0&&s<=e&&o>=e+t},intersects:function(e,t){var n,r,i,s;if(t===undefined)if(typeof e===SC.T_NUMBER)t=1;else{if(e&&e.isIndexSet){if(e===this)return YES;n=e._content,r=0,i=n[r];while(i!==0){if(i>0&&this.intersects(r,i-r))return YES;r=Math.abs(i),i=n[r]}return NO}t=e.length,e=e.start}r=this.rangeStartForIndex(e),n=this._content,i=n[r],s=e+t;while(r<s){if(i===0)return NO;if(i>0&&i>e)return YES;r=Math.abs(i),i=n[r]}return NO},without:function(e,t){return e===this?SC.IndexSet.create():this.clone().remove(e,t)},
replace:function(e,t){if(t===undefined)if(typeof e===SC.T_NUMBER)t=1;else{if(e&&e.isIndexSet)return this._content=this._sc_sliceContent(e._content),this.beginPropertyChanges().set("max",e.max).set("length",e.length).set("source",e.source).enumerableContentDidChange(),this.endPropertyChanges(),this;t=e.length,e=e.start}var n=this.length;return this._content.length=1,this._content[0]=0,this.length=this.max=0,this.add(e,t)},add:function(e,t){if(this.isFrozen)throw SC.FROZEN_ERROR;var n,r,i;if(e&&e.isIndexSet){n=e._content;if(!n)return this;r=0,i=n[0];while(i!==0)i>0&&this.add(r,i-r),r=i<0?0-i:i,i=n[r];return this}if(t===undefined){if(e===null||e===undefined)return this;typeof e===SC.T_NUMBER?t=1:(t=e.length,e=e.start)}else t===null&&(t=1);if(t<=0)return this;var s=this.get("max"),o=s,u,a;n=this._content;if(e===s)e>0?(r=this.rangeStartForIndex(e-1),i=n[r],i>0?(delete n[s],n[r]=s=e+t,e=r):n[s]=s=e+t):n[e]=s=t,n[s]=0,this.set("max",s),this.set("length",this.length+t),t=s-e;else if(e>s)n[s]=0-e,n[e]=e+t,n[e+t]=0,this.set("max",e+t),this.set("length",this.length+t),t=e+t-s,e=s;else{r=this.rangeStartForIndex(e),i=n[r],s=e+t,u=0,e>0&&r===e&&i<=0&&(r=this.rangeStartForIndex(e-1),i=n[r]),i<0?(n[r]=0-e,Math.abs(i)>s?(n[e]=0-s,n[s]=i):n[e]=i):(e=r,i>s&&(s=i)),r=e;while(r<s)a=n[r],a===0?(n[s]=0,i=s,u+=s-r):(i=Math.abs(a),i>s&&(n[s]=a,i=s),a<0&&(u+=i-r)),delete n[r],r=i;(r=n[s])>0&&(delete n[s],s=r),n[e]=s,s>o&&this.set("max",s),this.set("length",this.get("length")+u),t=s-e}return this._hint(e,t),u!==0&&this.enumerableContentDidChange(),this},remove:function(e,t){if(this.isFrozen)throw SC.FROZEN_ERROR
;if(t===undefined){if(e===null||e===undefined)return this;if(typeof e===SC.T_NUMBER)t=1;else{if(e.isIndexSet)return e.forEachRange(this.remove,this),this;t=e.length,e=e.start}}if(t<=0)return this;var n=this.get("max"),r=n,i=this._content,s,o,u,a,f;if(e>=n)return this;s=this.rangeStartForIndex(e),o=i[s],f=e+t,u=0;var l=this.HINT_SIZE,c=e-e%l+l;Math.abs(i[c])===e&&(i[c]=0),e>0&&s===e&&o>0&&(s=this.rangeStartForIndex(e-1),o=i[s]),o>0?(i[s]=e,o>f?(i[e]=f,i[f]=o):i[e]=o):(e=s,o=Math.abs(o),o>f&&(f=o)),s=e;while(s<f)a=i[s],a===0?(i[f]=0,o=f):(o=Math.abs(a),o>f&&(i[f]=a,o=f),a>0&&(u+=o-s)),delete i[s],s=o;return(s=i[f])<0&&(delete i[f],f=Math.abs(s)),i[f]===0?(delete i[f],i[e]=0,this.set("max",e)):i[e]=0-f,this.set("length",this.get("length")-u),t=f-e,this._hint(e,t),u!==0&&this.enumerableContentDidChange(),this},_hint:function(e,t,n){n===undefined&&(n=this._content);var r=SC.IndexSet.HINT_SIZE,i=Math.abs(n[e]),s=e-e%r+r,o=e+t;while(s<o){while(i!==0&&i<=s)e=i,i=Math.abs(n[e]);i===0?delete n[s]:s!==e&&(n[s]=-e),s+=r}},clear:function(){if(this.isFrozen)throw SC.FROZEN_ERROR;var e=this.length;this._content.length=1,this._content[0]=0,this.set("length",0).set("max",0),e>0&&this.enumerableContentDidChange()},addEach:function(e){if(this.isFrozen)throw SC.FROZEN_ERROR;this.beginPropertyChanges();var t=e.get("length");if(e.isSCArray)while(--t>=0)this.add(e.objectAt(t));else e.isEnumerable&&e.forEach(function(e){this.add(e)},this);return this.endPropertyChanges(),this},removeEach:function(e){if(this.isFrozen)throw SC.FROZEN_ERROR;this.beginPropertyChanges();var t=e.get("length");if(e.isSCArray
)while(--t>=0)this.remove(e.objectAt(t));else e.isEnumerable&&e.forEach(function(e){this.remove(e)},this);return this.endPropertyChanges(),this},clone:function(){return SC.IndexSet.create(this)},inspect:function(){var e=this._content,t=e.length,n=0,r=[],i;for(n=0;n<t;n++)i=e[n],i!==undefined&&r.push("%@:%@".fmt(n,i));return"SC.IndexSet<%@>".fmt(r.join(" , "))},forEachRange:function(e,t){var n=this._content,r=0,i=n[r],s=this.source;t===undefined&&(t=null);while(i!==0)i>0&&e.call(t,r,i-r,this,s),r=Math.abs(i),i=n[r];return this},forEachIn:function(e,t,n,r){var i=this._content,s=0,o=0,u=e+t,a=this.source,f=i[s];r===undefined&&(r=null);while(f!==0){s<e&&(s=e);while(s<f&&s<u)n.call(r,s++,o++,this,a);s>=u?s=f=0:(s=Math.abs(f),f=i[s])}return this},lengthIn:function(e,t){var n=0;if(t===undefined){if(e===null||e===undefined)return 0;if(typeof e===SC.T_NUMBER)t=1;else{if(e.isIndexSet)return e.forEachRange(function(e,t){n+=this.lengthIn(e,t)},this),n;t=e.length,e=e.start}}if(this.get("length")===0)return 0;var r=this._content,i=0,s=r[i],o=e+t;while(i<o&&s!==0)s>0&&(n+=s>o?o-i:s-i),i=Math.abs(s),s=r[i];return n},source:null,indexOf:function(e,t){var n=this.source;if(!n)throw"%@.indexOf() requires source".fmt(this);var r=n.get("length"),i=this._content,s=i[0]<0?Math.abs(i[0]):0,o;while(s>=0&&s<r){o=n.indexOf(e,s);if(o<0)return-1;if(this.contains(o))return o;s=o+1}return-1},lastIndexOf:function(e,t){var n=this.source;if(!n)throw"%@.lastIndexOf() requires source".fmt(this);var r=n.get("length"),i=this.max-1,s;i>=r&&(i=r-1);while(i>=0){s=n.lastIndexOf(e,i);if(s<0)return-1;if(this.contains(s
))return s;i=s+1}return-1},forEachObject:function(e,t){var n=this.source;if(!n)throw"%@.forEachObject() requires source".fmt(this);var r=this._content,i=0,s=0,o=r[i];t===undefined&&(t=null);while(o!==0){while(i<o)e.call(t,n.objectAt(i),i,n,this),i++;i=Math.abs(o),o=r[i]}return this},addObject:function(e,t){var n=this.source;if(!n)throw"%@.addObject() requires source".fmt(this);var r=n.get("length"),i=0,s;while(i>=0&&i<r){s=n.indexOf(e,i);if(!(s>=0))return this;this.add(s);if(t)return this;i=s++}return this},addObjects:function(e,t){return e.forEach(function(e){this.addObject(e,t)},this),this},removeObject:function(e,t){var n=this.source;if(!n)throw"%@.removeObject() requires source".fmt(this);var r=n.get("length"),i=0,s;while(i>=0&&i<r){s=n.indexOf(e,i);if(!(s>=0))return this;this.remove(s);if(t)return this;i=s+1}return this},removeObjects:function(e,t){return e.forEach(function(e){this.removeObject(e,t)},this),this},LOG_OBSERVING:NO,forEach:function(e,t){var n=this._content,r=0,i=0,s=this.source,o=n[r];t===undefined&&(t=null);while(o!==0){while(r<o)e.call(t,r++,i++,this,s);r=Math.abs(o),o=n[r]}return this},nextObject:function(e,t,n){var r=this._content,i=n.next,s=this.get("max");if(t===null)t=i=0;else{if(t>=s)return delete n.next,null;t++}if(t===i){do t=Math.abs(i),i=r[t];while(i<0);n.next=i}return t<i?t:null},toString:function(){var e=[];return this.forEachRange(function(t,n){e.push(n===1?t:"%@..%@".fmt(t,t+n-1))},this),"SC.IndexSet<%@>".fmt(e.join(","))}}),SC.IndexSet.slice=SC.IndexSet.copy=SC.IndexSet.clone,SC.IndexSet.EMPTY=SC.IndexSet.create().freeze(),SC.json={encode:
function(e){return JSON.stringify(e)},decode:function(e){return JSON.parse(e)}},this.JSON||(this.JSON={}),function(){function f(e){return e<10?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,i,s,o=gap,u,a=t[e];a&&typeof a=="object"&&typeof a.toJSON=="function"&&(a=a.toJSON(e)),typeof rep=="function"&&(a=rep.call(t,e,a));switch(typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a)return"null";gap+=indent,u=[];if(Object.prototype.toString.apply(a)==="[object Array]"){s=a.length;for(n=0;n<s;n+=1)u[n]=str(n,a)||"null";return i=u.length===0?"[]":gap?"[\n"+gap+u.join(",\n"+gap)+"\n"+o+"]":"["+u.join(",")+"]",gap=o,i}if(rep&&typeof rep=="object"){s=rep.length;for(n=0;n<s;n+=1)r=rep[n],typeof r=="string"&&(i=str(r,a),i&&u.push(quote(r)+(gap?": ":":")+i))}else for(r in a)Object.hasOwnProperty.call(a,r)&&(i=str(r,a),i&&u.push(quote(r)+(gap?": ":":")+i));return i=u.length===0?"{}":gap?"{\n"+gap+u.join(",\n"+gap)+"\n"+o+"}":"{"+u.join(",")+"}",gap=o,i}}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(e){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(
e){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","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;typeof JSON.stringify!="function"&&(JSON.stringify=function(e,t,n){var r;gap="",indent="";if(typeof n=="number")for(r=0;r<n;r+=1)indent+=" ";else typeof n=="string"&&(indent=n);rep=t;if(!t||typeof t=="function"||typeof t=="object"&&typeof t.length=="number")return str("",{"":e});throw new Error("JSON.stringify")}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){function walk(e,t){var n,r,i=e[t];if(i&&typeof i=="object")for(n in i)Object.hasOwnProperty.call(i,n)&&(r=walk(i,n),r!==undefined?i[n]=r:delete i[n]);return reviver.call(e,t,i)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.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,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),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(e,t){SC.Logger._handleMessage(SC.LOGGER_LEVEL_DEBUG,YES,e,arguments)},debugWithoutFmt:function(){this._handleMessage(SC.LOGGER_LEVEL_DEBUG,NO,null,arguments)},debugGroup:function(e,t){SC.Logger._handleGroup(SC.LOGGER_LEVEL_DEBUG,e,arguments)},debugGroupEnd:function(){SC.Logger._handleGroupEnd(SC.LOGGER_LEVEL_DEBUG)},info:function(e,t){SC.Logger._handleMessage(SC.LOGGER_LEVEL_INFO,YES,e,arguments)},infoWithoutFmt:function(){this._handleMessage(SC.LOGGER_LEVEL_INFO,NO,null,arguments)},infoGroup:function(e,t){SC.Logger._handleGroup(SC.LOGGER_LEVEL_INFO,e,arguments)},infoGroupEnd:function(){SC.Logger._handleGroupEnd(SC.LOGGER_LEVEL_INFO)},warn:function(e,t){SC.Logger._handleMessage(SC.LOGGER_LEVEL_WARN,YES,e,arguments)},warnWithoutFmt:function(){this._handleMessage(SC.LOGGER_LEVEL_WARN,NO,null,arguments)},warnGroup:function(e,t){SC.Logger._handleGroup(SC.LOGGER_LEVEL_WARN,e,arguments)},warnGroupEnd:function(){SC.Logger._handleGroupEnd(SC.LOGGER_LEVEL_WARN)},error:function(e,t){
SC.Logger._handleMessage(SC.LOGGER_LEVEL_ERROR,YES,e,arguments)},errorWithoutFmt:function(){this._handleMessage(SC.LOGGER_LEVEL_ERROR,NO,null,arguments)},errorGroup:function(e,t){SC.Logger._handleGroup(SC.LOGGER_LEVEL_ERROR,e,arguments)},errorGroupEnd:function(){SC.Logger._handleGroupEnd(SC.LOGGER_LEVEL_ERROR)},outputRecordedLogMessages:function(e){if(!this.get("exists"))return;var t=this.get("reporter"),n=this.get("recordedLogMessages"),r=0,i=SC.LOGGER_RECORDED_LOG_TIMESTAMP_PREFIX,s,o,u,a,f,l,c,h,p,d,v,m,g;if(n)for(s=0,o=n.length;s<o;++s){u=n[s],a=u.type,e&&(f=i.fmt(u.timestamp.toUTCString())),l=u.message;if(l)c=u.originalArguments,this._outputMessage(a,f,r,l,c);else{d=u.indentation,p=u.title,v=d-r;if(t.group){if(Math.abs(v)>1)for(m=0,g=v-1;m<g;++m)v>0?t.group():t.groupEnd();v>0?(h=f?f:"",h+=p,t.group(h)):t.groupEnd()}else v>0&&this._outputGroup(a,f,d-1,p);r=d}}},stringifyRecordedLogMessages:function(){var e="",t=this.get("recordedLogMessages"),n=0,r=SC.LOGGER_RECORDED_LOG_TIMESTAMP_PREFIX,i=this._LOG_FALLBACK_PREFIX_MAPPING,s=SC.LOGGER_LOG_GROUP_HEADER,o,u,a,f,l,c,h,p,d,v,m;if(t)for(o=0,u=t.length;o<u;++o)a=t[o],f=a.type,h=r.fmt(a.timestamp.toUTCString()),h+=i[f]||"",l=a.message,l?(c=a.originalArguments,p=h+this._indentation(n),p+=c?this._argumentsToString(c):l):(v=a.indentation,d=a.title,m=v-n,m>0&&(p=h+this._indentation(n)+s.fmt(d)),n=v),e+=p+"\n";return e},log:function(){var e=this.get("reporter"),t=arguments[0],n=this.get("messagePrefix"),r=this.get("outputMessagePrefix"),i=NO;return t&&SC.typeOf(t)===SC.T_STRING&&(n||r)&&(n&&(t=n+t),r&&(t=r+t),arguments[0]=t),this.get
("exists")&&(typeof e.log=="function"?(e.log.apply(e,arguments),i=YES):e.log&&(e.log(this._argumentsToArray(arguments)),i=YES)),!i&&this.get("fallBackOnAlert")&&(this.get("exists")&&typeof e.alert=="function"?(e.alert(arguments),i=YES):(alert(arguments),i=YES)),i},group:function(e){var t=this.get("reporter");this.get("exists")&&typeof t.group=="function"&&t.group(e)},groupEnd:function(){var e=this.get("reporter");this.get("exists")&&typeof e.groupEnd=="function"&&e.groupEnd()},dir:function(){var e=this.get("reporter");this.get("exists")&&typeof e.dir=="function"?e.dir.apply(e,arguments):this.log.apply(this,arguments)},dirxml:function(){var e=this.get("reporter");this.get("exists")&&typeof e.dirxml=="function"?e.dirxml.apply(e,arguments):this.log.apply(this,arguments)},profile:function(e){var t=this.get("reporter");return this.get("exists")&&typeof t.profile=="function"?(t.profile(e),YES):NO},profileEnd:function(e){var t=this.get("reporter");return this.get("exists")&&typeof t.profileEnd=="function"?(t.profileEnd(e),YES):NO},time:function(e){var t=this.get("reporter");return this.get("exists")&&typeof t.time=="function"?(t.time(e),YES):NO},timeEnd:function(e){var t=this.get("reporter");return this.get("exists")&&typeof t.timeEnd=="function"?(t.timeEnd(e),YES):NO},trace:function(){var e=this.get("reporter");return this.get("exists")&&typeof e.trace=="function"?(e.trace(),YES):NO},init:function(){arguments.callee.base.apply(this,arguments),this.get("logOutputLevel")||(SC.buildMode==="debug"?this.set("logOutputLevel",SC.LOGGER_LEVEL_DEBUG):this.set("logOutputLevel",SC.LOGGER_LEVEL_INFO
)),this.debugEnabledDidChange()},debugEnabledDidChange:function(){this.get("debugEnabled")&&this.set("logOutputLevel",SC.LOGGER_LEVEL_DEBUG)}.observes("debugEnabled"),_handleMessage:function(e,t,n,r){var i=this._shouldOutputType(e),s=this._shouldRecordType(e),o,u,a,f,l,c,h,p,d;if(!i&&!s)return;o=r&&r.length>1,t&&(SC.none(n)||typeof n!="string")&&(t=NO);if(t&&o){f=[];for(u=1,a=r.length;u<a;++u)f.push(r[u]);n=n.fmt.apply(n,f)}h=this.get("messagePrefix"),h&&(n=h+n),i&&(p=this.get("outputMessagePrefix"),f=t?null:r,this._outputMessage(e,null,this._outputIndentationLevel,p?p+n:n,f)),s&&(d=this.get("recordedMessagePrefix"),c={type:e,message:n?d?d+n:n:YES,timestamp:new Date},!t&&o&&(c.originalArguments=r),this._addRecordedMessageEntry(c))},_handleGroup:function(e,t,n){var r=this._shouldOutputType(e),i=this._shouldRecordType(e),s,o,u,a,f,l,c,h,p,d,v;if(!r&&!i)return;s=n&&n.length>1;if(t&&s){a=[];for(o=1,u=n.length;o<u;++o)a.push(n[o]);t=t.fmt.apply(t,a)}r&&(this._outputGroup(e,null,this._outputIndentationLevel,t),this._outputIndentationLevel++),i&&(d=++this._recordingIndentationLevel,v={type:e,indentation:d,beginGroup:YES,title:t,timestamp:new Date},this._addRecordedMessageEntry(v))},_handleGroupEnd:function(e){var t=this._shouldOutputType(e),n=this._shouldRecordType(e),r,i,s,o;if(!t&&!n)return;t&&(this._outputIndentationLevel--,this.get("exists")&&(r=this.get("reporter"),i=r.groupEnd,i&&i.call(r))),n&&(s=--this._recordingIndentationLevel,o={type:e,indentation:s,timestamp:new Date},this._addRecordedMessageEntry(o))},_shouldOutputType:function(e){var t=this._LOG_LEVEL_MAPPING,n=t[e]||0
,r=t[this.get("logOutputLevel")]||0;return n<=r},_shouldRecordType:function(e){var t=this._LOG_LEVEL_MAPPING,n=t[e]||0,r=t[this.get("logRecordingLevel")]||0;return n<=r},_outputMessage:function(e,t,n,r,i){if(!this.get("exists"))return;var s=this.get("reporter"),o,u,a,f,l,c;u=!s.group,a=s[e],a?i?(l=this._argumentsToArray(i),f="",t&&(f=t),u&&(f+=this._indentation(n)),f&&l.splice(0,0,f),a.apply?a.apply(s,l):s[e](l)):(o=t?t:"",u&&(o+=this._indentation(n)),o+=r,s[e](o)):s.log&&(f="",t&&(f=t),f+=this._LOG_FALLBACK_PREFIX_MAPPING[e]||"",u&&(f+=this._indentation(n)),i?(l=this._argumentsToArray(i),f&&l.splice(0,0,f),s.log(l)):s.log(f+r))},_outputGroup:function(e,t,n,r){if(!this.get("exists"))return;var i=this.get("reporter"),s=i.group,o;s?(o=t?t:"",o+=r,s.call(i,o)):i.log&&(o="",t&&(o=t),o+=this._LOG_FALLBACK_PREFIX_MAPPING[e]||"",o+=this._indentation(n),o+=SC.LOGGER_LOG_GROUP_HEADER.fmt(r),i.log(o))},_addRecordedMessageEntry:function(e){var t=this.get("recordedLogMessages"),n;t||(t=[],this.set("recordedLogMessages",t)),t.push(e),n=t.length,n>this.get("recordedLogMessagesMaximumLength")&&t.splice(0,n-this.get("recordedLogMessagesPruningMinimumLength")),t.enumerableContentDidChange()},_argumentsToArray:function(e){var t=[],n,r;if(e)for(n=0,r=e.length;n<r;++n)t[n]=e[n];return t},_argumentsToString:function(){var e="",t=SC.LOGGER_LOG_DELIMITER,n,r;for(n=0,r=arguments.length-1;n<r;++n)e+=arguments[n]+t;return e+=arguments[r],e},_indentation:function(e){if(!e||e<0)e=0;var t="",n=SC.LOGGER_LOG_GROUP_INDENTATION,r;for(r=0;r<e;++r)t+=n;return t},_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.RunLoop=SC.Object.extend({beginRunLoop:function(){return this._start=(new Date).getTime(),this._runLoopInProgress=YES,this},isRunLoopInProgress:function(){return this._runLoopInProgress}.property(),endRunLoop:function(){return this.flushAllPending(),this._start=null,SC.RunLoop.lastRunLoopEnd=Date.now(),this._runLoopInProgress=NO,this},flushAllPending:function(){var e=!0;while(e)e=this.flushApplicationQueues(),e||(e=this._flushinvokeLastQueue())},invokeOnce:function(e,t){t===undefined&&(t=e,e=this);var n;return typeof t=="string"&&(t=e[t]),this._invokeQueue||(this._invokeQueue=SC.ObserverSet.create()),t&&this._invokeQueue.add(e,t,undefined,n),this},invokeLast:function(e,t){t===undefined&&(t=e,e=this);var n;return typeof t=="string"&&(t=e[t]),this._invokeLastQueue||(this._invokeLastQueue=SC.ObserverSet.create()),this._invokeLastQueue.add(e,t,undefined,n),this},flushApplicationQueues:function(){var e=NO,t=this._invokeQueue;return t&&t.getMembers().length&&(this._invokeQueue=null,e=YES,t.invokeMethods()),SC.Binding.flushPendingChanges()||e},_flushinvokeLastQueue:function(){var e=this._invokeLastQueue,t=NO;return e&&e.getMembers().length&&(this._invokeLastQueue=null,t=YES,t&&e.invokeMethods()),t}}),SC.RunLoop.currentRunLoop=null,SC.RunLoop.runLoopClass=SC.RunLoop,SC.RunLoop.begin=function(){var e=
this.currentRunLoop;return e||(e=this.currentRunLoop=this.runLoopClass.create()),e.beginRunLoop(),this},SC.RunLoop.end=function(){var e=this.currentRunLoop;if(!e)throw"SC.RunLoop.end() called outside of a runloop!";return e.endRunLoop(),this},SC.RunLoop.kill=function(){return this.currentRunLoop=this.runLoopClass.create(),this},SC.RunLoop.isRunLoopInProgress=function(){return this.currentRunLoop?this.currentRunLoop.get("isRunLoopInProgress"):NO},SC.run=function(e,t,n){var r=SC.RunLoop.isRunLoopInProgress(),i;if(SC.ExceptionHandler&&SC.ExceptionHandler.enabled)try{(n||!r)&&SC.RunLoop.begin(),e&&(i=e.call(t)),(n||!r)&&SC.RunLoop.end()}catch(s){var o=SC.ExceptionHandler.handleException(s);if(!o&&!SC.browser.msie)throw s}else(n||!r)&&SC.RunLoop.begin(),e&&(i=e.call(t)),(n||!r)&&SC.RunLoop.end();return i},SC.RunLoop.wrapFunction=function(e){var t=function(){var t=SC.$A(arguments),n=this;return SC.run(function(){return e.apply(n,t)})};return t.wrapped=e,t},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(e,t){return SC.mixin(SC.STRINGS,t),this}}),SC.Controller=SC.Object.extend({isEditable:YES,destroyContentOnReplace:NO,contentObjectDidChanged:function(){var e,t;if(!this.get("destroyContentOnReplace"))return;e=this._oldContent,t=this
.get("content"),e&&t!==e&&e.destroy&&e.destroy(),this._oldContent=t}.observes("content")}),SC.SelectionSupport={hasSelectionSupport:YES,allowsSelection:YES,allowsMultipleSelection:YES,allowsEmptySelection:YES,firstSelectableObject:function(){return this.get("firstObject")}.property(),selection:function(e,t){var n=this._scsel_selection,r=n?n.get("length"):0,i,s=this.get("arrangedObjects"),o;if(t===undefined||!this.get("allowsSelection"))t=n;return o=t&&t.isEnumerable?t.get("length"):0,o>1&&!this.get("allowsMultipleSelection")&&(r>1?(t=SC.SelectionSet.create().addObject(n.get("firstObject")).freeze(),o=1):(t=n,o=r)),o===0&&!this.get("allowsEmptySelection")&&s&&s.get("length")!==0&&(r===0?(t=this.get("firstSelectableObject"),t?t=SC.SelectionSet.create().addObject(t).freeze():t=SC.SelectionSet.EMPTY,o=t.get("length")):(t=n,o=r)),o===0&&(t=SC.SelectionSet.EMPTY),t!==n&&(t=t.frozenCopy()),this._scsel_selection=t,t}.property("arrangedObjects","allowsEmptySelection","allowsMultipleSelection","allowsSelection").cacheable(),hasSelection:function(){var e=this.get("selection");return!!e&&e.get("length")>0}.property("selection").cacheable(),selectObjects:function(e,t){if(!e||e.get("length")===0)return t||this.set("selection",SC.SelectionSet.EMPTY),this;var n=this.get("selection");return t&&n?n=n.copy():n=SC.SelectionSet.create(),n.addObjects(e).freeze(),this.set("selection",n),this},selectObject:function(e,t){return e===null?(t||this.set("selection",null),this):this.selectObjects([e],t)},deselectObjects:function(e){if(!e||e.get("length")===0)return this;var t=this.get("selection");return!
t||t.get("length")===0?this:(t=t.copy().removeObjects(e).freeze(),this.set("selection",t.freeze()),this)},deselectObject:function(e){return e?this.deselectObjects([e]):this},updateSelectionAfterContentChange:function(){var e=this.get("arrangedObjects"),t=this.get("selection"),n=this.get("allowsEmptySelection"),r;if(!t)return this;r=t.indexSetForSource(e);if(r&&r.get("length")!==t.get("length")||!r&&t.get("length")>0)t=t.copy().constrain(e).freeze(),this.set("selection",t);return t.get("length")===0&&e&&e.get("length")>0&&!n&&this.selectObject(this.get("firstSelectableObject"),NO),this}},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 e=this.get("content"),t;return t=!!e&&this.get("isEditable")&&this.get("hasContent"),t?!e.isEnumerable||SC.typeOf(e.removeObject)===SC.T_FUNCTION:NO}.property("content","isEditable","hasContent"),canReorderContent:function(){var e=this.get("content"),t;return t=!!e&&this.get("isEditable")&&!this.get("orderBy"),t&&!!e.isSCArray}.property("content","isEditable","orderBy"),canAddContent:function(){var e=this.get("content"),t;return t=e&&this.get("isEditable")&&e.isEnumerable,t?SC.typeOf(e.addObject)===SC.T_FUNCTION||SC.typeOf(e.pushObject)===SC.T_FUNCTION:NO}.property("content","isEditable"),hasContent:function(){var e=this.get("content");return!!e&&(!!e.isEnumerable||!!this.get("allowsSingleContent"))}.property("content","allowSingleContent"),status
:function(){var e=this.get("content"),t=e?e.get("status"):null;return t?t:SC.Record.READY}.property().cacheable(),addObject:function(e){if(!this.get("canAddContent"))throw"%@ cannot add content".fmt(this);var t=this.get("content");if(t.isSCArray)t.pushObject(e);else{if(!t.addObject)throw"%@.content does not support addObject".fmt(this);t.addObject(e)}return this},removeObject:function(e){if(!this.get("canRemoveContent"))throw"%@ cannot remove content".fmt(this);var t=this.get("content");return t.isEnumerable?t.removeObject(e):this.set("content",null),this.get("destroyOnRemoval")&&e.destroy&&e.destroy(),this},length:function(){var e=this._scac_observableContent();return e?e.get("length"):0}.property().cacheable(),objectAt:function(e){var t=this._scac_observableContent();return t?t.objectAt(e):undefined},replace:function(e,t,n){if(!n||n.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 r=this.get("content"),i=[],s,o;if(this.get("destroyOnRemoval"))for(s=0;s<t;s++)i.push(r.objectAt(s+e));r&&r.replace(e,t,n);for(s=0,o=i.length;s<o;s++)i[s].destroy();return i=null,this},indexOf:function(e,t){var n=this._scac_observableContent();return n?n.indexOf(e,t):-1},init:function(){arguments.callee.base.apply(this,arguments),this._scac_contentDidChange()},_scac_cached:NO,_scac_observableContent:function(){var e=this._scac_cached;if(e)return e;var t=this.get("content"),n,r,i;if(SC.none(t))return this._scac_cached=[];if(!
t.isEnumerable)return e=this.get("allowsSingleContent")?[t]:[],this._scac_cached=e;var s=this.get("orderBy");if(!s){if(t.isSCArray)return this._scac_cached=t;throw"%@.orderBy is required for unordered content".fmt(this)}var o=SC.typeOf(s);if(o===SC.T_STRING)s=[s];else if(o===SC.T_FUNCTION)n=s;else if(o!==SC.T_ARRAY)throw"%@.orderBy must be Array, String, or Function".fmt(this);return n=n||function(e,t){var n,r,o,u;for(var a=0,f=s.get("length");a<f&&!n;a++)r=s.objectAt(a),o=r.match(/^(ASC )?(DESC )?(.*)$/),r=o[3],i=o[2]?-1:1,e&&(e=e.isObservable?e.get(r):e[r]),t&&(t=t.isObservable?t.get(r):t[r]),n=SC.compare(e,t)*i;return n},this._scac_cached=t.toArray().sort(n)},propertyWillChange:function(e){if(e!=="content")return arguments.callee.base.apply(this,arguments);this.arrayContentWillChange(0,this.get("length"),0)},_scac_arrayContentWillChange:function(e,t,n){this.arrayContentWillChange(e,t,n);if(this._kvo_enumerable_property_chains){var r=this.slice(e,e+t);this.teardownEnumerablePropertyChains(r)}},_scac_arrayContentDidChange:function(e,t,n){var r=this._scac_observableContent(),i=r?r.get("length"):0;this._scac_length=i,this._scac_cached=NO,this.notifyPropertyChange("length");if(this._kvo_enumerable_property_chains){var s=this.slice(e,e+n);this.setupEnumerablePropertyChains(s)}this.updateSelectionAfterContentChange(),this.arrayContentDidChange(e,t,n)},_scac_contentDidChange:function(){this._scac_cached=NO;var e=this.get("content"),t=!!this.get("orderBy"),n=this._scac_content,r=this._scac_length||0,i=this._scac_arrayContentDidChange,s=this._scac_arrayContentWillChange,o=this._scac_contentStatusDidChange
,u=this._scac_enumerableDidChange,a;if(e===n)return this;this.arrayContentWillChange(0,r,a),n&&(n.isSCArray?n.removeArrayObservers({target:this,didChange:i,willChange:s}):n.isEnumerable&&n.removeObserver("[]",this,u),n.removeObserver("status",this,o),this.teardownEnumerablePropertyChains(n)),this._scac_cached=NO,this._scac_content=e,e?(e.isSCArray?(e.addArrayObservers({target:this,didChange:i,willChange:s}),a=e.get("length")):e.isEnumerable?(e.addObserver("[]",this,u),a=e.get("length")):a=1,e.addObserver("status",this,o),this.setupEnumerablePropertyChains(e)):a=SC.none(e)?0:1,this._scac_length=a,this._scac_contentStatusDidChange(),this.arrayContentDidChange(0,r,a),this.updateSelectionAfterContentChange()}.observes("content"),_scac_enumerableDidChange:function(){var e=this.get("content"),t=e?e.get("length"):0,n=this._scac_length;this._scac_length=t,this.beginPropertyChanges(),this._scac_cached=NO,this.arrayContentDidChange(0,n,t),this.endPropertyChanges(),this.updateSelectionAfterContentChange()}.observes("orderBy"),_scac_contentStatusDidChange:function(){this.notifyPropertyChange("status")}}),SC.ObjectController=SC.Controller.extend({content:null,allowsMultipleContent:NO,hasContent:function(){return!SC.none(this.get("observableContent"))}.property("observableContent"),isEditable:YES,observableContent:function(){var e=this.get("content"),t,n;if(e&&e.isEnumerable){t=e.get("length"),n=this.get("allowsMultipleContent");if(t===1)e=e.firstObject();else if(t===0||!n)e=null;e&&!n&&e.isEnumerable&&(e=null)}return e}.property("content","allowsMultipleContent").cacheable(),destroy:function(
){var e=this.get("observableContent");return e&&SC.typeOf(e.destroy)===SC.T_FUNCTION&&e.destroy(),this.set("content",null),this},contentPropertyDidChange:function(e,t){t==="*"?this.allPropertiesDidChange():this.notifyPropertyChange(t)},unknownProperty:function(e,t){if(e==="content")return t!==undefined&&(this.content=t),this.content;var n=this.get("observableContent"),r,i,s;if(n===null||n===undefined)return undefined;if(t===undefined)if(n.isEnumerable){t=n.getEach(e),r=t.get("length");if(r>0){s=YES,i=t.objectAt(0);while(--r>0&&s)i!==t.objectAt(r)&&(s=NO);s&&(t=i)}else t=undefined}else t=n.isObservable?n.get(e):n[e];else{if(!this.get("isEditable"))throw"%@.%@ is not editable".fmt(this,e);n.isEnumerable?n.setEach(e,t):n.isObservable?n.set(e,t):n[e]=t}return t},init:function(){arguments.callee.base.apply(this,arguments),this.get("content")&&this._scoc_contentDidChange(),this.get("observableContent")&&this._scoc_observableContentDidChange()},_scoc_contentDidChange:function(){var e=this._scoc_content,t=this.get("content");if(e!==t){this._scoc_content=t;var n=this._scoc_enumerableContentDidChange;e&&e.isEnumerable&&e.removeObserver("[]",this,n),t&&t.isEnumerable&&t.addObserver("[]",this,n)}}.observes("content"),_scoc_observableContentDidChange:function(){var e=this._scoc_observableContent,t=this.get("observableContent"),n=this.contentPropertyDidChange,r=this._scoc_enumerableContentDidChange;if(e===t)return this;this._scoc_observableContent=t,e&&(e.isEnumerable?e.removeObserver("[]",this,r):e.isObservable&&e.removeObserver("*",this,n)),t&&(t.isEnumerable?t.addObserver("[]",this,r):
t.isObservable&&t.addObserver("*",this,n)),e&&e.isEnumerable||t&&t.isEnumerable?this._scoc_enumerableContentDidChange():this.contentPropertyDidChange(t,"*")}.observes("observableContent"),_scoc_enumerableContentDidChange:function(){var e=this.get("observableContent"),t=this._scoc_observableContentItems,n=this.contentPropertyDidChange;return t&&(t.forEach(function(e){e.isObservable&&e.removeObserver("*",this,n)},this),t.clear()),e&&e.isEnumerable?(t||(t=SC.Set.create()),e.forEach(function(e){if(t.contains(e))return;t.add(e),e.isObservable&&e.addObserver("*",this,n)},this)):t=null,this._scoc_observableContentItems=t,this.contentPropertyDidChange(e,"*"),this}}),SC.mixin(Function.prototype,{invokeLater:function(e,t){t===undefined&&(t=1);var n=this;if(arguments.length>2){var r=SC.$A(arguments).slice(2,arguments.length);r.unshift(e);var i=n;n=function(){return i.apply(this,r.slice(1))}}return SC.Timer.schedule({target:e,action:n,interval:t})}}),SC.mixin(SC.Object.prototype,{invokeLater:function(e,t){t===undefined&&(t=1);var n=e,r,i;return arguments.length>2&&(r=SC.$A(arguments).slice(2),SC.typeOf(n)===SC.T_STRING&&(n=this[e]),i=n,n=function(){return i.apply(this,r)}),SC.Timer.schedule({target:this,action:n,interval:t})},invokeOnceLater:function(e,t){t===undefined&&(t=1);var n=this._sc_invokeOnceLaterTimers,r,i,s,o;return SC.typeOf(e)===SC.T_STRING&&(e=this[e]),r=SC.guidFor(e),n||(this._sc_invokeOnceLaterTimers=n={}),i=n[r],i&&i.invalidate(),s=function(){return delete n[r],e.apply(this,arguments)},o=SC.Timer.schedule({target:this,action:s,interval:t}),n[r]=o,o},invokeWith:function(
e,t,n){n===undefined&&(n=t,t=this),t||(t=this),SC.typeOf(n)===SC.T_STRING&&(n=t[n]);var r=this.getPath(e);return n.call(t,r,this),this}}),SC.RunLoop=SC.RunLoop.extend({startTime:function(){return this._start||(this._start=Date.now()),this._start}.property(),endRunLoop:function(){this.fireExpiredTimers();var e=arguments.callee.base.apply(this,arguments);return this.scheduleNextTimeout(),e},scheduleTimer:function(e,t){return this._timerQueue=e.removeFromTimerQueue(this._timerQueue),this._timerQueue=e.scheduleInTimerQueue(this._timerQueue,t),this},cancelTimer:function(e){return this._timerQueue=e.removeFromTimerQueue(this._timerQueue),this},TIMER_ARRAY:[],fireExpiredTimers:function(){if(!this._timerQueue||this._firing)return NO;var e=this.get("startTime"),t=this.TIMER_ARRAY,n,r,i;this._firing=YES,this._timerQueue=this._timerQueue.collectExpiredTimers(t,e),r=t.length;for(n=0;n<r;n++)t[n].fire();return i=t.length>0,t.length=0,this._firing=NO,i},scheduleNextTimeout:function(){var e=this._timerQueue,t=NO;if(!e)this._timeout&&clearTimeout(this._timeout);else{var n=e._timerQueueRunTime;if(this._timeoutAt!==n){this._timeout&&clearTimeout(this._timeout);var r=Math.max(0,n-Date.now());this._timeout=setTimeout(this._timeoutDidFire,r),this._timeoutAt=n}t=YES}return t},_timeoutDidFire:function(){var e=SC.RunLoop.currentRunLoop;e._timeout=e._timeoutAt=null,SC.run()}}),SC.RunLoop.currentRunLoop=SC.RunLoop.create(),SC.RunLoop.runLoopClass=SC.RunLoop,SC.Locale=SC.Object.extend({init:function(){this.language||SC.Locale._assignLocales();if(!this.hasStrings){var e=this._deprecatedLanguageCodes||[
];e.push(this.language);var t=e.length,n=null;while(!n&&--t>=0)n=String[e[t]];n&&(this.hasStrings=YES,this.strings=n)}},hasStrings:NO,strings:{},metrics:{},toString:function(){return this.language||SC.Locale._assignLocales(),"SC.Locale["+this.language+"]"+SC.guidFor(this)},locWithDefault:function(e,t){var n=this.strings[e];return SC.typeOf(n)===SC.T_STRING?n:SC.typeOf(t)===SC.T_STRING?t:e},locMetric:function(e){var t=this.metrics[e];return SC.typeOf(t)===SC.T_NUMBER?t:t===undefined?(SC.warn('No localized metric found for key "'+e+'"'),undefined):(SC.warn('Unexpected metric type for key "'+e+'"'),undefined)},locLayout:function(e,t){var n,r,i,s,o,u=SC.Locale.layoutKeys,a=this.metrics,f=SC.typeOf,l=SC.T_NUMBER,c={};t&&SC.mixin(c,t);for(n=0,r=u.length;n<r;++n){i=u[n],s=e+"."+i,o=a[s];if(f(o)===l){if(t&&t[i])throw"locLayout(): There is a localized value for the key '"+s+"' but a value for '"+i+"' was also specified in the non-localized hash";c[i]=o}}return c}}),SC.Locale.mixin({useAutodetectedLanguage:NO,preferredLanguage:null,layoutKeys:["left","top","right","bottom","width","height","minWidth","minHeight","centerX","centerY"],createCurrentLocale:function(){var e=String.useAutodetectedLanguage!==undefined?String.useAutodetectedLanguage:this.useAutodetectedLanguage,t=String.preferredLanguage!==undefined?String.preferredLanguage:this.preferredLanguage,n=(e?SC.browser.language:null)||t||SC.browser.language||"en";n=SC.Locale.normalizeLanguage(n);var r=this.localeClassFor(n);return n!=this.currentLanguage&&(this.currentLanguage=n,this.currentLocale=r.create()),this.currentLocale},localeClassFor
:function(e){e=SC.Locale.normalizeLanguage(e);var t,n=this.locales[e];return!n&&(t=e.split("-")[0])!==e&&(n=this.locales[t])&&(n=this.locales[e]=n.extend()),n||(n=this.locales[e]=this.locales.en.extend()),n},define:function(e,t){var n;return t===undefined&&SC.typeOf(e)!==SC.T_STRING?(n=this,t=e):n=SC.Locale.localeClassFor(e),SC.mixin(n.prototype,t),n},options:function(){return this.prototype},addStrings:function(e){var t=this.prototype.strings;return t?this.prototype.hasOwnProperty("strings")||(this.prototype.strings=SC.clone(t)):t=this.prototype.strings={},e&&(this.prototype.strings=SC.mixin(t,e)),this.prototype.hasStrings=YES,this},addMetrics:function(e){var t=this.prototype.metrics;return t?this.prototype.hasOwnProperty(t)||(this.prototype.metrics=SC.clone(t)):t=this.prototype.metrics={},e&&(this.prototype.metrics=SC.mixin(t,e)),this},_map:{english:"en",french:"fr",german:"de",japanese:"ja",jp:"ja",spanish:"es"},normalizeLanguage:function(e){return e?SC.Locale._map[e.toLowerCase()]||e:"en"},_assignLocales:function(){for(var e in this.locales)this.locales[e].prototype.language=e},toString:function(){return this.prototype.language||SC.Locale._assignLocales(),"SC.Locale["+this.prototype.language+"]"},extend:function(){var e=SC.Object.extend.apply(this,arguments);return e.addStrings=SC.Locale.addStrings,e.define=SC.Locale.define,e.options=SC.Locale.options,e.toString=SC.Locale.toString,e}}),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(e,t){var n=SC.Locale.localeClassFor(e);return n.addStrings(t),this},SC.metricsFor=function(e,t){var n=SC.Locale.localeClassFor(e);return n.addMetrics(t),this},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(e){return e.charAt(0).toUpperCase()+e.slice(1)},camelize:function(e){var t=e.replace(SC.STRING_TITLEIZE_REGEXP,function(e,t,n){return n?n.toUpperCase():""}),n=t.charAt(0),r=n.toLowerCase();return n!==r?r+t.slice(1):t},decamelize:function(e){return e.replace(SC.STRING_DECAMELIZE_REGEXP,"$1_$2").toLowerCase()},dasherize:function(e){var t=SC.STRING_DASHERIZE_CACHE,n=t[e];return n?n:(n=SC.String.decamelize(e).replace(SC.STRING_DASHERIZE_REGEXP,"-"),t[e]=n,n)},loc:function(e){SC.Locale.currentLocale||SC.Locale.createCurrentLocale();var t=SC.Locale.currentLocale.locWithDefault(e);SC.typeOf(t)!==SC.T_STRING&&(t=e);var n=SC.$A(arguments);n.shift(),n.length>0&&n[0].isSCArray&&(n=n[0]);try{return SC.String.fmt(t,n)}catch(r){SC.error("Error processing string with key: "+e),SC.error("Localized String: "+t),SC.error("Error: "+r)}},locMetric:function(e){var t=SC.Locale,n=t.currentLocale;return n||(t.createCurrentLocale(),n=t.currentLocale),n.locMetric(e)},locLayout:function(e,t){var n=SC.Locale,r=n.currentLocale
;return r||(n.createCurrentLocale(),r=n.currentLocale),r.locLayout(e,t)},locWithDefault:function(e,t){SC.Locale.currentLocale||SC.Locale.createCurrentLocale();var n=SC.Locale.currentLocale.locWithDefault(e,t);SC.typeOf(n)!==SC.T_STRING&&(n=e);var r=SC.$A(arguments);return r.shift(),r.shift(),SC.String.fmt(n,r)},trim:jQuery.trim,trimLeft:function(e){return e.replace(SC.STRING_TRIM_LEFT_REGEXP,"")},trimRight:function(e){return e.replace(SC.STRING_TRIM_RIGHT_REGEXP,"")},mult:function(e,t){if(SC.typeOf(t)!==SC.T_NUMBER||t<1)return null;var n="";for(var r=0;r<t;r+=1)n+=e;return n}}),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(e){return SC.String.locLayout(this.toString(),e)}}),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 e=SC.$A(arguments);return e.unshift(this),SC.String.loc.apply(SC.String,e)},locWithDefault:function(e){var t=SC.$A(arguments);return t.unshift(this),SC.String.locWithDefault.apply(SC.String,t)},mult:function(e){return SC.String.
mult(this,e)}}),SC.DelegateSupport={delegateFor:function(e){var t=1,n=arguments.length,r;while(t<n){r=arguments[t];if(r&&r[e]!==undefined)return r;t++}return this[e]!==undefined?this:null},invokeDelegateMethod:function(e,t,n){n=SC.A(arguments),n=n.slice(2,n.length);if(!e||!e[t])e=this;var r=e[t];return r?r.apply(e,n):null},getDelegateProperty:function(e,t){var n=1,r=arguments.length,i;while(n<r){i=arguments[n++];if(i&&i[e]!=undefined)return i.get?i.get(e):i[e]}return this[e]!=undefined?this.get(e):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 e=this.get("pane")||this.get("responderContext")||this.pane();return e&&this.get("acceptsFirstResponder")&&e.get("firstResponder")!==this&&e.makeFirstResponder(this),this},resignFirstResponder:function(e){var t=this.get("pane")||this.get("responderContext");return t&&t.get("firstResponder")===this&&(this.get("isPane")||t.set("lastViewFirstResponder",this),t.makeFirstResponder(null,e)),YES},willLoseFirstResponder:function(e){},didBecomeFirstResponder:function(e){},sendAction:function(e,t){return SC.RootResponder.responder.sendAction(e,null,this,null,t,this)}}),SC.ResponderContext={isResponderContext:YES,trace:NO,defaultResponder:null,nextResponder:function(){return this.get("defaultResponder")}.property("defaultResponder").cacheable(),firstResponder:null,nextResponderFor:function(e){var t=e.get("nextResponder");return typeof t===SC.T_STRING?t=SC.objectForPropertyPath
(t,this):!t&&e!==this&&(t=this),t},responderNameFor:function(e){if(!e)return"(No Responder)";if(e._scrc_name)return e._scrc_name;var t=this.NAMESPACE;return this._findResponderNamesFor(this,3,t?[this.NAMESPACE]:[]),e._scrc_name||e.toString()},_findResponderNamesFor:function(e,t,n){var r,i;for(r in e){if(r==="nextResponder")continue;i=e[r];if(i&&i.isResponder){if(i._scrc_name)continue;n.push(r),i._scrc_name=n.join("."),t>0&&this._findResponderNamesFor(i,t-1,n),n.pop()}}},makeFirstResponder:function(e,t){var n=this.get("firstResponder"),r=this.get("nextResponder"),i=this.get("trace"),s;if(this._locked){i&&SC.Logger.log("%@: AFTER ACTION: makeFirstResponder => %@".fmt(this,this.responderNameFor(e))),this._pendingResponder=e;return}i&&SC.Logger.log("%@: makeFirstResponder => %@".fmt(this,this.responderNameFor(e))),e&&e.set("becomingFirstResponder",YES),this._locked=YES,this._pendingResponder=null,s=e?e:null;while(s){if(s.get("hasFirstResponder"))break;s=s===r?null:this.nextResponderFor(s)}return s||(s=r),this._notifyWillLoseFirstResponder(n,n,s,t),n&&n.set("isFirstResponder",NO),this.beginPropertyChanges(),this.set("firstResponder",e),e&&e.set("isFirstResponder",YES),this._notifyDidBecomeFirstResponder(e,e,s),this.endPropertyChanges(),this._locked=NO,this._pendingResponder&&(this.makeFirstResponder(this._pendingResponder),this._pendingResponder=null),e&&e.set("becomingFirstResponder",NO),this},_notifyWillLoseFirstResponder:function(e,t,n,r){if(!t||t===n)return;t.willLoseFirstResponder(e,r),t.set("hasFirstResponder",NO);var i=this.nextResponderFor(t);i&&this._notifyWillLoseFirstResponder
(e,i,n)},_notifyDidBecomeFirstResponder:function(e,t,n){if(!t||t===n)return;var r=this.nextResponderFor(t);r&&this._notifyDidBecomeFirstResponder(e,r,n),t.set("hasFirstResponder",YES),t.didBecomeFirstResponder(e)},resetFirstResponder:function(){var e=this.get("firstResponder");if(!e)return;e.willLoseFirstResponder(),e.didBecomeFirstResponder()},sendAction:function(e,t,n){var r=this.get("firstResponder"),i=this.get("nextResponder"),s=this.get("trace"),o=NO,u;this._locked=YES,s&&SC.Logger.log("%@: begin action '%@' (%@, %@)".fmt(this,e,t,n)),!o&&!r&&this.tryToPerform&&(o=this.tryToPerform(e,t,n));while(!o&&r)r.tryToPerform&&(o=r.tryToPerform(e,t,n)),o||(r=r===i?null:this.nextResponderFor(r));s&&(o?SC.Logger.log("%@: action '%@' handled by %@".fmt(this,e,this.responderNameFor(r))):SC.Logger.log("%@: action '%@' NOT HANDLED".fmt(this,e))),this._locked=NO;if(u=this._pendingResponder)this._pendingResponder=null,this.makeFirstResponder(u);return r}},SC.bodyOverflowArbitrator=SC.Object.create({requestHidden:function(e,t){this._makeRequest(e,-1-9*!!t)},requestVisible:function(e,t){this._makeRequest(e,1+9*!!t)},withdrawRequest:function(e){if(!e)return;var t=SC.guidFor(e);this._requests[t]&&delete this._requests[t],this.setOverflow()},setOverflow:function(){var e=this._decideOverflow();e!==undefined&&(document.body.style.overflow=e?"auto":"hidden")},_makeRequest:function(e,t){if(!e)return;var n=SC.guidFor(e);this._requests[n]=t,this.setOverflow()},_requests:{},_decideOverflow:function(){var e,t,n,r,i=this._requests,s;for(var o in i)(s=i[o])<0&&(e=YES),s<-1&&(n=YES),s>0&&(t=YES),s>1&&(
r=YES);return r?YES:t&&n?NO:t?YES:e?NO:undefined}}),SC.mixin(SC.browser,{compareVersion:function(){if(this._versionSplit===undefined){var e=function(e){return Number(e.match(/^[0-9]+/))};this._versionSplit=SC.A(this.version.split(".")).map(e)}var t=SC.A(arguments).map(Number);for(var n=0;n<t.length;n++){var r=this._versionSplit[n]-t[n];if(isNaN(r))return 0;if(r!==0)return r}return 0}}),SC.Builder=function(e){return SC.Builder.create(e)},SC.Builder.create=function(t){var n=SC.mixin(SC.beget(this.fn),t||{});t.hasOwnProperty("toString")&&(n.toString=t.toString);var r=function(){var e=SC.beget(n);return e.defaultClass=this,e.constructor=r,e.init.apply(e,arguments)};return r.fn=r.prototype=n,r.extend=SC.Builder.create,r.mixin=SC.Builder.mixin,r},SC.Builder.mixin=function(){var e=arguments.length,t;for(t=0;t<e;t++)SC.mixin(this,arguments[t]);return this},SC.Builder.fn={init:function(e){if(e!==undefined)if(SC.typeOf(e)===SC.T_ARRAY){var t=e.length;while(--t>=0)this[t]=e.objectAt?e.objectAt(t):e[t];this.length=e.length}else this[0]=e,this.length=1;return this},size:function(){return this.length},pushStack:function(){var e=this.constructor.apply(this,arguments);return e.prevObject=this,e},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 e=SC.Enumerable,t=SC.Builder.fn,n,r;for(n in e){if(!e.hasOwnProperty(n))continue;r=Array.prototype[n]||e[n],t[n]=r}}(),SC.$=SC.CoreQuery=jQuery,SC.mixin(SC.$.fn,{isCoreQuery:YES,toString:function(
){var e=[],t=this.length,n=0;for(n=0;n<t;n++)e[n]="%@: %@".fmt(n,this[n]?this[n].toString():"(null)");return"<$:%@>(%@)".fmt(SC.guidFor(this),e.join(" , "))},isVisible:function(){return Array.prototype.every.call(this,function(e){return SC.$.isVisible(e)})},view:function(){return this.map(function(){var e=null,t=SC.viewKey,n=this,r;while(!e&&n&&n!==document)n.nodeType===1&&(r=n.getAttribute("id"))&&(e=SC.View.views[r]),n=n.parentNode;return n=null,e})},within:function(e){return this.filter(e).length?!0:!!this.has(e).length}}),function(){var e={},t={find:function(t,n){return n!==undefined?SC.Enumerable.find.call(this,t,n):e.find.call(this,t)},filter:function(t,n){return n!==undefined?this.pushStack(SC.Enumerable.filter.call(this,t,n)):e.filter.call(this,t)},filterProperty:function(e,t){return this.pushStack(SC.Enumerable.filterProperty.call(this,e,t))},indexOf:SC.$.index,map:function(t,n){return n!==undefined?SC.Enumerable.map.call(this,t,n):e.map.call(this,t)}},n=SC.$.fn,r=SC.Enumerable,i;for(var s in r)r.hasOwnProperty(s)&&(i=r[s],s in t&&(e[s]=n[s],i=t[s]),n[s]=i)}(),SC.mixin(SC.$,{isVisible:function(e){var t=SC.$;return"hidden"!=e.type&&t.css(e,"display")!="none"&&t.css(e,"visibility")!="hidden"}}),SC.Event=function(e){var t,n;if(e){this.originalEvent=e;var r=SC.Event._props,i;n=r.length,t=n;while(--t>=0)i=r[t],this[i]=e[i]}this.timeStamp=this.timeStamp||Date.now(),this.target||(this.target=this.srcElement||document),this.target.nodeType===3&&(this.target=this.target.parentNode),!this.relatedTarget&&this.fromElement&&(this.relatedTarget=this.fromElement===this.target?this
.toElement:this.fromElement);if(SC.none(this.pageX)&&!SC.none(this.clientX)){var s=document.documentElement,o=document.body;this.pageX=this.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s.clientLeft||0),this.pageY=this.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s.clientTop||0)}!this.which&&(this.charCode||e.charCode===0?this.charCode:this.keyCode)&&(this.which=this.charCode||this.keyCode),!this.metaKey&&this.ctrlKey&&(this.metaKey=this.ctrlKey),!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"||this.type==="wheel"){var u=SC.Event.MOUSE_WHEEL_MULTIPLIER;(SC.browser.webkit||SC.browser.edge)&&e.wheelDelta!==undefined?(this.wheelDelta=0-(e.wheelDeltaY||e.wheelDeltaX),this.wheelDeltaY=0-(e.wheelDeltaY||0),this.wheelDeltaX=0-(e.wheelDeltaX||0)):!SC.none(e.detail)&&SC.browser.mozilla?e.axis&&e.axis===e.HORIZONTAL_AXIS?(this.wheelDeltaX=e.detail,this.wheelDeltaY=this.wheelDelta=0):(this.wheelDeltaY=this.wheelDelta=e.detail,this.wheelDeltaX=0):!SC.none(e.deltaX)&&SC.browser.msie?(this.wheelDeltaY=e.deltaY||0,this.wheelDeltaX=e.deltaX||0,this.wheelDelta=this.wheelDeltaY||this.wheelDeltaX):(this.wheelDelta=this.wheelDeltaY=SC.browser.msie||SC.browser.opera?0-e.wheelDelta:e.wheelDelta,this.wheelDeltaX=0),this.wheelDelta*=u,this.wheelDeltaX*=u,this.wheelDeltaY*=u}return this},SC.mixin(SC.Event,{MOUSE_WHEEL_MULTIPLIER:function(){var e=1,t=parseFloat(SC.browser.version);return SC.browser.safari?(e=.4,t>=533.17&&t<534?e=.004:t<533&&(e=40)):SC.browser.msie?e=.3
:SC.browser.chrome&&(e=.4),e}(),MOUSE_WHEEL_DELTA_LIMIT:1e3,_MOUSE_WHEEL_LIMIT_INVALIDATED:NO,create:function(e){return new SC.Event(e)},add:function(e,t,n,r,i,s){if(e&&e.isCoreQuery){if(e.length>0)return e.forEach(function(e){this.add(e,t,n,r,i)},this),this;e=e[0]}if(!e)return this;s||(s=NO);if(e.nodeType===3||e.nodeType===8)return SC.Event;SC.typeOf(n)===SC.T_FUNCTION?(i=r,r=n,n=null):n&&SC.typeOf(r)===SC.T_STRING&&(r=n[r]);var o=SC.data(e,"sc_events")||SC.data(e,"sc_events",{}),u=o[t];return u||(u=o[t]={},this._addEventListener(e,t,s)),u[SC.hashFor(n,r)]=[n,r,i],SC.Event._global[t]=YES,e=o=u=null,this},remove:function(e,t,n,r){if(e&&e.isCoreQuery){if(e.length>0)return e.forEach(function(e){this.remove(e,t,n,r)},this),this;e=e[0]}if(!e)return this;if(e.nodeType===3||e.nodeType===8)return SC.Event;var i,s,o=SC.data(e,"sc_events");if(!o)return this;if(t===undefined)for(t in o)this.remove(e,t);else if(i=o[t]){var u=NO;if(n||r){SC.typeOf(n)===SC.T_FUNCTION?(r=n,n=null):SC.typeOf(r)===SC.T_STRING&&(r=n[r]),delete i[SC.hashFor(n,r)],s=null;for(s in i)break;s===null&&(u=YES)}else u=YES;u&&(delete o[t],this._removeEventListener(e,t)),s=null;for(s in o)break;s||(SC.removeData(e,"sc_events"),delete this._elements[SC.guidFor(e)])}return e=o=i=null,this},NO_BUBBLE:["blur","focus","change"],simulateEvent:function(e,t,n){var r=SC.Event.create({type:t,target:e,preventDefault:function(){this.cancelled=YES},stopPropagation:function(){this.bubbles=NO},allowDefault:function(){this.hasCustomEventHandling=YES},timeStamp:Date.now(),bubbles:this.NO_BUBBLE.indexOf(t)<0,cancelled:NO,normalized:YES
});return n&&SC.mixin(r,n),r},trigger:function(e,t,n,r){if(e&&e.isCoreQuery){if(e.length>0)return e.forEach(function(e){this.trigger(e,t,n,r)},this),this;e=e[0]}if(!e)return this;if(e.nodeType===3||e.nodeType===8)return undefined;n=SC.A(n);var i,s=SC.typeOf(e[t]||null)===SC.T_FUNCTION,o,u,a,f;o=n[0];if(!o||!o.preventDefault)o=this.simulateEvent(e,t),n.unshift(o);o.type=t,u=e;do i=SC.Event.handle.apply(u,n),u=u===document?null:u.parentNode||document;while(!i&&o.bubbles&&u);u=null,a=e["on"+t],f=SC.$.nodeName(e,"a")&&t==="click",(!s||f)&&a&&a.apply(e,n)===NO&&(i=NO);if(s&&r!==NO&&i!==NO&&!f){this.triggered=YES;try{e[t]()}catch(l){}}return this.triggered=NO,i},handle:function(e){if(typeof SC=="undefined"||SC.Event.triggered)return YES;var t,n,r,i,s,o,u,a,f,l;o=SC.A(arguments),o[0]=e=SC.Event.normalizeEvent(e||window.event),s=(SC.data(this,"sc_events")||{})[e.type];if(!s)return NO;for(u in s)a=s[u],f=a[1],e.handler=f,e.data=e.context=a[2],l=a[0]||this,n=f.apply(l,o),t!==NO&&(t=n),n===NO&&(e.preventDefault(),e.stopPropagation());return t},unload:function(){var e,t=this._elements;for(e in t)this.remove(t[e]);for(e in t)delete t[e];delete this._elements},special:{ready:{setup:function(){SC._bindReady();return},teardown:function(){return}},mouseenter:{setup:function(){return SC.browser.msie?NO:(SC.Event.add(this,"mouseover",SC.Event.special.mouseenter.handler),YES)},teardown:function(){return SC.browser.msie?NO:(SC.Event.remove(this,"mouseover",SC.Event.special.mouseenter.handler),YES)},handler:function(e){return SC.Event._withinElement(e,this)?YES:(e.type="mouseenter",SC.Event.handle
.apply(this,arguments))}},mouseleave:{setup:function(){return SC.browser.msie?NO:(SC.Event.add(this,"mouseout",SC.Event.special.mouseleave.handler),YES)},teardown:function(){return SC.browser.msie?NO:(SC.Event.remove(this,"mouseout",SC.Event.special.mouseleave.handler),YES)},handler:function(e){return SC.Event._withinElement(e,this)?YES:(e.type="mouseleave",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(e,t){var n=e.relatedTarget;while(n&&n!==t)try{n=n.parentNode}catch(r){n=t}return n===t},_addEventListener:function(e,t,n){var r,i=this.special[t];n||(n=NO);if(!i||i.setup.call(e)===NO){var s=SC.guidFor(e);this._elements[s]=e,r=SC.data(e,"listener")||SC.data(e,"listener",function(){return SC.Event.handle.apply(SC.Event._elements[s],arguments)}),e.addEventListener?e.addEventListener(t,r,n):e.attachEvent&&e.attachEvent("on"+t,r)}e=i=r=null},_removeEventListener:function(e,t){var n,r=SC.Event.special[t];if(!r||r.teardown.call(e)===NO)n=SC.data(e,"listener"),n&&(e.removeEventListener?e.removeEventListener(t,n,NO):e.detachEvent&&e.detachEvent("on"+t,n));e=r=n=null},_elements:{},normalizeEvent:function(e){return e===window.event?SC.Event.create(e):e.normalized?e:SC.Event.create(e)},_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(e){if(this.touchContext)return this.touchContext.touchesForView(e)},touchesForResponder:function(e){if(this.touchContext)return this.touchContext.touchesForView(e)},averagedTouchesForView:function(e){return this.touchContext?this.touchContext.averagedTouchesForView(e):null},allowDefault:function(){return this.hasCustomEventHandling=YES,this},preventDefault:function(){var e=this.originalEvent;return e&&(e.preventDefault&&e.preventDefault(),e.returnValue=NO),this.hasCustomEventHandling=YES,this},stopPropagation:function(){var e=this.originalEvent;return e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=YES),this.hasCustomEventHandling=YES,this},stop:function(){return this.preventDefault().stopPropagation()},normalized:YES,getCharString:function(){if(SC.browser.msie){if(this.keyCode==8||this.keyCode==9||this.keyCode>=37&&this.keyCode<=40)return String.fromCharCode(0);var e=this.keyCode>=96&&this.keyCode<=105?this.charCode:this.keyCode;return e>0?String.fromCharCode(e):null}return this.charCode>0?String.fromCharCode(this.charCode):null},commandCodes:function(){var e=this.keyCode,t=null,n=null,r="",i;if(e){t=SC.FUNCTION_KEYS[e],!t&&(this.altKey||this.ctrlKey||this.metaKey)&&(t=SC.PRINTABLE_KEYS[e]);if(t){this.altKey&&(r+="alt_");if(this.ctrlKey||this.metaKey)r+="ctrl_";this.shiftKey&&(r+="shift_")}}return t||(e=this.which,e>95&&e<106&&(e-=48),n=t=String.fromCharCode(e),i=t.toLowerCase(),this.metaKey?(r="meta_",t=i):t=null),t&&(t=r+t),[t,n]}},SC.Event.observe=SC.Event.add,SC.Event.stopObserving=
SC.Event.remove,SC.Event.fire=SC.Event.trigger,SC.browser.msie&&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 e=this.get("cursorStyle")||SC.DEFAULT_CURSOR,t=this.constructor.sharedStyleSheet(),n=SC.guidFor(this);return t.insertRule?
t.insertRule("."+n+" {cursor: "+e+";}",t.cssRules?t.cssRules.length:0):t.addRule&&t.addRule("."+n,"cursor: "+e),this.cursorStyle=e,this.className=n,this},className:null,cursorStyle:SC.DEFAULT_CURSOR,cursorStyleDidChange:function(){var e,t,n,r,i,s,o;e=this.get("cursorStyle")||SC.DEFAULT_CURSOR,t=this._rule;if(t){t.style.cursor=e;return}n="."+this.get("className"),r=this.constructor.sharedStyleSheet(),i=(r.cssRules?r.cssRules:r.rules)||[];for(s=0,o=i.length;s<o;++s){t=i[s];if(t.selectorText===n){this._rule=t,t.style.cursor=e;break}}}.observes("cursorStyle")}),SC.Cursor.sharedStyleSheet=function(){var e,t=this._styleSheet;return t||(t=document.createElement("style"),t.type="text/css",e=document.getElementsByTagName("head")[0],e||(e=document.documentElement),e.appendChild(t),t=document.styleSheets[document.styleSheets.length-1],this._styleSheet=t),t},SC.Theme={isTheme:YES,classNames:SC.CoreSet.create(),_extend_class_names:function(e){if(e)if(SC.typeOf(e)===SC.T_HASH&&!e.isSet)for(var t in e)e[t]?this.classNames.add(t):this.classNames.remove(t);else typeof e=="string"?this.classNames.addEach(e.split(" ")):this.classNames.addEach(e)},_extend_self:function(e){e.classNames&&this._extend_class_names(e.classNames);var t,n,r;for(t in e){if(t==="classNames")continue;if(!e.hasOwnProperty(t))continue;n=e[t],n instanceof Function&&!n.base&&n!==(r=this[t])&&(n.base=r),this[t]=n}},create:function(){var e=SC.beget(this);e.baseTheme=this,this.themes===SC.Theme.themes?(e.themes={},e._themeIsUnrelated={}):(e.themes=SC.beget(this.themes),e._themeIsUnrelated=SC.beget(this._themeIsUnrelated)),e._privateThemes=
{},e._specializedThemes={},e.classNames=SC.clone(this.classNames);var t=arguments,n=t.length,r,i;for(r=0;r<n;r++)e._extend_self(t[r]);return e.name&&e.classNames.add(e.name),e},subtheme:function(e){var t=this.create({name:e});return this.addTheme(t),t},invisibleSubtheme:function(e){var t=this.create({name:e});return this._privateThemes[e]=t,t},themes:{},_themeIsUnrelated:{},find:function(e,t){if(this===SC.Theme)return this.themes[e];var n;n=this._privateThemes[e];if(n)return n;n=this._specializedThemes[e];if(n)return n;n=this.themes[e];if(n&&this._themeIsUnrelated[e])return n;if(n&&!this._specializedThemes[e])return this._specializedThemes[e]=n.create({classNames:this.classNames});if(t)return;return n=SC.Theme.themes[e],n?n:null},addTheme:function(e){this.themes[e.name]=e,this._themeIsUnrelated[e.name]=NO},addUnrelatedTheme:function(e){this.themes[e.name]=e,this._themeIsUnrelated[e.name]=YES}},SC.BaseTheme=SC.Theme.create({name:""}),SC.Theme.themes["sc-base"]=SC.BaseTheme,SC.defaultTheme="sc-base",SC.CoreView=SC.Responder.extend(SC.DelegateSupport),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,ariaLabel:null,pane:function(){var e=this;while(e&&!e.isPane)e=e.get("parentView");return e}.property("parentView").cacheable(),page:null,parentView:null
,isVisible:YES,isVisibleBindingDefault:SC.Binding.bool(),isVisibleInWindow:YES,childViews:SC.EMPTY_CHILD_VIEWS_ARRAY,layer:function(e,t){if(t!==undefined)this._view_layer=t;else{t=this._view_layer;if(!t){var n=this.get("parentView");n&&(n=n.get("layer")),n&&(this._view_layer=t=this.findLayerInParentLayer(n))}}return t}.property("isVisibleInWindow").cacheable(),$:function(e){var t=this.get("layer");return t?e===undefined?SC.$(t):SC.$(e,t):SC.$()},containerLayer:function(){return this.get("layer")}.property("layer").cacheable(),layerId:function(e,t){return t&&(this._layerId=t),this._layerId?this._layerId:SC.guidFor(this)}.property().cacheable(),findLayerInParentLayer:function(e){var t="#"+this.get("layerId");return jQuery(t)[0]||jQuery(t,e)[0]},isDescendantOf:function(e){var t=this.get("parentView");return this===e?YES:t?t.isDescendantOf(e):NO},displayDidChange:function(){return this.set("layerNeedsUpdate",YES),this},_sc_isVisibleDidChange:function(){this.displayDidChange()}.observes("isVisible"),layerNeedsUpdate:NO,_view_layerNeedsUpdateDidChange:function(){this.get("layerNeedsUpdate")&&this.invokeOnce(this.updateLayerIfNeeded)}.observes("layerNeedsUpdate"),updateLayerIfNeeded:function(e){var t=this.get("layerNeedsUpdate"),n=t&&(e||this.get("isVisibleInWindow"));return n&&this.get("layer")&&(this.beginPropertyChanges(),this.set("layerNeedsUpdate",NO),this.updateLayer(),this.endPropertyChanges()),this},updateLayer:function(e){var t,n,r,i,s=e||this.renderContext(this.get("layer"));this._renderLayerSettings(s,NO),i=!this.update,i?this.render(s,NO):this.update(s.$());if(t=this.renderMixin
){r=t.length;for(n=0;n<r;++n)t[n].call(this,s,NO)}s.update();if(s._innerHTMLReplaced){var o=this.get("pane");o&&o.get("isPaneAttached")&&this._notifyDidAppendToDocument()}return this.useStaticLayout&&this.viewDidResize(),this.didUpdateLayer&&this.didUpdateLayer(),this},parentViewDidResize:function(){this.get("hasLayout")||this.notifyPropertyChange("frame"),this.viewDidResize()},viewDidResize:function(){},renderContext:function(e){return SC.RenderContext(e)},createLayer:function(){if(this.get("layer"))return this;var e=this.renderContext(this.get("tagName"));return this.renderToContext(e),this.set("layer",e.element()),this._notifyDidCreateLayer(),this},_notifyDidCreateLayer:function(){var e=this.get("useStaticLayout"),t=this.didCreateLayerMixin,n,r,i=this.get("childViews"),s;this.notifyPropertyChange("layer");if(e){var o=this.get("pane");o&&o.isPaneAttached&&this.viewDidResize()}this.didCreateLayer&&this.didCreateLayer();if(t){n=t.length;for(r=0;r<n;++r)t[r].call(this)}n=i.length;for(r=0;r<n;++r){s=i[r];if(!s)continue;s.notifyPropertyChange("layer"),e&&(s.get("isFixedLayout")||s.viewDidResize()),s._notifyDidCreateLayer()}},_invalidateStaticLayoutFrames:function(){var e=this.get("childViews"),t=e.length,n,r;for(n=0;n<t;n++)r=e[n],r.useStaticLayout?r.viewDidResize():r._invalidateStaticLayoutFrames()},destroyLayer:function(){var e=this.get("layer");return e&&(this._notifyWillDestroyLayer(),e.parentNode&&e.parentNode.removeChild(e),e=null),this},replaceLayer:function(){this.destroyLayer(),this.set("layerLocationNeedsUpdate",YES),this.invokeOnce(this.updateLayerLocationIfNeeded)},
parentViewDidChange:function(){this.parentViewDidResize(),this.updateLayerLocation()},layerLocationNeedsUpdate:NO,updateLayerLocationIfNeeded:function(e){return this.get("layerLocationNeedsUpdate")&&this.updateLayerLocation(),this},updateLayerLocation:function(){var e=this.get("layer"),t=this.get("parentView"),n=t?t.get("containerLayer"):null;e&&e.parentNode&&e.parentNode!==n&&e.parentNode.removeChild(e);if(!t)e&&e.parentNode&&e.parentNode.removeChild(e);else if(!n)e&&(e.parentNode&&e.parentNode.removeChild(e),this.destroyLayer());else{if(!e){this.createLayer(),e=this.get("layer");if(!e)return}var r=t.get("childViews"),i=r.objectAt(r.indexOf(this)+1),s=i?i.get("layer"):null;i&&(!s||s.parentNode!==n)&&(i.updateLayerLocationIfNeeded(),s=i.get("layer")||null),(e.parentNode!==n||e.nextSibling!==s)&&n.insertBefore(e,s)}return n=t=e=s=null,this.set("layerLocationNeedsUpdate",NO),this},_notifyWillDestroyLayer:function(){this.willDestroyLayer&&this.willDestroyLayer();var e=this.willDestroyLayerMixin,t,n,r=this.get("childViews");if(e){t=e.length;for(n=0;n<t;++n)e[n].call(this)}t=r.length;for(n=0;n<t;++n)r[n]._notifyWillDestroyLayer();this.set("layer",null)},renderToContext:function(e,t){var n,r,i,s;this.beginPropertyChanges(),this.set("layerNeedsUpdate",NO),SC.none(t)&&(t=YES),this._renderLayerSettings(e,t),n=!this.update,n?this.render(e,t):t?this.render(e):this.update(e.$()),t&&!this._didRenderChildViews&&this.renderChildViews(e,t),this._didRenderChildViews=NO;if(r=this.renderMixin){s=r.length;for(i=0;i<s;++i)r[i].call(this,e,t)}this.endPropertyChanges()},_renderLayerSettings:function(
e,t){e.resetClassNames(),e.resetStyles(),this.applyAttributesToContext(e)},applyAttributesToContext:function(e){this._didApplyAttributes||(this._applyClassNameBindings(),this._applyAttributeBindings(e),this._didApplyAttributes=YES),e.addClass(this.get("classNames")),this.get("isTextSelectable")&&e.addClass("allow-select"),this.get("isVisible")||e.addClass("sc-hidden"),this.get("isFirstResponder")&&e.addClass("focus"),e.id(this.get("layerId")),e.attr("role",this.get("ariaRole")),e.attr("aria-label",this.get("ariaLabel"));var t=this.get("ariaHidden");t!==null&&(t===NO?e.removeAttr("aria-hidden"):e.attr("aria-hidden",t)),this.get("acceptsFirstResponder")&&e.attr("tabindex","0")},_applyClassNameBindings:function(){var e=this.get("classNameBindings"),t=this.get("classNames"),n,r,i;if(!e)return;e.forEach(function(e){var s,o=function(){r=this._classStringForProperty(e),n=this.$(),s&&(n.removeClass(s),t.removeObject(s)),r?(n.addClass(r),t.pushObject(r),s=r):s=null};this.addObserver(e.split(":")[0],this,o),i=this._classStringForProperty(e),i&&(t.push(i),s=i)},this)},_applyAttributeBindings:function(e){var t=this.get("attributeBindings"),n,r,i;if(!t)return;t.forEach(function(t){var s=function(){r=this.$();var e=r.attr(t);n=this.get(t),i=typeof n,i!=="string"&&i!=="number"||n===e?n&&i==="boolean"?r.attr(t,t):n===NO&&r.removeAttr(t):r.attr(t,n)};this.addObserver(t,this,s),n=this.get(t),i=typeof n,i==="string"||i==="number"?e.attr(t,n):n&&i==="boolean"&&e.attr(t,t)},this)},_classStringForProperty:function(e){var t=e.split(":"),n=t[1];e=t[0];var r=SC.getPath(this,e);return r===YES?n?n:SC.
String.dasherize(e.split(".").get("lastObject")):r!==NO&&r!==undefined&&r!==null?r:null},prepareContext:function(e,t){t!==!1&&(t=YES),t?this.renderToContext(e):this.updateLayer(e)},renderChildViews:function(e,t){var n=this.get("childViews"),r=n.length,i,s;for(i=0;i<r;++i){s=n[i];if(!s)continue;e=e.begin(s.get("tagName")),s.renderToContext(e,t),e=e.end()}return this._didRenderChildViews=YES,e},render:function(){},_notifyDidAppendToDocument:function(){this.get("hasLayout")||this.notifyPropertyChange("frame"),this.didAppendToDocument&&this.didAppendToDocument();var e=0,t,n,r=this.get("childViews");for(e=0,n=r.length;e<n;e++)t=r[e],t._notifyDidAppendToDocument&&t._notifyDidAppendToDocument()},childViewsObserver:function(){var e=this.get("childViews"),t,n,r;for(t=0,n=e.length;t<n;t++)r=e[t],r._notifyDidAppendToDocument&&r._notifyDidAppendToDocument()}.observes("childViews"),tagName:"div",classNames:[],toolTip:null,displayToolTip:function(){var e=this.get("toolTip");return e&&this.get("localize")?SC.String.loc(e):e||""}.property("toolTip","localize").cacheable(),isTextSelectable:NO,displayProperties:["ariaHidden","ariaLabel"],nextResponder:function(){return this.get("parentView")}.property("parentView").cacheable(),acceptsFirstResponder:NO,focusEventMakesFirstResponder:YES,focusEventMakesFirstResponderBindingDefault:SC.Binding.bool(),init:function(){var e=this.get("parentView"),t,n,r,i;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
(),i=this.get("displayProperties");for(var s=0,o=i.length;s<o;s++)this.addObserver(i[s],this,this.displayDidChange)},awake:function(){arguments.callee.base.apply(this,arguments);var e=this.get("childViews"),t=e.length,n;for(n=0;n<t;++n){if(!e[n])continue;e[n].awake()}},frame:function(){return this.computeFrameWithParentFrame(null)}.property("useStaticLayout").cacheable(),computeFrameWithParentFrame:function(){var e,t=this.get("parentView"),n;return(e=this.get("layer"))?(n=SC.offset(e),t&&(n=t.convertFrameFromView(n,null)),n.width=e.offsetWidth,n.height=e.offsetHeight,n):this.get("hasLayout")?null:{x:0,y:0,width:0,height:0}},clippingFrame:function(){var e=this.__alreadyCalculatedClippingFrame;if(e)return delete this.__alreadyCalculatedClippingFrame,e;var t=this.get("frame"),n=t,r,i;if(!t)return null;r=this.get("parentView");if(r){i=r.get("clippingFrame");if(!i)return{x:0,y:0,width:t.width,height:t.height};n=SC.intersectRects(i,t)}return n.x-=t.x,n.y-=t.y,n}.property().cacheable(),_previousClippingFrame:null,_sc_view_clippingFrameMayHaveChanged:function(){var e=this._previousClippingFrame,t=this.clippingFrame(),n,r,i,s;if(!e||!t||e.height!==t.height||e.width!==t.width||e.y!==t.y||e.x!==t.x){this._previousClippingFrame=t,this.__alreadyCalculatedClippingFrame=t,this.notifyPropertyChange("clippingFrame"),n=this.get("childViews");for(r=0,i=n.length;r<i;++r)s=n[r],s._sc_view_clippingFrameMayHaveChanged()}else delete this.__alreadyCalculatedClippingFrame},removeChild:function(e){e.set("parentView",null);var t=this.get("childViews"),n=t.indexOf(e);return n>=0&&t.removeAt(n),this},removeAllChildren
:function(){var e=this.get("childViews"),t;while(t=e.objectAt(e.get("length")-1))this.removeChild(t);return this},removeFromParent:function(){var e=this.get("parentView");return e&&e.removeChild(this),this},destroy:function(){return this.get("isDestroyed")?this:(this._destroy(),this.get("parentView")&&this.removeFromParent(),arguments.callee.base.apply(this,arguments))},_destroy:function(){this.destroyLayer();var e=this.get("childViews"),t=e.length,n;if(t){e=e.slice();for(n=0;n<t;++n)e[n].destroy()}return delete SC.View.views[this.get("layerId")],delete this._CQ,delete this.page,this.get("parentView")&&this.removeFromParent(),this.set("owner",null),this},createChildViews:function(){var e=this.get("childViews"),t=e.length,n,r,i,s;this.beginPropertyChanges();for(n=0;n<t;++n){if(r=s=e[n]){typeof r===SC.T_STRING?s=this[r]:r=null;if(!s){SC.Logger.error("No view with name "+r+" has been found in "+this.toString());continue}s=this.createChildView(s),r&&(this[r]=s)}e[n]=s}return this.endPropertyChanges(),this},createChildView:function(e,t){return e.isClass?t?t=SC.clone(t):t={}:t=e,t.owner=t.parentView=this,e.isClass&&e.prototype.hasVisibility&&(t.isVisibleInWindow=this.get("isVisibleInWindow")),t.page||(t.page=this.page),e.isClass&&(e=e.create(t)),e},isView:YES,selectStart:function(e){return this.get("isTextSelectable")},isContextMenuEnabled:SC.CONTEXT_MENU_ENABLED,contextMenu:function(e){return!this.get("isContextMenuEnabled")}}),SC.CoreView.mixin({isViewClass:YES,design:function(){if(this.isDesign)return this;var e=this.extend.apply(this,arguments);return e.isDesign=YES,e},extend:
function(){var e=arguments[arguments.length-1];return e&&!SC.none(e.theme)&&typeof e.theme=="string"&&(e.themeName=e.theme,delete e.theme),SC.Object.extend.apply(this,arguments)},layout:function(e){return this.prototype.layout=e,this},classNames:function(e){return e=(this.prototype.classNames||[]).concat(e),this.prototype.classNames=e,this},tagName:function(e){return this.prototype.tagName=e,this},childView:function(e){var t=this.prototype.childViews||[];return t===this.superclass.prototype.childViews&&(t=t.slice()),t.push(e),this.prototype.childViews=t,this},bind:function(e,t){var n=this.prototype,r=this.superclass.prototype,i=n._bindings;if(!i||i===r._bindings)i=n._bindings=(i||[]).slice();return e+="Binding",n[e]=t,i.push(e),this},prop:function(e,t){return this.prototype[e]=t,this},localization:function(e,t){return t&&(e.rootElement=SC.$(t)[0]),e},viewFor:function(e,t){var n=SC.$A(arguments);SC.none(e)?n.shift():n[0]={rootElement:SC.$(e)[0]};var r=this.create.apply(this,arguments);return n=n[0]=null,r},create:function(){var e=arguments[arguments.length-1];e&&e.theme&&(e.themeName=e.theme,delete e.theme);var t=this,n=new t(arguments);return n},loc:function(e){var t=e.childViews;delete e.childViews,this.applyLocalizedAttributes(e);var n=this.prototype.childViews,r=n.length,i;while(--r>=0)i=n[r],e=t[r],e&&i&&typeof i===SC.T_STRING&&SC.String.loc(i,e);return this},applyLocalizedAttributes:function(e){SC.mixin(this.prototype,e)},views:{}}),SC.outlet=function(e,t){return function(n){return this[n]=SC.objectForPropertyPath(e,t!==undefined?t:this)}.property()},SC.CoreView.unload=
function(){var e=SC.View.views;if(e)for(var t in e){if(!e.hasOwnProperty(t))continue;delete e[t]}},SC.View=SC.CoreView.extend({classNames:["sc-view"],displayProperties:["isFirstResponder"]}),SC.browser.msie&&SC.Event.add(window,"unload",SC.View,SC.View.unload),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(){SC.platform.supportsCSSTransitions&&this.resetAnimation()},animate:function(e,t,n,r){var i,s;typeof e===SC.T_STRING?(i={},i[e]=t,s=n):(i=e,s=t,r=n);var o=SC.typeOf(s);if(o===SC.T_NUMBER)s={duration:s};else if(o!==SC.T_HASH)throw"Must provide options hash or duration!";r&&(s.callback=r);var u=s.timing;u?typeof u!==SC.T_STRING&&(s.timing="cubic-bezier("+u[0]+", "+u[1]+", "+u[2]+", "+u[3]+")"):s.timing="linear";var a=SC.clone(this.get("layout")),f=NO,l,c,h,p,d;a.animate||(a.animate={});for(d in i){if(!i.hasOwnProperty(d)||!SC.ANIMATABLE_PROPERTIES[d])continue;l=i[d],c=a[d],p=a.animate[d];if(l==null)throw"Can only animate to an actual value!";if(c!==l||p&&p.duration!==s.duration)f=YES,a.animate[d]=s,a[d]=l}return f&&this.set("layout",a),this},resetAnimation:function(){var e=this.get("layout"),t=e.animate,n=NO,r;if(!t)return;var i;for(r in t)n=YES,delete t[r];return n&&(this.set("layout",e),this.notifyPropertyChange("layout")),this},transitionDidEnd:function(e){this.get("layoutStyleCalculator").transitionDidEnd(e)}}),SC.CSS_TRANSFORM_MAP={rotate:function(e){return null},rotateX:function(e){return SC.typeOf
(e)===SC.T_NUMBER&&(e+="deg"),"rotateX("+e+")"},rotateY:function(e){return SC.typeOf(e)===SC.T_NUMBER&&(e+="deg"),"rotateY("+e+")"},rotateZ:function(e){return SC.typeOf(e)===SC.T_NUMBER&&(e+="deg"),"rotateZ("+e+")"},scale:function(e){return SC.typeOf(e)===SC.T_ARRAY&&(e=e.join(", ")),"scale("+e+")"}},SC.View.reopen({layoutStyleCalculator:null,layoutStyle:function(){var e={layout:this.get("layout"),turbo:this.get("hasAcceleratedLayer"),staticLayout:this.get("useStaticLayout")},t=this.get("layoutStyleCalculator");return t.set(e),t._layoutDidUpdate(),t.calculate()}.property().cacheable()}),SC.View.LayoutStyleCalculator=SC.Object.extend({_layoutDidUpdate:function(){var e=this.get("layout");if(!e)return;this.dims=SC._VIEW_DEFAULT_DIMS,this.loc=this.dims.length;var t=this.right=e.right;this.hasRight=t!=null;var n=this.left=e.left;this.hasLeft=n!=null;var r=this.top=e.top;this.hasTop=r!=null;var i=this.bottom=e.bottom;this.hasBottom=i!=null;var s=this.width=e.width;this.hasWidth=s!=null;var o=this.height=e.height;this.hasHeight=o!=null,this.minWidth=e.minWidth===undefined?null:e.minWidth;var u=this.maxWidth=e.maxWidth===undefined?null:e.maxWidth;this.hasMaxWidth=u!=null,this.minHeight=e.minHeight===undefined?null:e.minHeight;var a=this.maxHeight=e.maxHeight===undefined?null:e.maxHeight;this.hasMaxHeight=a!=null;var f=this.centerX=e.centerX;this.hasCenterX=f!=null;var l=this.centerY=e.centerY;this.hasCenterY=l!=null;var c=this.borderTop=(e.borderTop!==undefined?e.borderTop:e.border)||0,h=this.borderRight=(e.borderRight!==undefined?e.borderRight:e.border)||0,p=this.borderBottom=(e.borderBottom!==
undefined?e.borderBottom:e.border)||0,d=this.borderLeft=(e.borderLeft!==undefined?e.borderLeft:e.border)||0;this.zIndex=e.zIndex!=null?e.zIndex.toString():null,this.opacity=e.opacity!=null?e.opacity.toString():null,this.backgroundPosition=e.backgroundPosition!=null?e.backgroundPosition:null,this.ret={marginTop:null,marginLeft:null}},_invalidAutoValue:function(e){var t=SC.Error.desc("%@.layout() you cannot use %@:auto if staticLayout is disabled".fmt(this.get("view"),e),"%@".fmt(this.get("view")),-1);throw SC.Logger.error(t.toString()),t},_handleMistakes:function(){var e=this.get("layout");this.staticLayout||(this.width===SC.LAYOUT_AUTO&&this._invalidAutoValue("width"),this.height===SC.LAYOUT_AUTO&&this._invalidAutoValue("height"));if(SC.platform.supportsCSSTransforms){var t=e.animate,n,r;if(t)for(r in t)if(SC.CSS_TRANSFORM_MAP[r]){if(this._pendingAnimations&&this._pendingAnimations["-"+SC.platform.cssPrefix+"-transform"])throw"Animations of transforms must be executed simultaneously!";n&&t[r].duration!==n&&(SC.Logger.warn("Can't animate transforms with different durations! Using first duration specified."),t[r].duration=n),n=t[r].duration}}},_calculatePosition:function(e){var t=null,n=this.get("turbo"),r=this.ret;if(!r)return t;var i,s,o,u,a,f,l,c,h,p,d,v,m,g;e==="x"?(i="left",s="right",o="width",u="maxWidth",a="marginLeft",p="borderLeft",v="borderRight",f=this.hasLeft,l=this.hasRight,c=this.hasWidth,h=this.hasMaxWidth):(i="top",s="bottom",o="height",u="maxHeight",a="marginTop",p="borderTop",v="borderBottom",f=this.hasTop,l=this.hasBottom,c=this.hasHeight,h=this.hasMaxHeight
),r[i]=this._cssNumber(this[i]),r[s]=this._cssNumber(this[s]),d=this._cssNumber(this[p]),m=this._cssNumber(this[v]),r[p+"Width"]=d||null,r[v+"Width"]=m||null,g=this[o],g>=1&&(g-=d+m),r[o]=this._cssNumber(g);if(f)n&&(t=r[i],r[i]=0),l&&c&&(r[s]=null);else if(!l||l&&!c&&!h)r[i]=0;return!c&&!l&&(r[s]=0),t},_calculateCenter:function(e){var t=this.ret,n,r,i,s,o,u,a,f,l;e==="x"?(n="width",r="centerX",i="left",s="right",o="marginLeft",u="borderLeft",f="borderRight"):(n="height",r="centerY",i="top",s="bottom",o="marginTop",u="borderTop",f="borderBottom"),t[i]="50%",a=this._cssNumber(this[u]),l=this._cssNumber(this[f]),t[u+"Width"]=a||null,t[f+"Width"]=l||null;var c=this[n],h=this[r],p=this[i],d=SC.isPercentage(c),v=SC.isPercentage(h,YES);c>1&&(c-=a+l);if(d&&v||!d&&!v){var m=h-c/2;t[o]=d?m*100+"%":m}else SC.Logger.warn("You have to set "+n+" and "+r+" using both percentages or pixels"),t[o]="50%";t[n]=this._cssNumber(c)||0,t[s]=null},_calculateTransforms:function(e,t){if(SC.platform.supportsCSSTransforms){var n=this.get("layout"),r=SC.platform.domCSSPrefix+"Transform",i=[];this.turbo&&(i.push("translateX("+(e||0)+"px)","translateY("+(t||0)+"px)"),SC.platform.supportsCSS3DTransforms&&i.push("translateZ(0px)"));var s=SC.CSS_TRANSFORM_MAP;for(var o in s){var u=n[o];u!=null&&i.push(s[o](u))}this.ret[r]=i.length>0?i.join(" "):null}},_calculateAnimations:function(e,t){var n=this.layout,r=n.animate,i;if(!r)return;if(this.getPath("view.isAnimatable"))return;var s=[],o;this._animatedTransforms=[],this._pendingAnimations||(this._pendingAnimations={});var u="-"+SC.platform.cssPrefix+"-transform"
;if(SC.platform.supportsCSSTransitions){for(i in r){o=r[i];var a=SC.CSS_TRANSFORM_MAP[i],f=i==="top"&&t!=null||i==="left"&&e!=null;SC.platform.supportsCSSTransforms&&(f||a)&&(this._animatedTransforms.push(i),i=u),o.css=i+" "+o.duration+"s "+o.timing,this._pendingAnimations[i]||(this._pendingAnimations[i]=o,s.push(o.css))}this.ret[SC.platform.domCSSPrefix+"Transition"]=s.join(", ")}else for(i in r)this._pendingAnimations[i]=r[i];delete n.animate},_cssNumber:function(e){return e==null?null:e===SC.LAYOUT_AUTO?SC.LAYOUT_AUTO:SC.isPercentage(e)?e*100+"%":e},calculate:function(){var e=this.get("layout"),t=null,n=this.get("staticLayout"),r=null,i=null,s=this.get("turbo"),o=this.ret,u=this.dims,a=this.loc,f=this.get("view"),l,c;this._handleMistakes(e);if(n&&e===SC.View.prototype.layout)return{};this.hasLeft||this.hasRight||!this.hasCenterX?i=this._calculatePosition("x"):this._calculateCenter("x"),this.hasTop||this.hasBottom||!this.hasCenterY?r=this._calculatePosition("y"):this._calculateCenter("y"),o.minWidth=this.minWidth,o.maxWidth=this.maxWidth,o.minHeight=this.minHeight,o.maxHeight=this.maxHeight,o.zIndex=this.zIndex,o.opacity=this.opacity,o.backgroundPosition=this.backgroundPosition,this._calculateTransforms(i,r),this._calculateAnimations(i,r);for(l in o)c=o[l],typeof c===SC.T_NUMBER&&(o[l]=c+"px");return o},willRenderAnimations:function(){if(SC.platform.supportsCSSTransitions){var e=this.get("view"),t=e.get("layer"),n=t?t.style:null,r=e.get("layoutStyle"),i=this._activeAnimations,s,o=this._pendingAnimations,u,a=this._animatedTransforms,f=a?a.length:0,l=r[SC.platform.domCSSPrefix+"Transition"
],c=e.get("layout"),h,p,d,v;if(o){i||(i={});for(h in o){if(!o.hasOwnProperty(h))continue;u=o[h],s=i[h],v=NO,r[h]!==(n?n[h]:null)&&(v=YES),s&&(s.duration!==u.duration||s.timing!==u.timing)&&(v=YES);if(v&&s){if(p=s.callback)if(f>0){for(d=0;d<f;d++)this.runAnimationCallback(p,null,a[d],YES);this._animatedTransforms=null}else this.runAnimationCallback(p,null,h,YES);this.removeAnimationFromLayout(h,YES)}i[h]=u}}this._activeAnimations=i,this._pendingAnimations=null}},didRenderAnimations:function(){if(!SC.platform.supportsCSSTransitions){var e,t;for(e in this._pendingAnimations)t=this._pendingAnimations[e].callback,t&&this.runAnimationCallback(t,null,e,NO),this.removeAnimationFromLayout(e,NO,YES);this._activeAnimations=this._pendingAnimations=null}},runAnimationCallback:function(e,t,n,r){var i=this.get("view");e&&(SC.typeOf(e)!==SC.T_HASH&&(e={action:e}),e.source=i,e.target||(e.target=this)),SC.View.runCallback(e,{event:t,propertyName:n,view:i,isCancelled:r})},transitionDidEnd:function(e){var t=e.originalEvent.propertyName,n,r;n=this._activeAnimations?this._activeAnimations[t]:null;if(n){if(n.callback){SC.RunLoop.begin();if(this._animatedTransforms&&this._animatedTransforms.length>0)for(r=0;r<this._animatedTransforms.length;r++)this.invokeLater("runAnimationCallback",1,n.callback,e,this._animatedTransforms[r],NO);else this.invokeLater("runAnimationCallback",1,n.callback,e,t,NO);SC.RunLoop.end()}this.removeAnimationFromLayout(t,YES)}},removeAnimationFromLayout:function(e,t,n){if(t){var r=this.getPath("view.layer"),i=[],s;for(s in this._activeAnimations)s!==e&&i.push(this._activeAnimations
[s].css);r&&(r.style[SC.platform.domCSSPrefix+"Transition"]=i.join(", "))}var o=this.getPath("view.layout"),u;if(e==="-"+SC.platform.cssPrefix+"-transform"&&this._animatedTransforms&&this._animatedTransforms.length>0){for(u=0;u<this._animatedTransforms.length;u++)delete o["animate"+SC.String.capitalize(this._animatedTransforms[u])];this._animatedTransforms=null}delete o["animate"+SC.String.capitalize(e)],n||delete this._activeAnimations[e]}}),SC.CoreView.runCallback=function(e){var t=SC.$A(arguments).slice(1),n=SC.typeOf(e.action);if(n==SC.T_FUNCTION)e.action.apply(e.target,t);else if(n===SC.T_STRING&&e.action.indexOf(".")>=0){var r=e.action.split("."),i=r.pop(),s=SC.objectForPropertyPath(r,window),o=s.get?s.get(i):s[i];if(!o||SC.typeOf(o)!=SC.T_FUNCTION)throw"SC.runCallback could not find a function at %@".fmt(e.action);o.apply(s,t)}},SC.View.runCallback=SC.CoreView.runCallback,SC.View.reopen({wantsAcceleratedLayer:NO,hasAcceleratedLayer:function(){if(this.get("wantsAcceleratedLayer")&&SC.platform.supportsAcceleratedLayers){var e=this.get("layout"),t=e.animate,n=SC.LAYOUT_AUTO,r;if(t&&(t.top||t.left))for(r in t)if(SC.CSS_TRANSFORM_MAP[r]&&(t.top&&t.top.duration!==t[r].duration||t.left&&t.left.duration!==t[r].duration))return NO;if(e.left!=null&&!SC.isPercentage(e.left)&&e.left!==n&&e.top!=null&&!SC.isPercentage(e.top)&&e.top!==n&&e.width!=null&&!SC.isPercentage(e.width)&&e.width!==n&&e.height!=null&&!SC.isPercentage(e.height)&&e.height!==n)return YES}return NO}.property("wantsAcceleratedLayer").cacheable()}),SC.View.reopen({cursor:function(e,t){var n;return t&&(this._setCursor=
t),this._setCursor!==undefined?this._setCursor:(n=this.get("parentView"),this.get("shouldInheritCursor")&&n?n.get("cursor"):null)}.property("parentView","shouldInheritCursor").cacheable(),applyAttributesToContext:function(e,t){var n=this.get("cursor");n&&t.addClass(n.get("className")),e(t)}.enhance(),shouldInheritCursor:YES}),SC.View.reopen({isEnabled:YES,isEnabledBindingDefault:SC.Binding.oneWay().bool(),isEnabledInPane:function(){var e=this.get("isEnabled"),t;return e&&(t=this.get("parentView"))&&(e=t.get("isEnabledInPane")),e}.property("parentView","isEnabled"),_sc_view_isEnabledDidChange:function(){!this.get("isEnabled")&&this.get("isFirstResponder")&&this.resignFirstResponder()}.observes("isEnabled"),applyAttributesToContext:function(e,t){var n=this.get("isEnabled");e(t),t.setClass("disabled",!n),t.attr("aria-disabled",n?null:"true")}.enhance()}),SC.View.reopen({isKeyResponder:NO,willLoseKeyResponderTo:function(e){},willBecomeKeyResponderFrom:function(e){},didLoseKeyResponderTo:function(e){},didBecomeKeyResponderFrom:function(e){},interpretKeyEvents:function(e){var t=e.commandCodes(),n=t[0],r=t[1],i;if(!n&&!r)return null;if(n){var s=SC.MODIFIED_KEY_BINDINGS[n]||SC.BASE_KEY_BINDINGS[n.match(/[^_]+$/)[0]];if(s){var o=this,u=this.get("pane"),a=null;while(o&&!(a=o.tryToPerform(s,e)))o=o===u?null:o.get("nextResponder");return a}}return r&&this.respondsTo("insertText")?(i=this.insertText(r,e),i?i===YES?this:i:null):null},insertText:function(e){return NO},performKeyEquivalent:function(e,t){var n=NO,r=this.get("childViews"),i=r.length,s=-1,o;while(!n&&++s<i)o=r[s],n=o.tryToPerform
("performKeyEquivalent",e,t);return n},firstKeyView:null,_getFirstKeyView:function(){var e=this.get("firstKeyView");if(e)return e;var t=this.get("childViews");if(t)return t[0]},lastKeyView:null,_getLastKeyView:function(){var e=this.get("lastKeyView");if(e)return e;var t,n=this.get("firstKeyView");if(n){while(t=n._getNextKeyView())n=t;return n}var r=this.get("childViews");if(r)return r[r.length-1]},nextKeyView:undefined,_getNextKeyView:function(){var e=this.get("parentView"),t=this.get("nextKeyView");if(e&&e.get("lastKeyView")===this)return null;if(t!==undefined)return t;if(e){var n=e.get("childViews");return n[n.indexOf(this)+1]}},nextValidKeyView:function(){var e=this,t;while(t!==this){t=null,e.get("isVisibleInWindow")&&(t=e._getFirstKeyView()),t||(t=e._getNextKeyView());if(!t)while(e=e.get("parentView"))if(t=e._getNextKeyView())break;if(!t){if(!SC.TABBING_ONLY_INSIDE_DOCUMENT)break;t=this.get("pane")}if(t.get("isVisibleInWindow")&&t.get("acceptsFirstResponder"))return t;e=t}return null}.property("nextKeyView"),previousKeyView:undefined,_getPreviousKeyView:function(){var e=this.get("parentView"),t=this.get("previousKeyView");if(e&&e.get("firstKeyView")===this)return null;if(t!==undefined)return t;if(e){var n=e.get("childViews");return n[n.indexOf(this)-1]}},previousValidKeyView:function(){var e=this,t;while(t!==this){if(e.get("parentView"))t=e._getPreviousKeyView();else{if(!SC.TABBING_ONLY_INSIDE_DOCUMENT)break;t=e}if(t){do e=t,t=t._getLastKeyView();while(t&&t.get("isVisibleInWindow"));t||(t=e)}else t=e.get("parentView");if(t.get("isVisibleInWindow")&&t.get("acceptsFirstResponder"
))return t;e=t}return null}.property("previousKeyView")}),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,useStaticLayout:NO,init:function(e){e(),this.layoutStyleCalculator=SC.View.LayoutStyleCalculator.create({view:this}),this._previousLayout=this.get("layout")}.enhance(),propertyDidChange:function(e,t,n){var r=!1;if(typeof this.layout=="function"&&this._kvo_dependents){var i=this._kvo_dependents[e];i&&i.indexOf("layout")!=-1&&(r=!0)}(e==="layout"||r)&&this.layoutDidChange(),arguments.callee.base.apply(this,arguments)},adjust:function(e,t){var n=this.get("layout"),r=NO,i,s;if(e===undefined)return this;if(SC.typeOf(e)===SC.T_STRING){i=n[e];if(t===undefined||i==t)return this;n=SC.clone(n),t===null?delete n[e]:n[e]=t,r=YES}else{s=e;for(e in s){if(!s.hasOwnProperty(e))continue;t=s[e],i=n[e];if(t===undefined||i==t)continue;r||(n=SC.clone(n)),t===null?delete n[e]:n[e]=t,r=YES}}return r&&this.set("layout",n),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 e=this.get("layout"),t,n=e.left,r=e.top;return t=n!==undefined&&r!==undefined&&n!==SC.LAYOUT_AUTO&&r!==SC.LAYOUT_AUTO,t&&(t=!SC.isPercentage(r)&&!SC.isPercentage(n)),t}.property("layout").cacheable(),isFixedSize:function(){var e=this
.get("layout"),t,n=e.width,r=e.height;return t=n!==undefined&&r!==undefined&&n!==SC.LAYOUT_AUTO&&r!==SC.LAYOUT_AUTO,t&&(t=!SC.isPercentage(n)&&!SC.isPercentage(r)),t}.property("layout").cacheable(),convertFrameToView:function(e,t){var n=0,r=0,i=0,s=0,o=this,u;while(o)u=o.get("frame"),n+=u.x,r+=u.y,o=o.get("layoutView");if(t){o=t;while(o)u=o.get("frame"),i+=u.x,s+=u.y,o=o.get("layoutView")}return n=e.x+n-i,r=e.y+r-s,{x:n,y:r,width:e.width,height:e.height}},convertFrameFromView:function(e,t){var n=0,r=0,i=0,s=0,o=this,u;while(o&&(u=o.get("frame")))n+=u.x,r+=u.y,o=o.get("parentView");if(t){o=t;while(o)u=o.get("frame"),i+=u.x,s+=u.y,o=o.get("parentView")}return n=e.x-n+i,r=e.y-r+s,{x:n,y:r,width:e.width,height:e.height}},scrollToVisible:function(){var e=this.get("parentView");while(e&&!e.get("isScrollable"))e=e.get("parentView");return e?(e.scrollToVisible(),e.scrollToVisible(this)):NO},_adjustForBorder:function(e,t){var n=(t.borderTop!==undefined?t.borderTop:t.border)||0,r=(t.borderLeft!==undefined?t.borderLeft:t.border)||0,i=(t.borderBottom!==undefined?t.borderBottom:t.border)||0,s=(t.borderRight!==undefined?t.borderRight:t.border)||0;return e.x+=r,e.y+=n,e.width-=r+s,e.height-=n+i,e},computeFrameWithParentFrame:function(e,t){var n,r=this.get("layout");if(this.get("useStaticLayout"))return n=e(),n?this._adjustForBorder(n,r):null;n={};var i,s,o=SC.LAYOUT_AUTO,u=this.get("parentView"),a,f,l=r.right,c=r.left,h=r.top,p=r.bottom,d=r.width,v=r.height,m=r.centerX,g=r.centerY;if(d===o)throw i=SC.Error.desc("%@.layout() cannot use width:auto if staticLayout is disabled".fmt(this),"%@".
fmt(this),-1),SC.Logger.error(i.toString()),i;if(v===o)throw i=SC.Error.desc("%@.layout() cannot use height:auto if staticLayout is disabled".fmt(this),"%@".fmt(this),-1),SC.Logger.error(i.toString()),i;t||(t=this.computeParentDimensions(r)),a=t.height,f=t.width,SC.none(c)?SC.none(l)?SC.none(m)?(n.x=0,SC.none(d)?n.width=f:(d===o&&(n.width=o),SC.isPercentage(d)?n.width=d*f:n.width=d||0)):(d===o?n.width=o:SC.isPercentage(d)?n.width=d*f:n.width=d||0,SC.isPercentage(m)?n.x=(f-n.width)/2+m*f:n.x=(f-n.width)/2+m):SC.none(d)?(SC.isPercentage(l)?n.width=f-f*l:n.width=f-l,n.x=0):(d===o?n.width=o:SC.isPercentage(d)?n.width=f*d:n.width=d||0,SC.isPercentage(d)?n.x=f-l*f-n.width:n.x=f-l-n.width):(SC.isPercentage(c)?n.x=f*c:n.x=c,d!==undefined?d===o?n.width=o:SC.isPercentage(d)?n.width=f*d:n.width=d:(n.width=f-n.x,l&&SC.isPercentage(l)?n.width=n.width-l*f:n.width=n.width-(l||0))),SC.none(h)?SC.none(p)?SC.none(g)?(n.y=0,SC.none(v)?n.height=a:(v===o&&(n.height=o),SC.isPercentage(v)?n.height=v*a:n.height=v||0)):(v===o&&(n.height=o),v&&SC.isPercentage(v)?n.height=v*a:n.height=v||0,SC.isPercentage(g)?n.y=(a-n.height)/2+g*a:n.y=(a-n.height)/2+g):SC.none(v)?(SC.isPercentage(p)?n.height=a-p*a:n.height=a-p,n.y=0):(v===o&&(n.height=o),v&&SC.isPercentage(v)?n.height=v*a:n.height=v||0,SC.isPercentage(p)?n.y=a-p*a-n.height:n.y=a-p-n.height):(SC.isPercentage(h)?n.y=h*a:n.y=h,v!==undefined?v===o?n.height=o:SC.isPercentage(v)?n.height=v*a:n.height=v:p&&SC.isPercentage(p)?n.height=a-n.y-p*a:n.height=a-n.y-(p||0));if(n.height===o||n.width===o)s=this.get("layer"),n.height===o&&(n.height=s?s.clientHeight:0),
n.width===o&&(n.width=s?s.clientWidth:0);return n=this._adjustForBorder(n,r),u&&u.isScrollContainer&&(u=u.get("parentView"),n.x-=u.get("horizontalScrollOffset"),n.y-=u.get("verticalScrollOffset")),!SC.none(r.maxHeight)&&n.height>r.maxHeight&&(n.height=r.maxHeight),!SC.none(r.minHeight)&&n.height<r.minHeight&&(n.height=r.minHeight),!SC.none(r.maxWidth)&&n.width>r.maxWidth&&(n.width=r.maxWidth),!SC.none(r.minWidth)&&n.width<r.minWidth&&(n.width=r.minWidth),n.height<0&&(n.height=0),n.width<0&&(n.width=0),n}.enhance(),computeParentDimensions:function(e){var t,n=this.get("parentView"),r=n?n.get("frame"):null;if(r)t={width:r.width,height:r.height};else{var i=e||{};t={width:(i.left||0)+(i.width||0)+(i.right||0),height:(i.top||0)+(i.height||0)+(i.bottom||0)}}return t},borderFrame:function(){var e=this.get("layout"),t=this.get("frame"),n=e.border,r=(e.topBorder!==undefined?e.topBorder:e.border)||0,i=(e.rightBorder!==undefined?e.rightBorder:e.border)||0,s=(e.bottomBorder!==undefined?e.bottomBorder:e.border)||0,o=(e.leftBorder!==undefined?e.leftBorder:e.border)||0;return{x:t.x-o,y:t.y-r,width:t.width+o+i,height:t.height+r+s}}.property("frame").cacheable(),parentViewDidResize:function(){var e,t;t=this.useStaticLayout||!this.get("isFixedSize"),e=!this.get("isFixedPosition"),t?this.viewDidResize():e&&this._viewFrameDidChange()},viewDidResize:function(){this._viewFrameDidChange();var e=this.childViews,t,n,r;for(n=0;n<(t=e.length);++n)r=e[n],r.tryToPerform("parentViewDidResize")},_viewFrameDidChange:function(){this.notifyPropertyChange("frame"),this._sc_view_clippingFrameMayHaveChanged()},beginLiveResize
:function(){this.willBeginLiveResize&&this.willBeginLiveResize();var e=this.get("childViews"),t=e.length,n,r;for(n=0;n<t;++n)r=e[n],r.beginLiveResize&&r.beginLiveResize();return this},endLiveResize:function(){var e=this.get("childViews"),t=e.length,n,r;for(n=t-1;n>=0;--n)r=e[n],r.endLiveResize&&r.endLiveResize();return this.didEndLiveResize&&this.didEndLiveResize(),this},layoutView:function(){return this.get("parentView")}.property("parentView").cacheable(),layoutDidChange:function(){var e=this._previousLayout,t=this.get("layout"),n=YES,r,i,s,o;SC.none(t.rotate)||SC.none(t.rotateX)&&(t.rotateX=t.rotate,SC.Logger.warn("Please set rotateX instead of rotate")),SC.none(t.rotateX)?delete t.rotate:t.rotate=t.rotateX;var u=t.animations;u&&(SC.none(u.rotate)||SC.none(u.rotateX)&&(u.rotateX=u.rotate,SC.Logger.warn("Please animate rotateX instead of rotate")),SC.none(u.rotateX)?delete u.rotate:u.rotate=u.rotateX),e&&e!==t&&(r=e.width,r!==undefined&&(s=t.width,r===s&&(i=e.height,e!==undefined&&(o=t.height,i===o&&(n=NO))))),this.beginPropertyChanges(),this.notifyPropertyChange("hasAcceleratedLayer"),this.notifyPropertyChange("layoutStyle"),n?this.viewDidResize():this._viewFrameDidChange(),this.endPropertyChanges();var a=this.get("layoutView");return a&&(a.set("childViewsNeedLayout",YES),a.layoutDidChangeFor(this),a.get("childViewsNeedLayout")&&a.invokeOnce(a.layoutChildViewsIfNeeded)),this._previousLayout=t,this},childViewsNeedLayout:NO,layoutDidChangeFor:function(e){var t=this._needLayoutViews;t||(t=this._needLayoutViews=SC.CoreSet.create()),t.add(e)},layoutChildViewsIfNeeded:function(
e){return e||(e=this.get("isVisibleInWindow")),e&&this.get("childViewsNeedLayout")&&(this.set("childViewsNeedLayout",NO),this.layoutChildViews()),this},layoutChildViews:function(){var e=this._needLayoutViews,t=e?e.length:0,n;for(n=0;n<t;++n)e[n].updateLayout();e.clear()},updateLayout:function(){var e=this.get("layer"),t;return e&&(t=this.renderContext(e),this.renderLayout(t,NO),t.update(),this.useStaticLayout&&this.viewDidResize()),e=null,this},renderLayout:function(e,t){var n=this.get("layoutStyleCalculator");n.willRenderAnimations(),e.addStyle(this.get("layoutStyle")),n.didRenderAnimations()},_renderLayerSettings:function(e,t,n){e(t,n),this.renderLayout(t,n)}.enhance(),applyAttributesToContext:function(e,t){e(t),this.get("useStaticLayout")&&t.addClass("sc-static-layout")}.enhance()}),SC.View.mixin({convertLayoutToAnchoredLayout:function(e,t){var n={top:0,left:0,width:t.width,height:t.height},r=t.width,i=t.height,s=e.right,o=e.left,u=e.top,a=e.bottom,f=e.width,l=e.height,c=e.centerX,h=e.centerY;return SC.none(o)?SC.none(s)?SC.none(c)?SC.none(f)?(n.left=0,n.width=0):(n.left=0,f===SC.LAYOUT_AUTO?n.width=SC.LAYOUT_AUTO:SC.isPercentage(f)?n.width=f*r:n.width=f):(f&&SC.isPercentage(f)?n.width=f*r:n.width=f||0,n.left=(r-n.width)/2,SC.isPercentage(c)?n.left=n.left+c*r:n.left=n.left+c):SC.none(f)?(n.left=0,s&&SC.isPercentage(s)?n.width=r-s*r:n.width=r-(s||0)):f===SC.LAYOUT_AUTO?n.width=SC.LAYOUT_AUTO:(SC.isPercentage(f)?n.width=f*r:n.width=f,SC.isPercentage(s)?n.left=r-(n.width+s):n.left=r-(n.width+s)):(SC.isPercentage(o)?n.left=o*r:n.left=o,f!==undefined?f===SC.LAYOUT_AUTO?n.width=
SC.LAYOUT_AUTO:SC.isPercentage(f)?n.width=f*r:n.width=f:s&&SC.isPercentage(s)?n.width=r-n.left-s*r:n.width=r-n.left-(s||0)),e.minWidth!==undefined&&(n.minWidth=e.minWidth),e.maxWidth!==undefined&&(n.maxWidth=e.maxWidth),SC.none(u)?SC.none(a)?SC.none(h)?SC.none(l)?(n.top=0,n.height=0):(n.top=0,l===SC.LAYOUT_AUTO?n.height=SC.LAYOUT_AUTO:SC.isPercentage(l)?n.height=l*i:n.height=l):(l&&SC.isPercentage(l)?n.height=l*i:n.height=l||0,n.top=(i-n.height)/2,SC.isPercentage(h)?n.top=n.top+h*i:n.top=n.top+h):SC.none(l)?(n.top=0,a&&SC.isPercentage(a)?n.height=i-a*i:n.height=i-(a||0)):l===SC.LAYOUT_AUTO?n.height=SC.LAYOUT_AUTO:(SC.isPercentage(l)?n.height=l*i:n.height=l,n.top=i-n.height,SC.isPercentage(a)?n.top=n.top-a*i:n.top=n.top-a):(SC.isPercentage(u)?n.top=u*i:n.top=u,l!==undefined?l===SC.LAYOUT_AUTO?n.height=SC.LAYOUT_AUTO:SC.isPercentage(l)?n.height=l*i:n.height=l:(n.height=i-n.top,a&&SC.isPercentage(a)?n.height=n.height-a*i:n.height=n.height-(a||0))),e.minHeight!==undefined&&(n.minHeight=e.minHeight),e.maxHeight!==undefined&&(n.maxHeight=e.maxHeight),n}}),SC.View.reopen({_lastLayerId:null,layerIdDidChange:function(){var e=this.get("layer"),t=this.get("layerId"),n=this._lastLayerId;t!==n&&(n&&SC.View.views[n]===this&&delete SC.View.views[n],this._lastLayerId=t,SC.View.views[t]=this,e&&(e.id=t))}.observes("layerId"),parentViewDidChange:function(){return this.recomputeIsVisibleInWindow(),this.resetBuildState(),this.set("layerLocationNeedsUpdate",YES),this.invokeOnce(this.updateLayerLocationIfNeeded),this._invalidatePaneCacheForSelfAndAllChildViews(),this},_invalidatePaneCacheForSelfAndAllChildViews
:function(){var e,t=this.get("childViews"),n=t.length,r;this.notifyPropertyChange("pane");for(r=0;r<n;++r)e=t[r],e._invalidatePaneCacheForSelfAndAllChildViews&&e._invalidatePaneCacheForSelfAndAllChildViews()},insertBefore:function(e,t){e.beginPropertyChanges(),e.get("parentView")&&e.removeFromParent(),this.willAddChild&&this.willAddChild(e,t),e.willAddToParent&&e.willAddToParent(this,t),e.set("parentView",this);var n,r=this.get("childViews");return r.needsClone&&this.set(r=[]),n=t?r.indexOf(t):r.length,n<0&&(n=r.length),r.insertAt(n,e),e.parentViewDidChange&&e.parentViewDidChange(),e.layoutDidChange&&e.layoutDidChange(),e.endPropertyChanges(),this.invokeLast(function(){var t=e.get("pane");t&&t.get("isPaneAttached")&&e._notifyDidAppendToDocument()}),this.didAddChild&&this.didAddChild(e,t),e.didAddToParent&&e.didAddToParent(this,t),this},removeChild:function(e,t){if(!t)return this;if(t.parentView!==this)throw"%@.removeChild(%@) must belong to parent".fmt(this,t);return t.willRemoveFromParent&&t.willRemoveFromParent(),this.willRemoveChild&&this.willRemoveChild(t),e(t),t.parentViewDidChange&&t.parentViewDidChange(),this.didRemoveChild&&this.didRemoveChild(t),t.didRemoveFromParent&&t.didRemoveFromParent(this),this}.enhance(),replaceChild:function(e,t){return e.beginPropertyChanges(),t.beginPropertyChanges(),this.beginPropertyChanges(),this.insertBefore(e,t).removeChild(t),this.endPropertyChanges(),t.endPropertyChanges(),e.endPropertyChanges(),this},replaceAllChildren:function(e){var t=e.get("length"),n;this.beginPropertyChanges(),this.destroyLayer().removeAllChildren();for(n=0;n<
t;n++)this.appendChild(e.objectAt(n));return this.replaceLayer(),this.endPropertyChanges(),this},appendChild:function(e){return this.insertBefore(e,null)},buildInChild:function(e){e.willBuildInToView(this),this.appendChild(e),e.buildInToView(this)},buildOutChild:function(e){e.buildOutFromView(this)},buildInDidFinishFor:function(e){},buildOutDidFinishFor:function(e){this.removeChild(e)},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(){this.isBuildingIn&&(this.buildInDidCancel(),this.isBuildingIn=NO),this.isBuildingOut&&(this.buildOutDidCancel(),this.isBuildingOut=NO),this.buildingInTo=null,this.buildingOutFrom=null,this.resetBuild()},willBuildInToView:function(e){this.isBuildingOut&&this.buildOutDidCancel()},buildInToView:function(e){if(this.isBuildingIn)return;this._buildingInTo=e,this.isBuildingOut=NO,this.isBuildingIn=YES,this.buildIn()},buildOutFromView:function(e){if(this.isBuildingOut)return;this.isBuildingIn&&this.buildInDidCancel(),this.isBuildingOut=YES,this.isBuildingIn=NO,this._buildingOutFrom=e,this.buildOut()}}),SC.View.reopen({init:function(e){e(),this._lastTheme=this.get("theme"),this._sc_view_lastRenderTheme=this.get("renderTheme")}.enhance
(),themeName:null,baseThemeName:null,_sc_view_findThemeInParent:function(e,t,n){if(e){var r;if(t){r=t.find(e,n);if(r)return r}if(!n){r=SC.Theme.find(e);if(r)return r}return t.invisibleSubtheme(e)}return t},findThemeAtPathInParent:function(e,t,n){if(!e)return t;var r=e.split("."),i,s=r.length,o=t;for(i=0;i<s;i++)o=this._sc_view_findThemeInParent(r[i],o,n),n=YES;return o},theme:function(){return this.findThemeAtPathInParent(this.get("themeName"),this.get("baseTheme"))}.property("baseTheme","themeName").cacheable(),_sc_view_themeDidChange:function(){if(this._lastTheme===this.get("theme"))return;this._lastTheme=this.get("theme");var e=this.childViews,t=e.length,n;for(n=0;n<t;n++)e[n].notifyPropertyChange("baseTheme")}.observes("theme"),baseTheme:function(){var e,t=this.get("baseThemeName");if(t)return this.findThemeAtPathInParent(t,SC.Theme);e=this.get("parentView");var n=e&&e.get("theme");return n||this.findThemeAtPathInParent(SC.defaultTheme,SC.Theme)}.property("baseThemeName","parentView").cacheable(),renderStyle:null,renderTheme:function(){return this.findThemeAtPathInParent(this.get("renderStyle"),this.get("theme"))}.property("theme","renderStyle").cacheable(),_sc_view_renderThemeDidChange:function(){if(this._sc_view_lastRenderTheme===this.get("renderTheme"))return;this._sc_view_lastRenderTheme=this.get("renderTheme"),this.get("layer")&&this.replaceLayer()}.observes("renderTheme"),renderDelegate:function(e,t){t&&(this._setRenderDelegate=t);if(this._setRenderDelegate)return this._setRenderDelegate;var n=this.get("renderDelegateName"),r;if(n){r=this.get("theme")[n];if(!r)throw'%@: Unable to locate render delegate "%@" in theme.'
.fmt(this,n);return r}return null}.property("renderDelegateName","renderTheme"),renderDelegateName:null,renderDelegateProxy:function(){return SC.View._RenderDelegateProxy.createForView(this)}.property("renderDelegate").cacheable(),render:function(e,t){var n=this.get("renderDelegate");n&&(t?n.render(this.get("renderDelegateProxy"),e):n.update(this.get("renderDelegateProxy"),e.$()))},applyAttributesToContext:function(e,t){var n=this.get("renderTheme"),r=n.classNames,i,s=r.length;for(i=0;i<s;i++)t.addClass(r[i]);e(t);var o=this.get("renderDelegate");o&&o.className&&t.addClass(o.className)}.enhance(),invokeRenderDelegateMethod:function(e,t){var n=this.get("renderDelegate");return n?SC.typeOf(n[e])!==SC.T_FUNCTION?undefined:(t=SC.$A(arguments),t.shift(),t.unshift(this.get("renderDelegateProxy")),n[e].apply(n,t)):undefined}}),SC.View._RenderDelegateProxy={isViewRenderDelegateProxy:YES,createForView:function(e){var t=SC.beget(this),n=e.get("displayProperties"),r={};for(var i=0,s=n.length;i<s;i++)r[n[i]]=YES;return r.theme=YES,t._displayPropertiesLookup=r,t.renderState={},t._view=e,t},get:function(e){if(this[e]!==undefined)return this[e];var t="display"+e.capitalize();return this._displayPropertiesLookup[t]?this._view.get(t):this._displayPropertiesLookup[e]?this._view.get(e):undefined},didChangeFor:function(e){var t=arguments.length,n;for(n=1;n<t;n++){var r=arguments[n],i="display"+r.capitalize();if(this._displayPropertiesLookup[i]){if(this._view.didChangeFor(e,i))return YES}else if(this._displayPropertiesLookup[r]&&this._view.didChangeFor(e,r))return YES}return NO}},SC.propertyFromRenderDelegate=
function(e,t){return function(n,r){r!==undefined&&(this["_set_rd_"+n]=r);var i=this["_set_rd_"+n];if(i!==undefined)return i;var s=this.get("renderDelegate");if(s&&s.get){var o=this.get("renderDelegateProxy");i=s.getPropertyFor(o,e)}return i!==undefined?i:t}.property("renderDelegate","controlSize").cacheable()},SC.View.reopen({acceptsMultitouch:NO,hasTouch:NO,touchBoundary:{left:50,right:50,top:50,bottom:50},_touchBoundaryFrame:function(){return this.get("parentView").convertFrameToView(this.get("frame"),null)}.property("frame","parentView").cacheable(),touchIsInBoundary:function(e){var t=this.get("_touchBoundaryFrame"),n=0,r=0,i=this.get("touchBoundary"),s=e.pageX,o=e.pageY;return s<t.x?(s=t.x-s,n=i.left):s>t.x+t.width?(s-=t.x+t.width,n=i.right):(s=0,n=1),o<t.y?(o=t.y-o,r=i.top):o>t.y+t.height?(o-=t.y+t.height,r=i.bottom):(o=0,r=1),s>100||o>100?NO:YES}}),SC.View.reopen({hasVisibility:YES,isVisibleInWindow:NO,recomputeIsVisibleInWindow:function(e){var t=this.get("isVisibleInWindow"),n=this.get("isVisible"),r;n&&(e===undefined&&(r=this.get("parentView"),e=r?r.get("isVisibleInWindow"):NO),n=n&&e);if(t!==n){this.set("isVisibleInWindow",n);var i=this.get("childViews"),s=i.length,o,u;for(o=0;o<s;o++)u=i[o],u&&u.recomputeIsVisibleInWindow&&u.recomputeIsVisibleInWindow(n);n?this.get("childViewsNeedLayout")&&this.invokeOnce(this.layoutChildViewsIfNeeded):this.get("isFirstResponder")&&this.resignFirstResponder()}return this.updateLayerIfNeeded(YES),this},_sc_isVisibleDidChange:function(){this.displayDidChange(),this.recomputeIsVisibleInWindow()}.observes("isVisible")}),SC.MIXED_STATE="__MIXED__"
,SC.Pane=SC.View.extend(SC.ResponderContext,{isPane:YES,page:null,rootResponder:null,sendEvent:function(e,t,n){var r;n||(n=this.get("firstResponder"));while(n){if(e==="touchStart"){if(t.touchResponder===n){n=null;break}if(!n.get("hasTouch")||n.get("acceptsMultitouch"))if(n.tryToPerform("touchStart",t))break}else if(e==="touchEnd"&&!n.get("acceptsMultitouch")){if(!n.get("hasTouch")&&n.tryToPerform("touchEnd",t))break}else if(n.tryToPerform(e,t))break;n=n===this?null:n.get("nextResponder")}return!n&&(n=this.get("defaultResponder"))?(typeof n===SC.T_STRING&&(n=SC.objectForPropertyPath(n)),n?n=n.tryToPerform(e,t)?n:null:n=null):!n&&!(n=this.get("defaultResponder"))&&(n=this.tryToPerform(e,t)?this:null),t.mouseHandler||n},nextResponder:function(){return null}.property().cacheable(),firstResponder:null,acceptsKeyPane:YES,isKeyPane:NO,becomeKeyPane:function(){return this.get("isKeyPane")?this:(this.rootResponder&&this.rootResponder.makeKeyPane(this),this)},resignKeyPane:function(){return this.get("isKeyPane")?(this.rootResponder&&this.rootResponder.makeKeyPane(null),this):this},makeFirstResponder:function(e,t,n){t||(t=this);var r=this.get("firstResponder"),i=this.get("isKeyPane");return r===t?this:SC.platform.touch&&t&&t.kindOf(SC.TextFieldView)&&!t.get("focused")?this:(i&&(r&&r.tryToPerform("willLoseKeyResponderTo",t),t&&t.tryToPerform("willBecomeKeyResponderFrom",r)),r&&(r.beginPropertyChanges(),r.set("isKeyResponder",NO)),t&&(t.beginPropertyChanges(),t.set("isKeyResponder",i)),e(t,n),r&&r.endPropertyChanges(),t&&t.endPropertyChanges(),i&&(t&&t.tryToPerform("didBecomeKeyResponderFrom"
,r),r&&r.tryToPerform("didLoseKeyResponderTo",t)),this)}.enhance(),willLoseKeyPaneTo:function(e){return this._forwardKeyChange(this.get("isKeyPane"),"willLoseKeyResponderTo",e,NO),this},willBecomeKeyPaneFrom:function(e){return this._forwardKeyChange(!this.get("isKeyPane"),"willBecomeKeyResponderFrom",e,YES),this},didBecomeKeyResponderFrom:function(e){},didLoseKeyPaneTo:function(e){var t=this.get("isKeyPane");return this.set("isKeyPane",NO),this._forwardKeyChange(t,"didLoseKeyResponderTo",e),this},didBecomeKeyPaneFrom:function(e){var t=this.get("isKeyPane");return this.set("isKeyPane",YES),this._forwardKeyChange(!t,"didBecomeKeyResponderFrom",e,YES),this},isMainPane:NO,focusFrom:function(e){},blurTo:function(e){},blurMainTo:function(e){this.set("isMainPane",NO)},focusMainFrom:function(e){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 e=this.get("layer");e&&e.parentNode&&e.parentNode.removeChild(e),e=null,this._removeIntercept(),this.resignKeyPane();var t=this.rootResponder;return this.get("isMainPane")&&t.makeMainPane(null),t.panes.remove(this),this.rootResponder=null,this.set("isPaneAttached",NO),this.parentViewDidChange(),this},insert:function(e){var t=this.get("layer");return t||(t=this.createLayer().get("layer")),e(t),this.get("isPaneAttached")||this.paneDidAttach(),this},appendTo:function(e){return this.insert(function(t){jQuery(e).append(t)})},paneDidAttach:function(){var e=this.rootResponder=SC.RootResponder.responder;return e
.panes.add(this),this.set("isPaneAttached",YES),this.recomputeDependentProperties(),this._notifyDidAppendToDocument(),this._invalidateStaticLayoutFrames(),this._addIntercept(),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 e=document.createElement("div"),t=e.style;t.position="absolute",t.left="0px",t.top="0px",t.right="0px",t.bottom="0px",t.webkitTransform="translateZ(0px)",t.zIndex=this.get("zIndex")+this.get("touchZ"),e.className="touch-intercept",e.id="touch-intercept-"+SC.guidFor(this),this._touchIntercept=e,document.body.appendChild(e)}},_removeIntercept:function(){this._touchIntercept&&(document.body.removeChild(this._touchIntercept),this._touchIntercept=null)},hideTouchIntercept:function(){this._touchIntercept&&(this._touchIntercept.style.display="none")},showTouchIntercept:function(){this._touchIntercept&&(this._touchIntercept.style.display="block")},recomputeIsVisibleInWindow:function(){var e=this.get("isVisibleInWindow"),t=this.get("isVisible")&&this.get("isPaneAttached");if(e!==t){this.set("isVisibleInWindow",t);var n=this.get("childViews"),r=n.length,i,s;for(i=0;i<r;i++)s=n[i],s.recomputeIsVisibleInWindow&&s.recomputeIsVisibleInWindow(t);t?this.get("childViewsNeedLayout")&&this.invokeOnce(this.layoutChildViewsIfNeeded):this.get("isKeyPane")&&this.resignKeyPane()}return this.updateLayerIfNeeded(YES),this},updateLayerLocation
:function(){return this.get("parentView")?arguments.callee.base.apply(this,arguments):this},replaceLayer:function(){var e=this.get("isPaneAttached");this.destroyLayer(),e&&this.invokeLast(this.append)},init:function(){this.hasTouchIntercept===YES&&(SC.Logger.warn("Do not set hasTouchIntercept directly. Use wantsTouchIntercept instead."),this.hasTouchIntercept=SC.platform.touch);var e=!!this.get("layer");arguments.callee.base.apply(this,arguments),e&&this.paneDidAttach()},classNames:["sc-pane"]}),SC.Pane.reopen({performKeyEquivalent:function(e,t){var n=arguments.callee.base.apply(this,arguments);if(!n){var r=this.get("defaultResponder");r&&(r.performKeyEquivalent&&(n=r.performKeyEquivalent(e,t)),!n&&r.tryToPerform&&(n=r.tryToPerform(e,t)))}return n},keyDown:function(e){var t;if((e.which===9||SC.browser.mozilla&&e.keyCode===9)&&!this.get("firstResponder")){e.shiftKey?t=this.get("previousValidKeyView"):t=this.get("nextValidKeyView");if(t)return this.makeFirstResponder(t),YES;SC.TABBING_ONLY_INSIDE_DOCUMENT||e.allowDefault()}return NO},_forwardKeyChange:function(e,t,n,r){var i,s,o;e&&(s=this.get("firstResponder"))&&(o=n?n.get("firstResponder"):null,i=this.get("firstResponder"),i&&i[t]&&i[t](o),r!==undefined&&s&&s.set("isKeyResponder",r))}}),SC.Pane.reopen({currentWindowSize:null,computeParentDimensions:function(e){var t={x:0,y:0,width:1e3,height:1e3},n=this.get("layout");document&&document.body&&(t.width=document.body.clientWidth,t.height=document.body.clientHeight);if(n.minHeight||n.minWidth)n.minHeight&&(t.height=Math.max(t.height,n.minHeight)),n.minWidth&&(t.width=Math.max(t.
width,n.minWidth));return t},frame:function(){return this.computeFrameWithParentFrame(null)}.property(),windowSizeDidChange:function(e,t){return this.set("currentWindowSize",t),this.setBodyOverflowIfNeeded(),this.parentViewDidResize(),this},setBodyOverflowIfNeeded:function(e){var t=this.get("layout"),n=this.get("currentWindowSize");if(!t||!n||!n.width||!n.height)return;var r=t.minWidth,i=t.minHeight;if(e===!0||r||i)i&&n.height<i||r&&n.width<r?SC.bodyOverflowArbitrator.requestVisible(this):SC.bodyOverflowArbitrator.requestHidden(this)},paneLayoutDidChange:function(){this.invokeOnce(this.updateLayout),this.setBodyOverflowIfNeeded()}.observes("layout"),recomputeDependentProperties:function(e){this.set("currentWindowSize",this.rootResponder.computeWindowSize()),e()}.enhance()}),SC.Pane.reopen({prependTo:function(e){return this.insert(function(t){jQuery(e).prepend(t)})},removeFromParent:function(){throw SC.Error.desc("SC.Pane cannot be removed from its parent, since it's the root. Did you mean remove()?")}}),SC.Pane.reopen({recomputeDependentProperties:function(e){this.recomputeIsVisibleInWindow(),e()}.enhance()}),SC.Application=SC.Responder.extend(SC.ResponderContext,{}),SC.BENCHMARK_LOG_READY=YES,SC.mixin({isReady:NO,suppressOnReady:SC.suppressOnReady?YES:NO,suppressMain:SC.suppressMain?YES:NO,ready:function(e,t){var n=SC._readyQueue;return t===undefined?(t=e,e=null):SC.typeOf(t)===SC.T_STRING&&(t=e[t]),SC.isReady?jQuery(document).ready(function(){t.call(e)}):(n||(SC._readyQueue=[]),SC._readyQueue.push(function(){t.call(e)})),this},onReady:{done:function(){if(SC.isReady)return;
SC.isReady=!0,SC.RunLoop.begin(),SC.Locale.createCurrentLocale();var e=SC.Locale.currentLanguage.toLowerCase();jQuery("body").addClass(e),jQuery("html").attr("lang",e),jQuery("#loading").remove();var t=SC._readyQueue,n,r;if(t){for(n=0,r=t.length;n<r;n++)t[n].call();SC._readyQueue=null}window.main&&!SC.suppressMain&&SC.mode===SC.APP_MODE&&window.main(),SC.RunLoop.end()}}}),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 e=document.createElement("DIV"),t;e.innerHTML="<div style='height:1px;'></div>",e.style.cssText="position:absolute;width:100px;height:100px;overflow-y:visible;",t=e.childNodes[0],document.body.appendChild(e);var n=t.innerWidth||t.clientWidth;e.style.overflowY="scroll";var r=t.innerWidth||t.clientWidth;return document.body.removeChild(e),n-r}.property().cacheable(),touch:"createTouch"in document&&(SC.browser.iOS||SC.browser.android||SC.browser.silk),bounceOnScroll:SC.browser.iOS,pinchToZoom:SC.browser.iOS,input:function(e){var t={},n=e.length,r=document.createElement("input"),i,s;for(s=0;s<n;s++)i=e[s],t[i]=i in r;return t}(["autocomplete","readonly","list","size","required","multiple","maxlength","pattern","min","max","step","placeholder"]),standalone:!!navigator.standalone,dpi:BUILD_INFO.stylesDPIUsed,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(e){var t,n=e.length,r;for(t=0;t<n;t++)r=e[t],SC.Event.remove(document,r,SC.RootResponder.responder,SC.RootResponder.responder[r])},replaceEvent:function(e,t){SC.Event.remove(document,e,SC.RootResponder.responder,SC.RootResponder.responder[e]),SC.Event.add(document,e,this,t)},_simtouch_mousemove:function(e){if(!this._mousedown)return e.altKey&&this._pinchCenter===null?this._pinchCenter={pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY}:!e.altKey&&this._pinchCenter!==null&&(this._pinchCenter=null),NO;var t=this.manufactureTouchEvent(e,"touchmove");return SC.RootResponder.responder.touchmove(t)},_simtouch_mousedown:function(e){this._mousedown=YES;var t=this.manufactureTouchEvent(e,"touchstart");return SC.RootResponder.responder.touchstart(t)},_simtouch_mouseup:function(e){var t=this.manufactureTouchEvent(e,"touchend"),n=SC.RootResponder.responder.touchend(t);return this._mousedown=NO,this._simtouch_counter++,n},manufactureTouchEvent:function(e,t){var n,r,i=this._simtouch_counter;n={type:t,target:e.target,identifier:i,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY},e.touches=[n];
if(e.altKey&&this._pinchCenter!==null){var s=this._pinchCenter.pageX+this._pinchCenter.pageX-e.pageX,o=this._pinchCenter.pageY+this._pinchCenter.pageY-e.pageY,u=this._pinchCenter.screenX+this._pinchCenter.screenX-e.screenX,a=this._pinchCenter.screenY+this._pinchCenter.screenY-e.screenY,f=this._pinchCenter.clientX+this._pinchCenter.clientX-e.clientX,l=this._pinchCenter.clientY+this._pinchCenter.clientY-e.clientY,c=this._simtouch_counter+1;r={type:t,target:e.target,identifier:c,pageX:s,pageY:o,screenX:u,screenY:a,clientX:f,clientY:l},e.touches=[n,r]}return e.changedTouches=e.touches,e},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.iOS||!("onorientationchange"in window)}),function(){var e=navigator.userAgent.toLowerCase();/webkit/.test(e)?(SC.platform.cssPrefix="webkit",SC.platform.domCSSPrefix="Webkit"):/opera/.test(e)?(SC.platform.cssPrefix="opera",SC.platform.domCSSPrefix="O"):/msie/.test(e)&&!/opera/.test(e)?(SC.platform.cssPrefix="ms",SC.platform.domCSSPrefix="ms"):/mozilla/.test(e)&&!/(compatible|webkit)/.test(e)&&(SC.platform.cssPrefix="moz",SC.platform.domCSSPrefix="Moz")}(),function(){var e=document.
createElement("div"),t=["-moz-","-moz-","-o-","-ms-","-webkit-"],n=["moz","Moz","o","ms","webkit"],r="",i=null,s,o;for(i=0,o=t.length;i<o;i++)s=t[i],r+=s+"transition:all 1s linear;",r+=s+"transform: translate(1px, 1px);",r+=s+"perspective: 500px;";e.style.cssText=r;var u;for(i=0,o=n.length;i<o;i++){u=n[i],e.style[u+"TransitionProperty"]!==undefined&&(SC.platform.supportsCSSTransitions=YES),e.style[u+"Transform"]!==undefined&&(SC.platform.supportsCSSTransforms=YES);if(e.style[u+"Perspective"]!==undefined||e.style[u+"PerspectiveProperty"]!==undefined)SC.platform.understandsCSS3DTransforms=YES,SC.platform.supportsCSS3DTransforms=YES}try{window.media&&window.media.matchMedium?window.media.matchMedium("(-webkit-transform-3d)")||(SC.platform.supportsCSS3DTransforms=NO):window.styleMedia&&window.styleMedia.matchMedium&&(window.styleMedia.matchMedium("(-webkit-transform-3d)")||(SC.platform.supportsCSS3DTransforms=NO))}catch(a){SC.platform.supportsCSS3DTransforms=NO}SC.platform.supportsCSSTransforms&&SC.platform.cssPrefix==="webkit"&&(SC.platform.supportsAcceleratedLayers=YES)}(),SC.CAPTURE_BACKSPACE_KEY=NO,SC.APP_HAS_NONSC_IFRAME=NO,SC.RootResponder=SC.Object.extend({panes:null,init:function(){arguments.callee.base.apply(this,arguments),this.panes=SC.Set.create(),SC.platform.supportsCSSTransitions&&(this[SC.platform.cssPrefix+"TransitionEnd"]=this.transitionEnd,this.transitionend=this.transitionEnd)},mainPane:null,makeMainPane:function(e){var t=this.get("mainPane");return t===e?this:(this.beginPropertyChanges(),this.get("keyPane")===t&&this.makeKeyPane(e),this.set("mainPane",e),t&&t
.blurMainTo(e),e&&e.focusMainFrom(t),this.endPropertyChanges(),this)},menuPane:null,makeMenuPane:function(e){if(e&&!e.get("acceptsMenuPane"))return this;var t=this.get("menuPane");return t===e?this:(this.set("menuPane",e),this)},keyPane:null,previousKeyPanes:[],makeKeyPane:function(e){var t,n,r;if(e){if(!e.get("acceptsKeyPane"))return this;n=this.get("keyPane");if(n===e)return this;n&&(r=this.get("previousKeyPanes"),r.push(n)),t=e}else{n=this.get("keyPane"),r=this.get("previousKeyPanes"),t=null;var i;while(r.length>0){i=r.pop();if(i.get("isPaneAttached")&&i.get("acceptsKeyPane")){t=i;break}}}if(!t){var s=this.get("mainPane");s&&s.get("acceptsKeyPane")&&(t=s)}return n&&n.willLoseKeyPaneTo(t),t&&t.willBecomeKeyPaneFrom(n),this.set("keyPane",t),t&&t.didBecomeKeyPaneFrom(n),n&&n.didLoseKeyPaneTo(t),this},currentWindowSize:null,computeWindowSize:function(){var e,t,n;return!this._bod||!this._docElement?(t=document.body,n=document.documentElement,this._bod=t,this._docElement=n):(t=this._bod,n=this._docElement),window.innerHeight?e={width:window.innerWidth,height:window.innerHeight}:n&&n.clientHeight?e={width:n.clientWidth,height:n.clientHeight}:t&&(e={width:t.clientWidth,height:t.clientHeight}),e},resize:function(){return this._resize(),YES},_resize:function(){var e=this.computeWindowSize(),t=this.get("currentWindowSize");this.set("currentWindowSize",e),SC.rectsEqual(e,t)||(SC.device.windowSizeDidChange(e),this.panes&&SC.run(function(){this.panes.invoke("windowSizeDidChange",t,e)},this))},hasFocus:NO,focus:function(e){return!this.get("hasFocus")&&document.hasFocus()&&SC.run(function(
){SC.$("body").addClass("sc-focus").removeClass("sc-blur");if(!SC.TABBING_ONLY_INSIDE_DOCUMENT&&!SC.browser.isIE8OrLower&&!SC.APP_HAS_NONSC_IFRAME){var e=SC.RootResponder.responder.get("keyPane");if(e){var t=e.get("lastViewFirstResponder");if(t)e.makeFirstResponder(t),e.set("lastViewFirstResponder",null);else{var n=e.get("nextValidKeyView");n&&e.makeFirstResponder(n)}}}this.set("hasFocus",YES)},this),YES},focusin:function(e){this._focusTimeout&&clearTimeout(this._focusTimeout),this.focus(e)},focusout:function(e){var t=this;this._focusTimeout=setTimeout(function(){t.blur(e)},300)},blur:function(e){if(this.get("hasFocus")&&!document.hasFocus()){SC.$("body").addClass("sc-blur").removeClass("sc-focus");var t=SC.RootResponder.responder.get("keyPane");if(t){var n=t.get("firstResponder");n&&!SC.browser.isIE8OrLower&&!SC.APP_HAS_NONSC_IFRAME&&n.resignFirstResponder(e)}SC.run(function(){this.set("hasFocus",NO)},this)}return YES},dragDidStart:function(e){this._mouseDownView=e,this._drag=e},defaultResponder:null,sendAction:function(e,t,n,r,i,s){return t=this.targetForAction(e,t,n,r,s),t&&t.isResponderContext?!!t.sendAction(e,n,i,s):t&&t.tryToPerform(e,n)},_responderFor:function(e,t,n){var r=e?e.get("defaultResponder"):null;if(e){e=n||e.get("firstResponder")||e;do if(e.respondsTo(t))return e;while(e=e.get("nextResponder"))}return typeof r===SC.T_STRING&&(r=SC.objectForPropertyPath(r)),r?r.isResponderContext?r:r.respondsTo(t)?r:null:null},targetForAction:function(e,t,n,r,i){if(!e||SC.typeOf(e)!==SC.T_STRING)return null;if(t)return SC.typeOf(t)===SC.T_STRING&&(t=SC.objectForPropertyPath(t
)||SC.objectForPropertyPath(t,n)),t&&!t.isResponderContext&&(t.respondsTo&&!t.respondsTo(e)?t=null:SC.typeOf(t[e])!==SC.T_FUNCTION&&(t=null)),t;if(r){t=this._responderFor(r,e,i);if(t)return t}var s=this.get("keyPane"),o=this.get("mainPane");return s&&s!==r&&(t=this._responderFor(s,e)),!t&&o&&o!==s&&(t=this._responderFor(o,e)),!t&&(t=this.get("defaultResponder"))&&(SC.typeOf(t)===SC.T_STRING&&(t=SC.objectForPropertyPath(t),t&&this.set("defaultResponder",t)),t&&!t.isResponderContext&&(t.respondsTo&&!t.respondsTo(e)?t=null:SC.typeOf(t[e])!==SC.T_FUNCTION&&(t=null))),t},targetViewForEvent:function(e){return e.target?SC.$(e.target).view()[0]:null},sendEvent:function(e,t,n){var r,i;return SC.run(function(){n?r=n.get("pane"):r=this.get("menuPane")||this.get("keyPane")||this.get("mainPane"),i=r?r.sendEvent(e,t,n):null},this),i},listenFor:function(e,t,n,r){return n=n?n:this,e.forEach(function(e){var i=n[e];i&&SC.Event.add(t,e,n,i,null,r)},this),t=null,n},setup:function(){this.listenFor(["touchstart","touchmove","touchend","touchcancel"],document),this.listenFor(["keydown","keyup","beforedeactivate","mousedown","mouseup","click","dblclick","mousemove","selectstart","contextmenu","scroll"],document).listenFor(["resize"],window),SC.browser.isIE8OrLower?this.listenFor(["focusin","focusout"],document):this.listenFor(["focus","blur"],window),this.listenFor(["webkitAnimationStart","webkitAnimationIteration","webkitAnimationEnd"],document),SC.platform.supportsCSSTransitions&&this.listenFor(["transitionend",SC.platform.cssPrefix+"TransitionEnd"],document);if(this.keypress)if(SC.CAPTURE_BACKSPACE_KEY&&
SC.browser.mozilla){var e=this;document.onkeypress=function(t){return t=SC.Event.normalizeEvent(t),e.keypress.call(e,t)}}else SC.Event.add(document,"keypress",this,this.keypress);["drag","selectstart"].forEach(function(e){var t=this[e];if(t)if(SC.browser.msie){var n=this;document.body["on"+e]=function(e){return t.call(n,SC.Event.normalizeEvent(event||window.event))},SC.Event.add(window,"unload",this,function(){document.body["on"+e]=null})}else SC.Event.add(document,e,this,t)},this);var t="mousewheel";if(SC.browser.mozilla)SC.browser.compareVersion(1,9,1)<0?t="DOMMouseScroll":t="MozMousePixelScroll";else if(parseInt(SC.browser.chrome)>=31||parseInt(SC.browser.msie)>=9||parseInt(SC.browser.safari)>=600||SC.browser.isEdge)t="wheel";SC.Event.add(document,t,this,this.mousewheel),this.set("currentWindowSize",this.computeWindowSize());if(SC.browser.mobileSafari){SC.platform&&!SC.platform.touch&&SC.platform.simulateTouchEvents();var n=SC.RunLoop.prototype.endRunLoop,r;r=function(){n&&n.apply(this,arguments);var e=SC.RootResponder.responder._touches,t,r,i,s,o,u=NO;if(e)for(t in e){if(e[t]._rescuedElement)continue;i=r=e[t].target;while(r&&(r=r.parentNode)&&!u)u=r===document.body;if(!u&&i){if(i.parentNode&&i.cloneNode){var a=i.cloneNode(!0);i.parentNode.replaceChild(a,i),i.swapNode=a}var l=SC.touchHoldingPen;l||(l=SC.touchHoldingPen=document.createElement("div"),l.style.display="none",document.body.appendChild(l)),l.appendChild(i),e[t]._rescuedElement=i}}},SC.RunLoop.prototype.endRunLoop=r}},_touchedViews:{},_touches:{},touchesForView:function(e){if(this._touchedViews[SC.guidFor(e)])return this
._touchedViews[SC.guidFor(e)].touches},averagedTouchesForView:function(e,t){var n=this.touchesForView(e),r=e._scrr_averagedTouches||(e._scrr_averagedTouches={});if((!n||n.length===0)&&!t)r.x=0,r.y=0,r.d=0,r.touchCount=0;else{var i=this._averagedTouches_touches||(this._averagedTouches_touches=[]),s;i.length=0;if(n){var o;s=n.length;for(o=0;o<s;o++)i.push(n[o])}t&&i.push(t);var u,a,f=0,l=0,c,h,p=0;s=i.length;for(u=0;u<s;u++)a=i[u],f+=a.pageX,l+=a.pageY;f/=s,l/=s;for(u=0;u<s;u++)a=i[u],c=Math.abs(a.pageX-f),h=Math.abs(a.pageY-l),p+=Math.pow(c*c+h*h,.5);p/=s,r.x=f,r.y=l,r.d=p,r.touchCount=s}return r},assignTouch:function(e,t){if(e.hasEnded)throw"Attemt to assign a touch that is already finished.";if(e.view===t)return;e.view&&this.unassignTouch(e),this._touchedViews[SC.guidFor(t)]||(this._touchedViews[SC.guidFor(t)]={view:t,touches:SC.CoreSet.create([]),touchCount:0},t.set("hasTouch",YES)),e.view=t,this._touchedViews[SC.guidFor(t)].touches.add(e),this._touchedViews[SC.guidFor(t)].touchCount++},unassignTouch:function(e){var t,n;if(!e.view)return;t=e.view,n=this._touchedViews[SC.guidFor(t)],n.touches.remove(e),n.touchCount--,n.touchCount<1&&(t.set("hasTouch",NO),n.view=null,delete this._touchedViews[SC.guidFor(t)]),e.view=undefined},_flushQueuedTouchResponder:function(){if(this._queuedTouchResponder){var e=this._queuedTouchResponder;this._queuedTouchResponder=null,this.makeTouchResponder.apply(this,e)}},makeTouchResponder:function(e,t,n,r){if(this._isMakingTouchResponder){this._queuedTouchResponder=[e,t,n,r];return}this._isMakingTouchResponder=YES;var i=e.touchResponders,s;if(e.touchResponder===
t){this._isMakingTouchResponder=NO,this._flushQueuedTouchResponder();return}var o;t?o=t.get("pane"):o=this.get("keyPane")||this.get("mainPane");if(i.indexOf(t)<0)if(r)try{t=o?o.sendEvent("touchStart",e,t):null}catch(u){SC.Logger.error("Error in touchStart: "+u),t=null}else t&&((t.get?t.get("acceptsMultitouch"):t.acceptsMultitouch)||!t.hasTouch)&&(t.touchStart(e)||(t=null));if(!n||i.indexOf(t)>-1&&i[i.length-1]!==t){this.unassignTouch(e);var a=i.length-1,f=i[a];while(f&&f!==t)s=this.touchesForView(f),((f.get?f.get("acceptsMultitouch"):f.acceptsMultitouch)||!s)&&f.touchCancelled&&f.touchCancelled(e),a--,f=i[a],i.pop(),e.touchResponder=i[a],e.nextTouchResponder=i[a-1]}t&&(this.assignTouch(e,t),t!==e.touchResponder&&(i.push(t),e.touchResponder=t,e.nextTouchResponder=i[i.length-2])),this._isMakingTouchResponder=NO,this._flushQueuedTouchResponder()},captureTouch:function(e,t,n){t||(t=this);var r=e.targetView,i=r,s=[],o,u;SC.LOG_TOUCH_EVENTS&&SC.Logger.info(" -- Received one touch on %@".fmt(r.toString()));while(i&&i!==t)s.unshift(i),i=i.get("nextResponder");for(u=s.length,o=0;o<u;o++){i=s[o],SC.LOG_TOUCH_EVENTS&&SC.Logger.info(" -- Checking %@ for captureTouch response…".fmt(i.toString()));if(i.tryToPerform("captureTouch",e)){SC.LOG_TOUCH_EVENTS&&SC.Logger.info(" -- Making %@ touch responder because it returns YES to captureTouch".fmt(i.toString())),this.makeTouchResponder(e,i,n,YES);return}}SC.LOG_TOUCH_EVENTS&&SC.Logger.info(" -- Didn't find a view that returned YES to captureTouch, so we're calling touchStart"),this.makeTouchResponder(e,r,n,YES)},endMissingTouches:function(
e){var t,n=e.length,r={},i=[];for(t=0;t<n;t++)r[e[t].identifier]=YES;for(t in this._touches){var s=this._touches[t].identifier;r[s]||i.push(this._touches[t])}for(t=0,n=i.length;t<n;t++)this.endTouch(i[t]),this.finishTouch(i[t])},_touchCount:0,endTouch:function(e,t,n){t||(t="touchEnd");var r,i,s,o;this.unassignTouch(e);if(e.touchResponder){o=e.touchResponder,i=e.touchResponders,r=i.length-1,s=i[r];while(s){s[t]&&s[t](e,n);if(e.touchResponder!==o)break;r--,s=i[r],t="touchCancelled"}}},finishTouch:function(e){var t;this.unassignTouch(e);if(t=e._rescuedElement)t.swapNode&&t.swapNode.parentNode?t.swapNode.parentNode.replaceChild(t,t.swapNode):t.parentNode===SC.touchHoldingPen&&SC.touchHoldingPen.removeChild(t),delete e._rescuedElement,t.swapNode=null,t=null;e.touchResponders=null,e.touchResponder=null,e.nextTouchResponder=null,e.hasEnded=YES,this._touches[e.identifier]&&delete this._touches[e.identifier]},touchstart:function(e){if(this.ignoreTouchHandle(e))return YES;var t=NO;return SC.run(function(){this.endMissingTouches(e.touches);var n,r=e.changedTouches,i=r.length,s,o,u,a;e.touchContext=this;for(n=0;n<i;n++){u=r[n],a=SC.Touch.create(u,this);if(!a.targetView)continue;a.hidesTouchIntercept&&(t=YES),a.timeStamp=e.timeStamp,this._touches[u.identifier]=a,a.event=e,this.captureTouch(a,this),a.event=null}},this),t?YES:e.hasCustomEventHandling},touchmove:function(e){return this.ignoreTouchHandle(e)?YES:(SC.run(function(){var t=e.changedTouches,n,r,i,s=t.length,o,u,a,f,l={},c,h,p=NO;this._drag&&(n=SC.Touch.create(e.changedTouches[0],this),this._drag.tryToPerform("mouseDragged",n));for(
i=0;i<s;i++){n=t[i],r=this._touches[n.identifier];if(!r)continue;r.hidesTouchIntercept&&(p=YES),r.pageX=n.pageX,r.pageY=n.pageY,r.clientX=n.clientX,r.clientY=n.clientY,r.screenX=n.screenX,r.screenY=n.screenY,r.timeStamp=e.timeStamp,r.event=e,r.touchResponder&&(o=r.touchResponder,h=SC.guidFor(o),l[h]||(l[h]={view:o,touches:[]}),l[h].touches.push(r))}if(p)return e.allowDefault(),YES;for(i in l)o=l[i].view,u=l[i].touches,e.viewChangedTouches=u,a=this.touchesForView(o),f=a.firstObject(),e.pageX=f.pageX,e.pageY=f.pageY,e.clientX=f.clientX,e.clientY=f.clientY,e.screenX=f.screenX,e.screenY=f.screenY,e.touchContext=this,o.tryToPerform("touchesDragged",e,a);t=e.changedTouches,s=t.length;for(i=0;i<s;i++)n=t[i],r=this._touches[n.identifier],r&&(r.event=null)},this),e.hasCustomEventHandling)},touchend:function(e){var t=NO;return this.ignoreTouchHandle(e)?YES:(SC.run(function(){var n=e.changedTouches,r,i,s,o=n.length,u,a,f=e.isCancel?"touchCancelled":"touchEnd",l,c,h,p;for(s=0;s<o;s++){r=n[s],r.type="touchend",i=this._touches[r.identifier];if(!i)continue;i.timeStamp=e.timeStamp,i.pageX=r.pageX,i.pageY=r.pageY,i.clientX=r.clientX,i.clientY=r.clientY,i.screenX=r.screenX,i.screenY=r.screenY,i.type="touchend",i.event=e,SC.LOG_TOUCH_EVENTS&&SC.Logger.info("-- Received touch end"),i.hidesTouchIntercept&&(i.unhideTouchIntercept(),t=YES),this._drag&&(this._drag.tryToPerform("mouseUp",r),this._drag=null),this.endTouch(i,f,e),this.finishTouch(i)}},this),t?YES:e.hasCustomEventHandling)},touchcancel:function(e){e.isCancel=YES,this.touchend(e)},ignoreTouchHandle:function(e){if(SC.browser.isMobileSafari||
SC.browser.android||SC.browser.silk){var t=e.target.tagName;if(t==="INPUT"||t==="A")return e.allowDefault(),YES}return NO},attemptKeyEquivalent:function(e){var t=e.commandCodes()[0],n=null;if(!t)return n;var r=this.get("menuPane"),i=this.get("keyPane"),s=this.get("mainPane");if(r){n=r.performKeyEquivalent(t,e);if(n)return n}if(i){n=i.performKeyEquivalent(t,e);if(n||i.get("isModal"))return n}if(!n&&s&&s!==i){n=s.performKeyEquivalent(t,e);if(n||s.get("isModal"))return n}return n},_lastModifiers:null,_handleModifierChanges:function(e){var t;t=this._lastModifiers=this._lastModifiers||{alt:!1,ctrl:!1,shift:!1};var n=!1;return e.altKey!==t.alt&&(t.alt=e.altKey,n=!0),e.ctrlKey!==t.ctrl&&(t.ctrl=e.ctrlKey,n=!0),e.shiftKey!==t.shift&&(t.shift=e.shiftKey,n=!0),e.modifiers=t,n?this.sendEvent("flagsChanged",e)?e.hasCustomEventHandling:YES:YES},_isModifierKey:function(e){return!!SC.MODIFIER_KEYS[e.charCode]},keydown:function(e){if(SC.none(e))return YES;var t=e.keyCode;this._lastKeyDownKeyCodeForKeyPress=t,SC.browser.mozilla&&e.keyCode===9&&(this.keydownCounter=1);if(t===229)return this._IMEInputON=YES,this.sendEvent("keyDown",e);if(t===27&&this._drag)return this._drag.cancelDrag(),this._drag=null,this._mouseDownView=null,YES;if(SC.browser.mozilla&&e.which===8)return!0;var n=this._handleModifierChanges(e),r=e.target||e.srcElement,i=e.which===8&&!SC.allowsBackspaceToPreviousPage&&r===document.body;if(this._isModifierKey(e))return i?NO:n;n=YES;if(SC.isFunctionOrNonPrintableKey(e)){if(t>=37&&t<=40&&SC.browser.mozilla)return YES;n=this.sendEvent("keyDown",e),n?(n=e.hasCustomEventHandling,n&&(
i=NO)):n=SC.run(function(){return!this.attemptKeyEquivalent(e)},this)}return i?NO:n},keypress:function(e){var t,n=e.keyCode,r=!!SC.browser.mozilla;e.keyCode=e.which=this._lastKeyDownKeyCodeForKeyPress;if(SC.browser.mozilla&&e.keyCode===9){this.keydownCounter++;if(this.keydownCounter==2)return YES}if(r&&e.which===8)return t=this.sendEvent("keyDown",e)||!this.attemptKeyEquivalent(e),t?SC.allowsBackspaceToPreviousPage||e.hasCustomEventHandling:YES;var i=n>=37&&n<=40&&r,s=e.charCode;if(s!==undefined&&s===0&&e.keyCode!==9&&!i)return YES;if(i||!SC.isFunctionOrNonPrintableKey(e))t=this.sendEvent("keyDown",e),t?t=e.hasCustomEventHandling:t=!this.attemptKeyEquivalent(e);return t},keyup:function(e){this._lastKeyDownKeyCodeForKeyPress=null,this._ffevt&&(this._ffevt=null);var t=this._handleModifierChanges(e);return this._isModifierKey(e)?t:(this._IMEInputON&&e.keyCode===13&&(e.isIMEInput=YES,this.sendEvent("keyDown",e),this._IMEInputON=NO),this.sendEvent("keyUp",e)?e.hasCustomEventHandling:YES)},beforedeactivate:function(e){var t=e.toElement;if(t&&t.tagName&&t.tagName!=="IFRAME"){var n=SC.$(t).view()[0];if(n&&n.get("blocksIEDeactivate"))return NO}return YES},mousedown:function(e){if(SC.platform.touch)return e.allowDefault(),this._lastMouseDownCustomHandling=YES,YES;if(e.target&&e.target.tagName==="HTML")return YES;this._clickCount+=1;if(!this._lastMouseUpAt||Date.now()-this._lastMouseUpAt>250)this._clickCount=1;else{var t=this._lastMouseDownX-e.clientX,n=this._lastMouseDownY-e.clientY,r=Math.sqrt(t*t+n*n);r>8&&(this._clickCount=1)}e.clickCount=this._clickCount,this._lastMouseDownX=e.clientX
,this._lastMouseDownY=e.clientY;var i,s=this.targetViewForEvent(e);s&&(i=s.getPath("pane.firstResponder")),i&&i.get("blurOnMouseDown")&&i!==s&&i.resignFirstResponder(e),s=this._mouseDownView=this.sendEvent("mouseDown",e,s),s&&s.respondsTo("mouseDragged")&&(this._mouseCanDrag=YES);var o=s?e.hasCustomEventHandling:YES;return this._lastMouseDownCustomHandling=o,o},mouseup:function(e){var t=NO;if(SC.platform.touch)return e.allowDefault(),this._lastMouseUpCustomHandling=YES,YES;this._drag&&(this._drag.tryToPerform("mouseUp",e),this._drag=null);var n=null,r=this._mouseDownView,i=this.targetViewForEvent(e);e.clickCount=this._clickCount,r&&(n=this.sendEvent("mouseUp",e,r),!n&&this._clickCount===2&&(n=this.sendEvent("doubleClick",e,r),t=YES),n||(n=this.sendEvent("click",e,r),t=YES)),!n&&!t&&(this._clickCount===2&&(n=this.sendEvent("doubleClick",e,i)),n||(n=this.sendEvent("click",e,i))),this._mouseCanDrag=NO,this._mouseDownView=null,this._lastMouseUpAt=Date.now();var s=n?e.hasCustomEventHandling:YES;return this._lastMouseUpCustomHandling=s,s},click:function(e){return!this._lastMouseUpCustomHandling||!this._lastMouseDownCustomHandling?(e.preventDefault(),e.stopPropagation(),NO):YES},dblclick:function(e){SC.browser.isIE8OrLower&&(this._clickCount=2,this._mouseDownView=this.targetViewForEvent(e),this.mouseup(e))},mousewheel:function(e){var t=this.targetViewForEvent(e),n=this.sendEvent("mouseWheel",e,t);return n?e.hasCustomEventHandling:YES},_lastHovered:null,mousemove:function(e){if(SC.platform.touch)return e.allowDefault(),YES;if(SC.browser.msie&&this._lastMoveX===e.clientX&&this._lastMoveY===
e.clientY)return;this._lastMoveX=e.clientX,this._lastMoveY=e.clientY,SC.run(function(){if(this._drag)SC.browser.msie?(this._lastMouseDownX!==e.clientX||this._lastMouseDownY!==e.clientY)&&this._drag.tryToPerform("mouseDragged",e):this._drag.tryToPerform("mouseDragged",e);else{var t=this._lastHovered||[],n=[],r,i,s,o=this.targetViewForEvent(e);while(o&&o!==this)n.push(o),o=o.get("nextResponder");for(i=0,s=t.length;i<s;i++)o=t[i],r=o.respondsTo("mouseExited"),r&&n.indexOf(o)===-1&&o.tryToPerform("mouseExited",e);for(i=0,s=n.length;i<s;i++)o=n[i],t.indexOf(o)!==-1?o.tryToPerform("mouseMoved",e):o.tryToPerform("mouseEntered",e);this._lastHovered=n,this._mouseDownView&&(SC.browser.msie?this._lastMouseDownX!==e.clientX&&this._lastMouseDownY!==e.clientY&&this._mouseDownView.tryToPerform("mouseDragged",e):this._mouseDownView.tryToPerform("mouseDragged",e))}},this)},_mouseCanDrag:YES,selectstart:function(e){var t=this.targetViewForEvent(e),n=this.sendEvent("selectStart",e,t);return t&&t.respondsTo("mouseDragged")?(n!==null?YES:NO)&&!this._mouseCanDrag:n!==null?YES:NO},drag:function(){return!1},contextmenu:function(e){var t=this.targetViewForEvent(e);return this.sendEvent("contextMenu",e,t)?NO:YES},scroll:function(e){var t=this.targetViewForEvent(e);return this.sendEvent("scroll",e,t)?NO:YES},webkitAnimationStart:function(e){var t;try{t=this.targetViewForEvent(e),this.sendEvent("animationDidStart",e,t)}catch(n){throw SC.Logger.warn("Exception during animationDidStart: %@".fmt(n)),n}return t?e.hasCustomEventHandling:YES},webkitAnimationIteration:function(e){var t;try{t=this.targetViewForEvent
(e),this.sendEvent("animationDidIterate",e,t)}catch(n){throw SC.Logger.warn("Exception during animationDidIterate: %@".fmt(n)),n}return t?e.hasCustomEventHandling:YES},webkitAnimationEnd:function(e){var t;try{t=this.targetViewForEvent(e),this.sendEvent("animationDidEnd",e,t)}catch(n){throw SC.Logger.warn("Exception during animationDidEnd: %@".fmt(n)),n}return t?e.hasCustomEventHandling:YES},transitionEnd:function(e){var t;try{t=this.targetViewForEvent(e),this.sendEvent("transitionDidEnd",e,t)}catch(n){throw SC.Logger.warn("Exception during transitionDidEnd: %@".fmt(n)),n}return t?e.hasCustomEventHandling:YES}}),SC.Touch=function(e,t){this.touchContext=t,this.identifier=e.identifier;var n=e.target,r;n&&SC.$(n).hasClass("touch-intercept")?(e.target.style.webkitTransform="translate3d(0px,-5000px,0px)",n=document.elementFromPoint(e.pageX,e.pageY),n&&(r=SC.$(n).view()[0]),this.hidesTouchIntercept=NO,n.tagName==="INPUT"?this.hidesTouchIntercept=e.target:e.target.style.webkitTransform="translate3d(0px,0px,0px)"):r=e.target?SC.$(e.target).view()[0]:null,this.targetView=r,this.target=n,this.hasEnded=NO,this.type=e.type,this.clickCount=1,this.view=undefined,this.touchResponder=this.nextTouchResponder=undefined,this.touchResponders=[],this.startX=this.pageX=e.pageX,this.startY=this.pageY=e.pageY,this.clientX=e.clientX,this.clientY=e.clientY,this.screenX=e.screenX,this.screenY=e.screenY},SC.Touch.prototype={unhideTouchIntercept:function(){var e=this.hidesTouchIntercept;e&&setTimeout(function(){e.style.webkitTransform="translate3d(0px,0px,0px)"},500)},allowDefault:function(){this.event&&
(this.event.hasCustomEventHandling=YES)},preventDefault:function(){this.event&&this.event.preventDefault()},stopPropagation:function(){this.event&&this.event.stopPropagation()},stop:function(){this.event&&this.event.stop()},end:function(){this.touchContext.endTouch(this)},makeTouchResponder:function(e,t,n){this.touchContext.makeTouchResponder(this,e,t,n)},captureTouch:function(e,t){this.touchContext.captureTouch(this,e,t)},touchesForView:function(e){return this.touchContext.touchesForView(e)},touchesForResponder:function(e){return this.touchContext.touchesForView(e)},averagedTouchesForView:function(e,t){return this.touchContext.averagedTouchesForView(e,t?this:null)}},SC.mixin(SC.Touch,{create:function(e,t){return new SC.Touch(e,t)}}),SC.ready(SC.RootResponder,SC.RootResponder.ready=function(){var e;e=SC.RootResponder.responder=SC.RootResponder.create(),e.setup();if(window.addEventListener){var t={target:null};window.addEventListener("focus",function(){SC.run(function(){t.target=document.activeElement;var n=e.targetViewForEvent(t);while(n&&!n.get("acceptsFirstResponder"))n=n.get("parentView");return n&&n.get("focusEventMakesFirstResponder")&&n.becomeFirstResponder(),YES})},!0)}}),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 e=SC.RootResponder.responder,t=e._lastMoveX,n=e._lastMoveY;return SC.empty(t)||SC.empty(n)?null:{x:t,y:n}}.property(),init:function(){arguments.callee.base.apply(this,arguments),navigator&&navigator.onLine===!1&&
this.set("isOffline",YES)},setup:function(){var e=SC.RootResponder.responder;e.listenFor(["online","offline"],window,this),this.orientationHandlingShouldChange()},orientationHandlingShouldChange:function(){SC.platform.windowSizeDeterminesOrientation?(SC.Event.remove(window,"orientationchange",this,this.orientationchange),this.windowSizeDidChange(SC.RootResponder.responder.get("currentWindowSize"))):SC.platform.supportsOrientationChange&&(SC.Event.add(window,"orientationchange",this,this.orientationchange),this.orientationchange())},windowSizeDidChange:function(e){return SC.platform.windowSizeDeterminesOrientation?(SC.browser.iOS?SC.run(function(){e.width===window.screen.width?SC.device.set("orientation",SC.PORTRAIT_ORIENTATION):SC.device.set("orientation",SC.LANDSCAPE_ORIENTATION)}):SC.run(function(){SC.platform.touch?e.height>=e.width?SC.device.set("orientation",SC.PORTRAIT_ORIENTATION):SC.device.set("orientation",SC.LANDSCAPE_ORIENTATION):SC.device.set("orientation",SC.NO_ORIENTATION)}),YES):NO},orientationchange:function(e){SC.run(function(){window.orientation===0||window.orientation===180?SC.device.set("orientation",SC.PORTRAIT_ORIENTATION):SC.device.set("orientation",SC.LANDSCAPE_ORIENTATION)})},orientationObserver:function(){var e=SC.$(document.body),t=this.get("orientation");t===SC.PORTRAIT_ORIENTATION?e.addClass("portrait"):e.removeClass("portrait"),t===SC.LANDSCAPE_ORIENTATION?e.addClass("landscape"):e.removeClass("landscape")}.observes("orientation"),online:function(e){this.set("isOffline",NO)},offline:function(e){this.set("isOffline",YES)}}),SC.ready(function(){SC
.device.setup()}),SC.Page=SC.Object.extend({owner:null,get:function(e){var t=this[e];return t&&t.isClass?(this[e]=t=t.create({page:this}),t.awake(),t):arguments.callee.base.apply(this,arguments)},awake:function(){var e,t;for(t in this){if(!this.hasOwnProperty(t))continue;e=this[t],e&&e.isViewClass&&(this[t]=e=e.create({page:this}))}return this},getIfConfigured:function(e){var t=this[e];return t&&t.isViewClass?null:this.get(e)}}),SC.Page.design=SC.Page.create,SC.Page.localization=function(e){return e},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,t){var n,r;t&&(this.prevObject=t,this.strings=t.strings,this.offset=t.length+t.offset),this.strings||(this.strings=[]),e===undefined?(e="div",r=YES):e==="div"||e==="label"||e==="a"?r=YES:SC.typeOf(e)===SC.T_STRING&&(e=e.toLowerCase(),r=YES);if(r){this._tagName=e,this._needsTag=YES,this.needsContent=YES;var i=this;while(i)i.length++,i=i.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(e){var t=this.strings||[];return e===undefined?t.slice(this.offset
,this.length):t[e+this.offset]},push:function(e){var t=this.strings,n=arguments.length;t||(this.strings=t=[]),n>1?t.push.apply(t,arguments):t.push(e);var r=this;while(r)r.length+=n,r=r.prevObject;return this.needsContent=YES,this},text:function(e){var t=arguments.length,n=0;for(n=0;n<t;n++)this.push(SC.RenderContext.escapeHTML(arguments[n]));return this},join:function(e){this._needsTag&&this.end();var t=this.strings;return t?t.join(e||""):""},begin:function(e){return SC.RenderContext(e,this)},element:function(){return this._elem?this._elem:SC.$(this.join())[0]},remove:function(e){if(!e)return;var t,n=this._elem;if(!n||!n.removeChild)return;t=document.getElementById(e),t&&(t=n.removeChild(t),t=null)},update:function(){var e=this._elem,t=this.updateMode,n,r,i,s,o;this._innerHTMLReplaced=NO;if(!e)return;n=this.$();if(this.length>0){this._innerHTMLReplaced=YES;if(t===SC.MODE_REPLACE)n.html(this.join());else{i=e.cloneNode(!1),i.innerHTML=this.join(),s=i.firstChild;while(s)o=s.nextSibling,e.insertBefore(s,o),s=o;s=o=i=null}}return this._idDidChange&&(r=this._id)&&n.attr("id",r),jQuery.Buffer.flush(),e=this._elem=null,this.prevObject||this},_DEFAULT_ATTRS:{},end:function(){var e=this._classNames,t=this._styles,n=this._attrs,r=this._id,i=SC.RenderContext,s="",o="",u,a,f,l,c,h,p;s="<"+this._tagName;if(n||e||t||r){n||(n=this._DEFAULT_ATTRS),r&&(n.id=r),e&&(n["class"]=e.join(" "));if(t){for(f in t){if(!t.hasOwnProperty(f))continue;l=t[f];if(l===null)continue;typeof l===SC.T_NUMBER&&!SC.NON_PIXEL_PROPERTIES.contains(f)&&(l+="px"),o=o+this._dasherizeStyleName(f)+": "+l+"; "}n.style=o}s+=" "
;for(f in n){if(!n.hasOwnProperty(f))continue;l=n[f];if(l===null)continue;p=i.escapeAttribute(l),s=s+f+'="'+p+'" '}n===this._DEFAULT_ATTRS&&(delete n.style,delete n["class"],delete n.id)}c=this.strings,h=this._selfClosing===NO?NO:this.length===1,s+=h?" />":">",c[this.offset]=s;if(!h){c.push("</"+this._tagName+">");var d=this;while(d)d.length++,d=d.prevObject}return this._elem=null,this.prevObject||this},tag:function(e,t){return this.begin(e,t).end()},tagName:function(e){return e===undefined?(!this._tagName&&this._elem&&(this._tagName=this._elem.tagName),this._tagName):(this._tagName=e,this._tagNameDidChange=YES,this)},id:function(e){return e===undefined?(!this._id&&this._elem&&(this._id=this._elem.id),this._id):(this._id=e,this._idDidChange=YES,this)},classNames:function(e,t){return this._elem?e?(this.$().resetClassNames().addClass(e),this):this.$().attr("class").split(" "):e===undefined?(this._cloneClassNames&&(this._classNames=(this._classNames||[]).slice(),this._cloneClassNames=NO),this._classNames||(this._classNames=[]),this._classNames):(this._classNames=e,this._cloneClassNames=t||NO,this._classNamesDidChange=YES,this)},hasClass:function(e){return this._elem?this.$().hasClass(e):this.classNames().indexOf(e)>=0},addClass:function(e){if(e===undefined||e===null)return SC.Logger.warn("You are adding an undefined or empty class"+this.toString()),this;if(this._elem){if(SC.typeOf(e)===SC.T_STRING)this.$().addClass(e);else{var t,n=e.length;for(t=0;t<n;t++)this.$().addClass(e[t])}return this}var r=this.classNames();if(SC.typeOf(e)===SC.T_STRING)r.indexOf(e)<0&&(r.push(e),this._classNamesDidChange=
YES);else{var i;for(var s=0,o=e.length;s<o;s++)i=e[s],r.indexOf(i)<0&&(r.push(i),this._classNamesDidChange=YES)}return this},removeClass:function(e){if(this._elem)return this.$().removeClass(e),this;var t=this._classNames,n;return t&&(n=t.indexOf(e))>=0&&(this._cloneClassNames&&(t=this._classNames=t.slice(),this._cloneClassNames=NO),t[n]=null,this._classNamesDidChange=YES),this},resetClassNames:function(){return this._elem?(this.$().resetClassNames(),this):(this._classNames=[],this._classNamesDidChange=YES,this)},setClass:function(e,t){if(this._elem)return this.$().setClass(e,t),this;var n,r,i,s;if(t!==undefined)return t?this.addClass(e):this.removeClass(e);n=this._classNames,n||(n=this._classNames=[]),this._cloneClassNames&&(n=this._classNames=n.slice(),this._cloneClassNames=NO),s=NO;for(i in e){if(!e.hasOwnProperty(i))continue;r=n.indexOf(i),e[i]?r<0&&(n.push(i),s=YES):r>=0&&(n[r]=null,s=YES)}return s&&(this._classNamesDidChange=YES),this},_STYLE_REGEX:/-?\s*([^:\s]+)\s*:\s*([^;]+)\s*;?/g,styles:function(e,t){if(this._elem)return e&&this.$().resetStyles().css(e),this.$().styles();var n,r,i;if(e===undefined){if(!this._styles&&this._elem){n=this.$().attr("style");if(n&&(n=n.toString()).length>0){SC.browser.msie&&(n=n.toLowerCase()),e={},r=this._STYLE_REGEX,r.lastIndex=0;while(i=r.exec(n))e[this._camelizeStyleName(i[1])]=i[2];this._styles=e,this._cloneStyles=NO}else this._styles={}}else this._styles?this._cloneStyles&&(this._styles=SC.clone(this._styles),this._cloneStyles=NO):this._styles={};return this._styles}return this._styles=e,this._cloneStyles=t||NO,this._stylesDidChange=
YES,this},_deleteComboStyles:function(e,t){var n=SC.COMBO_STYLES[t],r=NO,i;if(n)for(var s=0,o=n.length;s<o;s++)i=n[s],e[i]&&(delete e[i],r=YES);return r},resetStyles:function(){return this.styles({}),this},addStyle:function(e,t){if(this._elem)return this.$().css(e,t),this;var n,r=NO,i=this.styles();if(typeof e===SC.T_STRING){if(t===undefined)return i[e];r=this._deleteComboStyles(i,e),i[e]!==t&&(i[e]=t,r=YES),r&&(this._stylesDidChange=YES)}else{for(n in e){if(!e.hasOwnProperty(n))continue;r=r||this._deleteComboStyles(i,n),t=e[n],i[n]!==t&&(i[n]=t,r=YES)}r&&(this._stylesDidChange=YES)}return this},removeStyle:function(e){if(this._elem)return this.$().css(e,null),this;if(!this._styles)return this;var t=this.styles();t[e]&&(t[e]=null,this._stylesDidChange=YES)},attr:function(e,t){if(this._elem)return this.$().attr(e,t),this;var n,r=this._attrs,i=NO;r||(this._attrs=r={});if(typeof e===SC.T_STRING){if(t===undefined)return r[e];r[e]!==t&&(r[e]=t,this._attrsDidChange=YES)}else{for(n in e){if(!e.hasOwnProperty(n))continue;t=e[n],r[n]!==t&&(r[n]=t,i=YES)}i&&(this._attrsDidChange=YES)}return this},removeAttr:function(e){if(this._elem)return this.$().removeAttr(e),this},$:function(e){var t,n=this._elem;return t=n?e===undefined?SC.$.buffer(n):SC.$.buffer(e,n):SC.$.buffer([]),n=null,t},_camelizeStyleName:function(e){var t=e.match(/^-(webkit|moz|o)-/),n=SC.String.camelize(e);return t?n.substr(0,1).toUpperCase()+n.substr(1):n},_dasherizeStyleName:function(e){var t=SC.String.dasherize(e);return t.match(/^(webkit|moz|ms|o)-/)&&(t="-"+t),t}}),SC.RenderContext.fn.html=SC.RenderContext.fn.push,SC
.RenderContext.fn.css=SC.RenderContext.fn.addStyle,function(){var e=/[&<>]/g,t=function(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;"}},n=/[\/\*\+\^'"%`=, ]/g,r=function(e){switch(e){case'"':return"&quot;";case" ":return"&#32;";case"%":return"&#37;";case"'":return"&#39;";case"*":return"&#42;";case"+":return"&#43;";case",":return"&#44;";case"/":return"&#47;";case"=":return"&#61;";case"^":return"&#94;";case"`":return"&#96;"}};SC.RenderContext.escapeHTML=function(n){return SC.none(n)?"":n.replace(e,t)},SC.RenderContext.escapeAttribute=function(i){if(SC.none(i))return;return SC.typeOf(i)!==SC.T_STRING&&(i=String(i)),i.replace(e,t).replace(n,r)}}(),SC.SelectionSet=SC.Object.extend(SC.Enumerable,SC.Freezable,SC.Copyable,{isSelectionSet:YES,length:function(){var e=0,t=this._sets,n=this._objects;return n&&(e+=n.get("length")),t&&t.forEach(function(t){e+=t.get("length")}),e}.property().cacheable(),sources:function(){var e=[],t=this._sets,n=t?t.length:0,r,i,s;for(r=0;r<n;r++)i=t[r],i&&i.get("length")>0&&i.source&&e.push(i.source);return e}.property().cacheable(),indexSetForSource:function(e){if(!e||!e.isSCArray)return null;var t=this._indexSetCache,n=this._objects,r,i;return t||(t=this._indexSetCache={}),r=t[SC.guidFor(e)],r&&r._sourceRevision&&r._sourceRevision!==e.propertyRevision&&(r=null),r||(r=this._indexSetForSource(e,NO),r&&r.get("length")===0&&(r=null),n&&(r&&(r=r.copy()),n.forEach(function(t){(i=e.indexOf(t))>=0&&(r||(r=SC.IndexSet.create()),r.add(i))},this)),r&&(r=t[SC.guidFor(e)]=r.frozenCopy(),r._sourceRevision=e.propertyRevision)),r},_indexSetForSource
:function(e,t){t===undefined&&(t=YES);var n=SC.guidFor(e),r=this[n],i=this._sets,s=i?i.length:0,o=null;return r>=s&&(r=null),SC.none(r)?t&&!this.isFrozen&&(this.propertyWillChange("sources"),i||(i=this._sets=[]),o=i[s]=SC.IndexSet.create(),o.source=e,this[n]=s,this.propertyDidChange("sources")):o=i?i[r]:null,o},add:function(e,t,n){if(this.isFrozen)throw SC.FROZEN_ERROR;var r,i,s,o,u,a,f,l;if(t===undefined&&n===undefined){if(!e)throw"Must pass params to SC.SelectionSet.add()";if(e.isIndexSet)return this.add(e.source,e);if(e.isSelectionSet){r=e._sets,l=e._objects,i=r?r.length:0,this.beginPropertyChanges();for(s=0;s<i;s++)o=r[s],o&&o.get("length")>0&&this.add(o.source,o);return l&&this.addObjects(l),this.endPropertyChanges(),this}}return o=this._indexSetForSource(e,YES),u=this.get("length"),f=o.get("length"),a=u-f,o.add(t,n),this._indexSetCache=null,a+=o.get("length"),a!==u&&(this.propertyDidChange("length"),this.enumerableContentDidChange(),f===0&&this.notifyPropertyChange("sources")),this},remove:function(e,t,n){if(this.isFrozen)throw SC.FROZEN_ERROR;var r,i,s,o,u,a,f,l;if(t===undefined&&n===undefined){if(!e)throw"Must pass params to SC.SelectionSet.remove()";if(e.isIndexSet)return this.remove(e.source,e);if(e.isSelectionSet){r=e._sets,l=e._objects,i=r?r.length:0,this.beginPropertyChanges();for(s=0;s<i;s++)o=r[s],o&&o.get("length")>0&&this.remove(o.source,o);return l&&this.removeObjects(l),this.endPropertyChanges(),this}}return o=this._indexSetForSource(e,YES),u=this.get("length"),a=u-o.get("length"),o&&(l=this._objects)&&(n!==undefined&&(t=SC.IndexSet.create(t,n),n=undefined
),l.forEach(function(n){s=e.indexOf(n),t.contains(s)&&(l.remove(n),a--)},this)),o.remove(t,n),f=o.get("length"),a+=f,this._indexSetCache=null,a!==u&&(this.propertyDidChange("length"),this.enumerableContentDidChange(),f===0&&this.notifyPropertyChange("sources")),this},contains:function(e,t,n){if(t===undefined&&n===undefined)return this.containsObject(e);var r=this.indexSetForSource(e);return r?r.contains(t,n):NO},intersects:function(e,t,n){var r=this.indexSetForSource(e,NO);return r?r.intersects(t,n):NO},_TMP_ARY:[],addObject:function(e){var t=this._TMP_ARY,n;return t[0]=e,n=this.addObjects(t),t.length=0,n},addObjects:function(e){var t=this._objects,n,r;return t||(t=this._objects=SC.CoreSet.create()),n=t.get("length"),t.addEach(e),r=t.get("length"),this._indexSetCache=null,r!==n&&(this.propertyDidChange("length"),this.enumerableContentDidChange()),this},removeObject:function(e){var t=this._TMP_ARY,n;return t[0]=e,n=this.removeObjects(t),t.length=0,n},removeObjects:function(e){var t=this._objects,n,r,i;return t?(n=t.get("length"),t.removeEach(e),r=t.get("length"),(i=this._sets)&&i.forEach(function(t){n+=t.get("length"),t.removeObjects(e),r+=t.get("length")},this),this._indexSetCache=null,r!==n&&(this.propertyDidChange("length"),this.enumerableContentDidChange()),this):this},containsObject:function(e){var t=this._objects;if(t&&t.contains(e))return YES;var n=this._sets,r=n?n.length:0,i,s;for(i=0;i<r;i++){s=n[i];if(s&&s.indexOf(e)>=0)return YES}return NO},constrain:function(e){var t,n,r,i;this.beginPropertyChanges(),this.get("sources").forEach(function(t){if(t===e)return;var n=this
._indexSetForSource(e,NO);n&&this.remove(e,n)},this),t=this._indexSetForSource(e,NO),t&&(r=t.get("max"))>(n=e.get("length"))&&this.remove(e,n,r-n);if(i=this._objects){var s,o;for(s=i.length-1;s>=0;s--)o=i[s],e.indexOf(o)<0&&this.removeObject(o)}return this.endPropertyChanges(),this},isEqual:function(e){var t,n,r,i,s,o;if(!e||!e.isSelectionSet)return NO;if(e===this)return YES;if(this._sets===e._sets&&this._objects===e._objects)return YES;if(this.get("length")!==e.get("length"))return NO;t=this._objects,n=e._objects;if(t||n){if((t?t.get("length"):0)!==(n?n.get("length"):0))return NO;if(t&&!t.isEqual(n))return NO}s=this.get("sources"),i=s.get("length");for(r=0;r<i;r++){o=s.objectAt(r),t=this._indexSetForSource(o,NO),n=this._indexSetForSource(o,NO);if(!!n!=!!t)return NO;if(t&&!t.isEqual(n))return NO}return YES},clear:function(){if(this.isFrozen)throw SC.FROZEN_ERROR;return this._sets&&(this._sets.length=0),this._objects&&(this._objects=null),this._indexSetCache=null,this.propertyDidChange("length"),this.enumerableContentDidChange(),this.notifyPropertyChange("sources"),this},copy:function(){var e=this.constructor.create(),t=this._sets,n=t?t.length:0,r,i;if(t&&n>0){t=e._sets=t.slice();for(r=0;r<n;r++){if(!(i=t[r]))continue;i=t[r]=i.copy(),e[SC.guidFor(i.source)]=r}}return this._objects&&(e._objects=this._objects.copy()),e},freeze:function(){if(this.get("isFrozen"))return this;var e=this._sets,t=e?e.length:0,n;while(--t>=0)n=e[t],n&&n.freeze();return this._objects&&this._objects.freeze(),this.set("isFrozen",YES),this},toString:function(){var e=this._sets||[];return e=e.map(function(
e){return e.toString().replace("SC.IndexSet",SC.guidFor(e.source))},this),this._objects&&e.push(this._objects.toString()),"SC.SelectionSet:%@<%@>".fmt(SC.guidFor(this),e.join(","))},firstObject:function(){var e=this._sets,t=this._objects;if(e&&e.get("length")>0){var n=e?e[0]:null,r=n?n.source:null,i=n?n.firstObject():-1;if(r&&i>=0)return r.objectAt(i)}return t?t.firstObject():undefined}.property(),nextObject:function(e,t,n){var r,i;return e===0&&(r=n.objects=[],this.forEach(function(e){r.push(e)},this),n.max=r.length),r=n.objects,i=r[e],e+1>=n.max&&(n.objects=n.max=null),i},forEach:function(e,t){var n=this._sets,r=this._objects,i=n?n.length:0,s,o;for(o=0;o<i;o++)s=n[o],s&&s.forEachObject(e,t);return r&&r.forEach(e,t),this}}),SC.SelectionSet.prototype.clone=SC.SelectionSet.prototype.copy,SC.SelectionSet.EMPTY=SC.SelectionSet.create().freeze(),SC.SparseArray=SC.Object.extend(SC.Observable,SC.Enumerable,SC.Array,SC.DelegateSupport,{_requestingLength:0,_requestingIndex:0,length:function(){var e=this.delegate;return e&&SC.none(this._length)&&e.sparseArrayDidRequestLength&&(this._requestingLength++,e.sparseArrayDidRequestLength(this),this._requestingLength--),this._length||0}.property().cacheable(),provideLength:function(e){var t=this._length;if(e!==t){var n=SC.none(e);e=e||0,t=t||0;var r=Math.min(t,e),i=Math.max(t,e),s=i-e,o=e-r,u=this._requestingLength<=0;u&&this.arrayContentWillChange(r,s,o),this._length=e,n&&(this._sa_content=null),u&&this.arrayContentDidChange(r,s,o)}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(e,t){var n=this._sa_content,r;return n||(n=this._sa_content=[]),(r=n[e])===undefined&&(t||this.requestIndex(e),r=n[e]),r},definedIndexes:function(e){var t=SC.IndexSet.create(),n=this._sa_content,r,i;if(!n)return t.freeze();if(e)e.forEach(function(e){n[e]!==undefined&&t.add(e)});else{i=n.length;for(r=0;r<i;r++)n[r]!==undefined&&t.add(r)}return t.freeze()},_TMP_RANGE:{},requestIndex:function(e){var t=this.delegate;if(!t)return this;var n=this.get("rangeWindowSize"),r=e;n>1&&(r-=Math.floor(r%n)),n<1&&(n=1),this._requestingIndex++;if(t.sparseArrayDidRequestRange){var i=this._TMP_RANGE;this.wasRangeRequested(r)===-1&&(i.start=r,i.length=n,this.requestedRangeIndex.push(r),t.sparseArrayDidRequestRange(this,i))}else if(t.sparseArrayDidRequestIndex)while(--n>=0)t.sparseArrayDidRequestIndex(this,r+n);return this._requestingIndex--,this},wasRangeRequested:function(e){var t,n;for(t=0,n=this.requestedRangeIndex.length;t<n;t++)if(this.requestedRangeIndex[t]===e)return t;return-1},rangeRequestCompleted:function(e){var t=this.wasRangeRequested(e);return t>=0?(this.requestedRangeIndex.removeAt(t,1),YES):NO},provideObjectsInRange:function(e,t){var n=this._sa_content;n||(n=this._sa_content=[]);var r=e.start,i=e.length,s=this._requestingIndex<=0;s&&this.arrayContentWillChange(e.start,e.length,e.length);while(--i>=0)n[r+i]=t.objectAt(i);return s&&this.arrayContentDidChange(e.start,e.length,e.length),this},provideObjectAtIndex:function(e,t){var n=this._TMP_PROVIDE_ARRAY
,r=this._TMP_PROVIDE_RANGE;return n[0]=t,r.start=e,this.provideObjectsInRange(r,n)},objectsDidChangeInRange:function(e){this.arrayContentWillChange(e.start,e.length,e.length);var t=this._sa_content;if(t)if(e.start===0&&SC.maxRange(e)>=t.length)this._sa_content=null;else{var n=e.start,r=Math.min(n+e.length,t.length);while(--r>=n)t[r]=undefined}return this.arrayContentDidChange(e.start,e.length,e.length),this},indexOf:function(e){var t=this.delegate;if(t&&t.sparseArrayDidRequestIndexOf)return t.sparseArrayDidRequestIndexOf(this,e);var n=this._sa_content;return n||(n=this._sa_content=[]),n.indexOf(e)},replace:function(e,t,n){n=n||[];var r=this.delegate;if(r)if(!r.sparseArrayShouldReplace||!r.sparseArrayShouldReplace(this,e,t,n))return this;var i=n?n.get?n.get("length"):n.length:0;this.arrayContentWillChange(e,t,i);var s=this._sa_content;s||(s=this._sa_content=[]),s.replace(e,t,n);var o=i-t;return SC.none(this._length)||(this.propertyWillChange("length"),this._length+=o,this.propertyDidChange("length")),this.arrayContentDidChange(e,t,i),this.enumerableContentDidChange(e,t,o),this},reset:function(){var e=this._length;return this.arrayContentWillChange(0,e,0),this._sa_content=null,this._length=null,this.arrayContentDidChange(0,e,0),this.invokeDelegateMethod(this.delegate,"sparseArrayDidReset",this),this}}),SC.SparseArray.array=function(e){return this.create({_length:e||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 t=this.get("interval"),n=this.get("lastFireTime");n<e&&(n=e);var r;this.get("repeats")?t===0?r=n:r=e+(Math.floor((n-e)/t)+1)*t:r=e+t;var i=this.get("until");return i&&i>0&&r>i&&(r=i),r}.property("interval","startTime","repeats","until","isValid","lastFireTime").cacheable(),schedule:function(){if(!this.get("isValid"))return this;this.beginPropertyChanges(),this.startTime||this.set("startTime",SC.RunLoop.currentRunLoop.get("startTime"));var e=this.get("fireTime"),t=this.get("lastFireTime");return e>=t&&(this.set("isScheduled",YES),SC.RunLoop.currentRunLoop.scheduleTimer(this,e)),this.endPropertyChanges(),this},invalidate:function(){this.beginPropertyChanges(),this.set("isValid",NO);var e=SC.RunLoop.currentRunLoop;return e&&e.cancelTimer(this),this.action=this.target=null,this.endPropertyChanges(),this.get("isPooled")&&SC.Timer.returnTimerToPool(this),this},fire:function(){var e=Date.now();this.set("lastFireTime",e);var t=this.get("fireTime");this.get("isPaused")||this.performAction(),t>e?this.schedule():this.invalidate()},performAction:function(){var e=SC.typeOf(this.action);if(e==SC.T_FUNCTION)this.action.call(this.target||this,this);else if(e===SC.T_STRING)if(this.action.indexOf(".")>=0){var t=this.action.split("."),n=t.pop(),r=SC.objectForPropertyPath(t,window),i=r.get?r.get(n):r[n];if(!i||SC.typeOf(i)!=SC.T_FUNCTION)throw"%@: Timer could not find a function at %@".fmt(this,this.action);i.call(r,this)}else SC.RootResponder.responder.sendAction(this.action,this.target,this)},init:function(){arguments.callee.base.apply(this
,arguments),this.startTime instanceof Date&&(this.startTime=this.startTime.getTime()),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(e){e||(e=SC.EMPTY_HASH),this.propertyWillChange("fireTime");var t=this.RESET_DEFAULTS;for(var n in t){if(!t.hasOwnProperty(n))continue;this[n]=SC.none(e[n])?t[n]:e[n]}return this.propertyDidChange("fireTime"),this},removeFromTimerQueue:function(e){var t=this._timerQueuePrevious,n=this._timerQueueNext;return!t&&!n&&e!==this?e:(t&&(t._timerQueueNext=n),n&&(n._timerQueuePrevious=t),this._timerQueuePrevious=this._timerQueueNext=null,e===this?n:e)},scheduleInTimerQueue:function(e,t){this._timerQueueRunTime=t;var n=e,r=null;while(n&&n._timerQueueRunTime<t)r=n,n=n._timerQueueNext;return r&&(r._timerQueueNext=this,this._timerQueuePrevious=r),n&&(n._timerQueuePrevious=this,this._timerQueueNext=n),n===e?this:e},collectExpiredTimers:function(e,t){if(this._timerQueueRunTime>t)return this;e.push(this);var n=this._timerQueueNext;return this._timerQueueNext=null,n&&(n._timerQueuePrevious=null),n?n.collectExpiredTimers(e,t):null}}),SC.Timer.schedule=function(e){var t;return!e||SC.none(e.isPooled)||e.isPooled?t=this.timerFromPool(e):t=this.create(e),t.schedule()},SC.Timer.timerFromPool=function(e){var t=this._timerPool;t||(t=this._timerPool=[]);var n=t.pop();return n||(n=this.create()),n.reset(e)},SC.Timer.returnTimerToPool=function(e){return this._timerPool||(this._timerPool=[]
),this._timerPool.push(e),this},SC.mixin({normalizeURL:function(e){return e.slice(0,1)=="/"?e=window.location.protocol+"//"+window.location.host+e:e.slice(0,5)!="http:"&&e.slice(0,6)!="https:"&&(e=window.location.href+"/"+e),e},isPercentage:function(e){return e<1&&e>0},minX:function(e){return e.x||0},maxX:function(e){return(e.x||0)+(e.width||0)},midX:function(e){return(e.x||0)+(e.width||0)/2},minY:function(e){return e.y||0},maxY:function(e){return(e.y||0)+(e.height||0)},midY:function(e){return(e.y||0)+(e.height||0)/2},centerX:function(e,t){return(t.width-e.width)/2},centerY:function(e,t){return(t.height-e.height)/2},offset:function(e,t){var n,r,i,s;t=t||"document";if(t==="parent")s=jQuery(e).position();else{s=jQuery(e).offset();if(SC.browser.mobileSafari){n=navigator.userAgent,r=n.indexOf("Mobile/"),i=n.substring(r+7,r+9);if(parseInt(SC.browser.mobileSafari,0)<=532||i<="8A")s.left-=window.pageXOffset,s.top-=window.pageYOffset}if(t==="viewport")if(SC.browser.isIE8OrLower){var o=SC.$(window);s.left-=o.scrollLeft(),s.top-=o.scrollTop()}else s.left-=window.pageXOffset,s.top-=window.pageYOffset}try{s.x=s.left,s.y=s.top}catch(u){s={x:s.left,y:s.top}}return delete s.left,delete s.top,s},viewportOffset:function(e){console.warn("SC.viewportOffset() has been deprecated in favor of SC.offset(). Please use SC.offset() from here on.");var t=SC.offset(e,"viewport");return{x:t.left,y:t.top}},isFunctionOrNonPrintableKey:function(e){return!!(e.altKey||e.ctrlKey||e.metaKey||e.charCode!==e.which&&SC.FUNCTION_KEYS[e.which])}}),SC.mixin({ZERO_POINT:{x:0,y:0},pointInRect:function(e,t){return e.x>=
SC.minX(t)&&e.y>=SC.minY(t)&&e.x<=SC.maxX(t)&&e.y<=SC.maxY(t)},rectsEqual:function(e,t,n){return!e||!t?e==t:(!n&&n!==0&&(n=.1),e.y!=t.y&&Math.abs(e.y-t.y)>n?NO:e.x!=t.x&&Math.abs(e.x-t.x)>n?NO:e.width!=t.width&&Math.abs(e.width-t.width)>n?NO:e.height!=t.height&&Math.abs(e.height-t.height)>n?NO:YES)},intersectRects:function(e,t){var n={x:Math.max(SC.minX(e),SC.minX(t)),y:Math.max(SC.minY(e),SC.minY(t)),width:Math.min(SC.maxX(e),SC.maxX(t)),height:Math.min(SC.maxY(e),SC.maxY(t))};return n.width=Math.max(0,n.width-n.x),n.height=Math.max(0,n.height-n.y),n},unionRects:function(e,t){var n={x:Math.min(SC.minX(e),SC.minX(t)),y:Math.min(SC.minY(e),SC.minY(t)),width:Math.max(SC.maxX(e),SC.maxX(t)),height:Math.max(SC.maxY(e),SC.maxY(t))};return n.width=Math.max(0,n.width-n.x),n.height=Math.max(0,n.height-n.y),n},cloneRect:function(e){return{x:e.x,y:e.y,width:e.width,height:e.height}},stringFromRect:function(e){return e?"{x:"+e.x+", y:"+e.y+", width:"+e.width+", height:"+e.height+"}":"(null)"}}),SC.MainPane=SC.Pane.extend({layout:{top:0,left:0,bottom:0,right:0,minHeight:200,minWidth:200},init:function(){var e={x:0,y:0,width:1e3,height:1e3},t=this.get("layout"),n=!1;if(document&&document.body){e.width=document.body.clientWidth,e.height=document.body.clientHeight;if(t.minHeight||t.minWidth)t.minHeight&&e.height<t.minHeight||t.minWidth&&e.width<t.minWidth?SC.bodyOverflowArbitrator.requestVisible(this):SC.bodyOverflowArbitrator.requestHidden(this)}arguments.callee.base.apply(this,arguments)},paneDidAttach:function(){var e=arguments.callee.base.apply(this,arguments),t=this.rootResponder;return t
.makeMainPane(this),t.get("keyRootView")||t.makeKeyPane(this),e},acceptsKeyPane:YES,classNames:["sc-main"]}),SC.Response=SC.Object.extend({isResponse:YES,isError:NO,errorValue:function(){return this}.property().cacheable(),errorObject:null,request:null,originalRequest:function(){var e=this.get("request");while(e.get("source"))e=e.get("source");return e}.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 e=this.get("encodedBody");if(e&&this.get("isJSON"))try{e=SC.json.decode(e)}catch(t){return SC.error("Failed to parse response: %@",e),SC.Error.create({message:t.name+": "+t.message,label:"Response",errorValue:this})}return e}.property("encodedBody").cacheable(),response:function(){return this.get("body")}.property("body").cacheable(),isCancelled:NO,timedOut:null,timeoutTimer:null,fire:function(){var e=this.get("request"),t=e?e.get("source"):null;t&&t.willSend&&t.willSend(e,this),e.freeze(),this.get("isCancelled")||this.invokeTransport();var n=e.get("timeout");if(n){var r=SC.Timer.schedule({target:this,action:"timeoutReached",interval:n,repeats:NO});this.set("timeoutTimer",r)}!this.get("isCancelled")&&t&&
t.didSend&&t.didSend(e,this)},invokeTransport:function(){this.receive(function(e){this.set("status",200)},this)},receive:function(e,t){if(!this.get("timedOut")){var n=this.get("timeoutTimer");n&&n.invalidate(),this.set("timedOut",NO)}var r=this.get("request"),i=r?r.get("source"):null;return SC.run(function(){i&&i.willReceive&&i.willReceive(r,this),e.call(t,!this.get("isCancelled")),!this.get("isCancelled")&&i&&i.didReceive&&i.didReceive(r,this),this.get("isCancelled")||this.notify()},this),SC.Request.manager.transportDidClose(this),this},cancel:function(){this.get("isCancelled")||(this.set("isCancelled",YES),this.cancelTransport(),SC.Request.manager.transportDidClose(this))},timeoutReached:function(){return this.get("timedOut")===null?(this.set("timedOut",YES),this.cancelTransport(),this.receive(function(e){if(!e)return;var t=SC.$error("HTTP Request timed out","Request",0);t.set("errorValue",this),this.set("isError",YES),this.set("errorObject",t),this.set("status",0)},this),YES):NO},cancelTransport:function(){},_notifyListeners:function(e,t){var n=e[t],r,i,s;if(!n)return NO;var o=NO,u=n.length;for(var a=0;a<u;a++){var f=n[a];r=(f.params||[]).copy(),r.unshift(this),i=f.target,s=f.action,SC.typeOf(s)===SC.T_STRING&&(s=i[s]),o=s.apply(i,r)}return o},notify:function(){var e=this.get("listeners"),t=this.get("status"),n=Math.floor(t/100)*100,r=NO;return e?(r=this._notifyListeners(e,t),!r&&n!==t&&(r=this._notifyListeners(e,n)),!r&&t!==0&&(r=this._notifyListeners(e,0)),this):this},toString:function(){var e=arguments.callee.base.apply(this,arguments);return"%@<%@ %@, status=%@".fmt(e
,this.get("type"),this.get("address"),this.get("status"))}}),SC.XHRResponse=SC.Response.extend({headers:function(){var e=this.get("rawRequest"),t=e?e.getAllResponseHeaders():null,n={};return t?(t.split("\n").forEach(function(e){var t=e.indexOf(":"),r,i;t>=0&&(r=e.slice(0,t),i=e.slice(t+1).trim(),n[r]=i)},this),n):n}.property("status").cacheable(),header:function(e){var t=this.get("rawRequest");return t?t.getResponseHeader(e):null},encodedBody:function(){var e=this.get("rawRequest");return e?this.get("isXML")?e.responseXML:e.responseText:null}.property("status").cacheable(),cancelTransport:function(){var e=this.get("rawRequest");e&&e.abort(),this.set("rawRequest",null)},invokeTransport:function(){var e,t,n,r,i;e=this.createRequest(),this.set("rawRequest",e),r=!!this.getPath("request.isAsynchronous"),r&&(!SC.browser.msie&&!SC.browser.opera?SC.Event.add(e,"readystatechange",this,this.finishRequest,e):(t=this,n=function(){if(!t)return null;var e=t.finishRequest();return e&&(t=null),e},e.onreadystatechange=n)),e.open(this.get("type"),this.get("address"),r),i=this.getPath("request.headers");for(var s in i)e.setRequestHeader(s,i[s]);return e.send(this.getPath("request.encodedBody")),r||this.finishRequest(),e},createRequest:function(){function e(){for(var e=0;e<arguments.length;e++)try{var t=arguments[e]();return t}catch(n){}return NO}return e(function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})},finishRequest:function(e){var t=this.get("rawRequest"),n=t.readyState,r,i,s;return n===4&&!
this.get("timedOut")?(this.receive(function(e){if(!e)return;i=-1;try{i=t.status||0}catch(n){}if(i<200||i>=300){try{s=t.statusText||""}catch(o){s=""}r=SC.$error(s||"HTTP Request failed","Request",i),r.set("errorValue",this),this.set("isError",YES),this.set("errorObject",r)}this.set("status",i)},this),!SC.browser.msie&&!SC.browser.opera?SC.Event.remove(t,"readystatechange",this,this.finishRequest):t.onreadystatechange=null,YES):NO}}),SC.Request=SC.Object.extend(SC.Copyable,SC.Freezable,{isAsynchronous:YES,isJSON:NO,isXML:NO,attachIdentifyingHeaders:YES,headers:function(){var e=this._headers;return e||(e=this._headers={}),e}.property().cacheable(),responseClass:SC.XHRResponse,source:null,address:null,type:"GET",timeout:null,body:null,encodedBody:function(){var e=this.get("body");return e&&this.get("isJSON")&&(e=SC.json.encode(e)),e}.property("isJSON","isXML","body").cacheable(),willSend:function(e,t){},didSend:function(e,t){},willReceive:function(e,t){},didReceive:function(e,t){},concatenatedProperties:"COPY_KEYS",COPY_KEYS:["attachIdentifyingHeaders","isAsynchronous","isJSON","isXML","address","type","timeout","body","responseClass","willSend","didSend","willReceive","didReceive"],copy:function(){var e={},t=this.COPY_KEYS,n=t.length,r,i,s;while(--n>=0)r=t[n],this.hasOwnProperty(r)&&(e[r]=this.get(r));return this.hasOwnProperty("listeners")&&(e.listeners=SC.copy(this.get("listeners"))),this.hasOwnProperty("_headers")&&(e._headers=SC.copy(this._headers)),e.source=this.get("source")||this,this.constructor.create(e)},header:function(e,t){var n;if(SC.typeOf(e)===SC.T_STRING)return n=
this._headers,arguments.length===1?n?n[e]:null:(this.propertyWillChange("headers"),n||(n=this._headers={}),n[e]=t,this.propertyDidChange("headers"),this);if(t===undefined){n=e,this.beginPropertyChanges();for(e in n){if(!n.hasOwnProperty(e))continue;this.header(e,n[e])}return this.endPropertyChanges(),this}return this},clearHeaders:function(){this.propertyWillChange("headers"),this._headers={},this.propertyDidChange("headers")},async:function(e){return e===undefined&&(e=YES),this.set("isAsynchronous",e)},timeoutAfter:function(e){return this.set("timeout",e)},json:function(e){return e===undefined&&(e=YES),e&&this.set("isXML",NO),this.set("isJSON",e)},xml:function(e){return e===undefined&&(e=YES),e&&this.set("isJSON",NO),this.set("isXML",e)},_prep:function(){var e=!!this.header("Content-Type");return this.get("attachIdentifyingHeaders")&&(this.header("X-Requested-With","XMLHttpRequest"),this.header("X-SproutCore-Version",SC.VERSION)),this.get("isJSON")&&!e?this.header("Content-Type","application/json"):this.get("isXML")&&!e&&this.header("Content-Type","text/xml"),this},send:function(e){var t=this.get("timeout");if(t&&!this.get("isAsynchronous"))throw"Timeout values cannot be used with synchronous requests";if(t===0)throw"The timeout value must either not be specified or must be greater than 0";return e&&this.set("body",e),SC.Request.manager.sendRequest(this.copy()._prep())},resend:function(){var e=this.get("source")?this:this.copy()._prep();return SC.Request.manager.sendRequest(e)},notify:function(e,t,n,r){var i=YES;SC.typeOf(e)!==SC.T_NUMBER?(r=SC.A(arguments).slice(2),n=t,t=e
,e=0,i=NO):r=SC.A(arguments).slice(3);var s=this.get("listeners");return s||this.set("listeners",s={}),s[e]||(s[e]=[]),s[e].push({target:t,action:n,params:r}),this}}),SC.Request.mixin({getUrl:function(e){return this.create().set("address",e).set("type","GET")},postUrl:function(e,t){var n=this.create().set("address",e).set("type","POST");return t&&n.set("body",t),n},deleteUrl:function(e){return this.create().set("address",e).set("type","DELETE")},putUrl:function(e,t){var n=this.create().set("address",e).set("type","PUT");return t&&n.set("body",t),n}}),SC.Request.manager=SC.Object.create({maxRequests:6,inflight:[],pending:[],sendRequest:function(e){if(!e)return null;var t=e.get("responseClass").create({request:e});return this.get("pending").pushObject(t),this.fireRequestIfNeeded(),t},cancel:function(e){var t=this.get("pending"),n=this.get("inflight"),r;return t.indexOf(e)>=0?(this.propertyWillChange("pending"),t.removeObject(e),this.propertyDidChange("pending"),YES):n.indexOf(e)>=0?(e.cancel(),n.removeObject(e),this.fireRequestIfNeeded(),YES):NO},cancelAll:function(){return this.get("pending").length||this.get("inflight").length?(this.set("pending",[]),this.get("inflight").forEach(function(e){e.cancel()}),this.set("inflight",[]),YES):NO},fireRequestIfNeeded:function(){var e=this.get("pending"),t=this.get("inflight"),n=this.get("maxRequests"),r;e.length>0&&t.length<n&&(r=e.shiftObject(),t.pushObject(r),r.fire())},transportDidClose:function(e){this.get("inflight").removeObject(e),this.fireRequestIfNeeded()}}),SC.FOCUS_ALL_CONTROLS=YES,SC.TreeItemContent={isTreeItemContent:YES,treeItemChildren
:null,treeItemIsExpanded:YES,treeItemIsGrouped:NO,treeItemDisclosureState:function(e,t){return this.get("treeItemIsExpanded")?SC.BRANCH_OPEN:SC.BRANCH_CLOSED},treeItemCollapse:function(e,t){this.setIfChanged("treeItemIsExpanded",NO)},treeItemExpand:function(e,t){this.setIfChanged("treeItemIsExpanded",YES)},treeItemBranchIndexes:function(e,t){var n=this.get("treeItemChildren"),r,i,s,o;if(!n)return null;r=SC.IndexSet.create(),i=n.get("length");for(s=0;s<i;s++){if(!(o=n.objectAt(s)))continue;if(!o.get("treeItemChildren"))continue;o.treeItemDisclosureState(this,s)!==SC.LEAF_NODE&&r.add(s)}return r.get("length")>0?r:null}},SC.BRANCH_OPEN=17,SC.BRANCH_CLOSED=18,SC.LEAF_NODE=32,SC.CollectionContent={isCollectionContent:YES,contentIndexIsSelected:function(e,t,n){var r=e.get("selection");return r?r.contains(t,n):NO},contentIndexIsEnabled:function(e,t,n){return e.get("isEnabled")},contentGroupIndexes:function(e,t){return null},contentIndexIsGroup:function(e,t,n){return NO},contentIndexOutlineLevel:function(e,t,n){return-1},contentIndexDisclosureState:function(e,t,n){return SC.LEAF_NODE},contentIndexExpand:function(e,t,n){SC.Logger.log("contentIndexExpand(%@, %@, %@)".fmt(e,t,n))},contentIndexCollapse:function(e,t,n){SC.Logger.log("contentIndexCollapse(%@, %@, %@)".fmt(e,t,n))}},SC.TreeItemObserver=SC.Object.extend(SC.Array,SC.CollectionContent,{item:null,delegate:null,parentObserver:null,parentItem:function(){var e=this.get("parentObserver");return e?e.get("item"):null}.property("parentObserver").cacheable(),index:null,outlineLevel:0,children:null,disclosureState:SC.BRANCH_OPEN,branchIndexes
:function(){var e=this.get("item"),t,n,r,i,s;if(!e)return SC.IndexSet.EMPTY;if(e.isTreeItemContent)return n=this.get("parentItem"),r=this.get("index"),e.treeItemBranchIndexes(n,r);i=this.get("children");if(!i)return null;s=SC.IndexSet.create(),t=i.get("length"),n=e;for(r=0;r<t;r++){if(!(e=i.objectAt(r)))continue;if(!this._computeChildren(e,n,r))continue;this._computeDisclosureState(e,n,r)!==SC.LEAF_NODE&&s.add(r)}return s.get("length")>0?s:null}.property("children").cacheable(),isHeaderVisible:function(){return!!this.get("parentObserver")}.property("parentObserver").cacheable(),length:0,objectAt:function(e,t){var n=this.get("length"),r=this.get("item"),i=this._objectAtCache,s=e,o=0,u,a;if(e>=n)return undefined;if(this.get("isHeaderVisible")){if(e===0)return r;s--}return r=null,i||(i=this._objectAtCache=[]),(r=i[e])!==undefined?r:(a=this.get("children"),a?((u=this.get("branchIndexes"))&&u.forEach(function(e){if(r||e>s)return;var n=this.branchObserverAt(e),i;if(!n)return;i=n.get("length"),e+i>s?(r=n.objectAt(s-e,t),s=-1):s-=i-1},this),s>=0&&(r=a.objectAt(s,t)),i[e]=r,r):undefined)},replace:function(e,t,n,r){var i=e,s=null,o,u,a;r===undefined&&(r=SC.DROP_BEFORE),this.get("isHeaderVisible")&&i--;if(i<0)throw"Tree Item cannot replace itself";(o=this.get("branchIndexes"))&&o.forEach(function(e){if(s||e>=i)return;if(!(s=this.branchObserverAt(e)))return;u=s.get("length"),e+u===i&&r===SC.DROP_AFTER?i-=e:e+u>i?i-=e:(i-=u-1,s=null)},this);if(s)return s.replace(i,t,n,r),this;a=i+t,t>1&&o&&o.forEachIn(i,o.get("max")-i,function(e){if(e>a)return;if(!(s=this.branchObserverAt(e)))return;u=s.
get("length"),a-=u-1},this),t=a-i;var f=this.get("children");if(!f)throw"cannot replace() tree item with no children";if(t<0||a>f.get("length"))throw"replace() range must lie within a single tree item";return f.replace(i,t,n,r),this},observerContentDidChange:function(e,t,n){this.invalidateBranchObserversAt(e),this._objectAtCache=this._outlineLevelCache=null,this._disclosureStateCache=null,this._contentGroupIndexes=NO,this.notifyPropertyChange("branchIndexes");var r=this.get("length"),i=this._computeLength(),s=this.get("parentObserver"),o;r!==i&&this.set("length",i);if(!this._notifyParent)return this;if(s)o=SC.IndexSet.create(this.get("index")),s._childrenRangeDidChange(s.get("children"),null,"[]",o);else{r===i?(t=this.expandChildIndex(e+t),e=this.expandChildIndex(e),t-=e,n=0):(e=this.expandChildIndex(e),t=i-e,n=i-r);var u=t,a=n+u;this.arrayContentDidChange(e,u,a)}},expandChildIndex:function(e){var t=e;this.get("isHeaderVisible")&&e++;var n=this.get("branchIndexes");return!n||n.get("length")===0?t:(n.forEachIn(0,e,function(e){t+=this.branchObserverAt(e).get("length")-1},this),t)},_contentGroupIndexes:NO,contentGroupIndexes:function(e,t){if(t!==this)return null;var n=this._contentGroupIndexes;if(n!==NO)return n;if(this.get("parentObserver"))return null;var r=this.get("item"),i,s,o,u;return r&&r.isTreeItemContent?i=r.get("treeItemIsGrouped"):i=!!this.delegate.get("treeItemIsGrouped"),i?(n=SC.IndexSet.create(),s=this.get("branchIndexes"),s&&(o=s.min(),u=0,s.forEach(function(e){n.add(e+u,1);var t=this.branchObserverAt(e);t&&(u+=t.get("length")-1,o+=u)},this))):n=null,this._contentGroupIndexes=
n,n},contentIndexIsGroup:function(e,t,n){var r=this.contentGroupIndexes(e,t);return r?r.contains(n):NO},contentIndexOutlineLevel:function(e,t,n){if(t!==this)return-1;var r=this._outlineLevelCache;if(r&&r[n]!==undefined)return r[n];r||(r=this._outlineLevelCache=[]);var i=this.get("length"),s=n,o=0,u=null,a,f,l;if(n>=i)return-1;if(this.get("isHeaderVisible")){if(n===0)return r[0]=this.get("outlineLevel")-1;s--}return(a=this.get("branchIndexes"))&&a.forEach(function(t){if(u!==null||t>s)return;var n=this.branchObserverAt(t),r;if(!n)return;r=n.get("length"),t+r>s?(u=n.contentIndexOutlineLevel(e,n,s-t),s=-1):s-=r-1},this),s>=0&&(u=this.get("outlineLevel")),r[n]=u,u},contentIndexDisclosureState:function(e,t,n){if(t!==this)return-1;var r=this._disclosureStateCache;if(r&&r[n]!==undefined)return r[n];r||(r=this._disclosureStateCache=[]);var i=this.get("length"),s=n,o=0,u=null,a,f,l;if(n>=i)return SC.LEAF_NODE;if(this.get("isHeaderVisible")){if(n===0)return r[0]=this.get("disclosureState");s--}return(a=this.get("branchIndexes"))&&a.forEach(function(t){if(u!==null||t>s)return;var n=this.branchObserverAt(t),r;if(!n)return;r=n.get("length"),t+r>s?(u=n.contentIndexDisclosureState(e,n,s-t),s=-1):s-=r-1},this),s>=0&&(u=SC.LEAF_NODE),r[n]=u,u},contentIndexExpand:function(e,t,n){var r,i=n,s,o;if(t!==this)return;if(this.get("isHeaderVisible")){if(n===0){this._expand(this.get("item"));return}i--}(r=this.get("branchIndexes"))&&r.forEach(function(t){if(t>=i)return;var n=this.branchObserverAt(t),r;if(!n)return;r=n.get("length"),t+r>i?(n.contentIndexExpand(e,n,i-t),i=-1):i-=r-1},this),i>=0&&(s=this.
get("children"),o=s?s.objectAt(i):null,o&&this._expand(o,this.get("item"),i))},contentIndexCollapse:function(e,t,n){var r,i,s,o=n;if(t!==this)return;if(this.get("isHeaderVisible")){if(n===0){this._collapse(this.get("item"));return}o--}(r=this.get("branchIndexes"))&&r.forEach(function(t){if(t>=o)return;var n=this.branchObserverAt(t),r;if(!n)return;r=n.get("length"),t+r>o?(n.contentIndexCollapse(e,n,o-t),o=-1):o-=r-1},this),o>=0&&(i=this.get("children"),s=i?i.objectAt(o):null,s&&this._collapse(s,this.get("item"),o))},branchObserverAt:function(e){var t=this._branchObserversByIndex,n=this._branchObserverIndexes,r,i,s,o,u,a,f;return t||(t=this._branchObserversByIndex=[]),n||(n=this._branchObserverIndexes=SC.IndexSet.create()),(r=t[e])?r:(u=this.get("children"),o=u?u.objectAt(e):null,o?(t[e]=r=SC.TreeItemObserver.create({item:o,delegate:this.get("delegate"),parentObserver:this,index:e,outlineLevel:this.get("outlineLevel")+1}),n.add(e),r):null)},invalidateBranchObserversAt:function(e){var t=this._branchObserversByIndex,n=this._branchObserverIndexes;return!t||t.length<=e?this:(e<0&&(e=0),n.forEachIn(e,n.get("max")-e,function(e){var n=t[e];n&&n.destroy()},this),t.length=e,this)},init:function(){arguments.callee.base.apply(this,arguments);var e=this.get("item");if(!e)throw"SC.TreeItemObserver.item cannot be null";e.addObserver("*",this,this._itemPropertyDidChange),this._itemPropertyDidChange(e,"*"),this._notifyParent=YES},destroy:function(){this.invalidateBranchObserversAt(0),this._objectAtCache=null,this._notifyParent=NO;var e=this.get("item");e&&e.removeObserver("*",this,this._itemPropertyDidChange
);var t=this._children,n=this._childrenRangeObserver;t&&n&&t.removeRangeObserver(n),this.set("length",0),arguments.callee.base.apply(this,arguments)},_itemPropertyDidChange:function(e,t){var n=this.get("children"),r=this.get("disclosureState"),i=this.get("item"),s;this.beginPropertyChanges(),s=this._computeDisclosureState(i),r!==s&&this.set("disclosureState",s),s=this._computeChildren(i),n!==s&&this.set("children",s),this.endPropertyChanges()},_childrenDidChange:function(){var e=this.get("disclosureState"),t=e===SC.BRANCH_OPEN?this.get("children"):null,n=this._children,r=this._childrenRangeObserver;if(n===t)return this;r&&n.removeRangeObserver(r),t?this._childrenRangeObserver=t.addRangeObserver(null,this,this._childrenRangeDidChange):this._childrenRangeObserver=null,this._children=t,this._childrenRangeDidChange(t,null,"[]",null)}.observes("children","disclosureState"),_childrenRangeDidChange:function(e,t,n,r){var i=this.get("children"),s=i?i.get("length"):0,o=r?r.get("min"):0,u=r?r.get("max"):s,a=this._childrenLen||0;this._childrenLen=s,this.observerContentDidChange(o,u-o,s-a)},_computeDisclosureState:function(e,t,n){var r,i;return!e||!this._computeChildren(e)?SC.LEAF_NODE:e.isTreeItemContent?(t===undefined&&(t=this.get("parentItem")),n===undefined&&(n=this.get("index")),e.treeItemDisclosureState(t,n)):(r=this._treeItemIsExpandedKey,r||(i=this.get("delegate"),r=i?i.get("treeItemIsExpandedKey"):"treeItemIsExpanded",this._treeItemIsExpandedKey=r),e.get(r)?SC.BRANCH_OPEN:SC.BRANCH_CLOSED)},_collapse:function(e,t,n){var r,i;return!e||!this._computeChildren(e)?this:(e.isTreeItemContent?
(t===undefined&&(t=this.get("parentItem")),n===undefined&&(n=this.get("index")),e.treeItemCollapse(t,n)):(r=this._treeItemIsExpandedKey,r||(i=this.get("delegate"),r=i?i.get("treeItemIsExpandedKey"):"treeItemIsExpanded",this._treeItemIsExpandedKey=r),e.setIfChanged(r,NO)),this)},_expand:function(e,t,n){var r,i;return!e||!this._computeChildren(e)?this:(e.isTreeItemContent?(t===undefined&&(t=this.get("parentItem")),n===undefined&&(n=this.get("index")),e.treeItemExpand(t,n)):(r=this._treeItemIsExpandedKey,r||(i=this.get("delegate"),r=i?i.get("treeItemIsExpandedKey"):"treeItemIsExpanded",this._treeItemIsExpandedKey=r),e.setIfChanged(r,YES)),this)},_computeChildren:function(e){var t,n;return e?e.isTreeItemContent?e.get("treeItemChildren"):(n=this._treeItemChildrenKey,n||(t=this.get("delegate"),n=t?t.get("treeItemChildrenKey"):"treeItemChildren",this._treeItemChildrenKey=n),e.get(n)):null},_computeLength:function(){var e=this.get("isHeaderVisible")?1:0,t=this.get("disclosureState"),n=this.get("children"),r;return t===SC.BRANCH_OPEN&&n&&(e+=n.get("length"),(r=this.get("branchIndexes"))&&r.forEach(function(t){var n=this.branchObserverAt(t);e+=n.get("length")-1},this)),e}}),SC.TreeController=SC.ObjectController.extend(SC.SelectionSupport,{treeItemIsGrouped:NO,treeItemIsExpandedKey:"treeItemIsExpanded",treeItemChildrenKey:"treeItemChildren",arrangedObjects:function(){var e,t=this.get("content");return t?e=SC.TreeItemObserver.create({item:t,delegate:this}):e=null,this._sctc_arrangedObjects=e,e}.property().cacheable(),_sctc_invalidateArrangedObjects:function(){this.propertyWillChange("arrangedObjects"
);var e=this._sctc_arrangedObjects;e&&e.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 e=this.get("arrangedObjects"),t,n,r=0;if(!e)return null;if(this.get("treeItemIsGrouped")===NO||this.get("canSelectGroups"))return e.get("firstObject");t=e.contentGroupIndexes(null,e),n=e.get("length");while(t.contains(r)&&r<n)r++;return r>=n?null:e.objectAt(r)}.property()}),SC.InlineTextFieldDelegate={editor:null,acquireEditor:function(e){var t=this.editor;if(t){if(t.get("isEditing")&&!t.commitEditing()&&!t.discardEditing())return null;this.releaseEditor(t)}var n=e.exampleEditor?e.exampleEditor:SC.InlineTextFieldView,r=e.get("pane");return t=this.editor=r.createChildView(n,{inlineEditorDelegate:this}),r.appendChild(t),t},releaseEditor:function(e){return e.removeFromParent(),this.editor=null,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(e){return e.replace(SC.STRING_TITLEIZE_REGEXP,function(e,t,n){return n?t+n.toUpperCase():t}).capitalize()},titleize:function(e){var t=e.replace(SC.STRING_DECAMELIZE_REGEXP,"$1_$2");return t.replace(SC.STRING_TITLEIZE_REGEXP,function(e,t,n){return n?" "+n.toUpperCase():" "}).capitalize()},classify:function(e){var t=e.replace(SC.STRING_TITLEIZE_REGEXP,function(e,t,n){return n?n.toUpperCase():""}),n=t.charAt(0),r=n.toUpperCase();return n!==r?r+t.slice(1):t},humanize:function(e){return SC.String
.decamelize(e).replace(SC.STRING_HUMANIZE_REGEXP," ")},escapeForRegExp:function(e){return e.replace(SC.STRING_REGEXP_ESCAPED_REGEXP,"\\$1")},removeDiacritics:function(e){var t=SC.diacriticMappingTable;t||(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"},t=SC.diacriticMappingTable);var n,r,i="",s=e.length;for(var o=0;o<=s;++o)n=e.charAt(o),r=t[n],i+=r||n;return i},pluralize:function(e){var t,n,r=e.split(/\s/).pop(),i=e.replace(r,""),s=r.charAt(0).match(/[A-Z]/)?!0:!1;r=r.toLowerCase();for(t=0,n=SC.INFLECTION_CONSTANTS.UNCOUNTABLE.length;t<n;t++){var o=SC.INFLECTION_CONSTANTS.UNCOUNTABLE[t];if(r==o)return e.toString()}for(t=0,n=SC.INFLECTION_CONSTANTS.IRREGULAR.length;t<n;t++){var u=SC.INFLECTION_CONSTANTS.IRREGULAR[t][0],a=SC.INFLECTION_CONSTANTS.IRREGULAR[t][1];if(r==u||r==a)return s&&(a=a.capitalize()),i+a}for(t=0,n=SC.INFLECTION_CONSTANTS.PLURAL.length;t<n;t++){var f=SC.INFLECTION_CONSTANTS.PLURAL
[t][0],l=SC.INFLECTION_CONSTANTS.PLURAL[t][1];if(f.test(r))return e.replace(f,l)}},singularize:function(e){var t,n,r=e.split(/\s/).pop(),i=e.replace(r,""),s=r.charAt(0).match(/[A-Z]/)?!0:!1;r=r.toLowerCase();for(t=0,n=SC.INFLECTION_CONSTANTS.UNCOUNTABLE.length;t<n;t++){var o=SC.INFLECTION_CONSTANTS.UNCOUNTABLE[t];if(r==o)return e.toString()}for(t=0,n=SC.INFLECTION_CONSTANTS.IRREGULAR.length;t<n;t++){var u=SC.INFLECTION_CONSTANTS.IRREGULAR[t][0],a=SC.INFLECTION_CONSTANTS.IRREGULAR[t][1];if(r==u||r==a)return s&&(u=u.capitalize()),i+u}for(t=0,n=SC.INFLECTION_CONSTANTS.SINGULAR.length;t<n;t++){var f=SC.INFLECTION_CONSTANTS.SINGULAR[t][0],l=SC.INFLECTION_CONSTANTS.SINGULAR[t][1];if(f.test(r))return e.replace(f,l)}}}),SC.String.strip=SC.String.trim,SC.supplement(String.prototype,{capitalizeEach:function(){return SC.String.capitalizeEach(this,arguments)},titleize:function(e){return SC.String.titleize(this,arguments)},classify:function(e){return SC.String.classify(this,arguments)},humanize:function(e){return SC.String.humanize(this,arguments)},escapeForRegExp:function(e){return SC.String.escapeForRegExp(this,arguments)},removeDiacritics:function(e){return SC.String.removeDiacritics(this,arguments)},trim:function(e){return SC.String.trim(this,arguments)},trimLeft:function(e){return SC.String.trimLeft(this,arguments)},trimRight:function(e){return SC.String.trimRight(this,arguments)},pluralize:function(e){return SC.String.pluralize(this,arguments)},singularize:function(e){return SC.String.singularize(this,arguments)}}),SC.mixin({_copy_computed_props:["maxWidth","maxHeight","paddingLeft"
,"paddingRight","paddingTop","paddingBottom","fontFamily","fontSize","fontStyle","fontWeight","fontVariant","lineHeight","whiteSpace","letterSpacing","wordWrap","boxSizing","webkitBoxSizing","MozBoxSizing"],stringFromLayout:function(e){var t=["maxHeight","maxWidth","minHeight","minWidth","centerY","centerX","width","height","bottom","right","top","left"],n=[],r,i=t.length;while(--i>=0)r=t[i],e.hasOwnProperty(r)&&n.push(r+":"+e[r]);return"{"+n.join(", ")+"}"},heightForString:function(e,t,n,r,i,s){if(s){var o=this.bestStringMetricsForMaxWidth(e,t,s,r,i);return o.height}SC.debug("Warning: Use the element reference for the heightForString method. Just using class names may result in inaccurate values.");var s,u;u=r&&SC.typeOf(r)===SC.T_ARRAY?r.join(" "):"",elem=document.createElement("div"),document.body.insertBefore(elem,null),n=n+"; width: "+t+"px; left: "+ -1*t+"px; position: absolute;";var a=SC.$(elem);a.attr("style",n),u!==""&&a.attr("class",u),elem.innerHTML=e;var o=this.bestStringMetricsForMaxWidth(e,t,elem,r,i);return elem.parentNode.removeChild(elem),elem=null,o.height},prepareStringMeasurement:function(e,t){var n=this._metricsCalculationElement,r,i,s,o;r=SC.A(t).join(" ");if(!n){var u=document.createElement("div");u.style.cssText="position:absolute; left:-10010px; top:-10px;width:10000px; height:0px; overflow:hidden;visibility:hidden;",n=this._metricsCalculationElement=document.createElement("div"),u.appendChild(n),document.body.insertBefore(u,null)}o=SC.$(n);if(SC.typeOf(e)!=SC.T_STRING){var a=null;document.defaultView&&document.defaultView.getComputedStyle?a=document
.defaultView.getComputedStyle(e,null):a=e.currentStyle;var f=this._copy_computed_props;for(var l=0;l<f.length;l++){var c=f[l],h=a[c];n.style[c]=h}var p=n.style;if(p.font===""){var d="";p.fontStyle&&(d+=p.fontStyle+" "),p.fontVariant&&(d+=p.fontVariant+" "),p.fontWeight&&(d+=p.fontWeight+" "),p.fontSize?d+=p.fontSize:d+="10px",p.lineHeight&&(d+="/"+p.lineHeight),d+=" ",p.fontFamily?d+=p.fontFamily:p+="sans-serif",n.style.font=d}SC.mixin(n.style,{left:"0px",top:"0px",position:"absolute",bottom:"auto",right:"auto",width:"auto",height:"auto"}),a=null}else s=e,o.attr("style",s+"; position:absolute; left: 0px; top: 0px; bottom: auto; right: auto; width: auto; height: auto;");n.className=r,n=null},teardownStringMeasurement:function(){var e=this._metricsCalculationElement;e.innerHTML="",e.className="",e.setAttribute("style",""),e=null},measureString:function(e,t,n){var r=this._metricsCalculationElement,i=SC.browser,s=0;if(!r)throw"measureString requires a string measurement environment to be set up. Did you mean metricsForString?";t?r.innerHTML=e:typeof r.innerText!="undefined"?r.innerText=e:r.textContent=e;var o=r.getBoundingClientRect(),u=o.width,a=o.height,f={width:u,height:a};return i.isMozilla&&!n&&(f.width+=1),r=null,f},metricsForString:function(e,t,n,r,i){SC.prepareStringMeasurement(t,n);var s=SC.measureString(e,r,i);return SC.teardownStringMeasurement(),s}}),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,autoFitTextFramePadding:{width:1,height:1},useExactMeasurement:NO,fontPropertyDidChange:function(){this.get("shouldAutoFitText")&&this.invokeLast(this.fitTextToFrame)}.observes("shouldAutoFitText","minFontSize","maxFontSize","frame"),measuredSizeDidChange:function(){var e=this.get("measuredSize"),t=e.width,n=e.height,r,i,s=this.get("autoResizePadding")||0,o=this.get("maxWidth"),u=this.get("maxHeight"),a=this.get("minWidth"),f=this.get("minHeight");SC.typeOf(s)===SC.T_NUMBER?r=i=s:(r=s.height,i=s.width),n+=r,t+=i,this.get("shouldAutoResize")&&(this.get("shouldResizeWidth")&&(a&&t<a&&(t=a),o&&t>o&&(t=o),this.set("calculatedWidth",t),this.adjust("width",t)),this.get("shouldResizeHeight")&&(f&&n<f&&(n=f),u&&n>u&&(n=u),this.set("calculatedHeight",n),this.adjust("height",n))),this.get("shouldAutoFitText")&&this.invokeLast(this.fitTextToFrame)}.observes("shouldAutoResize","measuredSize","autoResizePadding","maxWidth","minWidth","shouldResizeWidth","shouldResizeHeight"),initMixin:function(){},batchResizeId:null,scheduleMeasurement:function(){var e=this.get("batchResizeId");if(!this.get("shouldMeasureSize")||!this.get("isVisibleInWindow")||this.get("autoResizeText")===this._lastMeasuredText&&e===this._lastMeasuredId)return;SC.AutoResizeManager.scheduleMeasurementForView(this,e)}.observes("isVisibleInWindow","shouldMeasureSize","autoResizeText","batchResizeId"),_lastMeasuredText:null,_cachedMetrics:function(e,t){if(!this.get("shouldCacheSizes"))return;var n=SC.cacheSlotFor(this.get("batchResizeId")||this),r=this.get("autoResizeText"
);return t?n[r]=t:t=n[r],t}.property("shouldCacheSizes","autoResizeText","batchResizeId").cacheable(),measureSize:function(e){var t,n=this.get("autoResizeLayer"),r=this.get("autoResizeText"),i=!this.get("escapeHTML"),s=this.get("batchResizeId"),o=this.get("_cachedMetrics"),u=this.get("maxFontSize");if(!n)return;return o?t=o:SC.none(r)||r===""?t={width:0,height:0}:e?t=SC.measureString(r,i,this.get("useExactMeasurement")):(this.prepareLayerForStringMeasurement(n),t=SC.metricsForString(r,n,this.get("classNames"),i,this.get("useExactMeasurement"))),this.set("measuredSize",t),this.get("shouldCacheSizes")&&this.setIfChanged("_cachedMetrics",t),this._lastMeasuredText=r,this._lastMeasuredId=s,t},prepareLayerForStringMeasurement:function(e){var t=this.get("maxFontSize");this.get("shouldAutoFitText")&&this.get("calculatedFontSize")!==t&&(e.style.fontSize=t+"px")},viewDidResize:function(e){e(),this.fontPropertyDidChange()}.enhance(),fitTextToFrame:function(){var e=this.get("autoResizeLayer");if(!e)return;var t=this.get("maxFontSize"),n=this.get("minFontSize");this.prepareLayerForStringMeasurement(e);var r=this.get("frame"),i=this.get("autoResizePadding")||0,s=this.get("autoFitTextFramePadding"),o=s.width,u=s.height,a=r.width,f=r.height,l=a-o,c=f-u,h=this.get("measuredSize"),p=h.width,d=h.height,v;SC.typeOf(i)===SC.T_NUMBER?(l-=i,c-=i):(l-=i.width,c-=i.height);if(p<=l&&d<=c){this.set("calculatedFontSize",t),e.style.fontSize=t+"px";return}if(this.get("autoFitDiscreteFontSizes"))v=n;else{var m=l/p,g=c/d,y=Math.floor(t*Math.min(m,g)),b=this.get("classNames"),w=!this.get("escapeHTML"),E=this
.get("autoResizeText"),S;y=v=Math.min(t,Math.max(n,y)),e.style.fontSize=y+"px",S=SC.metricsForString(E,e,b,w);if(S.width>l||S.height>c)for(y-=1;y>=n;y--){e.style.fontSize=y+"px",S=SC.metricsForString(E,e,b,w),v=y;if(S.width<=l&&S.height<=c)break}else if(S.width<l||S.height<c)for(y+=1;y<=t;y++){e.style.fontSize=y+"px",S=SC.metricsForString(E,e,b,w),S.width<=l&&S.height<=c&&(v=y);if(S.width>=l||S.height>=c)break}}e.style.fontSize=v+"px",this.set("calculatedFontSize",v)},applyAttributesToContext:function(e,t){e(t),this.get("shouldAutoFitText")&&t.css("font-size",this.get("calculatedFontSize")+"px")}.enhance(),didCreateLayer:function(e){e(),this.scheduleMeasurement()}.enhance()},SC.AutoResizeManager={measurementQueue:SC.CoreSet.create(),scheduleMeasurementForView:function(e){this.measurementQueue.add(e),SC.RunLoop.currentRunLoop.invokeLast(this.doBatchResize)},cancelMeasurementForView:function(e,t){this.measurementQueue.remove(e)},doBatchResize:function(){if(this!==SC.AutoResizeManager)return SC.AutoResizeManager.doBatchResize();var e,t,n,r=this.measurementQueue,i,s,o,u;while((u=r.get("length"))>0){i=NO,e=r[u-1].get("batchResizeId");for(o=u-1;o>=0;--o){t=r[o];if(t.get("batchResizeId")!==e)continue;t.get("isVisibleInWindow")&&t.get("shouldMeasureSize")&&(n=t.get("autoResizeLayer"))&&(s=t.get("autoResizeText"),!SC.none(s)&&s!==""&&!t.get("_cachedMetrics")&&!i&&(t.prepareLayerForStringMeasurement(n),SC.prepareStringMeasurement(n,t.get("classNames")),i=YES),t.measureSize(YES)),r.remove(t);if(!e)break}i&&SC.teardownStringMeasurement()}}},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(e){var t=this._display_contentPropertyDidChange;SC.isArray(e)?e.invoke("addObserver","*",this,t):e.addObserver&&e.addObserver("*",this,t)},_display_stopObservingContent:function(e){var t=this._display_contentPropertyDidChange;SC.isArray(e)?e.invoke("removeObserver","*",this,t):e.removeObserver&&e.removeObserver("*",this,t)},_display_contentDidChange:function(e,t,n){if((n=this.get("content"))===this._display_content)return;var r=this._display_content;r&&this._display_stopObservingContent(r),r=this._display_content=n,r&&this._display_beginObservingContent(r),this.displayDidChange()}.observes("content","contentDisplayProperties"),_display_contentPropertyDidChange:function(e,t,n,r){if(t==="*")this.displayDidChange();else{var i=this.get("contentDisplayProperties");i&&i.indexOf(t)>=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(e,t){var n=this.get("contentKeys"),r;if(n){for(r in n)(t==="*"||t===this.getDelegateProperty(r,this,this.get("displayDelegate"),n))&&this.updatePropertyFromContent(n[r],t,r,e);return this}return this.updatePropertyFromContent("value",
t,"contentValueKey",e)},updatePropertyFromContent:function(e,t,n,r){var i,s;n===undefined&&(n="content"+e.capitalize()+"Key");if(this[n])n=this.get(n);else{if(!(i=this.get("displayDelegate"))||!(s=i[n]))return this;n=i.get?i.get(n):s}if(t==="*"||t===n)r===undefined&&(r=this.get("content")),r?s=r.get?r.get(n):r[n]:s=null,this.setIfChanged(e,s);return this},updateContentWithValueObserver:function(e,t){var n=this._reverseContentKeys;if(!t||t==="*")for(t in n)this.updateContentWithValueObserver(this,t);var r=this.get(t),i=this.get("content"),s=this.getDelegateProperty(n[t],this,this.displayDelegate);if(!s||!i)return this;typeof i.setIfChanged===SC.T_FUNCTION?i.setIfChanged(s,r):i[s]!==r&&(i[s]=r)},_control_content:null,_old_contentValueKeys:null,_old_contentKeys:null,_control_contentDidChange:function(e,t){var n=this.get("content"),r=this.get("contentKeys"),i,s=this._control_content,o=this._old_contentValueKeys,u=SC.typeOf(o),a=this.contentPropertyDidChange;if(s&&s.removeObserver&&o)if(u===SC.T_STRING)s.removeObserver(o,this,a),o=null;else{var f,l=o.get("length");for(f=0;f<l;f++)i=o[f],s.removeObserver(i,this,a);o.clear()}if(n&&n.addObserver)if(r){o||(o=SC.CoreSet.create());for(i in r)i=this.getDelegateProperty(i,this,this.get("displayDelegate")),i&&(n.addObserver(i,this,a),o.add(i))}else i=this.getDelegateProperty("contentValueKey",this,this.get("displayDelegate")),i&&(n.addObserver(i,this,a),o?o.add(i):o=i);this._control_content=n,this._old_contentValueKeys=o,t=!t||t==="content"?"*":this.get(t),t&&this.contentPropertyDidChange(n,t)}.observes("content"),_old_contentKeys:null,_control_contentKeysDidChange
:function(){var e,t={},n=this.get("contentKeys")||this._default_contentKeys,r,i=this._old_contentKeys,s=this._control_contentDidChange,o=this.updateContentWithValueObserver;for(e in i)r=i[e],this.removeObserver(r,this,o),this.removeObserver(e,this,s);for(e in n)r=n[e],t[r]=e,this.addObserver(r,this,o),this.addObserver(e,this,s);this._reverseContentKeys=t,this._old_contentKeys=n,this._control_contentDidChange()}.observes("contentKeys")},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.CUSTOM_CONTROL_SIZE="sc-custom-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 e,t,n,r;return(e=this.get("fieldLabel"))?e:(t=this.get("fieldKey")||this.constructor.toString(),n=t?SC.String.capitalize(SC.String.humanize(t)):"",r=SC.String.locWithDefault("FieldKey."+t,n),SC.String.locWithDefault("ErrorLabel."+t,r))}.property("fieldLabel","fieldKey").cacheable(),controlSize:SC.REGULAR_CONTROL_SIZE,displayProperties:["isEnabled","isSelected","isActive","controlSize"],_CONTROL_TMP_CLASSNAMES:{},renderMixin:function(e,t){var n=this.get("isSelected"),r=!this.get("isEnabled"),i=this._CONTROL_TMP_CLASSNAMES;i.mixed=n===SC.MIXED_STATE,i.sel=n&&n!==SC.MIXED_STATE,i.active=this.get("isActive"
);var s=this.get("controlSize");s||(s=SC.REGULAR_CONTROL_SIZE),t?(e.setClass(i),this.get("renderDelegate")||e.addClass(s)):(e.$().setClass(i),this.get("renderDelegate")||e.$().addClass(s));if(!t&&this.$input){var o=this.$input();o.attr("type")!=="radio"&&this.$input().attr("disabled",r)}}}),SC.Editable={isEditable:NO,isEditing:NO,beginEditing:function(){return this.get("isEditable")?this.get("isEditing")?YES:(this.beginPropertyChanges(),this.set("isEditing",YES),this.becomeFirstResponder(),this.endPropertyChanges(),YES):NO},discardEditing:function(){return!this.get("isEditing")},commitEditing:function(){return this.get("isEditing")?(this.set("isEditing",NO),this.resignFirstResponder(),YES):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 e=this.get("flowPadding")||{},t={};return t.left=e.left||0,t.top=e.top||0,t.bottom=e.bottom||0,t.right=e.right||0,t}.property("flowPadding").cacheable(),concatenatedProperties:["childMixins"],initMixin:function(){this._scfl_tileOnce()},_scfl_childViewsDidChange:function(e){this._scfl_tileOnce()}.observes("childViews"),_scfl_layoutPropertyDidChange:function(e){this._scfl_tileOnce()}.observes("layoutDirection","align","flowPadding","canWrap","defaultFlowSpacing","isVisibleInWindow"),layoutDidChangeFor:function(e){var t=e._scfl_lastLayout,n=e.get("layout"),r=e.get("frame"
);if(!t)return arguments.callee.base.apply(this,arguments);var i=YES;t.left&&t.left!==n.left?i=NO:t.top&&t.top!==n.top?i=NO:!e.get("fillWidth")&&t.width&&t.width!==n.width?i=NO:!t.width&&!e.get("fillWidth")&&r.width!==e._scfl_lastFrame.width?i=NO:!e.get("fillHeight")&&t.height&&t.height!==n.height?i=NO:!t.height&&!e.get("fillHeight")&&r.height!==e._scfl_lastFrame.height&&(i=NO);if(i)return arguments.callee.base.apply(this,arguments);this._scfl_tileOnce(),arguments.callee.base.apply(this,arguments)},observeChildLayout:function(e){if(e._scfl_isBeingObserved)return;e._scfl_isBeingObserved=YES,e.addObserver("flowSpacing",this,"_scfl_tileOnce"),e.addObserver("isVisible",this,"_scfl_tileOnce"),e.addObserver("useAbsoluteLayout",this,"_scfl_tileOnce"),e.addObserver("calculatedWidth",this,"_scfl_tileOnce"),e.addObserver("calculatedHeight",this,"_scfl_tileOnce"),e.addObserver("startsNewRow",this,"_scfl_tileOnce"),e.addObserver("isSpacer",this,"_scfl_tileOnce"),e.addObserver("maxSpacerLength",this,"_scfl_tileOnce"),e.addObserver("fillWidth",this,"_scfl_tileOnce"),e.addObserver("fillHeight",this,"_scfl_tileOnce")},unobserveChildLayout:function(e){e._scfl_isBeingObserved=NO,e.removeObserver("flowSpacing",this,"_scfl_tileOnce"),e.removeObserver("isVisible",this,"_scfl_tileOnce"),e.removeObserver("useAbsoluteLayout",this,"_scfl_tileOnce"),e.removeObserver("calculatedWidth",this,"_scfl_tileOnce"),e.removeObserver("calculatedHeight",this,"_scfl_tileOnce"),e.removeObserver("startsNewRow",this,"_scfl_tileOnce"),e.removeObserver("isSpacer",this,"_scfl_tileOnce"),e.removeObserver("maxSpacerLength"
,this,"_scfl_tileOnce"),e.removeObserver("fillWidth",this,"_scfl_tileOnce"),e.removeObserver("fillHeight",this,"_scfl_tileOnce")},shouldIncludeChildInFlow:function(e,t){return t.get("isVisible")&&!t.get("useAbsoluteLayout")},flowSpacingForChild:function(e,t){var n=t.get("flowSpacing");return SC.none(n)&&(n=this.get("defaultFlowSpacing")),SC.none(n)&&(n=0),SC.typeOf(n)===SC.T_NUMBER?n={left:n,right:n,bottom:n,top:n}:(n.left=n.left||0,n.right=n.right||0,n.top=n.top||0,n.bottom=n.bottom||0),n},flowSizeForChild:function(e,t){var n=t.get("calculatedWidth"),r=t.get("calculatedHeight"),i=this.get("layoutDirection"),s={},o=t.get("frame"),u=t.get("layout");return t._scfl_lastFrame=o,n?s.width=n:s.width=u.width||o.width,r?s.height=r:s.height=u.height||o.height,t.get("isSpacer")&&(s.maxSpacerLength=t.get("maxSpacerLength"),i===SC.LAYOUT_HORIZONTAL?s.width=u.minWidth||0:s.height=u.minHeight||0),i===SC.LAYOUT_HORIZONTAL&&t.get("fillHeight")?s.height=u.minHeight||0:i===SC.LAYOUT_VERTICAL&&t.get("fillWidth")&&(s.width=u.minWidth||0),s},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(){this.get("autoResize")&&(this.get("layoutDirection")==SC.LAYOUT_VERTICAL?(this.get("shouldResizeHeight")&&this.adjust("minHeight",this.get("_scfl_maximumCollapsedRowLength")),this.get("shouldResizeWidth")&&this.adjust("minWidth",this.get("_scfl_totalCollapsedRowSize"))):(this.get("shouldResizeWidth"
)&&this.adjust("minWidth",this.get("_scfl_maximumCollapsedRowLength")),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"),t=this.get("_scfl_validFlowPadding"),n=this.get("frame"),r=e===SC.LAYOUT_VERTICAL,i={rows:undefined,maximumCollapsedRowLength:0,totalCollapsedRowSize:0,isVertical:e===SC.LAYOUT_VERTICAL,isHorizontal:e===SC.LAYOUT_HORIZONTAL,flowPadding:t,planStartPadding:t[r?"left":"top"],planEndPadding:t[r?"right":"bottom"],rowStartPadding:t[r?"top":"left"],rowEndPadding:t[r?"bottom":"right"],maximumRowLength:undefined,fitToPlanSize:undefined,align:this.get("align")};return r?(i.maximumRowLength=n.height-i.rowStartPadding-i.rowEndPadding,i.fitToPlanSize=n.width-i.planStartPadding-i.planEndPadding):(i.maximumRowLength=n.width-i.rowStartPadding-i.rowEndPadding,i.fitToPlanSize=n.height-i.planStartPadding-i.planEndPadding),i},_scfl_distributeChildrenIntoRows:function(e){var t=this.get("childViews"),n,r,i=t.length,s=e.isVertical,o=[],u;u=-1,r=0;while(r<i&&r!==u){u=r;var a={plan:e,rowLength:undefined,rowSize:undefined,shouldExpand:undefined,items:undefined,position:undefined};r=this._scfl_distributeChildrenIntoRow(t,r,a),o.push(a)}e.rows=o},_scfl_distributeChildrenIntoRow:function(e,t,n){var r,i=e.length,s=n.plan,o,u,a,f=[],l=0,c=s.isVertical,h,p,d,v=this.get("canWrap"),m=NO,g=0,y=n.plan.maximumRowLength;for(r=t;r<i;r++){o=e[r],m=m||f.length>0&&
o.get("startsNewRow");if(!this.shouldIncludeChildInFlow(r,o))continue;u=this.flowSizeForChild(r,o),a=this.flowSpacingForChild(r,o),u.width+=a.left+a.right,u.height+=a.top+a.bottom,p=u[c?"height":"width"],SC.none(u.maxSpacerLength)||(d=u.maxSpacerLength+(c?a.top+a.bottom:a.left+a.right)),h=u[c?"width":"height"];if((m||v&&l+p>y)&&f.length>0)break;var b={child:o,itemLength:p,maxSpacerLength:d,itemSize:h,spacing:a,position:undefined,fillRow:c?o.get("fillWidth"):o.get("fillHeight"),isSpacer:o.get("isSpacer"),left:undefined,top:undefined,width:undefined,height:undefined};f.push(b),l+=p,g=Math.max(p,g)}n.rowLength=l;var w=v?g:n.rowLength;return n.plan.maximumCollapsedRowLength=Math.max(w,n.plan.maximumCollapsedRowLength),n.items=f,r},_scfl_positionChildrenInRows:function(e){var t=e.rows,n=t.length,r;for(r=0;r<n;r++)this._scfl_positionChildrenInRow(t[r])},_scfl_positionChildrenInRow:function(e){var t=e.items,n=t.length,r,i,s,o=0,u=0,a,f=e.plan.align,l=YES,c=0,h=NO;for(r=0;r<n;r++)i=t[r],i.isSpacer&&(u+=i.child.get("spaceUnits")||1);f===SC.ALIGN_JUSTIFY&&(u+=n-1),a=Math.max(0,e.plan.maximumRowLength-e.rowLength)/u;while(a>0){for(r=0;r<n;r++)i=t[r],i.isSpacer&&(i.itemLength+=a*(i.child.get("spaceUnits")||1),i.itemLength>i.maxSpacerLength?(c+=i.itemLength-i.maxSpacerLength,i.itemLength=i.maxSpacerLength):h=YES);if(!h)break;a=Math.round(c/u),c=0}s=0,u!==0||f!==SC.ALIGN_RIGHT&&f!==SC.ALIGN_BOTTOM?u===0&&(f===SC.ALIGN_CENTER||f===SC.ALIGN_MIDDLE)&&(s=e.plan.maximumRowLength/2-e.rowLength/2):s=e.plan.maximumRowLength-e.rowLength,s+=e.plan.rowStartPadding;for(r=0;r<n;r++)i=t[r],i.fillRow||(
l=NO),o=Math.max(i.itemSize,o),i.position=s,s+=i.itemLength,f===SC.ALIGN_JUSTIFY&&r<n-1&&(s+=a);e.shouldExpand=n>0?l:NO,e.rowLength=s-e.plan.rowStartPadding,e.rowSize=o,e.plan.totalCollapsedRowSize+=e.rowSize},_scfl_positionRows:function(e){var t=e.rows,n=t.length,r,i,s,o=0,u=0,a;for(r=0;r<n;r++)t[r].shouldExpand&&o++,u+=t[r].rowSize;a=e.fitToPlanSize-u,s=e.planStartPadding;for(r=0;r<n;r++)i=t[r],i.shouldExpand&&a>0&&(i.rowSize+=a/o,o--),i.position=s,s+=i.rowSize},_scfl_applyPlan:function(e){var t=e.rows,n,r,i,s=0,o=0,u,a,f,l,c,h,p=e.isVertical;r=t.length;for(n=0;n<r;n++){i=t[n],s=Math.max(s,i.rowLength),o+=i.rowSize,u=i.items,f=u.length;for(a=0;a<f;a++)l=u[a],l.child.beginPropertyChanges(),h=l.fillRow?i.rowSize:l.itemSize,c={left:l.spacing.left+(p?i.position:l.position),top:l.spacing.top+(p?l.position:i.position),width:p?h:l.itemLength,height:p?l.itemLength:h},c.width-=l.spacing.left+l.spacing.right,c.height-=l.spacing.top+l.spacing.bottom,this.applyPlanToView(l.child,c),l.child._scfl_lastLayout=c,l.child.endPropertyChanges()}o+=e.planStartPadding+e.planEndPadding,s+=e.rowStartPadding+e.rowEndPadding,this.beginPropertyChanges(),this.set("calculatedHeight",p?s:o),this.set("calculatedWidth",p?o:s),this.set("_scfl_maximumCollapsedRowLength",e.maximumCollapsedRowLength),this.set("_scfl_totalCollapsedRowSize",e.totalCollapsedRowSize),this.endPropertyChanges()},applyPlanToView:function(e,t){e.adjust(t)},_scfl_tileOnce:function(){this.invokeLast(this._scfl_tile)},_scfl_tile:function(){if(!this.get("isVisibleInWindow"))return;var e=this._scfl_createPlan();this._scfl_distributeChildrenIntoRows
(e),this._scfl_positionChildrenInRows(e),this._scfl_positionRows(e),this._scfl_applyPlan(e),this.setIfChanged("numberOfRows",e.rows.length);var t=this._scfl_isObserving||SC.CoreSet.create(),n=SC.CoreSet.create(),r=this.get("childViews"),i=r.length,s,o;for(s=0;s<i;s++)o=r[s],t.contains(o)?t.remove(o):this.observeChildLayout(o),n.add(o);i=t.length;for(s=0;s<i;s++)this.unobserveChildLayout(t[s])},_scfl_frameDidChange:function(){var e=this.get("frame"),t=this._scfl_lastFrameSize||{};this._scfl_lastFrameSize=SC.clone(e);if(t.width==e.width&&t.height==e.height)return;this._scfl_tileOnce()}.observes("frame"),destroyMixin:function(){var e=this._scfl_isObserving;if(!e)return;var t=e.length,n;for(n=0;n<t;n++)this.unobserveChildLayout(e[n])},reorder:function(e){!SC.typeOf(e)===SC.T_ARRAY&&(e=arguments);var t=e.length,n=this.childViews,r;this.beginPropertyChanges();while(t-->0)r=e[t],SC.typeOf(r)===SC.T_STRING&&(r=this.get(r)),n.removeObject(r),n.unshiftObject(r);return this.endPropertyChanges(),this._scfl_childViewsDidChange(),this}},SC.InlineEditable={isInlineEditable:YES,isEditable:YES,exampleEditor:SC.InlineTextFieldView,isEditing:NO,inlineEditorDelegate:SC.InlineTextFieldDelegate,_editor:null,beginEditing:function(){var e;return e=this.delegateFor("inlineEditorShouldBeginEditing",this.inlineEditorDelegate),e&&!e.inlineEditorShouldBeginEditing(this,this.get("value"))?NO:(this._editor=this.invokeDelegateMethod(this.inlineEditorDelegate,"acquireEditor",this),this._editor?this._editor.beginEditing(this):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(e,t,n){e.set("value",this.get("value"))},inlineEditorDidBeginEditing:function(e,t,n){this.set("isEditing",YES)},inlineEditorWillCommmitEditing:function(e,t,n){this.inlineEditorWillEndEditing&&this.inlineEditorWillEndEditing(e,t)},inlineEditorDidCommitEditing:function(e,t,n){n.setIfChanged("value",t),this.inlineEditorDidEndEditing&&this.inlineEditorDidEndEditing(e,t),this._endEditing()},inlineEditorWillDiscardEditing:function(e,t){this.inlineEditorWillEndEditing&&this.inlineEditorWillEndEditing(e,this.get("value"))},inlineEditorDidDiscardEditing:function(e,t){this.inlineEditorDidEndEditing&&this.inlineEditorDidEndEditing(e,this.get("value")),this._endEditing()},_endEditing:function(){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(e){if(this.get("isEditing")||!e||!e.isInlineEditable)return NO;var t,n;return n=this._target=e,t=this.delegateFor("inlineEditorWillBeginEditing",this.inlineEditorDelegate,n),t&&t.inlineEditorWillBeginEditing(this,this.get("value"),n),this.set("isEditing",YES),this.invokeLast(this._callDidBegin),this._didBeginInvoked=YES,YES},_callDidBegin:function(){if(!this.get("isEditing"))return NO;this._didBeginInvoked=NO;var e=this._target,t;t=this.delegateFor
("inlineEditorDidBeginEditing",this.inlineEditorDelegate,e),t&&t.inlineEditorDidBeginEditing(this,this.get("value"),e)},commitEditing:function(){if(!this.get("isEditing"))return NO;this._didBeginInvoked&&this._callDidBegin();var e,t=this._target;return e=this.delegateFor("inlineEditorShouldCommitEditing",this.inlineEditorDelegate,t),e&&!e.inlineEditorShouldCommitEditing(this,this.get("value"),t)?NO:(e=this.delegateFor("inlineEditorWillCommitEditing",this.inlineEditorDelegate,t),e&&e.inlineEditorWillCommitEditing(this,this.get("value"),t),this._endEditing(),e=this.delegateFor("inlineEditorDidCommitEditing",this.inlineEditorDelegate,t),e&&e.inlineEditorDidCommitEditing(this,this.get("value"),t),YES)},discardEditing:function(){if(!this.get("isEditing"))return NO;this._didBeginInvoked&&this._callDidBegin();var e,t=this._target;return e=this.delegateFor("inlineEditorShouldDiscardEditing",this.inlineEditorDelegate,t),e&&!e.inlineEditorShouldDiscardEditing(this,t)?NO:(e=this.delegateFor("inlineEditorWillDiscardEditing",this.inlineEditorDelegate,t),e&&e.inlineEditorWillDiscardEditing(this,t),this._endEditing(),e=this.delegateFor("inlineEditorDidDiscardEditing",this.inlineEditorDelegate,t),e&&e.inlineEditorDidDiscardEditing(this,t),YES)},_endEditing:function(){this.set("isEditing",NO),this._target=null}},SC.InlineEditorDelegate={acquireEditor:function(e){},releaseEditor:function(e){},inlineEditorShouldBeginEditing:function(e,t){},inlineEditorWillBeginEditing:function(e,t,n){},inlineEditorDidBeginEditing:function(e,t,n){},inlineEditorShouldCommitEditing:function(e,t,n){},inlineEditorWillCommitEditing
:function(e,t,n){},inlineEditorDidCommitEditing:function(e,t,n){},inlineEditorShouldDiscardEditing:function(e,t){},inlineEditorWillDiscardEditing:function(e,t){},inlineEditorDidDiscardEditing:function(e,t){},inlineEditorWillEndEditing:function(e,t,n){},inlineEditorDidEndEditing:function(e,t,n){}},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(e,t,n,r){var i=this.get("align"),s=this.get("scale"),o,u,a;a={x:0,y:0,width:n,height:r};if(s===SC.FILL)return a;o=n/e,u=r/t;switch(s){case SC.FILL_PROPORTIONALLY:s=o>u?o:u;break;case SC.BEST_FIT:s=o<u?o:u;break;case SC.BEST_FIT_DOWN_ONLY:e>n||t>r?s=o<u?o:u:s=1;break;case SC.SCALE_NONE:s=1;break;default:if(isNaN(window.parseFloat(s))||window.parseFloat(s)<=0)return 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(s)),a}e*=s,t*=s,a.width=Math.round(e),a.height=Math.round(t);switch(i){case SC.ALIGN_LEFT:a.x=0,a.y=r/2-t/2;break;case SC.ALIGN_RIGHT:a.x=n-e,a.y=r/2-t/2;break;case SC.ALIGN_TOP:a.x=n/2-e/2,a.y=0;break;case SC.ALIGN_BOTTOM:a.x=n/2-e/2,a.y=r-t;break;case SC.ALIGN_TOP_LEFT:a.x=0,a.y=0;break;case SC.ALIGN_TOP_RIGHT:a.x=n-e,a.y=0;break;case SC.ALIGN_BOTTOM_LEFT:a.x=0,a.y=r-t;break;case SC.ALIGN_BOTTOM_RIGHT:a.x=n-e,a.y=r-t;break;default:i!==SC.ALIGN_CENTER&&i!==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(i)),a.x=n/2-e/2,a.y=r/2-t/2}return a},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(e){var t=SC.VALIDATE_OK;if(this._validator){var n=this.get("ownerForm");e?(t=this._validator.validatePartial(n,this),t==SC.VALIDATE_NO_CHANGE&&this._validator.validateChange(n,this)==SC.VALIDATE_OK&&(t=SC.VALIDATE_OK)):t=this._validator.validateChange(n,this)}return t},performValidateSubmit:function(){return this._validator?this._validator.validateSubmit(this.get("ownerForm"),this):SC.VALIDATE_OK},performValidateKeyDown:function(e){var t=e.getCharString();return t?this._validator?this._validator.validateKeyDown(this.get("ownerForm"),this,t):YES:YES},validatorObject:function(){return this._validator}.property(),validateSubmit:function(){return this.performValidateSubmit()},objectForFieldValue:function(e,t){return this._validator?this._validator.objectForFieldValue(e,this.get("ownerForm"),this):e},fieldValueForObject:function(e){return this._validator?this._validator.fieldValueForObject(e,this.get("ownerForm"),this):e},_validatable_displayObserver:function(){this.displayDidChange()}.observes("isValid"),renderMixin:function(e){e.setClass("invalid",!this.get("isValid"))},_validatable_validatorDidChange:function(){var e=this.get("ownerForm"),t=SC.Validator.findFor(e,this,this.get("validator"));t!=this._validator&&(this.propertyWillChange("validatorObject"
),this._validator&&this._validator.detachFrom(e,this),this._validator=t,this._validator&&this._validator.attachTo(e,this),this.propertyDidChange("validatorObject"))}.observes("validator","ownerForm")},SC.RenderDelegate={create:function(){var e=SC.beget(this),t,n=arguments.length;for(t=0;t<n;t++)e.mixin(arguments[t]);return e},reopen:function(e){var t,n;for(t in e){n=e[t];if(!e.hasOwnProperty(t))continue;typeof n=="function"&&n!==this[t]&&(n.base=this[t]||SC.K),n&&n.isEnhancement&&n!==this[t]&&(n=SC._enhance(this[t]||SC.K,n)),this[t]=n}},get:function(e){return this[e]},getPropertyFor:function(e,t){return this[t+"For"]?this[t+"For"](e,t):this[t]},className:undefined,render:function(e,t){},update:function(e,t){}},SC.RenderDelegate.extend=SC.RenderDelegate.create,SC.RenderDelegate.mixin=SC.RenderDelegate.reopen,SC.BaseTheme.canvasImageRenderDelegate=SC.RenderDelegate.create({className:"canvasImage",render:function(e,t){var n=e.get("width")||0,r=e.get("height")||0;t.attr("width",n),t.attr("height",r)},update:function(e,t){var n=t[0],r=e.get("image"),i=e.get("frame"),s=i.width,o=i.height,u=e.get("innerFrame"),a=e.get("backgroundColor"),f=e.get("renderState"),l,c=![u.x,u.y,u.width,u.height].isEqual(f._lastInnerFrameValues),h=![n.width,n.height].isEqual(f._lastElemSizeValues),p=e.didChangeFor("canvasImageRenderDelegate","backgroundColor"),d=e.didChangeFor("canvasImageRenderDelegate","image")||(r&&r.complete)!==f._lastImageComplete;if(h||c||p||d)n&&n.getContext&&(n.height=o,n.width=s,l=n.getContext("2d"),l.clearRect(0,0,s,o),a&&(l.fillStyle=a,l.fillRect(0,0,s,o)),r&&r.complete&&l.drawImage
(r,Math.floor(u.x),Math.floor(u.y),Math.floor(u.width),Math.floor(u.height))),f._lastInnerFrameValues=[u.x,u.y,u.width,u.height],f._lastElemSizeValues=[n.width,n.height],f._lastImageComplete=r&&r.complete}}),SC.BaseTheme.containerRenderDelegate=SC.RenderDelegate.create({render:function(e,t){},update:function(){}}),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(e){var t=e.get("controlSize"),n,r,i;if(t)return this[t]||(this[t]={}),n=this[t],n.name||(n.name=t),n;var s=e.get("frame");if(!s)return n=this["sc-regular-size"],n||(n=this["sc-regular-size"]={}),n.name||(n.name="sc-regular-size"),n;for(r=0;r<i;r++){key=sizes[r],n=this[key];if(!n)continue;if(n.width===undefined&&n.height===undefined&&n.minHeight===undefined&&n.minWidth===undefined&&n.maxHeight===undefined&&n.maxWidth===undefined||n.width!==undefined&&s.width!==n.width||n.minWidth!==undefined&&s.width<n.minWidth||n.maxWidth!==undefined&&s.width>n.maxWidth||n.height!==undefined&&s.height!==n.height||n.minHeight!==undefined&&s.height<n.minHeight||n.maxHeight!==undefined&&s.height<n.maxHeight)continue;return n.name||(n.name=key),n}return n=this["sc-regular-size"],n||(n=this["sc-regular-size"]={}),n.name||(n.name="sc-regular-size"),n},addSizeClassName:function(e,t){var n=this.sizeFor(e);n&&t.addClass(n.name)},updateSizeClassName:function(e,t){var n=this.sizeFor(e);n&&t.addClass(n.name)},getPropertyFor:function(e,t){var n=this.sizeFor(e);if(n){if(n[t+"For"])return n[t+"For"](e,t);if(n[t]!==undefined
)return n[t]}return this[t+"For"]?this[t+"For"]:this[t]}}),SC.BaseTheme.imageRenderDelegate=SC.RenderDelegate.create({className:"image",render:function(e,t){var n=e.get("image"),r=e.get("imageValue"),i=e.get("type")||SC.IMAGE_TYPE_URL,s=e.get("toolTip");t=t.begin("img"),t.attr("src",n.src),r&&i===SC.IMAGE_TYPE_CSS_CLASS&&(t.addClass(r),this._last_class=r),s&&(t.attr("title",s),t.attr("aria-label",s)),t.addStyle(this.imageStyles(e)),t=t.end()},update:function(e,t){var n=e.get("image"),r=e.get("imageValue"),i=e.get("toolTip");t=t.find("img"),t.attr("src",n.src),r!==this._last_class&&t.setClass(this._last_class,NO),r&&(t.addClass(r),this._last_class=r),i&&(t.attr("title",i),t.attr("alt",i)),t.css(this.imageStyles(e))},imageStyles:function(e){var t=e.get("innerFrame");return{position:"absolute",left:Math.round(t.x),top:Math.round(t.y),width:Math.round(t.width),height:Math.round(t.height)}}}),SC.BaseTheme.labelRenderDelegate=SC.RenderDelegate.create({className:"label",render:function(e,t){this.addSizeClassName(e,t);var n=e.get("fontWeight"),r=e.get("textAlign");(n||r)&&t.addStyle({fontWeight:n||null,textAlign:r||null}),t.setClass("ellipsis",e.get("needsEllipsis")||NO),t.setClass("icon",e.get("icon")||NO);var i=this.htmlForTitleAndIcon(e);t.push(i),e.get("renderState")._lastHTMLForTitleAndIcon=i},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("fontWeight"),r=e.get("textAlign");(n||r)&&t.css({fontWeight:n||null,textAlign:r||null}),t.setClass("ellipsis",e.get("needsEllipsis")||NO);var i=this.htmlForTitleAndIcon(e);e.get("renderState")._lastHTMLForTitleAndIcon!==i&&(t
.html(i),e.get("renderState")._lastHTMLForTitleAndIcon=i)},htmlForTitleAndIcon:function(e){var t=e.get("title"),n=e.get("hint"),r=e.get("hintEnabled"),i=e.get("escapeHTML"),s=e.get("icon")||"";return t&&i&&(t=SC.RenderContext.escapeHTML(t)),r&&n&&!t&&(i&&(n=SC.RenderContext.escapeHTML(n)),t="<span class='sc-hint'>"+n+"</span>"),s&&(s.indexOf("/")>=0?s='<img src="'+s+'" class="icon" />':s='<img src="'+SC.BLANK_IMAGE_URL+'" class="icon '+s+'" />'),s+t}}),SC.Benchmark={verbose:NO,enabled:YES,events:{},stats:{},globalStartTime:null,addEvent:function(e,t){t||(t=(new Date).getTime()),this.events[e]=t},start:function(e,t,n,r){if(!this.enabled)return;var i=n||Date.now(),s;return t?s=this._subStatFor(e,t):s=this._statFor(e),r&&s._starts.length>0?s._starts.push("ignore"):s._starts.push(i),s._times.push({start:i,_subStats:{}}),e},end:function(e,t,n){var r,i,s;if(!this.enabled)return;t?r=this._subStatFor(e,t):r=this._statFor(e),i=r._starts,i&&(s=i.pop());if(!s){SC.Logger.log('SC.Benchmark "%@" ended without a matching start. No information was saved.'.fmt(e));return}if(s=="ignore")return;var o=n||Date.now(),u=o-s;r._times[r._times.length-1].end=o,r._times[r._times.length-1].dur=u,r.amt+=u,r.runs++,this.verbose&&this.log(e)},setGlobalStartTime:function(e){this.globalStartTime=e},bench:function(e,t,n){t||(t="bench%@".fmt(this._benchCount++)),n||(n=1);var r;while(--n>=0){var i=SC.Benchmark.start(t);r=e(),SC.Benchmark.end(i)}return r},install:function(e,t,n){e["b__"+t]=e[t];var r=e["b__"+t];e[t]=function(){var e="%@(%@)".fmt(t,$A(arguments).join(", "));SC.Benchmark.start(e,n);var i=r.apply
(this,arguments);return SC.Benchmark.end(e),i}},restore:function(e,t){e[t]=e["b__"+t]},report:function(e){if(e)return this._genReport(e);var t=[];for(var n in this.stats){if(!this.stats.hasOwnProperty(n))continue;t.push(this._genReport(n))}return t.join("\n")},timelineReport:function(e){e=e?"SproutCore Application":e;var t=[e,"User-Agent: %@".fmt(navigator.userAgent),"Report Generated: %@ (%@)".fmt((new Date).toString(),Date.now()),""],n=this._compileChartData(!0);for(var r=0;r<n.length;r++)n[r][4]?t.push(this._timelineGenSubReport(n[r])):t.push(this._timelineGenReport(n[r]));return t.join("\n")},getTimelineChartContent:function(){var e=this._compileChartData(!1),t=e.length;if(t===0)return;var n=this.globalStartTime?this.globalStartTime:e[0][1],r=e[t-1][2]-n,i=25+t*30,s=Math.ceil(r/200)+1,o=s*50,u=10,a=300,f="<div class = 'sc-benchmark-timeline-chart' style = 'position:relative;'>";f+="<div class = 'sc-benchmark-top'></div>";for(var l=0;l<s;l++)f+="<div class = 'sc-benchmark-tick' style = '",f+="left: "+(u+l*50)+"px; ",f+="height: "+i+"px;",f+="'></div>",f+="<div class = 'sc-benchmark-tick-label' style = '",f+="left: "+(u+l*50)+"px; ",f+="'>"+l*200+"ms</div>";for(l=0;l<t;l++){f+="<div class = 'sc-benchmark-row ",f+=l%2===0?"even":"odd",f+="' style = '",f+="top: "+(50+l*30)+"px; ",f+="'></div>";var c=document.createElement("div"),h=e[l][1],p=e[l][2],d=e[l][3];f+="<div class = 'sc-benchmark-bar' style = '",f+="left:"+(u+(h-n)/4)+"px; width: "+d/4+"px;",f+="top: "+(28+l*30)+"px;",f+="' title = 'start: "+(h-n)+" ms, end: "+(p-n)+" ms, duration: "+d+" ms'",f+=">",f+="&nbsp;"+e[l]
[0]+" <span class='sc-benchmark-emphasis'>",f+=d+"ms (start: "+(h-n)+"ms)",f+="</span>",f+="</div>"}var v=this.events,m=0;for(l in v){var g=v[l]-n;f+="<div class = 'sc-benchmark-event idx"+m%10+"' style = '",f+="left: "+(u+g/4)+"px; height: "+i+"px; top: 20px;",f+="' title = '"+l+": "+g+"'></div>",m++}return f+="</div>",{html:f,totalCapturedTime:r,pointsCaptured:t,width:o+u+a,height:i}},getTimelineChartView:function(){var e=SC.ScrollView.create({contentView:SC.StaticContentView.extend({}),reload:function(){var e=SC.Benchmark.getTimelineChartContent();this.contentView.set("content",e.html),this.contentView.adjust({width:e.width,height:e.height}),this.chartContent=e,SC.RunLoop.invokeLater(SC.Benchmark,function(){this.contentView.notifyPropertyChange("frame")})}});return e.reload(),e},timelineChart:function(e){SC.RunLoop.begin();var t=0;this.hideChart();var n=this.getTimelineChartView(),r=n.chartContent.pointsCaptured,i=n.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:(e?e:"SproutCore Application")+(" - Total Captured Time: "+i+" ms - Points Captured: "+r),fontWeight:"bold"})}).append(),n.set("layout",{left:20,top:60,bottom:20,right:20}),this._benchmarkChart.appendChild(n),SC.RunLoop.end()},hideChart:function(){return this._benchmarkChart&&
(this._benchmarkChart.remove(),this._benchmarkChart=null),YES},tryToPerform:function(e,t){return this[e]?this[e](t):NO},log:function(e){var t=this.report(e).split("\n"),n=t.length,r;for(r=0;r<n;r++)SC.Logger.log(t[r])},startProfile:function(e){if(!this.enabled)return;SC.Logger.profile(e)},endProfile:function(e){if(!this.enabled)return;SC.Logger.profileEnd(e)},loadPreloadEvents:function(){var e=SC.benchmarkPreloadEvents,t=[],n,r,i;typeof webkitPerformnce!="undefined"&&SC.mixin(e,webkitPerformane.timing);if(!this.globalStartTime){var s=["navigation","navigationStart","headStart"];r=s.length;for(n=0;n<r;n++)if(e[s[n]]){this.globalStartTime=e[s[n]];break}}this.javascriptStartTime=e.headStart,SC.mixin(this.events,e),this._hasLoadedPreloadEvents=!0},_loadBenchmarksFromEvents:function(){this._hasLoadedPreloadEvents||this.loadPreloadEvents();var e=this.events;for(var t in e){if(t.substr(-3)!=="End")continue;var n=t.substr(0,t.length-3);if(!e[n+"Start"])continue;SC.Benchmark.start(n,undefined,e[n+"Start"]),SC.Benchmark.end(n,undefined,e[n+"End"]),delete e[n+"Start"],delete e[n+"End"]}},_compileChartData:function(e){this._loadBenchmarksFromEvents();var t=[],n;for(var r in this.stats){var i=this.stats[r];for(var s=0;s<i._times.length;s++){var o=i._times[s];n=i._times.length>1?s+1+" - "+r:r,t.push([n,o.start,o.end,o.dur,!1]);if(e){var u=o._subStats;for(var a in u){var f=u[a];for(var l=0;l<f._times.length;l++){var c=f._times[l];n=f._times.length>1?l+1+" - "+a:a,t.push([n,c.start,c.end,c.dur,!0])}}}}}return t.sort(function(e,t){return e[1]<t[1]?-1:e[1]==t[1]?e[3]&&!t[3]?-1:!e[3]&&t[3]?1:0
:1}),t},_genReport:function(e){var t=this._statFor(e),n=t.runs>0?Math.floor(t.amt*1e3/t.runs)/1e3:0,r=t._times[t._times.length-1];return"BENCH %@ msec: %@ (%@x); latest: %@".fmt(n,t.name||e,t.runs,r.end-r.start)},_timelineGenReport:function(e){return this.globalStartTime?"BENCH start: %@ msec, duration: %@ msec, %@".fmt(e[1]-this.globalStartTime,e[3],e[0]):"BENCH duration: %@ msec, %@".fmt(e[3],e[0])},_timelineGenSubReport:function(e){return this.globalStartTime?" CHECKPOINT BENCH start: %@ msec, duration: %@ msec, %@".fmt(e[1]-this.globalStartTime,e[3],e[0]):" CHECKPOINT BENCH duration: %@ msec, %@".fmt(e[3],e[0])},_subStatFor:function(e,t){var n=this.stats[t]._times.length;if(n===0)return;var r=this.stats[t]._times[this.stats[t]._times.length-1]._subStats,i=r[e];return i||(r[e]={runs:0,amt:0,name:e,_starts:[],_times:[]},i=r[e]),i},_statFor:function(e){var t=this.stats[e];return t||(t=this.stats[e]={runs:0,amt:0,name:e,_starts:[],_times:[]},t=this.stats[e]),t},reset:function(){this.stats={}},_bench:function(e,t){SC.Benchmark.bench(e,t,1)},_benchCount:1},SC.Benchmark=SC.Benchmark,SC.mixin(SC.$.fn,{setClass:function(e,t){if(SC.none(e))return this;var n=SC.typeOf(e)!==SC.T_STRING,r=this._fixupClass,i;return this.each(function(){if(this.nodeType!==1)return;var i=this.className.split(/\s+/),s=NO;if(n)for(var o in e)e.hasOwnProperty(o)&&(s=r(i,o,e[o])||s);else s=r(i,e,t);s&&(this.className=i.join(" "))}),this},_fixupClass:function(e,t,n){var r=e.indexOf(t);if(n){if(r<0)return e.push(t),YES}else if(r>=0)return e[r]=null,YES;return NO}}),SC.ExceptionHandler={enabled:SC.buildMode!=="debug"
,handleException:function(e){return this.isShowingErrorDialog?NO:(this._displayErrorDialog(e),NO)},_displayErrorDialog:function(e){var t=this._errorDialogHTMLForException(e),n=document.createElement("div");n.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;",n.innerHTML=t,document.body.appendChild(n),this.isShowingErrorDialog=YES},_errorDialogHTMLForException:function(e){var t;return t=['<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>",e.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>"],t.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(e,t,n,r){var i=SC.typeOf(t);SC.none(n)&&SC.typeOf(t)===SC.T_FUNCTION&&(t=null,n=t),SC.typeOf(n)===SC.T_STRING&&(n=t[n]),SC.none(r)&&(r=SC.none(t)&&SC.none(n));var s=this._imageEntryFor(e);s.status===this.IMAGE_LOADED?n&&n.call
(t||s.image,s.url,s.image):((t||n)&&this._addCallback(s,t,n),s.retainCount++,this._scheduleImageEntry(s,r))},releaseImage:function(e,t,n){var r=this._imageEntryFor(e,NO);if(!r)return this;if(--r.retainCount<=0)this._deleteEntry(r);else if(t||n){var i=SC.typeOf(t);SC.none(n)&&SC.typeOf(t)===SC.T_FUNCTION&&(t=null,n=t),SC.typeOf(n)===SC.T_STRING&&(n=t[n]),this._removeCallback(r,t,n)}},reloadImage:function(e){var t=this._imageEntryFor(e,NO);t&&t.status===this.IMAGE_LOADED&&(t.status=this.IMAGE_WAITING)},loadNextImage:function(){var e=null,t;if(this.get("activeRequests")>=this.get("loadLimit"))return;t=this._foregroundQueue;while(t.length>0&&!e)e=t.shift();if(!e){t=this._backgroundQueue;while(t.length>0&&!e)e=t.shift()}this.set("isLoading",!!e);if(e){var n=e.image;if(!n)return;var r=SC.$(n);r.length!==0?(r.bind("abort",this._imageDidAbort),r.bind("error",this._imageDidError),r.bind("load",this._imageDidLoad),n.src=e.url,this._loading.push(e)):e.url?SC.error("Unable to load the image for url %@".fmt(e.url)):SC.error("entry does not contain any url. Its an invalid entry"),this.incrementProperty("activeRequests"),this.loadNextImage()}},_imageEntryFor:function(e,t){t===undefined&&(t=YES);var n=this._images[e];if(!n&&t){var r=new Image;n=this._images[e]={url:e,status:this.IMAGE_WAITING,callbacks:[],retainCount:0,image:r},r.entry=n}return n},_deleteEntry:function(e){this._unscheduleImageEntry(e),delete this._images[e.url]},_addCallback:function(e,t,n){var r=e.callbacks,i=r.find(function(e){return e[0]===t&&e[1]===n},this);return i||r.push([t,n]),r=null,this},_removeCallback:function(e
,t,n){var r=e.callbacks;return r.forEach(function(e,i){e[0]===t&&e[1]===n&&(r[i]=null)},this),r=null,this},_scheduleImageEntry:function(e,t){var n=this._backgroundQueue,r=this._foregroundQueue;if(e.status===this.IMAGE_LOADED)return this;e.status===this.IMAGE_QUEUED&&!t&&e.isBackground&&(n[n.indexOf(e)]=null,e.status=this.IMAGE_WAITING);if(e.status!==this.IMAGE_QUEUED){var i=t?n:r;i.push(e),e.status=this.IMAGE_QUEUED,e.isBackground=t}return this.isLoading||this.invokeLater(this.loadNextImage,100),this.set("isLoading",YES),this},_unscheduleImageEntry:function(e){if(e.status!==this.IMAGE_QUEUED)return this;var t=e.isBackground?this._backgroundQueue:this._foregroundQueue;return t[t.indexOf(e)]=null,this._loading.indexOf(e)>=0&&(t.image&&t.image.abort(),this.imageStatusDidChange(e,this.ABORTED)),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(e,t){if(!e)return;var n=e.url,r;switch(t){case this.LOADED:r=e.image;break;case this.ABORTED:r=SC.IMAGE_ABORTED_ERROR;break;case this.ERROR:r=SC.IMAGE_FAILED_ERROR;break;default:r=SC.IMAGE_FAILED_ERROR}e.callbacks.forEach(function(e){var t=e[0],i=e[1];i.call(t,n,r)},this),e.callbacks=[],e.status=t===this.LOADED?this.IMAGE_LOADED:this.IMAGE_WAITING;var i=e.image;i&&(i.onload=i.onerror=i.onabort=null,t!==
this.LOADED&&(e.image=null)),this._loading[this._loading.indexOf(e)]=null,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.Task=SC.Object.extend({run:function(e){}}),SC.LOG_MODULE_LOADING=YES,SC.Module=SC.Object.create({isModuleReady:function(e){var t=SC.MODULE_INFO[e];return t?!!t.isReady:NO},loadModule:function(e,t,n){var r=SC.MODULE_INFO[e],i,s,o=SC.A(arguments).slice(3),u=SC.LOG_MODULE_LOADING,a,f;n===undefined&&SC.typeOf(t)===SC.T_FUNCTION&&(n=t,t=null),u&&SC.debug("SC.Module: Attempting to load '%@'",e);if(!r)throw"SC.Module: could not find module '%@'".fmt(e);r.isPrefetching=NO;if(r.isLoaded&&!r.isWaitingForRunLoop)return u&&SC.debug("SC.Module: Module '%@' already loaded.",e),this._dependenciesMetForModule(e)?r.source?(u&&SC.debug("SC.Module: Evaluating JavaScript for module '%@'.",e),this._evaluateStringLoadedModule(r),this._addCallbackForModule(e,t,n,o),this.invokeLast(function(){r.isReady=YES,this._moduleDidBecomeReady(e)}),NO):(n&&(SC.isReady?SC.Module._invokeCallback(e,t,n,o):SC.ready(SC.Module,function(){SC.Module._invokeCallback(e,t,n,o)})),YES):(this._addCallbackForModule(e,t,n,o),this._loadDependenciesForModule(e),NO);if(!r.isWaitingForRunLoop)return u&&SC.debug("SC.Module: Module '%@' is not loaded, loading now."
,e),this._addCallbackForModule(e,t,n,o),r.isLoading||(this._loadDependenciesForModule(e),this._loadCSSForModule(e),this._loadJavaScriptForModule(e),r.isLoading=YES),NO;this._addCallbackForModule(e,t,n,o)},_addCallbackForModule:function(e,t,n,r){var i=SC.MODULE_INFO[e],s=i.callbacks||[];n&&s.push(function(){SC.Module._invokeCallback(e,t,n,r)}),i.callbacks=s},prefetchModule:function(e){var t=SC.MODULE_INFO[e];if(t.isLoading||t.isLoaded)return;SC.LOG_MODULE_LOADING&&SC.debug("SC.Module: Prefetching module '%@'.",e),this._loadDependenciesForModule(e),this._loadCSSForModule(e),this._loadJavaScriptForModule(e),t.isLoading=YES,t.isPrefetching=YES},_executeLazilyInstantiatedModule:function(e,t,n){var r=SC.LAZY_INSTANTIATION[e],i,s,o,u;SC.LOG_MODULE_LOADING&&SC.debug("SC.Module: Module '%@' is marked for lazy instantiation, instantiating it now…",e),u=r.length;for(o=0;o<u;o++)try{r[o]()}catch(a){SC.Logger.error("SC.Module: Failed to lazily instatiate entry for '%@'".fmt(e))}delete SC.LAZY_INSTANTIATION[e],i=this._targetForTargetName(t),s=this._methodForMethodNameInTarget(n,i);if(!s)throw"SC.Module: could not find callback for lazily instantiated module '%@'".fmt(e)},_evaluateStringLoadedModule:function(e){var t=e.source;jQuery.globalEval(t),delete e.source;if(e.cssSource){var n=this.getInlinedCSSFor(e),r=document.createElement("style");r.setAttribute("type","text/css");if(r.styleSheet)r.styleSheet.cssText=n;else{var i=document.createTextNode(n);r.appendChild(i)}document.getElementsByTagName("head")[0].appendChild(r)}e.isReady=YES},getInlinedCSSFor:function(e){var t=typeof e=="string"?
SC.MODULE_INFO[e]:e,n,r;if(t._sc_module_postprocessed_css)return t._sc_module_postprocessed_css;window.devicePixelRatio>1?(n=t.css2xSource,r=t.css2xLogicalUrl,n||(n=t.cssSource,r=t.cssLogicalUrl)):(n=t.cssSource,r=t.cssLogicalUrl);var i=SC.absoluteUrl(r);return i=i.split("/"),i.pop(),i=i.join("/"),n=n.replace(/url\s*\(\s*["']?(.*?)["']\s*?\)/g,function(e,t){return t[0]==="/"?e:t.match(/https?:|file:/)?e:(t=i+"/"+t,"url("+JSON.stringify(t)+")")}),t._sc_module_postprocessed_css=n,n},_loadCSSForModule:function(e){var t=document.getElementsByTagName("head")[0],n=SC.MODULE_INFO[e],r=window.devicePixelRatio>1?n.styles2x:n.styles||[],i=r.length,s,o,u;t||(t=document.documentElement),i=r.length;for(u=0;u<i;u++)s=r[u],s.length>0&&(SC.LOG_MODULE_LOADING&&SC.debug("SC.Module: Loading CSS file in '%@' -> '%@'",e,s),o=document.createElement("link"),o.setAttribute("href",s),o.setAttribute("rel","stylesheet"),o.setAttribute("type","text/css"),t.appendChild(o));o=null},_loadJavaScriptForModule:function(e){var t=SC.MODULE_INFO[e],n,r,i=t.dependencies,s=YES;i&&i.length>0&&(s=this._dependenciesMetForModule(e)),t.isPrefetched?r=t.stringURL:s?r=t.scriptURL:r=t.stringURL;if(r.length>0){SC.LOG_MODULE_LOADING&&SC.debug("SC.Module: Loading JavaScript file in '%@' -> '%@'",e,r);if(parseFloat(SC.browser.msie)>=11){var o=new XMLHttpRequest;o.onreadystatechange=function(){if(this.readyState!==4||this.status!==200||this._done===(this._done=YES))return;window.eval.call(window,this.responseText+';SC.run(function(){SC.Module._moduleDidLoad("'+e+'")})')},o.open("GET",r),o.send(null);return}n=document.createElement
("script"),n.setAttribute("type","text/javascript"),n.setAttribute("async","true"),n.setAttribute("src",r),SC.browser.isIE?n.onreadystatechange=function(){(this.readyState=="complete"||this.readyState=="loaded")&&SC.run(function(){SC.Module._moduleDidLoad(e)})}:n.onload=function(){SC.run(function(){SC.Module._moduleDidLoad(e)})},document.body.appendChild(n)}},_dependenciesMetForModule:function(e){var t=SC.MODULE_INFO[e].dependencies||[],n,r=t.length,i,s;for(n=0;n<r;n++){i=t[n],s=SC.MODULE_INFO[i];if(!s)throw"SC.loadModule: Unable to find dependency %@ for module %@.".fmt(i,e);if(!s.isReady)return NO}return YES},_loadDependenciesForModule:function(e){var t=SC.MODULE_INFO[e],n=SC.LOG_MODULE_LOADING,r=t.dependencies||[],i=YES,s=r.length,o,u,a,f;for(o=0;o<s;o++){u=r[o],a=SC.MODULE_INFO[u];if(!a)throw"SC.Module: could not find required module '%@' for module '%@'".fmt(u,e);if(a.isLoading)i=NO,f=a.dependents,f||(a.dependents=f=[]),f.push(e);else{if(a.isReady)continue;i=NO,f=a.dependents,f||(a.dependents=f=[]),f.push(e),n&&SC.debug("SC.Module: '%@' depends on '%@', loading dependency…",e,u),SC.Module.loadModule(u)}}},_invokeCallback:function(e,t,n,r){var i,s;s=this._targetForTargetName(t),i=this._methodForMethodNameInTarget(n,s);if(!i){if(!SC.LAZY_INSTANTIATION[e])throw"SC.Module: could not find callback for '%@'".fmt(e);this._executeLazilyInstantiatedModule(e,t,n),s=this._targetForTargetName(t),i=this._methodForMethodNameInTarget(n,s)}r||(r=[]),r.unshift(e);var o=!!SC.RunLoop.currentRunLoop;o?SC.run(function(){i.apply(s,r)}):i.apply(s,r)},_invokeCallbacksForModule:function(e){var t=
SC.MODULE_INFO[e],n;if(!t)return;SC.LOG_MODULE_LOADING&&SC.debug("SC.Module: Module '%@' has completed loading, invoking callbacks.",e),n=t.callbacks||[];for(var r=0,i=n.length;r<i;++r)n[r]()},_evaluateAndInvokeCallbacks:function(e){var t=SC.MODULE_INFO,n=t[e],r=SC.LOG_MODULE_LOADING;r&&SC.debug("SC.Module: Evaluating and invoking callbacks for '%@'.",e),n.source&&this._evaluateStringLoadedModule(n),n.isWaitingForRunLoop=YES,this.invokeLast(function(){n.isReady=YES,this._moduleDidBecomeReady(e)})},_moduleDidBecomeReady:function(e){var t=SC.MODULE_INFO,n=t[e],r=SC.LOG_MODULE_LOADING;n.isWaitingForRunLoop=NO,SC.isReady?(SC.Module._invokeCallbacksForModule(e),delete n.callbacks):SC.ready(SC,function(){SC.Module._invokeCallbacksForModule(e),delete n.callbacks});var i=n.dependents||[],s,o;for(var u=0,a=i.length;u<a;u++)s=i[u],o=t[s],o.isLoaded&&this._dependenciesMetForModule(s)&&(r&&SC.debug("SC.Module: Now that %@ has loaded, all dependencies for a dependent %@ are met.",e,s),this._evaluateAndInvokeCallbacks(s))},_moduleDidLoad:function(e){var t=SC.MODULE_INFO[e],n=SC.LOG_MODULE_LOADING,r,i,s;n&&SC.debug("SC.Module: Module '%@' finished loading.",e);if(!t){n&&SC.debug("SC._moduleDidLoad() called for unknown module '@'.",e),t=SC.MODULE_INFO[e]={isLoaded:YES,isReady:YES};return}if(t.isLoaded){n&&SC.debug("SC._moduleDidLoad() called more than once for module '%@'. Skipping.",e);return}delete t.isLoading,t.isLoaded=YES,t.isPrefetching?(delete t.isPrefetching,n&&SC.debug("SC.Module: Module '%@' was prefetched, not evaluating until needed.",e)):(r=this._dependenciesMetForModule(e),r?this
._evaluateAndInvokeCallbacks(e):n&&SC.debug("SC.Module: Dependencies for '%@' not met yet, waiting to evaluate.",e))},_targetForTargetName:function(e){return SC.typeOf(e)===SC.T_STRING?SC.objectForPropertyPath(e):e},_methodForMethodNameInTarget:function(e,t){return SC.typeOf(e)===SC.T_STRING?SC.objectForPropertyPath(e,t):e},methodsForSuspend:"loadModule _moduleDidLoad prefetchModule _moduleDidBecomeReady".w(),suspend:function(){this._suspendCount=(this._suspendCount||0)+1;if(this._suspendCount!==1)return;var e=this.get("methodsForSuspend"),t,n,r,i;for(i=0;r=e[i];i++)this[t="__replacement_"+r+"__"]||((this[t]=function(){(this._bufferedCalls||(this._bufferedCalls=[])).push({method:arguments.callee.methodName,arguments:arguments})}).methodName=r),this[n="__saved_"+r+"__"]||(this[n]=this[r]),this[r]=this[t]},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 e=this.get("methodsForSuspend"),t=this._bufferedCalls,n,r,i,s;for(r=0;n=e[r];r++)this[n]=this["__saved_"+n+"__"];for(r=0;s=t&&t[r];r++)this[s.method].apply(this,s.arguments);t&&(t.length=0)}}),SC.ready(function(){var e=SC.MODULE_INFO,t,n,r;for(t in e)n=e[t],n.isPrefetched&&(r=SC.Module.PrefetchModuleTask.create({prefetchedModuleName:t}),SC.backgroundTaskQueue.push(r))}),SC.Module.PrefetchModuleTask=SC.Task.extend({prefetchedModuleName:null,run:function(){SC.Module.prefetchModule(this.prefetchedModuleName)}}),SC.TaskQueue=
SC.Task.extend({init:function(){var e=this;this._doIdleEntry=function(){e._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(e){this._tasks.push(e),this.notifyPropertyChange("taskCount")},next:function(){if(this._tasks.length<1)return null;var e=this._tasks.shift();return this.notifyPropertyChange("taskCount"),e},suspend:function(){this._suspendCount++},resume:function(){this._suspendCount--,this._suspendCount<=0&&this._setupIdle()},_taskCountDidChange:function(){this._setupIdle()}.observes("taskCount"),_runWhenIdleDidChange:function(){this._setupIdle()}.observes("runWhenIdle"),_setupIdle:function(){!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 e=SC.RunLoop.lastRunLoopEnd;if(!this.get("runWhenIdle")&&!this._suspendCount)return;Date.now()-e>this.get("minimumIdleDuration")&&(SC.run(this.run,this),SC.RunLoop.lastRunLoopEnd=e),this._setupIdle()},run:function(e){this.set("isRunning",YES),e||(e=this.get("runLimit"));var t,n=Date.now();while(t=this.next()){t.run(this);if(Date.now()-n>e)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 e=this.get("start"),t=this.get("end");return e===-1||t===-1?-1:t-e}.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 e=this.get("length");return e&&e>0?e===1?"[%@ character selected: {%@, %@}]".fmt(e,this.get("start"),this.get("end")):"[%@ characters selected: {%@, %@}]".fmt(e,this.get("start"),this.get("end")):"[no text selected; caret at %@]".fmt(this.get("start"))}}),SC.mixin({_downloadFrames:0,download:function(e){var t=document.createElement("iframe"),n="DownloadFrame_"+this._downloadFrames;SC.$(t).attr("id",n),t.style.border="10px",t.style.width="0px",t.style.height="0px",t.style.position="absolute",t.style.top="-10000px",t.style.left="-10000px",SC.browser.isSafari||SC.$(t).attr("src",e),document.getElementsByTagName("body")[0].appendChild(t),SC.browser.isSafari&&SC.$(t).attr("src",e),this._downloadFrames=this._downloadFrames+1;if(!SC.browser.isSafari){var r=function(){document.body.removeChild(document.getElementById(n)),n=null};r.invokeLater(null,2e3)}t=null},getStyle:function(e,t){var n="";return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,"").getPropertyValue(t):e.currentStyle&&(t=t.replace(/\-(\w)/g,function(e,t){return t.toUpperCase()}),n=e.currentStyle[t]),n},uniJapaneseConvert:function(e){var t,n="",r,i;for(r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t=t>=65281&&t<=65392?t-65248:t,t=t===12540?45:t,n+=String
.fromCharCode(t);return n},pointInElement:function(e,t,n,r){var i,s,o,u;return t=jQuery(t),n=n||"border",i=SC.offset(t,r),n==="padding"?(s=t.innerWidth(),o=t.innerHeight(),i.x+=window.parseInt(t.css("border-top-width").replace("px","")),i.y+=window.parseInt(t.css("border-left-width").replace("px",""))):(s=t.outerWidth(n==="margin"),o=t.outerHeight(n==="margin"),n==="margin"&&(i.x-=window.parseInt(t.css("margin-top").replace("px","")),i.y-=window.parseInt(t.css("margin-left").replace("px","")))),u={x:i.x,y:i.y,width:s,height:o},SC.pointInRect(e,u)},switchScale:function(){$("head meta[name=viewport]").remove(),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" />'):$("head").prepend('<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0" />')}}),SC.mixin({bestStringMetricsForMaxWidth:function(e,t,n,r,i){if(!t)return SC.warn("When calling bestMetricsForWidth, the second argument, maxWidth, is required. There's no reason to call this without a maxWidth."),undefined;t=Math.ceil(parseFloat(t));var s=arguments.callee,o=SC.typeOf(n||(n=""))!==SC.T_STRING,u=o?n.style.maxWidth:undefined,a=!o||n.cacheableForMetrics?SC.cacheSlotFor(n,r,i,e):undefined,f=o?s._applyMaxToEl||(s._applyMaxToEl=function(e,t){return e.style.maxWidth=t+"px",e}):s._applyMaxToStr||(s._applyMaxToStr=function(e,t){return e.replace(/max-width:[^;]*;/g,"")+" max-width:"+t+"px"}),l=o?s._removeMaxFromEl||(s._removeMaxFromEl=function(
e){return e.style.maxWidth="none",e}):s._removeMaxFromStr||(s._removeMaxFromStr=function(e){return e.replace(/max-width:[^;]*;/g,"")+" max-width:none"}),c=!1;if(a){a.list||(a.list=[{width:Infinity,height:0}]);for(var h=1,p=a.list.length,d,v,m;h<p&&!m;h++){d=a.list[h],v=a.list[h-1];if(!d||!d.width)continue;if(t>=d.width){if(v&&v.width||t<=d.maxWidth)return d;m=d}}}var g=f(n,t),y=SC.metricsForString(e,g,r,i),b=y.height,w=a?a.parent.height||(a.parent.height=SC.metricsForString("W",g,r).height):SC.metricsForString("W",g,r).height,E=Math.round(b/w);c&&(E--,b=E*w);if(b>w){var S=c?Math.ceil(y.width*2.5):y.width,x=c?y.width:Math.floor(y.width/2.5),T,N=new Date*1,C=0;while(S-x>1||y.height>b&&!c||y.height<b&&c)C++,T=(S+x)/2,g=f(g,T),y=SC.metricsForString(e,g,r,i),y.height>b?x=T:S=T;y.width=Math.ceil(T),y.height=b,y.maxWidth=t,y.lineHeight=w,y.lines=E,y.searchPerformed=!0,y.searchTime=new Date*1-N,y.searchCount=C}else c&&(y=SC.metricsForString(e,g=l(g),r,i)),y.maxWidth=t,y.lineHeight=w,y.lines=E,y.searchPerformed=!1;y.browserCorrection=0,SC.browser.msie&&(y.browserCorrection=1),SC.browser.mozilla&&(y.browserCorrection=1),y.width=Math.min(t,y.width+y.browserCorrection);if(a){var k=a.list[E];k&&k.maxWidth<t&&(k.maxWidth=t),k||(k=a.list[E]=y)}return o&&(g.style.maxWidth=u),m=c?m:y,m},cacheSlotFor:function(){var e=arguments.callee.caller,t=e.cache||(e.cache={});if(!arguments.length)return t;var n=arguments[0],r=n&&(n instanceof Array||n.callee)?n:arguments,i=r.length,s,o;for(o=0;o<i;o++)typeof (s=r[o])=="object"&&(s=SC.guidFor(s)),t=t[s]||(t[s]={parent:t});return t},cachedVersionOf:function(
){var e=function(e){var t=function(){var e=SC.cacheSlotFor(arguments);return e.result||(e.result=arguments.callee.func.apply(this,arguments))};return t.func=e,t};return e(e)}()}),SC.didPreloadBundle=function(){},SC.PreloadBundleTask=SC.Task.extend({bundle:null,target:"SC",action:"preloaded",run:function(e){var t;if(t=this.get("bundle")){var n=Date.now();SC.Module.loadModule(this.get("bundle"),this.get("target"),this.get("action"))}}}),SC.VALIDATE_OK=YES,SC.VALIDATE_NO_CHANGE=NO,SC.Validator=SC.Object.extend({fieldValueForObject:function(e,t,n){return e},objectForFieldValue:function(e,t,n){return e},validate:function(e,t){return!0},validateError:function(e,t){return SC.$error(SC.String.loc("Invalid.General(%@)",t.get("fieldValue")),t.get("fieldKey"))},validateChange:function(e,t,n){return this.validate(e,t)?SC.VALIDATE_OK:this.validateError(e,t)},validateSubmit:function(e,t){return this.validate(e,t)?SC.VALIDATE_OK:this.validateError(e,t)},validatePartial:function(e,t){return t.get("isValid")?SC.VALIDATE_NO_CHANGE:this.validate(e,t)?SC.VALIDATE_OK:this.validateError(e,t)},validateKeyDown:function(e,t,n){return!0},attachTo:function(e,t){},detachFrom:function(e,t){}}),SC.Validator.mixin({OK:!0,NO_CHANGE:!1,findFor:function(e,t,n){var r;if(!n)return;if(n instanceof SC.Validator)r=n;else if(n.isClass)r=n.create();else if(SC.typeOf(n)===SC.T_STRING){var i=null,s=n.match(/^(.+)\[(.*)\]/);s&&(n=s[1],i=s[2]),n=SC.String.classify(n);var o=SC.Validator[n];if(SC.none(o))throw"validator %@ not found for %@".fmt(n,t);if(i){if(!e)throw"named validator (%@) could not be found for field %@ because the field does not belong to a form"
.fmt(i,t);e._validatorHash||(e._validatorHash={}),r=i?e._validatorHash[i]:null,r||(r=o.create()),i&&(e._validatorHash[i]=r)}else r=o.create()}return r},fieldValueForObject:function(e,t,n){return this.prototype&&this.prototype.fieldValueForObject?this.prototype.fieldValueForObject(e,t,n):null},objectForFieldValue:function(e,t,n){return this.prototype&&this.prototype.objectForFieldValue?this.prototype.objectForFieldValue(e,t,n):null}}),SC.Validator.Date=SC.Validator.extend({format:"%b %d, %Y %i:%M:%S %p",fieldValueForObject:function(e,t,n){var r=this.get("format"),i;return SC.typeOf(e)===SC.T_NUMBER?i=SC.DateTime.create(e):e instanceof Date&&(i=e.getTime()),i&&(e=i.toFormattedString(r)),e},objectForFieldValue:function(e,t,n){var r=this.get("format"),i;return e&&(i=SC.DateTime.parse(e,r),e=i?i._ms:null),e}}),SC.ContainerView=SC.View.extend({classNames:["sc-container-view"],renderDelegateName:"containerRenderDelegate",nowShowing:null,contentView:null,contentViewBindingDefault:SC.Binding.single(),replaceContent:function(e){this.removeAllChildren(),e&&this.appendChild(e)},createChildViews:function(){var e=this.get("contentView");e&&(e=this.contentView=this.createChildView(e),this.childViews=[e])},awake:function(){arguments.callee.base.apply(this,arguments);var e=this.get("nowShowing");e&&e.length>0&&this.nowShowingDidChange()},nowShowingDidChange:function(){var e=this.get("nowShowing");if(e===SC.CONTENT_SET_DIRECTLY)return;var t=this._instantiatedLastView===YES?this.get("contentView"):null;this._instantiatedLastView=NO;if(SC.typeOf(e)===SC.T_STRING&&e.length>0)if(e.indexOf(".")>0)
e=SC.objectForPropertyPath(e);else{var n=this.getPath(e);e=SC.kindOf(n,SC.CoreView)?n:SC.objectForPropertyPath(e,this.get("page"))}SC.typeOf(e)===SC.T_CLASS&&(e.kindOf(SC.CoreView)?(e=this.createChildView(e),this._instantiatedLastView=YES):e=null),e&&!(e instanceof SC.CoreView)&&(e=null),this.set("contentView",e),t&&t.destroy()}.observes("nowShowing"),contentViewDidChange:function(){this.replaceContent(this.get("contentView"))}.observes("contentView")}),SC.FieldView=SC.View.extend(SC.Control,SC.Validatable,{isTextArea:NO,_field_isMouseDown:NO,fieldValue:function(){var e=this.get("value");return SC.typeOf(e)===SC.T_ERROR&&(e=e.get("errorValue")),this.fieldValueForObject(e)}.property("value","validator").cacheable(),$input:function(){return this.get("isTextArea")?this.$("textarea").andSelf().filter("textarea"):this.$("input").andSelf().filter("input")},setFieldValue:function(e){SC.none(e)&&(e="");var t=this.$input();return t.val()!==e&&t.val(e),this},getFieldValue:function(){return this.$input().val()},_field_fieldValueDidChange:function(e){SC.run(function(){this.fieldValueDidChange(NO)},this)},fieldValueDidChange:function(e){var t=this.getFieldValue(),n=this.objectForFieldValue(t,e);this.setIfChanged("value",n)},_field_valueDidChange:function(){this.setFieldValue(this.get("fieldValue"))}.observes("fieldValue"),didCreateLayer:function(){this.setFieldValue(this.get("fieldValue")),SC.Event.add(this.$input(),"change",this,this._field_fieldValueDidChange)},didAppendToDocument:function(){this.get("isTextArea")&&(this.setFieldValue(this.get("fieldValue")),SC.Event.add(this.$input(),"change"
,this,this._field_fieldValueDidChange))},willDestroyLayer:function(){SC.Event.remove(this.$input(),"change",this,this._field_fieldValueDidChange)},mouseDown:function(e){return this._field_isMouseDown=YES,e.allowDefault(),YES},mouseExited:function(e){return this._field_isMouseDown&&this.set("isActive",NO),e.allowDefault(),YES},mouseEntered:function(e){return this.set("isActive",this._field_isMouseDown),e.allowDefault(),YES},mouseUp:function(e){return this._field_isMouseDown&&this.set("isActive",NO),this._field_isMouseDown=NO,e.allowDefault(),YES},keyDown:function(e){if(e.which===9||e.keyCode===9){var t=e.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");return t?t.becomeFirstResponder():e.allowDefault(),YES}return this.performValidateKeyDown(e)?(this._isKeyDown=YES,e.allowDefault()):e.stop(),YES},acceptsFirstResponder:function(){return SC.FOCUS_ALL_CONTROLS?this.get("isEnabled"):NO}.property("isEnabled"),_field_setFieldValue:function(e){this.propertyWillChange("fieldValue"),this.fieldValueForObject&&(e=this.fieldValueForObject(e));var t=this.setFieldValue(e);return this.propertyDidChange("fieldValue"),t},_field_getFieldValue:function(){var e=this.getFieldValue();return this.objectForFieldValue&&(e=this.objectForFieldValue(e)),e}}),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.msie&&SC.browser.msie<8?"/system/cloudos/16GHotfix7/sproutcore/foundation/16GHotfix7/en-us/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 e=this.get("value");return e&&e.isEnumerable?e.firstObject():e}.property("value").cacheable(),innerFrame:function(){var e=this.get("image"),t=e.width,n=e.height,r=this.get("frame");return SC.none(r)?{x:0,y:0,width:0,height:0}:this.innerFrameForSize(t,n,r.width,r.height)}.property("align","image","scale","frame").cacheable(),localize:YES,status:SC.IMAGE_STATE_NONE,type:function(){var e=this.get("imageValue");return SC.ImageView.valueIsUrl(e)?SC.IMAGE_TYPE_URL:SC.none(e)?SC.IMAGE_TYPE_NONE:SC.IMAGE_TYPE_CSS_CLASS}.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 e=this.get("layer"),t,n;if(e){t=e.offsetWidth,n=e.offsetHeight;if(this._cachedWidth!==t||this
._cachedHeight!==n)this.notifyPropertyChange("frame"),this._cachedWidth=t,this._cachedHeight=n}},init:function(){arguments.callee.base.apply(this,arguments),this._image_valueDidChange(),this.get("useImageCache")!==undefined&&(SC.Logger.warn("%@ has useImageCache set, please set useImageQueue instead".fmt(this)),this.set("useImageQueue",this.get("useImageCache")))},layerDidChange:function(){this.get("useCanvas")&&this.set("layerNeedsUpdate",YES)}.observes("layer"),_image_valueDidChange:function(){var e=this.get("imageValue"),t=this.get("type");e!==this._iv_value&&(this._iv_value=e,this.set("image",SC.BLANK_IMAGE),t!==SC.IMAGE_TYPE_CSS_CLASS&&(this.set("status",SC.IMAGE_STATE_LOADING),this._loadImageUsingCache()||this._loadImage()))}.observes("imageValue"),_loadImageUsingCache:function(){var e=this.get("imageValue"),t=this.get("type");if(t===SC.IMAGE_TYPE_URL&&this.get("useImageQueue")){var n=this.get("isVisibleInWindow")||this.get("canLoadInBackground");return SC.imageQueue.loadImage(e,this,this._loadImageUsingCacheDidComplete,n),YES}return NO},_loadImageUsingCacheDidComplete:function(e,t){var n=this.get("imageValue");n===e&&(SC.ok(t)?this.didLoad(t):this.didError(t))},_loadImage:function(){var e=this.get("imageValue"),t=this.get("type"),n=this,r,i;if(t===SC.IMAGE_TYPE_URL){r=new Image;var s=function(){SC.run(function(){n._loadImageDidComplete(e,SC.$error("SC.Image.FailedError","Image",-101))})},o=function(){SC.run(function(){n._loadImageDidComplete(e,r)})};return i=$(r),i.bind("error",s),i.bind("abort",s),i.bind("load",o),r.src=e,YES}return NO},_loadImageDidComplete:function(
e,t){var n=this.get("imageValue");n===e&&(SC.ok(t)?this.didLoad(t):this.didError(t))},didLoad:function(e){this.set("status",SC.IMAGE_STATE_LOADED),e||(e=SC.BLANK_IMAGE),this.set("image",e)},didError:function(e){this.set("status",SC.IMAGE_STATE_FAILED),this.set("image",SC.BLANK_IMAGE)}}),SC.ImageView.valueIsUrl=function(e){return e&&SC.typeOf(e)===SC.T_STRING?e.indexOf("/")>=0:NO},SC.TextFieldView=SC.FieldView.extend(SC.StaticLayout,SC.Editable,{classNames:["sc-text-field-view"],isTextField:YES,escapeHTML:NO,applyImmediately:YES,commitOnBlur:YES,isPassword:NO,isTextArea:NO,hint:"",type:"text",isBrowserFocusable:YES,autoCorrect:!0,autoCapitalize:!0,formattedHint:function(){var e=this.get("hint");return typeof e=="string"&&(this.get("localize")&&(e=SC.String.loc(e)),this.get("escapeHTML")&&(e=SC.RenderContext.escapeHTML(e)),e=e.replace(/\"/g,"&#34;")),e}.property("hint","localize","escapeHTML").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,shouldRenderInnerBorder:NO,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 e=this.get("value");this._hintON=(!e||e&&e.length===0)&&!this.get("hintOnFocus")?YES:NO;var t=this.get("continouslyUpdatesValue"
);return t!==null&&t!==undefined&&this.set("applyImmediately",t),arguments.callee.base.apply(this,arguments)},isEditable:YES,selection:function(e,t){var n=this.$input()[0],r,i,s;if(t===undefined){if(n){i=null,s=null;if(!n.value)i=s=0;else{try{"selectionStart"in n&&(i=n.selectionStart),"selectionEnd"in n&&(s=n.selectionEnd)}catch(o){return null}if(i===null||s===null){var u=document.selection;if(u){var a=u.type;if(a&&(a==="None"||a==="Text")){r=u.createRange();if(!this.get("isTextArea")){var f=r.text.length;i=Math.abs(r.moveStart("character",0-(n.value.length+1))),s=i+f}else{var l=r.duplicate();l.moveToElementText(n),l.setEndPoint("EndToStart",r),i=l.text.length,s=i+r.text.length}}}}}return SC.TextSelection.create({start:i,end:s})}return null}if(!t||!t.kindOf||!t.kindOf(SC.TextSelection))throw"When setting the selection, you must specify an SC.TextSelection instance.";if(n)if(n.setSelectionRange)n.setSelectionRange(t.get("start"),t.get("end"));else{r=n.createTextRange(),i=t.get("start"),r.move("character",i),r.moveEnd("character",t.get("end")-i);try{r.select()}catch(o){SC.Error("Failed selecting, this is a know bug with IE8, error 800a025e. Ignoring")}}return t}.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 e,t=["leftAccessoryView"
,"rightAccessoryView"],n=t.length,r,i,s,o;for(r=0;r<n;r++){i=t[r],s=this["_"+i],o=this.get(i);if(!s||!o||s!==o){s&&(e=s.get("classNames"),e=e.without("sc-text-field-accessory-view"),s.set("classNames",e),this.removeChild(s),s=null,this["_"+i]=null);if(o){o.isClass&&(o=o.create({layoutView:this})),e=o.get("classNames");var u="sc-text-field-accessory-view";e.indexOf(u)<0&&(e=SC.clone(e),e.push(u),o.set("classNames",e)),this.appendChild(o),this["_"+i]=o}}}}.observes("leftAccessoryView","rightAccessoryView"),layoutChildViewsIfNeeded:function(e){e||(e=this.get("isVisibleInWindow"));if(e&&this.get("childViewsNeedLayout")){var t=this.get("rightAccessoryView");if(t&&t.get){var n=t.get("layout");n&&(n.left=null,n.right||(n.right=0),t.adjust({layout:n}))}}arguments.callee.base.apply(this,arguments)},render:function(e,t){arguments.callee.base.apply(this,arguments);var n,r,i,s;n=this.get("fieldValue"),SC.none(n)&&(n=""),n=String(n),e.setClass("not-empty",n.length>0),r=this._getAccessoryViewWidths(),i=r.left,s=r.right,i&&(i+="px"),s&&(s+="px"),this._renderField(e,t,n,i,s)},localizedAriaLabel:function(){var e=this.get("ariaLabel");return!SC.none(e)&&typeof e===SC.T_STRING&&this.get("localize")&&(e=SC.String.loc(e)),e}.property("ariaLabel","localize").cacheable(),_forceRenderFirstTime:NO,_renderFieldLikeFirstTime:function(){this.set("_forceRenderFirstTime",YES)}.observes("isTextArea"),_renderField:function(e,t,n,r,i){var s=this.get("formattedHint"),o=this.get("localizedAriaLabel"),u=this.get("hintOnFocus"),a="",f=this.get("maxLength"),l=this.get("isTextArea"),c=this.get("isEnabled"),h=this
.get("isEditable"),p=this.get("autoCorrect"),d=this.get("autoCapitalize"),v=this.get("isBrowserFocusable"),m=SC.RenderContext,g="",y="",b="",w,E,S,x,T,N,C,k,L,A;n&&(this.get("escapeHTML")&&(n=m.escapeHTML(n)),n=n.replace(/\"/g,"&#34;")),e.setClass("text-area",l),e.setClass("text-field",!l),k=SC.browser.isWebkit&&parseInt(SC.browser.webkit,0)<532,e.setClass("oldWebKitFieldPadding",k);if(SC.none(o)){var O=this.get("hint");o=this.get("localize")?SC.String.loc(O):O}if(t||this._forceRenderFirstTime){this._forceRenderFirstTime=NO,L=c?h?"":'readonly="readonly"':'disabled="disabled"',w=this.get("layerId"),g=this.get("spellCheckEnabled")?' spellcheck="true"':' spellcheck="false"',o=m.escapeAttribute(o),SC.browser.mobileSafari&&(b=p?"":' autocorrect="off"',y=d?"":' autocapitalize="off"'),v&&(A='tabindex="-1"'),SC.platform.input.placeholder&&!u&&(a=' placeholder="'+s+'"'),this.get("shouldRenderBorder")&&!this.get("shouldRenderInnerBorder")&&e.push('<div class="border"></div>'),E="";if(r||i)E='style="',r&&(E+="left: "+r+"; "),i&&(E+="right: "+i+";"),E+='"';e.push('<div class="padding" '+E+">"),this._hintON&&!SC.platform.input.placeholder&&(!n||n&&n.length===0)&&(n=s,e.setClass("sc-hint",YES));if(u){var M='<div aria-hidden="true" class="hint '+(l?"":"ellipsis")+'%@">'+s+"</div>";e.push(M.fmt(n?" sc-hidden":""))}C="field",l?e.push('<textarea aria-label="'+o+'" aria-multiline="true" class="'+C+'" name="'+w+'" '+L+a+g+b+A+y+' maxlength="'+f+'">'+n+"</textarea>"):(S=this.get("type"),this.get("isPassword")&&(S="password"),e.push('<input aria-label="'+o+'" class="'+C+'" type="'+S+'" name="'+w+'" '+
L+' value="'+n+'"'+a+g+A+' maxlength="'+f+'" '+b+" "+y+"/>")),this.get("shouldRenderInnerBorder")&&e.push('<div class="border"></div>'),e.push("</div>")}else{var _=this.$input(),D=_[0],P=this.get("value"),H=this.$(".hint")[0];u&&H?H.innerHTML=s:u||(D.placeholder=s);if(!P||P&&P.length===0)this.get("isPassword")&&(D.type="password"),!SC.platform.input.placeholder&&this._hintON&&(this.get("isFirstResponder")?(e.setClass("sc-hint",NO),_.val("")):(e.setClass("sc-hint",YES),_.val(s)));_.attr("aria-label",o),SC.browser.mobileSafari&&(_.attr("autoCapitalize",d?"true":"off"),_.attr("autoCorrect",p?"true":"off")),!u&&SC.platform.input.placeholder&&_.attr("placeholder",s),v?_.removeAttr("tabindex"):_.attr("tabindex","-1"),T=_[0],T&&(c?h?(T.disabled=null,T.readOnly=null):(T.disabled=null,T.readOnly="true"):(T.disabled="true",T.readOnly=null),N=T.parentNode.style,r?N.left!==r&&(N.left=r):N.left=null,i?N.right!==i&&(N.right=i):N.right=null)}},_getAccessoryViewWidths:function(){var e={},t=["left","right"],n=t.length,r,i,s,o,u,a,f,l;for(r=0;r<n;r++)i=t[r],s=this.get(i+"AccessoryView"),s&&(s.isClass&&(s=s.create({layoutView:this})),s.get&&(l=s.get("frame"),l&&(u=l.width,u&&(a=s.get("layout"),a&&(f=a[i],u+=f),e[i]=u))));return e},didCreateLayer:function(){arguments.callee.base.apply(this,arguments),SC.platform.input.placeholder||this.invokeLast(this._setInitialPlaceHolderIE);if(this.get("isTextArea"))this.invokeLast(this._addTextAreaEvents);else{this._addTextAreaEvents();if(SC.browser.mozilla){var e=this.$input();SC.Event.add(e,"keypress",this,this._firefox_dispatch_keypress)}}},_setInitialPlaceHolderIE
:function(){if(!SC.platform.input.placeholder&&this._hintON){var e=this.$input(),t=e.val();(!t||t&&t.length===0)&&e.val(this.get("formattedHint"))}},_addTextAreaEvents:function(){var e=this.$input();SC.Event.add(e,"focus",this,this._textField_fieldDidFocus),SC.Event.add(e,"blur",this,this._textField_fieldDidBlur),SC.Event.add(e,"select",this,this._textField_selectionDidChange),SC.Event.add(e,"input",this,this._html5input),SC.Event.add(e,"compositionstart",this,this._IMECompositionStart)},willDestroyLayer:function(){arguments.callee.base.apply(this,arguments);var e=this.$input();SC.Event.remove(e,"focus",this,this._textField_fieldDidFocus),SC.Event.remove(e,"blur",this,this._textField_fieldDidBlur),SC.Event.remove(e,"select",this,this._textField_selectionDidChange),SC.Event.remove(e,"keypress",this,this._firefox_dispatch_keypress),SC.Event.remove(e,"input",this,this._html5input),SC.Event.remove(e,"compositionstart",this,this._IMECompositionStart)},_textField_fieldDidFocus:function(e){SC.run(function(){this.set("focused",YES),this.fieldDidFocus(e);var t=this.get("value");!SC.platform.input.placeholder&&(!t||t&&t.length===0)&&(this._hintON=NO)},this)},_textField_fieldDidBlur:function(e){SC.run(function(){this.set("focused",NO),this.fieldDidBlur(this._origEvent||e);var t=this.get("value");!SC.platform.input.placeholder&&!this.get("hintOnFocus")&&(!t||t&&t.length===0)&&(this._hintON=YES)},this)},fieldDidFocus:function(e){this.becomeFirstResponder(),this.beginEditing(e),this._field_valueHasChanged=NO,this._didHideInterceptForPane&&(this._didHideInterceptForPane.showTouchIntercept(
),this._didHideInterceptForPane=null);var t=this.get("pane");t&&t.get("hasTouchIntercept")&&(t.hideTouchIntercept(),this._didHideInterceptForPane=this.get("pane"))},fieldDidBlur:function(e){this.resignFirstResponder(e),this._field_valueHasChanged&&(this.fieldValueDidChange(NO),this._field_valueHasChanged=NO),this.get("commitOnBlur")&&this.commitEditing(e);var t=this._didHideInterceptForPane;t&&(t.showTouchIntercept(),t=null)},_field_fieldValueDidChange:function(e){this.get("focused")&&SC.run(function(){this.fieldValueDidChange(NO)},this),this.updateHintOnFocus()},_html5input:function(e){SC.run(function(){this.get("applyImmediately")||!this.get("focused")?this.fieldValueDidChange(YES):this._field_valueHasChanged=YES},this),this.updateHintOnFocus()},_IMECompositionStart:function(e){this.updateHintOnFocus(YES)},updateHintOnFocus:function(e){var t=this.get("hintOnFocus");if(!t)return;var n=this.getFieldValue();n!==undefined&&n!==null&&n.length>0||e&&SC.typeOf(e)===SC.T_BOOL?this.$(".hint").addClass("sc-hidden"):this.$(".hint").removeClass("sc-hidden")}.observes("value"),_topOffsetForFirefoxCursorFix:3,_firefox_dispatch_keypress:function(e){var t=this.get("selection"),n=this.get("value"),r=n?n.length:0,i;if(!t||t.get("length")===0&&t.get("start")===0||t.get("end")===r){i=SC.RootResponder.responder;if(e.keyCode===9)return;i.keypress.call(i,e),e.stopPropagation()}},_textField_selectionDidChange:function(){this.notifyPropertyChange("selection")},didBecomeKeyResponderFrom:function(e){if(this.get("isVisibleInWindow")){var t=this.$input()[0];try{t&&t.focus()}catch(n){}this._txtFieldMouseDown||
this.invokeLast(this._selectRootElement)}},_selectRootElement:function(){var e=this.$input()[0];e?(!SC.browser.isSafari||!SC.browser.isLion||SC.buildLocale!=="ko-kr")&&e.select():this._textField_selectionDidChange()},didLoseKeyResponderTo:function(e){var t=this.$input()[0];t&&t.blur(),this.invokeLater("scrollToOriginIfNeeded",100)},scrollToOriginIfNeeded:function(){var e=this.get("pane");if(!e)return;var t=e.get("firstResponder");if(!t||!t.get("isTextField"))document.body.scrollTop=document.body.scrollLeft=0},keyDown:function(e){var t=e.which,n=e.keyCode,r=!1,i,s;if(t===SC.Event.KEY_RETURN&&!e.isIMEInput&&!this.get("isTextArea"))return NO;if(t===SC.Event.KEY_ESC)return NO;if(t!==SC.Event.KEY_TAB&&n!==SC.Event.KEY_TAB||!this.get("defaultTabbingEnabled")){if(!SC.platform.input.maxlength&&this.get("isTextArea")){var o=this.get("value");o&&(!SC.browser.mozilla&&t>47||SC.browser.mozilla&&(t>32&&t<43||t>47)&&!(n>36&&n<41))&&o.length>=this.get("maxLength")&&(r=!0)}(this.performValidateKeyDown(e)||SC.platform.touch)&&!r||SC.isFunctionOrNonPrintableKey(e)?(this._isKeyDown=YES,e.allowDefault()):e.stop();if(this.get("applyImmediately")){var u=this;setTimeout(function(){u.fieldValueDidChange()},10)}else this._field_valueHasChanged=YES;return YES}return s=e.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView"),s?s.becomeFirstResponder():e.allowDefault(),YES},keyUp:function(e){return SC.browser.mozilla&&e.keyCode===SC.Event.KEY_RETURN&&this.fieldValueDidChange(),this.notifyPropertyChange("selection"),this._isKeyDown=NO,e.allowDefault(),YES},mouseDown:function(e){var t=this
.get("fieldValue"),n=this.$input();return n&&(n=n[0]),this._txtFieldMouseDown=YES,document.activeElement!==n&&(SC.browser.isIE8OrLower?this.invokeLater(this.becomeFirstResponder,50):this.becomeFirstResponder()),this.get("isEnabled")?e.target!==n?(e.stop(),SC.browser.isIE8OrLower&&setTimeout(function(){n.focus()},0),YES):arguments.callee.base.apply(this,arguments):(e.stop(),YES)},mouseUp:function(e){return this._txtFieldMouseDown=NO,this.notifyPropertyChange("selection"),this.get("isEnabled")?arguments.callee.base.apply(this,arguments):(e.stop(),YES)},doubleClick:function(e){return SC.browser.isIE8OrLower?this.mouseDown(e)|this.mouseUp(e):NO},touchStart:function(e){return this.mouseDown(e)},touchEnd:function(e){return this.mouseUp(e)},mouseWheel:function(e){return this.get("isTextArea")?(e.allowDefault(),YES):NO},selectStart:function(e){return YES},_valueObserver:function(){var e=this.get("value"),t;e&&e.length>0?(this._hintON=NO,t=this.get("maxLength"),!SC.platform.input.maxlength&&e.length>t&&this.set("value",e.substr(0,t))):this.get("hintOnFocus")||(this._hintON=YES)}.observes("value")}),SC.InlineTextFieldView=SC.TextFieldView.extend(SC.InlineEditor,{classNames:["inline-editor"],_topOffsetForFirefoxCursorFix:0,blurOnMouseDown:YES,_updateViewStyle:function(e){var t="",n=SC.getStyle(e,"font-size");return n&&n.length>0&&(t=t+"font-size: "+n+" !important; "),n=SC.getStyle(e,"font-family"),n&&n.length>0&&(t=t+"font-family: "+n+" !important; "),n=SC.getStyle(e,"font-weight"),n&&n.length>0&&(t=t+"font-weight: "+n+" !important; "),n=SC.getStyle(e,"z-index"),n&&n.length>0&&(t=t+"z-index: "+
n+" !important; "),n=SC.getStyle(e,"line-height"),n&&n.length>0&&(t=t+"line-height: "+n+" !important; "),n=SC.getStyle(e,"text-align"),n&&n.length>0&&(t=t+"text-align: "+n+" !important; "),n=SC.getStyle(e,"top-margin"),n&&n.length>0&&(t=t+"top-margin: "+n+" !important; "),n=SC.getStyle(e,"bottom-margin"),n&&n.length>0&&(t=t+"bottom-margin: "+n+" !important; "),n=SC.getStyle(e,"left-margin"),n&&n.length>0&&(t=t+"left-margin: "+n+" !important; "),n=SC.getStyle(e,"right-margin"),n&&n.length>0&&(t=t+"right-margin: "+n+" !important; "),t},_updateViewPaddingStyle:function(e){var t="",n=SC.getStyle(e,"padding-top");return n&&n.length>0&&(t=t+"top: "+n+" !important; "),n=SC.getStyle(e,"padding-bottom"),n&&n.length>0&&(t=t+"bottom: "+n+" !important; "),n=SC.getStyle(e,"padding-left"),n&&n.length>0&&(t=t+"left: "+n+" !important; "),n=SC.getStyle(e,"padding-right"),n&&n.length>0&&(t=t+"right: "+n+" !important; "),t},updateStyle:function(e){e.length&&(e=e[0]);var t=document.getElementById("sc-inline-text-field-style"),n=this._updateViewStyle(e),r=this._updateViewPaddingStyle(e),i=".inline-editor input{"+n+"}"+".inline-editor textarea{"+n+"}"+".inline-editor .padding{"+r+"}";if(!t){var s=document.getElementsByTagName("head")[0];t=document.createElement("style"),t.type="text/css",t.media="screen",t.id="sc-inline-text-field-style",s.appendChild(t)}t.styleSheet?t.styleSheet.cssText=i:t.innerHTML=i},positionOverTargetView:function(e,t,n,r,i){n||(n=e.get("pane")),i||(i=e.$()[0]);if(!r){var s=e.get("frame");r=SC.offset(i),r.height=s.height,r.width=s.width}var o={},u=n.$()[0],a=e.get("layout");
o.height=r.height,o.width=r.width,t&&a.left?(o.left=r.x-a.left-u.offsetLeft-1,SC.browser.msie==7&&o.left--):(o.left=r.x-u.offsetLeft-1,SC.browser.msie==7&&o.left--),t&&a.top?(o.top=r.y-a.top-u.offsetTop,SC.browser.msie==7&&(o.top=o.top-2)):(o.top=r.y-u.offsetTop,SC.browser.msie==7&&(o.top=o.top-2)),this.set("layout",o)},multiline:NO,isTextArea:function(){return this.get("multiline")}.property("multiline").cacheable(),beginEditing:function(e,t){if(!e(t))return NO;var n=t.get("pane"),r=this.get("exampleElement");return this.beginPropertyChanges(),r?r.length&&(r=r[0]):r=t.$()[0],this.updateStyle(r),this.positionOverTargetView(t,this.get("isCollection"),n,this.get("exampleFrame"),r),this._previousFirstResponder=n?n.get("firstResponder"):null,this.becomeFirstResponder(),this.endPropertyChanges(),YES}.enhance(),blurEditor:function(e){return this.get("isEditing")?this.commitOnBlur?this.commitEditing():this.discardEditing():YES},_endEditing:function(e){var t=e();if(this.get("isFirstResponder")){var n=this.get("pane");n&&this._previousFirstResponder?n.makeFirstResponder(this._previousFirstResponder):this.resignFirstResponder()}return this._previousFirstResponder=null,t}.enhance(),mouseDown:function(e){return arguments.callee.base.call(this,e),this.get("isEditing")},touchStart:function(e){this.mouseDown(e)},keyDown:function(e){if(e.isIMEInput===!0&&e.which===13)return!0;var t=this.interpretKeyEvents(e);return this.fieldValueDidChange(!0),t?t:NO},insertText:null,_scitf_blurInput:function(){var e=this.$input()[0];e&&e.blur(),e=null},willRemoveFromParent:function(){return this._scitf_blurInput
()},willLoseFirstResponder:function(e,t){if(e!==this)return;return this._previousFirstResponder=null,this._origEvent=t,this._scitf_blurInput(),this.blurEditor(t)},cancel:function(){return this.discardEditing(),YES},fieldValueDidChange:function(e){arguments.callee.base.call(this,e)},insertNewline:function(e){return this.get("isTextArea")?(e.allowDefault(),arguments.callee.base.call(this,e)):(this.get("value")!=this.$input().val()&&this.set("value",this.$input().val()),this.commitEditing(),YES)},insertTab:function(e){var t=this.target;this.resignFirstResponder(),this.commitEditing();if(t){var n=t.get("nextValidKeyView");n&&n.beginEditing&&n.beginEditing()}return YES},insertBacktab:function(e){var t=this.target;this.resignFirstResponder(),this.commitEditing();if(t){var n=t.get("previousValidKeyView");n&&n.beginEditing&&n.beginEditing()}return YES},deleteForward:function(e){return e.allowDefault(),YES},deleteBackward:function(e){return e.allowDefault(),YES}}),SC.mixin(SC.InlineTextFieldView,{inlineEditorDelegate:SC.InlineTextFieldDelegate,label:null,editor:null,beginEditing:function(e){var t,n,r,i,s;if(SC.typeOf(e)===SC.T_HASH){r=e;if(!r.delegate||!r.exampleElement||!r.frame)return SC.error("Delegate, exampleElement, and frame options are required."),NO;e=r.delegate,i=r.value}else i=e.get("value");return s=SC.beget(e),s.mixin({inlineEditorWillBeginEditing:function(){e.inlineEditorWillBeginEditing&&e.inlineEditorWillBeginEditing.apply(e,arguments)},inlineEditorDidBeginEditing:function(){e.inlineEditorDidBeginEditing&&e.inlineEditorDidBeginEditing.apply(e,arguments)},inlineEditorWillCommitEditing
:function(t,n,r){e.inlineEditorWillCommitEditing&&e.inlineEditorWillCommitEditing(t,n,r),e.inlineEditorWillEndEditing&&e.inlineEditorWillEndEditing(t,n)},inlineEditorDidCommitEditing:function(t,n,r){e.inlineEditorDidCommitEditing&&e.inlineEditorDidCommitEditing(t,n,r),e.inlineEditorDidEndEditing&&e.inlineEditorDidEndEditing(t,n),SC.InlineTextFieldView._endEditing()},inlineEditorWillDiscardEditing:function(t,n){e.inlineEditorWillDiscardEditing&&e.inlineEditorWillDiscardEditing(t,n),e.inlineEditorWillEndEditing&&e.inlineEditorWillEndEditing(t,this.get("value"))},inlineEditorDidDiscardEditing:function(t,n){e.inlineEditorDidDiscardEditing&&e.inlineEditorDidDiscardEditing(t,n),e.inlineEditorDidEndEditing&&e.inlineEditorDidEndEditing(t,this.get("value")),SC.InlineTextFieldView._endEditing()}}),e.inlineEditorShouldBeginEditing&&!e.inlineEditorShouldBeginEditing(e,i)?NO:(this.editor=n=this.inlineEditorDelegate.acquireEditor(e),n.set("value",i),r&&(n.set("exampleElement",r.exampleElement),n.set("exampleFrame",r.frame),n.set("multiline",r.multiline),n.set("escapeHTML",r.escapeHTML),n.set("isCollection",r.isCollection),n.set("commitOnBLur",r.commitOnBlur),n.set("validator",r.validator)),n?n.beginEditing(s):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.REGULAR_WEIGHT="normal",SC.BOLD_WEIGHT="bold"
,SC.LabelView=SC.View.extend(SC.Control,SC.InlineEditable,{classNames:["sc-label-view"],displayProperties:["displayTitle","textAlign","fontWeight","icon","escapeHTML","needsEllipsis","hint"],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 e,t;e=this.get("value"),t=this.getDelegateProperty("formatter",this.displayDelegate);if(t){var n=SC.typeOf(t)===SC.T_FUNCTION?t(e,this):t.fieldValueForObject(e,this);SC.none(n)||(e=n)}if(SC.typeOf(e)===SC.T_ARRAY){var r=[];for(var i=0,s=e.get("length");i<s;i++){var o=e.objectAt(i);!SC.none(o)&&o.toString&&(o=o.toString()),r.push(o)}e=r.join(",")}return!SC.none(e)&&e.toString&&(e=e.toString()),e&&this.getDelegateProperty("localize",this.displayDelegate)&&(e=SC.String.loc(e)),e}.property("value","localize","formatter").cacheable(),hintValue:function(){var e=this.get("hint");return e}.property("hint").cacheable(),doubleClick:function(e){return this.beginEditing()},inlineEditorDidBeginEditing
:function(e,t,n,r){this._oldOpacity=this.get("layout").opacity||1,this.adjust("opacity",0),e(t,n,r)}.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(){console.warn("SC.Border is deprecated, please set border in your layout"),this._sc_border_borderStyleDidChange(),this._sc_border_borderDimensionsDidChange()},renderMixin:function(e,t){var n=this.get("borderStyle");n&&(this._BORDER_REGEXP.exec(n)?e.addClass(n):e.addStyle("border","1px "+n+" solid"))},_sc_border_borderStyleDidChange:function(){var e=this.get("borderStyle"),t=SC.Border.dimensions[e];t&&(this.beginPropertyChanges(),this.set("borderTop",t),this.set("borderRight",t),this.set("borderBottom",t),this.set("borderLeft",t),this.endPropertyChanges())},_sc_border_borderDimensionsDidChange:function(){var e=this.get("borderTop"),t=this.get("borderRight"),n=this.get("borderBottom"),r=this.get("borderLeft");this.adjust({borderTop:e,borderRight:t,borderBottom:n,borderLeft:r})}.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.Scrollable={isScrollable:!0,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(e){var t=this.get("scrollFrame"),n=this.get("innerFrame");this.get("hasVerticalScroller")||(e.y=0),t.height<=n.height&&(e.y=0),this.get("hasHorizontalScroller")||(e.x=0),t.width<=n.width&&(e.x=0);var r={x:t.x-(e.x||0),y:t.y-(e.y||0)};return this.set("scrollFrame",r),r=this.get("scrollFrame"),{x:r.x-t.x,y:r.y-t.y}},scrollTo:function(e,t){this.set("scrollFrame",{x:0-e,y:0-t})},scrollToVisible:function(e){var t=this.get("innerFrame"),n=this.get("scrollFrame"),r=this.convertFrameFromView(e.get("frame"),e);r.x-=t.x+n.x,r.y-=t.y+n.y;var i={x:0-n.x,y:0-n.y,width:t.width,height:t.height};i.y-=Math.max(0,SC.minY(i)-SC.minY(r)),i.x-=Math.max(0,SC.minX(i)-SC.minX(r)),i.y+=Math.max(0,SC.maxY(r)-SC.maxY(i)),i.x+=Math.max(0,SC.maxX(r)-SC.maxX(i)),this.scrollTo(i.x,i.y)},scrollDownLine:function(e){return e===undefined&&(e=1),this.scrollBy({y:this.get("verticalLineScroll")*e}).y},scrollUpLine:function(e){return e===undefined&&(e=1),0-this.scrollBy({y:0-this.get("verticalLineScroll")*e}).y},scrollRightLine:function(
e){return e===undefined&&(e=1),this.scrollTo({y:this.get("horizontalLineScroll")*e}).x},scrollLeftLine:function(e){return e===undefined&&(e=1),0-this.scrollTo({y:0-this.get("horizontalLineScroll")*e}).x},scrollDownPage:function(e){return e===undefined&&(e=1),this.scrollBy({y:this.get("verticalPageScroll")*e}).y},scrollUpPage:function(e){return e===undefined&&(e=1),0-this.scrollBy({y:0-this.get("verticalPageScroll")*e}).y},scrollRightPage:function(e){return e===undefined&&(e=1),this.scrollTo({y:this.get("horizontalPageScroll")*e}).x},scrollLeftPage:function(e){return e===undefined&&(e=1),0-this.scrollTo({y:0-this.get("horizontalPageScroll")*e}).x}},SC.ModalPane=SC.Pane.extend({classNames:"sc-modal",_openPaneCount:0,paneWillAppend:function(e){var t,n=SC.RootResponder.responder.panes;this._openPaneCount++,this.get("isVisibleInWindow")||this.append();for(var r=0,i=n.length;r<i;r++)t=n[r],t!==e&&t.set("ariaHidden",YES);return this},paneDidRemove:function(e){var t,n=SC.RootResponder.responder.panes;this._openPaneCount--,this._openPaneCount<=0&&(this._openPaneCount=0,this.get("isVisibleInWindow")&&this.remove());for(var r=0,i=n.length;r<i;r++)t=n[r],t!==e&&t.set("ariaHidden",NO)},mouseDown:function(e){var t=this.get("owner");t&&t.modalPaneDidClick&&t.modalPaneDidClick(e)},touchStart:function(e){this.mouseDown(e)}}),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(e){this.removeAllChildren(),e&&this.appendChild(e)},createChildViews:function(){var e=this.contentView;e&&(e=this.contentView=this.createChildView(e),this.childViews=[e])},contentViewDidChange:function(){this.replaceContent(this.get("contentView"))}.observes("contentView"),renderDelegateName:"panelRenderDelegate",_modalPane:function(){var e=this.get("modalPane");return e&&e.isClass&&(e=e.create({owner:this}),this.set("modalPane",e)),e},appendTo:function(e){var t;return!this.get("isVisibleInWindow")&&this.get("isModal")&&(t=this._modalPane())&&(this._isShowingModal=YES,t.paneWillAppend(this)),arguments.callee.base.apply(this,arguments)},remove:function(){var e,t=arguments.callee.base.apply(this,arguments);return this._isShowingModal&&(this._isShowingModal=NO,(e=this._modalPane())&&e.paneDidRemove(this)),t},destroy:function(){var e=this.get("modalPane");e&&!e.isClass&&e.destroy(),arguments.callee.base.apply(this,arguments)},_isModalDidChange:function(){var e,t=this.get("isModal");t?!this._isShowingModal&&this.get("isVisibleInWindow")&&(e=this._modalPane())&&(this._isShowingModal=YES,e.paneWillAppend(this)):this._isShowingModal&&(e=this._modalPane())&&(this._isShowingModal=NO,e.paneDidRemove(this))}.observes("isModal"),paneDidAttach:function(){var e=arguments.callee.base.apply(this,arguments);return this.becomeKeyPane(),e},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(){return SC.FOCUS_ALL_CONTROLS?this.get("isEnabled"):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 e=this.get("title");return e&&this.get("localize")?SC.String.loc(e):e||""}.property("title","localize").cacheable(),keyEquivalent:null,isBorderless:NO,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 e=this.invokeRenderDelegateMethod("getRenderedAutoResizeLayer",this.$());return e||this.get("layer")}.property("layer").cacheable(),autoResizeText:function(){return this.get("displayTitle")}.property("displayTitle").cacheable(),autoResizePadding:SC.propertyFromRenderDelegate("autoResizePadding",10),_labelMinWidthIE7:0,triggerActionAfterDelay:function(e){return this.get("isEnabled")?(this.set("isActive",YES),this.invokeLater("triggerAction",200,e),YES):NO},triggerAction:function(e){this._action(e,YES),this.didTriggerAction(),this.set("isActive",NO)},didTriggerAction:function(){},init:function(){arguments.callee.base.apply(this,arguments);var e=this.get("keyEquivalent");e&&(this._defaultKeyEquivalent=e),SC.none(this.get("value"))||this._button_valueDidChange()},ariaRole
:"button",displayProperties:["icon","displayTitle","value","displayToolTip","isDefault","isCancel","escapeHTML","needsEllipsis","tooltip","supportFocusRing","buttonBehavior","isBorderless"],renderDelegateName:"buttonRenderDelegate",contentKeys:{contentValueKey:"value",contentTitleKey:"title",contentIconKey:"icon"},_button_displayObserver:function(){this.displayDidChange()}.observes("title","icon","value"),performKeyEquivalent:function(e,t){if(!this.get("isVisibleInWindow"))return NO;if(!this.get("isEnabled"))return NO;var n=this.get("keyEquivalent");if(n){if(n===e)return this.triggerAction(t)}else if(this.get("isDefault")&&e==="return"||this.get("isCancel")&&e==="escape")return this.triggerAction(t);return NO},computeIsSelectedForValue:function(e){var t=this.get("toggleOnValue"),n,r;return SC.typeOf(e)===SC.T_ARRAY?e.length===1?n=e[0]==t:(n=null,e.find(function(e){return r=e==t,n===null?n=r:r!==n&&(n=SC.MIXED_STATE),n===SC.MIXED_STATE})):e===SC.MIXED_STATE?n=SC.MIXED_STATE:n=e===t,n},_button_valueDidChange:function(){var e=this.get("value"),t=this.computeIsSelectedForValue(e);this.set("isSelected",t)}.observes("value"),_button_isSelectedDidChange:function(){var e=this.get("isSelected"),t=this.computeIsSelectedForValue(this.get("value"));if(e!==SC.MIXED_STATE&&t!==e){var n=e?"toggleOnValue":"toggleOffValue";this.set("value",this.get(n))}}.observes("isSelected"),_defaultKeyEquivalent:null,_isDefaultOrCancelDidChange:function(){var e=!!this.get("isDefault"),t=!e&&this.get("isCancel");e?this.set("keyEquivalent","return"):t?this.set("keyEquivalent","escape"):this.set("keyEquivalent"
,this._defaultKeyEquivalent)}.observes("isDefault","isCancel"),mouseDown:function(e){var t=this.get("buttonBehavior");return this.get("isEnabled")?(this.set("isActive",YES),this._isMouseDown=YES,t===SC.HOLD_BEHAVIOR?this._action(e):!this._isFocused&&t!==SC.PUSH_BEHAVIOR&&(this._isFocused=YES,this.becomeFirstResponder()),YES):YES},mouseExited:function(e){return this._isMouseDown&&this.set("isActive",NO),YES},mouseEntered:function(e){return this._isMouseDown&&this.set("isActive",YES),YES},mouseUp:function(e){this._isMouseDown&&this.set("isActive",NO),this._isMouseDown=!1;if(this.get("buttonBehavior")!==SC.HOLD_BEHAVIOR){var t=this.$().within(e.target);t&&this.get("isEnabled")&&this._action(e)}return YES},touchStart:function(e){var t=this.get("buttonBehavior");return this.get("isEnabled")?(this.set("isActive",YES),t===SC.HOLD_BEHAVIOR?this._action(e):!this._isFocused&&t!==SC.PUSH_BEHAVIOR&&(this._isFocused=YES,this.becomeFirstResponder()),e.preventDefault(),YES):YES},touchesDragged:function(e,t){return this.touchIsInBoundary(e)?(this._touch_exited&&this.set("isActive",YES),this._touch_exited=NO):(this._touch_exited||this.set("isActive",NO),this._touch_exited=YES),e.preventDefault(),YES},touchEnd:function(e){return this._touch_exited=NO,this.set("isActive",NO),this.get("buttonBehavior")!==SC.HOLD_BEHAVIOR&&this.touchIsInBoundary(e)&&this.get("isEnabled")&&this._action(e),e.preventDefault(),YES},keyDown:function(e){if(!this.get("isEnabled"))return YES;if(e.which===9||e.keyCode===9){var t=e.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");return t?t.becomeFirstResponder
():e.allowDefault(),YES}return e.which===32?(this.triggerActionAfterDelay(e),YES):(e.allowDefault(),NO)},_action:function(e,t){switch(this.get("buttonBehavior")){case SC.TOGGLE_BEHAVIOR:var n=this.get("isSelected");n?this.set("value",this.get("toggleOffValue")):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(e,t);break;default:this._runAction(e)}},_runAction:function(e){var t=this.get("action"),n=this.get("target")||null,r;if(t){if(t&&SC.typeOf(t)===SC.T_FUNCTION){this.action(e);return}r=this.getPath("pane.rootResponder"),r&&r.sendAction(t,n,this,this.get("pane"),null,this)}},_runHoldAction:function(e,t){this.get("isActive")&&(this._runAction(),t||(SC.RunLoop.begin(),this.invokeLater("_runHoldAction",this.get("holdInterval"),e),SC.RunLoop.end()))},didBecomeKeyResponderFrom:function(e){this._isFocused||(this._isFocused=YES,this.becomeFirstResponder(),this.get("isVisibleInWindow")&&this.$().focus())},willLoseKeyResponderTo:function(e){this._isFocused&&(this._isFocused=NO)},didAppendToDocument:function(){if(parseInt(SC.browser.msie,0)===7&&this.get("useStaticLayout")){var e=this.get("layout"),t=this.$(),n=0;if(t&&t[0]&&(n=t[0].clientWidth)&&n!==0&&this._labelMinWidthIE7===0){var r=this.$(".sc-button-label"),i=parseInt(r.css("paddingRight"),0),s=parseInt(r.css("paddingLeft"),0),o=parseInt(r.css("marginRight"),0),u=parseInt(r.css("marginLeft"),0);o=="auto"&&SC.Logger.log(o+","+u+","+
i+","+s),!i&&isNaN(i)&&(i=0),!s&&isNaN(s)&&(s=0),!o&&isNaN(o)&&(o=0),!u&&isNaN(u)&&(u=0),this._labelMinWidthIE7=n-(i+s)-(o+u),r.css("minWidth",this._labelMinWidthIE7+"px")}else this.invokeLater(this.didAppendToDocument,1)}}}),SC.ButtonView.CLICK_AND_HOLD_DELAY=SC.browser.msie?600:300,SC.REGULAR_BUTTON_HEIGHT=24,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 e=this.get("description");return!e||e.length===0?e:(e=SC.RenderContext.escapeHTML(e),'<p class="description">'+e.split("\n").join('</p><p class="description">')+"</p>")}.property("description").cacheable(),caption:"",displayCaption:function(){var e=this.get("caption");return!e||e.length===0?e:(e=SC.RenderContext.escapeHTML(e),'<p class="caption">'+e.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:.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(e,t){var n=this.get("pane");n.get("icon")=="blank"&&e.addClass("plain"
),e.push('<img src="'+SC.BLANK_IMAGE_URL+'" class="icon '+n.get("icon")+'" />'),e.begin("h1").attr("class","header").text(n.get("message")||"").end(),e.push(n.get("displayDescription")||""),e.push(n.get("displayCaption")||""),e.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(e){var t=this.delegate,n,r,i;t&&t.alertPaneDidDismiss&&t.alertPaneDidDismiss(this,e.get("actionKey"));if(r=e&&e.get("customAction"))SC.typeOf(r)===SC.T_FUNCTION?r.call(r):(n=this.getPath("pane.rootResponder"),n&&(i=e.get("target"),n.sendAction(r,i||t,this,this,null,this)));this.remove()},alertInfoDidChange:function(){var e=this.getPath("contentView.childViews.0");e&&e.displayDidChange()}.observes("icon","message","displayDescription","displayCaption")}),SC.AlertPane.mixin({show:function(e){e=SC.AlertPane._argumentsCall.apply(this,arguments)
;var t=this.create(e),n=0,r=e.buttons,i,s,o,u,a;r?r.forEach(function(r){n++;if(!r)return;i=t.get("button%@".fmt(n)),s=r.title,o=r.action,u=r.target,a=e.themeName||"capsule",i.set("title".fmt(n),s),o&&i.set("customAction".fmt(n),o),u&&i.set("target".fmt(n),u),i.set("isVisible",!!s),i.set("themeName",a)}):(i=t.get("button1"),i.set("title","OK"),i.set("isVisible",YES));var f=t.append();return t.adjust("height",t.childViews[0].$().height()),t.updateLayout(),f},warn:function(e){return e=SC.AlertPane._argumentsCall.apply(this,arguments),e.icon="sc-icon-alert-48",this.show(e)},info:function(e){return e=SC.AlertPane._argumentsCall.apply(this,arguments),e.icon="sc-icon-info-48",this.show(e)},error:function(e){return e=SC.AlertPane._argumentsCall.apply(this,arguments),e.icon="sc-icon-error-48",this.show(e)},plain:function(e){return e=SC.AlertPane._argumentsCall.apply(this,arguments),e.icon="blank",this.show(e)},_argumentsCall:function(e){var t=e;if(SC.typeOf(e)!==SC.T_HASH){var n=this._normalizeArguments(arguments);t={message:n[0],description:n[1],caption:n[2],delegate:n[7],icon:n[6]||"sc-icon-alert-48",themeName:"capsule"};if(SC.typeOf(n[3])===SC.T_STRING||SC.typeOf(n[4])===SC.T_STRING||SC.typeOf(n[5])===SC.T_STRING)t.buttons=[{title:n[3]},{title:n[4]},{title:n[5]}]}return t},_normalizeArguments:function(e){e=SC.A(e);var t=e.length,n=e[t-1];return SC.typeOf(n)!==SC.T_STRING?e[t-1]=null:n=null,e[7]=n,e}}),SC.PalettePane=SC.PanelPane.extend({classNames:["sc-palette"],isModal:NO,modalPane:SC.ModalPane,isAnchored:NO,_mouseOffsetX:null,_mouseOffsetY:null,mouseDown:function(e){var t=this.get
("frame");return this._mouseOffsetX=t?t.x-e.pageX:0,this._mouseOffsetY=t?t.y-e.pageY:0,YES},mouseDragged:function(e){return this.isAnchored||(this.set("layout",{width:this.layout.width,height:this.layout.height,left:this._mouseOffsetX+e.pageX,top:this._mouseOffsetY+e.pageY}),this.updateLayout()),YES},touchStart:function(e){return this.mouseDown(e)},touchesDragged:function(e){return this.mouseDragged(e)}}),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(e,t,n,r){return e&&(e.isView?(this._anchorView=e,this._anchorHTMLElement=null,this._setupScrollObservers(e)):(this._anchorHTMLElement=e,this._anchorView=null)),this.beginPropertyChanges(),t&&this.set("preferType",t),n&&this.set("preferMatrix",n),r&&this.set("pointerOffset",r),this.endPropertyChanges(),this.positionPane(),this._hideOverflow(),this.append()},positionPane:function(e){e=e&&this.get("anchorCached");var t=e?this.get("anchorCached"):this.get("anchorElement"),n=this.get("preferType"),r=this.get("preferMatrix"),i=this.get("layout"),s;if(t){e||(t=this.computeAnchorRect(t),this.set("anchorCached",t));if(t.x===0&&t.y===0
)return;s=SC.cloneRect(t);if(n)switch(n){case SC.PICKER_MENU:case SC.PICKER_FIXED:(!r||r.length!==3)&&this.set("preferMatrix",[1,4,3]),s.x+=(this.preferMatrix[2]===0?s.width:0)+this.preferMatrix[0],s.y+=(this.preferMatrix[2]===3?s.height:0)+this.preferMatrix[1];break;default:s.y+=s.height}else s.y+=s.height;s=this.fitPositionToScreen(s,this.get("frame"),t),this.adjust({width:s.width,height:s.height,left:s.x,top:s.y})}else this.adjust({width:i.width,height:i.height,centerX:0,centerY:0});return this.updateLayout(),this},computeAnchorRect:function(e){var t,n,r,i=SC.RootResponder.responder.computeWindowSize();if(e.getBoundingClientRect){if(SC.browser.isIE)try{t=e.getBoundingClientRect()}catch(s){t={left:0,top:0,width:0,height:0}}else t=e.getBoundingClientRect();n={x:t.left,y:t.top,width:t.width,height:t.height};if(n.width===undefined||n.height===undefined)r=SC.$(e),n.width=r.outerWidth(),n.height=r.outerHeight()}else n=SC.offset(e),r=SC.$(e),n.width=r.outerWidth(),n.height=r.outerHeight();return n.height=i.height-n.y<n.height?i.height-n.y:n.height,!SC.browser.msie&&window.scrollX>0||window.scrollY>0?(n.x+=window.scrollX,n.y+=window.scrollY):SC.browser.msie&&(document.documentElement.scrollTop>0||document.documentElement.scrollLeft>0)&&(n.x+=document.documentElement.scrollLeft,n.y+=document.documentElement.scrollTop),n},fitPositionToScreen:function(e,t,n){var r=SC.RootResponder.responder.computeWindowSize(),i={x:0,y:0,width:r.width,height:r.height},s=SC.RootResponder.responder.mainPane;if(s){var o=s.layout.minWidth,u=s.layout.minHeight;o&&i.width<o&&(i.width=s.layout.minWidth),u&&
i.height<u&&(i.height=s.layout.minHeight)}t.x=e.x,t.y=e.y;if(this.preferType)switch(this.preferType){case SC.PICKER_MENU:t=this.fitPositionToScreenMenu(i,t,this.get("isSubMenu"));break;case SC.PICKER_MENU_POINTER:this.setupPointer(n),t=this.fitPositionToScreenMenuPointer(i,t,n);break;case SC.PICKER_POINTER:this.setupPointer(n),t=this.fitPositionToScreenPointer(i,t,n);break;case SC.PICKER_FIXED:break;default:}else t=this.fitPositionToScreenDefault(i,t,n);return this.displayDidChange(),t},fitPositionToScreenDefault:function(e,t,n){if(SC.maxX(t)>e.width){var r=Math.max(SC.maxX(n),t.width);t.x=Math.min(r,e.width)-t.width}return SC.minX(t)<0&&(t.x=SC.minX(Math.max(n,0)),SC.maxX(t)>e.width&&(t.x=Math.max(0,e.width-t.width))),SC.maxY(t)>e.height&&(r=Math.max(n.y-t.height,0),r>e.height?t.y=Math.max(0,e.height-t.height):t.y=r),SC.minY(t)<0&&(r=Math.min(SC.maxY(n),e.height-n.height),t.y=Math.max(r,0)),t},fitPositionToScreenMenu:function(e,t,n){return n&&(t.x-=this.get("submenuOffsetX"),t.y-=Math.floor(this.get("menuHeightPadding")/2)),t.x+t.width>e.width-20&&(n?t.x=t.x-t.width*2:t.x=e.width-t.width-20),t.x<7&&(t.x=7),t.y<7&&(t.height+=t.y,t.y=7),t.height+t.y+35>=e.height&&(t.height+50>=e.height?(t.y=SC.MenuPane.VERTICAL_OFFSET,t.height=e.height-SC.MenuPane.VERTICAL_OFFSET*2):t.y+=e.height-(t.height+t.y+35)),t},fitPositionToScreenMenuPointer:function(e,t,n){return t=this.fitPositionToScreenPointer(e,t,n),t.y>=0&&t.height+t.y+35>=e.height&&(t.height=e.height-t.y-SC.MenuPane.VERTICAL_OFFSET*2),t.y<0&&t.height>=e.height&&(t.y=SC.MenuPane.VERTICAL_OFFSET,t.height=e.height-SC.MenuPane.VERTICAL_OFFSET*2
,this.set("pointerPosY",n.y-t.y-26)),t},fitPositionToScreenPointer:function(e,t,n){var r=[this.pointerOffset[0],this.pointerOffset[1],this.pointerOffset[2],this.pointerOffset[3]],i=[[n.x+n.width+r[0],n.y+parseInt(n.height/2,0)-40],[n.x-t.width+r[1],n.y+parseInt(n.height/2,0)-40],[n.x+parseInt(n.width/2-t.width/2,0),n.y-t.height+r[2]],[n.x+parseInt(n.width/2-t.width/2,0),n.y+n.height+r[3]]],s=[[n.x+n.width+t.width+r[0],n.y+parseInt(n.height/2,0)+t.height-24],[n.x+r[1],n.y+parseInt(n.height/2,0)+t.height-24],[n.x+parseInt(n.width/2-t.width/2,0)+t.width,n.y+r[2]],[n.x+parseInt(n.width/2-t.width/2,0)+t.width,n.y+n.height+t.height+r[3]]],o=[[i[0][1]>0?0:0-i[0][1],s[0][0]<e.width?0:s[0][0]-e.width,s[0][1]<e.height?0:s[0][1]-e.height,i[0][0]>0?0:0-i[0][0]],[i[1][1]>0?0:0-i[1][1],s[1][0]<e.width?0:s[1][0]-e.width,s[1][1]<e.height?0:s[1][1]-e.height,i[1][0]>0?0:0-i[1][0]],[i[2][1]>0?0:0-i[2][1],s[2][0]<e.width?0:s[2][0]-e.width,s[2][1]<e.height?0:s[2][1]-e.height,i[2][0]>0?0:0-i[2][0]],[i[3][1]>0?0:0-i[3][1],s[3][0]<e.width?0:s[3][0]-e.width,s[3][1]<e.height?0:s[3][1]-e.height,i[3][0]>0?0:0-i[3][0]]],u=this.preferMatrix;u[4]===-1?(t.x=n.x+parseInt(n.width/2,0),t.y=n.y+parseInt(n.height/2,0)-parseInt(t.height/2,0),this.set("pointerPos",SC.POINTER_LAYOUT[0]+" fallback"),this.set("pointerPosY",parseInt(t.height/2,0)-40)):(t.x=i[u[4]][0],t.y=i[u[4]][1],this.set("pointerPos",SC.POINTER_LAYOUT[u[4]]),this.set("pointerPosY",0)),this.set("pointerPosX",0);for(var a=0,f,l=SC.POINTER_LAYOUT.length;a<l;a++)f=u[a],o[f][0]===0&&o[f][1]===0&&o[f][2]===0&&o[f][3]===0?(u[4]!==f&&(t.x=i[f][0],t.y=i[f]
[1],this.set("pointerPosY",0),this.set("pointerPos",SC.POINTER_LAYOUT[f])),a=SC.POINTER_LAYOUT.length):(f===0||f===1)&&o[f][0]===0&&o[f][1]===0&&o[f][2]<t.height-91&&o[f][3]===0?(u[4]!==f&&(t.x=i[f][0],this.set("pointerPos",SC.POINTER_LAYOUT[f])),t.y=i[f][1]-o[f][2],this.set("pointerPosY",o[f][2]),a=SC.POINTER_LAYOUT.length):(f===0||f===1)&&o[f][0]===0&&o[f][1]===0&&o[f][2]<=t.height-51&&o[f][3]===0?(u[4]!==f&&(t.x=i[f][0]),t.y=i[f][1]-(t.height-51),this.set("pointerPosY",t.height-53),this.set("pointerPos",SC.POINTER_LAYOUT[f]+" extra-low"),a=SC.POINTER_LAYOUT.length):(f===2||f===3)&&o[f][0]===0&&o[f][1]<=parseInt(t.width/2,0)-this.get("extraRightOffset")&&o[f][2]===0&&o[f][3]===0?(u[4]!==f&&(t.y=i[f][1]),t.x=i[f][0]-(parseInt(t.width/2,0)-this.get("extraRightOffset")),this.set("pointerPos",SC.POINTER_LAYOUT[f]+" extra-right"),a=SC.POINTER_LAYOUT.length):(f===2||f===3)&&o[f][0]===0&&o[f][1]===0&&o[f][2]===0&&o[f][3]<=parseInt(t.width/2,0)-this.get("extraRightOffset")&&(u[4]!==f&&(t.y=i[f][1]),t.x=i[f][0]+(parseInt(t.width/2,0)-this.get("extraRightOffset")),this.set("pointerPos",SC.POINTER_LAYOUT[f]+" extra-left"),a=SC.POINTER_LAYOUT.length);return t},setupPointer:function(e){var t=this.pointerOffset,n=SC.PickerPane;if(!t||t.length!==4)if(this.get("preferType")==SC.PICKER_MENU_POINTER)switch(this.get("controlSize")){case SC.TINY_CONTROL_SIZE:this.set("pointerOffset",n.TINY_PICKER_MENU_POINTER_OFFSET),this.set("extraRightOffset",n.TINY_PICKER_MENU_EXTRA_RIGHT_OFFSET);break;case SC.SMALL_CONTROL_SIZE:this.set("pointerOffset",n.SMALL_PICKER_MENU_POINTER_OFFSET),this.set("extraRightOffset"
,n.SMALL_PICKER_MENU_EXTRA_RIGHT_OFFSET);break;case SC.REGULAR_CONTROL_SIZE:this.set("pointerOffset",n.REGULAR_PICKER_MENU_POINTER_OFFSET),this.set("extraRightOffset",n.REGULAR_PICKER_MENU_EXTRA_RIGHT_OFFSET);break;case SC.LARGE_CONTROL_SIZE:this.set("pointerOffset",n.LARGE_PICKER_MENU_POINTER_OFFSET),this.set("extraRightOffset",n.LARGE_PICKER_MENU_EXTRA_RIGHT_OFFSET);break;case SC.HUGE_CONTROL_SIZE:this.set("pointerOffset",n.HUGE_PICKER_MENU_POINTER_OFFSET),this.set("extraRightOffset",n.HUGE_PICKER_MENU_EXTRA_RIGHT_OFFSET)}else{var r=e.width<16?e.width<4?9:6:0,i=e.height<16?e.height<4?9:6:0,s=n.PICKER_POINTER_OFFSET,o=[s[0]+r,s[1]-r,s[2]-i,s[3]+i];this.set("pointerOffset",o),this.set("extraRightOffset",n.PICKER_EXTRA_RIGHT_OFFSET)}(!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(e){var t=this.get("frame"),n=this.get("removeTarget")||null,r=this.get("removeAction"),i=this.get("rootResponder");return this.clickInside(t,e)?NO:(r?i.sendAction(r,n,this,this,null,this):this.remove(),YES)},mouseDown:function(e){return this.modalPaneDidClick(e)},clickInside:function(e,t){return SC.pointInRect({x:t.pageX,y:t.pageY},e)},windowSizeDidChange:function(e,t){this.repositionOnWindowResize&&this.positionPane()},remove:function(){return this.get("isVisibleInWindow")&&this.get("isPaneAttached")&&this._withdrawOverflowRequest(),this._removeScrollObservers(),arguments.
callee.base.apply(this,arguments)},anchorElement:function(e,t){var n;if(t===undefined)return n=this._anchorView,n?n.get("layer"):this._anchorHTMLElement;if(!t)throw"You must set 'anchorElement' to either a view or a DOM element";t.isView?(this._anchorView=t,this._anchorHTMLElement=null):(this._anchorView=null,this._anchorHTMLElement=t)}.property("layer").cacheable(),_hideOverflow:function(){var e=SC.$(document.body),t=SC.$(".sc-main"),n=parseInt(t.css("minWidth"),0),r=parseInt(t.css("minHeight"),0),i=SC.RootResponder.responder.get("currentWindowSize");i.width>=n&&i.height>=r&&SC.bodyOverflowArbitrator.requestHidden(this)},_withdrawOverflowRequest:function(){SC.bodyOverflowArbitrator.withdrawRequest(this)},_getScrollViewOfView:function(e){var t=e;while(YES){if(!t)return null;if(t.isScrollable)return t;t=t.get("parentView")}},_setupScrollObservers:function(e){var t=this._getScrollViewOfView(e);t&&(t.addObserver("horizontalScrollOffset",this,this._scrollOffsetDidChange),t.addObserver("verticalScrollOffset",this,this._scrollOffsetDidChange),this._scrollView=t)},_removeScrollObservers:function(){var e=this._scrollView;e&&(e.removeObserver("horizontalScrollOffset",this,this._scrollOffsetDidChange),e.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,-14,14],SC.PickerPane.TINY_PICKER_MENU_EXTRA_RIGHT_OFFSET=12,SC.PickerPane.SMALL_PICKER_MENU_POINTER_OFFSET=[9,-9
,-4,4],SC.PickerPane.SMALL_PICKER_MENU_EXTRA_RIGHT_OFFSET=11,SC.PickerPane.REGULAR_PICKER_MENU_POINTER_OFFSET=[9,-9,-8,8],SC.PickerPane.REGULAR_PICKER_MENU_EXTRA_RIGHT_OFFSET=12,SC.PickerPane.LARGE_PICKER_MENU_POINTER_OFFSET=[9,-9,-12,12],SC.PickerPane.LARGE_PICKER_MENU_EXTRA_RIGHT_OFFSET=17,SC.PickerPane.HUGE_PICKER_MENU_POINTER_OFFSET=[9,-9,-14,14],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(e,t){t&&e.push("<span></span>"),e.addClass(this.get("layoutDirection"))}}),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 e=this.get("content"),t,n;return e?(n=this.get("parentMenu"),t=e.get(n.itemSubMenuKey),t?SC.kindOf(t,SC.MenuPane)?(t.set("isModal",NO),t.set("isSubMenu",YES),t.set("parentMenu",n),t):SC.MenuPane.create({layout:{width:200},items:t,isModal:NO,isSubMenu:YES,parentMenu:n,controlSize:n.get("controlSize"),exampleView:n.get("exampleView"
)}):null):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(e,t){var n=this.get("content"),r,i,s=this.get("parentMenu"),o=this.get("itemWidth")||s.layout.width,u=this.get("itemHeight")||SC.DEFAULT_MENU_ITEM_HEIGHT;this.set("itemWidth",o),this.set("itemHeight",u),this.get("isSeparator")?e.attr("role","separator"):this.get("isChecked")&&(e.attr("role","menuitemcheckbox"),e.attr("aria-checked",!0)),e=e.begin("a").addClass("menu-item"),this.get("isSeparator")?(e.push('<span class="separator"></span>'),e.addClass("disabled")):(i=n.get(s.itemIconKey),i&&(this.renderImage(e,i),e.addClass("has-icon")),i=this.get("title"),SC.typeOf(i)!==SC.T_STRING&&(i=i.toString()),this.renderLabel(e,i),this.get("isChecked")&&e.push('<div class="checkbox"></div>'),this.get("hasSubMenu")&&this.renderBranch(e),i=this.getContentProperty("itemShortCutKey"),i&&this.renderShortcut(e,i)),e=e.end()},renderImage:function(e,t){var n,r;t&&SC.ImageView.valueIsUrl(t)?(n=t,r=""):(r=t,n=SC.BLANK_IMAGE_URL),e.begin("img").addClass("image").addClass(r).attr("src",n).end()},renderLabel:function(e,t){this.get("escapeHTML")&&(t=SC.RenderContext.escapeHTML(t)),e.push("<span class='value ellipsis'>"+t+"</span>")},renderBranch:function(e){e.push('<span class="has-branch"></span>')},renderShortcut:function(e,t){e.push('<span class = "shortcut">'+t+"</span>")},showSubMenu:function(){var e=this.get("subMenu");e&&(e.set("mouseHasEntered",NO),e.popup(this,[0
,0,0])),this._subMenuTimer=null},title:function(){var e=this.getContentProperty("itemTitleKey"),t=this.getPath("parentMenu.localize");return t&&e&&(e=SC.String.loc(e)),e||""}.property("content.title").cacheable(),getContentProperty:function(e){var t=this.get("content"),n=this.get("parentMenu");if(t)return t.get(n.get(e))},mouseUp:function(e){var t;return t=this.getPath("parentMenu.rootMenu.targetMenuItem"),t&&t.performAction(),YES},performAction:function(){if(!this.get("isEnabled"))return this.getPath("parentMenu.rootMenu").remove(),YES;if(this.get("hasSubMenu"))return NO;var e=this.getContentProperty("itemDisableMenuFlashKey"),t;return e?this.sendAction():(this._flashCounter=0,t=this.getPath("parentMenu.rootMenu"),t._isFlashing=YES,this.invokeLater(this.flashHighlight,25),this.invokeLater(this.sendAction,150)),YES},sendAction:function(){var e=this.getContentProperty("itemActionKey"),t=this.getContentProperty("itemTargetKey"),n=this.getPath("parentMenu.rootMenu"),r;this.getPath("parentMenu.rootMenu").remove(),n._isFlashing=NO,e=e===undefined?n.get("action"):e,t=t===undefined?n.get("target"):t,n.set("selectedItem",this.get("content")),SC.typeOf(e)===SC.T_FUNCTION?e.apply(t,[n]):(r=this.getPath("pane.rootResponder")||SC.RootResponder.responder,r&&r.sendAction(e,t,n))},flashHighlight:function(){var e=this._flashCounter,t=this.$();e%2===0?t.addClass("focus"):t.removeClass("focus"),e<=2&&(this.invokeLater(this.flashHighlight,50),this._flashCounter++)},mouseDown:function(e){if(!this.get("mouseHasEntered")){var t=this.get("parentMenu");t.set("mouseHasEntered",YES),this.set("mouseHasEntered"
,YES),t.set("currentMenuItem",this),this.get("isEnabled")&&this.becomeFirstResponder(),this.get("hasSubMenu")&&(this._subMenuTimer=this.invokeLater(this.showSubMenu,100))}return YES},mouseEntered:function(e){var t=this.get("parentMenu"),n=t.get("rootMenu");if(n._isFlashing)return;return t.set("mouseHasEntered",YES),this.set("mouseHasEntered",YES),t.set("currentMenuItem",this),this.get("isEnabled")&&this.becomeFirstResponder(),this.get("hasSubMenu")&&(this._subMenuTimer=this.invokeLater(this.showSubMenu,100)),YES},mouseExited:function(e){var t,n;return this.get("hasSubMenu")?(n=this._subMenuTimer,n?n.invalidate():this.invokeLater(this.checkMouseLocation,100)):(t=this.get("parentMenu"),t.get("currentMenuItem")===this&&t.set("currentMenuItem",null)),YES},touchStart:function(e){return this.mouseEntered(e),YES},touchEnd:function(e){return this.mouseUp(e)},touchEntered:function(e){return this.mouseEntered(e)},touchExited:function(e){return this.mouseExited(e)},checkMouseLocation:function(){var e=this.get("subMenu"),t=this.get("parentMenu"),n,r;if(!e.get("mouseHasEntered")){n=t.get("currentMenuItem");if(n===this||n===null)r=t.get("previousMenuItem"),r&&r.resignFirstResponder(),this.resignFirstResponder(),e.remove()}},moveUp:function(e,t){var n=this.get("parentMenu");return n&&n.moveUp(this),YES},moveDown:function(e,t){var n=this.get("parentMenu");return n&&n.moveDown(this),YES},moveRight:function(e,t){return this.showSubMenu(),YES},insertText:function(e,t){var n=this.get("parentMenu");n&&n.insertText(e,t)},keyDown:function(e){return this.interpretKeyEvents(e)},keyUp:function(e){return YES
},cancel:function(e){return this.getPath("parentMenu.rootMenu").remove(),YES},didBecomeFirstResponder:function(e){if(e!==this)return;var t=this.get("parentMenu");t&&t.set("currentSelectedMenuItem",this)},willLoseFirstResponder:function(e){if(e!==this)return;var t=this.get("parentMenu");t&&(t.set("currentSelectedMenuItem",null),t.set("previousSelectedMenuItem",this))},insertNewline:function(e,t){this.mouseUp(t)},closeParent:function(){this.$().removeClass("focus");var e=this.get("parentMenu");e&&e.remove()},clickInside:function(e,t){return SC.pointInRect({x:t.pageX,y:t.pageY},e)},contentDidChange:function(){var e=this.get("content"),t=this._content;if(e===t)return;var n=this.contentPropertyDidChange;t&&t.removeObserver&&t.removeObserver("*",this,n),this._content=e,e&&e.addObserver&&e.addObserver("*",this,n),this.contentPropertyDidChange(e,"*")}.observes("content"),contentPropertyDidChange:function(e,t){var n=this.get("parentMenu");if(!n)return;var r=SC.MenuItemView._contentPropertyToMenuItemPropertyMapping,i=SC.keys(r),s,o,u,a;if(t==="*")for(s=0,o=i.length;s<o;++s)u=i[s],a=r[u],this.notifyPropertyChange(a);else for(s=0,o=i.length;s<o;++s)u=i[s],n.get(u)===t&&(a=r[u],this.notifyPropertyChange(a))}}),SC.MenuItemView._contentPropertyToMenuItemPropertyMapping={itemTitleKey:"title",itemIsEnabledKey:"isEnabled",itemSeparatorKey:"isSeparator",itemSubMenuKey:"subMenu"},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(e,t){var n;this.beginPropertyChanges(),e&&(e.isView?(this._anchorView=e,this._setupScrollObservers(e)):this._anchorHTMLElement=e),t&&this.set("preferMatrix",t),this.adjust("height",this.get("menuHeight")),this.positionPane(),this.set("defaultResponder",this),this.endPropertyChanges(),this._hideOverflow(),this.append()},remove:function(){var e=this.get("parentMenu");return this._isRemoving=!0,this.set("currentMenuItem",null),this._isRemoving=!1,this.closeOpenMenus(),this.resignMenuPane(),e&&e.becomeMenuPane(),arguments.callee.base.apply(this,arguments)},itemTitleKey:"title",itemIsEnabledKey:"isEnabled",itemValueKey:"value",itemIconKey:"icon",itemHeightKey:"height",itemSubMenuKey:"subMenu",itemSeparatorKey:"separator",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 e,t,n;return e=this.createChildView(SC.MenuScrollView,{borderStyle:SC.BORDER_NONE,controlSize:this.get("controlSize")}),t=this._menuView=SC.View.create({parentViewDidResize:function(){this.notifyPropertyChange("frame")},viewDidResize:function(){}}),n=this.get("menuItemViews"),t.set("layout",{top:0,left:0,height:this.get("menuHeight")}),t.replaceAllChildren(n),e.set("contentView",t),this.childViews=[e],this},paneDidAttach:function(){var e=this.rootResponder=SC.RootResponder.responder;return e.panes.add(this),this.set("currentWindowSize",e.computeWindowSize()),this.set("isPaneAttached",YES),this.parentViewDidChange(),this._notifyDidAppendToDocument(),this.becomeMenuPane(),this},becomeMenuPane:function(){return this.rootResponder&&this.rootResponder.makeMenuPane(this),this},resignMenuPane:function(){return this.rootResponder&&this.rootResponder.makeMenuPane(null),this},menuItemViews:function(){return this.createMenuItemViews()}.property("displayItems").cacheable(),createMenuItemViews:function(){var e=[],t=this.get("displayItems"),n=this.get("exampleView"),r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b;if(!t)return e;u=this.get("itemHeightKey"),a=this.get("itemSeparatorKey"),exampleViewKey=this.get("itemExampleViewKey"),f=this.get("itemHeight"),p=this.get("itemKeyEquivalentKey"),l=this.get("itemSeparatorHeight"),g=this.get("itemLayerIdKey"),h=Math.floor(this.get("menuHeightPadding")/2),c=h,v=this.menuItemKeys.map(SC._menu_fetchKeys,this),b=t.get("length"
);for(m=0;m<b;m++)r=t[m],o=r.get(u),o||(o=r.get(a)?l:f),y={layout:{height:o,top:c},contentDisplayProperties:v,content:r,parentMenu:this},r.get(g)&&(y.layerId=r.get(g)),itemExampleView=r.get(exampleViewKey),itemExampleView?i=itemExampleView:i=n,s=this._menuView.createChildView(i,y),e[m]=s,c+=o,d=r.get(p),d&&(SC.typeOf(d)===SC.T_ARRAY?d.forEach(function(e){this._keyEquivalents[e]=s},this):this._keyEquivalents[d]=s);return this.set("menuHeight",c+h),e},menuItemViewForContentIndex:function(e){var t=this.get("menuItemViews");return t?t.objectAt(e):undefined},_keyEquivalents:{},_rootMenuBinding:SC.Binding.oneWay("*parentMenu.rootMenu"),rootMenu:function(){return this.get("isSubMenu")?this.get("_rootMenu"):this}.property("isSubMenu","_rootMenu").cacheable(),windowSizeDidChange:function(e,t){return this.remove(),arguments.callee.base.apply(this,arguments)},displayItems:function(){var e=this.get("items"),t=this.get("localize"),n=this.get("itemHeight"),r,i=[],s,o,u;if(!e)return null;r=e.get("length");for(s=0;s<r;s++){o=e.objectAt(s);if(!o)continue;u=SC.typeOf(o),u===SC.T_STRING?o=SC.Object.create({title:o,value:o,isEnabled:YES}):u===SC.T_HASH?o=SC.Object.create(o):u===SC.T_ARRAY&&(o=this.convertArrayMenuItemToObject(o)),o.contentIndex=s,i.push(o)}return i}.property("items").cacheable(),_sc_menu_itemsDidChange:function(){var e=this.get("menuItemViews");this._menuView.replaceAllChildren(e),this._menuView.adjust("height",this.get("menuHeight"))}.observes("items"),convertArrayMenuItemToObject:function(e){SC.Logger.warn("Support for Array-based menu items has been deprecated. Please update your menus to use a hash."
);var t,n=SC._menu_fetchKeys,r=SC._menu_fetchItem,i,s=SC.Object.create(),o,u;return t=this.menuItemKeys.map(n,this),s[t[0]]=e[0],s[t[1]]=e[1],s[t[2]]=e[2],s[t[3]]=e[3],s[t[4]]=e[4],s[t[5]]=e[5],s[t[6]]=e[6],s[t[7]]=e[7],s[t[8]]=e[8],s[t[9]]=e[9],s[t[10]]=e[10],s[t[11]]=e[11],s[t[12]]=e[12],s},currentMenuItem:function(e,t){return t!==undefined?(this._currentMenuItem!==null&&this.set("previousMenuItem",this._currentMenuItem),this._currentMenuItem=t,(!this._isRemoving||!this.get("isSubMenu"))&&this.setPath("rootMenu.targetMenuItem",t),t):this._currentMenuItem}.property().cacheable(),_sc_menu_currentMenuItemDidChange:function(){var e=this.get("currentMenuItem"),t=this.get("previousMenuItem");t&&(!t.get("hasSubMenu")||e!==null)&&(t.resignFirstResponder(),this.closeOpenMenusFor(t)),e&&e.get("isEnabled")&&e.scrollToVisible()}.observes("currentMenuItem"),closeOpenMenusFor:function(e){if(!e)return;var t=e.get("parentMenu");while(t&&e)t=e.get("subMenu"),t&&(t.remove(),e.resignFirstResponder(),e=t.get("previousMenuItem"))},closeOpenMenus:function(){this.closeOpenMenusFor(this.get("previousMenuItem"))},mouseDown:function(e){return this.modalPaneDidClick(e),YES},mouseEntered:function(e){this.set("mouseHasEntered",YES)},keyUp:function(e){var t=this.interpretKeyEvents(e);return t?t:NO},moveUp:function(){var e=this.get("currentMenuItem"),t=this.get("menuItemViews"),n,r,i;if(!e)i=t.get("length")-1;else{n=e.getPath("content.contentIndex");if(n===0)return YES;i=n-1}while(i>=0){if(t[i].get("isEnabled")){this.set("currentMenuItem",t[i]),t[i].becomeFirstResponder();break}i--}return YES},moveDown:
function(){var e=this.get("currentMenuItem"),t=this.get("menuItemViews"),n=t.get("length"),r,i,s;if(!e)s=0;else{r=e.getPath("content.contentIndex");if(r===n)return YES;s=r+1}while(s<n){if(t[s].get("isEnabled")){this.set("currentMenuItem",t[s]),t[s].becomeFirstResponder();break}s++}return YES},insertText:function(e,t){var n=this._timer,r=this._keyBuffer;return n&&n.invalidate(),n=this._timer=SC.Timer.schedule({target:this,action:"clearKeyBuffer",interval:500,isPooled:NO}),r=r||"",r+=e.toUpperCase(),this.selectMenuItemForString(r),this._keyBuffer=r,YES},performKeyEquivalent:function(e,t,n){if(!n&&!this.get("isVisibleInWindow"))return NO;var r=this._keyEquivalents[e];return r?(r.performAction(YES),YES):e==="escape"||e==="return"?(this.remove(),YES):NO},selectMenuItemForString:function(e){var t=this.get("menuItemViews"),n,r,i,s,o;if(!t)return;o=e.length,s=t.get("length");for(i=0;i<s;i++){n=t.objectAt(i),r=n.get("title");if(!r)continue;r=r.replace(/ /g,"").substr(0,o).toUpperCase();if(r===e){this.set("currentMenuItem",n),n.becomeFirstResponder();break}}},clearKeyBuffer:function(){this._keyBuffer=""},modalPaneDidClick:function(e){return this.remove(),YES}}),SC._menu_fetchKeys=function(e){return this.get(e)},SC._menu_fetchItem=function(e){return e?this.get?this.get(e):this[e]:null},SC.MenuPane.VERTICAL_OFFSET=23,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.SheetPane=SC.PanelPane.extend({classNames:["sc-sheet"],modalPane:SC.ModalPane,transitionDuration:200,_state:"NO_VIEW",init:function(){arguments.callee.base.apply(this,arguments),SC.Animatable&&(SC.SheetPane.ANIMATABLE_AVAILABLE=YES,this.mixin(SC.Animatable),this.transitions||(this.transitions={}),this.transitions.top||(this.transitions.top={duration:this.transitionDuration===200?.3:this.transitionDuration/1e3,action:"_complete",target:this}))},append:function(){var e=this.get("layout");if(!e.height||!e.top)e=SC.View.convertLayoutToAnchoredLayout(e,this.computeParentDimensions());return e.top=-1*e.height,this.disableAnimation&&this.disableAnimation(),this.adjust(e),this.updateLayout(),this.enableAnimation&&this.enableAnimation(),arguments.callee.base.apply(this,arguments)},remove:function(){var e=this,t=arguments;return this.invokeLater(function(){t.callee.base.apply(e,t)},this.transitionDuration),this.slideUp(),this},paneDidAttach:function(){var e=arguments.callee.base.apply(this,arguments);return this.slideDown(),e},slideDown:function(){this._state=SC.
SheetPane.ANIMATING,this._direction=SC.SheetPane.SLIDE_DOWN,SC.SheetPane.ANIMATABLE_AVAILABLE?(this.transitions.top.timing=SC.Animatable.TRANSITION_EASE_OUT,this.adjust("top",0)):(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 e=this.get("layout");this.transitions.top.timing=SC.Animatable.TRANSITION_EASE_IN,this.adjust("top",-1*e.height)}else this._start=Date.now(),this._end=this._start+this.get("transitionDuration"),this.tick()},_complete:function(){var e=this._direction;if(e===SC.SheetPane.SLIDE_DOWN)SC.SheetPane.ANIMATABLE_AVAILABLE||this.adjust("top",0),this.adjust({centerX:0,left:null}),SC.browser.mozilla&&this.parentViewDidChange();else{var t=this.get("layout");SC.SheetPane.ANIMATABLE_AVAILABLE||this.adjust("top",-1*t.height)}this._state=SC.SheetPane.READY,this.updateLayout()},blurTo:function(e){this.setFirstResponder("")},tick:function(){this._timer=null;var e=Date.now(),t=(e-this._start)/(this._end-this._start),n=this,r=this._direction,i=this.get("layout"),s,o;return t<0&&(t=0),t>=1?(this._complete(),this):(o=Math.floor(i.height*t),r==SC.SheetPane.SLIDE_DOWN?n.adjust("top",0-(i.height-o)):r==SC.SheetPane.SLIDE_UP&&n.adjust("top",0-o),this._timer=this.invokeLater(this.tick,20),n.updateLayout(),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(e,t){this.addSizeClassName(e,t);var n,r=e.get("toolTip"),i=e.get("value"),s=e.get("isSelected")||NO,o=e.get("isActive")||NO,u=e.get("isDefault")||NO,a=e.get("isCancel")||NO,f=e.get("isToggle")||NO,l=SC.guidFor(e)+"-label",c=e.get("isBorderless")||NO;t.setClass({icon:!!e.get("icon"),def:u,cancel:a&&!u,active:o,sel:s}),r&&(t.attr("title",r),t.attr("alt",r)),c||this.includeSlices(e,t,SC.THREE_SLICE),e.get("isSegment")?t.attr("aria-selected",s.toString()):f&&t.attr("aria-pressed",o.toString()),i?t.attr("aria-labelledby",l):r?t.attr("aria-label",r):t.attr("aria-label",e.get("displayTitle")),t=t.begin("label").addClass("sc-button-label").id(l),e.get("theme").labelRenderDelegate.render(e,t),t=t.end(),e.get("supportFocusRing")&&(t=t.begin("div").addClass("focus-ring"),this.includeSlices(e,t,SC.THREE_SLICE),t=t.end())},update:function(e,t){var n=e.get("buttonBehavior")===SC.TOGGLE_BEHAVIOR;this.updateSizeClassName(e,t),e.get("isActive")&&t.addClass("active");var r=e.get("isDefault"),i=e.get("isCancel");e.get("isSegment")?t.attr("aria-selected",e.get("isSelected").toString()):n&&t.attr("aria-pressed",e.get("isActive").toString());var s=e.get("toolTip");t.attr("title",s),t.attr("aria-label",s),t.setClass("icon",!!e.get("icon")),t.setClass("def",!!r),t.setClass("cancel",!!i&&!r),e.get("theme"
).labelRenderDelegate.update(e,t.find("label"))},getRenderedAutoResizeLayer:function(e,t){return t.find(".sc-button-label")[0]}}),SC.BaseTheme.checkboxRenderDelegate=SC.RenderDelegate.create({className:"checkbox",render:function(e,t){this.addSizeClassName(e,t);var n=e.get("theme"),r,i;i=SC.guidFor(e)+"-label";var s=e.get("isSelected")||NO,o=e.get("isActive"),u=!e.get("isEnabled"),a;s===SC.MIXED_STATE?a="mixed":s?a="true":a="false",t.attr("role","checkbox"),t.attr("aria-checked",a),t.attr("aria-labelledby",i),t.setClass({sel:s,active:o,disabled:u}),t.push('<span class = "button"></span>'),t=t.begin("span").addClass("label").id(i),n.labelRenderDelegate.render(e,t),t=t.end()},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("theme"),r=e.get("isSelected"),i=e.get("isActive"),s=!e.get("isEnabled"),o;r===SC.MIXED_STATE?o="mixed":r?o="true":o="false",t.attr("aria-checked",o),n.labelRenderDelegate.update(e,t.find("span.label")),t.setClass({sel:r,active:i,disabled:s})},isEventWithinActiveArea:function(e,t){var n=t.target||t.srcElement,r=n===e.$(".button")[0]||n===e.$(".label")[0];return!r&&document.activeElement===e.$()[0]&&t.pageX===0&&t.pageY===0&&(r=!0),n&&r}}),SC.BaseTheme.collectionRenderDelegate=SC.RenderDelegate.create({className:"collection",render:function(e,t){t.setClass("focus",e.get("hasFirstResponder")),t.setClass("disabled",!e.get("isEnabled")),t.setClass("active",e.get("isActive"))},update:function(e,t){t.setClass("focus",e.get("hasFirstResponder")),t.setClass("disabled",!e.get("isEnabled")),t.setClass("active",e.get("isActive"))}}),SC.BaseTheme.disclosureRenderDelegate=
SC.RenderDelegate.create({className:"disclosure",render:function(e,t){this.addSizeClassName(e,t);var n=e.get("theme"),r=e.get("value"),i=e.get("title"),s=SC.guidFor(e)+"-label",o=r?"true":"false";t.attr("role","disclosure checkbox"),t.attr("aria-labelledby",s),t.attr("aria-checked",o),e.get("isSelected")&&t.addClass("sel");var u="";u+=e.get("isSelected")?"open":"closed",e.get("isActive")&&(u+=" active"),t.push('<img src = "'+SC.BLANK_IMAGE_URL+'" class = "disclosure button '+u+'" />'),t=t.begin("span").addClass("sc-button-label").id(s),n.labelRenderDelegate.render(e,t),t=t.end()},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("theme"),r=e.get("value"),i=e.get("title"),s=r?"true":"false";t.attr("role","disclosure checkbox"),t.attr("aria-checked",s),e.get("isSelected")&&t.addClass("sel"),t.find("img").setClass({open:e.get("isSelected"),closed:!e.get("isSelected"),active:e.get("isActive")}),n.labelRenderDelegate.update(e,t.find("span.sc-button-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,t,n){for(var r=0,i=n.length;r<i;r++)t.push('<div class="'+n[r]+'"></div>')}}),SC.BaseTheme.imageButtonRenderDelegate=SC.RenderDelegate.create({className:"image-button",render:function(e,t){var n=e.get("image"),r=e.get("toolTip");this.addSizeClassName(e,t),t.addClass("no-min-width"),r&&(t.attr("title",r),t.attr("alt",r)),n?t.push("<div class='img "+n+"'></div>"):t.push("<div class='img'></div>")},update:function(e,t)
{var n,r;this.updateSizeClassName(e,t),e.didChangeFor("imageButtonRenderDelegate","toolTip")&&(r=e.get("toolTip"),t.attr("title",r),t.attr("aria-label",r)),n=e.get("image"),n&&e.didChangeFor("imageButtonRenderDelegate","image")&&(t.children()[0].className="img "+n)}}),SC.BaseTheme.MASTER_DETAIL_DIVIDER_WIDTH=1,SC.BaseTheme.masterDetailRenderDelegate=SC.RenderDelegate.create({className:"master-detail",dividerWidth:1,render:function(e,t){t.setClass("round-toolbars",SC.platform.touch)},update:function(e,t){t.setClass("round-toolbars",SC.platform.touch)}}),SC.BaseTheme.panelRenderDelegate=SC.RenderDelegate.create({className:"panel",render:function(e,t){t=t.begin("div").addClass("panel-background"),this.includeSlices(e,t,SC.NINE_SLICE),t=t.end();var n=e.get("ariaLabel"),r=e.get("ariaLabelledBy"),i=e.get("ariaDescribedBy");n&&t.attr("aria-label",n),r&&t.attr("aria-labelledby",r),i&&t.attr("aria-describedby",i)},update:function(e,t){var n=e.get("ariaLabel"),r=e.get("ariaLabelledBy"),i=e.get("ariaDescribedBy");n&&t.attr("aria-label",n),r&&t.attr("aria-labelledby",r),i&&t.attr("aria-describedby",i)}}),SC.BaseTheme.pickerRenderDelegate=SC.RenderDelegate.create({className:"picker",render:function(e,t){var n=e.get("theme").panelRenderDelegate;n.render(e,t);var r=e.get("preferType"),i=e.get("pointerPos"),s=e.get("pointerPosY");if(r==SC.PICKER_POINTER||r==SC.PICKER_MENU_POINTER)t.push('<div class="sc-pointer '+i+'" style="margin-top: '+s+'px"></div>'),t.addClass(i)},update:function(e,t){var n=e.get("theme").panelRenderDelegate;n.update(e,t);var r=e.get("preferType"),i=e.get("pointerPos"),
s=e.get("pointerPosY");if(r==SC.PICKER_POINTER||r==SC.PICKER_MENU_POINTER){var o=t.find(".sc-pointer");o.attr("class","sc-pointer "+i),o.attr("style","margin-top: "+s+"px"),t.addClass(i)}}}),SC.BaseTheme.menuRenderDelegate=SC.BaseTheme.pickerRenderDelegate.create({className:"menu",render:function(e,t,n){this.addSizeClassName(t,n),e(t,n)}.enhance(),update:function(e,t,n){this.updateSizeClassName(t,n),e(t,n)}.enhance(),itemHeight:26,itemSeparatorHeight:9,menuHeightPadding:6,menuWidthPadding:50,minimumMenuWidth:50,submenuOffsetX:2,verticalOffset:23,"sc-tiny-size":{itemHeight:22,itemSeparatorHeight:2,menuHeightPadding:4,submenuOffsetX:0},"sc-small-size":{itemHeight:26,itemSeparatorHeight:7,menuHeightPadding:0,submenuOffsetX:4},"sc-large-size":{itemHeight:30,itemSeparatorHeight:20,menuHeightPadding:0,submenuOffsetX:4},"sc-huge-size":{itemHeight:30,itemSeparatorHeight:9,menuHeightPadding:0,submenuOffsetX:0}}),SC.BaseTheme.popupButtonRenderDelegate=SC.BaseTheme.buttonRenderDelegate.create({render:function(e,t){t.attr("aria-haspopup","true"),arguments.callee.base.apply(this,arguments)},update:function(e,t){arguments.callee.base.apply(this,arguments)}}),SC.BaseTheme.progressRenderDelegate=SC.RenderDelegate.create({className:"progress",render:function(e,t){this.addSizeClassName(e,t);var n=e.get("theme"),r=e.get("maximum"),i=e.get("minimum"),s=e.get("ariaValue"),o;e.get("isIndeterminate")?o=120:o=e.get("value"),t.attr("aria-valuemax",r),t.attr("aria-valuemin",i),t.attr("aria-valuenow",s),t.setClass({indeterminate:e.get("isIndeterminate"),running:e.get("isRunning"),disabled:!e.get("isEnabled"
),"sc-empty":o<=0,"sc-complete":o>=100}),t=t.begin("div").addClass("track"),this.includeSlices(e,t,SC.THREE_SLICE),t=t.end(),t=t.begin("div").addClass("content"),t.css("width",o*100+"%"),this.includeSlices(e,t,SC.THREE_SLICE),t=t.end()},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("theme"),r=e.get("maximum"),i=e.get("minimum"),s=e.get("ariaValue");t.attr("aria-valuemax",r),t.attr("aria-valuemin",i),t.attr("aria-valuenow",s);var o;e.get("isIndeterminate")?o=120:o=e.get("value"),t.setClass({indeterminate:e.get("isIndeterminate"),running:e.get("isRunning"),disabled:!e.get("isEnabled"),"sc-empty":o<=0,"sc-complete":o>=100}),t.find(".content").css("width",o*100+"%")}}),SC.BaseTheme.radioRenderDelegate=SC.RenderDelegate.create({className:"radio",render:function(e,t){this.addSizeClassName(e,t);var n=e.get("theme"),r=e.get("isSelected"),i=e.get("width"),s=SC.guidFor(e)+"-label";t.setClass({active:e.get("isActive"),mixed:e.get("isMixed"),sel:e.get("isSelected"),disabled:!e.get("isEnabled")}),t.attr("role","radio"),t.attr("aria-checked",r),t.attr("aria-labelledby",s),t.attr("aria-disabled",e.get("isEnabled")?"false":"true"),i&&t.css("width",i),t.push('<span class = "button"></span>'),t=t.begin("span").addClass("sc-button-label").id(s),n.labelRenderDelegate.render(e,t),t=t.end()},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("theme"),r=e.get("isSelected"),i=e.get("width"),s=e.get("value");t.setClass({active:e.get("isActive"),mixed:e.get("isMixed"),sel:e.get("isSelected"),disabled:!e.get("isEnabled")}),t.attr("aria-disabled",e.get("isEnabled")?"false":"true"
),t.attr("aria-checked",r),t.css("width",i?i:null),n.labelRenderDelegate.update(e,t.find(".sc-button-label"))}}),SC.BaseTheme.radioGroupRenderDelegate=SC.RenderDelegate.create({className:"radio-group",render:function(e,t){this.addSizeClassName(e,t);var n=e.get("theme"),r=SC.guidFor(this),i=e.get("items"),s,o=i.length,u;t.addClass(e.get("layoutDirection")),t.attr("role","radiogroup"),t.attr("aria-disabled",e.get("isEnabled")?"false":"true");for(s=0;s<o;s++)u=i[s],t=t.begin("div").addClass("radio-"+s).attr("index",s).addClass(n.classNames).addClass(n.radioRenderDelegate.className).addClass("sc-radio-button"),n.radioRenderDelegate.render(u,t),t=t.end();e.get("renderState").radioCount=s},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("theme"),r=SC.guidFor(this),i=e.get("items"),s,o=i.length,u;t.addClass(e.get("layoutDirection")),t.attr("aria-disabled",e.get("isEnabled")?"false":"true");if(e.get("renderState").radioCount!==o){var a=SC.RenderContext(t[0]);this.render(e,a),a.update();return}for(s=0;s<o;s++)u=i[s],n.radioRenderDelegate.update(u,t.find(".radio-"+s))},updateRadioAtIndex:function(e,t,n){var r=e.get("items")[n];e.get("theme").radioRenderDelegate.update(r,t.find(".radio-"+n))},indexForEvent:function(e,t,n){var r=SC.$(n.target).closest(".sc-radio-button").attr("index");return isNaN(r)?undefined:parseInt(r,0)}}),SC.BaseTheme.segmentRenderDelegate=SC.RenderDelegate.create({className:"segment",render:function(e,t){var n=e.get("theme"),r,i;i={"sc-first-segment":e.get("isFirstSegment"),"sc-middle-segment":e.get("isMiddleSegment"),"sc-last-segment":e.get("isLastSegment"
),"sc-overflow-segment":e.get("isOverflowSegment")},SC.none(e.get("index"))||(i["sc-segment-"+e.get("index")]=YES),t.setClass(i),t.attr("tabindex",e.get("isSelected")?0:-1),r=n.buttonRenderDelegate,r.render(e,t)},update:function(e,t){var n=e.get("theme"),r,i={};i={"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},SC.none(e.get("index"))||(i["sc-segment-"+e.get("index")]=YES),t.setClass(i),t.attr("tabindex",e.get("isSelected")?0:-1),r=n.buttonRenderDelegate,r.update(e,t)}}),SC.BaseTheme.segmentedRenderDelegate=SC.RenderDelegate.create({className:"segmented",render:function(e,t){this.addSizeClassName(e,t),t.addStyle("text-align",e.get("align"))},update:function(e,t){this.updateSizeClassName(e,t),t.css("text-align",e.get("align"))},segmentWidths:function(e){var t=e.$(".sc-segment-view"),n,r=[];for(var i=0,s=t.length;i<s-1;i++)n=t[i],r[i]=n.getBoundingClientRect().width;return r},overflowSegmentWidth:function(e){var t=e.$(".sc-segment-view"),n;return n=t[t.length-1],n.getBoundingClientRect().width},indexForClientPosition:function(e,t,n){var r=e.$(".sc-segment-view"),i,s,o,u,a;a={x:t,y:n};for(s=0,i=r.length;s<i;s++){o=r[s],u=o.getBoundingClientRect(),u={x:u.left,y:u.top,width:u.right-u.left,height:u.bottom-u.top};if(SC.pointInRect(a,u))return s}return-1}}),SC.BaseTheme.sliderRenderDelegate=SC.RenderDelegate.create({className:"slider",render:function(e,t){this.addSizeClassName(e,t);var n=SC.BLANK_IMAGE_URL,r=e.get("maximum"),i=e.get("minimum"),s=e.get
("ariaValue"),o=e.get("layoutDirection")===SC.LAYOUT_HORIZONTAL,u=e.get("value"),a=e.get("isEnabled")?'tabindex="0"':"",f;t.attr("aria-valuemax",r),t.attr("aria-valuemin",i),t.attr("aria-valuenow",s),o?(t.attr("aria-orientation","horizontal"),t.addClass("sc-horizontal"),f="left"):(t.attr("aria-orientation","vertical"),t.addClass("sc-vertical"),f="top",u=100-u),t=t.begin("span").addClass("track"),this.includeSlices(e,t,SC.THREE_SLICE),t.push('<img src="'+n+'" class="sc-handle" '+a+'style="'+f+": "+u+'%" />'+"</span>"),t=t.end(),e.get("renderState")._cachedHandle=null},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("maximum"),r=e.get("minimum"),i=e.get("ariaValue"),s=Math.round(i*10)/10,o=e.get("layoutDirection")===SC.LAYOUT_HORIZONTAL,u=e.didChangeFor("sliderRenderDelegate","layoutDirection");t.attr("aria-valuemax",n),t.attr("aria-valuemin",r),t.attr("aria-valuenow",s),t.attr("aria-orientation",o?"horizontal":"vertical"),t.addClass(o?"sc-horizontal":"sc-vertical");if(u||e.didChangeFor("sliderRenderDelegate","value")){var a=e.get("renderState")._cachedHandle;a||(a=e.get("renderState")._cachedHandle=t.find(".sc-handle")),e.get("isEnabled")?a.attr("tabindex",0):a.removeAttr("tabindex");var f=e.get("frame"),l=e.get("value");u&&a.css(o?"top":"left",null),o?a.css("left",l+"%"):a.css("top",100-l+"%")}}}),SC.BaseTheme.SourceList=SC.BaseTheme.subtheme("source-list"),SC.BaseTheme.toolbarRenderDelegate=SC.RenderDelegate.create({className:"toolbar",render:function(e,t){},update:function(){}}),SC.BaseTheme.wellRenderDelegate=SC.RenderDelegate.create({className:"well",render
:function(e,t){},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(e){e(),this.get("isDropTarget")&&SC.Drag.addDropTarget(this),this.get("isScrollable")&&SC.Drag.addScrollableView(this)}.enhance(),destroy:function(e){return this.get("isDropTarget")&&SC.Drag.removeDropTarget(this),this.get("isScrollable")&&SC.Drag.removeScrollableView(this),e()}.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 e=this.data;if(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}var r=this.get("source");return r&&r.dragDataTypes?r.get("dragDataTypes")||[]:[]}.property().cacheable(),hasDataType:function(e){return this.get("dataTypes").indexOf(e)>=0},dataForType:function(e){if(this.dataSource)return this.dataSource.dragDataForType(this,e);if(this.data)return this.data[e];var t=this.get("source");return t&&SC.typeOf(t.dragDataForType)==SC.T_FUNCTION?t.dragDataForType(this,e):null},dataSource:null,data:null,allowedDragOperations:SC.DRAG_ANY,_dragInProgress:YES,_dragViewWasVisible:null,startDrag:function(){this.get("sourceIsDraggable")&&this._createGhostView();var e=this.event,t={x:e.pageX,y:e.pageY};this.set("location"
,t);if(this.get("sourceIsDraggable")){var n=this._getDragView(),r=n.get("parentView"),i=r?r.convertFrameToView(n.get("frame"),null):n.get("frame");this.get("ghost")&&(this._dragViewWasVisible=n.get("isVisible"),n.set("isVisible",NO)),this.ghostActsLikeCursor?this.ghostOffset={x:14,y:14}:this.ghostOffset={x:t.x-i.x,y:t.y-i.y},this._ghostViewHidden||this._positionGhostView(e);if(e.makeTouchResponder){var s=this;SC.Timer.schedule({target:e,action:function(){e.hasEnded||e.makeTouchResponder(s,YES)},interval:1})}else this.ghostView.rootResponder.dragDidStart(this,e)}var o=this.source;o&&o.dragDidBegin&&o.dragDidBegin(this,t);var u=this._dropTargets();for(var a=0,f=u.length;a<f;a++)u[a].tryToPerform("dragStarted",this,e)},cancelDrag:function(){var e=this._lastTarget,t=this.get("location");e&&e.dragExited&&e.dragExited(this,this._lastMouseDraggedEvent),this.get("sourceIsDraggable")&&(this._destroyGhostView(),this.get("ghost")&&(this._dragViewWasVisible&&this._getDragView().set("isVisible",YES),this._dragViewWasVisible=null));var n=this.source;n&&n.dragDidEnd&&n.dragDidEnd(this,t,SC.DRAG_NONE),this._lastTarget=null,this._dragInProgress=NO},touchStart:function(e){return YES},mouseDragged:function(e){var t=this._autoscroll(e),n=this.get("location");if(!t&&e.pageX===n.x&&e.pageY===n.y)return;n={x:e.pageX,y:e.pageY},this.set("location",n),this._lastMouseDraggedEvent=e;var r=this.source,i=this._lastTarget,s=this._findDropTarget(e),o=SC.DRAG_NONE;while(s&&s!==i&&o===SC.DRAG_NONE)s&&r&&r.dragSourceOperationMaskFor?o=r.dragSourceOperationMaskFor(this,s):o=SC.DRAG_ANY,o!==SC.DRAG_NONE&&s&&s.
computeDragOperations?o&=s.computeDragOperations(this,e,o):o=SC.DRAG_NONE,this.allowedDragOperations=o,o===SC.DRAG_NONE&&(s=this._findNextDropTarget(s));s!==i?(i&&i.dragExited&&i.dragExited(this,e),s&&(s.dragEntered&&s.dragEntered(this,e),s.dragUpdated&&s.dragUpdated(this,e)),this._lastTarget=s):s&&s.dragUpdated&&s.dragUpdated(this,e),r&&r.dragDidMove&&r.dragDidMove(this,n),this.get("sourceIsDraggable")&&!this._ghostViewHidden&&this._positionGhostView(e)},touchesDragged:function(e){this.mouseDragged(e)},mouseUp:function(e){var t={x:e.pageX,y:e.pageY},n=this._lastTarget,r=this.allowedDragOperations;this.set("location",t);try{n&&n.acceptDragOperation&&n.acceptDragOperation(this,r)?r=n.performDragOperation?n.performDragOperation(this,r):SC.DRAG_NONE:r=SC.DRAG_NONE}catch(i){SC.Logger.error("Exception in SC.Drag.mouseUp(acceptDragOperation|performDragOperation): %@".fmt(i))}try{n&&n.dragExited&&n.dragExited(this,e)}catch(s){SC.Logger.error("Exception in SC.Drag.mouseUp(target.dragExited): %@".fmt(s))}var o=this._dropTargets();for(var u=0,a=o.length;u<a;u++)try{o[u].tryToPerform("dragEnded",this,e)}catch(f){SC.Logger.error("Exception in SC.Drag.mouseUp(dragEnded on %@): %@".fmt(o[u],f))}this.get("sourceIsDraggable")&&(this._destroyGhostView(),this.get("ghost")&&(this._dragViewWasVisible&&this._getDragView().set("isVisible",YES),this._dragViewWasVisible=null));var l=this.source;l&&l.dragDidEnd&&l.dragDidEnd(this,t,r),this._lastTarget=null,this._dragInProgress=NO},touchEnd:function(e){this.mouseUp(e)},_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 e=this,t=this._getDragView(),n=t.get("frame"),r;r=this.ghostView=SC.Pane.create({classNames:["sc-ghost-view"],layout:{top:n.y,left:n.x,width:n.width,height:n.height},owner:this,didCreateLayer:function(){if(t){var e=t.get("layer");e&&(e=e.cloneNode(!0),e.style.top="0px",e.style.left="0px",this.get("layer").appendChild(e))}}}),r.append()},_positionGhostView:function(e){var t=this.get("location");t.x-=this.ghostOffset.x,t.y-=this.ghostOffset.y;var n=this.ghostView;n&&(n.adjust({top:t.y,left:t.x}),n.invokeOnce("updateLayout"))},_ghostViewHidden:NO,hideGhostView:function(){this.ghostView&&!this._ghostViewHidden&&(this.ghostView.remove(),this._ghostViewHidden=YES)},unhideGhostView:function(){this._ghostViewHidden&&(this._ghostViewHidden=NO,this._createGhostView())},_destroyGhostView:function(){this.ghostView&&(this.ghostView.remove(),this.ghostView=null,this._ghostViewHidden=NO)},_dropTargets:function(){if(this._cachedDropTargets)return this._cachedDropTargets;var e=[],t=SC.Drag._dropTargets;for(var n in t)t.hasOwnProperty(n)&&e.push(t[n]);var r={},i=SC.Drag._dropTargets,s=function(e){if(!e)return 0;var t=SC.guidFor(e),n=r[t];if(!n){n=1;while(e=e.get("parentView"))i[SC.guidFor(e)]!==undefined&&n++;r[t]=n}return n};return e.sort(function(e,t){return e===t?0:(e=s(e),t=s(t),e>t?-1:1)}),this._cachedDropTargets=e,e},_findDropTarget:function(e){var t={x:e.pageX,y:e.pageY},n,r,i=this._dropTargets();for(var s=0,o=i.length;s<o;s++){n=i[s];if(!n.get("isVisibleInWindow"))continue;r=n.convertFrameToView(n.get("clippingFrame"
),null);if(SC.pointInRect(t,r))return n}return null},_findNextDropTarget:function(e){var t=SC.Drag._dropTargets;while(e=e.get("parentView"))if(t[SC.guidFor(e)])return e;return null},_autoscroll:function(e){e||(e=this._lastAutoscrollEvent);if(!this._dragInProgress)return NO;var t=e?{x:e.pageX,y:e.pageY}:this.get("location"),n=this._findScrollableView(t),r=null,i,s,o,u,a,f,l;while(n&&!r){i=n.get("canScrollVertical")?1:0,s=n.get("canScrollHorizontal")?1:0;if(i||s)f=n.get("containerView"),f?l=n.convertFrameToView(f.get("frame"),null):i=s=0;i&&(u=SC.maxY(l),o=u-SC.DRAG_AUTOSCROLL_ZONE_THICKNESS,t.y>=o&&t.y<=u?i=1:(o=SC.minY(l),u=o+SC.DRAG_AUTOSCROLL_ZONE_THICKNESS,t.y>=o&&t.y<=u?i=-1:i=0)),s&&(u=SC.maxX(l),o=u-SC.DRAG_AUTOSCROLL_ZONE_THICKNESS,t.x>=o&&t.x<=u?s=1:(o=SC.minX(l),u=o+SC.DRAG_AUTOSCROLL_ZONE_THICKNESS,t.x>=o&&t.x<=u?s=-1:s=0)),i||s?r=n:n=this._findNextScrollableView(n)}r&&this._lastScrollableView===r?Date.now()-this._hotzoneStartTime>100&&(this._horizontalScrollAmount*=1.05,this._verticalScrollAmount*=1.05):(this._lastScrollableView=r,this._horizontalScrollAmount=15,this._verticalScrollAmount=15,this._hotzoneStartTime=r?Date.now():null,s=i=0);if(r&&(s||i)){var c={x:s*this._horizontalScrollAmount,y:i*this._verticalScrollAmount};r.scrollBy(c)}return r?(e&&(this._lastAutoscrollEvent={pageX:e.pageX,pageY:e.pageY}),this.invokeLater(this._autoscroll,100,null),YES):(this._lastAutoscrollEvent=null,NO)},_scrollableViews:function(){if(this._cachedScrollableView)return this._cachedScrollableView;var e=[],t=SC.Drag._scrollableViews;for(var n in t)t.hasOwnProperty(n)&&e.push(t[n])
;return e=e.sort(function(e,t){var n=e;while(n=n.get("parentView"))if(t==n)return-1;return 1}),this._cachedScrollableView=e,e},_findScrollableView:function(e){var t=this._scrollableViews(),n=t?t.length:0,r,i,s;for(s=0;s<n;s++){r=t[s];if(!r.get("isVisibleInWindow"))continue;i=r.convertFrameToView(r.get("clippingFrame"),null);if(SC.pointInRect(e,i))return r}return null},_findNextScrollableView:function(e){var t=SC.Drag._scrollableViews;while(e=e.get("parentView"))if(t[SC.guidFor(e)])return e;return null}}),SC.Drag.mixin({start:function(e){var t=this.create(e);return t.startDrag(),t},_dropTargets:{},_scrollableViews:{},addDropTarget:function(e){this._dropTargets[SC.guidFor(e)]=e},removeDropTarget:function(e){delete this._dropTargets[SC.guidFor(e)]},addScrollableView:function(e){this._scrollableViews[SC.guidFor(e)]=e},removeScrollableView:function(e){delete this._scrollableViews[SC.guidFor(e)]}}),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.CheckboxView=
SC.ButtonView.extend(SC.StaticLayout,{classNames:["sc-checkbox-view","sc-checkbox-control"],ariaRole:"checkbox",themeName:null,renderDelegateName:"checkboxRenderDelegate",needsEllipsis:NO,acceptsFirstResponder:function(){return SC.FOCUS_ALL_CONTROLS?this.get("isEnabled"):NO}.property("isEnabled"),_toggleValue:function(){var e=this.get("value")===this.get("toggleOnValue");this.set("value",e?this.get("toggleOffValue"):this.get("toggleOnValue"))},mouseDown:function(e){if(!this.get("isEnabled"))return YES;var t=NO,n=this.get("renderDelegate"),r;return n?t=n.isEventWithinActiveArea(this,e):t=YES,t?(this.set("isActive",YES),this._isMouseDown=YES,e&&this.get("acceptsFirstResponder")&&e.allowDefault(),r=YES):r=NO,r},mouseUp:function(e){return this.get("isEnabled")?(this.set("isActive",NO),this._isMouseDown=NO,this.get("buttonBehavior")!==SC.HOLD_BEHAVIOR&&this.$().within(e.target)&&(this._toggleValue(),this._action(e)),YES):YES},keyDown:function(e){if(!this.get("isEnabled"))return YES;if(e.which===9||e.keyCode===9){var t=e.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");return t?t.becomeFirstResponder():e.allowDefault(),YES}return e.which===13||e.which===32?(this._toggleValue(),this.get("buttonBehavior")!==SC.HOLD_BEHAVIOR&&this.$().within(e.target)&&this._action(e),YES):(e.allowDefault(),NO)},touchStart:function(e){return this.mouseDown(e)},touchEnd:function(e){return this.mouseUp(e)}}),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(e){if(e.which===37||e.which===38)return this.set("value",this.get("toggleOffValue")),YES;if(e.which===39||e.which===40)return this.set("value",this.get("toggleOnValue")),YES;arguments.callee.base.apply(this,arguments)}}),SC.ImageButtonView=SC.ButtonView.extend({classNames:["sc-image-button-view"],themeName:null,renderDelegateName:"imageButtonRenderDelegate",displayProperties:["image"],image:null}),SC.ScrollerView=SC.View.extend({classNames:["sc-scroller-view"],displayProperties:["thumbPosition","thumbLength","isEnabled","controlsHidden"],ariaRole:"scrollbar",shouldScrollToClick:NO,_touchScrollValue:NO,value:function(e,t){var n=this.get("minimum");return t!==undefined&&(this._scs_value=t),t=this._scs_value||n,Math.max(Math.min(t,this.get("maximum")),n)}.property("maximum","minimum").cacheable(),displayValue:function(){var e;return this.get("_touchScrollValue")?e=this.get("_touchScrollValue"):e=this.get("value"),e}.property("value","_touchScrollValue").cacheable(),proportion:0,maximum:100,minimum:0,isEnabled:function(e,t){return t!==undefined&&(this._scsv_isEnabled=t),this._scsv_isEnabled!==undefined?this._scsv_isEnabled: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,_classNames:{},render:function(e,t){var n=this._classNames,r="",i=this.get("parentView"),s=this.get("layoutDirection"),o,u,a,f,l,c,h,p,d;n["sc-vertical"]=s===SC.LAYOUT_VERTICAL
,n["sc-horizontal"]=s===SC.LAYOUT_HORIZONTAL,n.disabled=!this.get("isEnabled"),n["controls-hidden"]=this.get("controlsHidden"),e.setClass(n),u=this.get("thumbLength"),o=this.get("thumbPosition");if(t)e.push('<div class="track"></div>'),this.renderButtons(e,this.get("hasButtons")),this.renderThumb(e,s,u,o),e.attr("aria-orientation","vertical"),e.attr("aria-valuemax",this.get("maximum")),e.attr("aria-valuemin",this.get("minimum")),e.attr("aria-valuenow",this.get("value")),e.attr("aria-controls",i.getPath("contentView.layerId"));else{if(this.get("controlsHidden"))return;f=this.$(".thumb"),this.adjustThumb(f,o,u),e.attr("aria-valuenow",this.get("value"))}},renderThumb:function(e,t,n,r){var i;t===SC.LAYOUT_HORIZONTAL?i="width: "+n+"px; left: "+r+"px;":i="height: "+n+"px; top: "+r+"px;",e.push('<div class="thumb" style="%@">'.fmt(i),'<div class="thumb-center"></div></div>')},renderButtons:function(e,t){t&&e.push('<div class="button-bottom"></div><div class="button-top"></div>')},touchScrollDidStart:function(e){this.set("_touchScrollValue",e)},touchScrollDidEnd:function(e){this.set("_touchScrollValue",NO)},touchScrollDidChange:function(e){this.set("_touchScrollValue",e)},adjustThumb:function(e,t,n){this.adjustThumbPosition(e,t),this.adjustThumbSize(e,n)},adjustThumbPosition:function(e,t){if(this._thumbPosition===t)return;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:e.css("top",t);break;case SC.LAYOUT_HORIZONTAL:e.css("left",t)}this._thumbPosition=t},adjustThumbSize:function(e,t){t=Math.max(t,this.get("minimumThumbLength"));if(this._thumbSize===t)return;switch(this.get
("layoutDirection")){case SC.LAYOUT_VERTICAL:e.css("height",t);break;case SC.LAYOUT_HORIZONTAL:e.css("width",t)}this._thumbSize=t},trackLength:function(){var e=this.get("scrollerLength");return e-=this.capLength-this.capOverlap,e-=this.buttonLength-this.buttonOverlap,e}.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 e;return e=Math.floor(this.get("trackLength")*this.get("proportion")),e=isNaN(e)?0:e,Math.max(e,this.get("minimumThumbLength"))}.property("trackLength","proportion").cacheable(),thumbPosition:function(){var e=this.get("displayValue"),t=this.get("maximum"),n=this.get("trackLength"),r=this.get("thumbLength"),i=this.get("capLength"),s=this.get("capOverlap"),o;return o=e/t*(n-r),o+=i-s,Math.floor(isNaN(o)?0:o)}.property("displayValue","maximum","trackLength","thumbLength").cacheable(),controlsHidden:function(){return this.get("proportion")>=1}.property("proportion").cacheable(),valueForPosition:function(e){var t=this.get("maximum"),n=this.get("trackLength"),r=this.get("thumbLength"),i=this.get("capLength"),s=this.get("capOverlap"),o;return o=e-(i-s),o/=n-r,o*=t,o},mouseDown:function(e){if(!this.get("isEnabled"))return NO;this._altIsDown=e.altKey,this._shiftIsDown=e.shiftKey;var t=e.target,n=this.get("thumbPosition"),r,i,s,o=this.get("scrollerLength");if(t.className.indexOf("thumb")>=0)i=this.convertFrameFromView({x:e.pageX,y:e.pageY}),i.
x-=n,i.y-=n,this._thumbDragging=YES,this._thumbOffset=i,this._mouseDownLocation={x:e.pageX,y:e.pageY},this._thumbPositionAtDragStart=this.get("thumbPosition"),this._valueAtDragStart=this.get("value");else if(t.className.indexOf("button-top")>=0)this.decrementProperty("value",this._altIsDown?o:30),this.makeButtonActive(".button-top"),this.startMouseDownTimer("scrollUp"),this._isScrollingUp=YES;else if(t.className.indexOf("button-bottom")>=0)this.incrementProperty("value",this._altIsDown?o:30),this.makeButtonActive(".button-bottom"),this.startMouseDownTimer("scrollDown"),this._isScrollingDown=YES;else{var u=this.get("shouldScrollToClick");e.altKey&&(u=!u);var a=this.get("trackLength"),f=this.get("thumbLength"),l=this.convertFrameFromView({x:e.pageX,y:e.pageY}),c;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:this._mouseDownLocation=c=l.y;break;case SC.LAYOUT_HORIZONTAL:this._mouseDownLocation=c=l.x}u?(this.set("value",this.valueForPosition(c-f/2)),n=this.get("thumbPosition"),this._thumbDragging=YES,this._thumbOffset={x:l.x-n,y:l.y-n},this._mouseDownLocation={x:e.pageX,y:e.pageY},this._thumbPositionAtDragStart=n,this._valueAtDragStart=this.get("value")):c<n?(this.decrementProperty("value",o),this.startMouseDownTimer("page")):(this.incrementProperty("value",o),this.startMouseDownTimer("page"))}return YES},mouseUp:function(e){var t=this._scs_buttonActive,n=NO,r;return t&&(t.removeClass("active"),n=YES),r=this._mouseDownTimer,r&&(r.invalidate(),this._mouseDownTimer=null),this._thumbDragging=NO,this._isScrollingDown=NO,this._isScrollingUp=NO,n},mouseDragged:function(e)
{var t,n,r,i,s=e.target,o=this._thumbPositionAtDragStart,u=this._isScrollingUp,a=this._isScrollingDown,f=this._scs_buttonActive,l;if(this._thumbDragging){switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:r=e.pageY-this._mouseDownLocation.y;break;case SC.LAYOUT_HORIZONTAL:r=e.pageX-this._mouseDownLocation.x}if(e.altKey){if(!this._altIsDown||this._shiftIsDown!==e.shiftKey)o=this._thumbPositionAtDragStart=o+r,r=0,this._mouseDownLocation={x:e.pageX,y:e.pageY},this._valueAtDragStart=this.get("value");e.shiftKey&&(r=-r),this.set("value",Math.round(this._valueAtDragStart+r*2))}else i=o+r,n=this.get("trackLength")-this.get("thumbLength"),this.set("value",Math.round(i/n*this.get("maximum")))}else if(u||a){var c=NO,h=NO,p=this.$(".button-top")[0].getBoundingClientRect(),d=this.$(".button-bottom")[0].getBoundingClientRect();switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:e.clientY<p.bottom?c=YES:h=YES;break;case SC.LAYOUT_HORIZONTAL:e.clientX<p.right?c=YES:h=YES}(c||h)&&c!==u&&(f&&f.removeClass("active"),this._mouseDownTimerAction=c?"scrollUp":"scrollDown",c?this.makeButtonActive(".button-top"):h&&this.makeButtonActive(".button-bottom"),this._isScrollingUp=c,this._isScrollingDown=h)}return this._altIsDown=e.altKey,this._shiftIsDown=e.shiftKey,YES},startMouseDownTimer:function(e,t){var n;this._mouseDownTimerAction=e,this._mouseDownTimer=SC.Timer.schedule({target:this,action:this.mouseDownTimerDidFire,interval:t?0:300})},mouseDownTimerDidFire:function(){var e=this.get("scrollerLength"),t=SC.device.get("mouseLocation"),n=this.get("thumbPosition"),r=this.get("thumbLength"
),i=50;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:t=this.convertFrameFromView(t).y;break;case SC.LAYOUT_HORIZONTAL:t=this.convertFrameFromView(t).x}switch(this._mouseDownTimerAction){case"scrollDown":this.incrementProperty("value",this._altIsDown?e:30);break;case"scrollUp":this.decrementProperty("value",this._altIsDown?e:30);break;case"page":i=150,t<n?this.decrementProperty("value",e):t>n+r&&this.incrementProperty("value",e)}this._mouseDownTimer=SC.Timer.schedule({target:this,action:this.mouseDownTimerDidFire,interval:i})},makeButtonActive:function(e){this._scs_buttonActive=this.$(e).addClass("active")}}),SC.TouchScrollerView=SC.ScrollerView.extend({classNames:["sc-touch-scroller-view"],scrollbarThickness:12,capLength:5,capOverlap:0,hasButtons:NO,buttonOverlap:36,adjustThumb:function(e,t,n){var r=this.$(".thumb-inner"),i=this.get("scrollerLength"),s=this.get("minimum");t+n>i&&(t=Math.min(i-20,t),n=i-t),t<s&&(n-=s-t,t=s);switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:this._thumbPosition!==t&&e.css("-webkit-transform","translate3d(0px,"+t+"px,0px)"),this._thumbSize!==n&&r.css("-webkit-transform","translate3d(0px,"+Math.round(n-1044)+"px,0px)");break;case SC.LAYOUT_HORIZONTAL:this._thumbPosition!==t&&e.css("-webkit-transform","translate3d("+t+"px,0px,0px)"),this._thumbSize!==n&&r.css("-webkit-transform","translate3d("+Math.round(n-1044)+"px,0px,0px)")}this._thumbPosition=t,this._thumbSize=n},render:function(e,t){var n=this._classNames,r=this.get("layoutDirection"),i,s,o,u,a,f,l,c,h;n["sc-vertical"]=r===SC.LAYOUT_VERTICAL,n["sc-horizontal"]=r===SC.LAYOUT_HORIZONTAL
,n.disabled=!this.get("isEnabled"),n["controls-hidden"]=this.get("controlsHidden"),e.setClass(n),s=this.get("thumbLength"),i=this.get("thumbPosition");if(t)e.push('<div class="track"></div>'),this.renderButtons(e,this.get("hasButtons")),this.renderThumb(e,this.get("layoutDirection"),s);else{if(this.get("controlsHidden"))return;u=this.$(".thumb"),this.adjustThumb(u,i,s)}},renderThumb:function(e,t,n){n-=1044,t=t===SC.LAYOUT_HORIZONTAL?"X":"Y",e.push('<div class="thumb"><div class="thumb-top"></div><div class="thumb-clip">'+'<div class="thumb-inner" style="-webkit-transform: translate%@(%@px);">'.fmt(t,n)+'<div class="thumb-center"></div>'+'<div class="thumb-bottom"></div></div></div></div>')}}),SC.NORMAL_SCROLL_DECELERATION=.95,SC.FAST_SCROLL_DECELERATION=.85,SC.ScrollView=SC.View.extend({classNames:["sc-scroll-view"],isScrollable:YES,contentView:null,horizontalAlign:SC.ALIGN_LEFT,verticalAlign:SC.ALIGN_TOP,horizontalScrollOffset:function(e,t){if(t!==undefined){var n=this.minimumHorizontalScrollOffset(),r=this.get("maximumHorizontalScrollOffset");this._scroll_horizontalScrollOffset=Math.max(n,Math.min(r,t)),this.childViews&&this.horizontalScrollerView&&this.horizontalScrollerView.isObject&&this.horizontalScrollerView.set("value",this._scroll_horizontalScrollOffset||0)}return this._scroll_horizontalScrollOffset||0}.property().cacheable(),verticalScrollOffset:function(e,t){if(t!==undefined){var n=this.get("minimumVerticalScrollOffset"),r=this.get("maximumVerticalScrollOffset");this._scroll_verticalScrollOffset=Math.max(n,Math.min(r,t)),this.childViews&&this.verticalScrollerView&&
this.verticalScrollerView.isObject&&this.verticalScrollerView.set("value",this._scroll_verticalScrollOffset||0)}return this._scroll_verticalScrollOffset||0}.property().cacheable(),maximumScrollOffset:function(e,t,n){return e>=t?e-t:n===SC.ALIGN_LEFT||n===SC.ALIGN_TOP?0:n===SC.ALIGN_MIDDLE||n===SC.ALIGN_CENTER?0-Math.round((t-e)/2):0-(t-e)},minimumScrollOffset:function(e,t,n){return e>t?0:n===SC.ALIGN_LEFT||n===SC.ALIGN_TOP?0:n===SC.ALIGN_MIDDLE||n===SC.ALIGN_CENTER?0-Math.round((t-e)/2):0-(t-e)},maximumHorizontalScrollOffset:function(){var e=this.get("contentView"),t=e?e.get("frame").width:0,n=e?e.get("calculatedWidth"):0;n&&(t=e.calculatedWidth),t*=this._scale;var r=this.get("containerView").get("frame").width;return this.get("canScrollHorizontal")||(t=Math.min(t,r)),this.maximumScrollOffset(t,r,this.get("horizontalAlign"))}.property(),maximumVerticalScrollOffset:function(){var e=this.get("contentView"),t=e&&e.get("frame")?e.get("frame").height:0,n=e?e.get("calculatedHeight"):0;n&&(t=n),t*=this._scale;var r=this.get("containerView").get("frame").height;return this.get("canScrollVertical")||(t=Math.min(t,r)),this.maximumScrollOffset(t,r,this.get("verticalAlign"))}.property(),minimumHorizontalScrollOffset:function(){var e=this.get("contentView"),t=e?e.get("frame").width:0,n=e?e.get("calculatedWidth"):0;n&&(t=n),t*=this._scale;var r=this.get("containerView").get("frame").width;return this.get("canScrollHorizontal")||(t=Math.min(t,r)),this.minimumScrollOffset(t,r,this.get("horizontalAlign"))}.property(),minimumVerticalScrollOffset:function(){var e=this.get("contentView"),t=e&&e
.get("frame")?e.get("frame").height:0,n=e?e.get("calculatedHeight"):0;n&&(t=e.calculatedHeight),t*=this._scale;var r=this.get("containerView").get("frame").height;return this.get("canScrollVertical")||(t=Math.min(t,r)),this.minimumScrollOffset(t,r,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(){return SC.platform.touch?YES:NO}.property().cacheable(),horizontalOverlay:function(){return SC.platform.touch?YES:NO}.property().cacheable(),verticalScrollerLayout:null,horizontalScrollerLayout:null,containerView:SC.ContainerView.extend({}),scrollTo:function(e,t){return t===undefined&&SC.typeOf(e)===SC.T_HASH&&
(t=e.y,e=e.x),SC.none(e)||this.set("horizontalScrollOffset",e),SC.none(t)||this.set("verticalScrollOffset",t),this},scrollBy:function(e,t){return t===undefined&&SC.typeOf(e)===SC.T_HASH&&(t=e.y,e=e.x),e=e?this.get("horizontalScrollOffset")+e:null,t=t?this.get("verticalScrollOffset")+t:null,this.scrollTo(e,t)},scrollToVisible:function(e){if(arguments.length===0)return arguments.callee.base.apply(this,arguments);var t=this.get("contentView");if(!t)return NO;var n=e.get("frame");return n?(n=t.convertFrameFromView(n,e.get("parentView")),this.scrollToRect(n)):NO},scrollToRect:function(e){var t=SC.cloneRect(this.get("containerView").get("frame"));t.x=this.get("horizontalScrollOffset"),t.y=this.get("verticalScrollOffset");var n=t.x,r=t.y;return t.y-=Math.max(0,SC.minY(t)-SC.minY(e)),t.x-=Math.max(0,SC.minX(t)-SC.minX(e)),t.y+=Math.max(0,SC.maxY(e)-SC.maxY(t)),t.x+=Math.max(0,SC.maxX(e)-SC.maxX(t)),n!==t.x||r!==t.y?(this.scrollTo(t.x,t.y),YES):NO},scrollDownLine:function(e){return e===undefined&&(e=1),this.scrollBy(null,this.get("verticalLineScroll")*e)},scrollUpLine:function(e){return e===undefined&&(e=1),this.scrollBy(null,0-this.get("verticalLineScroll")*e)},scrollRightLine:function(e){return e===undefined&&(e=1),this.scrollTo(this.get("horizontalLineScroll")*e,null)},scrollLeftLine:function(e){return e===undefined&&(e=1),this.scrollTo(0-this.get("horizontalLineScroll")*e,null)},scrollDownPage:function(e){return e===undefined&&(e=1),this.scrollBy(null,this.get("verticalPageScroll")*e)},scrollUpPage:function(e){return e===undefined&&(e=1),this.scrollBy(null,0-this.get("verticalPageScroll"
)*e)},scrollRightPage:function(e){return e===undefined&&(e=1),this.scrollBy(this.get("horizontalPageScroll")*e,null)},scrollLeftPage:function(e){return e===undefined&&(e=1),this.scrollBy(0-this.get("horizontalPageScroll")*e,null)},tile:function(){var e=this.get("hasHorizontalScroller")?this.get("horizontalScrollerView"):null,t=e&&this.get("isHorizontalScrollerVisible"),n=this.get("hasVerticalScroller")?this.get("verticalScrollerView"):null,r=n&&this.get("isVerticalScrollerVisible"),i=this.get("containerView"),s={left:0,top:0},o,u,a,f,l,c,h=t?e.get("scrollbarThickness"):0,p=r?n.get("scrollbarThickness"):0;t?(c=this.get("horizontalScrollerLayout"),u={left:c?c.left:0,bottom:c?c.bottom:0,right:c?c.right+p-1:p-1,height:h},e.set("layout",u),f=this.get("horizontalOverlay"),s.bottom=f?0:u.bottom+h):s.bottom=0,e&&e.set("isVisible",t),r?(h+=this.get("verticalScrollerBottom"),l=this.get("verticalScrollerLayout"),u={top:l?l.top:0,bottom:l?l.bottom+h:h,right:l?l.right:0,width:p},n.set("layout",u),a=this.get("verticalOverlay"),s.right=a?0:u.right+p):s.right=0,n&&n.set("isVisible",r),i.adjust(s)},scrollerVisibilityDidChange:function(){this.tile()}.observes("isVerticalScrollerVisible","isHorizontalScrollerVisible"),_scroll_wheelDeltaX:0,_scroll_wheelDeltaY:0,mouseWheel:function(e){return this._scroll_wheelDeltaX+=e.wheelDeltaX,this._scroll_wheelDeltaY+=e.wheelDeltaY,this.invokeLater(this._scroll_mouseWheel,10),this.get("canScrollHorizontal")||this.get("canScrollVertical")},_scroll_mouseWheel:function(){this.scrollBy(this._scroll_wheelDeltaX,this._scroll_wheelDeltaY),SC.WHEEL_MOMENTUM&&this.
_scroll_wheelDeltaY>0?(this._scroll_wheelDeltaY=Math.floor(this._scroll_wheelDeltaY*.95),this._scroll_wheelDeltaY=Math.max(this._scroll_wheelDeltaY,0),this.invokeLater(this._scroll_mouseWheel,10)):SC.WHEEL_MOMENTUM&&this._scroll_wheelDeltaY<0?(this._scroll_wheelDeltaY=Math.ceil(this._scroll_wheelDeltaY*.95),this._scroll_wheelDeltaY=Math.min(this._scroll_wheelDeltaY,0),this.invokeLater(this._scroll_mouseWheel,10)):(this._scroll_wheelDeltaY=0,this._scroll_wheelDeltaX=0)},_handleDomScrollEvent:function(e){var t=this.$(e.target);this.setIfChanged("verticalScrollOffset",t.scrollTop()),this.setIfChanged("horizontalScrollOffset",t.scrollLeft())},didCreateLayer:function(){var e=this.containerView.$()[0];SC.Event.add(e,"scroll",this,this._handleDomScrollEvent)},willDestroyLayer:function(){var e=this.containerView.$()[0];SC.Event.remove(e,"scroll",this,this._handleDomScrollEvent)},canScale:NO,_scale:1,scale:function(e,t){return t!==undefined&&(this._scale=Math.min(Math.max(this.get("minimumScale"),t),this.get("maximumScale"))),this._scale}.property().cacheable(),minimumScale:.25,maximumScale:2,autoScaleRange:NO,_scale_css:"",updateScale:function(e){var t=this.get("contentView");if(!t)return;t.isScalable?(this.get("contentView").applyScale(e),this._scale_css=""):this._scale_css="scale3d("+e+", "+e+", 1)"},acceptsMultitouch:YES,decelerationRate:SC.NORMAL_SCROLL_DECELERATION,alwaysBounceHorizontal:NO,alwaysBounceVertical:YES,delaysContentTouches:YES,_touchScrollDidChange:function(){this.get("contentView").touchScrollDidChange&&this.get("contentView").touchScrollDidChange(this._scroll_horizontalScrollOffset
,this._scroll_verticalScrollOffset),this.verticalScrollerView&&this.verticalScrollerView.touchScrollDidChange&&this.verticalScrollerView.touchScrollDidChange(this._scroll_verticalScrollOffset),this.horizontalScrollerView&&this.horizontalScrollerView.touchScrollDidChange&&this.horizontalScrollerView.touchScrollDidChange(this._scroll_horizontalScrollOffset)},_touchScrollDidStart:function(){this.get("contentView").touchScrollDidStart&&this.get("contentView").touchScrollDidStart(this._scroll_horizontalScrollOffset,this._scroll_verticalScrollOffset),this.verticalScrollerView&&this.verticalScrollerView.touchScrollDidStart&&this.verticalScrollerView.touchScrollDidStart(this._touch_verticalScrollOffset),this.horizontalScrollerView&&this.horizontalScrollerView.touchScrollDidStart&&this.horizontalScrollerView.touchScrollDidStart(this._touch_horizontalScrollOffset)},_touchScrollDidEnd:function(){this.get("contentView").touchScrollDidEnd&&this.get("contentView").touchScrollDidEnd(this._scroll_horizontalScrollOffset,this._scroll_verticalScrollOffset),this.verticalScrollerView&&this.verticalScrollerView.touchScrollDidEnd&&this.verticalScrollerView.touchScrollDidEnd(this._touch_verticalScrollOffset),this.horizontalScrollerView&&this.horizontalScrollerView.touchScrollDidEnd&&this.horizontalScrollerView.touchScrollDidEnd(this._touch_horizontalScrollOffset)},_applyCSSTransforms:function(e){var t="";this.updateScale(this._scale),t+="translate3d("+ -this._scroll_horizontalScrollOffset+"px, "+ -Math.round(this._scroll_verticalScrollOffset)+"px,0) ",t+=this._scale_css;if(e){var n=e.style;n.webkitTransform=
t,n.webkitTransformOrigin="top left"}},captureTouch:function(e){return YES},touchGeneration:0,touchStart:function(e){var t=++this.touchGeneration;return!this.tracking&&this.get("delaysContentTouches")?this.invokeLater(this.beginTouchesInContent,150,t):this.tracking||this.invokeLater(this.beginTouchesInContent,1,t),this.beginTouchTracking(e,YES),YES},beginTouchesInContent:function(e){if(e!==this.touchGeneration)return;var t=this.touch,n;t&&this.tracking&&!this.dragging&&!t.touch.scrollHasEnded&&(t.touch.captureTouch(this,YES),t.touch.touchResponder?t.needsScrollEnd&&this._touchScrollDidEnd():t.touch.makeTouchResponder(this))},beginTouchTracking:function(e,t){var n=e.averagedTouchesForView(this,t),r=this._scroll_verticalScrollOffset||0,i=this._scroll_horizontalScrollOffset||0,s=i,o=r,u=NO,a=0,f=0,l,c;this.touch&&this.touch.timeout&&(clearTimeout(this.touch.timeout),this.touch.timeout=null,s=this.touch.startClipOffset.x,o=this.touch.startClipOffset.y,u=YES),c=this.get("contentView"),c&&(l=c.get("frame"),a=l.width,f=l.height),c.calculatedWidth&&c.calculatedWidth!==0&&(a=c.calculatedWidth),c.calculatedHeight&&c.calculatedHeight!==0&&(f=c.calculatedHeight);var h=this.get("containerView").get("frame"),p=h.width,d=h.height,v=this.convertFrameToView(this.get("frame"),null),m=(i+(n.x-v.x))/this._scale,g=(r+(n.y-v.y))/this._scale;this.touch={startTime:e.timeStamp,notCalculated:YES,enableScrolling:{x:a*this._scale>p||this.get("alwaysBounceHorizontal"),y:f*this._scale>d||this.get("alwaysBounceVertical")},scrolling:{x:NO,y:NO},enableBouncing:SC.platform.bounceOnScroll,startClipOffset:{x:s
,y:o},lastScrollOffset:{x:i,y:r},startTouchOffset:{x:n.x,y:n.y},scrollVelocity:{x:0,y:0},startTouchOffsetInContent:{x:m,y:g},containerSize:{width:p,height:d},contentSize:{width:a,height:f},startScale:this._scale,startDistance:n.d,canScale:this.get("canScale")&&SC.platform.pinchToZoom,minimumScale:this.get("minimumScale"),maximumScale:this.get("maximumScale"),globalFrame:v,layer:c.get("layer"),resistanceCoefficient:.998,resistanceAsymptote:320,decelerationFromEdge:.05,accelerationToEdge:.1,scrollTolerance:{x:15,y:15},scaleTolerance:5,secondaryScrollTolerance:30,scrollLock:500,decelerationRate:this.get("decelerationRate"),lastEventTime:e.timeStamp,touch:t?e:this.touch?this.touch.touch:null,needsScrollEnd:u},this.tracking||(this.tracking=YES,this.dragging=NO)},_adjustForEdgeResistance:function(e,t,n,r,i){var s;if(e<t)s=e-t;else{if(!(e>n))return e;s=n-e}return s=Math.pow(r,Math.abs(s))*i,e<t?s-=i:s=-s+i,Math.min(Math.max(t,e),n)+s},touchesDragged:function(e,t){var n=e.averagedTouchesForView(this);this.updateTouchScroll(n.x,n.y,n.d,e.timeStamp)},updateTouchScroll:function(e,t,n,r){var i=this.touch,s=e-i.globalFrame.x,o=t-i.globalFrame.y,u,a,f,l,c,h,p=i.scrolling,d=this.get("horizontalAlign"),v=this.get("verticalAlign"),m=((this._scroll_horizontalScrollOffset||0)+s)/this._scale,g=((this._scroll_verticalScrollOffset||0)+o)/this._scale,y=m-i.startTouchOffset.x,b=g-i.startTouchOffset.y,w=i.dragging;!p.x&&Math.abs(y)>i.scrollTolerance.x&&i.enableScrolling.x&&(w=YES,p.x=YES,i.scrollTolerance.y=i.secondaryScrollTolerance,i.startTouchOffset.x=e,y=0),!p.y&&Math.abs(b)>i.scrollTolerance.y&&
i.enableScrolling.y&&(w=YES,p.y=YES,i.scrollTolerance.x=i.secondaryScrollTolerance,i.startTouchOffset.y=t,b=0),w&&!i.dragging&&(i.dragging=YES,this.dragging=YES,this._touchScrollDidStart());if(!p.x&&!p.y&&!i.canScale)return;p.x&&!p.y&&y>i.scrollLock&&!p.y&&(i.enableScrolling.y=NO),p.y&&!p.x&&b>i.scrollLock&&!p.x&&(i.enableScrolling.x=NO);if(i.canScale){var E=i.startDistance,S=n-E;if(Math.abs(S)>i.scaleTolerance){p.y=YES,p.x=YES;var x=i.startScale*(n/Math.max(E,50)),T=this._adjustForEdgeResistance(x,i.minimumScale,i.maximumScale,i.resistanceCoefficient,i.resistanceAsymptote);this.dragging=YES,this._scale=T;var N=m*this._scale,C=g*this._scale}}c=this.minimumScrollOffset(i.contentSize.width*this._scale,i.containerSize.width,d),h=this.minimumScrollOffset(i.contentSize.height*this._scale,i.containerSize.height,v),l=this.maximumScrollOffset(i.contentSize.width*this._scale,i.containerSize.width,d),a=this.maximumScrollOffset(i.contentSize.height*this._scale,i.containerSize.height,v),f=i.startTouchOffsetInContent.x*this._scale-s,u=i.startTouchOffsetInContent.y*this._scale-o,i.enableBouncing?(f=this._adjustForEdgeResistance(f,c,l,i.resistanceCoefficient,i.resistanceAsymptote),u=this._adjustForEdgeResistance(u,h,a,i.resistanceCoefficient,i.resistanceAsymptote)):(f=Math.max(c,Math.min(l,f)),u=Math.max(h,Math.min(a,u))),p.x&&(this._scroll_horizontalScrollOffset=f),p.y&&(this._scroll_verticalScrollOffset=u),this._applyCSSTransforms(i.layer),this._touchScrollDidChange();if(r-i.lastEventTime>=1||i.notCalculated){i.notCalculated=NO;var k=this._scroll_horizontalScrollOffset,L=this._scroll_verticalScrollOffset
;i.scrollVelocity.x=(k-i.lastScrollOffset.x)/Math.max(1,r-i.lastEventTime),i.scrollVelocity.y=(L-i.lastScrollOffset.y)/Math.max(1,r-i.lastEventTime),i.lastScrollOffset.x=k,i.lastScrollOffset.y=L,i.lastEventTime=r}},touchEnd:function(e){var t=this.touch,n=e.averagedTouchesForView(this);e.scrollHasEnded=YES,n.touchCount>0?this.beginTouchTracking(e,NO):(this.dragging?(t.dragging=NO,t.lastEventTime=e.timeStamp,this.startDecelerationAnimation()):(t.needsScrollEnd&&this._touchScrollDidEnd(),e.captureTouch(this,YES),e.touchResponder&&e.touchResponder!==this?e.end():(!e.touchResponder||e.touchResponder===this)&&e.nextTouchResponder&&e.makeTouchResponder(e.nextTouchResponder),this.touch=null),this.tracking=NO,this.dragging=NO)},touchCancelled:function(e){var t=this.touch,n=e.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,this.dragging&&this._touchScrollDidEnd(),this.dragging=NO,this.touch=null},startDecelerationAnimation:function(e){var t=this.touch;t.decelerationVelocity={x:t.scrollVelocity.x*10,y:t.scrollVelocity.y*10},this.decelerateAnimation()},bouncyBounce:function(e,t,n,r,i,s,o){return t<n?e<0?e+=(n-t)*i:e=Math.min((n-t)*s+o,n-t-.01):t>r&&(e>0?e-=(t-r)*i:e=-Math.min((t-r)*s+o,t-r-.01)),e},decelerateAnimation:function(){var e=this.touch,t=this._scale,n=e.contentSize,r=e.containerSize,i=this.get("horizontalAlign"),s=this.get("verticalAlign"
),o=this.minimumScrollOffset(n.width*this._scale,r.width,i),u=this.minimumScrollOffset(n.height*this._scale,r.height,s),a=this.maximumScrollOffset(n.width*this._scale,r.width,i),f=this.maximumScrollOffset(n.height*this._scale,r.height,s),l=Date.now(),c=Math.max(l-e.lastEventTime,1),h=this._scroll_horizontalScrollOffset+e.decelerationVelocity.x*(c/10),p=this._scroll_verticalScrollOffset+e.decelerationVelocity.y*(c/10),d=e.decelerationFromEdge,v=e.accelerationToEdge,m=!e.enableBouncing,g=!e.enableBouncing;h>=o&&h<=a&&(m=YES),p>=u&&p<=f&&(g=YES),h/=this._scale,p/=this._scale;var y=0;y=this.bouncyBounce(y,t,e.minimumScale,e.maximumScale,d,v,0),this._scale=t+=y,h*=this._scale,p*=this._scale,o=this.minimumScrollOffset(n.width*this._scale,r.width,i),u=this.minimumScrollOffset(n.height*this._scale,r.height,s),a=this.maximumScrollOffset(n.width*this._scale,r.width,i),f=this.maximumScrollOffset(n.height*this._scale,r.height,s),m&&(h<o||h>a)&&(h=Math.max(o,Math.min(h,a)),e.decelerationVelocity.x=0),g&&(p<u||p>f)&&(p=Math.max(u,Math.min(p,f)),e.decelerationVelocity.y=0),this._scroll_horizontalScrollOffset=h,this._scroll_verticalScrollOffset=p,this._applyCSSTransforms(e.layer),this._touchScrollDidChange();var b=e.decelerationRate,w=Math.pow(b,c/10);e.decelerationVelocity.y*=w,e.decelerationVelocity.x*=w,e.decelerationVelocity.x=this.bouncyBounce(e.decelerationVelocity.x,h,o,a,d,v,.3),e.decelerationVelocity.y=this.bouncyBounce(e.decelerationVelocity.y,p,u,f,d,v,.3);var E=Math.abs(e.decelerationVelocity.x),S=Math.abs(e.decelerationVelocity.y);if(S<.05&&E<.05&&Math.abs(y)<.05){e.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 x=this;e.lastEventTime=Date.now(),this.touch.timeout=setTimeout(function(){SC.run(x.decelerateAnimation(),x)},30)},createChildViews:function(){var e=[],t;SC.none(t=this.containerView)&&(t=SC.ContainerView),e.push(this.containerView=this.createChildView(t,{contentView:this.contentView,isScrollContainer:YES})),this.contentView=this.containerView.get("contentView"),t=SC.platform.touch?this.get("horizontalTouchScrollerView"):this.get("horizontalScrollerView"),t&&(this.get("hasHorizontalScroller")?(t=this.horizontalScrollerView=this.createChildView(t,{layoutDirection:SC.LAYOUT_HORIZONTAL,valueBinding:"*owner.horizontalScrollOffset"}),e.push(t)):this.horizontalScrollerView=null),t=SC.platform.touch?this.get("verticalTouchScrollerView"):this.get("verticalScrollerView"),t&&(this.get("hasVerticalScroller")?(t=this.verticalScrollerView=this.createChildView(t,{layoutDirection:SC.LAYOUT_VERTICAL,valueBinding:"*owner.verticalScrollOffset"}),e.push(t)):this.verticalScrollerView=null),this.childViews=e,this.contentViewDidChange(),this.tile()},init:function(){arguments.callee.base.apply(this,arguments),this._scroll_contentView=this.get("contentView");var e=this._scroll_contentView;e&&(e.addObserver("frame",this,this.contentViewFrameDidChange),e.addObserver("calculatedWidth",this,this.contentViewFrameDidChange),e.addObserver
("calculatedHeight",this,this.contentViewFrameDidChange)),this.get("isVisibleInWindow")&&this._scsv_registerAutoscroll()},_scsv_registerAutoscroll:function(){this.get("isVisibleInWindow")?SC.Drag.addScrollableView(this):SC.Drag.removeScrollableView(this)}.observes("isVisibleInWindow"),contentViewDidChange:function(){var e=this.get("contentView"),t=this._scroll_contentView,n=this.contentViewFrameDidChange,r=this.contentViewLayerDidChange;e!==t&&(t&&(t.removeObserver("calculatedWidth",this,this.contentViewFrameDidChange),t.removeObserver("calculatedHeight",this,this.contentViewFrameDidChange),t.removeObserver("frame",this,n),t.removeObserver("layer",this,r)),this._scroll_contentView=e,e&&(e.addObserver("frame",this,n),e.addObserver("calculatedWidth",this,this.contentViewFrameDidChange),e.addObserver("calculatedHeight",this,this.contentViewFrameDidChange),e.addObserver("layer",this,r)),this.containerView.set("contentView",e),this.contentViewFrameDidChange())}.observes("contentView"),render:function(e,t){return this.invokeLast(this.adjustElementScroll),t&&e.push('<div class="corner"></div>'),arguments.callee.base.apply(this,arguments)},oldMaxHOffset:0,oldMaxVOffset:0,contentViewFrameDidChange:function(e){var t=this.get("contentView"),n=t?t.get("frame"):null,r=this._scale,i=0,s=0,o,u,a,f,l;if(!t||!n)return;i=t.get("calculatedWidth")||n.width||0,s=t.get("calculatedHeight")||n.height||0,i*=r,s*=r;if(!e&&i===this._scroll_contentWidth&&s===this._scroll_contentHeight)return;this._scroll_contentWidth=i,this._scroll_contentHeight=s,o=this.getPath("containerView.frame"),u=o.width,a=o.height
,this.get("hasHorizontalScroller")&&(t=this.get("horizontalScrollerView"))&&(this.get("autohidesHorizontalScroller")&&this.set("isHorizontalScrollerVisible",i>u),t.setIfChanged("maximum",i-u),t.setIfChanged("proportion",u/i)),this.get("hasVerticalScroller")&&(t=this.get("verticalScrollerView"))&&(this.get("autohidesVerticalScroller")&&this.set("isVerticalScrollerVisible",s>a),t.setIfChanged("maximum",s-a),t.setIfChanged("proportion",a/s)),!this.get("isVerticalScrollerVisible")&&this.get("verticalScrollOffset")!==0&&this.get("autohidesVerticalScroller")&&this.set("verticalScrollOffset",0),!this.get("isHorizontalScrollerVisible")&&this.get("horizontalScrollOffset")!==0&&this.get("autohidesHorizontalScroller")&&this.set("horizontalScrollOffset",0);var c=this.get("maximumVerticalScrollOffset"),h=this.get("verticalScrollOffset"),p=this.get("maximumHorizontalScrollOffset"),d=this.get("horizontalScrollOffset"),v=c<h,m=p<d;(v||m)&&this.forceDimensionsRecalculation(m,v,h,d),this.notifyPropertyChange("maximumVerticalScrollOffset"),this.notifyPropertyChange("maximumHorizontalScrollOffset")},frameDidChange:function(){this.contentViewFrameDidChange(YES)}.observes("frame"),contentViewLayerDidChange:function(){this._verticalScrollOffset!==0&&(this._verticalScrollOffset=-1),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 e=this.get("containerView"),t=this.get("contentView"),n=this.get("verticalScrollOffset"),r=this.get("horizontalScrollOffset");t&&(SC.platform.touch&&this._applyCSSTransforms(t.get("layer")),t._viewFrameDidChange&&t._viewFrameDidChange()),e&&!SC.platform.touch&&(e=e.$()[0],e&&(n!==this._verticalScrollOffset&&(e.scrollTop=n,this._verticalScrollOffset=n),r!==this._horizontalScrollOffset&&(e.scrollLeft=r,this._horizontalScrollOffset=r)))},forceDimensionsRecalculation:function(e,t,n,r){var i=r,s=n;this.scrollTo(0,0),e&&t&&this.scrollTo(this.get("maximumHorizontalScrollOffset"),this.get("maximumVerticalScrollOffset")),e&&!t&&this.scrollTo(this.get("maximumHorizontalScrollOffset"),s),!e&&t&&this.scrollTo(i,this.get("maximumVerticalScrollOffset"))},_scroll_verticalScrollOffset:0,_scroll_horizontalScrollOffset:0}),SC.MenuScrollerView=SC.ScrollerView.extend({classNames:["sc-menu-scroller-view"],scrollDown:NO,value:function(e,t){if(t===undefined){var n=this._value||0;return Math.min(n,this.get("maximum"))}this._value=t}.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)}return arguments.callee.base.apply(this,arguments)},render:function(e,t){e.addClass("sc-vertical"),e.addClass(this.get("controlSize"));if(t){var n=this.get("scrollDown")?"arrowDown":"arrowUp";e.push('<span class="scrollArrow '+n+'">&nbsp;</span>')}e.setClass("disabled",!this.get("isEnabled"))},didCreateLayer:function(){},willDestroyLayer:function(){var e=this._sc_scroller_scrollDidChange;SC.Event.remove(this.$(),"scroll",this,e)},mouseEntered:function(e){this.set("isMouseOver",YES),this._invokeScrollOnMouseOver()},mouseExited:function(e){this.set("isMouseOver",NO)},_sc_scroller_valueDidChange:function(){}.observes("value"),_sc_scroller_armScrollTimer:function(){if(!this._sc_scrollTimer){SC.RunLoop.begin();var e=this._sc_scroller_scrollDidChange;this._sc_scrollTimer=this.invokeLater(e,50),SC.RunLoop.end()}},_sc_scroller_scrollDidChange:function(){var e=Date.now(),t=this._sc_lastScroll,n=this.get("layer"),r=0;if(t&&e-t<50)return this._sc_scroller_armScrollTimer();this._sc_scrollTimer=null,this._sc_lastScroll=e,SC.RunLoop.begin();if(!this.get("isEnabled"))return;this._sc_scrollValue=r=n.scrollTop,this.set("value",r),SC.RunLoop.end()},_scrollMenu:function(){var e=this.get("value"),t;return this.get("scrollDown")?(t=e+this.verticalLineScroll,t<=this.get("maximum")?this.set("value",t):this.set("value"
,this.get("maximum"))):(t=e-this.verticalLineScroll,t>=0?this.set("value",t):e<=this.verticalLineScroll&&e>0&&this.set("value",0)),YES},_invokeScrollOnMouseOver:function(){this._scrollMenu(),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(e){if(arguments.length===0)return arguments.callee.base.apply(this,arguments);var t=this.get("contentView");if(!t)return NO;var n=e.get("frame");if(!n)return NO;n=t.convertFrameFromView(n,e.get("parentView"));var r=this.get("verticalScrollerView2");r&&r.get("isVisible")&&(n.height+=r.get("frame").height);var i=this.get("verticalScrollerView");return i&&i.get("isVisible")&&(n.y-=i.get("frame").height),this.scrollToRect(n)},tile:function(){var e,t,n,r,i,s,o;e=this.get("hasVerticalScroller"),t=e?this.get("verticalScrollerView"
):null,n=e?this.get("verticalScrollerView2"):null,r=t&&this.get("isVerticalScrollerVisible"),i=this.get("containerView"),s={left:0,top:0};if(r){o=0;var u=t.get("scrollerThickness")||n.get("scrollerThickness"),a=this.get("contentView"),f,l=a?a.get("frame"):null,c=l?l.height:0,h=this.containerView.$()[0],p=this.get("verticalScrollOffset"),d={height:0,top:0,right:0,left:0},v={height:u,top:0,right:0,left:0},m={height:u,bottom:0,right:0,left:0},g={height:0,bottom:0,right:0,left:0};h&&(o=h.offsetHeight),p===0?(s.top=0,s.bottom=u,t.set("layout",d),n.set("layout",m)):p>=c-o-u?(s.top=u,s.bottom=0,t.set("layout",v),n.set("layout",g)):(s.top=u,s.bottom=u,t.set("layout",v),n.set("layout",m))}t&&(t.set("isVisible",r),n.set("isVisible",r)),i.set("layout",s)},scrollerVisibilityDidChange:function(){this.tile()}.observes("isVerticalScrollerVisible","isHorizontalScrollerVisible","verticalScrollOffset"),createChildViews:function(){var e=[],t,n,r=this.get("controlSize");SC.none(t=this.containerView)&&(t=SC.ContainerView),e.push(this.containerView=this.createChildView(t,{contentView:this.contentView})),this.contentView=this.containerView.get("contentView"),(t=this.verticalScrollerView)&&(n=this.verticalScrollerView2)&&(this.get("hasVerticalScroller")?(t=this.verticalScrollerView=this.createChildView(t,{layout:{top:0,left:0,right:0},controlSize:r,valueBinding:"*owner.verticalScrollOffset"}),e.push(t),n=this.verticalScrollerView2=this.createChildView(n,{scrollDown:YES,layout:{bottom:0,left:0,right:0},controlSize:r,valueBinding:"*owner.verticalScrollOffset"}),e.push(n)):(this.verticalScrollerView=null
,this.verticalScrollerView2=null)),this.childViews=e,this.contentViewFrameDidChange(),this.tile()},init:function(){arguments.callee.base.apply(this,arguments),this._scroll_contentView=this.get("contentView");var e=this._scroll_contentView;e&&e.addObserver("frame",this,this.contentViewFrameDidChange),this.get("isVisibleInWindow")&&this._scsv_registerAutoscroll()},_scsv_registerAutoscroll:function(){this.get("isVisibleInWindow")?SC.Drag.addScrollableView(this):SC.Drag.removeScrollableView(this)}.observes("isVisibleInWindow"),contentViewFrameDidChange:function(){var e=this.get("contentView"),t,n=e?e.get("frame"):null,r=n?n.width:0,i=n?n.height:0,s=this.get("frame"),o,u;this._scroll_contentWidth=r,this._scroll_contentHeight=i,this.get("hasVerticalScroller")&&(e=this.get("verticalScrollerView"))&&(t=this.get("verticalScrollerView2"))&&(i-=1,this.get("autohidesVerticalScroller")&&this.set("isVerticalScrollerVisible",i>s.height),i-=this.get("verticalScrollerBottom"),o=0,u=this.containerView.$()[0],u&&(o=u.offsetHeight),i-=o,e.setIfChanged("maximum",i),t.setIfChanged("maximum",i))},_scroll_horizontalScrollOffsetDidChange:function(){},_scroll_verticalScrollOffsetDidChange:function(){this.adjustElementScroll()}.observes("verticalScrollOffset")}),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(),this.get("shouldLoadInBackground")&&SC.backgroundTaskQueue.push(SC.PopupButtonMenuLoader.create
({popupButton:this}))},_setupMenu:function(){var e=this.get("instantiatedMenu");this.isActiveBinding&&this.isActiveBinding.disconnect(),this.isActiveBinding=null,e&&!e.isClass&&(this.isActiveBinding=this.bind("isActive",e,"isVisibleInWindow"))},_popup_menuDidChange:function(){this._setupMenu()}.observes("menu"),isActive:NO,_instantiateMenu:function(){var e=this.get("menu");if(!e||!e.isClass)return;this.menu=e.create(),this._setupMenu()},instantiatedMenu:function(){var e=this.get("menu");return e&&e.isClass&&(this._instantiateMenu(),e=this.get("menu")),e}.property("menu").cacheable(),action:function(e){var t=this.get("instantiatedMenu");return t?(t.popup(this,this.get("preferMatrix")),YES):NO},mouseDown:function(e){if(!this.get("isEnabled"))return YES;this._isMouseDown=YES,this._action(),this._menuRenderedTimestamp=0;var t=this;return setTimeout(function(){SC.run(function(){t._menuRenderedTimestamp=Date.now()})},1),this.becomeFirstResponder(),YES},mouseUp:function(e){var t=(new Date).getTime(),n=this._menuRenderedTimestamp,r=this.get("instantiatedMenu"),i=SC.platform.touch,s;return n===0&&(n=Date.now()),r&&(s=r.getPath("rootMenu.targetMenuItem"),s?s.performAction()||r.remove():!i&&t-n>SC.ButtonView.CLICK_AND_HOLD_DELAY&&r.remove()),this._isMouseDown=NO,arguments.callee.base.apply(this,arguments),YES},mouseExited:function(e){return YES},performKeyEquivalent:function(e,t){if(!this.get("isEnabled"))return NO;var n=this.get("instantiatedMenu");return!!n&&n.performKeyEquivalent(e,t,YES)}}),SC.PopupButtonMenuLoader=SC.Task.extend({popupButton:null,run:function(){this.popupButton&&this
.popupButton._instantiateMenu()}}),SC.SliderView=SC.View.extend(SC.Control,{classNames:"sc-slider-view",ariaRole:"slider",value:.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:.1,decimalPrecisionScale:10,trackMargin:0,isAdjustableByMouseWheel:YES,layoutDirection:SC.LAYOUT_HORIZONTAL,displayProperties:["displayValue","ariaValue","minimum","maximum","step","frame","layoutDirection"],acceptsFirstResponder:function(){return SC.FOCUS_ALL_CONTROLS?this.get("isEnabled"):NO}.property("isEnabled"),didBecomeFirstResponder:function(){this.$(".sc-handle").focus()},willLoseFirstResponder:function(){this.$(".sc-handle").blur()},ariaValue:function(){return this.get("value")}.property("value").cacheable(),renderDelegateName:"sliderRenderDelegate",displayValue:function(){var e=this.get("minimum"),t=this.get("maximum"),n=this.get("value"),r=this.get("step");return n=Math.min(Math.max(n,e),t),!SC.none(r)&&r!==0&&(n=Math.round(n/r)*r),n!==0&&(n=Math.floor((n-e)/(t-e)*100)),n}.property("value","minimum","maximum","step").cacheable(),_isMouseDown:NO,mouseDown:function(e){return this.get("isEnabled")?(this.set("isActive",YES),this._isMouseDown=YES,this.becomeFirstResponder(),this._triggerHandle(e,YES)):YES},mouseDragged:function(e){return this._isMouseDown?this._triggerHandle(e):YES},mouseUp:function(e){this._isMouseDown&&this.set("isActive",NO);var t=this._isMouseDown?this._triggerHandle(e):YES;return this._isMouseDown=
NO,t},mouseWheel:function(e){if(!this.get("isEnabled"))return YES;var t=this.get("minimum"),n=this.get("maximum"),r=this.get("step"),i=this.get("value")+(e.wheelDeltaX+e.wheelDeltaY)*r,s=Math.round(i/r)*r;return s<t?this.setIfChanged("value",t):s>n?this.setIfChanged("value",n):this.setIfChanged("value",s),YES},touchStart:function(e){return this.mouseDown(e)},touchEnd:function(e){return this.mouseUp(e)},touchesDragged:function(e){return this.mouseDragged(e)},_triggerHandle:function(e,t){var n=this.get("frame"),r=n.width,i=n.height,s=this.get("minimum"),o=this.get("maximum"),u=this.get("step"),a=this.get("value"),f=this.get("trackMargin"),l=this.get("layoutDirection"),c=l===SC.LAYOUT_HORIZONTAL,h,p;c?(p=r,t?(h=this.convertFrameFromView({x:e.pageX}).x,this._evtDiff=e.pageX-h):h=e.pageX-this._evtDiff):(p=i,t?(h=this.convertFrameFromView({y:e.pageY}).y,this._evtDiff=e.pageY-h):h=e.pageY-this._evtDiff),p-=2*f,h-=f,p<=0?(p=1,h=0):h/=p,c||(h=1-h);if(t){var d=this.get("value");d=(d-s)/(o-s),Math.abs(d*p-h*p)<16?this._offset=d-h:this._offset=0}h=Math.max(0,Math.min(h+this._offset,1)),h=s+(o-s)*h,u!==0&&(h=Math.round(h/u)*u);var v=this.get("decimalPrecisionScale");return h=Math.round(h*v)/v,Math.abs(a-h)>=.01&&this.set("value",h),YES},keyDown:function(e){if(e.which===9||e.keyCode===9){var t=e.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");return t?t.becomeFirstResponder():e.allowDefault(),YES}if(e.which>=33&&e.which<=40){var n=this.get("minimum"),r=this.get("maximum"),i=this.get("step"),s=r-n,o=0,u,a=this.get("value");if(e.which===34||e.which===37||e.which===40)
i===0?s<100?o=a-1:(u=Math.abs(s/100),u<2&&(u=2),o=a-u):o=Math.round((a-i)*10)/10;if(e.which===33||e.which===38||e.which===39)i===0?s<100?o=a+2:(u=Math.abs(s/100),u<2&&(u=2),o=a+u):o=Math.round((a+i)*10)/10;if(e.which===38||e.which===39)e.altKey||(o=a+i*10);if(e.which===37||e.which===40)e.altKey||(o=a-i*10);return e.which===33&&(o=a+i*100),e.which===34&&(o=a-i*100),e.which===35&&(o=r),e.which===36&&(o=n),o>=n&&o<=r?this.set("value",o):o<n?this.set("value",n):o>r&&this.set("value",r),YES}return e.allowDefault(),NO},contentKeys:{contentValueKey:"value",contentMinimumKey:"minimum",contentMaximumKey:"maximum",contentIsIndeterminateKey:"isIndeterminate"}}),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 e=this.get("layer"),t;return e?e.getBoundingClientRect&&!SC.browser.isIE8OrLower?(t=e.getBoundingClientRect(),{x:0,y:0,width:t.width,height:t.height}):{x:0,y:0,width:e.clientWidth,height:e.clientHeight}:{x:0,y:0,width:0,height:0}}.property("content").cacheable(),parentViewDidResize:function(){this.contentLayoutDidChange()},didUpdateLayer:function(){this.contentLayoutDidChange()},render:function(e,t){var n=this.get("content");n&&e.push(n||"")},touchStart:function(e){return e.allowDefault(),YES},touchEnd:function(e){return e.allowDefault(),YES}}),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 e=this.get("contentView");e&&(e=this.contentView=this.createChildView(e),e.set("layout",this.contentLayout),this.childViews=[e])},contentViewDidChange:function(){var e=this.get("contentView");e.set("layout",this.contentLayout),this.replaceContent(e)}.observes("contentView")}),SC.MIXED_STATE="__MIXED__",SC.DataSource=SC.Object.extend({fetch:function(e,t){return NO},retrieveRecords:function(e,t,n){return this._handleEach(e,t,this.retrieveRecord,n)},commitRecords:function(e,t,n,r,i){var s,o,u;return t.length>0&&(u=this.createRecords.call(this,e,t,i)),n.length>0&&(s=this.updateRecords.call(this,e,n,i),u=SC.none(u)?s:u===s?u:SC.MIXED_STATE),r.length>0&&(o=this.destroyRecords.call(this,e,r,i),u=SC.none(u)?o:u===o?u:SC.MIXED_STATE),u||NO},cancel:function(e,t){return NO},updateRecords:function(e,t,n){return this._handleEach(e,t,this.updateRecord,null,n)},createRecords:function(e,t,n){return this._handleEach(e,t,this.createRecord,null,n)},destroyRecords:function(e,t,n){return this._handleEach(e,t,this.destroyRecord,null,n)},_handleEach:function(e,t,n,r,i){var s=t.length,o,u,a,f;for(o=0;o<s;o++)f=r?r[o]:i,a=n.call(this,e,t[o],f),u===undefined?u=a:u===YES?u=a===YES?YES:SC.MIXED_STATE:u===NO&&(u=a===NO?NO:SC.MIXED_STATE);return SC.none(u)?null:u},updateRecord:function(e,t,n){return NO},retrieveRecord:function(e,t,n){return NO},createRecord:function(e,t,n){return NO},destroyRecord:function(e,t,n){return NO}}),SC.CascadeDataSource=SC.DataSource.extend({dataSources
:null,from:function(e){var t=this.get("dataSources");return t||this.set("dataSources",t=[]),t.push(e),this},fetch:function(e,t){var n=this.get("dataSources"),r=n?n.length:0,i=NO,s,o,u;for(u=0;i!==YES&&u<r;u++)o=n.objectAt(u),s=o.fetch?o.fetch.apply(o,arguments):NO,i=this._handleResponse(i,s);return i},retrieveRecords:function(e,t,n){var r=this.get("dataSources"),i=r?r.length:0,s=NO,o,u,a;for(a=0;s!==YES&&a<i;a++)u=r.objectAt(a),o=u.retrieveRecords.apply(u,arguments),s=this._handleResponse(s,o);return s},commitRecords:function(e,t,n,r,i){var s=this.get("dataSources"),o=s?s.length:0,u=NO,a,f,l;for(l=0;u!==YES&&l<o;l++)f=s.objectAt(l),a=f.commitRecords.apply(f,arguments),u=this._handleResponse(u,a);return u},cancel:function(e,t){var n=this.get("dataSources"),r=n?n.length:0,i=NO,s,o,u;for(u=0;i!==YES&&u<r;u++)o=n.objectAt(u),s=o.cancel.apply(o,arguments),i=this._handleResponse(i,s);return i},init:function(){arguments.callee.base.apply(this,arguments);var e=this.get("dataSources"),t=e?e.get("length"):0,n;while(--t>=0)n=e[t],SC.typeOf(n)===SC.T_STRING&&(e[t]=this.get(n))},_handleResponse:function(e,t){return t===YES?YES:e===NO?t===NO?NO:SC.MIXED_STATE:SC.MIXED_STATE}}),SC.Query=SC.Object.extend(SC.Copyable,SC.Freezable,{isQuery:YES,conditions:null,orderBy:null,recordType:null,recordTypes:null,expandedRecordTypes:function(){var e=SC.CoreSet.create(),t,n;return(t=this.get("recordType"))?this._scq_expandRecordType(t,e):(t=this.get("recordTypes"))?t.forEach(function(t){this._scq_expandRecordType(t,e)},this):this._scq_expandRecordType(SC.Record,e),n=SC.Query._scq_queriesWithExpandedRecordTypes
,n||(n=SC.Query._scq_queriesWithExpandedRecordTypes=SC.CoreSet.create()),n.add(this),e.freeze()}.property("recordType","recordTypes").cacheable(),_scq_expandRecordType:function(e,t){if(t.contains(e))return;t.add(e),SC.typeOf(e)===SC.T_STRING&&(e=SC.objectForPropertyPath(e)),e.subclasses.forEach(function(e){this._scq_expandRecordType(e,t)},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(e,t){var n,r=YES;if(n=this.get("recordTypes"))r=n.find(function(t){return SC.kindOf(e,t)});else if(n=this.get("recordType"))r=SC.kindOf(e,n);if(!r)return NO;var i=this.get("scope");return i&&!i.contains(e)?NO:(this._isReady||this.parse(),this._isReady?(t===undefined&&(t=this.parameters||this),this._tokenTree.evaluate(e,t)):NO)},containsRecordTypes:function(e){var t=this.get("recordType");return t?!!e.find(function(e){return SC.kindOf(e,t)}):(t=this.get("recordTypes"))?!!t.find(function(t){return!!e.find(function(e){return SC.kindOf(e,t)})}):YES},compare:function(e,t){var n=0,r,i,s,o;if(e===t)return 0;this._isReady||this.parse();if(!this._isReady)return SC.compare(e.get("id"),t.get("id"));i=this._order;if(SC.typeOf(i)===SC.T_FUNCTION)n=i.call(null,e,t);else{s=i?i.length:0;for(o=0;n===0&&o<s;o++)r=i[o].propertyName,SC.Query.comparisons[r]?n=SC.Query.comparisons[r](e.get(r),t.get(r)):n=SC.compare(e.get(r),t.get(r)),n!==0&&i[o].descending&&(n=-1*n)}return n!==0?n:SC.compare
(e.get("id"),t.get("id"))},_isReady:NO,parse:function(){var e=this.get("conditions"),t=this.get("queryLanguage"),n,r;n=this._tokenList=this.tokenizeString(e,t),r=this._tokenTree=this.buildTokenTree(n,t),this._order=this.buildOrder(this.get("orderBy")),this._isReady=!!r&&!r.error;if(r&&r.error)throw r.error;return this._isReady},queryWithScope:function(e){var t=SC.keyFor("__query__",SC.guidFor(this)),n=e[t];return n||(e[t]=n=this.copy(),n.set("scope",e),n.freeze()),n},copyKeys:["conditions","orderBy","recordType","recordTypes","parameters","location","scope"],concatenatedProperties:["copyKeys"],copy:function(){var e={},t=this.get("copyKeys"),n=t?t.length:0,r,i,s;while(--n>=0)r=t[n],i=this.get(r),i!==undefined&&(e[r]=i);return s=this.constructor.create(e),e=null,s},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,t){var n=this.tokenValue.split("."),r=n.length;if(r<2)return e.get(this.tokenValue);var i=e;for(var s=0;s<r;s++){if(!i)return;i.get?i=i.get(n[s]):i=i[n[s]]}return i}},NUMBER:{firstCharacter:/[\d\-]/,notAllowed:/[^\d\-\.]/,format:/^-?\d+$|^-?\d+\.\d+$/,evalType:"PRIMITIVE",evaluate:function(e,t){return parseFloat(this.tokenValue)}},STRING:{firstCharacter:/['"]/,delimeted:!0,evalType:"PRIMITIVE",evaluate:function(e,t){return this.tokenValue}},PARAMETER:{firstCharacter:/\{/,lastCharacter:"}",delimeted:!0,evalType:"PRIMITIVE",evaluate:function(e,t){return t[this.tokenValue]}},"%@":{rememberCount:!0,reservedWord:!0,evalType
:"PRIMITIVE",evaluate:function(e,t){return t[this.tokenValue]}},OPEN_PAREN:{firstCharacter:/\(/,singleCharacter:!0},CLOSE_PAREN:{firstCharacter:/\)/,singleCharacter:!0},AND:{reservedWord:!0,leftType:"BOOLEAN",rightType:"BOOLEAN",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t);return n&&r}},OR:{reservedWord:!0,leftType:"BOOLEAN",rightType:"BOOLEAN",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t);return n||r}},NOT:{reservedWord:!0,rightType:"BOOLEAN",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.rightSide.evaluate(e,t);return!n}},"=":{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t);return SC.isEqual(n,r)}},"!=":{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t);return!SC.isEqual(n,r)}},"<":{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t);return SC.compare(n,r)==-1}},"<=":{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t);return SC.compare(n,r)!=1}},">":{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide
.evaluate(e,t);return SC.compare(n,r)==1}},">=":{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t);return SC.compare(n,r)!=-1}},BEGINS_WITH:{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t);return n&&n.indexOf(r)===0}},ENDS_WITH:{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t);return n&&n.indexOf(r)===n.length-r.length}},CONTAINS:{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t)||[],r=this.rightSide.evaluate(e,t),i=SC.typeOf(n);if(i===SC.T_STRING)return n.indexOf(r)!==-1;if(i===SC.T_ARRAY||n.toArray){i!==SC.T_ARRAY&&(n=n.toArray());var s=!1,o=0;while(s===!1&&o<n.length)r==n[o]&&(s=!0),o++;return s}}},ANY:{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t),i=!1,s=0;while(i===!1&&s<r.length)n==r[s]&&(i=!0),s++;return i}},MATCHES:{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t);return r.test(n)}},TYPE_IS:{reservedWord:!0,rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=SC.Store.recordTypeFor(e.storeKey
),r=this.rightSide.evaluate(e,t),i=SC.objectForPropertyPath(r);return n==i}},"null":{reservedWord:!0,evalType:"PRIMITIVE",evaluate:function(e,t){return null}},"undefined":{reservedWord:!0,evalType:"PRIMITIVE",evaluate:function(e,t){return undefined}},"false":{reservedWord:!0,evalType:"PRIMITIVE",evaluate:function(e,t){return!1}},"true":{reservedWord:!0,evalType:"PRIMITIVE",evaluate:function(e,t){return!0}},YES:{reservedWord:!0,evalType:"PRIMITIVE",evaluate:function(e,t){return!0}},NO:{reservedWord:!0,evalType:"PRIMITIVE",evaluate:function(e,t){return!1}}},tokenizeString:function(e,t){function m(e,r){i=t[e],i.format&&!i.format.test(r)&&(e="UNKNOWN"),i.delimeted&&(d=!0);if(!i.delimeted)for(var s in t)t[s].reservedWord&&s==r&&(e=s);i=t[e],i&&i.rememberCount&&(v[e]||(v[e]=0),r=v[e],v[e]+=1),n.push({tokenType:e,tokenValue:r}),u=null,a=null,f=null}var n=[],r=null,i=null,s=null,o=null,u=null,a=null,f=null,l=null,c=!1,h=!1,p=!1,d=!1,v={};if(!e)return[];var g=e.length;for(var y=0;y<g;y++){c=y===g-1,r=e.charAt(y),d=!1,u&&(i=t[u],h=i.delimeted?r===l:i.notAllowed.test(r),h||(f+=r),(h||c)&&m(u,f),c&&!h&&(d=!0));if(!u&&!d){for(s in t)i=t[s],i.firstCharacter&&i.firstCharacter.test(r)&&(u=s);u&&(i=t[u],f=r,i.delimeted&&(f="",i.lastCharacter?l=i.lastCharacter:l=r),(i.singleCharacter||c)&&m(u,f))}}return n},buildTokenTree:function(e,t){function u(e){var r=e;if(r<0)return!1;var i=t[n[r].tokenType];return i?(n[r].evaluate=i.evaluate,i):(o.push("logic for token '"+n[r].tokenType+"' is not defined"),!1)}function a(e,t){var n=t,r=u(n);if(!r)return!1;if(e=="left")return r.leftType;if(e=="right")return r
.rightType}function f(e){var t=e,n=u(t);return n?n.evalType:!1}function l(e){n.splice(e,1),e<=r&&r--}function c(e){var t=e||r;return t>0?!0:!1}function h(e){var t=e;return t<0?!0:a("left",t)&&!n[t].leftSide||a("right",t)&&!n[t].rightSide}function p(e,t){var n=t<e?"left":"right";return e<0||t<0?!1:a(n,e)?f(t)?a(n,e)==f(t)?!0:!1:!1:!1}function d(e){var t=e;return h(t)?c(t)?p(t,t-1)?!0:!1:!1:!1}function v(e){var t=e;return h(t)?!1:c(t)?h(t-1)?p(t-1,t)?!0:!1:!1:!1}function m(e){var t=e;if(t<1)return!1;n[t].leftSide=n[t-1],l(t-1)}function g(e){var t=e;if(t<1)return!1;n[t-1].rightSide=n[t],l(t)}function y(e){l(e),l(i.pop())}var n=e.slice(),r=0,i=[],s=!1,o=[];if(!e||e.length===0)return{evaluate:function(){return!0}};for(r=0;r<n.length;r++)s=!1,n[r].tokenType=="UNKNOWN"&&o.push("found unknown token: "+n[r].tokenValue),n[r].tokenType=="OPEN_PAREN"&&i.push(r),n[r].tokenType=="CLOSE_PAREN"&&y(r),d(r)&&m(r),v(r)&&(g(r),s=!0),s&&r--;return n.length==1?n=n[0]:o.push("string did not resolve to a single tree"),o.length>0?{error:o.join(",\n"),tree:n}:n},buildOrder:function(e){if(!e)return[];if(SC.typeOf(e)===SC.T_FUNCTION)return e;var t=e.split(",");for(var n=0;n<t.length;n++){var r=t[n];r=r.replace(/^\s+|\s+$/,""),r=r.replace(/\s+/,","),r=r.split(","),t[n]={propertyName:r[0]},r[1]&&r[1]=="DESC"&&(t[n].descending=!0)}return t}}),SC.Query.mixin({LOCAL:"local",REMOTE:"remote",storeKeyFor:function(e){return e?e.get("storeKey"):null},containsRecords:function(e,t,n){var r=[];for(var i=0,s=t.get("length");i<s;i++){var o=t.objectAt(i);o&&e.contains(o)&&r.push(o.get("storeKey"))}return r=SC.Query.orderStoreKeys
(r,e,n),r},orderStoreKeys:function(e,t,n){if(e)var r=e.sort(function(e,r){return SC.Query.compareStoreKeys(t,n,e,r)});return e},compareStoreKeys:function(e,t,n,r){var i=t.materializeRecord(n),s=t.materializeRecord(r);return e.compare(i,s)},build:function(e,t,n,r){var i=null,s,o,u,a;if(t&&t.isQuery)return t.get("location")===e?t:t.copy().set("location",e).freeze();if(typeof t===SC.T_STRING){s=SC.objectForPropertyPath(t);if(!s)throw"%@ did not resolve to a class".fmt(t);t=s}else t&&t.isEnumerable?(s=[],t.forEach(function(e){typeof e===SC.T_STRING&&(e=SC.objectForPropertyPath(e));if(!e)throw"cannot resolve record types: %@".fmt(t);s.push(e)},this),t=s):t||(t=SC.Record);return r===undefined&&(r=null),n===undefined&&(n=null),!r&&typeof n!==SC.T_STRING&&(i=n,n=null),!r&&!i?(a=SC.Query._scq_recordTypeCache,a||(a=SC.Query._scq_recordTypeCache={}),o=a[e],o||(o=a[e]={}),t.isEnumerable?(u=t.map(function(e){return SC.guidFor(e)}),u=u.sort().join(":")):u=SC.guidFor(t),n&&(u=[u,n].join("::")),s=o[u],s||(t.isEnumerable?i={recordTypes:t.copy()}:i={recordType:t},i.location=e,i.conditions=n,s=o[u]=SC.Query.create(i).freeze())):(i||(i={}),i.location||(i.location=e),t&&t.isEnumerable?i.recordsTypes=t:i.recordType=t,n&&(i.conditions=n),r&&(i.parameters=r),s=SC.Query.create(i).freeze()),s},local:function(e,t,n){return this.build(SC.Query.LOCAL,e,t,n)},remote:function(e,t,n){return this.build(SC.Query.REMOTE,e,t,n)},_scq_didDefineRecordType:function(){var e=SC.Query._scq_queriesWithExpandedRecordTypes;e&&(e.forEach(function(e){e.notifyPropertyChange("expandedRecordTypes")},this),e.clear())}}),SC.Query
.comparisons={},SC.Query.registerComparison=function(e,t){SC.Query.comparisons[e]=t},SC.Query.registerQueryExtension=function(e,t){SC.Query.prototype.queryLanguage[e]=t},SC.Q=SC.Query.from,SC.Record=SC.Object.extend({isRecord:YES,isParentRecord:NO,primaryKey:"guid",id:function(e,t){return t!==undefined?(this.writeAttribute(this.get("primaryKey"),t),t):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(e,t){return t!==undefined&&(this._screc_isEditable=t),this.get("status")&SC.Record.READY?this._screc_isEditable:NO}.property("status").cacheable(),_screc_isEditable:YES,isLoaded:function(){var e=SC.Record,t=this.get("status");return t!==e.EMPTY&&t!==e.BUSY_LOADING&&t!==e.ERROR}.property("status").cacheable(),relationships:null,attributes:function(){var e=this.get("store"),t=this.storeKey;return e.readEditableDataHash(t)}.property(),readOnlyAttributes:function(){var e=this.get("store"),t=this.storeKey,n=e.readDataHash(t);return n&&(n=SC.clone(n,YES)),n}.property(),nestedRecordNamespace:null,isNestedRecord:function(){var e=this.get("store"),t,n=this.get("storeKey"),r=e.parentStoreKeyExists(n);return t=r?YES:NO,t}.property().cacheable(),parentRecord:function(){var e=this.storeKey,t=this.get("store");return t.materializeParentRecord(e)}.property(),refresh:function(e,t){var n=this.get("store"),r,i,s=this.get("storeKey"),o=n.parentStoreKeyExists
();return i=e||SC.none(e)&&SC.none(o),i?n.refreshRecord(null,null,s,t):o&&(r=n.materializeRecord(o),r.refresh(e,t)),this},destroy:function(e){var t=this.get("store"),n,r,i=this.get("storeKey"),s=t.parentStoreKeyExists();return r=e||SC.none(e)&&SC.none(s),r?(t.destroyRecord(null,null,i),this.notifyPropertyChange("status"),this.propagateToAggregates()):s&&(n=t.materializeRecord(s),n.destroy(e)),this},recordDidChange:function(e){var t=this.get("parentRecord");return t&&t.recordDidChange(),this.get("store").recordDidChange(null,null,this.get("storeKey"),e),this.notifyPropertyChange("status"),this.propagateToAggregates(),this},toJSON:function(){return this.get("attributes")},_editLevel:0,beginEditing:function(){return this._editLevel++,this},endEditing:function(e){return--this._editLevel<=0&&(this._editLevel=0,this.recordDidChange(e)),this},readAttribute:function(e){var t=this.get("store"),n=this.storeKey,r=t.readDataHash(n);return r?r[e]:undefined},writeAttribute:function(e,t,n){var r=this.get("store"),i=this.storeKey,s;s=r.readEditableDataHash(i);if(!s)throw SC.Record.BAD_STATE_ERROR;return t!==s[e]&&(n||this.beginEditing(),s[e]=t,e===this.get("primaryKey")&&(SC.Store.replaceIdFor(i,t),this.propertyDidChange("id")),n||this.endEditing(e)),this},propagateToAggregates:function(){var e=this.get("storeKey"),t=SC.Store.recordTypeFor(e),n=t.__sc_aggregate_keys,r,i,s,o,u,a;if(!n){n=[];for(s in this)o=this[s],o&&o.isRecordAttribute&&o.aggregate===YES&&n.push(s);t.__sc_aggregate_keys=n}var f=SC.Record,l=f.DIRTY,c=f.READY_NEW,h=f.DESTROYED,p=f.READY_CLEAN,d;d=function(e){var t,n,r,i;if(e)
{t=this.get("status");if(t&l||t&c||t&h)n=e.get("store"),r=e.get("storeKey"),i=n.peekStatus(r),i===p&&e.get("store").recordDidChange(e.constructor,null,e.get("storeKey"),null,YES)}};for(r=0,i=n.length;r<i;++r)s=n[r],u=this.get(s),a=SC.kindOf(u,SC.ManyArray)?u:[u],a.forEach(d,this)},storeDidChangeProperties:function(e,t){if(e)this.notifyPropertyChange("status");else{t?(this.beginPropertyChanges(),t.forEach(function(e){this.notifyPropertyChange(e)},this),this.notifyPropertyChange("status"),this.endPropertyChanges()):this.allPropertiesDidChange();var n=this.relationships,r=n?n.length:0;while(--r>=0)n[r].recordPropertyDidChange(t)}},normalize:function(e){var t=this.primaryKey,n=this.get("id"),r=this.get("store"),i=this.get("storeKey"),s={},o,u,a,f,l,c,h,p,d,v,m,g=r.readEditableDataHash(i)||{};g[t]=n,f=r.readDataHash(i);for(o in this)u=this[o],u&&(a=u.typeClass,a&&(v=u.get("key")||o,s[v]=YES,h=SC.typeOf(a.call(u))===SC.T_CLASS,p=u.isNestedRecordTransform,!h&&!p?(l=this.get(o),l===undefined||l===null&&!e?e||(s[v]=NO):(m=this[o],SC.instanceOf(m,SC.RecordAttribute)&&(l=m.fromType(this,o,l)),g[v]=l)):p?(l=this.get(o),l&&l.normalize&&l.normalize()):h&&(l=f[v],l!==undefined?g[v]=l:(d=u.get("defaultValue"),SC.typeOf(d)===SC.T_FUNCTION?g[v]=d(this,o,d):g[v]=d))));for(o in g)s[o]||(SC.debug("%@: Deleting key from underlying data hash due to normalization: %@",this,o),delete g[o]);return this},unknownProperty:function(e,t){if(t!==undefined){var n=this.get("storeKey"),r=SC.Store.recordTypeFor(n);if(r.ignoreUnknownProperties===YES)return this[e]=t,t;var i=this.get("primaryKey");this.writeAttribute
(e,t),e===i&&SC.Store.replaceIdFor(n,t)}return this.readAttribute(e)},commitRecord:function(e,t,n){var r=this.get("store"),i,s,o=this.get("storeKey"),u=r.parentStoreKeyExists();return s=t||SC.none(t)&&SC.none(u),s?r.commitRecord(undefined,undefined,this.get("storeKey"),e,n):u&&(i=r.materializeRecord(u),i.commitRecord(e,t,n)),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 e=this.get("store");return e.readError(this.get("storeKey"))||SC.Record.GENERIC_ERROR}return null}.property("isError").cacheable(),set:function(e,t){var n=this[e];return n&&n.isProperty&&n.get&&!n.get("isEditable")?this:arguments.callee.base.apply(this,arguments)},toString:function(){var e=this.get("store").readDataHash(this.get("storeKey"));return"%@(%@) %@".fmt(this.constructor.toString(),SC.inspect(e),this.statusString())},statusString:function(){var e=[],t=this.get("status");for(var n in SC.Record)n.match(/[A-Z_]$/)&&SC.Record[n]===t&&e.push(n);return e.join(" ")},registerNestedRecord:function(e,t,n){var r,i,s,o,u;return SC.none(n)&&(n=t),e&&e.get&&e.get("isRecord")?o=e:(u=this._materializeNestedRecordType(e,t),o=this.createNestedRecord(u,e)),o&&(this.isParentRecord=YES,r=this.get("store"),i=this.get("storeKey"),s=o.get("storeKey"),r.registerChildToParent(i,s,n)),o},_materializeNestedRecordType:function(e,t){var n,r,i;SC.typeOf(e)===SC.T_HASH&&(n=this.get("nestedRecordNamespace"),e.type&&!
SC.none(n)&&(r=n[e.type])),!r&&t&&this[t]&&(r=this[t].get("typeClass"));if(!r||!SC.kindOf(r,SC.Record))throw"SC.Child: Error during transform: Invalid record type.";return r},createNestedRecord:function(e,t){var n,r,i,s,o=null,u=null;return SC.run(function(){t=t||{},u=t[e.prototype.primaryKey],n=this.get("store");if(SC.none(n))throw"Error: during the creation of a child record: NO STORE ON PARENT!";!r&&(s=e.prototype.primaryKey)&&(r=t[s],i=r?n.storeKeyExists(e,r):null,i?(n.writeDataHash(i,t),o=n.materializeRecord(i)):(o=n.createRecord(e,t),SC.none(r)&&(i=o.get("storeKey"),r="cr"+i,SC.Store.replaceIdFor(i,r),t=n.readEditableDataHash(i),t[s]=r))),SC.none(u)&&this.generateIdForChild&&this.generateIdForChild(o)},this),o},_nestedRecordKey:0,generateIdForChild:function(e){}}),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(e,t){return SC.RecordAttribute.attr(e,t)},fetch:function(e,t){return SC.FetchedAttribute.attr(e,t)},toMany:function(e,t){t=t||{};var n=t.nested||t.isNested,r;return n?r=SC.ChildrenAttribute.attr(e,t):r=SC.ManyAttribute.attr(e,t),r},
toOne:function(e,t){t=t||{};var n=t.nested||t.isNested,r;return n?r=SC.ChildAttribute.attr(e,t):r=SC.SingleAttribute.attr(e,t),r},storeKeysById:function(){var e=SC.keyFor("storeKey",SC.guidFor(this)),t=this[e];return t||(t=this[e]={}),t},storeKeyFor:function(e){var t=this.storeKeysById(),n=t[e];return n||(n=SC.Store.generateStoreKey(),SC.Store.idsByStoreKey[n]=e,SC.Store.recordTypesByStoreKey[n]=this,t[e]=n),n},storeKeyExists:function(e){var t=this.storeKeysById(),n=t[e];return n},find:function(e,t){return e.find(this,t)},extend:function(){var e=SC.Object.extend.apply(this,arguments);return SC.Query&&SC.Query._scq_didDefineRecordType(e),e}}),SC.FixturesDataSource=SC.DataSource.extend({simulateRemoteResponse:NO,latency:50,cancel:function(e,t){return NO},fetch:function(e,t){if(t.get("location")!==SC.Query.LOCAL)throw SC.$error("SC.Fixture data source can only fetch local queries");if(!t.get("recordType")&&!t.get("recordTypes"))throw SC.$error("SC.Fixture data source can only fetch queries with one or more record types");this.get("simulateRemoteResponse")?this.invokeLater(this._fetch,this.get("latency"),e,t):this._fetch(e,t)},_fetch:function(e,t){var n=t.get("recordType"),r=t.get("recordTypes")||[n];r.forEach(function(t){SC.typeOf(t)===SC.T_STRING&&(t=SC.objectForPropertyPath(t)),t&&this.loadFixturesFor(e,t)},this),e.dataSourceDidFetchQuery(t)},retrieveRecords:function(e,t){var n=this.get("latency"),r=this.hasFixturesFor(t);return r?(this.get("simulateRemoteResponse")?this.invokeLater(this._retrieveRecords,n,e,t):this._retrieveRecords(e,t),r):r},_retrieveRecords:function(e,t){t
.forEach(function(t){var n=[],r=SC.Store.recordTypeFor(t),i=e.idFor(t),s=this.fixtureForStoreKey(e,t);n.push(t),e.dataSourceDidComplete(t,s,i)},this)},updateRecords:function(e,t,n){var r=this.get("latency"),i=this.hasFixturesFor(t);return i?(this.get("simulateRemoteResponse")?this.invokeLater(this._updateRecords,r,e,t):this._updateRecords(e,t),i):i},_updateRecords:function(e,t){t.forEach(function(t){var n=e.readDataHash(t);this.setFixtureForStoreKey(e,t,n),e.dataSourceDidComplete(t)},this)},createRecords:function(e,t,n){var r=this.get("latency");return this.get("simulateRemoteResponse")?this.invokeLater(this._createRecords,r,e,t):this._createRecords(e,t),YES},_createRecords:function(e,t){t.forEach(function(t){var n=e.idFor(t),r=e.recordTypeFor(t),i=e.readDataHash(t),s=this.fixturesFor(r);n||(n=this.generateIdFor(r,i,e,t)),this._invalidateCachesFor(r,t,n),s[n]=i,e.dataSourceDidComplete(t,null,n)},this)},destroyRecords:function(e,t,n){var r=this.get("latency"),i=this.hasFixturesFor(t);return i?(this.get("simulateRemoteResponse")?this.invokeLater(this._destroyRecords,r,e,t):this._destroyRecords(e,t),i):i},_destroyRecords:function(e,t){t.forEach(function(t){var n=e.idFor(t),r=e.recordTypeFor(t),i=this.fixturesFor(r);this._invalidateCachesFor(r,t,n),n&&delete i[n],e.dataSourceDidDestroy(t)},this)},loadFixturesFor:function(e,t,n){var r=[],i,s,o;i=this.fixturesFor(t);for(s in i)o=t.storeKeyFor(s),e.peekStatus(o)===SC.Record.EMPTY&&r.push(i[s]),n&&n.push(o);return r&&r.length>0&&e.loadRecords(t,r),this},generateIdFor:function(e,t,n,r){return"@id%@".fmt(SC.Store.generateStoreKey())},
fixtureForStoreKey:function(e,t){var n=e.idFor(t),r=e.recordTypeFor(t),i=this.fixturesFor(r);return i?i[n]:null},setFixtureForStoreKey:function(e,t,n){var r=e.idFor(t),i=e.recordTypeFor(t),s=this.fixturesFor(i);return this._invalidateCachesFor(i,t,r),s[r]=n,this},fixturesFor:function(e){this._fixtures||(this._fixtures={});var t=this._fixtures[SC.guidFor(e)];if(t)return t;var n=e?e.FIXTURES:null,r=n?n.length:0,i=e?e.prototype.primaryKey:"guid",s,o,u;this._fixtures[SC.guidFor(e)]=t={};for(s=0;s<r;s++)o=n[s],u=o[i],u||(u=this.generateIdFor(e,o)),t[u]=o;return t},fixturesLoadedFor:function(e){if(!this._fixtures)return NO;var t=[],n=this._fixtures[SC.guidFor(e)];return n?YES:NO},reset:function(){return this._fixtures=null,this},hasFixturesFor:function(e){var t=NO;return e.forEach(function(e){if(t!==SC.MIXED_STATE){var n=SC.Store.recordTypeFor(e),r=n?n.FIXTURES:null;r&&r.length&&r.length>0?t===NO&&(t=YES):t===YES&&(t=SC.MIXED_STATE)}},this),t},_invalidateCachesFor:function(e,t,n){var r=this._storeKeyCache;return r&&delete r[SC.guidFor(e)],this}}),SC.Record.fixtures=SC.FixturesDataSource.create(),SC.RelationshipSupport={_srs_inverseDidRelinquishRelationships:function(e,t,n,r){t.forEach(function(t){this._srs_inverseDidRelinquishRelationship(e,t,n,r)},this)},_srs_inverseDidRelinquishRelationship:function(e,t,n,r){var i=e.storeKeyFor(t),s=this.readDataHash(i),o=n.inverse,u=e.prototype;if(!s||!o)return;SC.instanceOf(u[o],SC.SingleAttribute)?delete s[o]:SC.instanceOf(u[o],SC.ManyAttribute)&&SC.typeOf(s[o])===SC.T_ARRAY&&s[o].removeObject(r),this.pushRetrieve(e,t,s,undefined,!0)},_srs_inverseDidAddRelationships
:function(e,t,n,r){t.forEach(function(t){this._srs_inverseDidAddRelationship(e,t,n,r)},this)},_srs_inverseDidAddRelationship:function(e,t,n,r){var i=e.storeKeyFor(t),s=this.readDataHash(i),o=this.peekStatus(i),u=e.prototype,a=n.inverse,f=u[a],l=u[u.primaryKey],c=!1;f=f&&f.get&&f.get("key")||f.key||a,o===SC.Record.EMPTY&&(SC.typeOf(n.lazilyInstantiate)===SC.T_FUNCTION&&n.lazilyInstantiate()||SC.typeOf(n.lazilyInstantiate)!==SC.T_FUNCTION&&n.lazilyInstantiate)&&(!SC.none(l)&&l.typeClass&&SC.typeOf(l.typeClass())===SC.T_CLASS&&(c=!0),s={},s[u.primaryKey]=t);if(!s||!a)return;SC.instanceOf(u[a],SC.SingleAttribute)?s[f]=r:SC.instanceOf(u[a],SC.ManyAttribute)&&(s[f]=s[f]||[],s[a].indexOf(r)<0&&s[f].push(r)),this.pushRetrieve(e,t,s,undefined,!c)},_srs_pushIterator:function(e,t,n,r){var i=e.prototype,s,o,u,a;typeof n=="undefined"&&(n=e.storeKeyFor(t)),o=this.readDataHash(n)||{};for(u in i){s=i[u];if(s&&s.typeClass&&s.inverse&&s.isMaster){a=s.typeClass();if(SC.typeOf(a)!==SC.T_CLASS)continue;r.apply(this,[a,o,s,s.get&&s.get("key")||u])}}},pushDestroy:function(e,t,n,r){var i;return this._srs_pushIterator(t,n,r,function(e,t,r,s){i=[t[s]||null].flatten().compact().uniq(),this._srs_inverseDidRelinquishRelationships(e,i,r,n)}),e(t,n,r)}.enhance(),pushRetrieve:function(e,t,n,r,i,s){if(!s){var o,u;this._srs_pushIterator(t,n,i,function(e,t,i,s){o=[t[s]||null].flatten().compact().uniq(),u=[r[s]||null].flatten().compact().uniq(),this._srs_inverseDidRelinquishRelationships(e,o.filter(function(e){return u.indexOf(e)===-1}),i,n),this._srs_inverseDidAddRelationships(e,u,i,n)})}return i=i||t.storeKeyFor
(n),e(t,n,r,i)}.enhance()},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 e=this.get("type");return SC.typeOf(e)===SC.T_STRING&&(e=SC.requiredObjectForPropertyPath(e)),e}.property("type").cacheable(),transform:function(){var e=this.get("typeClass")||String,t=SC.RecordAttribute.transforms,n;while(e&&!(n=t[SC.guidFor(e)]))e.superclass.hasOwnProperty("create")?e=e.superclass:e=SC.T_FUNCTION;return n}.property("typeClass").cacheable(),toType:function(e,t,n){var r=this.get("transform"),i=this.get("typeClass"),s;if(r&&r.to){n=r.to(n,this,i,e,t);if(!SC.none(n)&&(s=r.observesChildren)){var o,u=s.length,a={record:e,key:t};for(o=0;o<u;o++)n.addObserver(s[o],this,this._SCRA_childObserver,a)}}return n},_SCRA_childObserver:function(e,t,n,r){this.call(r.record,r.key,e),r.record.notifyPropertyChange(r.key)},fromType:function(e,t,n){var r=this.get("transform"),i=this.get("typeClass");return r&&r.from&&(n=r.from(n,this,i,e,t)),n},getDefaultValue:function(e,t){var n=this.get("defaultValue");return typeof n===SC.T_FUNCTION&&(n=n(e,t,this)),n},call:function(e,t,n){var r=this.get("key")||t,i;return n!==undefined&&this.get("isEditable")&&(i=this.fromType(e,t,n),e.writeAttribute(r,i)),n=e.readAttribute(r),SC.none(n)&&(n=this.getDefaultValue(e,t)),n=this.toType(e,t,n),n},apply:function(e,t){return this.call.apply(e,t)},isProperty:YES,isCacheable:YES,dependentKeys:[],init:function(){arguments.callee.base.apply(this,arguments),this.cacheKey="__cache__"+
SC.guidFor(this),this.lastSetValueKey="__lastValue__"+SC.guidFor(this)}}),SC.RecordAttribute.mixin({attr:function(e,t){return t||(t={}),t.type||(t.type=e||String),this.create(t)},transforms:{},registerTransform:function(e,t){SC.RecordAttribute.transforms[SC.guidFor(e)]=t}}),SC.RecordAttribute.registerTransform(Boolean,{to:function(e){return SC.none(e)?null:!!e}}),SC.RecordAttribute.registerTransform(Number,{to:function(e){return SC.none(e)?null:Number(e)}}),SC.RecordAttribute.registerTransform(String,{to:function(e){return typeof e!==SC.T_STRING&&!SC.none(e)&&e.toString&&(e=e.toString()),e}}),SC.RecordAttribute.registerTransform(Array,{to:function(e){return!SC.isArray(e)&&!SC.none(e)&&(e=[]),e},observesChildren:["[]"]}),SC.RecordAttribute.registerTransform(Object,{to:function(e){return typeof e!="object"&&!SC.none(e)&&(e={}),e}}),SC.RecordAttribute.registerTransform(SC.Record,{to:function(e,t,n,r){var i=r.get("store");return SC.none(e)||e===""?null:i.find(n,e)},from:function(e){return e?e.get("id"):null}}),SC.RecordAttribute.registerTransform(SC.T_FUNCTION,{to:function(e,t,n,r){n=n.apply(r);var i=r.get("store");return i.find(n,e)},from:function(e){return e.get("id")}}),SC.RecordAttribute.registerTransform(Date,{to:function(e,t){if(SC.none(e))return e;var n;e=e.toString()||"";if(t.get("useIsoDate")){var r="([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})))?)?)?)?",i=e.match(new RegExp(r)),s=0,o=new Date(i[1],0,1),u;i[3]&&o.setMonth(i[3]-1),i[5]&&o.setDate(i[5]),i[7]&&o.setHours(i[7]),i[8]&&o.setMinutes(i[8]),
i[10]&&o.setSeconds(i[10]),i[12]&&o.setMilliseconds(Number("0."+i[12])*1e3),i[14]&&(s=Number(i[16])*60+Number(i[17]),s*=i[15]==="-"?1:-1),s-=o.getTimezoneOffset(),u=Number(o)+s*60*1e3,n=new Date,n.setTime(Number(u))}else n=new Date(Date.parse(e));return n},_dates:{},_zeropad:function(e){var t=Math.abs(e),n=e<0?"-":"";return n+(t<10?"0":"")+t},from:function(e){if(SC.none(e))return null;var t=this._dates[e.getTime()];if(t)return t;var n=this._zeropad,r=-e.getTimezoneOffset();if(r===0)r="Z";else{var i=r<0?"-":"+";r=Math.abs(r);var s=Math.floor(r/60),o=r%60;r=i+n(s)+":"+n(o)}return this._dates[e.getTime()]=t="%@-%@-%@T%@:%@:%@%@".fmt(n(e.getFullYear()),n(e.getMonth()+1),n(e.getDate()),n(e.getHours()),n(e.getMinutes()),n(e.getSeconds()),r),t}}),SC.DateTime&&!SC.RecordAttribute.transforms[SC.guidFor(SC.DateTime)]&&SC.RecordAttribute.registerTransform(SC.DateTime,{to:function(e,t){if(SC.none(e)||SC.instanceOf(e,SC.DateTime))return e;if(SC.none(e)||SC.instanceOf(e,Date))return SC.DateTime.create(e.getTime());var n=t.get("format");return SC.DateTime.parse(e,n?n:SC.DateTime.recordFormat)},from:function(e,t){if(SC.none(e))return e;var n=t.get("format");return e.toFormattedString(n?n:SC.DateTime.recordFormat)}}),SC.RecordAttribute.registerTransform(SC.Set,{to:function(e,t,n,r,i){return SC.Set.create(e)},from:function(e,t,n,r,i){return e.toArray()},observesChildren:["[]"]}),SC.ChildAttribute=SC.RecordAttribute.extend({isNestedRecordTransform:YES,toType:function(e,t,n){var r=null,i,s=this.get("typeClass");if(!e)throw"SC.Child: Error during transform: Unable to retrieve parent record.";return SC
.none(n)||(r=e.registerNestedRecord(n,t)),r},fromType:function(e,t,n){var r,i,s;return e&&(SC.none(n)?(e.writeAttribute(t,n),s=n):(s=e.registerNestedRecord(n,t),s?(r=s.get("storeKey"),i=s.get("store"),e.writeAttribute(t,i.readDataHash(r))):n&&e.writeAttribute(t,n))),s},call:function(e,t,n){var r=this.get("key")||t,i,s=SC.keyFor("__kid__",SC.guidFor(this));return n!==undefined?n=this.fromType(e,t,n):(n=e.readAttribute(r),SC.none(n)&&(n=this.get("defaultValue"))?typeof n===SC.T_FUNCTION&&(n=this.defaultValue(e,t,this),e.attributes()&&e.writeAttribute(r,n,!0)):n=this.toType(e,t,n)),n}}),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 e=this.get("store"),t=this.get("storeKey"),n=this.get("propertyName"),r,i;return r=e.readEditableProperty(t,n),r||(i=e.readEditableDataHash(t),r=i[n]=[]),r}.property(),length:function(){var e=this.get("readOnlyChildren");return e?e.length:0}.property("readOnlyChildren"),objectAt:function(e){var t=this._records,n=this.get("readOnlyChildren"),r,i,s=this.get("propertyName"),o=this.get("record"),u=n?n.length:0;return n?t&&(i=t[e])?i:(t||(this._records=t=[]),
e>=u?undefined:(r=n.objectAt(e),r?(t[e]=i=o.registerNestedRecord(r,s,s+"."+e),i):undefined)):undefined},replace:function(e,t,n){var r=this.get("editableChildren"),i=n?n.get?n.get("length"):n.length:0,s=this.get("record"),o,u=this.get("propertyName"),a,f;return o=this._processRecordsToHashes(n),r.replace(e,t,o),o!==this._prevChildren&&(this._performRecordPropertyChange(null,!1),this.arrayContentWillChange(e,t,i),this._childrenContentDidChange(e,t,i)),s.recordDidChange(u),this},_processRecordsToHashes:function(e){var t,n;return e=e||[],e.forEach(function(r,i){r.isNestedRecord&&(t=r.get("store"),n=r.storeKey,e[i]=t.readDataHash(n))}),e},normalize:function(){this.forEach(function(e,t){e.normalize&&e.normalize()})},recordPropertyDidChange:function(e){return this._performRecordPropertyChange(e,!0),this},_performRecordPropertyChange:function(e,t){if(e&&!e.contains(this.get("propertyName")))return this;var n=this.get("readOnlyChildren"),r=0,i=0,s=this._prevChildren,o=this._childrenContentDidChange;return t=SC.none(t)?!0:t,n===s?this:(s&&(s.removeArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:o}),r=s.get("length")),n&&(n.addArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:o}),i=n.get("length")),this._prevChildren=n,t&&(this.arrayContentWillChange(0,r,i),this._childrenContentDidChange(0,r,i)),this)},_childrenContentDidChange:function(e,t,n){this._records=null,this.arrayContentDidChange(e,t,n)},init:function(){arguments.callee.base.apply(this,arguments),this.recordPropertyDidChange()}}),SC.ChildrenAttribute=SC.ChildAttribute.extend
({toType:function(e,t,n){var r=this.get("key")||t,i=SC.keyFor("__kidsArray__",SC.guidFor(this)),s=e[i],o=this.get("typeClass"),u;return s||(s=SC.ChildArray.create({record:e,propertyName:r,defaultRecordType:o}),e[i]=s,u=e.get("relationships"),u||e.set("relationships",u=[]),u.push(s)),s},fromType:function(e,t,n){var r,i,s=SC.keyFor("__kidsArray__",SC.guidFor(this)),o=e[s];return e&&(e.writeAttribute(t,n),o&&(o=o.recordPropertyDidChange())),o}}),SC.FetchedAttribute=SC.RecordAttribute.extend({paramValueKey:"link",paramOwnerKey:"owner",paramRelKey:"rel",queryKey:null,isEditable:NO,toType:function(e,t,n){var r=e.get("store");if(!r)return null;var i=this.get("paramValueKey"),s=this.get("paramOwnerKey"),o=this.get("paramRelKey"),u=this.get("queryKey")||this.get("typeClass"),a={};return i&&(a[i]=n),s&&(a[s]=e),o&&(a[o]=this.get("key")||t),r.findAll(u,a)},fromType:function(e,t,n){return n}}),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 e=this.get("store"),t=this.get("storeKey"),n=this.get("propertyName"),r,i;return r=e.readEditableProperty(t,n),r||(i=e.readEditableDataHash(t),r=i[n]=[]),r!==this._prevStoreIds&&this.recordPropertyDidChange(),r}.property(),isEditable:function(){var e=this.manyAttribute
;return e?e.get("isEditable"):NO}.property("manyAttribute").cacheable(),inverse:function(){var e=this.manyAttribute;return e?e.get("inverse"):null}.property("manyAttribute").cacheable(),isMaster:function(){var e=this.manyAttribute;return e?e.get("isMaster"):null}.property("manyAttribute").cacheable(),orderBy:function(){var e=this.manyAttribute;return e?e.get("orderBy"):null}.property("manyAttribute").cacheable(),length:function(){var e=this.get("readOnlyStoreIds");return e?e.get("length"):0}.property("readOnlyStoreIds"),objectAt:function(e){var t=this._records,n=this.get("readOnlyStoreIds"),r=this.get("store"),i=this.get("recordType"),s,o,u;return!n||!r?undefined:t&&(o=t[e])?o:(t||(this._records=t=[]),u=n.objectAt(e),u&&(s=r.storeKeyFor(i,u),r.readStatus(s)===SC.Record.EMPTY&&r.retrieveRecord(i,null,s),t[e]=o=r.materializeRecord(s)),o)},replace:function(e,t,n){if(!this.get("isEditable"))throw"%@.%@[] is not editable".fmt(this.get("record"),this.get("propertyName"));var r=this.get("editableStoreIds"),i=n?n.get?n.get("length"):n.length:0,s=this.get("record"),o=this.get("propertyName"),u,a,f,l,c,h,p;f=[];for(u=0;u<i;u++)f[u]=n.objectAt(u).get("id");c=this.get("inverse");if(c&&t>0){l=SC.ManyArray._toRemove,l?SC.ManyArray._toRemove=null:l=[];for(u=0;u<t;u++)l[u]=this.objectAt(e+u)}r.replace(e,t,f);if(c){for(u=0;u<t;u++)p=l[u],h=p?p[c]:null,h&&h.inverseDidRemoveRecord&&h.inverseDidRemoveRecord(p,c,s,o);l&&(l.length=0,SC.ManyArray._toRemove||(SC.ManyArray._toRemove=l));for(u=0;u<i;u++)p=n.objectAt(u),h=p?p[c]:null,h&&h.inverseDidAddRecord&&h.inverseDidAddRecord(p,c,s,o)}return s&&(!
c||this.get("isMaster"))&&s.recordDidChange(o),this.enumerableContentDidChange(e,t,i-t),this},removeInverseRecord:function(e){if(!e)return this;var t=e.get("id"),n=this.get("editableStoreIds"),r=n&&t?n.indexOf(t):-1,i;return r>=0&&(n.removeAt(r),this.get("isMaster")&&(i=this.get("record"))&&i.recordDidChange(this.get("propertyName"))),this},addInverseRecord:function(e){if(!e)return this;var t=e.get("id"),n=this.get("editableStoreIds"),r=this.get("orderBy"),i=n.get("length"),s,o;return r?s=this._findInsertionLocation(e,0,i,r):s=i,n.insertAt(s,e.get("id")),this.get("isMaster")&&(o=this.get("record"))&&o.recordDidChange(this.get("propertyName")),this},_findInsertionLocation:function(e,t,n,r){var i=t+Math.floor((n-t)/2),s=this.objectAt(i),o=this._compare(e,s,r);return o<0?i===0?i:this._findInsertionLocation(e,0,i,r):o>0?i>=n?i:this._findInsertionLocation(e,i,n,r):i},_compare:function(e,t,n){var r=SC.typeOf(n),i,s,o;if(r===SC.T_FUNCTION)i=n(e,t);else if(r===SC.T_STRING)i=SC.compare(e,t);else{o=n.get("length"),i=0;for(s=0;i===0&&s<o;s++)i=SC.compare(e,t)}return i},recordPropertyDidChange:function(e){if(e&&!e.contains(this.get("propertyName")))return this;var t=this.get("readOnlyStoreIds"),n,r,i=this._prevStoreIds,s=this._storeIdsContentDidChange;if(t===i)return this;i?(i.removeArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:s}),n=i.get("length")):n=0,t?(t.addArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:s}),r=t.get("length")):r=0,this.arrayContentWillChange(0,n,r),this._prevStoreIds=t,this._storeIdsContentDidChange(0,n,r)
},_storeIdsContentDidChange:function(e,t,n){this._records=null,this.arrayContentDidChange(e,t,n)},unknownProperty:function(e,t){var n;return SC.typeOf(e)===SC.T_STRING&&(n=this.reducedProperty(e,t)),n===undefined?arguments.callee.base.apply(this,arguments):n},init:function(){arguments.callee.base.apply(this,arguments),this.recordPropertyDidChange()}}),SC.ManyAttribute=SC.RecordAttribute.extend({inverse:null,isMaster:YES,orderBy:null,toType:function(e,t,n){var r=this.get("typeClass"),i=this.get("key")||t,s=SC.keyFor("__manyArray__",SC.guidFor(this)),o=e[s],u;return o||(o=SC.ManyArray.create({recordType:r,record:e,propertyName:i,manyAttribute:this}),e[s]=o,u=e.get("relationships"),u||e.set("relationships",u=[]),u.push(o)),o},fromType:function(e,t,n){var r=[];if(!SC.isArray(n))throw"Expects toMany attribute to be an array";var i=n.get("length");for(var s=0;s<i;s++)r[s]=n.objectAt(s).get("id");return r},inverseDidRemoveRecord:function(e,t,n,r){var i=e.get(t);i&&i.removeInverseRecord(n)},inverseDidAddRecord:function(e,t,n,r){var i=e.get(t);i&&i.addInverseRecord(n)}}),SC.SingleAttribute=SC.RecordAttribute.extend({inverse:null,isMaster:YES,call:function(e,t,n){var r=this.get("key")||t,i,s,o,u,a,f;if(n!==undefined&&this.get("isEditable")){if(n&&!SC.kindOf(n,SC.Record))throw"%@ is not an instance of SC.Record".fmt(n);i=this.get("inverse"),i&&(o=this._scsa_call(e,t)),f=this.fromType(e,t,n),e.writeAttribute(r,f,!this.get("isMaster")),a=n,i&&o!==n&&(o&&(u=o[i])&&u.inverseDidRemoveRecord(o,i,e,t),n&&(u=n[i])&&u.inverseDidAddRecord(n,i,e,t))}else a=this._scsa_call(e,t,n);return a},_scsa_call
:SC.RecordAttribute.prototype.call,inverseDidRemoveRecord:function(e,t,n,r){var i=this.get("inverse"),s=this._scsa_call(e,t),o=this.get("isMaster"),u;e.writeAttribute(t,null,!o),e.notifyPropertyChange(t),(s!==n||r!==i)&&s&&(u=s[i])&&u.inverseDidRemoveRecord(s,i,e,t)},inverseDidAddRecord:function(e,t,n,r){var i=this.get("inverse"),s=this._scsa_call(e,t),o=this.get("isMaster"),u,a;a=this.fromType(e,t,n),e.writeAttribute(t,a,!o),e.notifyPropertyChange(t),(s!==n||r!==i)&&s&&(u=s[i])&&u.inverseDidRemoveRecord(s,i,e,t)}}),SC.Store=SC.Object.extend({name:null,nestedStores:null,dataSource:null,isNested:NO,commitRecordsAutomatically:NO,from:function(e){return this.set("dataSource",e),this},_getDataSource:function(){var e=this.get("dataSource");return typeof e===SC.T_STRING&&(e=SC.requiredObjectForPropertyPath(e),e.isClass&&(e=e.create()),this.set("dataSource",e)),e},cascade:function(e){var t=SC.A(arguments);return e=SC.CascadeDataSource.create({dataSources:t}),this.from(e)},chain:function(e,t){e||(e={}),e.parentStore=this;if(t){if(SC.typeOf(t)!=="class")throw new Error("%@ is not a valid class".fmt(t));if(!SC.kindOf(t,SC.NestedStore))throw new Error("%@ is not a type of SC.NestedStore".fmt(t))}else t=SC.NestedStore;e.childRecords=this.childRecords?SC.clone(this.childRecords):{},e.parentRecords=this.parentRecords?SC.clone(this.parentRecords):{};var n=t.create(e),r=this.nestedStores;return r||(r=this.nestedStores=[]),r.push(n),n},willDestroyNestedStore:function(e){return this.nestedStores&&this.nestedStores.removeObject(e),this},hasNestedStore:function(e){while(e&&e!==this)e=e.get("parentStore"
);return e===this},dataHashes:null,statuses:null,revisions:null,editables:null,changelog:null,recordErrors:null,queryErrors:null,childRecords:null,parentRecords:null,storeKeyEditState:function(e){var t=this.editables,n=this.locks;return t&&t[e]?SC.Store.EDITABLE:SC.Store.LOCKED},readDataHash:function(e){return this.dataHashes[e]},readEditableDataHash:function(e){var t=this.dataHashes[e];if(!t)return t;var n=this.editables;return n||(n=this.editables=[]),n[e]||(n[e]=1,t=this.dataHashes[e]=SC.clone(t,YES)),t},readEditableProperty:function(e,t){var n=this.readEditableDataHash(e),r=this.editables[e],i=n[t];return r===1&&(r=this.editables[e]={}),r[t]||(i=n[t],i&&i.isCopyable&&(i=n[t]=i.copy(YES)),r[t]=YES),i},writeDataHash:function(e,t,n){t&&(this.dataHashes[e]=t),n&&(this.statuses[e]=n);var r=this.editables;r||(r=this.editables=[]),r[e]=1;var i=this;return this._propagateToChildren(e,function(e){i.writeDataHash(e,null,n)}),this},removeDataHash:function(e,t){this.dataHashes[e]=null,this.statuses[e]=t||SC.Record.EMPTY;var n=this.editables;return n&&(n[e]=0),this},readStatus:function(e){return this.readDataHash(e),this.statuses[e]||SC.Record.EMPTY},peekStatus:function(e){return this.statuses[e]||SC.Record.EMPTY},writeStatus:function(e,t){return this.writeDataHash(e,null,t)},dataHashDidChange:function(e,t,n,r){t||(t=SC.Store.generateStoreKey());var i,s,o,u;i=SC.typeOf(e)===SC.T_ARRAY,i?s=e.length:(s=1,u=e);var a=this;for(o=0;o<s;o++)i&&(u=e[o]),this.revisions[u]=t,this._notifyRecordPropertyChange(u,n,r),this._propagateToChildren(u,function(e){a.dataHashDidChange(e,null,n,r)});return this
},_notifyRecordPropertyChange:function(e,t,n){var r=this.records,i=this.get("nestedStores"),s=SC.Store,o,u,a,f,l,c,h;a=i?i.length:0;for(f=0;f<a;f++){l=i[f],c=l.peekStatus(e),u=l.storeKeyEditState(e);if(u===s.INHERITED)l._notifyRecordPropertyChange(e,t,n);else if(c&SC.Record.BUSY){if(l.get("hasChanges"))throw s.CHAIN_CONFLICT_ERROR;l.reset()}}var p=this.recordPropertyChanges;return p||(p=this.recordPropertyChanges={storeKeys:SC.CoreSet.create(),records:SC.CoreSet.create(),hasDataChanges:SC.CoreSet.create(),propertyForStoreKeys:{}}),p.storeKeys.add(e),r&&(o=r[e])&&(p.records.push(e),t||p.hasDataChanges.push(e),n?((h=p.propertyForStoreKeys[e])||(h=p.propertyForStoreKeys[e]=SC.CoreSet.create()),h!=="*"&&h.add(n)):p.propertyForStoreKeys[e]="*"),this.invokeOnce(this.flush),this},flush:function(){if(!this.recordPropertyChanges)return this;var e=this.recordPropertyChanges,t=e.storeKeys,n=e.hasDataChanges,r=e.records,i=e.propertyForStoreKeys,s=SC.CoreSet.create(),o,u,a,f,l,c,h;return t.forEach(function(e){r.contains(e)&&(a=n.contains(e)?NO:YES,o=this.records[e],h=i?i[e]:null,h==="*"&&(h=null),r.remove(e),o&&o.storeDidChangeProperties(a,h)),u=SC.Store.recordTypeFor(e),s.add(u)},this),t.get("length")>0&&this._notifyRecordArrays(t,s),t.clear(),n.clear(),r.clear(),this.recordPropertyChanges.propertyForStoreKeys={},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 e=this.get("dataSource");e&&e.reset&&e.reset();var t=this.records,n;if(t)for(n in
t){if(!t.hasOwnProperty(n))continue;this._notifyRecordPropertyChange(parseInt(n,10),NO)}this.set("hasChanges",NO)},commitChangesFromNestedStore:function(e,t,n){n||this._verifyLockRevisions(t,e.locks);var r=t.length,i,s,o,u,a,f,l,c,h,p,d,v,m;f=this.revisions,o=this.dataHashes,u=this.statuses,a=this.editables,l=this.parentRecords?this.parentRecords:this.parentRecords={},c=this.childRecords?this.childRecords:this.childRecords={},a||(a=this.editables=[]),h=e.dataHashes,d=e.revisions,p=e.statuses,v=e.parentRecords||{},m=e.childRecords||{};for(i=0;i<r;i++)s=t[i],o[s]=h[s],u[s]=p[s],f[s]=d[s],l[s]=v[s],c[s]=m[s],a[s]=0,this._notifyRecordPropertyChange(s,NO);var g=this.changelog,y=e.changelog;return y&&(g||(g=this.changelog=SC.CoreSet.create()),g.addEach(y)),this.changelog=g,this.get("parentStore")||this.flush(),this},_verifyLockRevisions:function(e,t){var n=e.length,r=this.revisions,i,s,o,u;if(t&&r)for(i=0;i<n;i++){s=e[i],o=t[s]||1,u=r[s]||1;if(o<u)throw SC.Store.CHAIN_CONFLICT_ERROR}return this},find:function(e,t){SC.typeOf(e)===SC.T_STRING&&(e=SC.objectForPropertyPath(e));if(arguments.length===1&&!(e&&e.get&&e.get("isRecord"))){if(!e)throw new Error("SC.Store#find() must pass recordType or query");return e.isQuery||(e=SC.Query.local(e)),this._findQuery(e,YES,YES)}return this._findRecord(e,t)},findAll:function(e,t,n){SC.Logger.warn("SC.Store#findAll() will be removed in a future version of SproutCore. Use SC.Store#find() instead");if(!e||!e.isQuery)e=SC.Query.local(e,t,n);return this._findQuery(e,YES,YES)},_findQuery:function(e,t,n){var r=this._scst_recordArraysByQuery,i=SC.guidFor
(e),s,o;return r||(r=this._scst_recordArraysByQuery={}),s=r[i],!s&&t&&(r[i]=s=SC.RecordArray.create({store:this,query:e}),o=this.get("recordArrays"),o||this.set("recordArrays",o=SC.Set.create()),o.add(s),n&&this.refreshQuery(e)),this.flush(),s},_findRecord:function(e,t){var n;return e&&e.get&&e.get("isRecord")?n=e.get("storeKey"):n=SC.none(t)?null:e.storeKeyFor(t),n&&this.readStatus(n)===SC.Record.EMPTY&&(n=this.retrieveRecord(e,t)),n?this.materializeRecord(n):null},recordArrayWillDestroy:function(e){var t=this._scst_recordArraysByQuery,n=this.get("recordArrays");return t&&delete t[SC.guidFor(e.get("query"))],n&&n.remove(e),this},refreshQuery:function(e){if(!e)throw new Error("refreshQuery() requires a query");var t=this._scst_recordArraysByQuery,n=t?t[SC.guidFor(e)]:null,r=this._getDataSource();return r&&r.fetch&&(n&&n.storeWillFetchQuery(e),r.fetch.call(r,this,e)),this},_notifyRecordArrays:function(e,t){var n=this.get("recordArrays");return n?(n.forEach(function(n){n&&n.storeDidChangeStoreKeys(e,t)},this),this):this},recordsFor:function(e){var t=[],n=e.storeKeysById(),r,i,s;for(r in n)i=n[r],this.readStatus(i)!==SC.RECORD_EMPTY&&t.push(i);return t.length>0?s=SC.RecordArray.create({store:this,storeKeys:t}):s=t,s},_TMP_REC_ATTRS:{},materializeRecord:function(e){var t=this.records,n,r,i;return t||(t=this.records={}),n=t[e],n?n:(r=SC.Store.recordTypeFor(e),r?(i=this._TMP_REC_ATTRS,i.storeKey=e,i.store=this,n=t[e]=r.create(i),n):null)},createRecord:function(e,t,n){var r,i,s,o=SC.Record,u,a,f;!n&&(r=e.prototype.primaryKey)&&(n=t[r],a=e.prototype[r]?e.prototype[r].defaultValue:null
,!n&&SC.typeOf(a)===SC.T_FUNCTION&&(n=t[r]=a())),i=n?e.storeKeyFor(n):SC.Store.generateStoreKey(),s=this.readStatus(i);if(s&o.BUSY||s&o.READY||s===o.DESTROYED_DIRTY)throw n?o.RECORD_EXISTS_ERROR:o.BAD_STATE_ERROR;if(!!n||s!==SC.DESTROYED_CLEAN&&s!==SC.ERROR)return this.writeDataHash(i,t?t:{},o.READY_NEW),SC.Store.replaceRecordTypeFor(i,e),this.dataHashDidChange(i),u=this.changelog,u||(u=SC.Set.create()),u.add(i),this.changelog=u,this.get("commitRecordsAutomatically")&&this.invokeLast(this.commitRecords),f=this.materializeRecord(i),f&&f.propagateToAggregates(),f;throw o.BAD_STATE_ERROR},createRecords:function(e,t,n){var r=[],i,s,o,u=t.length,a;o=SC.typeOf(e)===SC.T_ARRAY,o||(i=e);for(a=0;a<u;a++)o&&(i=e[a]||SC.Record),s=n?n[a]:undefined,r.push(this.createRecord(i,t[a],s));return r},unloadRecord:function(e,t,n,r){n===undefined&&(n=e.storeKeyFor(t));var i=this.readStatus(n),s=SC.Record;r=r||s.EMPTY;if(i===s.BUSY_DESTROYING||i&s.DESTROYED)return this;if(i&s.BUSY)throw s.BUSY_ERROR;i=r,this.removeDataHash(n,i),this.dataHashDidChange(n);var o=this;return this._propagateToChildren(n,function(e){o.unloadRecord(null,null,e,r)}),this},unloadRecords:function(e,t,n,r){var i,s,o,u,a,f;if(n===undefined){s=SC.typeOf(e)===SC.T_ARRAY,s||(a=e);if(t===undefined){i=s?e.length:1;for(o=0;o<i;o++)s&&(a=e[o]),n=this.storeKeysFor(a),this.unloadRecords(undefined,undefined,n,r)}else{i=t.length;for(o=0;o<i;o++)s&&(a=e[o]||SC.Record),u=t?t[o]:undefined,this.unloadRecord(a,u,undefined,r)}}else{i=n.length;for(o=0;o<i;o++)f=n?n[o]:undefined,this.unloadRecord(undefined,undefined,f,r)}return this},destroyRecord
:function(e,t,n){n===undefined&&(n=e.storeKeyFor(t));var r=this.readStatus(n),i,s=SC.Record;if(r===s.BUSY_DESTROYING||r&s.DESTROYED)return this;if(r&s.BUSY)throw s.BUSY_ERROR;r===s.READY_NEW?r=s.DESTROYED_CLEAN:r=s.DESTROYED_DIRTY,this.writeStatus(n,r),this.dataHashDidChange(n),i=this.changelog,i||(i=this.changelog=SC.Set.create()),r&s.DIRTY?i.add(n):i.remove(n),this.changelog=i,this.get("commitRecordsAutomatically")&&this.invokeLast(this.commitRecords);var o=this;return this._propagateToChildren(n,function(e){o.destroyRecord(null,null,e)}),this},destroyRecords:function(e,t,n){var r,i,s,o,u,a;if(n===undefined){r=t.length,i=SC.typeOf(e)===SC.T_ARRAY,i||(u=e);for(s=0;s<r;s++)i&&(u=e[s]||SC.Record),o=t?t[s]:undefined,this.destroyRecord(u,o,undefined)}else{r=n.length;for(s=0;s<r;s++)a=n?n[s]:undefined,this.destroyRecord(undefined,undefined,a)}return this},registerChildToParent:function(e,t,n){var r,i,s,o,u;i=this.childRecords||{},r=this.parentRecords||{},s=i[t],s&&(o=r[s],delete o[t]),u=r[e]||{},u[t]=n||YES,r[e]=u,i[t]=e,this.writeStatus(t,this.statuses[e]),this.childRecords=i,this.parentRecords=r},materializeParentRecord:function(e){var t,n;return SC.none(e)?null:(n=this.childRecords,t=n?this.childRecords[e]:null,SC.none(t)?null:this.materializeRecord(t))},parentStoreKeyExists:function(e){if(SC.none(e))return;var t=this.childRecords||{};return t[e]},_propagateToChildren:function(e,t){if(SC.none(this.parentRecords))return;var n=this.parentRecords[e]||{};if(SC.none(t))return;for(var r in n)n.hasOwnProperty(r)&&t(r)},recordDidChange:function(e,t,n,r,i){n===undefined&&(n=e.storeKeyFor
(t));var s=this.readStatus(n),o,u=SC.Record;if(s&u.BUSY)throw u.BUSY_ERROR;if(!(s&u.READY))throw u.NOT_FOUND_ERROR;return s!=u.READY_NEW&&this.writeStatus(n,u.READY_DIRTY),this.dataHashDidChange(n,null,i,r),o=this.changelog,o||(o=this.changelog=SC.Set.create()),o.add(n),this.changelog=o,this.get("commitRecordsAutomatically")&&this.invokeLast(this.commitRecords),this},recordsDidChange:function(e,t,n){var r,i,s,o,u,a;if(n===undefined){r=t.length,i=SC.typeOf(e)===SC.T_ARRAY,i||(u=e);for(s=0;s<r;s++)i&&(u=e[s]||SC.Record),o=t?t[s]:undefined,a=n?n[s]:undefined,this.recordDidChange(u,o,a)}else{r=n.length;for(s=0;s<r;s++)a=n?n[s]:undefined,this.recordDidChange(undefined,undefined,a)}return this},retrieveRecords:function(e,t,n,r,i){var s=this._getDataSource(),o=SC.typeOf(e)===SC.T_ARRAY,u=SC.typeOf(i)===SC.T_ARRAY,a=n?n.length:t.length,f=[],l=SC.Store.generateStoreKey(),c=SC.Record,h,p,d,v,m,g;o||(h=e);for(p=0;p<a;p++){n?d=n[p]:(o&&(h=e[p]),d=h.storeKeyFor(t[p])),g=u?i[p]:i,v=this.readStatus(d);if(v==c.EMPTY||v==c.ERROR||v==c.DESTROYED_CLEAN)this.writeStatus(d,c.BUSY_LOADING),this.dataHashDidChange(d,l,YES),f.push(d),this._setCallbackForStoreKey(d,g,u,n);else if(r)if(v&c.READY)this.writeStatus(d,c.BUSY_REFRESH|v&3),this.dataHashDidChange(d,l,YES),f.push(d),this._setCallbackForStoreKey(d,g,u,n);else{if(v==c.BUSY_DESTROYING||v==c.BUSY_CREATING||v==c.BUSY_COMMITTING)throw c.BUSY_ERROR;if(v==c.DESTROYED_DIRTY)throw c.BAD_STATE_ERROR}}m=NO,s&&(m=s.retrieveRecords.call(s,this,f,t));if(!m){a=f.length,l=SC.Store.generateStoreKey();for(p=0;p<a;p++)d=f[p],v=this.readStatus(d),v===c.BUSY_LOADING?
(this.writeStatus(d,c.ERROR),this.dataHashDidChange(d,l,YES)):v&c.BUSY_REFRESH&&(this.writeStatus(d,c.READY|v&3),this.dataHashDidChange(d,l,YES));f.length=0}return f},_TMP_RETRIEVE_ARRAY:[],_callback_queue:{},_setCallbackForStoreKey:function(e,t,n,r){var i=this._callback_queue;n?i[e]={callback:t,otherKeys:r}:i[e]=t},_retreiveCallbackForStoreKey:function(e){var t=this._callback_queue,n=t[e],r,i;n&&(SC.typeOf(n)===SC.T_FUNCTION?(n.call(),delete t[e]):SC.typeOf(n)==SC.T_HASH&&(n.completed=YES,i=n.storeKeys,i.forEach(function(e){t[e].completed||(r=YES)}),r&&(n.callback.call(),i.forEach(function(e){delete t[e]}))))},_cancelCallback:function(e){var t=this._callback_queue;t[e]&&delete t[e]},retrieveRecord:function(e,t,n,r,i){var s=this._TMP_RETRIEVE_ARRAY,o;return n?(s[0]=n,n=s,t=null):(s[0]=t,t=s),o=this.retrieveRecords(e,t,n,r,i),s.length=0,o[0]},refreshRecord:function(e,t,n,r){return!!this.retrieveRecord(e,t,n,YES,r)},refreshRecords:function(e,t,n,r){var i=this.retrieveRecords(e,t,n,YES,r);return i&&i.length>0},commitRecords:function(e,t,n,r,i){var s=this._getDataSource(),o=SC.typeOf(e)===SC.T_ARRAY,u=SC.typeOf(i)===SC.T_ARRAY,a=[],f=[],l=[],c=SC.Store.generateStoreKey(),h=SC.Record,p,d,v,m,g,y,b,w;!e&&!t&&!n&&(n=this.changelog),b=n?n.get("length"):t?t.get("length"):0;for(d=0;d<b;d++){n?v=n[d]:(o?p=e[d]||SC.Record:p=e,v=p.storeKeyFor(t[d])),w=u?i[d]:i,m=this.readStatus(v);if(m==h.EMPTY||m==h.ERROR)throw h.NOT_FOUND_ERROR;m==h.READY_NEW?(this.writeStatus(v,h.BUSY_CREATING),this.dataHashDidChange(v,c,YES),a.push(v),this._setCallbackForStoreKey(v,w,u,n)):m==h.READY_DIRTY?(this.writeStatus
(v,h.BUSY_COMMITTING),this.dataHashDidChange(v,c,YES),f.push(v),this._setCallbackForStoreKey(v,w,u,n)):m==h.DESTROYED_DIRTY?(this.writeStatus(v,h.BUSY_DESTROYING),this.dataHashDidChange(v,c,YES),l.push(v),this._setCallbackForStoreKey(v,w,u,n)):m==h.DESTROYED_CLEAN&&this.dataHashDidChange(v,c,YES)}return s&&(b>0||r)&&(y=s.commitRecords.call(s,this,a,f,l,r)),y&&!e&&!t&&(n===this.changelog?this.changelog=null:this.changelog.removeEach(n)),y},commitRecord:function(e,t,n,r,i){var s=this._TMP_RETRIEVE_ARRAY,o;return t===undefined&&n===undefined?NO:(n!==undefined?(s[0]=n,n=s,t=null):(s[0]=t,t=s),o=this.commitRecords(e,t,n,r,i),s.length=0,o)},cancelRecords:function(e,t,n){var r=this._getDataSource(),i=SC.typeOf(e)===SC.T_ARRAY,s=SC.Record,o=[],u,a,f,l,c,h;a=n===undefined?t.length:n.length;for(f=0;f<a;f++){i?c=e[f]||SC.Record:c=e||SC.Record,l=t?t[f]:undefined,n===undefined?h=c.storeKeyFor(l):h=n?n[f]:undefined;if(h){u=this.readStatus(h);if(u==s.EMPTY||u==s.ERROR)throw s.NOT_FOUND_ERROR;o.push(h),this._cancelCallback(h)}}return r&&r.cancel.call(r,this,o),this},cancelRecord:function(e,t,n){var r=this._TMP_RETRIEVE_ARRAY,i;return n!==undefined?(r[0]=n,n=r,t=null):(r[0]=t,t=r),i=this.cancelRecords(e,t,n),r.length=0,this},loadRecord:function(e,t,n){var r=SC.Record,i,s,o;return e=e||SC.Record,s=e.prototype.primaryKey,n=n||t[s],i=o=e.storeKeyFor(n),this.readStatus(o)&r.BUSY?this.dataSourceDidComplete(o,t,n):this.pushRetrieve(e,n,t,o),i},loadRecords:function(e,t,n){var r=SC.typeOf(e)===SC.T_ARRAY,i=t.get("length"),s=[],o=SC.Record,u,a,f,l,c,h;r||(u=e||SC.Record,f=u.prototype.primaryKey);for(
l=0;l<i;l++)c=t.objectAt(l),r&&(u=e.objectAt(l)||SC.Record,f=u.prototype.primaryKey),a=n?n.objectAt(l):c[f],s[l]=this.loadRecord(u,c,a);return s},readError:function(e){var t=this.recordErrors;return t?t[e]:undefined},readQueryError:function(e){var t=this.queryErrors;return t?t[SC.guidFor(e)]:undefined},dataSourceDidCancel:function(e){var t=this.readStatus(e),n=SC.Record;if(!(t&n.BUSY))throw n.BAD_STATE_ERROR;switch(t){case n.BUSY_LOADING:t=n.EMPTY;break;case n.BUSY_CREATING:t=n.READY_NEW;break;case n.BUSY_COMMITTING:t=n.READY_DIRTY;break;case n.BUSY_REFRESH_CLEAN:t=n.READY_CLEAN;break;case n.BUSY_REFRESH_DIRTY:t=n.READY_DIRTY;break;case n.BUSY_DESTROYING:t=n.DESTROYED_DIRTY;break;default:throw n.BAD_STATE_ERROR}return this.writeStatus(e,t),this.dataHashDidChange(e,null,YES),this._cancelCallback(e),this},dataSourceDidComplete:function(e,t,n){var r=this.readStatus(e),i=SC.Record,s;if(!(r&i.BUSY))throw i.BAD_STATE_ERROR;if(r===i.BUSY_DESTROYING)throw i.BAD_STATE_ERROR;r=i.READY_CLEAN,this.writeStatus(e,r),t&&this.writeDataHash(e,t,r),n&&SC.Store.replaceIdFor(e,n),s=t||n?NO:YES,this.dataHashDidChange(e,null,s);var o=this.materializeRecord(e);return o!=null&&o.notifyPropertyChange("status"),this._retreiveCallbackForStoreKey(e),this},dataSourceDidDestroy:function(e){var t=this.readStatus(e),n=SC.Record;if(!(t&n.BUSY))throw n.BAD_STATE_ERROR;t=n.DESTROYED_CLEAN,this.removeDataHash(e,t),this.dataHashDidChange(e);var r=this.materializeRecord(e);return r!=null&&r.notifyPropertyChange("status"),this._retreiveCallbackForStoreKey(e),this},dataSourceDidError:function(e,t){var n=this.readStatus
(e),r=this.recordErrors,i=SC.Record;if(!(n&i.BUSY))throw i.BAD_STATE_ERROR;n=i.ERROR,t&&t.isError&&(r||(r=this.recordErrors=[]),r[e]=t),this.writeStatus(e,n),this.dataHashDidChange(e,null,YES);var s=this.materializeRecord(e);return s!=null&&s.notifyPropertyChange("status"),this._retreiveCallbackForStoreKey(e),this},pushRetrieve:function(e,t,n,r){var i=SC.Record,s;return r===undefined&&(r=e.storeKeyFor(t)),s=this.readStatus(r),s==i.EMPTY||s==i.ERROR||s==i.READY_CLEAN||s==i.DESTROYED_CLEAN?(s=i.READY_CLEAN,n===undefined?this.writeStatus(r,s):this.writeDataHash(r,n,s),this.dataHashDidChange(r),r):NO},pushDestroy:function(e,t,n){var r=SC.Record,i;return n===undefined&&(n=e.storeKeyFor(t)),i=this.readStatus(n),i==r.EMPTY||i==r.ERROR||i==r.READY_CLEAN||i==r.DESTROYED_CLEAN?(i=r.DESTROYED_CLEAN,this.removeDataHash(n,i),this.dataHashDidChange(n),n):NO},pushError:function(e,t,n,r){var i=SC.Record,s,o=this.recordErrors;return r===undefined&&(r=e.storeKeyFor(t)),s=this.readStatus(r),s==i.EMPTY||s==i.ERROR||s==i.READY_CLEAN||s==i.DESTROYED_CLEAN?(s=i.ERROR,n&&n.isError&&(o||(o=this.recordErrors=[]),o[r]=n),this.writeStatus(r,s),this.dataHashDidChange(r,null,YES),r):NO},loadQueryResults:function(e,t){if(e.get("location")===SC.Query.LOCAL)throw new Error("Cannot load query results for a local query");var n=this._findQuery(e,YES,NO);return n&&n.set("storeKeys",t),this.dataSourceDidFetchQuery(e),this},dataSourceDidFetchQuery:function(e){return this._scstore_dataSourceDidFetchQuery(e,YES)},_scstore_dataSourceDidFetchQuery:function(e,t){var n=this._findQuery(e,t,NO),r=this.get("nestedStores")
,i=r?r.get("length"):0;n&&n.storeDidFetchQuery(e);while(--i>=0)r[i]._scstore_dataSourceDidFetchQuery(e,NO);return this},dataSourceDidCancelQuery:function(e){return this._scstore_dataSourceDidCancelQuery(e,YES)},_scstore_dataSourceDidCancelQuery:function(e,t){var n=this._findQuery(e,t,NO),r=this.get("nestedStores"),i=r?r.get("length"):0;n&&n.storeDidCancelQuery(e);while(--i>=0)r[i]._scstore_dataSourceDidCancelQuery(e,NO);return this},dataSourceDidErrorQuery:function(e,t){var n=this.queryErrors;return t&&t.isError&&(n||(n=this.queryErrors={}),n[SC.guidFor(e)]=t),this._scstore_dataSourceDidErrorQuery(e,YES)},_scstore_dataSourceDidErrorQuery:function(e,t){var n=this._findQuery(e,t,NO),r=this.get("nestedStores"),i=r?r.get("length"):0;n&&n.storeDidErrorQuery(e);while(--i>=0)r[i]._scstore_dataSourceDidErrorQuery(e,NO);return this},init:function(){arguments.callee.base.apply(this,arguments),this.reset()},toString:function(){var e=this.get("name");if(!e)return arguments.callee.base.apply(this,arguments);var t=arguments.callee.base.apply(this,arguments);return"%@ (%@)".fmt(e,t)},idFor:function(e){return SC.Store.idFor(e)},recordTypeFor:function(e){return SC.Store.recordTypeFor(e)},storeKeyFor:function(e,t){return e.storeKeyFor(t)},storeKeyExists:function(e,t){return e.storeKeyExists(t)},storeKeysFor:function(e){var t=[],n=e&&e.isEnumerable,r,i,s;if(!this.statuses)return t;for(i in SC.Store.recordTypesByStoreKey)r=SC.Store.recordTypesByStoreKey[i],n?s=e.contains(r):s=r===e,s&&this.statuses[i]&&t.push(parseInt(i,10));return t},storeKeys:function(){var e=[],t;if(!this.statuses)return e;for(
t in this.statuses)this.statuses[t]!=SC.Record.EMPTY&&e.push(parseInt(t,10));return e},statusString:function(e){var t=this.materializeRecord(e);return t.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(e){return this.idsByStoreKey[e]},queryFor:function(e){return this.queriesByStoreKey[e]},recordTypeFor:function(e){return this.recordTypesByStoreKey[e]},replaceIdFor:function(e,t){var n=this.idsByStoreKey[e],r,i;if(n!==t){r=this.recordTypeFor(e);if(!r)throw new Error("replaceIdFor: storeKey %@ does not exist".fmt(e));this.idsByStoreKey[e]=t,i=r.storeKeysById(),delete i[n],i[t]=e}return this},replaceRecordTypeFor:function(e,t){return this.recordTypesByStoreKey[e]=t,this}}),SC.Store.prototype.nextStoreIndex=1,SC.Store._getDefaultStore=function(){var e=this._store;return e||(this._store=e=SC.Store.create()),e},SC.Store.updateRecords=function(e,t,n,r){SC.Logger.warn("SC.Store.updateRecords() is deprecated. Use loadRecords() instead");var i=this._getDefaultStore(),s=e.length,o,u;if(!n){n=[];for(o=0;o<s;o++)n[o]=e[o].recordType}u=i.loadRecords(n,e),s=u.length;for(o=0;o<s;o++)u[o]=i.materializeRecord(u[o]);return u},SC.Store
.find=function(e,t){return this._getDefaultStore().find(t,e)},SC.Store.findAll=function(e,t){return this._getDefaultStore().findAll(e,t)},SC.NestedStore=SC.Store.extend({hasChanges:NO,parentStore:null,isNested:YES,lockOnRead:YES,locks:null,chainedChanges:null,find:function(e){if(e&&e.isQuery&&e.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(e){if(this.get("hasChanges")){var t=this.get("parentStore");t.commitChangesFromNestedStore(this,this.chainedChanges,e)}return this.reset(),this},discardChanges:function(){var e,t;if((e=this.records)&&(t=this.locks)){var n=this.get("parentStore"),r=n.revisions,i=this.revisions,s,o,u;for(s in e){if(!e.hasOwnProperty(s))continue;if(!(o=t[s]))continue;u=r[s],(u!==o||i[s]>u)&&this._notifyRecordPropertyChange(parseInt(s,10))}}return this.reset(),this.flush(),this},destroy:function(){this.discardChanges();var e=this.get("parentStore");return e&&e.willDestroyNestedStore(this),arguments.callee.base.apply(this,arguments),this},reset:function(){var e,t,n,r=this.get("parentStore");if(!r)throw SC.Store.NO_PARENT_STORE_ERROR;this.dataHashes=SC.beget(r.dataHashes),this.revisions=SC.beget(r.revisions),this.statuses=SC.beget(r.statuses),this.childRecords=r.childRecords?SC.beget(r.childRecords):{},this.parentRecords=r.parentRecords?SC.beget(r.parentRecords):{},this.chainedChanges=this.locks=this.editables=null,this.changelog=null,this.set("hasChanges",NO)},refreshQuery:function(e){var t=this.get("parentStore");return t&&t.refreshQuery
(e),this},readError:function(e){var t=this.get("parentStore");return t?t.readError(e):null},readQueryError:function(e){var t=this.get("parentStore");return t?t.readQueryError(e):null},storeKeyEditState:function(e){var t=this.editables,n=this.locks;return t&&t[e]?SC.Store.EDITABLE:n&&n[e]?SC.Store.LOCKED:SC.Store.INHERITED},_lock:function(e){var t=this.locks,n,r,i,s,o,u,a,f;if(t&&t[e])return this;t||(t=this.locks=[]),r=this.editables,r&&(r[e]=0);var l=this.get("parentStore"),c;while(l&&(c=l.storeKeyEditState(e))===SC.Store.INHERITED)l=l.get("parentStore");return l&&c===SC.Store.EDITABLE?(i=this.childRecords[e],i?(this._lock(i),s=this.parentRecords[i],s&&(o=s[e],u=o?SC.tupleForPropertyPath(o,this.dataHashes[i]):null,u&&(a=u[0],f=u[1]),this.dataHashes[e]=a&&f?a[f]:null)):this.dataHashes[e]=SC.clone(l.dataHashes[e],YES),r||(r=this.editables=[]),r[e]=1):this.dataHashes[e]=l.dataHashes[e],this.statuses[e]=this.statuses[e],n=this.revisions[e]=this.revisions[e],t[e]=n||1,this},readDataHash:function(e){return this.get("lockOnRead")&&this._lock(e),this.dataHashes[e]},readEditableDataHash:function(e){return this._lock(e),arguments.callee.base.apply(this,arguments)},writeDataHash:function(e,t,n){var r=this.locks,i=NO,s;t?this.dataHashes[e]=t:(this._lock(e),i=YES),n?this.statuses[e]=n:i||(this.statuses[e]=this.statuses[e]||SC.Record.READY_NEW),i||(s=this.revisions[e]=this.revisions[e],r||(r=this.locks=[]),r[e]||(r[e]=s||1));var o=this.editables;return o||(o=this.editables=[]),o[e]=1,this},removeDataHash:function(e,t){var n=this.locks;return n||(n=this.locks=[]),n[e]||(n[e]=this.revisions
[e]||1),arguments.callee.base.apply(this,arguments)},dataHashDidChange:function(e,t,n,r){t||(t=SC.Store.generateStoreKey());var i,s,o,u;i=SC.typeOf(e)===SC.T_ARRAY,i?s=e.length:(s=1,u=e);var a=this.chainedChanges;a||(a=this.chainedChanges=SC.Set.create());for(o=0;o<s;o++)i&&(u=e[o]),this._lock(u),this.revisions[u]=t,a.add(u),this._notifyRecordPropertyChange(u,n,r);return this.setIfChanged("hasChanges",YES),this},commitChangesFromNestedStore:function(e,t,n){arguments.callee.base.apply(this,arguments);var r=this.get("parentStore"),i=r.revisions,s,o=this.locks,u=this.chainedChanges,a,f;o||(o=this.locks=[]),u||(u=this.chainedChanges=SC.Set.create()),a=t.length;for(s=0;s<a;s++)f=t[s],o[f]||(o[f]=i[f]||1),u.add(f);return this.setIfChanged("hasChanges",u.get("length")>0),this.flush(),this},queryFor:function(e,t,n){return this.get("parentStore").queryFor(e,t,n)},findAll:function(e,t,n,r,i){return i||(i=this),this.get("parentStore").findAll(e,t,n,r,i)},retrieveRecords:function(e,t,n,r){var i=this.get("parentStore"),s,o,u,a=n?n.length:t.length,f=SC.Record,l;if(r)for(s=0;s<a;s++){o=n?n[s]:i.storeKeyFor(e,t[s]),l=this.peekStatus(o);if(l&f.DIRTY)throw SC.Store.NESTED_STORE_RETRIEVE_DIRTY_ERROR;var c=this.dataHashes,h=this.revisions,p=this.statuses,d=this.editables,v=this.locks,m=NO,g=NO;c&&c.hasOwnProperty(o)&&(delete c[o],m=YES),h&&h.hasOwnProperty(o)&&(delete h[o],m=YES),d&&delete d[o],v&&delete v[o],p&&p.hasOwnProperty(o)&&(delete p[o],m||(g=YES),m=YES),m&&this._notifyRecordPropertyChange(o,g)}return i.retrieveRecords(e,t,n,r)},commitRecords:function(e,t,n){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR
},commitRecord:function(e,t,n){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},cancelRecords:function(e,t,n){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},cancelRecord:function(e,t,n){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},dataSourceDidCancel:function(e){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},dataSourceDidComplete:function(e,t,n){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},dataSourceDidDestroy:function(e){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},dataSourceDidError:function(e,t){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},pushRetrieve:function(e,t,n,r){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},pushDestroy:function(e,t,n){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR},pushError:function(e,t,n,r){throw SC.Store.NESTED_STORE_UNSUPPORTED_ERROR}}),SC.RecordArray=SC.Object.extend(SC.Enumerable,SC.Array,{store:null,query:null,storeKeys:null,status:SC.Record.EMPTY,isEditable:function(){var e=this.get("query");return e?e.get("isEditable"):YES}.property("query").cacheable(),length:function(){this.flush();var e=this.get("storeKeys");return e?e.get("length"):0}.property("storeKeys").cacheable(),_scra_records:null,objectAt:function(e){this.flush();var t=this._scra_records,n=this.get("storeKeys"),r=this.get("store"),i,s;return!n||!r?undefined:t&&(s=t[e])?s:(t||(this._scra_records=t=[]),i=n.objectAt(e),i&&(r.peekStatus(i)===SC.Record.EMPTY&&r.retrieveRecord(null,null,i),t[e]=s=r.materializeRecord(i)),s)},forEach:function(e,t){this.flush();var n=this._scra_records,r=this.get("storeKeys"),i=this.get("store"),s=r?r.get("length"):0,o,u,a;if(!r||!i)return this;n||
(n=this._scra_records=[]),t||(t=this);for(o=0;o<s;o++)a=n[o],a||(a=n[o]=i.materializeRecord(r.objectAt(o))),e.call(t,a,o,this);return this},replace:function(e,t,n){this.flush();var r=this.get("storeKeys"),i=n?n.get?n.get("length"):n.length:0,s,o;if(!r)throw"Unable to edit an SC.RecordArray that does not have its storeKeys property set.";if(!this.get("isEditable"))throw SC.RecordArray.NOT_EDITABLE;o=[];for(s=0;s<i;s++)o[s]=n.objectAt(s).get("storeKey");return r.replace(e,t,o),this},contains:function(e){return this.indexOf(e)>=0},indexOf:function(e,t){if(!SC.kindOf(e,SC.Record))return SC.Logger.warn("Using indexOf on %@ with an object that is not an SC.Record".fmt(e)),-1;this.flush();var n=e.get("storeKey"),r=this.get("storeKeys");return r?r.indexOf(n,t):-1},lastIndexOf:function(e,t){if(!SC.kindOf(e,SC.Record))return SC.Logger.warn("Using lastIndexOf on %@ with an object that is not an SC.Record".fmt(e)),-1;this.flush();var n=e.get("storeKey"),r=this.get("storeKeys");return r?r.lastIndexOf(n,t):-1},add:function(e){return SC.kindOf(e,SC.Record)?(this.indexOf(e)<0&&this.pushObject(e),this):this},remove:function(e){return SC.kindOf(e,SC.Record)?(this.removeObject(e),this):this},find:function(e,t,n){return t&&t.isQuery?this.get("store").find(t.queryWithScope(this)):e.apply(this,SC.$A(arguments).slice(1))}.enhance(),refresh:function(){return this.get("store").refreshQuery(this.get("query")),this},reload:function(){return this.flush(YES),this},destroy:function(){this.get("isDestroyed")||this.get("store").recordArrayWillDestroy(this),arguments.callee.base.apply(this,arguments)},storeWillFetchQuery
:function(e){var t=this.get("status"),n=SC.Record;if(t===n.EMPTY||t===n.ERROR)t=n.BUSY_LOADING;return t&n.READY&&(t=n.BUSY_REFRESH),this.setIfChanged("status",t),this},storeDidFetchQuery:function(e){return this.setIfChanged("status",SC.Record.READY_CLEAN),this},storeDidCancelQuery:function(e){var t=this.get("status"),n=SC.Record;return t===n.BUSY_LOADING?t=n.EMPTY:t===n.BUSY_REFRESH&&(t=n.READY_CLEAN),this.setIfChanged("status",t),this},storeDidErrorQuery:function(e){return this.setIfChanged("status",SC.Record.ERROR),this},storeDidChangeStoreKeys:function(e,t){var n=this.get("query");if(n.get("location")!==SC.Query.LOCAL)return this;if(!n.containsRecordTypes(t))return this;var r=this._scq_changedStoreKeys;return r||(r=this._scq_changedStoreKeys=SC.IndexSet.create()),r.addEach(e),this.set("needsFlush",YES),this.get("storeKeys")&&this.flush(),this},flush:function(e){if(this._insideFlush)return this.set("needsFlush",YES),this;if(!this.get("needsFlush")&&!e)return this;this.set("needsFlush",NO);var t=this.get("query"),n=this.get("store");if(!n||!t||t.get("location")!==SC.Query.LOCAL)return this;this._insideFlush=YES;var r=this.get("storeKeys"),i=this._scq_changedStoreKeys,s=NO,o=SC.Record,u=[],a=new Date,f,l,c,h,p,d,v=r;if(r&&!e)i&&(i.forEach(function(e){if(u.length>0||new Date-a>SC.RecordArray.QUERY_MATCHING_THRESHOLD){u.push(e);return}l=n.peekStatus(e),!(l&o.EMPTY)&&!(l&o.DESTROYED||l===o.BUSY_DESTROYING)?(f=n.materializeRecord(e),d=!!f&&!!t.contains(f)):d=NO,d?r.indexOf(e)<0&&(s||(r=r.copy()),r.pushObject(e)):r.indexOf(e)>=0&&(s||(r=r.copy()),r.removeObject(e))},this),s=YES);
else{if(p=t.get("scope"))h=p.flush().get("storeKeys");else if(c=t.get("expandedRecordTypes"))h=SC.IndexSet.create(),c.forEach(function(e){h.addEach(n.storeKeysFor(e))});r=[],h.forEach(function(e){if(u.length>0||new Date-a>SC.RecordArray.QUERY_MATCHING_THRESHOLD){u.push(e);return}l=n.peekStatus(e),!(l&o.EMPTY)&&!(l&o.DESTROYED||l===o.BUSY_DESTROYING)&&(f=n.materializeRecord(e),f&&t.contains(f)&&r.push(e))}),s=YES}if(u.length>0){var m=this;window.setTimeout(function(){SC.run(function(){if(!m||m.get("isDestroyed"))return;m.set("needsFlush",YES),m._scq_changedStoreKeys=SC.IndexSet.create().addEach(u),m.flush()})},1)}return i&&i.clear(),s&&(r&&r===v&&(r=r.copy()),r=SC.Query.orderStoreKeys(r,t,n),SC.compare(v,r)!==0&&this.set("storeKeys",SC.clone(r))),this._insideFlush=NO,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 e=this.get("store");return e.readQueryError(this.get("query"))||SC.Record.GENERIC_ERROR}return null}.property("isError").cacheable(),propertyWillChange:function(e,t){if(e==="storeKeys"){var n=this.get("storeKeys"),r=n?n.get("length"):0,i=t?t.get("length"):0;this.arrayContentWillChange(0,r,i)}return arguments.callee.base.apply(this,arguments)},_storeKeysDidChange:function(){var e=this.get("storeKeys"),t=this._prevStoreKeys,n,r,i=this._storeKeysContentDidChange,s=this._storeKeysStateDidChange;if(e===t)return;t?(t.removeArrayObservers({target
:this,willChange:this.arrayContentWillChange,didChange:this._storeKeysContentDidChange}),n=t.get("length")):n=0,this._prevStoreKeys=e,e?(e.addArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:this._storeKeysContentDidChange}),r=e.get("length")):r=0,this._storeKeysContentDidChange(0,n,r)}.observes("storeKeys"),addArrayObservers:function(){return this.flush(),SC.Array.addArrayObservers.apply(this,arguments)},_storeKeysContentDidChange:function(e,t,n){this._scra_records&&(this._scra_records.length=0),this.arrayContentDidChange(e,t,n)},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(){return this.isEventHandler=YES,this.events=arguments,this},Function.prototype.stateObserves=function(){return this.isStateObserveHandler=YES,this.args=SC.A(arguments),this},SC.StatechartEventDelegate={isStatechartEventDelegate:YES,tryToPerform:function(e,t,n){if(!this.respondsTo(e))return NO;if(SC.typeOf(this[e])===SC.T_FUNCTION){var r=this[e](t,n);if(r!==NO)return YES}return!!this.sendEvent(e,t,n)},sendEvent:function(e,t,n){}},SC.StatechartRoutingDelegate={isStatechartDelegate:YES,isStatechartRoutingDelegate:YES,statechartUpdateLocationForState:function(e,t,n){SC.routes.set("location",t)},statechartAcquireLocationForState:function(e,t){return SC.routes.get("location")},statechartBindStateToRoute:function(e,t,n,r){SC.routes.add(n,t,r)},statechartShouldStateHandleTriggeredRoute:function(
e,t,n){return YES},statechartStateCancelledHandlingTriggeredRoute:function(e,t,n){}},SC.StatechartDelegate=SC.StatechartRoutingDelegate,SC.StatePathMatcher=SC.Object.extend({state:null,expression:null,tokens:null,init:function(){arguments.callee.base.apply(this,arguments),this._parseExpression()},_parseExpression:function(){var e=this.expression?this.expression.split("."):[],t=e.length,n=0,r,i=null,s,o=[];for(;n<t;n+=1){r=e[n];if(r.indexOf("~")>=0){r=r.split("~");if(r.length>2)throw"Invalid use of '~' at part %@".fmt(n);s=SC.StatePathMatcher._ExpandToken.create({start:r[0],end:r[1]})}else if(r==="this"){if(o.length>0)throw"Invalid use of 'this' at part %@".fmt(n);s=SC.StatePathMatcher._ThisToken.create()}else s=SC.StatePathMatcher._BasicToken.create({value:r});s.owner=this,o.push(s)}this.set("tokens",o);var u=SC.clone(o);this._chain=i=u.pop();while(s=u.pop())i.nextToken=s,i=s},lastPart:function(){var e=this.get("tokens"),t=e?e.length:0,n=t>0?e[t-1]:null;return n.get("lastPart")}.property("tokens").cacheable(),match:function(e){return this._stack=e.split("."),SC.empty(e)||SC.typeOf(e)!==SC.T_STRING?NO:this._chain.match()},_pop:function(){return this._lastPopped=this._stack.pop(),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 e=this.owner._pop(),t=this.nextToken;return this.value!==e?NO:t?t.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 e=this.start,t=this.end,n,r=this.nextToken;n=this.owner._pop();if(n!==t)return NO;while(n=this.owner._pop())if(n===e)return r?r.match():YES;return NO}}),SC.StatePathMatcher._ThisToken=SC.StatePathMatcher._Token.extend({type:"this",lastPart:"this",match:function(){var e=this.owner.state,t=e.get("substates"),n=t.length,r=0,i;i=this.owner._lastPopped;if(!i||this.owner._stack.length!==0)return NO;for(;r<n;r+=1)if(t[r].get("name")===i)return YES;return NO}}),SC.Async=SC.Object.extend({func:null,arg1:null,arg2:null,tryToPerform:function(e){var t=this.get("func"),n=this.get("arg1"),r=this.get("arg2"),i=SC.typeOf(t);i===SC.T_STRING?e.tryToPerform(t,n,r):i===SC.T_FUNCTION&&t.apply(e,[n,r])}}),SC.Async.mixin({perform:function(e,t,n){return SC.Async.create({func:e,arg1:t,arg2:n})}}),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 e=this.getPath("statechart.statechartTraceKey");return this.getPath("statechart.%@".fmt(e))}.property().cacheable(),owner:function(){var e=this.get("statechart"),t=e?e.get("statechartOwnerKey"):null,n=e?e.get(t):null;return n?n:e}.property().cacheable(),statechartDelegate:function(){return this.getPath("statechart.statechartDelegate")}.property().cacheable(),routingDelegate
:function(){return this.getPath("statechart.routingDelegateValue")}.property().cacheable(),location:function(e,t){var n=this.get("statechart"),r=this.get("routingDelegate");return t!==undefined&&r.statechartUpdateLocationForState(n,t,this),r.statechartAcquireLocationForState(n,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 e=this.get("statechart"),t=e?e.get("statechartOwnerKey"):null,n=e?e.get("statechartTraceKey"):null;e&&(e.addObserver(t,this,"_statechartOwnerDidChange"),e.addObserver(n,this,"_statechartTraceDidChange"))},destroy:function(){var e=this.get("statechart"),t=e?e.get("statechartOwnerKey"):null,n=e?e.get("statechartTraceKey"):null;e&&(e.removeObserver(t,this,"_statechartOwnerDidChange"),e.removeObserver(n,this,"_statechartTraceDidChange"));var r=this.get("substates");r&&r.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 e=null,t=null,n=null,r=null,i=this.constructor,s=null,o=[],u=NO,a=this.get("initialSubstate"),f=this.get("substatesAreConcurrent"),l=this.get("statechart"),c=0,h=0,p=NO,d=null;this.set("substates",o),a&&a.isClass&&SC.kindOf(a,SC.HistoryState)&&(d=this.createSubstate(a),this.set("initialSubstate",d),SC.none(d.get("defaultState"))&&(this.stateLogError("Initial substate is invalid. History state requires the name of a default state to be set"),this.set("initialSubstate",null),d=null));for(e in this){t=this[e];if(!t)continue;r=t,n=t.isClass,p=!n&&t instanceof Function;if(p){if(t.isEventHandler){this._registerEventHandler(e,t);continue}if(t.isStateObserveHandler){this._registerStateObserveHandler(e,t);continue}t.statePlugin&&(t=t.apply(this))}t&&t.isClass&&r!==i&&SC.kindOf(t,SC.State)&&(s=this._addSubstate(e,t),e===a?(this.set("initialSubstate",s),u=YES):d&&d.get("defaultState")===e&&(d.set("defaultState",s),u=YES))}!SC.none(a)&&!u&&this.stateLogError("Unable to set initial substate %@ since it did not match any of state's %@ substates".fmt(a,this)),o.length===0?SC.none(a)||this.stateLogWarning("Unable to make %@ an initial substate since state %@ has no substates".fmt(a,this)):o.length>0&&(s=this._addEmptyInitialSubstateIfNeeded(),!s&&a&&f&&(this.set("initialSubstate",null),this.stateLogWarning("Can not use %@ as initial substate since substates are all concurrent for state %@"
.fmt(a,this)))),this.notifyPropertyChange("substates"),this.set("currentSubstates",[]),this.set("enteredSubstates",[]),this.set("stateIsInitialized",YES)},_setupRouteHandling:function(){var e=this.get("representRoute"),t=this.get("statechart"),n=this.get("routingDelegate");if(!e)return;if(this.get("isConcurrentState")){this.stateLogError("State %@ cannot handle route '%@' since state is concurrent".fmt(this,e));return}n.statechartBindStateToRoute(t,this,e,this.routeTriggered)},routeTriggered:function(e){if(this._isEnteringState)return;var t=this.get("statechart"),n=this.get("routingDelegate"),r=this.get("location"),i={state:this,location:r,params:e,handler:this.routeTriggered},s=this.createStateRouteHandlerContext(i);n.statechartShouldStateHandleTriggeredRoute(t,this,s)?(this.get("trace")&&r&&this.stateLogTrace("will handle route '%@'".fmt(r)),this.handleTriggeredRoute(s)):n.statechartStateCancelledHandlingTriggeredRoute(t,this,s)},createStateRouteHandlerContext:function(e){return SC.StateRouteHandlerContext.create(e)},handleTriggeredRoute:function(e){this.gotoState(this,e)},_addEmptyInitialSubstateIfNeeded:function(){var e=this.get("initialSubstate"),t=this.get("substatesAreConcurrent");if(e||t)return null;var n=this.createSubstate(SC.EmptyState);return this.set("initialSubstate",n),this.get("substates").push(n),this[n.get("name")]=n,n.initState(),this.stateLogWarning("state %@ has no initial substate defined. Will default to using an empty state as initial substate".fmt(this)),n},_addSubstate:function(e,t,n){var r=this.get("substates");return n=SC.clone(n)||{},n.name=e,t=this
.createSubstate(t,n),r.push(t),this[e]=t,t.initState(),t},addSubstate:function(e,t,n){if(SC.empty(e))return this.stateLogError("Can not add substate. name required"),null;if(this[e]!==undefined)return this.stateLogError("Can not add substate '%@'. Already a defined property".fmt(e)),null;if(!this.get("stateIsInitialized"))return this.stateLogError("Can not add substate '%@'. this state is not yet initialized".fmt(e)),null;var r=arguments.length;r===1?t=SC.State:r===2&&SC.typeOf(t)===SC.T_HASH&&(n=t,t=SC.State);var i=t&&t.isClass&&SC.kindOf(t,SC.State);return i?(t=this._addSubstate(e,t,n),this._addEmptyInitialSubstateIfNeeded(),this.notifyPropertyChange("substates"),t):(this.stateLogError("Can not add substate '%@'. must provide a state class".fmt(e)),null)},createSubstate:function(e,t){return t=t||{},e.create({parentState:this,statechart:this.get("statechart")},t)},_registerEventHandler:function(e,t){var n=t.events,r=null,i=n.length,s=0;this._registeredEventHandlers[e]=t;for(;s<i;s+=1){r=n[s];if(SC.typeOf(r)===SC.T_STRING){this._registeredStringEventHandlers[r]={name:e,handler:t};continue}if(r instanceof RegExp){this._registeredRegExpEventHandlers.push({name:e,handler:t,regexp:r});continue}this.stateLogError("Invalid event %@ for event handler %@ in state %@".fmt(r,e,this))}},_registerStateObserveHandler:function(e,t){var n=0,r=t.args,i=r.length,s,o=YES;for(;n<i;n+=1){s=r[n];if(SC.typeOf(s)!==SC.T_STRING||SC.empty(s))this.stateLogError("Invalid argument %@ for state observe handler %@ in state %@".fmt(s,e,this)),o=NO}if(!o)return;this._registeredStateObserveHandlers[e]=t.args
},_registerWithParentStates:function(){var e=this.get("parentState");while(!SC.none(e))e._registerSubstate(this),e=e.get("parentState")},_registerSubstate:function(e){var t=e.pathRelativeTo(this);if(SC.none(t))return;this._registeredSubstates.push(e);var n=this._registeredSubstatePaths;n[e.get("name")]===undefined&&(n[e.get("name")]={});var r=n[e.get("name")];r[t]=e},pathRelativeTo:function(e){var t=this.get("name"),n=this.get("parentState");while(!SC.none(n)&&n!==e)t="%@.%@".fmt(n.get("name"),t),n=n.get("parentState");return n!==e&&e!==this?(this.stateLogError("Can not generate relative path from %@ since it not a parent state of %@".fmt(e,this)),null):t},getSubstate:function(e,t,n){if(!e)return null;var r=SC.typeOf(e);if(r===SC.T_OBJECT)return this._registeredSubstates.indexOf(e)>-1?e:null;if(r!==SC.T_STRING)return this.stateLogError("Can not find matching subtype. value must be an object or string: %@".fmt(e)),null;var i=SC.StatePathMatcher.create({state:this,expression:e}),s=[],o;if(i.get("tokens").length===0)return null;var u=this._registeredSubstatePaths[i.get("lastPart")];if(!u)return this._notifySubstateNotFound(t,n,e);for(o in u)i.match(o)&&s.push(u[o]);if(s.length===1)return s[0];if(s.length>1){var a=[];for(o in u)a.push(o);if(t)return this._notifySubstateNotFound(t,n,e,a);var f="Can not find substate matching '%@' in state %@. Ambiguous with the following: %@";this.stateLogError(f.fmt(e,this.get("fullPath"),a.join(", ")))}return this._notifySubstateNotFound(t,n,e)},_notifySubstateNotFound:function(e,t,n,r){return e?e.call(t||this,this,n,r):null},getState:function(
e){return e===this.get("name")?this:SC.kindOf(e,SC.State)?e:this.getSubstate(e,this._handleSubstateNotFound)},_handleSubstateNotFound:function(e,t,n){var r=this.get("parentState");if(r)return r.getState(t);if(n){var i="Can not find state matching '%@'. Ambiguous with the following: %@";this.stateLogError(i.fmt(t,n.join(", ")))}return null},gotoState:function(e,t){var n=this.getState(e);if(!n){var r="can not go to state %@ from state %@. Invalid value.";this.stateLogError(r.fmt(e,this));return}var i=this.findFirstRelativeCurrentState(n);this.get("statechart").gotoState(n,i,!1,t)},gotoHistoryState:function(e,t,n){var r=this.getState(e);if(!r){var i="can not go to history state %@ from state %@. Invalid value.";this.stateLogError(i.fmt(e,this));return}var s=this.findFirstRelativeCurrentState(r);this.get("statechart").gotoHistoryState(r,s,t,n)},resumeGotoState:function(){this.get("statechart").resumeGotoState()},stateIsCurrentSubstate:function(e){SC.typeOf(e)===SC.T_STRING&&(e=this.get("statechart").getState(e));var t=this.get("currentSubstates");return!!t&&t.indexOf(e)>=0},stateIsEnteredSubstate:function(e){SC.typeOf(e)===SC.T_STRING&&(e=this.get("statechart").getState(e));var t=this.get("enteredSubstates");return!!t&&t.indexOf(e)>=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 e=this.get("currentSubstates");return!!e&&e.get("length")>0}.property("currentSubstates").cacheable(),hasEnteredSubstates:function(){var e=this.get("enteredSubstates");return!!e&&e.get("length")>0}.property("enteredSubstates").cacheable(),findFirstRelativeCurrentState:function(e){if(this.get("isCurrentState"))return this;var t=this.get("currentSubstates")||[],n=t.get("length"),r=this.get("parentState");if(n===0)return r?r.findFirstRelativeCurrentState():null;if(n>1){e=this.getSubstate(e);if(e)return e.findFirstRelativeCurrentState()}return t[0]},reenter:function(){this.get("isEnteredState")?this.gotoState(this):SC.Logger.error("Can not re-enter state %@ since it is not an entered state in the statechart".fmt(this))},tryToHandleEvent:function(e,t,n){var r=this.get("trace"),i=this.get("statechart"),s;if(this._registeredEventHandlers[e])return this.stateLogWarning("state %@ can not handle event '%@' since it is a registered event handler".fmt(this,e)),NO;if(this._registeredStateObserveHandlers[e])return this.stateLogWarning("state %@ can not handle event '%@' since it is a registered state observe handler".fmt(this,e)),NO;if(SC.typeOf(this[e])===SC.T_FUNCTION)return r&&this.stateLogTrace("will handle event '%@'".fmt(e)),i.stateWillTryToHandleEvent(this,e,e),s=this[e](t,n)!==NO,i.stateDidTryToHandleEvent(this,e,e,s),s;var o=this._registeredStringEventHandlers[e];if(o)return r&&this.stateLogTrace("%@ will handle event '%@'"
.fmt(o.name,e)),i.stateWillTryToHandleEvent(this,e,o.name),s=o.handler.call(this,e,t,n)!==NO,i.stateDidTryToHandleEvent(this,e,o.name,s),s;var u=this._registeredRegExpEventHandlers.length,a=0;for(;a<u;a+=1){o=this._registeredRegExpEventHandlers[a];if(e.match(o.regexp))return r&&this.stateLogTrace("%@ will handle event '%@'".fmt(o.name,e)),i.stateWillTryToHandleEvent(this,e,o.name),s=o.handler.call(this,e,t,n)!==NO,i.stateDidTryToHandleEvent(this,e,o.name,s),s}return SC.typeOf(this.unknownEvent)===SC.T_FUNCTION?(r&&this.stateLogTrace("unknownEvent will handle event '%@'".fmt(e)),i.stateWillTryToHandleEvent(this,e,"unknownEvent"),s=this.unknownEvent(e,t,n)!==NO,i.stateDidTryToHandleEvent(this,e,"unknownEvent",s),s):NO},enterState:function(e){},stateWillBecomeEntered:function(e){this._isEnteringState=YES},stateDidBecomeEntered:function(e){this._setupAllStateObserveHandlers(),this._isEnteringState=NO},exitState:function(e){},stateWillBecomeExited:function(e){this._isExitingState=YES,this._teardownAllStateObserveHandlers()},stateDidBecomeExited:function(e){this._isExitingState=NO},_setupAllStateObserveHandlers:function(){this._configureAllStateObserveHandlers("addObserver")},_teardownAllStateObserveHandlers:function(){this._configureAllStateObserveHandlers("removeObserver")},_configureAllStateObserveHandlers:function(e){var t,n,r,i,s,o,u,a;for(t in this._registeredStateObserveHandlers){n=this._registeredStateObserveHandlers[t];for(u=0;u<n.length;u+=1)s=n[u],o=t,i=s.indexOf("."),i<0?this[e](s,this,o):s.indexOf("*")===0?this[e](s.slice(1),this,o):(a=null,i===0?(a=this,s=s.slice(1))
:i===4&&s.slice(0,5)==="this."?(a=this,s=s.slice(5)):i<0&&s.length===4&&s==="this"&&(a=this,s=""),SC.Observers[e](s,this,o,a))}},performAsync:function(e,t,n){return SC.Async.perform(e,t,n)},respondsToEvent:function(e){if(this._registeredEventHandlers[e])return!1;if(SC.typeOf(this[e])===SC.T_FUNCTION)return!0;if(this._registeredStringEventHandlers[e])return!0;if(this._registeredStateObserveHandlers[e])return!1;var t=this._registeredRegExpEventHandlers.length,n=0,r;for(;n<t;n+=1){r=this._registeredRegExpEventHandlers[n];if(e.match(r.regexp))return!0}return SC.typeOf(this.unknownEvent)===SC.T_FUNCTION},fullPath:function(){var e=this.getPath("statechart.rootState");return e?this.pathRelativeTo(e):this.get("name")}.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(e){var t=this.get("statechart");t.statechartLogTrace("%@: %@".fmt(this,e))},stateLogWarning:function(e){var t=this.get("statechart");t.statechartLogWarning(e)},stateLogError:function(e){var t=this.get("statechart");t.statechartLogError(e)}}),SC.State.plugin=function(e){var t=SC.A(arguments);t.shift();var n=function(){var n=SC.objectForPropertyPath(e);return n?!n.isClass||!n.kindOf(
SC.State)?(console.error("SC.State.plugin: Unable to extend. %@ must be a class extending from SC.State".fmt(e)),undefined):n.extend.apply(n,t):(console.error("SC.State.plugin: Unable to determine path %@".fmt(e)),undefined)};return n.statePlugin=YES,n},SC.State.design=SC.State.extend,SC.EMPTY_STATE_NAME="__EMPTY_STATE__",SC.EmptyState=SC.State.extend({name:SC.EMPTY_STATE_NAME,enterState:function(){var e="No initial substate was defined for state %@. Entering default empty state";this.stateLogWarning(e.fmt(this.get("parentState")))}}),SC.HistoryState=SC.Object.extend({isRecursive:NO,defaultState:null,statechart:null,parentState:null,state:function(){var e=this.get("defaultState"),t=this.getPath("parentState.historyState");return t?t:e}.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 e=this.get("state"),t=this.get("params"),n=this.get("handler");SC.typeOf(n)===SC.T_STRING&&(n=e[n]),SC.typeOf(n)===SC.T_FUNCTION&&n.apply(e,[t])}}),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 e=this.get("delegate");return this.delegateFor("isStatechartDelegate"
,e)}.property("delegate"),routingDelegate:null,eventDelegate:null,routingDelegateValue:function(){var e=this.get("routingDelegate"),t=this.get("delegate");return this.delegateFor("isStatechartRoutingDelegate",e,t)}.property("routingDelegate").cacheable(),initMixin:function(){this.get("autoInitStatechart")&&this.initStatechart()},destroyMixin:function(){var e=this.get("rootState"),t=this.get("statechartTraceKey");this.removeObserver(t,this,"_statechartTraceDidChange"),e.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,this.get("monitorIsActive")&&this.set("monitor",SC.StatechartMonitor.create({statechart:this}));var e=this.get("statechartTraceKey");this.addObserver(e,this,"_statechartTraceDidChange"),this._statechartTraceDidChange();var t=this.get("allowStatechartTracing"),n=this.get("rootState"),r;t&&this.statechartLogTrace("BEGIN initialize statechart"),n?SC.typeOf(n)===SC.T_FUNCTION&&n.statePlugin&&(n=n.apply(this)):n=this._constructRootStateClass();if(!SC.kindOf(n,SC.State)||!n.isClass)throw r="Unable to initialize statechart. Root state must be a state class",this.statechartLogError(r),r;n=this.createRootState(n,{statechart:this,name:SC.ROOT_STATE_NAME}),this.set("rootState",n),n.initState();if(SC.kindOf(n.get("initialSubstate"),SC.EmptyState))throw r="Unable to initialize statechart. Root state must have an initial substate explicilty defined",this.statechartLogError(r),r
;if(!SC.empty(this.get("initialState"))){var i="initialState";this.set(i,n.get(this.get(i)))}this.set("statechartIsInitialized",YES),this.gotoState(n),t&&this.statechartLogTrace("END initialize statechart")},createRootState:function(e,t){return t||(t={}),e=e.create(t),e},currentStates:function(){return this.getPath("rootState.currentSubstates")}.property().cacheable(),firstCurrentState:function(){var e=this.get("currentStates");return e?e.objectAt(0):null}.property("currentStates").cacheable(),currentStateCount:function(){return this.getPath("currentStates.length")}.property("currentStates").cacheable(),stateIsCurrentState:function(e){return this.get("rootState").stateIsCurrentSubstate(e)},enteredStates:function(){return this.getPath("rootState.enteredSubstates")}.property().cacheable(),stateIsEntered:function(e){return this.get("rootState").stateIsEnteredSubstate(e)},doesContainState:function(e){return!SC.none(this.getState(e))},getState:function(e){var t=this.get("rootState");return t===e?t:t.getSubstate(e)},gotoState:function(e,t,n,r){if(!this.get("statechartIsInitialized")){this.statechartLogError("can not go to state %@. statechart has not yet been initialized".fmt(e));return}if(this.get("isDestroyed")){this.statechartLogError("can not go to state %@. statechart is destroyed".fmt(this));return}var i=this._processGotoStateArgs(arguments);e=i.state,t=i.fromCurrentState,n=i.useHistory,r=i.context;var s=null,o=[],u=[],a=this.get("allowStatechartTracing"),f=this.get("rootState"),l=e,c=t,h;e=this.getState(e);if(SC.none(e)){this.statechartLogError("Can not to goto state %@. Not a recognized state in statechart"
.fmt(l));return}if(this._gotoStateLocked){this._pendingStateTransitions.push({state:e,fromCurrentState:t,useHistory:n,context:r});return}this._gotoStateLocked=YES;if(t){t=this.getState(t);if(SC.none(t)||!t.get("isCurrentState")){h="Can not to goto state %@. %@ is not a recognized current state in statechart",this.statechartLogError(h.fmt(l,c)),this._gotoStateLocked=NO;return}}else t=e.findFirstRelativeCurrentState(),t||(t=this.get("firstCurrentState"));a&&(this.statechartLogTrace("BEGIN gotoState: %@".fmt(e)),h="starting from current state: %@",h=h.fmt(t?t:"---"),this.statechartLogTrace(h),h="current states before: %@",h=h.fmt(this.getPath("currentStates.length")>0?this.get("currentStates"):"---"),this.statechartLogTrace(h)),SC.none(t)||(o=this._createStateChain(t)),u=this._createStateChain(e),s=this._findPivotState(o,u);if(s){a&&this.statechartLogTrace("pivot state = %@".fmt(s));if(s.get("substatesAreConcurrent")&&s!==e){this.statechartLogError("Can not go to state %@ from %@. Pivot state %@ has concurrent substates.".fmt(e,t,s)),this._gotoStateLocked=NO;return}}var p=[];this._traverseStatesToExit(o.shift(),o,s,p),s!==e?this._traverseStatesToEnter(u.pop(),u,s,n,p):(this._traverseStatesToExit(s,[],null,p),this._traverseStatesToEnter(s,null,null,n,p)),this._gotoStateActions=p,this._executeGotoStateActions(e,p,null,r)},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 e=this._gotoStateSuspendedPoint;this._executeGotoStateActions(e.gotoState,e.actions,e.marker,e.context)},_executeGotoStateActions:function(e,t,n,r){var i=null,s=t.length,o=null;n=SC.none(n)?0:n;for(;n<s;n+=1){this._currentGotoStateAction=i=t[n];switch(i.action){case SC.EXIT_STATE:o=this._exitState(i.state,r);break;case SC.ENTER_STATE:o=this._enterState(i.state,i.currentState,r)}if(SC.kindOf(o,SC.Async)){this._gotoStateSuspendedPoint={gotoState:e,actions:t,marker:n+1,context:r},o.tryToPerform(i.state);return}}this.beginPropertyChanges(),this.notifyPropertyChange("currentStates"),this.notifyPropertyChange("enteredStates"),this.endPropertyChanges(),this.get("allowStatechartTracing")&&(this.statechartLogTrace("current states after: %@".fmt(this.get("currentStates"))),this.statechartLogTrace("END gotoState: %@".fmt(e))),this._cleanupStateTransition()},_cleanupStateTransition:function(){this._currentGotoStateAction=null,this._gotoStateSuspendedPoint=null,this._gotoStateActions=null,this._gotoStateLocked=NO,this._flushPendingStateTransition()},_exitState:function(e,t){var n;if(e.get("currentSubstates").indexOf(e)>=0){n=e.get("parentState");while(n)n.get("currentSubstates").removeObject(e),n=n.get("parentState")}n=e;while(n)n.get("enteredSubstates").removeObject(e),n=n.get("parentState");this.get("allowStatechartTracing")&&this.statechartLogTrace("<-- exiting state: %@".fmt(e)),e.set("currentSubstates",[]),e.stateWillBecomeExited(t);var r=this.exitState(e,t);return e.stateDidBecomeExited(t),this.get("monitorIsActive")&&this.get("monitor").pushExitedState(e),e._traverseStatesToExit_skipState=
NO,r},exitState:function(e,t){return e.exitState(t)},_enterState:function(e,t,n){var r=e.get("parentState");r&&!e.get("isConcurrentState")&&r.set("historyState",e);if(t){r=e;while(r)r.get("currentSubstates").pushObject(e),r=r.get("parentState")}r=e;while(r)r.get("enteredSubstates").pushObject(e),r=r.get("parentState");this.get("allowStatechartTracing")&&this.statechartLogTrace("--> entering state: %@".fmt(e)),e.stateWillBecomeEntered(n);var i=this.enterState(e,n);return e.stateDidBecomeEntered(n),this.get("monitorIsActive")&&this.get("monitor").pushEnteredState(e),i},enterState:function(e,t){return e.enterStateByRoute&&SC.kindOf(t,SC.StateRouteHandlerContext)?e.enterStateByRoute(t):e.enterState(t)},gotoHistoryState:function(e,t,n,r){if(!this.get("statechartIsInitialized")){this.statechartLogError("can not go to state %@'s history state. Statechart has not yet been initialized".fmt(e));return}var i=this._processGotoStateArgs(arguments);e=i.state,t=i.fromCurrentState,n=i.useHistory,r=i.context,e=this.getState(e);if(!e){this.statechartLogError("Can not to goto state %@'s history state. Not a recognized state in statechart".fmt(e));return}var s=e.get("historyState");n?this.gotoState(e,t,YES,r):s?this.gotoState(s,t,r):this.gotoState(e,t,r)},sendEvent:function(e,t,n){if(this.get("isDestroyed")){this.statechartLogError("can send event %@. statechart is destroyed".fmt(e));return}var r=NO,i=this.get("currentStates").slice(),s={},o=[],u=NO,a=0,f=0,l=null,c=this.get("allowStatechartTracing");if(this._sendEventLocked||this._goStateLocked){this._pendingSentEvents.push({event:e,arg1:t,arg2
:n});return}this._sendEventLocked=YES;var h=this.get("eventDelegate");h&&(r=h.sendEvent(e,t,n),r&&c&&this.statechartLogTrace("eventDelegate handled event: '%@'".fmt(e)));if(!r){c&&this.statechartLogTrace("BEGIN sendEvent: '%@'".fmt(e)),a=i.get("length");for(;f<a;f+=1){l=i[f];if(!l.get("isCurrentState"))continue;while(l){var p=SC.hashFor(l);if(l.get("substatesAreConcurrent")){s[p]?s[p]++:s[p]=1;if(s[p]<l.substates.length||o.indexOf(l)!=-1)break}u=l.tryToHandleEvent(e,t,n),r=r||u;var d=l.get("parentState");u&&d&&d.get("substatesAreConcurrent")&&o.push(d);if(u)break;l=l.get("parentState")}}c&&(r||this.statechartLogTrace("No state was able handle event %@".fmt(e)),this.statechartLogTrace("END sendEvent: '%@'".fmt(e)))}this._sendEventLocked=NO;var v=this._flushPendingSentEvents();return r?this:v?this:null},stateWillTryToHandleEvent:function(e,t,n){this._stateHandleEventInfo={state:e,event:t,handler:n}},stateDidTryToHandleEvent:function(e,t,n,r){this._stateHandleEventInfo=null},_createStateChain:function(e){var t=[];while(e)t.push(e),e=e.get("parentState");return t},_findPivotState:function(e,t){if(e.length===0||t.length===0)return null;var n=e.find(function(e,n){if(t.indexOf(e)>=0)return YES});return n},_traverseStatesToExit:function(e,t,n,r){if(!e||e===n)return;var i=this.get("allowStatechartTracing");if(e.get("substatesAreConcurrent")){var s=0,o=e.get("currentSubstates"),u=o.length,a=null;for(;s<u;s+=1){a=o[s];if(a._traverseStatesToExit_skipState===YES)continue;var f=this._createStateChain(a);this._traverseStatesToExit(f.shift(),f,e,r)}}r.push({action:SC.EXIT_STATE,state:e}),e.
get("isCurrentState")&&(e._traverseStatesToExit_skipState=YES),this._traverseStatesToExit(t.shift(),t,n,r)},_traverseStatesToEnter:function(e,t,n,r,i){if(!e)return;var s=this.get("allowStatechartTracing");if(n)e!==n?this._traverseStatesToEnter(t.pop(),t,n,r,i):this._traverseStatesToEnter(t.pop(),t,null,r,i);else if(!t||t.length===0){var o={action:SC.ENTER_STATE,state:e,currentState:NO};i.push(o);var u=e.get("initialSubstate"),a=e.get("historyState");e.get("substatesAreConcurrent")?this._traverseConcurrentStatesToEnter(e.get("substates"),null,r,i):e.get("hasSubstates")&&a&&r?this._traverseStatesToEnter(a,null,null,r,i):u?(SC.kindOf(u,SC.HistoryState)&&(r||(r=u.get("isRecursive")),u=u.get("state")),this._traverseStatesToEnter(u,null,null,r,i)):o.currentState=YES}else if(t.length>0){i.push({action:SC.ENTER_STATE,state:e});var f=t.pop();this._traverseStatesToEnter(f,t,null,r,i),e.get("substatesAreConcurrent")&&this._traverseConcurrentStatesToEnter(e.get("substates"),f,r,i)}},respondsTo:function(e){var t=this.get("currentStates"),n=t.get("length"),r=0,i=null;for(;r<n;r+=1){i=t.objectAt(r);while(i){if(i.respondsToEvent(e))return!0;i=i.get("parentState")}}return SC.typeOf(this[e])===SC.T_FUNCTION},invokeStateMethod:function(e,t,n){if(e==="unknownEvent"){this.statechartLogError("can not invoke method unkownEvent");return}t=SC.A(arguments),t.shift();var r=t.length,i=r>0?t[r-1]:null,s=SC.typeOf(i)===SC.T_FUNCTION?t.pop():null,o=this.get("currentStates"),u=0,a=null,f={},l,c=undefined,h=0;r=o.get("length");for(;u<r;u+=1){a=o.objectAt(u);while(a){if(f[a.get("fullPath")])break;f[a.get("fullPath"
)]=YES,l=a[e];if(SC.typeOf(l)===SC.T_FUNCTION&&!l.isEventHandler){c=l.apply(a,t),s&&s.call(this,a,c),h+=1;break}a=a.get("parentState")}}return h===1?c:undefined},_traverseConcurrentStatesToEnter:function(e,t,n,r){var i=0,s=e.length,o=null;for(;i<s;i+=1)o=e[i],o!==t&&this._traverseStatesToEnter(o,null,null,n,r)},_flushPendingStateTransition:function(){if(!this._pendingStateTransitions){this.statechartLogError("Unable to flush pending state transition. _pendingStateTransitions is invalid");return}var e=this._pendingStateTransitions.shift();if(!e)return;this.gotoState(e.state,e.fromCurrentState,e.useHistory,e.context)},_flushPendingSentEvents:function(){var e=this._pendingSentEvents.shift();return e?this.sendEvent(e.event,e.arg1,e.arg2):null},_monitorIsActiveDidChange:function(){this.get("monitorIsActive")&&SC.none(this.get("monitor"))&&this.set("monitor",SC.StatechartMonitor.create())}.observes("monitorIsActive"),_processGotoStateArgs:function(e){var t={state:null,fromCurrentState:null,useHistory:!1,context:null},n=null,r=null;e=SC.$A(e),e=e.filter(function(e){return e!==undefined}),n=e.length;if(n<1)return t;t.state=e[0];if(n===2){r=e[1];switch(SC.typeOf(r)){case SC.T_BOOL:t.useHistory=r;break;case SC.T_HASH:case SC.T_OBJECT:SC.kindOf(r,SC.State)||(t.context=r);break;default:t.fromCurrentState=r}}else n===3?(r=e[1],SC.typeOf(r)===SC.T_BOOL?(t.useHistory=r,t.context=e[2]):(t.fromCurrentState=r,r=e[2],SC.typeOf(r)===SC.T_BOOL?t.useHistory=r:t.context=r)):(t.fromCurrentState=e[1],t.useHistory=e[2],t.context=e[3]);return t},_constructRootStateClass:function(){var e="rootStateExample"
,t=this.get(e),n=this.get("initialState"),r=this.get("statesAreConcurrent"),i=0,s,o,u,a={};SC.typeOf(t)===SC.T_FUNCTION&&t.statePlugin&&(t=t.apply(this));if(!SC.kindOf(t,SC.State)||!t.isClass)return this._logStatechartCreationError("Invalid root state example"),null;if(r&&!SC.empty(n))this._logStatechartCreationError("Can not assign an initial state when states are concurrent");else if(r)a.substatesAreConcurrent=YES;else{if(SC.typeOf(n)!==SC.T_STRING)return this._logStatechartCreationError("Must either define initial state or assign states as concurrent"),null;a.initialSubstate=n}for(s in this){if(s===e)continue;o=this[s],u=SC.typeOf(o)===SC.T_FUNCTION,u&&o.statePlugin&&(o=o.apply(this)),SC.kindOf(o,SC.State)&&o.isClass&&this[s]!==this.constructor&&(a[s]=o,i+=1)}return i===0?(this._logStatechartCreationError("Must define one or more states"),null):t.extend(a)},_logStatechartCreationError:function(e){SC.Logger.error("Unable to create statechart for %@: %@.".fmt(this,e))},statechartLogTrace:function(e){SC.Logger.info("%@: %@".fmt(this.get("statechartLogPrefix"),e))},statechartLogError:function(e){SC.Logger.error("ERROR %@: %@".fmt(this.get("statechartLogPrefix"),e))},statechartLogWarning:function(e){if(this.get("suppressStatechartWarnings"))return;SC.Logger.warn("WARN %@: %@".fmt(this.get("statechartLogPrefix"),e))},statechartLogPrefix:function(){var e=SC._object_className(this.constructor),t=this.get("name"),n;return SC.empty(t)?n="%@<%@>".fmt(e,SC.guidFor(this)):n="%@<%@, %@>".fmt(e,t,SC.guidFor(this)),n}.property().cacheable(),allowStatechartTracing:function(){var e=this.get
("statechartTraceKey");return this.get(e)}.property().cacheable(),_statechartTraceDidChange:function(){this.notifyPropertyChange("allowStatechartTracing")},details:function(){var e={initialized:this.get("statechartIsInitialized")};this.get("name")&&(e.name=this.get("name"));if(!this.get("statechartIsInitialized"))return e;e["current-states"]=[],this.get("currentStates").forEach(function(t){e["current-states"].push(t.get("fullPath"))});var t={active:this.get("gotoStateActive"),suspended:this.get("gotoStateSuspended")};if(this._gotoStateActions){t["transition-sequence"]=[];var n=this._gotoStateActions,r=function(e){var t=e.action===SC.ENTER_STATE?"enter":"exit";return"%@ %@".fmt(t,e.state.get("fullPath"))};n.forEach(function(e){t["transition-sequence"].push(r(e))}),t["current-transition"]=r(this._currentGotoStateAction)}e["state-transition"]=t;if(this._stateHandleEventInfo){var i=this._stateHandleEventInfo;e["handling-event"]={state:i.state.get("fullPath"),event:i.event,handler:i.handler}}else e["handling-event"]=!1;return e}.property(),toStringWithDetails:function(){var e="",t=this.toString(),n=this.get("details");return e+=t+"\n",e+=this._hashToString(n,2),e},_hashToString:function(e,t){var n="";for(var r in e){var i=e[r];i instanceof Array?n+=this._arrayToString(r,i,t)+"\n":i instanceof Object?(n+="%@%@:\n".fmt(" ".mult(t),r),n+=this._hashToString(i,t+2)):n+="%@%@: %@\n".fmt(" ".mult(t),r,i)}return n},_arrayToString:function(e,t,n){if(t.length===0)return"%@%@: []".fmt(" ".mult(n),e);var r="%@%@: [\n".fmt(" ".mult(n),e);return t.forEach(function(e,t){r+="%@%@\n".fmt(" ".mult
(n+2),e)},this),r+=" ".mult(n)+"]",r}},SC.supplement(SC.StatechartManager,SC.StatechartRoutingDelegate,SC.StatechartEventDelegate,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,function(){function e(){if(e.is(arguments[0],_)){var t=arguments[0],r=$t[h](e,t.splice(0,3+e.is(t[0],O))),i=r.set();for(var o=0,u=t[S];o<u;o++){var a=t[o]||{};n[s](a.type)&&i[j](r[a.type]().attr(a))}return i}return $t[h](e,arguments)}function ut(){return"r-"+CW.UUID()}function ht(e,t,n){function r(){var o=Array[i].slice.call(arguments,0),u=o[E]("►"),a=r.cache=r.cache||{},f=r.count=r.count||[];return a[s](u)?n?n(a[u]):a[u]:(f[S]>=1e3&&delete a[f.shift()],f[j](u),a[u]=e[h](t,o),n?n(a[u]):a[u])}return r}function mn(){return this.x+m+this.y}function Ln(t){return function(n,r,i,s){var o={back:t};return e.is(i,"function")?s=i:o.rot=i,n&&n.constructor==It&&(n=n.attrs.path),n&&(o.along=n),this.animate(o,r,s)}}function An(e,t,n,r,i,s){function h(e){return((a*e+u)*e+o)*e}function p(e,t){var n=d(e,t);return((c*n+l)*n+f)*n}function d(e,t){var n,r,i,s,f,l;for(i=e,l=0;l<8;l++){s=h(i)-e;if(k(s)<t)return i;f=(3*a*i+2*u)*i+o;if(k(f)<1e-6)break;i-=s/f}n=0,r=1,i=e;if(i<n)return n;if(i>r)return r;while(n<r){s=h(i);if(k(s-e)<t)return i;e>s?n=i:r=i,i=(r-n)/2+n}return i}var o=3*t,u=3*(r-t)-o,a=1-o-u,f=3*n,l=3*(i-n)-f,c=1-f-l;return p(e,1/(200*s))}e.version="1.5.2";var t=/[, ]+/,n={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},r=/\{(\d+)\}/g,i="prototype",s="hasOwnProperty"
,o=document,u=window,a={was:Object[i][s].call(u,"Raphael"),is:u.Raphael},f=function(){this.customAttributes={}},l,c="appendChild",h="apply",p="concat",d="createTouch"in o,v="",m=" ",g=String,y="split",b="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend orientationchange touchcancel gesturestart gesturechange gestureend"[y](m),w={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},E="join",S="length",x=g[i].toLowerCase,T=Math,N=T.max,C=T.min,k=T.abs,L=T.pow,A=T.PI,O="number",M="string",_="array",D="toString",P="fill",H=Object[i][D],B={},j="push",F=/^url\(['"]?([^\)]+?)['"]?\)$/i,I=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i,q={NaN:1,Infinity:1,"-Infinity":1},R=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,U=T.round,z="setAttribute",W=parseFloat,X=parseInt,V=" progid:DXImageTransform.Microsoft",$=g[i].toUpperCase,J={blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width"
:1,target:"_blank","text-anchor":"middle",title:"Raphael",translation:"0 0",width:0,x:0,y:0},K={along:"along",blur:O,"clip-rect":"csv",cx:O,cy:O,fill:"colour","fill-opacity":O,"font-size":O,height:O,opacity:O,path:"path",r:O,rotation:"csv",rx:O,ry:O,scale:"csv",stroke:"colour","stroke-opacity":O,"stroke-width":O,translation:"csv",width:O,x:O,y:O},Q="replace",G=/^(from|to|\d+%?)$/,Y=/\s*,\s*/,Z={hs:1,rg:1},et=/,?([achlmqrstvxz]),?/gi,tt=/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,nt=/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,rt=/^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/,it=function(e,t){return e.key-t.key};e.type=u.SVGAngle||o.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(e.type=="VML"){var st=o.createElement("div"),ot;st.innerHTML='<v:shape adj="1"/>',ot=st.firstChild,ot.style.behavior="url(#default#VML)";if(!ot||typeof ot.adj!="object")return e.type=null;st=null}e.svg=!(e.vml=e.type=="VML"),f[i]=e[i],l=f[i],e._id=0,e._oid=0,e.fn={},e.is=function(e,t){return t=x.call(t),t=="finite"?!q[s](+e):t=="null"&&e===null||t==typeof e||t=="object"&&e===Object(e)||t=="array"&&Array.isArray&&Array.isArray(e)||H.call(e).slice(8,-1).toLowerCase()==t},e.angle=function(t,n,r,i,s,o){if(s==null){var u=t-r,a=n-i;return!u&&!a?0:((u<0)*180+T.atan(-a/-u)*180/A+360)%360}return e.angle(t,n,s,o)-e.angle(r,i,s,o)},e.rad=function(e){return e%360*A/180},e.deg=function(e){return e*180/A%360},e.snapTo=function(t,n,r){r=e.is(r,"finite")?r:10;if(e.is(t,_)){var i=t.length;while(i--)if(k(t[i]-n)<=r)return t[i]}else{t=+t;var s=n%t;if(s<r)return n-
s;if(s>t-r)return n-s+t}return n},e.setWindow=function(e){u=e,o=u.document};var at=function(t){if(e.vml){var n=/^\s+|\s+$/g,r;try{var i=new ActiveXObject("htmlfile");i.write("<body>"),i.close(),r=i.body}catch(s){r=createPopup().document.body}var u=r.createTextRange();at=ht(function(e){try{r.style.color=g(e)[Q](n,v);var t=u.queryCommandValue("ForeColor");return t=(t&255)<<16|t&65280|(t&16711680)>>>16,"#"+("000000"+t[D](16)).slice(-6)}catch(i){return"none"}})}else{var a=o.createElement("i");a.title="Raphaël Colour Picker",a.style.display="none",o.body[c](a),at=ht(function(e){return a.style.color=e,o.defaultView.getComputedStyle(a,v).getPropertyValue("color")})}return at(t)},ft=function(){return"hsb("+[this.h,this.s,this.b]+")"},lt=function(){return"hsl("+[this.h,this.s,this.l]+")"},ct=function(){return this.hex};e.hsb2rgb=function(t,n,r,i){return e.is(t,"object")&&"h"in t&&"s"in t&&"b"in t&&(r=t.b,n=t.s,t=t.h,i=t.o),e.hsl2rgb(t,n,r/2,i)},e.hsl2rgb=function(t,n,r,i){e.is(t,"object")&&"h"in t&&"s"in t&&"l"in t&&(r=t.l,n=t.s,t=t.h);if(t>1||n>1||r>1)t/=360,n/=100,r/=100;var s={},o=["r","g","b"],u,a,f,l,c,h;if(!n)s={r:r,g:r,b:r};else{r<.5?u=r*(1+n):u=r+n-r*n,a=2*r-u;for(var p=0;p<3;p++)f=t+1/3*-(p-1),f<0&&f++,f>1&&f--,f*6<1?s[o[p]]=a+(u-a)*6*f:f*2<1?s[o[p]]=u:f*3<2?s[o[p]]=a+(u-a)*(2/3-f)*6:s[o[p]]=a}return s.r*=255,s.g*=255,s.b*=255,s.hex="#"+(16777216|s.b|s.g<<8|s.r<<16).toString(16).slice(1),e.is(i,"finite")&&(s.opacity=i),s.toString=ct,s},e.rgb2hsb=function(t,n,r){n==null&&e.is(t,"object")&&"r"in t&&"g"in t&&"b"in t&&(r=t.b,n=t.g,t=t.r);if(n==null&&e.is(t,M)){var i=e.getRGB(t);
t=i.r,n=i.g,r=i.b}if(t>1||n>1||r>1)t/=255,n/=255,r/=255;var s=N(t,n,r),o=C(t,n,r),u,a,f=s;if(o==s)return{h:0,s:0,b:s,toString:ft};var l=s-o;return a=l/s,t==s?u=(n-r)/l:n==s?u=2+(r-t)/l:u=4+(t-n)/l,u/=6,u<0&&u++,u>1&&u--,{h:u,s:a,b:f,toString:ft}},e.rgb2hsl=function(t,n,r){n==null&&e.is(t,"object")&&"r"in t&&"g"in t&&"b"in t&&(r=t.b,n=t.g,t=t.r);if(n==null&&e.is(t,M)){var i=e.getRGB(t);t=i.r,n=i.g,r=i.b}if(t>1||n>1||r>1)t/=255,n/=255,r/=255;var s=N(t,n,r),o=C(t,n,r),u,a,f=(s+o)/2,l;if(o==s)l={h:0,s:0,l:f};else{var c=s-o;a=f<.5?c/(s+o):c/(2-s-o),t==s?u=(n-r)/c:n==s?u=2+(r-t)/c:u=4+(t-n)/c,u/=6,u<0&&u++,u>1&&u--,l={h:u,s:a,l:f}}return l.toString=lt,l},e._path2string=function(){return this.join(",")[Q](et,"$1")},e.getRGB=ht(function(t){if(!t||!!((t=g(t)).indexOf("-")+1))return{r:-1,g:-1,b:-1,hex:"none",error:1};if(t=="none")return{r:-1,g:-1,b:-1,hex:"none"};!Z[s](t.toLowerCase().substring(0,2))&&t.charAt()!="#"&&(t=at(t));var n,r,i,o,u,a,f,l=t.match(I);return l?(l[2]&&(o=X(l[2].substring(5),16),i=X(l[2].substring(3,5),16),r=X(l[2].substring(1,3),16)),l[3]&&(o=X((a=l[3].charAt(3))+a,16),i=X((a=l[3].charAt(2))+a,16),r=X((a=l[3].charAt(1))+a,16)),l[4]&&(f=l[4][y](Y),r=W(f[0]),f[0].slice(-1)=="%"&&(r*=2.55),i=W(f[1]),f[1].slice(-1)=="%"&&(i*=2.55),o=W(f[2]),f[2].slice(-1)=="%"&&(o*=2.55),l[1].toLowerCase().slice(0,4)=="rgba"&&(u=W(f[3])),f[3]&&f[3].slice(-1)=="%"&&(u/=100)),l[5]?(f=l[5][y](Y),r=W(f[0]),f[0].slice(-1)=="%"&&(r*=2.55),i=W(f[1]),f[1].slice(-1)=="%"&&(i*=2.55),o=W(f[2]),f[2].slice(-1)=="%"&&(o*=2.55),(f[0].slice(-3)=="deg"||f[0].slice(-1)=="°")&&(r/=360),l[1].toLowerCase
().slice(0,4)=="hsba"&&(u=W(f[3])),f[3]&&f[3].slice(-1)=="%"&&(u/=100),e.hsb2rgb(r,i,o,u)):l[6]?(f=l[6][y](Y),r=W(f[0]),f[0].slice(-1)=="%"&&(r*=2.55),i=W(f[1]),f[1].slice(-1)=="%"&&(i*=2.55),o=W(f[2]),f[2].slice(-1)=="%"&&(o*=2.55),(f[0].slice(-3)=="deg"||f[0].slice(-1)=="°")&&(r/=360),l[1].toLowerCase().slice(0,4)=="hsla"&&(u=W(f[3])),f[3]&&f[3].slice(-1)=="%"&&(u/=100),e.hsl2rgb(r,i,o,u)):(l={r:r,g:i,b:o},l.hex="#"+(16777216|o|i<<8|r<<16).toString(16).slice(1),e.is(u,"finite")&&(l.opacity=u),l)):{r:-1,g:-1,b:-1,hex:"none",error:1}},e),e.getColor=function(e){var t=this.getColor.start=this.getColor.start||{h:0,s:1,b:e||.75},n=this.hsb2rgb(t.h,t.s,t.b);return t.h+=.075,t.h>1&&(t.h=0,t.s-=.2,t.s<=0&&(this.getColor.start={h:0,s:1,b:t.b})),n.hex},e.getColor.reset=function(){delete this.start},e.parsePathString=ht(function(t){if(!t)return null;var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=[];return e.is(t,_)&&e.is(t[0],_)&&(r=dt(t)),r[S]||g(t)[Q](tt,function(e,t,i){var s=[],o=x.call(t);i[Q](nt,function(e,t){t&&s[j](+t)}),o=="m"&&s[S]>2&&(r[j]([t][p](s.splice(0,2))),o="l",t=t=="m"?"l":"L");while(s[S]>=n[o]){r[j]([t][p](s.splice(0,n[o])));if(!n[o])break}}),r[D]=e._path2string,r}),e.findDotsAtSegment=function(e,t,n,r,i,s,o,u,a){var f=1-a,l=L(f,3)*e+L(f,2)*3*a*n+f*3*a*a*i+L(a,3)*o,c=L(f,3)*t+L(f,2)*3*a*r+f*3*a*a*s+L(a,3)*u,h=e+2*a*(n-e)+a*a*(i-2*n+e),p=t+2*a*(r-t)+a*a*(s-2*r+t),d=n+2*a*(i-n)+a*a*(o-2*i+n),v=r+2*a*(s-r)+a*a*(u-2*s+r),m=(1-a)*e+a*n,g=(1-a)*t+a*r,y=(1-a)*i+a*o,b=(1-a)*s+a*u,w=90-T.atan((h-d)/(p-v))*180/A;return(h>d||p<v)&&(w+=180),{x:l,y:c,m:{x:h,y:p},n:{x:d,y:v},start
:{x:m,y:g},end:{x:y,y:b},alpha:w}};var pt=ht(function(e){if(!e)return{x:0,y:0,width:0,height:0};e=St(e);var t=0,n=0,r=[],i=[],s;for(var o=0,u=e[S];o<u;o++){s=e[o];if(s[0]=="M")t=s[1],n=s[2],r[j](t),i[j](n);else{var a=Et(t,n,s[1],s[2],s[3],s[4],s[5],s[6]);r=r[p](a.min.x,a.max.x),i=i[p](a.min.y,a.max.y),t=s[5],n=s[6]}}var f=C[h](0,r),l=C[h](0,i);return{x:f,y:l,width:N[h](0,r)-f,height:N[h](0,i)-l}}),dt=function(t){var n=[];if(!e.is(t,_)||!e.is(t&&t[0],_))t=e.parsePathString(t);for(var r=0,i=t[S];r<i;r++){n[r]=[];for(var s=0,o=t[r][S];s<o;s++)n[r][s]=t[r][s]}return n[D]=e._path2string,n},vt=ht(function(t){if(!e.is(t,_)||!e.is(t&&t[0],_))t=e.parsePathString(t);var n=[],r=0,i=0,s=0,o=0,u=0;t[0][0]=="M"&&(r=t[0][1],i=t[0][2],s=r,o=i,u++,n[j](["M",r,i]));for(var a=u,f=t[S];a<f;a++){var l=n[a]=[],c=t[a];if(c[0]!=x.call(c[0])){l[0]=x.call(c[0]);switch(l[0]){case"a":l[1]=c[1],l[2]=c[2],l[3]=c[3],l[4]=c[4],l[5]=c[5],l[6]=+(c[6]-r).toFixed(3),l[7]=+(c[7]-i).toFixed(3);break;case"v":l[1]=+(c[1]-i).toFixed(3);break;case"m":s=c[1],o=c[2];default:for(var h=1,p=c[S];h<p;h++)l[h]=+(c[h]-(h%2?r:i)).toFixed(3)}}else{l=n[a]=[],c[0]=="m"&&(s=c[1]+r,o=c[2]+i);for(var d=0,v=c[S];d<v;d++)n[a][d]=c[d]}var m=n[a][S];switch(n[a][0]){case"z":r=s,i=o;break;case"h":r+=+n[a][m-1];break;case"v":i+=+n[a][m-1];break;default:r+=+n[a][m-2],i+=+n[a][m-1]}}return n[D]=e._path2string,n},0,dt),mt=ht(function(t){if(!e.is(t,_)||!e.is(t&&t[0],_))t=e.parsePathString(t);var n=[],r=0,i=0,s=0,o=0,u=0;t[0][0]=="M"&&(r=+t[0][1],i=+t[0][2],s=r,o=i,u++,n[0]=["M",r,i]);for(var a=u,f=t[S];a<f;a++){var l=n[a]=[],c=t[a];if(c[0]!=
$.call(c[0])){l[0]=$.call(c[0]);switch(l[0]){case"A":l[1]=c[1],l[2]=c[2],l[3]=c[3],l[4]=c[4],l[5]=c[5],l[6]=+(c[6]+r),l[7]=+(c[7]+i);break;case"V":l[1]=+c[1]+i;break;case"H":l[1]=+c[1]+r;break;case"M":s=+c[1]+r,o=+c[2]+i;default:for(var h=1,p=c[S];h<p;h++)l[h]=+c[h]+(h%2?r:i)}}else for(var d=0,v=c[S];d<v;d++)n[a][d]=c[d];switch(l[0]){case"Z":r=s,i=o;break;case"H":r=l[1];break;case"V":i=l[1];break;case"M":s=n[a][n[a][S]-2],o=n[a][n[a][S]-1];default:r=n[a][n[a][S]-2],i=n[a][n[a][S]-1]}}return n[D]=e._path2string,n},null,dt),gt=function(e,t,n,r){return[e,t,n,r,n,r]},yt=function(e,t,n,r,i,s){var o=1/3,u=2/3;return[o*e+u*n,o*t+u*r,o*i+u*n,o*s+u*r,i,s]},bt=function(e,t,n,r,i,s,o,u,a,f){var l=A*120/180,c=A/180*(+i||0),h=[],d,v=ht(function(e,t,n){var r=e*T.cos(n)-t*T.sin(n),i=e*T.sin(n)+t*T.cos(n);return{x:r,y:i}});if(!f){d=v(e,t,-c),e=d.x,t=d.y,d=v(u,a,-c),u=d.x,a=d.y;var m=T.cos(A/180*i),g=T.sin(A/180*i),b=(e-u)/2,w=(t-a)/2,x=b*b/(n*n)+w*w/(r*r);x>1&&(x=T.sqrt(x),n=x*n,r=x*r);var N=n*n,C=r*r,L=(s==o?-1:1)*T.sqrt(k((N*C-N*w*w-C*b*b)/(N*w*w+C*b*b))),O=L*n*w/r+(e+u)/2,M=L*-r*b/n+(t+a)/2,_=T.asin(((t-M)/r).toFixed(9)),D=T.asin(((a-M)/r).toFixed(9));_=e<O?A-_:_,D=u<O?A-D:D,_<0&&(_=A*2+_),D<0&&(D=A*2+D),o&&_>D&&(_-=A*2),!o&&D>_&&(D-=A*2)}else _=f[0],D=f[1],O=f[2],M=f[3];var P=D-_;if(k(P)>l){var H=D,B=u,j=a;D=_+l*(o&&D>_?1:-1),u=O+n*T.cos(D),a=M+r*T.sin(D),h=bt(u,a,n,r,i,0,o,B,j,[D,H,O,M])}P=D-_;var F=T.cos(_),I=T.sin(_),q=T.cos(D),R=T.sin(D),U=T.tan(P/4),z=4/3*n*U,W=4/3*r*U,X=[e,t],V=[e+z*I,t-W*F],$=[u+z*R,a-W*q],J=[u,a];V[0]=2*X[0]-V[0],V[1]=2*X[1]-V[1];if(f)return[V,$,J][p](h);h=[V,$,
J][p](h)[E]()[y](",");var K=[];for(var Q=0,G=h[S];Q<G;Q++)K[Q]=Q%2?v(h[Q-1],h[Q],c).y:v(h[Q],h[Q+1],c).x;return K},wt=function(e,t,n,r,i,s,o,u,a){var f=1-a;return{x:L(f,3)*e+L(f,2)*3*a*n+f*3*a*a*i+L(a,3)*o,y:L(f,3)*t+L(f,2)*3*a*r+f*3*a*a*s+L(a,3)*u}},Et=ht(function(e,t,n,r,i,s,o,u){var a=i-2*n+e-(o-2*i+n),f=2*(n-e)-2*(i-n),l=e-n,c=(-f+T.sqrt(f*f-4*a*l))/2/a,p=(-f-T.sqrt(f*f-4*a*l))/2/a,d=[t,u],v=[e,o],m;return k(c)>"1e12"&&(c=.5),k(p)>"1e12"&&(p=.5),c>0&&c<1&&(m=wt(e,t,n,r,i,s,o,u,c),v[j](m.x),d[j](m.y)),p>0&&p<1&&(m=wt(e,t,n,r,i,s,o,u,p),v[j](m.x),d[j](m.y)),a=s-2*r+t-(u-2*s+r),f=2*(r-t)-2*(s-r),l=t-r,c=(-f+T.sqrt(f*f-4*a*l))/2/a,p=(-f-T.sqrt(f*f-4*a*l))/2/a,k(c)>"1e12"&&(c=.5),k(p)>"1e12"&&(p=.5),c>0&&c<1&&(m=wt(e,t,n,r,i,s,o,u,c),v[j](m.x),d[j](m.y)),p>0&&p<1&&(m=wt(e,t,n,r,i,s,o,u,p),v[j](m.x),d[j](m.y)),{min:{x:C[h](0,v),y:C[h](0,d)},max:{x:N[h](0,v),y:N[h](0,d)}}}),St=ht(function(e,t){var n=mt(e),r=t&&mt(t),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o=function(e,t){var n,r;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null);switch(e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"][p](bt[h](0,[t.x,t.y][p](e.slice(1))));break;case"S":n=t.x+(t.x-(t.bx||t.x)),r=t.y+(t.y-(t.by||t.y)),e=["C",n,r][p](e.slice(1));break;case"T":t.qx=t.x+(t.x-(t.qx||t.x)),t.qy=t.y+(t.y-(t.qy||t.y)),e=["C"][p](yt(t.x,t.y,t.qx,t.qy,e[1],e[2]));break;case"Q":t.qx=e[1],t.qy=e[2],e=["C"][p](yt(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"][p](gt(t.x,t.y,e[1],e[2]));break;case"H":e=["C"][p](gt(t.x,t.y,e[1],t.y));break;
case"V":e=["C"][p](gt(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"][p](gt(t.x,t.y,t.X,t.Y))}return e},u=function(e,t){if(e[t][S]>7){e[t].shift();var i=e[t];while(i[S])e.splice(t++,0,["C"][p](i.splice(0,6)));e.splice(t,1),l=N(n[S],r&&r[S]||0)}},a=function(e,t,i,s,o){e&&t&&e[o][0]=="M"&&t[o][0]!="M"&&(t.splice(o,0,["M",s.x,s.y]),i.bx=0,i.by=0,i.x=e[o][1],i.y=e[o][2],l=N(n[S],r&&r[S]||0))};for(var f=0,l=N(n[S],r&&r[S]||0);f<l;f++){n[f]=o(n[f],i),u(n,f),r&&(r[f]=o(r[f],s)),r&&u(r,f),a(n,r,i,s,f),a(r,n,s,i,f);var c=n[f],d=r&&r[f],v=c[S],m=r&&d[S];i.x=c[v-2],i.y=c[v-1],i.bx=W(c[v-4])||i.x,i.by=W(c[v-3])||i.y,s.bx=r&&(W(d[m-4])||s.x),s.by=r&&(W(d[m-3])||s.y),s.x=r&&d[m-2],s.y=r&&d[m-1]}return r?[n,r]:n},null,dt),xt=ht(function(t){var n=[];for(var r=0,i=t[S];r<i;r++){var s={},o=t[r].match(/^([^:]*):?([\d\.]*)/);s.color=e.getRGB(o[1]);if(s.color.error)return null;s.color=s.color.hex,o[2]&&(s.offset=o[2]+"%"),n[j](s)}for(r=1,i=n[S]-1;r<i;r++)if(!n[r].offset){var u=W(n[r-1].offset||0),a=0;for(var f=r+1;f<i;f++)if(n[f].offset){a=n[f].offset;break}a||(a=100,f=i),a=W(a);var l=(a-u)/(f-r+1);for(;r<f;r++)u+=l,n[r].offset=u+"%"}return n}),Tt=function(t,n,r,i){var s;if(!e.is(t,M)&&!e.is(t,"object"))return{container:1,x:t,y:n,width:r,height:i};s=e.is(t,M)?o.getElementById(t):t;if(s.tagName)return n==null?{container:s,width:s.style.pixelWidth||s.offsetWidth,height:s.style.pixelHeight||s.offsetHeight}:{container:s,width:n,height:r}},Nt=function(e,t){var n=this;for(var r in t)if(t[s](r)&&!(r in e))switch(typeof t[r]){case"function":(function(t){e[r]=e===n?t:function(){return t[h](n,arguments)}})(t[r])
;break;case"object":e[r]=e[r]||{},Nt.call(this,e[r],t[r]);break;default:e[r]=t[r]}},Ct=function(e,t){e==t.top&&(t.top=e.prev),e==t.bottom&&(t.bottom=e.next),e.next&&(e.next.prev=e.prev),e.prev&&(e.prev.next=e.next)},kt=function(e,t){if(t.top===e)return;Ct(e,t),e.next=null,e.prev=t.top,t.top.next=e,t.top=e},Lt=function(e,t){if(t.bottom===e)return;Ct(e,t),e.next=t.bottom,e.prev=null,t.bottom.prev=e,t.bottom=e},At=function(e,t,n){Ct(e,n),t==n.top&&(n.top=e),t.next&&(t.next.prev=e),e.next=t.next,e.prev=t,t.next=e},Ot=function(e,t,n){Ct(e,n),t==n.bottom&&(n.bottom=e),t.prev&&(t.prev.next=e),e.prev=t.prev,t.prev=e,e.next=t},Mt=function(e){return function(){throw new Error("Raphaël: you are calling to method “"+e+"” of removed object")}};e.pathToRelative=vt;if(e.svg){l.svgns="http://www.w3.org/2000/svg",l.xlink="http://www.w3.org/1999/xlink",U=function(e){return+e+(~~e===e)*.5};var _t=function(e,t){if(!t)return e=o.createElementNS(l.svgns,e),e.style.webkitTapHighlightColor="rgba(0,0,0,0)",e;for(var n in t)t[s](n)&&e[z](n,g(t[n]))};e[D]=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var Dt=function(e,t){var n=_t("path");t.canvas&&t.canvas[c](n);var r=new It(n,t);return r.type="path",Bt(r,{fill:"none",stroke:"#000",path:e}),r},Pt=function(e,t,n){var r="linear",i=.5,s=.5,u=e.style;t=g(t)[Q](rt,function(e,t,n){r="radial";if(t&&n){i=W(t),s=W(n);var o=(s>.5)*2-1;L(i-.5,2)+L(s-.5,2)>.25&&(s=T.sqrt(.25-L(i-.5,2))*o+.5)&&s!=.5&&(s=s.toFixed(5)-1e-5*o)}return v}),t=t[y](/\s*\-\s*/);if(r=="linear"){var a=t.shift();a=-W(a);if(isNaN(a))return null;var f=[0
,0,T.cos(a*A/180),T.sin(a*A/180)],l=1/(N(k(f[2]),k(f[3]))||1);f[2]*=l,f[3]*=l,f[2]<0&&(f[0]=-f[2],f[2]=0),f[3]<0&&(f[1]=-f[3],f[3]=0)}var h=xt(t);if(!h)return null;var p=e.getAttribute(P);p=p.match(/^url\(#(.*)\)$/),p&&n.defs.removeChild(o.getElementById(p[1]));var d=_t(r+"Gradient");d.id=ut(),_t(d,r=="radial"?{fx:i,fy:s}:{x1:f[0],y1:f[1],x2:f[2],y2:f[3]}),n.defs[c](d);for(var m=0,b=h[S];m<b;m++){var w=_t("stop");_t(w,{offset:h[m].offset?h[m].offset:m?"100%":"0%","stop-color":h[m].color||"#fff"}),d[c](w)}return _t(e,{fill:"url(#"+d.id+")",opacity:1,"fill-opacity":1}),u.fill=v,u.opacity=1,u.fillOpacity=1,1},Ht=function(t){var n=t.getBBox();_t(t.pattern,{patternTransform:e.format("translate({0},{1})",n.x,n.y)})},Bt=function(n,r){var i={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},u=n.node,a=n.attrs,f=n.rotate(),l=function(e,t){t=i[x.call(t)];if(t){var n=e.attrs["stroke-width"]||"1",s={round:n,square:n,butt:0}[e.attrs["stroke-linecap"]||r["stroke-linecap"]]||0,o=[],a=t[S];while(a--)o[a]=t[a]*n+(a%2?1:-1)*s;_t(u,{"stroke-dasharray":o[E](",")})}};r[s]("rotation")&&(f=r.rotation);var h=g(f)[y](t);h.length-1?(h[1]=+h[1],h[2]=+h[2]):h=null,W(f)&&n.rotate(0,!0);for(var p in r)if(r[s](p)){if(!J[s](p))continue;var d=r[p];a[p]=d;switch(p){case"blur":n.blur(d);break;case"rotation":n.rotate(d,!0);break;case"href":case"title":case"target":var b=u.parentNode;if(x.call(b.tagName)!="a"){var w=_t("a");b.insertBefore(w,u),w[c](u),b=w}p=="target"&&d=="blank"?b.setAttributeNS(n.paper.xlink
,"show","new"):b.setAttributeNS(n.paper.xlink,p,d);break;case"cursor":u.style.cursor=d;break;case"clip-rect":var T=g(d)[y](t);if(T[S]>=4){n.clip&&n.clip.parentNode.parentNode.removeChild(n.clip.parentNode);var N=_t("clipPath"),C=_t("rect");N.id=ut(),_t(C,{x:T[0],y:T[1],width:T[2],height:T[3],r:T[4]||0,rx:T[4]||0,ry:T[4]||0}),N[c](C),n.paper.defs[c](N),_t(u,{"clip-path":"url(#"+N.id+")"}),n.clip=C}if(!d){var k=o.getElementById(u.getAttribute("clip-path")[Q](/(^url\(#|\)$)/g,v));k&&k.parentNode.removeChild(k),_t(u,{"clip-path":v}),delete n.clip}break;case"path":n.type=="path"&&_t(u,{d:d?a.path=mt(d):"M0,0"});break;case"width":u[z](p,d);if(!a.fx)break;p="x",d=a.x;case"x":a.fx&&(d=-a.x-(a.width||0));case"rx":if(p=="rx"&&n.type=="rect")break;case"cx":h&&(p=="x"||p=="cx")&&(h[1]+=d-a[p]),u[z](p,d),n.pattern&&Ht(n);break;case"height":u[z](p,d);if(!a.fy)break;p="y",d=a.y;case"y":a.fy&&(d=-a.y-(a.height||0));case"ry":if(p=="ry"&&n.type=="rect")break;case"cy":h&&(p=="y"||p=="cy")&&(h[2]+=d-a[p]),u[z](p,d),n.pattern&&Ht(n);break;case"r":n.type=="rect"?_t(u,{rx:d,ry:d}):u[z](p,d);break;case"src":n.type=="image"&&u.setAttributeNS(n.paper.xlink,"href",d);break;case"stroke-width":u.style.strokeWidth=d,u[z](p,d),a["stroke-dasharray"]&&l(n,a["stroke-dasharray"]);break;case"stroke-dasharray":l(n,d);break;case"translation":var L=g(d)[y](t);L[0]=+L[0]||0,L[1]=+L[1]||0,h&&(h[1]+=L[0],h[2]+=L[1]),kn.call(n,L[0],L[1]);break;case"scale":L=g(d)[y](t),n.scale(+L[0]||1,+L[1]||+L[0]||1,isNaN(W(L[2]))?null:+L[2],isNaN(W(L[3]))?null:+L[3]);break;case P:var A=g(d).match(F);if(A){N=_t("pattern");var O=_t("image"
);N.id=ut(),_t(N,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),_t(O,{x:0,y:0}),O.setAttributeNS(n.paper.xlink,"href",A[1]),N[c](O);var M=o.createElement("img");M.style.cssText="position:absolute;left:-9999em;top-9999em",M.onload=function(){_t(N,{width:this.offsetWidth,height:this.offsetHeight}),_t(O,{width:this.offsetWidth,height:this.offsetHeight}),o.body.removeChild(this),n.paper.safari()},o.body[c](M),M.src=A[1],n.paper.defs[c](N),u.style.fill="url(#"+N.id+")",_t(u,{fill:"url(#"+N.id+")"}),n.pattern=N,n.pattern&&Ht(n);break}var _=e.getRGB(d);if(!_.error)delete r.gradient,delete a.gradient,!e.is(a.opacity,"undefined")&&e.is(r.opacity,"undefined")&&_t(u,{opacity:a.opacity}),!e.is(a["fill-opacity"],"undefined")&&e.is(r["fill-opacity"],"undefined")&&_t(u,{"fill-opacity":a["fill-opacity"]});else if(({circle:1,ellipse:1}[s](n.type)||g(d).charAt()!="r")&&Pt(u,d,n.paper)){a.gradient=d,a.fill="none";break}_[s]("opacity")&&_t(u,{"fill-opacity":_.opacity>1?_.opacity/100:_.opacity});case"stroke":_=e.getRGB(d),u[z](p,_.hex),p=="stroke"&&_[s]("opacity")&&_t(u,{"stroke-opacity":_.opacity>1?_.opacity/100:_.opacity});break;case"gradient":((({circle:1,ellipse:1}))[s](n.type)||g(d).charAt()!="r")&&Pt(u,d,n.paper);break;case"opacity":a.gradient&&!a[s]("stroke-opacity")&&_t(u,{"stroke-opacity":d>1?d/100:d});case"fill-opacity":if(a.gradient){var D=o.getElementById(u.getAttribute(P)[Q](/^url\(#|\)$/g,v));if(D){var H=D.getElementsByTagName("stop");H[H[S]-1][z]("stop-opacity",d)}break};default:p=="font-size"&&(d=X(d,10)+"px");var B=p[Q](/(\-.)/g,function(e){return $.call(e.substring(1
))});u.style[B]=d,u[z](p,d)}}Ft(n,r),h?n.rotate(h.join(m)):W(f)&&n.rotate(f,!0)},jt=1.2,Ft=function(t,n){if(t.type!="text"||!(n[s]("text")||n[s]("font")||n[s]("font-size")||n[s]("x")||n[s]("y")))return;var r=t.attrs,i=t.node,u=i.firstChild&&i.firstChild.style["font-size"]!==""?X(o.defaultView.getComputedStyle(i.firstChild,v).getPropertyValue("font-size"),10):X(i.style["font-size"],10)||10;if(n[s]("text")){r.text=n.text;while(i.firstChild)i.removeChild(i.firstChild);var a=g(n.text)[y]("\n");for(var f=0,l=a[S];f<l;f++)if(a[f]){var h=_t("tspan");f&&_t(h,{dy:u*jt,x:r.x}),h[c](o.createTextNode(a[f])),i[c](h)}}else{a=i.getElementsByTagName("tspan");for(f=0,l=a[S];f<l;f++)f&&_t(a[f],{dy:u*jt,x:r.x})}_t(i,{y:r.y});var p=t.getBBox(),d=r.y-(p.y+p.height/2);d&&e.is(d,"finite")&&_t(i,{y:r.y+d})},It=function(t,n){var r=0,i=0;this[0]=t,this.id=e._oid++,this.node=t,t.raphael=this,this.paper=n,this.attrs=this.attrs||{},this.transformations=[],this._={tx:0,ty:0,rt:{deg:0,cx:0,cy:0},sx:1,sy:1},!n.bottom&&(n.bottom=this),this.prev=n.top,n.top&&(n.top.next=this),n.top=this,this.next=null},qt=It[i];It[i].rotate=function(n,r,i){if(this.removed)return this;if(n==null)return this._.rt.cx?[this._.rt.deg,this._.rt.cx,this._.rt.cy][E](m):this._.rt.deg;var s=this.getBBox();return n=g(n)[y](t),n[S]-1&&(r=W(n[1]),i=W(n[2])),n=W(n[0]),r!=null&&r!==!1?this._.rt.deg=n:this._.rt.deg+=n,i==null&&(r=null),this._.rt.cx=r,this._.rt.cy=i,r=r==null?s.x+s.width/2:r,i=i==null?s.y+s.height/2:i,this._.rt.deg?(this.transformations[0]=e.format("rotate({0} {1} {2})",this._.rt.deg,r,i),this.clip&&_t(this.clip,{transform:e
.format("rotate({0} {1} {2})",-this._.rt.deg,r,i)})):(this.transformations[0]=v,this.clip&&_t(this.clip,{transform:v})),_t(this.node,{transform:this.transformations[E](m)}),this},It[i].hide=function(){return!this.removed&&(this.node.style.display="none"),this},It[i].show=function(){return!this.removed&&(this.node.style.display=""),this},It[i].remove=function(){if(this.removed)return;Ct(this,this.paper),this.node.parentNode.removeChild(this.node);for(var e in this)delete this[e];this.removed=!0},It[i].getBBox=function(){if(this.removed)return this;if(this.type=="path")return pt(this.attrs.path);if(this.node.style.display=="none"){this.show();var e=!0}var t={};try{t=this.node.getBBox()}catch(n){}finally{t=t||{}}if(this.type=="text")try{t={x:t.x,y:Infinity,width:0,height:0};for(var r=0,i=this.node.getNumberOfChars();r<i;r++){var s=this.node.getExtentOfChar(r);s.y<t.y&&(t.y=s.y),s.y+s.height-t.y>t.height&&(t.height=s.y+s.height-t.y),s.x+s.width-t.x>t.width&&(t.width=s.x+s.width-t.x)}}catch(n){}finally{t=t||{x:t.x,y:Infinity,width:0,height:0}}return e&&this.hide(),t},It[i].attr=function(t,n){if(this.removed)return this;if(t==null){var r={};for(var i in this.attrs)this.attrs[s](i)&&(r[i]=this.attrs[i]);return this._.rt.deg&&(r.rotation=this.rotate()),(this._.sx!=1||this._.sy!=1)&&(r.scale=this.scale()),r.gradient&&r.fill=="none"&&(r.fill=r.gradient)&&delete r.gradient,r}if(n==null&&e.is(t,M))return t=="translation"?kn.call(this):t=="rotation"?this.rotate():t=="scale"?this.scale():t==P&&this.attrs.fill=="none"&&this.attrs.gradient?this.attrs.gradient:this.attrs[t];if(n==null&&e.is(
t,_)){var o={};for(var u=0,a=t.length;u<a;u++)o[t[u]]=this.attr(t[u]);return o}if(n!=null){var f={};f[t]=n}else t!=null&&e.is(t,"object")&&(f=t);for(var l in this.paper.customAttributes)if(this.paper.customAttributes[s](l)&&f[s](l)&&e.is(this.paper.customAttributes[l],"function")){var c=this.paper.customAttributes[l].apply(this,[][p](f[l]));this.attrs[l]=f[l];for(var h in c)c[s](h)&&(f[h]=c[h])}return Bt(this,f),this},It[i].toFront=function(){if(this.removed)return this;this.node.parentNode[c](this.node);var e=this.paper;return e.top!=this&&kt(this,e),this},It[i].toBack=function(){if(this.removed)return this;if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),Lt(this,this.paper);var e=this.paper}return this},It[i].insertAfter=function(e){if(this.removed)return this;var t=e.node||e[e.length-1].node;return t.nextSibling?t.parentNode.insertBefore(this.node,t.nextSibling):t.parentNode[c](this.node),At(this,e,this.paper),this},It[i].insertBefore=function(e){if(this.removed)return this;var t=e.node||e[0].node;return t.parentNode.insertBefore(this.node,t),Ot(this,e,this.paper),this},It[i].blur=function(e){var t=this;if(+e!==0){var n=_t("filter"),r=_t("feGaussianBlur");t.attrs.blur=e,n.id=ut(),_t(r,{stdDeviation:+e||1.5}),n.appendChild(r),t.paper.defs.appendChild(n),t._blur=n,_t(t.node,{filter:"url(#"+n.id+")"})}else t._blur&&(t._blur.parentNode.removeChild(t._blur),delete t._blur,delete t.attrs.blur),t.node.removeAttribute("filter")};var Rt=function(e,t,n,r){var i=_t("circle");e.canvas&&e.canvas[c](i);var s=new
It(i,e);return s.attrs={cx:t,cy:n,r:r,fill:"none",stroke:"#000"},s.type="circle",_t(i,s.attrs),s},Ut=function(e,t,n,r,i,s){var o=_t("rect");e.canvas&&e.canvas[c](o);var u=new It(o,e);return u.attrs={x:t,y:n,width:r,height:i,r:s||0,rx:s||0,ry:s||0,fill:"none",stroke:"#000"},u.type="rect",_t(o,u.attrs),u},zt=function(e,t,n,r,i){var s=_t("ellipse");e.canvas&&e.canvas[c](s);var o=new It(s,e);return o.attrs={cx:t,cy:n,rx:r,ry:i,fill:"none",stroke:"#000"},o.type="ellipse",_t(s,o.attrs),o},Wt=function(e,t,n,r,i,s){var o=_t("image");_t(o,{x:n,y:r,width:i,height:s,preserveAspectRatio:"none"}),o.setAttributeNS(e.xlink,"href",t),e.canvas&&e.canvas[c](o);var u=new It(o,e);return u.attrs={x:n,y:r,width:i,height:s,src:t},u.type="image",u},Xt=function(e,t,n,r){var i=_t("text");_t(i,{x:t,y:n,"text-anchor":"middle"}),e.canvas&&e.canvas[c](i);var s=new It(i,e);return s.attrs={x:t,y:n,"text-anchor":"middle",text:r,font:J.font,"font-size":J["font-size"],stroke:"none",fill:"#000"},s.type="text",Bt(s,s.attrs),s},Vt=function(e,t){return this.width=e||this.width,this.height=t||this.height,this.canvas[z]("width",this.width),this.canvas[z]("height",this.height),this},$t=function(){var t=Tt[h](0,arguments),n=t&&t.container,r=t.x,i=t.y,s=t.width,u=t.height;if(!n)throw new Error("SVG container not found.");var a=_t("svg");return r=r||0,i=i||0,s=s||512,u=u||342,_t(a,{xmlns:"http://www.w3.org/2000/svg",version:1.1,width:s,height:u}),n==1?(a.style.cssText="position:absolute;left:"+r+"px;top:"+i+"px",o.body[c](a)):n.firstChild?n.insertBefore(a,n.firstChild):n[c](a),n=new f,n.width=s,n.height=u,n.canvas=a,Nt
.call(n,n,e.fn),n.clear(),n};l.clear=function(){var e=this.canvas;while(e.firstChild)e.removeChild(e.firstChild);this.bottom=this.top=null,this.desc=_t("desc"),e[c](this.desc),e[c](this.defs=_t("defs"))},l.remove=function(){this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var e in this)this[e]=Mt(e)}}if(e.vml){var Jt={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},Kt=/([clmz]),?([^clmz]*)/gi,Qt=/ progid:\S+Blur\([^\)]+\)/g,Gt=/-?[^,\s-]+/g,Yt=1e3+m+1e3,Zt=10,en={path:1,rect:1},tn=function(e){var t=/[ahqstv]/ig,n=mt;g(e).match(t)&&(n=St),t=/[clmz]/g;if(n==mt&&!g(e).match(t)){var r=g(e)[Q](Kt,function(e,t,n){var r=[],i=x.call(t)=="m",s=Jt[t];return n[Q](Gt,function(e){i&&r[S]==2&&(s+=r+Jt[t=="m"?"l":"L"],r=[]),r[j](U(e*Zt))}),s+r});return r}var i=n(e),s,o;r=[];for(var u=0,a=i[S];u<a;u++){s=i[u],o=x.call(i[u][0]),o=="z"&&(o="x");for(var f=1,l=s[S];f<l;f++)o+=U(s[f]*Zt)+(f!=l-1?",":v);r[j](o)}return r[E](m)};e[D]=function(){return"Your browser doesn’t support SVG. Falling down to VML.\nYou are running Raphaël "+this.version},Dt=function(e,t){var n=rn("group");n.style.cssText="position:absolute;left:0;top:0;width:"+t.width+"px;height:"+t.height+"px",n.coordsize=t.coordsize,n.coordorigin=t.coordorigin;var r=rn("shape"),i=r.style;i.width=t.width+"px",i.height=t.height+"px",r.coordsize=Yt,r.coordorigin=t.coordorigin,n[c](r);var s=new It(r,n,t),o={fill:"none",stroke:"#000"};return e&&(o.path=e),s.type="path",s.path=[],s.Path=v,Bt(s,o),t.canvas[c](n),s},Bt=function(n,r){n.attrs=n.attrs||{};var i=n.node,u=n.attrs,a=i.style,f,l=(r.x!=u.x||r.y!=u.y||r.width!=
u.width||r.height!=u.height||r.r!=u.r)&&n.type=="rect",h=n;for(var p in r)r[s](p)&&(u[p]=r[p]);l&&(u.path=nn(u.x,u.y,u.width,u.height,u.r),n.X=u.x,n.Y=u.y,n.W=u.width,n.H=u.height),r.href&&(i.href=r.href),r.title&&(i.title=r.title),r.target&&(i.target=r.target),r.cursor&&(a.cursor=r.cursor),"blur"in r&&n.blur(r.blur);if(r.path&&n.type=="path"||l)i.path=tn(u.path);r.rotation!=null&&n.rotate(r.rotation,!0),r.translation&&(f=g(r.translation)[y](t),kn.call(n,f[0],f[1]),n._.rt.cx!=null&&(n._.rt.cx+=+f[0],n._.rt.cy+=+f[1],n.setBox(n.attrs,f[0],f[1]))),r.scale&&(f=g(r.scale)[y](t),n.scale(+f[0]||1,+f[1]||+f[0]||1,+f[2]||null,+f[3]||null));if("clip-rect"in r){var d=g(r["clip-rect"])[y](t);if(d[S]>=4){d[2]=+d[2]+ +d[0],d[3]=+d[3]+ +d[1],d[4]||(d[4]=0);var m=i.clipRect||o.createElement("div"),b=m.style,w=i.parentNode;b.clip=e.format("rect({1}px {2}px {3}px {0}px)",d),i.clipRect||(b.position="absolute",b.top=0,b.left=0,b.width=n.paper.width+"px",b.height=n.paper.height+"px",w.parentNode.insertBefore(m,w),m[c](w),i.clipRect=m)}r["clip-rect"]||i.clipRect&&(i.clipRect.style.clip=v)}n.type=="image"&&r.src&&(i.src=r.src),n.type=="image"&&r.opacity&&(i.filterOpacity=V+".Alpha(opacity="+r.opacity*100+")",a.filter=(i.filterMatrix||v)+(i.filterOpacity||v)),r.font&&(a.font=r.font),r["font-family"]&&(a.fontFamily='"'+r["font-family"][y](",")[0][Q](/^['"]+|['"]+$/g,v)+'"'),r["font-size"]&&(a.fontSize=r["font-size"]),r["font-weight"]&&(a.fontWeight=r["font-weight"]),r["font-style"]&&(a.fontStyle=r["font-style"]);if(r.opacity!=null||r["stroke-width"]!=null||r.fill!=null||r.stroke!=null||r["stroke-width"
]!=null||r["stroke-opacity"]!=null||r["fill-opacity"]!=null||r["stroke-dasharray"]!=null||r["stroke-miterlimit"]!=null||r["stroke-linejoin"]!=null||r["stroke-linecap"]!=null){i=n.shape||i;var E=i.getElementsByTagName(P)&&i.getElementsByTagName(P)[0],x=!1;!E&&(x=E=rn(P));if("fill-opacity"in r||"opacity"in r){var T=((+u["fill-opacity"]+1||2)-1)*((+u.opacity+1||2)-1)*((+e.getRGB(r.fill).o+1||2)-1);T=C(N(T,0),1),E.opacity=T}r.fill&&(E.on=!0);if(E.on==null||r.fill=="none")E.on=!1;if(E.on&&r.fill){var k=r.fill.match(F);k?(E.src=k[1],E.type="tile"):(E.color=e.getRGB(r.fill).hex,E.src=v,E.type="solid",e.getRGB(r.fill).error&&(h.type in{circle:1,ellipse:1}||g(r.fill).charAt()!="r")&&Pt(h,r.fill)&&(u.fill="none",u.gradient=r.fill))}x&&i[c](E);var L=i.getElementsByTagName("stroke")&&i.getElementsByTagName("stroke")[0],A=!1;!L&&(A=L=rn("stroke"));if(r.stroke&&r.stroke!="none"||r["stroke-width"]||r["stroke-opacity"]!=null||r["stroke-dasharray"]||r["stroke-miterlimit"]||r["stroke-linejoin"]||r["stroke-linecap"])L.on=!0;(r.stroke=="none"||L.on==null||r.stroke==0||r["stroke-width"]==0)&&(L.on=!1);var O=e.getRGB(r.stroke);L.on&&r.stroke&&(L.color=O.hex),T=((+u["stroke-opacity"]+1||2)-1)*((+u.opacity+1||2)-1)*((+O.o+1||2)-1);var M=(W(r["stroke-width"])||1)*.75;T=C(N(T,0),1),r["stroke-width"]==null&&(M=u["stroke-width"]),r["stroke-width"]&&(L.weight=M),M&&M<1&&(T*=M)&&(L.weight=1),L.opacity=T,r["stroke-linejoin"]&&(L.joinstyle=r["stroke-linejoin"]||"miter"),L.miterlimit=r["stroke-miterlimit"]||8,r["stroke-linecap"]&&(L.endcap=r["stroke-linecap"]=="butt"?"flat":r["stroke-linecap"]=="square"?"square"
:"round");if(r["stroke-dasharray"]){var _={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};L.dashstyle=_[s](r["stroke-dasharray"])?_[r["stroke-dasharray"]]:v}A&&i[c](L)}if(h.type=="text"){a=h.paper.span.style,u.font&&(a.font=u.font),u["font-family"]&&(a.fontFamily=u["font-family"]),u["font-size"]&&(a.fontSize=u["font-size"]),u["font-weight"]&&(a.fontWeight=u["font-weight"]),u["font-style"]&&(a.fontStyle=u["font-style"]),h.node.string&&(h.paper.span.innerHTML=g(h.node.string)[Q](/</g,"&#60;")[Q](/&/g,"&#38;")[Q](/\n/g,"<br>")),h.W=u.w=h.paper.span.offsetWidth,h.H=u.h=h.paper.span.offsetHeight,h.X=u.x,h.Y=u.y+U(h.H/2);switch(u["text-anchor"]){case"start":h.node.style["v-text-align"]="left",h.bbx=U(h.W/2);break;case"end":h.node.style["v-text-align"]="right",h.bbx=-U(h.W/2);break;default:h.node.style["v-text-align"]="center"}}},Pt=function(e,t){e.attrs=e.attrs||{};var n=e.attrs,r,i="linear",s=".5 .5";e.attrs.gradient=t,t=g(t)[Q](rt,function(e,t,n){return i="radial",t&&n&&(t=W(t),n=W(n),L(t-.5,2)+L(n-.5,2)>.25&&(n=T.sqrt(.25-L(t-.5,2))*((n>.5)*2-1)+.5),s=t+m+n),v}),t=t[y](/\s*\-\s*/);if(i=="linear"){var o=t.shift();o=-W(o);if(isNaN(o))return null}var u=xt(t);if(!u)return null;e=e.shape||e.node,r=e.getElementsByTagName(P)[0]||rn(P),!r.parentNode&&e.appendChild(r);if(u[S]){r.on=!0,r.method="none",r.color=u[0].color,r.color2=u[u[S]-1].color;var a=[];for(var f=0,l=u[S];f<l;f++)u[f].offset&&a[j](u[f].offset+m+u[f].color);r.colors&&(r.colors.value=a[S]?a[E]():"0% "+
r.color),i=="radial"?(r.type="gradientradial",r.focus="100%",r.focussize=s,r.focusposition=s):(r.type="gradient",r.angle=(270-o)%360)}return 1},It=function(t,n,r){var i=0,s=0,o=0,u=1;this[0]=t,this.id=e._oid++,this.node=t,t.raphael=this,this.X=0,this.Y=0,this.attrs={},this.Group=n,this.paper=r,this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1},!r.bottom&&(r.bottom=this),this.prev=r.top,r.top&&(r.top.next=this),r.top=this,this.next=null},qt=It[i],qt.rotate=function(e,n,r){return this.removed?this:e==null?this._.rt.cx?[this._.rt.deg,this._.rt.cx,this._.rt.cy][E](m):this._.rt.deg:(e=g(e)[y](t),e[S]-1&&(n=W(e[1]),r=W(e[2])),e=W(e[0]),n!=null?this._.rt.deg=e:this._.rt.deg+=e,r==null&&(n=null),this._.rt.cx=n,this._.rt.cy=r,this.setBox(this.attrs,n,r),this.Group.style.rotation=this._.rt.deg,this)},qt.setBox=function(e,t,n){if(this.removed)return this;var r=this.Group.style,i=this.shape&&this.shape.style||this.node.style;e=e||{};for(var o in e)e[s](o)&&(this.attrs[o]=e[o]);t=t||this._.rt.cx,n=n||this._.rt.cy;var u=this.attrs,a,f,l,c;switch(this.type){case"circle":a=u.cx-u.r,f=u.cy-u.r,l=c=u.r*2;break;case"ellipse":a=u.cx-u.rx,f=u.cy-u.ry,l=u.rx*2,c=u.ry*2;break;case"image":a=+u.x,f=+u.y,l=u.width||0,c=u.height||0;break;case"text":this.textpath.v=["m",U(u.x),", ",U(u.y-2),"l",U(u.x)+1,", ",U(u.y-2)][E](v),a=u.x-U(this.W/2),f=u.y-this.H/2,l=this.W,c=this.H;break;case"rect":case"path":if(!this.attrs.path)a=0,f=0,l=this.paper.width,c=this.paper.height;else{var h=pt(this.attrs.path);a=h.x,f=h.y,l=h.width,c=h.height}break;default:a=0,f=0,l=this.paper.width,c=this.paper.height}t=t==null?a+l/2:t,n=n==
null?f+c/2:n;var p=t-this.paper.width/2,d=n-this.paper.height/2,m;r.left!=(m=p+"px")&&(r.left=m),r.top!=(m=d+"px")&&(r.top=m),this.X=en[s](this.type)?-p:a,this.Y=en[s](this.type)?-d:f,this.W=l,this.H=c,en[s](this.type)?(i.left!=(m=-p*Zt+"px")&&(i.left=m),i.top!=(m=-d*Zt+"px")&&(i.top=m)):this.type=="text"?(i.left!=(m=-p+"px")&&(i.left=m),i.top!=(m=-d+"px")&&(i.top=m)):(r.width!=(m=this.paper.width+"px")&&(r.width=m),r.height!=(m=this.paper.height+"px")&&(r.height=m),i.left!=(m=a-p+"px")&&(i.left=m),i.top!=(m=f-d+"px")&&(i.top=m),i.width!=(m=l+"px")&&(i.width=m),i.height!=(m=c+"px")&&(i.height=m))},qt.hide=function(){return!this.removed&&(this.Group.style.display="none"),this},qt.show=function(){return!this.removed&&(this.Group.style.display="block"),this},qt.getBBox=function(){return this.removed?this:en[s](this.type)?pt(this.attrs.path):{x:this.X+(this.bbx||0),y:this.Y,width:this.W,height:this.H}},qt.remove=function(){if(this.removed)return;Ct(this,this.paper),this.node.parentNode.removeChild(this.node),this.Group.parentNode.removeChild(this.Group),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var e in this)delete this[e];this.removed=!0},qt.attr=function(t,n){if(this.removed)return this;if(t==null){var r={};for(var i in this.attrs)this.attrs[s](i)&&(r[i]=this.attrs[i]);return this._.rt.deg&&(r.rotation=this.rotate()),(this._.sx!=1||this._.sy!=1)&&(r.scale=this.scale()),r.gradient&&r.fill=="none"&&(r.fill=r.gradient)&&delete r.gradient,r}if(n==null&&e.is(t,"string"))return t=="translation"?kn.call(this):t=="rotation"?this.rotate():t=="scale"?this.scale():t==
P&&this.attrs.fill=="none"&&this.attrs.gradient?this.attrs.gradient:this.attrs[t];if(this.attrs&&n==null&&e.is(t,_)){var o,u={};for(i=0,o=t[S];i<o;i++)u[t[i]]=this.attr(t[i]);return u}var a;n!=null&&(a={},a[t]=n),n==null&&e.is(t,"object")&&(a=t);if(a){for(var f in this.paper.customAttributes)if(this.paper.customAttributes[s](f)&&a[s](f)&&e.is(this.paper.customAttributes[f],"function")){var l=this.paper.customAttributes[f].apply(this,[][p](a[f]));this.attrs[f]=a[f];for(var c in l)l[s](c)&&(a[c]=l[c])}a.text&&this.type=="text"&&(this.node.string=a.text),Bt(this,a),a.gradient&&({circle:1,ellipse:1}[s](this.type)||g(a.gradient).charAt()!="r")&&Pt(this,a.gradient),(!en[s](this.type)||this._.rt.deg)&&this.setBox(this.attrs)}return this},qt.toFront=function(){return!this.removed&&this.Group.parentNode[c](this.Group),this.paper.top!=this&&kt(this,this.paper),this},qt.toBack=function(){return this.removed?this:(this.Group.parentNode.firstChild!=this.Group&&(this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild),Lt(this,this.paper)),this)},qt.insertAfter=function(e){return this.removed?this:(e.constructor==On&&(e=e[e.length-1]),e.Group.nextSibling?e.Group.parentNode.insertBefore(this.Group,e.Group.nextSibling):e.Group.parentNode[c](this.Group),At(this,e,this.paper),this)},qt.insertBefore=function(e){return this.removed?this:(e.constructor==On&&(e=e[0]),e.Group.parentNode.insertBefore(this.Group,e.Group),Ot(this,e,this.paper),this)},qt.blur=function(t){var n=this.node.runtimeStyle,r=n.filter;r=r.replace(Qt,v),+t!==0?(this.attrs.blur=t,n.filter=r+m+V+".Blur(pixelradius="+
(+t||1.5)+")",n.margin=e.format("-{0}px 0 0 -{0}px",U(+t||1.5))):(n.filter=r,n.margin=0,delete this.attrs.blur)},Rt=function(e,t,n,r){var i=rn("group"),s=rn("oval"),o=s.style;i.style.cssText="position:absolute;left:0;top:0;width:"+e.width+"px;height:"+e.height+"px",i.coordsize=Yt,i.coordorigin=e.coordorigin,i[c](s);var u=new It(s,i,e);return u.type="circle",Bt(u,{stroke:"#000",fill:"none"}),u.attrs.cx=t,u.attrs.cy=n,u.attrs.r=r,u.setBox({x:t-r,y:n-r,width:r*2,height:r*2}),e.canvas[c](i),u};function nn(t,n,r,i,s){return s?e.format("M{0},{1}l{2},0a{3},{3},0,0,1,{3},{3}l0,{5}a{3},{3},0,0,1,{4},{3}l{6},0a{3},{3},0,0,1,{4},{4}l0,{7}a{3},{3},0,0,1,{3},{4}z",t+s,n,r-s*2,s,-s,i-s*2,s*2-r,s*2-i):e.format("M{0},{1}l{2},0,0,{3},{4},0z",t,n,r,i,-r)}Ut=function(e,t,n,r,i,s){var o=nn(t,n,r,i,s),u=e.path(o),a=u.attrs;return u.X=a.x=t,u.Y=a.y=n,u.W=a.width=r,u.H=a.height=i,a.r=s,a.path=o,u.type="rect",u},zt=function(e,t,n,r,i){var s=rn("group"),o=rn("oval"),u=o.style;s.style.cssText="position:absolute;left:0;top:0;width:"+e.width+"px;height:"+e.height+"px",s.coordsize=Yt,s.coordorigin=e.coordorigin,s[c](o);var a=new It(o,s,e);return a.type="ellipse",Bt(a,{stroke:"#000"}),a.attrs.cx=t,a.attrs.cy=n,a.attrs.rx=r,a.attrs.ry=i,a.setBox({x:t-r,y:n-i,width:r*2,height:i*2}),e.canvas[c](s),a},Wt=function(e,t,n,r,i,s){var o=rn("group"),u=rn("image");o.style.cssText="position:absolute;left:0;top:0;width:"+e.width+"px;height:"+e.height+"px",o.coordsize=Yt,o.coordorigin=e.coordorigin,u.src=t,o[c](u);var a=new It(u,o,e);return a.type="image",a.attrs.src=t,a.attrs.x=n,a.attrs.y=r,a.attrs.w=i,a.attrs.h=s,a
.setBox({x:n,y:r,width:i,height:s}),e.canvas[c](o),a},Xt=function(t,n,r,i){var s=rn("group"),o=rn("shape"),u=o.style,a=rn("path"),f=a.style,l=rn("textpath");s.style.cssText="position:absolute;left:0;top:0;width:"+t.width+"px;height:"+t.height+"px",s.coordsize=Yt,s.coordorigin=t.coordorigin,a.v=e.format("m{0},{1}l{2},{1}",U(n*10),U(r*10),U(n*10)+1),a.textpathok=!0,u.width=t.width,u.height=t.height,l.string=g(i),l.on=!0,o[c](l),o[c](a),s[c](o);var h=new It(l,s,t);return h.shape=o,h.textpath=a,h.type="text",h.attrs.text=i,h.attrs.x=n,h.attrs.y=r,h.attrs.w=1,h.attrs.h=1,Bt(h,{font:J.font,stroke:"none",fill:"#000"}),h.setBox(),t.canvas[c](s),h},Vt=function(e,t){var n=this.canvas.style;return e==+e&&(e+="px"),t==+t&&(t+="px"),n.width=e,n.height=t,n.clip="rect(0 "+e+" "+t+" 0)",this};var rn;o.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!o.namespaces.rvml&&o.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),rn=function(e){return o.createElement("<rvml:"+e+' class="rvml">')}}catch(sn){rn=function(e){return o.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}$t=function(){var t=Tt[h](0,arguments),n=t.container,r=t.height,i,s=t.width,u=t.x,a=t.y;if(!n)throw new Error("VML container not found.");var l=new f,p=l.canvas=o.createElement("div"),d=p.style;return u=u||0,a=a||0,s=s||512,r=r||342,s==+s&&(s+="px"),r==+r&&(r+="px"),l.width=1e3,l.height=1e3,l.coordsize=Zt*1e3+m+Zt*1e3,l.coordorigin="0 0",l.span=o.createElement("span"),l.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;"
,p[c](l.span),d.cssText=e.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",s,r),n==1?(o.body[c](p),d.left=u+"px",d.top=a+"px",d.position="absolute"):n.firstChild?n.insertBefore(p,n.firstChild):n[c](p),Nt.call(l,l,e.fn),l},l.clear=function(){this.canvas.innerHTML=v,this.span=o.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas[c](this.span),this.bottom=this.top=null},l.remove=function(){this.canvas.parentNode.removeChild(this.canvas);for(var e in this)this[e]=Mt(e);return!0}}var on=navigator.userAgent.match(/Version\/(.*?)\s/);navigator.vendor=="Apple Computer, Inc."&&(on&&on[1]<4||navigator.platform.slice(0,2)=="iP")?l.safari=function(){var e=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});u.setTimeout(function(){e.remove()})}:l.safari=function(){};var un=function(){this.returnValue=!1},an=function(){return this.originalEvent.preventDefault()},fn=function(){this.cancelBubble=!0},ln=function(){return this.originalEvent.stopPropagation()},cn=function(){if(o.addEventListener)return function(e,t,n,r){var i=d&&w[t]?w[t]:t,o=function(i){if(d&&w[s](t))for(var o=0,u=i.targetTouches&&i.targetTouches.length;o<u;o++)if(i.targetTouches[o].target==e){var a=i;i=i.targetTouches[o],i.originalEvent=a,i.preventDefault=an,i.stopPropagation=ln;break}return n.call(r,i)};return e.addEventListener(i,o,!1),function(){return e.removeEventListener(i,o,!1),!0}};if(o.attachEvent)return function(e,t,n,r){var i=function(
e){return e=e||u.event,e.preventDefault=e.preventDefault||un,e.stopPropagation=e.stopPropagation||fn,n.call(r,e)};e.attachEvent("on"+t,i);var s=function(){return e.detachEvent("on"+t,i),!0};return s}}(),hn=[],pn=function(e){var t=e.clientX,n=e.clientY,r=o.documentElement.scrollTop||o.body.scrollTop,i=o.documentElement.scrollLeft||o.body.scrollLeft,s,u=hn.length;while(u--){s=hn[u];if(d){var a=e.touches.length,f;while(a--){f=e.touches[a];if(f.identifier==s.el._drag.id){t=f.clientX,n=f.clientY,(e.originalEvent?e.originalEvent:e).preventDefault();break}}}else e.preventDefault();t+=i,n+=r,s.move&&s.move.call(s.move_scope||s.el,t-s.el._drag.x,n-s.el._drag.y,t,n,e)}},dn=function(t){e.unmousemove(pn).unmouseup(dn);var n=hn.length,r;while(n--)r=hn[n],r.el._drag={},r.end&&r.end.call(r.end_scope||r.start_scope||r.move_scope||r.el,t);hn=[]};for(var vn=b[S];vn--;)(function(t){e[t]=It[i][t]=function(n,r){return e.is(n,"function")&&(this.events=this.events||[],this.events.push({name:t,f:n,unbind:cn(this.shape||this.node||o,t,n,r||this)})),this},e["un"+t]=It[i]["un"+t]=function(e){var n=this.events||[],r=n[S];while(r--)if(n[r].name==t&&n[r].f==e)return n[r].unbind(),n.splice(r,1),!n.length&&delete this.events,this;return this}})(b[vn]);qt.hover=function(e,t,n,r){return this.mouseover(e,n).mouseout(t,r||n)},qt.unhover=function(e,t){return this.unmouseover(e).unmouseout(t)},qt.drag=function(t,n,r,i,s,u){return this._drag={},this.mousedown(function(a){(a.originalEvent||a).preventDefault();var f=o.documentElement.scrollTop||o.body.scrollTop,l=o.documentElement.scrollLeft||o.body.scrollLeft;this
._drag.x=a.clientX+l,this._drag.y=a.clientY+f,this._drag.id=a.identifier,n&&n.call(s||i||this,a.clientX+l,a.clientY+f,a),!hn.length&&e.mousemove(pn).mouseup(dn),hn.push({el:this,move:t,end:r,move_scope:i,start_scope:s,end_scope:u})}),this},qt.undrag=function(t,n,r){var i=hn.length;while(i--)hn[i].el==this&&hn[i].move==t&&hn[i].end==r&&hn.splice(i,1);!hn.length&&e.unmousemove(pn).unmouseup(dn)},l.circle=function(e,t,n){return Rt(this,e||0,t||0,n||0)},l.rect=function(e,t,n,r,i){return Ut(this,e||0,t||0,n||0,r||0,i||0)},l.ellipse=function(e,t,n,r){return zt(this,e||0,t||0,n||0,r||0)},l.path=function(t){return t&&!e.is(t,M)&&!e.is(t[0],_)&&(t+=v),Dt(e.format[h](e,arguments),this)},l.image=function(e,t,n,r,i){return Wt(this,e||"about:blank",t||0,n||0,r||0,i||0)},l.text=function(e,t,n){return Xt(this,e||0,t||0,g(n))},l.set=function(e){return arguments[S]>1&&(e=Array[i].splice.call(arguments,0,arguments[S])),new On(e)},l.setSize=Vt,l.top=l.bottom=null,l.raphael=e,qt.resetScale=function(){if(this.removed)return this;this._.sx=1,this._.sy=1,this.attrs.scale="1 1"},qt.scale=function(e,t,n,r){if(this.removed)return this;if(e==null&&t==null)return{x:this._.sx,y:this._.sy,toString:mn};t=t||e,!+t&&(t=e);var i,s,o,u,a=this.attrs;if(e!=0){var f=this.getBBox(),l=f.x+f.width/2,c=f.y+f.height/2,h=k(e/this._.sx),d=k(t/this._.sy);n=+n||n==0?n:l,r=+r||r==0?r:c;var g=this._.sx>0,y=this._.sy>0,b=~~(e/k(e)),w=~~(t/k(t)),x=h*b,T=d*w,N=this.node.style,C=n+k(l-n)*x*(l>n==g?1:-1),L=r+k(c-r)*T*(c>r==y?1:-1),A=e*b>t*w?d:h;switch(this.type){case"rect":case"image":var O=a.width*h,M=a.height*d;this.attr({height
:M,r:a.r*A,width:O,x:C-O/2,y:L-M/2});break;case"circle":case"ellipse":this.attr({rx:a.rx*h,ry:a.ry*d,r:a.r*A,cx:C,cy:L});break;case"text":this.attr({x:C,y:L});break;case"path":var _=vt(a.path),D=!0,P=g?x:h,H=y?T:d;for(var B=0,j=_[S];B<j;B++){var F=_[B],I=$.call(F[0]);if(I=="M"&&D)continue;D=!1;if(I=="A")F[_[B][S]-2]*=P,F[_[B][S]-1]*=H,F[1]*=h,F[2]*=d,F[5]=+(b+w?!!+F[5]:!+F[5]);else if(I=="H")for(var q=1,R=F[S];q<R;q++)F[q]*=P;else if(I=="V")for(q=1,R=F[S];q<R;q++)F[q]*=H;else for(q=1,R=F[S];q<R;q++)F[q]*=q%2?P:H}var U=pt(_);i=C-U.x-U.width/2,s=L-U.y-U.height/2,_[0][1]+=i,_[0][2]+=s,this.attr({path:_})}if(this.type in{text:1,image:1}&&(b!=1||w!=1))this.transformations?(this.transformations[2]="scale("[p](b,",",w,")"),this.node[z]("transform",this.transformations[E](m)),i=b==-1?-a.x-(O||0):a.x,s=w==-1?-a.y-(M||0):a.y,this.attr({x:i,y:s}),a.fx=b-1,a.fy=w-1):(this.node.filterMatrix=V+".Matrix(M11="[p](b,", M12=0, M21=0, M22=",w,", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')"),N.filter=(this.node.filterMatrix||v)+(this.node.filterOpacity||v));else if(this.transformations){this.transformations[2]=v;var W=this.transformations[E](m),X=/^\s+$/;X.test(W)||this.node[z]("transform",W),a.fx=0,a.fy=0}else this.node.filterMatrix=v,N.filter=(this.node.filterMatrix||v)+(this.node.filterOpacity||v);a.scale=[e,t,n,r][E](m),this._.sx=e,this._.sy=t}return this},qt.clone=function(){if(this.removed)return null;var e=this.attr();return delete e.scale,delete e.translation,this.paper[this.type]().attr(e)};var gn={},yn=function(t,n,r,i,s,o,u,a,f){var l=0,c=100,h=[t,n,r,i,s,o,u,a].join
(),p=gn[h],d,v;!p&&(gn[h]=p={data:[]}),p.timer&&clearTimeout(p.timer),p.timer=setTimeout(function(){delete gn[h]},2e3);if(f!=null){var m=yn(t,n,r,i,s,o,u,a);c=~~m*10}for(var g=0;g<c+1;g++){p.data[f]>g?v=p.data[g*c]:(v=e.findDotsAtSegment(t,n,r,i,s,o,u,a,g/c),p.data[g]=v),g&&(l+=L(L(d.x-v.x,2)+L(d.y-v.y,2),.5));if(f!=null&&l>=f)return v;d=v}if(f==null)return l},bn=function(t,n){return function(r,i,s){r=St(r);var o,u,a,f,l="",c={},h,p=0;for(var d=0,v=r.length;d<v;d++){a=r[d];if(a[0]=="M")o=+a[1],u=+a[2];else{f=yn(o,u,a[1],a[2],a[3],a[4],a[5],a[6]);if(p+f>i){if(n&&!c.start){h=yn(o,u,a[1],a[2],a[3],a[4],a[5],a[6],i-p),l+=["C",h.start.x,h.start.y,h.m.x,h.m.y,h.x,h.y];if(s)return l;c.start=l,l=["M",h.x,h.y+"C",h.n.x,h.n.y,h.end.x,h.end.y,a[5],a[6]][E](),p+=f,o=+a[5],u=+a[6];continue}if(!t&&!n)return h=yn(o,u,a[1],a[2],a[3],a[4],a[5],a[6],i-p),{x:h.x,y:h.y,alpha:h.alpha}}p+=f,o=+a[5],u=+a[6]}l+=a}return c.end=l,h=t?p:n?c:e.findDotsAtSegment(o,u,a[1],a[2],a[3],a[4],a[5],a[6],1),h.alpha&&(h={x:h.x,y:h.y,alpha:h.alpha}),h}},wn=bn(1),En=bn(),Sn=bn(0,1);qt.getTotalLength=function(){if(this.type!="path")return;return this.node.getTotalLength?this.node.getTotalLength():wn(this.attrs.path)},qt.getPointAtLength=function(e){if(this.type!="path")return;return En(this.attrs.path,e)},qt.getSubpath=function(e,t){if(this.type!="path")return;if(k(this.getTotalLength()-t)<"1e-6")return Sn(this.attrs.path,e).end;var n=Sn(this.attrs.path,t,1);return e?Sn(n,e).end:n},e.easing_formulas={linear:function(e){return e},"<":function(e){return L(e,3)},">":function(e){return L(e-1,3)+1},"<>":function(e){return e*=2
,e<1?L(e,3)/2:(e-=2,(L(e,3)+2)/2)},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){e-=1;var t=1.70158;return e*e*((t+1)*e+t)+1},elastic:function(e){if(e==0||e==1)return e;var t=.3,n=t/4;return L(2,-10*e)*T.sin((e-n)*2*A/t)+1},bounce:function(e){var t=7.5625,n=2.75,r;return e<1/n?r=t*e*e:e<2/n?(e-=1.5/n,r=t*e*e+.75):e<2.5/n?(e-=2.25/n,r=t*e*e+.9375):(e-=2.625/n,r=t*e*e+.984375),r}};var xn=[],Tn=function(){var t=+(new Date);for(var n=0;n<xn[S];n++){var r=xn[n];if(r.stop||r.el.removed)continue;var i=t-r.start,o=r.ms,u=r.easing,a=r.from,f=r.diff,l=r.to,c=r.t,h=r.el,p={},d;if(i<o){var g=u(i/o);for(var y in a)if(a[s](y)){switch(K[y]){case"along":d=g*o*f[y],l.back&&(d=l.len-d);var b=En(l[y],d);h.translate(f.sx-f.x||0,f.sy-f.y||0),f.x=b.x,f.y=b.y,h.translate(b.x-f.sx,b.y-f.sy),l.rot&&h.rotate(f.r+b.alpha,b.x,b.y);break;case O:d=+a[y]+g*o*f[y];break;case"colour":d="rgb("+[Cn(U(a[y].r+g*o*f[y].r)),Cn(U(a[y].g+g*o*f[y].g)),Cn(U(a[y].b+g*o*f[y].b))][E](",")+")";break;case"path":d=[];for(var w=0,x=a[y][S];w<x;w++){d[w]=[a[y][w][0]];for(var T=1,N=a[y][w][S];T<N;T++)d[w][T]=+a[y][w][T]+g*o*f[y][w][T];d[w]=d[w][E](m)}d=d[E](m);break;case"csv":switch(y){case"translation":var C=g*o*f[y][0]-c.x,k=g*o*f[y][1]-c.y;c.x+=C,c.y+=k,d=C+m+k;break;case"rotation":d=+a[y][0]+g*o*f[y][0],a[y][1]&&(d+=","+a[y][1]+","+a[y][2]);break;case"scale":d=[+a[y][0]+g*o*f[y][0],+a[y][1]+g*o*f[y][1],2 in l[y]?l[y][2]:v,3 in l[y]?l[y][3]:v][E](m);break;case"clip-rect":d=[],w=4;while(w--)d[w]=+a[y][w]+g*o*f[y][w]}break;default:var L=[].concat(a[y]);d=[],w=h.paper.customAttributes[y].length;
while(w--)d[w]=+L[w]+g*o*f[y][w]}p[y]=d}h.attr(p),h._run&&h._run.call(h)}else l.along&&(b=En(l.along,l.len*!l.back),h.translate(f.sx-(f.x||0)+b.x-f.sx,f.sy-(f.y||0)+b.y-f.sy),l.rot&&h.rotate(f.r+b.alpha,b.x,b.y)),(c.x||c.y)&&h.translate(-c.x,-c.y),l.scale&&(l.scale+=v),h.attr(l),xn.splice(n--,1)}e.svg&&h&&h.paper&&h.paper.safari(),xn[S]&&setTimeout(Tn)},Nn=function(t,n,r,i,s){var o=r-i;n.timeouts.push(setTimeout(function(){e.is(s,"function")&&s.call(n),n.animate(t,o,t.easing)},i))},Cn=function(e){return N(C(e,255),0)},kn=function(e,t){if(e==null)return{x:this._.tx,y:this._.ty,toString:mn};this._.tx+=+e,this._.ty+=+t;switch(this.type){case"circle":case"ellipse":this.attr({cx:+e+this.attrs.cx,cy:+t+this.attrs.cy});break;case"rect":case"image":case"text":this.attr({x:+e+this.attrs.x,y:+t+this.attrs.y});break;case"path":var n=vt(this.attrs.path);n[0][1]+=+e,n[0][2]+=+t,this.attr({path:n})}return this};qt.animateWith=function(e,t,n,r,i){for(var s=0,o=xn.length;s<o;s++)xn[s].el.id==e.id&&(t.start=xn[s].start);return this.animate(t,n,r,i)},qt.animateAlong=Ln(),qt.animateAlongBack=Ln(1),qt.onAnimation=function(e){return this._run=e||0,this},qt.animate=function(n,r,i,o){var u=this;u.timeouts=u.timeouts||[];if(e.is(i,"function")||!i)o=i||null;if(u.removed)return o&&o.call(u),u;var a={},f={},l=!1,c={};for(var h in n)if(n[s](h))if(K[s](h)||u.paper.customAttributes[s](h)){l=!0,a[h]=u.attr(h),a[h]==null&&(a[h]=J[h]),f[h]=n[h];switch(K[h]){case"along":var p=wn(n[h]),d=En(n[h],p*!!n.back),v=u.getBBox();c[h]=p/r,c.tx=v.x,c.ty=v.y,c.sx=d.x,c.sy=d.y,f.rot=n.rot,f.back=n.back,f.len=p,n.rot&&(c.
r=W(u.rotate())||0);break;case O:c[h]=(f[h]-a[h])/r;break;case"colour":a[h]=e.getRGB(a[h]);var m=e.getRGB(f[h]);c[h]={r:(m.r-a[h].r)/r,g:(m.g-a[h].g)/r,b:(m.b-a[h].b)/r};break;case"path":var b=St(a[h],f[h]);a[h]=b[0];var w=b[1];c[h]=[];for(var E=0,x=a[h][S];E<x;E++){c[h][E]=[0];for(var T=1,N=a[h][E][S];T<N;T++)c[h][E][T]=(w[E][T]-a[h][E][T])/r}break;case"csv":var C=g(n[h])[y](t),k=g(a[h])[y](t);switch(h){case"translation":a[h]=[0,0],c[h]=[C[0]/r,C[1]/r];break;case"rotation":a[h]=k[1]==C[1]&&k[2]==C[2]?k:[0,C[1],C[2]],c[h]=[(C[0]-a[h][0])/r,0,0];break;case"scale":n[h]=C,a[h]=g(a[h])[y](t),c[h]=[(C[0]-a[h][0])/r,(C[1]-a[h][1])/r,0,0];break;case"clip-rect":a[h]=g(a[h])[y](t),c[h]=[],E=4;while(E--)c[h][E]=(C[E]-a[h][E])/r}f[h]=C;break;default:C=[].concat(n[h]),k=[].concat(a[h]),c[h]=[],E=u.paper.customAttributes[h][S];while(E--)c[h][E]=((C[E]||0)-(k[E]||0))/r}}if(!l){var L=[],A;for(var M in n)n[s](M)&&G.test(M)&&(h={value:n[M]},M=="from"&&(M=0),M=="to"&&(M=100),h.key=X(M,10),L.push(h));L.sort(it),L[0].key&&L.unshift({key:0,value:u.attrs});for(E=0,x=L[S];E<x;E++)Nn(L[E].value,u,r/100*L[E].key,r/100*(L[E-1]&&L[E-1].key||0),L[E-1]&&L[E-1].value.callback);A=L[L[S]-1].value.callback,A&&u.timeouts.push(setTimeout(function(){A.call(u)},r))}else{var _=e.easing_formulas[i];if(!_){_=g(i).match(R);if(_&&_[S]==5){var D=_;_=function(e){return An(e,+D[1],+D[2],+D[3],+D[4],r)}}else _=function(e){return e}}xn.push({start:n.start||+(new Date),ms:r,easing:_,from:a,diff:c,to:f,el:u,t:{x:0,y:0}}),e.is(o,"function")&&(u._ac=setTimeout(function(){o.call(u)},r)),xn[S]==1&&setTimeout(Tn)}return this},qt
.stop=function(){for(var e=0;e<xn.length;e++)xn[e].el.id==this.id&&xn.splice(e--,1);for(e=0,ii=this.timeouts&&this.timeouts.length;e<ii;e++)clearTimeout(this.timeouts[e]);return this.timeouts=[],clearTimeout(this._ac),delete this._ac,this},qt.translate=function(e,t){return this.attr({translation:e+" "+t})},qt[D]=function(){return"Raphaël’s object"},e.ae=xn;var On=function(e){this.items=[],this[S]=0,this.type="set";if(e)for(var t=0,n=e[S];t<n;t++)e[t]&&(e[t].constructor==It||e[t].constructor==On)&&(this[this.items[S]]=this.items[this.items[S]]=e[t],this[S]++)};On[i][j]=function(){var e,t;for(var n=0,r=arguments[S];n<r;n++)e=arguments[n],e&&(e.constructor==It||e.constructor==On)&&(t=this.items[S],this[t]=this.items[t]=e,this[S]++);return this},On[i].pop=function(){return delete this[this[S]--],this.items.pop()};for(var Mn in qt)qt[s](Mn)&&(On[i][Mn]=function(e){return function(){for(var t=0,n=this.items[S];t<n;t++)this.items[t][e][h](this.items[t],arguments);return this}}(Mn));On[i].attr=function(t,n){if(t&&e.is(t,_)&&e.is(t[0],"object"))for(var r=0,i=t[S];r<i;r++)this.items[r].attr(t[r]);else for(var s=0,o=this.items[S];s<o;s++)this.items[s].attr(t,n);return this},On[i].animate=function(t,n,r,i){(e.is(r,"function")||!r)&&(i=r||null);var s=this.items[S],o=s,u,a=this,f;i&&(f=function(){!--s&&i.call(a)}),r=e.is(r,M)?r:f,u=this.items[--o].animate(t,n,r,f);while(o--)this.items[o]&&!this.items[o].removed&&this.items[o].animateWith(u,t,n,r,f);return this},On[i].insertAfter=function(e){var t=this.items[S];while(t--)this.items[t].insertAfter(e);return this},On[i].getBBox=function(){var e=
[],t=[],n=[],r=[];for(var i=this.items[S];i--;){var s=this.items[i].getBBox();e[j](s.x),t[j](s.y),n[j](s.x+s.width),r[j](s.y+s.height)}return e=C[h](0,e),t=C[h](0,t),{x:e,y:t,width:N[h](0,n)-e,height:N[h](0,r)-t}},On[i].clone=function(e){e=new On;for(var t=0,n=this.items[S];t<n;t++)e[j](this.items[t].clone());return e},e.registerFont=function(e){if(!e.face)return e;this.fonts=this.fonts||{};var t={w:e.w,face:{},glyphs:{}},n=e.face["font-family"];for(var r in e.face)e.face[s](r)&&(t.face[r]=e.face[r]);this.fonts[n]?this.fonts[n][j](t):this.fonts[n]=[t];if(!e.svg){t.face["units-per-em"]=X(e.face["units-per-em"],10);for(var i in e.glyphs)if(e.glyphs[s](i)){var o=e.glyphs[i];t.glyphs[i]={w:o.w,k:{},d:o.d&&"M"+o.d[Q](/[mlcxtrv]/g,function(e){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[e]||"M"})+"z"};if(o.k)for(var u in o.k)o[s](u)&&(t.glyphs[i].k[u]=o.k[u])}}return e},l.getFont=function(t,n,r,i){i=i||"normal",r=r||"normal",n=+n||{normal:400,bold:700,lighter:300,bolder:800}[n]||400;if(!e.fonts)return;var o=e.fonts[t];if(!o){var u=new RegExp("(^|\\s)"+t[Q](/[^\w\d\s+!~.:_-]/g,v)+"(\\s|$)","i");for(var a in e.fonts)if(e.fonts[s](a)&&u.test(a)){o=e.fonts[a];break}}var f;if(o)for(var l=0,c=o[S];l<c;l++){f=o[l];if(f.face["font-weight"]==n&&(f.face["font-style"]==r||!f.face["font-style"])&&f.face["font-stretch"]==i)break}return f},l.print=function(n,r,i,s,o,u,a){u=u||"middle",a=N(C(a||0,1),-1);var f=this.set(),l=g(i)[y](v),c=0,h=v,p;e.is(s,i)&&(s=this.getFont(s));if(s){p=(o||16)/s.face["units-per-em"];var d=s.face.bbox.split(t),m=+d[0],b=+d[1]+(u=="baseline"?d[3]-d[1]+ +s.face.descent:(
d[3]-d[1])/2);for(var w=0,E=l[S];w<E;w++){var x=w&&s.glyphs[l[w-1]]||{},T=s.glyphs[l[w]];c+=w?(x.w||s.w)+(x.k&&x.k[l[w]]||0)+s.w*a:0,T&&T.d&&f[j](this.path(T.d).attr({fill:"#000",stroke:"none",translation:[c,0]}))}f.scale(p,p,m,b).translate(n-m,r-b)}return f},e.format=function(t,n){var i=e.is(n,_)?[0][p](n):arguments;return t&&e.is(t,M)&&i[S]-1&&(t=t[Q](r,function(e,t){return i[++t]==null?v:i[t]})),t||v},e.ninja=function(){return a.was?u.Raphael=a.is:delete Raphael,e},e.el=qt,e.st=On[i],a.was?u.Raphael=e:Raphael=e}(),SC.DateFormatter=function(e,t){if(!e)throw"No date passed to date formatter.";if(!e.getFullYear)throw"Object passed to date formatter was not a date!";if(!t)throw"No formatting string passed to date formatter. Date: "+e;var n=t.length,r=t[0],i;for(i=1;i<n;i++)if(t[i]!==r)throw"Invalid format string for a date; all characters must be the same: "+t+"; date: "+e;var s=SC.DateFormatter[r];if(!s)throw"No formatter `"+r+"` exists for date: "+e;return s(e,n)},SC.DateFormatter.G=function(e,t){var n="SC.Date.Era.";n+=e.getFullYear()>=0?"AD":"BC";if(t<=3)return(n+".Abbreviated").loc();if(t===4)return(n+".Full").loc();if(t===5)return(n+".Letter").loc();throw"Invalid era format: expected at most 5 digits; found "+t+"."},SC.DateFormatter.y=function(e,t){var n=e.getFullYear();t===1&&(t=n.length);var r=Math.abs(n).toString();while(r.length<t)r="0"+r;return r=r.substr(r.length-t),r},SC.DateFormatter.Y=function(e,t){return SC.DateFormatter.y(e,t)},SC.DateFormatter.u=function(e,t){var n=e.getFullYear();t===1&&(t=n.length);var r=n<0,i=Math.abs(n).toString();while(i.length<t)i="0"+
i;return i=i.substr(i.length-t),(r?"-":"")+i},SC.DateFormatter.Q=function(e,t,n){var r=e.getMonth(),i=Math.floor(r/3)+1,s="SC.Date.Quarter."+(n?"StandAlone.":"")+"Q"+i;if(t===1)return""+i;if(t===2)return"0"+i;if(t===3)return(s+".Abbreviated").loc();if(t==4)return(s+".Full").loc();throw"Unrecognized number of characters for quarter: "+t},SC.DateFormatter.q=function(e,t){return SC.DateFormatter.Q(e,t,YES)},SC.DateFormatter.ENGLISH_MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"],SC.DateFormatter.M=function(e,t,n){var r=e.getMonth(),i=""+(r+1),s="SC.Date.Month."+(n?n:"")+SC.DateFormatter.ENGLISH_MONTH_NAMES[r];if(t===1)return i;if(t===2)return i.length<2&&(i="0"+i),i;if(t===3)return(s+".Abbreviated").loc();if(t===4)return(s+".Full").loc();if(t===5)return(s+".Letter").loc();throw"The number of Ms or Ls must be from 1 to 5. Supplied: "+t},SC.DateFormatter.L=function(e,t){var n="StandAlone.";return SC.DateFormatter.M(e,t,n)},SC.DateFormatter.P=function(e,t){var n="Prepositional.";return SC.DateFormatter.M(e,t,n)},SC.DateFormatter.l=function(){throw"`l` date formatter not implemented."},SC.DateFormatter.w=function(e,t){throw"Week number currently not supported for date formatting."},SC.DateFormatter.W=function(e,t){throw"Week number currently not supported for date formatting."},SC.DateFormatter.d=function(e,t){var n=""+e.getDate();return t>n.length&&(n="0"+n),n},SC.DateFormatter.D=function(e,t){var n=new Date(e.getFullYear(),0,1),r=n.getTime(),i=e.getTime()-r,s=Math.floor(i/864e5)+1;s=""+s;while(s.length<t)
s="0"+s;return s},SC.DateFormatter.F=function(e,t){throw"Day of week in month (F) is not supported in date formatting"},SC.DateFormatter.g=function(e,t){throw"Julian day not supported in date formatting."},SC.DateFormatter.ENGLISH_DAY_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],SC.DateFormatter.E=function(e,t){return t<3&&(t=3),SC.DateFormatter.e(e,t)},SC.DateFormatter.e=function(e,t,n){var r=e.getDay(),i=""+(r+1),s="SC.Date.Day."+(n?"StandAlone.":"")+SC.DateFormatter.ENGLISH_DAY_NAMES[r];if(t===1)return i;if(t===2)return i="0"+i,i;if(t===3)return(s+".Abbreviated").loc();if(t===4)return(s+".Full").loc();if(t===5)return(s+".Letter").loc();throw"Unrecognized number of `e`s, `c`s, or `E`s in date format string."},SC.DateFormatter.c=function(e,t){return SC.DateFormatter.e(e,t,YES)},SC.DateFormatter.a=function(e,t){if(t!==1)throw"`a` can only be included in a date format string once.";var n="SC.Date.Period."+(e.getHours()>11?"PM":"AM");return n.loc()},SC.DateFormatter._h=function(e,t,n,r){var i=e.getHours();n||(i%=12),r&&(n?i===0&&(i=24):i===0&&(i=12));var s=""+i;return s.length<t&&(s="0"+s),s},SC.DateFormatter.h=function(e,t){return SC.DateFormatter._h(e,t,NO,1)},SC.DateFormatter.H=function(e,t){return SC.DateFormatter._h(e,t,YES,0)},SC.DateFormatter.K=function(e,t){return SC.DateFormatter._h(e,t,NO,0)},SC.DateFormatter.k=function(e,t){return SC.DateFormatter._h(e,t,YES,1)},SC.DateFormatter.m=function(e,t){var n=""+e.getMinutes();return n.length<t&&(n="0"+n),n},SC.DateFormatter.s=function(e,t){var n=""+e.getSeconds();return n.length<t&&(n="0"+n
),n},SC.DateFormatter.S=function(e,t){var n=e.getMilliseconds()/1e3,r=Math.pow(10,t);n=Math.round(n*r),n=""+n;while(n.length<t)n="0"+n;return n},SC.DateFormatter.A=function(e,t){var n=(new Date(e.getFullYear(),e.getMonth(),e.getDay())).getTime(),r=e.getTime()-n;r=""+r;while(r.length<t)r="0"+r;return r},SC.DateFormatter.z=SC.DateFormatter.Z=SC.DateFormatter.v=SC.DateFormatter.V=function(e,t){throw"Timezone not supported in date format strings."},function(e){function a(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function f(e){return String(Object.prototype.toString.call(e))==="[object Array]"}function l(t,n){var r={},i,s;if(f(n))for(i=0,s=n.length;i<s;i++)r[n[i]]=!0;else r[n]=!0;for(i=0,s=t.length;i<s;i++)r[t[i]]!==e&&(t.splice(i,1),s--,i--);return t}var t=typeof module!="undefined"&&module.exports,n=function(e){return t?require("./"+e):window[e]},r=n("punycode"),i=n("IPv6"),s=n("SecondLevelDomains"),o=function(t,n){return this instanceof o?(t===e&&(t=location.href+""),this.href(t),n!==e?this.absoluteTo(n):this):new o(t)},u=o.prototype;o.idn_expression=/[^a-z0-9\.-]/i,o.punycode_expression=/(xn--)/i,o.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,o.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/
,o.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig,o.defaultPorts={http:"80",https:"443",ftp:"21"},o.invalid_hostname_characters=/[^a-zA-Z0-9\.-]/,o.encode=encodeURIComponent,o.decode=decodeURIComponent,o.iso8859=function(){o.encode=escape,o.decode=unescape},o.unicode=function(){o.encode=encodeURIComponent,o.decode=decodeURIComponent},o.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}}},o.encodeQuery=function(e){return o.encode(e+"").replace(/%20/g,"+")},o.decodeQuery=function(e){return o.decode((e+"").replace(/\+/g,"%20"))},o.recodePath=function(e){var t=(e+"").split("/");for(var n=0,r=t.length;n<r;n++)t[n]=o.encodePathSegment(o.decode(t[n]));return t.join("/")},o.decodePath=function(e){var t=(e+"").split("/");for(var n=0,r=t.length;n<r;n++)t[n]=o.decodePathSegment(t[n]);return t.join("/")};var c={encode:"encode",decode:"decode"},h,p=function(e){return function(t){return o[e](t+"").replace(o.characters.pathname[e].expression,function(t){return o.characters.pathname[e].map[t]})}};for(h in c)o[h+"PathSegment"]=p(c[h]);o.parse=function(e){var t,n,r={};return t=e.indexOf("#"),t>-1&&(r.fragment=e.substring(t+1)||null,e=e.substring(0,t)),t=e.indexOf("?"),t>-1&&(r.query=e.substring(t+1)||null,e=e.substring(0,t)),e.substring(0,2)==="//"?
(r.protocol="",e=e.substring(2),e=o.parseAuthority(e,r)):(t=e.indexOf(":"),t>-1&&(r.protocol=e.substring(0,t),e.substring(t+1,t+3)==="//"?(e=e.substring(t+3),e=o.parseAuthority(e,r)):(e=e.substring(t+1),r.urn=!0))),r.path=e,r},o.parseHost=function(e,t){var n=e.indexOf("/"),r;n===-1&&(n=e.length);if(e[0]==="["){var i=e.indexOf("]");t.hostname=e.substring(1,i)||null,t.port=e.substring(i+2,n)||null}else e.indexOf(":")!==e.lastIndexOf(":")?(t.hostname=e.substring(0,n)||null,t.port=null):(r=e.substring(0,n).split(":"),t.hostname=r[0]||null,t.port=r[1]||null);return t.hostname&&e.substring(n)[0]!=="/"&&(n++,e="/"+e),e.substring(n)||"/"},o.parseAuthority=function(e,t){return e=o.parseUserinfo(e,t),o.parseHost(e,t)},o.parseUserinfo=function(e,t){var n=e.indexOf("@"),r=e.indexOf("/"),i;return n>-1&&(r===-1||n<r)?(i=e.substring(0,n).split(":"),t.username=i[0]?o.decode(i[0]):null,t.password=i[1]?o.decode(i[1]):null,e=e.substring(n+1)):(t.username=null,t.password=null),e},o.parseQuery=function(e){if(!e)return{};e=e.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"");if(!e)return{};var t={},n=e.split("&"),r=n.length;for(var i=0;i<r;i++){var s=n[i].split("="),u=o.decodeQuery(s.shift()),a=s.length?o.decodeQuery(s.join("=")):null;t[u]?(typeof t[u]=="string"&&(t[u]=[t[u]]),t[u].push(a)):t[u]=a}return t},o.build=function(e){var t="";return e.protocol&&(t+=e.protocol+":"),!e.urn&&(t||e.hostname)&&(t+="//"),t+=o.buildAuthority(e)||"",typeof e.path=="string"&&(e.path[0]!=="/"&&typeof e.hostname=="string"&&(t+="/"),t+=e.path),typeof e.query=="string"&&(t+="?"+e.query),typeof e.fragment=="string"&&(t+="#"+
e.fragment),t},o.buildHost=function(e){var t="";return e.hostname?(o.ip6_expression.test(e.hostname)?e.port?t+="["+e.hostname+"]:"+e.port:t+=e.hostname:(t+=e.hostname,e.port&&(t+=":"+e.port)),t):""},o.buildAuthority=function(e){return o.buildUserinfo(e)+o.buildHost(e)},o.buildUserinfo=function(e){var t="";return e.username&&(t+=o.encode(e.username),e.password&&(t+=":"+o.encode(e.password)),t+="@"),t},o.buildQuery=function(t,n){var r="";for(var i in t)if(Object.hasOwnProperty.call(t,i)&&i)if(f(t[i])){var s={};for(var u=0,a=t[i].length;u<a;u++)t[i][u]!==e&&s[t[i][u]+""]===e&&(r+="&"+o.buildQueryParameter(i,t[i][u]),n!==!0&&(s[t[i][u]+""]=!0))}else t[i]!==e&&(r+="&"+o.buildQueryParameter(i,t[i]));return r.substring(1)},o.buildQueryParameter=function(e,t){return o.encodeQuery(e)+(t!==null?"="+o.encodeQuery(t):"")},o.addQuery=function(t,n,r){if(typeof n=="object")for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&o.addQuery(t,i,n[i]);else{if(typeof n!="string")throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");if(t[n]===e){t[n]=r;return}typeof t[n]=="string"&&(t[n]=[t[n]]),f(r)||(r=[r]),t[n]=t[n].concat(r)}},o.removeQuery=function(t,n,r){if(f(n))for(var i=0,s=n.length;i<s;i++)t[n[i]]=e;else if(typeof n=="object")for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&o.removeQuery(t,u,n[u]);else{if(typeof n!="string")throw new TypeError("URI.addQuery() accepts an object, string as the first parameter");r!==e?t[n]===r?t[n]=e:f(t[n])&&(t[n]=l(t[n],r)):t[n]=e}},o.commonPath=function(e,t){var n=Math.min(e.length,t.length),r;for(r=0;r<n;r++)
if(e[r]!==t[r]){r--;break}return r<1?e[0]===t[0]&&e[0]==="/"?"/":"":(e[r]!=="/"&&(r=e.substring(0,r).lastIndexOf("/")),e.substring(0,r+1))},o.withinString=function(e,t){return e.replace(o.find_uri_expression,t)},o.ensureValidHostname=function(e){if(e.match(o.invalid_hostname_characters)){if(!r)throw new TypeError("Hostname '"+e+"' contains characters other than [A-Z0-9.-] and Punycode.js is not available");if(r.toASCII(e).match(o.invalid_hostname_characters))throw new TypeError("Hostname '"+e+"' contains characters other than [A-Z0-9.-]")}},u.build=function(t){if(t===!0)this._deferred_build=!0;else if(t===e||this._deferred_build)this._string=o.build(this._parts),this._deferred_build=!1;return this},u.toString=function(){return this.build(!1)._string},u.valueOf=function(){return this.toString()},c={protocol:"protocol",username:"username",password:"password",hostname:"hostname",port:"port"},p=function(t){return function(n,r){return n===e?this._parts[t]||"":(this._parts[t]=n,this.build(!r),this)}};for(h in c)u[h]=p(c[h]);c={query:"?",fragment:"#"},p=function(t,n){return function(r,i){return r===e?this._parts[t]||"":(r!==null&&(r+="",r[0]===n&&(r=r.substring(1))),this._parts[t]=r,this.build(!i),this)}};for(h in c)u[h]=p(h,c[h]);c={search:["?","query"],hash:["#","fragment"]},p=function(e,t){return function(n,r){var i=this[e](n,r);return typeof i=="string"&&i.length?t+i:i}};for(h in c)u[h]=p(c[h][1],c[h][0]);u.pathname=function(t,n){if(t===e||t===!0){var r=this._parts.path||(this._parts.urn?"":"/");return t?o.decodePath(r):r}return this._parts.path=t?o.recodePath(t):"/",this.build
(!n),this},u.path=u.pathname,u.href=function(t,n){if(t===e)return this.toString();this._string="",this._parts={protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null};var r=t instanceof o,i=typeof t=="object"&&(t.hostname||t.path),s;if(typeof t=="string")this._parts=o.parse(t);else{if(!r&&!i)throw new TypeError("invalid input");var u=r?t._parts:t;for(s in u)Object.hasOwnProperty.call(this._parts,s)&&(this._parts[s]=u[s])}return this.build(!n),this},u.is=function(e){var t=!1,n=!1,r=!1,i=!1,u=!1,a=!1,f=!1,l=!this._parts.urn;this._parts.hostname&&(l=!1,n=o.ip4_expression.test(this._parts.hostname),r=o.ip6_expression.test(this._parts.hostname),t=n||r,i=!t,u=i&&s&&s.has(this._parts.hostname),a=i&&o.idn_expression.test(this._parts.hostname),f=i&&o.punycode_expression.test(this._parts.hostname));switch(e.toLowerCase()){case"relative":return l;case"absolute":return!l;case"domain":case"name":return i;case"sld":return u;case"ip":return t;case"ip4":case"ipv4":case"inet4":return n;case"ip6":case"ipv6":case"inet6":return r;case"idn":return a;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return f}return null};var d=u.protocol,v=u.port,m=u.hostname;u.protocol=function(t,n){if(t!==e&&t){t=t.replace(/:(\/\/)?$/,"");if(t.match(/[^a-zA-z0-9\.+-]/))throw new TypeError("Protocol '"+t+"' contains characters other than [A-Z0-9.+-]")}return d.call(this,t,n)},u.scheme=u.protocol,u.port=function(t,n){if(this._parts.urn)return t===e?"":this;if(t!==e){t===0&&(t=null);if(t){t+="",t[0]===":"&&(t=t.substring(1));if(
t.match(/[^0-9]/))throw new TypeError("Port '"+t+"' contains characters other than [0-9]")}}return v.call(this,t,n)},u.hostname=function(t,n){if(this._parts.urn)return t===e?"":this;if(t!==e){var r={};o.parseHost(t,r),t=r.hostname}return m.call(this,t,n)},u.host=function(t,n){return this._parts.urn?t===e?"":this:t===e?this._parts.hostname?o.buildHost(this._parts):"":(o.parseHost(t,this._parts),this.build(!n),this)},u.authority=function(t,n){return this._parts.urn?t===e?"":this:t===e?this._parts.hostname?o.buildAuthority(this._parts):"":(o.parseAuthority(t,this._parts),this.build(!n),this)},u.userinfo=function(t,n){if(this._parts.urn)return t===e?"":this;if(t===e){if(!this._parts.username)return"";var r=o.buildUserinfo(this._parts);return r.substring(0,r.length-1)}return t[t.length-1]!=="@"&&(t+="@"),o.parseUserinfo(t,this._parts),this.build(!n),this},u.subdomain=function(t,n){if(this._parts.urn)return t===e?"":this;if(t===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,r)||""}var i=this._parts.hostname.length-this.domain().length,s=this._parts.hostname.substring(0,i),u=new RegExp("^"+a(s));return t&&t[t.length-1]!=="."&&(t+="."),t&&o.ensureValidHostname(t),this._parts.hostname=this._parts.hostname.replace(u,t),this.build(!n),this},u.domain=function(t,n){if(this._parts.urn)return t===e?"":this;typeof t=="boolean"&&(n=t,t=e);if(t===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.match(/\./g);if(!r||r.length<2)return this._parts.hostname;var i=this
._parts.hostname.length-this.tld(n).length-1;return i=this._parts.hostname.lastIndexOf(".",i-1)+1,this._parts.hostname.substring(i)||""}if(!t)throw new TypeError("cannot set domain empty");o.ensureValidHostname(t);if(!this._parts.hostname||this.is("IP"))this._parts.hostname=t;else{var s=new RegExp(a(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(s,t)}return this.build(!n),this},u.tld=function(t,n){if(this._parts.urn)return t===e?"":this;typeof t=="boolean"&&(n=t,t=e);if(t===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.lastIndexOf("."),i=this._parts.hostname.substring(r+1);return n!==!0&&s&&s.list[i.toLowerCase()]?s.get(this._parts.hostname)||i:i}var o;if(!t)throw new TypeError("cannot set TLD empty");if(t.match(/[^a-zA-Z0-9-]/)){if(!s||!s.is(t))throw new TypeError("TLD '"+t+"' contains characters other than [A-Z0-9]");o=new RegExp(a(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,t)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");o=new RegExp(a(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,t)}return this.build(!n),this},u.directory=function(t,n){if(this._parts.urn)return t===e?"":this;if(t===e||t===!0){if(!this._parts.path||this._parts.path==="/")return"/";var r=this._parts.path.length-this.filename().length-1,i=this._parts.path.substring(0,r)||"/";return t?o.decodePath(i):i}var s=this._parts.path.length-this.filename().length,u=this._parts.path.substring(0,s),f=new RegExp("^"+a(u));return this.is("relative")||(t||(t="/"
),t[0]!=="/"&&(t="/"+t)),t&&t[t.length-1]!=="/"&&(t+="/"),t=o.recodePath(t),this._parts.path=this._parts.path.replace(f,t),this.build(!n),this},u.filename=function(t,n){if(this._parts.urn)return t===e?"":this;if(t===e||t===!0){if(!this._parts.path||this._parts.path==="/")return"";var r=this._parts.path.lastIndexOf("/"),i=this._parts.path.substring(r+1);return t?o.decodePathSegment(i):i}var s=!1;t[0]==="/"&&(t=t.substring(1)),t.match(/\.?\//)&&(s=!0);var u=new RegExp(a(this.filename())+"$");return t=o.recodePath(t),this._parts.path=this._parts.path.replace(u,t),s?this.normalizePath(n):this.build(!n),this},u.suffix=function(t,n){if(this._parts.urn)return t===e?"":this;if(t===e||t===!0){if(!this._parts.path||this._parts.path==="/")return"";var r=this.filename(),i=r.lastIndexOf("."),s,u;return i===-1?"":(s=r.substring(i+1),u=/^[a-z0-9%]+$/i.test(s)?s:"",t?o.decodePathSegment(u):u)}t[0]==="."&&(t=t.substring(1));var f=this.suffix(),l;if(!f){if(!t)return this;this._parts.path+="."+o.recodePath(t)}else t?l=new RegExp(a(f)+"$"):l=new RegExp(a("."+f)+"$");return l&&(t=o.recodePath(t),this._parts.path=this._parts.path.replace(l,t)),this.build(!n),this};var g=u.query;u.query=function(t,n){return t===!0?o.parseQuery(this._parts.query):t!==e&&typeof t!="string"?(this._parts.query=o.buildQuery(t),this.build(!n),this):g.call(this,t,n)},u.addQuery=function(e,t,n){var r=o.parseQuery(this._parts.query);return o.addQuery(r,e,t),this._parts.query=o.buildQuery(r),typeof e!="string"&&(n=t),this.build(!n),this},u.removeQuery=function(e,t,n){var r=o.parseQuery(this._parts.query);return o.removeQuery
(r,e,t),this._parts.query=o.buildQuery(r),typeof e!="string"&&(n=t),this.build(!n),this},u.addSearch=u.addQuery,u.removeSearch=u.removeQuery,u.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},u.normalizeProtocol=function(e){return typeof this._parts.protocol=="string"&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!e)),this},u.normalizeHostname=function(e){return this._parts.hostname&&(this.is("IDN")&&r?this._parts.hostname=r.toASCII(this._parts.hostname):this.is("IPv6")&&i&&(this._parts.hostname=i.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!e)),this},u.normalizePort=function(e){return typeof this._parts.protocol=="string"&&this._parts.port===o.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!e)),this},u.normalizePath=function(e){if(this._parts.urn)return this;if(!this._parts.path||this._parts.path==="/")return this;var t,n,r=this._parts.path,i,s;r[0]!=="/"&&(r[0]==="."&&(n=r.substring(0,r.indexOf("/"))),t=!0,r="/"+r),r=r.replace(/(\/(\.\/)+)|\/{2,}/g,"/");for(;;){i=r.indexOf("/../");if(i===-1)break;if(i===0){r=r.substring(3);break}s=r.substring(0,i).lastIndexOf("/"),s===-1&&(s=i),r=r.substring(0,s)+r.substring(i+3)}return t&&this.is("relative")&&(n?r=n+r:r=r.substring(1)),r=o.recodePath(r),this._parts.path=r,this.build(!e),this},u.normalizePathname=u.normalizePath,u.normalizeQuery=
function(e){return typeof this._parts.query=="string"&&(this._parts.query.length?this.query(o.parseQuery(this._parts.query)):this._parts.query=null,this.build(!e)),this},u.normalizeFragment=function(e){return this._parts.fragment||(this._parts.fragment=null,this.build(!e)),this},u.normalizeSearch=u.normalizeQuery,u.normalizeHash=u.normalizeFragment,u.iso8859=function(){var e=o.encode,t=o.decode;return o.encode=escape,o.decode=decodeURIComponent,this.normalize(),o.encode=e,o.decode=t,this},u.unicode=function(){var e=o.encode,t=o.decode;return o.encode=encodeURIComponent,o.decode=unescape,this.normalize(),o.encode=e,o.decode=t,this},u.readable=function(){var t=new o(this);t.username("").password("").normalize();var n="";t._parts.protocol&&(n+=t._parts.protocol+"://"),t._parts.hostname&&(t.is("punycode")&&r?(n+=r.toUnicode(t._parts.hostname),t._parts.port&&(n+=":"+t._parts.port)):n+=t.host()),t._parts.hostname&&t._parts.path&&t._parts.path[0]!=="/"&&(n+="/"),n+=t.path(!0);if(t._parts.query){var i="";for(var s=0,u=t._parts.query.split("&"),a=u.length;s<a;s++){var f=(u[s]||"").split("=");i+="&"+o.decodeQuery(f[0]).replace(/&/g,"%26"),f[1]!==e&&(i+="="+o.decodeQuery(f[1]).replace(/&/g,"%26"))}n+="?"+i.substring(1)}return n+=t.hash(),n},u.absoluteTo=function(e){if(this._parts.urn)throw new Error("URNs do not have any generally defined hierachical components");if(!this.is("relative"))throw new Error("Cannot resolve non-relative URL");e instanceof o||(e=new o(e));var t=new o(this),n=["protocol","username","password","hostname","port"];for(var r=0,i;i=n[r];r++)t._parts[i]=e._parts[i];
return t.path()[0]!=="/"&&(t._parts.path=e.directory()+"/"+t._parts.path,t.normalizePath()),t.build(),t},u.relativeTo=function(e){if(this._parts.urn)throw new Error("URNs do not have any generally defined hierachical components");e instanceof o||(e=new o(e));if(this.path()[0]!=="/"||e.path()[0]!=="/")throw new Error("Cannot calculate common path from non-relative URLs");var t=new o(this),n=["protocol","username","password","hostname","port"],r=o.commonPath(t.path(),e.path()),i=e.directory();for(var s=0,u;u=n[s];s++)t._parts[u]=null;if(!r||r==="/")return t;if(i+"/"===r)t._parts.path="./"+t.filename();else{var f="../",l=new RegExp("^"+a(r)),c=i.replace(l,"/").match(/\//g).length-1;while(c--)f+="../";t._parts.path=t._parts.path.replace(l,f)}return t.build(),t},u.equals=function(e){var t=new o(this),n=new o(e),r={},i={},s={},u,a,l;t.normalize(),n.normalize();if(t.toString()===n.toString())return!0;u=t.query(),a=n.query(),t.query(""),n.query("");if(t.toString()!==n.toString())return!1;if(u.length!==a.length)return!1;r=o.parseQuery(u),i=o.parseQuery(a);for(l in r)if(Object.prototype.hasOwnProperty.call(r,l)){if(!f(r[l])){if(r[l]!==i[l])return!1}else{if(!f(i[l]))return!1;if(r[l].length!==i[l].length)return!1;r[l].sort(),i[l].sort();for(var c=0,h=r[l].length;c<h;c++)if(r[l][c]!==i[l][c])return!1}s[l]=!0}for(l in i)if(Object.prototype.hasOwnProperty.call(i,l)&&!s[l])return!1;return!0},typeof module!="undefined"&&module.exports?module.exports=o:window.URI=o}(),function(e,t){var n=e.prototype;n.baseEquals=function(t){var n=(new e(this)).normalize(),r=(new e(t)).normalize(),i=n.protocol
()+"://"+n.domain()+":"+n.port(),s=r.protocol()+"://"+r.domain()+":"+r.port();return i===s}}(window.URI),function(e,t){var n=e.prototype;n.sortQuery=function(){var t=this._parts.query;if(!t.length)this._parts.query=null;else{var n=e.parseQuery(t),r,i,s,o;this.query(null),o=CW.invertHash(n).sort();for(r=0,i=o.length;r<i;r++)s=o[r],this.addQuery(s,n[s])}return this}}(window.URI),SC.stringsFor("English",{"Uploader.fileTooBigDescription":"The file was too big","Uploader.wrongFiletypeDescription":"The file type is not supported"}),CW=SC.Object.create({NAMESPACE:"CW",VERSION:"1.0.0"}),CW.mixin({upperCaseUUID:function(){return this.UUID().toString().toUpperCase()},UUID:function(){var e=new Array(36),t=0,n=["8","9","a","b"];if(window.crypto&&window.crypto.getRandomValues){var r=new Uint8Array(18);crypto.getRandomValues(r);for(t=0;t<18;t++)e[t*2+1]=(r[t]>>4).toString(16),e[t*2]=(r[t]&15).toString(16);e[19]=n[r[9]>>6]}else{while(t<36)e[t]=(Math.random()*16|0).toString(16),t++;e[19]=n[Math.random()*4|0]}return e[8]=e[13]=e[18]=e[23]="-",e[14]="4",e.join("")},invertArray:function(e){e||CW.fatalError("invertArray(): You must specify an array to invert");var t,n,r,i={};for(t=0,n=e.length;t<n;++t)r=e[t],i[r]=!0;return i},invertArrayWithOrder:function(e){e||CW.fatalError("invertArrayWithOrder(): You must specify an array to invert");var t,n,r,i={};for(t=0,n=e.length;t<n;++t)r=e[t],i[r]=t;return i},invertHash:function(e,t){e||CW.fatalError("invertHash(): You must specify an hash to invert");var n,r,i=[];if(t)for(n in e)r=e[n],r&&i.push(parseInt(n,10));else for(n in e)r=e[n],r&&i.push(n);return i
},combineHashes:function(e,t){var n=SC.clone(e),r;for(r in t)n[r]=t[r];return n},hashDifferencesBreakdown:function(e,t,n){(!e||!t)&&CW.fatalError("hashDifferencesBreakdown() must be called with two hashes"),e===t&&CW.fatalError("hashDifferencesBreakdown() must be called with two different hashes");var r=[],i=[],s=[],o=[],u,a,f,l;n&&(u=this.invertArray(n));var c=CW.getSimpleTypes(),h={},p,d,v,m;for(a in e){h[a]=!0;if(u&&u[a])continue;p=e[a],d=t[a],d===undefined?s.push(a):(v=p===d,v||(m=SC.typeOf(p),c[m]?v=!1:v=CW.valuesAreEqual(p,d,m)),v?r.push(a):i.push(a))}for(a in t)h[a]||o.push(a);return{equal:r,different:i,firstHashOnly:s,secondHashOnly:o}},valuesAreEqual:function(e,t,n,r){if(e===t)return!0;n||(n=SC.typeOf(e));var i=CW.getSimpleTypes();if(i[n])return!1;r||(r=SC.typeOf(t));if(n!==r)return!1;if(n===SC.T_DATE)return e.getTime()===t.getTime();if(n===SC.T_REGEXP)return e.toString()===t.toString();if(n===SC.T_HASH){var s=0,o,u,a,f;for(o in e){++s,u=e[o],a=t[o];if(u!==a){f=SC.typeOf(u);if(i[f])return!1;if(!CW.valuesAreEqual(u,a,f))return!1}}for(o in t)--s;return s===0}if(n===SC.T_ARRAY){var l=e.length,c=t.length;if(l!==c)return!1;for(var h=l-1;h>=0;--h){u=e[h],a=t[h];if(u!==a){f=SC.typeOf(u);if(i[f])return!1;if(!CW.valuesAreEqual(u,a,f))return!1}}return!0}CW.fatalError("Unsupported type for CW.valuesAreEqual: '%@'".fmt(n))},getSimpleTypes:function(){var e=CW._simpleTypes;return e||(e=CW._simpleTypes={},e[SC.T_STRING]=!0,e[SC.T_NUMBER]=!0,e[SC.T_BOOL]=!0,e[SC.T_UNDEFINED]=!0,e[SC.T_NULL]=!0),e},getUrlParameters:function(e){e||(e=location.search);var t=new URI.parse(e);return t.
query?URI.parseQuery(t.query):{}},escapeRegexCharacters:function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&")},formatNumber:function(e,t,n){if(SC.none(e))return"";SC.none(t)&&(t=","),SC.none(n)&&(n="."),e=e.toString();var r=e.split("."),i=r[0],s=r[1],o=/(\d+?)(?=(?:\d{3})+$)/g,u="$1"+t;return i=i.replace(o,u),s?i+n+s:i},preloadTargetImages:function(e){if(SC.APP_IMAGE_ASSETS)for(var t=0,n=SC.APP_IMAGE_ASSETS.length;t<n;t++)(!e||SC.APP_IMAGE_ASSETS[t].indexOf(e)!==-1)&&SC.imageQueue.loadImage(SC.APP_IMAGE_ASSETS[t])},guidForContents:function(e,t){var n=t|0,r="",i,s,o;if(CW.isArrayLike(e)){i=e.length;for(s=0;s<i;s++)s&&(r+=","),r+=CW.componentForValue(e[s],n);return"["+r+"]"}if(SC.kindOf(e,SC.Array)){i=e.get("length");for(s=0;s<i;s++)s&&(r+=","),r+=CW.componentForValue(e.objectAt(s),n);return"["+r+"]"}if(!CW.isPrimitive(e)){var u=[];for(o in e)e.hasOwnProperty(o)&&u.push(o);u.sort(),i=u.length;for(s=0;s<i;s++)o=u[s],s&&(r+=","),r+='"'+o+'":'+CW.componentForValue(e[o],n);return"{"+r+"}"}CW.fatalError("Object expected in call to `guidForContents`.",e)},componentForValue:function(e,t){return t>0&&!CW.isPrimitive(e)?CW.guidForContents(e,t-1):'"'+SC.guidFor(e)+'"'},isArrayLike:function(e){return Array.isArray(e)?!0:e&&""+e=="[object Arguments]"},isPrimitive:function(e){return e===null||typeof e!="object"&&typeof e!="function"},fontDetector:function(e,t){var n=t.delay||50,r=t.timeout||1e3,i=t.testString||"MMMMMMMIIIa%@!",s=t.testFontFamily||'"Comic Sans MS"',o=t.testFontSize||"300px",u=t.targetFontWeight||"500",a=t.fail,f=t.success,l=t.complete,c,h,p=document.createElement("canvas"
),d=p.getContext("2d");d.font=u+" "+o+" "+s;var v=d.measureText(i).width;h=window.setInterval(function(){d.font=u+" "+o+' "'+e+'", '+s,d.measureText(i).width!==v&&v!==0&&(window.clearInterval(h),window.clearTimeout(c),f&&SC.run(f()),l&&SC.run(l(!0)))},n),c=window.setTimeout(function(){window.clearInterval(h),a&&SC.run(a()),l&&SC.run(l(!1))},r)}}),SC.ready(function(){setTimeout(function(){CW.preloadTargetImages()},2e3)}),CW.mixin({fatalError:function(e,t){var n=this.recordStack(YES,YES),r;throw e instanceof Error?r=e:r=new Error(e),t&&SC.mixin(r,t),r.recordedStack=n,r},recordStack:function(e,t){if(t||!this.get("hasSymbolicated"))try{this.symbolicate()}catch(n){}var r=arguments.callee,i=r?r.caller:null,s=0,o=[],u={},a,f,l,c,h,p;i&&e&&(i=i.caller);while(i&&s<26){a=i.displayName,a||(a=i.name),a||(a=i.toString()),a.length>150&&(a=a.substring(0,150)),l={func:a},f=i.arguments;if(f){c=[];for(h=0;h<5;++h)p=f[h],p&&(p.toString?p=p.toString():p="(argument without .toString() method)"),c.push(p);l.args=c}o[s++]=l;if(u[a]){o[s++]="(Because "+a+" was called recursively, no more of the stack is available)";break}u[a]=!0,i=i.caller}return o},hasSymbolicated:NO,namespacesToSymbolicate:["SC"],symbolicate:function(){if(!SC.Object.toString()){SC.warn("Cannot yet properly symbolicate because SproutCore is not yet in a position to provide class names");return}this.hasSymbolicated||(this.hasSymbolicated=!0);if(!SC||!SC.typeOf)return;var e=new Date;this._symbolicateClassAndSubclasses(SC.Object);var t=this.namespacesToSymbolicate,n=CW.invertArray(t),r,i,s,o,u,a,f,l,c,h;if(!t)return;for(r in window){
if(n[r])continue;i=r.charAt(0);if(i.toUpperCase()===i)try{f=window[r],f&&f.isObject&&t.push(r)}catch(p){}}for(u=0,a=t.length;u<a;++u){s=t[u],o=window[s];for(r in o){if(!o.hasOwnProperty(r))continue;f=o[r];if(!f)continue;if(f instanceof Function)f.displayName||(l=s+"."+r,f.displayName=l);else if(f instanceof Object&&!f.isClass)for(c in f){if(!f.hasOwnProperty(c))continue;try{h=f[c],h instanceof Function&&(h.displayName||(l=s+"."+r+"."+c,h.displayName=l))}catch(d){SC.warn("Can not symbolicate %@: %@",c,d)}}}}SC.info("Spent %@ ms symbolicating",new Date-e)},_symbolicateClassAndSubclasses:function(e){var t=e.toString(),n,r,i,s,o,u;if(!t)return;for(n in e){if(!e.hasOwnProperty(n))continue;r=e[n],r instanceof Function&&(r.displayName||(i=t+"."+n,r.displayName=i))}s=e.prototype;for(n in s){if(!s.hasOwnProperty(n))continue;r=s[n],r instanceof Function&&(r.displayName||(i=t+"#"+n,r.displayName=i))}o=e.subclasses;for(n in o)u=o[n],u&&u.isClass&&this._symbolicateClassAndSubclasses(u)}}),CW.FakeReply=SC.Object.extend({isFakeReply:YES,shouldProcessRequestNormally:NO,applyToBackgroundRequests:NO,status:undefined,statusText:undefined,responseText:undefined,urlFilter:undefined,delay:undefined,headers:undefined,readyState:undefined,_lowercaseHeaders:null,getAllResponseHeaders:function(){var e=this.get("headers"),t="";for(var n in e){var r=e[n];t+=n+": "+r+"\n"}return t},getResponseHeader:function(e){if(!e)return;var t=this._lowercaseHeaders;if(!t){t=this._lowercaseHeaders={};var n=this.get("headers");for(var r in n){var i=n[r];t[r.toLowerCase()]=i}}return t[e.toLowerCase()]},abort:function()
{},toString:function(){if(this.get("shouldProcessRequestNormally"))return"will be sent normally";var e=[],t=CW.FakeReply.allowableCreationParams,n,r,i,s;for(n=0,r=t.length;n<r;++n){i=t[n],s=this.get(i);if(s!==undefined){if(i==="applyToBackgroundRequests"&&!s)continue;SC.typeOf(s)===SC.T_STRING?e.push("%@=“%@”".fmt(i,s)):e.push("%@=%@".fmt(i,s))}}return e.join(", ")}}),SC.mixin(CW.FakeReply,{allowableCreationParams:["applyToBackgroundRequests","status","statusText","responseText","responseHash","urlFilter","delay","headers"],_allowableCreationParamsHash:null,createFakeReply:function(e){var t=CW.FakeReply,n=t._allowableCreationParamsHash,r,i,s,o;if(!n){n=t._allowableCreationParamsHash={},i=t.allowableCreationParams;for(s=0,o=i.length;s<o;++s)r=i[s],n[r]=YES}if(e===null)return t.create({shouldProcessRequestNormally:YES});e||CW.fatalError("You must specify params for the fake reply");var u=NO;for(r in e)n[r]||(console.error&&console.error("Fake reply has an unrecognized parameter “%@”:".fmt(r),e),u=YES);u&&CW.fatalError("Unrecognized parameter in fake reply");var a=0,f=e.status;f===undefined?(console.error&&console.error("Fake reply does not include a status:",e),++a):f||(console.error&&console.error("Fake reply has an invalid status of 0:",e),++a);var l=e.responseText,c=e.responseHash;l===undefined&&!c?l=e.responseText="Fake reply with status "+f:l!==undefined&&c?(console.error&&console.error("Fake reply has both a responseText and a responseHash:",e),++a):l!==undefined&&SC.typeOf(l)!==SC.T_STRING?(console.error&&console.error("Fake reply has an invalid responseText (it should be a string):"
,e),++a):c&&SC.typeOf(c)!==SC.T_HASH&&(console.error&&console.error("Fake reply has an invalid responseHash (it should be a hash):",e),++a);var h=e.urlFilter;h&&!(h instanceof RegExp)&&(SC.typeOf(h)===SC.T_STRING?e.urlFilter=new RegExp(h):(console.error&&console.error("Fake reply has an invalid urlFilter (it should be a string or a RegExp instance):",e),++a));if(c&&a===0){delete e.responseHash;try{e.responseText=SC.json.encode(c)}catch(p){console.error&&console.error("There was an error encoding JSON from the responseHash: "+p+", fake reply:",e),++a}}if(a===1)CW.fatalError("There was one error with the fake reply parameters");else{if(!(a>0))return t.create(e);CW.fatalError("There were %@ errors with the fake reply parameters".fmt(a))}}}),CW.mixin({requestLoggingLevel:null,fakeReplyQueue:null,addFakeReply:function(e,t){SC.typeOf(e)!==SC.T_ARRAY&&(e=SC.$A(e));var n=CW.FakeReply,r=[],i,s,o,u;for(i=0,s=e.length;i<s;++i){o=e[i],u=null;try{u=n.createFakeReply(o)}catch(a){}u&&r.push(u)}var f=e.length,l=r.length;if(f!==l){var c=f-l;c===1?CW.fatalError("Errors prevented your fake reply from being added. The fake reply queue was not changed."):CW.fatalError("Errors prevented %@ of your %@ fake replies from being added. The fake reply queue was not changed.".fmt(c,f))}var h=this.get("fakeReplyQueue");h||(h=[],this.set("fakeReplyQueue",h)),h.beginPropertyChanges();for(i=0,s=r.length;i<s;++i)u=r[i],h.pushObject(u);h.endPropertyChanges(),t||(console.log("The fake reply queue is now:"),this.listFakeReplyQueue())},listFakeReplyQueue:function(){var e=this.get("fakeReplyQueue");if(!e)console
.log("(no fake reply queue)");else{var t=[],n,r,i;for(n=0,r=e.length;n<r;++n)i=e[n],t.push("[%@] %@".fmt(n,i));console.log(t.join("\n"))}},_recordingCount:0,_logRequestIfAppropriateFor:function(e){e||CW.fatalError("_logRequestIfAppropriateFor(): A response must be specified");var t=this.get("requestLoggingLevel"),n=++this._recordingCount,r,i,s,o,u,a,f;t&&(e._recordingID=n,e._sentAt=new Date,r=e.get("request"),i=r.get("type"),s=r.getFullAddress(),o=this._sortAndStringifyHeaders(r.get("headers")),u=r.get("cookies"),r.get("bodyShouldBeLogged")?(a=r.get("encodedBody"),a||(a="(empty)")):a="(omitted)",f="--> Request "+n+": "+i+" to "+s+", headers: "+o+(u?", cookies: "+u:"")+", body: "+a,SC.Logger._handleMessage(t,NO,f))},_logResponseIfAppropriate:function(e){e||CW.fatalError("_logResponseIfAppropriateFor(): A response must be specified");var t=this.get("requestLoggingLevel"),n=new Date,r,i,s,o,u,a,f,l,c;if(t){r=e._recordingID,i=e._sentAt,s=e._receivedAtWhileSuspended,o=e.get("timedOut"),o?u=" (timed out)":s?u=i?" ("+(s-i)+"ms, suspended for "+(n-s)+"ms)":" (unknown)":u=i?" ("+(n-i)+"ms)":" (unknown)",a=e.get("status");try{f=this._sortAndStringifyHeaders(e.get("headers"))}catch(h){}e.get("bodyShouldBeLogged")?(l=e.get("encodedBody"),l||(l="(empty)")):l="(omitted)",c="<-- Response "+r+": "+a+u+", headers: "+f+" body: "+l,SC.Logger._handleMessage(t,NO,c)}},_sortAndStringifyHeaders:function(e){var t,n,r,i,s,o=[];for(t in e)o.push(t);o.sort(),r="";for(i=0,s=o.length;i<s;++i)t=o[i],n=e[t],i!==0&&(r+=", "),r+=t+"="+n;return r}}),CW.ButtonKeyHandlingHelpers={isDefault:NO
,isCancel:NO,keyHandlersDidChange:function(){var e=null,t=this.get("isDefault"),n=this.get("isCancel");t?this.registerKeyboardShortcut("return",this,this.triggerActionFromKeyboardShortcut):this.deregisterKeyboardShortcut("return"),n?this.registerKeyboardShortcut("escape",this,this.triggerActionFromKeyboardShortcut):this.deregisterKeyboardShortcut("escape")}.observes("isDefault","isCancel"),initMixin:function(){this.get("isDefault")&&this.registerKeyboardShortcut("return",this,this.triggerActionFromKeyboardShortcut),this.get("isCancel")&&this.registerKeyboardShortcut("escape",this,this.triggerActionFromKeyboardShortcut)},triggerActionFromKeyboardShortcut:function(e){return this.triggerAction(),YES}},CW.ViewKeyHandlingHelpers={keyboardShortcuts:null,initMixin:function(){this._cwvkh_paneDidChange()},_cwvkh_paneDidChange:function(){var e,t,n,r,i,s=this,o;if(this.keyboardShortcuts&&this._cwvkh_lastPane!==this.get("pane")){n=this.get("pane"),e=this.get("keyboardShortcuts"),r=this._cwvkh_lastPane;if(r)for(t in e)r.deregisterKeyboardShortcut(t);if(n)for(t in e)i=e[t],typeof i=="string"||typeof i=="function"?o=i:(s=i.target,o=i.action),n.registerKeyboardShortcut(t,s,o);this._cwvkh_lastPane=n}}.observes("pane"),registerKeyboardShortcut:function(e,t,n){n||(n=t,t=this);var r=this.keyboardShortcuts,i=this.get("pane");r||(r=this.keyboardShortcuts={}),r[e]={target:t,action:n},i&&i.registerKeyboardShortcut(e,t,n)},deregisterKeyboardShortcut:function(e){var t=this.keyboardShortcuts,n=this.get("pane");t&&(delete this.keyboardShortcuts[e],n&&n.deregisterKeyboardShortcut(e))}},SHA1=SC.Object.create
({hexcase:1,b64pad:"",hex_sha1:function(e){return this.rstr2hex(this.rstr_sha1(this.str2rstr_utf8(e)))},b64_sha1:function(e){return this.rstr2b64(this.rstr_sha1(this.str2rstr_utf8(e)))},sha1_vm_test:function(){return this.hex_sha1("abc").toLowerCase()==="a9993e364706816aba3e25717850c26c9cd0d89d"},rstr_sha1:function(e){return this.binb2rstr(this.binb_sha1(this.rstr2binb(e),e.length*8))},rstr2hex:function(e){var t=this.hexcase?"0123456789ABCDEF":"0123456789abcdef",n="",r;for(var i=0;i<e.length;i++)r=e.charCodeAt(i),n+=t.charAt(r>>>4&15)+t.charAt(r&15);return n},rstr2b64:function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="",r=e.length;for(var i=0;i<r;i+=3){var s=e.charCodeAt(i)<<16|(i+1<r?e.charCodeAt(i+1)<<8:0)|(i+2<r?e.charCodeAt(i+2):0);for(var o=0;o<4;o++)i*8+o*6>e.length*8?n+=b64pad:n+=t.charAt(s>>>6*(3-o)&63)}return n},str2rstr_utf8:function(e){var t="",n=-1,r,i;while(++n<e.length)r=e.charCodeAt(n),i=n+1<e.length?e.charCodeAt(n+1):0,55296<=r&&r<=56319&&56320<=i&&i<=57343&&(r=65536+((r&1023)<<10)+(i&1023),n++),r<=127?t+=String.fromCharCode(r):r<=2047?t+=String.fromCharCode(192|r>>>6&31,128|r&63):r<=65535?t+=String.fromCharCode(224|r>>>12&15,128|r>>>6&63,128|r&63):r<=2097151&&(t+=String.fromCharCode(240|r>>>18&7,128|r>>>12&63,128|r>>>6&63,128|r&63));return t},rstr2binb:function(e){var t,n=Array(e.length>>2);for(t=0;t<n.length;t++)n[t]=0;for(t=0;t<e.length*8;t+=8)n[t>>5]|=(e.charCodeAt(t/8)&255)<<24-t%32;return n},binb2rstr:function(e){var t="";for(var n=0;n<e.length*32;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t},binb_sha1
:function(e,t){e[t>>5]|=128<<24-t%32,e[(t+64>>9<<4)+15]=t;var n=Array(80),r=1732584193,i=-271733879,s=-1732584194,o=271733878,u=-1009589776;for(var a=0;a<e.length;a+=16){var f=r,l=i,c=s,h=o,p=u;for(var d=0;d<80;d++){d<16?n[d]=e[a+d]:n[d]=this.bit_rol(n[d-3]^n[d-8]^n[d-14]^n[d-16],1);var v=this.safe_add(this.safe_add(this.bit_rol(r,5),this.sha1_ft(d,i,s,o)),this.safe_add(this.safe_add(u,n[d]),this.sha1_kt(d)));u=o,o=s,s=this.bit_rol(i,30),i=r,r=v}r=this.safe_add(r,f),i=this.safe_add(i,l),s=this.safe_add(s,c),o=this.safe_add(o,h),u=this.safe_add(u,p)}return Array(r,i,s,o,u)},sha1_ft:function(e,t,n,r){return e<20?t&n|~t&r:e<40?t^n^r:e<60?t&n|t&r|n&r:t^n^r},sha1_kt:function(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514},safe_add:function(e,t){var n=(e&65535)+(t&65535),r=(e>>16)+(t>>16)+(n>>16);return r<<16|n&65535},bit_rol:function(e,t){return e<<t|e>>>32-t}}),CW.SpritePreloadEnforcement={hasSpritePreloadEnforcement:YES,extraRequiredSrcs:null,extraRequiredImages:null,didFinishWaitingForImages:function(){},initMixin:function(){this.didCreateLayer&&(this._user_didCreateLayer=this.didCreateLayer),this.didCreateLayer=function(){if(this._user_didCreateLayer)var e=this._user_didCreateLayer.apply(this,arguments);return this._preload_didCreateLayer(),e}},_preload_didCreateLayer:function(){if(this.constructor.prototype.__hasPreloadedSprites__){var e=this.constructor.prototype.__preloadedExtraRequiredImages__;e&&(this.extraRequiredImages=e),SC.debug("Creating another instance of "+this.constructor+": all sprite backgrounds are confirmed to have been downloaded. Performing no preload action."
),this.hasPaneAnimationSupport&&(SC.debug("Because this is the first append, and this pane has PaneAnimationSupport, we now trigger animateShow() to perform the animation."),this._hasShownFromDidCreateLayer=!0,this.animateShow());return}this.hideForPreload(),this.preloadBackgroundSprites(this.getPreloadElementList(),this.showForPreload,this)},getPreloadElementList:function(){return SC.$A(this.$("*"))},hideForPreload:function(){this.set("isVisible",NO)},showForPreload:function(){this.set("isVisible",YES),this.hasPaneAnimationSupport&&(this._hasShownFromDidCreateLayer=!0,this.animateShow())},preloadBackgroundSprites:function(e,t,n){this.__elements__=e,this.__callback__=t,this.__target__=n,this.invokeLast("_preloadBackgroundSprites",e,t,n)},_preloadBackgroundSprites:function(e,t,n){e=this.__elements__,t=this.__callback__,n=this.__target__,this.__target__=this.__callback__=this.__elements__=undefined;var r=CW._backgroundImageLoadedness||(CW._backgroundImageLoadedness={}),i,s=0,o=!1,u=this,a=undefined,f=this.get("extraRequiredSrcs"),l=this.extraRequiredImages=f?{}:null,c=function(){s--,SC.debug("Finished loading "+this._src_+". images remaining before callback: "+s),r[this._src_]=!0,l&&this._extraKey_&&(l[this._extraKey_]=this),s===0&&(SC.debug("All images are downloaded. Now running callback."),h())},h=function(e){a&&clearTimeout(a);if(o){SC.debug("Performing the callback for all images having finished loading, but it has already been performed. Aborting.");return}e||(u.constructor.prototype.__hasPreloadedSprites__=!0,l&&(u.constructor.prototype.__preloadedExtraRequiredImages__=
l)),u.didFinishWaitingForImages(),o=!0,SC.run(function(){t.apply(n||u)})};e=SC.$A(e);for(var p=0,d,v,m,g;d=e[p];p++){m=jQuery(d).css("background-image");if(!m)continue;if(m.indexOf("http")===-1)continue;if(m.indexOf("url(")===-1)continue;m=m.substring(4,m.length-1);if((v=m.charAt(0))==='"'||v==="'")m=m.substring(1);if((v=m.charAt(m.length-1))==='"'||v==="'")m=m.substring(0,m.length-1);if(r[m])continue;if(i&&i[m])continue;(i||(i={}))[m]=!0,s++,g=new Image,g.onload=c,SC.debug("Preloading "+m),g.src=g._src_=m}if(f)for(p in f){if(!f.hasOwnProperty(p))continue;m=f[p],s++,g=new Image,g.onload=c,SC.debug("Preloading explicitly-specified image "+m),g.src=g._src_=m,g._extraKey_=p}if(s===0)SC.debug("Preloading background images, but every image was already loaded. Running callback immediately."),h();else{var y=SC.buildMode==="debug"?3e3:1500;a=setTimeout(function(){SC.debug("Attempted to preload background images, but the loading is taking longer than "+y/1e3+" seconds. Now running callback regardless of image loadedness."),h(!0)},y)}}},CW.TouchApproximation={isTouchApproximationEnabled:YES,distanceThreshold:50,touchStart:function(e){var t=this.convertFrameFromView({x:e.pageX,y:e.pageY}),n=t.x,r=t.y,i,s,o=this.get("touchApproximationViews")||this.get("childViews"),u=this.get("distanceThreshold"),a=null,f=Infinity,l,c,h,p,d;p=o.get("length");for(h=0;h<p;h++){l=o[h];if(!l||!l.get("isVisible")||l.get("isDecorative"))continue;c=l.get("frame"),i=-1,s=-1,n<c.x?i=c.x-n:n>c.x+c.width&&(i=n-(c.x+c.width)),r<c.y?s=c.y-r:r>c.y+c.height&&(s=r-(c.y+c.height)),i!==-1&&s!==-1?i=(i+s)/2:s!==-1&&(i=s)
,i!==-1&&i<f&&i<u&&(a=l,f=i)}if(a){e.isProxied=YES,e.target=a.get("layer"),d=a.tryToPerform("touchStart",e);if(d)return this._foundChild=a,YES;this._foundChild=null}return NO},touchesDragged:function(e,t){var n=this._foundChild;return n?n.tryToPerform("touchesDragged",e,t):NO},touchEnd:function(e){var t=this._foundChild;return t?(e.isProxied=YES,e.target=t.get("layer"),t.tryToPerform("touchEnd",e)):NO}},CW.mixin({encodeBase64:function(e){var t=this._b64,n=0,r=0,i="",s=[],o,u,a,f,l,c,h,p;if(!e)return e;e=this.encodeUTF8(e+"");do o=e.charCodeAt(n++),u=e.charCodeAt(n++),a=e.charCodeAt(n++),p=o<<16|u<<8|a,f=p>>18&63,l=p>>12&63,c=p>>6&63,h=p&63,s[r++]=t.charAt(f)+t.charAt(l)+t.charAt(c)+t.charAt(h);while(n<e.length);i=s.join("");switch(e.length%3){case 1:i=i.slice(0,-2)+"==";break;case 2:i=i.slice(0,-1)+"="}return i},decodeBase64:function(e){var t="",n=0,r=this._b64,i,s,o,u,a,f,l;if(!SC.empty(e)){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(n<e.length)u=r.indexOf(e.charAt(n++)),a=r.indexOf(e.charAt(n++)),f=r.indexOf(e.charAt(n++)),l=r.indexOf(e.charAt(n++)),i=u<<2|a>>4,s=(a&15)<<4|f>>2,o=(f&3)<<6|l,t+=String.fromCharCode(i),f!==64&&(t+=String.fromCharCode(s)),l!==64&&(t+=String.fromCharCode(o));t=this.decodeUTF8(t)}else CW.fatalError("Cannot decode blank input");return t},encodeUTF8:function(e){e=e.replace(/\r\n/g,"\n");var t="",n,r,i;for(n=0,r=e.length;n<r;++n)i=e.charCodeAt(n),i<128?t+=String.fromCharCode(i):i>127&&i<2048?(t+=String.fromCharCode(i>>6|192),t+=String.fromCharCode(i&63|128)):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128),t+=String.fromCharCode
(i&63|128));return t},decodeUTF8:function(e){var t="",n=0,r,i,s,o;r=i=s=o=0;while(n<e.length)r=e.charCodeAt(n),r<128?(t+=String.fromCharCode(r),n++):r>191&&r<224?(s=e.charCodeAt(n+1),t+=String.fromCharCode((r&31)<<6|s&63),n+=2):(s=e.charCodeAt(n+1),o=e.charCodeAt(n+2),t+=String.fromCharCode((r&15)<<12|(s&63)<<6|o&63),n+=3);return t},_b64:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}),CW.DATE_ONLY=0,CW.DATE_TIME=1,CW.DATE_TIME_TO_MIDNIGHT=3,CW.DATE_TIME_SEC=4,CW.DAY_MIN_DUR=1440,CW.DAY_MILLIS_DUR=864e5,CW.Date={value:null,dateType:CW.DATE_ONLY,timeFormat:null,fullDateFormat:null,dateFormat:null,_dateObj:null,_timezoneOffset:0,incrementSeconds:function(e){return this.seconds(this.seconds()+e),this},incrementMinutes:function(e){return this.minutes(this.minutes()+e),this},incrementHours:function(e){return this.hours(this.hours()+e),this},incrementDate:function(e){return this.date(this.date()+e),this},incrementMonth:function(e){return this.month(this.month()+e),this},incrementYear:function(e){return this.year(this.year()+e),this},now:function(){this._dateObj=new Date;var e=this._dateObj.getTime(),t=this._dateObj.getTimezoneOffset()*6e4;return this._dateObj.setTime(e-t),this._dateObj._isUsingUTC=!0,this._dateComponentDidChange(),this},dateComponent:function(){var e=this.value;return e?e[0]:null},date:function(e){return e!==undefined?(this._dateObj.setUTCDate(e),this._dateComponentDidChange()):this.value[3]},dateObject:function(){return this._dateObj},day:function(){return this._dateObj.getUTCDay()},fullYear:function(e){return e!==undefined?(this._dateObj.setUTCFullYear
(e),this._dateComponentDidChange()):this.value[1]},hours:function(e){return e!==undefined?(this._dateObj.setUTCHours(e),this._dateComponentDidChange()):this.value[4]},minutes:function(e){return e!==undefined?(this._dateObj.setUTCMinutes(e),this._dateComponentDidChange()):this.value[5]},seconds:function(e){return this.dateType===CW.DATE_TIME_SEC?e!==undefined?(this._dateObj.setUTCSeconds(e),this._dateComponentDidChange()):this.value[6]:0},month:function(e){return e!==undefined?(this._dateObj.setUTCMonth(e),this._dateComponentDidChange()):this._dateObj.getUTCMonth()},time:function(e){return e!==undefined?(this._dateObj.setTime(e),this._dateComponentDidChange()):this._dateObj.getTime()},timezoneOffset:function(e){return e!==undefined?(this.set("_timezoneOffset",e),this._dateComponentDidChange()):this.get("_timezoneOffset")},year:function(e){return this.fullYear(e)},changeDateType:function(e){return e===this.dateType?this:(e===CW.DATE_ONLY||e===CW.DATE_TIME||e===CW.DATE_TIME_TO_MIDNIGHT||e===CW.DATE_TIME_SEC?(this.dateType=e,this._dateComponentDidChange()):CW.fatalError("You must provide a valid date type."),this)},weekNumber:function(e){e=e?e:this._dateObj;var t=new Date(e.getUTCFullYear(),0,1),n=1,r=t.getUTCDay()-n,i=Math.floor((e.getTime()-t.getTime())/CW.DAY_MILLIS_DUR)+1,s,o,u,a,f;return r=r>=0?r:r+7,r<4?(s=Math.floor((i+r-1)/7)+1,s>52&&(o=new Date(e.getUTCFullYear()+1,0,1),u=o.getUTCDay()-n,u=u>=0?u:u+7,s=u<4?1:53)):(a=Math.floor((i+r-1)/7),s=a===0?53:a),f=e.getUTCFullYear(),s===53&&e.getUTCMonth()===0?f--:s===1&&e.getUTCMonth()===11&&f++,[f,s]},weekNumberToDate:function(e
,t){e=parseInt(e,0),t=parseInt(t,0);var n=new Date(t,0,10,12,0,0),r=new Date(t,0,4,12,0,0),i=new Date(r.getTime()-n.getUTCDay()*CW.DAY_MILLIS_DUR),s=new Date(i.getTime()+(e-1)*6048e5),o=new Date(s.getTime()+5184e5),u=[s,o];return u},dateRangeOfWeek:function(){var e=this._dateObj,t=e.getUTCDay(),n;t===0?n=6:n=t+1;var r=new Date(e.valueOf());r.setDate(e.getUTCDate()-n);var i=new Date(e.valueOf());return i.setDate(e.getUTCDate()+(7-e.getUTCDay())),[r,i]},daysInMonth:function(){var e=this.year(),t=this.month(),n=[31,28,31,30,31,30,31,31,30,31,30,31];return t===1&&(e%4===0&&e%100!==0||e%400===0)?29:n[t]},toTimeString:function(e){return e?this.format(e):this.timeFormat?this.format(this.timeFormat):this._dateObj.toString().substr(16,5)},toString:function(e){if(e)return this.format(e);if(this.fullDateFormat)return this.format(this.fullDateFormat);var t=this._dateObj;return t?t.toString():"null"},toDateString:function(e){return e?this.format(e):this.dateFormat?this.format(this.dateFormat):this._dateObj.toString().substr(0,15)},parse:function(e){var t=this._dateObj;return SC.typeOf(e)===SC.T_ARRAY?(isNaN(e[3])||t.setUTCDate(e[3]),isNaN(e[1])||t.setUTCFullYear(e[1]),isNaN(e[2])||t.setUTCMonth(e[2]-1),!isNaN(e[3])&&e[3]!==t.getUTCDate()&&t.setUTCDate(e[3]),this.dateType===CW.DATE_ONLY?(t.setUTCHours(12),t.setUTCMinutes(0)):(isNaN(e[4])||t.setUTCHours(e[4]),isNaN(e[5])||t.setUTCMinutes(e[5]),this.dateType===CW.DATE_TIME_SEC&&(isNaN(e[6])||t.setUTCSeconds(e[6])))):e&&e.getTime&&(e._isUsingUTC?(t.setUTCFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),t.setUTCHours(e.getUTCHours(
)),t.setUTCMinutes(e.getUTCMinutes()),this.dateType===CW.DATE_TIME_SEC&&t.setUTCSeconds(e.getUTCSeconds())):(t.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t.setUTCHours(e.getHours()),t.setUTCMinutes(e.getMinutes()),this.dateType===CW.DATE_TIME_SEC&&t.setUTCSeconds(e.getSeconds()))),this.dateType!==CW.DATE_TIME_SEC&&t.setUTCSeconds(0),t.setUTCMilliseconds(0),t._isUsingUTC=!0,this._dateObj=t,this._dateComponentDidChange(),this},format:function(e,t){e+="",t&&(e=e.loc());var n=this._dateObj,r=this.value||{},i=e.length,s="",o=0,u="",a="",f=r[1]+"",l=r[2],c=r[3],h=n.getUTCDay(),p=r[4],d=r[5],v=n.getUTCSeconds(),m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_;f.length<3&&(f>=0&&f<=28?f=""+(f+2e3):f>=28&&f<=99&&(f=""+(f+1900))),r.y=""+f,r.yyyy=f,r.yy=f.substring(2,4),r.M=l,r.MM=LZ(l),r.MMM=MONTH_NAMES[l-1],r.NNN=MONTH_NAMES[l+11],r.d=c,r.dd=LZ(c),r.E=DAY_NAMES[h+7],r.EE=DAY_NAMES[h],r.H=p,r.HH=LZ(p),p===0?r.h=12:p>12?r.h=p-12:r.h=p,r.hh=LZ(r.h),p>11?r.K=p-12:r.K=p,r.k=p+1,r.KK=LZ(r.K),r.kk=LZ(r.k),p>11?r.a="SC.Date.Period.PM".loc():r.a="SC.Date.Period.AM".loc(),r.m=d,r.mm=LZ(d),r.s=v,r.ss=LZ(v);while(o<i){u=e.charAt(o),a="";while(e.charAt(o)==u&&o<i)a+=e.charAt(o++);M=r[a],SC.none(M)?s+=a:(_=M.toString().loc(),s+=_?_:M)}return s},done:function(){return CW.Date._pool.indexOf(this)===-1&&CW.Date._pool.push(this),this.timeFormat=this.fullTimeFormat=this.dateFormat=null,SC.clone(this.value)},components:function(){return SC.clone(this.value)},clone:function(e){return CW.Date.create(SC.clone(this.value),e?e:this.dateType)},setValue:function(e){this.value=SC.clone(e),this._dateComponentDidChange
()},_dateComponentDidChange:function(){var e=[0,0,0,0,0,0,0],t=this._dateObj;return e[1]=t.getUTCFullYear(),e[2]=t.getUTCMonth()+1,e[3]=t.getUTCDate(),e[0]=parseInt(e[1]+(e[2]<10?"0":"")+e[2]+(e[3]<10?"0":"")+e[3],0),this.dateType!==CW.DATE_ONLY&&(e[4]=t.getUTCHours(),e[5]=t.getUTCMinutes(),this.dateType===CW.DATE_TIME_SEC?e[6]=t.getUTCSeconds():e[6]=this.dateType===CW.DATE_TIME_TO_MIDNIGHT?CW.DAY_MIN_DUR-(e[4]*60+e[5]):e[4]*60+e[5]),this.value=e,this}},SC.mixin(CW.Date,{_pool:[],parseDate:function(e,t){var n=new Date;return SC.typeOf(e)!==SC.T_ARRAY?n:(n.setUTCFullYear(e[1]),n.setUTCMonth(e[2]),n.setUTCDate(e[3]),t||(n.setUTCHours(e[4]),n.setUTCMinutes(e[5])),n.setUTCSeconds(0),n.setUTCMilliseconds(0),n)},dateComponentsEqual:function(e,t){return SC.typeOf(e)!==SC.T_ARRAY&&SC.typeOf(t)===SC.T_ARRAY?NO:e[0]===t[0]},datesEqual:function(e,t){if(e===t)return YES;var n=SC.typeOf(e),r=SC.typeOf(t);return n!==r?NO:e.value[0]===t.value[0]},dateTimesEqual:function(e,t){return SC.typeOf(e)!==SC.T_ARRAY&&SC.typeOf(t)===SC.T_ARRAY?NO:e[0]===t[0]&&e[4]===t[4]&&e[5]===t[5]},create:function(e,t){var n;return CW.Date._pool.length>0?(n=CW.Date._pool.pop(),n.value=null,n.dateType=CW.DATE_ONLY):n=SC.beget(CW.Date),n._dateObj=new Date,n._dateObj._isUsingUTC=!0,e&&SC.typeOf(e)===SC.T_NUMBER&&(t=e,e=null),t!==undefined&&(n.dateType=t),n.parse(e),n},createFromDateObject:function(e,t){var n;return CW.Date._pool.length>0?(n=CW.Date._pool.pop(),n.value=null,n.dateType=CW.DATE_ONLY):n=SC.beget(CW.Date),n._dateObj=e,n.dateType=t||CW.DATE_ONLY,n},createFromDateComponent:function(e){e||CW.fatalError("createFromDateComponent(): No date component was specified"
);var t=Math.floor(e/1e4),n=Math.floor(e/100)-t*100,r=e-t*1e4-n*100,i=[e,t,n,r],s=CW.Date.create(i,CW.DATE_ONLY);return s},areDatesInRange:function(e,t,n,r){return!e||!t?NO:t[0]===n[0]&&t[6]===1440?NO:e[0]>=n[0]&&e[0]<=r[0]||t[0]>=n[0]&&t[0]<=r[0]||e[0]<=n[0]&&t[0]>=r[0]},compareDates:function(e,t,n){if(!e||!t)return e||t;var r,i,s,o;return r=e._dateObj?e.components():e,i=t._dateObj?t.components():t,r[0]<i[0]?n?t:e:r[0]===i[0]?(s=r[4]*60+r[5],o=i[4]*60+i[5],s<o?n?t:e:s>o?n?e:t:null):n?e:t},greaterThan:function(e,t){SC.typeOf(e)===SC.T_ARRAY&&(e=CW.Date.create(e)),SC.typeOf(t)===SC.T_ARRAY&&(t=CW.Date.create(t));var n=this.compareDates(e,t,YES);return n===e?YES:NO}}),CW.DateParser={parseDate:function(e,t,n,r){var i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w=["Sunday".loc().toLowerCase(),"Monday".loc().toLowerCase(),"Tuesday".loc().toLowerCase(),"Wednesday".loc().toLowerCase(),"Thursday".loc().toLowerCase(),"Friday".loc().toLowerCase()],E=e.toLowerCase(),S,x,T,N,C,k=SC.Locale.currentLocale.language,L;if(!isNaN(e)&&parseInt(e,10)>31)i=CW.Date.create(t),b=e.length,b===2?(n?(s=parseInt(e.charAt(1),10)-1,o=parseInt(e.charAt(0),10)):(s=parseInt(e.charAt(0),10)-1,o=parseInt(e.charAt(1),10)),u=(new Date).getFullYear()):b===3?(v=e,a=parseInt(e.charAt(0),10),c=parseInt(e.substr(0,2),10),h=parseInt(e.substr(1,2),10),l=parseInt(e.charAt(2),10),n?(s=h<=12?h-1:l-1,o=h<=12?a:c):(s=c<=12?c-1:a-1,o=c<=12?l:h),u=(new Date).getFullYear()):b===4?(m=e,a=parseInt(e.charAt(0),10),c=parseInt(e.substr(0,2),10),p=parseInt(e.substr(2,2),10),f=parseInt(e.charAt(1),10),n?(s=h<=12?h-1:l-1,o=h<=12?a:c):(s=c<=12&&p<=31?
c-1:a-1,o=c<=12&&p<=31?p:f,u=c<=12&&p<=31?(new Date).getFullYear():2e3+p)):b===5?(g=parseInt(e,10).toString(),a=parseInt(e.charAt(0),10),c=parseInt(e.substr(0,2),10),h=parseInt(e.substr(1,2),10),y=parseInt(e.substr(3,2),10),l=parseInt(e.substr(2,1),10),n?(s=h<=12?h-1:l-1,o=h<=12?a:c):(s=c<=12?c-1:a-1,o=c<=12?l:h),u=2e3+y):b>=6&&b<=8&&(c=parseInt(e.substr(0,2),10),p=parseInt(e.substr(2,2),10),l=parseInt(e.charAt(2),10),y=parseInt(e.substr(3,2),10),d=parseInt(e.substr(4),10),b===6&&p===20||b===7&&y===20?b===6&&p===20?n?(s=f-1,o=a):(s=a-1,o=f):b===7&&y===20&&(n?(s=h<=12?h-1:l-1,o=h<=12?a:c):(s=c<=12?c-1:a-1,o=c<=12?l:h)):(s=c<=12?c-1:p<=12&&c>=1&&c<=31?p-1:-1,o=p>=1&&p<=31&&s===c-1?p:c>=1&&c<=31&&s===p-1?c:-1,u=b>6?d:2e3+d)),s<0||s>=12||o<1||o>31||u<0?i=null:(i._dateObj.set({month:s,day:o,year:u}),i._dateComponentDidChange());else if(!isNaN(e)&&(L=parseInt(e,10))<31){i=CW.Date.create();var A=Date.parse(e);SC.none(A)?i=null:(i._dateObj=A,i._dateComponentDidChange())}return i}},CW.Response=SC.XHRResponse.extend({bodyShouldBeLogged:function(){var e=this.get("status");return!SC.none(e)&&e!==200}.property("status"),fakeReply:null,overallTimeoutTimer:null,addedToOutgoingQueueTimestamp:null,getFullAddress:function(){return this.get("request").getFullAddress()},notify:function(){var e=arguments.callee.base.apply(this,arguments),t=CW.RequestManagement,n;return t&&(n=t.sharedInstance()),n&&n.removeOutstandingResponse(this),e},fire:function(e){var t=this.get("request"),n=t?t.get("source"):null;n&&n.willSend&&n.willSend(t,this),t.freeze(),this.get("isCancelled")||this.invokeTransport(e);var r=
t.get("timeout");if(r){var i=SC.Timer.schedule({target:this,action:"timeoutReached",interval:r,repeats:NO});this.set("timeoutTimer",i)}!this.get("isCancelled")&&n&&n.didSend&&n.didSend(t,this)},timeoutReached:function(){var e=this.get("timeoutTimer");return e&&e.invalidate(),e=this.get("overallTimeoutTimer"),e&&e.invalidate(),arguments.callee.base.apply(this,arguments)},receive:function(e,t){var n=this.get("overallTimeoutTimer");return n&&n.invalidate(),arguments.callee.base.apply(this,arguments)},invokeTransport:function(){var e=this.get("fakeReply"),t;if(!e){var n=this.createRequest(),r,i,s;return this.set("rawRequest",n),s=!!this.getPath("request.isAsynchronous"),s&&(!SC.browser.msie&&!SC.browser.opera?SC.Event.add(n,"readystatechange",this,this.finishRequest,n):(r=this,i=function(){if(!r)return null;var e=r.finishRequest();return e&&(r=null),e},n.onreadystatechange=i)),n.open(this.get("type"),this.getFullAddress(),s),this.setRequestHeaders(),this.getPath("request.useCrossDomain")&&this.getPath("request.withCredentials")&&(n.withCredentials=!0),n.send(this.getPath("request.encodedBody")),s||this.finishRequest(),n}this.set("rawRequest",e),t=e.get("delay"),this.invokeLater(this._triggerFakeReply,t)},setRequestHeaders:function(){var e=this.get("rawRequest"),t=this.getPath("request.headers");for(var n in t)e.setRequestHeader(n,t[n])},cancelTransport:function(){var e=this.get("fakeReply");if(e)return;return arguments.callee.base.apply(this,arguments)},_triggerFakeReply:function(){var e=this.get("fakeReply");e&&(e.set("readyState",4),this.finishRequest(undefined))}}),CW.IFramePostMessageResponse=
CW.Response.extend({isCrossDomain:YES,requestId:-1,rawResponse:null,_activeRequests:{},destinationDomain:"",headers:function(){var e=this.get("rawResponse");if(!e)return{};var t=e.headers,n={};return t?(t.split("\n").forEach(function(e){var t=e.indexOf(":"),r,i;t>=0&&(r=e.slice(0,t),i=e.slice(t+1).trim(),n[r]=i)},this),n):n}.property("status").cacheable(),header:function(e){var t=this.get("headers");return t[e]||null},encodedBody:function(){var e=this.get("rawResponse");return e?e.responseText:""}.property("status").cacheable(),invokeTransport:function(e){var t=this.get("request"),n={requestId:e,url:t.getFullAddress(),type:t.get("type"),headers:t.get("headers"),body:t.get("body"),isAsynchronous:t.get("isAsynchronous")},r=SC.Request.manager.get("crossDomainIFrames")[t.get("destinationDomain")];try{r.contentWindow.postMessage(SC.json.encode(n),this.get("destinationDomain"))}catch(i){SC.debug('CW.IFramePostMessageResponse: iFrame not properly loaded from "%@". Maybe ajax_sender.html is missing?',r.src)}},finishRequest:function(e){var t=this.get("rawResponse"),n=t?t.readyState:null,r,i,s;return n===4&&!this.get("timedOut")?(this.receive(function(e){if(!e)return;i=-1;try{i=t.status||0}catch(n){}if(i<200||i>=300){try{s=t.statusText||""}catch(o){s=""}r=SC.$error(s||"HTTP Request failed","Request",i),r.set("errorValue",this),this.set("isError",YES),this.set("errorObject",r)}this.set("status",i)},this),!SC.browser.msie&&!SC.browser.opera?SC.Event.remove(t,"readystatechange",this,this.finishRequest):t.onreadystatechange=null,YES):NO},cancelTransport:function(){this.set("rawRequest",null
)}}),CW.ImagePreloader=SC.Object.extend({images:null,callBack:null,init:function(){this.loadImages()},loadImages:function(){this._numLoaded=0,this._numProcessed=0,this._allImages=[],this._numImages=this.get("images").length;for(var e=0;e<this._numImages;e++)this.preload(this.get("images")[e])},preload:function(e){var t=new Image;this._allImages.push(t),theImage=this,t.onload=function(){theImage.onload.call(theImage)},t.onerror=function(){theImage.onerror.call(theImage)},t.onabort=function(){theImage.onabort.call(theImage)},t.sLoaded=!1,t.src=e},onComplete:function(){this._numProcessed++,this._numProcessed===this._numImages&&this.callBack(this._allImages,this._numLoaded)},onload:function(){this.sLoaded=!0,this._numLoaded++,this.onComplete()},onerror:function(){this.sError=!0,this.onComplete()},onabort:function(){this.sAbort=!0,this.onComplete()}}),CW.KeyResponder={_kr_init:function(){var e=this.keyboardShortcuts||{};e=SC.clone(e),this.keyboardShortcuts=e,this._kr_hasInited=YES},registerKeyboardShortcut:function(e,t,n){this._kr_hasInited||this._kr_init(),n?this.keyboardShortcuts[e]={target:t,action:n}:(n=t,this.keyboardShortcuts[e]=n)},deregisterKeyboardShortcut:function(e){this._kr_hasInited||this._kr_init(),delete this.keyboardShortcuts[e]},performKeyEquivalent:function(e,t){this._kr_hasInited||this._kr_init(),CW.LOG_KEYBOARD_SHORTCUTS&&SC.Logger.log("Responder attempting to find keyboard shortcut for %s",e);var n=this.keyboardShortcuts[e];if(n){var r=n,i=this;return typeof n=="object"&&(i=n.target,r=n.action),typeof r!="string"?r.call(i,e,t):SC.RootResponder.responder.sendAction
(r,i,this,e,t)}return NO}},SC.mixin(CW,{LOG_KEYBOARD_SHORTCUTS:NO,registerKeyboardShortcut:function(e,t,n){CW.globalKeyResponder.registerKeyboardShortcut(e,t,n)},deregisterKeyboardShortcut:function(e){CW.globalKeyResponder.deregisterKeyboardShortcut(e)},keyResponders:[],globalKeyResponder:SC.Object.create(CW.KeyResponder),addKeyResponder:function(e){this.keyResponders.push(e)},removeKeyResponder:function(e){this.keyResponders.removeObject(e)},performKeyEquivalent:function(e,t){CW.LOG_KEYBOARD_SHORTCUTS&&SC.Logger.log("Attempting to find keyboard shortcut for %s",e);var n=this.keyResponders,r,i=n.length;for(r=i-1;r>=0;r--)if(n[r].performKeyEquivalent(e,t))return YES;return NO},installKeyResponder:function(){var e=SC.RootResponder.prototype.attemptKeyEquivalent;SC.RootResponder.reopen({attemptKeyEquivalent:function(t){var n=e.apply(this,arguments);if(n)return n;var r=t.commandCodes()[0];return r?CW.performKeyEquivalent(r,t):NO}}),SC.View.reopen(CW.ViewKeyHandlingHelpers),SC.Pane.reopen(CW.KeyResponder),SC.ButtonView.reopen(CW.ButtonKeyHandlingHelpers)}}),CW.keyResponders.push(CW.globalKeyResponder),CW.LOG_NOTIFICATIONS=NO,CW.notificationCenter=SC.Object.create({_subscriptions:{},postNotification:function(e){var t=this._subscriptions;if(!t[e]){CW.LOG_NOTIFICATIONS&&SC.info("Notification Center: Could not find any subscribers for %@, returning.".fmt(e));return}var n=t[e],r=n.length,i=SC.A(arguments).slice(1);i||(i=[]),CW.LOG_NOTIFICATIONS&&SC.info("Notification Center: Posting notification %@".fmt(e));for(var s=0;s<r;s++){var o=n[s];if(o){var u=o.action,a=o.target;u.apply(a,i)}}
},_targetForTargetName:function(e){return SC.typeOf(e)===SC.T_STRING?SC.objectForPropertyPath(e):e},_methodForMethodNameInTarget:function(e,t){return SC.typeOf(e)===SC.T_STRING?SC.objectForPropertyPath(e,t):e},subscribeToNotification:function(e,t,n){t=this._targetForTargetName(t),n=this._methodForMethodNameInTarget(n,t);if(!n)throw"You must pass a action to subscribeToNotification()";var r=this._subscriptions,i=r[e];i||(i=r[e]=[]);var s=!1,o=i.length;for(var u=0;u<o;u++){var a=i[u];a.action===n&&a.target===t&&(s=!0)}s||(CW.LOG_NOTIFICATIONS&&SC.info("Notification Center: Subscribed to %@".fmt(e)),r[e].push({action:n,target:t}),this._subscriptions=r)},unsubscribeFromNotification:function(e,t,n){var r=this._subscriptions;t=this._targetForTargetName(t),n=this._methodForMethodNameInTarget(n,t);if(!n)throw"You must pass a action to subscribeToNotification()";var i=r[e];if(!i)return;var s=i.length,o=-1;for(var u=0;u<s;u++){var a=i[u];a.action===n&&a.target===t&&(o=u)}o!==-1&&(CW.LOG_NOTIFICATIONS&&SC.info("Notification Center: Subscribed to %@".fmt(e)),r[e].splice(o,1),this._subscriptions=r)}}),CW.Request=SC.Request.extend({COPY_KEYS:SC.Request.prototype.COPY_KEYS.concat(["overallTimeout","addressPrefix","useCrossDomain","withCredentials","id","isCancelled","destinationDomain","cycle","action","isBackgroundRequest","_crossDomainMethod","_queryParameters","_isRead","isRead","isWrite","_isPending","_cycleWhenPended","_cycleWhenSent"]),responseClass:undefined,timeout:3e4,overallTimeout:null,addressPrefix:null,useCrossDomain:NO,withCredentials:NO,iFrameScriptLocation:"ajax_sender.html"
,id:null,isCancelled:NO,cycle:null,action:null,isBackgroundRequest:NO,isRead:function(e,t){if(t!==undefined)return this._isRead=t,t;var n=this._isRead;if(n!==undefined)return n;var r=this.get("type");if(!!r)return r.toLowerCase()==="get";CW.fatalError("No type was specified, so we don’t know whether this request is a read or a write.")}.property("type").cacheable(),isWrite:function(e,t){return t===undefined?!this.get("isRead"):(this.set("isRead",!t),t)}.property("isRead").cacheable(),bodyShouldBeLogged:NO,queryParameter:function(e,t){var n;if(SC.typeOf(e)===SC.T_STRING)return n=this._queryParameters,arguments.length===1?n?n[e]:null:(this.propertyWillChange("queryParameters"),n||(n=this._queryParameters={}),n[e]=t,this.propertyDidChange("queryParameters"),this);if(t===undefined){n=e,this.beginPropertyChanges();for(e in n){if(!n.hasOwnProperty(e))continue;this.queryParameter(e,n[e])}return this.endPropertyChanges(),this}return CW.fatalError("queryParameter(): You must pass in either a key or a hash of query parameters",{target:this}),this},clearQueryParameters:function(){this.propertyWillChange("queryParameters"),this._queryParameters={},this.propertyDidChange("queryParameters")},queryParameters:function(){return this._queryParameters}.property().cacheable(),addressWithQueryParameters:function(){var e=URI(this.get("address")).addQuery(this.get("queryParameters")).sortQuery().normalize().toString();return e}.property("address","queryParameters").cacheable(),send:function(e,t){this._determineResponseClassAndMethod();var n;this.get("isAsynchronous")===NO&&(n=this._crossDomainMethod
,n&&n!=="cors"&&CW.fatalError("You cannot send a synchronous request using iframes with postMessage",{target:this}));var r=CW.RequestManagement,i=r?r.sharedInstance():null,s,o,u,a;this._isPending=NO,this._cycleWhenPended=null,this._cycleWhenSent=this.get("cycle"),o=this._getFakeReply();var f=this.get("timeout");if(f&&!this.get("isAsynchronous"))throw"Timeout values cannot be used with synchronous requests";if(f===0)throw"The timeout value must either not be specified or must be greater than 0";e&&this.set("body",e);var l=SC.clone(this._queryParameters);return a=this.copy()._prep(),a._queryParameters=l,o&&(a._fakeReplyToUse=o),s=SC.Request.manager.sendRequest(a),s&&i&&i.addOutstandingResponse(s),t&&i&&i.removePendingRequest(this),s},sendAfterDelay:function(e,t){t||CW.fatalError("sendAfterDelay(): You must specify a delay",{target:this});var n=CW.RequestManagement,r=n?n.sharedInstance():null;this._isPending=YES,this._cycleWhenPended=this.get("cycle"),r&&r.addPendingRequest(this),this.invokeLater(this.send,t,e,YES)},resend:function(e,t){var n=this._getFakeReply(),r,i,s,o;return i=this.get("source")?this:this.copy()._prep(),n&&(i._fakeReplyToUse=n),r=SC.Request.manager.sendRequest(i,e),r&&(s=CW.RequestManagement,o=s?s.sharedInstance():null,o&&o.addOutstandingResponse(r)),t&&o&&o.removePendingRequest(this),r},resendAfterDelay:function(e,t){t||CW.fatalError("resendAfterDelay(): You must specify a delay",{target:this});var n=CW.RequestManagement,r=n?n.sharedInstance():null;this._isPending=YES,this._cycleWhenPended=this.get("cycle"),r&&r.addPendingRequest(this),this.invokeLater(this
.resend,t,e,YES)},getFullAddress:function(){var e=this.get("addressPrefix"),t=this.get("addressWithQueryParameters");return e&&(t=e+t),t},didSend:function(e,t){var n;CW._logRequestIfAppropriateFor(t),n=t.get("rawRequest"),n&&n.isFakeReply&&SC.info("Using fake reply (%@) for request: %@",n,e)},didReceive:function(e,t){var n=CW.Request,r;n._responseSuspendCount>0?(t._receivedAtWhileSuspended=new Date,r=n._suspendedResponses,r?r.push(t):r=n._suspendedResponses=[t],t.get("isCancelled")||(t._receivedWhenSuspended=YES,t.set("isCancelled",YES))):CW._logResponseIfAppropriate(t)},destinationDomain:function(){var e=this.getFullAddress(),t=null,n,r;if(e){if(URI(e).protocol()===""||URI(e).host()==="")return SC.error("Malformed URL: "+e),null;t=URI(e).protocol()+"://"+URI(e).host()}return t}.property("addressPrefix","address"),cycleDidChange:function(){var e=CW.RequestManagement,t=e?e.sharedInstance():null,n,r;t&&(n=this.get("cycle"),this._isPending?n!==this._cycleWhenPended&&t.cycleDidChangeForPendingRequest():(r=this._cycleWhenSent,r&&n!==r&&t.cycleDidChangeForOutstandingResponse()))}.observes("cycle"),toString:function(){var e=arguments.callee.base.apply(this,arguments),t=this.get("address");return t&&(e+=" ("+t+")"),e},_crossDomainMethod:null,_queryParameters:null,_isPending:NO,_cycleWhenPended:null,_cycleWhenSent:null,_determineResponseClassAndMethod:function(){var e=SC.kindOf,t,n;if(this.get("useCrossDomain")){t=this.get("responseClass"),t||(XMLHttpRequest&&"withCredentials"in new XMLHttpRequest?t=CW.Response:this._isAppropriateForXDomainRequest()?t=CW.XDRResponse:window.postMessage?
t=CW.IFramePostMessageResponse:SC.browser.msie&&SC.browser.version<=7&&(t=CW.IFrameDocumentDomainResponse));if(!this._crossDomainMethod){if(e(t,CW.IFramePostMessageResponse))n="postMessage";else if(e(t,CW.IFrameDocumentDomainResponse))n="documentDomain";else if(e(t,CW.Response)||e(t,CW.XDRResponse))n="cors";n&&(this._crossDomainMethod=n)}}else t=CW.Response;!this.get("responseClass")&&t&&this.set("responseClass",t)},_isAppropriateForXDomainRequest:function(){var e=this.get("headers"),t=YES,n;if(e)for(n in e)if(n.toLowerCase()!=="content-type"||e[n]!=="text/plain")t=NO;return t&&SC.browser.msie&&SC.browser.version<=9&&!this.get("withCredentials")?YES:NO},_getFakeReply:function(){var e=CW.get("fakeReplyQueue"),t=e?e.length:0,n=null,r,i,s,o,u,a;if(t>0){r=this.get("isBackgroundRequest"),i=null;for(s=0;s<t;++s){o=e[s];if(r&&!o.get("applyToBackgroundRequests"))continue;u=o.get("urlFilter");if(u){a=this.get("address");if(!a||!u.test(a))continue}e.removeAt(s,1),i=o;break}i&&(i.get("shouldProcessRequestNormally")||(n=i))}return n}}),CW.Request.mixin({suspendResponses:function(){++this._responseSuspendCount},resumeResponses:function(){var e=--this._responseSuspendCount,t,n,r,i,s,o;e<0&&(SC.warn("CW.Response.resumeResponses() was called without a paired suspendResponses() invocation; ignoring…"),this._responseSuspendCount=0);var u=function(){i.get("isCancelled")&&i._receivedWhenSuspended&&(i.set("isCancelled",NO),s=i.get("request"),o=s.get("source"),o&&o.didReceive&&o.didReceive(s,i),i.get("isCancelled")||i.notify())};t=this._suspendedResponses,r=t?t.length:0;for(n=0;n<r;++n)i=t[n],SC.
run(u)},_responseSuspendCount:0,_suspendedResponses:null}),SC.Request.manager.mixin({crossDomainIFrames:{},_requestId:0,_crossDomainXHRLoaderURL:"",shouldFireRequest:null,_createCrossDomainIFrame:function(e,t){e||CW.fatalError("_createCrossDomainIFrame(): A destination domain must be specified",{target:this}),t||CW.fatalError("_createCrossDomainIFrame(): An AJAX sender URL must be specified",{target:this,destinationDomain:e});var n=document.createElement("iframe"),r=this;t[0]!=="/"&&(t="/"+t),n.loaded=!1,n.onload=n.onreadystatechange=function(){!n.loaded&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")&&(n.loaded=!0,r.fireRequestIfNeeded())},e[e.length-1]==="/"&&(e=e.substr(0,e.length-1)),n.src=e+t,n.style.display="none",document.body.appendChild(n),n.className="crossdomain-iframe",SC.Event.add(window,"message",this,SC.RunLoop.wrapFunction(this._messageWasReceived),null,!0),this.get("crossDomainIFrames")[e]=n,this.notifyPropertyChange("crossDomainIFrames")},_messageWasReceived:function(e){var t=e.originalEvent,n=t.data,r;try{r=SC.json.decode(n)}catch(i){SC.warn("CW.Request cannot parse received message from iframe support: %@",n);return}if(!r.isIFramePostMessageResponse)return;var s=r.headers,o=this.get("inflight"),u,a,f;for(f=0,u=o.length;f<u;f++){a=o[f];if(a.requestId===r.requestId){if(!URI(t.origin).baseEquals(URI(a.get("destinationDomain")))){CW.fatalError("Potential cross domain attack, postMessage from unknown origin, %@",t.origin);return}a.set("rawResponse",r),a.set("rawRequest",r),a.finishRequest();return}}},sendRequest:function(e,t){if(!
e)return null;var n=this._requestId,r=e.get("responseClass").create({request:e,requestId:n}),i,s,o,u;if(r.get("isCrossDomain")){var a=e.get("destinationDomain"),f=e._crossDomainMethod;(f==="postMessage"||f==="documentDomain")&&!this.get("crossDomainIFrames")[a]&&this._createCrossDomainIFrame(a,e.get("iFrameScriptLocation")),r.set("destinationDomain",a)}return t&&r.set("retryOf",t),this._requestId=++n,r.set("addedToOutgoingQueueTimestamp",new Date),i=e._fakeReplyToUse,i&&(r.set("fakeReply",i),delete e._fakeReplyToUse),s=e.get("timeout"),o=e.get("overallTimeout"),o===null&&s&&(o=s,e.set("overallTimeout",s)),o&&(u=SC.Timer.schedule({target:r,action:"timeoutReached",interval:o,repeats:NO}),r.set("overallTimeoutTimer",u)),this.get("pending").pushObject(r),this.fireRequestIfNeeded(),r},fireRequestIfNeeded:function(){var e=this.get("pending"),t=this.get("inflight"),n=this.get("maxRequests"),r=e.length,i,s,o,u;if(r>0&&t.length<n){i=this.shouldFireRequest;if(i)for(u=0;u<r;++u){s=e.objectAt(u);if(i(s)){o=s,e.removeAt(u);break}}else o=e.shiftObject();if(!o)return;if(o.get("isCrossDomain")){var a=this.get("crossDomainIFrames")[o.get("destinationDomain")];if(!a||!a.loaded){SC.debug("CW.Request.manager: postponing the sending of %@ since the necessary iframe is not loaded…",o),e.unshift(o);return}}t.pushObject(o),this.set("inflight",t);var f=o.get("requestId");o.fire(f)}this.propertyDidChange("inflight")}}),CW.RequestManagement=SC.Object.extend({pendingRequests:null,outstandingResponses:null,addPendingRequest:function(e){var t=this.get("pendingRequests");t.pushObject(e)},addOutstandingResponse
:function(e){if(!e.getPath("request.isAsynchronous")){SC.debug("Skipping response registration for synchronous response %@…",e);return}var t=this.get("outstandingResponses");t.pushObject(e)},removePendingRequest:function(e){var t=this.get("pendingRequests"),n=t.indexOf(e);n!==-1&&t.removeAt(n,1)},removeOutstandingResponse:function(e){var t=this.get("outstandingResponses"),n=t.indexOf(e);n!==-1&&t.removeAt(n,1)},pendingRequestsForCycle:function(e){var t=this.get("pendingRequests"),n=null,r,i,s;for(r=0,i=t.length;r<i;++r)s=t[r],s.get("cycle")===e&&(n?n.push(s):n=[s]);return n},outstandingResponsesForCycle:function(e){var t=this.get("outstandingResponses"),n=null,r,i,s;for(r=0,i=t.length;r<i;++r)s=t[r],s.getPath("request.cycle")===e&&(n?n.push(s):n=[s]);return n},cycleDidChangeForPendingRequest:function(){this.get("pendingRequests").enumerableContentDidChange()},cycleDidChangeForOutstandingResponse:function(){this.get("outstandingResponses").enumerableContentDidChange()},numberOfPendingOrOutstandingReadsForCycle:function(e){return this.numberOfPendingReadRequestsForCycle(e)+this.numberOfOutstandingReadResponsesForCycle(e)},numberOfPendingReadRequestsForCycle:function(e){var t,n,r,i=0,s=this.pendingRequestsForCycle(e);if(s)for(t=0,n=s.length;t<n;++t)r=s[t],r.get("isRead")&&i++;return i},numberOfOutstandingReadResponsesForCycle:function(e){var t,n,r,i=0,s=this.outstandingResponsesForCycle(e);if(s)for(t=0,n=s.length;t<n;++t)r=s[t],r.getPath("request.isRead")&&i++;return i},numberOfPendingOrOutstandingWritesForCycle:function(e){return this.numberOfPendingWriteRequestsForCycle(e)+this
.numberOfOutstandingWriteResponsesForCycle(e)},numberOfPendingWriteRequestsForCycle:function(e){var t,n,r,i=0,s=this.pendingRequestsForCycle(e);if(s)for(t=0,n=s.length;t<n;++t)r=s[t],r.get("isWrite")&&i++;return i},numberOfOutstandingWriteResponsesForCycle:function(e){var t,n,r,i=0,s=this.outstandingResponsesForCycle(e);if(s)for(t=0,n=s.length;t<n;++t)r=s[t],r.getPath("request.isWrite")&&i++;return i},init:function(){var e=arguments.callee.base.apply(this,arguments);return this.pendingRequests=[],this.outstandingResponses=[],e}}),CW.RequestManagement.mixin({sharedInstance:function(){var e=this._singleton;return e||(e=this._singleton=CW.RequestManagement.create()),e},_singleton:null}),CW.mixin({CJK_UNICODE_RANGES:[[4352,4607],[11904,12031],[12032,12255],[12288,12351],[12352,12447],[12448,12543],[12544,12591],[12592,12687],[12688,12703],[12704,12735],[12800,13055],[13056,13311],[13312,19893],[19968,40959],[40960,42127],[42128,42191],[44032,55203],[63744,64255],[65072,65103]],characterCodeIsCJK:function(e){var t=this.CJK_UNICODE_RANGES,n;if(SC.none(e))return NO;for(var r=0,i=t.length;r<i;++r){n=t[r];if(e>=n[0]&&e<=n[1])return YES}return NO},stringIsCJK:function(e){e=e.trim();if(SC.empty(e))return NO;var t=0,n=e.length-1;while(t<=n)if(!this.characterCodeIsCJK(e.charCodeAt(t++))||!this.characterCodeIsCJK(e.charCodeAt(n--)))return NO;return YES}}),SC.time=function(e){var t=SC.beget(fn);return t.value=e,t},function(){var e=new Date;SC.mixin(SC.time,{month:function(t,n){return e.setTime(t),n===undefined?e.getMonth():(e.setMonth(n),e.getTime())},utc:function(t){return e.setTime(t),t+
e.getTimezoneOffset()*60*1e3},local:function(t){return e.setTime(t),t-e.getTimezoneOffset()*60*1e3},parse:function(e){},format:function(e){}})}(),SC.time.fmt=SC.time.format,SC.time.fn={done:function(){return this.value}},"month day year".split(" ").forEach(function(e){SC.time.fn[e]=function(t){return t===undefined?SC.time[e](this.value):(this.value=SC.time[e](this.value,t),this)}});var MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],DAY_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sun","Mon","Tue","Wed","Thu","Fri","Sat"];SC.Locale.define("en",{longMonthNames:"January February March April May".split(" "),shortMonthNames:[],shortDateFormat:"dd/mm/yy",longDateFormat:""}),SC.mixin(Date,{isDate:function(e,t){var n=Date.getDateFromFormat(e,t);return n===0?!1:!0},compareDates:function(e,t,n,r){var i=Date.getDateFromFormat(e,t),s=Date.getDateFromFormat(n,r);return i===0||s===0?-1:i>s?1:0},getDateFromFormat:function(e,t){e+="",t+="";var n=0,r=0,i="",s="",o="",u,a,f=new Date,l=f.getFullYear(),c=f.getMonth()+1,h=1,p=f.getHours(),d=f.getMinutes(),v=f.getSeconds(),m="",g=SC.Locale.currentLocale;while(r<t.length){i=t.charAt(r),s="";while(t.charAt(r)==i&&r<t.length)s+=t.charAt(r++);if(s==="yyyy"||s==="yy"||s==="y"){s==="yyyy"&&(u=4,a=4),s==="yy"&&(u=2,a=2),s==="y"&&(u=2,a=4),l=Date._getInt(e,n,u,a);if(l===null)return 0;n+=l.length,l.length===2&&(l>70?l=1900+(l-0):l=2e3+(l-0))}else if(s==="MMM"||s==="NNN"){c=0;
for(var y=0;y<MONTH_NAMES.length;y++){var b=MONTH_NAMES[y];if(e.substring(n,n+b.length).toLowerCase()==b.toLowerCase())if(s==="MMM"||s==="NNN"&&y>11){c=y+1,c>12&&(c-=12),n+=b.length;break}}if(c<1||c>12)return 0}else if(s==="EE"||s==="E")for(y=0;y<DAY_NAMES.length;y++){var w=DAY_NAMES[y];if(e.substring(n,n+w.length).toLowerCase()==w.toLowerCase()){n+=w.length;break}}else if(s==="MM"||s==="M"){c=Date._getInt(e,n,s.length,2);if(c===null||c<1||c>12)return 0;n+=c.length}else if(s==="dd"||s==="d"){h=Date._getInt(e,n,s.length,2);if(h===null||h<1||h>31)return 0;n+=h.length}else if(s==="hh"||s==="h"){p=Date._getInt(e,n,s.length,2);if(p===null||p<1||p>12)return 0;n+=p.length}else if(s==="HH"||s==="H"){p=Date._getInt(e,n,s.length,2);if(p===null||p<0||p>23)return 0;n+=p.length}else if(s==="KK"||s==="K"){p=Date._getInt(e,n,s.length,2);if(p===null||p<0||p>11)return 0;n+=p.length}else if(s==="kk"||s==="k"){p=Date._getInt(e,n,s.length,2);if(p===null||p<1||p>24)return 0;n+=p.length,p--}else if(s==="mm"||s==="m"){d=Date._getInt(e,n,s.length,2);if(d===null||d<0||d>59)return 0;n+=d.length}else if(s==="ss"||s==="s"){v=Date._getInt(e,n,s.length,2);if(v===null||v<0||v>59)return 0;n+=v.length}else if(s==="a"){if(e.substring(n,n+2).toLowerCase()==="am")m="AM";else{if(e.substring(n,n+2).toLowerCase()!=="pm")return 0;m="PM"}n+=2}else{if(e.substring(n,n+s.length)!=s)return 0;n+=s.length}}if(n!==e.length)return 0;if(c===2)if(l%4===0&&l%100!==0||l%400===0){if(h>29)return 0}else if(h>28)return 0;if(c===4||c===6||c===9||c===11)if(h>30)return 0;p<12&&m=="PM"?p=p-0+12:p>11&&m=="AM"&&(p-=12);var E=new Date(l,
c-1,h,p,d,v);return E.getTime()},parseDate:function(e){var t=arguments.length==2?arguments[1]:!1,n=["E NNN dd HH:mm:ss UTC yyyy","y-M-d","y-M-d","MMM d, y","MMM d,y","y-MMM-d","d-MMM-y","MMM d","d MMM y","d.MMM.y","y MMM d","y.MMM.d"],r=["M/d/y","M-d-y","M.d.y","MMM-d","M/d","M-d"],i=["d/M/y","d-M-y","d.M.y","d-MMM","d/M","d-M"],s=t?n.concat(i,r):n.concat(r,i),o=null;o=0;var u=(new Date).getTime();switch(e.toLowerCase()){case SC.String.loc("yesterday"):o=u-864e5;break;case SC.String.loc("today"):case SC.String.loc("now"):o=u;break;case SC.String.loc("tomorrow"):o=u+864e5}if(o>0)return new Date(o);for(var a=0;a<s.length;a++){o=Date.getDateFromFormat(e,s[a]),o===0&&(o=Date.getDateFromFormat(e,s[a]+" H:m:s")),o===0&&(o=Date.getDateFromFormat(e,s[a]+" h:m:s a"));if(o!==0)return new Date(o)}return null},_isInteger:function(e){var t="1234567890";for(var n=0;n<e.length;n++)if(t.indexOf(e.charAt(n))==-1)return!1;return!0},_getInt:function(e,t,n,r){for(var i=r;i>=n;i--){var s=e.substring(t,t+i);if(s.length<n)return null;if(Date._isInteger(s))return s}return null}}),SC.mixin(Date.prototype,{format:function(e){e+="";var t=this,n="",r=0,i="",s="",o=t.getFullYear()+"",u=t.getMonth()+1,a=t.getDate(),f=t.getDay(),l=t.getHours(),c=t.getMinutes(),h=t.getSeconds(),p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L={};o.length<4&&(o=""+(o-0+1900)),L.y=""+o,L.yyyy=o,L.yy=o.substring(2,4),L.M=u,L.MM=LZ(u),L.MMM=MONTH_NAMES[u-1],L.NNN=MONTH_NAMES[u+11],L.d=a,L.dd=LZ(a),L.E=DAY_NAMES[f+7],L.EE=DAY_NAMES[f],L.H=l,L.HH=LZ(l),l===0?L.h=12:l>12?L.h=l-12:L.h=l,L.hh=LZ(L.h),l>11?L.K=l-12:L.K=l,L.k=l+1,L.KK=LZ(L.K),L.kk=LZ
(L.k),l>11?L.a="PM":L.a="AM",L.m=c,L.mm=LZ(c),L.s=h,L.ss=LZ(h);while(r<e.length){i=e.charAt(r),s="";while(e.charAt(r)==i&&r<e.length)s+=e.charAt(r++);SC.none(L[s])?n+=s:n+=L[s]}return n},utcFormat:function(){var e=new Date(this.getTime()+this.getTimezoneOffset()*60*1e3);return e.format("E NNN dd HH:mm:ss UTC yyyy")}}),CW.UPLOADER_READY=0,CW.UPLOADER_INCOMPATIBLE_FILE_TYPE=1,CW.UPLOADER_FILE_TOO_BIG=2,CW.UPLOADER_MISSING_XHR=3,CW.Uploader=SC.Object.extend({isUploader:YES,uploadURL:null,maximumFileSize:2048e3,allowedFileTypes:"png jpeg bmp jpg gif".w(),shouldUploadFile:function(e){return YES},encloseFileWithinForm:NO,formFieldName:"X-data",withCredentials:NO,willUploadFile:function(e,t){var n=this;t.upload.onprogress=function(e){SC.run(function(){this.logIfRawRequestEvtNotNull(t,e,"rawRequest:upload:progess - ");if(!this.uploadProgressDidChange){SC.warn("No function called uploadProgressDidChange found in %@ object",this.toString());return}this.uploadProgressDidChange(t,e)},n)},t.onload=function(e){SC.run(function(){this.logIfRawRequestEvtNotNull(t,e,"rawRequest:onload - ");if(!this.didUploadFile){SC.warn("No function called didUploadFile found in %@ object",this.toString()),this.uploadDidFail&&this.uploadDidFail(t,e);return}this.didUploadFile(t,e)},n)},t.onerror=function(e){SC.run(function(){this.logIfRawRequestEvtNotNull(t,e,"rawRequest:onerror - ");if(!this.uploadDidFail){SC.warn("No function called uploadDidFail found in %@ object",this.toString());return}this.uploadDidFail(t,e)},n)},t.onreadystatechange=function(e){t.readyState===4&&t.status!==200&&SC.run(function(){n.uploadDidFail
(t,e)})}},logIfRawRequestEvtNotNull:function(e,t,n){var r=NO;n||(n=""),e||(n+="Raw Request was not found.",r=YES),t||(n+="Evt was not found.",r=YES),r&&SC.warn(n)},setRequestHeaders:function(e,t){t.setRequestHeader("X-File-Name",encodeURIComponent(e.fileName)),t.setRequestHeader("X-File-Size",e.fileSize);var n=this.get("_xhrHeaders");for(var r in n)n.hasOwnProperty(r)&&t.setRequestHeader(r,n[r])},uploadProgressDidChange:function(e,t){},didUploadFile:function(e,t){},uploadDidFail:function(e,t){},uploadFiles:function(e){var t=[];for(var n=e.length-1;n>=0;n--){var r=e[n],i=this._fileIsAcceptableToUpload(r);if(i!==CW.UPLOADER_READY)t.push(this._errorForFile(r,i));else if(this.shouldUploadFile(r))try{this._createAndSendUploadRequest(r)}catch(s){console.warn(s.toString())}}return t},_xhrHeaders:function(){var e={"If-Modified-Since":"Mon, 26 Jul 1997 05:00:00 GMT","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};return this.get("encloseFileWithinForm")||(e["Content-Type"]="text/plain"),e}.property("encloseFileWithinForm").cacheable(),_fileTooBigDescription:"Uploader.fileTooBigDescription".loc(),_wrongFileTypeDescription:"Uploader.wrongFiletypeDescription".loc(),_createAndSendUploadRequest:function(e){var t=this.get("uploadURL");if(!t)throw"%@: Can't upload file if uploadURL is not set.".fmt(this);var n=this.get("encloseFileWithinForm"),r;n?(r=new FormData,r.append(this.get("formFieldName"),e)):r=e;var i=new XMLHttpRequest;if(!i)throw this._errorForFile(e,CW.UPLOADER_MISSING_XHR);this.willUploadFile(e,i),i.open("POST",t,!0),this.setRequestHeaders(e,i),this.get("withCredentials"
)&&(i.withCredentials=YES),i.send(r)},_fileIsAcceptableToUpload:function(e){var t=CW.UPLOADER_READY,n=this.get("maximumFileSize"),r=this.get("allowedFileTypes"),i=e.type.split("/")[1];return e.fileSize>n&&(t=CW.UPLOADER_FILE_TOO_BIG),r.indexOf(i)===-1&&(t=CW.UPLOADER_INCOMPATIBLE_FILE_TYPE),t},_errorForFile:function(e,t){var n="",r="";switch(t){case CW.UPLOADER_INCOMPATIBLE_FILE_TYPE:n=this._wrongFileTypeDescription;break;case CW.UPLOADER_FILE_TOO_BIG:n=this._fileTooBigDescription}return SC.$error(n,r,e,t)}}),CW.XDRResponse=CW.Response.extend({createRequest:function(){var e=new XDomainRequest,t=this;return e.timeout=null,e.onerror=function(){if(!t)return null;var e=t.finishRequest();return e&&(t=null),e},e.onload=function(){if(!t)return null;var e=t.finishRequest(200);return e&&(t=null),e},e},setRequestHeaders:function(){},finishRequest:function(e){var t=this.get("rawRequest");return t.readyState=4,t.status=e,arguments.callee.base.apply(this,arguments)}}),window.CW||(window.CW={}),function(){var e=CW.Animator=CW.Anim={fps:60,fpsModifier:65/60,tasks:[],speedMultiplier:1,frameCount:0,isActive:!1,isInFrame:!1,extraStatus:{},ENABLE_OLD_IE:!0,_runningCWAguid:0,_hasSC:!!(window.SC&&SC.RunLoop&&SC.Object),_frameTimeNoiseLevelingWindowSize:30,_frameNoiseLevelerLog:[],_movingAverageFrameTime:function(){for(var t=0,n=e._frameNoiseLevelerLog,r=0,i=n.length;t<i;t++)r+=n[t];return Math.round(10*r/(i||1))/10},init:function(){e.prepareObject(),e.stop(),e.useRAF=e.IS_MOBILE&&window.requestAnimationFrame&&window.cancelRequestAnimationFrame,e.lock16=e.IS_MOBILE&&!e.useRAF},nextFrame:function(
t,n){var r,i=e._frameNoiseLevelerLog,s=e._frameTimeNoiseLevelingWindowSize,o,u,a=0;e.isInFrame=e._canAddLastSecondTasks=!0,o=e._lastFrameTime===-1?(new Date).valueOf():e._lastFrameTime,e._lastFrameTime=(new Date).valueOf(),u=o=e._lastFrameTime-o,e.now=e._lastFrameTime,e.firstActiveFrame&&(o=0),o>=300&&o>=(r=Math.max(e._movingAverageFrameTime(),60))*5?(o=0,i.unshift(r/2)):i.unshift(o),i.length<=s||(i.length=s),e.frameTime=o;var f=!e._hasSC||SC.RunLoop.isRunLoopInProgress();if(!e.shouldSkipFrame||!e.shouldSkipFrame()){f||(SC.RunLoop.begin(),e._SCLoopBegan()),e.trigger("preframe");for(var l=0,c;c=e.tasks[l];l++)c.running&&c.elapse(o*e.speedMultiplier);e._canAddLastSecondTasks=!1;for(l=0;c=e.tasks[l];l++)c.running?c&&(c.fps||e.fps)>a&&(a=c.fps||e.fps):(c._inCWATasks=!1,e.tasks.splice(l--,1));e.trigger("frame"),f||(SC.RunLoop.end(),e._SCLoopEnded()),e.isActive=!!e.tasks.length,e.frameCount++}else e._canAddLastSecondTasks=!1;e.frameRate=Math.round(1e5/u)/100,e.computeTime=(new Date).valueOf()-e.now;var h=Math.round(1e3/(a*e.fpsModifier));e.timeoutWaitTime=Math.max(0,h-e.computeTime),e.clearNextTimeout(),!n&&e.isActive?e.useRAF?e._timeout=window.requestAnimationFrame(e.nextFrame,document.body):e._timeout=setTimeout(e.nextFrame,e.lock16?16:e.timeoutWaitTime):e.stop(),e.firstActiveFrame&&(e.firstActiveFrame=!1),e.isInFrame=!1,e._alreadyExpeditedNextFrame=!1},start:function(){if(e.isActive){e._canAddLastSecondTasks||e.expediteNextFrame();return}e.firstActiveFrame=!0,e.isActive=!0,e._lastFrameTime=-1,e.frameTime=1e3/e.fps,e.frameRate=1e3/e.frameTime,e.computeTime=0,e.trigger("start"),e
.nextFrame()},stop:function(){e.isActive=!1,e.frameTime=Infinity,e.frameRate=0,e.computeTime=NaN,e.timeoutWaitTime=NaN,e.clearNextTimeout(),e.trigger("stop")},clearNextTimeout:function(){if(!e._timeout)return;e.useRAF?window.cancelRequestAnimationFrame(e._timeout):clearTimeout(e._timeout),e._timeout=0},expediteNextFrame:function(){if(e._alreadyExpeditedNextFrame||!e.isActive)return;e._alreadyExpeditedNextFrame=!0,e.clearNextTimeout(),e._timeout=setTimeout(e.nextFrame,0)},handleTask:function(t){if(!t||t.isDestroyed)return;if(!t._inCWATasks){if(t.name)for(var n=0,r=e.tasks,i;i=r[n];n++)i.name===t.name&&i.stop();e.tasks.push(t)}t._inCWATasks=!0,e.start()},tellStop:function(){arguments._isArgs_=!0,this.performMethodOn("stop",arguments)},tellFinish:function(){arguments._isArgs_=!0,this.performMethodOn("finish",arguments)},performMethodOn:function(e,t){var n=1,r=arguments;t&&t._isArgs_&&(n=0,r=t);for(var i=n,s,o=r.length;i<o;i++)(s=r[i])&&s[e]&&s[e]()},trigger:function(e,t){if(this.isDestroyed)return;var n,r;(n=this["on"+e]||this["on"+e.charAt(0).toUpperCase()+e.substring(1)])instanceof Function&&n.call(this,t);if(!(r=this["__"+e+"Listeners__"]))return;for(var i=0,s;i<r.length;i++){if(!((s=r[i])instanceof Function))continue;s.call(this,t)}},clearTrigger:function(e){var t=this["__"+e+"Listeners__"];if(!t)return;t.length=0},listen:function(e,t){if(!e)return;if(!t){t=e;var n=t._listens;if(n)for(var r=0;e=n[r];r++)this.listen(e,t);return}var i="__"+e+"Listeners__";if(!this.hasOwnProperty(i))if(!this[i])this[i]=[];else{for(var s=[],o=0,u=this[i].length;o<u;o++)s.push(this[i][o]);this[i
]=s}this[i].push(t)},unlisten:function(e,t){if(!e)return;if(!t){t=e;var n=t._listens;if(n)for(var r=0;e=n[r];r++)this.unlisten(e,t);return}var i="__"+e+"Listeners__";if(!this[i])return;if(!this.hasOwnProperty(i)){for(var s=[],o=0,u=this[i].length;o<u;o++)s.push(this[i][o]);this[i]=s}for(var a=0,f=this[i],l=f.length;a<l;a++)f[a]===t&&(f[a]=undefined)},setIfChanged:function(e,t){var n=this[e];return this[e]=t,t!==n&&this.trigger(e),t},get:function(e){return this[e]},set:function(e,t){return this[e]=t,this.trigger(e),t},cloneFunction:function(e){var t=e.clonedFrom;if(t)return t.clone();var n=function(){var e=arguments.callee.clonedFrom,t=e.base,n;return e.base=arguments.callee.base,n=arguments.callee.clonedFrom.apply(this,arguments),e.base=t,n};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return n.clonedFrom=e,n.toString=function(){return"Clone of "+this.clonedFrom.toString()},n},toString:function(){return"[The CoreWeb Animator]"},prepareObject:function(){var t=Function.prototype;t.listens=function(){var e=!this._listens,t=this._listens||(this._listens=[]);e&&(t.length=0);for(var n=0,r=arguments.length;n<r;n++)t.push(arguments[n]);return this},t.observes||(t.observes=t.listens),e.Object=e._hasSC?e.prepareSCObject():e.prepareOwnObject()},prepareOwnObject:function(){var t=function(){};return t.prototype={className:"Object",init:function(){this._cwaguid=++e._runningCWAguid},mixin:function(t){if(!arguments.length)return this;for(var n=0,r=arguments.length,i,s,o,u,a,f,l,c,h,p;n<r;n++){o=arguments[n],l=o.isMixin;for(f in o){h=this.suffixes;if(!o.hasOwnProperty(f)||f==="isMixin")continue;
u=this[f],a=o[f],(c=this[f+"Override"])&&(c instanceof Function||(c=this[c])instanceof Function)&&(a=c.call(this,a,u,f));for(i=0;p=h&&h[i];i++)f.slice(-p.length)===p&&(c=this["*"+p+"Override"])&&(c instanceof Function||(c=this[c])instanceof Function)&&(a=c.call(this,a,u,f));u instanceof Function&&(l&&a instanceof Function&&(a=e.cloneFunction(a)),a.base=u,u._listens&&this.unlisten(u)),a instanceof Function&&a._listens&&this.listen(a),this[f]=a}}return this},trigger:e.trigger,listen:e.listen,unlisten:e.unlisten,clearTrigger:e.clearTrigger,toString:e._objectToString,get:e.get,set:e.set,setIfChanged:e.setIfChanged},t.isClass=!0,t.create=function(){var e;return arguments.length?e=new(this.extend.apply(this,arguments)):e=new this,e._type=this,e.init(),e},t.extend=function(){var e=function(){},t=new this;t.mixin.apply(t,arguments);for(var n in this){if(!this.hasOwnProperty(n))continue;e[n]=this[n]}return e.prototype=t,e},t},prepareSCObject:function(){var t=SC.Object.extend({className:"CW.Anim.Object",init:function(){arguments.callee.base.call(this),this._cwaguid=++e._runningCWAguid},trigger:e.trigger,listen:e.listen,unlisten:e.unlisten,clearTrigger:e.clearTrigger,toString:e._objectToString,setIfChanged:e.setIfChanged}),n=function(e,t){for(var n,r,i,s,o=0;n=e[o];o++){if(typeof n!="object")continue;for(i in n){if(!n.hasOwnProperty(i))continue;if(!((r=n[i])instanceof Function)||!r._listens)continue;t.listen(r)}}},r=function(){var e=arguments.callee.base.apply(this,arguments);return e.prototype._type=this,n(arguments,e.prototype),e};r.base=t.extend,t.extend=r;var i=function(){var e=arguments
.callee.base.apply(this,arguments);return n(arguments,e),e};return i.base=t.create,t.create=i,t},_objectToString:function(){return"["+this.className+(this._cwaguid?":"+this._cwaguid:"")+"]"},asHTML:function(e){return e.split("\n").join("<BR>").split(" ").join(" &nbsp;")},toCamel:function(e,t){for(var n=0,r=e.length;n<r;n++){if(e.charAt(n)!=="-"||n==r-1)continue;e=e.substring(0,n)+e.charAt(n+1).toUpperCase()+e.substring(n+2),r--}return t?e.charAt(0).toUpperCase()+e.substring(1):e},toDashed:function(e){for(var t=0,n=e.length;t<n;t++){var r=e.charAt(t);if(r.toLowerCase()===r||t==n-1)continue;e=e.substring(0,t)+"-"+e.charAt(t).toLowerCase()+e.substring(t+1),n++}return e},getStyle:function(t,n){if(t.currentStyle)return t.currentStyle[e.toCamel(n)];if(t.initialStyle)return t.initialStyle.getPropertyValue(n);var r;if((r=document.defaultView)&&(r=r.getComputedStyle))return(t.initialStyle=r(t,null)).getPropertyValue(n)},IS_MOBILE:!!(/ipad/.test(navigator.userAgent.toLowerCase())||/iphone/.test(navigator.userAgent.toLowerCase())||/ipod/.test(navigator.userAgent.toLowerCase())||/android/.test(navigator.userAgent.toLowerCase())),getOpacity:function(t){if(!t)return-1;var n;return(n=t.cwa$opacity||t.getAttribute("cwa$opacity"))&&(n=parseFloat(n))||n===0?n:(n=t.style.opacity||e.getStyle(t,"opacity"))&&(n=parseFloat(n))||n===0?parseFloat(n):1},setOpacity:function(e,t){return e?(t=Math.max(0,Math.min(1,t)),t>.9999||isNaN(t)?this.removeOpacity(e):(e.cwa$opacity=t,e.style.opacity=t,t)):-1},removeOpacity:function(e){return e?(e.cwa$opacity=1,e.style.opacity="",1):-1},encodeColor:function(e,t,n
){if(typeof e=="object"&&typeof e.r=="number"&&typeof e.g=="number"&&typeof e.b=="number")t=e.g,n=e.b,e=e.r;else if(typeof e=="object")t=e[1],n=e[2],e=e[0];else if(typeof e=="string"){if(e.charAt(0)=="#"&&e.length===7)return e;e=CW.Anim.decodeColor(e),t=e[1],n=e[2],e=e[0]}return e=Math.round(Math.max(0,Math.min(255,e))).toString(16),e.length==1&&(e="0"+e),t=Math.round(Math.max(0,Math.min(255,t))).toString(16),t.length==1&&(t="0"+t),n=Math.round(Math.max(0,Math.min(255,n))).toString(16),n.length==1&&(n="0"+n),("#"+e+t+n).toUpperCase()},decodeColor:function(t){e.colors&&e.colors[t]&&(t=e.colors[t]);var n,r,i,s;if((n=typeof t)=="number"||n=="object")return undefined;t=t.replace(/\s+/g,"");if(t.charAt(0)=="#")t.length==4&&(t="#"+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)+t.charAt(3)+t.charAt(3)),r=parseInt(t.substring(1,3),16),i=parseInt(t.substring(3,5),16),s=parseInt(t.substring(5,7),16);else{var o;if(t.indexOf("rgba(")!=-1)o=5;else{if(t.indexOf("rgb(")==-1)return undefined;o=4}t=t.substring(o,t.length-1).split(","),r=parseInt(t[0],10),i=parseInt(t[1],10),s=parseInt(t[2],10)}return[r,i,s]},colors:{red:"#ff0000","orange red":"#ff4500",orange:"#ff7f00",yellow:"#ffff00",green:"#00ff00","forest green":"#228b22",cyan:"#00ffff","light sea green":"#20b2aa",blue:"#0000ff","cornflower blue":"#6495ed","medium blue":"#3232cd",purple:"#a020f0","hot pink":"#ff69b4",magenta:"#ff00ff",white:"#ffffff","light gray":"#d3d3d3",gray:"#bebebe","dark gray":"#a9a9a9","dim gray":"#696969",black:"#000000"},initRandom:function(e,t,n){return{isInitRandom:!0,lo:e,hi:t,round:n}},_improveSCCompatibility
:function(){if(!e._hasSC)return;e._runLoopedTrigger=function(){var t=SC.RunLoop.isRunLoopInProgress();t||SC.RunLoop.begin(),e._inSCLoop=!0;var n=e._coreTrigger.apply(this,arguments);return e._inSCLoop=!1,t||SC.RunLoop.end(),n},e._coreTrigger=e.trigger,e.trigger=e._runLoopedTrigger},_SCLoopBegan:function(){e._inSCLoop=!0,e.trigger=e.Object.prototype.trigger=e._coreTrigger},_SCLoopEnded:function(){e._inSCLoop=!1,e.trigger=e.Object.prototype.trigger=e._runLoopedTrigger}}}(),CW.Anim.init(),CW.Anim._improveSCCompatibility(),CW.Anim.Task=CW.Anim.Object.extend({className:"CW.Anim.Task",running:!1,speedMultiplier:1,frameCount:0,elapsedTime:0,ticked:!1,tickCount:0,start:function(){return this.running?this:(this.running=!0,this.elapsedTime=this.frameCount=this.tickCount=0,this.trigger("start"),CW.Anim.handleTask(this),this)},stop:function(){return this.running?(this.running=!1,this.trigger("stop"),this):this},elapse:function(e,t){if(this.isDestroyed)return this.running=!1,this;if(!t&&this.shouldSkipFrame&&this.shouldSkipFrame())return this;this._forcedZeroes&&(e=0,this._forcedZeroes--),e*=this.speedMultiplier,this.trigger("preframe"),this.elapsedTime+=e;if(!this.ticked)this.trigger("pretick"),this.run instanceof Function&&this.run(e),this.tickCount++,this.trigger("tick");else for(var n=this.ticked===!0?1e3/CW.Anim.fps:this.ticked,r=1+Math.floor(this.elapsedTime/n),i=r-this.tickCount,s=0;s<i;s++)this.trigger("pretick"),this.run instanceof Function&&this.run(n,s<i-1),this.running&&this.trigger("tick"),this.tickCount++;return this.running&&(this.trigger("frame"),this.trigger("frame"+this
.frameCount)),this.trigger("postFrame"),this.clearTrigger("postFrame"),this.frameCount++,this},destroy:function(){return arguments.callee.base&&arguments.callee.base.apply(this,arguments),this.isDestroyed=!0,this}}),CW.Anim.Task.initiate=function(){var e=this.create.apply(this,arguments);return e.start(),e},CW.Anim.tweens={make:function(e){var t=[];for(var n=1,r=arguments.length;n<r;n++)t.push(arguments[n]);return function(){var n=t;n.l=n.length;var r=CW.Anim.tweens[e]||CW.Anim.tweens.LINEAR;return function(e){return n[n.l]=e,r.apply(this,n)}}()},compound:function(){var e=arguments.length,t=arguments[e-1];for(var n=0,r;n<e-1&&(r=arguments[n]);n++)typeof r=="string"?t=CW.Anim.tweens[r].call(this,t):t=r.call(this,t);return t},LINEAR:function(e){return e},BOUNCE:function(e){var t;e=1-e;for(var n=0,r=1;1;n+=r,r/=2)if(e>=(7-4*n)/11){t=r*r-Math.pow((11-6*n-11*e)/4,2);break}return 1-t},SINE_IN_OUT:function(e){return.5-.5*Math.cos(Math.PI*e)},multiSineInOut:function(e,t){var n=e%1;e=Math.floor(e);for(var r=0;r<e;r++)t=.5-.5*Math.cos(Math.PI*t);return n&&(t=(1-n)*t+n*(.5-.5*Math.cos(Math.PI*t))),t},QUADRATIC_IN:function(e){return e*e},QUADRATIC_OUT:function(e){return 1-(e=1-e)*e},WEBKIT_EASE:function(e){return CW.Anim.tweens.cubicBezier(.25,.1,.25,1,e)},WEBKIT_LINEAR:function(e){return e},WEBKIT_EASE_IN:function(e){return CW.Anim.tweens.cubicBezier(.42,0,1,1,e)},WEBKIT_EASE_OUT:function(e){return CW.Anim.tweens.cubicBezier(0,0,.58,1,e)},WEBKIT_EASE_IN_OUT:function(e){return CW.Anim.tweens.cubicBezier(.42,0,.58,1,e)},cubicBezier:function(e,t,n,r,i){var s=5,o=3*e,u=3*(n-e)-o,a=1-o-u,f=3*
t,l=3*(r-t)-f,c=1-f-l,h=1/(200*s),p,d,v,m,g,y;for(v=i,y=0;y<8;y++){m=((a*v+u)*v+o)*v-i;if(Math.abs(m)<h)return((c*v+l)*v+f)*v;g=(3*a*v+2*u)*v+o;if(Math.abs(g)<1e-6)break;v-=m/g}p=0,d=1,v=i;if(v<p)return((c*p+l)*p+f)*p;if(v>d)return((c*d+l)*d+f)*d;while(p<d){m=((a*v+u)*v+o)*v;if(Math.abs(m-i)<h)return((c*v+l)*v+f)*v;i>m?p=v:d=v,v=(d-p)*.5+p}return((c*v+l)*v+f)*v},linearInterpolation:function(e,t){var n=e._length_||(e._length=e.length),r=t*n/n*(n-1),i=Math.floor(r),s=e[i],o=r-i;if(o===0)return s;var u=e[Math.ceil(r)];return s*(1-o)+u*o}},CW.Anim.Animation=CW.Animation=CW.Anim.Task.extend({className:"CW.Animation",isAnimation:!0,init:function(){arguments.callee.base.call(this),this.hasOwnProperty("animateOldIE")||(this.animateOldIE=CW.Anim.ENABLE_OLD_IE),SC.browser.isIE8OrLower&&!this.animateOldIE&&(this.disabled=!0);var e,t,n,r,i,s=this._type.prototype.freevars;typeof this.freevars=="string"&&(this.freevars=this.freevars.split(/\s+/)),this.freevars&&!this.freevars.length&&(this.freevars=[this.freevars]);if(this.freevars&&s&&this.freevars===s){i=[];for(t=0;t<(r||(r=this.freevars.length));t++)i.push(this.freevars[t]);this.freevars=i}this.freevars&&this.speed===undefined&&this.duration===undefined&&!this.signal&&(this.duration=0);for(t=-1,r=!!this.freevars&&this.freevars.length;t<r;t++)e=t===-1?this:this.freevars[t],typeof e=="string"&&(this[e].key=e,this.freevars[t]=e=this[e]),e=this.makeFreevarFromHash(e),e!==this&&(this.freevars[t]=e,e.key&&(this[e.key]=e))},makeFreevarFromHash:function(e){if(e._isFreevar)return e;var t=CW.Animation.defaultFreevar,n,r,i,s,o,u,a,f=e===this?this
:{};for(i in e){if(!e.hasOwnProperty(i))continue;(s=e[i])&&s.isInitRandom===!0?(a=s.round,s=Math.random()*(s.hi-s.lo)+s.lo,a&&(s=Math.round(s/a)*a),f[i]=s):f!==e&&(f[i]=e[i])}if(f===this)for(i in t)f[i]===undefined&&(f[i]=t[i]);else for(i in t)f.hasOwnProperty(i)||(f[i]=t[i]);if(f.signal)f.tween=undefined,n=this._returnExtendedFreevar(f,CW.Animation._signalFreevar),n._unsignaledCurrent=n.from;else if(f.inertia){f.tween=undefined,n=this._returnExtendedFreevar(f,CW.Animation._inertiaFreevar),n._undampedCurrent=n.from,n.inertia!==!0||(n.inertia=CW.Animation._inertiaFreevar.prototype.inertia),r=[];for(i=0;i<f.inertia-1;i++)r[i]=n._undampedCurrent;n.inertiaChain=r}else n=this._returnExtendedFreevar(f,CW.Animation._tweenFreevar),n._untweenedCurrent=f.from,typeof n.speed=="number"&&(n.duration=undefined);return n._isFreevar=!0,n.freevarRun(0),n},_returnExtendedFreevar:function(e,t){if(e===this){for(var n in t.prototype)this[n]===undefined&&(this[n]=t.prototype[n]);return this}return new t(e)},addFreevar:function(e){if(!e)return;return e.key&&this[e.key]?!1:(e=this.makeFreevarFromHash(e),e.key&&(this[e.key]=e),(this.freevars||(this.freevars=[])).push(e),this)},removeFreevar:function(e){typeof e=="string"&&(e=this[e]);if(!e||!e._isFreevar)return null;if(!this.freevars||!this.freevars.length)return null;e.key&&(this[e.key]=undefined);for(var t=0;t<this.freevars.length;t++)this.freevars[t]===e&&this.freevars.splice(t--,1);return e},allFreevarsDo:function(e,t){var n,r,i=arguments.callee.args||(arguments.callee.args=[]);i.length=0;for(var s=1,o=arguments.length;s<o;s++)i.push(arguments[s
]);this[e].apply(this,i);if(!(n=this.freevars))return this;for(s=0;r=n[s];s++)r[e].apply(r,i);return this},forceAll:function(e){return this.allFreevarsDo("force",e),this},resetAll:function(){return this.allFreevarsDo("reset"),this},reverseAll:function(e){return this.allFreevarsDo("reverse"),this},run:function(e,t){var n=!0,r=1,i=Infinity,s;for(var o=-1,u=!!this.freevars&&this.freevars.length||0;o<u;o++)s=this.freevars&&this.freevars[o]||this,s.freevarRun(e)||(n=!1),s.progress<r&&(r=s.progress),s.tweenedProgress<i&&(i=s.tweenedProgress);this.freevars&&(this.progress=r,this.tweenedProgress=i),t||this.update(),n&&this.listen("postFrame",this._finishNaturally)},start:function(){if(this.running)return this;this.disabled&&this.allFreevarsDo("zeroOutDuration");if(CW.Animator._hasSC){var e=SC.RunLoop.isRunLoopInProgress();e||SC.RunLoop.begin()}var t=arguments.callee.base.apply(this,arguments);return CW.Anim.isActive&&(this.update(),this.trigger("tick"),this.trigger("frame")),!e&&CW.Animator._hasSC&&SC.RunLoop.end(),t},finish:function(e,t){if(!this.running)return this;e||(this.allFreevarsDo("force"),t||(this.update(),this.trigger("tick"),this.trigger("frame")));var n=this.stop();return this.trigger("finish"),this.repeat>0&&(this.repeat--,this.reverseOnRepeat?this.reverse():this.reset(),this.start()),n},_finishNaturally:function(){this.finish(!0)},update:function(){},toString:function(){var e=arguments.callee.base.apply(this,arguments);return e=e.substring(0,e.length-1)+(this.name?" "+this.name:"")+(this.running?" running":"")+(this.fps?" fps="+this.fps:"")+(this.freevars||this.inertia?""
:" "+this.from+"-to-"+this.to+" "+this.duration+"ms "+Math.round(this.progress*100)+"%")+"]",e},destroy:function(){var e=arguments.callee.base.apply(this,arguments);return this.update=this.run=this.finish=function(){},e},recycle:function(){this.tickCount=this.frameCount=this.elapsedTime=this._forcedZeroes=0}}),CW.Animation.defaultFreevar={tween:CW.Anim.tweens.WEBKIT_EASE,discreteness:0},CW.Animation._tweenFreevar=function(){var e=function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t])};return e.prototype={from:0,to:1,duration:1e3,importants:undefined,isAlmostFinished:function(e){return Math.abs(this.to-this.current)<e},reverse:function(){var e=this.to;return this.to=this.from,this.from=e,this.freevarRun(0),this},reset:function(){return this._untweenedCurrent=this.from,this.freevarRun(0),this},redirectTo:function(e){return this.from=this.current,this.to=e,this._untweenedCurrent=this.from,this.freevarRun(0),this},redirectFrom:function(e){return this.from=this._untweenedCurrent=e,this.freevarRun(0),this},zeroOutDuration:function(){return!this.duration||(this.duration=0),!this.speed||(this.speed=Infinity),this},force:function(e){return typeof e=="number"&&(this.to=e),this._untweenedCurrent=this.to,this.freevarRun(0),this},freevarRun:function(e){if(this.duration===0||this.speed===Infinity)this._untweenedCurrent=this.to;var t=this,n=t._untweenedCurrent<t.to,r=t.isFinished=t._untweenedCurrent===t.to,i=t.importants?t.importants[t._impSpot||0]||undefined:undefined,s=i!==undefined?t._untweenedCurrent<i:undefined,o,u;if(t.to===t.from)return t.current=t._untweenedCurrent=t.to,t.isFinished=!0
;if(!r){u=t.speed||1e3/t.duration*Math.abs(t.to-t.from),o=Math.abs(u*e/1e3),n?t._untweenedCurrent+=o:t._untweenedCurrent-=o;if(s===!0&&t._untweenedCurrent>i||s===!1&&t._untweenedCurrent<i)t._untweenedCurrent=i,t._impSpot=(t._impSpot||0)+1;if(t.isFinished=n&&t._untweenedCurrent>=t.to||!n&&t._untweenedCurrent<=t.to)t._untweenedCurrent=t.to}return t.from!==undefined&&t.to!==undefined?(t.progress=(t._untweenedCurrent-t.from)/(t.to-t.from),t.tween instanceof Function&&t.from!=t.to&&(t.from===0&&t.to===1?t.current=t.tweenedProgress=t.tween.call(this,t._untweenedCurrent):t.current=(t.tweenedProgress=t.tween.call(this,t.progress))*(t.to-t.from)+t.from)):t.current=t._untweenedCurrent,t.discreteness&&Math.abs(t.to/t.discreteness)%1<1e-8&&(t.current=Math.round(t.current/t.discreteness)*t.discreteness),t.isFinished}},e._freevarPrototype=e,e}(),CW.Animation._inertiaFreevar=function(){var e=function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t])};return e.prototype={from:0,to:1,speed:1,inertia:3,headStart:.01,isAlmostFinished:function(e){return Math.abs(this.to-this.current)<e},reverse:function(){var e=this.to;return this.to=this.from,this.from=e,this},reset:function(){var e=this.to;return this.force(this.from),this.to=e,this},redirectTo:function(e){return this.from=this.current,this.to=e,this},redirectFrom:function(e){var t=e-this.current;this.from=e,this._undampedCurrent+=t;for(var n=0,r=this.inertiaChain.length;n<r;n++)this.inertiaChain[n]+=t;return this.freevarRun(0),this},zeroOutDuration:function(){return this.speed=Infinity,this},force:function(e){typeof e=="number"&&(this.to=
e),this._undampedCurrent=this.current=this.to;for(var t=0,n=this.inertiaChain.length;t<n;t++)this.inertiaChain[t]=this.to;return this},freevarRun:function(e){this.speed===Infinity&&this.force();var t,n=this,r,i,s=n.speed,o=n.inertiaChain,u,a,f;for(t=0;t<n.inertia;t++){t===0?(r=n._undampedCurrent,i=n.to):t===1?(r=o[0],i=n._undampedCurrent):(r=o[t-1],i=o[t-2]);if(r===i)continue;u=r<i,a=e/1e3*s*Math.abs(i+n.headStart*(2*u-1)-r),u?r+=a:r-=a;if(f=u&&r>=i||!u&&r<=i)r=i;t===0?n._undampedCurrent=r:o[t-1]=r}return n.current=r,n.discreteness&&Math.abs(n.to/n.discreteness)%1<1e-8&&(n.current=Math.round(n.current/n.discreteness)*n.discreteness),n.isFinished=n.to===n.current,n.progress=NaN,n.isFinished}},e._freevarPrototype=e,e}(),CW.Animation._signalFreevar=function(){var e=function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t])};return e.prototype={speed:1,from:0,signal:function(e){return.5+.5*Math.sin(e*Math.PI*2)},persistent:!0,isAlmostFinished:function(e){return!this.persistent},reverse:function(){return this.speed=-this.speed,this},reset:function(){return this._unsignaledCurrent=this.from,this},redirectTo:function(){return this},force:function(){return this},advance:function(e){this._unsignaledCurrent+=e},zeroOutDuration:function(){return this},freevarRun:function(e){return this._unsignaledCurrent+=e/1e3*this.speed,this.current=this.signal(this._unsignaledCurrent),this.discreteness&&(this.current=Math.round(this.current/this.discreteness)*this.discreteness),this.isFinished=!this.persistent,this.progress=NaN,this.isFinished}},e._freevarPrototype=e,e}(),CW.Anim.Fader=CW.Fader=
CW.Animation.extend({className:"CW.Fader",update:function(){CW.Anim.setOpacity(this.element,this.current)},init:function(){this.from===undefined&&(this._untweenedCurrent=this.from=CW.Anim.getOpacity(this.element)),arguments.callee.base.apply(this,arguments)},_removeOnFinish:function(){if(!this.REMOVE_ON_FINISH)return;this.element.parentNode&&this.element.parentNode.removeChild(this.element)}.listens("finish"),saveSelf:function(){var e=this.element._cwaFader;e&&e.stop(),this.element._cwaFader=this}.listens("start"),killSelf:function(){this.element._cwaFader=undefined}.listens("stop")}),CW.Anim.DisplayNoneAtZero={isMixin:!0,setDisplayNone:function(){this.to===0&&(this.element.style.display="none")}.listens("finish"),removeDisplayNone:function(){this.element.style.display=""}.listens("start")},CW.Anim.ColorFader=CW.ColorFader=CW.Animation.extend({className:"CW.ColorFader",style:"color",init:function(){this.colorKey="_cwa"+this.style+"color",this.saveKey="_cwa"+this.style+"Fader";var e;if(this.sR===undefined||this.sG===undefined||this.sB===undefined)(e=CW.Anim.getStyle(this.element,this.style))?e=CW.Anim.decodeColor(e):e=this.element[this.colorKey]||(this.element[this.colorKey]=[0,0,0]),this.sR=e[0],this.sG=e[1],this.sB=e[2];arguments.callee.base.apply(this,arguments)},update:function(){if(!this.element||!this.style)return;var e=this.current,t=1-e,n,r,i,s=this.element[this.colorKey]||(this.element[this.colorKey]=[]);s[0]=n=this.tR*e+this.sR*t,s[1]=r=this.tG*e+this.sG*t,s[2]=i=this.tB*e+this.sB*t,this.element.style[this.style]=(this.cssBeforeColor||"")+CW.Anim.encodeColor(n,r,i)+
(this.cssAfterColor||"")},saveSelf:function(){var e=this.element[this.saveKey];e&&e.stop(),this.element[this.saveKey]=this}.listens("start"),killSelf:function(){this.element[this.saveKey]=undefined}.listens("stop")}),CW.Anim.Mover=CW.Mover=CW.Animation.extend({className:"CW.Mover",getOmittedPositions:function(){var e,t,n,r;if(this.fromX===undefined||this.anchorX===undefined)n="left",e=parseInt(CW.Anim.getStyle(this.element,n),10),isNaN(e)&&(n="right",e=parseInt(CW.Anim.getStyle(this.element,n),10)),isNaN(e)&&(n="left"),this.anchorX!==undefined||(this.anchorX=n),this.fromX!==undefined||(this.fromX=e);if(this.fromY===undefined||this.anchorY===undefined)r="top",t=parseInt(CW.Anim.getStyle(this.element,r),10),isNaN(t)&&(r="bottom",t=parseInt(CW.Anim.getStyle(this.element,r),10)),isNaN(t)&&(n="top"),this.anchorY!==undefined||(this.anchorY=r),this.fromY!==undefined||(this.fromY=t);if(isNaN(this.fromX)||isNaN(this.fromY))this.anchorX="left",this.anchorY="top",this.fromX=this.element.offsetLeft,this.fromY=this.element.offsetTop,this.element.style.position="absolute";this.toX===undefined&&(this.toX=this.fromX),this.toY===undefined&&(this.toY=this.fromY)}.listens("start"),update:function(){var e=this.element.style,t=this.current,n=1-t;e[this.anchorX]=Math.round(t*this.toX+n*this.fromX)+"px",e[this.anchorY]=Math.round(t*this.toY+n*this.fromY)+"px"}}),CW.Animatability={ENABLE_OLD_IE:YES,hasAnimatability:!0,mustKeepLayoutSync:YES,isAnimating:NO,isAnimatingInWindow:NO,isAnimatingWithParent:NO,recomputeIsAnimatingBooleans:function(){var e=this.get("isAnimatingInWindow"),t=!1,n=this,r=this.
_animCount>0,i;while(n=n.get("parentView"))if(n.hasAnimatability&&n.get("isAnimating")){t=!0;break}i=t||r,this.isAnimating!==r&&this.set("isAnimating",r),this.isAnimatingInWindow!==i&&this.set("isAnimatingInWindow",i),this.isAnimatingWithParent!==t&&this.set("isAnimatingWithParent",t),i!==e&&this._recomputeChildrenIsAnimatingBooleans()},_recomputeChildrenIsAnimatingBooleans:function(){for(var e=0,t=this.get("childViews"),n;n=t[e];e++)n.hasAnimatability?n.recomputeIsAnimatingBooleans():CW.Animatability._recomputeChildrenIsAnimatingBooleans.apply(n)},incrementAnimationCount:function(){this._animCount=(this._animCount||0)+1,this.recomputeIsAnimatingBooleans()},decrementAnimationCount:function(){this._animCount=Math.max(this._animCount-1,0),this.recomputeIsAnimatingBooleans()},animateProperty:function(e,t,n){return this.animateProperties.apply(this,arguments)},animateProperties:function(e,t){var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L=SC.A(arguments),A=this._currentlyAnimatingProperties,O=this.get("mustKeepLayoutSync");if(o=typeof e=="string")(s={})[e]=t,e=s,t=L[2];if(!e){SC.warn("When using .animateProperties(, either a property name (string)or a hash, keyed by property name, full of destinations (or full freevar optionshashes) must be supplied as the first argument. Aborting the call.");return}e=SC.clone(e);if(t)for((n=o?2:1)&&(i=L.length)&&!(t=undefined);n<i;n++){if(typeof (N=L[n])!="object")continue;for(r in N)(t||(t={}))[r]=N[r]}t||(t=this.___emptyHash),typeof (u=t.duration)=="number"&&delete t.duration,(a=t.tween)&&delete t.tween,(f=t.speed)&&delete t.speed,(
l=t.inertia)&&delete t.inertia,(c=t.headStart)&&delete t.headStart,(globalDiscreteness=t.discreteness)&&delete t.discreteness,m=!0;for(n in t){if(!t.hasOwnProperty(n))continue;y=t[n],b=typeof y;if(b==="object"||b==="function")m=!1;(g||(g=[])).push(n)}t.canReuse=m=m||t.canReuse,g&&(t.extraKeys=g);for(n in e){if(SC.none(h=e[n]))continue;p=(d=A[n])?((S||(S={}))[n]=d).removeProperty(n,!0):undefined,typeof h=="number"&&(h=e[n]={to:h}),h.from===undefined&&(h.isLayoutProperty?(p?h.from=p.current:h.from=(this._previousLayout||this.get("layout"))[n],typeof h.from!="number"&&(h.from=this._DEFAULT_LAYOUT_FROMS[n]||0)):h.from=this.getPath(n)),typeof u=="number"&&h.duration===undefined&&h.inertia===undefined&&h.speed===undefined&&(h.duration=u),a&&h.tween===undefined&&h.inertia===undefined&&(h.tween=a),f&&h.speed===undefined&&h.duration===undefined&&h.tween===undefined&&(h.speed=f),l&&h.inertia===undefined&&h.tween===undefined&&(h.inertia=l),c&&h.headStart===undefined&&(h.headStart=c),globalDiscreteness&&h.discreteness===undefined&&(h.discreteness=globalDiscreteness),p&&p.inertia&&h.inertia===p.inertia&&(h.speed&&(p.speed=h.speed),h.headStart&&(p.headStart=h.headStart),p.from=h.from,p.to=h.to,h.discreteness!==undefined&&(p.discreteness=h.discreteness),e[n]=h=p),e[n].propertyName=n}E=0,T=0,C=!this.get("animateOldIE")&&SC.browser.msie&&SC.browser.msie<=8;for(n in e){if(!(h=e[n]))continue;C&&(!h.duration||(h.duration=0),!h.speed||(h.speed=Infinity)),(h.duration||0)>E&&(E=h.duration),O||this.adjust(h.propertyName,h.to),h.to===h.from?(O&&this.adjust(h.propertyName,h.to),delete e[n]):T++}if(T===0
)m||(k=CW.Animation.create({view:this,duration:E||u||0},t).start());else if(m&&(w=this._bestMatchAnimationForProperties(e)||this._animationFromPool())){for(n in e)w.addProperty(e[n]);for(n in t)w[n]=t[n];k=w.start()}else{v={freevars:[],properties:[]};for(n in e)v.freevars.push(n),v.properties.push(n);v.view=this,w=CW.MultiPropertyAnimation.create(v,e,t);for(n in e)A[n]=w;k=w.start()}if(S){for(n in S){if(!S.hasOwnProperty(n))continue;x=S[n];if(x.__checked__)continue;x.__checked__=!0,x.stopIfNoProperties()}for(n in S){if(!S.hasOwnProperty(n))continue;S[n].__checked__=!1}}return k},_bestMatchAnimationForProperties:function(e){var t,n,r,i,s,o,u=this._currentlyAnimatingProperties;for(t in u){if(!(i=u[t])||i.___matchCheck)continue;i.___matchCheck=!0,r=i.properties.length,s=0;for(n=0;n<r;n++)s+=e[i.properties[n]]?2:1;i.___matchCount=s}s=0;for(t in u){if(!(i=u[t])||!i.matchCheck)continue;i.___matchCheck=undefined,i.___matchCount>s&&(s=i.___matchCount,o=i),i.___matchCount=undefined}return o||this._animationFromPool()},_propertyAnimPool:null,_addAnimationToPool:function(e){if(!e)return;var t=this._propertyAnimPool;for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return;t.push(e)},_animationFromPool:function(){var e=this._propertyAnimPool,t=e.length,n=e[t-1];return n&&(e.length=t-1),n},animate:function(e,t){var n,r,i,s,o,u,a,f=SC.A(arguments);if(u=typeof e=="string")(n={})[e]=t,e=n,t=f[2];if(!e){SC.warn("When using .animate(, either a property name (string)or a hash, keyed by property name, full of destinations (or full freevar optionshashes) must be supplied as the first argument. Aborting the call."
);return}e=SC.clone(e);if(t)for((i=u?2:1)&&(s=f.length)&&!(t=undefined);i<s;i++){if(typeof (a=f[i])!="object")continue;for(r in a)(t||(t={}))[r]=a[r]}typeof (n=e.duration)=="number"&&((t||(t={})).duration=n,delete e.duration);if(n=e.tween)(t||(t={})).tween=n,delete e.tween;if(n=e.speed)(t||(t={})).speed=n,delete e.speed;if(n=e.inertia)(t||(t={})).inertia=n,delete e.inertia;if(n=e.headStart)(t||(t={})).headStart=n,delete e.headStart;t||(t=this.___emptyHash);for(i in e)o=e[i],typeof o=="number"&&(o=e[i]={to:o}),o.isLayoutProperty=!0;return this.animateProperties(e,t)},adjust:function(e){return SC.View.prototype.adjust.apply(this,arguments)},stopAnimation:function(){this._forSaidPropertyAnimationsDo("removeProperty",arguments)},finishAnimation:function(){this._forSaidPropertyAnimationsDo("finishProperty",arguments)},updateToAnimation:function(){this._forSaidPropertyAnimationsDo("updateToProperty",arguments)},_forSaidPropertyAnimationsDo:function(e,t){var n=this._currentlyAnimatingProperties;if(!e||!n)return;var r=this.___keysForDoAll||(this.___keysForDoAll=[]),i=t[0],s,o,u,a;r.length=0,i||(i=n);if(i instanceof Array){o=i.length;for(s=0;s<o;s++)r[s]=i[s]}else if(typeof i=="object")for(s in i)i.hasOwnProperty(s)&&i[s]!==undefined&&r.push(s);else if(typeof i=="string"){o=t.length;for(s=0;s<o;s++)r[s]=t[s]}o=r.length;for(s=0;s<o;s++){a=n[u=r[s]];if(!a)continue;a[e](u)}},_canAvoidAdjust:function(){return this.get("mustKeepLayoutSync")?!1:!0},_quickAdjust:function(e,t){if(!this._isQuickAdjusting)return this.adjust.apply(this,arguments)},_isQuickAdjusting:!1,_quickAdjustment:null,_beginQuickAdjustment
:function(){this._isQuickAdjusting=!0;var e=this._quickAdjustment||(this._quickAdjustment={}),t=this._previousLayout||this.get("layout");for(var n in e)t.hasOwnProperty(n)||delete e[n];for(n in t)e[n]=t[n]},_commitQuickAdjustment:function(){this._isQuickAdjusting=!1},_renderQuickAdjustment:function(){},_currentlyAnimatingProperties:null,___emptyHash:{},initMixin:function(){this._currentlyAnimatingProperties={},this._propertyAnimPool=[],this.hasOwnProperty("animateOldIE")||this.set("animateOldIE",CW.Animatability.ENABLE_OLD_IE)},_DEFAULT_LAYOUT_FROMS:{opacity:1,scale:1},discreteForOutsideUnitInterval:{left:YES,top:YES,width:YES,height:YES,right:YES,bottom:YES,centerX:YES,centerY:YES}},CW.MultiPropertyAnimation=CW.Animation.extend({view:null,properties:null,ticked:SC.platform.touch?5:0,stopIfNoProperties:function(){this.properties.length===0&&this.stop()},finishProperty:function(e,t){var n=this.freevarForProperty(e);if(!n)return;n.force(),t||this.update(),this.removeProperty(e)},removeProperty:function(e,t){for(var n=0,r;r=this.properties[n];n++)r===e&&(this.properties.splice(n,1),n--);this.view._currentlyAnimatingProperties[e]=undefined,t||this.stopIfNoProperties();var i=this.removeFreevar(this.freevarForProperty(e));return i},addProperty:function(e){var t;if(!e||!(t=e.propertyName))return;e.key=e.propertyName;for(var n=0,r;r=this.properties[n];n++)r===t&&(this.removeProperty(t,!0),n--);this.properties.push(t),this.view._currentlyAnimatingProperties[t]=this,this.addFreevar(e)},updateToProperty:function(e){var t=CW.Animatability.discreteForOutsideUnitInterval,n=e,r=this.view;r
._updatingAnimatedProperty=!0,typeof n=="string"&&(n=this.freevarForProperty(n)),e=n.propertyName,n.isLayoutProperty?(n.discreteness||(n.discreteness=t[e]&&(n.to>1||n.from>1||n.to<0||n.from<0)?1:1e-6),r.get("mustKeepLayoutSync")?r.adjust(e,n.current):r.$().css(e,n.current)):this.view[e]!==n.current&&r.set(e,n.current),r._updatingAnimatedProperty=!1},freevarForProperty:function(e){return this[e]},update:function(){for(var e=0,t,n;t=this.freevars[e];e++)this.updateToProperty(t)},releaseProperties:function(){for(var e=0,t;t=this.properties[e];e++)this.view._currentlyAnimatingProperties[t]=undefined}.listens("stop"),poolAnimation:function(){if(!this.canReuse)return;while(this.properties.length)this.removeProperty(this.properties[0],!0);this.properties.length=0;if(this.extraKeys){for(var e in this.extraKeys)delete this[e];delete this.extraKeys}this.recycle(),this.view._addAnimationToPool(this)}.listens("stop"),markView:function(){this.view.incrementAnimationCount()}.listens("start"),unmarkView:function(){this.view.decrementAnimationCount()}.listens("stop")}),CW.PaneAnimationSupport={hasPaneAnimationSupport:YES,hiddenState:{opacity:0},showingState:{opacity:1},duration:350,showDuration:null,hideDuration:null,tween:CW.Anim.tweens.WEBKIT_EASE,showTween:null,hideTween:null,firstShowDelay:0,hideDelay:0,append:function(e){(!this.hasSpritePreloadEnforcement||this._hasShownFromDidCreateLayer)&&this.animateShow(),e()}.enhance(),animateShow:function(){if(SC.browser.isIE8OrLower){this.paneWillShow(),this.paneDidShow();return}this._hideAnim&&this._hideAnim.finish(),this._showAnim&&this._showAnim
.finish(),this._showTimer&&(this._showTimer.invalidate(),this._showTimer=null),this._hideTimer&&(this._hideTimer.invalidate(),this._hideTimer=null),this._animatingShow=YES,this.paneWillShow(),this.invokeLast(function(){this._animatingShow=YES,this.adjust(this.get("hiddenState"));var e=this.get("showDuration"),t=[this.get("showingState"),{duration:typeof e=="number"?e:this.get("duration"),tween:this.get("showTween")||this.get("tween"),notifyFrame:function(){this.view.didFrame(this),this.view.showDidFrame(this)}.listens("frame"),completed:function(){this.view._showAnim=null,this.view.paneDidShow(this)}.listens("finish")}];!this._hasAppendedOnce&&this.get("firstShowDelay")!==0?(this._showTimer=this._delayedFirstShowTimer=this.invokeLater(function(){this._showTimer=this._delayedFirstShowTimer=null,this._showAnim=this.animate.apply(this,t)},this.get("firstShowDelay")),this._hasAppendedOnce=YES):this._showTimer=this.invokeLast(function(){this._showTimer=null,this._showAnim=this.animate.apply(this,t)}),this._animatingShow=NO}),this._animatingShow=NO},remove:function(e){if(SC.browser.isIE8OrLower){this.paneWillHide(),e(),this.paneDidHide();return}var t;this.get("isPanelPane")&&this._isShowingModal&&(this._isShowingModal=NO,(t=this._modalPane())&&t.paneDidRemove(this)),this._hideAnim&&this._hideAnim.finish(),this._showAnim&&this._showAnim.finish(),this._showTimer&&(this._showTimer.invalidate(),this._showTimer=null),this._hideTimer&&(this._hideTimer.invalidate(),this._hideTimer=null),this._animatingHide=YES,this.paneWillHide(),this.invokeLast(function(){this._animatingHide=YES;var t=this
.get("hideDuration"),n=[this.get("hiddenState"),{duration:typeof t=="number"?t:this.get("duration"),tween:this.get("hideTween")||this.get("tween"),notifyFrame:function(){this.view.didFrame(this),this.view.hideDidFrame(this)}.listens("frame"),enableClickThrough:function(){this.view.$().css("pointerEvents","none")}.listens("start"),removeClickThrough:function(){this.view.$().css("pointerEvents","auto")}.listens("stop"),completed:function(){this.view._hideAnim=null,e(),this.view.paneDidHide(this)}.listens("finish")}];this.get("hideDelay")!==0?this._hideTimer=this.invokeLater(function(){this._hideTimer=null,this._hideAnim=this.animate.apply(this,n)},this.get("hideDelay")):this._hideTimer=this.invokeLast(function(){this._hideTimer=null,this._hideAnim=this.animate.apply(this,n)}),this._animatingHide=NO}),this._animatingHide=NO}.enhance(),didFrame:function(e){},showDidFrame:function(e){},hideDidFrame:function(e){},paneDidHide:function(e){},paneWillHide:function(){},paneDidShow:function(e){},paneWillShow:function(){}},CW.PaneFadingSupport=SC.clone(CW.PaneAnimationSupport),SC.mixin(CW.PaneFadingSupport,{paneFadeInDuration:100,paneFadeOutDuration:350,showDuration:function(){return this.get("paneFadeInDuration")}.property("paneFadeInDuration").cacheable(),hideDuration:function(){return this.get("paneFadeOutDuration")}.property("paneFadeOutDuration").cacheable(),showingState:function(){return{opacity:this.get("paneOpacity")||1}}.property("paneOpacity").cacheable(),paneDidHide:function(){return this.paneDidFadeOut()},paneDidFadeOut:function(){}}),SC.stringsFor("en-us",{monthHeading:"%@1 %@2"
,year:"%@",Month:"Month",January:"January",February:"February",March:"March",April:"April",May:"May",June:"June",July:"July",August:"August",September:"September",October:"October",November:"November",December:"December",Jan:"Jan",Feb:"Feb",Mar:"Mar",Apr:"Apr",Jun:"Jun",Jul:"Jul",Aug:"Aug",Sep:"Sep",Oct:"Oct",Nov:"Nov",Dec:"Dec",Sunday:"Sunday",Monday:"Monday",Tuesday:"Tuesday",Wednesday:"Wednesday",Thursday:"Thursday",Friday:"Friday",Saturday:"Saturday",Sun:"Sun",Mon:"Mon",Tue:"Tue",Wed:"Wed",Thu:"Thu",Fri:"Fri",Sat:"Sat",Yesterday:"Yesterday",Today:"Today",Tomorrow:"Tomorrow",Midnight:"Midnight",Now:"Now",Noon:"Noon",Next:"Next",Last:"Last",English:"English",French:"French",German:"German",Japanese:"Japanese","Button.OK":"OK","Button.Cancel":"Cancel","Button.Reload":"Reload","Button.Save":"Save","Button.Accept":"Accept","Button.Decline":"Decline","Button.Maybe":"Maybe","Button.TryAgain":"Try Again","Status.Loading":"Loading…","Status.Sharing":"Sharing…","Toolbar.Message.Actions":"Actions","Dialog.Error.Details":"Details","Color.Picker.Custom.Color":"Custom color…","CW.DropTarget.SafariWindowsNotSupported.Title":"Drag and drop not supported.","CW.DropTarget.SafariWindowsNotSupported.Description":"Drag and drop of files into this browser is not currently supported."}),CW.CANVAS_BUTTON_HEIGHT=26,CW.TOOLBAR_BUTTON_HEIGHT=26,CW.SQUARE_BUTTON_REGULAR_HEIGHT=27,CW.IOS_BUTTON_REGULAR_HEIGHT=30,CW.IOSMINI_BUTTON_REGULAR_HEIGHT=24,CW.IOSBIG_BUTTON_REGULAR_HEIGHT=46,CW.SELECT_BUTTON_REGULAR_HEIGHT=27,CW.POPUP_BUTTON_REGULAR_HEIGHT=27,CW.SQUARE_BUTTON_REGULAR_MIN_WIDTH=68,CW.SQUARE_BUTTON_SMALL_MIN_WIDTH=56
,CW.SQUARE_BUTTON_TINY_MIN_WIDTH=52,CW.HELP_BUTTON_REGULAR_MIN_WIDTH=26,CW.HELP_BUTTON_SMALL_MIN_WIDTH=22,CW.HELP_BUTTON_TINY_MIN_WIDTH=18,CW.CHECKBOX_REGULAR_HEIGHT=18,CW.PROGRESS_REGULAR_HEIGHT=20,CW.PROGRESS_CAPSULE_HEIGHT=19,CW.PROGRESS_CAPSULE_ANIMATED_BACKGROUND_MATRIX=[171,19,31],CW.PROGRESS_REGULAR_OFFSETRANGE=32,CW.PROGRESS_CAPSULE_OFFSETRANGE=20,CW.TEXT_FIELD_TINY_HEIGHT=18,CW.TEXT_FIELD_SMALL_HEIGHT=22,CW.TEXT_FIELD_REGULAR_HEIGHT=26,CW.TEXT_FIELD_LARGE_HEIGHT=30,CW.TEXT_FIELD_LARGE_TALL_HEIGHT=31,CW.TEXT_FIELD_HUGE_HEIGHT=31,CW.SLIDER_REGULAR_HEIGHT=25,CW.DOCK_HEIGHT=46,CW.SOURCE_LIST_WIDTH=171,CW.TINY_CONTROL_SIZE=SC.TINY_CONTROL_SIZE,CW.SMALL_CONTROL_SIZE=SC.SMALL_CONTROL_SIZE,CW.REGULAR_CONTROL_SIZE=SC.REGULAR_CONTROL_SIZE,CW.LARGE_CONTROL_SIZE=SC.LARGE_CONTROL_SIZE,CW.LARGE_TALL_CONTROL_SIZE="me-large-tall-size",CW.XLARGE_CONTROL_SIZE=SC.HUGE_CONTROL_SIZE,CW.DropTarget={isDropTarget:YES,acceptsFileDrags:YES,dragStarted:function(e,t){},dragEntered:function(e,t){},dragUpdated:function(e,t){},dragExited:function(e,t){},dragEnded:function(e,t){},computeDragOperations:function(e,t){return SC.DRAG_NONE},acceptDragOperation:function(e,t){return YES},performDragOperation:function(e,t){return SC.DRAG_NONE},_isCurrentlyHovered:NO,renderMixin:function(e,t){t&&SC.browser.isWebkit&&this.get("acceptsFileDrags")&&e.push('<div class="cw-drop-target-container"><input class="cw-drop-target-file" type="file" multiple="multiple"></div>')},didCreateLayer:function(e){e();if(!this.get("acceptsFileDrags"))return;var t=this.$().children(".cw-drop-target-container").children()[0]||null
;if(SC.browser.isWebkit&&t)SC.Event.add(t,"change",this,this._handleDrop);else if(SC.browser.mozilla){var n=this.get("layer");SC.Event.add(n,"drop",this,this._handleDrop)}}.enhance(),_changeFileElementClickability:function(e){if(SC.browser.isWebkit&&this.get("acceptsFileDrags")){var t=this.$().children(".cw-drop-target-container").children()[0]||null,n=e?"block":"none";t&&n!==t.style.display&&(t.style.display=n)}},_handleDragEnter:function(e){if(CW.DropTarget.dealWithSafariWindows())return;if(SC.browser.isWebkit&&!(e&&e.target&&e.target.className&&e.target.className.indexOf&&e.target.className.indexOf("cw-drop-target-file")>-1)){this._isCurrentlyHovered=YES;return}var t=e.dragOperation;this._isFileEvent(e)&&this._changeFileElementClickability(YES),this.computeDragOperations(t,e)&SC.DRAG_DATA&&(this.dragEntered(t,e),this._isCurrentlyHovered=YES)},_handleDragOver:function(e){var t=e.dragOperation;this._isFileEvent(e)&&this._changeFileElementClickability(YES);if(CW.DropTarget.dealWithSafariWindows())return;this.computeDragOperations(t,e)&SC.DRAG_DATA&&(this._isCurrentlyHovered?this.dragUpdated(t,e):(this.dragEntered(t,e),this._isCurrentlyHovered=YES))},_handleDrop:function(e){var t=e.dragOperation;t||(t=this._dragOperationForEvent(e)),this._changeFileElementClickability(NO);if(CW.DropTarget.dealWithSafariWindows())return;if(this.acceptDragOperation(t,SC.DRAG_DATA)){var n=e.dataTransfer.files;if(n&&n.length>0){t.data=n;for(var r=0,i=n.length;r<i;++r){var s=n[r];SC.none(s.fileName)&&s.name&&(s.fileName=s.name)}}this.performDragOperation(t,SC.DRAG_DATA)}},_handleDragExit:function(
e){if(SC.browser.isWebkit&&!(e&&e.target&&e.target.className&&e.target.className.indexOf&&e.target.className.indexOf("cw-drop-target-file")>-1))return;var t=e.dragOperation,n=e.originalEvent.target;n.type&&n.type==="file"&&this._changeFileElementClickability(NO);if(CW.DropTarget.dealWithSafariWindows())return;this.dragExited(t,e)},_isFileEvent:function(e){var t=e.dataTransfer;if(t){var n=t.types;if(SC.none(n))return YES;for(var r=0,i=n.length;r<i;++r){var s=n[r];if(s==="text/uri-list"&&SC.browser.isMozilla)return NO;if(s==="Files")return YES}}return NO},_notifyTargetViewsOfEvent:function(e,t){var n=SC.RootResponder.responder,r=n.targetViewForEvent(t);return this._isFileEvent(t)?(t.stopPropagation(),t.preventDefault()):t.allowDefault(),SC.browser.isWindows&&SC.browser.isSafari?NO:(t.dragOperation=this._dragOperationForEvent(t,r),n.sendEvent(e,t,r))},_dragOperation:null,_dragOperationForEvent:function(e,t){var n=CW.DropTarget._dragOperation;if(n)return n;var r=SC.Drag.start({event:e,source:t,ghost:NO,slideBack:NO,sourceIsDraggable:NO});return CW.DropTarget._dragOperation=r,r},_dragEndedOnDropTargets:function(e,t){if(CW.DropTarget.dealWithSafariWindows())return;t=e.dragOperation||t;if(!t)return;var n=t._dropTargets();for(var r=0,i=n.length;r<i;r++){var s=n[r];s.tryToPerform("dragEnded",this,e);if(s&&s.get("acceptsFileDrags")){s._isCurrentlyHovered=NO,s._changeFileElementClickability(NO);if(SC.browser.isWebkit&&s.isVisibleInWindow){var o=s.$().children(".cw-drop-target-container").children()[0]||null;o&&(o.value=null)}}}CW.DropTarget._dragOperation=null}},SC.RootResponder.reopen
({init:function(e){e(),SC.browser.isIE9OrLower||this.listenFor("dragenter dragover dragleave drop".w(),document,null,!0)}.enhance(),_dropTargetViewForEvent:function(e){var t=this.targetViewForEvent(e),n=CW.DropTarget._isFileEvent(e);while(YES){if(SC.none(t))return t;if(t.isDropTarget&&(!n||t.get("acceptsFileDrags")))return t;t=t.get("parentView")}},dragenter:function(e){this.set("_lastDragEnterTarget",e.target),this._setupDragOverTimer(e);if(SC.browser.isMozilla||SC.browser.msie&&!SC.browser.isIE9OrLower){var t=this._lastEvent;this._lastEvent=e;if(t){if(this._dropTargetViewForEvent(e)===this._dropTargetViewForEvent(t))return;CW.DropTarget._notifyTargetViewsOfEvent("_handleDragExit",t)}else CW.DropTarget._notifyTargetViewsOfEvent("_handleDragEnter",e)}else CW.DropTarget._notifyTargetViewsOfEvent("_handleDragEnter",e)},_setupDragOverTimer:function(e){var t=this.get("_dragOverTimer");this.set("_lastDragOverEvent",e),t&&t.invalidate(),t=SC.Timer.schedule({target:this,action:function(){var e=this.get("_lastDragOverEvent");e&&(this._lastEvent=undefined,CW.DropTarget._dragEndedOnDropTargets(e))},interval:500,repeats:NO}),this.set("_dragOverTimer",t)},dragover:function(e){this._setupDragOverTimer(e),CW.DropTarget._notifyTargetViewsOfEvent("_handleDragOver",e)},dragleave:function(e){if(SC.browser.isMozilla||SC.browser.msie&&!SC.browser.isIE9OrLower){var t=this._lastEvent;this._lastEvent=e;if(t){if(this._dropTargetViewForEvent(t)===this._dropTargetViewForEvent(e))return;CW.DropTarget._notifyTargetViewsOfEvent("_handleDragEnter",t)}else CW.DropTarget._notifyTargetViewsOfEvent("_handleDragExit"
,e)}else CW.DropTarget._notifyTargetViewsOfEvent("_handleDragExit",e)},drop:function(e){if(CW.DropTarget.eliminateDoubleDrops){if(CW.DropTarget._droppedRecently)return;CW.DropTarget._droppedRecently=YES,setTimeout(function(){CW.DropTarget._droppedRecently=undefined},1e3)}var t=CW.DropTarget._notifyTargetViewsOfEvent("_handleDrop",e);t||CW.DropTarget._dragEndedOnDropTargets(e)}}),CW.DropTarget.dealWithSafariWindows=function(){return SC.browser.isWindows&&SC.browser.isSafari?(CW.Alert.show({message:"CW.DropTarget.SafariWindowsNotSupported.Title".loc(),description:"CW.DropTarget.SafariWindowsNotSupported.Description".loc()}),YES):NO},CW.Alert=SC.PanelPane.extend({message:"",classNameBindings:["readyToShow:animate-show","notReadyToShow:before-animate-show","isCompact:compact"],readyToShow:YES,notReadyToShow:function(){return!this.get("readyToShow")}.property("readyToShow").cacheable(),messageViewPaddingBottom:7,description:null,descriptionViewPadding:{top:0,bottom:4},descriptionViewMinHeight:9,caption:null,captionViewPadding:{top:4,bottom:7},captionViewMinHeight:0,image:"icon-icloud",rightButton:"OK",middleButton:null,leftButton:null,extraView:null,extraViewPadding:{top:12,bottom:3},extraViewMinHeight:0,escapeHTML:NO,layout:{centerX:0,width:450,centerY:-10,height:181},isCompact:NO,originalLayout:null,classNames:["cw-alert"],ariaRole:"alertdialog",init:function(){this.get("pane").set("readyToShow",NO),this.get("extraWide")&&this.adjust("width",500),arguments.callee.base.apply(this,arguments)},modalPane:SC.ModalPane.extend(CW.Animatability,CW.PaneFadingSupport,{classNames:"cw-modal"
.w(),paneFadeInDuration:350,paneFadeOutDuration:function(){return this.get("paneFadeInDuration")}.property(),paneOpacity:1,init:function(){arguments.callee.base.apply(this,arguments);var e=SC.RootResponder.responder.mainPane;if(e){var t=e.layout.minWidth,n=e.layout.minHeight;t&&this.adjust("minWidth",t),n&&this.adjust("minHeight",n)}}}),contentView:SC.View.design({layout:{left:0,right:0,top:0,bottom:0},escapeHTMLBinding:"*parentView.escapeHTML",separatorView:SC.View.design({layout:{height:1,right:0,left:0,bottom:52},classNames:["separator"]}),createChildViews:function(){SC.Binding.flushPendingChanges();var e=this.get("escapeHTML"),t=this.get("pane"),n=t.get("message"),r=t.get("description"),i=t.get("caption"),s=t.get("image"),o=t.get("extraView"),u=t.get("rightButton"),a=t.get("middleButton"),f=t.get("leftButton"),l=t.get("isCompact"),c=this.childViews,h=CW.Alert,p="Trying to create a CW.Alert with a %@ button that is neither a string, nor a button view.",d,v,m,g,y,b,w;return s&&(SC.typeOf(s)===SC.T_STRING?this.iconView=h.IconView.extend({classNames:s.w()}):s.value?this.iconView=h.IconView.extend({classNames:s.value.w()}):CW.fatalError("Trying to create a CW.Alert with improper an invalid image hash."),c.push("iconView")),n||CW.fatalError("Trying to create a CW.Alert without a message."),this.messageView=h.MessageView.extend({value:n,escapeHTML:e}),c.push("messageView"),r&&(this.descriptionView=h.DescriptionView.extend({value:r,escapeHTML:e}),c.push("descriptionView")),i&&(this.captionView=h.CaptionView.extend({value:i,escapeHTML:e}),c.push("captionView")),o&&(this.extraView=
o,c.push("extraView")),f&&(SC.typeOf(f)===SC.T_STRING?d={title:f,action:"remove",target:t}:SC.typeOf(f)===SC.T_HASH?d=f:CW.fatalError(p.fmt("left")),this.leftButtonView=h.LeftButtonView.extend(d),c.push("separatorView"),c.push("leftButtonView")),a&&(SC.typeOf(a)===SC.T_STRING?(v=a,m="remove",g=t):SC.typeOf(a)===SC.T_HASH?(v=a.title?a.title:"Cancel",m=a.action?a.action:null,g=a.target?a.target:t):CW.fatalError(p.fmt("middle"))),u||CW.fatalError("Trying to create a CW.Alert without a right button."),SC.typeOf(u)===SC.T_STRING?(y=u,b="remove",w=t):SC.typeOf(u)===SC.T_HASH?(y=u.title?u.title:"OK",b=u.action?u.action:null,w=u.target?u.target:t):CW.fatalError(p.fmt("right")),this.mainButtonsView=h.MainButtonsView.extend({middleButtonIsVisible:a?YES:NO,middleButtonTitle:v,middleButtonAction:m,middleButtonTarget:g,rightButtonTitle:y,rightButtonAction:b,rightButtonTarget:w}),c.push("mainButtonsView"),arguments.callee.base.apply(this,arguments)},extraViewFrameDidChange:function(){if(this._resizingExtraView){this._resizingExtraView=NO;return}this.performLayout()},didCreateLayer:function(){var e=this.get("pane"),t=this.get("extraView");t&&t.isAutoResizingExtraView&&t.addObserver("frame",this,this.extraViewFrameDidChange);var n=this;requestAnimationFrame(function(){SC.run(function(){n.performLayout()})})},performLayout:function(){var e=this.get("pane"),t=this.messageView,n=this.descriptionView,r=e.get("descriptionViewMinHeight")||0,i=this.captionView,s=e.get("captionViewMinHeight")||0,o=this.extraView,u=e.get("extraViewMinHeight")||0,a=this.iconView,f=e.get("image"),l=t.getPath("layout.top"
),c=e.get("isCompact"),h=c?25:106,p=this.mainButtonsView,d=CW.Alert,v=d.MIN_ALERT_HEIGHT,m=e.getPath("layout.maxHeight"),g,y,b,w=0,E,S,x,T,N,C,k,L,A;a&&a.set("isVisible",c?NO:YES),t&&t.adjust("left",h),n&&n.adjust("left",h),i&&i.adjust("left",h),o&&o.adjust("left",h),e.set("ariaLabelledBy",SC.guidFor(t)),e.set("ariaDescribedBy",SC.guidFor(n)),g=t.get("value"),y=t.get("layer"),S=t.get("frame").width+"px",y.style.maxWidth=S,b=SC.metricsForString(g,y,null,!this.get("escapeHTML")).height,t.adjust("height",b),l+=b,A=e.get("messageViewPaddingBottom"),A&&(l+=A),n?(k=e.get("descriptionViewPadding"),k&&(L=k.top)&&(l+=L),n.adjust("top",l),g=n.get("value"),y=n.get("layer"),y.style.maxWidth=S,b=SC.metricsForString(g,y,null,!this.get("escapeHTML")).height,b<r&&(b=r),n.adjust("height",b),l+=b,k&&(A=k.bottom)&&(l+=A)):l+=r,i?(k=i.get("padding"),k&&(L=k.top)&&(l+=L),i.adjust("top",l),g=i.get("value"),y=i.get("layer"),y.style.maxWidth=S,b=SC.metricsForString(g,y,null,!this.get("escapeHTML")).height,b<s&&(b=s),i.adjust("height",b),l+=b,k&&(A=k.bottom)&&(l+=A)):l+=s,o?(this._resizingExtraView=YES,k=e.get("extraViewPadding"),k&&(L=k.top)&&(l+=L),o.adjust("top",l),b=undefined,o.isAutoResizingExtraView&&(b=o.computeHeight()),SC.none(b)&&(b=o.get("frame").height),SC.none(b)&&CW.fatalError("Trying to create a CW.Alert with an extraView which does not have its height specified."),b<u&&(b=u),l+=b,k&&(A=k.bottom)&&(l+=A)):l+=u;if(a){var w=f.width,b=f.height;w&&b&&(a.adjust("width",w),a.adjust("height",b))}l+=c?d.BUTTONS_AND_SEPARATOR_COMPACT_HEIGHT:d.BUTTONS_AND_SEPARATOR_HEIGHT,l<v&&(l=v),l>m&&(l=m),
x=p.middleButton,T=p.rightButton,this.leftButtonView&&(C=this.leftButtonView.get("frame"),C&&(w=C.width)),x&&(C=x.get("frame"),C&&(w+=C.width)),T&&(C=T.get("frame"),C&&(w+=C.width)),e.adjust("height",l),N=d.BUTTONS_REGULAR_PADDING+d.BUTTONS_MIN_PADDING_MIDDLE_AND_LEFT+d.BUTTONS_SIDE_PADDING*2,w+N>e.get("frame").width&&!c&&e.adjust("width",w+N),this._resizingExtraView=NO,e.set("readyToShow",YES);var O=this.$(".def");O&&O.length&&setTimeout(function(){O[0].focus()},500)},isAlertCompactChanged:function(){this.get("isVisibleInWindow")&&this.performLayout()}.observes("pane.isCompact")})}),CW.Alert.BUTTONS_REGULAR_PADDING=8,CW.Alert.BUTTONS_MIN_PADDING_MIDDLE_AND_LEFT=15,CW.Alert.BUTTONS_SIDE_PADDING=20,CW.Alert.BUTTONS_AND_SEPARATOR_HEIGHT=70,CW.Alert.BUTTONS_AND_SEPARATOR_COMPACT_HEIGHT=60,CW.Alert.MIN_ALERT_HEIGHT=112,CW.Alert.MessageView=SC.LabelView.extend({layout:{left:106,top:25,right:25},classNames:["title-label"],controlSize:SC.LARGE_CONTROL_SIZE,ariaRole:"heading"}),CW.Alert.DescriptionView=SC.LabelView.extend({layout:{left:106,right:25},classNames:["description"]}),CW.Alert.CaptionView=SC.LabelView.extend({layout:{left:106,right:25},classNames:["caption"]}),CW.Alert.IconView=SC.View.extend({layout:{left:25,top:19,width:68,height:68},classNames:["cw-alert-image-view"]}),CW.Alert.MainButtonsView=SC.View.extend({layout:{height:44,bottom:4,right:0,left:0},classNames:["text-align-right"],childViews:["middleButton","rightButton"],middleButtonIsVisible:YES,middleButtonTitle:"Cancel",middleButtonAction:null,middleButtonTarget:null,rightButtonTitle:"Ok",rightButtonAction:null,rightButtonTarget
:null,init:function(){arguments.callee.base.apply(this,arguments),this.middleButton.set("title",this.middleButtonTitle),this.middleButton.set("isVisible",this.middleButtonIsVisible),this.middleButton.set("action",this.middleButtonAction),this.middleButton.set("target",this.middleButtonTarget),this.rightButton.set("title",this.rightButtonTitle),this.rightButton.set("action",this.rightButtonAction),this.rightButton.set("target",this.rightButtonTarget)},middleButton:SC.ButtonView.extend({isCancel:YES,themeName:"borderless",classNames:["middle-button","bar-after","button-in-between"],useStaticLayout:YES,layout:{left:0,top:0,width:"auto",bottom:0}}),rightButton:SC.ButtonView.extend({isDefault:YES,themeName:"borderless",classNames:["right-button","button-aligned-right"],useStaticLayout:YES,layout:{left:0,top:0,width:"auto",bottom:0},render:function(e){return e.attr("tabindex","0"),arguments.callee.base.apply(this,arguments)}})}),CW.Alert.LeftButtonView=SC.ButtonView.extend({useStaticLayout:YES,title:"Other...",themeName:"borderless",classNames:["left-button","button-aligned-left"],textAlign:SC.ALIGN_LEFT,layout:{height:44,left:0,bottom:4,width:"auto"}}),CW.Alert.ExtraViewAutoResizingSupport={isAutoResizingExtraView:YES,computeHeight:function(){var e=this.get("autoResizeLayer")||this.get("layer"),t=this.getPath("frame.width"),n=this.get("autoResizeText")||"",r=this.get("autoResizePadding")||0,i;return SC.none(e)||SC.empty(n)?0:(e.style.maxWidth=t+"px",i=SC.metricsForString(n,e,this.get("classNames"),!this.get("escapeHTML")),i.height+r)}},CW.Alert.show=function(e){if(SC.typeOf(e)===
SC.T_HASH){var t=this.create(e);return t.append(),t}return CW.fatalError("Attempted to show a CW.Alert without options."),null},CW.ErrorPicker=SC.PickerPane.extend({layout:{left:0,top:0,height:20,right:0,minWidth:36},classNames:["error-picker"],errorText:"Please fill in required info",escapeHTML:YES,pointerOffset:[10,20,-17,19],preferType:SC.PICKER_POINTER,acceptsKeyPane:NO,acceptsFirstResponder:NO,isModal:NO,contentView:SC.LabelView.extend(SC.AutoResize,{displayProperties:["value"],layout:{bottom:0,top:0,minWidth:36,centerX:0},classNames:["error-picker-label"],valueBinding:"*parentView.errorText",escapeHTMLBinding:"*parentView.escapeHTML",textAlign:SC.ALIGN_CENTER,measuredSizeDidChange:function(e){e();var t=this.get("measuredSize"),n=this.get("calculatedWidth")||t.width,r=this.get("calculatedHeight")||t.height,i=this.get("parentView");i.adjust({width:n+20,height:r}).updateLayout(),i.positionPane()}.enhance()}),preferMatrix:[2,3,2,2,2],render:function(e,t){var n=this.get("pointerPos");if(e.needsContent)this.renderChildViews(e,t),e.push("<div class='top-left-edge'></div>","<div class='top-edge'></div>","<div class='top-right-edge'></div>"),n.indexOf(SC.POINTER_LAYOUT[2])!==-1?e.push('<div class="top-middle-edge" style="margin-top: '+this.get("pointerPosY")+'px"></div>'):n.indexOf(SC.POINTER_LAYOUT[3])!==-1&&e.push('<div class="bottom-middle-edge" style="margin-top: '+this.get("pointerPosY")+'px"></div>');else{var r=this.$(".sc-pointer");n===SC.POINTER_LAYOUT[2]?(r.attr("class","top-middle-edge"),r.attr("style","margin-top: "+this.get("pointerPosY")+"px")):n===SC.POINTER_LAYOUT
[3]&&(r.attr("class","bottom-middle-edge"),r.attr("style","margin-top: "+this.get("pointerPosY")+"px"))}e.addClass(n)}}),CW.ErrorPicker.showError=function(e,t){var n=this.create({errorText:t});return n.popup(e,SC.PICKER_POINTER),n},CW.DetailsDisclosureView=SC.View.extend(CW.Alert.ExtraViewAutoResizingSupport,{layout:{left:106,right:25},contentView:SC.TextFieldView.design({layout:{height:90},isVisible:NO}),caption:null,isExpanded:NO,disclosureTitle:"Details",verticalPadding:15,classNames:["cw-details"],childViews:["contentView","disclosureButtonView"],disclosureButtonView:SC.DisclosureView.design({valueBinding:"*owner.isExpanded",titleBinding:"*owner.disclosureTitle",layout:{height:30},controlSize:SC.LARGE_CONTROL_SIZE}),init:function(){arguments.callee.base.apply(this,arguments);var e=this.get("contentView");e&&e.set("isVisible",this.get("isExpanded"))},_isExpandedDidChange:function(){var e=this.get("isExpanded"),t=this.get("captionView"),n=t?t.getPath("frame.height"):undefined,r=this.get("contentView"),i=r.getPath("frame.height")+this.get("verticalPadding"),s=this.getPath("frame.height");e?(r.set("isVisible",YES),t&&t.adjust("top",n+i),this.adjust("height",s+i)):(r.set("isVisible",NO),t&&t.adjust("top",n-i),this.adjust("height",s-i))}.observes("isExpanded"),createChildViews:function(){var e=this.get("caption");return e&&(this.captionView=CW.DetailsDisclosureView.CaptionView.extend({value:e}),this.childViews.push("captionView")),arguments.callee.base.apply(this,arguments)},computeHeight:function(){var e=this.get("disclosureButtonView"),t=this.get("contentView"),n=this.get("captionView"
),r=this.get("isExpanded"),i=e.getPath("frame.height"),s=this.getPath("pane.isCompact"),o,u;t.adjust("top",i),r?i+=t.getPath("frame.height")+(s?0:22):i+=5;if(n)if(!s||!r){var a=n.get("value");n.adjust("top",i),u=n.get("layer"),u.style.maxWidth=n.getPath("frame.width")+"px",o=SC.metricsForString(a,u,"",YES).height,n.adjust("height",o),i+=o,n.set("isVisible",YES)}else n.set("isVisible",NO);return this.adjust("height",i),i}}),CW.DetailsDisclosureView.CaptionView=SC.LabelView.design({escapeHTML:NO,classNames:["cw-caption"],layout:{top:0,left:0,right:0,height:0}}),CW.ScrollerView=SC.ScrollerView.extend({hasButtons:NO,capLength:0,capOverlap:-2,buttonLength:0,buttonOverlap:-2,scrollbarThickness:9,minimumThumbLength:32,hoveredScroll:!1,isVisibleDidChange:function(){if(!this.get("isVisible"))return}.observes("isVisible"),mouseDown:function(){return this._MouseDown=YES,arguments.callee.base.apply(this,arguments)},mouseUp:function(){return this._MouseDown=NO,this.set("hoveredScroll",!1),arguments.callee.base.apply(this,arguments)},mouseEntered:function(){this.set("hoveredScroll",!0)},mouseExited:function(){this._MouseDown||this.set("hoveredScroll",!1)}}),SC.mixin(SC.ScrollView.prototype,{horizontalScrollerView:CW.ScrollerView,verticalScrollerView:CW.ScrollerView}),CW.FadingCaplessScrollerView=CW.ScrollerView.extend({hasButtons:NO,classNames:"sc-fading-capless-scroller-view".w(),capLength:0,capOverlap:-2,buttonLength:0,buttonOverlap:-2,scrollbarThickness:10,minimumThumbLength:32,isVisibleDidChange:function(){if(!this.get("isVisible"))return;this.$(".sc-scroller-view").addClass("sc-fading-capless-scroller-view-invisible"
)}.observes("isVisible")}),CW.FadingCaplessScrollerViewSupport={_thumbHidden:NO,didCreateLayer:function(e){this.$(".sc-scroller-view").addClass("sc-fading-capless-scroller-view-invisible"),this._thumbHidden=YES,e()}.enhance(),verticalOverlay:YES,horizontalOverlay:YES,mouseExited:function(){if(this._thumbHidden)return;var e=this.get("verticalScrollerView"),t=this.get("horizontalScrollerView");if(e&&!e._thumbDragging||t&&!t._thumbDragging)this.$(".sc-scroller-view").addClass("sc-fading-capless-scroller-view-invisible"),this._thumbHidden=YES},mouseMoved:function(){if(!this._thumbHidden)return;this._thumbView||(this._thumbView=this.$(".thumb")),this.$(".sc-scroller-view").removeClass("sc-fading-capless-scroller-view-invisible"),this._thumbHidden=NO}},CW.ImageMapView=SC.View.extend({classNames:["me-image-map-view"],regions:[],regionCoordinatesKey:"coordinates",regionTargetKey:"target",regionActionKey:"action",hoveredRegion:null,selectedRegion:null,mouseDown:function(e){var t,n;return t=this.convertFrameFromView({x:e.pageX,y:e.pageY}),n=this.regionForPoint(t),n?(this._mouseDownRegion=n,YES):NO},touchStart:function(e){return this.mouseDown(e)},mouseUp:function(e){var t,n,r,i,s;return t=this.convertFrameFromView({x:e.pageX,y:e.pageY}),n=this.regionForPoint(t),n?(i=SC.get(n,"regionActionKey"),r=SC.get(n,"regionTargetKey")||null,r&&(s=this.getPath("pane.rootResponder"),s&&s.sendAction(i,r,this,this.get("pane"),{region:n,coords:t})),this.setIfChanged("selectedRegion",n),YES):NO},touchEnd:function(e){return this.set("hoveredRegion",null),this.mouseUp(e)},mouseMoved:function(e){var t=this
.convertFrameFromView({x:e.pageX,y:e.pageY});this.setIfChanged("hoveredRegion",this.regionForPoint(t))},touchesDragged:function(e){this.mouseMoved(e)},mouseExited:function(e){this.set("hoveredRegion",null)},regionForPoint:function(e){var t=this.get("regions"),n=0,r=t.get("length"),i,s=this.get("regionCoordinatesKey");this._coordinatesCache=this._coordinatesCache||[];for(;n<r;n++){i=t[n].get?t[n].get(s):t[n][s],SC.typeOf(i)===SC.T_STRING&&(this._coordinatesCache[n]?i=this._coordinatesCache[n]:i=this._coordinatesCache[n]=this._coordinateObjectForString(i));if(this._pointInPoly(e,i))return t[n]}return null},_pointInPoly:function(e,t){var n=t.length,r=e.x,i=e.y,s,o=n-1,u=NO;for(s=0;s<n;s++)(t[s][1]<i&&t[o][1]>=i||t[o][1]<i&&t[s][1]>=i)&&t[s][0]+(i-t[s][1])/(t[o][1]-t[s][1])*(t[o][0]-t[s][0])<r&&(u=!u),o=s;return u},_coordinateObjectForString:function(e){var t=e.split(","),n=0,r=t.length,i=[];if(r%2!==0){var s=SC.Error.desc("SC.ImageMapView: Unable to parse coordinates string because there were an odd number of values.");throw console.error(s.toString()),s}for(;n<r;n+=2)i.push([parseInt(t[n],10),parseInt(t[n+1],10)]);return i}}),CW.MiniFadingCaplessScrollerView=CW.FadingCaplessScrollerView.extend({minimumThumbLength:16,classNames:"sc-mini-fading-capless-scroller-view".w()}),CW.MiniFadingCaplessScrollerViewSupport=CW.FadingCaplessScrollerViewSupport,CW.SpinnerView=SC.View.extend({layout:{left:0,top:0},frequency:1.5,size:NaN,assetFrameCount:NaN,assetIsAlways2x:NO,asset:"/system/cloudos/16GHotfix7/coreweb/views/16GHotfix7/en-us/source/resources/images/spinner.png",innerElement:null,
innerClassNames:null,init:function(){return this.innerClassNames&&(this.innerElement||(this.innerElement=document.createElement("div")),this.innerElement.className+=" "+this.innerClassNames.join(" ")),this.innerElement&&(this.assetIsAlways2x=NO),arguments.callee.base.apply(this,arguments)},didCreateLayer:function(){var e=this.get("layer"),t=this;if(!e)return;var n=this.get("innerElement");n?(n.style.right=n.style.bottom="",this.invokeOnce("fillInUnknownValuesUsingInnerElement")):(this.set("innerElement",n=new Image),n.onload=function(){this.style.display="",t.invokeOnce("fillInUnknownValuesUsingInnerElement")},n._isAutomaticImage=YES,n.style.display="none",n.src=this.get("asset")),n.parentNode&&n.parentNode!==e&&n.parentNode.removeChild(n),n.parentNode||e.appendChild(n),n.style.position="absolute",n.style.left=n.style.top="0px"},fillInUnknownValuesUsingInnerElement:function(){var e=this.get("layer");if(!e)return;this._imageLoaded=YES;var t=this.get("innerElement"),n=this.get("assetIsAlways2x")?2:window.devicePixelRatio||1,r=t._isAutomaticImage?t.width:t.offsetWidth||parseInt(CW.Anim.getStyle(t,"width"),10),i=t._isAutomaticImage?t.height:t.offsetHeight||parseInt(CW.Anim.getStyle(t,"height"),10),s=this.get("assetFrameCount"),o=this.get("size");isNaN(s)&&this.set("assetFrameCount",s=Math.round(i/r)),isNaN(o)&&this.set("size",o=Math.round(r/n)),this.renderSize(),this._startStopSpin(),SC.browser.isIE8OrLower&&s===3&&SC.warn("Warning: IE8 cannot use three-framed spinner images, because it cannot rotate. Please provide a 12-framed spinner for IE8."),s!==3&&s!==12&&SC.warn("Warning: CW.SpinnerView:"+
SC.guidFor(this)+" has an invalid assetFrameCount of "+s+". It must resolve to either 3 or 12 instead. Unpredictable rendering may occur.")},_startStopSpin:function(){var e=this.get("layout"),t=this.get("isVisibleInWindow")&&this._imageLoaded&&(SC.none(e.opacity)||e.opacity>0);t?this._startSpin():this._stopSpin()}.observes("isVisibleInWindow","layout"),_renderSizeObserver:function(){this.renderSize()}.observes("size"),renderSize:function(e,t,n,r){e||(e=this.get("size")),t||(t=this.get("assetFrameCount")),n||(n=this.get("innerElement"));if(isNaN(e))return;r?r.style.width=r.style.height=e+"px":this.adjust({width:e,height:e}),n.style.width=e+"px",n.style.height=e*t+"px",r||this.renderPosition()},_startSpin:function(){if(this._interval)return;var e=this;this._interval=setInterval(function(){e._rotateStep()},1e3/this.get("frequency")/12)},_stopSpin:function(){if(!this._interval)return;clearInterval(this._interval),this._interval=null},_rotateStep:function(){this._pos=((this._pos||0)+1)%12,this.renderPosition()},renderPosition:function(e,t,n,r){e===undefined&&(e=this._pos||0),t||(t=this.get("size")||0),n||(n=this.get("assetFrameCount"));var i=(r||this.get("innerElement")).style,s=e%n,o,u,a,f,l;if(n===12){i.top=-t*s+"px";return}o=Math.floor(e/3),f=o%2!==0,l=Math.floor(o/2)===1?1:-1,u=f?t*-l*s+l*t:0,a=(f?0:t*l*s)-(o!==0?t:0)-(o===2?t:0),i[SC.platform.domCSSPrefix+"Transform"]=i.transform="translateX("+u+"px) translateY("+a+"px) rotate("+o*90+"deg)"}}),CW.SpinnerView.renderPosition=CW.SpinnerView.prototype.renderPosition,CW.SpinnerView.renderSize=CW.SpinnerView.prototype.renderSize,SC
.stringsFor("en-us",{"Name.Display.FirstAndFamilyNames":"%{firstName} %{familyName}","Toolbar.Button.Action.Help":"Help and Support","Toolbar.Tooltip.App.Switcher":"Change App","Toolbar.Button.Action.UserAction":"iCloud Settings & Sign Out"}),CK=SC.Object.create({NAMESPACE:"CK",VERSION:"1.0.0",LOAD_REASON_USER_CLICK:1,LOAD_REASON_LOCATION_HASH:2,LOAD_REASON_APP_SWITCH:3,LOAD_REASON_NOTIFICATION:4,LOAD_REASON_RELOAD:5,LOAD_REASON_SHARE_ACCEPTED:6,LOAD_REASON_APP_REPLACED:7,EXIT_NON_FATAL:0,EXIT_FATAL_ERROR:1,EXIT_STARTUP_ERROR:2,EXIT_PCS_MISSING:3,EXIT_PCS_INVALID:4,RPC_RESPONSE:"RPC_RESPONSE",currentApplication:null,isLoadedByCloudOS:!!CW.getUrlParameters().isLoadedByCloudOS,isReloading:NO,isWWW:window.location.hostname==="www.icloud.com"?YES:NO,isBeta:window.location.hostname==="beta.icloud.com"?YES:NO,isFuture:window.location.hostname==="future.icloud.com"?YES:NO,isCarry:window.location.hostname==="carry.icloud.com"?YES:NO,initiatedCloudKitJSLoading:!1,init:function(){SC.ready(function(){CK.redirectToCloudOSIfNeeded()})},redirectToCloudOSIfNeeded:function(){if(!CK.currentApplication)return;var e=window.location.pathname,t;window===window.top&&SC.buildMode==="production"&&e!=="/"&&(t=e.match(/\/applications\/(.*?)\//),t&&t[1]&&(window.location="https://"+window.location.hostname+"/#"+t[1]))},queryParamsToOmitForStartupCaching:["clientId","clientBuildNumber","clientMasteringNumber"],startupUrlsAreEqual:function(e,t){return this.removeQueryParamsToOmitForStartupCaching(e)===this.removeQueryParamsToOmitForStartupCaching(t)},removeQueryParamsToOmitForStartupCaching:function(e){
if(!e)return e;var t=URI(e),n=CK.queryParamsToOmitForStartupCaching,r,i;for(r=0,i=n.length;r<i;r++)t.removeSearch(n[r]);return t.toString()},reloadWithReason:function(e,t){CK.setValueInSessionStorage("reloadReason",e),window.COS&&COS.authController.get("environment")!=="PROD"&&CK.setValueInSessionStorage("preReloadLogMessages",SC.Logger.stringifyRecordedLogMessages());var n=!1;n&&CW.getUrlParameters().debugReloads?SC.error("\n\n\n\nReloaded for reason: "+e+"\n\n\n\n"):(t?window.location=t:window.location.reload(),CK.set("isReloading",YES))},getValidateToken:function(){return CK.readCookie("X-APPLE-WEBAUTH-VALIDATE")},carryPartitions:["p97","p98"],isURLInCarryPartition:function(e){var t,n;return e?(t=URI.parse(e).hostname,t?(n=t.split("-")[0],this.get("carryPartitions").indexOf(n)!==-1):NO):NO},loadCloudKitJS:function(e){var t=this.get("initiatedCloudKitJSLoading");if(!window.CloudKit&&!t){var n=e?e:window.VERSIONS.cloudkitjs,r=CK.isCarry,i="https://",s="cdn.apple-cloudkit.com";r&&(s="carry.icloud.com");var o="/ck/"+n+"/cloudkit.js",u=i+s+o,a=document.createElement("script");a.onerror=a.onabort=function(){var e=window.document.createEvent("Event");e.initEvent("cloudkitloadfailure",!0,!0),window.document.dispatchEvent(e)},a.setAttribute("src",u),document.head.appendChild(a),this.set("initiatedCloudKitJSLoading",!0)}}}),function(){var e=window.parent,t=e;if(e&&window!==e&&e.postMessage){var n=e.parent;n&&e!==n&&n.postMessage&&(t=n);var r=window.location.pathname.match(/(?:\/applications)?\/(.*?)\/current/)[1],i=function(e){t.postMessage(JSON.stringify({isCloudOSMessage:!0,methodName
:"recordApplicationMessage",appName:r,args:e}),"*")};window.onerror=function(e,t,n,r,s){console.warn("onerror exception: "+e+" Script: "+t+" Line: "+n);var o={applicationBuildNumber:SC.buildNumber,applicationMasteringNumber:SC.masteringNumber,error:e,url:t,lineNumber:n,stack:s?s.stack:"not available"};i(["OnErrorException",o])},i(["OnErrorExceptionHandlerWasConfigured"])}}(),CK.AuthenticationStateEnum={NOT_AUTHENTICATED:0,PARTIALLY_AUTHENTICATED_HSA:1,AUTHENTICATED:2,PARTIALLY_AUTHENTICATED_MANAGED_APPLE_ID:3},CK.mixin({getCurrentLocaleInISOFormat:function(){var e=String.preferredLanguage,t=null;return e&&(t=e.substr(0,2).toLowerCase()+"_"+e.substr(3,5).toUpperCase()),t},userLocalPreferenceIsCJK:function(){var e=["ja-jp","zh-cn","zh-tw","ko-kr"],t=String.preferredLanguage;return e.contains(t)}.property("String.preferredLanguage").cacheable(),computeBestAvailableLocale:function(e,t){var n=function(e,t){var n=t;for(;;){if(e.indexOf(n)>-1)return n;var r=n.lastIndexOf("-");if(r<0)return;r>=2&&n.charAt(r-2)=="-"&&(r-=2),n=n.substring(0,r)}},r=function(e){return e.replace(/_/g,"-").toLowerCase()},i=r(t),s=CK.SUPPLEMENTARY_LOCALE_DATA.likelySubtags;for(var o in s){var u=r(o);if(i===u){i=r(s[o]);break}}var a=CK.SUPPLEMENTARY_LOCALE_DATA.metadata.alias.languageAlias;for(var f in a){var l=r(f);i.indexOf(l)===0&&(i=a[f]._replacement+i.substr(l.length))}var c=e.map(r),h=n(c,i);if(h===undefined)return;var p=e[c.indexOf(h)];return p},displayNameFor:function(e,t,n,r,i){var s;return e&&t?CW.stringIsCJK(e)&&CW.stringIsCJK(t)?s=t+e:s="Name.Display.FirstAndFamilyNames".loc({firstName:e,familyName
:t}):e?s=e:t?s=t:r?s=r:i&&(s=i),s||(s=n||""),s},redirectTo:function(e){window.location.href=e},readCookie:function(e,t){var n=document.cookie,r,i,s;if(n.length>0){t&&(s=n.match(new RegExp("("+e+")=")),s&&(e=s[1])),r=n.indexOf(e+"=");if(r!==-1)return r=r+e.length+1,i=n.indexOf(";",r),i===-1&&(i=n.length),window.unescape(n.substring(r,i))}return null},writeCookie:function(e,t,n,r,i,s){var o,u,a;if(!e)return undefined;if(t===undefined||t===null)t="",u="expires=Thu, 01-Jan-1970 00:00:01 GMT;";return i&&(a=i*1e3*60*60,u="expires="+(new Date((new Date).getTime()+a)).toGMTString()),s&&(u+=";Secure"),n||(n="/"),r||(r="."+window.location.hostname),o=document.cookie=e+"="+t+";path="+n+";domain="+r+";"+u,o||SC.info('Not able to set cookie "%@" with "%@"',e,t),o},formatNumberWithLocale:function(e){return CW.formatNumber(e,"Numbers.ThousandsSeparator".loc(),"Numbers.DecimalSeparator".loc())},getLegacyLprojNameForLocale:function(e){var t={"en-us":"English","ja-jp":"Japanese","fr-fr":"French","de-de":"German","es-es":"Spanish","zh-cn":"zh_CN","nl-nl":"Dutch","it-it":"Italian","ko-kr":"ko","zh-tw":"zh_TW","pt-pt":"pt_PT","pt-br":"pt","sv-se":"sv","pl-pl":"pl","cs-cz":"cs","da-dk":"da","hu-hu":"hu","no-no":"no","fi-fi":"fi","tr-tr":"tr","ru-ru":"ru","uk-ua":"uk"},n=t[e];return n||(n="English"),n+".lproj"},hasLocalizedStringForKey:function(e){return e&&e.loc()!==e?YES:NO},persistAfterLogoutSuffix:".persist",getValueFromSessionStorage:function(e){return this._getValueFromStorage("sessionStorage",e)},setValueInSessionStorage:function(e,t){return this._setValueInStorage("sessionStorage",e,t)},removeValueInSessionStorage
:function(e){return this._removeValueInStorage("sessionStorage",e)},getKeysInSessionStorage:function(){return this._getKeysInStorage("sessionStorage")},clearSessionStorage:function(){return this._clearStorage("sessionStorage")},getValueFromLocalStorage:function(e,t){return this._getValueFromStorage("localStorage",e,t)},setValueInLocalStorage:function(e,t,n){return this._setValueInStorage("localStorage",e,t,n)},removeValueInLocalStorage:function(e,t){return t&&(e+=this.get("persistAfterLogoutSuffix")),this._removeValueInStorage("localStorage",e)},getKeysInLocalStorage:function(){return this._getKeysInStorage("localStorage")},clearLocalStorage:function(){return this._clearStorage("localStorage",YES)},_getStorageObject:function(e){try{return window[e]}catch(t){SC.warn("Could not get storage object for %@: %@",e,t)}},_getValueFromStorage:function(e,t,n){var r=null,i=this._getStorageObject(e),s,o;return i&&i.getItem&&(o=CK.currentApplication,s=o?o.get("name"):"iCloud",s&&(t=s+"."+t),n&&(t+=this.get("persistAfterLogoutSuffix")),r=i.getItem(t)),r},_setValueInStorage:function(e,t,n,r){var i=NO,s=this._getStorageObject(e),o,u;if(s&&s.setItem){u=CK.currentApplication,o=u?u.get("name"):"iCloud",o&&(t=o+"."+t),r&&(t+=this.get("persistAfterLogoutSuffix"));try{s.setItem(t,n),i=YES}catch(a){}}return i},_getKeysInStorage:function(e){var t=[],n=this._getStorageObject(e),r,i,s,o;if(n){r=CK.currentApplication,i=r?r.get("name"):"iCloud",i&&(i+="."),s=i?i.length:0;for(o in n)o.indexOf(i)===0&&t.push(o.substring(s))}return t},_removeValueInStorage:function(e,t){var n=NO,r=this._getStorageObject(e
),i,s;if(r&&r.removeItem){s=CK.currentApplication,i=s?s.get("name"):"iCloud",i&&(t=i+"."+t);try{r.removeItem(t),n=YES}catch(o){}}return n},_clearStorage:function(e,t){var n=YES,r=this._getStorageObject(e),i,s,o,u,a,f,l;if(r&&t)try{i={},s=this.get("persistAfterLogoutSuffix"),o=s.length;for(u=0,a=r.length;u<a;++u){try{f=r.key(u),l=f.indexOf(s),l!==-1&&l===f.length-o&&(i[f]=r.getItem(f))}catch(c){}r.length!==a&&(i={},u=-1,a=r.length)}}catch(h){}if(r)if(!r.clear)n=NO;else try{r.clear()}catch(p){n=NO}if(t)try{for(f in i)r.setItem(f,i[f])}catch(d){}return n}}),CK.servicesController=SC.Object.create({getServiceInf
@lfcharger72000
Copy link
Author

My account has been hacked. Can anyone help me make sense of this so i can forward this on. I know who is doing the hacking but i can't prove anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment