HiddenEye-Legacy/WebPages/iCloud/index_files/javascript-packed.js.download
Usama Abdul Sattar 93bfe138e5
fix all 404s
2018-07-14 10:05:55 +05:00

1095 lines
1.6 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @license Portions of this software are copyright Yahoo, Inc, used under the following license:
* Software License Agreement (BSD License)
* Copyright (c) 2009, Yahoo! Inc.
* All rights reserved.
* Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Yahoo! Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Yahoo! Inc.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Sources of Intellectual Property Included in the YUI Library
* Where not otherwise indicated, all YUI content is authored by Yahoo! engineers and consists of Yahoo!-owned intellectual property. YUI is issued by Yahoo! under the BSD license above. In some specific instances, YUI will incorporate work done by developers outside of Yahoo! with their express permission.
*/
/*!
* jQuery JavaScript Library v1.8.3
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time)
*/
/** @license
* ==========================================================================
* SproutCore -- JavaScript Application Framework
* Copyright ©2008-2011 Apple Inc. All rights reserved.
* Copyright 2006-2011, Strobe Inc. and contributors.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* SproutCore and the SproutCore logo are trademarks of Strobe Inc.
*
* For more information about SproutCore, visit http://www.sproutcore.com
*
* ==========================================================================
*/
/*! @license
* Raphael 1.5.2 - JavaScript Vector Library
*
* Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com)
* Licensed under the MIT (http://raphaeljs.com/license.html) license.
*/
/*! @license
* URI.js - Mutating URLs
*
* Version: 1.18.1
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Published under the MIT License http://www.opensource.org/licenses/mit-license
*
*/
/*! @license
Copyright Mathias Bynens <https://mathiasbynens.be/>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*!
* @license
*
* ]{ UUID - Ultra liteweight, blazing fast JavaScript UUID v4 generator
* https://bitbucket.org/kodifica/uuid/
*
* Copyright 2009-2010 Massimo Lombardo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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 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},getCurrentTimeForPerformance:function(){var e=window.performance;return e&&e.now?Math.round(e.now()):Date.now()}}),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=SC.getCurrentTimeForPerformance(),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;try{this._timerQueue=this._timerQueue.collectExpiredTimers(t,e),r=t.length;for(n=0;n<r;n++)t[n].fire();i=t.length>0,t.length=0}catch(s){throw t.splice(0,n+1),s}finally{this._firing=NO}return 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(SC.Observable,{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:{},language:null,isRTL:function(){return!!this.get("language"
).match(/^(ar|iw)-.*/)}.property("language").cacheable(),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(SC.Observable,{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.set("currentLocale",r.create({language:n}))),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.RTLSupport={layoutRecipe:null,init:function(e){e();if(!this._isLayoutHashEqualToDefault())throw new Error('The layout value set for "%@" is neither null nor has the default value of {top: 0, left: 0, bottom: 0, right: 0}.'.fmt(this)+"While using this mixin the layout value should not be set. Instead layoutRecipe should be used.");this.layoutDirectionDidChange()}.enhance(),layoutDirectionDidChange:function(){if(!this._isLayoutRecipeValid())throw new Error('The layoutRecipe set for "%@" is not valid. Either it is null or it has "left" and "right" values.'.fmt(this));var e=this.get("layoutRecipe"),t=this._isPreviousLayoutDirectionRTL,n=SC.Locale.currentLocale.get("isRTL");if(t!==n){var r=
SC.clone(e),i=r.start,s=r.end,o,u;n?(u=i,o=s):(o=i,u=s),delete r.start,delete r.end,o!==undefined&&(r.left=o),u!==undefined&&(r.right=u),this.set("layout",r)}this._isPreviousLayoutDirectionRTL=n}.observes("SC.Locale.currentLocale"),_isPreviousLayoutDirectionRTL:null,_isLayoutHashEqualToDefault:function(){var e=this.get("layout"),t=!0,n;if(e){var r=SC.View.prototype.layout,i={};for(n in e){if(e[n]!==r[n]){t=!1;break}i[n]=!0}if(t)for(n in r)if(!i[n]){t=!1;break}}return t},_isLayoutRecipeValid:function(){var e=this.get("layoutRecipe"),t=!0;if(e){if(e.left!==undefined||e.right!==undefined)t=!1}else t=!1;return t}},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(),enforcesBodyOverflow:NO,windowSizeDidChange
:function(e,t){return this.set("currentWindowSize",t),this.setBodyOverflowIfNeeded(),this.parentViewDidResize(),this},setBodyOverflowIfNeeded:function(e){if(!this.get("enforcesBodyOverflow"))return;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||SC.getCurrentTimeForPerformance()-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=SC.getCurrentTimeForPerformance();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&&this.get("enforcesBodyOverflow")){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"],enforcesBodyOverflow:YES}),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=SC.getCurrentTimeForPerformance()),this.events[e]=t},start:function(e,t,n,r){if(!this.enabled)return;var i=n||SC.getCurrentTimeForPerformance(),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||SC.getCurrentTimeForPerformance(),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,2e4)}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/1812Project43/sproutcore/foundation/1812Project43/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)),SC.Locale.getPath("currentLocale.isRTL")&&(t.x=t.x-t.width),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)}if(!this.preferMatrix||this.preferMatrix.length!==5){var u;this.get("preferType")===SC.PICKER_MENU_POINTER?u=[3,2,1,0,3]:SC.Locale.getPath("currentLocale.isRTL")?u=[1,0,2,3,2]:u=[0,1,2,3,2],this.set("preferMatrix",u)}},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=SC.getCurrentTimeForPerformance(),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=SC.getCurrentTimeForPerformance(),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=SC.getCurrentTimeForPerformance(),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?SC.getCurrentTimeForPerformance()-this._hotzoneStartTime>100&&(this._horizontalScrollAmount*=1.05,this._verticalScrollAmount*=1.05):(this._lastScrollableView=r,this._horizontalScrollAmount=15,this._verticalScrollAmount=15,this._hotzoneStartTime=r?SC.getCurrentTimeForPerformance():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).set("isPooled",!0),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).set("isPooled",!0)):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).set("isPooled",!0)):(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).set("isPooled",!0):this.tracking||this.invokeLater(this.beginTouchesInContent,1,t).set("isPooled",!0),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=SC.getCurrentTimeForPerformance(),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=SC.getCurrentTimeForPerformance(),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=SC.getCurrentTimeForPerformance(),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=SC.getCurrentTimeForPerformance()})},1),this.becomeFirstResponder(),YES},mouseUp:function(e){var t=SC.getCurrentTimeForPerformance(),n=this._menuRenderedTimestamp,r=this.get("instantiatedMenu"),i=SC.platform.touch,s;return n===0&&
(n=SC.getCurrentTimeForPerformance()),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 doesnt 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ëls 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,t){"use strict";typeof module=="object"&&module.exports?module.exports=t():typeof define=="function"&&define.amd?define(t):e.SecondLevelDomains=t(e)}(this,function(e){"use strict";var t=e&&e.SecondLevelDomains,n={list:{cn:" com "},has:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;var r=e.lastIndexOf(".",t-1);if(r<=0||r>=t-1)return!1;var i=n.list[e.slice(t+1)];return i?i.indexOf(" "+e.slice(r+1,t)+" ")>=0:!1},is:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;var r=e.lastIndexOf(".",t-1);if(
r>=0)return!1;var i=n.list[e.slice(t+1)];return i?i.indexOf(" "+e.slice(0,t)+" ")>=0:!1},get:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return null;var r=e.lastIndexOf(".",t-1);if(r<=0||r>=t-1)return null;var i=n.list[e.slice(t+1)];return i?i.indexOf(" "+e.slice(r+1,t)+" ")<0?null:e.slice(r+1):null},noConflict:function(){return e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return n}),function(e,t){"use strict";typeof module=="object"&&module.exports?module.exports=t(require("./punycode"),require("./IPv6"),require("./SupportedSecondLevelDomains")):typeof define=="function"&&define.amd?define(["./punycode","./IPv6","./SupportedSecondLevelDomains"],t):e.URI=t(e.punycode,e.IPv6,e.SecondLevelDomains,e)}(this,function(e,t,n,r){"use strict";function s(e,t){var n=arguments.length>=1,r=arguments.length>=2;if(this instanceof s){if(e===undefined){if(n)throw new TypeError("undefined is not a valid argument for URI");typeof location!="undefined"?e=location.href+"":e=""}if(e===null&&n)throw new TypeError("null is not a valid argument for URI");return this.href(e),t!==undefined?this.absoluteTo(t):this}return n?r?new s(e,t):new s(e):new s}function o(e){return/^[0-9]+$/.test(e)}function f(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function l(e){return e===undefined?"Undefined":String(Object.prototype.toString.call(e)).slice(8,-1)}function c(e){return l(e)==="Array"}function h(e,t){var n={},r,i;if(l(t)==="RegExp")n=null;else if(c(t))for(r=0,i=t.length;r<i;r++)n[t[r]]=!0;else n[t]=!0;for(r=0,i=e.length;r<i;r++){var s=n&&n[e[r]]!==undefined||!n&&t.test
(e[r]);s&&(e.splice(r,1),i--,r--)}return e}function p(e,t){var n,r;if(c(t)){for(n=0,r=t.length;n<r;n++)if(!p(e,t[n]))return!1;return!0}var i=l(t);for(n=0,r=e.length;n<r;n++)if(i==="RegExp"){if(typeof e[n]=="string"&&e[n].match(t))return!0}else if(e[n]===t)return!0;return!1}function d(e,t){if(!c(e)||!c(t))return!1;if(e.length!==t.length)return!1;e.sort(),t.sort();for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function v(e){var t=/^\/+|\/+$/g;return e.replace(t,"")}function m(e){return escape(e)}function g(e){return encodeURIComponent(e).replace(/[!'()*]/g,m).replace(/\*/g,"%2A")}function S(e){return function(t,n){return t===undefined?this._parts[e]||"":(this._parts[e]=t||null,this.build(!n),this)}}function x(e,t){return function(n,r){return n===undefined?this._parts[e]||"":(n!==null&&(n+="",n.charAt(0)===t&&(n=n.substring(1))),this._parts[e]=n,this.build(!r),this)}}var i=r&&r.URI;s.version="1.19.1";var u=s.prototype,a=Object.prototype.hasOwnProperty;s._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:s.preventInvalidHostname,duplicateQueryParameters:s.duplicateQueryParameters,escapeQuerySpace:s.escapeQuerySpace}},s.preventInvalidHostname=!1,s.duplicateQueryParameters=!1,s.escapeQuerySpace=!0,s.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,s.idn_expression=/[^a-z0-9\._-]/i,s.punycode_expression=/(xn--)/i,s.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,s.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*$/
,s.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,s.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},s.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},s.hostProtocols=["http","https"],s.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,s.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},s.getDomAttribute=function(e){if(!e||!e.nodeName)return undefined;var t=e.nodeName.toLowerCase();return t==="input"&&e.type!=="image"?undefined:s.domAttributes[t]},s.encode=g,s.decode=decodeURIComponent,s.iso8859=function(){s.encode=escape,s.decode=unescape},s.unicode=function(){s.encode=g,s.decode=decodeURIComponent},s.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"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode
:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},s.encodeQuery=function(e,t){var n=s.encode(e+"");return t===undefined&&(t=s.escapeQuerySpace),t?n.replace(/%20/g,"+"):n},s.decodeQuery=function(e,t){e+="",t===undefined&&(t=s.escapeQuerySpace);try{return s.decode(t?e.replace(/\+/g,"%20"):e)}catch(n){return e}};var y={encode:"encode",decode:"decode"},b,w=function(e,t){return function(n){try{return s[t](n+"").replace(s.characters[e][t].expression,function(n){return s.characters[e][t].map[n]})}catch(r){return n}}};for(b in y)s[b+"PathSegment"]=w("pathname",y[b]),s[b+"UrnPathSegment"]=w("urnpath",y[b]);var E=function(e,t,n){return function(r){var i;n?i=function(e){return s[t](s[n](e))}:i=s[t];var o=(r+"").split(e);for(var u=0,a=o.length;u<a;u++)o[u]=i(o[u]);return o.join(e)}};s.decodePath=E("/","decodePathSegment"),s.decodeUrnPath=E(":","decodeUrnPathSegment"),s.recodePath=E("/","encodePathSegment","decode"),s.recodeUrnPath=E(":","encodeUrnPathSegment","decode"),s.encodeReserved=w("reserved","encode"),s.parse=function(e,t){var n;return t||(t={preventInvalidHostname:s.preventInvalidHostname}),n=e.indexOf("#"),n>-1&&(t.fragment=e.substring(n+1)||null,e=e.substring(0,n)),n=e.indexOf("?"),n>-1&&(t.query=e.substring(n+1)||null,e=e.substring(0,n)),e.substring(0,2)==="//"?(t.protocol=null,e=e.substring(2),e=s.parseAuthority(e,t)):(n=e.indexOf(":"),n>-1&&(t.protocol=e.substring(0,n)||null,t.
protocol&&!t.protocol.match(s.protocol_expression)?t.protocol=undefined:e.substring(n+1,n+3)==="//"?(e=e.substring(n+3),e=s.parseAuthority(e,t)):(e=e.substring(n+1),t.urn=!0))),t.path=e,t},s.parseHost=function(e,t){e||(e=""),e=e.replace(/\\/g,"/");var n=e.indexOf("/"),r,i;n===-1&&(n=e.length);if(e.charAt(0)==="[")r=e.indexOf("]"),t.hostname=e.substring(1,r)||null,t.port=e.substring(r+2,n)||null,t.port==="/"&&(t.port=null);else{var o=e.indexOf(":"),u=e.indexOf("/"),a=e.indexOf(":",o+1);a!==-1&&(u===-1||a<u)?(t.hostname=e.substring(0,n)||null,t.port=null):(i=e.substring(0,n).split(":"),t.hostname=i[0]||null,t.port=i[1]||null)}return t.hostname&&e.substring(n).charAt(0)!=="/"&&(n++,e="/"+e),t.preventInvalidHostname&&s.ensureValidHostname(t.hostname,t.protocol),t.port&&s.ensureValidPort(t.port),e.substring(n)||"/"},s.parseAuthority=function(e,t){return e=s.parseUserinfo(e,t),s.parseHost(e,t)},s.parseUserinfo=function(e,t){var n=e.indexOf("/"),r=e.lastIndexOf("@",n>-1?n:e.length-1),i;return r>-1&&(n===-1||r<n)?(i=e.substring(0,r).split(":"),t.username=i[0]?s.decode(i[0]):null,i.shift(),t.password=i[0]?s.decode(i.join(":")):null,e=e.substring(r+1)):(t.username=null,t.password=null),e},s.parseQuery=function(e,t){if(!e)return{};e=e.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,"");if(!e)return{};var n={},r=e.split("&"),i=r.length,o,u,f;for(var l=0;l<i;l++){o=r[l].split("="),u=s.decodeQuery(o.shift(),t),f=o.length?s.decodeQuery(o.join("="),t):null;if(a.call(n,u)){if(typeof n[u]=="string"||n[u]===null)n[u]=[n[u]];n[u].push(f)}else n[u]=f}return n},s.build=function(e){var t="";return e.protocol&&
(t+=e.protocol+":"),!e.urn&&(t||e.hostname)&&(t+="//"),t+=s.buildAuthority(e)||"",typeof e.path=="string"&&(e.path.charAt(0)!=="/"&&typeof e.hostname=="string"&&(t+="/"),t+=e.path),typeof e.query=="string"&&e.query&&(t+="?"+e.query),typeof e.fragment=="string"&&e.fragment&&(t+="#"+e.fragment),t},s.buildHost=function(e){var t="";return e.hostname?(s.ip6_expression.test(e.hostname)?t+="["+e.hostname+"]":t+=e.hostname,e.port&&(t+=":"+e.port),t):""},s.buildAuthority=function(e){return s.buildUserinfo(e)+s.buildHost(e)},s.buildUserinfo=function(e){var t="";return e.username&&(t+=s.encode(e.username)),e.password&&(t+=":"+s.encode(e.password)),t&&(t+="@"),t},s.buildQuery=function(e,t,n){var r="",i,o,u,f;for(o in e)if(a.call(e,o)&&o)if(c(e[o])){i={};for(u=0,f=e[o].length;u<f;u++)e[o][u]!==undefined&&i[e[o][u]+""]===undefined&&(r+="&"+s.buildQueryParameter(o,e[o][u],n),t!==!0&&(i[e[o][u]+""]=!0))}else e[o]!==undefined&&(r+="&"+s.buildQueryParameter(o,e[o],n));return r.substring(1)},s.buildQueryParameter=function(e,t,n){return s.encodeQuery(e,n)+(t!==null?"="+s.encodeQuery(t,n):"")},s.addQuery=function(e,t,n){if(typeof t=="object")for(var r in t)a.call(t,r)&&s.addQuery(e,r,t[r]);else{if(typeof t!="string")throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");if(e[t]===undefined){e[t]=n;return}typeof e[t]=="string"&&(e[t]=[e[t]]),c(n)||(n=[n]),e[t]=(e[t]||[]).concat(n)}},s.setQuery=function(e,t,n){if(typeof t=="object")for(var r in t)a.call(t,r)&&s.setQuery(e,r,t[r]);else{if(typeof t!="string")throw new TypeError("URI.setQuery() accepts an object, string as the name parameter"
);e[t]=n===undefined?null:n}},s.removeQuery=function(e,t,n){var r,i,o;if(c(t))for(r=0,i=t.length;r<i;r++)e[t[r]]=undefined;else if(l(t)==="RegExp")for(o in e)t.test(o)&&(e[o]=undefined);else if(typeof t=="object")for(o in t)a.call(t,o)&&s.removeQuery(e,o,t[o]);else{if(typeof t!="string")throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter");n!==undefined?l(n)==="RegExp"?!c(e[t])&&n.test(e[t])?e[t]=undefined:e[t]=h(e[t],n):e[t]!==String(n)||!!c(n)&&n.length!==1?c(e[t])&&(e[t]=h(e[t],n)):e[t]=undefined:e[t]=undefined}},s.hasQuery=function(e,t,n,r){switch(l(t)){case"String":break;case"RegExp":for(var i in e)if(a.call(e,i)&&t.test(i)&&(n===undefined||s.hasQuery(e,i,n)))return!0;return!1;case"Object":for(var o in t)if(a.call(t,o)&&!s.hasQuery(e,o,t[o]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(l(n)){case"Undefined":return t in e;case"Boolean":var u=Boolean(c(e[t])?e[t].length:e[t]);return n===u;case"Function":return!!n(e[t],t,e);case"Array":if(!c(e[t]))return!1;var f=r?p:d;return f(e[t],n);case"RegExp":if(!c(e[t]))return Boolean(e[t]&&e[t].match(n));if(!r)return!1;return p(e[t],n);case"Number":n=String(n);case"String":if(!c(e[t]))return e[t]===n;if(!r)return!1;return p(e[t],n);default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},s.joinPaths=function(){var e=[],t=[],n=0;for(var r=0;r<arguments.length;r++){var i=new s(arguments[r]);e.push(i);var o=i.segment();for(var u=0
;u<o.length;u++)typeof o[u]=="string"&&t.push(o[u]),o[u]&&n++}if(!t.length||!n)return new s("");var a=(new s("")).segment(t);return(e[0].path()===""||e[0].path().slice(0,1)==="/")&&a.path("/"+a.path()),a.normalize()},s.commonPath=function(e,t){var n=Math.min(e.length,t.length),r;for(r=0;r<n;r++)if(e.charAt(r)!==t.charAt(r)){r--;break}if(r<1)return e.charAt(0)===t.charAt(0)&&e.charAt(0)==="/"?"/":"";if(e.charAt(r)!=="/"||t.charAt(r)!=="/")r=e.substring(0,r).lastIndexOf("/");return e.substring(0,r+1)},s.withinString=function(e,t,n){n||(n={});var r=n.start||s.findUri.start,i=n.end||s.findUri.end,o=n.trim||s.findUri.trim,u=n.parens||s.findUri.parens,a=/[a-z0-9-]=["']?$/i;r.lastIndex=0;for(;;){var f=r.exec(e);if(!f)break;var l=f.index;if(n.ignoreHtml){var c=e.slice(Math.max(l-3,0),l);if(c&&a.test(c))continue}var h=l+e.slice(l).search(i),p=e.slice(l,h),d=-1;for(;;){var v=u.exec(p);if(!v)break;var m=v.index+v[0].length;d=Math.max(d,m)}d>-1?p=p.slice(0,d)+p.slice(d).replace(o,""):p=p.replace(o,"");if(p.length<=f[0].length)continue;if(n.ignore&&n.ignore.test(p))continue;h=l+p.length;var g=t(p,l,h,e);if(g===undefined){r.lastIndex=h;continue}g=String(g),e=e.slice(0,l)+g+e.slice(h),r.lastIndex=l+g.length}return r.lastIndex=0,e},s.ensureValidHostname=function(t,n){var r=!!t,i=!!n,o=!1;i&&(o=p(s.hostProtocols,n));if(o&&!r)throw new TypeError("Hostname cannot be empty, if protocol is "+n);if(t&&t.match(s.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(e.toASCII(t).match(s.invalid_hostname_characters
))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_]')}},s.ensureValidPort=function(e){if(!e)return;var t=Number(e);if(o(t)&&t>0&&t<65536)return;throw new TypeError('Port "'+e+'" is not a valid port')},s.noConflict=function(e){if(e){var t={URI:this.noConflict()};return r.URITemplate&&typeof r.URITemplate.noConflict=="function"&&(t.URITemplate=r.URITemplate.noConflict()),r.IPv6&&typeof r.IPv6.noConflict=="function"&&(t.IPv6=r.IPv6.noConflict()),r.SecondLevelDomains&&typeof r.SecondLevelDomains.noConflict=="function"&&(t.SecondLevelDomains=r.SecondLevelDomains.noConflict()),t}return r.URI===this&&(r.URI=i),this},u.build=function(e){if(e===!0)this._deferred_build=!0;else if(e===undefined||this._deferred_build)this._string=s.build(this._parts),this._deferred_build=!1;return this},u.clone=function(){return new s(this)},u.valueOf=u.toString=function(){return this.build(!1)._string},u.protocol=S("protocol"),u.username=S("username"),u.password=S("password"),u.hostname=S("hostname"),u.port=S("port"),u.query=x("query","?"),u.fragment=x("fragment","#"),u.search=function(e,t){var n=this.query(e,t);return typeof n=="string"&&n.length?"?"+n:n},u.hash=function(e,t){var n=this.fragment(e,t);return typeof n=="string"&&n.length?"#"+n:n},u.pathname=function(e,t){if(e===undefined||e===!0){var n=this._parts.path||(this._parts.hostname?"/":"");return e?(this._parts.urn?s.decodeUrnPath:s.decodePath)(n):n}return this._parts.urn?this._parts.path=e?s.recodeUrnPath(e):"":this._parts.path=e?s.recodePath(e):"/",this.build(!t),this},u.path=u.pathname,u.href=function(e,t){var n
;if(e===undefined)return this.toString();this._string="",this._parts=s._parts();var r=e instanceof s,i=typeof e=="object"&&(e.hostname||e.path||e.pathname);if(e.nodeName){var o=s.getDomAttribute(e);e=e[o]||"",i=!1}!r&&i&&e.pathname!==undefined&&(e=e.toString());if(typeof e=="string"||e instanceof String)this._parts=s.parse(String(e),this._parts);else{if(!r&&!i)throw new TypeError("invalid input");var u=r?e._parts:e;for(n in u){if(n==="query")continue;a.call(this._parts,n)&&(this._parts[n]=u[n])}u.query&&this.query(u.query,!1)}return this.build(!t),this},u.is=function(e){var t=!1,r=!1,i=!1,o=!1,u=!1,a=!1,f=!1,l=!this._parts.urn;this._parts.hostname&&(l=!1,r=s.ip4_expression.test(this._parts.hostname),i=s.ip6_expression.test(this._parts.hostname),t=r||i,o=!t,u=o&&n&&n.has(this._parts.hostname),a=o&&s.idn_expression.test(this._parts.hostname),f=o&&s.punycode_expression.test(this._parts.hostname));switch(e.toLowerCase()){case"relative":return l;case"absolute":return!l;case"domain":case"name":return o;case"sld":return u;case"ip":return t;case"ip4":case"ipv4":case"inet4":return r;case"ip6":case"ipv6":case"inet6":return i;case"idn":return a;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return f}return null};var T=u.protocol,N=u.port,C=u.hostname;u.protocol=function(e,t){if(e){e=e.replace(/:(\/\/)?$/,"");if(!e.match(s.protocol_expression))throw new TypeError('Protocol "'+e+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]")}return T.call(this,e,t)},u.scheme=u.protocol,u.port=function(e,t){return this._parts.urn?e===undefined?""
:this:(e!==undefined&&(e===0&&(e=null),e&&(e+="",e.charAt(0)===":"&&(e=e.substring(1)),s.ensureValidPort(e))),N.call(this,e,t))},u.hostname=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e!==undefined){var n={preventInvalidHostname:this._parts.preventInvalidHostname},r=s.parseHost(e,n);if(r!=="/")throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');e=n.hostname,this._parts.preventInvalidHostname&&s.ensureValidHostname(e,this._parts.protocol)}return C.call(this,e,t)},u.origin=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e===undefined){var n=this.protocol(),r=this.authority();return r?(n?n+"://":"")+this.authority():""}var i=s(e);return this.protocol(i.protocol()).authority(i.authority()).build(!t),this},u.host=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e===undefined)return this._parts.hostname?s.buildHost(this._parts):"";var n=s.parseHost(e,this._parts);if(n!=="/")throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},u.authority=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e===undefined)return this._parts.hostname?s.buildAuthority(this._parts):"";var n=s.parseAuthority(e,this._parts);if(n!=="/")throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},u.userinfo=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e===undefined){var n=s.buildUserinfo(this._parts);return n?n.substring(0,n.length-1):n}return e[e.length-1]!=="@"&&(e+="@"),s.parseUserinfo
(e,this._parts),this.build(!t),this},u.resource=function(e,t){var n;return e===undefined?this.path()+this.search()+this.hash():(n=s.parse(e),this._parts.path=n.path,this._parts.query=n.query,this._parts.fragment=n.fragment,this.build(!t),this)},u.subdomain=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e===undefined){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,n)||""}var r=this._parts.hostname.length-this.domain().length,i=this._parts.hostname.substring(0,r),o=new RegExp("^"+f(i));e&&e.charAt(e.length-1)!=="."&&(e+=".");if(e.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");return e&&s.ensureValidHostname(e,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(o,e),this.build(!t),this},u.domain=function(e,t){if(this._parts.urn)return e===undefined?"":this;typeof e=="boolean"&&(t=e,e=undefined);if(e===undefined){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.match(/\./g);if(n&&n.length<2)return this._parts.hostname;var r=this._parts.hostname.length-this.tld(t).length-1;return r=this._parts.hostname.lastIndexOf(".",r-1)+1,this._parts.hostname.substring(r)||""}if(!e)throw new TypeError("cannot set domain empty");if(e.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");s.ensureValidHostname(e,this._parts.protocol);if(!this._parts.hostname||this.is("IP"))this._parts.hostname=e;else{var i=new RegExp(f(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(i,e)}return this
.build(!t),this},u.tld=function(e,t){if(this._parts.urn)return e===undefined?"":this;typeof e=="boolean"&&(t=e,e=undefined);if(e===undefined){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.lastIndexOf("."),i=this._parts.hostname.substring(r+1);return t!==!0&&n&&n.list[i.toLowerCase()]?n.get(this._parts.hostname)||i:i}var s;if(!e)throw new TypeError("cannot set TLD empty");if(e.match(/[^a-zA-Z0-9-]/)){if(!n||!n.is(e))throw new TypeError('TLD "'+e+'" contains characters other than [A-Z0-9]');s=new RegExp(f(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(s,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");s=new RegExp(f(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(s,e)}return this.build(!t),this},u.directory=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e===undefined||e===!0){if(!this._parts.path&&!this._parts.hostname)return"";if(this._parts.path==="/")return"/";var n=this._parts.path.length-this.filename().length-1,r=this._parts.path.substring(0,n)||(this._parts.hostname?"/":"");return e?s.decodePath(r):r}var i=this._parts.path.length-this.filename().length,o=this._parts.path.substring(0,i),u=new RegExp("^"+f(o));return this.is("relative")||(e||(e="/"),e.charAt(0)!=="/"&&(e="/"+e)),e&&e.charAt(e.length-1)!=="/"&&(e+="/"),e=s.recodePath(e),this._parts.path=this._parts.path.replace(u,e),this.build(!t),this},u.filename=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(typeof e!="string"){if(!this._parts.path||this._parts
.path==="/")return"";var n=this._parts.path.lastIndexOf("/"),r=this._parts.path.substring(n+1);return e?s.decodePathSegment(r):r}var i=!1;e.charAt(0)==="/"&&(e=e.substring(1)),e.match(/\.?\//)&&(i=!0);var o=new RegExp(f(this.filename())+"$");return e=s.recodePath(e),this._parts.path=this._parts.path.replace(o,e),i?this.normalizePath(t):this.build(!t),this},u.suffix=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e===undefined||e===!0){if(!this._parts.path||this._parts.path==="/")return"";var n=this.filename(),r=n.lastIndexOf("."),i,o;return r===-1?"":(i=n.substring(r+1),o=/^[a-z0-9%]+$/i.test(i)?i:"",e?s.decodePathSegment(o):o)}e.charAt(0)==="."&&(e=e.substring(1));var u=this.suffix(),a;if(!u){if(!e)return this;this._parts.path+="."+s.recodePath(e)}else e?a=new RegExp(f(u)+"$"):a=new RegExp(f("."+u)+"$");return a&&(e=s.recodePath(e),this._parts.path=this._parts.path.replace(a,e)),this.build(!t),this},u.segment=function(e,t,n){var r=this._parts.urn?":":"/",i=this.path(),s=i.substring(0,1)==="/",o=i.split(r);e!==undefined&&typeof e!="number"&&(n=t,t=e,e=undefined);if(e!==undefined&&typeof e!="number")throw new Error('Bad segment "'+e+'", must be 0-based integer');s&&o.shift(),e<0&&(e=Math.max(o.length+e,0));if(t===undefined)return e===undefined?o:o[e];if(e===null||o[e]===undefined){if(c(t)){o=[];for(var u=0,a=t.length;u<a;u++){if(!t[u].length&&(!o.length||!o[o.length-1].length))continue;o.length&&!o[o.length-1].length&&o.pop(),o.push(v(t[u]))}}else if(t||typeof t=="string")t=v(t),o[o.length-1]===""?o[o.length-1]=t:o.push(t)}else t?o[e]=v(t):o.splice(e,1);return s&&
o.unshift(""),this.path(o.join(r),n)},u.segmentCoded=function(e,t,n){var r,i,o;typeof e!="number"&&(n=t,t=e,e=undefined);if(t===undefined){r=this.segment(e,t,n);if(!c(r))r=r!==undefined?s.decode(r):undefined;else for(i=0,o=r.length;i<o;i++)r[i]=s.decode(r[i]);return r}if(!c(t))t=typeof t=="string"||t instanceof String?s.encode(t):t;else for(i=0,o=t.length;i<o;i++)t[i]=s.encode(t[i]);return this.segment(e,t,n)};var k=u.query;return u.query=function(e,t){if(e===!0)return s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof e=="function"){var n=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace),r=e.call(this,n);return this._parts.query=s.buildQuery(r||n,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this}return e!==undefined&&typeof e!="string"?(this._parts.query=s.buildQuery(e,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!t),this):k.call(this,e,t)},u.setQuery=function(e,t,n){var r=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof e=="string"||e instanceof String)r[e]=t!==undefined?t:null;else{if(typeof e!="object")throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");for(var i in e)a.call(e,i)&&(r[i]=e[i])}return this._parts.query=s.buildQuery(r,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof e!="string"&&(n=t),this.build(!n),this},u.addQuery=function(e,t,n){var r=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.addQuery(r,e,t===undefined?null:t),this._parts.query=s.buildQuery(r,this.
_parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof e!="string"&&(n=t),this.build(!n),this},u.removeQuery=function(e,t,n){var r=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.removeQuery(r,e,t),this._parts.query=s.buildQuery(r,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof e!="string"&&(n=t),this.build(!n),this},u.hasQuery=function(e,t,n){var r=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.hasQuery(r,e,t,n)},u.setSearch=u.setQuery,u.addSearch=u.addQuery,u.removeSearch=u.removeQuery,u.hasSearch=u.hasQuery,u.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!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(n){return this._parts.hostname&&(this.is("IDN")&&e?this._parts.hostname=e.toASCII(this._parts.hostname):this.is("IPv6")&&t&&(this._parts.hostname=t.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!n)),this},u.normalizePort=function(e){return typeof this._parts.protocol=="string"&&this._parts.port===s.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!e)),this},u.normalizePath=function(e){var t=this._parts.path;if(!t)return this;if(this._parts.urn)return this._parts.path=
s.recodeUrnPath(this._parts.path),this.build(!e),this;if(this._parts.path==="/")return this;t=s.recodePath(t);var n,r="",i,o;t.charAt(0)!=="/"&&(n=!0,t="/"+t);if(t.slice(-3)==="/.."||t.slice(-2)==="/.")t+="/";t=t.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),n&&(r=t.substring(1).match(/^(\.\.\/)+/)||"",r&&(r=r[0]));for(;;){i=t.search(/\/\.\.(\/|$)/);if(i===-1)break;if(i===0){t=t.substring(3);continue}o=t.substring(0,i).lastIndexOf("/"),o===-1&&(o=i),t=t.substring(0,o)+t.substring(i+3)}return n&&this.is("relative")&&(t=r+t.substring(1)),this._parts.path=t,this.build(!e),this},u.normalizePathname=u.normalizePath,u.normalizeQuery=function(e){return typeof this._parts.query=="string"&&(this._parts.query.length?this.query(s.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):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=s.encode,t=s.decode;s.encode=escape,s.decode=decodeURIComponent;try{this.normalize()}finally{s.encode=e,s.decode=t}return this},u.unicode=function(){var e=s.encode,t=s.decode;s.encode=g,s.decode=unescape;try{this.normalize()}finally{s.encode=e,s.decode=t}return this},u.readable=function(){var t=this.clone();t.username("").password("").normalize();var n="";t._parts.protocol&&(n+=t._parts.protocol+"://"),t._parts.hostname&&(t.is("punycode")&&e?(n+=e.toUnicode(t._parts.hostname),t._parts.port&&(n+=":"+t._parts.port)):n+=t.host()),t._parts.hostname&&
t._parts.path&&t._parts.path.charAt(0)!=="/"&&(n+="/"),n+=t.path(!0);if(t._parts.query){var r="";for(var i=0,o=t._parts.query.split("&"),u=o.length;i<u;i++){var a=(o[i]||"").split("=");r+="&"+s.decodeQuery(a[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),a[1]!==undefined&&(r+="="+s.decodeQuery(a[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}n+="?"+r.substring(1)}return n+=s.decodeQuery(t.hash(),!0),n},u.absoluteTo=function(e){var t=this.clone(),n=["protocol","username","password","hostname","port"],r,i,o;if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");e instanceof s||(e=new s(e));if(t._parts.protocol)return t;t._parts.protocol=e._parts.protocol;if(this._parts.hostname)return t;for(i=0;o=n[i];i++)t._parts[o]=e._parts[o];return t._parts.path?(t._parts.path.substring(-2)===".."&&(t._parts.path+="/"),t.path().charAt(0)!=="/"&&(r=e.directory(),r=r?r:e.path().indexOf("/")===0?"/":"",t._parts.path=(r?r+"/":"")+t._parts.path,t.normalizePath())):(t._parts.path=e._parts.path,t._parts.query||(t._parts.query=e._parts.query)),t.build(),t},u.relativeTo=function(e){var t=this.clone().normalize(),n,r,i,o,u;if(t._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");e=(new s(e)).normalize(),n=t._parts,r=e._parts,o=t.path(),u=e.path();if(o.charAt(0)!=="/")throw new Error("URI is already relative");if(u.charAt(0)!=="/")throw new Error("Cannot calculate a URI relative to another relative URI");n.protocol===r.protocol&&(n.protocol=null);if(n.username!==r.username||n.password!==r.password)return t
.build();if(n.protocol!==null||n.username!==null||n.password!==null)return t.build();if(n.hostname!==r.hostname||n.port!==r.port)return t.build();n.hostname=null,n.port=null;if(o===u)return n.path="",t.build();i=s.commonPath(o,u);if(!i)return t.build();var a=r.path.substring(i.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return n.path=a+n.path.substring(i.length)||"./",t.build()},u.equals=function(e){var t=this.clone(),n=new s(e),r={},i={},o={},u,f,l;t.normalize(),n.normalize();if(t.toString()===n.toString())return!0;u=t.query(),f=n.query(),t.query(""),n.query("");if(t.toString()!==n.toString())return!1;if(u.length!==f.length)return!1;r=s.parseQuery(u,this._parts.escapeQuerySpace),i=s.parseQuery(f,this._parts.escapeQuerySpace);for(l in r)if(a.call(r,l)){if(!c(r[l])){if(r[l]!==i[l])return!1}else if(!d(r[l],i[l]))return!1;o[l]=!0}for(l in i)if(a.call(i,l)&&!o[l])return!1;return!0},u.preventInvalidHostname=function(e){return this._parts.preventInvalidHostname=!!e,this},u.duplicateQueryParameters=function(e){return this._parts.duplicateQueryParameters=!!e,this},u.escapeQuerySpace=function(e){return this._parts.escapeQuerySpace=!!e,this},s}),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=SC.getCurrentTimeForPerformance();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",SC.getCurrentTimeForPerformance()-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=SC.getCurrentTimeForPerformance(),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=SC.getCurrentTimeForPerformance(),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<2048?(t+=String.fromCharCode(i>>6|192),t+=String.fromCharCode(i&63|128)):i<65536?(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128),t+=String.fromCharCode(i&63|128)):(t+=String.fromCharCode(i>>18|240),t+=String.fromCharCode(i>>12&63|128),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;var u=String.fromCodePoint||this._fromCodePoint,a=String.fromCharCode;while(n<e.length)r=e.charCodeAt(n++),r<128?t+=String.fromCharCode(r):r>191&&r<224?(i=e.charCodeAt(n++),t+=a((r&31)<<6|i&63)):r>=224&&r<240?(i=e.charCodeAt(n++),s=e.charCodeAt(n++),t+=a((r&15)<<12|(i&63)<<6|s&63)):r>=240&&(i=e.charCodeAt(n++),s=e.charCodeAt(n++),o=e.charCodeAt(n++),t+=u((r&7)<<18|(i&63)<<12|(s&63)<<6|o&63));return t},_fromCodePoint:function(e){if(e<65536)return String.fromCharCode(e);var t=((e-=65536)>>10)+55296,n=e%1024+56320;return String.fromCharCode(t,n)},_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 dont 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=SC.getCurrentTimeForPerformance(),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",SC.getCurrentTimeForPerformance()),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,O=SC.Locale.getPath("currentLocale.isRTL")?"right":"left";a&&a.set("isVisible",c?NO:YES),t&&t.adjust(O,h),n&&n.adjust(O,h),i&&i.adjust(O,h),o&&o.adjust(O,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.performLayout()),this._resizingExtraView=NO,e.set("readyToShow",YES);var M=this.$(".def");M&&M.length&&setTimeout(function(){M[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(SC.RTLSupport,{layoutRecipe:{top:25,start:106,end:25},classNames:["title-label"],controlSize:SC.LARGE_CONTROL_SIZE,ariaRole:"heading"}),CW.Alert.DescriptionView=SC.LabelView.extend(SC.RTLSupport,{layoutRecipe:{start:106,end:25},classNames:["description"]}),CW.Alert.CaptionView=SC.LabelView.extend(SC.RTLSupport,{layoutRecipe:{start:106,end:25},classNames:["caption"]}),CW.Alert.IconView=SC.View.extend(SC.RTLSupport,{layoutRecipe:{top:19,width:68,height:68,start:25},classNames:["cw-alert-image-view"]}),CW.Alert.MainButtonsView=SC
.View.extend(SC.RTLSupport,{layoutRecipe:{height:44,bottom:4,start:0,end:0},classNames:["main-buttons"],childViews:["middleButton","rightButton"],middleButtonIsVisible:YES,middleButtonTitle:"Cancel",middleButtonAction:null,middleButtonTarget:null,rightButtonTitle:"Ok",rightButtonAction:null,rightButtonTarget:null,init:function(e){e(),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)}.enhance(),middleButton:SC.ButtonView.extend(SC.RTLSupport,{isCancel:YES,themeName:"borderless",classNames:["middle-button","button-in-between"],useStaticLayout:YES,layoutRecipe:{top:0,width:"auto",bottom:0,start:0}}),rightButton:SC.ButtonView.extend(SC.RTLSupport,{isDefault:YES,themeName:"borderless",classNames:["right-button"],useStaticLayout:YES,layoutRecipe:{top:0,width:"auto",bottom:0,start:0},render:function(e){return e.attr("tabindex","0"),arguments.callee.base.apply(this,arguments)}})}),CW.Alert.LeftButtonView=SC.ButtonView.extend(SC.RTLSupport,{useStaticLayout:YES,title:"Other...",themeName:"borderless",classNames:["left-button"],layoutRecipe:{height:44,bottom:4,width:"auto",start:0}}),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,SC.RTLSupport,{layoutRecipe:{start:106,end: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(e){e();var t=this.get("contentView");t&&t.set("isVisible",this.get("isExpanded"))}.enhance(),_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,isBeingShown:undefined,isBeingFadedIn:undefined,isBeingFadedOut:undefined,currentThumbAnimation:undefined,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/1812Project43/coreweb/views/1812Project43/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,currentSubDomain:function(){return URI(window.location.href).subdomain()}.property().cacheable(),isWWW:function(){return this.get("currentSubDomain")==="www"}.property("currentSubDomain").cacheable(),isBeta:function(){return this.get("currentSubDomain")==="beta"}.property("currentSubDomain").cacheable(),isFuture:function(){return this.get("currentSubDomain")==="future"}.property("currentSubDomain").cacheable(),isCarry:function(){return this.get("currentSubDomain")==="carry"}.property("currentSubDomain").cacheable(),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.get("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.addEventListener("error",SC.RunLoop.wrapFunction(function(e){var t=e.error,n="not available",r=e.message||n,s=e.filename||n,o=e.lineno||n,u=t&&t.stack?t.stack:n;SC.warn("onerror exception: "+r+" Script: "+s+" Line: "+o);var a={applicationBuildNumber:SC.buildNumber,applicationMasteringNumber:SC.masteringNumber,error:r,url:s,lineNumber:o,stack:u};i(["OnErrorException",a])})),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},matchesFormatOfAppleId:function(e){return CK.matchesFormatOfEmailAddress(e)||CK.matchesFormatOfPhoneNumberAppleId(e)},matchesFormatOfEmailAddress:function(e){return/^([A-Z0-9\.\-\_\+])*([A-Z0-9\+\-\_])+\@[A-Z0-9]+([\-][A-Z0-9]+)*([\.][A-Z0-9\-]+){1,8}$/i.test(e)},matchesFormatOfPhoneNumberAppleId:function(e){return/^\+?[0-9]{5,}$/.test(e)},matchesFormatOfPhoneNumber:function(e){var t=this._phoneNumberRegex;if(!t){var n="0-9\\uff10-\\uff19\\u0660-\\u0669\\u06F0-\\u06F9\\u0966-\\u096F\\u09E6-\\u09FF\\u0E50-\\u0E59",r="\\(\\)\\s\\-\\+\\.\\,\\#";this._phoneNumberRegexAllDigits=new RegExp("^s*\\+?(["+n+"]+)s*$","gi"),t=this._phoneNumberRegex=new RegExp("^s*([+\\(])?((["+n+"]+)(["+r+"]{1,3}|x|ext))+(["+n+"]+)s*$","gi")}var i=this._phoneNumberRegexAllDigits;return t.lastIndex=0,i.lastIndex=0,t.test(e)||i.test(e)},normalizePhoneNumber:function(e){return e&&e.replace(/[^0-9]/g,"")},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},addRootDomainQueryParameterHackAsAppropriate:function(e){e||CW.fatalError("You must specify a URL");var t;window.CloudOS&&(CloudOS.isBeta&&(t="beta"),CloudOS.isCarry&&(t="carry"),CloudOS.isFuture&&(t="future"));var n;return CK.get("isBeta")&&(n="beta"),CK.get("isCarry")&&(n="carry"),CK.get("isFuture"
)&&(n="future"),e instanceof URI||(e=new URI(e)),t&&t!==n&&e.addQuery("rootDomain",t),e.href()},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;if(i&&i.getItem){o=CK.currentApplication,s=o?o.get("name"):"iCloud",s&&(t=s+"."+t),n&&(t+=this.get("persistAfterLogoutSuffix"));try{r=i.getItem(t)}catch(u){SC.warn('Could not get value for key "%@" in %@: %@',t,e,u)}}return 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},isStringBase64Encoded:function(e){return e.match(new RegExp("^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$"))}}),CK.servicesController=SC.Object.create({getServiceInfoFor:function(e){e||SC.warn("getServiceInfoFor(): A service name must be specified");var t=this._servicesInfo;return t?t[e]:null},getServiceUrlFor:function(e,t){var n=this.getServiceInfoFor(e),r=null,i;return n?(r=n.get("url")||null,r||(i="getServiceUrlFor(): Could not find the URL for “%@”".fmt(e))):i="getServiceUrlFor(): Could not find service information for “%@”".fmt(e),i&&(t?CW.fatalError(i):SC.error(i)),r},getServiceStatusFor
:function(e,t){var n=this.getServiceInfoFor(e),r=null,i;return n?(r=n.get("status")||null,r||(i="getServiceStatusFor(): Could not find the status for “%@”".fmt(e))):i="getServiceStatusFor(): Could not find service information for “%@”".fmt(e),i&&(t?CW.fatalError(i):SC.error(i)),r},servicesInfoHasBeenReceived:function(){return this._servicesInfo!==null}.property("_servicesInfo"),_setupFromBag:function(e){e||CW.fatalError("_parseInformationFromBag(): The bag must be supplied");var t=e.webservices,n,r,i;if(t){n={};for(r in t)i=SC.clone(t[r],YES),i.name=r,n[r]=CK.ServiceInfo.create(i);this.set("_servicesInfo",n)}else SC.error("CK.servicesController: The bag does not contain any services information")},_servicesInfo:null}),CK.errorCatcher=SC.Object.create({enabledInDevMode:NO,bubbleErrorsToCloudOS:YES,callback:null,namespacesToSymbolicate:null,isReporting:NO,shouldReloadIfFatal:NO,init:function(){arguments.callee.base.apply(this,arguments),this.get("enabledInDevMode")||SC.buildMode==="production"?(this.set("enabled",YES),SC.ExceptionHandler=this):SC.ExceptionHandler=null},reportBadRequest:function(e){return e||(e={}),e.type="badRequest",this._handleError(e)},reportServerError:function(e,t){e||(e={}),e.type="server";if(SC.kindOf(t,SC.Response)){var n=["server error"],r=t.get("request");r._getServiceName&&n.push("service: "+r._getServiceName()),n.push("status: "+t.get("status")),e.error=n.join(", "),e.serverHostname=URI(t.getFullAddress()).hostname(),e.urlPath=t.getPath("request.reportPath")}return this._handleError(e)},report:function(e){return e||(e={}),e.type||(e.type="generic"
),this._handleError(e)},mostCommonErrorMessages:["null","undefined","Syntax","defined"],handleException:function(e){try{e.recordedStack=e.recordedStack||CW.recordStack(YES,YES)}catch(t){}var n=e.message,r=e.stack,i=e.recordedStack,s=this.get("mostCommonErrorMessages"),o=s.length,u,a="";if(r&&r.length>0){var f=r.toString().split("http")[0];a=f.replace(n,"").replace("\n","")}else i&&i.length>0&&(a=i[1].func);if(n)for(u=0;u<o;u++)if(n.indexOf(s[u])!==-1){n+=". The calling function is "+a;break}return e.message=n,this._handleError({exception:e,isFatal:YES,type:"exception"})},_handleError:function(e){if(!e)return SC.error("Warning: No parameters were specified in _handleError"),YES;if(this.get("isReporting"))return YES;SC.debug("CloudKit: ErrorCatcher dialog invoked.");var t=CK.currentApplication,n=e.applicationName,r,i,s=window.CloudOS&&CloudOS.getUser?CloudOS.getUser():null,o;n||(t?n=t.get("name"):n="cloudos"),e.applicationName||(e.applicationName=n);if(s&&(o=s._auth_bag)){var u=o.requestInfo,a,f;u&&(a=u.region,f=u.country,f&&(e.userRegion=a?a+", "+f:f))}if(!e.appStatechart){var l,c;n==="cloudos"?c=CloudOS.get("statechartPath"):t&&(c=t.get("statechartPath")),c&&(l=SC.getPath(c))&&l.toStringWithDetails&&(e.appStatechart=l.toStringWithDetails())}r=e.exception,r&&(i=this._hashForException(r),e=SC.mixin(i,e));var h=this.get("callback")||this.get("exceptionCallback");if(h)try{h.call(this,e)}catch(p){}if(e.isFatal&&t&&this.get("bubbleErrorsToCloudOS")===YES&&CloudOS&&!CloudOS.isSimulator&&!CloudOS.isCloudOSLite){var d=SC.Logger.stringifyRecordedLogMessages();return e.applicationBuildNumber=
SC.buildNumber,e.applicationMasteringNumber=SC.masteringNumber,CloudOS.handleApplicationCrash(e,d),NO}return e.exception?SC.RunLoop.kill():SC.RunLoop.end(),e.exception=null,!e.applicationLog&&!CloudOS.isCloudOSClient&&(e.applicationLog=SC.Logger.stringifyRecordedLogMessages()),SC.Module.loadModule("cloudkit/error_catcher","CK.errorCatcher","moduleDidLoad",e),this.set("isReporting",YES),YES},_hashForException:function(e){var t={},n=null,r,i,s,o,u,a,f,l,c,h,p,d,v;e&&(n=e.message?e.message:e.toString()),t.error=n,t.file=e.fileName||e.sourceURL||"Unknown",t.line=e.lineNumber||e.line||"Unknown";var m=CW.invertArray(["message","fileName","sourceURL","lineNumber","line","stack","recordedStack"]),g=function(){if(typeof e=="string")return e;var t="";for(p in e){if(m[p])continue;d=e[p],d===undefined?v="(undefined)":d===null?v="(null)":v=p+": "+d.toString(),t+=" "+v+"\n"}return t}();g.trim().length>0&&(t.exceptionInfo=g),r=e.stack,r&&(t.stack=r.toString()),r=e.recordedStack;if(r){i="";for(s=0,o=r.length;s<o;++s){u=r[s];if(typeof u=="string"){i+=u+"\n";break}i+=u.func+"\n",a=u.args;if(a){i+=" > args: ";for(l=0,f=a.length;l<f;++l)c=a[l],h=this._prettyValue(c),l>0&&(i+=", "),i+=h;i+="\n"}}t.mostRecentStack=i}return t},_shouldReload:function(e,t){return e&&CK.currentApplication?YES:e&&t==="cloudos"?YES:NO},_prettyValue:function(e){var t;return e===undefined?t="undefined":e===null?t="null":(e instanceof Function&&(t=e.displayName,t||(t=e.name)),t||(t=e.toString())),t}}),CK.AccountPreferences=SC.Object.extend({hasInitialized:NO,timeZone:"US/Pacific",timezoneName:"City.Cupertino - U.S."
,locale:null,secondaryLocale:null,regionFormat:null}),CK.AppInfo=SC.Object.extend({name:null,capitalizedName:function(){var e=this.get("name");return e&&(e.charAt(0)!=="i"?e=e.capitalize():e="i"+e.substring(1).capitalize()),e}.property("name").cacheable(),displayName:null,supportedFileExtensions:null,isDisabled:NO,isUnqualified:NO}),CK.AppInfo.mixin({_properties:["name","displayName","supportedFileExtensions","isDisabled","isUnqualified","supportedLocales"],serializeAsHash:function(e){var t=CK.AppInfo._properties,n={};for(var r=0;r<t.length;r++){var i=t[r];n[i]=e.get(i)}return n}}),CK.QuotaInfo=SC.Object.extend({storageUsageByMedia:null,familyStorageUsageInfo:null,totalStorageInBytes:null,commerceStorageInBytes:null,usedStorageInBytes:null,compStorageInBytes:null,overQuota:null,paidQuota:null,freeStorageInBytes:function(){return this.get("totalStorageInBytes")-this.get("usedStorageInBytes")}.property("usedStorageInBytes","totalStorageInBytes"),isAlmostOverQuota:function(){return this.get("almostOverQuota")||this.get("almostFull")||this.get("almost-full")}.property("almost-full","almostOverQuota","almostFull")}),CK.ServiceInfo=SC.Object.extend({name:undefined,url:undefined,isEnabled:undefined,pcsRequired:undefined,isServiceInCarryPartition:function(){return CK.isURLInCarryPartition(this.get("url"))}.property("url")}),CK.User=SC.Object.extend({statusCode:null,firstName:null,lastName:null,primaryEmail:null,isPaidDeveloper:NO,hsaEnabled:NO,hsaVersion:null,notificationId:null,isManagedAppleID:NO,brMigrated:NO,SafariBookmarksHasMigratedToCloudKit:NO,canShare:NO,countryCode:null,locale
:null,idmsLocale:function(){var e=this.get("locale"),t=e.indexOf("_");return t===-1?e:e.substr(0,t)}.property("locale").cacheable(),isChineseAccount:function(){return this.get("countryCode")==="CHN"}.property("countryCode").cacheable(),isHSA1Enabled:function(){return this.get("hsaEnabled")&&this.get("hsaVersion")===1}.property("hsaEnabled","hsaVersion"),isHSA2Enabled:function(){return this.get("hsaEnabled")&&this.get("hsaVersion")===2}.property("hsaEnabled","hsaVersion"),primaryEmailIsVerified:function(){return this.get("primaryEmailVerified")}.property(),displayName:function(){var e=this.get("firstName"),t=this.get("lastName"),n=this.get("displayablePrimaryAppleId");return CK.displayNameFor(e,t,n)}.property("firstName","lastName","displayablePrimaryAppleId"),isLiteAccount:function(){return this.get("statusCode")===CK.User.LITE}.property("statusCode"),appleId:function(e,t){var n=this.get("appleIdEntries");if(!n)return arguments.length===2&&(this._appleId=t),this._appleId;var r=this._getPrimaryAppleIdFromEntries(n);return r&&(r.type===CK.User.AppleIdEntryType.PHONE_NUMBER?r.formattedValue:r.value)||""}.property("appleIdEntries").cacheable(),normalizedPrimaryAppleId:function(){var e=this.get("appleIdEntries");if(!e)return this.get("appleId");var t=this._getPrimaryAppleIdFromEntries(e);return t&&(t.type===CK.User.AppleIdEntryType.PHONE_NUMBER?t.canonicalValue:t.value)||""}.property("appleIdEntries","appleId").cacheable(),displayablePrimaryAppleId:function(){var e=this.get("appleIdEntries");if(!e)return this.get("appleId");var t=this._getPrimaryAppleIdFromEntries(e);return t&&(t
.type===CK.User.AppleIdEntryType.PHONE_NUMBER?t.formattedValue:t.value)||""}.property("appleIdEntries","appleId").cacheable(),primaryAppleIdType:function(){var e=this.get("appleIdEntries");if(!e){var t=this.get("normalizedPrimaryAppleId");return CK.matchesFormatOfEmailAddress(t)?CK.User.AppleIdEntryType.EMAIL:CK.matchesFormatOfPhoneNumber(t)?CK.User.AppleIdEntryType.PHONE_NUMBER:undefined}var n=this._getPrimaryAppleIdFromEntries(e);return n&&n.type}.property("appleIdEntries").cacheable(),isPrimaryAppleIdTypePhoneNumber:function(){return this.get("primaryAppleIdType")===CK.User.AppleIdEntryType.PHONE_NUMBER}.property("primaryAppleIdType"),isPrimaryAppleIdTypeEmail:function(){return this.get("primaryAppleIdType")===CK.User.AppleIdEntryType.EMAIL}.property("primaryAppleIdType"),appleIdAlias:null,iCloudAppleIdAlias:null,appleIdEntries:null,dsid:null,isMyEmailAddressOrPhoneNumber:function(e){if(SC.empty(e))return!1;e=(e||"").toLowerCase();var t=this.get("_appleIdEmailsLookupTable");if(t[e])return!0;if(!CK.matchesFormatOfPhoneNumber(e))return!1;e=CK.normalizePhoneNumber(e);var n=this.get("_appleIdPhoneNumbersLookupTable");return n[e]?!0:!1},_appleIdEmailsLookupTable:function(){return this._buildAppleIdLookupTable(CK.User.AppleIdEntryType.EMAIL)}.property("appleId","primaryEmail","appleIdAliases","appleIdEntries").cacheable(),_appleIdPhoneNumbersLookupTable:function(){return this._buildAppleIdLookupTable(CK.User.AppleIdEntryType.PHONE_NUMBER)}.property("appleId","primaryEmail","appleIdAliases","appleIdEntries").cacheable(),hasEmailAddress:function(){var e=this.get("_appleIdEmailsLookupTable"
);return Object.keys(e).length>0}.property("_appleIdEmailsLookupTable").cacheable(),_buildAppleIdLookupTable:function(e){var t={},n=this.get("appleIdEntries");if(n){for(var r=0,i=n.length;r<i;++r){var s=n[r];if(e&&s.type!==e)continue;var o=(s.type===CK.User.AppleIdEntryType.PHONE_NUMBER?s.canonicalValue:s.value)||"";t[o.toLowerCase()]=!0}return t}if(e===CK.User.AppleIdEntryType.PHONE_NUMBER)return t;var u=this.get("appleId"),a=this.get("primaryEmail"),f=this.get("appleIdAliases");u&&(t[u.toLowerCase()]=!0),a&&(t[a.toLowerCase()]=!0);for(var r=0,i=f.length;r<i;++r){var l=f[r];l&&(t[l.toLowerCase()]=!0)}return t},_getPrimaryAppleIdFromEntries:function(e){for(var t=0,n=e&&e.length||0;t<n;++t){var r=e[t];if(r.isPrimary)return r}},updateAuthBag:function(e){var t=e&&e.dsInfo;if(!t)return;this._auth_bag=e,this.set(t)},_auth_bag:null,destroy:function(){var e=this._preferences_cache;return e&&e.destroy(),this._preferences_cache=null,arguments.callee.base.apply(this,arguments)}}),CK.User.mixin({PAID_LAPSED:-3,PAID_NOT_CREATED_YET:-2,FREE_NOT_CREATED_YET:-1,INACTIVE:0,PAID_ACTIVE:1,FREE_QUALIFIED:2,FREE_NOT_QUALIFIED:3,LITE:4,AppleIdEntryType:{PHONE_NUMBER:"PHONE_NUMBER",EMAIL:"EMAIL"},createFromAuthBag:function(e){var t=e&&e.dsInfo;if(!t)return;var n=CK.User.create();return n._auth_bag=e,n.set(t),n}}),String.prototype.startsWith||function(){"use strict";var e=function(){try{var e={},t=Object.defineProperty,n=t(e,e,e)&&t}catch(r){}return n}(),t={}.toString,n=function(e){if(this==null)throw TypeError();var n=String(this);if(e&&t.call(e)=="[object RegExp]")throw TypeError();var r=n.length
,i=String(e),s=i.length,o=arguments.length>1?arguments[1]:undefined,u=o?Number(o):0;u!=u&&(u=0);var a=Math.min(Math.max(u,0),r);if(s+a>r)return!1;var f=-1;while(++f<s)if(n.charCodeAt(a+f)!=i.charCodeAt(f))return!1;return!0};e?e(String.prototype,"startsWith",{value:n,configurable:!0,writable:!0}):String.prototype.startsWith=n}(),CK.RequestReporting={reportRequest:NO,reportPath:null,reportType:null,willSend:function(){var e=arguments.callee.base.apply(this,arguments);return window.CloudOS&&CloudOS.requestSent(),e},willReceive:function(e,t){var n=arguments.callee.base.apply(this,arguments);if(window.CloudOS){var r,i,s=URI(e.getFullAddress()),o=t.get("rawRequest"),u=o?o.response:undefined,a=o?o.status:undefined,f=this.get("reportRequest");if(!a||a>=500)i=t.get("encodedBody"),f||(this.set("reportPath",null),f=YES);f&&(r={httpMethod:this.get("reportType")||this.get("type"),statusCode:o?o.status:999,serverHostname:s.hostname(),urlPath:this.get("reportPath")||s.path(),clientTiming:SC.getCurrentTimeForPerformance()-t.get("addedToOutgoingQueueTimestamp"),uncompressedResponseSize:u?u.length:undefined}),CloudOS.requestReceived(r,a,e.getFullAddress(),i)}return n}},CK.SUPPLEMENTARY_LOCALE_DATA={likelySubtags:{aa:"aa-Latn-ET",ab:"ab-Cyrl-GE",ace:"ace-Latn-ID",ach:"ach-Latn-UG",ady:"ady-Cyrl-RU",af:"af-Latn-ZA",agq:"agq-Latn-CM",ak:"ak-Latn-GH",alt:"alt-Cyrl-RU",am:"am-Ethi-ET",amo:"amo-Latn-NG",aoz:"aoz-Latn-ID",ar:"ar-Arab-EG",as:"as-Beng-IN",asa:"asa-Latn-TZ",ast:"ast-Latn-ES",atj:"atj-Latn-CA",av:"av-Cyrl-RU",awa:"awa-Deva-IN",ay:"ay-Latn-BO",az:"az-Latn-AZ","az-Arab":"az-Arab-IR","az-IR"
:"az-Arab-IR","az-RU":"az-Cyrl-RU",ba:"ba-Cyrl-RU",bal:"bal-Arab-PK",ban:"ban-Latn-ID",bap:"bap-Deva-NP",bas:"bas-Latn-CM",bax:"bax-Bamu-CM",bbc:"bbc-Latn-ID",bbj:"bbj-Latn-CM",be:"be-Cyrl-BY",bem:"bem-Latn-ZM",bez:"bez-Latn-TZ",bfd:"bfd-Latn-CM",bfq:"bfq-Taml-IN",bft:"bft-Arab-PK",bfy:"bfy-Deva-IN",bg:"bg-Cyrl-BG",bgx:"bgx-Grek-TR",bhb:"bhb-Deva-IN",bho:"bho-Deva-IN",bi:"bi-Latn-VU",bik:"bik-Latn-PH",bin:"bin-Latn-NG",bjj:"bjj-Deva-IN",bkm:"bkm-Latn-CM",bku:"bku-Latn-PH",bm:"bm-Latn-ML",bmq:"bmq-Latn-ML",bn:"bn-Beng-BD",bo:"bo-Tibt-CN",bqv:"bqv-Latn-CI",br:"br-Latn-FR",bra:"bra-Deva-IN",brx:"brx-Deva-IN",bs:"bs-Latn-BA",bss:"bss-Latn-CM",bto:"bto-Latn-PH",btv:"btv-Deva-PK",bua:"bua-Cyrl-RU",buc:"buc-Latn-YT",bug:"bug-Latn-ID",bum:"bum-Latn-CM",bvb:"bvb-Latn-GQ",bya:"bya-Latn-ID",byn:"byn-Ethi-ER",byv:"byv-Latn-CM",bze:"bze-Latn-ML",ca:"ca-Latn-ES",cch:"cch-Latn-NG",ccp:"ccp-Beng-IN",ce:"ce-Cyrl-RU",ceb:"ceb-Latn-PH",cgg:"cgg-Latn-UG",ch:"ch-Latn-GU",chk:"chk-Latn-FM",chm:"chm-Cyrl-RU",chp:"chp-Latn-CA",chr:"chr-Cher-US",cja:"cja-Arab-KH",cjm:"cjm-Cham-VN",ckb:"ckb-Arab-IQ",co:"co-Latn-FR",cr:"cr-Cans-CA",crj:"crj-Cans-CA",crk:"crk-Cans-CA",crl:"crl-Cans-CA",crm:"crm-Cans-CA",cs:"cs-Latn-CZ",csb:"csb-Latn-PL",csw:"csw-Cans-CA",cu:"cu-Cyrl-RU",cv:"cv-Cyrl-RU",cy:"cy-Latn-GB",da:"da-Latn-DK",dar:"dar-Cyrl-RU",dav:"dav-Latn-KE",de:"de-Latn-DE",den:"den-Latn-CA",dgr:"dgr-Latn-CA",dje:"dje-Latn-NE",dnj:"dnj-Latn-CI",doi:"doi-Arab-IN",dsb:"dsb-Latn-DE",dtm:"dtm-Latn-ML",dua:"dua-Latn-CM",dv:"dv-Thaa-MV",dyo:"dyo-Latn-SN",dyu:"dyu-Latn-BF",dz:"dz-Tibt-BT",ebu:"ebu-Latn-KE",ee:"ee-Latn-GH"
,efi:"efi-Latn-NG",el:"el-Grek-GR",en:"en-Latn-US",eo:"eo-Latn-001",es:"es-Latn-ES",et:"et-Latn-EE",eu:"eu-Latn-ES",ewo:"ewo-Latn-CM",fa:"fa-Arab-IR",fan:"fan-Latn-GQ",ff:"ff-Latn-SN",fi:"fi-Latn-FI",fil:"fil-Latn-PH",fit:"fit-Latn-SE",fj:"fj-Latn-FJ",fo:"fo-Latn-FO",fon:"fon-Latn-BJ",fr:"fr-Latn-FR",fur:"fur-Latn-IT",fy:"fy-Latn-NL",ga:"ga-Latn-IE",gaa:"gaa-Latn-GH",gag:"gag-Latn-MD",gbm:"gbm-Deva-IN",gcr:"gcr-Latn-GF",gd:"gd-Latn-GB",gez:"gez-Ethi-ET",ggn:"ggn-Deva-NP",gil:"gil-Latn-KI",gjk:"gjk-Arab-PK",gju:"gju-Arab-PK",gl:"gl-Latn-ES",gn:"gn-Latn-PY",gon:"gon-Telu-IN",gor:"gor-Latn-ID",gos:"gos-Latn-NL",grt:"grt-Beng-IN",gsw:"gsw-Latn-CH",gu:"gu-Gujr-IN",gub:"gub-Latn-BR",guz:"guz-Latn-KE",gv:"gv-Latn-IM",gvr:"gvr-Deva-NP",gwi:"gwi-Latn-CA",ha:"ha-Latn-NG","ha-CM":"ha-Arab-CM","ha-SD":"ha-Arab-SD",haw:"haw-Latn-US",he:"he-Hebr-IL",hi:"hi-Deva-IN",hil:"hil-Latn-PH",hnd:"hnd-Arab-PK",hne:"hne-Deva-IN",hnn:"hnn-Latn-PH",ho:"ho-Latn-PG",hoc:"hoc-Deva-IN",hoj:"hoj-Deva-IN",hr:"hr-Latn-HR",hsb:"hsb-Latn-DE",ht:"ht-Latn-HT",hu:"hu-Latn-HU",hy:"hy-Armn-AM",ia:"ia-Latn-FR",ibb:"ibb-Latn-NG",id:"id-Latn-ID",ig:"ig-Latn-NG",ii:"ii-Yiii-CN",ik:"ik-Latn-US",ilo:"ilo-Latn-PH","in":"in-Latn-ID",inh:"inh-Cyrl-RU",is:"is-Latn-IS",it:"it-Latn-IT",iu:"iu-Cans-CA",iw:"iw-Hebr-IL",ja:"ja-Jpan-JP",jgo:"jgo-Latn-CM",ji:"ji-Hebr-UA",jmc:"jmc-Latn-TZ",jml:"jml-Deva-NP",jv:"jv-Latn-ID",jw:"jw-Latn-ID",ka:"ka-Geor-GE",kaa:"kaa-Cyrl-UZ",kab:"kab-Latn-DZ",kaj:"kaj-Latn-NG",kam:"kam-Latn-KE",kao:"kao-Latn-ML",kbd:"kbd-Cyrl-RU",kcg:"kcg-Latn-NG",kck:"kck-Latn-ZW",kde:"kde-Latn-TZ",kdt:"kdt-Thai-TH",kea
:"kea-Latn-CV",ken:"ken-Latn-CM",kfo:"kfo-Latn-CI",kfr:"kfr-Deva-IN",kg:"kg-Latn-CD",kge:"kge-Latn-ID",kgp:"kgp-Latn-BR",kha:"kha-Latn-IN",khb:"khb-Talu-CN",khq:"khq-Latn-ML",kht:"kht-Mymr-IN",khw:"khw-Arab-PK",ki:"ki-Latn-KE",kj:"kj-Latn-NA",kjg:"kjg-Laoo-LA",kk:"kk-Cyrl-KZ","kk-AF":"kk-Arab-AF","kk-Arab":"kk-Arab-CN","kk-CN":"kk-Arab-CN","kk-IR":"kk-Arab-IR","kk-MN":"kk-Arab-MN",kkj:"kkj-Latn-CM",kl:"kl-Latn-GL",kln:"kln-Latn-KE",km:"km-Khmr-KH",kmb:"kmb-Latn-AO",kn:"kn-Knda-IN",ko:"ko-Kore-KR",koi:"koi-Cyrl-RU",kok:"kok-Deva-IN",kos:"kos-Latn-FM",kpe:"kpe-Latn-LR",krc:"krc-Cyrl-RU",kri:"kri-Latn-SL",krl:"krl-Latn-RU",kru:"kru-Deva-IN",ks:"ks-Arab-IN",ksb:"ksb-Latn-TZ",ksf:"ksf-Latn-CM",ksh:"ksh-Latn-DE",ku:"ku-Latn-TR","ku-Arab":"ku-Arab-IQ","ku-LB":"ku-Arab-LB",kum:"kum-Cyrl-RU",kv:"kv-Cyrl-RU",kvr:"kvr-Latn-ID",kvx:"kvx-Arab-PK",kw:"kw-Latn-GB",kxp:"kxp-Arab-PK",ky:"ky-Cyrl-KG","ky-Arab":"ky-Arab-CN","ky-CN":"ky-Arab-CN","ky-Latn":"ky-Latn-TR","ky-TR":"ky-Latn-TR",la:"la-Latn-VA",lag:"lag-Latn-TZ",lah:"lah-Arab-PK",lb:"lb-Latn-LU",lbe:"lbe-Cyrl-RU",lbw:"lbw-Latn-ID",lcp:"lcp-Thai-CN",lep:"lep-Lepc-IN",lez:"lez-Cyrl-RU",lg:"lg-Latn-UG",li:"li-Latn-NL",lif:"lif-Deva-NP",lis:"lis-Lisu-CN",lki:"lki-Arab-IR",lkt:"lkt-Latn-US",lmn:"lmn-Telu-IN",lmo:"lmo-Latn-CH",ln:"ln-Latn-CD",lo:"lo-Laoo-LA",lol:"lol-Latn-CD",loz:"loz-Latn-ZM",lt:"lt-Latn-LT",lu:"lu-Latn-CD",lua:"lua-Latn-CD",luo:"luo-Latn-KE",luy:"luy-Latn-KE",luz:"luz-Arab-IR",lv:"lv-Latn-LV",lwl:"lwl-Thai-TH",mad:"mad-Latn-ID",maf:"maf-Latn-CM",mag:"mag-Deva-IN",mai:"mai-Deva-IN",mak:"mak-Latn-ID",man:"man-Latn-GM","man-GN"
:"man-Nkoo-GN","man-Nkoo":"man-Nkoo-GN",mas:"mas-Latn-KE",maz:"maz-Latn-MX",mdf:"mdf-Cyrl-RU",mdh:"mdh-Latn-PH",mdr:"mdr-Latn-ID",men:"men-Latn-SL",mer:"mer-Latn-KE",mfe:"mfe-Latn-MU",mg:"mg-Latn-MG",mgh:"mgh-Latn-MZ",mgo:"mgo-Latn-CM",mgp:"mgp-Deva-NP",mgy:"mgy-Latn-TZ",mh:"mh-Latn-MH",mi:"mi-Latn-NZ",min:"min-Latn-ID",mk:"mk-Cyrl-MK",ml:"ml-Mlym-IN",mn:"mn-Cyrl-MN","mn-CN":"mn-Mong-CN","mn-Mong":"mn-Mong-CN",mni:"mni-Beng-IN",mnw:"mnw-Mymr-MM",moe:"moe-Latn-CA",mos:"mos-Latn-BF",mr:"mr-Deva-IN",mrd:"mrd-Deva-NP",mrj:"mrj-Cyrl-RU",ms:"ms-Latn-MY","ms-CC":"ms-Arab-CC","ms-ID":"ms-Arab-ID",mt:"mt-Latn-MT",mua:"mua-Latn-CM",mvy:"mvy-Arab-PK",mwk:"mwk-Latn-ML",mwr:"mwr-Deva-IN",mxc:"mxc-Latn-ZW",my:"my-Mymr-MM",myv:"myv-Cyrl-RU",na:"na-Latn-NR",nap:"nap-Latn-IT",naq:"naq-Latn-NA",nb:"nb-Latn-NO",nch:"nch-Latn-MX",nd:"nd-Latn-ZW",nds:"nds-Latn-DE",ne:"ne-Deva-NP","new":"new-Deva-NP",ng:"ng-Latn-NA",nhe:"nhe-Latn-MX",nhw:"nhw-Latn-MX",nij:"nij-Latn-ID",niu:"niu-Latn-NU",nl:"nl-Latn-NL",nmg:"nmg-Latn-CM",nn:"nn-Latn-NO",nnh:"nnh-Latn-CM",no:"no-Latn-NO",nod:"nod-Lana-TH",nr:"nr-Latn-ZA",nsk:"nsk-Cans-CA",nso:"nso-Latn-ZA",nus:"nus-Latn-SD",nv:"nv-Latn-US",nxq:"nxq-Latn-CN",ny:"ny-Latn-MW",nym:"nym-Latn-TZ",nyn:"nyn-Latn-UG",oc:"oc-Latn-FR",om:"om-Latn-ET",or:"or-Orya-IN",os:"os-Cyrl-GE",pa:"pa-Guru-IN","pa-Arab":"pa-Arab-PK","pa-PK":"pa-Arab-PK",pag:"pag-Latn-PH",pam:"pam-Latn-PH",pap:"pap-Latn-AW",pau:"pau-Latn-PW",pcm:"pcm-Latn-NG",pko:"pko-Latn-KE",pl:"pl-Latn-PL",pon:"pon-Latn-FM",prd:"prd-Arab-IR",prg:"prg-Latn-001",ps:"ps-Arab-AF",pt:"pt-Latn-BR",puu:"puu-Latn-GA",qu:"qu-Latn-PE"
,raj:"raj-Latn-IN",rcf:"rcf-Latn-RE",rej:"rej-Latn-ID",ria:"ria-Latn-IN",rjs:"rjs-Deva-NP",rkt:"rkt-Beng-BD",rm:"rm-Latn-CH",rmf:"rmf-Latn-FI",rmo:"rmo-Latn-CH",rmt:"rmt-Arab-IR",rmu:"rmu-Latn-SE",rn:"rn-Latn-BI",rng:"rng-Latn-MZ",ro:"ro-Latn-RO",rob:"rob-Latn-ID",rof:"rof-Latn-TZ",ru:"ru-Cyrl-RU",rue:"rue-Cyrl-UA",rw:"rw-Latn-RW",rwk:"rwk-Latn-TZ",ryu:"ryu-Kana-JP",sa:"sa-Deva-IN",saf:"saf-Latn-GH",sah:"sah-Cyrl-RU",saq:"saq-Latn-KE",sas:"sas-Latn-ID",sat:"sat-Latn-IN",saz:"saz-Saur-IN",sbp:"sbp-Latn-TZ",scn:"scn-Latn-IT",sco:"sco-Latn-GB",scs:"scs-Latn-CA",sd:"sd-Arab-PK","sd-Deva":"sd-Deva-IN",sdh:"sdh-Arab-IR",se:"se-Latn-NO",sef:"sef-Latn-CI",seh:"seh-Latn-MZ",ses:"ses-Latn-ML",sg:"sg-Latn-CF",shi:"shi-Tfng-MA",shn:"shn-Mymr-MM",si:"si-Sinh-LK",sid:"sid-Latn-ET",sk:"sk-Latn-SK",sl:"sl-Latn-SI",sm:"sm-Latn-WS",sma:"sma-Latn-SE",smj:"smj-Latn-SE",smn:"smn-Latn-FI",sms:"sms-Latn-FI",sn:"sn-Latn-ZW",snk:"snk-Latn-ML",so:"so-Latn-SO",sq:"sq-Latn-AL",sr:"sr-Cyrl-RS","sr-ME":"sr-Latn-ME","sr-RO":"sr-Latn-RO","sr-RU":"sr-Latn-RU","sr-TR":"sr-Latn-TR",srn:"srn-Latn-SR",srr:"srr-Latn-SN",srx:"srx-Deva-IN",ss:"ss-Latn-ZA",ssy:"ssy-Latn-ER",st:"st-Latn-ZA",su:"su-Latn-ID",suk:"suk-Latn-TZ",sus:"sus-Latn-GN",sv:"sv-Latn-SE",sw:"sw-Latn-TZ",swb:"swb-Arab-YT",swc:"swc-Latn-CD",sxn:"sxn-Latn-ID",syl:"syl-Beng-BD",syr:"syr-Syrc-IQ",ta:"ta-Taml-IN",taj:"taj-Deva-NP",tbw:"tbw-Latn-PH",tcy:"tcy-Knda-IN",tdd:"tdd-Tale-CN",tdg:"tdg-Deva-NP",tdh:"tdh-Deva-NP",te:"te-Telu-IN",tem:"tem-Latn-SL",teo:"teo-Latn-UG",tet:"tet-Latn-TL",tg:"tg-Cyrl-TJ","tg-Arab":"tg-Arab-PK","tg-PK":"tg-Arab-PK",th:"th-Thai-TH"
,thl:"thl-Deva-NP",thq:"thq-Deva-NP",thr:"thr-Deva-NP",ti:"ti-Ethi-ET",tig:"tig-Ethi-ER",tiv:"tiv-Latn-NG",tk:"tk-Latn-TM",tkl:"tkl-Latn-TK",tkt:"tkt-Deva-NP",tl:"tl-Latn-PH",tmh:"tmh-Latn-NE",tn:"tn-Latn-ZA",to:"to-Latn-TO",tpi:"tpi-Latn-PG",tr:"tr-Latn-TR",trv:"trv-Latn-TW",ts:"ts-Latn-ZA",tsf:"tsf-Deva-NP",tsg:"tsg-Latn-PH",tsj:"tsj-Tibt-BT",tt:"tt-Cyrl-RU",ttj:"ttj-Latn-UG",tts:"tts-Thai-TH",tum:"tum-Latn-MW",tvl:"tvl-Latn-TV",twq:"twq-Latn-NE",ty:"ty-Latn-PF",tyv:"tyv-Cyrl-RU",tzm:"tzm-Latn-MA",udm:"udm-Cyrl-RU",ug:"ug-Arab-CN","ug-Cyrl":"ug-Cyrl-KZ","ug-KZ":"ug-Cyrl-KZ","ug-MN":"ug-Cyrl-MN",uk:"uk-Cyrl-UA",uli:"uli-Latn-FM",umb:"umb-Latn-AO",und:"en-Latn-US","und-002":"en-Latn-NG","und-003":"en-Latn-US","und-005":"pt-Latn-BR","und-009":"en-Latn-AU","und-011":"en-Latn-NG","und-013":"es-Latn-MX","und-014":"en-Latn-KE","und-015":"ar-Arab-EG","und-017":"sw-Latn-CD","und-018":"en-Latn-ZA","und-019":"en-Latn-US","und-021":"en-Latn-US","und-029":"es-Latn-CU","und-030":"zh-Hans-CN","und-034":"hi-Deva-IN","und-035":"id-Latn-ID","und-039":"it-Latn-IT","und-053":"en-Latn-AU","und-054":"en-Latn-PG","und-057":"en-Latn-KI","und-061":"sm-Latn-WS","und-142":"zh-Hans-CN","und-143":"uz-Latn-UZ","und-145":"ar-Arab-SA","und-150":"ru-Cyrl-RU","und-151":"ru-Cyrl-RU","und-154":"en-Latn-GB","und-155":"de-Latn-DE","und-419":"es-Latn-419","und-AD":"ca-Latn-AD","und-AE":"ar-Arab-AE","und-AF":"fa-Arab-AF","und-AL":"sq-Latn-AL","und-AM":"hy-Armn-AM","und-AO":"pt-Latn-AO","und-AQ":"und-Latn-AQ","und-AR":"es-Latn-AR","und-AS":"sm-Latn-AS","und-AT":"de-Latn-AT","und-AW":"nl-Latn-AW","und-AX":"sv-Latn-AX"
,"und-AZ":"az-Latn-AZ","und-Arab":"ar-Arab-EG","und-Arab-CC":"ms-Arab-CC","und-Arab-CN":"ug-Arab-CN","und-Arab-GB":"ks-Arab-GB","und-Arab-ID":"ms-Arab-ID","und-Arab-IN":"ur-Arab-IN","und-Arab-KH":"cja-Arab-KH","und-Arab-MN":"kk-Arab-MN","und-Arab-MU":"ur-Arab-MU","und-Arab-NG":"ha-Arab-NG","und-Arab-PK":"ur-Arab-PK","und-Arab-TJ":"fa-Arab-TJ","und-Arab-TR":"zza-Arab-TR","und-Arab-YT":"swb-Arab-YT","und-Armi":"arc-Armi-IR","und-Armn":"hy-Armn-AM","und-Avst":"ae-Avst-IR","und-BA":"bs-Latn-BA","und-BD":"bn-Beng-BD","und-BE":"nl-Latn-BE","und-BF":"fr-Latn-BF","und-BG":"bg-Cyrl-BG","und-BH":"ar-Arab-BH","und-BI":"rn-Latn-BI","und-BJ":"fr-Latn-BJ","und-BL":"fr-Latn-BL","und-BN":"ms-Latn-BN","und-BO":"es-Latn-BO","und-BQ":"pap-Latn-BQ","und-BR":"pt-Latn-BR","und-BT":"dz-Tibt-BT","und-BV":"und-Latn-BV","und-BY":"be-Cyrl-BY","und-Bali":"ban-Bali-ID","und-Bamu":"bax-Bamu-CM","und-Batk":"bbc-Batk-ID","und-Beng":"bn-Beng-BD","und-Bopo":"zh-Bopo-TW","und-Brah":"pra-Brah-IN","und-Brai":"und-Brai-FR","und-Bugi":"bug-Bugi-ID","und-Buhd":"bku-Buhd-PH","und-CD":"sw-Latn-CD","und-CF":"fr-Latn-CF","und-CG":"fr-Latn-CG","und-CH":"de-Latn-CH","und-CI":"fr-Latn-CI","und-CL":"es-Latn-CL","und-CM":"fr-Latn-CM","und-CN":"zh-Hans-CN","und-CO":"es-Latn-CO","und-CP":"und-Latn-CP","und-CR":"es-Latn-CR","und-CU":"es-Latn-CU","und-CV":"pt-Latn-CV","und-CW":"pap-Latn-CW","und-CY":"el-Grek-CY","und-CZ":"cs-Latn-CZ","und-Cakm":"ccp-Cakm-BD","und-Cans":"cr-Cans-CA","und-Cari":"xcr-Cari-TR","und-Cham":"cjm-Cham-VN","und-Cher":"chr-Cher-US","und-Copt":"cop-Copt-EG","und-Cprt":"grc-Cprt-CY","und-Cyrl":"ru-Cyrl-RU"
,"und-Cyrl-AL":"mk-Cyrl-AL","und-Cyrl-BA":"sr-Cyrl-BA","und-Cyrl-GE":"ab-Cyrl-GE","und-Cyrl-GR":"mk-Cyrl-GR","und-Cyrl-MD":"uk-Cyrl-MD","und-Cyrl-PL":"be-Cyrl-PL","und-Cyrl-RO":"bg-Cyrl-RO","und-Cyrl-SK":"uk-Cyrl-SK","und-Cyrl-TR":"kbd-Cyrl-TR","und-Cyrl-XK":"sr-Cyrl-XK","und-DE":"de-Latn-DE","und-DJ":"aa-Latn-DJ","und-DK":"da-Latn-DK","und-DO":"es-Latn-DO","und-DZ":"ar-Arab-DZ","und-Deva":"hi-Deva-IN","und-Deva-BT":"ne-Deva-BT","und-Deva-MU":"bho-Deva-MU","und-Deva-PK":"btv-Deva-PK","und-EA":"es-Latn-EA","und-EC":"es-Latn-EC","und-EE":"et-Latn-EE","und-EG":"ar-Arab-EG","und-EH":"ar-Arab-EH","und-ER":"ti-Ethi-ER","und-ES":"es-Latn-ES","und-ET":"am-Ethi-ET","und-EU":"en-Latn-GB","und-Egyp":"egy-Egyp-EG","und-Ethi":"am-Ethi-ET","und-FI":"fi-Latn-FI","und-FM":"chk-Latn-FM","und-FO":"fo-Latn-FO","und-FR":"fr-Latn-FR","und-GA":"fr-Latn-GA","und-GE":"ka-Geor-GE","und-GF":"fr-Latn-GF","und-GH":"ak-Latn-GH","und-GL":"kl-Latn-GL","und-GN":"fr-Latn-GN","und-GP":"fr-Latn-GP","und-GQ":"es-Latn-GQ","und-GR":"el-Grek-GR","und-GS":"und-Latn-GS","und-GT":"es-Latn-GT","und-GW":"pt-Latn-GW","und-Geor":"ka-Geor-GE","und-Glag":"cu-Glag-BG","und-Goth":"got-Goth-UA","und-Grek":"el-Grek-GR","und-Grek-TR":"bgx-Grek-TR","und-Gujr":"gu-Gujr-IN","und-Guru":"pa-Guru-IN","und-HK":"zh-Hant-HK","und-HM":"und-Latn-HM","und-HN":"es-Latn-HN","und-HR":"hr-Latn-HR","und-HT":"ht-Latn-HT","und-HU":"hu-Latn-HU","und-Hang":"ko-Hang-KR","und-Hani":"zh-Hani-CN","und-Hano":"hnn-Hano-PH","und-Hans":"zh-Hans-CN","und-Hant":"zh-Hant-TW","und-Hebr":"he-Hebr-IL","und-Hebr-CA":"yi-Hebr-CA","und-Hebr-GB":"yi-Hebr-GB","und-Hebr-SE"
:"yi-Hebr-SE","und-Hebr-UA":"yi-Hebr-UA","und-Hebr-US":"yi-Hebr-US","und-Hira":"ja-Hira-JP","und-IC":"es-Latn-IC","und-ID":"id-Latn-ID","und-IL":"he-Hebr-IL","und-IN":"hi-Deva-IN","und-IQ":"ar-Arab-IQ","und-IR":"fa-Arab-IR","und-IS":"is-Latn-IS","und-IT":"it-Latn-IT","und-Ital":"ett-Ital-IT","und-JO":"ar-Arab-JO","und-JP":"ja-Jpan-JP","und-Java":"jv-Java-ID","und-Jpan":"ja-Jpan-JP","und-KG":"ky-Cyrl-KG","und-KH":"km-Khmr-KH","und-KM":"ar-Arab-KM","und-KP":"ko-Kore-KP","und-KR":"ko-Kore-KR","und-KW":"ar-Arab-KW","und-KZ":"ru-Cyrl-KZ","und-Kali":"eky-Kali-MM","und-Kana":"ja-Kana-JP","und-Khar":"pra-Khar-PK","und-Khmr":"km-Khmr-KH","und-Knda":"kn-Knda-IN","und-Kore":"ko-Kore-KR","und-Kthi":"bh-Kthi-IN","und-LA":"lo-Laoo-LA","und-LB":"ar-Arab-LB","und-LI":"de-Latn-LI","und-LK":"si-Sinh-LK","und-LS":"st-Latn-LS","und-LT":"lt-Latn-LT","und-LU":"fr-Latn-LU","und-LV":"lv-Latn-LV","und-LY":"ar-Arab-LY","und-Lana":"nod-Lana-TH","und-Laoo":"lo-Laoo-LA","und-Latn-AF":"tk-Latn-AF","und-Latn-AM":"az-Latn-AM","und-Latn-BG":"tr-Latn-BG","und-Latn-CN":"za-Latn-CN","und-Latn-CY":"tr-Latn-CY","und-Latn-DZ":"fr-Latn-DZ","und-Latn-ET":"en-Latn-ET","und-Latn-GE":"ku-Latn-GE","und-Latn-GR":"tr-Latn-GR","und-Latn-IL":"ro-Latn-IL","und-Latn-IR":"tk-Latn-IR","und-Latn-KM":"fr-Latn-KM","und-Latn-KZ":"de-Latn-KZ","und-Latn-LB":"fr-Latn-LB","und-Latn-MA":"fr-Latn-MA","und-Latn-MK":"sq-Latn-MK","und-Latn-MO":"pt-Latn-MO","und-Latn-MR":"fr-Latn-MR","und-Latn-RU":"krl-Latn-RU","und-Latn-SY":"fr-Latn-SY","und-Latn-TN":"fr-Latn-TN","und-Latn-TW":"trv-Latn-TW","und-Latn-UA":"pl-Latn-UA","und-Lepc":"lep-Lepc-IN"
,"und-Limb":"lif-Limb-IN","und-Linb":"grc-Linb-GR","und-Lisu":"lis-Lisu-CN","und-Lyci":"xlc-Lyci-TR","und-Lydi":"xld-Lydi-TR","und-MA":"ar-Arab-MA","und-MC":"fr-Latn-MC","und-MD":"ro-Latn-MD","und-ME":"sr-Latn-ME","und-MF":"fr-Latn-MF","und-MG":"mg-Latn-MG","und-MK":"mk-Cyrl-MK","und-ML":"bm-Latn-ML","und-MM":"my-Mymr-MM","und-MN":"mn-Cyrl-MN","und-MO":"zh-Hant-MO","und-MQ":"fr-Latn-MQ","und-MR":"ar-Arab-MR","und-MT":"mt-Latn-MT","und-MU":"mfe-Latn-MU","und-MV":"dv-Thaa-MV","und-MX":"es-Latn-MX","und-MY":"ms-Latn-MY","und-MZ":"pt-Latn-MZ","und-Mand":"myz-Mand-IR","und-Merc":"xmr-Merc-SD","und-Mero":"xmr-Mero-SD","und-Mlym":"ml-Mlym-IN","und-Mong":"mn-Mong-CN","und-Mtei":"mni-Mtei-IN","und-Mymr":"my-Mymr-MM","und-Mymr-IN":"kht-Mymr-IN","und-Mymr-TH":"mnw-Mymr-TH","und-NA":"af-Latn-NA","und-NC":"fr-Latn-NC","und-NE":"ha-Latn-NE","und-NI":"es-Latn-NI","und-NL":"nl-Latn-NL","und-NO":"nb-Latn-NO","und-NP":"ne-Deva-NP","und-Nkoo":"man-Nkoo-GN","und-OM":"ar-Arab-OM","und-Ogam":"sga-Ogam-IE","und-Olck":"sat-Olck-IN","und-Orkh":"otk-Orkh-MN","und-Orya":"or-Orya-IN","und-Osma":"so-Osma-SO","und-PA":"es-Latn-PA","und-PE":"es-Latn-PE","und-PF":"fr-Latn-PF","und-PG":"tpi-Latn-PG","und-PH":"fil-Latn-PH","und-PK":"ur-Arab-PK","und-PL":"pl-Latn-PL","und-PM":"fr-Latn-PM","und-PR":"es-Latn-PR","und-PS":"ar-Arab-PS","und-PT":"pt-Latn-PT","und-PW":"pau-Latn-PW","und-PY":"gn-Latn-PY","und-Phag":"lzh-Phag-CN","und-Phli":"pal-Phli-IR","und-Phnx":"phn-Phnx-LB","und-Plrd":"hmd-Plrd-CN","und-Prti":"xpr-Prti-IR","und-QA":"ar-Arab-QA","und-QO":"en-Latn-IO","und-RE":"fr-Latn-RE","und-RO":"ro-Latn-RO","und-RS"
:"sr-Cyrl-RS","und-RU":"ru-Cyrl-RU","und-RW":"rw-Latn-RW","und-Rjng":"rej-Rjng-ID","und-Runr":"non-Runr-SE","und-SA":"ar-Arab-SA","und-SC":"fr-Latn-SC","und-SD":"ar-Arab-SD","und-SE":"sv-Latn-SE","und-SI":"sl-Latn-SI","und-SJ":"nb-Latn-SJ","und-SK":"sk-Latn-SK","und-SM":"it-Latn-SM","und-SN":"fr-Latn-SN","und-SO":"so-Latn-SO","und-SR":"nl-Latn-SR","und-ST":"pt-Latn-ST","und-SV":"es-Latn-SV","und-SY":"ar-Arab-SY","und-Samr":"smp-Samr-IL","und-Sarb":"xsa-Sarb-YE","und-Saur":"saz-Saur-IN","und-Shaw":"en-Shaw-GB","und-Shrd":"sa-Shrd-IN","und-Sinh":"si-Sinh-LK","und-Sora":"srb-Sora-IN","und-Sund":"su-Sund-ID","und-Sylo":"syl-Sylo-BD","und-Syrc":"syr-Syrc-IQ","und-TD":"fr-Latn-TD","und-TF":"fr-Latn-TF","und-TG":"fr-Latn-TG","und-TH":"th-Thai-TH","und-TJ":"tg-Cyrl-TJ","und-TK":"tkl-Latn-TK","und-TL":"pt-Latn-TL","und-TM":"tk-Latn-TM","und-TN":"ar-Arab-TN","und-TO":"to-Latn-TO","und-TR":"tr-Latn-TR","und-TV":"tvl-Latn-TV","und-TW":"zh-Hant-TW","und-TZ":"sw-Latn-TZ","und-Tagb":"tbw-Tagb-PH","und-Takr":"doi-Takr-IN","und-Tale":"tdd-Tale-CN","und-Talu":"khb-Talu-CN","und-Taml":"ta-Taml-IN","und-Tavt":"blt-Tavt-VN","und-Telu":"te-Telu-IN","und-Tfng":"zgh-Tfng-MA","und-Tglg":"fil-Tglg-PH","und-Thaa":"dv-Thaa-MV","und-Thai":"th-Thai-TH","und-Thai-CN":"lcp-Thai-CN","und-Thai-KH":"kdt-Thai-KH","und-Thai-LA":"kdt-Thai-LA","und-Tibt":"bo-Tibt-CN","und-UA":"uk-Cyrl-UA","und-UG":"sw-Latn-UG","und-UY":"es-Latn-UY","und-UZ":"uz-Latn-UZ","und-Ugar":"uga-Ugar-SY","und-VA":"la-Latn-VA","und-VE":"es-Latn-VE","und-VN":"vi-Latn-VN","und-VU":"bi-Latn-VU","und-Vaii":"vai-Vaii-LR","und-WF":"fr-Latn-WF","und-WS"
:"sm-Latn-WS","und-XK":"sq-Latn-XK","und-Xpeo":"peo-Xpeo-IR","und-Xsux":"akk-Xsux-IQ","und-YE":"ar-Arab-YE","und-YT":"fr-Latn-YT","und-Yiii":"ii-Yiii-CN",unr:"unr-Beng-IN","unr-Deva":"unr-Deva-NP","unr-NP":"unr-Deva-NP",unx:"unx-Beng-IN",ur:"ur-Arab-PK",uz:"uz-Latn-UZ","uz-AF":"uz-Arab-AF","uz-Arab":"uz-Arab-AF","uz-CN":"uz-Cyrl-CN",vai:"vai-Vaii-LR",ve:"ve-Latn-ZA",vi:"vi-Latn-VN",vic:"vic-Latn-SX",vo:"vo-Latn-001",vun:"vun-Latn-TZ",wa:"wa-Latn-BE",wae:"wae-Latn-CH",wal:"wal-Ethi-ET",war:"war-Latn-PH",wo:"wo-Latn-SN",xav:"xav-Latn-BR",xh:"xh-Latn-ZA",xog:"xog-Latn-UG",xsr:"xsr-Deva-NP",yao:"yao-Latn-MZ",yap:"yap-Latn-FM",yav:"yav-Latn-CM",ybb:"ybb-Latn-CM",yi:"yi-Hebr-UA",yo:"yo-Latn-NG",yua:"yua-Latn-MX",za:"za-Latn-CN",zea:"zea-Latn-NL",zgh:"zgh-Tfng-MA",zh:"zh-Hans-CN","zh-AU":"zh-Hant-AU","zh-BN":"zh-Hant-BN","zh-CN":"zh-Hans-CN","zh-GB":"zh-Hant-GB","zh-GF":"zh-Hant-GF","zh-HK":"zh-Hant-HK","zh-Hant":"zh-Hant-TW","zh-ID":"zh-Hant-ID","zh-MO":"zh-Hant-MO","zh-MY":"zh-Hant-MY","zh-PA":"zh-Hant-PA","zh-PF":"zh-Hant-PF","zh-PH":"zh-Hant-PH","zh-SR":"zh-Hant-SR","zh-TH":"zh-Hant-TH","zh-TW":"zh-Hant-TW","zh-US":"zh-Hant-US","zh-VN":"zh-Hant-VN",zmi:"zmi-Latn-MY",zu:"zu-Latn-ZA",zza:"zza-Arab-TR"},metadata:{alias:{languageAlias:{"aa-SAAHO":{_replacement:"ssy",_reason:"deprecated"},aar:{_replacement:"aa",_reason:"overlong"},abk:{_replacement:"ab",_reason:"overlong"},afr:{_replacement:"af",_reason:"overlong"},aju:{_replacement:"jrb",_reason:"macrolanguage"},aka:{_replacement:"ak",_reason:"overlong"},als:{_replacement:"sq",_reason:"macrolanguage"},amh:{_replacement:"am",_reason
:"overlong"},ara:{_replacement:"ar",_reason:"overlong"},arb:{_replacement:"ar",_reason:"macrolanguage"},arg:{_replacement:"an",_reason:"overlong"},"art-lojban":{_replacement:"jbo",_reason:"deprecated"},asm:{_replacement:"as",_reason:"overlong"},ava:{_replacement:"av",_reason:"overlong"},ave:{_replacement:"ae",_reason:"overlong"},aym:{_replacement:"ay",_reason:"overlong"},ayr:{_replacement:"ay",_reason:"macrolanguage"},aze:{_replacement:"az",_reason:"overlong"},azj:{_replacement:"az",_reason:"macrolanguage"},bak:{_replacement:"ba",_reason:"overlong"},bam:{_replacement:"bm",_reason:"overlong"},bcc:{_replacement:"bal",_reason:"macrolanguage"},bcl:{_replacement:"bik",_reason:"macrolanguage"},bel:{_replacement:"be",_reason:"overlong"},ben:{_replacement:"bn",_reason:"overlong"},bih:{_replacement:"bh",_reason:"overlong"},bis:{_replacement:"bi",_reason:"overlong"},bod:{_replacement:"bo",_reason:"overlong"},bos:{_replacement:"bs",_reason:"overlong"},bre:{_replacement:"br",_reason:"overlong"},bul:{_replacement:"bg",_reason:"overlong"},bxk:{_replacement:"luy",_reason:"macrolanguage"},bxr:{_replacement:"bua",_reason:"macrolanguage"},cat:{_replacement:"ca",_reason:"overlong"},ces:{_replacement:"cs",_reason:"overlong"},cha:{_replacement:"ch",_reason:"overlong"},che:{_replacement:"ce",_reason:"overlong"},chu:{_replacement:"cu",_reason:"overlong"},chv:{_replacement:"cv",_reason:"overlong"},cld:{_replacement:"syr",_reason:"macrolanguage"},cmn:{_replacement:"zh",_reason:"macrolanguage"},cor:{_replacement:"kw",_reason:"overlong"},cos:{_replacement:"co",_reason:"overlong"},cre:{_replacement:"cr"
,_reason:"overlong"},cwd:{_replacement:"cr",_reason:"macrolanguage"},cym:{_replacement:"cy",_reason:"overlong"},dan:{_replacement:"da",_reason:"overlong"},deu:{_replacement:"de",_reason:"overlong"},dgo:{_replacement:"doi",_reason:"macrolanguage"},dhd:{_replacement:"mwr",_reason:"macrolanguage"},dik:{_replacement:"din",_reason:"macrolanguage"},diq:{_replacement:"zza",_reason:"macrolanguage"},div:{_replacement:"dv",_reason:"overlong"},dzo:{_replacement:"dz",_reason:"overlong"},ekk:{_replacement:"et",_reason:"macrolanguage"},ell:{_replacement:"el",_reason:"overlong"},emk:{_replacement:"man",_reason:"macrolanguage"},eng:{_replacement:"en",_reason:"overlong"},epo:{_replacement:"eo",_reason:"overlong"},esk:{_replacement:"ik",_reason:"macrolanguage"},est:{_replacement:"et",_reason:"overlong"},eus:{_replacement:"eu",_reason:"overlong"},ewe:{_replacement:"ee",_reason:"overlong"},fao:{_replacement:"fo",_reason:"overlong"},fas:{_replacement:"fa",_reason:"overlong"},fat:{_replacement:"ak",_reason:"macrolanguage"},fij:{_replacement:"fj",_reason:"overlong"},fin:{_replacement:"fi",_reason:"overlong"},fra:{_replacement:"fr",_reason:"overlong"},fry:{_replacement:"fy",_reason:"overlong"},fuc:{_replacement:"ff",_reason:"macrolanguage"},ful:{_replacement:"ff",_reason:"overlong"},gaz:{_replacement:"om",_reason:"macrolanguage"},gbo:{_replacement:"grb",_reason:"macrolanguage"},gla:{_replacement:"gd",_reason:"overlong"},gle:{_replacement:"ga",_reason:"overlong"},glg:{_replacement:"gl",_reason:"overlong"},glv:{_replacement:"gv",_reason:"overlong"},gno:{_replacement:"gon",_reason:"macrolanguage"},grn
:{_replacement:"gn",_reason:"overlong"},gug:{_replacement:"gn",_reason:"macrolanguage"},guj:{_replacement:"gu",_reason:"overlong"},gya:{_replacement:"gba",_reason:"macrolanguage"},hat:{_replacement:"ht",_reason:"overlong"},hau:{_replacement:"ha",_reason:"overlong"},hbs:{_replacement:"sr-Latn",_reason:"overlong"},hdn:{_replacement:"hai",_reason:"macrolanguage"},hea:{_replacement:"hmn",_reason:"macrolanguage"},heb:{_replacement:"he",_reason:"overlong"},her:{_replacement:"hz",_reason:"overlong"},him:{_replacement:"srx",_reason:"macrolanguage"},hin:{_replacement:"hi",_reason:"overlong"},hmo:{_replacement:"ho",_reason:"overlong"},hrv:{_replacement:"hr",_reason:"overlong"},hun:{_replacement:"hu",_reason:"overlong"},hye:{_replacement:"hy",_reason:"overlong"},"i-ami":{_replacement:"ami",_reason:"deprecated"},"i-bnn":{_replacement:"bnn",_reason:"deprecated"},"i-hak":{_replacement:"hak",_reason:"deprecated"},"i-klingon":{_replacement:"tlh",_reason:"deprecated"},"i-lux":{_replacement:"lb",_reason:"deprecated"},"i-navajo":{_replacement:"nv",_reason:"deprecated"},"i-pwn":{_replacement:"pwn",_reason:"deprecated"},"i-tao":{_replacement:"tao",_reason:"deprecated"},"i-tay":{_replacement:"tay",_reason:"deprecated"},"i-tsu":{_replacement:"tsu",_reason:"deprecated"},ibo:{_replacement:"ig",_reason:"overlong"},ido:{_replacement:"io",_reason:"overlong"},iii:{_replacement:"ii",_reason:"overlong"},ike:{_replacement:"iu",_reason:"macrolanguage"},iku:{_replacement:"iu",_reason:"overlong"},ile:{_replacement:"ie",_reason:"overlong"},"in":{_replacement:"id",_reason:"deprecated"},ina:{_replacement:"ia",_reason
:"overlong"},ind:{_replacement:"id",_reason:"overlong"},ipk:{_replacement:"ik",_reason:"overlong"},isl:{_replacement:"is",_reason:"overlong"},ita:{_replacement:"it",_reason:"overlong"},iw:{_replacement:"he",_reason:"deprecated"},jav:{_replacement:"jv",_reason:"overlong"},ji:{_replacement:"yi",_reason:"deprecated"},jpn:{_replacement:"ja",_reason:"overlong"},jw:{_replacement:"jv",_reason:"deprecated"},kal:{_replacement:"kl",_reason:"overlong"},kan:{_replacement:"kn",_reason:"overlong"},kas:{_replacement:"ks",_reason:"overlong"},kat:{_replacement:"ka",_reason:"overlong"},kau:{_replacement:"kr",_reason:"overlong"},kaz:{_replacement:"kk",_reason:"overlong"},khk:{_replacement:"mn",_reason:"macrolanguage"},khm:{_replacement:"km",_reason:"overlong"},kik:{_replacement:"ki",_reason:"overlong"},kin:{_replacement:"rw",_reason:"overlong"},kir:{_replacement:"ky",_reason:"overlong"},kmr:{_replacement:"ku",_reason:"macrolanguage"},knc:{_replacement:"kr",_reason:"macrolanguage"},kng:{_replacement:"kg",_reason:"macrolanguage"},knn:{_replacement:"kok",_reason:"macrolanguage"},kom:{_replacement:"kv",_reason:"overlong"},kon:{_replacement:"kg",_reason:"overlong"},kor:{_replacement:"ko",_reason:"overlong"},kpv:{_replacement:"kv",_reason:"macrolanguage"},kua:{_replacement:"kj",_reason:"overlong"},kur:{_replacement:"ku",_reason:"overlong"},lao:{_replacement:"lo",_reason:"overlong"},lat:{_replacement:"la",_reason:"overlong"},lav:{_replacement:"lv",_reason:"overlong"},lbk:{_replacement:"bnc",_reason:"macrolanguage"},lim:{_replacement:"li",_reason:"overlong"},lin:{_replacement:"ln",_reason:"overlong"},
lit:{_replacement:"lt",_reason:"overlong"},ltz:{_replacement:"lb",_reason:"overlong"},lub:{_replacement:"lu",_reason:"overlong"},lug:{_replacement:"lg",_reason:"overlong"},lvs:{_replacement:"lv",_reason:"macrolanguage"},mah:{_replacement:"mh",_reason:"overlong"},mal:{_replacement:"ml",_reason:"overlong"},mar:{_replacement:"mr",_reason:"overlong"},mhr:{_replacement:"chm",_reason:"macrolanguage"},mkd:{_replacement:"mk",_reason:"overlong"},mlg:{_replacement:"mg",_reason:"overlong"},mlt:{_replacement:"mt",_reason:"overlong"},mnk:{_replacement:"man",_reason:"macrolanguage"},mo:{_replacement:"ro-MD",_reason:"deprecated"},mol:{_replacement:"ro-MD",_reason:"overlong"},mon:{_replacement:"mn",_reason:"overlong"},mri:{_replacement:"mi",_reason:"overlong"},msa:{_replacement:"ms",_reason:"overlong"},mup:{_replacement:"raj",_reason:"macrolanguage"},mya:{_replacement:"my",_reason:"overlong"},nau:{_replacement:"na",_reason:"overlong"},nav:{_replacement:"nv",_reason:"overlong"},nbl:{_replacement:"nr",_reason:"overlong"},nde:{_replacement:"nd",_reason:"overlong"},ndo:{_replacement:"ng",_reason:"overlong"},nep:{_replacement:"ne",_reason:"overlong"},nld:{_replacement:"nl",_reason:"overlong"},nno:{_replacement:"nn",_reason:"overlong"},no:{_replacement:"nb",_reason:"legacy"},"no-BOKMAL":{_replacement:"nb",_reason:"deprecated"},"no-NYNORSK":{_replacement:"nn",_reason:"deprecated"},"no-bok":{_replacement:"nb",_reason:"deprecated"},"no-nyn":{_replacement:"nn",_reason:"deprecated"},nob:{_replacement:"nb",_reason:"overlong"},nor:{_replacement:"nb",_reason:"overlong"},npi:{_replacement:"ne",_reason:"macrolanguage"
},nya:{_replacement:"ny",_reason:"overlong"},oci:{_replacement:"oc",_reason:"overlong"},ojg:{_replacement:"oj",_reason:"macrolanguage"},oji:{_replacement:"oj",_reason:"overlong"},ori:{_replacement:"or",_reason:"overlong"},orm:{_replacement:"om",_reason:"overlong"},ory:{_replacement:"or",_reason:"macrolanguage"},oss:{_replacement:"os",_reason:"overlong"},pan:{_replacement:"pa",_reason:"overlong"},pbu:{_replacement:"ps",_reason:"macrolanguage"},pes:{_replacement:"fa",_reason:"macrolanguage"},pli:{_replacement:"pi",_reason:"overlong"},plt:{_replacement:"mg",_reason:"macrolanguage"},pnb:{_replacement:"lah",_reason:"macrolanguage"},pol:{_replacement:"pl",_reason:"overlong"},por:{_replacement:"pt",_reason:"overlong"},pus:{_replacement:"ps",_reason:"overlong"},que:{_replacement:"qu",_reason:"overlong"},qxp:{_replacement:"qu",_reason:"macrolanguage"},rmy:{_replacement:"rom",_reason:"macrolanguage"},roh:{_replacement:"rm",_reason:"overlong"},ron:{_replacement:"ro",_reason:"overlong"},run:{_replacement:"rn",_reason:"overlong"},rus:{_replacement:"ru",_reason:"overlong"},sag:{_replacement:"sg",_reason:"overlong"},san:{_replacement:"sa",_reason:"overlong"},"sgn-BE-FR":{_replacement:"sfb",_reason:"deprecated"},"sgn-BE-NL":{_replacement:"vgt",_reason:"deprecated"},"sgn-CH-DE":{_replacement:"sgg",_reason:"deprecated"},sh:{_replacement:"sr-Latn",_reason:"legacy"},sin:{_replacement:"si",_reason:"overlong"},slk:{_replacement:"sk",_reason:"overlong"},slv:{_replacement:"sl",_reason:"overlong"},sme:{_replacement:"se",_reason:"overlong"},smo:{_replacement:"sm",_reason:"overlong"},sna:{_replacement
:"sn",_reason:"overlong"},snd:{_replacement:"sd",_reason:"overlong"},som:{_replacement:"so",_reason:"overlong"},sot:{_replacement:"st",_reason:"overlong"},spa:{_replacement:"es",_reason:"overlong"},spy:{_replacement:"kln",_reason:"macrolanguage"},sqi:{_replacement:"sq",_reason:"overlong"},src:{_replacement:"sc",_reason:"macrolanguage"},srd:{_replacement:"sc",_reason:"overlong"},srp:{_replacement:"sr",_reason:"overlong"},ssw:{_replacement:"ss",_reason:"overlong"},sun:{_replacement:"su",_reason:"overlong"},swa:{_replacement:"sw",_reason:"overlong"},swe:{_replacement:"sv",_reason:"overlong"},swh:{_replacement:"sw",_reason:"macrolanguage"},tah:{_replacement:"ty",_reason:"overlong"},tam:{_replacement:"ta",_reason:"overlong"},tat:{_replacement:"tt",_reason:"overlong"},tel:{_replacement:"te",_reason:"overlong"},tgk:{_replacement:"tg",_reason:"overlong"},tgl:{_replacement:"fil",_reason:"overlong"},tha:{_replacement:"th",_reason:"overlong"},tir:{_replacement:"ti",_reason:"overlong"},tl:{_replacement:"fil",_reason:"legacy"},ton:{_replacement:"to",_reason:"overlong"},tsn:{_replacement:"tn",_reason:"overlong"},tso:{_replacement:"ts",_reason:"overlong"},ttq:{_replacement:"tmh",_reason:"macrolanguage"},tuk:{_replacement:"tk",_reason:"overlong"},tur:{_replacement:"tr",_reason:"overlong"},tw:{_replacement:"ak",_reason:"macrolanguage"},twi:{_replacement:"ak",_reason:"overlong"},uig:{_replacement:"ug",_reason:"overlong"},ukr:{_replacement:"uk",_reason:"overlong"},umu:{_replacement:"del",_reason:"macrolanguage"},urd:{_replacement:"ur",_reason:"overlong"},uzb:{_replacement:"uz",_reason:"overlong"
},uzn:{_replacement:"uz",_reason:"macrolanguage"},ven:{_replacement:"ve",_reason:"overlong"},vie:{_replacement:"vi",_reason:"overlong"},vol:{_replacement:"vo",_reason:"overlong"},wln:{_replacement:"wa",_reason:"overlong"},wol:{_replacement:"wo",_reason:"overlong"},xho:{_replacement:"xh",_reason:"overlong"},xpe:{_replacement:"kpe",_reason:"macrolanguage"},xsl:{_replacement:"den",_reason:"macrolanguage"},ydd:{_replacement:"yi",_reason:"macrolanguage"},yid:{_replacement:"yi",_reason:"overlong"},yor:{_replacement:"yo",_reason:"overlong"},zai:{_replacement:"zap",_reason:"macrolanguage"},"zh-guoyu":{_replacement:"zh",_reason:"deprecated"},"zh-hakka":{_replacement:"hak",_reason:"deprecated"},"zh-min":{_reason:"deprecated"},"zh-min-nan":{_replacement:"nan",_reason:"deprecated"},"zh-xiang":{_replacement:"hsn",_reason:"deprecated"},zha:{_replacement:"za",_reason:"overlong"},zho:{_replacement:"zh",_reason:"overlong"},zsm:{_replacement:"ms",_reason:"macrolanguage"},zul:{_replacement:"zu",_reason:"overlong"},zyb:{_replacement:"za",_reason:"macrolanguage"}}}}},CK.SUPPORTED_REGION_FORMATS=["af","af-na","af-za","agq","agq-cm","ak","ak-gh","am","am-et","ar","ar-001","ar-ae","ar-bh","ar-dj","ar-dz","ar-eg","ar-eh","ar-er","ar-il","ar-iq","ar-jo","ar-km","ar-kw","ar-lb","ar-ly","ar-ma","ar-mr","ar-om","ar-ps","ar-qa","ar-sa","ar-sd","ar-so","ar-ss","ar-sy","ar-td","ar-tn","ar-ye","as","as-in","asa","asa-tz","az","az-cyrl","az-cyrl-az","az-latn","az-latn-az","bas","bas-cm","be","be-by","bem","bem-zm","bez","bez-tz","bg","bg-bg","bm","bm-ml","bn","bn-bd","bn-in","bo","bo-cn","bo-in","br","br-fr"
,"brx","brx-in","bs","bs-cyrl","bs-cyrl-ba","bs-latn","bs-latn-ba","ca","ca-ad","ca-es","ca-fr","ca-it","cgg","cgg-ug","chr","chr-us","ckb","cs","cs-cz","cy","cy-gb","da","da-dk","da-gl","dav","dav-ke","de","de-at","de-be","de-ch","de-de","de-li","de-lu","dje","dje-ne","dua","dua-cm","dyo","dyo-sn","dz","dz-bt","ebu","ebu-ke","ee","ee-gh","ee-tg","el","el-cy","el-gr","en","en-001","en-150","en-ad","en-ag","en-ai","en-al","en-as","en-at","en-au","en-ba","en-bb","en-be","en-bm","en-bs","en-bw","en-bz","en-ca","en-cc","en-ch","en-ck","en-cm","en-cx","en-cy","en-cz","en-de","en-dg","en-dk","en-dm","en-ee","en-er","en-es","en-fi","en-fj","en-fk","en-fm","en-fr","en-gb","en-gd","en-gg","en-gh","en-gi","en-gm","en-gu","en-gy","en-hk","en-hr","en-hu","en-ie","en-im","en-in","en-io","en-is","en-it","en-je","en-jm","en-ke","en-ki","en-kn","en-ky","en-lc","en-lr","en-ls","en-lt","en-lu","en-lv","en-me","en-mg","en-mh","en-mo","en-mp","en-ms","en-mt","en-mu","en-mw","en-na","en-nf","en-ng","en-nl","en-no","en-nr","en-nu","en-nz","en-pg","en-ph","en-pk","en-pl","en-pn","en-pr","en-pt","en-pw","en-ro","en-ru","en-rw","en-sb","en-sc","en-sd","en-se","en-sg","en-sh","en-si","en-sk","en-sl","en-ss","en-sx","en-sz","en-tc","en-tk","en-to","en-tr","en-tt","en-tv","en-tz","en-ug","en-um","en-us","en-us-posix","en-vc","en-vg","en-vi","en-vu","en-ws","en-za","en-zm","en-zw","eo","es","es-419","es-ar","es-bo","es-cl","es-co","es-cr","es-cu","es-do","es-ea","es-ec","es-es","es-gq","es-gt","es-hn","es-ic","es-mx","es-ni","es-pa","es-pe","es-ph","es-pr","es-py","es-sv","es-us","es-uy","es-ve","et","et-ee"
,"eu","eu-es","ewo","ewo-cm","fa","fa-af","fa-ir","ff","ff-sn","fi","fi-fi","fil","fil-ph","fo","fo-fo","fr","fr-be","fr-bf","fr-bi","fr-bj","fr-bl","fr-ca","fr-cd","fr-cf","fr-cg","fr-ch","fr-ci","fr-cm","fr-dj","fr-dz","fr-fr","fr-ga","fr-gf","fr-gn","fr-gp","fr-gq","fr-ht","fr-km","fr-lu","fr-ma","fr-mc","fr-mf","fr-mg","fr-ml","fr-mq","fr-mr","fr-mu","fr-nc","fr-ne","fr-pf","fr-pm","fr-re","fr-rw","fr-sc","fr-sn","fr-sy","fr-td","fr-tg","fr-tn","fr-vu","fr-wf","fr-yt","ga","ga-ie","gl","gl-es","gsw","gsw-ch","gsw-li","gu","gu-in","guz","guz-ke","gv","gv-im","ha","ha-latn","ha-latn-gh","ha-latn-ne","ha-latn-ng","haw","haw-us","he","he-il","hi","hi-in","hr","hr-ba","hr-hr","hu","hu-hu","hy","hy-am","id","id-id","ig","ig-ng","ii","ii-cn","is","is-is","it","it-ch","it-it","it-sm","iu","iu-cans","iu-cans-ca","ja","ja-jp","jgo","jgo-cm","jmc","jmc-tz","ka","ka-ge","kab","kab-dz","kam","kam-ke","kde","kde-tz","kea","kea-cv","khq","khq-ml","ki","ki-ke","kk","kk-cyrl","kk-cyrl-kz","kkj","kkj-cm","kl","kl-gl","kln","kln-ke","km","km-kh","kn","kn-in","ko","ko-kp","ko-kr","kok","kok-in","ks","ks-arab","ks-arab-in","ksb","ksb-tz","ksf","ksf-cm","kw","kw-gb","ky","ky-cyrl","ky-cyrl-kg","lag","lag-tz","lg","lg-ug","lkt","lkt-us","ln","ln-ao","ln-cd","ln-cf","ln-cg","lo","lo-la","lt","lt-lt","lu","lu-cd","luo","luo-ke","luy","luy-ke","lv","lv-lv","mas","mas-ke","mas-tz","mer","mer-ke","mfe","mfe-mu","mg","mg-mg","mgh","mgh-mz","mgo","mgo-cm","mk","mk-mk","ml","ml-in","mn","mn-cyrl","mn-cyrl-mn","mr","mr-in","ms","ms-arab","ms-arab-bn","ms-arab-my","ms-latn","ms-latn-bn","ms-latn-my","ms-latn-sg"
,"mt","mt-mt","mua","mua-cm","my","my-mm","naq","naq-na","nb","nb-no","nb-sj","nd","nd-zw","ne","ne-in","ne-np","nl","nl-aw","nl-be","nl-bq","nl-cw","nl-nl","nl-sr","nl-sx","nmg","nmg-cm","nn","nn-no","nnh","nnh-cm","nus","nus-sd","nyn","nyn-ug","om","om-et","om-ke","or","or-in","pa","pa-arab","pa-arab-pk","pa-guru","pa-guru-in","pl","pl-pl","ps","ps-af","pt","pt-ao","pt-br","pt-cv","pt-gw","pt-mo","pt-mz","pt-pt","pt-st","pt-tl","rm","rm-ch","rn","rn-bi","ro","ro-md","ro-ro","rof","rof-tz","ru","ru-by","ru-kg","ru-kz","ru-md","ru-ru","ru-ua","rw","rw-rw","rwk","rwk-tz","saq","saq-ke","sbp","sbp-tz","seh","seh-mz","ses","ses-ml","sg","sg-cf","shi","shi-latn","shi-latn-ma","shi-tfng","shi-tfng-ma","si","si-lk","sk","sk-sk","sl","sl-si","sn","sn-zw","so","so-dj","so-et","so-ke","so-so","sq","sq-al","sq-mk","sq-xk","sr","sr-cyrl","sr-cyrl-ba","sr-cyrl-me","sr-cyrl-rs","sr-cyrl-xk","sr-latn","sr-latn-ba","sr-latn-me","sr-latn-rs","sr-latn-xk","sv","sv-ax","sv-fi","sv-se","sw","sw-ke","sw-tz","sw-ug","swc","swc-cd","ta","ta-in","ta-lk","ta-my","ta-sg","te","te-in","teo","teo-ke","teo-ug","tg","tg-cyrl","tg-cyrl-tj","th","th-th","ti","ti-er","ti-et","tk","tk-latn","tk-latn-tm","to","to-to","tr","tr-cy","tr-tr","twq","twq-ne","tzm","tzm-latn","tzm-latn-ma","ug","ug-arab","ug-arab-cn","uk","uk-ua","ur","ur-in","ur-pk","uz","uz-arab","uz-arab-af","uz-cyrl","uz-cyrl-uz","uz-latn","uz-latn-uz","vai","vai-latn","vai-latn-lr","vai-vaii","vai-vaii-lr","vi","vi-vn","vun","vun-tz","xog","xog-ug","yav","yav-cm","yo","yo-bj","yo-ng","zgh","zgh-ma","zh","zh-hans","zh-hans-cn","zh-hans-hk","zh-hans-mo"
,"zh-hans-sg","zh-hant","zh-hant-hk","zh-hant-mo","zh-hant-tw","zu","zu-za"],CW.INVALID_LAYOUT_QUALITY=-2,CW.BAD_LAYOUT_QUALITY=-1,CW.OKAY_LAYOUT_QUALITY=0,CW.GOOD_LAYOUT_QUALITY=1,CW.PERFECT_LAYOUT_QUALITY=2,CW.PickerLayout=SC.Object.extend({owner:null,renderDelegateName:"panelRenderDelegate",theme:null,themeBinding:SC.Binding.oneWay("*owner.renderTheme"),controlSize:null,controlSizeBinding:SC.Binding.oneWay("*owner.controlSize"),renderDelegate:function(){var e=this.get("theme");return e?e[this.get("renderDelegateName")]:null}.property("theme","renderDelegateName"),renderDelegateProxy:function(){return this}.property().cacheable(),pointAtRectangle:{left:0,top:0,width:0,height:0},pointAtRectangleBinding:SC.Binding.oneWay("*owner.pointAtRectangle"),pointAtPoint:function(){var e=this.get("pointAtRectangle");return{left:e.left+e.width/2,top:e.top+e.height/2}}.property("pointAtRectangle").cacheable(),availableSpace:{width:0,height:0},availableSpaceBinding:SC.Binding.oneWay("*owner.availableSpace"),desiredSize:{width:320,height:400},desiredSizeBinding:SC.Binding.oneWay("*owner.desiredSize"),minimumSize:{width:320,height:200},minimumSizeBinding:SC.Binding.oneWay("*owner.minimumSize"),layout:{top:0,left:0,width:100,height:100},layoutQuality:CW.INVALID_LAYOUT_QUALITY,layoutNeedsUpdate:NO,reasonsForRelayout:SC.CoreSet.create(),init:function(){arguments.callee.base.apply(this,arguments),this._reasonsForRelayout=SC.CoreSet.create()},scheduleRedraw:function(){if(!this.get("owner"))return;this.get("owner").pickerLayoutNeedsRedraw(this)},layoutDidChange:function(){var e=this.get("layout")
,t=this._previousLayout||{};(e.left!==t.left||e.top!==t.top||e.width!==t.width||e.height!==t.height)&&this.scheduleRedraw(),this._previousLayout=e}.observes("layout"),scheduleLayout:function(e){this.set("layoutNeedsUpdate",YES);if(!e)return;typeof e=="string"&&(e=[e]),this._reasonsForRelayout.addEach(e)},computeLayout:function(){this.set("reasonsForRelayout",this._reasonsForRelayout),this._reasonsForRelayout=SC.CoreSet.create(),this.set("layoutNeedsUpdate",NO)},computeLayoutIfNeeded:function(){if(!this.get("layoutNeedsUpdate"))return;this.computeLayout()},_scpl_layoutNeedsUpdateDidChange:function(){if(!this.get("layoutNeedsUpdate"))return;var e=this.get("owner");if(!e)return;e.pickerLayoutNeedsUpdate(this)}.observes("layoutNeedsUpdate"),render:function(e){var t=this.get("renderDelegate");t&&(e.addClass(t.className),e.addClass(this.get("theme").classNames),t.render(this.get("renderDelegateProxy"),e))},update:function(e){var t=this.get("renderDelegate");t&&(e.addClass(t.className),e.addClass(this.get("theme").classNames),t.update(this.get("renderDelegateProxy"),e))},isBetterThanLayout:function(e){return this.get("layoutQuality")>e.get("layoutQuality")}}),CW.LEFT_SIDE="left",CW.RIGHT_SIDE="right",CW.TOP_SIDE="top",CW.BOTTOM_SIDE="bottom",CW.RELAYOUT_FOR_WINDOW="window",CW.RELAYOUT_FOR_TARGET="target",CW.RELAYOUT_FOR_DESIRED_SIZE="desired-size",CW.RELAYOUT_FOR_MINIMUM_SIZE="minimum-size",CW.PickerLayout.OnSide=CW.PickerLayout.extend({renderDelegateName:"cwPickerBackgroundRenderDelegate",pointAtSide:CW.RIGHT_SIDE,requiresSlices:NO,pointAtPoint:function(){var e=this.get("pointAtRectangle"
),t=this.get("pointAtSide"),n,r;return t===CW.RIGHT_SIDE||t===CW.LEFT_SIDE?(r=Math.round(e.top+e.height/2),n=e.left,t===CW.RIGHT_SIDE&&(n+=e.width)):(n=Math.round(e.left+e.width/2),r=e.top,t===CW.BOTTOM_SIDE&&(r+=e.height)),{left:n,top:r}}.property("pointAtSide","pointAtRectangle"),distanceFromRectangle:SC.propertyFromRenderDelegate("pickerDistanceFromRectangle",10),distanceFromEdge:SC.propertyFromRenderDelegate("pickerDistanceFromEdge",15),pointerCanMove:SC.propertyFromRenderDelegate("pointerCanMove",YES),validPointerLayouts:SC.propertyFromRenderDelegate("validPointerLayouts",[]),pointerDistanceFromTop:function(){return this.get("pointAtPoint").top-this.get("layout").top}.property("layout").cacheable(),pointerDistanceFromBottom:function(){var e=this.get("layout");return e.top+e.height-this.get("pointAtPoint").top}.property("layout").cacheable(),pointerDistanceFromLeft:function(){return this.get("pointAtPoint").left-this.get("layout").left}.property("layout").cacheable(),pointerDistanceFromRight:function(){var e=this.get("layout");return e.left+e.width-this.get("pointAtPoint").left}.property("layout").cacheable(),pointerLayout:null,layoutPropertyDidChange:function(e,t){t==="availableSpace"?this.scheduleLayout(CW.RELAYOUT_FOR_WINDOW):t==="pointAtPoint"?this.scheduleLayout(CW.RELAYOUT_FOR_TARGET):t==="desiredSize"?this.scheduleLayout(CW.RELAYOUT_FOR_DESIRED_SIZE):t==="minimumSize"?this.scheduleLayout(CW.RELAYOUT_FOR_MINIMUM_SIZE):(t==="validPointerLayouts"||t==="pointerCanMove")&&this.scheduleLayout(CW.RELAYOUT_FOR_TARGET)}.observes("availableSpace","pointAtPoint","desiredSize"
,"minimumSize","validPointerLayouts","pointerCanMove"),pointerLayoutPropertyDidChange:function(){this.scheduleRedraw()}.observes("pointerDistanceFromLeft","pointerDistanceFromRight","pointerDistanceFromBottom","pointerDistanceFromTop"),t_pointAtPoint:function(){var e=this.get("pointAtPoint"),t=this.get("pointAtSide");return t===CW.LEFT_SIDE||t===CW.RIGHT_SIDE?e:{left:e.top,top:e.left}}.property("pointAtPoint","pointAtSide"),t_validPointerLayouts:function(){var e=this.get("validPointerLayouts"),t,n=e.length,r,i,s=this.get("pointAtSide"),o=[];for(t=0;t<n;t++){r=e[t];if(r.top!=null||r.bottom!=null||r.minimumDistanceFromTop!=null||r.minimumDistanceFromBottom!=null||r.maximumDistanceFromTop!=null||r.maximumDistanceFromBottom!=null){if(s!==CW.LEFT_SIDE&&s!==CW.RIGHT_SIDE)continue;if(r.side&&r.side===s)continue;i={name:r.name},r.top!=null?i.maximumDistanceFromTop=i.minimumDistanceFromTop=r.top:r.bottom!=null?i.maximumDistanceFromBottom=i.minimumDistanceFromBottom=r.bottom:(i.maximumDistanceFromTop=r.maximumDistanceFromTop,i.minimumDistanceFromTop=r.minimumDistanceFromTop,i.maximumDistanceFromBottom=r.maximumDistanceFromBottom,i.minimumDistanceFromBottom=r.minimumDistanceFromBottom),i.original=r,o.push(i)}else if(r.left!=null||r.right!=null||r.minimumDistanceFromLeft!=null||r.minimumDistanceFromRight!=null||r.maximumDistanceFromLeft!=null||r.maximumDistanceFromRight!=null){if(s!==CW.TOP_SIDE&&s!==CW.BOTTOM_SIDE)continue;if(r.side&&r.side===s)continue;i={name:r.name},r.left!=null?i.maximumDistanceFromTop=i.minimumDistanceFromTop=r.left:r.right!=null?i.maximumDistanceFromBottom=i.minimumDistanceFromBottom=
r.right:(i.maximumDistanceFromTop=r.maximumDistanceFromLeft,i.minimumDistanceFromTop=r.minimumDistanceFromLeft,i.maximumDistanceFromBottom=r.maximumDistanceFromRight,i.minimumDistanceFromBottom=r.minimumDistanceFromRight),i.original=r,o.push(i)}}return o}.property("validPointerLayouts","pointAtSide").cacheable(),t_pointerMinimumDistanceFromTop:function(){var e=this.get("pointAtSide");return e===CW.LEFT_SIDE||e===CW.RIGHT_SIDE?this.get("pointerMinimumDistanceFromTop"):this.get("pointerMinimumDistanceFromLeft")}.property("pointerMinimumDistanceFromTop","pointerMinimumDistanceFromLeft","pointAtSide").cacheable(),t_pointerMinimumDistanceFromBottom:function(){var e=this.get("pointAtSide");return e===CW.LEFT_SIDE||e===CW.RIGHT_SIDE?this.get("pointerMinimumDistanceFromBottom"):this.get("pointerMinimumDistanceFromRight")}.property("pointerMinimumDistanceFromBottom","pointerMinimumDistanceFromRight","pointAtSide"),t_availableSpace:function(){var e=this.get("availableSpace"),t=this.get("pointAtSide");return t===CW.LEFT_SIDE||t===CW.RIGHT_SIDE?e:{width:e.height,height:e.width}}.property("availableSpace","pointAtSide").cacheable(),t_desiredSize:function(){var e=this.get("desiredSize"),t=this.get("pointAtSide");return t===CW.LEFT_SIDE||t===CW.RIGHT_SIDE?e:{width:e.height,height:e.width}}.property("desiredSize","pointAtSide").cacheable(),t_minimumSize:function(){var e=this.get("minimumSize"),t=this.get("pointAtSide");return t===CW.LEFT_SIDE||t===CW.RIGHT_SIDE?e:{width:e.height,height:e.width}}.property("minimumSize","pointAtSide").cacheable(),t_pointAtSide:function(){var e=this.get("pointAtSide"
);return e===CW.TOP_SIDE?CW.LEFT_SIDE:e===CW.BOTTOM_SIDE?CW.RIGHT_SIDE:e}.property("pointAtSide").cacheable(),computeLayout:function(){this.centerPicker(),this.repositionToFit(),this.repositionForPointer(),this.resizeToFit(),this.resizeForPointer(),this.resizeSecondaryDimension(),this.applyMinimumSize(),this.repositionToFit(),this.repositionForPointer(),this.gradeLayout();var e=this.get("pointAtSide"),t=this.get("t_layout"),n=t.pointerLayout;delete t.pointerLayout;if(e===CW.TOP_SIDE||e===CW.BOTTOM_SIDE)t={left:t.top,top:t.left,width:t.height,height:t.width};this.set("layout",t),this.set("pointerLayout",n),arguments.callee.base.apply(this,arguments)},centerPicker:function(){var e=this.get("t_pointAtPoint"),t=this.get("t_desiredSize"),n=this.get("distanceFromRectangle"),r={left:e.left,top:Math.round(e.top-t.height/2),width:t.width,height:t.height};this.get("t_pointAtSide")===CW.RIGHT_SIDE?r.left+=n:r.left=r.left-n-t.width,this.set("t_layout",r)},repositionToFit:function(){if(!this.get("pointerCanMove"))return;var e=this.get("t_layout"),t=this.get("distanceFromEdge"),n=this.get("t_availableSpace"),r=t,i=n.height-t;e.top+e.height>i&&(e.top=i-e.height),e.top<r&&(e.top=r)},repositionForPointer:function(){var e=this.get("t_layout"),t=this.get("t_pointAtPoint").top,n=this.get("t_validPointerLayouts"),r=n.length,i,s,o,u,a=null,f,l;o=null;for(i=0;i<r;i++){s=n[i],f=e.top;var c=s.minimumDistanceFromTop,h=s.maximumDistanceFromTop,p=s.minimumDistanceFromBottom,d=s.maximumDistanceFromBottom;c!=null&&f>t-c&&(f=t-c),h!=null&&f<t-h&&(f=t-h),p!=null&&f+e.height<t+p&&(f=t+p-e.height),d!=null&&f+
e.height>t+d&&(f=t+d-e.height),l=Math.abs(f-e.top);if(o==null||l<u)o=f,u=l,a=s.original}e.pointerLayout=a,o!=null&&(e.top=o)},resizeToFit:function(){if(!this.get("pointerCanMove"))return;var e=this.get("t_layout"),t=this.get("t_availableSpace"),n=t.height-this.get("distanceFromEdge");e.top+e.height>n&&(e.height=n-e.top)},resizeForPointer:function(){var e=this.get("t_layout"),t=this.get("t_pointAtPoint").top,n=this.get("t_validPointerLayouts"),r=n.length,i,s,o,u,a=null,f,l;o=null;for(i=0;i<r;i++){s=n[i],f=e.height;var c=s.minimumDistanceFromTop,h=s.maximumDistanceFromTop,p=s.minimumDistanceFromBottom,d=s.maximumDistanceFromBottom;p!=null&&e.top+f<t+p&&(f=t+p-e.top),d!=null&&e.top+f>t+d&&(f=t+d-e.top),l=Math.abs(f-e.height);if(o==null||l<u)o=f,u=l,a=s.original}e.pointerLayout=a,o!=null&&(e.height=o)},resizeSecondaryDimension:function(){var e=this.get("t_layout"),t=this.get("t_availableSpace"),n=this.get("distanceFromEdge"),r=n,i=t.width-n,s=this.get("t_pointAtSide");if(s===CW.RIGHT_SIDE)e.left+e.width>i&&(e.width=i-e.left);else if(e.left<r){var o=e.left+e.width;e.left=r,e.width=o-r}},applyMinimumSize:function(){var e=this.get("t_layout"),t=this.get("t_minimumSize");e.width<t.width&&(e.width=t.width),e.height<t.height&&(e.height=t.height)},gradeLayout:function(){var e=CW.PERFECT_LAYOUT_QUALITY,t=this.get("t_layout"),n=this.get("t_pointAtSide"),r=this.get("t_availableSpace"),i=this.get("distanceFromEdge"),s=this.get("distanceFromRectangle"),o=this.get("t_desiredSize"),u=this.get("t_pointAtPoint").left,a=this.get("t_pointAtPoint").top,f=this.get("t_pointerMinimumDistanceFromTop")
,l=this.get("t_pointerMinimumDistanceFromBottom");if(t.top>a-f)e=CW.INVALID_LAYOUT_QUALITY;else if(t.top+t.height<a-l)e=CW.INVALID_LAYOUT_QUALITY;else if(n===CW.LEFT_SIDE&&t.left+t.width+s!==u)e=CW.INVALID_LAYOUT_QUALITY;else if(n===CW.RIGHT_SIDE&&t.left-s!==u)e=CW.INVALID_LAYOUT_QUALITY;else if(t.top<0||t.left<0)e=CW.BAD_LAYOUT_QUALITY;else if(t.top+t.height>r.height||t.left+t.width>r.width)e=CW.BAD_LAYOUT_QUALITY;else if(t.top<i||t.left<i)e=CW.OKAY_LAYOUT_QUALITY;else if(t.top+t.height>r.height-i||t.left+t.width>r.width-i)e=CW.OKAY_LAYOUT_QUALITY;else if(t.height<o.height||t.width<o.width)e=CW.GOOD_LAYOUT_QUALITY;this.set("layoutQuality",e)},isBetterThanLayout:function(e){var t=this.get("layoutQuality"),n=e.get("layoutQuality");if(t>n)return YES;if(t<n)return NO;var r=this.get("layout"),i=e.get("layout"),s=this.get("desiredSize");return s.width-r.width<s.width-i.width?YES:s.height-r.height<s.height-i.height?YES:NO}}),CW.PickerLayout.ON_LEFT=CW.PickerLayout.OnSide.extend({pointAtSide:CW.LEFT_SIDE}),CW.PickerLayout.ON_RIGHT=CW.PickerLayout.OnSide.extend({pointAtSide:CW.RIGHT_SIDE}),CW.PickerLayout.ON_BOTTOM=CW.PickerLayout.OnSide.extend({pointAtSide:CW.BOTTOM_SIDE}),CW.PickerLayout.ON_TOP=CW.PickerLayout.OnSide.extend({pointAtSide:CW.TOP_SIDE}),CW.PickerPane=SC.PanelPane.extend({classNames:"sc-picker".w(),layouts:"onRight onBottom onLeft onTop".w(),onRight:CW.PickerLayout.ON_RIGHT,onLeft:CW.PickerLayout.ON_LEFT,onTop:CW.PickerLayout.ON_TOP,onBottom:CW.PickerLayout.ON_BOTTOM,shouldLayoutAutomatically:YES,shouldDismissAutomatically:YES,shouldBeStable:NO,dismissAction:null,dismissTarget
:null,repositionOnWindowResize:YES,desiredSize:{width:320,height:400},minimumSize:function(e,t){return t&&(this._scpp_setMinimumSize=t),this._scpp_setMinimumSize?this._scpp_setMinimumSize:this.get("desiredSize")}.property("desiredSize").cacheable(),currentLayout:undefined,pointAtRectangle:{left:0,top:0,width:0,height:0},pointAtView:null,pointAtViewFrame:null,pointAtViewFrameBinding:"*pointAtView.frame",pointAtRectangleForView:function(e){var t=this.get("parentView")||null,n=e.get("parentView"),r=e.get("frame");return n&&r?n.convertFrameToView(r,t):undefined},_scpv_pointAtViewFrameDidChange:function(){this.recomputePointAtRectangle()}.observes("pointAtViewFrame"),recomputePointAtRectangle:function(){var e=this.get("pointAtView"),t;e&&(t=this.pointAtRectangleForView(this.get("pointAtView")))&&(t.left===undefined&&(t.left=t.x),t.top===undefined&&(t.top=t.y),this.set("pointAtRectangle",t))},modalPane:SC.ModalPane.extend({classNames:"for-cw-picker"}),renderDelegateName:"cwPickerRenderDelegate",init:function(){arguments.callee.base.apply(this,arguments),this.set("desiredSize",SC.clone(this.desiredSize)),this.createLayouts()},popup:function(e,t){this.recomputePointAtRectangle(),t&&(this.set("layouts",t),this.createLayouts());if(e)if(e.isView)this.set("pointAtView",e);else if(e.left!==undefined&&e.top!==undefined&&e.width!==undefined&&e.height!==undefined)this.set("pointAtView",null),this.set("pointAtRectangle",e);else if(!e.nodeType)throw"Invalid argument supplied to SC.PickerPane#popup: "+e.toString();this.windowSizeDidChange(),this.append()},dismiss:function(){var e=this.get("dismissAction"
),t=this.get("dismissTarget")||null,n=this.get("rootResponder");e&&n.sendAction(e,t,this,this,null,this),this.get("shouldDismissAutomatically")&&this.remove()},adjustDesiredSize:function(e,t){var n=this.get("desiredSize");n={width:n.width,height:n.height},typeof e=="object"?SC.mixin(n,e):n[e]=t,this.set("desiredSize",n)},adjustMinimumSize:function(e,t){var n=this.get("minimumSize");n={width:n.width,height:n.height},typeof e=="object"?SC.mixin(n,e):n[e]=t,this.set("minimumSize",n)},createLayouts:function(){var e=this.get("layouts"),t=[],n,r,i=e.length,s;for(r=0;r<i;r++)n=e[r],s=undefined,typeof n=="string"&&(s=n,n=this[n]),n.isClass?n=n.create({owner:this}):n.set("owner",this),t.push(n),s&&this.set(s,n);this.set("layouts",t),this.computeLayoutIfNeeded()},_cwpp_layoutsDidChange:function(){var e=this.get("layouts");e.indexOf(this.get("currentLayout"))<0&&this.set("currentLayout",undefined)}.observes("layouts"),computeLayout:function(){var e=this.get("layouts"),t,n=e.length,r;for(t=0;t<n;t++)r=e[t],r.computeLayoutIfNeeded();var i=this.pickBestLayout();this.set("currentLayout",i),this.applyLayout(i),this.set("layoutNeedsUpdate",NO)},applyLayout:function(e){var t;e?t=e.get("layout"):t={left:0,top:0,width:100,height:100},this.set("layout",t)},pickBestLayout:function(){var e=this.get("layouts"),t,n=e.length,r,i=this.get("shouldBeStable")?this.get("currentLayout"):undefined;for(t=0;t<n;t++){r=e[t];if(!i||r.isBetterThanLayout(i))i=r}return i},computeLayoutIfNeeded:function(){if(!this.get("shouldLayoutAutomatically"))return;if(!this.get("layoutNeedsUpdate"))return;this.computeLayout()}
,pickerLayoutNeedsUpdate:function(){this.set("layoutNeedsUpdate",YES),this.invokeOnce("computeLayoutIfNeeded")},parentViewDidResize:function(){this.notifyPropertyChange("availableSpace")},windowSizeDidChange:function(){this.notifyPropertyChange("availableSpace"),this.get("repositionOnWindowResize")&&this.recomputePointAtRectangle()},parentDidChange:function(){arguments.callee.base.apply(this,arguments),this.notifyPropertyChange("availableSpace")},availableSpace:function(){if(this.get("parentView")){var e=this.getPath("parentView.frame");return{width:e.width,height:e.height}}var t=SC.RootResponder.responder.get("currentWindowSize");return{width:t.width,height:t.height}}.property().cacheable(),modalPaneDidClick:function(e){var t=this.get("frame");return this.get("parentView")&&(t=this.get("parentView").convertFrameToView(t,null)),e.pageX>=t.x&&e.pageY>=t.y&&e.pageX<=t.x+t.width&&e.pageY<=t.y+t.height?NO:(this.dismiss(),YES)},click:function(e){return this.modalPaneDidClick(e)},displayProperties:"currentLayout".w(),pickerLayoutNeedsRedraw:function(e){if(e!==this.get("currentLayout"))return;this.displayDidChange()},render:function(e){e=e.begin("div").addClass("_scpv_background");var t=this.get("currentLayout");t&&t.render(e),this._scpp_lastRenderedLayout=t,e=e.end(),this.get("renderDelegate")&&this.get("renderDelegate").render(this.get("renderDelegateProxy"),e)},update:function(e){var t=e.find("._scpv_background"),n=t[0];if(!n)return;var r=this.get("currentLayout");if(!r)return;t.resetClassNames().addClass("_scpv_background");if(this._scpp_lastRenderedLayout!==r){var i=SC.RenderContext
(n);r.render(i),i.update(),this._scpp_lastRenderedLayout=r}else r.update(t);this.get("renderDelegate")&&this.get("renderDelegate").update(this.get("renderDelegateProxy"),e)}}),CW.MenuPane=CW.PickerPane.extend({desiredSize:{width:100,height:100},minimumSize:{width:100,height:0},classNames:["cw-menu"],modalPane:SC.ModalPane,ariaRole:"menu",items:[],controlSize:SC.REGULAR_CONTROL_SIZE,minimumCroppedMenuHeight:SC.propertyFromRenderDelegate("minimumCroppedHeight"),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,layouts:[CW.PickerLayout.ON_BOTTOM,CW.PickerLayout.ON_TOP],popup:function(e,t){this.beginPropertyChanges(),this.adjustDesiredSize("height",this.get("menuHeight"));var n=Math.min(this.get("menuHeight"),this.get("minimumCroppedMenuHeight"));this.adjustMinimumSize("height",n),arguments.callee.base.apply(this,arguments),this.set("defaultResponder",this),this.endPropertyChanges()},remove:function(){var e=this.get("parentMenu");return this.set("currentMenuItem",null),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"],isModal:YES,_menuView:null,init:function(){return arguments.callee.base.apply(this,arguments)},displayProperties:["controlSize"],renderStyle:"menu",renderDelegateName:"cwMenuRenderDelegate",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","controlSize").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,w,E;if(!t)return e;u=this.get("itemHeightKey"),a=this.get("itemSeparatorKey"),v=this.get("itemExampleViewKey"),f=this.get("itemHeight"),p=this.get("itemKeyEquivalentKey"),l=this.get("itemSeparatorHeight"),b=this.get("itemLayerIdKey"),h=Math.floor(this.get("menuHeightPadding")/2),c=h,largestItemHeight=0,g=this.menuItemKeys.map(CW._menu_fetchKeys,this),E=t.get("length");for(y=0;y<E;y++)r=t[y],o=r.get(u),o||(o=r.get(a)?l:f),w={layout:{height:o,top:c},contentDisplayProperties:g,content:r,parentMenu:this},r.get(b)&&(w.layerId=r.get(b)),m=r.get(v),m?i=m:i=n,s=this._menuView.createChildView(i,w),e[y]=s,c+=o,largestItemHeight=Math.max(largestItemHeight,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),this.set("largestItemHeight",largestItemHeight),e},menuItemViewForContentIndex:function(e){var t=this.get("menuItemViews");return t?t.objectAt(e):undefined},_keyEquivalents:{},rootMenu:function(){return this.get("isSubMenu")?this.getPath("parentMenu.rootMenu"):this}.property("isSubMenu").cacheable(),windowSizeDidChange:function(e,t){return e&&t&&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("menuItemViews"),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=CW._menu_fetchKeys,r=CW._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.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}}),CW._menu_fetchKeys=function(e){return this.get(e)},CW._menu_fetchItem=function(e){return e?this.get?this.get(e):this[e]:null},CW.AutoResizingMenuItemView=SC.MenuItemView.extend(SC.AutoResize,{supportsAutoResize:YES,shouldAutoResize:NO,shouldMeasureSize:NO,autoResizePadding:0,getShortCutWidth:function(){var e=this.getContentProperty("itemShortCutKey"),t=this.get("layer"),n=this.get("_cachedShortCutWidth"),r=this.get("_previousShortCut"),i;return r&&r===e?i=n:e&&t&&(i=SC.metricsForString(e,t,"",YES).width,this.set("_cachedShortCutWidth",i).set("_previousShortCut",e)),i||0},autoResizeText:function(){return this.get("title")}.property("title"),autoResizeLayer:function(){return this.$(".value")[0]}.property("layer").cacheable(),batchResizeId:function(){return"menu-"+SC.guidFor(this.parentMenu)}.property().cacheable(),didUpdateLayer:function(){this.notifyPropertyChange("autoResizeLayer"),this.scheduleMeasurement()},_cachedShortCutWidth:null,_previousShortCut:null}),CW.AutoResizingMenuPane=CW.MenuPane.extend({shouldAutoResize:YES,exampleView:CW.AutoResizingMenuItemView,minimumMenuWidth:SC.propertyFromRenderDelegate("minimumMenuWidth",0),menuWidthPadding:SC.propertyFromRenderDelegate("menuWidthPadding",0),init:function(){arguments.callee.base.apply(this,arguments),this.get("shouldAutoResize")&&this.invokeOnce("_updateMenuWidth")},createMenuItemViews:function(){var e=arguments.callee.base.apply(this,arguments),t,n=e.length,r;if(this.get("shouldAutoResize"
))for(t=0;t<n;t++)r=e[t],r.set("shouldMeasureSize",YES),r.addObserver("measuredSize",this,this._menuItemMeasuredSizeDidChange);return e},_menuItemViewsDidChange:function(){this.get("shouldAutoResize")&&this.invokeOnce("_updateMenuWidth")}.observes("menuItemViews"),_menuItemMeasuredSizeDidChange:function(e){this.invokeOnce("_updateMenuWidth")},_menuMinimumMenuWidthDidChange:function(){this.invokeOnce("_updateMenuWidth")}.observes("minimumMenuWidth"),_updateMenuWidth:function(){var e=this.get("menuItemViews");if(!e)return;var t=e.length,n=this.get("minimumMenuWidth"),r=this.get("menuWidthPadding"),i,s,o,u,a;for(var f=0;f<t;f++)i=e[f],s=i.getShortCutWidth(),o=i.get("measuredSize"),u=o?o.width:0,a=u+s+r,n=Math.max(n,a);this.adjustDesiredSize("width",n)}}),CW.CalloutPicker=CW.PickerPane.extend(CW.Animatability,CW.PaneFadingSupport,{desiredSize:{width:215,height:43},minimumSize:{width:150,height:43},renderStyle:"iOS.callout",layouts:[CW.PickerLayout.ON_TOP],titleValue:"Callout title",detailValue:"Callout detail",escapeTitle:YES,escapeDetail:YES,target:"",action:"",preferType:SC.PICKER_POINTER,acceptsKeyPane:NO,acceptsFirstResponder:NO,isModal:NO,repositionOnWindowResize:NO,contentView:SC.View.extend({childViews:["title","detail","button"],title:SC.LabelView.extend({layout:{top:0,height:25,left:9,right:35},classNames:"title",escapeHTMLBinding:"*parentView.parentView.escapeTitle",valueBinding:"*parentView.parentView.titleValue"}),detail:SC.LabelView.extend({layout:{top:20,left:9,height:15},classNames:"detail",escapeHTMLBinding:"*parentView.parentView.escapeDetail",valueBinding:"*parentView.parentView.detailValue"
}),button:SC.ImageButtonView.extend({layout:{top:7,height:30,right:5,width:30},image:"info_button",targetBinding:"*parentView.parentView.target",actionBinding:"*parentView.parentView.action"})}),didCreateLayer:function(){this.invokeLater(this.recomputeDesiredSize,0)},recomputeDesiredSize:function(){var e=this.$(".title")[0],t=this.$(".detail")[0];if(SC.none(e)||SC.none(t))return;var n=SC.metricsForString(this.get("titleValue"),e,null,NO),r=SC.metricsForString(this.get("detailValue"),t,null,NO),i=(n.width>r.width?n.width:r.width)+55;i=i%2?i-1:i,this.adjustDesiredSize({width:Math.max(this.get("minimumSize").width,i)})},showCalloutInContainer:function(e){this._hideOverflow(),this.appendTo(e)},valuesObserver:function(){this.recomputeDesiredSize()}.observes("detailValue","titleValue","layer"),modalPaneDidClick:function(){return NO}}),CW.ErrorCalloutPicker=CW.PickerPane.extend({themeName:"errorCallout",renderStyle:"errorCallout",minimumSize:{width:120,height:29},errorText:"Please fill in required info",layouts:["onTop","onBottom"],acceptsFirstResponder:NO,acceptsKeyPane:NO,isModal:NO,contentView:SC.LabelView.extend(SC.AutoResize,{classNames:["error-picker-label"],valueBinding:".parentView.errorText",measuredSizeDidChange:function(){var e=this.get("measuredSize");e&&e.width&&e.height&&this.parentView.set("desiredSize",{width:e.width,height:e.height})}.observes("measuredSize")})}),CW.SelectMenuLayout={Aligned:CW.PickerLayout.extend({renderDelegateName:"cwPickerBackgroundRenderDelegate",distanceFromEdge:SC.propertyFromRenderDelegate("distanceFromEdge",15),desiredPosition:{left:0,top:0
},desiredPositionBinding:SC.Binding.oneWay("*owner.desiredPosition"),layoutPropertyDidChange:function(e,t){t==="availableSpace"?this.scheduleLayout(CW.RELAYOUT_FOR_WINDOW):t==="pointAtPoint"?this.scheduleLayout(CW.RELAYOUT_FOR_TARGET):t==="desiredSize"?this.scheduleLayout(CW.RELAYOUT_FOR_DESIRED_SIZE):t==="minimumSize"&&this.scheduleLayout(CW.RELAYOUT_FOR_MINIMUM_SIZE)}.observes("availableSpace","desiredSize","minimumSize","desiredPosition"),computeLayout:function(){var e=this.get("desiredPosition"),t=this.get("desiredSize"),n=this.get("minimumSize"),r=this.get("availableSpace"),i=this.get("distanceFromEdge"),s={top:e.top,left:e.left,width:t.width,height:t.height};s.top<i&&(s.height=s.height-(i-s.top),s.top=i),s.top+s.height>r.height-i&&(s.height=r.height-i-s.top),s.height<n.height&&(s.height=n.height),s.top+s.height>r.height-i&&(s.top=r.height-i-s.height),s.left<i&&(s.left=i),s.left+s.width>r.width-i&&(s.left=r.width-i-s.width),s.left<i&&(s.left=i,s.width=r.width-s.left-i),this.set("layout",s),arguments.callee.base.apply(this,arguments)}})},CW.SelectViewMenuPane=CW.AutoResizingMenuPane.extend({desiredPosition:{top:20,left:20},classNames:"select-menu",layouts:[CW.SelectMenuLayout.Aligned],selectView:null,value:null,valueBinding:".selectView.value",renderDelegateName:"cwSelectMenuRenderDelegate",renderStyle:"menu.cw-no-pointers",shouldDropDown:SC.propertyFromRenderDelegate("shouldDropDown",NO),valueDidChange:function(){var e=this.get("menuItemViews"),t,n=e.length,r;for(t=0;t<n;t++)r=e[t],r._lastIsChecked&&r.notifyPropertyChange("isChecked"),r.get("isChecked")&&r.notifyPropertyChange
("isChecked")}.observes("value"),_svm_selectedMenuItemView:function(){var e=this.get("menuItemViews"),t=this.get("value"),n,r;if(!e)return undefined;r=e.length;for(n=0;n<r;n++)if(t===e[n].get("content").get(this.get("itemValueKey")))return e[n];return undefined}.property("value","menuItemViews").cacheable(),exampleView:CW.AutoResizingMenuItemView.extend({isChecked:function(){return this._lastIsChecked=this.getContentProperty("itemValueKey")===this.getPath("parentMenu.rootMenu.value"),this._lastIsChecked}.property(),displayProperties:["isChecked"]}),desiredPosition:function(){var e=this.get("pointAtRectangle");return this.get("shouldDropDown")?{left:e.left+this.get("menuLeftOffset"),top:e.top+e.height+this.get("menuTopOffset")}:{left:e.left+this.get("menuLeftOffset"),top:e.top-this._svm_positionForValue(this.get("value"))+this.get("menuTopOffset")}}.property("pointAtRectangle","value","menuItemViews","isDropDown"),_svm_positionForValue:function(e){var t=this.get("_svm_selectedMenuItemView");return t?t.get("layout").top:0},menuLeftOffset:SC.propertyFromRenderDelegate("menuLeftOffset",0),menuTopOffset:SC.propertyFromRenderDelegate("menuTopOffset",0),menuMinimumWidthOffset:SC.propertyFromRenderDelegate("menuMinimumWidthOffset",0),minimumMenuWidth:function(){var e=this.get("pointAtRectangle");return e.width+this.get("menuMinimumWidthOffset")}.property("pointAtRectangle","menuMinimumWidthOffset").cacheable(),applyLayout:function(){arguments.callee.base.apply(this,arguments);var e=this.get("_svm_selectedMenuItemView");e&&e.scrollToVisible()},_svm_theme:null,_svm_themeBinding:"*selectView.theme"
,baseTheme:function(){return this.get("_svm_theme")||arguments.callee.base.apply(this,arguments)}.property("_svm_theme").cacheable(),_svm_bindToProperties:["items","itemTitleKey","itemIsEnabledKey","itemValueKey","itemIconKey","itemHeightKey","itemSubMenuKey","itemSeparatorKey","itemTargetKey","itemActionKey","itemCheckboxKey","itemShortCutKey","itemKeyEquivalentKey","itemDisableMenuFlashKey","controlSize"],_svm_setupBindings:function(){var e=this.get("selectView");if(!e)return;var t=this._svm_bindToProperties,n,r=t.length,i;for(n=0;n<r;n++)i=t[n],this[i+"Binding"]=this.bind(i,e,i);this._svm_isBoundTo=e},_svm_clearBindings:function(){var e=this._svm_isBoundTo;if(!e)return;var t=this._svm_bindToProperties,n,r=t.length,i;for(n=0;n<r;n++)i=t[n],this[i+"Binding"].disconnect()},_svm_selectViewDidChange:function(){this._svm_clearBindings(),this._svm_setupBindings()}.observes("selectView"),initMixin:function(){this._svm_setupBindings()},destroyMixin:function(){this._svm_clearBindings()}}),SC.BaseTheme.cwPickerBackgroundRenderDelegate=SC.RenderDelegate.create({className:"cw-picker-background",pickerDistanceFromRectangle:12,validPointerLayouts:[{name:"left-or-right-position",classNames:"calculated-pointer",minimumDistanceFromTop:60,minimumDistanceFromBottom:60,needsGap:YES},{name:"top-or-bottom-position",classNames:"calculated-pointer",minimumDistanceFromLeft:60,minimumDistanceFromRight:60,needsGap:YES},{classNames:"bottom-left-corner-pointer corner-pointer".w(),name:"point-left-on-bottom",bottom:20,needsGap:NO,side:CW.LEFT_SIDE},{classNames:"top-left-corner-pointer corner-pointer".w
(),name:"point-left-on-top",top:20,needsGap:NO,side:CW.LEFT_SIDE},{classNames:"top-left-corner-pointer corner-pointer".w(),name:"point-up-on-left",left:20,needsGap:NO,side:CW.TOP_SIDE},{classNames:"top-right-corner-pointer corner-pointer".w(),name:"point-up-on-right",right:20,needsGap:NO,side:CW.TOP_SIDE},{classNames:"bottom-left-corner-pointer corner-pointer".w(),name:"point-down-on-left",left:20,needsGap:NO,side:CW.BOTTOM_SIDE},{classNames:"bottom-right-corner-pointer corner-pointer".w(),name:"point-down-on-right",right:20,needsGap:NO,side:CW.BOTTOM_SIDE},{classNames:"bottom-right-corner-pointer corner-pointer".w(),name:"point-right-on-bottom",bottom:20,needsGap:NO,side:CW.BOTTOM_SIDE},{classNames:"top-right-corner-pointer corner-pointer".w(),name:"point-right-on-top",top:20,needsGap:NO,side:CW.BOTTOM_SIDE}],render:function(e,t){this.addSizeClassName(e,t);var n=e.get("pointAtSide")||"right",r=e.get("pointerLayout"),i=r?r.needsGap:NO,s,o,u=e.get("pointerDistanceFromTop")||0,a=e.get("pointerDistanceFromBottom")||0,f=e.get("pointerDistanceFromLeft")||0,l=e.get("pointerDistanceFromRight")||0,c,h,p,d,v=e.get("requiresSlices"),m;v&&(m=["top-left","bottom-left","top-right","bottom-right","middle"]),n==="right"?(c="top",h="bottom",p=u,m&&(d=a,o="left",m.push("right"),m.push("top"),m.push("bottom")),s="sc-point-left"):n==="left"?(c="top",h="bottom",p=u,m&&(d=a,o="right",m.push("left"),m.push("top"),m.push("bottom")),s="sc-point-right"):n==="top"?(c="left",h="right",p=f,m&&(d=l,o="bottom",m.push("top"),m.push("left"),m.push("right")),s="sc-point-down"):(c="left",h="right",p=f,m&&(d=
l,o="top",m.push("bottom"),m.push("left"),m.push("right")),s="sc-point-up"),r&&r.classNames&&t.addClass(r.classNames),r&&r.name&&t.addClass(r.name),t.setClass("needs-gap",i),m&&this.includeSlices(e,t,m),t.begin("div").addClass("sc-pointer").addClass(s).css(c,p).end(),m&&(t.begin("div").addClass(o).addClass("sc-before-pointer").css(h,i?d:null).end(),t.begin("div").addClass(o).addClass("sc-after-pointer").css(c,i?p:null).end())},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("pointAtSide"),r=e.get("pointerDistanceFromTop"),i=e.get("pointerDistanceFromBottom"),s=e.get("pointerDistanceFromLeft"),o=e.get("pointerDistanceFromRight"),u,a,f,l,c=e.get("pointerLayout"),h=c?c.needsGap:NO;n==="right"||n==="left"?(u="top",a="bottom",f=r,l=i):(u="left",a="right",f=s,l=o),t.find(".sc-pointer").css(u,f),t.find(".sc-before-pointer").css(a,h?l:null),t.find(".sc-after-pointer").css(u,h?f:null),c&&c.classNames&&t.addClass(c.classNames),c&&c.name&&t.addClass(c.name),t.setClass("needs-gap",h)}}),require("render_delegates/picker_background"),SC.BaseTheme.Callout=SC.BaseTheme.create({name:"callout"}),SC.BaseTheme.addTheme(SC.BaseTheme.Callout),SC.BaseTheme.Callout.cwPickerBackgroundRenderDelegate=SC.BaseTheme.cwPickerBackgroundRenderDelegate.create({validPointerLayouts:[{name:"top-position",classNames:"calculated-pointer",minimumDistanceFromLeft:30,minimumDistanceFromRight:30,needsGap:YES}]}),SC.BaseTheme.cwPickerRenderDelegate=SC.RenderDelegate.create({className:"cw-picker",render:function(e,t){},update:function(){}}),SC.BaseTheme.cwMenuRenderDelegate=SC.BaseTheme.cwPickerRenderDelegate
.create({className:"cw-menu",render:function(e,t){this.addSizeClassName(e,t)},update:function(e,t){this.updateSizeClassName(e,t)},minimumCroppedHeight:200,itemHeight:27,itemSeparatorHeight:9,menuHeightPadding:0,menuWidthPadding:34,minimumMenuWidth:34,submenuOffsetX:2,verticalOffset:23,"sc-tiny-size":{itemHeight:10,itemSeparatorHeight:2,menuHeightPadding:0,submenuOffsetX:0},"sc-small-size":{itemHeight:27,itemSeparatorHeight:9,menuHeightPadding:0,submenuOffsetX:2},"sc-large-size":{itemHeight:31,itemSeparatorHeight:9,menuHeightPadding:0,submenuOffsetX:4},"sc-huge-size":{itemHeight:20,itemSeparatorHeight:9,menuHeightPadding:0,submenuOffsetX:0}}),require("render_delegates/picker_background"),SC.BaseTheme.Menu=SC.BaseTheme.create({name:"menu"}),SC.BaseTheme.addTheme(SC.BaseTheme.Menu),SC.BaseTheme.Menu.cwPickerBackgroundRenderDelegate=SC.BaseTheme.cwPickerBackgroundRenderDelegate.create({"sc-small-size":{pickerDistanceFromRectangle:8},"sc-regular-size":{pickerDistanceFromRectangle:12},"sc-large-size":{pickerDistanceFromRectangle:16},validPointerLayouts:[{name:"top-or-bottom-position",classNames:"calculated-pointer",minimumDistanceFromLeft:20,minimumDistanceFromRight:20,needsGap:NO},{classNames:"top-left-corner-pointer corner-pointer".w(),name:"point-up-on-left",left:15,needsGap:NO,side:CW.TOP_SIDE},{classNames:"top-right-corner-pointer corner-pointer".w(),name:"point-up-on-right",right:15,needsGap:NO,side:CW.TOP_SIDE},{classNames:"bottom-left-corner-pointer corner-pointer".w(),name:"point-down-on-left",left:15,needsGap:NO,side:CW.BOTTOM_SIDE},{classNames:"bottom-right-corner-pointer corner-pointer"
.w(),name:"point-down-on-right",right:15,needsGap:NO,side:CW.BOTTOM_SIDE}]}),require("render_delegates/menu_background"),SC.BaseTheme.NoPointers=SC.BaseTheme.Menu.create({name:"cw-no-pointers"}),SC.BaseTheme.addTheme(SC.BaseTheme.NoPointers),SC.BaseTheme.NoPointers.cwPickerBackgroundRenderDelegate=SC.RenderDelegate.create({className:"cw-picker-background",distanceFromEdge:20,render:function(e,t){this.addSizeClassName(e,t),this.includeSlices(e,t,SC.NINE_SLICE)},update:function(e,t){this.updateSizeClassName(e,t)}}),SC.BaseTheme.DropDown=SC.BaseTheme.create({name:"dropdown"}),SC.BaseTheme.addTheme(SC.BaseTheme.DropDown),SC.BaseTheme.DropDown.cwMenuRenderDelegate=SC.BaseTheme.cwMenuRenderDelegate.create({menuLeftOffset:-3,menuTopOffset:7,menuMinimumWidthOffset:-18,shouldDropDown:YES}),SC.BaseTheme.DropDown.cwPickerBackgroundRenderDelegate=SC.BaseTheme.NoPointers.cwPickerBackgroundRenderDelegate,SC.BaseTheme.ErrorCallout=SC.BaseTheme.create({name:"errorCallout"}),SC.BaseTheme.ErrorCallout.cwPickerBackgroundRenderDelegate=SC.BaseTheme.cwPickerBackgroundRenderDelegate.create({pickerDistanceFromRectangle:10,validPointerLayouts:[{name:"top-position",classNames:"calculated-pointer",minimumDistanceFromLeft:30,minimumDistanceFromRight:30,needsGap:NO}]}),SC.BaseTheme.cwPopupButtonRenderDelegate=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.PopUp=SC.BaseTheme.create({name:"popup"}),SC.BaseTheme.addTheme(SC.BaseTheme.PopUp
),SC.BaseTheme.PopUp.cwMenuRenderDelegate=SC.BaseTheme.cwMenuRenderDelegate.create({shouldDropDown:NO}),SC.BaseTheme.PopUp.cwPickerBackgroundRenderDelegate=SC.BaseTheme.NoPointers.cwPickerBackgroundRenderDelegate,SC.BaseTheme.cwSelectRenderDelegate=SC.BaseTheme.buttonRenderDelegate.create({}),SC.BaseTheme.cwSelectMenuRenderDelegate=SC.BaseTheme.cwMenuRenderDelegate.create({menuLeftOffset:-21,menuTopOffset:0,menuMinimumWidthOffset:16,"sc-small-size":{itemHeight:27,itemSeparatorHeight:7,menuHeightPadding:0,submenuOffsetX:2,menuTopOffset:-1,menuLeftOffset:-20},"sc-large-size":{itemHeight:30,itemSeparatorHeight:5,menuHeightPadding:0,submenuOffsetX:4}}),CW.PopupButtonView=SC.ButtonView.extend({renderDelegateName:"cwPopupButtonRenderDelegate",menu:CW.MenuPane,shouldLoadInBackground:NO,_menuIsLoaded:NO,isActive:NO,acceptsFirstResponder:YES,init:function(){arguments.callee.base.apply(this,arguments),this._currentMenu=null,this.invokeOnce("scheduleMenuSetupIfNeeded")},scheduleMenuSetupIfNeeded:function(){var e=this.get("menu");e&&e.isClass&&this.get("shouldLoadInBackground")&&SC.backgroundTaskQueue.push(CW.PopupButtonView.InstantiateMenuTask.create({popupButton:this}))},menuDidChange:function(){var e=this.get("menu");if(e===this._currentMenu)return;this.invokeOnce("scheduleMenuSetupIfNeeded")}.observes("menu"),setupMenu:function(){var e=this.get("menu");if(e===this._currentMenu)return;this._currentMenu&&(this.isActiveBinding.disconnect(),this._currentMenu.destroy(),this._currentMenu=null),e&&e.isClass&&(e=this.createMenu(e)),this._currentMenu=e,this.set("menu",e),e.set("owner",this),
this.isActiveBinding=this.bind("isActive",e,"isVisibleInWindow")},createMenu:function(e){return e.create()},showMenu:function(){this.setupMenu(),this.invokeLast("_showMenu")},hideMenu:function(){var e=this.get("menu");e&&!e.isClass&&e.remove()},_showMenu:function(){var e=this.get("menu");e.popup(this)},mouseDown:function(e){if(!this.get("isEnabled"))return YES;this.set("_mouseDown",YES),this.showMenu(),this._mouseDownTimestamp=null;var t=this;return t._mouseDownTimestamp=0,setTimeout(function(){t._mouseDownTimestamp=SC.getCurrentTimeForPerformance()},1),this.becomeFirstResponder(),YES},mouseUp:function(e){var t=this.get("menu"),n,r;return t&&this.get("_mouseDown")&&(n=t.getPath("rootMenu.targetMenuItem"),this._mouseDownTimestamp===0&&(this._mouseDownTimestamp=SC.getCurrentTimeForPerformance()),SC.getCurrentTimeForPerformance()-this._mouseDownTimestamp>400&&(n&&t.get("mouseHasEntered")&&this._mouseDownTimestamp?n.performAction()||t.remove():t.remove())),this._mouseDownTimestamp=undefined,YES},keyDown:function(e){return e.which==13?(this.showMenu(),YES):arguments.callee.base.apply(this,arguments)},touchStart:function(e){return this.mouseDown(e)},touchEnd:function(e){return this.mouseUp(e)}}),CW.PopupButtonView.InstantiateMenuTask=SC.Task.extend({popupButton:null,run:function(e){this.popupButton.setupMenu()}}),CW.SelectView=CW.PopupButtonView.extend({themeName:"dropdown",renderDelegateName:"cwSelectRenderDelegate",items:null,itemsBindingDefault:SC.Binding.multiple(),itemTitleKey:"title",itemSortKey:null,itemValueKey:"value",itemIconKey:"icon",itemSeparatorKey:"separator",itemIsEnabledKey
:"isEnabled",menu:CW.SelectViewMenuPane,selectedItem:null,selectedItemBinding:"*menu.rootMenu.selectedItem",supportsFocusRing:YES,init:function(){arguments.callee.base.apply(this,arguments),this._scsv_updateTitle(),this._scsv_valueDidChange()},_scsv_getValueForMenuItem:function(e){var t=this.get("itemValueKey")||"value";return SC.typeOf(e)===SC.T_STRING?e:e.get?e.get(t):e[t]},_scsv_selectedItemDidChange:function(){var e=this.get("selectedItem"),t=this._scsv_lastSelection,n=this.get("itemTitleKey")||"title",r=this.get("itemValueKey")||"value";e&&this.setIfChanged("value",this._scsv_getValueForMenuItem(e)),t&&t.addObserver&&e!==t&&(t.removeObserver(n,this,this._scsv_selectedItemPropertyDidChange),t.removeObserver(r,this,this._scsv_selectedItemPropertyDidChange)),e&&e.addObserver&&e!==t&&(e.addObserver(n,this,this._scsv_selectedItemPropertyDidChange),e.addObserver(r,this,this._scsv_selectedItemPropertyDidChange)),this._scsv_lastSelection=e}.observes("selectedItem"),_scsv_selectedItemPropertyDidChange:function(e){this._scsv_updateTitle(),this.set("value",e.get(this.get("itemValueKey")||"value"))},defaultTitle:"",_scsv_updateTitle:function(){var e=this.get("selectedItem"),t,n;e?e.get?(t=e.get(this.get("itemTitleKey")||"title"),n=e.get(this.get("itemIconKey")||"icon")):SC.typeOf(e)==SC.T_HASH?(t=e[this.get("itemTitleKey")||"title"],n=e[this.get("itemIconKey")||"icon"]):t=e:t=this.get("defaultTitle"),t&&this.set("title",t),this.set("icon",n)}.observes("selectedItem"),_scsv_valueDidChange:function(){var e=this.get("value");if(!this.get("items"))return;var t=this.get("items"),n=t.get?
t.get("length"):t.length,r,i;for(r=0;r<n;r++){i=t.objectAt?t.objectAt(r):t[r];if(this._scsv_getValueForMenuItem(i)===e){this.setIfChanged("selectedItem",i);return}}this.setIfChanged("selectedItem",null)}.observes("value"),_scsv_itemsDidChange:function(){this._scsv_valueDidChange()}.observes("items","items.[]"),createMenu:function(e){var t={selectView:this,selectedItem:this.get("selectedItem")};return e.create(t)},keyDown:function(e){if(this.interpretKeyEvents(e))return YES;if(e.keyCode===13)return NO;arguments.callee.base.apply(this,arguments)},interpretKeyEvents:function(e){if(e){if(e.keyCode===38||e.keyCode===40)return this.showMenu(),YES;if(e.keyCode===27)return this.resignFirstResponder(),YES}return arguments.callee.base.apply(this,arguments)},acceptsFirstResponder:function(){return this.get("isEnabled")}.property("isEnabled").cacheable()}),window.CW||(CW=SC.Object.create()),SC.REGULAR_BUTTON_HEIGHT=27,CW.CANVAS_BUTTON_HEIGHT=26,CW.TOOLBAR_BUTTON_HEIGHT=26,CW.SQUARE_BUTTON_LARGE_HEIGHT=30,CW.SQUARE_BUTTON_REGULAR_HEIGHT=27,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,AppleThemeV4=SC.BaseTheme.create({name:"atv4"}),SC.ButtonView.reopen({isBorderless:YES}),SC.Theme.addTheme(AppleThemeV4),SC.defaultTheme="atv4",AppleThemeV4.iOS=AppleThemeV4.subtheme("iOS"),AppleThemeV4.iOS.blue=AppleThemeV4.iOS.subtheme("iOSBlue"),AppleThemeV4.ErrorCallout&&AppleThemeV4
.addTheme(AppleThemeV4.ErrorCallout),require("theme"),AppleThemeV4.menuRenderDelegate=SC.BaseTheme.menuRenderDelegate.create({itemHeight:27,itemSeparatorHeight:7,menuHeightPadding:6,"sc-small-size":{itemHeight:27,itemSeparatorHeight:7,menuHeightPadding:6,submenuOffsetX:2},"sc-large-size":{itemHeight:31,itemSeparatorHeight:9,menuHeightPadding:8,submenuOffsetX:4}}),CW.SQUARE_MENU_ITEM_HEIGHT=31,CW.SQUARE_MENU_ITEM_SEPARATOR_HEIGHT=7,CW.SQUARE_MENU_HEIGHT_PADDING=6,AppleThemeV4.iOS.cwPickerBackgroundRenderDelegate&&(AppleThemeV4.iOS.cwPickerBackgroundRenderDelegate=AppleThemeV4.iOS.cwPickerBackgroundRenderDelegate.create({validPointerLayouts:[{name:"left-or-right-position",classNames:"calculated-pointer",minimumDistanceFromLeft:60,minimumDistanceFromRight:60,needsGap:YES},{name:"top-or-bottom-position",classNames:"calculated-pointer",minimumDistanceFromTop:60,minimumDistanceFromBottom:60,needsGap:YES}]})),AppleThemeV4.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=t.begin("label").addClass("sc-button-label").id(l),e.get("theme").labelRenderDelegate.render(e,t),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()),t.attr("title",e.get("toolTip")),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]}}),AppleThemeV4.panelRenderDelegate=SC.RenderDelegate.create({className:"panel",render: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)},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)}}),AppleThemeV4.cwPopupButtonRenderDelegate=AppleThemeV4.buttonRenderDelegate.create({render:function(e,t){t.attr("aria-haspopup","true"),arguments.callee.base.apply(this,arguments)}}),AppleThemeV4.PopupButtonRenderDelegate=AppleThemeV4
.cwPopupButtonRenderDelegate.create(),AppleThemeV4.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,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"),a="left",f="width"):(t.attr("aria-orientation","vertical"),t.addClass("sc-vertical"),a="top",f="height",u=100-u),t=t.begin("div").addClass("cw-slider-track-before").css(f,u+"%").end(),t=t.begin("div").addClass("cw-slider-track-after").css(a,u+"%").end(),t=t.begin("div").addClass("cw-slider-handle").css(a,u+"%").end();var l=e.get("renderState");l._cachedHandle=null,l._cachedTrackBefore=null,l._cachedTrackAfter=null},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("maximum"),r=e.get("minimum"),i=e.get("ariaValue"),s=e.get("layoutDirection")===SC.LAYOUT_HORIZONTAL,o=e.didChangeFor("sliderRenderDelegate","layoutDirection");t.attr("aria-valuemax",n),t.attr("aria-valuemin",r),t.attr("aria-valuenow",i),t.attr("aria-orientation",s?"horizontal":"vertical"),t.addClass(s?"sc-horizontal":"sc-vertical");if(o||e.didChangeFor("sliderRenderDelegate","value")){var u=e.get("renderState"),a=u._cachedHandle,f=u._cachedTrackBefore,l=u._cachedTrackAfter;a||(a=u._cachedHandle=t.find(".cw-slider-handle"),f=u._cachedTrackBefore=t.find(".cw-slider-track-before"),l=u._cachedTrackAfter=t.find(".cw-slider-track-after"));var c=e.
get("frame"),h=e.get("value");o&&a.css(s?"top":"left",null),s?(f.css("width",h+"%"),l.css("left",h+"%"),a.css("left",h+"%")):(f.css("height",h+"%"),l.css("top",h+"%"),a.css("top",100-h+"%"))}}}),CK.meCardController=SC.Object.create({NO_PHOTO_SRC:window.devicePixelRatio>1?"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/foundation/1812Project43/en-us/source/resources/images/no_photo@2x.png":"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/foundation/1812Project43/en-us/source/resources/images/no_photo.png",photoChanged:NO,meCardUrl:function(){var e=CK.servicesController.getServiceUrlFor("contacts")+"/co/mecard/";return e}.property(),meCard:null,meCardRequirementSatisfied:NO,imgLoadError:NO,shouldCreateMeCard:NO,getMeCard:function(e){if(!CK.servicesController.getServiceInfoFor("contacts")){SC.debug("meCardController: not requesting me-card since contacts is disabled."),this.set("meCardRequirementSatisfied",YES),e instanceof Function&&e(1);return}var t=this.get("meCardUrl"),n=CK.Request.getUrl(t,null),r=this;n.set("reportRequest",YES),n.notify(200,this,function(t){var n=t.get("body");return typeof n=="string"&&(n=JSON.parse(n)),!n||!n.contacts?(SC.debug("no me-card is set"),r.set("shouldCreateMeCard",YES),r.set("meCard",{})):(SC.debug("meCardController: me-card received"),r.set("meCard",n.contacts[0])),e instanceof Function&&e(0),r.set("meCardRequirementSatisfied",YES),YES}),n.notify(0,this,function(t){SC.debug("meCardController: problem receiving me-card");if(CloudOS.getEnvironment()==="DEMO"){SC.debug("meCardController: using appleseed me-card in DEMO");var n="/system/cloudos/1812Project43/cloudkit/foundation/1812Project43/en-us/source/resources/images/appleseed_small.jpg"
;r.set("meCard",{photo:{url:n,crop:{height:165,width:165,y:22,x:11}}})}else r.set("shouldCreateMeCard",YES);return e instanceof Function&&e(1),r.set("meCardRequirementSatisfied",YES),YES}),SC.debug("Sending me card GET request to %@",t),n.send()},storeMeCard:function(e,t){var n=this.get("meCard");if(!CK.servicesController.getServiceInfoFor("contacts")){SC.debug("meCardController: not storing me-card since contacts is disabled.");return}var r=this.get("shouldCreateMeCard"),i=r?"POST":"PUT",s=this.get("meCardUrl")+"?method="+i,o=CK.Request.postUrl(s,null),u=this,a,f;o.set("isJSON",YES),o.set("reportRequest",YES),a=n?n:{};if(e)for(f in e){if(!e.hasOwnProperty(f))continue;a[f]=e[f]}o.notify(200,this,function(e){var n=e.get("body");return n.contacts?(u.set("shouldCreateMeCard",NO),SC.debug("me-card received"),this.set("meCard",n.contacts[0])):SC.debug("no me-card is set"),t instanceof Function&&t(0),YES}),o.notify(0,this,function(e){return SC.debug("problem storing me-card"),t instanceof Function&&t(1),YES});if(r){a.contactId=CW.upperCaseUUID();var l=CloudOS.authController,c=l.get("user"),h=c.get("isPrimaryAppleIdTypeEmail"),p=c.get("isPrimaryAppleIdTypePhoneNumber"),d=c.get("displayablePrimaryAppleId"),v=[{field:d}];a.firstName=c.get("firstName"),a.lastName=c.get("lastName"),h?(v[0].label="home",a.emailAddresses=v):p&&(v[0].label="mobile",a.phones=v)}var m={contacts:[a]};SC.debug("Sending me card GET request to %@",s),o.send(m)},completePhotoPicker:function(e){var t={url:e.photoUrl,crop:e.photoCrop,signature:e.photoSignature};this.set("photo",t),this.set("photoChanged",YES)},meCardPosted
:function(){this.getMeCard()},photoUrl:function(e,t){if(t===undefined)return this.getPath("photo.url")||null;var n=this.get("photo");n.url=t}.property("photo"),photoCrop:function(e,t){if(t===undefined)return this.getPath("photo.crop")||null;var n=this.get("photo");n.crop=t}.property("photo"),photoSignature:function(e,t){if(t===undefined)return this.getPath("photo.signature");var n=this.get("photo");n.signature=t}.property("photo"),photo:function(e,t){if(t===undefined)return this.getPath("meCard.photo");var n=this.get("meCard");n&&(n.photo=t)}.property("meCard"),isPhotoUrlValid:function(){return!this.get("imgLoadError")&&!!this.get("photoUrl")}.property("photoUrl","imgLoadError"),deletePhoto:function(){this.set("photo",null),this.set("photoChanged",YES)},reset:function(){this.set("meCard",null),this.set("meCardRequirementSatisfied",NO)}}),CK.StatsController=SC.Object.extend({_statsQueue:[],statSessionId:null,STAT_COALESCING_WINDOW:8e3,includedParams:{},recordStat:function(e,t,n){var r,i,s=this.get("includedParams"),o=e+t,u=window.CloudOS&&!CloudOS.isCloudOSClient,a=u&&CloudOS.getClientId?CloudOS.getClientId():this.get("statSessionId");r={statName:o,statSessionId:a,hostname:window.location.hostname,buildNumber:SC.buildNumber,platform:window.CloudOSBootstrap&&CloudOSBootstrap.isOnSupportedMobile?"mobile":"desktop"};if(!n||!n.appName)r.appName=e;for(var f in s)r[f]=s[f];i=SC.merge(n,r);try{SC.json.encode(i)}catch(l){CW.fatalError("'%@' stat from '%@' cannot be encoded, possibly a circular reference.".fmt(t,e))}this._statsQueue.push(i),this.invokeOnceLater(this.sendStats,this.STAT_COALESCING_WINDOW
)},_benchmarkStats:{},getStat:function(e,t){return this._getBenchmark(e,t)},beginStat:function(e,t,n){if(this.getStat(e,t)){SC.warn("%@ stat already exists for %@",t,e);return}n=n||{},n._startTime=SC.getCurrentTimeForPerformance(),this._recordBenchmark(e,t,n)},endStat:function(e,t,n,r){var i=this.getStat(e,t),s,o,u;r&&(s=r.durationKeyName,o=r.includeLocationAndLocale,u=r.includeLocationUrlDetails);if(!i){SC.warn("%@ stat does not exist for %@",t,e);return}s=s?s:"duration",i[s]=SC.getCurrentTimeForPerformance()-i._startTime,delete i._startTime;var a=SC.merge(n,i);o&&(a=this.includeLocationAndBrowserLocale(a)),u&&(a=this.includeLocationUrlDetails(a)),this.recordStat(e,t,a),this._clearBenchmark(e,t)},cancelStat:function(e,t){var n=this._getBenchmark(e,t);n&&this._clearBenchmark(e,t)},_getBenchmark:function(e,t){var n=this._benchmarkStats;if(!n[e]||!n[e][t])return;return n[e][t]},_clearBenchmark:function(e,t){var n=this._benchmarkStats;delete n[e][t]},_recordBenchmark:function(e,t,n){var r=this._benchmarkStats;r[e]||(r[e]={}),r[e][t]=n},endAllBenchmarkStats:function(e){var t=this._benchmarkStats,n,r,i;for(n in t){if(e&&n!==e)continue;for(r in t[n])i=t[n][r],this.endStat(n,r,i)}},sendStats:function(e,t){var n=this._statsQueue;if(!n||n.length===0)return;var r=CW.Request.postUrl("/reportStats");r.set("addressPrefix","https://feedbackws.%{currentDomain}".fmt({currentDomain:COS.authController.get("currentDomain")})),r.set("useCrossDomain",YES),r.set("isJSON",YES),r.set("attachIdentifyingHeaders",NO),r.set("isAsynchronous",e===undefined?YES:e),r.set("timeout",null),r.header("Content-Type"
,"text/plain"),r.notify(200,this,function(e){return SC.info("Successfully sent stats to feedbackws"),t&&t.call(undefined,e),YES}),r.notify(0,this,function(e){return SC.warn("Error sending stats to feedbackws"),t&&t.call(undefined,e),YES}),SC.debug("Sending stats to feedbackws"),r.send({stats:n}),this._statsQueue=[]},flushStats:function(){this.endAllBenchmarkStats(),this.sendStats(NO)},recordLocationStat:function(e,t,n){n||(n={}),this.recordStat(e,t,this.includeLocationAndBrowserLocale(n))},includeLocationAndBrowserLocale:function(e){var t=window.COS;if(!t)return SC.warn("includeLocationAndBrowserLocale() is only available to icloud authenticated applications."),e;var n=t.authController.get("requestInfo");n&&(e.region=n.region,e.country=n.country),e.time=(new Date).toString()+" ("+Math.floor(new Date)+")";var r=(new Date).toString().match(/.*?\((.*?)\).*/);return r&&r.length===2&&(e.timezone=r[1]),e.browserLocale=(navigator.language||navigator.browserLanguage).toLowerCase(),e},recordLocationAndWindowUrlStat:function(e,t,n){n||(n={});var r=window.CloudOSBootstrap;if(!r){SC.warn("recordLocationAndWindowUrlStat() is only available to stats originating from CloudOS app.");return}this.recordStat(e,t,this.includeLocationUrlDetails(this.includeLocationAndBrowserLocale(n)))},recordWindowUrlStat:function(e,t,n){n||(n={});var r=window.CloudOSBootstrap;if(!r){SC.warn("recordWindowUrlStat() is only available to stats originating from CloudOS app.");return}this.recordStat(e,t,this.includeLocationAndBrowserLocale(n))},includeLocationUrlDetails:function(e){if(!e)return;return window.
CloudOSBootstrap&&(CloudOSBootstrap.didLoadWithShareURL&&(e.isShareUrl=!0),CloudOSBootstrap.isTermsAndConditionUrl&&(e.isTermsAndConditionUrl=!0),CloudOSBootstrap.hasPostLoginRedirectUrl&&(e.hasPostLoginRedirectUrl=!0)),e}}),CK.CloudOSGetterSupport={getUser:function(){var e=this.get("appInstance"),t=e?e._cloudOSState:null;if(!e||!t)return window.COS&&COS.authController?COS.authController.get("user"):null;var n=t.authBag;return!e._cos_user_cache&&n?(SC.debug("Creating local CK.User object"),e._cos_user_cache=CK.User.createFromAuthBag(n)):n||SC.warn("Cannot getUser() before authenticating."),e._cos_user_cache},isUserNotAuthenticated:function(){if(window.COS&&COS.authController)return COS.authController.get("isNotAuthenticated");if(CK.currentApplication){var e=this.get("appInstance");if(e&&e._cloudOSState)return e._cloudOSState.userAuthenticationState===CK.AuthenticationStateEnum.NOT_AUTHENTICATED}return undefined},isUserPartiallyAuthenticated:function(){if(window.COS&&COS.authController)return COS.authController.get("isPartiallyAuthenticated");if(CK.currentApplication){var e=this.get("appInstance");if(e&&e._cloudOSState)return e._cloudOSState.userAuthenticationState===CK.AuthenticationStateEnum.PARTIALLY_AUTHENTICATED_HSA}return undefined},isUserAuthenticated:function(){if(window.COS&&COS.authController)return COS.authController.get("isAuthenticated");if(CK.currentApplication){var e=this.get("appInstance");if(e&&e._cloudOSState)return e._cloudOSState.userAuthenticationState===CK.AuthenticationStateEnum.AUTHENTICATED}return undefined},userIsAuthenticated:function(){return this.
isUserAuthenticated()},getAccountPreferences:function(){if(window.COS&&COS.authController)return COS.authController.accountPreferences();if(CK.currentApplication){var e=this.get("appInstance");if(!e._cos_account_preferences_cache){SC.debug("Creating local CK.AccountPreferences object");var t=e._cloudOSState.accountPreferences;if(!t){SC.warn("Cannot getAccountPreferences() before authenticating.");return}e._cos_account_preferences_cache=CK.AccountPreferences.create(t)}return e._cos_account_preferences_cache}return null},getAppInfo:function(e){var t=this.getAppInfoList();for(var n=0;n<t.length;n++){if(!t[n])return undefined;if(t[n].get("name")===e)return t[n]}},getAppInfoList:function(){var e=[],t;if(CK.currentApplication)t=this.get("appInstance"),t&&t._cloudOSState&&(e=t._cloudOSState.appsInfo||e,e=e.map(function(e){return COS.AppInfo.create(e)}));else if(window.COS&&COS.appsController){var n=COS.apps,r;for(r in n)e.push(COS.appsController.getAppInfoFor(r))}return e},getUserRegionFormat:function(){var e=this.getAccountPreferences(),t;return e?t=e.get("regionFormat")||e.get("locale"):t=String.preferredLanguage,t&&(t=CK.computeBestAvailableLocale(CK.SUPPORTED_REGION_FORMATS,t)),t},getAppDisplayName:function(){var e=this.get("appInstance"),t=e?e._cloudOSState:null;return t?t.displayName:null},getAccountMenu:function(){var e=this.get("appInstance"),t=e?e._cloudOSState:null;return t?t.accountMenu:null},getAccountMenuItems:function(){var e=this.getAccountMenu(),t;return e&&e.items?t=e.items:t=[{title:"AccountMenu.SignOut".loc(),target:"CloudOS",action:"performLogout"}],t=t.map(function(
e){var t=e.action,n=SC.objectForPropertyPath(e.target)||CloudOS;return e.action=function(){n&&n[t]&&n[t].call(n)},delete e.target,e}),t},getAccountMenuWidth:function(){var e=this.getAccountMenu();return e&&e.width?e.width:200},getUrlForServiceName:function(e,t){var n=this.get("appInstance");return e=SC.typeOf(e)===SC.T_STRING?e:n.get("name"),CK.servicesController.getServiceUrlFor(e,!!t)},getStatusForServiceName:function(e,t){var n=this.get("appInstance");return e=SC.typeOf(e)===SC.T_STRING?e:n.get("name"),CK.servicesController.getServiceStatusFor(e,!!t)},getAppLoadReason:function(){return this.get("loadReason")},getCurrentlyActiveApplication:function(){var e=this.get("appInstance");return e._cloudOSState.currentlyActiveApplication},getRoute:function(){var e=this.get("appInstance");return e._cloudOSState.route},getAppPreferences:function(e){if(!CK.isLoadedByCloudOS&&window.COS&&COS.prefsController){var t=SC.clone(COS.prefsController.allAppPreferencesHash());return e?t[e]:t}if(CK.currentApplication){var n=this.get("appInstance"),r=n.get("name"),i;e=e?e:r,i=SC.clone(n._cloudOSState.appPreferences[e],YES);if(!i){SC.warn("Failed to getAppPreferences() for %@",e);return}return e===r?(n._cos_app_preferences_cache||(n._cos_app_preferences_cache=i),n._cos_app_preferences_cache):i}},getRequestedStartupUrl:function(){var e=this.get("appInstance");return e._cloudOSState.requestedStartupUrl},getRequestedStartupInfo:function(){var e=this.get("appInstance");return e._cloudOSState.requestedStartupInfo},getEnvironment:function(){if(this.isCloudOSClient)return COS.authController.get("environment"
);var e=this.get("appInstance");return e._cloudOSState.environment},getClientId:function(){var e=this.get("appInstance");return e._cloudOSState.clientId},sessionIsExtendedLogin:function(){var e=this.get("appInstance");return e._cloudOSState.authBag.isExtendedLogin},getHostname:function(){var e=this.get("appInstance");return e._cloudOSState.hostname},getAvailableLocales:function(){var e=this.get("appInstance");return e._cloudOSState.availableLocales},getLocalesSupportedByAllApps:function(){var e=this.get("appInstance");return e._cloudOSState.localesSupportedByAllApps},mailTo:function(e,t,n,r,i,s){var o=this.get("appInstance"),u="",a,f,l={to:e?e:"",subject:t?t:"",body:n?n:"",cc:r?r:"",bcc:i?i:"",attachments:s?s:null,appName:CK.currentApplication.get("capitalizedName")};u="&willPM=true";if(CK.servicesController.getServiceInfoFor("mail")){var c=CloudOS.getAccountPreferences(),h=c.get("locale"),p=c.get("secondaryLocale")||"en-us",d=CloudOS.getLocalesSupportedByAllApps().map(function(e){return e.locale}),v=!1,m=d.length;for(var g=0;g<m;g++)if(d[g]===h){v=!0;break}var y=v?h:p,b=CK.openWindowApplication("https://%@/message/current/%@/index.html#compose?%@".fmt(window.location.hostname,y,u),"","width=810,height=644,resizable=yes,scrollbars=auto,status=no,menubar=no,toolbar=no,location=no,directories=no");CK.passWindowApplicationMessage(b,"populateFields",l)}else{var w=[];r&&w.push("cc="+r),i&&w.push("bcc="+i),n&&w.push("body="+encodeURI(n)),t&&w.push("subject="+encodeURI(t)),CK.redirectTo("mailto:%@?%@".fmt(e,w.join("&")))}},openIWorkDocument:function(e,t,n){var r={fileName:e,url:t,source
:this.get("appInstance").get("name")},i=CloudOS.getUser(),s=location.protocol+"//"+location.hostname,o=i&&i.get("brMigrated")?s+"/"+n+"/open_from_source":"/iw/#open_from_source/"+n,u=CK.openWindowApplication(o,"_blank");CK.passWindowApplicationMessage(u,"openFromSource",r)},getOpenersForDocument:function(e){var t=CK.FilenameUtils.normalizedExtension(e),n;return n=this._appsForExtension(t),n},_appsForExtension:function(e){var t=this.getAppInfoList(),n=[],r,i,s;for(var o=0;o<t.length;o++)i=t[o],s=i.get("supportedFileExtensions"),s&&s.contains(e)&&n.push(i);return n},openICloudDriveFile:function(e,t,n){var r=NO;n||(n=this.getOpenersForDocument(t.name)[0]);if(n){var i=n.get("name");if(i==="pages"||i==="numbers"||i==="keynote")r=this._openIWorkDriveFile(e,t,i)}return r},_openIWorkDriveFile:function(e,t,n){var r,i,s,o,u,a=NO,f=CloudOS.getDefaultAssetHostname();return t.name&&f&&(r=CK.FilenameUtils.baseName(t.name),r=r.replace(/[\s\/\u0085\u00a0\u1680\u180e\u2000-\u200d\u2028\u2029\u202f\u205f\u2060\u3000\ufeff]/g,"_"),t.sharingToken?(i=t.sharingToken,u="//%@/%@/%@#%@".fmt(f,n,i,r)):t.documentId&&(s=CloudOS.getUser().get("dsid"),o=t.documentId,u="//%@/%@/docws:%@:%@:%@#%@".fmt(f,n,s,e,o,r)),u&&(a=CK.openWindowApplication(u,"_blank"))),a},showHelp:function(e){var t=this.get("appInstance");CK.HelpUtils.open(t&&t.get("name"),e)},requestMeCard:function(){var e=this.appInstance,t=this.isCloudOSClient,n=e?e.isWindowApplication:!1,r=CK.meCardController,i=function(t,n){var r=!!t.photo,i={prefix:t.prefix,firstName:t.firstName,lastName:t.lastName,suffix:t.suffix,photoUrl:r?t.photo.url:null,photoCrop
:r?t.photo.crop:null,photoSignature:r?t.photo.signature:null};if(n)return i;e.receiveMeCard(i)},s,o;t?(s=r.get("meCard"),s?o=!1:o=!0):n?(s=e._cloudOSState.meCard,s||(s=r.get("meCard")),s?o=!1:o=!0):(s=e._cloudOSState.meCard,o=!1);if(!!s)return i(s,t);if(!o)return;r.getMeCard(function(){s=r.get("meCard");if(!!s)return i(s,t);SC.debug("requestMeCard: No meCard present")})},windowApplicationHasInitialized:function(e,t,n){CK.windowApplicationDidInitialize(e);if(!n){var r;if(CK.currentApplication){var i=this.get("appInstance"),s=CK.currentApplication;r=i._cloudOSState}else r=COS.cloudOSStateForApp(t);CK.passWindowApplicationMessage(e,"_applicationShouldInvokeMain",CloudOS._cloudOSAPIMethodNames,r)}CK.passPendingWindowApplicationMessages(e)},windowApplicationIsKnown:function(e){return CK.windowApplicationIsRegistered(e)},windowApplicationWillClose:function(e){var t=CK.getBackwardCompatibleInstanceId(e);CK.windowApplication[t]=null},exit:function(e,t){var n;if(CK.currentApplication)e=arguments[0],t=arguments[1],n=this.getPath("appInstance.name"),!t&&e!==CK.EXIT_NON_FATAL&&(t=SC.Logger.stringifyRecordedLogMessages());else{var r=arguments[0];e=arguments[2],t=arguments[3],n=r.get("name")}if(e===undefined||n===undefined){SC.warn("statusCode and appName must be provided for exit()");return}this.invokeLast(function(){CK.currentApplication?this.get("appInstance").invokeMethodOnCloudOS(n,"exit",[e,t]):this.appController.exitApplication(n,e,t)})},passMessageToOpenerApplication:function(e){var t=CloudOS.getOpenerWithCloudOS();if(t){var n=this.get("appInstance"),r=SC.$A(arguments);r.shift(),n
.invokeMethodOnCloudOS(n.get("name"),e,r,t)}},getOpenerWithCloudOS:function(){var e,t;CK.currentApplication?e=this.getPath("appInstance.cloudOSWindow"):e=window;try{e&&e.opener&&e.opener.CloudOS&&(t=e.opener,SC.info("Found an openers CloudOS instance"))}catch(n){SC.info("No opener found, or not allow to get reference to its CloudOS")}return t},hasOpenerWithCloudOS:function(){return!!CloudOS.getOpenerWithCloudOS()},setAppBanner:function(){var e=SC.$A(arguments);if(CK.currentApplication){var t=this.getPath("appInstance.name");if(e.length!==1){SC.warn("setAppBanner expects exactly 1 argument.");return}e.push(t),this.get("appInstance").invokeMethodOnCloudOS(this.getPath("appInstance.name"),"setAppBanner",e)}else{if(e.length<4){SC.warn("There are not enough arguments for function setAppBanner.");return}CloudOS.bannerManager.setAppBanner(e[2],e[3])}},currentAppName:function(){var e;return CK.currentApplication?e=this.getPath("appInstance.name"):e=CloudOS.appController.getPath("currentApp.name"),e},getQuotaData:function(){var e=this.get("appInstance");if(!e||!e._cloudOSState)return window.COS&&COS.authController?COS.authController.get("quotaInfo"):null;var t=e._cloudOSState.quotaData;return!e._cos_quota_cache&&t?(SC.debug("Creating local CK.QuotaInfo object"),e._cos_quota_cache=CK.QuotaInfo.create(t)):t||SC.warn("Cannot set Quota Data."),e._cos_quota_cache},isUserOverQuota:function(){var e=this.getQuotaData();return e?e.get("overQuota"):null},refreshQuotaData:function(){CK.currentApplication?this.get("appInstance").invokeMethodOnCloudOS(this.getPath("appInstance.name"),"refreshQuotaData"
):window.COS&&COS.authController&&COS.authController.getQuotaData()},isHSAChallengeRequired:function(){var e=this.get("appInstance");if(!e||!e._cloudOSState)return window.COS&&COS.authController?COS.authController.get("hsaChallengeRequired"):null;var t=e._cloudOSState;return t.authBag.hsaChallengeRequired},resolveCKShortGUID:function(){if(CK.currentApplication)this.get("appInstance").invokeMethodOnCloudOS(this.getPath("appInstance.name"),"resolveCKShortGUID",SC.$A(arguments));else if(window.COS&&COS.authController){var e=arguments[0].get("name"),t=arguments[2],n="#"+e+"/"+t;window.location.hash===n?CloudOS.statechart.sendAction("goToSharingState",{shortGUID:t,appNameFromUrl:e}):window.location.hash="#"+e+"/"+t}},replaceCurrentApp:function(){if(CK.currentApplication)this.get("appInstance").invokeMethodOnCloudOS(this.getPath("appInstance.name"),"replaceCurrentApp",SC.$A(arguments));else if(window.CloudOS&&CloudOS.isCloudOSClient){var e=arguments[0],t=e.get("name"),n=arguments[2],r=CloudOS.appManagerFor(n),i=CloudOS.appController,s=CloudOS.authController._auth_bag.apps,o=function(){r=CloudOS.appManagerFor(n),CloudOS.appController.set("pendingApp",r),r.set("loadReason",CK.LOAD_REASON_APP_REPLACED),CloudOS.statechart.sendAction("globalAppSwitchWasRequested"),CW.notificationCenter.subscribeToNotification("App Loaded",this,function(t,r){t===n&&(e.teardown(YES),i.removeOmittedApps(s))})};i.replaceOrAddApp(s,t,n),i.addAppsReplaced(t,n),r?o():(CW.notificationCenter.subscribeToNotification("receivedInfoForDynamicApp",this,function(t,r){t===n&&(i.notifyPropertyChange("appList"),r?(e.teardown
(YES),i.removeOmittedApps(s)):o())}),i.detectAndLoadAdditionalApps(s))}},getWindowMinimumSize:function(){if(window.COS)return{minWidth:COS.MIN_WIDTH,minHeight:COS.MIN_HEIGHT};var e=this.get("appInstance");if(e&&e._cloudOSState)return e._cloudOSState.mininumWindowSize},isOnSupportedMobile:function(){if(window.CloudOSBootstrap)return CloudOSBootstrap.isOnSupportedMobile;var e=this.get("appInstance");if(e&&e._cloudOSState)return e._cloudOSState.isOnSupportedMobile},getSecureChannelInfo:function(){var e=this.get("appInstance"),t=e?e._cloudOSState:null;if(!e||!t)return window.COS&&COS.authController?COS.authController.get("secureChannelInfo"):null;var n=t.secureChannelInfoData;return!e._secure_channel_info_cache&&n?(SC.debug("Creating local CK.SecureChannelInfo object"),e._secure_channel_info_cache=CK.SecureChannelInfo.create(n)):n||SC.warn("No secure Channel Info object. The user might not have used the secure channel route for logging in."),e._secure_channel_info_cache},getDefaultAssetHostname:function(){var e=this.get("appInstance"),t=e?e._cloudOSState:null;if(!e||!t)return window.COS&&COS.authController?COS.authController.get("defaultAssetHostname"):null;if(e&&e._cloudOSState)return e._cloudOSState.defaultAssetHostname}},CK.MicroResourceContainer={_cacheSizeHighWaterMark:200,_cacheSizeLowWaterMark:150,containerInit:function(){this._queue=[],this._status={},this._cache={},this._cacheSize=0,this._cacheLRU={},this._alreadyPendingCallbacks={},this._cacheLRUCounter=0},containerLoad:function(e,t){if(e===null||e===undefined)return t(undefined,undefined);if(e in this._cache)return t(
undefined,this.containerGet(e));if(this._status[e]===CK.MicroResourceContainer.LoadStatus.PENDING){var n=this._alreadyPendingCallbacks[e]||(this._alreadyPendingCallbacks[e]=[]);n.push(t);return}this._queue.push({key:e,callback:t}),this._status[e]=CK.MicroResourceContainer.LoadStatus.PENDING,this._hasInvokeLast||(this._hasInvokeLast=!0,this.invokeLast(function(){delete this._hasInvokeLast;var e=this._queue;e&&e.length&&(this._queue=[],this.containerFlush(e))}))},containerStoreResults:function(e,t,n,r){var i=this;e&&e.forEach(function(e,r){var s=t[r];n?i.containerSetStatus(e,CK.MicroResourceContainer.LoadStatus.FAILED):(i.containerSetStatus(e,CK.MicroResourceContainer.LoadStatus.LOADED),i.containerPut(e,s));var o=i._alreadyPendingCallbacks[e];o&&(o.forEach(function(e){e(n,s)}),delete i._alreadyPendingCallbacks[e])}),r.forEach(function(e){e.callback(n,i._cache[e.key])})},_containerPurge:function(){var e=this._cacheLRU,t=this._cache,n=this._status,r=Object.keys(t).sort(function(t,n){var r=e[t],i=e[n];return r<i?-1:r>i?1:0}),i=r.length,s=Math.min(this._cacheSize-this._cacheSizeLowWaterMark,i),o=0;for(var u=0;u<i;++u){var a=r[u];u<s?(delete t[a],delete e[a],delete n[a]):e[a]=o++}this.cacheLRUCounter=o,this._cacheSize-=s},containerGetStatus:function(e){return this._status[e]},containerSetStatus:function(e,t){this._status[e]=t},containerPut:function(e,t){var n=e in this._cache;this._cache[e]=t,this._cacheLRU[e]=this._cacheLRUCounter++,!n&&++this._cacheSize>this._cacheSizeHighWaterMark&&this._containerPurge()},containerGet:function(e){return this._cacheLRU[e]=this._cacheLRUCounter++,
this._cache[e]},containerFlush:function(e){CW.fatalError("Developer must provide a containerFlush method")}},CK.MicroResourceContainer.LoadStatus={NOT_LOADED:undefined,PENDING:"pending",LOADED:"loaded",FAILED:"failed"},CK.MicroResourceContainerServerError=SC.Object.extend({message:"",failedInputs:[]}),CK.RequestDelegate={isCKRequestDelegate:YES,getUrlForServiceName:function(e){return null},didReceiveSpecialResponse:function(e,t,n){}},CK.CKJSRequest={},CK.CKJSRequest.fetch=function(e,t){var n=e.substr(0,7),r=n==="http://"||n==="https:/",i=t.method||"GET",s=t.headers||{},o=t.body||"",u=CK.CKJSRequest._createQueryParamMapForUrl(e),a,f=e.split("?");f.length>1&&(e=f[0]);var l={withCredentials:YES,type:i,headers:s,address:e,body:o,reportRequest:YES};t&&t.credentials&&t.credentials.toLowerCase()==="omit"&&(l.withCredentials=NO),r||(l.serviceName="ckdatabasews"),window.CloudOS&&CloudOS.isUserAuthenticated()?a=CK.Request.create(l):(a=CW.Request.create(l),a.set("useCrossDomain",!0),a.set("attachIdentifyingHeaders",!1),a.set("contentType","text/plain"),a.header("Content-Type","text/plain"),a.set("addressPrefix","https://ckdatabasews.%{currentDomain}:443".fmt({currentDomain:URI(window.location.href).domain()})));var c=Object.keys(u);for(var h=0;h<c.length;h++){var p=c[h];a.queryParameter(p,u[p])}var d=new Promise(function(e,t){a.notify(200,this,function(n){return CK.CKJSRequest.handleSuccess(n,e,t),YES}.bind(this)),a.notify(0,this,function(n){return CK.CKJSRequest.handleFailure(n,e,t),YES}.bind(this)),a.send()}.bind(this));return d},CK.CKJSRequest.handleSuccess=function(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)},CK.CKJSRequest.handleFailure=function(e,t,n){var r=e.get("encodedBody"),i=new TypeError(r);n(i)},CK.CKJSRequest._createQueryParamMapForUrl=function(e){var t={},n=e.split("?");if(n.length>1){var r=n[1].split("&");for(var i=0;i<r.length;i++){var s=r[i],o=s.split("="),u=o[0],a=o[1];t[u]=a}}return t},CK.HelpUtils={open:function(e,t){var n=CloudOS.getUser(),r=n?n.isLiteAccount():NO,i=this.getHelpLanguageCodeForLocale(String.preferredLanguage),s=i==="en"?"":"?lang="+i,o="https://help.apple.com/"+(r?"icloudwebonly":"icloud")+"/"+s,u=SC.browser.chrome?705:675;t&&(o+="#"+t),window.open(o,"help","height="+u+",width=875,location=0,status=0,scrollbars=0")},getHelpLanguageCodeForLocale:function(e){var t=e.split("-"),n=["zh","pt"],r;return n.indexOf(t[0])!==-1?r=e:r=t[0],r}},CK.Request=CW.Request.extend(SC.DelegateSupport,CK.RequestReporting,{serviceName:null,useCrossDomain:YES,withCredentials:YES,attachIdentifyingHeaders:NO,contentType:undefined,delegate:null,requestDelegate:function(){var e=this.get("delegate")||window.CloudOS;return e||CW.fatalError("A CK.Request must have a delegate",{target:this}),e}.property("delegate").cacheable(),addressPrefix:function(){var e=null,t,n,r;return this.get("useCrossDomain")&&(t=this.get("requestDelegate"),n=this.get("address")||"",r=this._getServiceName(),n.
toLowerCase().indexOf("http")<0&&(e=t.getUrlForServiceName(r,NO),e&&(e[e.length-1]==="/"?n[0]==="/"&&(e=e.slice(0,-1)):n[0]!=="/"&&(e+="/")))),e}.property("useCrossDomain"),COPY_KEYS:CW.Request.prototype.COPY_KEYS.concat(["serviceName","delegate"]),init:function(){var e,t,n,r,i,s;arguments.callee.base.apply(this,arguments);if(!this.get("source")){this.get("useCrossDomain")&&(e=this.get("contentType"),e===undefined&&(e="text/plain",this.set("contentType",e))),e||(e=this.get("contentType")),e&&this.header("Content-Type",e),t=this._specialResponseStatuses;if(t){s=this._specialResponseWasReceived;for(n=0,r=t.length;n<r;++n)i=t[n],this.notify(i,this,s)}}},willSend:function(e,t){var n=window.CloudOS&&!CloudOS.isCloudOSClient,r=n&&CloudOS.getUser?CloudOS.getUser():COS.authController.get("user"),i=r?r.get("dsid"):null;i&&e.queryParameter("dsid",i),e.queryParameter("clientId",n&&CloudOS.getClientId?CloudOS.getClientId():COS.CLIENT_ID),e.queryParameter("clientBuildNumber",SC.buildNumber),e.queryParameter("clientMasteringNumber",SC.masteringNumber)},_specialResponseStatuses:[330,401,403,421,503],_specialResponseWasReceived:function(e){SC.debug("Received special response: %@",e);var t=this.get("requestDelegate"),n=e.get("status"),r=e.get("request"),i=r._getServiceName(),s=r.get("overallTimeout"),o=e.get("addedToOutgoingQueueTimestamp"),u=YES,a=NO,f=NO,l=e.get("body"),c,h,p,d,v;if(SC.typeOf(l)===SC.T_STRING)try{var m=SC.json.decode(l);l=m}catch(g){}if(n===330){var y=this.get("address");if(i&&i!=="keyvalue"){var b=URI(y);b.protocol()&&(SC.info("Removing hostname from %@ so we can pick up the new location"
,b),this.set("address",b.path()+b.search()+b.hash())),SC.Request.manager.suspendService(i)}else SC.error("We received a response with status 330 but the request (%@) was not annotated with a service name",r);a=YES}else if(n===403){v=NO;for(c in l)if(c.match(/^auth[ _\-]?mismatch$/i)){v=YES;break}v||(u=NO)}else if(n===503){if(l)for(c in l)if(c.match(/^retry[ _\-]?after$/i)){h=l[c];break}h&&(h=parseInt(h,10)),h&&(h*=1e3,s&&o&&(p=SC.getCurrentTimeForPerformance()-o,SC.debug("The server is telling us to retry after %@ms, it has been %@ms, and our overall timeout is %@ms",h,p,s),p+h+5e3<s?(SC.debug(" - it looks like we can make it so automatically retrying request %@…",r),a=YES,u=NO):(SC.debug(" - it doesnt look like we can make it so not automatically retrying request %@",r),a=NO,u=YES,d={retryAfter:h/1e3})))}return a&&(s&&o&&(p=SC.getCurrentTimeForPerformance()-o,p<s&&(r=r.copy()._prep(),r.set("overallTimeout",s-p))),this.invokeLater(function(){r.resend(e)},h),f=YES),d||(d={}),d.serviceName=i,u&&t.didReceiveSpecialResponse(n,e.get("encodedBody"),d),f},_getServiceName:function(){var e=this.get("serviceName"),t;return e||(t=CK.currentApplication,e=t?t.get("primaryServiceName")||t.get("name"):null),e}}),SC.Request.manager.mixin({serviceIsSuspended:function(e){e||CW.fatalError("serviceIsSuspended(): A service name must be specified",{target:this});var t=this._suspendedServices;return t&&t[e]},suspendService:function(e){e||CW.fatalError("suspendService(): A service name must be specified",{target:this});var t=this._suspendedServices;t||(t=this._suspendedServices={}),t[e]||SC.
debug("Suspending requests to “%@” service…",e),t[e]=YES},resumeService:function(e){e||CW.fatalError("resumeService(): A service name must be specified",{target:this});var t=this._suspendedServices;t&&(t[e]&&SC.debug("Resuming requests to “%@” service…",e),delete t[e]),SC.Request.manager.fireRequestIfNeeded()},resumeAllServices:function(){var e=this._suspendedServices,t;if(e)for(t in e)e[t]&&this.resumeService(t);SC.Request.manager.fireRequestIfNeeded()},_suspendedServices:null}),SC.Request.manager.mixin({shouldFireRequest:function(e){e||CW.fatalError("shouldFireRequest(): A response must be specified",{target:this});var t=e.get("request"),n=t._getServiceName?t._getServiceName():null;return n?!SC.Request.manager.serviceIsSuspended(n):YES}}),CK.AccountButtonView=CW.PopupButtonView.extend({themeName:"borderless",classNames:["account-menu","large-display-text"],attributeBindings:["aria-owns"],menuId:null,"aria-owns":function(){return this.get("menuId")}.property("menuId"),controlSize:SC.HUGE_CONTROL_SIZE,shouldAutoResize:NO,escapeHTML:YES,itemsOverride:null,availableTitles:function(){var e=[],t,n,r=window.CloudOS&&CloudOS.getUser?CloudOS.getUser():null;if(r){t=r.get("displayName");var i=r.get("firstName"),s=r.get("lastName");!CW.stringIsCJK(i)&&!CW.stringIsCJK(s)&&(n=r.get("firstName"))}return t=t||"AccountMenu.FallbackTitle".loc(),n&&e.push(n),e.push(t),e}.property().cacheable(),title:function(){var e=this.get("frame"),t=e.width,n=this.get("availableTitles"),r=this.get("measuredSizes"),i,s,o,u=n.length;for(o=0;o<u;o++){i=n[o],s=r[i];if(!s)return i;if(s.width<=t)return i}return i
}.property("availableTitles","frame","measuredSizes").cacheable(),measuredSize:function(){var e=this.get("title"),t=this.get("measuredSizes"),n=t[e];return n||(n={width:0,height:0}),n}.property("measuredSizes","title").cacheable(),smallestNonTruncatedWidth:function(){var e=this.get("measuredSizes"),t,n=this.get("availableTitles"),r,i=n.length,s=Infinity;if(i===0)return 0;for(r=0;r<i;r++)t=e[n[r]],t?s=Math.min(s,t.width):s=0;return s}.property("availableTitles","measuredSizes").cacheable(),preferredWidth:function(){var e=this.get("measuredSizes"),t=this.get("availableTitles")[0],n=e[t];return n?n.width:0}.property("availableTitles","measuredSizes").cacheable(),measuredSizes:function(){var e=this.get("availableTitles"),t,n=e.length,r={},i=this.$(".sc-button-label")[0],s;if(!i)return r;SC.prepareStringMeasurement(i);for(t=0;t<n;t++)s=e[t],r[s]=SC.measureString(s,NO,NO);return SC.teardownStringMeasurement(),r}.property("availableTitles","layer").cacheable(),menu:CW.AutoResizingMenuPane.extend({minimumSize:{width:130},shouldCloseMenu:NO,anchorView:null,popup:function(e){e.set("menuId",this.get("layerId")),this.set("anchorView",e),arguments.callee.base.apply(this,arguments)},assignMenuItemIndicator:function(){var e=this.get("menuItemViews"),t=e.length;e&&this.get("items").length===t&&(this.menuItemViewForContentIndex(0).set("isFirstItemInList",YES),this.menuItemViewForContentIndex(t-1).set("isLastItemInList",YES))}.observes("menuItemViews"),shouldCloseMenuDidChange:function(){this.get("shouldCloseMenu")&&this.removeIfOpen()}.observes("shouldCloseMenu"),init:function(e){arguments.callee
.base.apply(this,arguments),CW.notificationCenter.subscribeToNotification("preparingForAppTransition",this,"removeIfOpen")},keyDown:function(e){var t=this.get("currentSelectedMenuItem");if(e.which===SC.Event.KEY_TAB)if(t&&t.get("isFirstItemInList")||!t){if(e.shiftKey)return this.set("shouldCloseMenu",YES)}else t&&t.get("isLastItemInList")&&(e.shiftKey||this.set("shouldCloseMenu",YES));return arguments.callee.base.apply(this,arguments)},_focusCurrentItem:function(){var e=this.get("currentMenuItem");e&&e.get("isFirstResponder")&&e.get("layer").focus()},moveDown:function(){return arguments.callee.base.apply(this,arguments),this._focusCurrentItem(),YES},moveUp:function(){return arguments.callee.base.apply(this,arguments),this._focusCurrentItem(),YES},itemsOverride:null,itemsOverrideBinding:".owner.itemsOverride",items:function(){var e=this.get("itemsOverride"),t;return SC.none(e)?t=CloudOS.getAccountMenuItems():t=e,t.forEach(function(e){var t=e.disableWhenCurrentApp;!SC.none(t)&&t===CloudOS.currentAppName()&&(e.isEnabled=NO)}),t}.property("itemsOverride").cacheable(),pointAtRectangleForView:function(e){var t=arguments.callee.base.apply(this,arguments),n=Math.min(e.get("measuredSize").width,t.width);return t=SC.clone(t),t.x=t.x+t.width-n,t.width=n,t},removeIfOpen:function(){var e=this.getPath("anchorView.layer");this.isVisibleInWindow&&(this.remove(),e&&e.focus()),this.get("shouldCloseMenu")&&this.set("shouldCloseMenu",NO)},paneDidAttach:function(){arguments.callee.base.apply(this,arguments),this.get("layer").focus()},themeName:"atv4",preferType:SC.PICKER_MENU_POINTER,controlSize
:SC.REGULAR_CONTROL_SIZE,acceptsFirstResponder:YES})}),function(){var e=44,t=55,n=300;CK.AccountMenuView=SC.View.extend({shouldAutoResize:YES,calculatedWidth:100,accountMenuItems:null,layout:{right:2,top:0,bottom:0},CloudOSStateBinding:SC.Binding.oneWay("CloudOS.workspaceController.nowShowing"),isVisible:!window.CloudOSBootstrap||!CloudOSBootstrap.isOnSupportedMobile,init:function(){arguments.callee.base.apply(this,arguments),CW.notificationCenter.subscribeToNotification("relocalize",this,"relocalize")},relocalize:function(){var e=this.accountButton;this.notifyPropertyChange("accountMenuItems"),e.notifyPropertyChange("availableTitles"),e.notifyPropertyChange("toolTip"),this.helpButton.notifyPropertyChange("toolTip")},childrenShouldAcceptFirstResponder:function(){var e=this.get("CloudOSState");return!e||e<CloudOS.AUTH?NO:e===CloudOS.AUTH?this.get("isInAuthPane")?YES:NO:this.get("isEnabled")||this.get("isVisible")?YES:NO}.property("CloudOSState"),themeName:"icloud-controls",classNames:["account-menu"],childViews:["accountButton","dividerView","helpButton"],accountButton:CK.AccountButtonView.design(SC.RTLSupport,{layoutRecipe:{top:-5,bottom:0,end:t},itemsOverrideBinding:".owner.accountMenuItems",toolTip:"Toolbar.Button.Action.UserAction".loc(),ariaLabel:"Toolbar.Button.Action.UserAction".loc(),acceptsFirstResponder:function(){return this.getPath("parentView.childrenShouldAcceptFirstResponder")}.property("parentView.childrenShouldAcceptFirstResponder"),displayProperties:["acceptsFirstResponder"],render:function(e,t){arguments.callee.base.apply(this,arguments),t&&e.push('<div class="chevron"></div>'
),this.get("isVisible")?e.attr("aria-hidden",NO):e.attr("aria-hidden",YES)}}),dividerView:SC.View.design(SC.RTLSupport,{classNames:["account-menu-divider"],layoutRecipe:{centerY:0,width:1,height:22,end:e}}),helpButton:SC.ImageButtonView.design(SC.RTLSupport,{layoutRecipe:{top:0,bottom:0,width:e,end:0},image:"help-icon",targetBinding:"CK.currentApplication",action:"showHelp",toolTip:"Toolbar.Button.Action.Help",localize:YES,acceptsFirstResponder:function(){return this.getPath("parentView.accountButton.acceptsFirstResponder")}.property("parentView.accountButton"),render:function(e,t){arguments.callee.base.apply(this,arguments),this.get("isVisible")?e.attr("aria-hidden",NO):e.attr("aria-hidden",YES)},click:function(e){var t=this.get("layer");if(!t)return;return SC.Event.trigger(t,"mousedown"),SC.Event.trigger(t,"mouseup"),YES},keyDown:function(e){return e.which===SC.Event.KEY_RETURN||e.which===32?this.click():NO}}),buttonWidthDidChange:function(){var e=this.get("preferredWidth");this.set("calculatedWidth",e),this.get("shouldAutoResize")&&this.adjust("width",e)}.observes("preferredWidth"),accountButtonPreferredWidth:0,accountButtonPreferredWidthBinding:".accountButton.preferredWidth",accountButtonSmallestNonTruncatedWidth:0,accountButtonSmallestNonTruncatedWidthBinding:".accountButton.smallestNonTruncatedWidth",preferredWidth:function(){var e=SC.browser.isIE||SC.browser.isEdge?1:0;return Math.min(this.get("accountButtonPreferredWidth")+t+e,n)}.property("accountButtonPreferredWidth").cacheable(),smallestNonTruncatedWidth:function(){return Math.min(this.get("accountButtonSmallestNonTruncatedWidth"
)+t,n)}.property("accountButtonSmallestNonTruncatedWidth").cacheable()})}(),CK.AddDeleteButton=SC.ImageButtonView.extend({layout:{left:0,height:17,centerY:0,width:17},acceptsFirstResponder:NO,classNames:["add-delete"],action:"buttonClicked",isEmpty:YES}),function(){var e=13,t=82;CK.AppSwitcherView=SC.View.extend({calculatedWidth:0,shouldAutoResize:YES,title:null,useLightText:NO,themeName:"icloud-controls",classNames:["app-switcher"],childViews:["buttonView"],buttonWidthDidChange:function(){var n=t+e+this.getPath("buttonView.measuredSize").width;this.set("calculatedWidth",n),this.get("shouldAutoResize")&&this.adjust("width",n)}.observes("buttonView.measuredSize"),targetFrame:function(){var e=SC.clone(this.getPath("buttonView.frame"));return e=this.convertFrameToView(e,null),e.left=e.x,e.top=e.y,e}.property(),buttonView:SC.ButtonView.design(SC.AutoResize,{init:function(){arguments.callee.base.apply(this,arguments),CK.appSwitcherKeyResponder.registerAppSwitcher(this),CW.notificationCenter.subscribeToNotification("miniSpringboardDismissed",this,this.miniSpringboardDismissed),this.watchForSizeChange()},showAppSwitcherFromKeyboardShortcut:function(){if(!this.get("isVisibleInWindow")||!this.getPath("pane.isKeyPane")||SC.RootResponder.responder.get("menuPane"))return;return this.triggerActionFromKeyboardShortcut(),YES},shouldAutoResize:NO,layout:{left:e,top:-6,bottom:0},classNames:["large-display-text"],controlSize:SC.HUGE_CONTROL_SIZE,themeName:"borderless",acceptsFirstResponder:NO,watchForSizeChange:function(){if(!SC.browser.isSafari&&!SC.browser.isWindows)return;var e=SC.Timer.schedule
({interval:100,repeats:YES,target:this,action:function(){this.measureSize();var t=this.getPath("layer.clientWidth"),n=CK.getPath("currentApplication.isActive");(n||this._previousWidth&&t!==this._previousWidth)&&e.invalidate(),this._previousWidth=t}})},render:function(e,t){arguments.callee.base.apply(this,arguments);if(t){var n=this.getPath("parentView.useLightText");e.push('<div class="icloud-text image'+(n?" light":"")+'"></div>'),this.get("isEnabled")&&!CloudOS.isOnSupportedMobile()&&e.push('<div class="chevron"></div>')}},mouseUp:function(){var e=arguments.callee.base.apply(this,arguments);return this.set("isActive",YES),e},action:function(){CloudOS.isOnSupportedMobile()||CloudOS.showAppSwitcher(this.getPath("parentView.targetFrame"))},title:function(){var e=this.getPath("owner.title");return e?e.loc():CloudOS.getAppDisplayName()}.property("owner.title").cacheable(),toolTip:"Toolbar.Tooltip.App.Switcher".loc(),miniSpringboardDismissed:function(){this.set("isActive",NO)}})})}(),CK.logoutAlert=function(e,t,n){var r=URI(window.location.href).domain().replace("icloud","iCloud");return CW.Alert.show({classNames:["logout-alert"],message:"HSA.SignoutDialog.Title".loc({currentDomain:r}),image:"icon-icloud",descriptionViewMinHeight:5,extraWide:YES,extraViewPadding:{top:0,bottom:3},hsaTrustedBrowser:n,rightButton:{title:"HSA.SignoutDialog.SignoutButton".loc(),action:function(){var t=this.get("pane");t.remove(),e&&e(t.get("hsaTrustedBrowser"))}},middleButton:{title:"Button.Cancel".loc(),action:function(){this.get("pane").remove(),t&&t()}},extraView:SC.CheckboxView.design(CW.Alert.ExtraViewAutoResizingSupport
,SC.RTLSupport,{autoResizePadding:0,controlSize:SC.CUSTOM_CONTROL_SIZE,layoutRecipe:{start:105,end:10},title:"HSA.SignoutDialog.CheckboxTitle".loc(),valueBinding:"*pane.hsaTrustedBrowser"})})},function(){var e="cloudkit/error_catcher";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/stylesheet.css"],styles2x:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/stylesheet.css"],scriptURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/",stringURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/",isPrefetched:YES})}(),CW.HashAttributeCommon={isOrphan:NO,parent:null,parentKey:null,parentIsRecord:function(){var e=this.get("parent");return e?e.kindOf(SC.Record):NO}.property("parent").cacheable(),readAttribute:function(e){var t=this.peekAttributes();return t?t[e]:undefined},attributes:function(){if(this.get("isOrphan"))return SC.warn("%@: Requesting 'attributes' on orphaned instance",this),null;var e=this.get("parent"),t=this.get("parentKey"),n;return e||CW.fatalError("Cannot access 'attributes' because there is no parent",{hashAttributeOrArray:this}),SC.none(t)&&CW.fatalError("Cannot access 'attributes' because there is no parentKey",{hashAttributeOrArray:this}),this.get("parentIsRecord")?n=e.get("store").readEditableDataHash(e.get("storeKey")):n=e.get("attributes"),n?n[t]:null}.property("parent","isOrphan"
),hashAttributeDidChange:function(e,t,n){this.childHashDidChange(e,t,n)},destroy:function(){var e=this.get("parent"),t,n;e&&(t=this.get("parentKey"),t||CW.fatalError("There is a parent but no parentKey",{target:this,parent:e}),n=e.get("attributes"),n&&(delete n[t],this.hashAttributeDidChange(),this.orphan())),arguments.callee.base.apply(this,arguments)},getAncestorRecord:function(){var e=this.get("parent"),t;return e&&(this.get("parentIsRecord")?t=e:t=e.getAncestorRecord()),t},orphan:function(){this._orphan&&this._orphan(),this.beginPropertyChanges(),this.set("isOrphan",YES),this.set("parent",null),this.parentDidChange&&this.parentDidChange(),this.set("parentKey",null),this.destroy(),this.allPropertiesDidChange(),this.endPropertyChanges()},peekAttributes:function(e){var t=this.get("parent"),n=this.get("parentKey"),r;return t&&!SC.none(n)&&(r=t.readAttribute(n)),r}},CW.HashAttributeSupport={hashAttributeFor:function(e){var t=this._hashAttributes,n=null,r;return t&&(r=t[e],r&&(n=r)),n},childHashDidChange:function(e,t,n){t||(e?this.notifyPropertyChange(e):this.allPropertiesDidChange());var r=this.get("parent"),i=this.get("parentKey");this._ignoreChangePropogation=YES,r.childHashDidChange(i,YES,n),this._ignoreChangePropogation=NO},attributeIsDefault:function(e){var t=this[e],n=this.readAttribute(e),r;return!t||!t.isRecordAttribute?n===undefined:(r=t.getDefaultValue(this,e),n===r||SC.none(r)&&SC.none(n))},normalize:function(e,t){var n={},r,i,s,o,u,a,f,l,c,h,p,d=this.get("attributes");for(r in this)i=this[r],i&&(s=i.typeClass,s&&(h=i.get("key")||r,p=s.call(i),o=undefined,n[h]=YES,
f=SC.typeOf(s.call(i))===SC.T_CLASS,l=i.isNestedRecordTransform||p.isHashAttribute,!f&&!l?o=d[h]:l?(u=this.get(r),u&&(u.normalize&&u.normalize(e,t),!t&&u.isEmpty&&u.isEmpty()?o=null:o=u.get("attributes"))):f&&(u=this.get(r),u&&(o=d[h])),SC.none(o)&&(o=i.getDefaultValue(this,r)),o===null&&!e&&(o=undefined),o===undefined?delete d[h]:d[h]=o,u&&(u.isHashAttribute?u.underlyingContentDidChange():u.isHashAttributeArray&&u.recordPropertyDidChange())));for(r in d)n[r]||(SC.debug("%@: Deleting key from underlying data hash due to normalization: %@",this,r),delete d[r]);return this},registerHashAttribute:function(e,t){var n=this._hashAttributes,r,i;n||(n=this._hashAttributes={}),r=t.get("parent"),i=t.get("parentKey"),this!==r&&CW.fatalError("registerChildHashAttribute(): The specified child hash attribute does not have the proper parent",{key:e,target:this,parent:r}),e!==i&&CW.fatalError("registerChildHashAttribute(): The specified child hash attribute does not have the proper parentKey",{target:this,key:e,parentKey:i}),n[e]=t},unregisterHashAttribute:function(e,t){var n=this._hashAttributes,r;n||CW.fatalError("unregisterChildHashAttribute(): There is no “child hash attributes” structure",{target:this}),r=n[e],r||CW.fatalError("unregisterChildHashAttribute(): There is no registered child hash attribute for the specified key",{target:this,key:e}),delete n[e]},_hashAttributes:null},CW.StoreCommon={delegate:null,chain:function(e,t){return t||(t=CW.NestedStore),arguments.callee.base.call(this,e,t)},storageManager:null,getCurrentCommitCycle:function(){var e=null,t=this.getPath("storageManager.currentCycle"
);return t&&t.get("type")===CW.StorageCycle.COMMIT_CYCLE&&(e=t),e},commitAgentsFor:function(e){var t=this.commitAgents;return t?t[e]:null},lastCommitAgentWithParam:function(e,t){var n=this.commitAgents,r=null,i,s,o,u;if(n){n=n[e];if(n)for(s=n.length,i=s-1;i>=0;--i){o=n[i],u=o.get("params");if(u&&u.hasOwnProperty(t)){r=o;break}}}return r},notifyCommitAgents:function(e,t,n){var r=this.commitAgentsFor(e),i,s,o,u;if(r)for(i=0,s=r.length;i<s;++i)o=r[i],o&&(u=o[t],u&&u.call(o,e,n))},previousDataHashesForNotify:null,commitAgents:null,_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()}else if(!l._isCommitting){var p=l.get("delegate");p?l.invokeDelegateMethod(p,"parentStoreRecordPropertyDidChange",this,l,e,t,n):SC.warn("%@: Record with storeKey %@ changed underneath us, but since we have no merge delegate set, we wont inherit the changes",l,e)}!t&&!this.get("parentStore")&&(delete this.previousDataHashesForNotify[e],this._savePreviousDataHashForNotify(e))}var d=this.recordPropertyChanges;return d||(d=this.recordPropertyChanges={storeKeys:SC.CoreSet.create(),records:SC.CoreSet.create(),hasDataChanges:SC.CoreSet.create(),propertyForStoreKeys:{}}),d.storeKeys.add(e),r&&(o=r[e])&&(d.records.push(e),t||d.hasDataChanges.push(e),n?((h=d.propertyForStoreKeys[e])||(h=d.propertyForStoreKeys[e]=SC.CoreSet.create
()),h!=="*"&&h.add(n)):d.propertyForStoreKeys[e]="*"),this.invokeOnce(this.flush),this},_verifyLockRevisions:function(e,t,n){var r=this._mergedProperties,i=this._mergedDataHashes,s=!!n.getPath("delegate.shouldMergeOutdatedChangesWhenCommitting"),o,u,a,f,l=SC.Record,c=CW.StorageCycleAction,h=e.length,p=this.revisions,d,v,m,g;if(t&&p)for(d=0;d<h;d++){v=e[d],m=t[v]||1,g=p[v]||1;if(m<g){var y=SC.Store.recordTypeFor(v);SC.debug("Potential conflict while committing from %@ down to %@: storeKey %@, of type %@:",n,this,v,y);var b=n.peekStatus(v),w=this.peekStatus(v),E=SC.Record.DESTROYED,S=SC.Record.READY_NEW,x=b&E?c.STORAGE_OPERATION_DESTROY:c.STORAGE_OPERATION_UPDATE,T=NO,N,C,k;if(!s)throw SC.Store.CHAIN_CONFLICT_ERROR;SC.debug(" > lock=%@, current revision=%@",m,g),SC.debug("Version in %@:",n),SC.debug("%@",n.materializeRecord(v)),SC.debug("Version in %@:",this),SC.debug("%@",this.materializeRecord(v)),w&E?b&E?SC.debug("This record was destroyed in both stores, so ignoring it in the commit…"):C=c.ERROR_NOT_FOUND:b&E?C=c.ERROR_CONFLICT:(b===S&&w!==S&&n.writeStatus(v,SC.Record.READY_DIRTY),C=c.ERROR_CONFLICT);if(C){var L=n.get("delegate");L&&(T=n.invokeDelegateMethod(L,"mergeConflictDuringCommit",this,n,v,C,x))}if(T===NO)SC.debug("Removing this commit from %@s changelog…",this.get("name")),k=n.changelog,k&&k.remove(v),k=n.chainedChanges,k&&k.remove(v),a=this.getCurrentCommitCycle(),a&&(f=a.get("changelog"),f&&f.remove(v)),this.notifyCommitAgents(v,"commitWasUnnecessaryAtStore");else if(T!==YES)throw SC.Store.CHAIN_CONFLICT_ERROR}}return this}},CW.HashAttribute=SC.Object.extend
(CW.HashAttributeCommon,CW.HashAttributeSupport,{isHashAttribute:YES,normalize:function(e,t,n){this.get("isOrphan")&&CW.fatalError("normalize(): Cannot write to an orphan hash attribute",{target:this});var r=this.get("attributes"),i,s,o;r||(this._neverHadAHash||CW.fatalError("normalize(): We once had a hash but no longer do",{target:this}),i=this.get("parent"),s=this.get("parentKey"),i?s?i.isHashAttributeArray&&CW.fatalError("normalize(): There are no attributes but the parent is a hash attribute array",{target:this,parent:i}):CW.fatalError("normalize(): There is no parentKey",{target:this,parent:i}):CW.fatalError("normalize(): There is no parent",{target:this}),r={},i.writeAttribute(s,r),this._neverHadAHash=NO),e(t,n)}.enhance(),_checkedKeys:SC.CoreSet.create(),isEmpty:function(){var e,t,n,r=this._checkedKeys.clear();for(e in this){t=this[e];if(!t||!t.isRecordAttribute)continue;n=this.get("key");if(n&&n.isEmpty&&n.isEmpty()||!this.attributeIsDefault(e))return NO;r.add(e)}var i=this.get("attributes");for(e in i)if(!r.contains(e))return NO;return YES},beginEditing:function(){return this._editLevel++,this},endEditing:function(e){return--this._editLevel<=0&&(this._editLevel=0,this.hashAttributeDidChange(e)),this},writeAttribute:function(e,t,n){if(this.get("isOrphan"))return SC.debug("writeAttribute(): Cannot write to an orphan hash attribute"),this;var r=this.get("attributes"),i,s,o;return r?t!==r[e]&&(n||this.beginEditing(),r[e]=t,n||this.endEditing(e)):(this._neverHadAHash||CW.fatalError("writeAttribute(): We once had a hash but no longer do",{target:this}),i=this.get("parent"
),s=this.get("parentKey"),i?s?i.isHashAttributeArray&&CW.fatalError("writeAttribute(): There are no attributes but the parent is a hash attribute array",{target:this,parent:i}):CW.fatalError("writeAttribute(): There is no parentKey",{target:this,parent:i}):CW.fatalError("writeAttribute(): There is no parent",{target:this}),r={},r[e]=t,i.writeAttribute(s,r),this._neverHadAHash=NO),this},storeDidChangeProperties:function(e,t){t?(this.beginPropertyChanges(),t.forEach(function(e){this.notifyPropertyChange(e)},this),this.endPropertyChanges()):this.allPropertiesDidChange();var n=this.relationships,r=n?n.length:0;while(--r>=0)n[r].recordPropertyDidChange(t)},unknownProperty:function(e,t){var n;return t!==undefined?(n=this.constructor,n.ignoreUnknownProperties===YES?this[e]=t:this.writeAttribute(e,t),t):this.readAttribute(e)},toString:function(){var e=arguments.callee.base.apply(this,arguments),t=this.peekAttributes();return e+=" "+SC.inspect(t),e},parentDidChange:function(){var e=this._previousParent,t=this.get("parent"),n=this.get("parentKey"),r;if(SC.none(n))return;e!==t&&(r=this.underlyingContentDidChange,e&&(e.unregisterHashAttribute&&e.unregisterHashAttribute(n,this),e.removeObserver(n,this,r)),t&&(t.registerHashAttribute&&t.registerHashAttribute(n,this),t.addObserver(n,this,r)),this._previousParent=t,r.call(this))}.observes("parent"),underlyingContentDidChange:function(){if(this._ignoreChangePropogation){this._ignoreChangePropogation=NO;return}if(this.get("isOrphan"))return;!this._neverHadAHash&&!this.peekAttributes()?this.orphan():this.allPropertiesDidChange()},init:function(
){arguments.callee.base.apply(this,arguments);var e=this.get("parent");e||CW.fatalError("A hash attribute must have a parent",{hashAttribute:this}),!e.isRecord&&!e.isHashAttribute&&!e.isHashAttributeArray&&CW.fatalError("A hash attribute arrays parent must either be a record, a hash attribute, or a hash attribute array",{hashAttribute:this,parent:e}),this.peekAttributes()||(this._neverHadAHash=YES),this.parentDidChange()},_editLevel:0,_neverHadAHash:NO}),CW.HashAttribute.mixin({instantiateHashAttribute:function(e,t,n){return SC.kindOf(e,CW.HashAttribute)||CW.fatalError("%@ is not a kind of CW.HashAttribute".fmt(e)),e.create({parent:t,parentKey:n})},isComplex:YES,isHashAttribute:YES}),SC.RecordAttribute.registerTransform(CW.HashAttribute,{to:function(e,t,n,r,i){var s;return r?!r.kindOf(CW.Record)&&!r.kindOf(CW.HashAttribute)?CW.fatalError("The parent must be either an instance of subclass of either CW.Record or CW.HashAttribute",{parent:r,parentKey:i}):(s=r.hashAttributeFor(i),s||(s=CW.HashAttribute.instantiateHashAttribute(n,r,i))):CW.fatalError("Error during transform: A parent must be specified"),s},from:function(e){e&&e.isHashAttribute&&CW.fatalError("You should never set a hash attribute directly",{target:this,instance:e})}}),CW.ManyHashAttribute=SC.RecordAttribute.extend({toType:function(e,t,n){var r=this.get("typeClass"),i=this.get("key")||t,s=SC.keyFor("__cw__hashAttributeArray__",SC.guidFor(this)),o=e[s],u,a;return e&&e.isRecord&&(u=e.get("store"),u&&!u.isCoreWebStore&&CW.fatalError("Hash attribute arrays require the ancestor record to belong to a CoreWeb store rather than an SC.Store"
,{target:this,parent:e,store:u})),o||(o=CW.HashAttributeArray.create({objectType:r,parent:e,parentKey:i,manyAttribute:this}),e[s]=o,a=e.get("relationships"),a?(a.push(o),a.enumerableContentDidChange()):e.set("relationships",[o])),o},fromType:function(e,t,n){var r=[],i,s;SC.isArray(n)||CW.fatalError("CW.ManyHashAttribute#fromType: The toMany attribute should be an array");for(i=0,s=n.get("length");i<s;++i)r[i]=SC.clone(n.objectAt(i).get("attributes"),YES);return r}}),CW.Record=SC.Record.extend(CW.HashAttributeSupport,{typeString:function(){var e=this.get("store");if(!e)return null;var t=this.get("storeKey");if(!t)return null;var n=e.recordTypeFor(this.get("storeKey"));return n?n.typeString:null}.property("store","storeKey").cacheable(),childHashDidChange:function(e,t,n){var r=this.get("store");r.recordDidChange(null,null,this.get("storeKey"),e,YES),this.propagateToAggregates(),n||r.flush()},shortTypeString:function(){var e=this.get("store");if(!e)return null;var t=this.get("storeKey");if(!t)return null;var n=e.recordTypeFor(this.get("storeKey"));return n?n.shortTypeString():null}.property("store","storeKey").cacheable(),shortString:function(){var e=this.get("shortTypeString"),t;return e?(e=e.toLowerCase(),t=this.get("title"),t?e+=" “%@”".fmt(t):e+=" with ID %@".fmt(this.get(this.get("primaryKey")))):e=this.toString(),e},ownerProperty:null,owner:function(){var e=this.get("ownerProperty");return e?this.get("property"):null}.property("ownerProperty"),rootOwner:function(){var e=this.get("owner");return e?e.get("rootOwner"):this}.property("owner"),isAggregate:function(){var e=this
.get("ownerProperty"),t=NO,n;return e&&(n=this[e],t=n&&n.aggregate),t}.property("ownerProperty"),aggregates:function(){var e=[],t,n,r,i,s,o,u,a,f,l,c,h,p,d,v;for(t in this){n=this[t];if(n){r=n.typeClass;if(r){r=r.call(n),i=SC.typeOf(r)===SC.T_CLASS;if(i){s=n.inverse;if(s){o=r.prototype[s];if(o){u=o.aggregate;if(u){a=this.get(t);if(a)for(f=0,l=a.get("length");f<l;++f){c=a.objectAt(f),e.push(c),h=c.get("aggregates");if(h)for(p=0,d=h.length;p<d;++p)v=h[p],e.push(v)}}}}}}}}return e.length?e:null}.property(),usesHashAttributes:function(){var e=NO,t=this._hashAttributes,n,r,i,s;t&&t.length>0&&(e=YES);if(!e){n=this.relationships;if(n)for(r=0,i=n.length;r<i;++r){s=n[r];if(SC.kindOf(s,CW.HashAttributeArray)){e=YES;break}}}return e}.property().cacheable()}),SC.mixin(CW.Record,{toMany:function(e,t){return SC.kindOf(e,CW.HashAttribute)?CW.ManyHashAttribute.attr(e,t):SC.Record.toMany(e,t)},shortTypeString:function(){var e=this.typeString;return e&&(e=e.split("."),e=e[e.length-1]),e},storeKeyIfValid:function(e,t){e||CW.fatalError("storeKeyIfValid(): You must specify an ID."),t||CW.fatalError("storeKeyIfValid(): You must specify a store.");var n=this.storeKeyExists(e),r;return n&&(r=t.peekStatus(n),r===this.DESTROYED_CLEAN&&(n=null)),n}}),CW.HashAttributeArray=SC.Object.extend(CW.HashAttributeCommon,CW.HashAttributeSupport,SC.Enumerable,SC.Array,{isHashAttributeArray:YES,objectType:null,manyAttribute:null,normalize:function(e,t){var n=this._getReadOnlyUnderlyingArray(),r=n?n.get("length"):0,i,s;for(i=0;i<r;i++)s=this.objectAt(i),s.normalize(e,t);return this},length:function(){var e=this.
_getReadOnlyUnderlyingArray();return e?e.length:0}.property("parent","parentKey"),objectAt:function(e){var t=this._hashAttributes,n,r,i,s;return t&&(s=t[e]),s||(n=this._getReadOnlyUnderlyingArray(),n&&(r=n[e],r&&(SC.typeOf(r)!==SC.T_HASH&&CW.fatalError("objectAt(): The object in the array is not a hash",{hashAttributeArray:this,index:e}),i=this.get("objectType"),s=CW.HashAttribute.instantiateHashAttribute(i,this,e),t||(t=this._hashAttributes=[]),t[e]=s))),s},replace:function(e,t,n){var r=this._getEditableUnderlyingArray(),i=[],s=n?n.get?n.get("length"):n.length:0,o,u;this.arrayContentWillChange(e,t,s);for(o=0;o<s;++o)u=n.objectAt(o),SC.kindOf(u,CW.HashAttribute)?u=SC.clone(u.get("attributes"),YES):SC.typeOf(u)!==SC.T_HASH&&CW.fatalError("Illegal type of item specified in replace()",{target:this,index:o,items:n}),i.push(u);r.replace(e,t,i);var a=this._hashAttributes;if(a){var f=r?r.length:0,l=e+t,c=e+s;for(o=e;o<l;++o)u=a[o],u&&u.orphan();a.splice(e,t);for(o=e;o<f;++o)o<c?a.splice(o,0,null):(u=a[o])&&u.set("parentKey",o);f!==a.length&&CW.fatalError("Hash attribute array length is different from underlying array length",{target:this})}return this.arrayContentDidChange(e,t,s),this.enumerableContentDidChange(),this.hashAttributeDidChange(null,YES),this},isEmpty:function(){var e=this._getReadOnlyUnderlyingArray();return!e||e.get("length")===0},_getReadOnlyUnderlyingArray:function(){var e=this.get("parent"),t=this.get("parentKey");return e||CW.fatalError("No parent defined"),t||CW.fatalError("No parentKey defined"),e.readAttribute(t)},_getEditableUnderlyingArray:function(){var e=
this.get("parent"),t=this.get("parentKey"),n,r;return e||CW.fatalError("No parent defined"),t||CW.fatalError("No parentKey defined"),n=e.get("attributes"),r=n[t],r||(r=n[t]=[],this.recordPropertyDidChange(SC.Set.create([t])),this.hashAttributeDidChange(null,YES,YES)),r},recordPropertyDidChange:function(e){if(e&&!e.contains(this.get("parentKey")))return this;var t=this._previousUnderlyingArray,n=this._getReadOnlyUnderlyingArray(),r=0,i=0;t&&(r=t.get("length")),this._previousUnderlyingArray=n,n&&(i=n.get("length"));var s=Math.max(0,r-i),o=Math.max(0,i-r),u=Math.min(i,r);this.arrayContentWillChange(u,s,o);var a=this._hashAttributes;if(a){var f,l,c=Math.max(r,i);for(f=0;f<c;f++)l=a[f],l&&(f<i?l.allPropertiesDidChange():l.orphan());a.length=i}this.arrayContentDidChange(u,s,o),this.enumerableContentDidChange()},_orphan:function(){var e=this._hashAttributes,t,n,r;if(e){for(t=0,n=e.length;t<n;++t)r=e[t],r&&r.orphan();this._hashAttributes=null}},init:function(){arguments.callee.base.apply(this,arguments);var e=this.get("parent");e||CW.fatalError("A hash attribute array must have a parent",{hashAttributeArray:this}),!e.isRecord&&!e.isHashAttribute&&CW.fatalError("A hash attribute arrays parent must either be a record or a hash attribute",{hashAttributeArray:this}),this.recordPropertyDidChange()},_hashAttributes:null,_previousUnderlyingArray:null}),CW.HashAttributeArray.mixin({isComplex:YES,isHashAttributeArray:YES}),CW.Store=SC.Store.extend(CW.StoreCommon,SC.DelegateSupport,{isCoreWebStore:YES,readEditableDataHash:function(e){return this._savePreviousDataHashForNotify(e),arguments.callee
.base.apply(this,arguments)},writeDataHash:function(e,t,n){return t&&this._savePreviousDataHashForNotify(e),arguments.callee.base.apply(this,arguments)},placeHolderRecord:function(e,t,n){var r=e.storeKeyFor(t),i;return i=this.materializeRecord(r),r&&(this.writeDataHash(r,n?n:{}),this.writeStatus(r,SC.Record.READY_CLEAN),i.allPropertiesDidChange()),i},pushRetrieve:function(e,t,n,r,i){var s=SC.Record,o;r===undefined&&(r=e.storeKeyFor(t)),o=this.readStatus(r);if(o==s.EMPTY||o==s.ERROR||o==s.READY_CLEAN||o==s.DESTROYED_CLEAN){o=s.READY_CLEAN;if(n===undefined)this.writeStatus(r,s.EMPTY),this.dataHashDidChange(r);else{var u=this.getCurrentCommitCycle(),a=u?u.get("changelog"):null;if(a&&a.contains(r)){var f=SC.clone(this.readDataHash(r),YES),l=u.dataHashesCheckpointBeforeCycleStage[r],c=this.mergeHashesAsPossible;if(f&&l&&c){SC.debug("pushRetrieve(): Merging newly-loaded data for storeKey %@ into main store…",r);var h=c.call(this,n,f,l,e.propertyMergeGroups,YES,"server-retrieved data",this.get("name")),p=h.changedKeys.concat(h.addedKeys,h.removedKeys),d=h.mergeConflictKeys;if(p.length||d.length)this.writeDataHash(r,f,o),this.dataHashDidChange(r);if(d.length>0){var v=this.get("delegate"),m=NO;v&&(m=this.invokeDelegateMethod(v,"mergeConflictDuringNotify",this,null,r,p,d))}}else this.writeDataHash(r,n,o),this.dataHashDidChange(r)}else this.writeDataHash(r,n,o),this.dataHashDidChange(r)}return r}return NO},_savePreviousDataHashForNotify:function(e,t){var n=this.get("nestedStores");n&&n.length>0&&(this.previousDataHashesForNotify[e]||(this.previousDataHashesForNotify[e]=SC.clone(this.dataHashes
[e],YES)))},reset:function(){return this.previousDataHashesForNotify={},this.commitAgents=null,arguments.callee.base.apply(this,arguments)},commitChangesFromNestedStore:function(e,t,n){var r=e.commitAgents,i,s,o,u,a,f;if(r){i=this.commitAgents,i||(i=this.commitAgents={});for(s in r)s=parseInt(s,10),t.contains(s)&&(o=i[s],u=r[s],o?o=o.concat(u):i[s]=u)}n||this._verifyLockRevisions(t,e.locks,e);var l=t.length,c,h,p,d,v,m,g,y;v=this.revisions,h=this.dataHashes,p=this.statuses,d=this.editables,d||(d=this.editables=[]),m=e.dataHashes,y=e.revisions,g=e.statuses;for(c=0;c<l;c++)s=t[c],p[s]=g[s],v[s]=y[s],d[s]=0,this._savePreviousDataHashForCommit&&this._savePreviousDataHashForCommit(s),h[s]=m[s],this._notifyRecordPropertyChange(s,NO),this.notifyCommitAgents(s,"recordWasCommittedToStore",this);var b=this.changelog,w=e.changelog;return w&&(b||(b=this.changelog=SC.CoreSet.create()),b.addEach(w)),this.changelog=b,this.get("parentStore")||this.flush(),this}}),CW.BAR_OPACITY_DURATION=200,CW.BAR_LEFT_DURATION=350,CW.VIEW_LEFT_DURATION=350,CW.NAVIGATABLE_VIEW_PADDING=0,CW.NavigationController=SC.ObjectController.extend({layout:{top:0,left:0,right:0,bottom:0},viewStack:null,barStack:null,navigationView:null,previousNavigatableView:function(){var e=this.get("viewStack");return e[e.length-2]||null},init:function(){this.viewStack=[],this.barStack=[],this.navigationViewDidChange()},navigationViewDidChange:function(){var e=this.get("navigationView"),t=this.get("_oldNavigationView");e!==t&&(t&&t.removeObserver("frame",this,this.navigationViewFrameDidChange),e&&(e.addObserver("frame",this,this.navigationViewFrameDidChange
),this.set("_oldNavigationView",e)))}.observes("navigationView"),navigationViewFrameDidChange:function(){var e,t=this.getPath("navigationView.frame.width"),n=this.viewStack;for(var r=0,i=n.length;r<i;++r)e=n[r],e.adjust("width",t),this.barStack[r].adjust("width",t)},push:function(e,t,n){t===undefined&&(t=YES),e.isNavigatable||SC.error("Tried to push a view which doesn't mix-in the CW.NavigationSupport mixin.");var r=this.get("viewStack"),i=this.get("barStack"),s=-1*this.getPath("navigationView.frame").width,o=r[r.length-1],u=i[i.length-1];this._pushViewAndBarToStack(e,YES),this.getPath("navigationView.pane").makeFirstResponder(e);var a=r[r.length-1],f=i[i.length-1];a&&this._moveBarAndViewTo(a,f,t,0,1,NO),o&&this._moveBarAndViewTo(o,u,t,s,0,NO,n)},pop:function(e,t,n){e===undefined&&(e=YES),t===undefined&&(t=1);var r=this.get("viewStack"),i=this.get("barStack"),s=r.pop(),o=i.pop(),u,a,f,l,c;for(var h=0;h<t-1;h++)u=r.pop(),a=i.pop(),u.removeFromParent(),a.removeFromParent();f=r[r.length-1],l=i[i.length-1],c=this.get("navigationView").get("frame").width,this.getPath("navigationView.pane").makeFirstResponder(f),t>1&&f&&l&&(f.adjust({left:-1*c}),l.adjust({left:-1*c})),s&&this._moveBarAndViewTo(s,o,e,c,0,YES),f&&this._moveBarAndViewTo(f,l,e,0,1,NO,n)},_moveBarAndViewTo:function(e,t,n,r,i,s,o){var u=this.get("navigationView"),a=1,f=e.get("frame").x;if(n){e.adjust({left:f,height:u.get("frame").height-t.get("frame").height,bottom:null}),t.adjust({left:f,opacity:a}),e.set("wantsAcceleratedLayer",YES),t.set("wantsAcceleratedLayer",YES);var l=Math.max(CW.VIEW_LEFT_DURATION,CW.BAR_LEFT_DURATION
,CW.BAR_OPACITY_DURATION),c=u.$();if(c.find(".overlay").size()===0){var h="position: absolute; top: 0px; bottom: 0px; left: 0px; right: 0px; z-index: 1000;";h+='background-image: url("%@");'.fmt("/system/cloudos/1812Project43/sproutcore/foundation/1812Project43/en-us/source/resources/blank.gif"),c.append("<div class='overlay' style='%@'></div>".fmt(h))}var p=CW.Animation.create({view:e,bar:t,navigationView:u,tween:CW.Anim.tweens.WEBKIT_EASE_IN_OUT,viewLayer:e.get("layer"),barLayer:t.get("layer"),toLeft:r,fromLeft:f,toOpacity:i,fromOpacity:a,duration:l,name:SC.guidFor(this)+":navigationAnimation:"+SC.guidFor(e),update:function(){var e=this.current,t=Math.round(this.fromLeft+(this.toLeft-this.fromLeft)*Math.min(1,Math.max(0,e*(this.duration/CW.VIEW_LEFT_DURATION)))),n=Math.round(this.fromLeft+(this.toLeft-this.fromLeft)*Math.min(1,Math.max(0,e*(this.duration/CW.BAR_LEFT_DURATION)))),r=this.fromOpacity+(this.toOpacity-this.fromOpacity)*Math.min(1,Math.max(0,e*(this.duration/CW.BAR_OPACITY_DURATION)));if(!this.viewLayer||!this.barLayer)this.viewLayer=this.view.get("layer"),this.barLayer=this.bar.get("layer");if(this.viewLayer&&this.barLayer){var i=this.viewLayer.style,s=this.barLayer.style;SC.platform.supportsCSS3DTransforms?(i.width=this.view.get("frame").width,i.webkitTransform="translate3d("+t+"px,0,0)",s.webkitTransform="translate3d("+n+"px,0,0)"):(i.left=t+"px",s.left=n+"px")}},cleanUp:function(){s?(this.view.removeFromParent(),this.bar.removeFromParent(),this.bar.destroy()):(this.view.adjust({left:r}),this.bar.adjust({left:r,opacity:i})),this.view.adjust({height:null,bottom
:0});var e=this.navigationView.$(),t=e.find(".overlay");t.remove(),o&&o()}.listens("finish")});setTimeout(function(){p.start()},100)}else e.adjust({left:r}),t.adjust({left:r,opacity:i})},_pushViewAndBarToStack:function(e,t){var n=this.get("navigationView"),r=n.createChildView(CW.NavigationBarView),i=n.get("frame").width,s=n.get("frame").height,o=(t?1:-1)*i+CW.NAVIGATABLE_VIEW_PADDING,u=n.get("navigationBarHeight"),a=e.get("hasNavigationBar");e.set("navigationController",this),e.set("layout",{top:0,bottom:0,left:o,width:i}),r.set("layout",{top:0,left:o/2,width:i,height:u}),r.set("navigationController",this),r.set("associatedView",e);if(a)n.appendChild(r);else{var f=n.childViews[0],l=f.get("layout");f.set("layout",{top:0,left:l.left,right:l.right,bottom:l.bottom})}n.get("well").appendChild(e),this.get("viewStack").push(e),this.get("barStack").push(r)}}),CW.ViewController=SC.Responder.extend({isViewController:YES,view:null}),CW.NavigatableView=SC.View.extend(CW.Animatability,{isNavigatable:YES,navigationController:null,hasNavigationBar:YES,title:"",icon:null,escapeHTML:YES,navigationBarTheme:"iOS",hasLeftBarButton:YES,leftBarButtonTitle:"Back",leftBarButtonIsEnabled:YES,leftBarButtonTheme:"borderless",leftBarButtonTarget:this,leftBarButtonAction:function(){this.getPath("parentView.parentView.navigationController").pop()},rightBarButtonTheme:"borderless",hasRightBarButton:NO,rightBarButtonTitle:"",rightBarButtonIsEnabled:YES,rightBarButtonTarget:null,rightBarButtonAction:"",toolbarView:null,_realLeftBarButtonIsEnabled:null,realLeftBarButtonIsEnabled:function(e,t){return t!==undefined&&
(t===NO?this._realLeftBarButtonIsEnabled=t:this._realLeftBarButtonIsEnabled=null),SC.none(this._realLeftBarButtonIsEnabled)?this.get("leftBarButtonIsEnabled"):this._realLeftBarButtonIsEnabled}.property("leftBarButtonIsEnabled"),_realRightBarButtonIsEnabled:null,realRightBarButtonIsEnabled:function(e,t){return t!==undefined&&(t===NO?this._realRightBarButtonIsEnabled=t:this._realRightBarButtonIsEnabled=null),SC.none(this._realRightBarButtonIsEnabled)?this.get("rightBarButtonIsEnabled"):this._realRightBarButtonIsEnabled}.property("rightBarButtonIsEnabled"),_realHasLeftBarButton:null,realHasLeftBarButton:function(e,t){return t!==undefined&&(t===NO?this._realHasLeftBarButton=t:this._realHasLeftBarButton=null),SC.none(this._realHasLeftBarButton)?this.get("hasLeftBarButton"):this._realHasLeftBarButton}.property("hasLeftBarButton"),_realHasRightBarButton:null,realHasRightBarButton:function(e,t){return t!==undefined&&(t===NO?this._realHasRightBarButton=t:this._realHasRightBarButton=null),SC.none(this._realHasRightBarButton)?this.get("hasRightBarButton"):this._realHasRightBarButton}.property("hasRightBarButton")}),CW.ProxyDisplay={concatenatedProperties:"proxyDisplayProperties".w(),proxyDisplayProperties:[],displayDelegateKey:"displayDelegate",initMixin:function(){this._cwps_computedDisplayProxyProperties=[],this._cwps_computedProxyPropertyToPropertyMap={},this._cwps_contentKeys=[],this._cwps_contentKeyToComputedProxyPropertyMap={},this._cwps_computedProxyPropertyToContentKeyMap={};var e=this.get("proxyDisplayProperties");this._cwps_addContentKeyComputedDisplayProxyPropertyMapping(e),
this._cwps_addComputedDisplayProxyProperties(e),this._cwps_setupContentPropertiesObserving(),this._cwps_propertiesDidChange(this,"*")},destroyMixin:function(){this._cwps_tearDownContentPropertiesObserving()},computedDisplayProxyPropertyKey:function(e){return"display%@".fmt(e.classify())},_cwps_computedContentKey:function(e){var t="content%@Key".fmt(e.classify()),n=this.get(t);if(SC.none(n)){var r=this.get("displayDelegateKey"),i=r?this.get(r):null;n=i?i.get(t):null}return SC.none(n)?e:n},contentPropertyValueForComputedDisplayProxyProperty:function(e){var t=this.get("content"),n=this._cwps_computedProxyPropertyToContentKeyMap;if(!t||!n)return undefined;var r=n[e];return t.get(r)},contentPropertyValueForProxiedProperty:function(e){var t=this.get("content");if(!t)return undefined;var n=this._cwps_computedContentKey(e);return t.get(n)},computedDisplayProxyPropertyValue:function(e){var t=this.contentPropertyValueForComputedDisplayProxyProperty(e),n=this._cwps_computedProxyPropertyToPropertyMap;if(!SC.none(t))return t;if(!n)return undefined;var r=n[e];return this.get(r)},addProxyDisplayProperty:function(e){this.addProxyDisplayProperties([e])},addProxyDisplayProperties:function(e){this._cwps_addContentKeyComputedDisplayProxyPropertyMapping(e),this._cwps_addComputedDisplayProxyProperties(e);var t=this.get("proxyDisplayProperties");this.set("proxyDisplayProperties",t.concat(e)),e.forEach(function(e){this._cwps_propertiesDidChange(this,e)},this)},_cwps_addComputedDisplayProxyProperties:function(e){var t=this._cwps_computedDisplayProxyProperties,n=this._cwps_computedProxyPropertyToPropertyMap
;e.forEach(function(e){if(e==="content")throw"Can not proxy the content property";var r=this.computedDisplayProxyPropertyKey(e),i=this[r];if(i===undefined)this[r]=null,t.push(r),n[r]=e;else{if(SC.typeOf(i)!==SC.T_FUNCTION||!i.isProperty)throw"'%@' is already defined. Can not proxy property '%@'".fmt(r,e);t.push(r)}},this);var r=this.get("displayProperties");r=r.concat(t),this.set("displayProperties",r)},_cwps_addContentKeyComputedDisplayProxyPropertyMapping:function(e){var t=this._cwps_contentKeys,n=this._cwps_contentKeyToComputedProxyPropertyMap,r=this._cwps_computedProxyPropertyToContentKeyMap;e.forEach(function(e){var i=this._cwps_computedContentKey(e),s=this.computedDisplayProxyPropertyKey(e);t.push(i),n[i]=s,r[s]=i},this)},_cwps_contentDidChange:function(){this._cwps_tearDownContentPropertiesObserving(),this._cwps_setupContentPropertiesObserving(),this._cwps_contentPropertiesDidChange(this,"*")}.observes("content"),_cwps_setupContentPropertiesObserving:function(){var e=this.get("content");this._cwps_content=e;if(!e)return;e.addObserver("*",this,"_cwps_contentPropertiesDidChange")},_cwps_tearDownContentPropertiesObserving:function(){var e=this._cwps_content;this._cwps_content=null;if(!e)return;e.removeObserver("*",this,"_cwps_contentPropertiesDidChange")},_cwps_propertiesDidChange:function(e,t){var n=this.get("proxyDisplayProperties")||[],r=null;t==="*"?r=n:n.indexOf(t)>=0&&(r=[t]);if(!r)return;this.beginPropertyChanges(),r.forEach(function(e){var t=this.computedDisplayProxyPropertyKey(e);this._cwps_notifyComputedDisplayProxyPropertyChanged(t)},this),this.endPropertyChanges
(),this.displayDidChange()}.observes("*"),_cwps_contentPropertiesDidChange:function(e,t){var n=this.get("content"),r=this._cwps_contentKeys||[],i=null;t==="*"?i=r:r.indexOf(t)>=0&&(i=[t]);if(!i)return;this.beginPropertyChanges(),i.forEach(function(e){var t=this._cwps_contentKeyToComputedProxyPropertyMap[e];this._cwps_notifyComputedDisplayProxyPropertyChanged(t)},this),this.endPropertyChanges(),this.displayDidChange()},_cwps_notifyComputedDisplayProxyPropertyChanged:function(e){var t=this.get(e);if(SC.typeOf(t)===SC.T_FUNCTION&&t.isProperty)this.notifyPropertyChange(e);else{var n=this.computedDisplayProxyPropertyValue(e);this.set(e,n!==undefined?n:null)}}};var CW_ACTION_SHEET_BUTTON_HEIGHT=67,CW_ACTION_SHEET_BOTTOM_PADDING=20,CW_ACTION_SHEET_SIDE_MARGINS=10,CW_ACTION_SHEET_TEXT_WIDTH=290;CW.ActionSheet=SC.View.extend(CW.Animatability,{classNames:"cw-action-sheet",actionSheetButtons:null,actionSheetMessage:null,actionSheetMessageEscaped:YES,childViews:["sheet"],sheetHeight:0,wantsAcceleratedLayer:YES,descriptionAction:null,sheet:SC.View.design(CW.Animatability,{classNames:"cw-actions"}),init:function(){arguments.callee.base.apply(this,arguments);var e,t;for(var n=0,r=this.actionSheetButtons.length;n<r;n++)t=this.actionSheetButtons[n],e=SC.ButtonView.create({themeName:t.themeName,target:t.target,action:t.action,title:t.title,layout:{left:CW_ACTION_SHEET_SIDE_MARGINS,right:CW_ACTION_SHEET_SIDE_MARGINS,height:46,bottom:CW_ACTION_SHEET_BUTTON_HEIGHT*(r-n-1)+CW_ACTION_SHEET_BOTTOM_PADDING}}),this.sheet.appendChild(e);var i=SC.heightForString(this.actionSheetMessage,CW_ACTION_SHEET_TEXT_WIDTH
,null,"atv3 iOS sc-label-view sc-small-size".w(),!this.actionSheetMessageEscaped),s=SC.LabelView.create({layout:{top:15,height:i,left:CW_ACTION_SHEET_SIDE_MARGINS,right:CW_ACTION_SHEET_SIDE_MARGINS},controlSize:SC.SMALL_CONTROL_SIZE,textAlign:SC.ALIGN_CENTER,escapeHTMLBinding:"*parentView.parentView.actionSheetMessageEscaped",valueBinding:"*parentView.parentView.actionSheetMessage"});this.sheet.appendChild(s);var o=r*CW_ACTION_SHEET_BUTTON_HEIGHT+CW_ACTION_SHEET_BOTTOM_PADDING+(15+i);this.sheet.set("layout",{right:0,left:0,bottom:-o,height:o})}}),CW.ActionSheetSupport={actionSheetClass:CW.ActionSheet,_currentActionSheet:null,_previousLeftBarButtonState:null,_previousRightBarButtonState:null,animationDuration:350,actionSheetHeight:null,showActionSheet:function(){this._currentActionSheet=this.actionSheetClass.create(),this.childViews[0].appendChild(this._currentActionSheet);var e=this._currentActionSheet,t=e.childViews[0];this.set("actionSheetHeight",e.sheet.layout.height),this._disableNavigationButtons(),SC.browser.msie||e.animate({opacity:{to:1,from:0,duration:this.animationDuration}}),t.animate({bottom:{to:0,duration:this.animationDuration}})},hideActionSheet:function(){var e=this._currentActionSheet;if(SC.none(e))return;var t=e.childViews[0];this._enableNavigationButtons(),SC.browser.msie||e.animate({opacity:{to:0,from:1,duration:this.animationDuration}});var n=this;t.animate({bottom:{to:-t.get("layout").height,duration:this.animationDuration}},{notifyThatIJustFinished:function(){n.childViews[0].removeChild(e),n._currentActionSheet=null,e.destroy()}.listens("finish")})},_disableNavigationButtons
:function(){var e=this.getPath("navigationController.viewStack"),t=e[e.length-1];t.set("realLeftBarButtonIsEnabled",NO),t.set("realHasLeftBarButton",NO),t.set("realRightBarButtonIsEnabled",NO),t.set("realHasRightBarButton",NO)},_enableNavigationButtons:function(){var e=this.getPath("navigationController.viewStack"),t=e[e.length-1];t.set("realLeftBarButtonIsEnabled",YES),t.set("realHasLeftBarButton",YES),t.set("realRightBarButtonIsEnabled",YES),t.set("realHasRightBarButton",YES)}},CW.PanelPane=SC.PanelPane.extend({classNames:"cw-panel-pane".w(),displayProperties:["hasTabBar","hasNavigationBar"],hasTabBar:NO,hasNavigationBar:NO,renderDelegateName:"sheetPaneRenderDelegate"}),SC.BaseTheme.borderRenderDelegate=SC.RenderDelegate.create({className:"border",render:function(e,t){t=t.begin("div").addClass("panel-background"),this.includeSlices(e,t,SC.NINE_SLICE),t=t.end()},update:function(){}}),CW.FIVE_SLICE=["left","middle one","pointer","middle two","right"],SC.BaseTheme.iOSCalloutRenderDelegate=SC.RenderDelegate.create({className:"ios_callout",render:function(e,t){var n=e.get("pointerPos");t=t.begin("div").addClass("panel-background"),this.includeSlices(e,t,CW.FIVE_SLICE),t.addClass(n),t=t.end()},update:function(e,t){var n=e.get("pointerPos"),r=t.find(".panel-background").first();r&&r.attr("class","panel-background "+n)}}),SC.BaseTheme.sheetPaneRenderDelegate=SC.RenderDelegate.create({className:"panel",render:function(e,t){var n=e.get("hasTabBar"),r=e.get("hasNavigationBar");n&&t.addClass("has-tab-bar"),r&&t.addClass("has-navigation-bar");var i=t.begin("div").addClass("panel-mask")
;t=t.begin("div").addClass("panel-background"),this.includeSlices(e,t,SC.NINE_SLICE),t=t.end(),i.end(),r&&(t=t.begin("div").addClass("navigation-bar"),this.includeSlices(e,t,SC.THREE_SLICE),t.end()),n&&(t=t.begin("div").addClass("tab-bar"),this.includeSlices(e,t,SC.THREE_SLICE),t.end());var s=e.get("ariaLabel");t.attr("aria-label",s||"")},update:function(e,t){var n=e.get("ariaLabel");t.attr("aria-label",n||"");var r=e.get("hasTabBar"),i=e.get("hasNavigationBar");r&&t.addClass("has-tab-bar"),i&&t.addClass("has-navigation-bar")}}),SC.BaseTheme.switchViewRenderDelegate=SC.RenderDelegate.create({className:"switchview",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?a="true":a="false",t.attr("role","checkbox"),t.attr("aria-checked",a),t.attr("aria-labelledby",i),t.setClass({active:o,disabled:u}),t=t.begin("span").addClass("label").id(i),n.labelRenderDelegate.render(e,t),t=t.end();var f=t.begin("span").addClass("cw-switchview-container");t=t.begin("span").addClass("cw-switchview-tracks-container"),t=t.end(),t.push('<span class = "cw-switchview-handle"></span>'),f.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?o="true":o="false",t.attr("aria-checked",o),n.labelRenderDelegate.update(e,t.find("span.label")),t.setClass({active:i,disabled:s})}}),CW.SectionedViewDataSource={isSectionedViewDataSource:YES,numberOfSectionsInSectionedView:function(e){return 0},sectionedViewSectionIsVisible
:function(e,t){return YES},sectionedViewNumberOfRowsInSection:function(e,t){return 0},sectionedViewTitleForHeaderInSection:function(e,t){return undefined},sectionedViewTitleForFooterInSection:function(e,t){return undefined},sectionedViewCellForRowAtIndexPath:function(e,t){return undefined},sectionedViewContentForRowAtIndexPath:function(e,t){return undefined}},CW.SectionedViewDelegate={isSectionedViewDelegate:YES,sectionedViewHeightForRowAtIndexPath:function(e,t){return undefined},sectionedViewAccessoryButtonTappedForRowAtIndexPath:function(e,t){},sectionedViewWillSelectRowAtIndexPath:function(e,t){return t},sectionedViewDidSelectRowAtIndexPath:function(e,t){},sectionedViewWillDeselectRowAtIndexPath:function(e,t){return t},sectionedViewDidDeselectRowAtIndexPath:function(e,t){},sectionedViewViewForHeaderInSection:function(e,t){return undefined},sectionedViewViewForFooterInSection:function(e,t){return undefined},sectionedViewHeightForHeaderInSection:function(e,t){return undefined},sectionedViewHeightForFooterInSection:function(e,t){return undefined},sectionedViewShouldAutoResizeHeaderTitleInSection:function(e,t){return undefined},sectionedViewShouldAutoResizeFooterTitleInSection:function(e,t){return undefined},sectionedViewCellDisplayDelegateForRowAtIndexPath:function(e,t){return e},sectionedViewWillSetupAllCells:function(e){},sectionedViewDidSetupAllCells:function(e){},sectionedViewWillTearDownAllCells:function(e){},sectionedViewDidTearDownAllCells:function(e){}},CW.SectionedViewController=CW.ViewController.extend(CW.SectionedViewDataSource,CW.SectionedViewDelegate,{}),CW.SectionedViewAutoResizingViewSupport=
{isSectionedViewAutoResizingView:YES,shouldAutoResize:YES,heightPadding:0,computeHeight:function(){var e=this.$(),t=parseInt(e.css("padding-left")||0),n=parseInt(e.css("padding-right")||0),r=parseInt(e.css("margin-left")||0),i=parseInt(e.css("margin-right")||0),s=e[0],o=this.getPath("frame.width"),u;return SC.none(s)?null:(s.style.maxWidth=o-(t+n+r+i)+"px",u=SC.metricsForString(this.get("value"),s),u.height+this.get("heightPadding"))}},CW.SVCollectionSectionDelegate={isSVCollectionSectionDelegate:YES,collectionSectionCellForContentAtIndex:function(e,t,n){return null},collectionSectionRowHeightForContentAtIndex:function(e,t,n){return null}},CW.SectionedViewDesignSupport={},SC.mixin(CW.SectionedViewDesignSupport,CW.SectionedViewDataSource,CW.SectionedViewDelegate,{isSectionedViewDesigner:YES,sections:[],initMixin:function(){this.createSections()},createSections:function(){var e=(this.get("sections")||[]).slice(),t=e.length,n=0,r,i;for(;n<t;n+=1){r=e[n],i=this.createSection(this[r],n),e[n]=this[r]=i;if(!i)throw'sectioned view designer has invalid section "%@" for section[%@]'.fmt(r,n)}this.set("sections",e)},createSection:function(e,t){return SC.kindOf(e,CW.SectionedViewSection)&&e.isClass?e.create({owner:this,index:t}):null},sectionForIndex:function(e){var t=this.get("sections");return t?t.objectAt(e):undefined},rowForIndexPath:function(e){var t=e.get("section"),n=e.get("row");return t=this.sectionForIndex(t),t?t.rowForIndex(n):t},numberOfSectionsInSectionedView:function(e){return this.getPath("sections.length")},sectionedViewSectionIsVisible:function(e,t){return t=this.sectionForIndex
(t),t?t.get("isVisible"):NO},sectionedViewNumberOfRowsInSection:function(e,t){return t=this.sectionForIndex(t),t?t.get("rows").length:t},sectionedViewCellForRowAtIndexPath:function(e,t){var n=this.sectionForIndex(t.get("section")),r=this.rowForIndexPath(t),i;return r&&(i=r.get("cell"))?i:n&&(i=n.get("cell"))?i:null},sectionedViewContentForRowAtIndexPath:function(e,t){var n=this.rowForIndexPath(t);return!n||n.get("isContent")?n:n.get("content")},sectionedViewTitleForHeaderInSection:function(e,t){return t=this.sectionForIndex(t),t?t.get("headerTitle"):t},sectionedViewTitleForFooterInSection:function(e,t){return t=this.sectionForIndex(t),t?t.get("footerTitle"):t},sectionedViewHeightForRowAtIndexPath:function(e,t){var n=this.rowForIndexPath(t);return n?n.get("height"):n},sectionedViewViewForHeaderInSection:function(e,t){return t=this.sectionForIndex(t),t?t.get("headerView"):t},sectionedViewViewForFooterInSection:function(e,t){return t=this.sectionForIndex(t),t?t.get("footerView"):t},sectionedViewHeightForHeaderInSection:function(e,t){return t=this.sectionForIndex(t),t?t.get("headerHeight"):t},sectionedViewHeightForFooterInSection:function(e,t){return t=this.sectionForIndex(t),t?t.get("footerHeight"):t},sectionedViewShouldAutoResizeHeaderTitleInSection:function(e,t){return t=this.sectionForIndex(t),t?t.get("autoResizeHeaderTitle"):NO},sectionedViewShouldAutoResizeFooterTitleInSection:function(e,t){return t=this.sectionForIndex(t),t?t.get("autoResizeFooterTitle"):NO},sectionedViewAccessoryButtonTappedForRowAtIndexPath:function(e,t){var n=this.rowForIndexPath(t);if(!n)return null;n
.accessoryButtonTapped(e)},sectionedViewWillSelectRowAtIndexPath:function(e,t){var n=this.rowForIndexPath(t),r=this.sectionForIndex(t.get("section")),i=n&&n.get("allowsSelection"),s=n&&n.get("isEnabled");return!r.get("allowsSelection")||!n.get("allowsSelection")||!n.get("isEnabled")?null:t},sectionedViewDidSelectRowAtIndexPath:function(e,t){var n=this.rowForIndexPath(t);n&&n.get("allowsSelection")&&n.selected(e)},sectionedViewWillDeselectRowAtIndexPath:function(e,t){var n=this.rowForIndexPath(t);return n&&n.get("allowsSelection")?t:null},sectionedViewDidDeselectRowAtIndexPath:function(e,t){var n=this.rowForIndexPath(t);n&&n.get("allowsSelection")&&n.deselected(e)},sectionedViewCellDisplayDelegateForRowAtIndexPath:function(e,t){var n=this.sectionForIndex(t.get("section")),r=t.get("row"),i=null;return n&&(i=n.displayDelegateForRow(r)),i?i:e},sectionedViewWillSetupAllCells:function(e){this._notifySectionsOfAllCellUpdates("sectionedViewWillSetupAllCells",e)},sectionedViewDidSetupAllCells:function(e){this._notifySectionsOfAllCellUpdates("sectionedViewDidSetupAllCells",e)},sectionedViewWillTearDownAllCells:function(e){this._notifySectionsOfAllCellUpdates("sectionedViewWillTearDownAllCells",e)},sectionedViewDidTearDownAllCells:function(e){this._notifySectionsOfAllCellUpdates("sectionedViewDidTearDownAllCells",e)},_notifySectionsOfAllCellUpdates:function(e,t){var n=this.get("sections")||[];n.forEach(function(n){n[e](t)})}}),CW.SectionedViewMonitor={isSectionedViewMonitor:YES,sectionedViewWillUpdateContentView:function(e){},sectionedViewDidUpdateContentView:function(e){},sectionedViewWillSetupContentView
:function(e){},sectionedViewDidSetupContentView:function(e){},sectionedViewWillTearDownContentView:function(e){},sectionedViewDidTearDownContentView:function(e){}},CW.SWITCH_VIEW_WIDTH=52,CW.HANDLE_WIDTH=30,CW.CAP_WIDTH=24,CW.HANDLE_MAX_LEFT=21,CW.HANDLE_BIG_OFFSET=18,CW.SwitchView=SC.CheckboxView.extend({classNames:["cw-switchview"],renderDelegateName:"switchViewRenderDelegate",animateOnPropertyChange:NO,animateOnPropertyChangeBindingDefault:SC.Binding.oneWay(),_isTracking:NO,_startingMouseOffset:0,_handleLocation:0,_container:null,_handle:null,didCreateLayer:function(){this._animateTo(this.get("isSelected"),NO,0)},didUpdateLayer:function(){this._animateTo(this.get("isSelected"),NO,0)},_isSelectedDidChange:function(){this._handle||this._initReferences();var e=this.get("animateOnPropertyChange"),t=e?null:0;this._animateTo(this.get("isSelected"),NO,t)}.observes("isSelected"),keyDown:function(e){return this.get("isEnabled")?(this._handle||this._initReferences(),e.keyCode===13?(this._animateTo(!this.get("isSelected")),YES):e.keyCode===39?(this._animateTo(YES),YES):e.keyCode===37?(this._animateTo(NO),YES):arguments.callee.base.apply(this,arguments)):NO},mouseDown:function(e){if(!this.get("isEnabled"))return NO;this._handle||this._initReferences(),!e.target.className.indexOf("cw-switchview-handle")>0&&(this._handle.removeClass("highlight"),this._handle.addClass("pressed"),this._tracksContainer.addClass("pressed")),this.get("isSelected")&&this._repositionTo(CW.HANDLE_MAX_LEFT-3),this._onCap.addClass("cw-switchview-on"),this._startingMouseOffset=this._makeValueRelativeToLeftEdgeOf(
e.clientX,this._container),this._startingHandleLocation=parseInt(this._handle.css("left"),10)},touchesDragged:function(e){this.mouseDragged(e)},mouseDragged:function(e){if(!this.get("isEnabled"))return NO;this._isTracking||(this._handle.removeClass("highlight"),this._handle.addClass("pressed"),this._tracksContainer.addClass("pressed")),this._isTracking=YES;var t=parseInt(this._handle.css("left"),10)>=CW.HANDLE_MAX_LEFT/2,n=this._makeValueRelativeToLeftEdgeOf(e.clientX,this._container),r=n-this._startingMouseOffset;this.get("isSelected")&&this._repositionTo(CW.HANDLE_MAX_LEFT-3),this._repositionTo(this._startingHandleLocation+r)},mouseUp:function(e){if(!this.get("isEnabled"))return NO;var t=parseInt(this._handle.css("left"),10)>=CW.HANDLE_MAX_LEFT/2;this.set("isSelected",t),this._isTracking?(this._isTracking=NO,this._handleLocation==CW.HANDLE_BIG_OFFSET?this._animateTo(t,YES,0):this._animateTo(t)):this._animateTo(!this.get("isSelected"))},_makeValueRelativeToLeftEdgeOf:function(e,t){var n=0,r=0;if(t.offsetParent)do{if(t===document.body)break;r+=t.offsetLeft,n+=t.offsetTop}while(t=t.offsetParent);return e-r},_initReferences:function(){this._container=this.$(".cw-switchview-container")[0],this._handle=this.$(".cw-switchview-handle"),this._offTrack=this.$(".cw-switchview-off-track"),this._offText=this.$(".cw-switchview-off-text"),this._onText=this.$(".cw-switchview-on-text"),this._onCap=this.$(".cw-switchview-on-cap"),this._offCap=this.$(".cw-switchview-off-cap"),this._tracksContainer=this.$(".cw-switchview-tracks-container")}.observes("layer"),_repositionTo:function(e){e=Math.max
(Math.min(e,CW.HANDLE_MAX_LEFT),0),this._isTracking&&e>=CW.HANDLE_BIG_OFFSET&&(e=CW.HANDLE_BIG_OFFSET),e>=CW.HANDLE_MAX_LEFT/2?(this._tracksContainer.addClass("selectedState"),this._handle.addClass("selectedState")):(this._tracksContainer.removeClass("selectedState"),this._handle.removeClass("selectedState")),this._handle.css("left",this._handleLocation=e),this._offTrack.css("left",e)},_animateTo:function(e,t,n){t===undefined&&(t=YES),this._handle.removeClass("pressed"),this._tracksContainer.removeClass("pressed"),e?this._onCap.addClass("cw-switchview-on"):this._handle.removeClass("highlight"),this._anim&&this._anim.stop(),n===0?this._repositionTo(e?CW.HANDLE_MAX_LEFT:0):this._anim=CW.Animation.create({name:this.toString(),that:this,updateValue:t,isSelected:e,updateValue:t,from:this._handleLocation,to:e?CW.HANDLE_MAX_LEFT:0,duration:SC.none(n)?350:n,update:function(){this.that._repositionTo(this.current)},onFinish:function(){this.updateValue&&(this.that.get("isSelected")!==this.isSelected&&this.invokeLast(function(){this.that._action()}),this.that.set("isSelected",this.isSelected)),this.isSelected||this.that._onCap.removeClass("cw-switchview-on")}}).start()}}),CW.SwitcherAccessoryViewSupport={target:null,action:null,animateOnPropertyChange:NO,animateOnPropertyChangeBindingDefault:SC.Binding.oneWay(),accessoryView:CW.SwitchView.extend({layout:{width:57,centerY:1,height:31,right:8},animateOnPropertyChangeBinding:SC.Binding.oneWay(".bindingAgent.animateOnPropertyChange"),valueBinding:".bindingAgent.value",targetBinding:SC.Binding.oneWay(".bindingAgent.target"),actionBinding:SC.
Binding.oneWay(".bindingAgent.action")})},CW.SectionedViewCellAccessoryType=SC.Object.extend({concatenatedProperties:["classNames"],classNames:[],buttonHitTest:function(e,t){return NO}}),CW.SectionedViewCellAccessoryType.mixin({CLASS_NAME:"cw-accessory-type",render:function(e,t,n){n=n.begin().addClass(this.CLASS_NAME),e&&n.addClass(e.get("classNames")),n.end()},update:function(e,t,n){var r=n.find("."+this.CLASS_NAME);if(r){var i=[this.CLASS_NAME];e&&(i=i.concat(e.get("classNames"))),r.attr("class",i.join(" "))}}}),CW.SectionedViewCellAccessoryType.DETAIL_CHECKMARK=CW.SectionedViewCellAccessoryType.create({classNames:"cw-detail-checkmark".w()}),CW.SectionedViewCellAccessoryType.DISCLOSURE_INDICATOR=CW.SectionedViewCellAccessoryType.create({classNames:"cw-disclosure-indicator".w()}),CW.SectionedViewCellAccessoryType.DETAIL_DISCLOSURE_BUTTON=CW.SectionedViewCellAccessoryType.create({classNames:"cw-detail-disclosure-button".w(),buttonHitTest:function(e,t){var n=t.target,r=e.$("."+this.get("classNames")[0]);return r.size()>0&&r.within(n)}}),CW.IMAGE_ANCHOR_CLASS_NAME="cw-image-anchor",CW.SectionedViewCellImageAnchor=SC.Object.extend({concatenatedProperties:["classNames"],classNames:[CW.IMAGE_ANCHOR_CLASS_NAME]}),CW.SectionedViewCellImageAnchor.CONTENT_AREA=CW.SectionedViewCellImageAnchor.create(),CW.SectionedViewCellImageAnchor.TEXT_LEFT=CW.SectionedViewCellImageAnchor.create({classNames:["cw-image-left"]}),CW.SectionedViewCellImageAnchor.DETAIL_TEXT_LEFT=CW.SectionedViewCellImageAnchor.create({classNames:["cw-image-left"]}),CW.SectionedViewCellSelectionStyle=SC.Object.extend({classNames
:[]}),CW.SectionedViewCellSelectionStyle.NONE=CW.SectionedViewCellSelectionStyle.create(),CW.SectionedViewCellSelectionStyle.BLUE=CW.SectionedViewCellSelectionStyle.create({classNames:["cw-selection-blue"]}),CW.SectionedViewCellStyle=SC.Object.extend({concatenatedProperties:"classNames".w(),classNames:[],imageAnchor:CW.SectionedViewCellImageAnchor.CONTENT_AREA}),CW.SectionedViewCellStyle.DEFAULT1=CW.SectionedViewCellStyle.create({classNames:["cw-default"],imageAnchor:CW.SectionedViewCellImageAnchor.TEXT_LEFT}),CW.SectionedViewCellStyle.DEFAULT2=CW.SectionedViewCellStyle.create({classNames:["cw-default"],imageAnchor:CW.SectionedViewCellImageAnchor.DETAIL_TEXT_LEFT}),CW.SectionedViewCellStyle.BUTTON=CW.SectionedViewCellStyle.create({classNames:["cw-button"],imageAnchor:CW.SectionedViewCellImageAnchor.TEXT_LEFT}),CW.SectionedViewCellStyle.DELETE_BUTTON=CW.SectionedViewCellStyle.create({classNames:["cw-delete-button"],imageAnchor:CW.SectionedViewCellImageAnchor.TEXT_LEFT}),CW.SectionedViewCellStyle.TEXT_FIELD=CW.SectionedViewCellStyle.create({classNames:["cw-text-field"]}),CW.SectionedViewStyle=SC.Object.extend({contentLayout:{},sectionSpacing:0,classNames:[]}),CW.SectionedViewStyle.NONE=CW.SectionedViewStyle.create(),CW.SectionedViewStyle.PLAIN=CW.SectionedViewStyle.create({classNames:["cw-plain"]}),CW.SectionedViewStyle.GROUPED=CW.SectionedViewStyle.create({_layout1:{top:15,left:0,right:0,bottom:15},_layout2:{top:20,left:0,right:0,bottom:30},contentLayout:function(){var e=SC.browser;return e.iPhone||e.iPod?this._layout1:this._layout2}.property(),sectionSpacing:34,classNames:["cw-grouped"
]}),CW.SectionedViewBlock=SC.Object.extend({sectionedView:null,views:[],height:0,top:0,hasViews:function(){var e=this.get("views");return e&&e.length>0}.property("view").cacheable(),setup:function(){},tearDown:function(){var e=this.get("views")||[];e.forEach(function(e){e.destroy()}),this.set("views",[])},reload:function(){},readjustFromTop:function(e){this.set("top",e),this.doReadjustFromTop(e)},doReadjustFromTop:function(e){},readjustViewFromTop:function(e,t){return e.adjust({top:t,bottom:null}),e.get("frame").height},updateHeightIfNeeded:function(){var e=this.get("views")||[],t=NO;e.forEach(function(e){if(e.isSectionedViewAutoResizingView&&e.shouldAutoResize){var n=e.computeHeight();n&&(e.adjust("height",n),t=YES)}}),t&&this.updateHeight()},updateHeight:function(){}}),CW.SectionedViewFooterBlock=CW.SectionedViewBlock.extend({setup:function(){var e=this.get("sectionedView"),t=e.get("styleValue"),n=t.get("contentLayout"),r=e.get("footerView"),i=e.get("footerHeight");if(!r)return;if(!r.isClass||!SC.kindOf(r,SC.View)){SC.Logger.error("%@: sectioned view footer is not a view class".fmt(e));return}r=e.get("contentView").createChildView(r,{layerId:"%@-footer".fmt(e.get("layerId")),classNames:"cw-sectioned-footer",layout:{left:0,right:0,top:0,height:i}}),this.set("views",[r]),this.set("height",i)},doReadjustFromTop:function(e){var t=this.get("views");t&&t.length>0&&this.readjustViewFromTop(t[0],e)},updateHeight:function(){this.set("height",this.get("views")[0].get("frame").height)}}),CW.SectionedViewHeaderBlock=CW.SectionedViewBlock.extend({setup:function(){var e=this.get("sectionedView"
),t=e.get("styleValue"),n=t.get("contentLayout"),r=e.get("headerView"),i=e.get("headerHeight");if(!r)return;if(!r.isClass||!SC.kindOf(r,SC.View)){SC.Logger.error("%@: sectioned view header is not a view class".fmt(e));return}r=e.get("contentView").createChildView(r,{layerId:"%@-header".fmt(e.get("layerId")),classNames:"cw-sectioned-header",layout:{left:0,right:0,top:0,height:i}}),this.set("views",[r]),this.set("height",i)},doReadjustFromTop:function(e){var t=this.get("views");t&&t.length>0&&this.readjustViewFromTop(t[0],e)},updateHeight:function(){this.set("height",this.get("views")[0].get("frame").height)}}),CW.SectionedViewSectionBlock=CW.SectionedViewBlock.extend({sectionIndex:null,headerView:null,footerView:null,rows:null,height:function(){var e=this.get("sectionedView"),t=this.get("sectionIndex"),n=e.get("sectionedViewDataSource"),r=n.numberOfSectionsInSectionedView(e),i=this.get("views")||[],s=this.rowsContainerView,o=0;i.forEach(function(e){e!=s&&(o+=e.get("frame").height)});var u=e.get("styleValue"),a=u.get("contentLayout"),f=u.get("sectionSpacing");return t<r-1&&o>0&&(o+=f),o}.property("views","sectionIndex").cacheable(),includeSectionRowsContainer:function(){return SC.browser.isIE8OrLower}.property().cacheable(),setup:function(){var e=this.get("sectionedView"),t=[];this.headerView=this._createHeaderView(),this.rows=this._createRowCells(),this.footerView=this._createFooterView(),this.rowsContainerView=this._createRowsContainer(),this.rowsContainerView&&t.push(this.rowsContainerView),this.headerView&&t.push(this.headerView),this.rows&&t.pushObjects(this.rows),this.footerView&&
t.push(this.footerView),this.set("views",t)},reload:function(){this.tearDown(),this.setup()},doReadjustFromTop:function(e){var t=this.headerView,n=this.footerView,r=this.rows,i=e,s=0,o=0;t&&(e+=this.readjustViewFromTop(t,e));for(var u=0,a=r.length;u<a;u+=1){var f=r[u];u===0&&(s=e),o+=f.get("frame").height,e+=this.readjustViewFromTop(f,e)}n&&(e+=this.readjustViewFromTop(n,e));var l=this.rowsContainerView;l&&l.adjust({top:s,height:o})},updateHeight:function(){this.notifyPropertyChange("height")},_createRowsContainer:function(){var e=this.get("sectionedView"),t=e.get("contentView");if(!this.get("includeSectionRowsContainer"))return null;var n=CW.SectionedViewSectionBlock,r=n.sectionRowsContainerViewExample;return t.createChildView(r)},_createRowCells:function(){var e=this.get("sectionedView"),t=this.get("sectionIndex"),n=e.get("sectionedViewDataSource"),r=n.sectionedViewNumberOfRowsInSection(e,t),i=[];for(var s=0,o;s<r;s+=1)o=this._createRowCell(t,s),o&&i.push(o);return i},_createRowCell:function(e,t){var n=this.get("sectionedView"),r=n.get("sectionedViewDataSource"),i=n.get("sectionedViewDelegate"),s=CW.IndexPath.create({section:e,row:t}),o=r.sectionedViewCellForRowAtIndexPath(n,s),u=r.sectionedViewContentForRowAtIndexPath(n,s),a=i.sectionedViewHeightForRowAtIndexPath(n,s),f=["cw-section-row"],l=r.sectionedViewNumberOfRowsInSection(n,e),c=i.sectionedViewCellDisplayDelegateForRowAtIndexPath(n,s),h;a=a||n.get("rowHeight"),t===0&&f.push("cw-first-row"),t===l-1&&f.push("cw-last-row"),o||(o=n.get("rowCellExample"));if(!o||!o.isClass||!SC.kindOf(o,CW.SectionedViewCoreCell))return SC
.Logger.error("%@: cell for index path %@ is not a sectioned view core cell class".fmt(n,s)),null;h={classNames:f,layerId:"%@-section-%@-row-%@".fmt(n.get("layerId"),e,t),isSectionedViewCell:YES,indexPath:s,layout:{top:0,left:0,right:0,height:a},displayDelegate:c},u&&(h.content=u);var p=n.get("contentView");return o=p.createChildView(o,h),o.owner=n,o},_createHeaderView:function(){var e=this.get("sectionedView"),t=this.get("sectionIndex"),n=e.get("sectionedViewDataSource"),r=e.get("sectionedViewDelegate"),i=n.sectionedViewTitleForHeaderInSection(e,t),s=n.sectionedViewShouldAutoResizeHeaderTitleInSection(e,t),o=r.sectionedViewViewForHeaderInSection(e,t),u=r.sectionedViewHeightForHeaderInSection(e,t);u=u||e.get("sectionHeaderHeight"),!SC.empty(i)&&!o&&(o=e.get("sectionHeaderViewExample").extend({value:i}),s&&(o=o.extend(CW.SectionedViewAutoResizingViewSupport,{heightPadding:6})));if(!o)return null;if(!o.isClass||!SC.kindOf(o,SC.View))return SC.Logger.error("%@: header view for section %@ is not a view class".fmt(e,t)),null;var a=e.get("contentView");return o=a.createChildView(o,{layerId:"%@-section-header-%@".fmt(e.get("layerId"),t),classNames:"cw-section-header",layout:{left:0,right:0,top:0,height:u},displayDelegate:e}),o.owner=e,o},_createFooterView:function(){var e=this.get("sectionedView"),t=this.get("sectionIndex"),n=e.get("sectionedViewDataSource"),r=e.get("sectionedViewDelegate"),i=n.sectionedViewTitleForFooterInSection(e,t),s=n.sectionedViewShouldAutoResizeFooterTitleInSection(e,t),o=r.sectionedViewViewForFooterInSection(e,t),u=r.sectionedViewHeightForFooterInSection(e,
t);u=u||e.get("sectionFooterHeight"),!SC.empty(i)&&!o&&(o=e.get("sectionFooterViewExample").extend({value:i}),s&&(o=o.extend(CW.SectionedViewAutoResizingViewSupport)));if(!o)return null;if(!o.isClass||!SC.kindOf(o,SC.View))return SC.Logger.error("%@: footer view for section %@ is not a view class".fmt(e,t)),null;var a=e.get("contentView");return o=a.createChildView(o,{layerId:"%@-section-footer-%@".fmt(e.get("layerId"),t),classNames:"cw-section-footer",layout:{left:0,right:0,top:0,height:u},displayDelegate:e}),o.owner=e,o}}),CW.SectionedViewSectionBlock.mixin({sectionRowsContainerViewExample:SC.View.extend({classNames:"cw-section-rows-container",render:function(e,t){SC.RenderDelegate.includeSlices(this,e,SC.NINE_SLICE)}})}),CW.SectionedViewCoreCellRenderDelegate=SC.RenderDelegate.extend({className:"cw-sectioned-view-cell",styleKey:"styleValue",selectionStyleKey:"selectionStyleValue",highlightStyleKey:"highlightStyle",isEnabledKey:"isEnabledValue",render:function(e,t){var n=e.get("isSelected"),r=e.get("isHighlighted"),i=e.get(this.get("isEnabledKey")),s=e.get(this.get("styleKey")),o=e.get(this.get("selectionStyleKey")),u=e.get(this.get("highlightStyleKey"));n&&t.addClass("cw-selected"),r&&t.addClass("cw-highlighted"),i||t.addClass("cw-disabled"),r&&t.addClass(u.get("classNames")),n&&o&&t.addClass(o.get("classNames")),s&&t.addClass(s.get("classNames")),this.willRenderCellBody(e,t),this.renderCellBody(e,t),this.didRenderCellBody(e,t)},renderCellBody:function(e,t){},willRenderCellBody:function(e,t){},didRenderCellBody:function(e,t){},update:function(e,t){var n=e.get(this.get("styleKey"
)),r=e.get(this.get("selectionStyleKey")),i=e.get(this.get("highlightStyleKey")),s,o=e.get("isSelected");t.setClass("cw-selected",o);var u=e.get("isHighlighted");t.setClass("cw-highlighted",u);var a=e.get(this.get("isEnabledKey"));t.setClass("cw-disabled",!a),n&&t.addClass(n.get("classNames")),i&&(s=i.get("classNames"),u?t.addClass(s):t.removeClass(s)),r&&(s=r.get("classNames"),o?t.addClass(s):t.removeClass(s)),this.willUpdateCellBody(e,t),this.updateCellBody(e,t),this.didUpdateCellBody(e,t)},updateCellBody:function(e,t){},willUpdateCellBody:function(e,t){},didUpdateCellBody:function(e,t){}}),SC.BaseTheme.sectionedViewCoreCellRenderDelegate=CW.SectionedViewCoreCellRenderDelegate.create(),CW.SectionedViewCellRenderDelegate=CW.SectionedViewCoreCellRenderDelegate.extend({renderCellBody:function(e,t){this.renderContentArea(e,t),this.renderAccessoryType(e,t)},renderContentArea:function(e,t){var n=e.get("indentationLevelValue"),r=e.get("indentationWidthValue"),i=e.get("accessoryLayout"),s=n*r,o=SC.Locale.currentLocale.get("isRTL"),u=o?"margin-right":"margin-left";t=t.begin().addClass("cw-content"),t.addStyle(u,s);if(i){var a=i.width,f=i.left,l=i.right,c=5,h=a?a+l+c:f?f+c:null;u=o?"margin-left":"margin-right",h&&t.addStyle(u,s)}this.willRenderContentAreaBody(e,t),this.renderContentAreaImage(e,t,CW.SectionedViewCellImageAnchor.CONTENT_AREA),this.renderContentAreaText(e,t),this.renderContentAreaDetailText(e,t),this.didRenderContentAreaBody(e,t),t.end()},willRenderContentAreaBody:function(e,t){},didRenderContentAreaBody:function(e,t){},renderContentAreaText:function(e,t){var n=e.get("textValue"
),r=e.get("escapeHTMLValue");if(!n)return;t=t.begin().addClass("cw-text ellipsis"),this.renderContentAreaImage(e,t,CW.SectionedViewCellImageAnchor.TEXT_LEFT),this.willRenderContentAreaText(e,t),r?t.begin("span").text(n).end():t.begin("span").push(n).end(),this.didRenderContentAreaText(e,t),t.end()},willRenderContentAreaText:function(e,t){},didRenderContentAreaText:function(e,t){},renderContentAreaDetailText:function(e,t){var n=e.get("detailTextValue"),r=e.get("escapeHTMLValue");if(!n)return;t=t.begin().addClass("cw-detail-text"),this.renderContentAreaImage(e,t,CW.SectionedViewCellImageAnchor.DETAIL_TEXT_LEFT),this.willRenderContentAreaDetailText(e,t),r?t.begin("span").text(n).end():t.begin("span").push(n).end(),this.didRenderContentAreaDetailText(e,t),t.end()},willRenderContentAreaDetailText:function(e,t){},didRenderContentAreaDetailText:function(e,t){},renderContentAreaImage:function(e,t,n){var r=e.get("imageValue"),i=e.get(this.get("styleKey")),s=i?i.get("imageAnchor"):null,o=s===n;o&&t.addClass(s.get("classNames"));if(!r||!o)return;var u=null,a=["cw-image"];r&&SC.ImageView.valueIsUrl(r)?u=r:(a.push(r),u=SC.BLANK_IMAGE_URL),this.willRenderContentAreaImage(e,t),t.begin("img").addClass(a).attr("src",u).end(),this.didRenderContentAreaImage(e,t)},willRenderContentAreaImage:function(e,t){},didRenderContentAreaImage:function(e,t){},renderAccessoryType:function(e,t){var n=e.get("accessoryTypeValue");n&&t.addClass("cw-has-accessory-type"),CW.SectionedViewCellAccessoryType.render(n,e,t)},updateCellBody:function(e,t){this.updateContentArea(e,t),this.updateAccessoryType(e,t)},updateContentArea
:function(e,t){this.willUpdateContentArea(e,t),this.updateContentAreaText(e,t),this.updateContentAreaDetailText(e,t),this.updateContentAreaImage(e,t),this.didUpdateContentArea(e,t)},willUpdateContentArea:function(e,t){},didUpdateContentArea:function(e,t){},updateContentAreaText:function(e,t){if(!e.didChangeFor("update","textValue"))return;var n=e.get("textValue"),r=t.find(".cw-content .cw-text span"),i=!SC.empty(n),s=e.get("escapeHTMLValue");!i&&r.size()>0?(r.remove(),this.didRemoveContentAreaText(e,t)):i&&r.size()>0?(s?r.text(n):r.push(n),this.didUpdateContentAreaText(e,t)):i&&(t.find(".cw-content").append('<div class="%@"><span>%@</span></div>'.fmt("cw-text",n)),this.updateContentAreaImage(e,t.find(".cw-text"),CW.SectionedViewCellImageAnchor.DETAIL_TEXT_LEFT),this.didInsertContentAreaText(e,t))},didRemoveContentAreaText:function(e,t){},didUpdateContentAreaText:function(e,t){},didInsertContentAreaText:function(e,t){},updateContentAreaDetailText:function(e,t){if(!e.didChangeFor("update","detailTextValue"))return;var n=e.get("detailTextValue"),r=t.find(".cw-content .cw-detail-text span"),i=!SC.empty(n),s=e.get("escapeHTMLValue");!i&&r.size()>0?(r.remove(),this.didRemoveContentAreaDetailText(e,t)):i&&r.size()>0?(s?r.text(n):r.push(n),this.didUpdateContentAreaDetailText(e,t)):i&&(t.find(".cw-content").append('<div class="%@"><span>%@</span></div>'.fmt("cw-detail-text",n)),this.updateContentAreaImage(e,t.find(".cw-detail-text"),CW.SectionedViewCellImageAnchor.DETAIL_TEXT_LEFT),this.didInsertContentAreaDetailText(e,t))},didRemoveContentAreaDetailText:function(e,t){},didUpdateContentAreaDetailText
:function(e,t){},didInsertContentAreaDetailText:function(e,t){},updateContentAreaImage:function(e,t,n){if(!e.didChangeFor("update","imageValue"))return;var r=e.get("imageValue"),i=t.find("."+CW.IMAGE_ANCHOR_CLASS_NAME),s=i.find(".cw-image"),o=SC.ImageView.valueIsUrl(r),u=!SC.empty(r);if(!u&&s.size()>0)s.remove(),this.didRemoveContentAreaImage(e,t);else if(u&&s.size()>0)o?(s.attr("src",r),s.attr("class","cw-image")):(s.attr("src",SC.BLANK_IMAGE_URL),s.attr("class","cw-image %@".fmt(r))),this.didUpdateContentAreaImage(e,t);else if(u){var a=e.get("styleValue"),f=a.get("imageAnchor");i.size()===0&&n===f&&(i=t,i.addClass(f.get("classNames"))),o?i.prepend('<img class="cw-image" src="%@"/>'.fmt(r)):i.prepend('<img class="cw-image %@" src="%@"/>'.fmt(r,SC.BLANK_IMAGE_URL)),this.didInsertContentAreaImage(e,t)}},didRemoveContentAreaImage:function(e,t){},didUpdateContentAreaImage:function(e,t){},didInsertContentAreaImage:function(e,t){},updateAccessoryType:function(e,t){var n,r;r=e.get("accessoryTypeValue"),t.setClass("cw-has-accessory-type",!!r),e.didChangeFor("update","accessoryTypeValue")&&CW.SectionedViewCellAccessoryType.update(r,e,t),e.didChangeFor("update","accessoryTypeButtonActive")&&(r=e.get("accessoryTypeValue"),r&&(n||(n=t.find(".cw-accessory-type")),e.get("accessoryTypeButtonActive")?n.addClass("cw-active"):n.removeClass("cw-active")))}}),SC.BaseTheme.sectionedViewCellRenderDelegate=CW.SectionedViewCellRenderDelegate.create(),CW.SectionedViewCollectionItemCellRenderDelegate=CW.SectionedViewCellRenderDelegate.extend({didRenderCellBody:function(e,t){var n=e.get("isSelectedItem"
);n&&t.addClass("cw-selected-collection-item")},didUpdateCellBody:function(e,t){var n=e.get("isSelectedItem");t.setClass("cw-selected-collection-item",!!n)}}),SC.BaseTheme.sectionedViewCollectionItemCellRenderDelegate=CW.SectionedViewCollectionItemCellRenderDelegate.create(),CW.SectionedViewCoreCell=SC.View.extend(CW.ProxyDisplay,{renderDelegateName:"sectionedViewCoreCellRenderDelegate",proxyDisplayProperties:"isEnabled style selectionStyle escapeHTML".w(),indexPath:null,isHighlighted:NO,isSelected:NO,isEnabled:YES,isEnabledInSectionedView:YES,escapeHTML:YES,style:null,selectionStyle:CW.SectionedViewCellSelectionStyle.BLUE,highlightStyle:CW.SectionedViewCellSelectionStyle.BLUE,owner:null,selectedTarget:null,selectedAction:null,deselectedTarget:null,deselectedAction:null,displayProperties:"isSelected isHighlighted isEnabledInSectionedView highlightStyle".w(),computedDisplayProxyPropertyKey:function(e){return e+"Value"},sectionedViewTapStartForEvent:function(e,t){return NO},sectionedViewTapEndForEvent:function(e,t){return NO},selected:function(){var e=this.get("selectedTarget"),t=this.get("selectedAction");this.handleCellAction(e,t)},deselected:function(){var e=this.get("deselectedTarget"),t=this.get("deselectedAction");this.handleCellAction(e,t)},handleCellAction:function(e,t){if(!t)return;var n=this.getPath("owner.pane"),r=n.get("rootResponder");r.sendAction(t,e,this,n)},isEnabledValue:function(){if(!this.get("isEnabledInSectionedView")||!this.get("isEnabledInPane"))return NO;var e=this.contentPropertyValueForProxiedProperty("isEnabled");return e===undefined?this.get("isEnabledInPane"
):e}.property("isEnabledInPane","isEnabledInSectionedView").cacheable()}),CW.SECTIONED_VIEW_CELL_DEFAULT_ACCESSORY_WIDTH=40,CW.SectionedViewCell=CW.SectionedViewCoreCell.extend({proxyDisplayProperties:"text detailText image accessoryType accessoryIsEnabled accessoryView indentationLevel indentationWidth".w(),content:null,text:null,detailText:null,image:null,accessoryType:null,accessoryView:null,accessoryIsEnabled:YES,style:CW.SectionedViewCellStyle.DEFAULT1,accessoryTypeButtonActive:NO,indentationLevel:0,indentationWidth:22,renderDelegateName:"sectionedViewCellRenderDelegate",displayProperties:"accessoryTypeButtonActive accessoryLayout".w(),accessoryViewValue:function(){var e;return e=this.get("accessoryView"),e?e:(e=this.contentPropertyValueForProxiedProperty("accessoryView"),e)}.property().cacheable(),accessoryValue:function(){var e=this.get("accessoryTypeValue"),t=this.get("accessoryViewValue");return t?t:e?e:null}.property("accessoryTypeValue","accessoryViewValue").cacheable(),accessoryShouldBeEnabled:function(){return!!this.get("isEnabledValue")&&!!this.get("accessoryIsEnabledValue")}.property("isEnabledValue","accessoryIsEnabledValue").cacheable(),accessoryLayout:function(){var e=this.get("accessoryValue");return this._computeAccessoryLayout(e)}.property("accessoryValue").cacheable(),destroy:function(){this.accessoryView=null,this.contentView=null,arguments.callee.base.apply(this,arguments)},createChildViews:function(){var e=[],t;return t=this.createAccessoryView(),t&&(e.pushObject(t),this.beginPropertyChanges(),this.set("accessoryView",t),this.set("childViews",e),this
.endPropertyChanges()),this},_isEnabledValueDidChange:function(){}.observes("isEnabledValue"),createAccessoryView:function(){var e=this.get("accessoryViewValue"),t=this.get("content"),n=this;return!e||!SC.kindOf(e,SC.View)||!e.isClass?null:(e=this.createChildView(e,{layerId:this.get("layerId")+"-accessory",layout:this._computeAccessoryLayout(e),classNames:["cw-accessory"],isEnabledBinding:SC.Binding.oneWay(".parentView.accessoryShouldBeEnabled")}),t&&t.get("isBindingAgent")&&(n=t),e.bindingAgent=n,e)},_computeAccessoryLayout:function(e){if(!e)return null;var t={},n=null,r=SC.typeOf(e);switch(r){case SC.T_OBJECT:n=e.get("layout");break;case SC.T_CLASS:n=e.prototype.layout;break;case SC.T_HASH:n=e.layout}return n=n||{},n?n.width?t.width=n.width:n.left?t.left=n.left:t.width=CW.SECTIONED_VIEW_CELL_DEFAULT_ACCESSORY_WIDTH:t.width=CW.SECTIONED_VIEW_CELL_DEFAULT_ACCESSORY_WIDTH,SC.none(n.centerY)?(t.top=n.top||0,t.bottom=n.bottom||0):(t.centerY=n.centerY,t.height=n.height||0),t.right=n.right||0,t},sectionedViewTapStartForEvent:function(e,t){var n=this.get("accessoryTypeValue"),r=this.get("isEnabledValue");return r&&n&&n.buttonHitTest(this,t)?(this._handlingRowTap=YES,this.set("accessoryTypeButtonActive",YES),YES):NO},sectionedViewTapEndForEvent:function(e,t){var n=this.get("accessoryTypeValue");return this._handlingRowTap?(n&&n.buttonHitTest(this,t)&&e.rowAccessoryButtonTappedAtIndexPath(this.get("indexPath")),this._handlingRowTap=NO,this.set("accessoryTypeButtonActive",NO),YES):NO}}),CW.SectionedViewRow=SC.Object.extend({owner:null,section:null,indexPath:null,cell:null,height:null
,allowsSelection:YES,isEnabled:YES,isEnabledBindingDefault:SC.Binding.oneWay(),content:null,selectedTarget:null,selectedAction:null,deselectedTarget:null,deselectedAction:null,accessoryButtonTappedTarget:null,accessoryButtonTappedAction:null,isBindingAgent:YES,isContent:function(){return!this.get("content")}.property("content").cacheable(),selected:function(e){var t=this.get("selectedTarget"),n=this.get("selectedAction");this.willRespondToSelectedAction(e),this.sendAction(e,t,n),this.didRespondToSelectedAction(e)},willRespondToSelectedAction:function(e){},didRespondToSelectedAction:function(e){},deselected:function(e){var t=this.get("deselectedTarget"),n=this.get("deselectedAction");this.willRespondToDeselectedAction(e),this.sendAction(e,t,n),this.didRespondToDeselectedAction(e)},willRespondToDeselectedAction:function(e){},didRespondToDeselectedAction:function(e){},accessoryButtonTapped:function(e){var t=this.get("accessoryButtonTappedTarget"),n=this.get("accessoryButtonTappedAction");this.willRespondToAccessoryButtonTappedAction(e),this.sendAction(e,t,n),this.didRespondToAccessoryButtonTappedAction(e)},willRespondToAccessoryButtonTappedAction:function(e){},didRespondToAccessoryButtonTappedAction:function(e){},sendAction:function(e,t,n){if(!n)return;var r=e.get("pane"),i=r.get("rootResponder");i.sendAction(n,t,this,r)}}),CW.SectionedViewButtonRow=CW.SectionedViewRow.extend({title:null,titleBindingDefault:SC.Binding.oneWay(),image:null,imageBindingDefault:SC.Binding.oneWay(),isEnabled:YES,isDefault:NO,isDefaultBindingDefault:SC.Binding.oneWay().bool(),cellstyle:null,cell:CW.SectionedViewCell
.extend({style:CW.SectionedViewCellStyle.BUTTON,styleBinding:SC.Binding.transform(function(e){return SC.none(e)?CW.SectionedViewCellStyle.BUTTON:e}).from("*owner.cellStyle"),contentTextKey:"title",performKeyEquivalent:function(e,t){if(!this.get("isVisibleInWindow"))return NO;if(!this.get("isEnabled"))return NO;var n=this.get("content"),r=n.get("isDefault"),i=n.get("selectedAction"),s=n.get("selectedTarget");return r&&e==="return"&&n.sendAction(this.owner,s,i),NO}}),willRespondToSelectedAction:function(e){e.deselectRowAtIndexPath(this.get("indexPath"))}}),CW.SectionedViewSelectRow=CW.SectionedViewRow.extend({title:null,value:null,items:null,itemTitleKey:"title",itemImageKey:"image",itemValueKey:"value",style:CW.SectionedViewCellStyle.DEFAULT2,cell:CW.SectionedViewCell.extend({contentTextKey:"title",accessoryType:CW.SectionedViewCellAccessoryType.DISCLOSURE_INDICATOR}),_valueDidChange:function(){var e=this.get("value"),t=this.get("items"),n=t.length,r=this.get("itemTitleKey"),i=this.get("itemValueKey"),s=this.get("itemImageKey"),o=null,u;if(!i&&SC.typeOf(e)===SC.T_NUMBER&&e>=0&&e<n)o=t[e];else if(i)for(u=0;u<n;u+=1)if(t[u][i]===e){o=t[u];break}var a=SC.typeOf(o),f=null,l=null;a===SC.T_HASH?(f=o[r],l=o[s]):a===SC.T_OBJECT?(f=o.get(r),l=o.get(s)):SC.none(o)||(f=o),this.beginPropertyChanges(),this.set("detailText",f),this.set("image",l),this.endPropertyChanges()}.observes("value")}),CW.SectionedViewSwitcherRow=CW.SectionedViewRow.extend(CW.SwitcherAccessoryViewSupport,{title:null,value:null,allowsSelection:NO,cell:CW.SectionedViewCell.extend({contentTextKey:"title"})}),CW.SectionedViewTextFieldRow=
CW.SectionedViewRow.extend({value:null,title:null,hint:null,hintBindingDefault:SC.Binding.oneWay(),isPassword:NO,isPasswordBindingDefault:SC.Binding.bool().oneWay(),spellCheckEnabled:NO,spellCheckEnabledBindingDefault:SC.Binding.bool().oneWay(),autoCorrect:YES,autoCorrectBindingDefault:SC.Binding.bool().oneWay(),autoCapitalize:YES,autoCapitalizeBindingDefault:SC.Binding.bool().oneWay(),type:"text",textBindingDefault:SC.Binding.oneWay(),layout:null,defaultLayout:{left:14,top:5,bottom:5,right:14},allowsSelection:NO,accessoryViewExample:SC.TextFieldView.extend({themeName:"iOS",hintBinding:SC.Binding.oneWay(".bindingAgent.hint"),isPasswordBinding:SC.Binding.oneWay(".bindingAgent.isPassword"),valueBinding:".bindingAgent.value",spellCheckEnabledBinding:SC.Binding.oneWay(".bindingAgent.spellCheckEnabled"),autoCorrectBinding:SC.Binding.oneWay(".bindingAgent.autoCorrect"),autoCapitalizeBinding:SC.Binding.oneWay(".bindingAgent.autoCapitalize")}),cell:CW.SectionedViewCell.extend({style:CW.SectionedViewCellStyle.TEXT_FIELD,contentTextKey:"title"}),accessoryView:function(){var e=this.get("accessoryViewExample"),t=this.get("layout")||{},n=SC.clone(this.get("defaultLayout")),r=t.left,i=t.right,s=t.top,o=t.bottom;return SC.none(r)||(n.left=r),SC.none(i)||(n.right=i),SC.none(s)||(n.top=s),SC.none(o)||(n.bottom=o),e.extend({type:this.get("type"),layout:n})}.property("accessoryViewExample").cacheable()}),CW.SectionedViewSection=SC.Object.extend({owner:null,index:0,rows:[],footerTitle:null,autoResizeFooterTitle:NO,headerTitle:null,autoResizeHeaderTitle:NO,footerView:null,headerView:null,footerHeight
:null,headerHeight:null,allowsSelection:YES,isVisible:YES,isCellDisplayDelegate:YES,cell:null,init:function(){arguments.callee.base.apply(this,arguments),this.createRows()},rowForIndex:function(e){return this.get("rows").objectAt(e)},createRows:function(){var e=(this.get("rows")||[]).slice();for(var t=0,n=e.length;t<n;t+=1){var r=e[t],i=this.createRow(this[r],t);if(!i)throw'section has an invalid row "%@" for rows[%@]'.fmt(r,t);e[t]=this[r]=i}this.set("rows",e)},createRow:function(e,t,n){n=n||{};if(SC.kindOf(e,CW.SectionedViewCoreCell)&&e.isClass){var r=e;e=CW.SectionedViewRow.extend({isContent:NO,cell:r})}else if(!SC.kindOf(e,CW.SectionedViewRow)||!e.isClass)return null;return e=e.create(n,{owner:this.get("owner"),section:this,indexPath:CW.IndexPath.create({section:this.get("index"),row:t})}),e},destoryRows:function(){var e=this.get("rows")||[];e.forEach(function(e){e.destroy()},this),this.set("rows",[])},reload:function(){this.destoryRows(),this.createRows(),this.get("owner").reloadSection(this.get("index"))},displayDelegateForRow:function(e){return this.get("isDisplayDelegate")?this:null},sectionedViewWillSetupAllCells:function(e){},sectionedViewDidSetupAllCells:function(e){},sectionedViewWillTearDownAllCells:function(e){},sectionedViewDidTearDownAllCells:function(e){}}),CW.SectionedViewButtonSection=CW.SectionedViewSection.extend({title:null,titleBindingDefault:SC.Binding.oneWay(),image:null,imageBindingDefault:SC.Binding.oneWay(),isEnabled:YES,isEnabledBindingDefault:SC.Binding.oneWay(),isDefault:NO,isDefaultBindingDefault:SC.Binding.oneWay().bool(),selectedTarget:null,
selectedAction:null,buttonRow:CW.SectionedViewButtonRow,cellStyle:null,createRows:function(){var e=this.get("buttonRow");e=this.createRow(e,0,{titleBinding:".section.title",imageBinding:".section.image",isEnabledBinding:".section.isEnabled",isDefaultBinding:".section.isDefault",selectedTarget:this.get("selectedTarget"),selectedAction:this.get("selectedAction"),style:this.get("cellStyle")}),this.beginPropertyChanges(),this.set("rows",[e]),this.set("buttonRow",e),this.endPropertyChanges()}}),CW.SectionedViewCollectionItemCell=CW.SectionedViewCell.extend({renderDelegateName:"sectionedViewCollectionItemCellRenderDelegate",isSelectedItem:NO,accessoryType:function(){var e=this.get("isSelectedItem");return e?CW.SectionedViewCellAccessoryType.DETAIL_CHECKMARK:null}.property("isSelectedItem"),displayProperties:"isSelectedItem".w()}),CW.SectionedViewCollectionSection=CW.SectionedViewSection.extend(SC.DelegateSupport,CW.SVCollectionSectionDelegate,{content:null,selection:null,delegate:null,target:null,action:null,retainItemSelection:NO,itemsHeaderRow:null,itemsHeaderHeight:null,itemsHeaderCell:null,itemsFooterRow:null,itemsFooterCell:null,itemsFooterHeight:null,itemRowHeight:null,itemCellExample:CW.SectionedViewCollectionItemCell,retainedItemSelectionStyle:CW.SectionedViewCellSelectionStyle.BLUE,normalizedBasicItemValueKey:"text",hasItemsHeader:function(){return this.get("itemsHeaderRow")||this.get("itemsHeaderCell")}.property("itemsHeaderRow","itemsHeaderCell").cacheable(),hasItemsFooter:function(){return this.get("itemsFooterRow")||this.get("itemsFooterCell")}.property("itemsFooterRow"
,"itemsFooterCell").cacheable(),collectionSectionDelegate:function(){var e=this.get("delegate");return this.delegateFor("isSVCollectionSectionDelegate",e)}.property("delegate").cacheable(),createRows:function(){var e=[],t=this._createItemRows(),n=this._createHeaderRow(),r=this._createFooterRow();n&&e.push(n),t&&e.pushObjects(t),r&&e.push(r),this._itemsHeaderRow=n,this._itemsFooterRow=r,this._itemRows=t,this.set("rows",e)},_createItemRows:function(){var e=[],t=this.get("content")||[],n=this.get("collectionSectionDelegate"),r=CW.SectionedViewCellSelectionStyle.NONE,i=CW.SectionedViewCollectionSection,s=i._ItemRow,o;return this.get("retainItemSelection")&&(r=this.get("retainedItemSelectionStyle")),t.forEach(function(t,i){var u=n.collectionSectionCellForContentAtIndex(this,t,i);u||(u=this.get("itemCellExample"));var a=n.collectionSectionRowHeightForContentAtIndex(this,t,i);a||(a=this.get("itemRowHeight")),i+=this.get("hasItemsHeader")?1:0;var f=this._normalizeItem(t);f.set("selectionStyle",r),o=this.createRow(s,i,{content:f,cell:u,height:a}),o._svcs_originalItem=t,e.push(o)},this),e},_normalizeItem:function(e){var t=SC.typeOf(e);if(t===SC.T_OBJECT)return e;if(t===SC.T_HASH)return SC.Object.create(e);var n={};return n[this.get("normalizedBasicItemValueKey")]=e,SC.Object.create(n)},_createHeaderRow:function(){var e=this.get("itemsHeaderRow"),t=this.get("itemsHeaderCell"),n=this.get("itemsHeaderHeight");if(t)e=CW.SectionedViewRow.extend({isContent:NO,cell:t,height:n});else if(!e)return null;return this.createRow(e,0)},_createFooterRow:function(){var e=this.get("itemsFooterRow"),t=this
.get("itemsFooterCell"),n=this.get("itemsFooterHeight");if(t)e=CW.SectionedViewRow.extend({isContent:NO,cell:t,height:n});else if(!e)return null;var r=0,i=this.get("content")||[];return this.get("hasItemsHeader")&&(r+=1),r+=i.get("length"),this.createRow(e,r)},_itemsDidChange:function(){this.reload(),this._selectionDidChange()}.observes("*content.[]"),_selectionDidChange:function(){var e=this.get("owner"),t=this.get("selection"),n,r;r=this._selectedRow,r&&(n=e.cellForRowAtIndexPath(r.get("indexPath")),n&&n.set("isSelectedItem",NO)),r=this.rowForItem(t),r&&(n=e.cellForRowAtIndexPath(r.get("indexPath")),n&&n.set("isSelectedItem",YES)),this._selectedRow=r}.observes("selection"),rowForItem:function(e){var t=this.get("content")||[],n=this._itemRows||[],r=e?t.indexOf(e):-1;return r>=0?n[r]:null},selectItemRow:function(e){var t=this.get("owner"),n=this.get("target"),r=this.get("action");this.set("selection",e._svcs_originalItem),this.invokeLast(function(){e.sendAction(t,n,r)})},sectionedViewDidSetupAllCells:function(e){this._selectionDidChange()},displayDelegateForRow:function(e){return e=this.rows[e],this._itemRows.indexOf(e)>=0?this:null}}),CW.SectionedViewCollectionSection._ItemRow=CW.SectionedViewRow.extend({selected:function(e){this.get("section").selectItemRow(this)}}),CW.SectionedView=SC.ScrollView.extend(CW.SectionedViewDelegate,CW.SectionedViewDataSource,CW.SectionedViewMonitor,{classNames:"cw-sectioned-view".w(),datasource:null,delegate:null,selection:null,allowsSelection:YES,rowHeight:44,style:null,sectionHeaderHeight:25,sectionFooterHeight:25,sectionHeaderViewExample:SC
.LabelView,sectionFooterViewExample:SC.LabelView,headerView:null,footerView:null,headerHeight:18,footerHeight:18,rowCellExample:CW.SectionedViewCell,anchorLastSectionToBottom:NO,monitor:null,contentView:SC.View,styleValue:function(){var e=this.get("style");return e?e:CW.SectionedViewStyle.NONE}.property("style").cacheable(),sectionedViewDelegate:function(){var e=this.get("delegate");return this.delegateFor("isSectionedViewDelegate",e)}.property("delegate").cacheable(),sectionedViewDataSource:function(){var e=this.get("dataSource");return this.delegateFor("isSectionedViewDataSource",e)}.property("dataSource").cacheable(),sectionedViewMonitor:function(){var e=this.get("monitor");return this.delegateFor("isSectionedViewMonitor",e)}.property("monitor").cacheable(),reloadData:function(){this.clearSelection(),this._updateContentView(),this.invokeLast(function(){this.refreshLayout()})},reloadSection:function(e){var t=this._allSectionBlocks;if(!t)return;var n=t[e],r=n.get("views")||[],i=r.length,s=this.get("contentView"),o=s.get("childViews")||[],u=o.length,a=null,f=i>0?i[i-1]:null,l=o.indexOf(f);l>-1&&l<u-1&&(a=o[l+1]),s.beginPropertyChanges(),r.forEach(function(e){s.removeChild(e)},this),n.reload(),r=n.get("views")||[],r.forEach(function(e){s.insertBefore(e,a),a=e},this),this._readjustAllBlocks(),s.endPropertyChanges(),this.invokeLater(function(){this.refreshLayout()})},reloadRowAtIndexPath:function(e){},didAppendToDocument:function(){var e=this;this.invokeLater(function(){e.refreshLayout()})},refreshLayout:function(){var e=this._blocks||[];e.forEach(function(e){e.updateHeightIfNeeded
()}),this._readjustAllBlocks()},cellForRowAtIndexPath:function(e){var t=this._allSectionBlocks,n=e?e.get("section"):null,r=e?e.get("row"):null,i,s;return!e||!t||n>t.length-1?null:(i=t[n],s=i.rows,!s||r>s.length-1?null:s[r])},cellForEvent:function(e){var t=e.target,n=this.get("layer"),r=t,i,s;while(r&&r!==n&&r!==document){if((s=r.id)&&(i=SC.View.views[s])&&i.isSectionedViewCell)return i;r=r.parentNode}return null},deselectRowAtIndexPath:function(e){if(!this.get("allowsSelection")||!e)return;if(!this.validIndexPath(e))return;this.clearSelection()},selectRowAtIndexPath:function(e){if(!this.get("allowsSelection")||!e)return;this.propertyWillChange("selection");var t=this.cellForRowAtIndexPath(e);if(!t)return;this.propertyWillChange("selection"),this.clearSelection(),t.set("isSelected",YES),this.set("selection",e),this.propertyDidChange("selection")},clearSelection:function(){var e=this.get("selection"),t;if(!e)return;t=this.cellForRowAtIndexPath(e),t&&t.set("isSelected",NO),this.set("selection",null)},validIndexPath:function(e){var t,n,r,i,s,o=this.get("sectionedViewDataSource");return e?(n=o.get("sections"),t=n?n.length:0,r=e.get("section"),r<0||r>=t?NO:(i=n[r].rows,t=i?i.length:0,s=e.get("row"),s<0||s>=t?NO:YES)):NO},rowTapStartAtIndexPath:function(e){if(!this.get("allowsSelection")||!this.validIndexPath(e))return;var t=this.get("sectionedViewDelegate"),n=this.get("selection"),r,i,s;s=this.cellForRowAtIndexPath(e);if(!s||!s.get("isEnabled"))return;r=t.sectionedViewWillSelectRowAtIndexPath(this,e),n&&(i=t.sectionedViewWillDeselectRowAtIndexPath(this,n)),s=this.cellForRowAtIndexPath
(r);if(!s)return;this._rowTapInfo={selectIndexPath:r,deselectIndexPath:i,cell:s},s.set("isHighlighted",YES)},rowTapEndAtIndexPath:function(e){var t=this.get("sectionedViewDelegate"),n=this._rowTapInfo||{},r=n.selectIndexPath,i=n.deselectIndexPath,s;e&&e.equals(r)&&(this._removeHighlightFromTappedRow(),this.selectRowAtIndexPath(r),t.sectionedViewDidSelectRowAtIndexPath(this,r),i&&t.sectionedViewDidDeselectRowAtIndexPath(this,i),s=this.cellForRowAtIndexPath(i),s&&s.deselected(this),s=this.cellForRowAtIndexPath(r),s&&s.selected(this)),this._cleanupRowTap()},cancelRowTap:function(){this._cleanupRowTap()},_cleanupRowTap:function(){this._removeHighlightFromTappedRow(),this._rowTapInfo=null},_removeHighlightFromTappedRow:function(){var e=this._rowTapInfo||{},t=e.cell;t&&t.set("isHighlighted",NO)},rowAccessoryButtonTappedAtIndexPath:function(e){var t=this.get("sectionedViewDelegate");t.sectionedViewAccessoryButtonTappedForRowAtIndexPath(this,e)},render:function(e,t){var n=this.get("styleValue"),r=n.get("classNames");t&&e.addClass(r)},createChildViews:function(){return arguments.callee.base.apply(this,arguments),this.invokeLast(function(){this._setupContentView()},this),this},destroy:function(){this._tearDownContentView(),arguments.callee.base.apply(this,arguments)},_updateContentView:function(){var e=this.get("sectionedViewMonitor");e.sectionedViewWillUpdateContentView(this),this._tearDownContentView(),this._setupContentView(),e.sectionedViewDidUpdateContentView(this)},_setupContentView:function(){var e=this.get("contentView"),t=this.get("sectionedViewMonitor"),n=this.get("sectionedViewDelegate"
),r=[];t.sectionedViewWillSetupContentView(this),n.sectionedViewWillSetupAllCells(this),this._headerBlock=this._createHeaderBlock(),this._footerBlock=this._createFooterBlock(),this._sectionBlocks=this._createSectionBlocks();var i=[];i.push(this._headerBlock),i.pushObjects(this._sectionBlocks),i.push(this._footerBlock),this._blocks=i,i.forEach(function(e){e.setup(),r.pushObjects(e.get("views"))}),e.beginPropertyChanges();var s=this.get("styleValue"),o=s.get("contentLayout");e.adjust({right:o.right||0,left:o.left||0}),e.set("childViews",r),e.endPropertyChanges(),this._readjustAllBlocks(),e.replaceLayer(),n.sectionedViewDidSetupAllCells(this),t.sectionedViewDidSetupContentView(this)},_frameDidChange:function(){var e=this._readjustAnchoredBottomBlocks();if(e){var t=this.get("contentView");t.adjust("height",e)}}.observes("frame"),_heightOfAllBlocksWithPadding:function(){var e=this.get("styleValue"),t=e.get("contentLayout"),n=t.top||0,r=t.bottom||0;return this._heightOfAllBlocks()+n+r},_heightOfAllBlocks:function(){var e=this._blocks,t=e?e.length:0;return this._heightOfBlocksToIndex(t-1)},_heightOfBlocksToIndex:function(e){var t=this._blocks,n=t?t.length:0,r=0;if(e>=n)throw"invalid index: "+e;for(var i=0;i<=e;i+=1)r+=t[i].get("height");return r},_heightOfBlocksFromIndex:function(e){var t=this._blocks,n=t?t.length:0,r=0;if(e>=n)throw"invalid index: "+e;for(var i=e;i<n;i+=1)r+=t[i].get("height");return r},_readjustAllBlocks:function(){var e=this.get("styleValue"),t=e.get("contentLayout");this._readjustBlockFromIndex(0,t.top||0);var n=this._readjustAnchoredBottomBlocks();n||(n=this._heightOfAllBlocksWithPadding
());var r=this.get("contentView");r.adjust("height",n)},_readjustBlockFromIndex:function(e,t){var n=this._blocks,r=n?n.length:0;if(e>=r)return;this._readjustBlockRegion(e,r-1,t)},_readjustAnchoredBottomBlocks:function(){if(!this.get("anchorLastSectionToBottom"))return;var e=this.get("sectionedViewDataSource"),t=e.numberOfSectionsInSectionedView(this),n=this.get("frame").height,r=this._blocks;if(!r)return;var i=r.length;if(t<2)return;var s=i-2;if(this._heightOfAllBlocksWithPadding()>=n){this._readjustBlockFromIndex(s);return}var o=this.get("styleValue"),u=o.get("contentLayout"),a=u.bottom||0,f=this._heightOfBlocksFromIndex(s);return top=n-f-a,this._readjustBlockRegion(s,i-1,top),n},_readjustBlockRegion:function(e,t,n){var r=this._blocks,i=r.length;if(e<0||t>=i)throw"invalid argument provided";var s=n>=0;for(var o=e;o<=t;o+=1){var u=r[o],a=o-1>=0?r[o-1]:null,f=a?a.get("top")+a.get("height"):0;s||(n=a?f:0),u.readjustFromTop(n),s=!1}},_createHeaderBlock:function(){return CW.SectionedViewHeaderBlock.create({sectionedView:this})},_createFooterBlock:function(){return CW.SectionedViewFooterBlock.create({sectionedView:this})},_createSectionBlocks:function(){var e=this.get("sectionedViewDataSource"),t=e.numberOfSectionsInSectionedView(this),n=[],r=[],i;for(var s=0;s<t;s+=1)i=CW.SectionedViewSectionBlock.create({sectionedView:this,sectionIndex:s}),e.sectionedViewSectionIsVisible(this,s)&&n.push(i),r.push(i);return this._allSectionBlocks=r,n},_tearDownContentView:function(){var e=this.get("sectionedViewMonitor"),t=this.get("sectionedViewDelegate");e.sectionedViewWillTearDownContentView(
this),t.sectionedViewWillTearDownAllCells(this),this._tearDownAllBlocks(),t.sectionedViewDidTearDownAllCells(this),e.sectionedViewDidTearDownContentView(this)},_tearDownAllBlocks:function(){var e=this.get("contentView");e.beginPropertyChanges(),e.removeAllChildren();var t=this._blocks||[];t.forEach(function(e){e.tearDown()}),e.endPropertyChanges()},mouseDown:function(e){return this._handleTapStartForEvent(e)},mouseUp:function(e){return this._handleTapEndForEvent(e)},touchStart:function(e){var t=e.averagedTouchesForView(this,YES),n={event:e,handled:NO,x:t.x,y:t.y};this._touchStartInfo=n;var r=this;return setTimeout(function(){SC.RunLoop.begin(),r._handleTouchStart(),SC.RunLoop.end()},100),arguments.callee.base.apply(this,arguments)},touchesDragged:function(e,t){arguments.callee.base.apply(this,arguments);var n=e.averagedTouchesForView(this),r=this._touchStartInfo;return r?(r.touchDragged=YES,Math.abs(r.y-n.y)>3&&(this._touchStartInfo=null,this.cancelRowTap()),YES):YES},touchEnd:function(e){var t=e.averagedTouchesForView(this),n=this._touchStartInfo;return n&&(n.handled?this._handleTapEndForEvent(e):n.touchDragged||this.invokeLater(function(){this._handleTapStartForEvent(n.event),this.invokeLater(function(){this._handleTapEndForEvent(e)},100)},10)),this._touchStartInfo=null,arguments.callee.base.apply(this,arguments)},_handleTouchStart:function(){var e=this._touchStartInfo;if(!e)return;e.handled=YES,this._handleTapStartForEvent(e.event)},_handleTapStartForEvent:function(e){var t={};this._tapStartInfo=t;var n=this.cellForEvent(e);return n?(t.cell=n,n.tryToPerform("sectionedViewTapStartForEvent"
,this,e)?(t.cellHandlingRowTap=YES,YES):(this.rowTapStartAtIndexPath(n.get("indexPath")),YES)):(this._tapStartInfo=null,NO)},_handleTapEndForEvent:function(e){if(!this._tapStartInfo)return NO;var t=this._tapStartInfo,n=t.cell,r;return this._tapStartInfo=null,t.cellHandlingRowTap&&n.sectionedViewTapEndForEvent?n.sectionedViewTapEndForEvent(this,e):(n=this.cellForEvent(e),n&&(r=n.get("indexPath")),this.rowTapEndAtIndexPath(r),YES)},_cw_sv_isEnabledChanged:function(){var e=this._sectionBlocks||[],t=this.get("isEnabled");e.forEach(function(e){var n=e.rows||[];n.forEach(function(e){e.set("isEnabledInSectionedView",t)})})}.observes("isEnabled")}),CW.IndexPath=SC.Object.extend(SC.Copyable,{section:null,row:null,copy:function(e){return CW.IndexPath.create({section:this.get("section"),row:this.get("row")})},equals:function(e){return!e||!SC.kindOf(e,CW.IndexPath)?NO:CW.IndexPath.compare(this,e)===0},toString:function(){var e=this.get("row"),t=this.get("section");return"IndexPath(row: %@, section: %@)".fmt(e,t)}}),CW.IndexPath.mixin(SC.Comparable,{compare:function(e,t){var n=SC.kindOf(e,CW.IndexPath),r=SC.kindOf(t,CW.IndexPath);if(!n&&!r)throw"Can not compare. a and b must both be of type CW.IndexPath";return e.get("section")==t.get("section")?e.get("row")===t.get("row")?0:e.get("row")<t.get("row")?-1:1:e.get("section")<t.get("section")?-1:1}}),CW.BorderView=SC.View.extend({classNames:"cw-border-view",renderDelegateName:"borderRenderDelegate"}),CW.iOSPickerPane=SC.PickerPane.extend(CW.Animatability,CW.PaneFadingSupport,{paneFadeInDuration:0,fitPositionToScreenPointer:function(e,t,n){var r=
arguments.callee.base.apply(this,arguments),i=30,s,o=this.get("pointerPos"),u=this.get("pointerPosY");return(o==="perfectLeft"||o==="perfectRight")&&u>=0&&u<i&&(r.y=r.y-i,u+=i),this.set("pointerPosY",u),r},popup:function(e,t,n,r){r||(r=[13,-13,-9,9]),arguments.callee.base.call(this,e,t,n,r)},performKeyEquivalent:function(e,t){switch(e){case"escape":return this.modalPaneDidClick(t),YES;default:return NO}}}),sc_require("navigation_controller"),CW.NavigationBarView=SC.View.extend(CW.Animatability,{classNames:["cw-navigation-bar"],themeNameBinding:".parentView.associatedView.navigationBarTheme",childViews:"barContainer".w(),barContainer:SC.View.design({childViews:"title leftBarButton rightBarButton".w(),classNames:"cw-bar-container".w(),layout:function(){var e=this.get("parentView");while(e){if(e.kindOf(CW.iOSPickerPane))return{top:0,left:0};e=e.get("parentView")}return{top:0,left:0,right:0}}.property(),title:SC.LabelView.design({classNames:["cw-navigation-bar-item","cw-navigation-bar-title"],textAlign:SC.ALIGN_CENTER,escapeHTMLBinding:".parentView.parentView.associatedView.escapeHTML",iconBinding:".parentView.parentView.associatedView.icon",valueBinding:".parentView.parentView.associatedView.title",ariaRole:"heading"}),leftBarButton:SC.ButtonView.design(SC.AutoResize,{layout:{top:0,left:0,bottom:0,width:60},autoResizePadding:8,classNames:["cw-navigation-bar-item"],themeNameBinding:".parentView.parentView.associatedView.leftBarButtonTheme",isVisibleBinding:".parentView.parentView.associatedView.realHasLeftBarButton",isEnabledBinding:".parentView.parentView.associatedView.realLeftBarButtonIsEnabled"
,titleBinding:".parentView.parentView.associatedView.leftBarButtonTitle",targetBinding:".parentView.parentView.associatedView.leftBarButtonTarget",actionBinding:".parentView.parentView.associatedView.leftBarButtonAction",maxWidthBinding:".parentView.parentView.associatedView.leftBarButtonMaxWidth"}),rightBarButton:SC.ButtonView.design(SC.AutoResize,{layout:{top:0,right:0,bottom:0,width:60},autoResizePadding:10,classNames:["cw-navigation-bar-item"],themeNameBinding:".parentView.parentView.associatedView.rightBarButtonTheme",isVisibleBinding:".parentView.parentView.associatedView.realHasRightBarButton",isEnabledBinding:".parentView.parentView.associatedView.realRightBarButtonIsEnabled",titleBinding:".parentView.parentView.associatedView.rightBarButtonTitle",targetBinding:".parentView.parentView.associatedView.rightBarButtonTarget",actionBinding:".parentView.parentView.associatedView.rightBarButtonAction",maxWidthBinding:".parentView.parentView.associatedView.rightBarButtonMaxWidth"}),didCreateLayer:function(e){e&&e();var t=this;this.invokeLater(function(){t.performLayout()})}.enhance(),performLayout:function(){var e=this.get("leftBarButton"),t=this.get("rightBarButton"),n=this.get("title"),r=this._computeRequiredButtonWidth(e),i=this._computeRequiredButtonWidth(t),s=this._computeRequiredTitleWidth(),o=this.getPath("parentView.frame.width"),u=CW.NavigationBarView.LEFT_BUTTON_PADDING,a=CW.NavigationBarView.RIGHT_BUTTON_PADDING,f=CW.NavigationBarView.TITLE_BUTTON_PADDING,l=s/2+u+f+r,c=s/2+a+f+i;l<=o/2&&c<=o/2?n.set("layout",{left:0,right:0,centerX:0}):n.set("layout",{left:u+f+Math
.max(r,CW.NavigationBarView.MIN_TITLE_PADDING),right:a+f+Math.max(i,CW.NavigationBarView.MIN_TITLE_PADDING),centerX:0})},_computeRequiredTitleWidth:function(){var e=this.get("title");if(SC.none(e))return 0;var t=e.get("autoResizeLayer");return SC.none(t)?0:SC.metricsForString(e.get("value"),t,e.get("classNames"),e.get("escapeHTML")).width},_computeRequiredButtonWidth:function(e){return SC.none(e)||!e.get("isVisible")?0:e.getPath("frame.width")}})}),CW.NavigationBarView.LEFT_BUTTON_PADDING=5,CW.NavigationBarView.RIGHT_BUTTON_PADDING=5,CW.NavigationBarView.TITLE_BUTTON_PADDING=5,CW.NavigationBarView.MIN_TITLE_PADDING=40,CW.NavigationView=SC.View.extend(CW.Animatability,{classNames:["cw-navigation-view"],navigationController:null,navigationBar:null,navigationBarHeight:44,actionSheetContent:null,contentView:null,wellViewClassType:CW.BorderView,init:function(){var e=this.get("navigationController"),t=this.get("contentView");e.set("navigationView",this),arguments.callee.base.apply(this,arguments)},createChildViews:function(){var e=this.get("wellViewClassType"),t=this.get("navigationBarHeight"),n={top:t,left:0,right:0,bottom:0},r=this.createChildView(e,{layout:n,classNames:["cw-navigation-well"]});this.set("well",r),this.childViews=[r]},didCreateLayer:function(){var e=this.get("contentView").create();this.get("navigationController").push(e,NO)}}),CW.NOTIFICATION_AUTOMATICALLY_DISMISS_DELAY=8e3,CW.iOSNotification=SC.PanelPane.extend(CW.SpritePreloadEnforcement,CW.Animatability,CW.PaneAnimationSupport).extend({acceptsKeyPane:NO,ariaRole:null,isIOSNotification:YES,hasBeenSeen:NO,isDismissable
:YES,automaticallyDismiss:YES,dismissNotificationOnMouseClickAndDrag:YES,icon:undefined,iconWidth:29,iconHeight:29,iconInset:15,message:undefined,rightMarginForMessageText:29,_textDistanceFromDismissButton:null,description:undefined,notificationContainer:function(){return this.get("parentElement")||window.$("[role=alert]")[0]||document.body}.property("parentElement").cacheable(),shouldAdornEndingDescriptionLinkWithArrow:YES,dismiss:function(e){this.remove(),this.didDismiss(this,e)},didDismiss:function(){},action:function(){},hiddenState:function(){return{top:-this.get("frame").height-31}}.property(),showingState:{top:1},MAX_WIDTH:1093,MIN_WIDTH:500,MIN_HEIGHT:55,maxWidth:Infinity,minimumSideClearance:100,layout:{centerX:0},isModal:NO,classNames:"ios-notification".w(),_isClicked:NO,_mouseDragUpwardsCount:null,windowResized:function(){var e=this.get("currentWindowSize"),t,n;if(!e||!e.width)return;try{t=CloudOS.MIN_WIDTH||COS.MIN_WIDTH||950}catch(r){t=950}n=Math.max(t,e.width),this.set("maxWidth",Math.max(this.MIN_WIDTH,Math.min(n-this.get("minimumSideClearance")*2,this.MAX_WIDTH)))}.observes("currentWindowSize","minimumSideClearance"),_hideMask:function(){CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,{element:this._mask,to:0,duration:100}).start()},_showMask:function(){CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,{element:this._mask,to:.15,duration:100}).start()},mouseDown:function(e){return this._mask?(this._isClicked=YES,this.get("dismissNotificationOnMouseClickAndDrag")&&(this._prevEvt=e),this._showMask(),YES):NO},dismissOrAnimateNotificationOnMouseClickAndDrag:function(
e){var t=this.get("dismissNotificationOnMouseClickAndDrag");t&&!SC.none(this._mouseDragUpwardsCount)?(this._mouseDragUpwardsCount>5?this.dismiss():this.animateToTop(),this._mouseDragUpwardsCount=null):(this._icon&&(this._spinner.src=window.devicePixelRatio>1?"/system/cloudos/1812Project43/coreweb/apple_theme_v4/1812Project43/en-us/source/resources/ios/notification/images/ios_notification_spinner@2x.gif":"/system/cloudos/1812Project43/coreweb/apple_theme_v4/1812Project43/en-us/source/resources/ios/notification/images/ios_notification_spinner.gif",CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,{element:this._icon,to:0,duration:200}).start(),CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,{element:this._spinner,to:1,duration:200}).start()),this.get("action")(this))},mouseUp:function(e){if(!this._mask)return;this._isClicked=NO,this._prevEvt=null,this._hideMask();var t=this.get("frame"),n=this.convertFrameFromView({x:e.pageX,y:e.pageY});if(!t||n.x<0||n.y<0||n.x>t.width||n.y>t.height)return;this.dismissOrAnimateNotificationOnMouseClickAndDrag(e)},mouseMoved:function(e,t){return e(t),this.get("dismissNotificationOnMouseClickAndDrag")&&this._isClicked&&this._prevEvt?(!this._mouseDragUpwardsCount||this._mouseDragUpwardsCount>0?(this.adjust("top",this.get("frame").y+t.pageY-this._prevEvt.pageY),this._mouseDragUpwardsCount?this._mouseDragUpwardsCount-=t.pageY-this._prevEvt.pageY:this._mouseDragUpwardsCount=this._prevEvt.pageY<t.pageY?-1:1,this._prevEvt=t):this.animateToTop(),YES):NO}.enhance(),mouseEntered:function(e){if(!this._isClicked)return;return this._showMask(),YES},mouseExited:function(
e){if(!this._isClicked)return;return this._prevEvt=null,this._hideMask(),this.dismissOrAnimateNotificationOnMouseClickAndDrag(e),YES},animateToTop:function(e){this.animate("top",{to:0,duration:250})},render:function(e){for(var t=0,n="";t<9;t++)n+='<div class="'+SC.NINE_SLICE[t]+'"></div>';var r=this.get("message"),i=this._adornStringWithArrowIfNeeded(this._lastDesc=this.get("description"));this._lastMess=r,e.push('<img class="spinner" aria-hidden="true" />'),e.push('<div class="message">'+r+"</div>"),e.push('<div id="sr-alert-description" class="description">'+i+"</div>"),this.get("action")&&e.push('<div class="mask" aria-hidden=true>'+n+"</div>"),this.adjust("zIndex",this.get("isDismissable")?CW.iOSNotification.runningDismissableZIndex++:CW.iOSNotification.runningNonDismissableZIndex++)},displayProperties:"message description icon maxWidth".w(),update:function(){var e,t,n;this._lastMess!==(this._lastMess=e=this.get("message"))&&(this.$(".message")[0].innerHTML=e),this._lastDesc!==(this._lastDesc=t=this.get("description"))&&(this.$(".description")[0].innerHTML=this._adornStringWithArrowIfNeeded(t),n=YES),this.didChangeFor("update","maxWidth")&&(n=YES),n&&this.invokeLast("finishLayerDependentRendering")},didCreateLayer:function(){this._mask=this.$(".mask")[0],this._spinner=this.$(".spinner")[0],this._mask&&CW.Anim.setOpacity(this._mask,0),this._spinner&&CW.Anim.setOpacity(this._spinner,0),this.$(".description")[0].cacheableForMetrics=YES,this.windowResized(),this.get("automaticallyDismiss")&&this.invokeLater(function(){this.get("automaticallyDismiss")&&this.dismiss(YES)},CW.NOTIFICATION_AUTOMATICALLY_DISMISS_DELAY
)},finishLayerDependentRendering:function(){var e=this.get("frame"),t=this.get("layer"),n,r=this.get("icon"),i,s,o,u,a=SC.Locale.currentLocale.get("isRTL");this._lastIconInput!==(this._lastIconInput=r)&&((n=this._icon)&&n.parentNode&&n.parentNode.removeChild(n),this._icon=null);if(!(n=this._icon))if(typeof r=="string"&&r.indexOf("/")!==-1){n=new Image,this._icon=n,n.src=r;var f="z-index:3; position:absolute; "+(a?"right":"left")+":"+this.get("iconInset")+"px; width:"+this.get("iconWidth")+"px; height:"+(o=this.get("iconHeight"))+"px; margin-top:-"+(Math.ceil(o/2)+1)+"px; top:50%;";n.style.cssText=f,n.setAttribute("aria-hidden",!0),t.appendChild(n)}else if(r){typeof r=="string"&&(n=document.createElement("div"),n.className=r,this._icon=n),i=(this._icon||(this._icon=n=r)).style,i.position="absolute";var l=this.get("iconInset")+"px";a?i.right=l:i.left=l,i.top="50%",i.zIndex="3",n.setAttribute("aria-hidden",!0),t.appendChild(n),this.invokeOnce(function(){var e,t;this.set("iconWidth",e=parseInt(jQuery(n).css("width"),0)||this.get("iconWidth")),this.set("iconHeight",t=parseInt(jQuery(n).css("height"),0)||this.get("iconHeight")),i.marginTop=-Math.ceil(t/2)+"px"})}else{this.get("iconWidth")&&this.set("iconWidth",s=0),this.get("iconHeight")&&this.set("iconHeight",o=0);if(u=this._separator)u.parentNode&&u.parentNode.removeChild(u),this._separator=undefined}this.invokeOnce("sizeToText")},sizeToText:function(){var e=this._textDistanceFromDismissButton,t,n,r,i,s=19,o=0,u=0,a=0,f=0,l=0,c=6,h=SC.Locale.currentLocale.get("isRTL");t=2*this.get("iconInset")+this.get("iconWidth")-1,textDistanceFromIconString=
t+"px";if(r=this._message||(this._message=this.$(".message")[0])){var p=r.style;h?p.right=textDistanceFromIconString:p.left=textDistanceFromIconString,o=SC.bestStringMetricsForMaxWidth(r.innerHTML,this.get("maxWidth")-t-e,r,undefined,!0),u=o.height+!!SC.browser.mac*4+!!SC.browser.windows*1,r.style.height=u+"px",o=o.width}if(i=this._description||(this._description=this.$(".description")[0])){var d=i.style;h?d.right=textDistanceFromIconString:d.left=textDistanceFromIconString,a=SC.bestStringMetricsForMaxWidth(i.innerHTML,this.get("maxWidth")-t-e,i,undefined,!0),f=a.height,a=a.width,l=(u||-1)+6+2*!!SC.browser.mozilla,i.style.top=l+"px",i.style.height=f+"px"}var v=Math.max(this.MIN_HEIGHT,c+l+f);this.get("iconHeight")&&(v=Math.round(v/2)*2+(this.get("iconHeight")%2!==0)),this.adjust({width:Math.max(this.MIN_WIDTH,t+e+a,t+e+o),height:v})},animateShow:function(){var e=CW.PaneAnimationSupport.animateShow,t=arguments;this.invokeLast(function(){e.apply(this,t)})},contentView:SC.ImageButtonView.extend(SC.RTLSupport,{classNames:"dismiss".w(),init:function(e){this.set("toolTip","Button.Close".loc()),e()}.enhance(),layoutRecipe:{width:16,height:16,end:6,centerY:0},action:"dismiss"}),append:function(){return this.set("hasBeenSeen",YES),this._isAppended=YES,this.appendTo(this.get("notificationContainer"))},remove:function(){var e=arguments.callee.base.apply(this,arguments);return this._isAppended=NO,CW.iOSNotification.notificationWasRemoved(this),e},replaceWith:function(e){CW.iOSNotification.replaceNotificationWithNotification(this,e)},init:function(){this.get("isDismissable")||(this.contentView=
null);var e=this.get("rightMarginForMessageText");e!==undefined&&(this._textDistanceFromDismissButton=e),arguments.callee.base.apply(this,arguments)},_adornStringWithArrowIfNeeded:function(e){return this.get("shouldAdornEndingDescriptionLinkWithArrow")?e?(e.substring(e.length-4)==="</a>"&&(e=e.substring(0,e.length-4)+'<div class="ios-notification-link-arrow"></div></a>'),e.substring(e.length-5)==="</a>."&&(e=e.substring(0,e.length-5)+'.<div class="ios-notification-link-arrow"></div></a>'),e):"":e}}),SC.mixin(CW.iOSNotification,{runningDismissableZIndex:2e3,runningNonDismissableZIndex:1e3,show:SC.RunLoop.wrapFunction(function(e){var t=e.isIOSNotification?e:this._simpleCreate.apply(this,arguments);return t.append(),t}),queue:[],enqueue:function(e){var t=e.isIOSNotification?e:this._simpleCreate.apply(this,arguments);return t._isInQueue=YES,this.queue.unshift(t),this.updateToQueue(),t},updateToQueue:SC.RunLoop.wrapFunction(function(){var e=this.queue;if(!e.length)return;var t=e[e.length-1];t._isAppended||t.append()}),notificationWasRemoved:function(e){if(this._ignoreRemovals)return;for(var t=0,n=this.queue;this.queue[t];t++)n[t]===e&&n.splice(t,1);this.updateToQueue()},replaceNotificationWithNotification:function(e,t){for(var n=0,r=this.queue,i;i=r[n];n++)if(i===e){r[n]=t,n===r.length-1&&(this._ignoreRemovals=YES,e.remove(),this._ignoreRemovals=NO,t.append());break}},_simpleCreate:function(e,t,n,r,i){var s;return typeof e=="object"?s=this.create.apply(this,arguments):s=this.create({message:e,description:t,icon:n,isDismissable:r!==NO,parentElement:i}),s}}),CW.TouchScrollerView=SC
.TouchScrollerView.extend({touchScrollDidStart:function(){arguments.callee.base.apply(this,arguments),this.$(".thumb").css("opacity",.5)},touchScrollDidEnd:function(){arguments.callee.base.apply(this,arguments),this.$(".thumb").css("opacity",0)}}),SC.ScrollView.prototype.verticalTouchScrollerView=CW.TouchScrollerView,SC.ScrollView.prototype.horizontalTouchScrollerView=CW.TouchScrollerView,function(){var e="cloudkit/first_run";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:["coreweb/timezone_picker","cloudkit/photo"],styles:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/stylesheet.css"],styles2x:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/stylesheet@2x.css"],scriptURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/",stringURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/",isPrefetched:YES})}(),function(){var e="coreweb/timezone_picker";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/stylesheet.css"],styles2x:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/stylesheet@2x.css"],scriptURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/",stringURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/"
,isPrefetched:YES})}(),function(){var e="cloudkit/photo";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:[],styles2x:[],scriptURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/photo/1812Project43/en-us/",stringURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/photo/1812Project43/en-us/",isPrefetched:YES})}(),COS=SC.Object.create({NAMESPACE:"COS",VERSION:"1.0.0",init:function(){arguments.callee.base.apply(this,arguments),this.setupMinWidthAndHeight(),this.statsController=CK.StatsController.create({statSessionId:this.statSessionId,includedParams:function(){var e=COS.authController,t=e.getPath("user.isLiteAccount"),n=e.get("signupOriginApp"),r={},i=window.CloudOSBootstrap&&CloudOSBootstrap.isTermsAndConditionUrl&&URI(window.location.href).hash().split("/").lastObject()==="gc";return SC.none(t)||(r.isLiteAccount=t),SC.none(n)||(r.originApp=n),i&&(r.isGameCenterTermsUrl=!0),r}.property("COS.authController.user")}),CK.errorCatcher.exceptionCallback=function(e){COS.statsController.recordStat(e.applicationName,"ErrorReport",{errorType:e.origin})},this.scheduleStatSessionIdUpdateTimer()},CLIENT_ID:CW.upperCaseUUID(),statSessionId:CW.upperCaseUUID(),REVALIDATE_INTERVAL:1800,REFRESH_WEB_AUTH_INTERVAL:1500,STAT_SESSION_ID_UPDATE_INTERVAL:28800,PUSH_RETRY_WAIT:10,MIN_WIDTH:null,DESKTOP_MIN_WIDTH:950,MOBILE_MIN_WIDTH:320,MIN_HEIGHT:null,DESKTOP_MIN_HEIGHT:700,MOBILE_MIN_HEIGHT:460,MAX_VALIDATE_RETRIES:1,MAX_LOGIN_RETRIES:1,MAX_PREFERENCES_RETRIES:1,setupMinWidthAndHeight:function(
){window.CloudOSBootstrap&&CloudOSBootstrap.isOnSupportedMobile?(this.MIN_WIDTH=this.MOBILE_MIN_WIDTH,this.MIN_HEIGHT=this.MOBILE_MIN_HEIGHT):(this.MIN_WIDTH=this.DESKTOP_MIN_WIDTH,this.MIN_HEIGHT=this.DESKTOP_MIN_HEIGHT)},FONT_CHECK_DURATION:4,getCredentialsFromHash:function(){var e=window.location.hash.match(/:(.*?)(\/.*)?$/);if(!e)return null;var t=URI.parseQuery(e[1]),n=null,r=t.user||t.username,i=t.pass||t.password,s=!!t.extended||!!t.extendedLogin;if(r&&i){n={username:r,extendedLogin:s};if(SC.buildMode==="production"&&!CK.readCookie("ALLOW_CREDENTIALS"))return SC.warn("Ignoring credentials in URL hash"),n;n.password=i}return n},handleApplicationCrash:function(e){CK.errorCatcher._handleError(e)},cloudOSStateForApp:function(e){var t=COS.authController,n=COS.regionController,r=CK.meCardController,i=t.get("accountPreferences"),s=COS.appsController.getAppInfoFor(e),o=t.get("secureChannelInfoData"),u={authBag:t._auth_bag,meCard:r?r.get("meCard"):null,quotaData:t._quota_data,versions:window.VERSIONS,regionFormattingRules:n.regionFormattingRules,regionFormattingRulesVersion:n.localeVersion,regionFormattingRulesBaseUrl:n.localeURL,accountPreferences:i?i.prefsHash(YES):null,appPreferences:COS.prefsController.allAppPreferencesHash(),accountMenu:{items:[{title:"AccountMenu.AccountSettings".loc(),target:"CloudOS",action:"showAccountSettings",disableWhenCurrentApp:"settings"},{title:"AccountMenu.SignOut".loc(),target:"CloudOS",action:"performLogout"}],width:200},requestedStartupUrl:s?s.get("requestedStartupUrl"):null,requestedStartupInfo:s?s.get("requestedStartupInfo"):null,environment
:t.get("environment"),route:function(){if(CloudOS.appManagerFor)return CloudOS.appManagerFor(e).get("route");var t=window.location.hash,n=t?t.substring(1):null;return n}(),displayName:function(){if(CloudOS.appManagerFor)return CloudOS.appManagerFor(e).get("displayName")}(),currentlyActiveApplication:e,hostname:CloudOS.get("hostname")||window.location.hostname,clientId:this.CLIENT_ID,userAuthenticationState:t.get("userAuthenticationState"),appsInfo:function(){var e=COS.apps,t=[],n,r;for(n in e){r=COS.appsController.getAppInfoFor(n);if(!r){SC.warn("No appInfo for %@",n);continue}t.push(CK.AppInfo.serializeAsHash(r))}return t}(),userStatusCode:t.getPath("user.statusCode"),isBeta:CK.get("isBeta"),isFuture:CK.get("isFuture"),isCarry:CK.get("isCarry"),isCarryUser:t.get("isCarryUser"),availableLocales:this.filterLocales(COS.get("availableLocales")),localesSupportedByAllApps:this.filterLocales(COS.get("localesSupportedByAllApps")),pushToken:COS.pushController?COS.pushController.get("pushToken"):null,mininumWindowSize:{minWidth:COS.MIN_WIDTH,minHeight:COS.MIN_HEIGHT},isOnSupportedMobile:window.CloudOSBootstrap&&CloudOSBootstrap.isOnSupportedMobile,secureChannelInfoData:o,additionalClassNamesForBody:function(){var e,t;if(CloudOS.getUser&&CloudOS.getUser().get("isChineseAccount")||COS.authController&&COS.authController.getPath("user.isChineseAccount"))e="cn";return e}(),defaultAssetHostname:t.get("defaultAssetHostname")};return u},filterLocales:function(e){if(!e)return e;var t=[];for(var n=e.length;n--;){var r=e[n];t[n]={locale:r.locale,dispName:r.dispName}}return t},lastBenchmarkDurationFor
:function(e){var t=SC.Benchmark._statFor(e);if(!t||!t._times||t._times.length===0){SC.warn("Cannot find stats for %@",e);return}return t._times[t._times.length-1].dur},localeMap:[{dispName:"English (U.S.)",locale:"en-us"},{dispName:"Español",locale:"es-es"},{dispName:"Français",locale:"fr-fr"},{dispName:"Deutsch",locale:"de-de"},{dispName:"简体中文",locale:"zh-cn"},{dispName:"日本語",locale:"ja-jp"},{dispName:"Nederlands",locale:"nl-nl"},{dispName:"Italiano",locale:"it-it"},{dispName:"한국어",locale:"ko-kr"},{dispName:"繁體中文",locale:"zh-tw"},{dispName:"Português (Brasil)",locale:"pt-br"},{dispName:"Português (Portugal)",locale:"pt-pt"},{dispName:"Svenska",locale:"sv-se"},{dispName:"Polski",locale:"pl-pl"},{dispName:"Dansk",locale:"da-dk"},{dispName:"Suomi",locale:"fi-fi"},{dispName:"Norsk bokmål",locale:"no-no"},{dispName:"Русский",locale:"ru-ru"},{dispName:"العربية",locale:"ar-sa"},{dispName:"Türkçe",locale:"tr-tr"},{dispName:"ภาษาไทย",locale:"th-th"},{dispName:"Українська",locale:"uk-ua"},{dispName:"Hrvatski",locale:"hr-hr"},{dispName:"Čeština",locale:"cs-cz"},{dispName:"Ελληνικά",locale:"el-gr"},{dispName:"עברית",locale:"iw-il"},{dispName:"Română",locale:"ro-ro"},{dispName:"Slovenčina",locale:"sk-sk"},{dispName:"Magyar",locale:"hu-hu"},{dispName:"Bahasa Indonesia",locale:"id-id"},{dispName:"Bahasa Melayu",locale:"ms-my"},{dispName:"English (Australia)",locale:"en-au"},{dispName:"English (Canada)",locale:"en-ca"},{dispName:"English (New Zealand)",locale:"en-nz"},{dispName:"English (U.K.)",locale:"en-gb"},{dispName:"Català",locale:"ca-es"},{dispName:"Tiếng Việt",locale:"vi-vi"},{dispName
:"हिन्दी",locale:"hi-in"},{dispName:"Français (Canada)",locale:"fr-ca"},{dispName:"Español (México)",locale:"es-mx"}],localesSupportedByAllApps:function(){var e=window.supportedLocales,t=this.get("localeMap"),n=t.getEach("locale"),r=[];return e.map(function(e){var i=n.indexOf(e);i!=-1&&r.push(SC.Object.create(t[i]))}),r}.property("localeMap"),localesSupportedByCloudOSOnly:function(){return window.supportedLocales.concat(["ar-sa","iw-il"]).uniq()}.property(),availableLocales:function(){var e=window.supportedLocales,t=this.get("localesSupportedByAllApps"),n,r,i=this.get("localeMap"),s=COS.authController.getPath("accountPreferences"),o=s?s.get("locale"):null,u=s?s.get("secondaryLocale"):null,a=COS.apps,f;for(f in COS.apps){var l=COS.appsController.getAppInfoFor(f);if(!l){SC.warn("No appInfo for %@",f);continue}var c=l.get("supportedLocales"),h=t.getEach("locale");if(c)for(n=0,r=i.length;n<r;n++){var p=i[n].locale;c.indexOf(p)!==-1&&h.indexOf(p)===-1&&t.push(SC.Object.create(i[n]))}}var d=t.getEach("locale"),v=i.getEach("locale"),m;return o&&d.indexOf(o)==-1&&(m=v.indexOf(o),t.push(SC.Object.create(i[m]))),u&&d.indexOf(u)==-1&&(SC.warn("There is something wrong here as secondaryLocale '%@' is not part of window.supportedLocales already.",u),m=v.indexOf(u),t.push(SC.Object.create(i[m]))),t}.property("localesSupportedByAllApps","COS.apps").cacheable(),checkBodyFontsAvailability:function(e,t){var n=SC.$("body").css("font-family"),r=n?n.replace(/, /g,",").replace(/['"]/g,"").split(","):null;if(!r){SC.warn("Unable to detect font family of the body");return}this.checkFontAvailability(
r,0,e,t,this,this.checkFontAvailability)},checkFontAvailability:function(e,t,n,r,i,s){var o=e[t];SC.info("Trying to load font %@",o),SC.Benchmark.start("Loading Font %@".fmt(o)),CW.fontDetector(o,{success:function(){var e="Loading Font %@".fmt(o),t;SC.debug("%@ font is loaded",o),SC.Benchmark.end(e),t={fontName:o,fontAvailable:YES,loadDuration:COS.lastBenchmarkDurationFor(e)},COS.statsController.recordStat("cloudos","BodyFontAvailable",t),r.call(n)},fail:function(){var u="Loading Font %@".fmt(o),a;SC.warn("%@ font failed to load",o),SC.Benchmark.end(u),a={fontName:o,fontAvailable:NO,loadDuration:COS.lastBenchmarkDurationFor(u)},COS.statsController.recordStat("cloudos","BodyFontNotAvailable",a),++t<e.length?s.call(i,e,t,n,r,i,s):(SC.warn("Unable to load any of the required fonts in the time frame given. Continuing to load…"),r.call(n))},timeout:COS.FONT_CHECK_DURATION*1e3,testFontFamily:"Arial"})},scheduleStatSessionIdUpdateTimer:function(){this._statSessionUpdateTimer||(this._statSessionUpdateTimer=SC.Timer.schedule({target:this,action:function(){this.statSessionId=CW.upperCaseUUID()},interval:this.STAT_SESSION_ID_UPDATE_INTERVAL*1e3,repeats:!0}))}}),function(){COS.ENABLE_TRANSFORM_ANIMATIONS=!0,COS.ENABLE_SCALE_ANIMATION=!0,COS.ENABLE_APP_ANIMATION=!0,COS.ANIMATE_SPRINGBOARD_LAYOUT=!0,CW.Animator.ENABLE_OLD_IE=NO}(),COS.apps={contacts:{path:"contacts/",requiredServices:["contacts","keyvalue"],pushTopic:"73f7bfc9253abaaa423eba9a48e9f187994b7bd9",isBeta:!1,isWWW:!0,supportsLite:!0},calendar:{path:"calendar/",requiredServices:["calendar","keyvalue"],pushTopic:"dce593a0ac013016a778712b850dc2cf21af8266"
,showsPushNotifications:!0,awakesInBackgroundFromPush:!0,isBeta:!1,isWWW:!0},find:{requiredServices:["findme"],pushTopic:"f68850316c5241d8fd120f3bc6da2ff4a6cca9a8",showsPushNotifications:!0,awakesInBackgroundFromPush:!0,isBeta:!1,isWWW:!0,isFuture:!1},fmf:{requiredServices:["fmf"],isBeta:!1,isWWW:!0},mail:{path:"mail/",requiredServices:["mail"],pushTopic:"e850b097b840ef10ce5a7ed95b171058c42cc435",showsPushNotifications:!0,awakesInBackgroundFromPush:!0,isBeta:!1,isWWW:!0,isFuture:!0,supportsPhoneNumberBasedAppleId:!1},notes:{path:"notes/",requiredServices:["mail"],pushTopic:"c5292888edbd54273cf7c82fe861b81f0d2b87ef",alternateAppName:"notes2",supportsCKSharing:!1,isBeta:!1,isWWW:!0},notes2:{path:"notes2/",alternateAppName:"notes",requiredServices:["ckdatabasews"],isBeta:!1,isWWW:!0,isFuture:!0,supportsLite:!0,isPCSRequired:!0,preloadCoreTypes:!0,isHidden:YES,containerIdentifier:"com.apple.notes",shareInfo:{titleFields:[{name:"TitleEncrypted",type:"EncryptedBytes"}]}},reminders:{path:"reminders/",requiredServices:["reminders","keyvalue"],pushTopic:"8a40cb6b1d3fcd0f5c204504eb8fb9aa64b78faf",showsPushNotifications:!0,awakesInBackgroundFromPush:!0,isBeta:!1,isWWW:!0},photos:{path:"photos/",requiredServices:["ckdatabasews"],isFuture:!0,isBeta:!1,isWWW:!0,isPCSRequired:!0,containerIdentifier:"com.apple.photos.cloud"},iclouddrive:{path:"iclouddrive/",isFuture:!0,isBeta:!1,isWWW:!0,supportsLite:!0,isPCSRequired:!0,preloadCoreTypes:!0,hasUIForAcceptedSharesOnMobile:!0,shareInfo:{titleFields:[{name:"encryptedBasename",type:"EncryptedBytes"},{name:"bounceNo",type:"Number"}]},containerIdentifier
:"com.apple.clouddocs"},settings:{path:"settings/",supportsLite:!0,isFuture:!0,isBeta:!1,isWWW:!0},pages:{requiredServices:["iwmb","keyvalue"],supportedFileExtensions:["pages"],pushTopic:"5a5fc3a1fea1dfe3770aab71bc46d0aa8a4dad41",supportsLite:!0,isPCSRequired:!0,isCarry:!1,additionalSupportedLocales:["ar-sa","iw-il"],containerIdentifier:"com.apple.clouddocs",shareInfo:{titleFields:[{name:"encryptedBasename",type:"EncryptedBytes"},{name:"bounceNo",type:"Number"}],thumbnailField:{name:"thumb1024",type:"Asset"}}},numbers:{requiredServices:["iwmb","keyvalue"],supportedFileExtensions:["numbers"],pushTopic:"5a5fc3a1fea1dfe3770aab71bc46d0aa8a4dad41",supportsLite:!0,isPCSRequired:!0,isCarry:!1,additionalSupportedLocales:["ar-sa","iw-il"],containerIdentifier:"com.apple.clouddocs",shareInfo:{titleFields:[{name:"encryptedBasename",type:"EncryptedBytes"},{name:"bounceNo",type:"Number"}],thumbnailField:{name:"thumb1024",type:"Asset"}}},keynote:{requiredServices:["iwmb","keyvalue"],supportedFileExtensions:["key"],pushTopic:"5a5fc3a1fea1dfe3770aab71bc46d0aa8a4dad41",supportsLite:!0,isPCSRequired:!0,isCarry:!1,additionalSupportedLocales:["ar-sa","iw-il"],containerIdentifier:"com.apple.clouddocs",shareInfo:{titleFields:[{name:"encryptedBasename",type:"EncryptedBytes"},{name:"bounceNo",type:"Number"}],thumbnailField:{name:"thumb1024",type:"Asset"}}},newspublisher:{isCarry:!1,supportsLite:!0,supportsMAID:!1,isDynamicallyLoaded:!0,isHidden:!0}},function(){var e=window.CloudOSBootstrap&&CloudOSBootstrap.minimalisticAppsHash,t={};if(e){var n;for(n in COS.apps){var r=COS.apps[n],i=e[n],s;s=SC.merge
(i,r),t[n]=s}COS.apps=t}}(),COS.AppInfo=SC.Object.extend({name:null,capitalizedName:function(){var e=this.get("name");return e&&(e.charAt(0)!=="i"?e=e.capitalize():e="i"+e.substring(1).capitalize()),e}.property("name").cacheable(),localized:null,displayName:null,path:null,preferences:null,preferencesVersion:"",supportedFileExtensions:null,isReady:NO,isDisabled:NO,isUnqualified:NO,requiredServices:null,isDynamicallyLoaded:NO,isBeta:NO,isFuture:NO,isHidden:NO,supportsLite:NO,supportsMAID:YES,isLocked:NO,lockType:null,pushTopic:null,showsPushNotifications:NO,awakesInBackgroundFromPush:NO,supportedLocales:null,additionalSupportedLocales:null,requestedStartupUrl:null,requestedStartupInfo:null,startupResponse:null,requiresAuth:YES,isPCSRequired:NO,canLaunchWithOneFactor:NO,alternateAppName:null,supportsCKSharing:YES,isSupportedOnMobile:NO,shareInfo:null,supportsPhoneNumberBasedAppleId:YES,hasUIForAcceptedSharesOnMobile:!1,isCloudOSInterceptingShareUrls:!1,isShowingPublicSharingPreLogin:!1,isSharingAcceptanceEnabled:!1,isShareHandlingSupportedOnMobile:!1,isServiceRequired:function(e){var t=this.get("requiredServices");return t?t.indexOf(e)!==-1:NO},hasAccessToRequiredServices:function(){var e=this.get("requiredServices");if(!e)return YES;var t,n;for(t=0,n=e.length;t<n;t++)if(!CK.servicesController.getServiceInfoFor(e[t]))return NO;return YES}.property("requiredServices").cacheable(),requiredServicesRequirePCS:function(){var e=this.get("requiredServices");if(!e)return NO;var t,n;for(t=0,n=e.length;t<n;t++){var r=CK.servicesController.getServiceInfoFor(e[t]);if(r&&r.get("pcsRequired"
))return YES}return NO}.property("requiredServices").cacheable(),isHSALocked:function(){return this.get("isLocked")&&this.get("lockType")===COS.AppInfo.LOCKED_HSA}.property("isLocked","lockType").cacheable(),isPCSKeysDeletedLocked:function(){return this.get("isLocked")&&this.get("lockType")===COS.AppInfo.LOCKED_PCS_DELETED}.property("isLocked","lockType").cacheable(),canBeRemoved:function(){var e=COS.authController.getPath("user.isManagedAppleID"),t=this.get("supportsMAID"),n=this.get("isHidden");return e&&!t||!this.get("isHidden")}.property("COS.authController.user","supportsMAID","isHidden"),localizedDisplayNames:function(){return this.getPath("localized.displayName")}.property("localized").cacheable(),localizedTitleNames:function(){return this.getPath("localized.titleName")}.property("localized").cacheable(),countrySpecificDisplayNameOverrides:function(){return this.getPath("localized.countrySpecificDisplayNameOverrides")}.property("localized").cacheable(),countrySpecificTitleNameOverrides:function(){return this.getPath("localized.countrySpecificTitleNameOverrides")}.property("localized").cacheable(),calculateAndSetLocalizedNames:function(e,t){e||CW.fatalError("cannot calculate the displayName and titleName as locale has not been provided");var n=this.get("name"),r=("AppTitle."+n).loc(),i=("AppTitleBar."+n).loc(),s=this.get("localizedDisplayNames"),o=this.get("localizedTitleNames");s&&s&&s[e]&&(r=s[e]),o&&o&&o[e]&&(i=o[e]);if(t){var u=this.get("countrySpecificDisplayNameOverrides"),a=this.get("countrySpecificTitleNameOverrides");u&&u[t]&&u[t][e]&&(r=u[t][e]),a&&a[t]&&a[t]
[e]&&(i=a[t][e])}this.set("displayName",r),this.set("titleName",i)}}),COS.AppInfo.mixin({LOCKED_HSA:1,LOCKED_PCS_DELETED:2}),window.supportedLocales=["ca-es","cs-cz","da-dk","de-de","de-lu","el-gr","en-au","en-ca","en-gb","en-nz","en-us","es-es","es-mx","fi-fi","fr-ca","fr-fr","hi-in","hr-hr","hu-hu","id-id","it-it","ja-jp","ko-kr","ms-my","nl-be","nl-nl","no-no","pl-pl","pt-br","pt-pt","ro-ro","ru-ru","sk-sk","sv-se","th-th","tr-tr","uk-ua","vi-vi","zh-cn","zh-hk","zh-tw"],COS.appsController=SC.Object.create({getAppInfoFor:function(e){e||CW.fatalError("getAppInfoFor(): An application name must be specified");var t=this._appsInfo;return t[e]||null},removeAppInfoFor:function(e){e||CW.fatalError("removeAppInfoFor(): An application name must be specified");var t=this._appsInfo;delete t[e]},init:function(){var e=arguments.callee.base.apply(this,arguments),t=COS.apps,n={},r,i;this._appsInfo=n;for(r in t)i=t[r],i?this.createAppInfo(r,SC.clone(i,YES)):SC.warn("COS.appsController: Ignoring application “%@” because it has no hash information in COS.apps",r);return e},createAppInfo:function(e,t){if(!e||!t||SC.typeOf(t)!==SC.T_HASH)return null;t.path||(t.path=e+"/");var n=this._appsInfo;t.name=e;var r=COS.AppInfo.create(t),i=window.supportedLocales,s=t.additionalSupportedLocales;n[e]=r,i&&s&&(r.supportedLocales=i.slice().concat(s));var o=this._prefsForDynamicApps[e];return o&&(r.set("preferences",o),r.set("preferencesVersion",this._prefsVersionForDynamicApps[e])),r},_appsInfo:null,_prefsForDynamicApps:{},_prefsVersionForDynamicApps:{},storePrefsForDynamicApp:function(e,t,n){this._prefsForDynamicApps
[e]=t,this._prefsVersionForDynamicApps[e]=n},setAppLockInfo:function(e,t,n,r){var i=e.get("canLaunchWithOneFactor"),s=n&&r&&!i,o=t&&e.get("isPCSRequired"),u=s||o,a;e.set("isLocked",u),u&&(a=o?COS.AppInfo.LOCKED_PCS_DELETED:COS.AppInfo.LOCKED_HSA,e.set("lockType",a))}}),COS.AuthController=SC.Object.extend(SC.DelegateSupport,{delegate:null,isLoggingIn:NO,isLoggingOut:NO,isRevalidatingUser:NO,currentLogoutAlert:null,repairPayload:null,accountTermsUpdateRequired:NO,accountRepairRequired:function(){return!!this.get("repairPayload")||!!this.get("accountTermsUpdateRequired")}.property("repairPayload","accountTermsUpdateRequired"),isExtendedLogin:NO,hsaTrustedBrowser:NO,hsaChallengeRequired:NO,isCarryUser:NO,isValidatingHsa:NO,pcsDeleted:NO,siteDomains:["icloud.com","icloud.com.cn"],isLoadedFromSiteURL:null,defaultAssetHostname:function(){var e=this.get("currentDomain");if(e)return"www."+e}.property("currentDomain"),defaultOrigin:function(){var e=this.get("defaultAssetHostname");return e&&(e="https://"+e),e}.property("defaultAssetHostname"),setupBaseUrl:function(){var e=this.get("currentDomain"),t,n="https://setup.%{currentDomain}/setup/ws/1/";return e&&(t=n.fmt({currentDomain:this.get("currentDomain")})),t}.property("currentDomain").cacheable(),validateUrl:function(){var e=this.get("setupBaseUrl");if(e)return e+"validate";CW.fatalError("No setupBaseUrl available")}.property("setupBaseUrl").cacheable(),loginUrl:function(){var e=this.get("setupBaseUrl");if(e)return e+"login";CW.fatalError("No setupBaseUrl available")}.property("setupBaseUrl").cacheable(),quotaUrl:function(){var e=this
.get("setupBaseUrl");if(e)return e+"storageUsageInfo";CW.fatalError("No setupBaseUrl available")}.property("setupBaseUrl").cacheable(),logoutUrl:function(){var e=this.get("setupBaseUrl");if(e)return e+"logout";CW.fatalError("No setupBaseUrl available")}.property("setupBaseUrl").cacheable(),pcsEnabled:null,loginAttempts:0,customLoginBody:{},authBagLoadedFromOpenerWindow:NO,showSignup:NO,signupOriginApp:null,userAuthenticationState:null,userHasAcceptedTerms:!1,hideRememberMe:NO,environment:"PROD",isAppleInternal:NO,_auth_bag:null,_user_cache:null,_secure_channel_info_cache:null,dsWebAuthToken:null,trustToken:null,trustTokens:[],secureChannelInfoData:null,accountCountryCode:null,currentDomain:null,displayableCurrentDomain:function(){var e=this.get("currentDomain"),t;return e&&(t=e.replace("icloud","iCloud")),t}.property("currentDomain").cacheable(),isAnyServiceInCarryPartitionBinding:"CK.servicesController.isAnyServiceInCarryPartition",init:function(){var e=window.location.hostname,t=URI(window.location.href).domain(),n=this.get("siteDomains");this.set("currentDomain",t),this.set("isLoadedFromSiteURL",n.contains(t)),SC.Event.add(window,"unload",function(){COS.authController.tryToPerform("windowWillClose")})},user:function(){var e=this._user_cache;return e?e:this._user_cache=CK.User.createFromAuthBag(this._auth_bag)}.property(),quotaInfo:function(){return this._quotaInfo_cache||(this._quotaInfo_cache=CK.QuotaInfo.create(this._quota_data)),this._quotaInfo_cache}.property(),secureChannelInfo:function(){return this._secure_channel_info_cache||(this._secure_channel_info_cache=CK.SecureChannelInfo
.create(this.get("secureChannelInfoData"))),this._secure_channel_info_cache}.property("secureChannelInfoData").cacheable(),accountPreferences:function(){return this._account_preferences_cache||(this._account_preferences_cache=this._auth_bag?COS.AccountPreferences.create({user:this.get("user")}):null)}.property(),authBagApps:function(){var e=this._auth_bag;if(e)return e.apps}.property(),requestInfo:function(){var e=this._auth_bag;if(e)return e.requestInfo}.property(),isNotAuthenticated:function(){return this.get("userAuthenticationState")===CK.AuthenticationStateEnum.NOT_AUTHENTICATED}.property("userAuthenticationState"),isPartiallyAuthenticated:function(){var e=CK.AuthenticationStateEnum,t=this.get("userAuthenticationState");return t===e.PARTIALLY_AUTHENTICATED_HSA}.property("userAuthenticationState"),isPartiallyAuthenticatedForManagedAppleId:function(){var e=CK.AuthenticationStateEnum,t=this.get("userAuthenticationState");return t===e.PARTIALLY_AUTHENTICATED_MANAGED_APPLE_ID}.property("userAuthenticationState"),isAtLeastPartiallyAuthenticated:function(){return this.get("userAuthenticationState")>CK.AuthenticationStateEnum.NOT_AUTHENTICATED}.property("userAuthenticationState"),isAuthenticated:function(){return this.get("userAuthenticationState")===CK.AuthenticationStateEnum.AUTHENTICATED}.property("userAuthenticationState"),clearUserState:function(){var e=this._user_cache;e&&e.destroy(),this._auth_bag=null,this._quota_data=null,this.set("secureChannelInfoData",null),this._user_cache=null,this._quotaInfo_cache=null,this._account_preferences_cache=null,this._secure_channel_info_cache=
null,this._lastDsidCookie=null,this._validateUserTimer&&(this._validateUserTimer.invalidate(),this._validateUserTimer=null),window.CloudOS&&!CloudOS.isCloudOSClient&&CK.currentApplication._clearUserState(),CK.writeCookie("X-APPLE-WEB-ID",null,null,this.get("currentDomain"),null,YES),CK.removeValueInSessionStorage("redirectedToCarry"),CK.removeValueInSessionStorage("pushToken"),CK.removeValueInSessionStorage("username"),CK.tryToPerform("clearLocalStorage"),this.set("userAuthenticationState",CK.AuthenticationStateEnum.NOT_AUTHENTICATED),this.set("isLoggingIn",NO),this.set("isLoggingOut",NO),this.set("isExtendedLogin",NO),this.set("authBagLoadedFromOpenerWindow",NO),this.set("accountTermsUpdateRequired",NO),this.set("repairPayload",null)},scheduleValidateUserTimer:function(){this._validateUserTimer||(this._validateUserTimer=SC.Timer.schedule({target:this,action:function(){var e=COS.authController;e.set("isRevalidatingUser",YES),e.validateUser(function(){e.set("isRevalidatingUser",NO)},YES)},interval:COS.REVALIDATE_INTERVAL*1e3,repeats:YES}))},validateUser:function(e,t){var n=this.get("delegate"),r=this,i=this.get("validateUrl"),s;s=COS.Request.postUrl(i,null),s.set("reportRequest",YES),s.notify(200,this,function(i){var s=i.get("body"),o=r._processReceivedBag(s),u;if(!o||!o.dsInfo||!o.webservices)return SC.debug("Missing critial information in bag: %@",s),SC.debug("COS: invoking validateDidFail"),r.invokeDelegateMethod(n,"validateDidFail",i,o),YES;if(o.termsUpdateNeeded)return SC.debug("Terms update is still required, hence marking this validate call as failure"),NO;var a=o.configBag
;a&&CW.notificationCenter.postNotification("configBagReceived",a),u=o.dsInfo,u.dsid||(u.dsid=u.dsPrsID,delete u.dsPrsID);var f=SC.clone(r._auth_bag);return r._auth_bag=o,r._user_cache=null,r.notifyPropertyChange("user"),r.set("isLoggingIn",NO),r.setUserAuthenticationStatus(o.hsaChallengeRequired,o.dsInfo.isManagedAppleID,YES),r._authCompleted(o,e,NO,i)&&(SC.debug("COS: invoking validateDidSucceed with body %@",o),r.invokeDelegateMethod(n,"validateDidSucceed",o,f,t),r.monitorForUsernameChange()),YES}),s.notify(0,this,function(i){var s=i.get("body"),o=i.get("status"),u=r._processReceivedBag(s),a=u&&u.configBag,f=u&&u.hsaChallengeRequired,l=u&&u.dsInfo&&u.dsInfo.isManagedAppleID;return u&&!u.termsUpdateNeeded&&!f&&!l&&o===200?NO:(a&&CW.notificationCenter.postNotification("configBagReceived",a),r.set("isLoggingIn",NO),r.setUserAuthenticationStatus(f,l,NO),r.set("accountTermsUpdateRequired",NO),SC.debug("COS: invoking validateDidFail"),r.invokeDelegateMethod(n,"validateDidFail",i,u,t),e instanceof Function&&e(NO,NO,s,o),r.monitorForUsernameChange(),YES)}),this.set("isLoggingIn",YES),SC.debug("COS: Sending validate POST request to %@",i),this.invokeDelegateMethod(n,"validateRequestWillBeSent"),s.send()},loginUser:function(e,t,n,r,i){var s=this.get("loginUrl"),o=COS.Request.postUrl(s,null),u=this.get("delegate"),a=this;o.set("reportRequest",YES),i||o.queryParameter("dsid",null),o.notify(200,this,this.loginUserDidSucceed,u,r,i),o.notify(0,this,this.loginUserDidFail,u,r,i),a.set("isLoggingIn",YES);var f=SC.clone(this.get("customLoginBody"));f.apple_id=e,f.password=t,SC.none(n)||(f.extended_login=
n),this.set("isLoggingIn",YES),SC.debug("CloudKit: Sending login POST request to %@",s),this.invokeDelegateMethod(u,"loginRequestWillBeSent"),o.send(f)},loginUserDidSucceed:function(e,t,n,r){var i=e.get("body"),s=this._processReceivedBag(i),o;if(!s||!s.dsInfo||!s.webservices)return SC.debug("Missing critial information in bag: %@",i),SC.debug("COS: invoking loginDidFail"),this.invokeDelegateMethod(t,"loginDidFail",e,s),YES;o=s.dsInfo,o.dsid||(o.dsid=o.dsPrsID,delete o.dsPrsID);var u=SC.clone(this._auth_bag);return u&&!r&&o.dsid===u.dsInfo.dsid&&s.hsaChallengeRequired&&u.hsaChallengeRequired===s.hsaChallengeRequired?(SC.debug("Same auth bag as before completing HSA flow: %@",i),SC.debug("COS: invoking loginDidFail"),this.invokeDelegateMethod(t,"loginDidFail",e,s),YES):(this._auth_bag=s,this.notifyPropertyChange("user"),this.set("isLoggingIn",NO),this.setUserAuthenticationStatus(s.hsaChallengeRequired,s.dsInfo.isManagedAppleID,YES),this.set("repairPayload",s.isRepairNeeded&&s.repairPayload),this.set("accountTermsUpdateRequired",s.termsUpdateNeeded),this._authCompleted(s,n,YES,e)&&(SC.debug("COS: invoking loginDidSucceed"),this.invokeDelegateMethod(t,"loginDidSucceed",s),this.monitorForUsernameChange()),r&&this.set("secondaryLoginAttemptsCount",0),YES)},loginUserDidFail:function(e,t,n,r){var i=e.get("body"),s=this._processReceivedBag(i),o=s&&s.hsaChallengeRequired,u=s&&s.dsInfo&&s.dsInfo.isManagedAppleID;return this.set("isLoggingIn",NO),r?this.secondaryLoginAttemptsCount>=3?(SC.info("CloudKit: More than three invalid secondary auth attempts, make sure we log out"),this.logoutUser
(function(){CK.reloadWithReason("more than 3 secondaryLoginAttemptsCount")},YES)):r&&n instanceof Function&&n(NO,YES,e):(this.setUserAuthenticationStatus(o,u,NO),this.set("accountTermsUpdateRequired",NO),SC.debug("COS: invoking loginDidFail"),this.invokeDelegateMethod(t,"loginDidFail",e,s)),YES},logoutUser:function(e,t,n){if(this.get("isLoggingOut")){SC.warn("User is already being logged out. Ignoring new logout call.");return}CK.get("isCarry")&&!e&&(e=function(){CK.reloadWithReason("Logging Out From Carry")});if(t&&COS.pushController){var r=this;COS.pushController.unInitializePush(function(){r.sendLogoutRequest(e,t,n)})}else this.sendLogoutRequest(e,t,n);CW.notificationCenter.postNotification("logoutUser")},sendLogoutRequest:function(e,t,n){var r=this.get("logoutUrl"),i=this.get("delegate"),s=this,o,u={};t||(r=URI(r).addSearch("onunload","true").toString()),n&&(u.allBrowsers=!0),this.getPath("user.hsaEnabled")&&(u.trustBrowser=this.get("hsaTrustedBrowser")),this.set("isLoggingOut",YES),o=COS.Request.postUrl(r,null),o.set("timeout",null),o.set("useCrossDomain",YES),this._shouldRetryLogout&&COS.statsController.recordStat("cloudos","LogoutRetry",{isExplicit:t}),o.notify(200,this,function(t){return s.set("isLoggingIn",NO),s.setUserAuthenticationStatus(null,null,NO),s.set("accountTermsUpdateRequired",NO),SC.debug("CloudKit: invoking logoutDidSucceed"),s.invokeDelegateMethod(i,"logoutDidSucceed"),s.clearUserState(),s.invokeDelegateMethod(s.get("delegate"),"userDidLogout",YES),e instanceof Function&&e(t),YES}),o.notify(0,this,function(r){s.set("isLoggingIn",NO),s.setUserAuthenticationStatus
(null,null,NO),s.set("accountTermsUpdateRequired",NO);if(!s._shouldRetryLogout){SC.debug("CloudKit: Logging out did fail, will retry once"),s._shouldRetryLogout=YES,s.sendLogoutRequest(e,t,n);return}return SC.debug("CloudKit: invoking logoutDidFail"),s.invokeDelegateMethod(i,"logoutDidFail",r),s.clearUserState(),e instanceof Function&&e(r),YES}),SC.debug("CloudKit: Sending logout POST request to %@",r),this.invokeDelegateMethod(i,"logoutRequestWillBeSent"),o.send(u)},secondaryLoginAttemptsCount:0,secondaryLogin:function(e,t,n,r,i){this.secondaryLoginAttemptsCount++,this.loginUser(e,t,n,function(e,t,n){if(i instanceof Function){i(e,t,n);return}if(!r)return;var s=e?"secondaryAuthDidSucceed":"secondaryAuthDidFail",o,u=CK.currentApplication;u?(o=u.get("delegate"),u.invokeDelegateMethod(o||u,s)):CloudOS.appManagerFor(r).passMessage(s)},YES)},getQuotaData:function(e){var t=this.get("quotaUrl"),n=COS.Request.postUrl(t,null),r=this;n.set("reportRequest",YES),n.notify(200,this,function(t){var n=t.get("body"),i={},s,o={familyStorageUsageInfo:!0,storageUsageByMedia:!0};for(s in n){var u=n[s];if(SC.typeOf(u)===SC.T_HASH&&!o[s]){var a;for(a in u)i[a]=u[a]}else i[s]=n[s]}return r._quota_data=i,r._quotaInfo_cache=null,CW.notificationCenter.postNotification("quotaDataFetched",r.get("quotaInfo"),i),e&&e instanceof Function&&e(n),YES}),n.notify(0,this,function(e){return SC.warn("Could not get Quota Data"),YES}),n.send()},getConfigBagUrlForKey:function(e){var t=this._auth_bag,n=t.configBag,r=n.urls;return r[e]},monitorForUsernameChange:function(){var e=this,t=this.get("user"),n;SC.debug("Check if X-APPLE-WEB-ID can be created"
),t&&(!this.shouldShowFirstRun(this.get("accountPreferences"),CW.getUrlParameters())||this.get("isAuthenticated"))&&(n=SHA1.hex_sha1(t.get("dsid")+this.get("userAuthenticationState")),n!==this._lastDsidCookie&&(CK.writeCookie("X-APPLE-WEB-ID",n,null,this.get("currentDomain"),this.get("isExtendedLogin")?336:null,YES),this._lastDsidCookie=n));if(this._usernameMonitorTimer)return;SC.debug("Creating the _usernameMonitorTimer"),this._usernameMonitorTimer=SC.Timer.schedule({target:this,action:function(){if(!COS.authController._usernameMonitorTimer)return;var t=e.get("user"),n=CK.readCookie("X-APPLE-WEB-ID"),r=e.get("isAtLeastPartiallyAuthenticated"),i=e.get("isAuthenticated");r&&t&&t.get("dsid")&&e._lastDsidCookie&&!n?(e.clearUserState(),e.invokeDelegateMethod(e.get("delegate"),"userDidLogout",NO),e._lastDsidCookie=null):!i&&n&&n!==e._lastDsidCookie&&(e.validateUser(function(t){if(t){var n;e.get("isAuthenticated")&&(n="userDidAuthenticate"),e.get("isPartiallyAuthenticated")&&(n="userDidPartiallyAuthenticate"),n&&e.invokeDelegateMethod(e.get("delegate"),n,NO)}}),e._lastDsidCookie=n)},interval:1e3,repeats:YES})},clearMonitorForUsernameChange:function(){if(!this._usernameMonitorTimer)return;this._usernameMonitorTimer.invalidate(),this._usernameMonitorTimer=null},sendAccountCreateRequest:function(e,t){var n=this.get("repairPayload");this._sendAccountCreateRepairRequest(CloudOS.initializationController.get("accountCreateEndpointURL"),n?{createPayload:n}:{},e,t,YES)},sendAccountRepairRequest:function(e,t){var n=this.get("repairPayload");this._sendAccountCreateRepairRequest(CloudOS.initializationController
.get("repairDoneEndpointURL"),n?{repairPayload:n}:{},e,t,NO)},_sendAccountCreateRepairRequest:function(e,t,n,r,i){COS.Request.create({type:"POST",address:e,body:SC.merge(t,CloudOS.tosController.get("acceptedVersions"))}).notify(this,function(e){var t=CloudOS.statechart,s=i?"AppleID_NewAccountCreation":"AppleID_ExistingAccountRepair",o;if(e.get("status")===200){var u={referrer:document.referrer},a;n&&(o=n),i&&(a={},a.includeLocationUrlDetails=!0),COS.statsController.endStat("cloudos",s,u,a)}else r&&(o=r);o&&t.sendAction(o)}).send()},windowWillClose:function(){this.get("isAtLeastPartiallyAuthenticated")&&COS.statsController.endStat("cloudos","Session",{isRefresh:YES},{durationKeyName:"sessionDuration"}),this.cancelAppleIdFlowStats(),COS.statsController.flushStats()},_authCompleted:function(e,t,n,r){CK.servicesController._setupFromBag(e);var i=this.get("user"),s=i.get("statusCode"),o=this.get("delegate");if(this.invokeDelegateMethod(o,"redirectPostAuthenticationIfRequired",e))return;if(s===CK.User.PAID_ACTIVE)return SC.debug("The user is a MobileMe user, %@. Invoking delegate userIsMobileMe()",s),this.invokeDelegateMethod(o,"userIsMobileMe"),this.logoutUser(),NO;if(s!==CK.User.FREE_QUALIFIED&&s!==CK.User.LITE)return SC.debug("The user is not signed up to iCloud, %@. Invoking delegate userIsNotSignedUp()",s),this.invokeDelegateMethod(o,"userIsNotSignedUp"),this.logoutUser(),NO;if(i.isLiteAccount()&&SC.browser.isIE9OrLower)return SC.debug("The user is has an iCloud Lite account but is using IE9 (or earlier)."),this.invokeDelegateMethod(o,"iCloudLiteUnsupportedBrowser"),this.logoutUser
(),NO;this.set("isExtendedLogin",e.isExtendedLogin),this.set("hsaChallengeRequired",e.hsaChallengeRequired),this.set("hsaTrustedBrowser",e.hsaTrustedBrowser),this.set("pcsEnabled",e.pcsEnabled),this.set("isCarryUser",e.isCarryUser);var u=e.pcsDeleted||!!CW.getUrlParameters().deletePCSKeys;this.set("pcsDeleted",u);var a=COS.appsController,f=a._appsInfo,l=i.get("hasICloudQualifyingDevice"),c=i.get("isLiteAccount"),h=i.get("isManagedAppleId"),p=i.get("hsaEnabled"),d=NO,v=this.get("hsaChallengeRequired"),m,g=this.get("authBagApps"),y,b,w,E,S,x,T,N,C;g.photos===undefined&&!c&&(g.photos={});for(y in f){b=f[y],C=g[y];if(C)for(N in C)b.set(N,C[N]);a.setAppLockInfo(b,u,p,v),S=b.get("requiredServices");if(!S)continue;for(w=0,E=S.length;w<E;w++)x=S[w],(T=CK.servicesController.getServiceInfoFor(x))||(SC.debug("Auth bag did not contain service %@, disabling app %@",x,y),b.set("isDisabled",YES),!l&&!m&&(b.set("isUnqualified",YES),d=YES))}c&&(l=YES),this.set("isUserUnqualified",!l&&d),!l&&d&&this.invokeDelegateMethod(o,"userIsUnqualified"),this.invokeDelegateMethod(o,"userHasLoggedIn");if(CK.get("isReloading")){SC.info("Waiting to reload…");return}this.serviceIdentitiesAreMissing()&&COS.statsController.recordStat("cloudos","MissingServiceIdentities",{hsaEnabled:e.dsInfo?e.dsInfo.hsaEnabled:NO});var k=COS.prefsController,L=this.get("accountRepairRequired");if((!this.getPath("accountPreferences.hasInitialized")||this.get("isRevalidatingUser"))&&!L&&this.get("isAuthenticated"))if(window.CloudOS&&CloudOS.hasOpenerWithCloudOS&&CloudOS.hasOpenerWithCloudOS()){var A=k.getRequestedApps(),O=CloudOS
.getOpenerWithCloudOS(),M=O.CloudOS;if(M.userIsAuthenticated&&!M.userIsAuthenticated())return k.getPreferences(null,t),YES;var _=O.CK?O.CK.currentApplication:null,D=M.getAccountPreferences?M.getAccountPreferences():null,P;_&&_._cloudOSState?P=_.getPath("_cloudOSState.appPreferences"):M.getAppPreferences&&(P=M.getAppPreferences()),D&&P?(k.setPreferences(D,P,t),k.fetchRegionSettings()):k.getPreferences(null,t)}else k.getPreferences(null,t);else t instanceof Function&&t(YES,n);return!v&&!L&&!this.get("isPartiallyAuthenticatedForManagedAppleId")&&(this.getQuotaData(),this.scheduleValidateUserTimer()),!L&&this.setDomainSpecificClassNames&&this.setDomainSpecificClassNames(),YES},_processReceivedBag:function(e){if(e){this.set("environment",e.environment||"PROD"),this.set("isAppleInternal",e.requestInfo?e.requestInfo.isAppleInternal:NO);var t=e.trustTokens;t&&this.set("trustTokens",e.trustTokens)}return CW.notificationCenter.postNotification("environmentDidChange",this.get("environment")),e},serviceIdentitiesAreMissing:function(){var e=this._auth_bag;return e&&e.pcsEnabled&&!e.termsUpdateNeeded&&e.hsaChallengeRequired!==YES&&e.pcsServiceIdentitiesIncluded===NO?YES:NO},saveAuthBag:function(e){this._auth_bag=e,this._user_cache=null,this.set("authBagLoadedFromOpenerWindow",YES),this.notifyPropertyChange("user"),this.set("isLoggingIn",NO),this.setUserAuthenticationStatus(e.hsaChallengeRequired,e.dsInfo.isManagedAppleID,YES),this.set("accountTermsUpdateRequired",NO),this._processReceivedBag(e)},cancelAppleIdFlowStats:function(){var e=COS.statsController;e.cancelStat("cloudos","AppleID_NewAccountCreation"
),e.cancelStat("cloudos","AppleID_ExistingAccountRepair"),e.cancelStat("cloudos","AppleID_NewAccountTerms"),e.cancelStat("cloudos","AppleID_ExistingAccountTerms")},shouldShowFirstRun:function(e,t){return!e||!e.get("locale")||!this.get("isUserUnqualified")&&!e.get("timeZone")?(SC.debug("Missing account preferences; let's show first run"),YES):t.firstRun?(SC.debug("First run flag is on, let's show it"),YES):NO},setUserAuthenticationStatus:function(e,t,n){n?e?t?this.set("userAuthenticationState",CK.AuthenticationStateEnum.PARTIALLY_AUTHENTICATED_MANAGED_APPLE_ID):this.set("userAuthenticationState",CK.AuthenticationStateEnum.PARTIALLY_AUTHENTICATED_HSA):this.set("userAuthenticationState",CK.AuthenticationStateEnum.AUTHENTICATED):this.set("userAuthenticationState",CK.AuthenticationStateEnum.NOT_AUTHENTICATED)},sendAccountLoginRequest:function(){SC.Benchmark.start("AUTH_DURATION");var e=CloudOS.initializationController.get("accountLoginEndpointURL"),t=COS.Request.postUrl(e,null),n=this.get("delegate"),r=this.get("trustToken"),i={dsWebAuthToken:this.get("dsWebAuthToken"),extended_login:this.get("isExtendedLogin"),accountCountryCode:this.get("accountCountryCode")},s=function(e,t,n,r){var i=CloudOS.get("authPane"),s=COS.authController;s.validatePreferences(e,t,n,r)};r&&(i.trustToken=r),t.queryParameter("dsid",null),t.set("reportRequest",YES),t.notify(200,this,this.loginUserDidSucceed,n,s,NO),t.notify(0,this,this.loginUserDidFail,n,s,NO),this.set("isLoggingIn",YES),SC.debug("CloudKit: Sending login POST request to %@",e),this.invokeDelegateMethod(n,"loginRequestWillBeSent"),t.send(i)}
}),COS.AuthUIController=COS.AuthController.extend({init:function(){arguments.callee.base.apply(this,arguments),COS.authController=this,COS.authUIController=this,CW.notificationCenter.subscribeToNotification("relocalize",this,"relocalize");var e=this,t=this.validatePreferences;this.validatePreferences=function(){return t.apply(e,arguments)}},isSpinning:NO,areFieldsEditable:YES,_validateRetriesSentCount:0,_loginRetriesSentCount:0,_preferencesRetriesSentCount:0,_prefsWrongPartitionCheckDone:NO,relocalize:function(){var e=this.get("user");e&&e.notifyPropertyChange("displayName")},logoutUser:function(e,t){return t&&COS.statsController.endStat("cloudos","Session",{isRefresh:NO},{durationKeyName:"sessionDuration"}),arguments.callee.base.apply(this,arguments)},cloudOSAuthCompleted:function(e,t){var n=this.get("secondaryLoginAttemptsCount"),r=this.get("user"),i=e.iCloudInfo;for(var s in i)r.set(s,i[s]);n===0&&!this.get("hsaChallengeRequired")&&!this.get("accountRepairRequired")&&CK.meCardController.getMeCard(function(e){if(e){SC.warn("The me-card was not retrieved. (The network request may have failed or a necessary service may be unavailable.)");return}var t=CK.meCardController.meCard,n=!!t.photo,r={prefix:t.prefix,firstName:t.firstName,lastName:t.lastName,suffix:t.suffix,photoUrl:n?t.photo.url:null,photoCrop:n?t.photo.crop:null,photoSignature:n?t.photo.signature:null};CloudOS.passMessageToAllApps("receiveMeCard",r)})},validateDidSucceed:function(e,t,n){var r=COS.getCredentialsFromHash(),i=e.dsInfo,s=CloudOS.getUser(),o=this;if(r&&s&&!s.isMyEmailAddressOrPhoneNumber(r.username)){SC.
warn("Username provided in URL is NOT the same as the one that was validated, logging in..."),this.clearUserState(),SC.Request.manager.cancelAll(),this.get("statechart").sendAction("authDidNotConnect","InvalidUser"),this.loginUser(r.username,r.password,r.extendedLogin,this.validatePreferences);return}if(t&&i.dsid!==t.dsInfo.dsid){window.location.hash="#:showlogin",CK.reloadWithReason("dsid is not the same as previous dsid");return}this.cloudOSAuthCompleted(e,"validate")},validateDidFail:function(e,t,n){var r=COS.getCredentialsFromHash(),i=r&&r.username?r.username:null,s=COS.authUIState;i||(i=CK.getValueFromSessionStorage("username"));if(r){this.loginUser(r.username,r.password,r.extendedLogin,this.validatePreferences);return}n||(this.clearUserState(),this.userDidNotAuthenticate(YES));var o=e.status;o===401||o===421?s.sendAction("authDidNotValidate"):e.status===200&&t.hsaChallengeRequired?(SC.warn("Auth: In the middle of HSA validation. Need to show the Login UI."),s.sendAction("incompleteHSAFlow")):(SC.warn("validate call failed with %@ status code",o),this._validateRetriesSentCount>=COS.MAX_VALIDATE_RETRIES?(SC.warn("Already exceeded the maximum number of validate request attempts. Hence marking the request as failure."),s.sendAction("authDidNotConnect","validateDidFail"),this._validateRetriesSentCount=0):(this._validateRetriesSentCount++,s.sendAction("resendLoginOrValidateRequest",n)))},loginDidSucceed:function(e){this.cloudOSAuthCompleted(e,"login")},loginDidFail:function(e,t){var n=COS.authUIState,r=t?t.error:null,i=e.status;this.userDidNotAuthenticate(YES),!t||i!==401&&i!==421?
e.status===403?r===17?n.sendAction("authDidNotCompleteSetup"):r===16?n.sendAction("authPartitionLocked"):r===14?n.sendAction("authDidNotValidateExpiredPassword"):r===10?n.sendAction("authDidNotValidateAccountClosed"):r===9?n.sendAction("authDidNotValidateSupportLocked"):r===8?n.sendAction("authDidNotValidateLocked"):r===7?n.sendAction("authDidNotValidateLocked"):r===6?n.sendAction("authDidNotValidateNotICloudUser"):r===5?n.sendAction("authDidNotValidateNotICloudUser"):r===4?n.sendAction("authDidNotValidateNotICloudUser"):r===3?n.sendAction("authDidNotValidateNotICloudUser"):r===2?n.sendAction("authDidNotValidateNotICloudUser"):(SC.warn("Auth: 403 response but no recognized error code"),n.sendAction("authDidNotConnect","loginDidFail")):e.status===503?this.handle503(e.get("body")):SC.device.get("isOffline")?n.sendAction("authDidNotValidateOffline"):(SC.warn("Auth: No auth bag or recognized status code"),this._loginRetriesSentCount>=COS.MAX_LOGIN_RETRIES?(SC.warn("Already exceeded the maximum number of login request attempts. Hence marking the request as failure."),n.sendAction("authDidNotConnect","loginDidFail")):(this._loginRetriesSentCount++,n.sendAction("resendLoginOrValidateRequest"))):r===1?n.sendAction("authDidNotValidate"):r===11?(SC.info("Login id sent does not match, sending validate before re-sending login"),this.validateUser(function(){e.get("request").resend(e)},YES)):r===15?n.sendAction("authDidNotValidateAccountTypeNotSupported"):(SC.warn("Auth: 401 response but no recognized error code"),n.sendAction("authDidNotConnect","loginDidFail"))},userIsMobileMe:function(
){COS.authUIState.sendAction("authDidNotValidateNotICloudUser")},userIsNotSignedUp:function(){COS.authUIState.sendAction("authDidNotValidateNotICloudUser")},userIsNotVerified:function(){COS.authUIState.sendAction("authDidNotValidateNotVerified")},iCloudLiteUnsupportedBrowser:function(){COS.authUIState.sendAction("iCloudLiteUnsupportedBrowser")},userIsUnqualified:function(){this.set("userRequiresUnqualifiedNotification",YES)},handle503:function(e){var t,n;if(e)for(t in e)if(t.match(/^retry[ _\-]?after$/i)){n=e[t];break}n&&(n=parseInt(n,10)),COS.authUIState.sendAction("authDRLocked",{retryAfter:n})},validatePreferences:function(e,t,n,r,i){var s=COS.authUIState;if(this.get("accountRepairRequired")){SC.debug("Account requires repair, no need to check preferences");var o;return CloudOSBootstrap.isTermsAndConditionUrl&&(o=function(){var e=CloudOS.authController;e.redirectToPostLoginRedirectUrl()||e.set("userHasAcceptedTerms",!0)}),s.sendAction("accountRequiresRepair",o),YES}if(this.get("hsaChallengeRequired"))return SC.debug("HSA challenge required, no need to check preferences"),e?s.sendAction("authDidValidate"):s.sendAction("authDidNotValidate"),YES;SC.debug("Validating Preferences");if(t!==undefined&&!e)return NO;var u=this.get("statechart"),a=r===330;if(!i){var f=YES;if(r===503)this.handle503(n),f=NO;else if(n&&n.status!==0){SC.warn("responseBody status of KVS response was = ",n.status);if(this._preferencesRetriesSentCount>=COS.MAX_PREFERENCES_RETRIES)SC.warn("Already exceeded the maximum number of get preferences request attempts. Hence marking the request as failure."),s.sendAction
("authDidNotConnect","KVSFailed"),f=NO;else{if(!a){this._preferencesRetriesSentCount++,u.sendAction("resendGetPrefsRequest");return}if(!this._prefsWrongPartitionCheckDone||!a){this._prefsWrongPartitionCheckDone=a,this._preferencesRetriesSentCount=0,u.sendAction("resendLoginOrValidateRequest");return}SC.warn("The response status is %@",r),this._prefsWrongPartitionCheckDone&&SC.warn("We have already done the re-login once to get the correct partition information. Since we are still getting wrong partition information, we mark the login as failure."),s.sendAction("authDidNotConnect","KVSFailed Wrong Partition"),f=NO}}else if(!n||r!==200){SC.warn("KVS returned invalid response.");if(!(this._preferencesRetriesSentCount>=COS.MAX_PREFERENCES_RETRIES)){this._preferencesRetriesSentCount++,u.sendAction("resendGetPrefsRequest");return}SC.warn("Already exceeded the maximum number of get preferences request attempts. Hence marking the request as failure."),s.sendAction("authDidNotConnect","KVSFailed"),f=NO}if(!f)return NO}var l=this.get("accountPreferences"),c=CW.getUrlParameters();if(c.clearPrefs)return window.confirm("Are you sure you want to clear all preferences?")?COS.prefsController.clearPreferences(function(){document.location=document.location.href.replace("clearPrefs","firstrun")}):s.sendAction("authDidValidate"),YES;if(this.shouldShowFirstRun(l,c)){if(!window.CloudOSBootstrap||!CloudOSBootstrap.isOnSupportedMobile)return SC.debug("Missing account preferences; Lets show first run"),s.sendAction("showFirstRun"),NO;l.get("locale")||l.set("locale",CloudOSBootstrap.getLocale())}return SC
.debug("Account preferences look good, moving on..."),s.sendAction("authDidValidate"),YES},reportAuthError:function(e,t){SC.Benchmark.end("AUTH_DURATION");var n={authDuration:COS.lastBenchmarkDurationFor("AUTH_DURATION"),silentAuth:e==="validate"?YES:NO,failureReason:t};e==="login"&&(n.loginAttempts=this.get("loginAttempts")),COS.statsController.recordStat("cloudos","AuthFailure",n)},reportAuthSuccess:function(e){e==="login"&&SC.Benchmark.end("AUTH_DURATION");var t=this.get("requestInfo"),n=CloudOS.shareController&&!!CloudOS.shareController.get("recordInfo"),r=COS.authController,i=r.get("hsaTrustedBrowser"),s=r.get("user"),o=s.get("hsaEnabled"),u=s.get("hsaVersion"),a=s.get("isManagedAppleID"),f=r.getPath("accountPreferences.secondaryLocale"),l={idmsLocale:s.get("idmsLocale"),accountLocale:String.preferredLanguage,browserLocale:(navigator.language||navigator.browserLanguage).toLowerCase(),authDuration:COS.lastBenchmarkDurationFor("AUTH_DURATION"),rememberCredentials:this.get("isExtendedLogin"),silentAuth:e==="validate"?YES:NO,referrer:document.referrer,devicePixelRatio:window.devicePixelRatio,region:t?t.region:null,country:t?t.country:null};n&&(l.shareLogin=YES),f&&(l.accountSecondaryLocale=f),o&&r.get("isAuthenticated")&&(l.hsaEnabled=YES,l.hsaVersion=u,l.hsaTrustedBrowser=i,l.isManagedAppleID=a),e==="login"&&(l.loginAttempts=this.get("loginAttempts")),COS.statsController.recordStat("cloudos","AuthSuccess",l)},appleIdsAreEqual:function(e,t,n){e=e?e.toLowerCase():"",t=t?t.toLowerCase():"",n=n?n.toLowerCase():"";var r=e===t||e===n,i;return!r&&/@(me|mac)\.com$/.test(e)&&(i=e.replace
(/@.*$/,""),r=i===t.replace(/@.*$/,"")||i===n.replace(/@.*$/,"")),r},clearUserState:function(){arguments.callee.base.apply(this,arguments),CW.notificationCenter.postNotification("willClearUserState"),CK.meCardController.reset(),this.set("loginAttempts",0),this.set("_loginRetriesSentCount",0),this.set("_preferencesRetriesSentCount",0),this.set("_prefsWrongPartitionCheckDone",NO)},shouldRefreshValidateToken:function(){this.validateUser(function(){SC.debug("Successfully refreshed the validate token")})},exportAppsOrder:function(){var e=this.getPath("_auth_bag.appsOrder");e&&(this.set("appsOrder",e),CloudOS.appController.notifyPropertyChange("appIndices"))}.observes("user"),appsOrder:["mail","contacts","calendar","photos","iclouddrive","notes","notes2","reminders","pages","numbers","keynote","newspublisher","fmf","find","settings"],lockedAlertDescription:function(e,t,n){return SC.none(t)?e+="NoETA":t<=3600?e+="Hour":e+="HourOrMore",e.loc({appName:n})}}),COS.Request=CW.Request.extend(CK.RequestReporting,{isJSON:YES,useCrossDomain:YES,withCredentials:YES,attachIdentifyingHeaders:NO,contentType:undefined,queryParametersOrder:["dsid"],init:function(){var e;arguments.callee.base.apply(this,arguments),this.get("useCrossDomain")&&(e=this.get("contentType"),e===undefined&&(e="text/plain",this.set("contentType",e))),e||(e=this.get("contentType")),e&&this.header("Content-Type",e);var t=COS.authController,n=t.getPath("user.dsid"),r=this.get("address");n&&(!r||r.indexOf("dsid=")===-1)&&this.queryParameter("dsid",n),this.queryParameter("clientId",COS.CLIENT_ID),this.queryParameter("clientBuildNumber"
,SC.buildNumber),this.queryParameter("clientMasteringNumber",SC.masteringNumber)}}),COS.prefsController=SC.Object.create(SC.DelegateSupport,{delegate:null,_lastKnownAccountPrefs:{},_appsRemainingToFetch:[],_isRegionSettingsFetched:NO,_waitToRetrySavingPrefs:15e3,getRequestedApps:function(e){var t=[],n=COS.get("isCloudOSMini");if(e)t.push({"app-id":e,"registry-version":""});else{var r=COS.apps,i=this._appsRemainingToFetch,s;i.length>0&&(r=CW.invertArray(i)),t.push({"app-id":"account","registry-version":""});for(s in r)s==="iw"&&!r.gilligan&&t.push({"app-id":"gilligan","registry-version":""}),t.push({"app-id":s,"registry-version":""})}return t},getPreferences:function(e,t){var n=this.getRequestedApps(e),r=n.getEach("app-id"),i=COS.Request.create({type:"POST",address:"/json/sync",applicationName:e,COPY_KEYS:COS.Request.prototype.COPY_KEYS.concat(["applicationName"])});i.set("reportRequest",YES);var s=i.get("address"),o=CK.servicesController.getServiceUrlFor("keyvalue",YES),u={"service-id":"appleprefs",apps:n};i.set("address",o+s),i.notify(200,this,this.getPreferencesDidSucceed,t,r),i.notify(0,this,this.getPreferencesDidFail,t,r),SC.debug("COS: requesting preferences");var a=this.get("delegate");this.invokeDelegateMethod(a,"getPreferencesRequestWillBeSent"),i.send(u)},getPreferencesDidSucceed:function(e,t,n){var r=e.get("body"),i=this.get("currentPrefsResponse");if(!r||r.status!==0){this.getPreferencesDidFail(e);return}var s=[],o=COS.appsController,u=this.get("delegate"),a,f,l,c,h,p,d,v,m,g,y=r.apps,b=y.getEach("app-id"),w=b.indexOf("iw"),E=b.indexOf("gilligan"),S=w!==-1,x=S&&y[
w].keys.length>0,T=E!==-1,N=T&&y[E].keys.length>0;for(h=0,p=y.length;h<p;h++){f=y[h],a=f["app-id"],m=f.keys,this._appsRemainingToFetch.removeObject(a),s.push(a);if(f["registry-status"]!==1){var C="Unexpected KVS response for %@".fmt(a);SC.info(C+":"+r),CK.errorCatcher.reportServerError({error:C});continue}g=f["registry-version"];if(a==="account")d=COS.authController.get("accountPreferences"),d&&m&&(d.set("preferencesVersion",g),m.forEach(function(e){e.name.toLowerCase().indexOf("locale")!==-1&&CK.setValueInLocalStorage(e.name,e.data),d.set(e.name,e.data)}),this._lastKnownAccountPrefs=SC.clone(d.prefsHash(),YES),d.set("hasInitialized",YES),this.fetchRegionSettings());else{if(a==="gilligan"&&!o.getAppInfoFor(a))continue;a==="iw"&&(x||(m=y[E].keys)),v={},m&&m.forEach(function(e){v[e.name]=e.data}),l=o.getAppInfoFor(a),l?(l.set("preferencesVersion",g),a==="iw"&&!x&&this.savePreferences(a,v,null),l.set("preferences",v),this.invokeDelegateMethod(u,"passMessageToAllApps","_cloudOSStateChange",{appPreferences:function(){var e={};return e[a]=v,e}()})):o.storePrefsForDynamicApp(a,v,g)}}return s.indexOf("account")!==-1&&(COS.authController.monitorForUsernameChange(),CW.notificationCenter.postNotification("accountPreferencesLoaded")),this.didFetchAllApps(s,n)?(SC.debug("COS: Successfully retrieved all preferences"),t instanceof Function&&t.call(this,YES,undefined,r,e.get("status"))):(SC.info("COS: Fetching preferences for the remaining apps"),this.getPreferences(null,t)),YES},didFetchAllApps:function(e,t){var n=YES,r,i,s;for(i=0,s=t.length;i<s;i++)r=t[i],e.contains(r)||(this._appsRemainingToFetch
.push(r),n=NO);return n},getPreferencesDidFail:function(e,t){var n=e.getPath("request.applicationName"),r=e.get("body"),i="COS: There was an exception while getting the preferences";this.set("currentPrefsResponse",null);if(SC.kindOf(r,SC.Error))SC.error(i+". %@ (%@)".fmt(r.get("message"),r.get("code")));else{var s=r?r.status:null;SC.debug(i+", status “%@”, body “%@”, preferencesStatus '%@'",e.get("status"),r,s)}return this._appsRemainingToFetch=[],t instanceof Function&&t.call(this,NO,undefined,e.get("body"),e.get("status")),YES},savePreferences:function(e,t,n,r){if(SC.typeOf(t)!==SC.T_HASH){SC.debug("COS: Preferences to save is not a hash");return}if(COS.authController.get("isNotAuthenticated")){SC.info("COS: Cannot savePreferences since we are no longer logged In.");return}var i=COS.appsController,s=i.getAppInfoFor(e),o=this.get("delegate"),u,a,f,l=CW.notificationCenter;r=r?r:0;if(s){a=s.get("preferences"),u=s.get("preferencesVersion");if(CW.valuesAreEqual(t,a)){SC.debug("COS: Preferences did not change for “%@”, so will not send to server.",e);return}var c=SC.merge(a,t);s.set("preferences",c),this.invokeDelegateMethod(o,"passMessageToAllApps","_cloudOSStateChange",{appPreferences:function(){var t={};return t[e]=c,t}()})}else{if(e!=="account"){SC.debug("COS: cannot save preferences for unknown app “%@”",e);return}a=COS.authController.get("accountPreferences"),u=a&&a.get("preferencesVersion"),a||CW.fatalError("COS: Account Preferences object not found!");var h=a.get("prefsList"),p=[],d,v,m,g;for(d=0,v=h.length;d<v;d++)m=h[d],t[m]!==undefined&&!CW.valuesAreEqual(this._lastKnownAccountPrefs
[m],t[m])&&(p.push(m),this._lastKnownAccountPrefs[m]=SC.clone(t[m]));if(p.length===0){SC.debug("COS: No account preferences changed"),l.postNotification("accountPreferencesLoaded");return}p.indexOf("regionFormat")!==-1&&(this._isRegionSettingsFetched=NO),p.indexOf("locale")===-1&&p.indexOf("secondaryLocale")===-1&&this.invokeDelegateMethod(o,"passMessageToAllApps","_cloudOSStateChange",{accountPreferences:t})}var y=COS.Request.create({type:"POST",address:"/json/sync",applicationName:e,COPY_KEYS:COS.Request.prototype.COPY_KEYS.concat(["applicationName","newPrefs"])});y.set("reportRequest",YES),f=this.hashToPrefKeys(t);var b={"service-id":"appleprefs",apps:[{"app-id":e,"registry-version":u||"",keys:f}]},w=y.get("address"),E=CK.servicesController.getServiceUrlFor("keyvalue",YES);y.set("address",E+w),y.set("body",b),y.notify(200,this,this.savePreferencesDidSucceed,n,r),y.notify(0,this,this.savePreferencesDidFail,n),SC.debug("COS: Saving preferences for “%@”",e),this.invokeDelegateMethod(o,"savePreferencesRequestWillBeSent"),y.send(),e==="account"&&(COS.authController.monitorForUsernameChange(),l.postNotification("accountPreferencesLoaded"))},clearPreferences:function(e){var t=COS.Request.create({type:"POST",address:"/json/wipe"});t.set("reportRequest",YES);var n=COS.appsController,r,i,s,o,u,a={"service-id":"appleprefs",apps:[]};a.apps.push("account");for(u in COS.apps)COS.apps.hasOwnProperty(u)&&a.apps.push(u);var f=t.get("address"),l=CK.servicesController.getServiceUrlFor("keyvalue",YES);t.set("address",l+f),t.set("body",a),t.notify(200,this,this.clearPreferencesDidSucceed,e),t
.notify(0,this,this.clearPreferencesDidFail,e),SC.debug("COS: Clearing all preferences..."),t.send(a)},clearPreferencesDidSucceed:function(e,t){var n=e.get("body"),r=n.status,i=COS.appsController,s,o,u;if(SC.none(r)||r!==0)return NO;(u=COS.authController.get("user"))&&u.set("preferences",{});for(s in COS.apps)o=i.getAppInfoFor(s),o&&o.set("preferences",{});return t instanceof Function&&t(),YES},clearPreferencesDidFail:function(e,t){return SC.error("COS: There was an error clearing all preferences, status %@",e.get("status")),t instanceof Function&&t(),YES},savePreferencesDidSucceed:function(e,t,n){var r=[],i=[],s=e.getPath("request.applicationName"),o=e.get("body"),u,a,f,l,c,h=NO,p=this.get("delegate");if(!o)return this.savePreferencesDidFail(e);this.fetchRegionSettings();var d=o;if(!d||d.status!==0)return this.savePreferencesDidFail(e,t);f=d.apps[0]["registry-version"],c=d.apps[0].keys,c.forEach(function(e){l=e["update-status"];if(l!==undefined&&l!==0)switch(l){case 3:SC.debug("COS: KVS update status 3 for key:",e.name),r.push(e.name);break;case 4:SC.debug("COS: KVS update status 4 for key:",e.name),i.push(e.name);break;default:SC.debug("COS: error updating preferences key “%@”, update-status is %@",e.name,l),h=YES}});if(h)return this.savePreferencesDidFail(e);(i.length>0||r.length>0)&&n++,r.length>0&&this.invokeLater(function(){var e=this._getPreferencesForKeys(s,r);n<=3&&this.savePreferences(s,e,null,n)}.bind(this),this._waitToRetrySavingPrefs);if(i.length>0){var v=this._getPreferencesForKeys(s,i);n<=3&&this.savePreferences(s,v,null,n)}return u=COS.appsController.getAppInfoFor
(s),u?(a=u.get("preferences"),u.set("preferencesVersion",f),this.invokeDelegateMethod(p,"passMessageToAllApps","_cloudOSStateChange",{appPreferences:function(){var e={};return e[s]=a,e}()})):s==="account"&&(a=COS.authController.get("accountPreferences"),a.set("preferencesVersion",f),this.invokeDelegateMethod(p,"passMessageToAllApps","_cloudOSStateChange",{accountPreferences:a.prefsHash(YES)})),a?(t instanceof Function&&t(),SC.debug("COS: successfully saved preferences for “%@”",s),YES):this.savePreferencesDidFail(e)},savePreferencesDidFail:function(e,t){var n=e.getPath("request.applicationName");return SC.error("COS: There was an error saving the preferences for “%@”, status %@",n,e.get("status")),t instanceof Function&&t(),this.getPreferences(),YES},hashToPrefKeys:function(e){var t=[],n,r;for(n in e)r=e[n],r!==undefined&&t.push({name:n,data:r});return t},allAppPreferencesHash:function(){var e={},t=COS.appsController,n,r;for(r in COS.apps)if(COS.apps.hasOwnProperty(r)){n=t.getAppInfoFor(r);if(!n)continue;e[r]=n.get("preferences")||{},e[r].preferencesVersion=n.get("preferencesVersion")||""}return e},notifyAccountPreferencesDidChange:function(){var e=this.get("delegate");this.invokeDelegateMethod(e,"passMessageToAllApps","accountPreferencesDidChange")},setPreferences:function(e,t,n){var r=COS.authController.get("accountPreferences"),i=COS.appsController,s=this.get("delegate"),o;if(e)for(var u in e)e.hasOwnProperty(u)&&r.set(u,e[u]);this._lastKnownAccountPrefs=SC.clone(r.prefsHash(),YES),r.set("hasInitialized",YES);if(t){for(var a in t){var f=COS.appsController.getAppInfoFor(a)
;f?(o=t[a].preferencesVersion,f.set("preferencesVersion",o),t[a].preferencesVersion&&delete t[a].preferencesVersion,f.set("preferences",t[a])):i.storePrefsForDynamicApp(a,t,o)}this.invokeDelegateMethod(s,"passMessageToAllApps","_cloudOSStateChange",{appPreferences:t})}n&&n.call&&n.call(this,YES,undefined,undefined,undefined,YES)},_getPreferencesForKeys:function(e,t){var n={},r=this._getPreferencesForApp(e);for(var i=0;i<t.length;i++){var s=t[i];n[s]=r[s]}return n},_getPreferencesForApp:function(e){var t;return e==="account"?(t=COS.authController.accountPreferences(),t):(t=this.allAppPreferencesHash(),t[e])},fetchRegionSettings:function(){!this._isRegionSettingsFetched&&COS.regionController&&(COS.regionController.fetchRegionSettings(),this._isRegionSettingsFetched=YES)}}),COS.PushController=SC.Object.extend({webCourierURL:null,pushToken:null,delegate:null,cosPushTopics:[],hasPushConnection:null,registeredPushTopics:null,pushTTL:43200,appsMissingPushTopic:null,missingPushTopics:null,registeredCloudKitContainers:{},init:function(){var e=COS.appsController._appsInfo,t=[],n=[],r;for(r in e)e[r].get("pushTopic")?t.push(r):n.push(r);return this.set("appsMissingPushTopic",n),this.set("pushApps",t),arguments.callee.base.apply(this,arguments)},registerPushTopic:function(e){var t=this.get("registeredPushTopics");if(!t||t.indexOf(e)!==-1)return;var n=this.get("missingPushTopics");SC.typeOf(n)!==SC.T_ARRAY&&(n=[]),n.indexOf(e)===-1&&n.push(e),this.set("missingPushTopics",n),this.registerMissingTopics()},pushTopics:function(){var e=COS.appsController._appsInfo,t,n,r,i;t={};for(i in e)r=e[
i],n=r.get("pushTopic"),n&&r.get("hasAccessToRequiredServices")&&(t[n]=!0);return t=CW.invertHash(t).concat(this.get("cosPushTopics")),t}.property().cacheable(),pushApps:null,isRegisteredToAllTopics:function(){var e=this.get("pushTopics"),t=this.get("registeredPushTopics"),n,r;if(!t||!this.get("pushToken"))return NO;for(n=0,r=e.length;n<r;n++)if(t.indexOf(e[n])===-1)return NO;return YES}.property("registeredPushTopics","pushToken"),initiatePushConnection:function(e,t){e&&this.set("delegate",e),this.startRefreshWebAuthTimer();if(!CK.servicesController.getServiceInfoFor("push")){SC.debug("initiatePushConnection(): PushWS is not available.");return}var n=CK.getValueFromSessionStorage("pushToken");if(n){SC.debug("initiatePushConnection(): Found pushToken from existing session"),this.set("pushToken",n),this.set("missingPushTopics",this.get("pushTopics")),this.registerMissingTopics();return}this.get("pushToken")?this.parkConnectionIfAppropriate():this.initializePush(t)},increaseAttemptCount:function(e){var t="_attemptCount_"+e,n=this[t],r;return this[t]=r=n?n+1:1,SC.info("COS.pushController: Attempt #%@ for '%@'",r,e),r},resetAttemptCount:function(e){var t="_attemptCount_"+e;this[t]=0},scheduleAttempt:function(e){var t="_attemptCount_"+e,n=this[t];n||(this[t]=n=1);var r="_attemptTimer_"+e,i=this[r];if(i){SC.warn("COS.pushController: There is already an attemptTimer for %@",e);return}var s=COS.PUSH_RETRY_WAIT*Math.pow(2,n-1);SC.debug("COS.pushController: Scheduling '%@' in %@ seconds",e,s),this[r]=this.invokeLater(function(){this[r]=null;if(COS.authController.get("isNotAuthenticated"
))return;this[e]()},s*1e3)},parkConnectionIfAppropriate:function(){var e=this.get("pushToken"),t=this;if(!e)SC.info("COS.pushController: Missing pushToken, cannot park a connection without it");else if(this.get("hasPushConnection")===YES){SC.info("COS.pushController: A connection is already parked with pushToken=%@",e);return}if(!window.CloudOS||!CloudOS.isCloudOSClient){this.invokeLater(function(){COS.pushController.parkConnection()},500);return}CloudOS.runWhenReady(function(){t.invokeLater(function(){COS.pushController.parkConnection()},1e3)})},initializePush:function(e){if(this.get("hasPushConnection")===YES&&this.get("pushToken")){SC.warn("We already have an established push connection");return}if(this._isInitiatingPushConnection){SC.warn("Already initiating push connection");return}var t=this.get("pushTTL"),n=this.increaseAttemptCount("initializePush"),r,i=CK.Request.postUrl("/getToken");i.set("serviceName","push"),i.set("isJSON",YES),i.set("reportRequest",YES),i.notify(200,this,function(e){var t=e.get("body"),n=t.pushToken,r=t.pushTokenTTL,i=t.errors,s=this.get("delegate"),o=t.registeredTopics,u,a,f,l;if(i){var c=this.get("missingPushTopics");for(u=0,a=i.length;u<a;u++){f=i[u],l=f.pushTopic,SC.info("COS.pushController: initializePush error - "+f.errorMessage+" - "+l);if(o&&o.indexOf(l)!==-1)continue;SC.typeOf(c)!==SC.T_ARRAY&&(c=[]),c.indexOf(l)===-1&&c.push(l)}this.set("missingPushTopics",c),c.length>0&&this.scheduleAttempt("registerMissingTopics")}return SC.debug("Push token acquired: %@",n),this.set("pushToken",n),this.set("webCourierURL",t.webCourierURL),r&&this.set
("pushTTL",r),CK.setValueInSessionStorage("pushToken",n),s&&s.invokeDelegateMethod(s,"didInitializePush",t),this.set("registeredPushTopics",o),this._isInitiatingPushConnection=NO,this.parkConnectionIfAppropriate(),YES}),i.notify(400,this,function(e){return SC.debug("%@ received from pushws. Reverting to polling for this session.",e.get("status")),this._isInitiatingPushConnection=NO,YES}),i.notify(0,this,function(e){return SC.debug("Failed to aquire push token."),this.set("hasPushConnection",NO),this.set("pushToken",null),this._isInitiatingPushConnection=NO,this.scheduleAttempt("initializePush"),YES}),i.queryParameter("attempt",n),r={pushTopics:e?[e]:this.get("pushTopics"),pushTokenTTL:t},this._isInitiatingPushConnection=YES,i.send(r)},parkConnection:function(e){if(this.get("hasPushConnection")===YES&&!e){SC.warn("We already have an established push connection");return}var t=this.get("webCourierURL")+"?tok=%@&ttl=%@".fmt(this.get("pushToken"),this.get("pushTTL")),n=COS.Request.postUrl(t),r=this.increaseAttemptCount("parkConnection");n.set("timeout",this.get("pushTTL")*1e3),n.set("withCredentials",NO),n.willSend=null,n.willReceive=null,n.notify(200,this,function(e){var t=e.get("body"),n=this.get("delegate");return SC.debug("Received push notification: %@",t),n&&n.invokeDelegateMethod(n,"handlePushNotification",t),this.resetAttemptCount("parkConnection"),this.invokeLater(function(){COS.pushController.parkConnection(YES)},500),YES}),n.notify(408,this,function(e){return SC.debug("409: Request Time-out"),this.set("hasPushConnection",NO),this.scheduleAttempt("parkConnection"),YES})
,n.notify(409,this,function(e){return SC.debug("409: Re-parked multiple connections with the same pushToken"),this.set("hasPushConnection",NO),this.scheduleAttempt("parkConnection"),YES}),n.notify(403,this,function(e){SC.debug("403: The pushToken has expired");var t=this;return SC.info("Unregistering the topics before trying again..."),this.unInitializePush(function(){t.scheduleAttempt("initializePush")}),COS.statsController.recordStat("cloudos","APNS_403_Response"),this.set("hasPushConnection",NO),this.set("pushToken",null),YES}),n.notify(0,this,function(e){return SC.debug("Unknown error: The park push connection closed unexpectedly"),this.set("hasPushConnection",NO),this.scheduleAttempt("parkConnection"),YES}),n.clearQueryParameters(),n.send(),this._pushConnection=n,this.set("hasPushConnection",YES)},registerMissingTopics:function(){var e=this.get("missingPushTopics"),t=this.get("pushToken");if(!e||e.length===0){SC.info("COS.pushController: No missing pushTopics found.");return}if(!t){SC.warn("COS.pushController: You need a pushToken before you can call registerMissingTopics"),this.scheduleAttempt("initializePush");return}var n=this.get("pushTTL"),r=this.increaseAttemptCount("registerMissingTopics"),i=CK.Request.postUrl("/registerTopics");i.set("serviceName","push"),i.set("isJSON",YES),i.set("reportRequest",YES),i.notify(200,this,function(e){var t=e.get("body"),n=t.errors,r=t.registeredTopics,i=this.get("missingPushTopics"),s,o,u,a,f;if(n){SC.typeOf(i)!==SC.T_ARRAY&&(i=[]);for(s=0,o=n.length;s<o;s++)a=n[s],f=a.pushTopic,SC.info("COS.pushController: registerTopics error - "+
a.errorMessage+" - "+f),i.indexOf(f)===-1&&i.push(f);this.set("missingPushTopics",i)}if(r)for(s=0,o=r.length;s<o;s++){f=r[s],u=i.indexOf(f),i&&u!==-1&&i.splice(u,1);var l=this.get("registeredPushTopics");l?l.indexOf(f)===-1&&l.push(f):this.set("registeredPushTopics",[f])}return i.length>0?this.scheduleAttempt("registerMissingTopics"):this.resetAttemptCount("registerMissingTopics"),this.set("webCourierURL",t.webCourierURL),this.parkConnectionIfAppropriate(),YES}),i.notify(400,this,function(t){return SC.debug("%@: Failed to register topics, backing off, %@",t.get("status"),e),YES}),i.notify(0,this,function(t){return SC.debug("Unknown error: Failed to register topics, %@",e),this.scheduleAttempt("registerMissingTopics"),YES}),SC.debug("Registering push topics, %@",e);var s={pushToken:t,pushTopics:e,pushTokenTTL:n};i.queryParameter("attempt",r),i.send(s)},refreshWebAuth:function(){var e=CK.Request.getUrl("/refreshWebAuth");e.set("serviceName","push"),e.set("isJSON",YES),e.set("reportRequest",YES),e.notify(0,this,function(e){return YES}),e.send()},startRefreshWebAuthTimer:function(){if(this.get("refreshWebAuthTimer"))return;var e=SC.Timer.schedule({target:this,action:"refreshWebAuth",interval:COS.REFRESH_WEB_AUTH_INTERVAL*1e3,repeats:YES});SC.debug("Started refreshWebAuthTimer"),this.set("refreshWebAuthTimer",e)},stopRefreshWebAuthTimer:function(){var e=this.get("refreshWebAuthTimer");if(!e)return;e.invalidate(),this.set("refreshWebAuthTimer",null),SC.debug("Stopped refreshWebAuthTimer")},unInitializePush:function(e){var t=this.get("pushToken"),n=this.get("pushTopics");if(this.get
("hasPushConnection")!==YES&&!t||!n||n.length===0){e instanceof Function&&e();return}var r=CK.Request.postUrl("/unregisterTopics");r.set("serviceName","push"),r.set("isJSON",YES),r.set("reportRequest",YES),r.notify(200,this,function(t){return SC.info("COS.pushController: Successfully uninitialized push"),e instanceof Function&&e(t),YES}),r.notify(0,this,function(t){return SC.debug("COS.pushController: Failed to uninitialize push."),e instanceof Function&&e(t),YES}),r.send({pushToken:t,pushTopics:n})},pushTokenDidChange:function(){var e=this.get("registeredCloudKitContainers"),t=Object.keys(e),n=t.length;for(var r=0;r<n;r++){var i=t[r],s=e[i];s!==!0&&this.registerForCloudKitSubscriptions(i)}}.observes("pushToken"),registerForCloudKitSubscriptions:function(e,t){var n=this.get("registeredCloudKitContainers");if(n[e]===!0)return;n[e]=0,this.set("registeredCloudKitContainers",n);var r="production",i="development",s=CloudOS.getEnvironment();s==="PROD"&&(i="production");var o=1,u=1e4,a=this.get("pushToken");if(!a){SC.info("COS.pushController: Missing push token for CloudKit push registration.");return}var f=["INTERNAL_ERROR","NETWORK_ERROR","SERVICE_UNAVAILABLE","TRY_AGAIN_LATER"],l="/device/%@/%@/%@/tokens/register".fmt(o,e,r),c=CK.Request.postUrl(l);c.set("serviceName","ckdeviceservice"),c.set("isJSON",YES),c.set("reportRequest",YES),c.notify(200,this,function(n){SC.info("COS.pushController: CloudKit push registration successful.");var r=this.get("registeredCloudKitContainers");return r[e]=!0,t&&this.get("appsMissingPushTopic").removeObject(t),this.set("registeredCloudKitContainers"
,r),YES}),c.notify(0,this,function(n){var r=n.get("body"),i="";typeof r=="object"&&!SC.none(r)&&(i=r.serverErrorCode);if(f.indexOf(i)!==-1){var s=this.get("registeredCloudKitContainers");if(s[e]<3)this.invokeLater(this.registerForCloudKitSubscriptions,u,e,t);else{var s=this.get("registeredCloudKitContainers");s[e]=!1,this.set("registeredCloudKitContainers",s),SC.info("COS.pushController: Cannot establish push connection for container: "+e)}s[e]++,this.set("registeredCloudKitContainers",s)}return SC.warn("COS.pushController: CloudKit push registration failed."),YES}),c.send({apnsToken:a,clientID:COS.CLIENT_ID,apnsEnvironment:i})}}),COS.PushController.mixin({initiatePushConnection:function(e,t){COS.pushController||(COS.pushController=COS.PushController.create()),COS.pushController.initiatePushConnection(e,t)}}),COS.defaultRegionFormattingRules={locale:"en-US",date:{ca:["gregory","generic"],hourNo0:!0,hour12:!0,formats:{"short":"{1}, {0}",medium:"{1}, {0}",full:"{1} 'at' {0}","long":"{1} 'at' {0}",availableFormats:{d:"d",E:"ccc",Ed:"d E",Ehm:"E h:mm a",EHm:"E HH:mm",Ehms:"E h:mm:ss a",EHms:"E HH:mm:ss",Gy:"y G",GyMMM:"MMM y G",GyMMMd:"MMM d, y G",GyMMMEd:"E, MMM d, y G",h:"h a",H:"HH",hm:"h:mm a",Hm:"HH:mm",hms:"h:mm:ss a",Hms:"HH:mm:ss",hmsv:"h:mm:ss a v",Hmsv:"HH:mm:ss v",hmv:"h:mm a v",Hmv:"HH:mm v",M:"L",Md:"M/d",MEd:"E, M/d",MMM:"LLL",MMMd:"MMM d",MMMEd:"E, MMM d",MMMMd:"MMMM d",ms:"mm:ss",y:"y",yM:"M/y",yMd:"M/d/y",yMEd:"E, M/d/y",yMMM:"MMM y",yMMMd:"MMM d, y",yMMMEd:"E, MMM d, y",yMMMM:"MMMM y",yQQQ:"QQQ y",yQQQQ:"QQQQ y"},dateFormats:{yMMMMEEEEd:"EEEE, MMMM d, y",yMMMMd
:"MMMM d, y",yMMMd:"MMM d, y",yMd:"M/d/yy"},timeFormats:{hmmsszzzz:"h:mm:ss a zzzz",hmsz:"h:mm:ss a z",hms:"h:mm:ss a",hm:"h:mm a"}},calendars:{generic:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],"short":["M01","M02","M03","M04","M05","M06","M07","M08","M09","M10","M11","M12"],"long":["M01","M02","M03","M04","M05","M06","M07","M08","M09","M10","M11","M12"]},days:{narrow:["S","M","T","W","T","F","S"],"short":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"long":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},eras:{narrow:["ERA0","ERA1"],"short":["ERA0","ERA1"],"long":["ERA0","ERA1"]},dayPeriods:{am:"AM",pm:"PM"}},gregory:{months:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],"short":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"long":["January","February","March","April","May","June","July","August","September","October","November","December"]},days:{narrow:["S","M","T","W","T","F","S"],"short":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"long":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},eras:{narrow:["B","A","BCE","CE"],"short":["BC","AD","BCE","CE"],"long":["Before Christ","Anno Domini","Before Common Era","Common Era"]},dayPeriods:{am:"AM",pm:"PM"}}}},number:{nu:["latn"],patterns:{decimal:{positivePattern:"{number}",negativePattern:"{minusSign}{number}"},currency:{positivePattern:"{currency}{number}",negativePattern:"{minusSign}{currency}{number}"},percent:{positivePattern:"{number}{percentSign}",negativePattern:"{minusSign}{number}{percentSign}"}},symbols:
{latn:{decimal:".",group:",",nan:"NaN",plusSign:"+",minusSign:"-",percentSign:"%",infinity:"∞"}},currencies:{AUD:"A$",BRL:"R$",CAD:"CA$",CNY:"CN¥",EUR:"€",GBP:"£",HKD:"HK$",ILS:"₪",INR:"₹",JPY:"¥",KRW:"₩",MXN:"MX$",NZD:"NZ$",TWD:"NT$",USD:"$",VND:"₫",XAF:"FCFA",XCD:"EC$",XOF:"CFA",XPF:"CFPF"}}};var REGION_FALLBACKS={no:"nb","no-NO":"nb-NO","iw-IL":"he-IL","vi-VI":"vi","zh-CN":"zh-Hans-CN","zh-TW":"zh-Hant-TW","zh-Hant-CN":"zh-Hant"};COS.regionController=SC.Object.create({localeVersion:4,localeURL:function(){var e=COS.authController.get("defaultAssetHostname");return"https://"+e+"/locales/"}.property("COS.authController.defaultAssetHostname"),regionFormattingRules:null,defaultRules:null,_retries:null,init:function(){this.set("defaultRules",COS.defaultRegionFormattingRules)},load:function(e,t){var n=this._getISOnameForRegion(e),r=this.get("localeURL")+this.get("localeVersion")+"/"+n+".json",i=COS.Request.create({type:"GET",address:r,isJSON:YES,withCredentials:NO});i.notify(200,this,this.loadRulesDidSucceed,t),i.notify(0,this,this.loadRulesDidFail,t),i.send()},loadRulesDidSucceed:function(e,t){var n=e.get("body");return t(n),YES},loadRulesDidFail:function(e,t){var n=this.defaultRules;return t(n),YES},fetchRegionSettings:function(){this._retries=1;var e=COS.authController.get("accountPreferences"),t=e.get("regionFormat");if(!t){var n=e.get("locale"),r;n?(e.set("regionFormat",n),r="Setting missing 'regionFormat' for user to '"+n+"'"):(n="en-us",r="Defaulting to 'en-us' because there is no region format set for this user"),t=n,SC.Logger.info(r)}if(t==="en-us"){this.useFallbackRules
();return}var i=this._getISOnameForRegion(t);REGION_FALLBACKS[i]&&(i=REGION_FALLBACKS[i]);var s=this.get("localeURL")+this.get("localeVersion")+"/"+i+".json";this._sendNetworkRequest(s)},_getISOnameForRegion:function(e){var t="",n=e?e.split("-"):["en","us"];this._regionParts=n,t=n[0];if(n.length>2)t+="-"+this._capitalizeFirstLetter(n[1]),t+="-"+n[2].toUpperCase();else if(n.length>1){var r=n[1].length;r>2?t+="-"+this._capitalizeFirstLetter(n[1]):t+="-"+n[1].toUpperCase()}return t},_capitalizeFirstLetter:function(e){return e.charAt(0).toUpperCase()+e.slice(1)},_sendNetworkRequest:function(e){this._retries++;var t=COS.Request.create({type:"GET",address:e,isJSON:YES,withCredentials:NO});t.notify(200,this,this.getRulesDidSucceed),t.notify(0,this,this.getRulesDidFail),t.send()},getRulesDidSucceed:function(e){var t=e.get("body");return t||this.getRulesDidFail(e),this.set("regionFormattingRules",t),CW.notificationCenter.postNotification("didFetchRegionFormattingSettings"),YES},getRulesDidFail:function(e){var t=e.status,n=e.request.address;if(t===404){var r=this._regionParts.join("-");COS.statsController.recordStat("cloudOS","region formatter",{clientId:COS.CLIENT_ID,regionFormat:r,requestedRegion:this._getISOnameForRegion(r),error:"region format json not available"});if(this._regionParts.length>1){this._regionParts.pop();var i=this._regionParts.join("-"),s=this._getISOnameForRegion(i);n=this.get("localeURL")+this.get("localeVersion")+"/"+s+".json"}else n=this.get("localeURL")+this.get("localeVersion")+"/en-US.json"}return this._retries<3?this._sendNetworkRequest(n):this.useFallbackRules
(),YES},useFallbackRules:function(){var e=this.get("defaultRules");this.set("regionFormattingRules",e),CW.notificationCenter.postNotification("didFetchRegionFormattingSettings")}}),COS.revalidateController=SC.Object.create({lastRevalidate:null,intervalInHours:24,revalidateInProgress:!1,callbackQueue:[],performRevalidate:function(e){var t=this.get("callbackQueue");t.push(e),this.set("callbackQueue",t);if(this.get("revalidateInProgress"))return;var n=this.get("lastRevalidate");if(!n)this.set("lastRevalidate",SC.getCurrentTimeForPerformance()),this._invokeValidateWithCallback();else{var r=this.get("intervalInHours"),i=(SC.getCurrentTimeForPerformance()-n)/36e5;i>=r?(this.set("lastRevalidate",SC.getCurrentTimeForPerformance()),this._invokeValidateWithCallback()):(SC.Logger.warn("pcsController: Cannot revalidate, please retry in: "+(r-i)+" hour(s)"),e=t.shift(),this.set("callbackQueue",t),e.call())}},_invokeValidateWithCallback:function(){this.set("revalidateInProgress",!0),CloudOS.authController.validateUser(function(){this.set("revalidateInProgress",!1);var e=this.get("callbackQueue"),t=e.length;for(var n=0;n<t;n++){var r=e.shift();r.call()}this.set("callbackQueue",e)}.bind(this))}}),COS.startupController=SC.Object.create({getStartupUrl:function(e){var t=this.getStartupInfo(e);return t?t.url:null},getStartupInfo:function(e){var t=COS.authController.get("accountPreferences");if(t){var n=t.get("startupUrls");if(!n)return;var r=n[e];if(r){var i=r.substr(0,8);return i==="https://"?{method:"GET",url:r}:JSON.parse(r)}}},setStartupUrl:function(e,t){var n=COS.authController.get("accountPreferences"
),r;if(n){r=n.get("startupUrls");if(t&&!this._isValidStartupUrl(t)){SC.warn("Startup url %@ for %@ is not valid",t,e);return}t=CK.removeQueryParamsToOmitForStartupCaching(t),r[e]!==t&&(SC.debug("Storing new startup url %@ for %@",t,e),r[e]=t,n.set("startupUrls",r),n.commitStartupUrls())}},setStartupInfo:function(e,t){var n=COS.authController.get("accountPreferences");if(n){var r=n.get("startupUrls");if(t===null)r[e]=null,n.set("startupUrls",r),n.commitStartupUrls();else{var i=this._isValidStartupUrl(t.url),s=this._isValidMethod(t.method);if(i&&s){t.url=CK.removeQueryParamsToOmitForStartupCaching(t.url);var o=JSON.stringify(t);o!==r[e]&&(SC.debug("Storing new startup info %@ for %@",t.url,e),r[e]=o,n.set("startupUrls",r),n.commitStartupUrls())}else SC.warn("Startup info for %@ is not valid",e)}}},requestStartup:function(e){var t=COS.appsController.getAppInfoFor(e),n,r=this.getStartupInfo(e),i=r?r.url:null;t||SC.error("COS: Cannot find application information for application “%@”",e);if(!this._isValidStartupUrl(i))return;r&&r.loadCoreTypes&&SC.Module.loadModule("cloudkit/core_types");var s,o=r.method.toLowerCase();o==="get"?(this.setStartupUrl(e,i),s=CK.Request.getUrl(i),t.set("requestedStartupUrl",i)):o==="post"?(this.setStartupInfo(e,r),s=CK.Request.postUrl(i,r.requestPayload).json(),t.set("requestedStartupInfo",r)):o==="put"?(this.setStartupInfo(e,r),s=CK.Request.putUrl(i,r.requestPayload).json(),t.set("requestedStartupInfo",r)):o==="delete"&&(this.setStartupInfo(e,r),s=CK.Request.deleteUrl(i),t.set("requestedStartupInfo",r));if(!s)return;s.set("serviceName",e),s.set("reportRequest"
,YES);var u=r.timeout;u||(u=3e4),s.set("timeout",u),s.notify(200,this,this.fetchStartupDidSucceed,e),s.notify(0,this,this.fetchStartupDidFail,e),s.send(),SC.debug("COS: Requesting startup for “%@” with url %@",e,i)},_isValidStartupUrl:function(e){if(!e)return NO;var t=URI(e);return e&&t.protocol()==="https"&&t.domain()===COS.authController.get("currentDomain")?YES:NO},_isValidMethod:function(e){var t=e.toLowerCase();return t==="get"||t==="post"||t==="put"||t==="delete"},fetchStartupDidSucceed:function(e,t){var n=COS.appsController.getAppInfoFor(t);return n||SC.error("COS: No application info found for application “%@”".fmt(t)),n.set("startupResponse",e),this.notifyStartup(n),YES},fetchStartupDidFail:function(e,t){var n=COS.appsController.getAppInfoFor(t);return n||SC.error("COS: No application info found for application “%@”".fmt(applicationName)),SC.warn("COS: There was an error requesting startup URL for application “%@”".fmt(t)),this.setStartupUrl(t,null),n.set("startupResponse",e),this.notifyStartup(n),YES},notifyStartup:function(e,t){var n=e.get("startupResponse"),r,i,s;if(n){i=n.get("body"),s=n.get("status"),SC.kindOf(i,SC.Object)&&i.get("isError")&&(i=null);var o=CK.currentApplication;if(o)o.invokeDelegateMethod(o.get("delegate"),"didFetchStartup",i,s);else{r=CloudOS.appManagerFor(e.get("name"));if(!r||!r.get("isLoaded")){SC.debug("COS: We received a response to 'startup' for “%@” but cannot notify it yet, as were waiting for it to be running",e.get("name"));return}r.passMessage("didFetchStartup",i,s,r.benchmarks())}SC.debug("COS: Gave startup response to the app"),e
.set("startupResponse",null)}}}),COS.AnimatedPane={themeName:"iOS",hasNavigationBar:YES,acceptsFileDrags:NO,windowResized:function(e,t){if(this._lastOSP===(this._lastOSP=this.get("onscreenPosition")))return;this.adjust("centerY",this._lastOSP)}.observes("currentWindowSize"),onscreenPosition:function(){var e=this.get("currentWindowSize")||{height:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||2e3};return Math.round(Math.max(0,this.get("frame").height/2-e.height/2))}.property("currentWindowSize"),modalPane:SC.ModalPane.extend(CW.Animatability,CW.PaneAnimationSupport,{classNames:"ios-modal",hideDuration:500,showDuration:500,showingState:{opacity:.5},hiddenState:{opacity:0}}),offscreenPosition:function(){var e=this.get("currentWindowSize")||{height:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||2e3};return Math.round(e.height+this.get("frame").height/2+50)}.property("currentWindowSize"),showingState:function(){var e=jQuery(document.body).css("overflow")==="hidden";return e?{centerY:this.get("onscreenPosition")}:{opacity:1}}.property(),hiddenState:function(){var e=jQuery(document.body).css("overflow")==="hidden";return e?{centerY:this.get("offscreenPosition")}:{opacity:0}}.property(),duration:function(){var e=jQuery(document.body).css("overflow")==="hidden";return e?350:200}.property(),showTween:CW.Anim.tweens.QUADRATIC_OUT,hideTween:CW.Anim.tweens.QUADRATIC_IN,firstShowDelay:150,paneWillShow:function(){var e=jQuery(document.body).css("overflow")==="hidden";e?this.adjust("opacity",1):this.adjust("centerY"
,this.get("onscreenPosition"))}},COS.nextShowDelayTime=0,COS.IsShowingSupport={firstIsShowing:NO,displayKeys:null,nowShowing:null,_isShowingSupport_nowShowingObserver:function(){var e=this.get("displayKeys"),t=NO,n,r,i;if(e)for(n=this.get("nowShowing"),r=0;i=e[r];r++){n===i&&(t=YES);continue}var s=this._lastIsShowing;s===undefined&&(s=this.get("firstIsShowing"));if(t===s)return;this._lastIsShowing=t;if(!t)this.set("isShowing",NO),this._showTimer&&(this._showTimer.invalidate(),this._showTimer=null),this.hide();else{var o=COS.nextShowDelayTime;o?this._showTimer=this.invokeLater(function(){this.set("isShowing",YES),this.show()},o):(this.set("isShowing",YES),this.show()),COS.nextShowDelayTime=0}}.observes("nowShowing"),initMixin:function(){this.get("displayKey")&&(this.displayKeys=[this.displayKey]),this.isShowing=this.firstIsShowing,this.show||(this.show=this._default_isShowing_show),this.hide||(this.hide=this._default_isShowing_hide)},displayKeysDidChange:function(){this.get("displayKey")&&(this.displayKeys=[this.displayKey]),this.notifyPropertyChange("nowShowing")}.observes("displayKey","displayKeys"),_default_isShowing_show:function(){this.set("isVisible",YES)},_default_isShowing_hide:function(){this.set("isVisible",NO)}},COS.Paneness={isPaneAttached:YES,init:function(){arguments.callee.base.apply(this,arguments),this.invokeOnce("_paneness_checkInitialState")},_paneness_checkInitialState:function(){var e=this.get("parentView"),t=this.get("usualParent"),n=this.get("isPaneAttached");e||this.set("isPaneAttached",n=NO),!t&&e&&this.set("usualParent",t=e),!n&&e&&e.removeChild(this
),n&&t&&t!==e&&(e&&e.removeChild(this),t.appendChild(this))},append:function(){var e=this.get("parentView"),t=this.get("usualParent");if(!t)return;if(e===t)return;e&&e!==t&&this.removeFromParent();var n=t.appendChild(this);return this.set("isPaneAttached",YES),n},appendTo:SC.RunLoop.wrapFunction(function(e){return this.set("usualParent",e),this.append()}),remove:function(){var e=this.removeFromParent();return this.set("isPaneAttached",NO),e}},COS.AccountPreferences=CK.AccountPreferences.extend({preferencesVersion:"",startupUrls:{},localeForCloudOS:function(){var e={},t=COS.get("localesSupportedByCloudOSOnly");t.forEach(function(t){e[t]=!0});var n=CW.getUrlParameters().locale||this.get("locale");if(e[n])return n;var r=this.get("secondaryLocale");return e[r]?r:"en-us"}.property("locale","secondaryLocale").cacheable(),isCloudOSLocaleRTLOriented:function(){return["ar-sa","iw-il"].contains(this.get("localeForCloudOS"))}.property("localeForCloudOS"),prefsList:["locale","secondaryLocale","regionFormat","regionFormatsMatchLanguage","timeZone","timeZoneCity","timezoneName","lastDismissedMotm","startupUrls","dimissedGCBDNotification"],prefsOmittedFromNotification:["locale","secondaryLocale","lastDismissedMotm"],prefsNotSavedAutomatically:["startupUrls","preferencesVersion"],prefsHash:function(e){var t=this.get("prefsList"),n={},r,i,s;for(i=0,s=t.length;i<s;i++)r=t[i],this.get(r)!==null&&this.get(r)!==undefined&&(n[r]=this.get(r));return e&&(n.preferencesVersion=this.get("preferencesVersion")),n},_commit:function(e){this._commitTimer&&this._commitTimer.invalidate(),this._commitTimer=null
,COS.prefsController.savePreferences("account",this.prefsHash(),e)},_commitLater:function(e,t){this._commitTimer&&this._commitTimer.invalidate(),this._commitTimer=this.invokeLater("_commit",e,t)},commitStartupUrls:function(e){var t={startupUrls:this.get("startupUrls")};COS.prefsController.savePreferences("account",t,e)},set:function(e,t){return this.get("hasInitialized")&&this.get("prefsNotSavedAutomatically").indexOf(e)===-1&&this[e]!==t&&(e==="regionFormat"&&CloudOS.localizationController.relocalizeIfNeeded("User changed regionFormat",!0),this._commitLater(1),this.prefsOmittedFromNotification.indexOf(e)===-1&&this.prefsList.indexOf(e)!==-1&&COS.prefsController.invokeOnceLater(COS.prefsController.notifyAccountPreferencesDidChange,10)),arguments.callee.base.apply(this,arguments)}}),COS.AuthUIState=SC.State.extend({init:function(){arguments.callee.base.apply(this,arguments),COS.authUIState=this.get("statechart")},initialSubstate:"checkForNewLogin",enterState:function(){CloudOS.workspaceController.set("nowShowing",CloudOS.AUTH)},checkForNewLogin:SC.State.design({enterState:function(){this.gotoState("appleIdLogin")}}),newLogin:SC.State.design({enterState:function(){CloudOS.authController.clearUserState(),CloudOS.showNewLogin(),CloudOS.noticeController.setupNotices()},newLoginLoaded:function(){CloudOS.get("authPane").set("nowShowing","authBadge")},newLoginFailedToLoad:function(){this.gotoState("appleIdLogin")},loginCompleted:function(e){CloudOS.workspaceController.showCentralSpinner(function(){this.gotoState("appleWidgetLoginCompleted",e)}.bind(this))},gotoAppleIdLogin:function(
){CloudOS.workspaceController.showCentralSpinner(function(){this.gotoState("appleIdLogin")}.bind(this))}}),authDidCancel:function(){CloudOS.get("authPane").remove(),CloudOS.authController.logoutUser(function(){CK.reloadWithReason("Resetting due to auth cancellation message from Auth Widget.")},YES)},appleIdLogin:SC.State.design({enterState:function(){CloudOS.authController.clearUserState(),CloudOS.showAuthPane(),CloudOS.noticeController.setupNotices()},appleWidgetLoaded:function(){SC.debug("Apple Widget has loaded"),CloudOS.get("authPane").set("nowShowing","authBadge");var e=CloudOS.authController.get("showSignup");e&&CloudOS.initializationController.get("accountCreationEnabled")&&(window.location.hash="",this.gotoState("accountCreation"))},appleAuthPaneFailedToLoad:function(){var e=COS.authUIController;CW.Alert.show({message:"Error.AuthDidNotConnect.Title".loc(),description:"Error.AuthDidNotConnect.Description".loc(),middleButton:{title:"Error.AuthDidNotConnect.Support".loc(),action:"support"},rightButton:{title:"Button.OK".loc(),action:function(){this.get("pane").remove(),CloudOS.authController.logoutUser(function(){CK.reloadWithReason("Auth Pane failed to load")},YES)}},leftButton:{title:"Error.Button.Report".loc(),action:function(){this.get("pane").remove(),SC.run(function(){CW.fatalError("The Apple ID auth widget failed to load within the expected timeframe.")})}},remove:function(){this.getPath("pane.modalPane").set("paneFadeOutDuration",0),arguments.callee.base.apply(this,arguments)},fromState:this,support:function(){window.open("Error.AuthDidNotConnect.Support.URL".loc
())}}),e.reportAuthError("login","authDidNotLoad")},loginCompleted:function(e){this.gotoState("appleWidgetLoginCompleted",e)},loginFailed:function(){SC.debug("Login Failed"),COS.authUIController.reportAuthError("login","authDidNotValidate")},repairStarted:function(){SC.debug("Repair Started"),this.gotoState("active.authUI.appleIdRepair")},authDidNotConnect:function(e){SC.debug("Login Failed due to %@".fmt(e)),COS.authUIController.reportAuthError("login",e),CloudOS.UnableToProceedAlert.show({failureReason:e})}}),appleIdRepair:SC.State.design({loginCompleted:function(e){this.gotoState("appleWidgetLoginCompleted",e)},repairFailed:function(){COS.statsController.recordStat("cloudos","AuthWidget_Repair_Failed"),CK.errorCatcher.reportServerError({title:"Error.RepairFailed.Title".loc(),dismissCallback:function(){CloudOS.get("authPane").remove(),CloudOS.authController.invokeLater("logoutUser",400,function(){CK.reloadWithReason("Logged out because Apple ID repair flow was exited due to an error.")})}})},repairDidCancel:function(){var e=COS.authController,t=e.get("isPartiallyAuthenticated"),n=e.get("isPartiallyAuthenticatedForManagedAppleId");t||n?e.logoutUser(function(){var e=t?"HSA":"MAID";CK.reloadWithReason("Cancelling repair for a partially authenticated '%@' account.".fmt(e))},YES):this.gotoState("appleIdLogin")},showApp:function(e){var t=e.appName,n=e.route,r=CloudOS.appManagerFor(t),i=CloudOS.authController,s=CloudOS.appController;s.set("pendingApp",r),r.set("loadInBackground",NO),n&&r.set("route",n),SC.RootResponder.responder.set("defaultResponder",CloudOS.statechart),this.gotoState
("active.authUI.waitingForApp")}}),appleWidgetLoginCompleted:SC.State.design({enterState:function(e){var t=e.isNewLoginLogin,n=e.completionMessage,r=CloudOS.authController;if(t)r.loginUser(n.username,n.pet,NO,r.validatePreferences,NO);else{var i=e.dsWebAuthToken,s=e.trustToken,o=e.accountCountryCode;r.set("dsWebAuthToken",i),s&&r.set("trustToken",s),o&&r.set("accountCountryCode",o),r.sendAccountLoginRequest()}},gotoManagedAppleId:function(){this.gotoState("managedAppleId")},showFirstRun:function(){this.gotoState("loadFirstRun")},_reportAuthError:function(e){COS.authController.reportAuthError("login",e),CloudOS.appleAuthWidgetController&&CloudOS.appleAuthWidgetController.destroy(),CloudOS.workspaceController.showCentralSpinner(null,!1)},authDidValidate:function(){var e=COS.authUIController,t=COS.statsController;e.reportAuthSuccess("login"),t.getStat("cloudos","Session")||t.beginStat("cloudos","Session"),CloudOS.get("authPane")&&e.get("isAuthenticated")?this.gotoState("waitForAuthWidgetCompletion"):e.userDidAuthenticate()},authDidNotValidate:function(){this.authDidNotConnect("loginDidFail")},authDidNotConnect:function(e){e?e="authDidNotConnect-"+e:e="authDidNotConnect",this._reportAuthError(e),CloudOS.UnableToProceedAlert.show({failureReason:e})},authDidNotValidateNotICloudUser:function(){this._reportAuthError("authDidNotValidateNotICloudUser");var e=COS.authController.get("displayableCurrentDomain");CW.Alert.show({message:"Error.AuthDidNotValidateNotICloudUser.Title".loc({currentDomain:e}),description:"Error.AuthDidNotValidateNotICloudUser.Description".loc({currentDomain:e}),
middleButton:"Button.Close".loc(),rightButton:{title:"Error.AuthDidNotValidateNotICloudUser.LearnMore".loc(),action:"move"},fromState:this,remove:function(){arguments.callee.base.apply(this,arguments),this.fromState.gotoState("appleIdLogin")},move:function(){window.open("Error.AuthDidNotValidateNotICloudUser.LearnMore.URL".loc())}})},authDidNotValidateLocked:function(){this._reportAuthError("authDidNotValidateLocked"),CW.Alert.show({message:"Error.AuthDidNotValidateLocked.Title".loc(),description:"Error.AuthDidNotValidateLocked.Description".loc(),middleButton:{title:"Error.AuthDidNotValidateLocked.Reset".loc(),action:"reset"},rightButton:"Button.OK".loc(),fromState:this,remove:function(){arguments.callee.base.apply(this,arguments),this.fromState.gotoState("appleIdLogin")},reset:function(){window.open("Error.AuthDidNotValidateLocked.Reset.URL".loc())}})},authDidNotValidateSupportLocked:function(){this._reportAuthError("authDidNotValidateSupportLocked"),CW.Alert.show({message:"Error.AuthDidNotValidateSupportLocked.Title".loc(),description:"Error.AuthDidNotValidateSupportLocked.Description".loc(),middleButton:{title:"Error.AuthDidNotValidateSupportLocked.Support".loc(),action:"support"},rightButton:"Button.OK".loc(),fromState:this,remove:function(){arguments.callee.base.apply(this,arguments),this.fromState.gotoState("appleIdLogin")},support:function(){window.open("Error.AuthDidNotValidateSupportLocked.URL".loc())}})},authDidNotValidateNotVerified:function(){this._reportAuthError("authDidNotValidateNotVerified"),CW.Alert.show({message:"Error.AuthDidNotValidateNotVerified.Title".
loc(),description:"Error.AuthDidNotValidateNotVerified.Description".loc(COS.authController.getPath("user.primaryEmail")),rightButton:"Button.OK".loc(),fromState:this,remove:function(){arguments.callee.base.apply(this,arguments),this.fromState.gotoState("appleIdLogin")}})},authDidNotValidateExpiredPassword:function(e){this._reportAuthError("authDidNotValidateExpiredPassword"),CW.Alert.show({message:"Error.AuthDidNotValidateExpiredPassword.Title".loc(),description:"Error.AuthDidNotValidateExpiredPassword.Description".loc(),middleButton:{title:"Error.AuthDidNotValidateExpiredPassword.Support".loc(),action:"support"},rightButton:"Button.OK".loc(),fromState:this,remove:function(){arguments.callee.base.apply(this,arguments),this.fromState.gotoState("appleIdLogin")},support:function(){window.open("Error.AuthDidNotValidateExpiredPassword.Support.URL".loc())}})},authDidNotValidateAccountClosed:function(e){this._reportAuthError("authDidNotValidateAccountClosed"),CW.Alert.show({message:"Error.AuthDidNotValidateAccountClosed.Title".loc(),description:"Error.AuthDidNotValidateAccountClosed.Description".loc(),rightButton:"Button.OK".loc(),fromState:this,remove:function(){arguments.callee.base.apply(this,arguments),this.fromState.gotoState("appleIdLogin")}})},authDidNotValidateAccountTypeNotSupported:function(){this._reportAuthError("authDidNotValidateAccountTypeNotSupported"),CW.Alert.show({message:"Error.UnsupportedAppleID.Title".loc(),description:"Error.UnsupportedAppleID.Description".loc(),middleButton:{title:"Error.UnsupportedAppleID.LearnMore".loc(),action:function(){window.open("Error.UnsupportedAppleID.LearnMore.URL"
.loc())}},rightButton:"Button.OK".loc(),fromState:this,remove:function(){arguments.callee.base.apply(this,arguments),this.fromState.gotoState("appleIdLogin")}})},authDidNotValidateOffline:function(e){this._reportAuthError("authDidNotValidateOffline"),CW.Alert.show({message:"Error.AuthDidNotValidateOffline.Title".loc(),description:"Error.AuthDidNotValidateOffline.Description".loc(),rightButton:"Button.OK".loc(),fromState:this,remove:function(){arguments.callee.base.apply(this,arguments),this.fromState.gotoState("appleIdLogin")}})},authDRLocked:function(e){this._reportAuthError("authDRLocked"),CW.Alert.show({message:"Auth.Locked.Title".loc(),description:COS.authUIController.lockedAlertDescription("Auth.Locked.Description.",e.retryAfter),rightButton:"Button.OK".loc(),fromState:this,remove:function(){arguments.callee.base.apply(this,arguments),this.fromState.gotoState("appleIdLogin")}})},authPartitionLocked:function(){this._reportAuthError("authPartitionLocked"),CW.Alert.show({message:"Error.AuthUserPartitionLocked.Title".loc(),description:"Error.AuthUserPartitionLocked.Description".loc(),rightButton:"Button.OK".loc(),fromState:this,remove:function(){arguments.callee.base.apply(this,arguments),this.fromState.gotoState("appleIdLogin")}})},authDidNotCompleteSetup:function(e){this._reportAuthError("authDidNotCompleteSetup");var t=COS.authController.get("displayableCurrentDomain");CW.Alert.show({message:"Error.ManagedAppleIdNeedsSetupCompletion.Title".loc(),description:"Error.ManagedAppleIdNeedsSetupCompletion.Description".loc({currentDomain:t}),rightButton:"Button.OK".loc(),layout:
{centerX:0,width:570,centerY:-10,height:181},descriptionViewPadding:{top:0,bottom:0},fromState:this,remove:function(){arguments.callee.base.apply(this,arguments),this.fromState.gotoState("appleIdLogin")}})},iCloudLiteUnsupportedBrowser:function(){this._reportAuthError("authDidNotCompleteSetup"),CW.Alert.show({message:"Error.iCloudLiteUnsupportedBrowser.Title".loc(),description:"Error.iCloudLiteUnsupportedBrowser.Description".loc(),rightButton:"Button.OK".loc(),fromState:this,remove:function(){arguments.callee.base.apply(this,arguments),this.fromState.gotoState("appleIdLogin")}})},accountRequiresRepair:function(e){COS.authController.get("repairPayload")?this.accountNeedsAppleIdRepair(e):this.accountNeedsTermsUpdate(e)},accountNeedsAppleIdRepair:function(e){this.gotoState("appleIDAndTermsPane.appleIdRepair",{postValidateCallback:e})},accountNeedsTermsUpdate:function(e){this.gotoState("termsEnforcementAndSubmission",{isForAccountRepair:!0,postValidateCallback:e})},resendLoginOrValidateRequest:function(){SC.debug("sending accountLogin request again."),COS.authController.sendAccountLoginRequest()},resendGetPrefsRequest:function(){SC.debug("sending get preferences request again."),COS.prefsController.getPreferences(null,COS.authController.validatePreferences)},gotoShowTermsAndConditionConfirmation:function(){this.gotoState("termsAndConditionConfirmation")}}),waitForAuthWidgetCompletion:SC.State.extend({enterState:function(){CloudOS.get("authPane").hideSpinnerAndShowAuthPane()},loginCompleted:function(e){var t=CloudOS.authController;t.userDidAuthenticate()}}),signUp:function(){this
.gotoState("accountCreation")},appleIDAndTermsPane:SC.State.extend({initialSubstate:"dummyInitialState",enterState:function(){var e=CloudOS.authController,t=e.get("iCloudLiteAdjustablePane");t||(t=CloudOS.AdjustablePane.create(),e.set("iCloudLiteAdjustablePane",t))},dummyInitialState:SC.State.design(),accountCreation:SC.State.design({enterState:function(){CloudOS.authController.set("iCloudLiteSignUp",YES),CloudOS.appleCreateWidgetController||(CloudOS.appleCreateWidgetController=CloudOS.AppleCreateWidgetController.create());var e=COS.statsController;e.beginStat("cloudos","AppleID_NewAccountCreation"),e.recordWindowUrlStat("cloudos","AppleID_NewAccountCreationStarted");var t=CloudOS.authController.get("iCloudLiteAdjustablePane");CloudOS.appleCreateWidgetController.show(t,CloudOS.initializationController.get("createFrameURL")),t.append(),this._beforeUnloadListener=function(e){var t="Alert.CreateAppleID.BeforeUnloadConfirmation".loc(),n=e||window.event;return n.returnValue=t,t},window.addEventListener("beforeunload",this._beforeUnloadListener)},appleIDPaneFailedToLoad:function(){window.removeEventListener("beforeunload",this._beforeUnloadListener),SC.run(function(){CW.fatalError("The Apple ID create widget failed to load within the expected timeframe.")})},appleIDPaneCompletedWithPayload:function(e){e&&CloudOS.authController.set("repairPayload",e),this.gotoState("termsEnforcementAndSubmission",{isForAccountCreate:!0})},appleIDPaneExited:function(){var e=COS.statsController;e.cancelStat("cloudos","AppleID_NewAccountCreation"),e.recordWindowUrlStat("cloudos","AppleID_NewAccountCreationCancelled"
),this.gotoState("authUI")},appleIDPaneExitedForError:function(){COS.statsController.recordStat("cloudos","AppleId_CreateExitedForError");var e=this;CK.errorCatcher.reportServerError({title:"Error.CreateFailed.Title".loc(),dismissCallback:function(){e.gotoState("authUI")}})},appleIDPaneExitedForPasswordChange:function(){this.appleIDPaneExitedForError()},reloadAppleIDFlow:function(){this.gotoState(this)},exitState:function(){window.removeEventListener("beforeunload",this._beforeUnloadListener),CloudOS.authController.set("iCloudLiteSignUp",NO),COS.authController.set("showSignup",NO)}}),appleIdRepair:SC.State.design({enterState:function(e){this._cleanUpState(),this._postValidateCallback=e.postValidateCallback;var t=CloudOS.getUser();t&&t.isLiteAccount()&&CloudOS.authController.set("iCloudLiteSignUp",YES);if(e.alreadyShownAlert){this.activateAppleIDPane();return}this._alert=CW.Alert.show({message:"Alert.RepairAppleID.PreRepair.Title".loc(),description:"Alert.RepairAppleID.PreRepair.Description".loc(),owner:this,_cancelRepair:function(){this.remove(),this.owner.appleIDPaneExited()},_continueRepair:function(){this.remove(),this.owner.activateAppleIDPane()},middleButton:{title:"Button.Cancel".loc(),action:"_cancelRepair"},rightButton:{title:"Button.Continue".loc(),action:"_continueRepair"}})},_cleanUpState:function(){this._alert&&this._alert.remove(),this._alert=null,this._postValidateCallback=null},activateAppleIDPane:function(){var e=CloudOS.authController,t=COS.statsController;t.beginStat("cloudos","AppleID_ExistingAccountRepair"),t.recordStat("cloudos","AppleID_ExistingAccountRepairStarted"
);var n=e.get("iCloudLiteAdjustablePane");CloudOS.appleCreateWidgetController.show(n,CloudOS.initializationController.get("repairFrameURL"),e.get("repairPayload")),n.append()},appleIDPaneFailedToLoad:function(){SC.run(function(){CW.fatalError("The Apple ID repair widget failed to load within the expected timeframe.")})},appleIDPaneCompletedWithPayload:function(e){e&&CloudOS.authController.set("repairPayload",e),this.gotoState("termsEnforcementAndSubmission",{isForAccountRepair:!0,postValidateCallback:this._postValidateCallback})},appleIDPaneExited:function(){CloudOS.get("authPane").remove(),CloudOS.authController.invokeLater("logoutUser",400,function(){CK.reloadWithReason("Logged out because Apple ID repair flow was exited prematurely by the user.")})},appleIDPaneExitedForError:function(){COS.statsController.recordStat("cloudos","AppleId_RepairExitedForError"),CK.errorCatcher.reportServerError({title:"Error.RepairFailed.Title".loc(),dismissCallback:function(){CloudOS.get("authPane").remove(),CloudOS.authController.invokeLater("logoutUser",400,function(){CK.reloadWithReason("Logged out because Apple ID repair flow was exited due to an error.")})}})},appleIDPaneExitedForPasswordChange:function(){CloudOS.get("authPane").remove(),CloudOS.authController.get("iCloudLiteAdjustablePane").remove(),CW.Alert.show({message:"Alert.RepairAppleID.PasswordChanged.Title".loc(),description:"Alert.AppleIDRepair.PasswordChanged.Description".loc(),rightButton:"Button.OK".loc(),remove:function(){arguments.callee.base.apply(this,arguments),CloudOS.authController.logoutUser(function(){CK.reloadWithReason
("Logged out because the user's password was updated during Apple ID repair.")})}})},reloadAppleIDFlow:function(){this.gotoState(this,{alreadyShownAlert:!0,postValidateCallback:this._postValidateCallback})},exitState:function(){this._cleanUpState(),CloudOS.authController.set("iCloudLiteSignUp",NO)}}),termsEnforcementAndSubmission:SC.State.design({enterState:function(e){var t=COS.statsController,n=CloudOS.authController;this._postValidateCallback=e.postValidateCallback,this._isForAccountCreate=!!e.isForAccountCreate,this._isForAccountRepair=!!e.isForAccountRepair;var r=CloudOS.getUser();(this._isForAccountCreate||r&&r.isLiteAccount())&&CloudOS.authController.set("iCloudLiteSignUp",YES);var i;if(e.isForAccountCreate)t.beginStat("cloudos","AppleID_NewAccountTerms"),t.recordWindowUrlStat("cloudos","AppleID_NewAccountTermsStarted"),i=n.get("repairPayload"),CloudOS.tosController.show(n.get("iCloudLiteAdjustablePane"),i&&{createPayload:i});else if(n.get("accountTermsUpdateRequired")){t.beginStat("cloudos","AppleID_ExistingAccountTerms"),t.recordStat("cloudos","AppleID_ExistingAccountTermsStarted"),i=n.get("repairPayload"),CloudOS.tosController.show(CloudOS.authController.get("iCloudLiteAdjustablePane"),i&&{repairPayload:i});var s=n.get("iCloudLiteAdjustablePane");s&&!s.get("isPaneAttached")&&s.append()}else this.userHasAcceptedTerms()},userHasRejectedTerms:function(){this.updateStatsForTermsUpdateError("Rejected"),this.goBackToAuthUI("user disagreed with terms of service.")},showAlertDialog:function(e,t,n,r){CW.Alert.show({message:e,description:t,fromState:this,rightButton:{title:"Button.OK"
.loc(),action:"goBackToAuth"},goBackToAuth:function(){this.remove(),this.fromState.goBackToAuthUI(n)},middleButton:{title:"Error.Button.Report".loc(),action:function(){var e=this.get("pane");e.get("modalPane").set("paneFadeOutDuration",0),e.remove(),CK.errorCatcher.reportServerError({applicationName:"cloudos",error:r,dismissCallback:function(){e.goBackToAuth()}})}}})},termsUpdateFailed:function(){this.updateStatsForTermsUpdateError("UpdateFailed"),this.showAlertDialog("Error.TermsUpdateFailed.Title".loc(),"Error.TermsUpdateFailed.Description".loc(),"An error occurred while attempting to display terms for user.","Terms display failed")},updateStatsForTermsUpdateError:function(e){var t,n=COS.statsController;this._isForAccountCreate&&(t="AppleID_NewAccountTerms"),this._isForAccountRepair&&(t="AppleID_ExistingAccountTerms"),t&&(n.cancelStat("cloudos",t),e&&n.recordStat("cloudos",t+"_"+e))},userHasAcceptedTerms:function(){var e=COS.statsController,t=CloudOS.authController;CloudOS.blockUserInput(0),t.set("accountTermsUpdateRequired",!1),this._isForAccountCreate&&(e.endStat("cloudos","AppleID_NewAccountTerms",null,{includeLocationUrlDetails:!0}),t.sendAccountCreateRequest("createOrRepairDidComplete","createDidFail")),this._isForAccountRepair&&(e.endStat("cloudos","AppleID_ExistingAccountTerms"),t.sendAccountRepairRequest("createOrRepairDidComplete","repairDidFail"))},createOrRepairDidComplete:function(){var e=CloudOS.authController,t=e.get("user"),n=this._postValidateCallback;e.setDomainSpecificClassNames(),e.get("isPartiallyAuthenticated")?(CloudOS.unblockUserInput(),CloudOS.statechart
.sendAction("showHSA")):(e.clearUserState(),this.gotoState("validatingAuth",{showOnlyLiteApps:this._isForAccountCreate||t&&t.isLiteAccount(),successCallback:function(){CloudOS.unblockUserInput(),n&&n()},failureCallback:function(){CloudOS.unblockUserInput(),CW.fatalError("Validate failed after a create or repair was successfully completed.")}}))},createDidFail:function(){var e=COS.statsController;CloudOS.unblockUserInput(),e.cancelStat("cloudos","AppleID_NewAccountCreation"),e.recordStat("cloudos","AppleID_NewAccountCreationFailed",{includeLocationUrlDetails:!0}),this.showAlertDialog("Error.TermsAcceptFailed.Title".loc(),"Error.TermsAcceptFailed.Description".loc(),"After account Creation Terms update request failed.","Accepting Terms After Account Creation Failed")},repairDidFail:function(){var e=COS.statsController;CloudOS.unblockUserInput(),e.cancelStat("cloudos","AppleID_ExistingAccountRepair"),e.recordStat("cloudos","AppleID_ExistingAccountRepairFailed"),this.showAlertDialog("Error.RepairFailed.Title".loc(),"Error.RepairFailed.Description".loc(),"Terms update request failed.","Accepting Terms After Account Repair Failed")},goBackToAuthUI:function(e){var t=CloudOS.authController;t.cancelAppleIdFlowStats(),t.invokeLater("logoutUser",400,function(){CK.reloadWithReason("Logged out because "+e)})},exitState:function(){this._isForAccountCreate=this._isForAccountRepair=!1,this._postValidateCallback=undefined,CloudOS.authController.set("iCloudLiteSignUp",NO)}}),exitState:function(){var e=CloudOS.authController;e.get("iCloudLiteAdjustablePane").remove(),e.set("iCloudLiteAdjustablePane"
,null)}}),loadFirstRun:SC.State.design({enterState:function(){CW.notificationCenter.postNotification("springboardMayProceed"),SC.Module.loadModule("cloudkit/first_run",this,"moduleDidBecomeReady")},moduleDidBecomeReady:function(){var e=this.statechart.getState("firstRun");if(e&&CK.Photo){var t=e.get("substates").getEach("name");t.indexOf("accountPhotoPicker")===-1&&e.addSubstate("accountPhotoPicker",CK.Photo.photoPicker),this.gotoState("firstRun")}else SC.error("first Run State not found")}}),firstRun:SC.State.design({substatesAreConcurrent:YES,enterState:function(){CloudOS.authController.set("isFirstRunLoaded",YES)},exitState:function(){CloudOS.authController.set("isFirstRunLoaded",NO)},defaultState:SC.State.design({enterState:function(){COS.FirstRun.languagePickerViewController.set("_languages",COS.get("availableLocales")),COS.authUIController.clearMonitorForUsernameChange(),COS.FirstRun.loadFirstRunView();var e=CloudOS.appController.get("isAllAppInfoLoaded");e||(CloudOS.blockUserInput(0),CW.notificationCenter.subscribeToNotification("receivedInfoForAllDynamicApps",this,function(){COS.FirstRun.languagePickerViewController.set("_languages",COS.get("availableLocales")),CloudOS.unblockUserInput()}))},userDidSubmit:function(){COS.FirstRun&&CloudOS.authPane.remove(function(){CloudOS.workspaceController.showCentralSpinner(function(){COS.FirstRun.submitPrefsAndMeCard();if(CloudOS.authController.shouldUsePostLoginRedirectUrl()){CK.reloadWithReason("postLoginRedirectUrl",CloudOS.authController.get("postLoginRedirectUrl"));return}CW.notificationCenter.postNotification("userDidCompleteFirstRun"
)}.bind(this))}.bind(this))},deletePhoto:function(){CK.meCardController.deletePhoto()},gotoShowTermsAndConditionConfirmation:function(){this.gotoState("termsAndConditionConfirmation")}})}),hsa:SC.State.design({accountType:function(){return COS.authController.getPath("user.isHSA2Enabled")?"HSA2":"HSA1"}.property("COS.authController.isHSA2Enabled"),enterState:function(){var e=CloudOS.get("authPane");e||this.gotoState("appleIdLogin"),e&&(e.get("isPaneAttached")?e.show():e.append()),COS.authController.set("isValidatingHsa",YES),COS.statsController.recordLocationStat("cloudos","AuthWidget_"+this.get("accountType")+"_Flow_Started"),e.set("nowShowing","hsaBadge"),CW.notificationCenter.postNotification("authModuleDidLoad")},exitState:function(){COS.authController.set("isValidatingHsa",NO)},gotoAppLoadingState:function(e){this.gotoState("appLoadingState",e)},showAccountSettings:function(){CloudOS.get("authPane").hideAuthPaneAndShowSpinner(function(){CloudOS.openApp("settings")})},showApp:function(e){var t=e.appName,n=e.route,r=CloudOS.appManagerFor(t),i=CloudOS.authController,s=CloudOS.appController;s.set("pendingApp",r),r.set("loadInBackground",NO),n&&r.set("route",n),SC.RootResponder.responder.set("defaultResponder",CloudOS.statechart),this.gotoState("active.authUI.waitingForApp")},globalAppSwitchWasRequested:function(){var e=CloudOS.appController.get("pendingApp");e&&!e.get("isHSALocked")&&this.gotoState("active.authUI.waitingForApp")},loginCompleted:function(e){COS.statsController.recordLocationStat("cloudos","AuthWidget_"+this.get("accountType")+"_Flow_Completed"),this.gotoState
("appleWidgetLoginCompleted",e)},loginFailed:function(){SC.debug("HSA Login Failed"),COS.statsController.recordLocationStat("cloudos","AuthWidget_"+this.get("accountType")+"_Flow_Failed"),COS.authUIController.reportAuthError("login","authDidNotValidate")},repairStarted:function(){SC.debug("Repair Started for a HSA account"),this.gotoState("active.authUI.appleIdRepair")},appleWidgetLoaded:function(){this.gotoState("appleIdLogin"),CloudOS.get("authPane").set("nowShowing","authBadge")}}),managedAppleId:SC.State.design({enterState:function(){var e=CloudOS.get("authPane");e||this.gotoState("appleIdLogin"),e&&(e.get("isPaneAttached")?e.show():e.append()),COS.statsController.recordLocationStat("cloudos","AuthWidget_ManagedAppleId_Flow_Started"),e.set("nowShowing","managedAppleIdBadge"),CW.notificationCenter.postNotification("authModuleDidLoad")},loginCompleted:function(e){COS.statsController.recordLocationStat("cloudos","AuthWidget_ManagedAppleId_Flow_Completed"),this.gotoState("appleWidgetLoginCompleted",e)},loginFailed:function(){COS.statsController.recordLocationStat("cloudos","AuthWidget_ManagedAppleId_Flow_Failed"),SC.debug("Managed Apple Id Login Failed"),COS.authUIController.reportAuthError("login","authDidNotValidate")},showAccountSettings:function(){CloudOS.get("authPane").hide(),CloudOS.openApp("settings")},globalAppSwitchWasRequested:function(){var e=CloudOS.appController.get("pendingApp");e&&!e.get("isHSALocked")&&this.gotoState("active.authUI.waitingForApp")},authDidNotConnect:function(){CloudOS.authController.logoutUser(function(){CK.reloadWithReason("validateFailed")
},YES)},repairStarted:function(){SC.debug("Repair Started for a MAID account"),this.gotoState("active.authUI.appleIdRepair")},appleWidgetLoaded:function(){this.gotoState("appleIdLogin"),CloudOS.get("authPane").set("nowShowing","authBadge")}}),exitState:function(){var e=CloudOS.get("authPane");e&&e.hide()}}),COS.CloudOSLite=SC.Object.extend(SC.DelegateSupport,{isCloudOSLite:YES,init:function(){arguments.callee.base.apply(this,arguments);var e=CK.currentApplication,t=CK.currentApplication.get("name");COS.apps[t]||(COS.appsController.createAppInfo(t,{}),COS.apps[t]={});var n=SC.Logger,r=n.get("outputMessagePrefix"),i;r&&r===CK.currentApplication.get("capitalizedName")+": "&&SC.Logger.set("outputMessagePrefix",null);if(e.get("usesAuth")){SC.debug("CloudOSLite: setting the authController delegate to %@",this),COS.authController=i=COS.AuthController.create({delegate:this});if(!i.get("isLoadedFromSiteURL")){SC.error("CloudOSLite: Application was NOT loaded from valid site domain. Exiting here.");return}}},setAppPreferences:function(e){var t=CK.currentApplication,n=t.get("name");t._cos_app_preferences_cache=e,COS.prefsController.savePreferences(n,e)},refreshAppPreferences:function(){var e=CK.currentApplication,t=e.get("name");COS.prefsController.getPreferences(t)},getStartupUrl:function(){var e=CK.currentApplication,t=e.get("name");return COS.startupController.getStartupUrl(t)},requestStartup:function(){var e=CK.currentApplication;return e&&COS.startupController.requestStartup(e.get("name")),this},setStartupUrl:function(e){var t=CK.currentApplication,n=t.get("name");COS.startupController
.setStartupUrl(n,e)},setTitle:function(e){window.document.title=e},reload:function(){CK.reloadWithReason("call to reload")},exit:function(e){CK.errorCatcher.reportServerError({isFatal:!!e,error:"CloudOSLite exit()"})},setRoute:function(e){e&&(window.location.hash=e)},showHelp:function(e){COS.HelpUtils.open(CK.currentApplication,e)},showAppSwitcher:function(){},showSpringBoard:function(){},meCardUpdated:function(){},applicationIsReady:function(){var e=CK.currentApplication,t=e.get("name");SC.debug("CloudOSLite: applicationIsReady() called from %@",t);if(!e.isCloudKitApplication)throw"Application passed to applicationIsReady is not a CK.Application";COS.appsController.getAppInfoFor(t).set("isReady",YES);var n=e.get("delegate");SC.debug("CloudOSLite: Invoking applicationWillBecomeActive and applicationDidBecomeActive"),e.invokeDelegateMethod(n,"applicationWillBecomeActive"),e.invokeDelegateMethod(n,"applicationDidBecomeActive")},startupDataIsLoaded:function(){},didReceiveSpecialResponse:function(e,t,n){},showLocalNotification:function(){},setBadgeCount:function(){},recordStat:function(e,t){var n=CK.currentApplication,r=n.get("name");COS.statsController.recordStat(r,e,t)},beginStat:function(e,t){var n=CK.currentApplication,r=n.get("name");COS.statsController.beginStat(r,e,t)},endStat:function(e,t){var n=CK.currentApplication,r=n.get("name");COS.statsController.endStat(r,e,t)},requestSent:function(){this._outstandingRequests===undefined&&(this._outstandingRequests=0),this._outstandingRequests++},requestReceived:function(e){this._outstandingRequests--;var t=CK.currentApplication,n=
t.get("name");COS.statsController.recordLocationStat(n,"RequestInfo",e)},appWillUnload:function(){},isReadyToTerminateDidChange:function(e){},relayKeyboardShortcut:function(e,t,n){return CW.LOG_KEYBOARD_SHORTCUTS&&SC.info("CloudOSLite: Ignoring keyboard shortcut “%@”",n),NO},relayMouseMove:function(e,t){},performLogin:function(){this._createAuthState()},performLogout:function(){var e=COS.authController,t=e.get("isNotAuthenticated"),n=e.get("isLoggingOut"),r=e.currentLogoutAlert;if(t||n||r){SC.warn("Either the user is not logged in or logout process has already started. Ignoring new logout call.");return}SC.info("COS.CloudOSLite.performLogout");var i=function(e){var t=COS.authController;t.currentLogoutAlert=null,t.set("hsaTrustedBrowser",e),t.logoutUser(null,YES)},s=function(){var e=COS.authController;e.currentLogoutAlert=null},o=e.get("hsaTrustedBrowser");o?e.currentLogoutAlert=CK.logoutAlert(i,s,o):i()},userIsMobileMe:function(){this.loginDidFail()},userIsNotSignedUp:function(){this.loginDidFail()},userIsNotVerified:function(){this.loginDidFail()},userIsUnqualified:function(){this.loginDidFail()},loginDidSucceed:function(e){},loginDidFail:function(e,t){this.userDidNotAuthenticate(YES)},validateDidSucceed:function(e){},validateDidFail:function(e){this._initializeApp(NO)},logoutDidSucceed:function(){},logoutDidFail:function(){},userDidLogout:function(){},userDidNotAuthenticate:function(e){},userDidPartiallyAuthenticate:function(e){},userDidAuthenticate:function(e){var t=CK.currentApplication,n=t.get("name"),r=COS.appsController._appsInfo[n];if(COS.authController.get("isAuthenticated"
)){var i=r?r.get("requestedStartupUrl"):null,s=COS.authController.get("user"),o;COS.startupController.requestStartup(n),r&&COS.startupController.notifyStartup(r,YES),t.get("usesPush")&&(o=r?r.pushTopic:null,o?window.setTimeout(function(){SC.run(function(){COS.PushController.initiatePushConnection(CloudOS,o)})},3e3):this._initActiveAppTimer())}this._initializeApp(YES)},_initializeApp:function(e){var t=CK.currentApplication,n=COS.cloudOSStateForApp(t.get("name"));if(e||!e&&!t.get("requiresAuth"))t._didInvokeMain?t._cloudOSStateChange(n):t.invokeDelegateMethod(t,"_applicationShouldInvokeMain",null,n,CK.LOAD_REASON_USER_CLICK);!this._didCreateAuthState&&!e&&t.get("requiresAuth")&&t.get("supportsAuthUI")?this._createAuthState():this._didCreateAuthState&&e&&(CloudOS.authPane.hide(),COS.statechart=null,this._didCreateAuthState=null)},_createAuthState:function(){this._didCreateAuthState=YES,COS.statechart=SC.Statechart.create({trace:YES,monitorIsActive:NO,name:"cos-statechart",rootState:COS.AuthUIState.design()}),COS.AuthUIController.create({init:function(){arguments.callee.base.apply(this,arguments),CW.notificationCenter.subscribeToNotification("authModuleDidLoad",this,"authModuleDidLoad"),CW.notificationCenter.subscribeToNotification("userDidCompleteFirstRun",this,"userDidCompleteFirstRun")},authModuleDidLoad:function(){CloudOS.authPane.show()},userDidCompleteFirstRun:function(){CloudOS.userDidAuthenticate(YES)}}),COS.statechart.initStatechart()},_initActiveAppTimer:function(){var e=SC.Timer.schedule({action:function(){var e=CK.currentApplication,t=e.get("delegate");e.invokeDelegateMethod
(t,"applicationShouldRefresh")},interval:15e3,repeats:YES});this.set("activeAppTimer",e)},handlePushNotification:function(e,t){var n=CK.currentApplication;n.invokeDelegateMethod(n,"didReceiveNotification",e)},handleApplicationCrash:function(e){var t=CK.currentApplication,n=t?t.get("name"):"cloudos";e=e?SC.clone(e,NO):{},n&&(e.applicationName=n),COS.handleApplicationCrash(e)},passMessageToAllApps:function(e,t,n){var r=CK.currentApplication;r.invokeDelegateMethod(r.get("delegate"),e,t,n)}}),CK.PhoneNumbers=SC.Object.create({}),CK.PhoneNumbers.mixin({createFormattedString:function(e,t,n,r,i,s,o){if(!e||SC.empty(t))return"";var u,a,f,l,c,h,p,d,v,m,g,y=NO,b=NO,w=NO;p=this.getIndexOfPauses(e,",;"),h=p!==-1?YES:NO,c=e,e=p!==-1?e.substr(0,p):e,a=SC.none(t)?0:t.length,g=e.length,d=/[a-zA-Z*#]/,v=d.exec(e),m=e.indexOf(v),u="",w=t.indexOf("c")!==-1?YES:NO,i&&!w&&(u+=o==="+"?o+r+" ":o+" "+r+" ",i=NO,s=NO,l=YES),t.indexOf("n")===-1&&s&&(u+=n,l=YES);for(var E=0,S=0;E<a&&S<g;++E)switch(t[E]){case"#":if(!isNaN(this.convertFullWidthDigits(e[S])))u+=e[S],b=YES,++S;else{var x=/[a-zA-Z*#]/;y&&!SC.none(x.exec(e[S]))&&(u=u.replace("(",""),y=NO),u+=e[S],++S}break;case"(":y=YES,u+=t[E];break;case")":y&&(u+=t[E],y=NO);break;case" ":b&&u!==""&&(m===-1||S<=m)&&(u+=t[E]);break;case"n":n&&!l&&(i||s)&&(u+=n,s=NO,l=YES,b=YES);break;case"c":r&&!f&&i&&!l&&(u+=r,f=YES,b=YES);break;default:if(m===-1||S<=m)u+=t[E]}if(y){var T=t.indexOf(")"),N=t.indexOf("("),C=T-N-1,k="",L,A;L=u.indexOf("("),A=u.length-1-L;for(var O=0;O<C-A;O++)k+=" ";u+=k,u+=")",y=NO}return i&&f&&(u=o==="+"?o+u:o+" "+u),u=u.replace("()",""),u+=
h?c.substr(p):"",u=u?u.replace(/\[\[9\]\]|\[\[8\]\]/g,""):"",u},getInternationalOrNationalAccessCode:function(e,t,n){var r,i,s,o,u,a,f=NO,l=0,c,h,p,d;if(!t)return"";e=e.replace(" ",""),r=n?t.nationalAccessCode:t.internationalAccessCode;if(!r)return"";i="",r=r.split(",");for(var v=0;v<r.length;++v){o=r[v],o=o?o.replace(/\"/g,""):"",p=o.length,a=this.normalizeString(o),h=a.length,l=a.split("#").length-1,s=a.indexOf("#"),s!==-1&&(a=a.substr(0,s)),u=e.substr(0,a.length).trim();if(u===a){var m=s===-1?a:e.substr(0,h);SC.none(o)||(c=o.toString().indexOf(" "),c!==-1&&(m=m.substr(0,c)+" "+m.substr(c))),d=m;for(var g=0;g<p;g++)o[g]==="#"&&(d=d.substr(0,g)+"#"+d.substr(g+1));if(d===o){i=m;break}}}return i},getCountryCodeFromInput:function(e,t){var n,r,i=CK.PhoneNumbers.CountryCode,s=this.normalizeString(e);s=s.substr(t,e.length);if(!s||t===0||!i)return null;s=this.convertFullWidthDigits(s);for(var o=0;o<=3;++o){n=s.substr(0,o),r=i[n];if(!SC.none(r))break}return r},internationalPrefixForDigits:function(e,t){if(!e)return;if(e.charAt(0)==="+")return"+";var n=this.getInternationalOrNationalAccessCode(e,t,NO);return n.trim()},getMatchedFormatFromFormatsArray:function(e,t,n,r,i,s,o){var u=r.phoneFormats,a=u.length,f=0,l=!1,c,h,p,d,v,m,g,y,b,w,E,S,x;for(var T=0;T<a;T++){c=u[T],h=c.format,p=this.getIndexOfPauses(e,",;"),e=p!==-1?e.substr(0,p):e,d=e.length,v=h?h.split("#").length-1:0,m=c.rangeBegin.toString().length,g=d<m?"":e.substr(0,m),g=this.convertFullWidthDigits(g);if(g>=c.rangeBegin&&g<=c.rangeEnd&&d<=v){if(l&&v>f)continue;var N=c.format.indexOf("n")!==-1,C=c.format.indexOf("c")!==-1,k=c
.areaCodeLength;l=!0,f=v,i?y=YES:y=NO;if(SC.none(b)||s&&!E&&N||y&&!w&&C||!y&&!s&&S<m||S<m&&!E||S<m&&(y&C||s&N)||E&&N&&S<m)b=c,w=C,E=N,S=m,x=v}}return b},getFormattedStringUsingMatchedFormat:function(e,t,n,r,i,s,o){var u,a,f=e,l=this.getMatchedFormatFromFormatsArray(e,t,n,r,i,s,o);SC.none(l)||(u=l.format);if(SC.none(u)){var c=f.indexOf("x"),h=c!==-1;if(h){var p=f.substring(0,c),d=f.substring(c,f.length),v=this.getFormattedStringUsingMatchedFormat(p,t,n,r,i,s,o);return v&&v!==p?v+" "+d:f}var m=this.getInternationalOrNationalAccessCode(f,r,YES),g=this.normalizeString(m),y=g.length;if(m&&o&&n&&o==="+"){f=f.substr(y,f.length);var b=this.getFormattedStringUsingMatchedFormat(f,"",n,r,!1,!1,"");if(b&&b!==f){var w=o+n+" ("+g+") "+b;return w.indexOf(") (")!==-1&&(w=w.replace(") (","")),w}return o+n+" ("+g+") "+f}return a=this.createFormattedString(f,u,t,n,i,s,o),a?a:""}return a=this.createFormattedString(f,u,t,n,i,s,o),a?a:""},getIndexOfPauses:function(e,t){var n,r,i=e.length,s=i,o=-1;for(var u=0;u<t.length;u++)(o=e.indexOf(t[u]))!==-1&&s>o&&(s=o);return o=s===i?-1:s,o},formatEntryforDigits:function(e,t,n,r){var i,s,o,u,a,f=this.normalizeString(t),l=f.length,c=this.normalizeString(e),h=c.length,p=c,d=NO,v=NO,m=null;l===0&&(n=""),s=this.getInternationalOrNationalAccessCode(c,r,YES),o=this.normalizeString(s).length,s&&o!==0&&l===0&&(v=YES,p=c.substr(o,h)),m=r.numericCountryCode,u=this.getIndexOfPauses(e,",;"),t&&n&&u!==1?(p=c.substr(l+m.length,h),d=YES):d=NO,i=this.getFormattedStringUsingMatchedFormat(p,s,m,r,d,v,t);if(i.length===0&&d){var g=l+m.length,y=u!==-1?e.substr(0,u):e;a=y.length===
g||isNaN(y[l])?e:t!=="+"?t+" "+m+" "+p:t+m+" "+p}return i?i.trim():a},normalizeString:function(e){var t;return t=e?e.replace(/[^a-zA-Z0-9--९+,;@.*#\'\"<>\[\]]/g,""):"",t},convertFullWidthDigits:function(e){var t;return t=e.replace(/[-]/g,function(e){switch(e){case"":return"0";case"":return"1";case"":return"2";case"":return"3";case"":return"4";case"":return"5";case"":return"6";case"":return"7";case"":return"8";case"":return"9";default:return e}}),t}}),CK.PhoneNumbers.CanonicalizationController=SC.Object.extend(CK.MicroResourceContainer,{init:function(){arguments.callee.base.apply(this,arguments),this.containerInit()},getCanonicalizePhoneNumberState:function(e){return e=this.normalizePhoneNumber(e),this.containerGetStatus(e)},getCanonicalizePhoneNumberValue:function(e){return e=this.normalizePhoneNumber(e),this.containerGet(e)},canonicalizePhoneNumber:function(e,t){e=this.normalizePhoneNumber(e),this.containerLoad(e,t)},canonicalizePhoneNumbers:function(e,t){var n=this,r=e.reduce(function(e,t){return t?++e:e},0),i=[],s=[];e.forEach(function(e,o){e&&n.canonicalizePhoneNumber(e,function(e,n){i[o]=n,s[o]=e,--r<=0&&t(s,i)})})},containerFlush:function(e){var t={},n=[];e.forEach(function(e){var r=e.key;t[r]||(n.push(r),t[r]=!0)});var r=this;this.sendCanonicalizePhoneNumbersRequest(n,function(t,i){r.containerStoreResults(n,i,t,e)})},sendCanonicalizePhoneNumbersRequest:function(e,t){if(!e||!e.length){t(undefined,[]);return}var n=[],r=this;e.forEach(function(e,t){e=r.normalizePhoneNumber(e),e&&(e=e.replace(/\+/g,""),n.push({phoneNumber:e}))});var i={lookupInfos:n},s=CK.Request
.postUrl("/ws/v1/autocomplete/canonicalizePhoneNumbers");return s.set("serviceName","cksharews"),s.set("withCredentials",YES),s.set("isJSON",!0),s.set("timeout",3e4),s.notify(200,null,function(n){var r=n&&n.get("body"),i=r&&r.results;if(i&&i.forEach){var s=i.map(function(e){return e.canonicalized});t(null,s)}else t(CK.MicroResourceContainerServerError.create({message:"Server response to canonicalizePhoneNumbers returned data in an invalid format.",failedKeys:e}),[]);return YES}),s.notify(0,null,function(n){return t(CK.MicroResourceContainerServerError.create({message:"Server request to canonicalizePhoneNumbers failed.",failedKeys:e}),[]),YES}),s.send(i)},normalizePhoneNumber:function(e){e=(e||"").toLowerCase();var t=this;return e=e.replace(/./g,function(e){return t.phoneDigitsToRoman[e]||e}),e&&e.replace(/[^0-9+]/g,"")},phoneDigitsToRoman:{"":"0","":"1","":"2","":"3","":"4","":"5","":"6","":"7","":"8","":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","":"0","१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","":"0","১":"1","২":"2","৩":"3","":"4","৫":"5","৬":"6","":"7","৮":"8","৿":"9","":"0","๑":"1","๒":"2","๓":"3","๔":"4","๕":"5","๖":"6","๗":"7","๘":"8","๙":"9"}}),CK.PhoneNumbers.CanonicalizationController.sharedInstance=function(){var e=CK.PhoneNumbers.CanonicalizationController;return e._sharedInstance||(e._sharedInstance=e.create())},CK.PhoneNumbers.countryDataController=SC.ObjectController.create({countryPhoneFormats:{},loadCountryData
:function(e){var t=this.get("countryPhoneFormats");if(t&&SC.typeOf(t[e])===SC.T_HASH)CW.notificationCenter.postNotification("phoneFormatJSONLoaded",e);else if(SC.empty(t[e])){var n="https://"+window.location.hostname+"/phone_numbers/2/%@.json".fmt(e),r=SC.Request.getUrl(n).json();r.notify(200,this,"didFetchCountryData",{countryCode:e}),r.notify(0,this,"didReceiveErrorForCountryData",{countryCode:e}),r.send(),this.get("countryPhoneFormats")[e]=YES}},didReceiveErrorForCountryData:function(e,t){var n=t.countryCode;return this.get("countryPhoneFormats")[n]=NO,CW.notificationCenter.postNotification("phoneFormatJSONLoaded",n),YES},didFetchCountryData:function(e,t){var n=t.countryCode;return this.get("countryPhoneFormats")[n]=this._decompressV2Data(e.get("body")),CW.notificationCenter.postNotification("phoneFormatJSONLoaded",n),YES},_decompressV2PhoneFormat:function(e){var t=/^\[(\d+)](.*)$/.exec(e),n=/^\[(\d+)-(\d+)](.*)$/.exec(e);return n&&n.length===4?{rangeBegin:n[1],rangeEnd:n[2],format:n[3]}:t&&t.length===3?{rangeBegin:t[1],rangeEnd:t[1],format:t[2]}:e},_decompressV2Data:function(e){var t=e.split("|"),n=t.slice(4);for(var r=n.length;r--;)n[r]=this._decompressV2PhoneFormat(n[r]);return{countryCode:t[0],numericCountryCode:t[1],internationalAccessCode:t[2],nationalAccessCode:t[3],phoneFormats:n}}}),CK.PhoneNumbers.FormattingController=SC.Object.extend(CK.MicroResourceContainer,{init:function(e){arguments.callee.base.apply(this,arguments),this.containerInit()},getFormatPhoneNumberState:function(e){var t=CK.PhoneNumbers.CanonicalizationController.sharedInstance();return e=t.normalizePhoneNumber
(e),this.containerGetStatus(e)},getFormatPhoneNumberValue:function(e){var t=CK.PhoneNumbers.CanonicalizationController.sharedInstance();return e=t.normalizePhoneNumber(e),this.containerGet(e)},formatPhoneNumber:function(e,t){var n=CK.PhoneNumbers.CanonicalizationController.sharedInstance();e=n.normalizePhoneNumber(e),this.containerLoad(e,t)},containerFlush:function(e){var t=e.map(function(e){return e.key}),n=this;this._formatPhoneNumbers(t,function(r,i){n.containerStoreResults(t,i,r,e)})},_formatPhoneNumbers:function(e,t){if(!e||!e.length)return t(undefined,[]);this._loadCountryDataForPhoneNumbers(e,function(e,n){if(e)return t(e);var r=n.map(function(e){if(!e)return e;var t=CK.PhoneNumbers.internationalPrefixForDigits(e,null),n=CK.PhoneNumbers.getCountryCodeFromInput(e,t.length),r=n&&CK.PhoneNumbers.countryDataController.countryPhoneFormats[n];if(!r)return e;var i=CK.PhoneNumbers.formatEntryforDigits(e,t,n,r);return i||e});t(undefined,r)})},_loadCountryDataForPhoneNumbers:function(e,t){function s(n){delete i[n],Object.keys(i).length||(CW.notificationCenter.unsubscribeFromNotification("phoneFormatJSONLoaded",null,s),t(null,e))}var n=CK.PhoneNumbers.countryDataController,r=n&&n.countryPhoneFormats,i={};e.forEach(function(e){var t=e&&CK.PhoneNumbers.getCountryCodeFromInput(e.replace(/^\+/,""));t&&r[t]===undefined&&(i[t]=!0)});if(!Object.keys(i).length){t(null,e);return}CW.notificationCenter.subscribeToNotification("phoneFormatJSONLoaded",null,s);for(var o in i)n.loadCountryData(o)}}),CK.PhoneNumbers.FormattingController.sharedInstance=function(){var e=CK.PhoneNumbers.FormattingController
;return e._sharedInstance||(e._sharedInstance=e.create())},CK.PhoneNumbers.PhoneFormatter={shouldFormat:YES,countryCode:function(){var e=this.get("value");if(e){var t=this.getInternationalPrefix(e);return t=CK.PhoneNumbers.normalizeString(t),t?CK.PhoneNumbers.getCountryCodeFromInput(e,t.length):this.get("defaultCountryCode")}return this.get("defaultCountryCode")}.property("value","defaultCountryCode").cacheable(),getInternationalPrefix:function(e){var t=this.get("defaultCountryCode"),n=CK.PhoneNumbers.countryDataController.get("countryPhoneFormats")[t];return CK.PhoneNumbers.internationalPrefixForDigits(e,n)},formattedValue:function(e,t){var n=this.get("shouldFormat");return t===undefined?t=this.get("value"):this.set("value",t),n&&t?this.formatPhoneNumbers(t):t}.property("value","shouldFormat","phoneFormat").cacheable(),phoneFormatJSONLoaded:function(e){e===this.get("countryCode")&&this.invokeLater(function(){CW.notificationCenter.unsubscribeFromNotification("phoneFormatJSONLoaded",this,this.phoneFormatJSONLoaded)},50),this.notifyPropertyChange("phoneFormat")},phoneFormat:function(){var e=CK.PhoneNumbers.countryDataController.get("countryPhoneFormats"),t=this.get("countryCode");return e[t]}.property("countryCode"),countryCodeObserver:function(){var e=this.get("phoneFormat"),t=this.get("countryCode"),n=CK.PhoneNumbers.countryDataController;t&&SC.typeOf(e)!==SC.T_HASH&&(CW.notificationCenter.subscribeToNotification("phoneFormatJSONLoaded",this,this.phoneFormatJSONLoaded),e!==YES&&n.loadCountryData(t))}.observes("countryCode"),formatPhoneNumbers:function(e){var t;if(e){var n=this
.get("countryCode"),r=this.get("phoneFormat"),i=this.getInternationalPrefix(e);r&&SC.typeOf(r)===SC.T_HASH&&(t=CK.PhoneNumbers.formatEntryforDigits(e,i,n,r))}return t||(t=CK.PhoneNumbers.normalizeString(e)),t}},CK.PhoneNumbers.PhoneTextFieldUpdater={_deleteKeyPressed:NO,updateOnEachKeyStroke:YES,validateAction:function(){this.set("value",this.get("formattedValue"))},validateTarget:null,inputTextFieldElement:function(){var e=this.$("input:text")[0];return e?e:null}.property().cacheable(),valueObserver:function(){this.invokeLater(function(){var e=this.get("inputTextFieldElement");if(!e){SC.warn("%@ view doesn't have a text input element",this);return}var t=this.get("value"),n=this.get("updateOnEachKeyStroke"),r=this.get("validateAction"),i=this.get("validateTarget")||this,s=this.get("_deleteKeyPressed");if(!n||!r){SC.warn("Since the 2 required parameters updateOnEachKeyStroke and validateAction are not provided we cannot proceed further.");return}if(!t)return;if(!s)if(this.getPath("formattedValue")!==t){this.getCursorPosition(e);if(r&&i){var o=r;SC.typeOf(o)!==SC.T_FUNCTION&&(o=i[r]),SC.typeOf(o)===SC.T_FUNCTION&&o.call(i)}}else this.setCursorPosition(e);this.set("_deleteKeyPressed",NO)},5)}.observes("value"),getCursorPosition:function(e){if(!e)return;var t=e.selectionStart,n=this.get("value"),r;n&&(this.set("_tempCursorPos",t),t===n.length?r=null:r=n.charAt(t),this.set("_tempCharAtCursor",r))},setCursorPosition:function(e){if(!e)return;var t=this.get("_tempCursorPos"),n=this.get("_tempCharAtCursor"),r=this.get("value");if(t){while(r.charAt(t)!==n&&t<r.length)t++;t&&e.setSelectionRange
(t,t),this.set("_tempCursorPos",null),this.set("_tempCharAtCursor",null)}},setDeleteKeyPressed:function(e){this.set("_deleteKeyPressed",e)},deleteBackward:function(e){return this.setDeleteKeyPressed(YES),YES},deleteForward:function(e){return this.setDeleteKeyPressed(YES),YES},keyDown:function(e){return e.keyCode===8||e.keyCode===46?(this.interpretKeyEvents(e),e.cancelled||e.allowDefault(),YES):arguments.callee.base.apply(this,arguments)}},CK.PhoneNumbers.CountryCode={1:"us",7:"ru",20:"eg",27:"za",30:"gr",31:"nl",32:"be",33:"fr",34:"es",36:"hu",39:"it",40:"ro",41:"ch",43:"at",44:"gb",45:"dk",46:"se",47:"no",48:"pl",49:"de",51:"pe",52:"mx",53:"cu",54:"ar",55:"br",56:"cl",57:"co",58:"ve",60:"my",61:"au",62:"id",63:"ph",64:"nz",65:"sg",66:"th",81:"jp",82:"kr",84:"vn",86:"cn",90:"tr",91:"in",92:"pk",93:"af",94:"lk",95:"mm",98:"ir",212:"ma",213:"dz",216:"tn",218:"ly",220:"gm",221:"sn",222:"mr",223:"ml",224:"gn",225:"ci",226:"bf",227:"ne",228:"tg",229:"bj",230:"mu",231:"lr",232:"sl",233:"gh",234:"ng",235:"td",236:"cf",237:"cm",238:"cv",239:"st",240:"gq",241:"ga",242:"cg",243:"cd",244:"ao",245:"gw",246:"io",247:"ac",248:"sc",249:"sd",250:"rw",251:"et",252:"so",253:"dj",254:"ke",255:"tz",256:"ug",257:"bi",258:"mz",260:"zm",261:"mg",262:"re",263:"zw",264:"na",265:"mw",266:"ls",267:"bw",268:"sz",269:"km",290:"sh",291:"er",297:"aw",298:"fo",299:"gl",350:"gi",351:"pt",352:"lu",353:"ie",354:"is",355:"al",356:"mt",357:"cy",358:"fi",359:"bg",370:"lt",371:"lv",372:"ee",373:"md",374:"am",375:"by",376:"ad",377:"mc",378:"sm",379:"va",380:"ua",381:"rs",382:"me",385:"hr",386:"si",387:"ba",389:"mk"
,420:"cz",421:"sk",423:"li",500:"fk",501:"bz",502:"gt",503:"sv",504:"hn",505:"ni",506:"cr",507:"pa",508:"pm",509:"ht",590:"gp",591:"bo",592:"gy",593:"ec",594:"gf",595:"py",596:"mq",597:"sr",598:"uy",599:"cw",672:"aq",673:"bn",674:"nr",675:"pg",676:"to",677:"sb",678:"vu",679:"fj",680:"pw",681:"wf",682:"ck",683:"nu",685:"ws",686:"ki",687:"nc",688:"tv",689:"pf",690:"tk",691:"fm",692:"mh",800:"xt",850:"kp",852:"hk",853:"mo",855:"kh",856:"la",880:"bd",886:"tw",960:"mv",961:"lb",962:"jo",963:"sy",964:"iq",965:"kw",966:"sa",967:"ye",968:"om",970:"ps",971:"ae",972:"il",973:"bh",974:"qa",975:"bt",976:"mn",977:"np",992:"tj",993:"tm",994:"az",995:"ge",996:"kg",998:"uz"},function(){function t(t,n){var r=e,i=n.lastIndexOf(".");i<0&&CW.fatalError("Property path is not a path (has no `.`): `"+n+"`",{propertyPath:n});var s=n.substr(i+1),o=n.substr(0,i),u=t.getChild(o);return r.child=u,r.property=s,r}var e={child:null,property:null};CW.ChildLayoutPlan=SC.Object.extend({children:null,initMixin:function(){this.children={}},getChild:function(e){var t=this.children,n=t[e];return n||(n=t[e]={name:e,left:0,width:0,right:0,top:0,height:0,bottom:0,centerX:0,centerY:0}),n},get:function(e){var n=t(this,e);return n.child[n.property]},move:function(e,n){var r=t(this,e);this.moveChildProperty(r.child,r.property,n)},resize:function(e,n){var r=t(this,e);this.resizeChildProperty(r.child,r.property,n)},moveUntil:function(e,n,r){var i=t(this,e),s=i.child,o=i.property,u=s[o];switch(n){case">=":u<r&&this.moveChildProperty(s,o,r);break;case"<=":u>r&&this.moveChildProperty(s,o,r);break;default:CW.fatalError("Operator not supported by `moveUntil`: "+
n+"; only <= and >= supported.",{operator:n,propertyPath:e})}},resizeUntil:function(e,n,r){var i=t(this,e),s=i.child,o=i.property,u=s[o];switch(n){case">=":u<r&&this.resizeChildProperty(s,o,r);break;case"<=":u>r&&this.resizeChildProperty(s,o,r);break;default:CW.fatalError("Operator not supported by `moveUntil`: "+n+"; only <= and >= supported.",{operator:n,propertyPath:e})}},moveChildProperty:function(e,t,n){n===undefined&&CW.fatalError("No value passed to `moveChildProperty`",{child:e,property:t});switch(t){case"left":this.moveLeft(e,n);break;case"right":this.moveRight(e,n);break;case"top":this.moveTop(e,n);break;case"bottom":this.moveBottom(e,n);break;case"centerX":this.moveCenterX(e,n);break;case"centerY":this.moveCenterY(e,n);break;default:CW.fatalError("Cannot move property `"+t+"` of `"+e.name+"` in plan",{child:e,plan:this,property:t})}},resizeChildProperty:function(e,t,n){n===undefined&&CW.fatalError("No value passed to `moveChildProperty`",{child:e,property:t});switch(t){case"left":this.resizeLeft(e,n);break;case"right":this.resizeRight(e,n);break;case"width":this.resizeWidth(e,n);break;case"top":this.resizeTop(e,n);break;case"bottom":this.resizeBottom(e,n);break;case"height":this.resizeHeight(e,n);break;default:CW.fatalError("Cannot resize property `"+t+"` of `"+e.name+"` in plan",{child:e,plan:this,property:t})}},moveLeft:function(e,t){var n=e.width;e.left=t,e.right=t+n,e.centerX=t+n/2},resizeLeft:function(e,t){var n=e.right-t;e.left=t,e.width=n,e.centerX=t+n/2},resizeWidth:function(e,t){var n=e.left;e.width=t,e.right=n+t,e.centerX=n+t/2},moveRight:function(e,t){var n=
e.width;e.right=t,e.left=t-n,e.centerX=t-n/2},resizeRight:function(e,t){var n=t-e.left;e.right=t,e.width=n,e.centerX=t-n/2},moveCenterX:function(e,t){e.centerX=t;var n=e.width,r=n/2;e.left=t-r,e.right=t+r},moveTop:function(e,t){var n=e.height;e.top=t,e.bottom=t+n,e.centerY=t+n/2},resizeTop:function(e,t){var n=e.bottom-t;e.top=t,e.height=n,e.centerY=t+n/2},resizeHeight:function(e,t){var n=e.top;e.height=t,e.bottom=n+t,e.centerY=n+t/2},moveBottom:function(e,t){var n=e.height;e.bottom=t,e.top=t-n,e.centerY=t-n/2},resizeBottom:function(e,t){var n=t-e.top;e.bottom=t,e.height=n,e.centerY=t-n/2},moveCenterY:function(e,t){e.centerY=t;var n=e.height,r=n/2;e.top=t-r,e.bottom=t-r}})}(),function(){var e=0;if(SC.browser.isIE||SC.browser.isMozilla)e=1;var t={x:0,y:0,width:0,height:0};CW.ChildLayoutPlanSupport={initialChildLayouts:{},childLayoutPlan:function(){return CW.ChildLayoutPlan.create()}.property().cacheable(),initializeChildLayoutPlanForViews:function(n,r){var i=r.length,s,o=this.initialChildLayouts,u=this.get("frame"),a,f,l,c,h,p;for(s=0;s<i;s++){a=r[s],f=this.getPath(a),l=n.getChild(a),c=f.get("parentView"),h=c.get("frame"),p=o[a];if(!p)continue;t.width=h.width,t.height=h.height,h=c.convertFrameToView(t,this);var d=p.left,v=p.top,m=p.width,g=p.height,y=p.right,b=p.bottom,w=p.centerX,E=p.centerY;if(m==="auto"){f.$().css("width","auto");var S=f.$()[0],x=S.getBoundingClientRect().width;n.resizeChildProperty(l,"width",x+e)}else m!==undefined&&n.resizeChildProperty(l,"width",p.width);g==="auto"?(f.$().css("height","auto"),n.resizeChildProperty(l,"height",f.$().height()+e)):g!==undefined&&
n.resizeChildProperty(l,"height",p.height),v!==undefined&&n.moveChildProperty(l,"top",h.y+p.top),d!==undefined&&n.moveChildProperty(l,"left",h.x+p.left),y!==undefined&&(d!==undefined?n.resizeChildProperty(l,"right",h.x+h.width-p.right):n.moveChildProperty(l,"right",h.x+h.width-p.right)),b!==undefined&&(v!==undefined?n.resizeChildProperty(l,"bottom",h.y+h.height-p.bottom):n.moveChildProperty(l,"bottom",h.y+h.height-p.bottom)),w!==undefined&&n.moveChildProperty(l,"centerX",h.x+h.width/2),E!==undefined&&n.moveChildProperty(l,"centerY",h.y+h.height/2)}},applyChildLayoutPlanToViews:function(e,n){var r=n.length,i,s,o,u,a,f;for(i=0;i<r;i++)s=n[i],o=this.getPath(s),u=e.getChild(s),a=o.get("parentView"),f=a.convertFrameToView(t,this),o.beginPropertyChanges(),o.adjust("left",u.left-f.x),o.adjust("top",u.top-f.y),o.adjust("width",u.width),o.adjust("height",u.height),o.endPropertyChanges()}}}(),SC.stringsFor("en-us",{"ErrorPage.Message.JavaScriptRequired.Title":"JavaScript is required.","ErrorPage.Message.JavaScriptRequired.Caption":"Please double check and try again.","IndexFile.Title":"Sign in to iCloud - Apple","IndexFile.Meta.Description":"Sign in to iCloud to access your photos, videos, documents, notes, contacts, and more. Use your Apple ID or create a new account to start using Apple services."}),CW.installKeyResponder(),window.devicePixelRatio=window.devicePixelRatio||1,CloudOS=SC.Application.create(SC.DelegateSupport,{NAMESPACE:"CloudOS",VERSION:"2.0.0",isCloudOSClient:YES,isCloudOSMini:CloudOSBootstrap.isCloudOSMini,hostname:window.location.hostname,SPINNER_IMAGE_SRC:window._rhtmlSpinnerSrc
,APP_LOAD_INTERMEDIATE_TIMEOUT:15,APP_LOAD_TIMEOUT:120,APP_POST_READY_DELAY:500,ACTIVE_IDLE_INTERVAL:30,INACTIVE_IDLE_INTERVAL:600,INACTIVE_THRESHOLD:120,AUTO_UPDATE_INTERVAL:900,AUTO_UPDATE_INACTIVITY_INTERVAL:7200,AUTO_UPDATE_DELAYED_INTERVAL:3600,AUTO_UPDATE_DELAYED_FORCE_WAIT:7200,MAX_NOTIFICATION_DISMISSAL_WAIT:10,NOWHERE:0,PREAUTH:1,AUTH:2,APP:3,SPRINGBOARD:4,SHARING:5,EXCLUDE_SASH_FOR_ENVS:["PROD","DEMO","ICLOUD1"],delegate:null,_lastActivityEpoch:(new Date).getTime(),statechartPath:"CloudOS.statechart",authPane:null,supportedDomains:["icloud.com","icloud.com.cn"],supportedDomainsToReceiveMessagesFrom:function(){var e=SC.clone(this.get("supportedDomains"));return e.push("apple.com"),e}.property("supportedDomains").cacheable(),init:function(){arguments.callee.base.apply(this,arguments);var e=SC.Logger,t=SC.LOGGER_LEVEL_DEBUG,n=SC.buildMode==="debug"?t:SC.LOGGER_LEVEL_WARN;e.set("logOutputLevel",n),e.set("logRecordingLevel",t),CW.set("requestLoggingLevel",t),SC.Logger.set("outputMessagePrefix","CloudOS: ");var r=this;window.onbeforeunload=function(){var e=CloudOS.appController.get("loadedApps"),t=CloudOS.authController.get("isAtLeastPartiallyAuthenticated"),n,r;if(e&&t){r=e.filter(function(e){return e.get("isReadyToTerminate")===NO});if(r&&r.length>0){var i=r.pop(),s=i.get("displayName");n="Dialog.UnsavedChanges.Description".loc(s)}else CloudOS._receivedBeforeUnload=YES}return n},window.onhashchange=function(){if(CloudOSBootstrap.isOnSupportedMobile)return;var e=CloudOS.workspaceController,t=CloudOS.authController,n=CloudOS.appController,r=CloudOS.statechart,i=n.getDefaultAppName
(),s=CloudOS.getShareDetailsFromUrl(),o=CloudOS.getAppRouteFromHash(),u=CloudOS.appManagerFor(i),a=n.get("currentApp"),f=n.get("pendingApp"),l=a===u,c=CloudOS.shareController;if(t.get("isNotAuthenticated"))u&&s?CloudOS.handleShareDetails(s,u):r.gotoState("active.authUI");else if(t.get("isAtLeastPartiallyAuthenticated")){if(l&&o===u.get("route"))return;if(CloudOS.get("isCloudOSMini"))return;!s&&!u&&!COS.apps[i]&&window.location.hash!==""&&(i=null,e.clearHash());if(t.get("isPartiallyAuthenticatedForManagedAppleId"))u&&(u.set("loadReason",CK.LOAD_REASON_LOCATION_HASH),n.set("pendingApp",u));else if(u&&u.get("isHSALocked"))u.set("loadReason",CK.LOAD_REASON_LOCATION_HASH),n.set("pendingApp",u),r.sendAction("showHSA",CloudOS.HSASourceEnum.USER_SELECTED_APP);else if(u&&u.get("isPCSKeysDeletedLocked"))r.sendAction("showPCSDeletedMessage",u.get("displayName")),window.location.hash=a?a.get("name"):"";else if(s){if(t.shouldShowFirstRun(t.get("accountPreferences"),CW.getUrlParameters()))return;c.get("isZoneICloudApple")?c.launchApp():CloudOS.handleShareDetails(s,u)}else if(CloudOSBootstrap.willLoadMobileSupportedApp&&(!u||!u.get("isSupportedOnMobile")))if(a)window.location.hash=a.get("name");else{var h=SC.browser,p=window.location.origin;if(!p){var d=window.location;p=d.protocol+"//"+d.hostname}if(h.iPhone||h.iPod){window.location=p+"/iphone_welcome/";return}if(h.iPad){window.location=p+"/ipad_welcome/";return}}else if(SC.none(u)||u&&!u.get("isLocked")&&u!==f)u&&u.set("loadReason",CK.LOAD_REASON_LOCATION_HASH),CloudOS.openApp(i)}}},run:function(){if(this._hasRunRun===(this._hasRunRun=YES
)){SC.warn("CloudOS.run() has been called, but has already been called once.");return}SC.debug("CloudOS window is %@ initially",document.hidden?"hidden":"visible"),SC.Event.add(window,"visibilitychange",SC.RunLoop.wrapFunction(function(){document.hidden?SC.debug("CloudOS window is hidden"):SC.debug("CloudOS window is visible")})),CloudOS.loadLocalizedStrings(),CloudOS.localizationController.relocalizeIfNeeded("CloudOS.run() wants the initial relocalize call"),CloudOS.appController.initializeAppManagers(),CloudOS.statechart.initStatechart();var e=SC.RootResponder.responder,t=CloudOS.workspaceController,n=COS.statsController;e.set("defaultResponder",CloudOS.statechart),e.listenFor("resize".w(),window,t),t.updateTitle(),COS.prefsController.set("delegate",CloudOS),CW.notificationCenter.subscribeToNotification("configBagReceived",CloudOS.initializationController,CloudOS.initializationController.handleConfigBag),SC.Event.add(window,"message",this,SC.RunLoop.wrapFunction(this._messageWasReceived),null,!0),n.recordStat("cloudos","DidLoad",{duration:SC.getCurrentTimeForPerformance()-SC.benchmarkPreloadEvents.headStart});var r=window.location.search;if(r&&(r.indexOf("?sc")===0||r.indexOf("&sc")!==-1)){var i=window.location,s=i.href,o=URI(s),u=CloudOS.appController.getDefaultApp();n.recordStat("cloudos","BookmarkDetection",{hostname:window.location.hostname,buildNumber:SC.buildNumber,masteringNumber:SC.masteringNumber,referrer:function(){var e=document.referrer,t;return e?(t=URI(e),t.hostname()+"/"+t.path()):""}(),defaultApp:u?u.get("name"):""});var a=function(e){i.href="https://"+o.hostname
()+"/not_found/"},f=SC.browser.msie?YES:NO;n.sendStats(f,a)}},loadAlarms:function(){var e=YES;COS.authController&&COS.authController.getPath("user.isLiteAccount")&&(e=NO),e&&CloudOS.runWhenReady(function(){SC.Module.loadModule("cloudos_foundation/alarms","CloudOS.Alarms","initializeAlarmControllers")})},_messageWasReceived:function(e){var t=e.originalEvent,n=URI(t.origin),r=this.get("supportedDomainsToReceiveMessagesFrom"),i=n.domain();if(n.protocol()!=="https"||!r.contains(i)){SC.warn("Ignoring message from invalid domain "+i);return}var s=t.data,o=SC.typeOf(s),u,a,f,l,c,h=NO,p=NO,d=COS.statsController;if(o===SC.T_STRING){var v=CloudOS.APPLE_ID_WIDGET_POST_MESSAGE_PREFIX,m=CloudOS.APPLE_AUTH_WIDGET_POST_MESSAGE_PREFIX,g=NO,y=NO;s.indexOf(v)===0&&(h=YES,s=s.substring(v.length)),s.indexOf(m)===0&&(p=YES,s=s.substring(m.length))}try{o===SC.T_STRING?(u=SC.json.decode(s),t=SC.clone(t),t.data=u):u=s}catch(b){SC.warn(b);return}if(h){CloudOS.appleCreateWidgetController?CloudOS.appleCreateWidgetController.handleMessage(u):(SC.debug("No appleCreateWidgetController to handle message with data "+s),d.recordStat("cloudos","InvalidAppleIdCreateMessage",u));return}if(p){CloudOS.appleAuthWidgetController?CloudOS.appleAuthWidgetController.handleMessage(u):(SC.debug("No appleAuthWidgetController to handle message with data "+s),d.recordStat("cloudos","InvalidAppleIdAuthMessage",u));return}if(!u||!u.isCloudOSMessage)return;if(u.isWindowApplicationMessage){f=CloudOS._applicationWithOpener,f&&f.get("contentWindow").CK.currentApplication._messageWasReceived(e);return}if(u.widgetName==="NewLogin"
){CloudOS.newLoginController.handleMessage(u);return}a=u.appName,f=CloudOS.appManagerFor(a),l=u.methodName,c=u.args||[];if(!f){SC.warn("Could not find an appManager for %@ from %@",a,t.origin);return}f.setIfChanged("buildNumber",u.buildNumber),f.setIfChanged("masteringNumber",u.masteringNumber),c.unshift(t),c.unshift(f),this.respondsTo(l)?this[l].apply(this,c):d.recordStat("cloudos","InvalidCloudOSMessage",u)},_windowMessageWasReceived:function(e){SC.RunLoop.end(),SC.run(function(){this._messageWasReceived(e)},this)},passMessageToAllApps:function(e,t,n){var r=CloudOS.appController.get("loadedApps");if(r){var i=r.length;for(var s=0;s<i;s++){var o=r[s];o.passMessage(e,t,n)}}},focus:function(){try{window.focus()}catch(e){SC.debug("Failed to focus CloudOS client window. Exception text: "+e)}},localeDidLoad:window.localeDidLoad,_ldl:window.localeDidLoad,localeDidLoadDidChange:function(){if(!this.get("localeDidLoad")||!this.get("mainHasCompleted"))return;SC.debug("Got localized strings back AFTER app is loaded and CloudOS.main() has run. Running CloudOS.run() now, because CloudOS.localeDidLoad changed from "+this._ldl+" to "+this.localeDidLoad),CloudOS.run()}.observes("localeDidLoad"),loadLocalizedStrings:function(){SC.debug("Loading localized strings and metrics");var e=window.localizedStrings,t=window.localizedMetrics,n;for(n in e)SC.stringsFor(n,e[n]);for(n in t)SC.metricsFor(n,t[n])},getAppFromURL:function(){var e;if(CloudOS.get("isCloudOSMini"))e=window.location.pathname.match(/([A-z0-9]+)/)[0];else{var t=window.location.hash.match(/(\w+)/);if(t){var n=t[1];if(COS.apps[n])e=n
;else for(var r in COS.apps){var i=COS.apps[r].alternateAppName;i===n&&(e=r,window.location.hash=window.location.hash.replace(n,r))}}}return e},getAppRouteFromHash:function(){var e=window.location.hash,t;return CloudOS.get("isCloudOSMini")?t=0:t=e.indexOf("/"),t===-1?null:e.substring(t+1,e.length)},getShareDetailsFromUrl:function(){var e=window.location.hash,t,n,r,i,s;e=e.length>1?e.substr(1):"",t=/v\/([^\/]+)(\/updated)?/,n=e.match(t);if(n)s={},s.vettingToken=n[1],s.isVettingTokenVetted=!!n[2];else{r=/([^\/]+)\/([a-zA-Z0-9_\-]+)/,i=e.match(r);if(i){var o=i[1],u=i[2],a=o==="share",f,l=CloudOS.authController.get("performedLoginFlow"),c=this.isUserAuthenticated();o==="notes"&&CloudOS.appManagerFor("notes2")&&(o="notes2"),f=COS.appsController.getAppInfoFor(o);if(a||f&&f.get("isCloudOSInterceptingShareUrls"))s={},u.length<=25||c&&!l&&!CK.get("isCarry")?s.shortGUID=u:s.longGUID=u,s.appNameFromUrl=a?null:o}}return s},handleShareDetails:function(e,t){if(e){var n=e.shortGUID,r=e.longGUID,i=e.appNameFromUrl,s=i==="keynote"||i==="numbers"||i==="pages",o=e.vettingToken,u=this.get("statechart"),a=this.isUserAuthenticated();if(n)t&&t.get("isLoaded")?t.passMessage("ckShortGUIDDidChange",n):u.sendAction("goToSharingState",e);else if(r&&s&&a){var f=CloudOS.appManagerFor(i).getAppDomain();window.location.href=URI(f+"/"+i+"/"+r).addSearch("redirectReason","off").toString()+"#:nooverride"}else o&&u.sendAction("goToVettingState",e)}},appManagerFor:function(e){var t=arguments.callee.apps||(arguments.callee.apps=CloudOS.appController.get("apps")),n=arguments.callee.appsList||(arguments.callee.appsList=
CloudOS.appController.get("appList"));if(typeof e=="number")return n&&n[e];if(typeof e=="string")return t&&t[e];if(e&&e.isAppManager)return e;if(!e)return;return t&&t[e.get("name")]},appManagersForPushTopic:function(e){var t=CloudOS.appController.get("apps"),n,r,i=[];for(r in t)n=t[r],n.getPath("appInfo.pushTopic")===e&&i.push(n);return i},appManagersForContainerIdentifier:function(e){var t=CloudOS.appController.get("apps"),n,r,i=[];for(r in t)n=t[r],n.getPath("appInfo.containerIdentifier")===e&&i.push(n);return i},openApp:function(e){var t=CloudOS.workspaceController.get("nowShowing"),n=CloudOS.statechart,r=CloudOS.authController,i=r.get("isPartiallyAuthenticated"),s=r.get("isPartiallyAuthenticatedForManagedAppleId");if(t<CloudOS.AUTH)return;if(!e){if(t===CloudOS.SPRINGBOARD)return;i?n.stateIsEntered("hsa")||n.sendEvent("showHSA"):s?n.stateIsEntered("managedAppleId")||n.sendEvent("gotoManagedAppleId"):n.gotoState("active.springboard")}else CloudOS.appController.set("pendingApp",e=CloudOS.appManagerFor(e)),CW.notificationCenter.postNotification("preparingForAppTransition"),n.sendAction("globalAppSwitchWasRequested")},_userInputBlocked:0,blockUserInput:function(e){this._userInputBlocked||CloudOS.blockInputController.block(e),this._userInputBlocked++},unblockUserInput:function(){if(this._userInputBlocked<=0){SC.warn("User input already unblocked. unblockUserInput has no effect.");return}this._userInputBlocked--,this._userInputBlocked===0&&CloudOS.blockInputController.unblock()},shouldAppHaveFocus:function(){return CloudOS.workspaceController.nowShowing!==CloudOS.APP?NO:CloudOS
._numberDialogsAboveApp===0},numberDialogsAboveApp:0,hasDialogAboveApp:NO,notifyDialogAboveApp:function(){CloudOS.set("numberDialogsAboveApp",CloudOS.get("numberDialogsAboveApp")+1)},notifyRemovalOfDialogAboveApp:function(){CloudOS.set("numberDialogsAboveApp",Math.max(0,CloudOS.get("numberDialogsAboveApp")-1))},provideHasDialogAboveApp:function(){var e=CloudOS.get("numberDialogsAboveApp")>0;CloudOS.get("hasDialogAboveApp")!==e&&CloudOS.set("hasDialogAboveApp",e)}.observes("numberDialogsAboveApp"),runWhenReady:function(e,t){var n=this._readyQueue;return t===undefined?(t=e,e=null):SC.typeOf(t)===SC.T_STRING&&(t=e[t]),this._isReady?t.call(e):(n||(this._readyQueue=[]),this._readyQueue.push(function(){t.call(e)})),this},_executeReadyQueue:function(){if(CloudOS._outstandingRequests>0){this._invokeLaterTimer&&this._invokeLaterTimer.invalidate(),this._invokeLaterTimer=this.invokeLater(function(){CloudOS._executeReadyQueue()},1e3);return}this._isReady=YES;var e=this._readyQueue,t,n;if(e){SC.info("Executing CloudOS readyQueue");for(t=0,n=e.length;t<n;t++)e[t].call();this._readyQueue=null}},loadImageUrlAndRecordStat:function(e,t){var n=new Image,r=SC.getCurrentTimeForPerformance();n.onload=function(){var n={asset:e,loadTime:SC.getCurrentTimeForPerformance()-r};COS.statsController.recordLocationStat("cloudos",t,n)},n.src=e},reportEdgePerformance:function(){if(window.performance&&window.performance.getEntriesByType){var e=window.performance.getEntriesByType("resource");if(!e||!e.filter)return;var t=e.filter(function(e){if(e.name.indexOf("perf.css")!==-1)return YES}).pop();t&&t.toJSON&&COS
.statsController.recordLocationStat("cloudos","ICloudEdgeLoad",t.toJSON())}},showAuthPane:function(e){if(!e&&!CloudOS.appleAuthWidgetController){var t=CloudOS.shareController;t&&t.get("recordInfo")?CloudOS.appleAuthWidgetController=CloudOS.SharingAppleAuthWidgetController.create():CloudOS.appleAuthWidgetController=CloudOS.AppleAuthWidgetController.create()}var n=this.get("authPane");if(!n){n=CloudOS.AuthPane.create();if(!e){var r=URI(window.location.href).host(),i=CloudOS.initializationController.get("accountLoginUrl");i?CloudOS.appleAuthWidgetController.show(n,i):CloudOS.statechart.gotoState("validateFailureWithoutUsableData")}}return n.get("isPaneAttached")?n.show():n.append(),n},showNewLogin:function(){CloudOS.newLoginController||(CloudOS.newLoginController=CloudOS.NewLoginController.create());var e=this.get("authPane"),t=this.newLoginUrl();e||(e=CloudOS.AuthPane.create()),CloudOS.newLoginController.show(e,t),e.get("isPaneAttached")?e.show():e.append()},newLoginUrl:function(){var e=window.location.origin;if(!e){var t=window.location;e=t.protocol+"//"+t.hostname}return e+"/applications/new-login/current/%@/".fmt(String.preferredLanguage)},setupShareController:function(e){var t=CloudOS.shareController;e&&(t?t.updateShareDetails(e):CloudOS.shareController=CloudOS.ShareController.create(e))},isCloudOSLocaleRTLOriented:function(){var e=CloudOS.authController.getPath("accountPreferences"),t;return e?t=e.get("isCloudOSLocaleRTLOriented"):t=CloudOSBootstrap.isCurrentlyLoadedLocaleRTL,t}.property("CloudOS.authController.accountPreferences")}),CloudOS.HSASourceEnum={NONE:0,USER_SELECTED_APP
:1,POST_LOGIN_REDIRECT:2},CloudOS.API={requestStartup:function(){var e=arguments[0];return e&&COS.startupController.requestStartup(e.get("name")),this},getCurrentlyActiveApplication:function(){},userIsAuthenticated:function(){return CloudOS.authController.get("isAuthenticated")},sessionIsExtendedLogin:function(){},getUser:function(){},getUrlForServiceName:function(e,t){},getStatusForServiceName:function(e,t){},applicationIsReady:function(){var e=arguments[0];e.didBecomeReady()},startupDataIsLoaded:function(){var e=arguments[0];e.startupDataDidLoad()},showAccountSettings:function(){CloudOS.statechart.sendEvent("showAccountSettings")},showAppSwitcher:function(e,t,n){CloudOS.statechart.sendAction("appCalledShowAppSwitcher",n)},showSpringBoard:function(){CloudOS.statechart.sendAction("appCalledShowSpringBoard")},exit:function(e,t){},performSecondaryAuth:function(e){var t=arguments[0],n=t.get("name");e=arguments[2];var r=CloudOS.authController;r.secondaryLogin(r.getPath("user.appleId"),e,null,n)},performLogin:function(){if(COS.authController.get("isAtLeastPartiallyAuthenticated"))return;CloudOS.statechart.gotoState("active.authUI")},performLogout:function(){var e=COS.authController,t=e.get("isNotAuthenticated"),n=e.get("isLoggingOut"),r=e.currentLogoutAlert;if(t||n||r){SC.warn("Either the user is not logged in or logout process has already started. Ignoring new logout call.");return}var i=arguments[0],s=i.get("name"),o=function(e){var t=CloudOS.authController,n=CloudOS.get("isCloudOSMini")?null:function(){CK.reloadWithReason("application "+s+" called performLogout")};t.currentLogoutAlert=
null,t.set("hsaTrustedBrowser",e),i.set("route",null),t.logoutUser(n,YES)},u=function(){var e=COS.authController;e.currentLogoutAlert=null},a=COS.authController.get("hsaTrustedBrowser");a?e.currentLogoutAlert=CK.logoutAlert(o,u,a):o()},revalidateUser:function(){var e=arguments[0],t=arguments[1],n=t.data.id;n?COS.revalidateController.performRevalidate(function(){e.passMessage(CK.RPC_RESPONSE,n)}):COS.revalidateController.performRevalidate(function(){CloudOS.appController.userDidRevalidate()})},showHelp:function(e){},switchToApplication:function(e,t){var n=arguments[0],r=CloudOS.appManagerFor(arguments[2]);t=arguments[3];if(!n||!n.get("isActive")){SC.debug("%@ is not allowed to switch to a different app while in background",n.get("name"));return}if(!r){SC.debug("Cannot switch to unknown app %@",e);return}r.set("route",t),r.set("loadReason",CK.LOAD_REASON_APP_SWITCH),CloudOS.appController.set("pendingApp",r),CloudOS.statechart.sendAction("appCalledSwitchToApplication")},getAppLoadReason:function(){},mailTo:function(e,t,n,r,i){},setRoute:function(e){var t=arguments[0];e=arguments[2];if(!t)return;t.set("route",e)},getRoute:function(){},getAccountPreferences:function(){},getAppPreferences:function(e){},setAppPreferences:function(e){var t=arguments[0],n=t.get("name");e=SC.clone(arguments[2],YES),t._cos_app_preferences_cache=e,COS.prefsController.savePreferences(n,e)},refreshAppPreferences:function(){var e=arguments[0],t=e.get("name");COS.prefsController.getPreferences(t)},setStartupUrl:function(e){var t=arguments[0],n=t.get("name");e=arguments[2],COS.startupController.setStartupUrl
(n,e)},setStartupInfo:function(e){var t=arguments[0],n=t.get("name");e=arguments[2],COS.startupController.setStartupInfo(n,e)},getRequestedStartupUrl:function(){},getEnvironment:function(){},setTitle:function(e){var t=arguments[0];e=arguments[2],t&&t.set("title",e)},reload:function(){var e=arguments[0];e.reloadInPlaceIfAppropriate()},reloadWhenCanTerminate:function(){var e=arguments[0],t=arguments[1];e.reloadInPlaceIfAppropriateWhenCanTerminate(t)},showLocalNotification:function(){SC.warn("showLocalNotification has been deprecated. Use sendLocalNotification() instead."),this.sendLocalNotification.apply(this,arguments)},sendLocalNotification:function(e,t,n,r){var i=arguments[0],s=i.get("name"),o,u,a,f,l,c,h;e=arguments[2],t=arguments[3],n=arguments[4],r=arguments[5],n&&CloudOS.appManagerFor(n)&&(s=n),SC.typeOf(e)===SC.T_STRING?(o=arguments[2],u=arguments[3],a=arguments[4],f=arguments[5],l=arguments[6],h=YES,c=NO):e&&(o=e.alertTitle,u=e.alertDescription,a=e.actionPayload,f=e.badgeCount,l=e.soundPath,c=e.isDismissable!==undefined?!!e.isDismissable:YES,h=e.omitWhenActive!==undefined?!!e.omitWhenActive:YES);var p=u||o||f||l?{alert:u,alertTitle:o,badge:f,sound:l}:undefined;CloudOS.notificationsController.handlePushNotification(SC.merge(t,{aps:p,icloud:a,omitWhenActive:h,isDismissable:c}),YES,s,r)},setBadgeCount:function(e){var t=arguments[0];e=arguments[2],SC.typeOf(e)===SC.T_NUMBER&&e>-1&&t.set("badgeCount",e)},recordStat:function(e,t){var n,r;arguments.length>=3?(n=arguments[0],r=n.get("name"),e=arguments[2],t=arguments[3]):r=t&&t.appName?t.appName:"cloudos",SC.empty(t)?t={appName
:r}:t.appName=r,COS.statsController.recordStat(r,e,t)},beginStat:function(e,t){var n=arguments[0],r=n.get("name");e=arguments[2],t=arguments[3],COS.statsController.beginStat(r,e,t)},endStat:function(e,t){var n=arguments[0],r=n.get("name");e=arguments[2],t=arguments[3],COS.statsController.endStat(r,e,t)},passMessageToOpenerApplication:function(e){},hasOpenerWithCloudOS:function(){return!!CloudOS.getOpenerWithCloudOS()},setAccountPreference:function(e,t,n,r){var i=COS.authController.get("accountPreferences"),s;if(!i)return;var o=i.get(n);if(o==r)return;if(n==="locale"||n==="secondaryLocale")s=i.get("localeForCloudOS");i.set(n,r);switch(n){case"locale":case"secondaryLocale":i.set("startupUrls",{}),CW.notificationCenter.postNotification("accountPrefsChanged",i.get("localeForCloudOS"),s);break;case"timeZone":i.set("startupUrls",{})}},logoutFromAllBrowsers:function(){COS.authController.logoutUser(function(){CK.reloadWithReason("signOutAllBrowsers")},YES,YES,YES)},requestMeCard:function(e,t){},deleteMeCardPhoto:function(e,t){var n=CK.meCardController,r=n.get("photo");n.deletePhoto(),this._updateMeCardPhoto(e,t,null,r)},storeMeCardPhoto:function(e,t,n){if(!n)return;var r=CK.meCardController,i=r.get("photo");r.set("photo",n),this._updateMeCardPhoto(e,t,n,i)},_updateMeCardPhoto:function(e,t,n,r){function i(e){e===1&&CK.meCardController.set("photo",r);var t=CloudOS.requestMeCard();CloudOS.passMessageToAllApps("receiveMeCard",t)}CK.meCardController.storeMeCard({photo:n},i)},handleApplicationCrash:function(e,t){var n=arguments[0],r=n.get("name");e=arguments[2],t=arguments[3],e=e?SC.clone
(e,NO):{},e.applicationName=r,t&&(e.applicationLog=t),COS.handleApplicationCrash(e)},recordApplicationMessage:function(e,t){var n=arguments[0],r=n.get("name");e=arguments[2],t=arguments[3];var i=t?": "+JSON.stringify(t):"";SC.info('applicationMessage "%@" received from %@%@',e,r,i),COS.statsController.recordLocationStat(r,e,t),e==="OnErrorException"&&n.recordException("OnErrorException: "+i)},didReceiveSpecialResponse:function(e,t,n){SC.typeOf(e)!==SC.T_NUMBER&&(e=arguments[2],t=arguments[3],n=arguments[4]);var r;switch(e){case 330:this._suspendedCount=this._suspendedCount?++this._suspendedCount:1;if(this._suspendedCount>3){SC.warn("Have reached suspendCount max for 330 responses. Will stop retrying."),this.invokeLater(function(){CloudOS._suspendedCount=0},1e4);return}CloudOS.authController.validateUser(function(){CloudOS.appController.userDidRevalidate()});break;case 421:case 401:try{r=SC.json.decode(t)}catch(i){SC.info("Cannot decode response: "+t)}CloudOS.authController.logoutUser(function(){CK.reloadWithReason("received a "+e+" in didReceiveSpecialResponse")},YES);break;case 403:window.location.hash="#:showlogin",CK.reloadWithReason("received 403 in didReceiveSpecialResponse");break;case 503:CloudOS.statechart.sendAction("showServiceLocked",n)}},requestSent:function(){this._outstandingRequests===undefined&&(this._outstandingRequests=0),this._outstandingRequests++},requestReceived:function(e,t,n,r){this._outstandingRequests--;var i;e&&SC.typeOf(e)!==SC.T_HASH?(i=arguments[0].get("name"),e=arguments[2],t=arguments[3],n=arguments[4],r=arguments[5]):i="cloudos",e&&COS.statsController
.recordLocationStat(i,"RequestInfo",e);if(t===undefined||t===null)return;var s=String(t)[0];if(s==="5"||s==="0"){var o=CK.isURLInCarryPartition(n)?"ServerErrorOrTimeoutInCarry":"ServerErrorOrTimeout",u=URI(n),a=u.hostname(),f=(a+u.path()).replace(/[0-9]{3}/g,"…");COS.statsController.recordStat(i,o,{status:t,sanitizedUrl:f,serverHostname:a,responseBody:r})}},relayKeyboardShortcut:function(e,t,n){CW.performKeyEquivalent(n)},relayMouseMove:function(e,t,n){CloudOS._lastActivityEpoch=(new Date).getTime()},meCardUpdated:function(){SC.debug("meCardUpdated(), will grab latest version..."),CK.meCardController.getMeCard()},getClientId:function(){},isReadyToTerminateDidChange:function(){var e=arguments[0],t=arguments[2];e.set("isReadyToTerminate",t)},windowApplicationHasInitialized:function(){},appWillUnload:function(e){var t=arguments[0],n=t.get("name");e=arguments[2],e&&(SC.info("appWillUnload log from %@:",n),SC.info(e));if(!CloudOS._receivedBeforeUnload){if(t.get("loadReason")===CK.LOAD_REASON_RELOAD)return;CloudOS.appController.get("currentApp")===t&&t.get("isLoaded")?(SC.info("appWillUnload: Reloading application, most likely because user chose to Reload Frame"),CloudOS.appController.reloadApplication(n)):t.teardown()}},setAppBanner:function(e,t){},currentAppName:function(){},getQuotaData:function(){},isUserOverQuota:function(){},refreshQuotaData:function(){},fetchIcon:function(e,t,n,r){var i=null,s=null;if(typeof e=="string"){n||(n=window.devicePixelRatio);if(window.CoreTypes){var o=window.CoreTypes.API.fetchIcon(e,t,n,r);return o}return{}}i=arguments[0],s=arguments[1],e=arguments
[2],t=arguments[3],n=arguments[4],r=arguments[5];var u=s.data.id;n||(n=window.devicePixelRatio);if(!window.CoreTypes)SC.Module.loadModule("cloudkit/core_types",this,function(){var s=window.CoreTypes.API.fetchIcon(e,t,n,r);i.passMessage(CK.RPC_RESPONSE,u,s)}.bind(this));else{var a=window.CoreTypes.API.fetchIcon(e,t,n,r);i.passMessage(CK.RPC_RESPONSE,u,a)}},getConformingTypes:function(e,t,n){var e=arguments[0],r=t.data.id;if(!window.CoreTypes)SC.Module.loadModule("cloudkit/core_types",this,function(){var t=window.CoreTypes.API.getConformingTypes(n);e.passMessage(CK.RPC_RESPONSE,r,t)}.bind(this));else{var i=window.CoreTypes.API.getConformingTypes(n);e.passMessage(CK.RPC_RESPONSE,r,i)}},fetchAppUrl:function(e,t,n,r){var i=CloudOS.appManagerFor(r),s=i&&i.get("path");e.passMessage("didFetchAppUrl",n,s)},completeAuthentication:function(e,t,n){var r=CloudOS.appManagerFor(n)||e,i=e.get("name");if(CloudOS.authController.get("userAuthenticationState")!==CK.AuthenticationStateEnum.PARTIALLY_AUTHENTICATED_HSA){SC.info("completeAuthentication(): User is not partially authenticated, nothing to do here.");return}CloudOS.appController.exitApplication(i,CK.EXIT_NON_FATAL,null,r)},loadRulesForRegions:function(e,t,n){var r=t.data.id;COS.regionController.load(n,function(t){e.passMessage(CK.RPC_RESPONSE,r,t)}.bind(this))},resolveCKShortGUID:function(){},replaceCurrentApp:function(e){},getWindowMinimumSize:function(){},isOnSupportedMobile:function(){},getSecureChannelInfo:function(){},getDefaultAssetHostname:function(){}},CloudOS._cloudOSAPIMethodNames=function(){var e=[],t;for(t in CloudOS.API)CloudOS
.API.hasOwnProperty(t)&&e.push(t);return e}(),CloudOS.mixin(CloudOS.API),CloudOS.mixin(CK.CloudOSGetterSupport),CloudOS.displayApps=[{name:"mail",notificationIcon:window.devicePixelRatio>1?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/mail_icon_notification@2x.png":"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/mail_icon_notification.png",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/mail_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/mail_icon@2x.png"},{name:"contacts",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/contacts_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/contacts_icon@2x.png"},{name:"calendar",appIconType:"calendar",notificationIcon:window.devicePixelRatio>1?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/calendar_icon_notification@2x.png":"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/calendar_icon_notification.png",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/calendar_icon_background.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/calendar_icon_background@2x.png"
},{name:"notes",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/notes_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/notes_icon@2x.png"},{name:"notes2",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/notes_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/notes_icon@2x.png"},{name:"reminders",notificationIcon:window.devicePixelRatio>1?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/reminders_icon_notification@2x.png":"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/reminders_icon_notification.png",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/reminders_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/reminders_icon@2x.png"},{name:"find",notificationIcon:window.devicePixelRatio>1?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/find_icon_notification@2x.png":"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/find_icon_notification.png",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/find_icon.png",appIconUrl2x
:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/find_icon@2x.png"},{name:"fmf",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/fmf_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/fmf_icon@2x.png"},{name:"iclouddrive",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/icloud_drive_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/icloud_drive_icon@2x.png"},{name:"photos",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/photos_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/photos_icon@2x.png"},{name:"pages",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/pages_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/pages_icon@2x.png"},{name:"numbers",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/numbers_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/numbers_icon@2x.png"},{name:"keynote",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/keynote_icon.png"
,appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/keynote_icon@2x.png"},{name:"newspublisher"},{name:"settings",notificationIcon:window.devicePixelRatio>1?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/settings_icon_notification@2x.png":"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/settings_icon_notification.png",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/settings_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/settings_icon@2x.png"}],function(){var e=CloudOS.displayApps,t={},n;for(var r=0;n=e[r];r++)t[n.name]=n;CloudOS.displayInfoFor=function(e){return t[e]}}(),CloudOS.AppManager=SC.Object.extend({isAppManager:YES,appInfo:null,get:function(e){var t=arguments.callee.base.apply(this,arguments);if(t===undefined){var n=this.get("appInfo");if(n){var r=n.get(e);r!==undefined&&(t=r)}}return t},set:function(e,t){var n;return this.getPath("appInfo."+e)!==undefined?n=this.get("appInfo").set(e,t):n=arguments.callee.base.apply(this,arguments),n},warningArrowAsset:window.devicePixelRatio>1?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAAB0CAMAAAB648r2AAAAMFBMVEUAAADwsQXlqgbgiwDqnwLnlQHljwDkjwD60QkaGhr3yQjzvgeDcBFcUBU5NBeukw7thH3zAAAACHRSTlMA/u0YxZtrPo5RIdgAAAMJSURBVHjaxdvtauMwEIXhSLFiZfTh+7/bspByNs2yL64Yz/ldqBjrkY9celvJo+SUcnncYvLIzaxWs5YjlnDfmtVXrG23y7O1WpXrV1BafUsrt0uzp/ojab/2AVj9EdsuBdDqR9rjQgHZ6kcs3wN2YMw+vKf6z6R7yA5UrEQRFMWgAYhiFEFRDCIoilEENYIQgoq5UyxW/5tWogiKYhBBUYwhqDTPEYggUAwZgCgGEfQvBiJIFKMIqhgEERTFqB2o0yiAIIzAawDWzJeiCNrHnPuYzz+Z4zCg6FED+vOvzPxB0Zvg8XzLNF+KIqgBvOdw7ej75w4csABRdCBIE2CK5wniArIPRTVx2IRPO1cM1pt4/qHA5TQSwc/Y8y0D3ooOb8H5toDudF0WQXB4wFvRoQZ0QAAUzxIkBubS0UWQGEzo6C6XYUAgil5NfAICFQOnIjoAgYqBUxPvgEAUlwfADBoUVJcmnhkBUzxPUDFAoBGsEmQG3eO6LILMoNN12ecy3FEhU2SCwAAVcjFggrwA+lErLpfhxAp1GrlchkEhUMQBcCYjYIp8BrHDvvDxDs4gcAgKYQRMEBmAQqBIBDkHKASK1MQ5GRQCRRoAx0AhUESCnAkLgH1IBDkDFAJFIsjpoBBGQDWA00khFwOuAewQJgbFAM8gdlgVpniGIKfBMQAUkSAHFEJHxxrAOeYcQrA8Ah4AhykCQc8wxeI0AKYogv5JdyDoHdugBrgn7YsElXb00Y+2MIIlgta/W7Gdpsg1gGO6HQ9bocgE+RvROE1x/Qxq8KkWKK4T7PC1HDs6n0HcB5V5cgGiCAOARqwsUBRBpwUwRRH0fwSiCATdNqFGAAQpGf5kQzFRxCbOz2D8qhgAQYpN7YD2u7ciEKS07xmMtlAMlopo7mOOnisEOjoQdIxl7ybOFDWAoBGEDUC7oFgNjJWoJyCJqYYmBy/A0i1HT2AL3gPRDB/YBfxvyiXyKC7QB6/5WrIni/r9+6sRxcyg5V3/O5jaxWuwlsr9puxly+nC5O3x+vVfbQEXSDg8FDIAAAAASUVORK5CYII="
:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAA6CAMAAAA3Dq9LAAAAMFBMVEUAAADvsAXrogPmlQHljwDhiwDjjwD60QkaGhr4ygj0vQfOrQxQRhaehRB3ZhMuKxicpDLjAAAAB3RSTlMA/NObZRg355pkiwAAAXBJREFUeNqlldGywyAIBYumGjSJ//+37Xg7dx86loHsO/TIEvr4yZZE0vYIk0W1asvR+q3VSQtmeIrWicoz9gCtH2KPKFL/kRJokJQGmuITZI6hAESIBiCCXyEEVGYCoDKoEJWhCYJmR4BGHbTiD9DP6zo7Kr0Kz31yoNKp8Nj/6Kj0KKRBQ6Vvh65PA982cQaYASp9Cvs+uRYq7R0SGqDS9RWO2eB0fJVPAqChOw5DJgAa6EkEWyEahnEYAIU0wCIqHWegIwGkWApBkQCaTIUwkPA1RyMAHqUCEcwAeKxABFMhGkYFVJo7RAMsQsuGQjxiEVC5miA0LAJzXE4QjtGrceMJ4IAIBHCBShT6QCUKAc7juBjCUmURAnwflNHNCHlR3znrQIe8/jNmDzlJP1QmjTXQhELfE1BpKbw464sIKFxpHAf1gEoCuEAlAUK0jAIfTEHqLeR+gqw3Z1DuWSjvRRTVYHmTuYolJ4mR37//AstYPbuhXX/mAAAAAElFTkSuQmCC",lockBadgeAsset:window.devicePixelRatio>1?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABPFJREFUeNrsXE1PJEUYrplRcDdCPIgXXUjcED7cTVb3sB40BsJJk0k86ATUZOOFCGZnxwt/YjfhB3AyC4QD8eIaQ4iiF724qBk0RldCnFV3mUiYgXE+gNr3aapJz0cz3TNV3T1DPcmTMMzUW11Pv1X99lsfIeYtIsTLxKvEl4gXiReIzxKfJp4Xv8sR94lp4l/EP4gbxHvEn4mHrI3wHHGaeJeYIfImmRG2YPOFVhWlg/iuaEhRgih2hCd9TXxP1Bl4oIvERbfgHjNFvGnppoHCk8RPiA99EKaSuIaPiU8ERZzXxADKA0YM6Nf89prbxKMAimMdo26La/UUvcTvAixMJXGtfV52qXQLiWPyP+IbqsWJiiCOtyj/J76tSpzrxIMWFsck2vChbHHG20Qcq0hRWeKMEgttJI7JfdG2pvCiGNx4m3JHvDDbInTKd53E74lXlMUKvb1sYmKCjYyMsOHhYdbT08NKpRJLpVJsa2uLra2tsaWlJba5uanywfMT8VVi3m3BWVV3joThCwsL/ODggNfD4eGh8VuUUehJs43EOkoi5Gg0yjOZDHeLbDbLx8fHVQmEtr7u5hXiFxUXEo/HDY9oFEdHRzyRSKgS6VenryQ3VFxALBYzGliJjY0No9GDg4O8s7PT4NDQkPE/fFdLJNhSJFKinjjniP+qGHPQRawoFAp8enqah8Nh23L4bnJykudyuarupmhMeig0sEVcxZ2Zn5+vEmdsbMxx+dHRUaOMFYuLi6q86OZpaVLpmcC+vr6qcWdqasq1HXhb5dMNthVlJmumb2Mq7sjMzExZw5LJJI9EIq7toAzKWgHbirwoZooStgj0voooDEGgFXNzc4zuvms7KIOyp9mWiA9qTc2UVNwNiorL7jqeVo3aQlkrYFuRB5WEJif4SFWUms/nyxrV0dHRsC2UrRzsFUbXU9Yu9pZX6chisehL2QbwpilQxE2Y7RbpdFpZC7a3t1UKhPRsJCTe1tdV1UI9oTx9EAoFyl4dXIUHvcI07PAyBLqkdbDFpbDIGmrUxkUIdEG21f7+fra8vMx2d3drjiHNsBKoA3WhTgUwltf8JjN+GBgY4Ds7O9xroE7ULTkW+h0C/S3TKN1N7hdQt2SB/sEzMsuOl79JAVy+u7vblwFjb2+PdXV1yTS5HxJTyedUxT1eQ3JcVMAgXWQadshDoF2tgy2yECitdbB/3QuLNKtGbaQg0J9aB1vch0BJrYMtkhDontbBFusIGpAwwzIQKRFWG8VBe8Rn4EGYYvhWO0sVvoE2Zk76rtajCl8YHik+YIrjAZOwfL9NuhjWMD5PfGR60CPil9ppTrAiNCmbWb2jdTnBp+YfVoE+Y8cT900hk8n41iqkOyTggdCiSiC81d9q1vrq6qp//WJlRYaZW+yUDEfTC6gwf+5XyrWZeX/mcAEV0PQSPOSGkf5sZLGmW6AO1CUpH51w4mLKFnEGnI4XcQLKlgEHlK6WAZuYPUMCzTYymmMrwvoZEOdH4lONPvLO/GYWJ2jX7VA5JmE7lAm9oc4BrjO9JbMu9KZehzGS3hZeB/pgAYevJPpoCoddTh9u4sCb9PE4DnBepEv8OGAJdcZZQA9YqgT2W71D/JypP6LrK9ZCR3TVQksf8hbyWCxMc2PheuUxgT2s+phAZOC3Rde5Lx4EP7DjxRaeHRP4WIABANtHKBijf9nZAAAAAElFTkSuQmCC"
:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAjRJREFUeNrUWM1OwkAQphxAlBAS44n4e1JegXjRgMKRxPoU8DSIkVfxJEJAL3DhJxwUlQBnigghYZ1ptqZBCrOlNfVLPiid2dmv22F/RnKJ4wAYA0aAYf57i9s+gW1gA1gA3gNfXTbADbwCPgBnQEbkjLeReQxLcAasCYgwYo3HMo0N4I0FQuaZ5bGFsA0s2yBGY5n3QcIOT0pmMxu8r6Xw2Twyi0Zqc5mgO2owj8fD0uk0K5VKTFEUlXiN99AmICpnJCZKDRIKhVilUmFGQBv6CIiKLppn6tSR0cS0Wi2WTCZZIBBQidd4D1GtVpnX66UKqs/PUzL1aVKplNphs9lkwWDwlx3voQ2BvgKjJOsF5akNMU8QOBpGPmhDoK+AoLx+bSIvB5PJRO0MX5GRj9/vV33G4zETXGb28b1dACXRmXMwGBjahsOh+j2dTkVCooZLN1+1yYCkJvvCSIk+ZwQFnbicgzAK2qN4xuNxV7fb/fkNKbKUGrANtiViFz9GlKSDwMwssC0xsUcSF+RbJV3/1GYgSaT/zRe+MsVBOaSgoHcHCfpw832JU1BHQUUHCSpKfOl4WTVb/0FSYwdHbn6OKjhgdFBDW9uDZFZ593o90z31+32KW0Zog5ZIJBiIEp4UO52O2lZ0gya0hbWBsbU3+RYy96+OQY47KOqP0k82inkWOUrriw1ZG8Tcmik22FWOObeyYCWvUbC6phasJBPiDvmcdQo8XlDSe+MJ+2impPctwADNbkrjiKLsLQAAAABJRU5ErkJggg==",shadowAsset:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAYAAAA6oTAqAAABzElEQVR42u3a3Y6DIBCG4f6IUpEF3b3/a10OTD7DaKYMtc5uNXnPNuk+AdIKXCqe627t/FwVtBvittK9ohuNR8kR/D/eSOOAchSPaFJmUfvCzKKGQ0kg9wzRvjGgUqUgOiKAtKnugFqA6AhVQ/SDtiHmUAgyWyBmVAjEKoiC6OjQUckWu1VUCxAZHYIh60QVhq4fHpONykNPGB0Gs7pWHtraXjv8FOsVYuzWVOOmWK8uYAyLyaaYUwZxmGoCjMJ4DF38+jFYNx+IGbQlwVjlGCvFeC2dmAzzpaUT858xQUsnJsNELUkxnXJMV4MZFVSNccowjsGQ9xm1GPnLGV6bQ2pSUMBrMzClewBeCcZL9gCwO4OpFlLfBxYwxZiNQIKh68an4kGQOH++e2bfjJ9q+I0WU9ObEFMq4jcZN8Xw8FMNoJAaF6iflwXEmArz53lmihWfAvQroAhUqnYUgIgrkJ47BSg6n8lGyGcoVPjdgQhiwIiUnc9c2CNAgPolCrDqfIboAWGOAgvPNM0KCjA0CHJzAFCE4c40RSCgZhhwtVkAZoQUwt8DAIrAaJYPf78OAAIBgmpvaCCzQw1ibmh80N0Z/beazvtmf/Em4C+GnVIq6T5d5wAAAABJRU5ErkJggg=="
,spinnerAsset:CloudOS.SPINNER_IMAGE_SRC,spinnerAssetFrameCount:3,minWidth:1,minHeight:1,_currentAppLocale:null,_showingSlowConnectionMsg:NO,recordedExceptions:null,recordException:function(e){this.get("recordedExceptions")||this.set("recordedExceptions",[]),this.get("recordedExceptions").push((new Date).toUTCString()+": "+e)},requiresMailAndIsMissing:function(){var e=this.getPath("appInfo.requiredServices");return!e||e.indexOf("mail")===-1?NO:CK.servicesController.getServiceInfoFor("mail")?NO:YES},badgeCount:0,buildNumber:null,masteringNumber:null,path:function(){var e=this.getPath("appInfo.path"),t=this.getAppDomain(),n=this.preferredLocale(),r;return this._currentAppLocale=n,e.indexOf("/")===0||e.indexOf("https://")===0?r=e+"current/"+n+"/":(r=t+"/applications/"+e+"current/"+n+"/index.html",CK.get("isWWW")||(r+="?cache="+CW.UUID())),r=URI(r).addQuery("rootDomain",URI(window.location.href).subdomain()).toString(),r}.property("appInfo.path"),getAppDomain:function(){var e=CK.get("isBeta"),t=CK.get("isFuture"),n=CK.get("isCarry"),r;return e&&this.get("isBeta")?r="https://beta.icloud.com":t&&this.get("isFuture")?r="https://future.icloud.com":n&&this.getPath("isCarry")!==NO?r="https://carry.icloud.com":(r="https://%{defaultDomain}",r=r.fmt({defaultDomain:CloudOS.getDefaultAssetHostname()})),r},preferredLocale:function(){var e=this.get("name"),t=this.get("appInfo"),n=t.get("supportedLocales")||window.supportedLocales,r=CloudOS.authController.get("accountPreferences"),i=r?r.get("locale"):null,s=r?r.get("secondaryLocale"):null,o;n.contains(i)?o=i:n.contains(s)?o=s:n.contains(String
.preferredLanguage)&&(o=String.preferredLanguage);var u=CW.getUrlParameters(),a=u.locale;return a&&n.contains(a)&&(o=a),o||(r?SC.debug("Neither Primary Locale “%@” or Secondary Locale “%@” is supported by app “%@”. Hence using “en-us” as the locale for this app.",i,s,e):SC.debug("Since there is no account prefs yet, we will set the locale of “%@” as en-us",e),o="en-us"),o},locationHash:function(){var e="",t=this.get("route");return CloudOS.get("isCloudOSMini")||(e=this.get("name")),e+=CloudOS.workspaceController.retainedHash(),t&&(e&&(e+="/"),e+="%@".fmt(t)),e}.property("route"),route:null,routeDidChange:function(){var e=this.get("route");this.passMessage("_cloudOSStateChange",{route:e}),this.passMessage("routeDidChange",e)}.observes("route"),contentWindow:function(){var e=this.get("view");return e?e.get("contentWindow"):null}.property("view"),isFailed:NO,isActive:NO,isWaiting:NO,isLoaded:NO,isIntermediateFailedToLoad:NO,startupDataHasBeenLoaded:NO,loadInBackground:NO,isReadyToTerminate:YES,title:null,view:null,loadReason:null,shareInfo:null,preDisplayAction:null,preDisplayActionArgs:null,postDisplayAction:null,postLoadAction:null,getReady:function(){if(this._view)return;var e=this.get("name"),t=YES,n=this.get("appInfo");n.preloadCoreTypes&&SC.Module.loadModule("cloudkit/core_types"),SC.debug("Beginning to load %@",e),COS.startupController.requestStartup(e);var r=CloudOS.AppFrameView.create({minWidth:this.get("minWidth"),minHeight:this.get("minHeight"),app:this});this.set("view",this._view=r),r.get("usingPrevCreatedIframe")||CloudOS.getPath("mainPage.mainPane.appsView").addAppFrame
(r),this.set("isReadyToTerminate",YES),this.set("isWaiting",YES),CloudOS.get("isCloudOSMini")&&(t=NO),t&&(this._checkLoadFailureTimer=this.invokeLater("_checkLoadFailure",CloudOS.APP_LOAD_TIMEOUT*1e3),this._checkIntermediateLoadFailureTimer=this.invokeLater("_checkIntermediateLoadFailure",CloudOS.APP_LOAD_INTERMEDIATE_TIMEOUT*1e3)),this._iframeWasCreated=YES;var i=n.containerIdentifier;i&&COS.pushController.registerForCloudKitSubscriptions(i,e)},getReadyInBackground:function(){CloudOS.appController.get("loadingApp")!==this?(this.set("loadInBackground",YES),this.getReady()):SC.info("%@ is already being loaded, hence no need to load it in the background.",this.get("name"))},isLoadedObserver:function(){var e=this.get("isLoaded"),t=CloudOS.appController.get("loadedApps");t||(t=[]),e?t.push(this):t.indexOf(this)!==-1&&t.removeObject(this),CloudOS.appController.set("loadedApps",t)}.observes("isLoaded"),shouldRelocalize:function(e,t){var n=this.preferredLocale(),r=this._currentAppLocale,i=n!==r||t,s=this.get("name");return this.get("view")&&SC.debug("Language check for app '%@': "+r+" -> "+this.preferredLocale()+". We "+(i?"WILL":"WILL NOT")+" relocalize '%@.'",s,s),i},relocalize:function(e,t){this.get("appInfo").calculateAndSetLocalizedNames(String.preferredLanguage,CloudOS.authController.getPath("user.countryCode"));if(!this.shouldRelocalize(e,t))return;this.reloadInPlaceIfAppropriateWhenCanTerminate()},reloadInPlaceIfAppropriate:function(){var e=this.get("isActive"),t=this.get("view"),n=e&&t!==null,r=CloudOS.appController.get("pendingApp"),i=this._view,s=this.get("name");if(n){var o=
CloudOS.authController;if(r&&!this.get("canLaunchWithOneFactor")&&COS.authController.getPath("user.hsaEnabled")&&!o.get("delayedTearDownUsed")){o.set("delayedTearDownApp",this),o.set("delayedTearDownUsed",!0);return}i.get("usingPrevCreatedIframe")&&(i.get("layer").oldIframe=YES),this.set("view",this._view=null),this.teardown(YES),this._isReloadingInPlaceFromOldView=t,this.set("loadReason",CK.LOAD_REASON_RELOAD),CloudOS.blockUserInput(10),this.invokeLater(function(){this.set("loadInBackground",NO),this.getReady()},1e3)}else this.teardown()},teardown:function(e){if(!this._iframeWasCreated)return;var t=this.get("appInfo"),n=this.get("name");SC.debug("Ensuring that %@ is torn down.",n),t&&CloudOS.appController.applicationWillClose(t);var r=this.get("view");r&&r.destroy(),this.set("view",this._view=null),this._checkLoadFailureTimer&&this._checkLoadFailureTimer.invalidate(),this.invalidateIntermediateLoadFailureTimer(),this.get("isFailed")&&this.set("hasFailedOnce",YES),this.set("isFailed",NO),this.set("isWaiting",NO),e||this.set("isActive",NO),this.set("loadReason",null),this.set("isLoaded",NO),this._messageState=this._DID_SUSPEND,this._iframeWasCreated=NO,this._currentAppLocale=null,t&&(t.set("requestedStartupUrl",null),t.set("requestedStartupInfo",null),t.set("startupResponse",null),t.set("isReady",NO)),this.set("isReady",NO),COS.statsController.endAllBenchmarkStats(n)},teardownWhenCanTerminate:function(e){this._invokeWhenCanTerminate("teardown",e)},reloadInPlaceIfAppropriateWhenCanTerminate:function(e){this._invokeWhenCanTerminate("reloadInPlaceIfAppropriate",e)},_invokeWhenCanTerminate
:function(e,t){if(this.get("isReadyToTerminate"))return this[e]();CloudOS.blockUserInput(20);var n=this,r=NO,i=function(){if(r)return;r=YES,CloudOS.invokeLater("unblockUserInput",20),n[e]()};(this._canTerminateTasks||(this._canTerminateTasks=[])).push(i),this.invokeLater(i,t||1e4)},_flushCanTerminateQueue:function(){if(!this._canTerminateTasks||!this.get("isReadyToTerminate"))return;for(var e=0,t;t=this._canTerminateTasks[e];e++)t();this._canTerminateTasks.length=0}.observes("isReadyToTerminate"),_checkLoadFailure:function(){this.get("isReady")||(this.isIntermediateFailedToLoad=NO,this._didFailToBecomeReady())},_checkIntermediateLoadFailure:function(){var e=CloudOS.appController.get("pendingApp"),t=e===this;!this.get("isReady")&&t&&this._showIntermediateLoadFailureBanner()},_showIntermediateLoadFailureBanner:function(){var e=this,t=COS.statsController,n={pendingApp:this.get("name")};CloudOS.bannerManager.setAppBanner({title:"Banner.SlowConnection.Title".loc(),description:"Banner.SlowConnection.Description".loc({appName:this.get("displayName")}),optionalLink:{text:"Banner.SlowConnection.OptionalLink.Text".loc(),action:function(){t.recordLocationStat("cloudos","CancelSlowConnectionBanner",n),e.invalidateIntermediateLoadFailureTimer(YES),e._didFailToBecomeReady()}},priority:CloudOS.HIGH_PRIORITY_BANNER}),this._showingSlowConnectionMsg=YES,this.set("isIntermediateFailedToLoad",YES),t.recordLocationStat("cloudos","ShowSlowConnectionBanner",n),t.beginStat("cloudos","ShowSlowConnectionBannerDuration",n)},_removeIntermediateLoadFailureBanner:function(e){this._showingSlowConnectionMsg&&
(CloudOS.bannerManager.setAppBanner(null),this._showingSlowConnectionMsg=NO,COS.statsController.endStat("cloudos","ShowSlowConnectionBannerDuration",{wasCancelled:!!e}))},invalidateIntermediateLoadFailureTimer:function(e){this._checkIntermediateLoadFailureTimer&&(this._checkIntermediateLoadFailureTimer.invalidate(),this._removeIntermediateLoadFailureBanner(e))},_didFailToBecomeReady:function(){this.set("isWaiting",NO),this.get("isActive")&&this.set("isActive",NO),this.invalidateIntermediateLoadFailureTimer(),this._isReloadingInPlaceFromOldView&&CloudOS.unblockUserInput(),this._isReloadingInPlaceFromOldView=null,CloudOS.appController.get("pendingApp")===this&&CloudOS.statechart.sendAction("applicationDidFailToBecomeReady"),CloudOS.getPath("mainPage.mainPane.appsView").removeAppFrame(this._view)},didBecomeReady:function(){this.invalidateIntermediateLoadFailureTimer();var e=SC.Benchmark,t=this.get("name");e.end("Waiting for application to become visible",t);if(!this.get("isLoaded")){SC.debug("Received didBecomeReady for "+this.get("name")+", which is no longer loaded. Ignoring call.");return}if(this.get("isFailed"))return;COS.startupController.notifyStartup(this.get("appInfo"),YES),window[t.substr(0,2)]=this.get("contentWindow");var n=function(){var e=CloudOS.appController,n=this._isReloadingInPlaceFromOldView;this._isReloadingInPlaceFromOldView=null,n&&CloudOS.unblockUserInput();if(!this.get("isLoaded")){this.get("isActive")&&!n&&this.set("isActive",NO),SC.debug("Finishing didBecomeReady for "+this.get("name")+", which was unloaded since didBecomeReady was called. Aborting.");
return}this.set("isReady",YES),this.set("isWaiting",NO),e.get("pendingApp")===this&&!this.get("loadInBackground")&&CloudOS.statechart.sendAction("applicationDidBecomeReady");var r=this.get("postLoadAction");if(r){var i=[],s=this.get("shareInfo");s&&i.push(s),r.apply(this,i)}this.set("postLoadAction",null),e.set("loadingApp",null),n&&(n._shouldBeDestroyedAfterNextSwitch=YES,this.show(YES));if(CloudOS.get("isCloudOSMini")&&!CloudOS._applicationWithOpener)try{var o=CloudOS.getOpenerWithCloudOS();o&&o.CloudOS.windowApplicationIsKnown(window)&&(SC.info("main(): Found parent CloudOS application"),o.CloudOS.windowApplicationHasInitialized(window,t,YES),CloudOS._applicationWithOpener=this)}catch(u){SC.warn("didBecomeReady: There was a problem finding or communicating with the opener"),SC.warn(u)}};CloudOS.APP_POST_READY_DELAY?this.invokeLater(n,CloudOS.APP_POST_READY_DELAY):n.call(this)},startupDataDidLoad:function(){this.set("startupDataHasBeenLoaded",YES),this.get("isWaiting")||SC.Benchmark.end("Waiting for startup data",this.get("name"))},show:function(e,t){if(!this.get("isReady"))return;this.notifyPropertyChange("title");var n=CloudOS.getPath("mainPage.mainPane.appsView");n.showApp(this,e,t)},hide:function(e){if(!this.get("isReady"))return;var t=CloudOS.getPath("mainPage.mainPane.appsView");t.hideApp(this,e)},init:function(){this.get("displayName")||this.get("appInfo").set("displayName",this.getPath("appInfo.capitalizedName")),arguments.callee.base.apply(this,arguments),CW.notificationCenter.subscribeToNotification("relocalize",this,"relocalize")},benchmarks:function(){var e=SC.
Benchmark._statFor(this.get("name"));return e&&e._times&&e._times[0]?e._times[0]._subStats:null},focus:function(){var e=this.get("view");if(!e)return;e.focus()},_validatePostMessageData:function(e){if(!e||typeof e!="object")return!0;if(e.isObservable&&SC.kindOf(e,SC.Object))return SC.error("_validatePostMessageData: Attempt to serialize SC.Object in:"+e.toString()),!1;for(var t in e)if(e.hasOwnProperty(t)&&!this._validatePostMessageData(e[t]))return!1;return!0},passMessage:function(e){var t=this.get("contentWindow");if(!t)return;var n=SC.$A(arguments);n.shift();var r=this.getPath("view.layer.src"),i=URI(r),s="https://"+i.hostname();this._callCloudOSMethod(t,s,e,n)},_callCloudOSMethod:function(e,t,n,r){var i={isCloudOSMessage:!0,methodName:n,args:r};this._validatePostMessageData(i)||SC.error("Attempt to serialize invalid data in: "+JSON.stringify(i));var s=this.get("name"),o=s+n;this._lastMessageSignature!==o&&(SC.info('_callCloudOSMethod: "%@" to %@',n,s),this._lastMessageSignature=o);var i=JSON.stringify(i,function(e,t){return this.hasOwnProperty(e)?t:undefined});e.postMessage(i,t)},sleep:function(){this.passMessage("_sleep")},wake:function(){this.passMessage("_wake")},ensureWillSuspend:function(){this.ensureDidBecomeActive();if(this._messageState!==this._DID_BECOME_ACTIVE)return;this._messageState=this._WILL_SUSPEND,this.passMessage("applicationWillSuspend"),CloudOS.appController.applicationWillClose(this)},ensureDidSuspend:function(){if(this._messageState!==this._WILL_SUSPEND)return;this._messageState=this._DID_SUSPEND,this.passMessage("applicationDidSuspend")},ensureWillBecomeActive
:function(){this.ensureDidSuspend();if(this._messageState!==this._DID_SUSPEND)return;this._messageState=this._WILL_BECOME_ACTIVE,this.get("isReady")&&this.passMessage("applicationShouldRefresh",NO),this.passMessage("applicationWillBecomeActive"),this.sleep()},ensureDidBecomeActive:function(){if(this._messageState!==this._WILL_BECOME_ACTIVE)return;this._messageState=this._DID_BECOME_ACTIVE,this.wake(),this.passMessage("applicationDidBecomeActive",this.benchmarks());var e=this.get("postDisplayAction");this.set("postDisplayAction",undefined),e&&e.apply(this),CloudOS.appController.applicationDidOpen(this)},_DID_SUSPEND:1,_WILL_SUSPEND:2,_DID_BECOME_ACTIVE:3,_WILL_BECOME_ACTIVE:4,_messageState:1}),CloudOS.appController=SC.Object.create({apps:null,appList:null,loadedApps:null,pendingInfoJSONRequests:{},_newReplacementApps:[],_replacedAppsMapping:{},appIndices:function(){var e=CloudOS.authController.get("appsOrder")||[];if(this._lastAppsOrder===(this._lastAppsOrder=e.join(" ")))return this._cachedAppIndices;for(var t=0,n={},r=e.length;t<r;t++)n[e[t]]=t;return this._cachedAppIndices=n,n}.property(),isAllAppInfoLoaded:function(){var e=this.get("pendingInfoJSONRequests");return SC.$.isEmptyObject(e)}.property("pendingInfoJSONRequests"),appsNotReadyToTerminate:function(){var e=this.get("loadedApps"),t,n;return e&&(n=e.filter(function(e){return e.get("isReadyToTerminate")===NO}),n.length>0&&(t=n)),t}.property("loadedApps"),areAllAppReplacementsCompleted:function(){return this.get("_newReplacementApps").length===0}.property("_newReplacementApps"),showApps:function(){var e=CW.getUrlParameters
(),t=e.showApps;return t?t.split(","):null}.property().cacheable(),removeInvalidIframes:function(){var e=SC.$("iframe");e.forEach(function(e){if(e.id=="auth-frame")return;COS.apps[e.name]||(e.parentNode?(SC.info("Removing iframe for invalid app %@",e.name),e.parentNode.removeChild(e)):SC.warn("Unable to remove invalid iframe for app %@",e.name))})},initializeAppManagers:function(){var e={},t=CloudOS.appController.getDefaultAppName(),n=CloudOS.getAppRouteFromHash(),r=[],i=this.get("showApps"),s,o,u,a,f,l,c,h;for(f=0,l=CloudOS.displayApps.length;f<l;f++){a=CloudOS.displayApps[f],s=a.name,u=COS.appsController.getAppInfoFor(s),u||CW.fatalError("There is no appInfo for app “%@”".fmt(s));if(u.isBeta&&!CK.get("isBeta")&&!u.isWWW)continue;i&&i.indexOf(s)!==-1&&(a.isHidden=NO),c=s===t?n:null;if(u.get("isDynamicallyLoaded")){this.requestInfoJSONForApp(s,CK.get("isCarry"),c);continue}r.push(e[s]=CloudOS.AppManager.create(a,{appInfo:u,index:r.length,route:c}))}this.set("appList",r),this.set("apps",e)},detectAndLoadAdditionalApps:function(e){var t=this.get("apps"),n,r=this.get("showApps"),i=COS.appsController;if(r)for(var s=0;s<r.length;s++){var o=r[s];if(!COS.authController.get("isRevalidatingUser")){var u=i.getAppInfoFor(o);if(u){var a=u.get("preferences"),f=u.get("preferencesVersion");i.storePrefsForDynamicApp(o,a,f),this.removeApp(o,YES)}}e[o]={isFuture:CK.get("isFuture"),isBeta:CK.get("isBeta")}}for(n in e){var l=t[n];if(l){if(l.get("isHidden")){var c=!e[n].isHidden;c&&SC.debug("Existing app “%@” is now made visible",n),l.set("isHidden",!c),this.notifyPropertyChange("appList")}continue}
var u=i.getAppInfoFor(n);if(u&&u.get("isBeta")&&!CK.get("isBeta")&&!u.get("isWWW"))continue;COS.apps[n]=SC.merge(e[n],COS.apps[n]),this.requestInfoJSONForApp(n)}this.removeInvalidIframes()},requestInfoJSONForApp:function(e,t,n){var r=this.get("pendingInfoJSONRequests");if(r[e]||CloudOS.appManagerFor(e))return;var i=COS.apps[e],s="https://"+window.location.hostname,o,u;if(CloudOS.get("isCloudOSMini")&&this.getDefaultAppName()!==e)return;CK.get("isBeta")||CK.get("isCarry")?t?(s="https://"+CloudOS.authController.get("defaultAssetHostname"),SC.debug("Application %@ is not marked to appear in beta or future, loading www",e)):o=YES:CK.get("isFuture")&&t&&(u=YES);var a=s+"".fmt(e);CW.notificationCenter.postNotification("requestedInfoForDynamicApp",e);var f=CW.Request.getUrl(a+"").set("isJSON",YES).set("attachIdentifyingHeaders",NO).header("Content-Type","text/plain").notify(this,"appInfoDidLoad",e,a,o,u,n);CloudOS.get("isCloudOSMini")&&f.set("timeout",null);var l=URI(f.getFullAddress()).host();l&&l!==window.location.hostname&&(f.set("withCredentials",NO),f.set("useCrossDomain",YES)),f.send(),r[e]=f},appInfoDidLoad:function(e,t,n,r,i,s){var o=e.get("status")===200?e.get("body"):null,u,a,f=COS.appsController,l=CloudOS.authController,c=l.get("hsaChallengeRequired"),h=l.get("pcsDeleted"),p=l.getPath("user.hsaEnabled");delete this.pendingInfoJSONRequests[t];if(o&&SC.typeOf(o)===SC.T_HASH){u=f.getAppInfoFor(t);if(u){SC.debug("Adding additional data for "+t);for(a in o)SC.none(u.get(a))&&u.set(a,o[a])}else o=SC.merge(o,COS.apps[t]),SC.debug("Setting up appInfo for "+
t),u=f.createAppInfo(t,o),f.setAppLockInfo(u,h,p,c);r&&u.set("isBeta",YES),i&&u.set("isFuture",YES)}if(!u||!o){e.get("status")!==404&&SC.warn("There was a problem loading the info.json for %@",t),r||i?(SC.info("Could not find info.json for %@ on %@. Attempting www.",t,r?"beta":"future"),this.requestInfoJSONForApp(t,YES,s)):(CW.notificationCenter.postNotification("receivedInfoForDynamicApp",t,YES),this.checkIfAllDynamicAppsAreLoaded());return}if(CloudOS.authController.get("isAtLeastPartiallyAuthenticated")&&!u.get("hasAccessToRequiredServices")){SC.info("User does not have access to the requiredServices for %@",t);return}var d=SC.merge(CloudOS.displayInfoFor(t),{name:t,isDynamicallyLoaded:YES,appInfo:u,route:s,isBeta:r?YES:NO}),v=CloudOS.AppManager.create(d);this.getPath("pendingApp.name")==="notes"&&t==="notes2"&&this.set("pendingApp",v),n+=v.preferredLocale()+"/",CK.get("isBeta")&&(n=n.replace("https://www.icloud.com/","https://beta.icloud.com/www/")),CK.get("isFuture")&&(n=n.replace("https://www.icloud.com/","https://future.icloud.com/www/")),CK.get("isCarry")&&(n=n.replace("https://www.icloud.com/","https://carry.icloud.com/www/")),v.set("appIconType","image"),v.set("appIconUrl",n+"icon.png"),v.set("appIconUrl2x",n+"icon@2x.png"),o.showsPushNotifications&&!v.get("notificationIcon")&&v.set("notificationIcon",n+(window.devicePixelRatio>1?"icon_notification@2x.png":"icon_notification.png"));var m="AppTitle."+t,g=m.loc();if(g===m){var y={};y["AppTitle."+t]=o.displayName,y["AppTitleBar."+t]=o.titleName||o.displayName,SC.stringsFor(SC.Locale.currentLocale.language,y)}else v.set
("displayName",g);var b=o.pushTopic;COS.pushController&&b&&(SC.info("Registering pushTopic %@ for dynamic app %@",b,t),COS.pushController.registerPushTopic(b)),this.addAppManager(v),CW.notificationCenter.postNotification("receivedInfoForDynamicApp",t),this.checkIfAllDynamicAppsAreLoaded()},checkIfAllDynamicAppsAreLoaded:function(){this.get("isAllAppInfoLoaded")&&(this.set("pendingInfoJSONRequests",{}),CW.notificationCenter.postNotification("receivedInfoForAllDynamicApps"))},addAppManager:function(e){var t=this.get("apps"),n=this.get("appList");n.pushObject(e),e.set("index",n.length),t[e.get("name")]=e,this.notifyPropertyChange("appList")},iCloudLiteObserver:function(){var e=CloudOS.authController;(e.get("iCloudLiteSignUp")||e.getPath("user.isLiteAccount"))&&this.notifyPropertyChange("appList")}.observes("CloudOS.authController.iCloudLiteSignUp","CloudOS.authController.user"),removeApp:function(e,t){if(CloudOS.get("isCloudOSMini"))return;COS.appsController.removeAppInfoFor(e);var n=CloudOS.appManagerFor(e);if(!n)return;delete this.get("apps")[e];var r=COS.apps[e].alternateAppName;t||delete COS.apps[e],this.get("appList").removeObject(n),this.notifyPropertyChange("apps"),this.notifyPropertyChange("appList")},removeOmittedApps:function(e){var t=this.get("apps"),n;for(n in t){var r=t[n];if(!r)continue;!e[n]&&r.get("canBeRemoved")&&this.removeApp(n)}for(n in COS.apps)!t[n]&&!this.pendingInfoJSONRequests[n]&&delete COS.apps[n]},replaceOrAddApp:function(e,t,n){var r=COS.authController,i=r.get("appsOrder"),s=i.indexOf(t),o=this.get("showApps");e[n]={},!o||o.indexOf(t)===-1?delete e[
t]:i.push(t),i[s]=n,this.invokeLast(function(){this.notifyPropertyChange("appIndices")}),this.appReplacementDidComplete(n)},reloadApplication:function(e){var t=CloudOS.appController,n=CloudOS.appManagerFor(e),r=this,i=CloudOS.authController.get("user"),s=t.get("currentApp");if(!n){SC.warn("reloadApplication(): Application “%@” does not exist",e);return}s&&s.get("name")===e?CloudOS.statechart.sendAction("appMustReload",function(){n.teardown(),r.invokeLater(function(){t.set("pendingApp",n),n.set("loadReason",CK.LOAD_REASON_RELOAD),CloudOS.statechart.sendAction("userDidChooseApp")},500)}):n.teardown()},exitApplication:function(e,t,n,r){var i=CloudOS.appController,s=CloudOS.appManagerFor(e),o=NO;if(!s){SC.warn("application %@ does not exist".fmt(e));return}if(!s.get("isLoaded")){SC.warn("application %@ is already unloaded.".fmt(e));return}s.set("isFailed",YES),t===CK.EXIT_FATAL_ERROR&&(o=YES);var u=i.get("currentApp"),a=i.get("pendingApp");u&&u.get("name")===e||a&&a.get("name")===e?CloudOS.statechart.sendAction("appMustExit",{statusCode:t,applicationLog:n,appToLoadAfterAuthentication:r}):(s.teardown(),o&&this.showErrorReporter(s,n))},exitApplicationSilently:function(e){CloudOS.statechart.sendAction("appMustExitSilently");var t=CloudOS.appManagerFor(e);t&&t.teardown(),this.get("loadingApp")===t&&this.set("loadingApp",null)},switchToApplicationWithNotification:function(e,t,n){var r=CloudOS.appManagerFor(e);this.get("currentApp")===r&&r.get("isReady")?(SC.debug("Handing notification off to active app %@ immediately",e),r.passMessage("didReceiveNotification",t),n&&n.dismiss()):(r.set
("loadInBackground",NO),CloudOS.appController.set("pendingApp",r),n&&n.set("automaticallyDismiss",NO),r.set("postDisplayAction",function(){n&&n.dismiss(),r.passMessage("didLaunchWithNotification",t)}),CloudOS.statechart.sendAction("appCalledSwitchToApplication"))},reset:function(){var e=this.get("apps"),t,n;for(n in e)t=e[n],t.teardown()},currentApp:null,pendingApp:null,activateCurrentApp:function(e){var t=this.get("currentApp");if(!t){SC.debug("No app is ready to be activated yet, waiting for it to call back when ready");return}t.set("isActive",YES),t.show(e)},deactivateCurrentApp:function(){var e=this.get("currentApp");if(!e){SC.debug("No app is ready to be deactivated yet.");return}CK.currentApplication=null,e.set("isActive",NO),this.set("currentApp",null)},applicationDidOpen:function(e){COS.statsController.beginStat("cloudos","AppVisibleTime",{appName:e.get("name")})},applicationWillClose:function(e){var t=e?e.get("name"):this.getPath("currentApp.name");if(!t)return;e&&e.get("isReady")&&COS.statsController.endStat("cloudos","AppVisibleTime",null,{durationKeyName:"visibilityDuration"})},userDidRevalidate:function(){var e=this.get("apps"),t,n;for(t in e)n=e[t],n.passMessage("_cloudOSStateChange",{authBag:COS.authController._auth_bag}),n.passMessage("userDidRevalidate");SC.Request.manager.resumeAllServices()},getDefaultApp:function(){var e=this.getDefaultAppName();if(!e)return null;var t=CloudOS.appManagerFor(e);if(t&&!t.get("isDisabled"))return t},getDefaultAppName:function(){return CloudOS.getAppFromURL()},showErrorReporter:function(e,t,n,r){var i=e.get("name");n=n===NO?NO
:YES,r||(r="server");var s=e.get("recordedExceptions");s&&r==="loadFailure"&&(r="loadFailureLikelyException"),CK.errorCatcher.report({isFatal:n,applicationName:i,type:r,statSessionId:COS.statSessionId,title:"Error.AppLoading.Title".loc("AppTitle.%@".fmt(i).loc()),message:"Error.AppLoading.Description".loc(),applicationLog:t,recordedExceptions:s?s.join("\n"):null})},showNotes2AppIfNeeded:function(e){var t=CloudOS.authController.get("appsOrder").indexOf("notes2")!==-1;if(t){this.appReplacementDidComplete("notes2");return}var n=CK.servicesController.getServiceInfoFor("ckdatabasews");if(!n){SC.info("CloudKit web service does not exist for this account"),this.removeNotes2App();return}SC.info("Account has CloudKit web service, checking the state");var r=COS.Request.getUrl(n.get("url")+"/database/1/com.apple.notes/production/private/users/current");r.set("reportRequest",YES),r.notify(200,this,function(t){var r=t.get("body");if(r&&r.userRecordName){var i=COS.Request.postUrl(n.get("url")+"/database/1/com.apple.notes/production/private/records/lookup",{records:[{recordName:r.userRecordName}]});i.notify(200,this,function(t){var n=t.get("body"),r=NO,i;return n&&n.records&&n.records[0]&&n.records[0].fields&&n.records[0].fields.DidChooseToMigrate&&n.records[0].fields.DidChooseToMigrate.value===1?(this.replaceOrAddApp(e,"notes","notes2"),SC.info("Account is notes migrated in CK, but not in iCloud Account. Setting account flag…"),i=COS.Request.postUrl("https://setup.icloud.com/setup/ws/1/updateAccount",null),i.set("reportRequest",YES),i.notify(200,this,function(e){return SC.info("Successfully marked account notesMigrated"
),COS.statsController.recordStat("cloudos","NotesMigratedStateSuccess"),YES}),i.notify(0,this,function(e){return SC.info("Error marking account notesMigrated"),COS.statsController.recordStat("cloudos","NotesMigratedStateFailure"),YES}),i.send({notesMigrated:!0})):(SC.debug("Account is not notes migrated in CK."),this.removeNotes2App()),YES}),i.notify(0,this,function(e){return SC.debug("There was a problem fetching the user record."),this.removeNotes2App(),YES}),i.send()}return YES}),r.notify(400,this,function(e){return SC.debug("Account does not have this CloudKit container."),this.removeNotes2App(),YES}),r.notify(0,this,function(e){return SC.debug("There was a problem fetching the user id."),this.removeNotes2App(),YES}),r.send()},removeNotes2App:function(){this.removeApp("notes2"),this.removeInvalidIframes(),this.appReplacementDidComplete("notes2")},setNewReplacementApps:function(e){this._newReplacementApps=e},appReplacementDidComplete:function(e){var t=this._newReplacementApps;t&&t.length>0&&t.contains(e)&&(t.removeObject(e),t.length===0&&(CW.notificationCenter.postNotification("appReplacementsCompleted"),this._newReplacementApps=[]))},addAppsReplaced:function(e,t){this._replacedAppsMapping[e]=t},replaceApps:function(e){var t=this._replacedAppsMapping,n;for(n in t)e[n]&&this.replaceOrAddApp(e,n,t[n])}}),CloudOS.AppleWidgetCommonMethods={_floworigin:null,_pane:null,_url:null,_contentViewClass:null,_messagesReceived:[],_rpcMethodHandlers:{},init:function(){arguments.callee.base.apply(this,arguments),this.addCommonRPCMethods(this._rpcMethodHandlers)},addCommonRPCMethods:function(
e){var t=this.get("_rpcCommonMethodHandlers");if(t)for(var n in t)e[n]||(e[n]=t[n])},handleMessage:function(e){var t=e&&e.method,n=t&&this._rpcMethodHandlers[t],r=e&&e.params,i=this.toString();this._messageReceived(t);if(n){var s,o=SC.clone(r,!0);try{s=JSON.stringify(o,this._replacer.bind(this))}catch(u){s="(cannot stringify)"}SC.debug(i+" RPC: Received invocation for method `"+e.method+"`. (id: "+e.id+" params:"+s+")");var a=r&&SC.clone(r),f=this,l=function(t,n){f._frameMethodCallback(e,t,n)};a?(a.unshift(l),n.apply(this,a)):n.call(this,l)}else SC.warn(i+" RPC: Received invocation for non-existant method `"+e.method+"`. (id: "+e.id+")");typeof e=="object"&&(typeof e.result!="undefined"||typeof e.error!="undefined")&&SC.debug(i+" RPC: Received response. (id: "+e.id+")")},_paneContentView:function(){var e=this.__contentView,t=this.get("_contentViewClass");if(!t)return;if(!e||!e.kindOf(t))e=this.__contentView=t.create();return e}.property("_contentViewClass"),resetContentView:function(){this.__contentView=null},_removePane:function(){this._failureTimer&&this._failureTimer.invalidate()},_generateURL:function(e){var t=window.URI(e);return t.addQuery("locale",CK.getCurrentLocaleInISOFormat()),t.addQuery("font","sf"),t.toString()},_frameMethodCallback:function(e,t,n){var r={jsonrpc:"2.0",id:e.id};typeof t!="undefined"?r.result=t:typeof n!="undefined"?r.error=n:r.error="No response.",this._sendAppleIdWidgetMessage(r)},_keysNotToLog:["src","accountName","session","trustTokens"],_replacer:function(e,t){var n=SC.typeOf(t);if(n===SC.T_HASH){for(e in t)SC.typeOf(t[e])===SC.T_HASH?t[e]=this
._replacer(e,t[e]):this._keysNotToLog.contains(e)&&(t[e]="(omitted)");return t}return this._keysNotToLog.contains(e)?"(omitted)":t},_sendAppleIdWidgetMessage:function(e){var t=this.get("_paneContentView"),n=t.getFrame(),r=n&&n.contentWindow,i=this.toString();if(r){if(typeof e.result!="undefined"){var s=SC.clone(e.result,!0)||"";if(s){try{s=JSON.stringify(s,this._replacer.bind(this))}catch(o){s="(cannot stringify)"}s=" & params = %@ ".fmt(s)}SC.debug(i+" RPC: Responding with result. (id: "+e.id+s+")")}else typeof e.error!="undefined"?SC.debug(i+" RPC: Responding with error. (id: "+e.id+")"):SC.debug(i+" RPC: Calling `"+e.method+"`. (id: "+e.id+")");r.postMessage(this.get("prefix")+JSON.stringify(e),this._flowOrigin)}else SC.warn(i+" RPC: A message was not sent because the Apple widget frame could not be found. (id: "+e.id+")")},_rpcCommonMethodHandlers:{receivePingRequest:function(e,t){e(!!this._rpcMethodHandlers[t])},log:function(e){for(var t=0;t<arguments.length;t++){if(SC.typeOf(arguments[t])!==SC.T_STRING)continue;SC.Logger.debug(this.toString()+arguments[t])}e(YES)},reportStat:function(e,t){e(YES)}},_messageReceived:function(e){this._messagesReceived.push(e)},clearMessagesReceived:function(){this._messagesReceived=[]}},CloudOS.AdjustViewLayoutOnMobile={_windowSize:null,adjustLayoutOnMobile:function(e,t){if(CloudOSBootstrap.isOnSupportedMobile){t=t?t:["layout"];var n,r=this._windowSize?this._windowSize:SC.RootResponder.responder.currentWindowSize;for(var i=0,s=t.length;i<s;i++)n=t[i],e.indexOf("width")>-1&&this[n].width>r.width&&(this[n].width=r.width),e.indexOf("height")>-1&&
this[n].height>r.height&&(this[n].height=r.height),e.indexOf("minWidth")>-1&&this[n].minWidth>r.width&&(this[n].minWidth=r.width),e.indexOf("minHeight")>-1&&this[n].minHeight>r.height&&(this[n].minHeight=r.height)}}},CloudOS.AppleAuthWidgetFrameView=SC.View.extend(CW.Animatability,{classNames:["apple-auth-frame"],_url:null,_iframeView:null,_currentLayout:null,isFirstRunLoadedBinding:"CloudOS.authController.isFirstRunLoaded",isAuthWidgetLoadedBinding:"CloudOS.authController.isAuthWidgetLoaded",isRepairStartedBinding:"CloudOS.appleAuthWidgetController.isRepairStarted",isVisible:function(){var e=this.get("isAuthWidgetLoaded"),t=this.get("isFirstRunLoaded");return e&&!t}.property("isFirstRunLoaded","isAuthWidgetLoaded"),DEFAULT_WIDTH:640,DEFAULT_HEIGHT:480,shouldRepairFlowBeFullScreen:NO,isLoaded:!1,layout:function(e,t){var n={};if(t!==undefined)n=t;else{var r=CloudOSBootstrap.isOnSupportedMobile,i=this.get("shouldRepairFlowBeFullScreen"),s=this.get("isRepairStarted"),o=this.get("isLoaded");r&&i&&s?n={top:0,left:0,right:0,bottom:0}:n={centerY:-70,centerX:0,width:Math.min(this.DEFAULT_WIDTH,Math.max(COS.MIN_WIDTH,window.innerWidth)),height:Math.min(this.DEFAULT_HEIGHT,Math.max(COS.MIN_HEIGHT,window.innerHeight))},o||(n.opacity=0),n.zIndex=5}return n}.property("shouldRepairFlowBeFullScreen","isRepairStarted","isLoaded").cacheable(),init:function(){arguments.callee.base.apply(this,arguments),CloudOSBootstrap.isOnSupportedMobile&&this.DEFAULT_WIDTH>Math.min(window.innerWidth,window.innerHeight)&&this.set("shouldRepairFlowBeFullScreen",YES)},show:function(e){this._url=e;var t;t=this.
_iframeView=this.createChildView(CloudOS.iFrameView,{src:this._url,title:"Apple Id Sign-In",toString:function(){return"CloudOS.AppleAuthWidgetFrameView"}}),this.appendChild(t),this.invokeLast(function(){var e=t.$();e.attr("id","auth-frame"),e.attr("width","100%"),e.attr("height","100%"),e.attr("frameborder","0"),e.attr("scrolling","no"),e.attr("tabindex","-1")})},resetUrl:function(e){var t=this._iframeView;t&&t.set("src",e)},hide:function(){var e=this._iframeView;e&&e.destroy()},getFrame:function(){return this.getPath("_iframeView.layer")},shakeAuthFrame:function(){this._shaker&&this._shaker.finish();var e=15;this._shaker=this.animate("centerX",{to:this.get("layout").centerX+e,importants:[1,2,3,4,5,6].map(function(t){return t*e/7}),tween:CW.Anim.tweens.make("linearInterpolation",[0,1,-1,1,-1,.7,-0.7,0]),duration:400})}}),CloudOS.APPLE_AUTH_WIDGET_READY_TIMEOUT=45e3,CloudOS.APPLE_AUTH_WIDGET_POST_MESSAGE_PREFIX="pmrpc.",CloudOS.AppleAuthWidgetController=SC.Object.extend(CloudOS.AppleWidgetCommonMethods,{_contentViewClass:CloudOS.AppleAuthWidgetFrameView,prefix:CloudOS.APPLE_AUTH_WIDGET_POST_MESSAGE_PREFIX,_isRepairStarted:NO,isShowing:YES,hideRememberMeBinding:"CloudOS.authController.hideRememberMe",isFederatedFlowUIStarted:NO,configUI:function(){return{logo:{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANgAAADYCAYAAACJIC3tAAAgAElEQVR4nOy9Z3Bc15muyzpV98eZqjl10j11Z+bM2B7b4yhblonQjRwIgCQYJVGUqGglK1qWFZlEijkTJEiCRGDOOYHIIJgDCJIgAIIgbTlqxpZtEb1z6H7uj7V29wYIUZJHFESqv6q3dkv6s9Hdj973+9baqwcM+IIX8HfAPwM/AjKBB4BXgJlAMbAO2AvUA8eB88Bl4ArQBfwO+IO8fgB0x9Wv+qDXZ9IlP6vL8rM7Lj/LvfKzLZaf9Svys89EfBf+Gfi7/v5+3nYFfFe+ke8AG+Qb/nviFa+e9XvEd2MD4rvyAPDd/v7+fuEK+J/AaKAUOA38uZ8+sHjd/vVnxHeoFPGd+p/9/f3ulwL+NzAY8X+fD/rv84jXHV4fAOsR37X/3d/f+1tewL8h7LyjH9/0eH05qwPx3fu3/ubgMy/gLqAE+I/+fIfjFS/Ed7AEuKu/ufhPF/APwFzE9Che8foiVTfiu/kP/c3J31TAc8Snf/H64tfvgef6m5dPXMAPgYZ+ftPiFa9PWw3AD/ubn5sW8DJwvZ/fqHjF62+t68DL/c3RDQX8N2BtP7858YrXZ1Vrgf/W31wNGDBgwADgW8C5fn5D4hWvz7rOAd/qb7hSgd/28xsRr3jdqvotkNpfcKUBf+znNyBe8brV9Ucg7fOGK0h8mBGvL09dB4KfF1zJQKif/+B4xevzrhCQfKvh+r/AL/v5D41XvPqrfgl85VbB9feIB+LiFa8vc7UC//1WAFba339ZvOL1Ban1nzVcz/b3XxSveH3B6qefFVzfBtT+/mviFa8vWCnAtz8LwBr7+Q+JV7y+qNX4n4UrHg3jFa+b17N/K1z/SPwJ5HjF6+PqP4B//FsAW9bfdx6veN0mtezTwvVdwOzvu45XvG6TMoHvfRrASvr7juMVr9usSj4pXF8hvpE3XvH6tHWdT7KNCpjc33car3jdpjX54+D6e+Baf99lvOJ1m9Yvgb+/GWCD+/sO4xWv27wG3wywDf19d/GK121eGz4Krv9B/JdN4hWv/2z9mb5+1QV4sL/vLF7xukNqbF+Are7vu4pXvO6QqugN138hfrZhvOL1WdU54L/4Afs+8V9AiVe8PqvqBr7vB+yh/r6jeMXrDquH/IBN7e+7iVe87rCa4gdsc3/fTbzidYfVZg+uvwNO9ffdxCted1idBv7O2z3/p/69l3jF646rD4CvDgDu7u87iVe87tC6ewCQ1d93Ea//fNlh+JMW4VfXw7R9EObcv7s0/7vLyT+4nP6DeN36R5euv4T5fSiCYvX3HX8pKmsAMLa/7yJen67+qEVo/qPLxss2U0+YjDugMnSHSt42lezNCukbFFLWhQiuUwisUQiuDhFco5C2NkTmOoXc9QoFm1RGb9X4WZXO0jMmNb9y+M31MKod6e8/706qsQOAn/f3XcTr4+viBy6bOm3eOGKQs03h+2u6+f7qEN9dHeLbZd18uzTEd8pCfK+0m++XhbirtJu7SkNCq7q5a2WI75d0870V3Xx3WYhvL+vmW8UhvlPczfeWhfhecYiBJSEe3qWy6KRJ43sOfzbisP0n6+cDgJn9fRfx6rt+p4ZZecnkuXqDwOYQX1l1nW9VhLhnnULChpDQ+hAJ6xQS1oVIWBsiYY1Cwmp5rZCvK0IklCtCZSGh0hAJq4QGrhT68YoQ3yvu5p/nX+fri7oZsUllSoNB46+d/n4rbteaOQBY3t93Ea9YuRFo/pPD+BM6ebsUvrU2xNcrQtyzIURgs0LSJoWkDSESNygkbFAkYCES1ipCa6RWS8AqJGBlPrh6AZaw0pNCQolCYomA7ZsLu/mnOde5Z3mIsds0NrRa/DXuap+mlsUfsvwC1en/cHjlqE7SFoUfbFD4kYQqZYtCYHOI5ChgComeg60LkbDeg0u62Gqfc1WESCiXKpOglSoCsNIQCasUH2AhEkoUqRAJK4TuWiJg+9aibvJWK1S0WPxJj4P2CWrDAGB/f9/Fl73Of+Dy+nGdgVtC/GhTiLTtCmnbFVK2qqRsUQhuUUjerJC8OUTyphBJG6WDrfdprYTL72IVPsjKQr6IqPR0sFVK1L0SSkIxrfBpeYiBy0L8YEmIf5nTTf4ahfUXLML9/eZ9sWv/AKC+v+/iy1rddoRFF0yydil8b2OI1B0qmTsUMnYopG1TSN2qkLJVIbhVIbBZiTpY4kalJ2DrZB/WIyL64Krw+i8JWKl0sWg89LlYb8CW94QsYXmIhGUhvjGvm6/M6eah7RpHfxPv0T6i6gcAJ/r7Lr6M1fi+w8O1KglbFYLbQ+TsUsjaKeBK36GQtl0ldVsMsOBmheRNMiL2AEzGRK8PW+OPiIovIvZyLw8wfw/WAy7FpxhY3jVxWYgfLQ3x9Xnd/LAoxPTDBt1WPDb2qhMDgJb+vosvU2lOhCWtFqm7QqTsCJG3R2HQHpWc3SpZu6SDbVdI3y7gStkqImJgi4iISZsUkjaFYj3YeiXmXt4U0YOst4OV+3uvUC8X80Om9HSw5SESliskLFMEZMtCJBSHoq/vLgrxldnXGb5B4ez7bn+/xV+kahkAdPT3XXxZqqs7zItHNZK2K+TtVRmyXyF/r8Kg3Sq5uxWyd6lk7lRFRNyukLZVjQG2OdTTwTYqPQFb5wEWisXD1dK9KpTYkKO3e/VwMNmH+SOh372WhQRkxT7IikMkSv3rnG5+tDTEmpb4NhFZ7QOAq/19F1+GOvlHh7G1KsFdIYYcUBl6QKVgnwBt0G5FAqaQuVM4WNp2hdTtPgeLDjl8PVh0TN8TsET/iL7cN0ksU3pODz31GNNLqEoU4VpRB/MBtizU08l8oH17Xjdfn9vNO/UGTjwxXh0AdPX3XdzpVfk7m2GVCnn7FEZUqgw7qDLkgMqQfSr5ErAcz8F2qKTLiJi2rWdEDMg+LHGT14OFYkMOb4oYHXD0gqysl1Ypvgmib9ARnR76eq8oaF5MFC6W6AdsqVDi0hA/Whziq7O7eX6fzofml5qyrgHAr/v7Lu7k2nLNouCAQuFBhdGHVAGYdLAh+xUK9qrk7VHI3a32GHT06WCbQiIebvKN6df1WmyW/dcNLlbmmyJGo6HSc7ixsjdcfTlYqGdElGD1eC31zzOv89AWlffVLy1k7w0A3u/vu7hTa9M1m4KDCsMrVe6vVhklARt+UKHwgMrgfQoFexUJmNeDKWTsUAVgviliYIucIm4USugxppcu5rlXDwdTejpYdMARutG5pHsl9lr/8k8Pe8fC3lD59eMlIf5pxnXGbFa/rE72/gDgD/19F3di7f61xfBDKvfVqDxQq3F/tcboKgHZ8IOeg6liyLFHIXdPbMiRKUf1qduEgtsUAlsVkrd4a2EhEjaG5H7EjxjVe8MO/zQxOuQI9Vxk7mtxufeA46MA+xjQBi4N8bVZ3Yzb+qWE7A8DEE9exuszrJo/ONxbqzK2TuXBOo2xtRr3V6uMrlIZWSlcrPCAwuDooEMCtlshc5dKxk6F9J0yIm6T62BbVZK3KCRtUknaqJKwURHyO1l0TC/3IvrhKld8UTHU9zpYNB72ERG94UZxH5DdxMUSloZIKg7xlVnXeWqXjvblWpP+YAAQ6u+7uJOq5S8uD9Vr3F+r8XCDxoN1Gg/UqFHARlWpDD+kUigHHQX7VfL2KeTuUcne4wGmkr5DJXW7Sso2leA2lcBWhcBmleRNqtzNoZK4UZVwqULrFBLWqiSsUX2AKb12cvgXmpVYL7Yq5FsDU3rt3FBuHNN/CsASlob4cVGIf5rRzVvVen9/RJ9ndQ8gfuDoZ1Z/MiO8cFzjvlqVxxs1HqlXeaheZWytyphqlXurBWAjJGBDD6oU7NfEqH6PSs4elaxdGhk7NdJ3qKTtUEndppKyVSW4VRV92BaVpM09IUvcoJC4XiFxnSoAW+uBpkjYVBLK1RhkpaqQtwfRkz8qRheae8Pl6ZOB5Z8u/nBRiK/N6ab83Jfm57/jgH1Wpbvw7nmDMXUqTx5ReaxR5ZFGjXH1wsXur9W4r0ZjdLXGyEMaww5qDD2gMXi/Rv4+jdy9mtjNsVuNudjOmIulbFUJbFVJ3qLKBWfVB5gqAFuvkrhOIXGtkIiKqnQxVSgKme/qB61E6blNqq/FZg+uT+FgCUvFOtndi7u5a3E3R3/7pdjxEQfss6qt71k80KDy1FGNJ5o0Hjus8XCjxrgGjbH1OmPq9ChgIw5pDKvUGHpQY/ABlfz9GoP2auTs7QlY2g6VNC8mblXloMNzMAnXJlUuPEsnW+eDbI1C4moZFz24olFRFdceC86K73EVDzABWWLvUf2ncK/e/dg353ZTsFrlT9odP/SIA+aVGwErHMEMR3Ai8Gk++tYPXZ48pvJEk8bTRzR+ckTj8SadRxp1xjVqjG3QecAH2MgqjWGVKkMrNQYflIDtE4Ble4DtUknfqZG2QwK2XfRiyVsFYImbFQHXJgmWp/WqgGxtb8jUnnsS/e71UZCtUGOQLVN6xcVP5169J4tfmXWdt2vu+H7sywmYHY7wOz3Mmb84HHzfZutvLdb92mT1eyYV75msfc9kw29MtvzWYv/7Nmf+4vBbPYzdx8NPihNhUovOuMMazx3XeeaozpNHdZ44ovPoYZ2HG3QeijqYLgCr1hh+SKPwoMrggxr5+zXy9qnk7lXJ3uO5mEbGLpXUnRop2zVStmkEtmkEtmokbdFI2qxJwDQSN2okbtAkXJoETCVxjUriapXE1QqJFQqJFapQmUJiuSKuZQqJErTElQoJK9WeMdF7vcwnfx/2KYcdnn6wKMQ353VTfe2OHit+eQCzwnBNdTn4vs2KawYLu3TebdcY36ox8ZLGpDaNyVITL4l//0arxi8uin+e3amz+KrBvj/YXFNdXGlxh35v83CTxvMnDJ47bvDMMUPExCM6jx7WGNeo82CDxpg6TQBWIwGr0iis1Bh8QCP/gEbefo3cfRrZezSy9mhk7NZI36mRukMjZYeALLBNJbBNI2mrStIWlcTNKombtZtApvUEzQ9YmUJimUpiqUpiqYAsUUKW2GcvppB4A2B9gPZpouKcbgoqlDt5fezOB8xwoeVDl9XvGczs1Jh+WYA1vUNAM6dTZ85lodmdOrMuC828rDP9ss6MyzpT23Umtem8dUnj7Us6E9s01r1nsv99hxdO67x2WuelUwY/PaHzzHGdJ4/pPHHU68MEYA/Ua9xfp3NvrcbIGo1hhzQKK3WGVKoUHNAYdMADTCdrj07Gbo20XTppOzVSpIsFtotBh3AxlaTN0smiww6NxPWaLyZqQmtUEtdoMcjKpcrUGGSregKWuFIhsUQh0QdYVMvUzwSyxKUhvjr7OsvP3LFTxTsbsIvdDqW/MninXWPmZZ15V3TmXpHXTvF6bqfQ7E6d2Zd1ZnbGAJt5WWd6h9C7ntp1prQbTLxk8NUDOv9jt8GQwwY/O63z8ikfYEd0HmsSgD3UqDO2QeP+Ok06mC4c7JDGkEqdgoPCxXL26eTu08naq5O5RyN9l4AsdadwseB2jYB0suRoVPQPPaSLbfBDJrVaJXG1JlSuScg0CZnmA02VgKkCsBJ5XS4V7cU+ys0+3Rj/B4tCpJaE+E33HXn4wJ0J2B/NMDt/bzH9ssbUDo35V/Qemtfpg6xTY44EbJYPrhlS0zt0prXrTOvQebfNYGqbwdxOg8fPGPz9ToP/Z6fB3+02+G6lwbijBj+TkD1xROexIzqPHJaDjkaN++t17q3VGVVjMLxaZ1iVLgcdOnmei+3XyN6rCcB2a6Tt0gRgOzWCOwRgyds0H2BSmzSSNmokeS62Tl49F4tC1tvFfHB5gHmQlagxwEpigEWvUv8ZyAYuCfG12d1MaTD6+2tzK+rOA+yK4rL0qsHUdgHOgi4fWD645l3RmXNFj8LllwfXDL97tQu43u0wmNlh8ONag/+60+D/7DP4X3sN/m6XwT/uMyg8rPPSSZ2nj+piktik89BhnQcadcbUGdxbZzCqVmdEtU5hFDBNAqaTs08jywNsj0aahCxlp3Cw4HaNwA6NpG06SVultuhRyKIO5gfNkz8m9o6KvQFb5YNrRSwu9obroyELfWLIvjWvm+CKENc+vOPWxu4swM7+1WF2p3CgBVcMFvhcy/96rk8eZJ57zeoUMXFmh86MDoNp7QbvSk1tM5jXafBMswDr/91n8A/7Df5hn8H/t1+A9r/2GmTV6TwrXezhJoNxTQZjGwzurze4r95gtARsWJXG0EMaBZUa+Qd1Bu33ANPJ3KuTvkcnbbdO6i6h4A6dwA6d5O0aSds0krZqAq4tGkmbdKGNfifThdZpJK7TBWBrtFhUrJCK9mKaDzKNxJWajIoqiSt8Wv4RoBXHdANwHzO2/6cZ3Sw4fse52J0D2JEPbGZcFq618IrOwi7hXgu6BFwLumLO5fVec7yrB5gXETu83stgmgeZfD2zwyD7sMF/32vwzweF/umAwf+V8kBLqTV4+pjBY00G4w4bPNioM6be4N56ndG1OiNrdIZVaxRWGQypNMg/qJN7QCd3v072PoOMvToZewRkqbt1GRElZNt1krfrJG/TZVTUfVFRguZ3sfW6HHZoJK7RY5B5gJVrIip6gJVqMcBK1ChkSStUEpd7+pSQLf1oyBKXhvjO/G5yyxX+fGedt3hnAHbqLzbTLmvM6oyBtbBLZ2GXGMcv8EdEb9Ahhxz+iDhLut+MDoMZHYYAzHOvDoPZnQavXzT4xiGDfzlo8LVKg69WGnzloMFXD4rrVw4a/ON+k/+zzySrzuTpowaPNOmMbTR4oEEXDlYnABterQvADhnkV+rkHdTJPWCQvV8na18MsLTdOim7hII7NeliHmD+mCjh8vqx9TElrvP1Y30BFoWsV0z0HKzE52TLe4F2E8gSb4Csb9ASl4b4l5nd7O20+/vr9FnW7Q9Ye7fLbDkJ9GBaKB1r4RUj6mAiHhrM64oNOOZ06sz2ImJ0cmgwXWqadK13JWyzOw3GnTH4vwcNvnlIgPaNQwZfr4zpXw+a/OsBk68cMPnnAyZ5dSIqPnhYZ0yDzv31OqPqDEbUGAyrMRhaZTD4kE7+IYO8SoPcA7oEzCBjnyEA26OTsssQgO0yCHgutk2CtlUnaatB0haDpM2GAGyTQdIGjaQNuq8X02OQrdZ7TRV7OZkHlycZD5NW9AHZxwB2I2R9O9l35nfz1C7tU+2i+YLX7Q3Y7/Uwi7oEJIu6DBZeMXo6l2/AMb/rRheb2xlb/5p92WDWZYMZlwVM0y/31Ez539IOG3yj0uDbVQbfPmTy7SqTb1UZfOuQybcqTf6t0uSbh0z+7ZDJ1w6YfOOgychGg0eaDMY0GtzXYDC63mRErcnwGoMh1QaDq3yAHTTIPmCQdcAgc59B+l6DtL0GabuNGGQ7DQI7DJKjTmaQvFVqi06y52QbpTboJK3XSVqnS8gkaH26mC6jooyJq7QYZP5ebHkfWqaQuCx0U9ASb+JkPyoS/VjXX+6Ykf3tC5gTgbW/MZnWobPoqs4i6Vii/xLONb/3BLErNtyY54+Hl3Vm+SCaIV/7/3lOp8mbrQZ31xp8t8rg+9UGd1UbfL/K5HvVBt+rNvlulcl3qsT12xK4rx0wubvK5MEmgwcPC8DurTcZWWcwvNZgaI3BkCqDgqobAcuQgKXvNUjdY5Aio2Jgl4Rrh4ArsC0GWTQqbjaEi3mAbTCikCWt1Ulao5O0WhdOVqH3ERV9gK3SekbEFR8F2sc7WWKxQuLSviH78ZIQ310QYmXzHXPs2+0L2Ik/i75rgedeXt/li4jzvYgoQZvrA2xOpxFb/5LuNeuywaxOg5mdAi7/v1901eTxMwZ31Rj8sMbg7hqDH9WY3F1j8sMakx/WGPJq8oNqU4BXZfKdQ8LFcupMHjliMKbR5N4GU8TEWpOhNSaDq00KDpnkHTLIPWjGHGy/GYUsdY8HmUFgp0HyToPkHQbJ2w0B1zZDRMUtnmRc3GgIuDYYJK03BGDrjBhkazSSVmskVegklusCrnKNxFJdKOpiGoklWh+QKb1cTP14wCRkN4Km8PW53TyxQ+vvr9dnVbcnYH+1IizuEnAs7tJZeFXAtajLG3IYPaeHnuRwY06nztxOgzmdBrMvi94qqiux13M6TeZeMZlzxWTxVZMRx03uqjFJqDNJrBPXgXUmA2tNflxn8uNak3tqzBh41ULfPWTyg0MWoxtNHjxsMLrBYGS9yfA6g8JagyHVJgVVJvlVJoMqDXIOmmQfMMk8YJCx3yB9n0HqHlMAtscguNsksEuAFthhkrzd9EFmCm02Yi62SfdBJh1snU7SWkNAVuFTuU5SmSZUKhQb2XuQaTdxMQ8yqZvA5ZfnYt+e301umcLvQ3dEJ3Z7Alb3R5tpHTqLuwwB1VXDB1cMsPkSso+Ca06nwZwrPkX/vcmcTpN5XQKwhV0mMy6b5B4x+HGdSbDBJFBvEmgQSqoXSqwzSagVGlhrMrDW4p5qi3tqLO6qssiqFYDd2+gBZlJYYzJEulhelcmgKpOcSg8wk4z9Jun7TF9M9AAzBWA7DZJ3mMLNopCJgYeAzJRR0edk63xRca2IilGV6ySVa+JaGoMsaWVvyG7Sk/kBW6aQWKx+LGCe7l7UzXcXhth3Z0wTbz/A/mpHKL5mMP+KwaIuI9Z/SbBE/xXTPDngiI3lxVanuVcM5vUpAda8KzEVXzN585JJRpNJSqNJ+mGTtEaTNHlNbRAKNpgE602S6yyS6yyS6iwSay0SaywGVpskVAsXu7/RjAI2rM6LiQZ5VSa5hyxyK01yDkrADpik7zdJ22eQutckZY9JcI/pczGTwA459PCcbKtBshcR+wJsvSFjotQag6TVhnCw1Z6TeS6mC60SkCX5XexmTtYDsF6Q3QSwhKUK/zi9m/lNd8Si8+0H2Km/OMzqFO4lpLPoqsHCq76FZV/fJaaGhhxsGPK1wfwuqSsG87tMFlwxWdBlMv9q7PWCLpMFV01KfmXx8nmLlEaT7CNCWU1C2U0mmYctMhpNMg5bpDVapDVYpNZbBOstgnUWgTqTpFqTgTUmgxos7m8yGdVgMqLepLDOYkitxeAai/xqSzjYIeFiWRKydAlZ6j5TQLbXJLDHJOA52S6T5J0mgR0mge0mydtkTNxikuw52SaTZA+09T7I/EOPNYYETMJWpsei4iqfJGhJJUKJKzzQtE8eFXuBleR7/dVZIV7Yq98J4/rbCzA3EmHdb8RwIhoPZUT0LzDP96tTghUdegiwFnQZLPSBtPCq0KKrJou6xHXhVZPFVy2W/9LimXMW6YcN8o+a5B8xyZMa1GQy6IhJTpNFTpNJVpNF5mGLzEaL9AaL9HoBW2qdRVKtRVqdxX1NFqMbLUbUW8LBak0G15g9AMuuNMk6aEVdLG2/Reo+oeBei+BuS7qYJbTTJLDDkoBZQhKypC0GyZtMAddHOdka2Y95TuYBVi6vpTpJq6RW3ghZ0scCpn5iF/vOvBAj16n8Wb/tx/W3F2C/18MUXRWxb9FVoYXSwRZfNSj6pcHiawaLr+nyakT/2+JrBkXXDJZcM1l8zaToqhhcLOqS16smi+XrmCyKr1ksvmbxWLNF3lGTocdNhhwzGXLUZPAxk4KjFgVHTfKPWOQdscg7bJHbZJFz2CKnwSKrwSazwSKjTkCWVmcxvNFkdKPF8AaLYdLFBtea5NeYDKq2yK2yyD4kAMs4aJFxwCLtgCUg22uSstciuEcosMsSTiYdLNnvYj4nE1FRauPHREUPMg+uGwDT+wBMqEdU7BMw9WMB++FChaRihfY/xgH7XOv0XxzmdIqeq+iqweKrOkXXRB82+7LO9HaNKZc0Jl3UmHRRZ+JFjYkXdSZd1JncqjPlks60NrENak6ngGvJL02WXotpyTVL6Kq4Lv+lxYIum4fOmAw7bjLquMnwEybDjwsVHrMoPGYx9JjFkKMWg49YFByxyD9iMeiwUM5hi+wGi6wGi/Q6myENwsVGNFoMa7AYWm8xuNYiv9ZiULVJbpVJTpVFVqVFRqWALO2ARfoBi1QJWXCvdLI9FsFdwsmCOy0COyySd1gEtgsJyCwB2GYfaBtNCZlJ0jqp3pCV9wGZ14+t6gMyD7TlGkkfCZnysZAlLFH42qwQx9677Y8TuL0A2/fvNjMlYHMva0xp1XjrvMqrZxVeOa3ystRLp1RePqXx8mmNn53R+dkZjVfOarxyRuPVsxqvndd587zG2xd0Jl0SG3vnXzFZIh1r+S8tin9psfSaRcmvbOZ22Tx42mT0SZP7Tprce8pk9AmL0ScsRh63GHHCYsRxocJjFoVHBWxDjlgUNFnkNdnkNVoMarTJarAoaLS597DNyEZbAFZnMbjOJr/WJq/GZlC1JQGzyay0o4B5LpayTygK2G7pZLtMAjstoR0WAc/BtlqiH9sslLTRD5hB0gazZ1RcbfaMiuVGT8B6x8XegH0UZJ/ExZaIfuxfZoTY0x4H7HOtsl8ZvNGi8lqzwounFF44FeKFUwovnFJ4+ZTKz06pAqIzKr9o1oTOCb3RovH6OY035Os3zmu8fl7n9RadNy7ovHXBYHyrwbR2kwVdFst+abHyVxZl79nM6bQZc8pk7OmYxpyyGHPS4v6TFveeFLCNOi6BO2Yz/KjNsCM2Q49aDDliU3DYouCwgKyg0WLUYYuRjRbDGm3hYHUW+XUeYDY51RZZh2wypYulS8BS/YBJyAK7ZUz0ejEPsKiDmSRv8SCzSN5kkbzRFFpvyqgoXWyNf6poCLg8wG4WF3sDtkIAlrRM6AbAPioiLhH6+qwQZWdv+x0dtwdgf7EjHHzf4pXTKk8dE0C9eCrmWK+cVnnlrMqrZ1V+cVbjtWaV189pvN6s8lqzzhvnNN5s0XjrvM5bF8T1zQs6b1/QefuiwVsXjej1zQsGb140mNxuMu+KTdl7NvO6bB48bfHwWZOHz1iMO23x0HfHTlYAACAASURBVGmLB09bjD1t8cApizEnbO4/aXPfCZt7PdiOWQw/ZjHsqMXQIzZDm2wGN9kMbrQZ2WQz8rB0sAabIXU2BXU+B6u2ya6yyDxkk3HIJv2gTdrBGGTB/TYp+2xS9thi4LHHIrjbjjnYTovk7TbJ2/0DDyvqYsmbTJI3WiRvMIXWSa2VWmP2AZlBUqlxk55M7xUTffJAK/4EoC1R+MacEEXH44Dd0vrQjlD9R5vSX5tMuKjx7AlFxL/TCj87o/DKGYWfn1F59awWdazXJVyeU73ZovPWeY23Lmi8fUHEQg+sty8ajL9o8HarcK/xreL125cM3mgVew/f7bAYf0nA9dQ5i8fPWjxy1uLRM+L68Bmbh05bPHTK5sFTtoDtpM39J2zuO24x+rjNyGM2I47aFB6xKWyyGXrEZmSTxcjDNsMbbAobbAbX2xTUWeTV2gyqscmptkVMrLLJPGSTXulBZpN6wCZlv9Q+i6AH2W6bYHSqKPux6ERRaoslXcyUTiYhWy+1LgZY8mqT5L6crFSCVurBpfeEyx8TV8TgSpLjeu+ogIFF3Qxc3FMJRULfmhNiSq1B+Pae1X8xAXMi0PyhS8mvTOZcERPBmR0aL54K8fJplZ+dUfj5GYVXz6q82qxKsDReP6fzZrPOmy0CrrfO67x1Xuft8xrjL+iMvyjVqjP+YgyqCa0GEy7Jf74kABMymdhm8sRpncx6lYdPmzx73uKpcxZPNFs8ftbm0bMWj5yxeOSMLZ3NZuxJmwdO2tx/XOje4w6jjtmMPGoz4ojNcD9ghyVgDT7Aam1ya2yyqu0oYBmVArK0SgFYqnSw4D6b4F5bQmYT2CW10xaA9XCx3pBJeS623vIBZvggM0nuy8n6Gt2X+F0sNpYfWNTNjxdeF1ogNf/DmOZ9yD3zPuSeeX/lnrl/5Qez/kJOSTcTGwy2tFlc+o8w143bjrYvHmB/MMJs/q3FHLmJd+k1gxW/MpjRrvPiqRCvnFb4uRcHmzVea9Z445zOm+d03pRR8O0WXei8znjpXBMuaEy4aDDhos6EVnEq1IRLEq42U7y+ZDC+TUA24ZLJhDaTyR0mT541GFitkVKvM+K4wdMtNs+es3mqWYDmwfbYGZtHTts8fMrmoVM2Y08IjTnhcN9xm3uP24w65jCiyWFkk82IJg8whyH1DoPrbfJrHQbVOuTU+gFzSD8k3CutUlxTDsiIKOVBFtgtQdtpE9hhi2niDpvANovkrbaAa6stY6LsxfoCbK0hIPMBllxhkFwup4seYKX+mChAS1yukrBUES61qDuqGwDzQzZPQjZXavZfSVh8nay1KsFylZQyhSf26Cw/bXLuD7fN2R1fLMBaPnQouiae71p6TcC15JrB8l+ZzGzXeOm0EgXr9WYRA988JwB767zGW9K1xp/XBEgXxHXiRZ0JrToTJVh+TWozmCg14ZKEzad32i2ebjZJadDJaDRIqzcYeszkJ+csnm+xebrZ4alzNk822/yk2ebxMz7QTkvQTto8cMKRbmYz6pjNqCM2I5schjc6FDY6DGl0KGhwyKvzHMwhu9omq9ohs0r0YRmHHOFiB21SDjhCXi+2zyG4xxExcbdNYJcjIJNOFo2LURezfQOPXlHR68fWeDJigEnIksukSg3pYmINLKFYglUkI2BRiIGLfaAt7I5BNl9q3vUoYD+eK3T3rA9JLrrO0I0aQzeq5K9TCZQq3FWskF2h8kqlQc1Vh8gX29S+GICFgZo/2syV+waLJVwxwAxmdei8ckblF2dVXmtWeeOcKgYXssd6+7xwqvEXBFgTL2pMbBVrYJNadSa1Gky6pDNJQjXpklSbKSGTULWbTGz3Xlu802HxXItJdpNOwVGDgiMGeU0GhcdNnmi2eb7F4dkWm6fP2TwpQfPc7NHTArSHTjk8eNIRbnbc5r5jNqOPiEHHsMMOhY02QxpsChps8uocBtU55NY6ZNc4ZNU4ZFY7Aq5DDmmVjoyJjnCxA46IifucHi4W2O2IqLhDKHmHTfI2W0Jm3xgTN1okb7Bu7MXWxnqxGwArN0heZZBYoomzEuUaVsKSkA+ykOivfE42sLeLzesF2bwP+dHsDwksuU7hBgFYwTqV/LUqg9aoBFep/HCpQlKJwk/3aJz+4v5SS/8DZrgRdv7BYnan2HGx9FpPeYDNuazzi2aV185pvNHiwaX5+isRAyddlHBd1Jh00RBwXTKYfEmseU1uM5jcZjK5zWRSu4BLyGRiewy0iW0WE9oEYC9fsBh6zGTECYMRx01GnhCProw8afJEs8ULFxyePW/zzDmHZyRkTzQ7PO5Bdspm3CmbB6NO5jBaRsXhTTZDG+2Yg9V7gNk9AMusFoClVzqkHXRI9bTfIWWfI2OidDHPyWQvlrzDEdruSMhs4WBbbAmYHXOx9RbJ66TW+lxstUlyhSmgktekUl38QMRytechpHLTbhSw3pAtvC4h6/Y52Yc9AZvzISlLuxm6QWXIOgFYwRqVvNUquRUq2WUqqStVflwc4kdFChOrDX53/QtnZ/0LmObCtt9ZzOrUbwDLg2vJNYPiX4pNum+2COfywHr7vMaE8zoTzmtRp5p8UWfyJZ3JEqp32gwmt8WuAi6Dd9qFJrcLuCa3G0xqF2BNbLeY2G4zsd3inQ6bV1stRp8wuf+kyZhTJmPOmIw9bYnXp0yearZ54bzNcy02zzY7PNPs8FSzwxPNDo+dcXjktMO4kzYPnnSiUXH0UYeRRxyGH3YoPByLiPn1wsVy6xxyah2yax2yqh0yqh3Sq/wuFoMsZb+QcDFHDDz2OAKwXQ6BnQ7JO6WLbbeFg221YzHRc7INnov1hsySkEm4KgzxMOYKLQZYFDI1dkzbEikvJnpRcaFPErCBnuZ9yMB5H3LPnA9JK+5m2AaNoetUBq9VKVitMqhCZVC5ACxrlUrmSoWUZQrfmhsiv1Rlf/sX6jGX/gPMicD2TwCXB9iiLoMJF4VzjT8vY+AFuRXqgibAahVwvXNJZ8olg3fadKa0GbzjA2pKm8kUD64Ok3faDSbJ15PaLSZ2CLgmtFtM6LCY3GHzeqvNuNMmD58xefisySM+PXzG4pEzJs+cc3j+gsOzLQ5Pn5OAnbV5NAqYw9gTArD7jjuMOuoy4ojL8CYfYI0O+dLFPMCyahyyalwREz3ADvUC7ICEbJ9Dyl4ZFfc6BHc70agoXKwXYFslXJttoY0WgQ29erG1Vi/ADHGcgO+5sBsh8zmZjIwfDdl1Bi6Qmn+dgfM/ZOB8MeTIWB5i+AaNwrUaQ9ao5K9WyatQGVSmklOqkr1KJbNEIX25Qtoyhe/PD/HDBSHm1Ju4X4xtjP0DmBuBPe9bzOzUWdIHXL0BW3rNYOkvDaZc0nmzRWfCeZ2JF3QmX9SEa7UavHPJk86UNo0pbbqUwZQoWCZT202mthtMaTd5p93knQ6Dye0WkzssJnUI95oQBc1iUofNm202T54zeaLZ5CfNJk82i/7rCd+4/vFmm2daHH563uGpcw4/aXZ44ozDo2dcHj7lMO6Uy9iTrpwoOow61guwwy6DG13yG1wREescsutcsmsdMmuEg8VczCW10iH1oLimHHAFZPv8LuZEe7HkXb0cbLuMidFezCbQoxeLTRQD/l6swux5ZuLK2DNhCZ5uiIohAVmRB1k3AxcJyBJ8Lpbgab7QPbP/Ss6qEMM36BSu1Ri8WgJWrpJbppKzUiWrRCVzhQAsfZmALGGRwjdnhPjpNp2/9P8Zi/0D2OEPbOZc+WRw+V1sZruYEE66qDG5VRNgtRpMuaQx5ZLO1DaDqW3i+m67wVR5nuFU/+sOg6kdJlM6TKZ0iB7rnQ6Lye0Wk6QmdlhMaLdlTLR5u8PmufMWT54Tj6080yLWwp5qsXmyRQ43pJ45JxzsyWaHx5sdHjvj8vBph4dOuYw96TDmhMt9x11GHXMYedRl+FGXwiaXIYfdmIM1uOTWuxIwl6xal8wal8wql/Qql7RDLqmeDkodcEnZ75KyzyW4zyW41yWwRzrYbicaFQM7HDm2twlstUne6sioaJO80Y7FxF5RMWm1IU+c0nudOOVBFntUJWGZlP/MDeliCUUhEhaHSFjcTcKiEAkLu0n05APtx3M/JL9MZeQGnaFrNAZXaBSUa+SXqeSWCsBySlSyV6hkLFdIKxZKXaqQUqTwjRkhxq3T+f2H/Wplnz9gl0Mu87rEb20VfwrAllwzmNepS7h03pG746de0nm3Tfwww7ttBu+269GjrqPq8GQyVV6nXLaigE2WmtQe678mdAhNbLcZ327z0kWbZ1osfnpe6NnzNs+22DzTIq5Ptzg81SLcy3Owx5tdHjnjME4C9sAph/tPuNx33GH0MZcRR12GH3EpbPI5WKPLIAlYjg+wrBqXjGqX9OpegFUKwFIOuqQccAnu9wBzBGB+yDzAtkttcwhscQhssQls9kHmgbZeaq0pTp4q1wVkZb0Ow1mp9gGZ7MckYIm+qJiwOETi4hCJiyRYi2KAJfpcrKBcY+R6naGrNYZUaBSUaeSXaQwqVcmVgGUtV8lcppC+VCFtqULqEoVgkUJgocK/Tu1mTIXKB2q/OdnnC9iHVoSSX4nnuZb2MTH8KMCKrhny8RSDae2ix/LAmirBmt4mfwWlXUA2rUOPHnc9rcOMAvbuZYupEq4bAOuwmNhhM7HDjjqYd321VbjY8+dtnr8g9Nx5EQl/esHh2fMOz7S4PH3e4akWV0wRmx0eOeP4HCwWEWOAOQxrchlyxGXw4T4Aq4s5WEa1S3qNS5qELK1SwuYBdlAAlrLfFVFxn0tgr8/BPBfzA7Y1Blhgs01gkx8wm+R1vj2Jfsj8ZyeuVPt0suiTzL5NvIlFColFIXFdHCJpUYjERSESF3aTtChE0sJuEud1E1jUzdDVGiPWCcAGlwu48ks18lapDCpRyVmhkrVMJbNYAlakkFqkEFwsAEuar/D1qSEeWauh9M9PkH1+gEWA3X/46KHGRzmXB5en2ZdFDHy3TZNA6Uxv15nebjC93WBahy4OC5VwTb9sylN6TaZdtnhXamqHxZTLsYg4qUP0WxPbJWBS49sdJnY4vNZm8+IFm5cuOrwo9cJFMdh4/oLLcxdcCZrL0+ddfnLO5bGzLg+fcRl3xuXB0w4PnHS4/6TLvcdd0YMddUREPBLuCZiELApYnUtmrUuGB1mVS5pUapV0sUo32osF9zvCyXxj+8Aut6eLeU62zZaQOVHAAptsAhIysbu+18bfMrEnUTiZcDOxm16XxwdoPsB6bupNWiJVFCKpKETyYk/dJC8USpx3nbSlCsPW6gxbo1NYoTGkTKOgVCV/lcagEo3cFRo5y1Wyl6tkFatkFCukFymkLVZIWaQQXKAQWCCu35wS4uXtOs7nnxY/P8Auh1xmX9H7XOu6KWBXe2rhFXFe/DQfVNM7vPPkvZ8dEoDNuOwBZjL9ssW0yybvdsQcbOplz8FsJnXYcsghXGt8u834Doe35es32h1+1hrTSxeFXmx1eeGCKyETgD1z3uWplt6AhRlz0uX+Ey6jT7iMOh5m5DGX4UfDFB5xGdLkUtDkkt8YjgKWWx8WfZgHWG2YjJow6dVh0qvCpFWFST0UjvZiKQfD0aiYsl/0YVHA9rg9XWyH7XMxWwLmg2yjJR7GXCu1xnMx48ZnxFb5DsXxu9gyLQpZUrFKkgQsealCsoQsBliI5EXCuRIWdJO9XGHUOp1hq3UKyzWGlOkMLtXIX6WSX6KRu0IlZ7l0sKUqGUsU0hcrpC1SSF2oEJyvEJgvr/MUvvlON8VNn7uNfT6AGS6s+bXJ/K6P7rtuClgvJ5tzWcDl/UjDjMsSrg695+m8nWYUsGkSsGmXRUyc4pMHWNS52m3Gd8QAe7vd4a12h1c9wC45vNwq9FKrK53M5acXXAFYiwDs8WYB2EOnXR487fLAKVc42Ikwo467jIgCFmZIU5jBTWHyD4fJawwzqCFMbn2YnPow2fVhMusEXBk1rgCsJkxadZg0D7BKtwdcIiaGxbBjrxx67PJBtsMhsN32AWbHouImGRHXWT7ATN+DmDEX6wGZt9lXHh0gHlORu+klZMlLY4AFligkFykkF4UILFYILAoRWChi4qCVKqOkew0t1xhcqjF4lUbBSpW8FRqDlqvkLFPJLlbJXKKSUSThkkqZrxCcJxSYp3D3jBB3Tw9x5Orn+hDn5wPY6b84zL3y0WB9LFxXYz1Y0VVxNNvMDt8R1x3e6bymPJnXZGanyYxOkxmdFjM6LaZ3xiCb2mkxtdPrwXzu5RtqjG93JFg2b7XZvNXu8Is2h1dahV5udXjposuLFxyev+jy/EVHACaHHT9pcXninMsjZyVgp8KM6QFYmJHHwww/5lJ4NMyQI2EGN7nkN7nkHQ6T2xgmp0ECVhcmy4OsVsCVXi0B81ysUijlYJjUA2EJWlj2YS7BPS6BPWECuyVoO10CO1wC210Bma8fS95kywGHKaeIvmfE1pgkVZixuBjdVa+RtMrw7ahXSVqhkbxcJXm5RvIylcAylUCxSmCpQtDTkhDBIoVgUYiUxQrBRSFSi0IMLdcZsVpnWLlGYZnGkFKNgpUa+SuEBi3XyC1WyVmqkrVEJXOxKhxsoULqAgnWXIWgT/82OcSwYpW/ap/b0OPWA6a7EcreM1nQ9eng6t1/LZbyDrGZd8U73tr74TyDWZ0ms6+YEjCrB2TTO02mdZpM67R4t9Pff9k9hhvj2y0JmM3b7bYArN3hrTaH19ocXrnk8PIlh5daHV5sdXjhonAw4V4OT593eLLFjQL2qATsgVNhxpwKc58PsBHHwgw7FuvBCo5IBzscZlBjmFwJWFZ9mKw6CViddC+fg6VVudLJwtGBR/BAmOABOVHcFyawNyxi4u6wDzCvD3OFooD1Mar3bZsSMdH0OZkHmUFSiU6ypxWagGu5JuBaphJcphIsVmOALVUILlFIKQqRUhQisDhEZrHCyDU6wyo0Css1Cst0hqzSGLxSo2CFRt5ylUHLVHKLVbKXqGQVqWQtVklfpJC2QCF1vnSwuQqBOULBOQrB2Qr/Oj7EotrPLSreesDO/VW4V9Gn7L1uBpg4B9GUR1/r8qhrUzqY0MwrPSGb3mlF4XrXc6/LFpMvx6aH0WjowSWd6612hzfbHV6/JN2rF2DPX3D46XmXZ1ocnjrvRgF7vNnl0WaXh86EeeC0GwVstC8iRgE7GmbwkXDUwQYdFjExu0EC5new2hhgoh+TgFWGSY32YWGC+8MCrn2u0B6pXW4vyKSLbXVJ3uL02vxr3fCkc/JqGRcrTJLkxl/vIczklbpQiU6gRCewQiOwQiO4XCO4PAZYSrFKSrEitEQodUmIlCKFvBJVAFauM6xMp7D0YwBbfCNgqfMUUjzAZgulzFYYOF0heWaIy//+uUw8bi1gdgQ2/8686eTwptPDa33D5QE2Xx5tPbtTnB8/u9Nk1hXhYrOumMy4YjLjihcR5QSxUw43LtsCMA8uv3vJ3ssP1xttQj9vdXj5ooiHL1xweO6Cw3MXXJ654ESHG0+2uDx+zuXR5rBwsLMuY0+HuV9GxNEnw4w84TLiuMvw47IHOxKmoClMvnSxXNmH5TSEyWoIk9kgAIu6WG042oulV4XFNPGQS0plmJRKz8VcAdn+MIG9HwGYH7KtjlgL2yS10SZ5gy3H9Z6T9dw2Fdtdr5NcahAoFYAFVuoEV2oESjSCKzRSSiRkyzRSl6mkLNNIW6aStjSm1CKF9CUKhWU6Iyt0hpVpDCvTGLpKY8hKjcElGgXLVQqWaeQVa+Qu0cgpEg6WuUglc5FCuoQrdZ5wrMBseZ0lFJyp8L2JIV7d8rmcHHxrAXtPc5n/MZPDTzKe7wmYOBB0gZR3fvxs+SMNc3yAzbwSc6/pnWYvwKwevdf4dovxHWLXxlsdMfd6s93hDU9tDq9ecsWI/oIY0f/0ohhuPHPe5ekWlyfPuzzR4vJYc5jHzoV5pNll3Fk54DgV5t6TYUafcBl5MsyI42GGHQsz9GiEIUcjIiI2hclrijCoKSL6sEbPxSJk1nuQRUivjcSczDdRTDkUJqUyQsrBsIiJ+8XaWGCfK2LiXlf2YXKauNONTRO3eWtilm/RuQ8n8/YmVpgkl4ud9YEyqVKdwCqd4CoBWMpKnZQSjZQVGqmelqukScDSi1XSfetY2ctURq7WGVGuCfdapVG4SmNIicbgFQKwfAnYoCUqOUUqOYtVshaoZCxUyFigkD5PIXWucKygD6zgTIXgDIV7pigkTFVo/vUtf8zl1gLW9IHDzE79ppPDmy0s++FaLOGKAiZP5J3fJSCLwtXVF2ACMg8ubxeHFw8ntMfi4dtya9Rb7Q5vtgmwXm/z5PKLNpeX5BrYcxfkIrMETMTDME+cC/NYc5hHmsM8fDbMuLMiIt5/Osx9J8PSwcIMPx5h2LEIhcfCDDkaYfDRCPlNYfKjgEXIaYyQ3RAhs16qLuIDLEJajVBqdZjUqkgUsODBGGQBLyru9TlZ7+1T232AeTs7NvXqxzwH8yCTj7AEyk0CZSaBMoNgqUGwzCC4ShdwSaWWCLjSVmikL/epWCO9WCWjWCV9icrgVTojVxsML9cYVioAG7pSY8gKAdjg5Rr5xSp5S1UGLdHIXaySs0gla6FKxnyF9Hkq6fMU0mYrpMySgM2UmiEAC0xX+Nc3QkzYectd7NYBZoVh/W8sFl69eTz8OMB6OFiX0Sdg86/Inxnq6ulgPSaInT3d650OO7p7Y4J0r/Gee7XbUed6U0ZDAZeYJL58SfRdAjAxmn9K6olzErBzLg+fizDubJiHzkYYeybMfacijD4VYdSJCCNPRBhxIsyw42GGHovIHixCflMk6mCDDscAy2qISBeLkFErlF4TIb06QppUSlWE1EMR4WCVYYKVEYIHBWCBfRECErKgN03cHSawMyymiTvkFNHTZie24Ox/Tsw39AisMQlUeDIIlJsEywxSSg1SygxSV+mkrTRIW6mTtlIjrUQofblOugQtY5lUsVjTGl5uMLLCYHipQWGpRuEqnaElugBsuUbBMo2CpRp5SzRyi1RyF6tkS8AyF6ikz1VIm6uQNkc6mIQrOEMAFpiuEJyucNfEEDlzVH79wS3txW4dYO8bYRZ0fXq4ei8u9+VeC7tudDB/VJzl78F8Aw7Pvd7xr32124zvsHq415uy9/LAer3N5bU2h19ccnn1kssrl8I8L6NhzL3Cwr1aBFyPNrs8fC7MQ2fDYshxJsL9p8OMPhWWcAkNOx5h6FGfg0nIPAfzXCyzMUKmdLKM+gjpdVI1PherCpN6SEAWrIyQclA4WeBARMTFfdLJ9kRigO2SgG33Dzu8qOjEdnZssAnI0X1grUlgjUVgjUlwjUmwwiBYYZBSZpJSbpBaJpRWapC2SidtlUH6Kp2MlUKZK7SosparZC0XgOWv1Bi12mB4mQBs2CqdYSt1hpZIB1vmAaaSt0RjUJFwr+yFKtkLVDLnq2TMUwRksxVSZymkeFDNEGAFp0m9q/C1X4TYcPyWPj926wA7/6HDvJuM5j8SsD7Wvrz+S/xAgyEAk0OO+V0mc6X8PdhMCZgH17TLvQC7bDHpstg577mXfyzvOdhrbS6vXRLO9eolh59fcnnlkssLFwVcT58Pi96rxeUnLWEeb/F6rzDjmgVcD54JM+ZMWPRgpyKMOinca/iJCIXHI8LBjkUo8AN2JEKudLBoTPQAq4sBliZjYqpUSrUXE8OkHJSQHQiTsj8SnSoG93guJuX1Ydt9Dubf2bHRkYBJrbMJrrMIrhWApayWKjdJLTeEynTSSg3SSyVcErDMlTqZJRpZK2LKXK6Rs0yLuVeZwfBSnWGrdApLNAHYcglYsUbBEo28Io1Bi1VyPcDmq2TNV8mcq5A+RyV9lgAsdYZCynQJmYQr8K5CyrsK33kzxAtrdZxb14rdOsAO/Yd907WvT7r38AbAugwWXPV+fkg6lw+wHv3XlZ7j+ShgHTaTvP7L515vtQl5cHnuJaKhcK+ft7q80uryYmuYZ8+HebolLCeHYQHYuTCPngvzyLkw485GpHsJ3XsqLCKi7MGGHQ8z9ESEIcfDcsgRIV9ClutFxKaegGXUR0j3Q1br68FkH5ZaFZEDDxkXD4R7OFhwb5jgbjcqERN7bwD2tk05BDbaMW2wCUYBExKAWaSuMUmtMEkrN0grN0gvN8goFcpcpUeVtVIna6VGVolGdolG9nKNglXSvcoFYMNKjWg8HLpCADakWMTD/CUaeUUqeYs1chap5CyQcM1XyZyrkj5biQKWIp0rME0o+K4ALPiuQtI7CsGpCr/98y2LibcOsPW//dsWl5fcAJf8SaEeDmYw/6rZAzDPvTy4ZsrRvB8wz73eia59WUzwoqHUm+12NBq+5o+GbcK9fnbJ5WetLi9fdPnpRTmWPx/miRZXwNXi8si5MA83i3g49myEsWfDjDkd5t7TYUadikQjYtTBjkcYfCwierAjEQYdCZN7RMTEnKYI2Y1CWTImpkvQolGxNiJ3dkRIqw5H4fJ2dgQrwwQPhqMje7+LBb2dHTv8OzvcGGRbYhuAgxttgustghtsUtbbpKyzSVljkbrWInWNRdoak7TVJukVJhnlQpllBpllBlmlBtmlBtkrDXJW6eSU6OSs1MlZoZNbojO8wmBEucEILx6uNChcqVNYojN0uc6QZRqDPcAkXHmLhIN5gGXNVcmao5IxSyFtpkLaDIXU6Qop02JQBaYKqAJTFYJTFL77Zojatlu2ferWAKbZLit/ZbDQP56/atzwiMon679M39qX0ALpXvN9vVdvwLy1r2mXbwTM/2jK+OjUUA43okMNsXNDOFcsGr7c6vJSq7g+3xrmyfPh6Gj+8ZYwj8rp4bizYR48G2asdK8xZyLSwUQPNvxEhGEnwjIihgVgRyPkHwmLeChdZcCGWwAAIABJREFULOewUPbhGGAeXBl1kFGHAKxGDDpSPTeLDjvENDHlQCQG2F6pKGBeTPQD5kZjYnCTQ9ADbKNNynqLlHUWqesEXGlrTdLWWKStsUhfbZKx2iSjwiSz3CCr3CCrzCS7zCC7zCBnlQAsd5VO7koB15BSg1ESsOGlXv8lABvaG7AlGvlFGvmLVQHYApWc+SrZ8wRgmbNVMqSDpcl4mOJzreC7PQH74dsh5h24ZTs7bg1gf9IsVlwTv9v1t/ZfPYcbsemhN0H0DzduWP/qtJjp9V694qEfrgl9ABYbbDii97rk8mqrwyutLj9rdXi51eVFqRcuujx9weWJFuFgj51zxWi+2eWhZrcHYPeflhPEU3JELyNi4XHRfw0+HqHgWISCo0SniDmHiSrrMGQ1QlYDZDZARj1RwNJqIb0W0msipFZHSK2G1CpIqYqQUgnBSoSDHewDsD0uQW/YsdM38NjmEtziENziCknAUjY6pGywSV1vk7peQJa21iJ9rUX6GgnXapPM1SZZFQKw7HKTnDKDnFKDnFIJ1yoBV/5KnREVsvfqDViJTuEKCVixzuClGoOXaBQUaeT1Aixnnkr2nL4BS5VQRTUldv3h2yF+skr7rBHw6tYA9jvVYtnHANYbrGg0vNbTvXpOEOVvL181+oyHYrgh4PI7mPeQZcy97Kh7jW/r6V6vt9/oXq+0yj2IrS4vXRQO9vxFl+cuiD4s1nu5PNzsiuFGs8vYs9K9Toe574x0r1NhRp6MMOwEsXh4HKFjkH8sQt4RGHQEco9ATpNQVqNQZgNk1UvA6hG9WK2ErAYBVzVyZE+0DwtWRggeiBDcHyG4L+LrxcIEd4UJ7gwT3OkS3OES3OYS3OYQ3OoIyDY5pGx2SNnkkLLRJnWjQ+oGm7R1NmnrbdLX2aSvtchYa5G5RihrjUV2hUl2hUlOhUluuUFuucGgUoO8Up28Up1BK3UKy0257uWLh6tkRFxhMHS5ztBlOkOW6gxeqjO4SCN/sXSwhSqD5qvkzlfJlvEwa45KxkyVjJkK6TIepk6TLjZFKArZFIW7x4cYOk/FdG7JBuBbA9ivFYfia5/y2a+PAKzH7o0uo+d4/krMwWb3Wv/y+q93/YB5z361+9yrzRcN2x3eaLN5vc0/NXR4RfZe3uMpL7bK578uhvnphTBPnxejedF7uTwU7b/E9HDM6Qj3nhYDjpGnIow4gQDsBBQeh8ESsvxjkHdUyAMs1wNMOlimVEZDTOl1Qqm1kOZBVhUhpcoH2EEJ2AFikO2NyJjoQeYS3O4S3O4IyLa6BLdKuKRSNzmkbrRJ22iTtsEmfYNNxjqhzHV2FK6sNRY5qwVcORWWgKvMFCo1GLTKYEiZwcjVphxsmL7xfAywQg+wYp0hS3QKlugCsEUCsLzegM1WyZwlAEubHoPLD5WnwBSFe94OMWimyvu35uyOWwPYe4pD8bW+DxL9m7dH+X6UvMfal3962NkTsGmXb4yHk///9r4suK7yylrVj6lK119d/dRVXemHru5UJ+nEQEh0patZuoMsM08BM8+kAYMhYEKM53nCk+ZZnpghYDAYAzaWB022ZMtDGEIYi0Bs6w5nXv/D3t93vnPulTEB+VrK2VVfmYc8HFtaWXuvvfbew9T/EkOVjw4pro0hAw8dEuxF4Jo2aEphgwy+lBredcDCnQM27jhg47YBBzf1WZjaS+x1Db+rufa6Yp+Dy/c4JHB0A1N2gwSO3UD1bgbYLgcRAS5+AlzlbwNlKovtYHBtB4oUgIWZyQq3AYWvOSh4DSjYSiliwVb4GIwB9oJIEy2EnrVcFnuKmKxgs4mCTfQIXCbCG0yEOxlgHQaKOxhgbTpK2wyUteooa9VQ3qKjvEVHRYuGyiYdlU0aqpo0VDWkEW1IY0pLGhc1a65y2JjGFAGuWgbXuhSq1zCDPZlCbJUXYJVLE6hYkkD54gTKGWClzGDhOZQeFsweQYEfYDPpnTdjBKVzRnD443EEsPcSFlZ/B4Ct9DGYFDdEipilubzwqO4ROFSDLwHMkPs3hHP+UVYQ/ZaoB7nvNW3IxLQhC/cfND3gunuAFMQ7mL1u7bdxc7+Dqb22y177bFy138EVe0H1114Hl+wFLtoDajBLBRGI7wKiu4CoArKKnQQskSaWvUWv9C2uwbIwWJFkMEeyWOhVBwVbHYS2gp0dDDIBrhdshJ5zEHrWcVNFBljBFpPeZhOFG00UbjJQuMFEuMtAUZeJoi4TxZ0EsJIOHaXtBsradZS16Shv1VHRqhG4mnVUNesErkYNkcY0JjdrmNKiYUpzGjVNGmoaNAKXArDq9SlUr02jeq2ov1KIrkoisiKFyPIkqpYRg1UywEoXJlC2gBisaF4CRXNHEBYAywKu0MwRXPDYCIpmjWD/+2PSDBsbgL0/YmL1aVLEbxquXJnBYEI91KSCKPtfHoFD94BLrb+eGDY8k8szDo2iHA4SwB4YpLrrvkGT2YvBJR0cNm7vJ4Dd0u/gpj4HN/YK9dDBVfscXMkAu2yvg0v3ARfvdXBRtyPZa/JuAlhsFxB9l0CmMpiHvRhkog4rURlsO7PXNkoT1Tqs4FUCl6zDXmYmkyxmI/S844LsGRuhp20GmOUCbJMKMJMBxuDqNFDSYaC0XUdZu47yNnoVrToqW3RUtmioaqYXadJQ3awzuOjVNGqoaUijpl5z2YvFDZkeCgZbmUJkRdIF2JIEKpm9yhYlUDafGKxkXgJFcwhghQywAh+4BMAKnxjBu8fGRKofyxTx9ADzA82/GiBTos+0R4kGM7GXLgWOuQrAZkl53sAfhg1lsNJQRlIMSg+FY0Opv+5j9lIBdteARU3mfpbp+2zc2Ofgxj4H1/U4uGo/vSv3Obh8H3DZPgeX7gXVXwJg3eAmMxBlBTGy06Ea7B1OEd/xAWyHW4NJgL1BACtiJbFQTRFfBddhIEeHWoupqaLsibmCR8HTFgoUFivcRCwW3kgpYtEGgwDW5QKsrMMg9mrTUdGmobJVR1WrhqoWDZFmerEWDTWtOmqaNXpNGmoa06hp0FBTp2GyTA+JuYTAEef0MLYyhagEWBKVS5KoWJRAxaIEyhYmULpAAdhsL8D84BIAC80cwVvD4whgfx7RseY0KuKos19ZU0RuLh/XPP0vyV4CYDxo6R+ulPXXsI7HRf2luuaHDCluTB8yMX3QoNRwkKR5Gq608FsFXHcecNnr1n4HN/U7uKHPxvU9Dqb2OvhND4Hryv0OLt9L4Lp0j0PpYbeDGgVc8d3MYLscUhB3OsRg7wDlSnpYOkoNJlLEsHjbHK/QsdVBaKtDUv0rzF4SYLbCYrYnTSx4xkLBUzYKttgo3GKjcJOFwo0WwptMFG0kgBVLgOko7dBR2mGgvM1AeTuzV5uOylYNkVYNkWYdsRYdk1s1TG7RUdOiYXKzhsmNlB7WNGiYLBhsfRrV64SCmJbsFV+VQnRlEtHlKUSWJVG1NEkpIgOsfAEz2LwEiuclUMwMFp41gsJZozNYwcwRvDOeAPbJiI5130Km9y+18dqjFIvUMc3bYD7mNpclgx113fOzhnXMGjao/hp25fnHDulyJOWRQyYePmTgIQbYg4OGbCzfd1Ast2Hl8ACBi4QNG7f1O7ilzyH/YZ+Nqb0Oru11cG0PpYhX7HOIvfY4uGQP1V813Up6uBuI7QZiuxxEd7kqYmUWFVHWXzuUFJHTQ4+K6BE5RIrooOBlEHu97Bc7RD+M08RnBIPZzGA2CrZYBLBNFsKbLBRtsKj+UhistNMggLXrBLB2HVXMYJFWDdFWHdWtOia36ASsZg2TmzRMFuzVoHHviwG2ntirek2aRI4nU4itTCK2glNEBlglp4h+gJXMJYBJFvuGFLF7PKWIX6cM1L73Lfpg3wpg6Qz/oQowWX95GMwLMLe5LKaVDbf3pdRf9w6ycnjAwj0HLdx1kMAlxI1b+m3czKnh1D4SOa7tcXDNfgdX73dwxV4Hl+1l9ZDTw5puMIPRi+8m9oqy0FG1y3FrMAZYmQKw0h2KwLHdTRPDrzvMYAwuYfzlFDG0ldPDlxXTrwSYwwBz5XqZInItRgAzEd5ooWiDiaINJoq76JV20itrN1HeYaCi3SCAtRmoajUQbdURbyOAVbdqmNysuwBrSGNyg4bJ9WmZHlav58cAoxQxidiqJGIrXAaLLE2hcvEoAJvnA9is7HXY+Y/R/6Z3PIkchu2g8YP0qF7EM7FICXl+BXsPl8v6K52lwSzqLw1zj7qzX7OHDc94yu+HSUF0nRvuOoCHDhlSmr+fl9vcJxwbBy3cc8DGndz3ur3fwa19pBzezOLG9X3MXmyRovrLwWWcHl7c7WDKHgdTuh3UdDuoZoEjzk3mDAbb6WUw6eZ4y8tgxduV9NCXIha86lD9JdLEl/0poqImepREkuolg222ULjZRuFmiwDGICvuslDSZRHAOghc5R0mA8xAVRuBLNZmIN6mI96iI96so7pJR3WTRq9RQ3WDhuq6NCbXaqherzSY16RRvTqF6iddgSO2nGqw6LIUAyxJIFtECmLZfAbZ3ASKVRabpSiJKsBmnELZ3ASOfTqOZHoAePpj/YzNvpkOep//8JjwH2ZxcBzRsOCIrsx/MXsN+wAm3fM8WMnG3t9xDTZ9yMD0QQMPDLnq4b282IbSQ1uqh7cps1839jmue77HwTU9xF5X7ucUkdnr4j3AlG5KEWuYvarfdRB/12EFkdNEpdFcqUr0arP5Ta+SGFbsUmHFLuVVEaEwmAowwWA+V8fTNkJbbB+D0SvawADbQDK9SBHLOkyUtzPAGFzRNh2xNh2xVnrxFgZXo06vQUN1fRrVdRom12ncXOYaTLDXahY4VqWYwZLMYEkJsIpFCVT4ACbSxPAsF2CSwfjPSY+eQtX8BL4em/31Ywewt780z5jBshl8/SmiYC+/wVfI8wvYJuWZXj7ipodCQXxMkeh/x5PLanNZlefvleCixrKQ5tXhyuv7bFzf65B7vock+iv3E3tdvtcPMIcB5qCaWcwLMKEkOhlWKTVF9PTB3lBEjtf9Mj07OYRM7weYAJlfRXxaSPUMsi02ChSAqWliSZfpAqzTIBZrN1DZZiDSZiDSpiPapiPaoiPWrCHWrCHerCHepCHeoKG6IY3qOuUJgWMt1V7Vq1OIr04jvirNNZhgLwJY1WIGmUgRs9RhAmDZhI5fPHIKlyxPwB6bVYljB7DjIxYWH/3m43qjTTBnzID5BQ4lPZQjKhnzX4Yi0bsG30cFcwn2YgajkRSD00PaHkXqoY27Dtg8vWzj1gEbN/fbUj28rofk+d/02F722qvI86wiTukGJrPQERcChwQZULXT9SKqfTDZaN7BddgO1/DrUREFwLapKaKvBlNVxBfsLJYptxcW2sIg22ShYKMl7VJFXZasw0o61BqMGKyyXUdVm45Im45IC9Vh0WYdsSYdsUYNsUYCWFwCTEP1eg3VogZbm5b9rzgriLGVKcRWpBBdlpIgqxIMtjiB8oUEsvIFCZTNS6BkTgLFc0eoHzYru9Dx80dO4b721FhAABhLgJ00HKz9U+Y+xDPZP++1SGXWXy7AdMlgJHCQTO/fv+Hao3TMOKTLyeXfcf9r+iDVXw8K9jrostc9QpofsHE7TzDfMiDSQ5Lmr+tx00NpjeLm8iWSwagGq+kGW6QcThFPX4NJs2+WFFFVESW4tgkVkRlMSPWvKCpiBoP5RQ7Vl8ggY4AVbrK42Wwpbg4TJZ0mSttdBqtgFqtqJYBFGGDRJg2xRl0CrLpeQ7xeQ7wujepaDXHJYNRgrl6dRvzJtOyBxVakEF2eRJRFjqolgsGSGUJH6dwEiuckEPaniQrAfvbwKTTt0McCAsBYAswG8PwnOhb5WOzMd3CkseKY5ksR/SMquuKgdzdIzTmiOujd1dhe/6EPYKp6eJCMvXRBhdPDAxZuHyD2uqXfXQ1wfa/N7OXgqh4bV+63ccU+m5vLwiLl9sCmdLsexOrdDuK7He6D+cy+2XphLNMX7/CpiNt9PkSuw9RGc3YGU1LE5/wMpoBrC4+sbGSQbTQR3mBJkJV0EouVdZgoEwBrI4BVtuqoajEQadERadYRbdIRbdQQa6BH4NIQr3UBFhfstYbTQ6XJ7AeYrMN8ACubL1LELHWYArCfPnwKPWOjIAJjvbat/2+0tu3vBdjyY5oUOJap7JVl/8b8I0Lg0HzyPFukDuleB71IEYcMTB/0Ojfu5esptBbbxl0MrtsGhDRP4sYNvQ73vmwC2H6b2GufjcslwICL94BMvnuETO+4Mv27kBK9301fqSiIaoroBZnDLCb2c7g9sEIGWEgdWZEAE+sD1BpMtUtZXIOxq54BFtpoonAjs1inhaJOC8UdnCZ2GChrN1DWRp7EyladAUZexEiTjkgjA0yArE5DrDaNeG2awLWOAbaWwSUAtlIVOVKIiBRRpImLEqhYlETFQgYY12ACZOHZmQA7f8YIYgsT+OvIOFwZAABfGzbq3k9jKbPYt12P7Vkyqkr0/iWjvCLbP6Iyc9hQ1rOxwZcBRuohNZgfHGIG48MO94mxFAbXnaL3JQDWT43l6/tsXNcrai829+6z3RSR2esSUYN1ixqMGs1xZRYs+i7PgvnGVTx+xCwiBy2/cVPEsCdFdFjkUNwcgr1e8vXBMhjMFTkkg22yENpgIdRFs2GFXRbCnSaKOk3yJLYbKG3nVFEYflsMVDYbCsg0RBt0fhpi9QSyeG0a8XWaC7A1KU8Nlslgws3h+hErFpKSmNlwTkipXtRhBTNH8J/TTuGJZ9IYw1MQY7+b/pXPdMliZ7aDw1uDeR30aSw56lUQXYDpPole8SCKBrOy3EakhwQwdfbLHaz87UGe+Tpg4Y4DNm7tt0jc6HMBNrXXwbUsbgiAXc5PpojcZPaKHKIP5nANRiriaDWYFDjeoqnm4gwnh5MdYCx0hLbCrcM8Q5fZvIiWy2A8tiJZjAFW2JUFYG0uwMpaDAaYjopmg9z0gsUYXNF6AbA0YrUa4uv9ACMGi6kix0oFYEtTiCxJyDqsYmHSBdg8BWCzFYDNInD96vER/PjBU9g2OKbnjMYeYB8lbaxiwIw2zTwqgykDlsuOc4qYBWDukYcsAJPsxevZDunsoDeU4Uq2R8nbX+yeP+juPyTfIV9NEavZhDy/38FVIkVUJPpL99GIinBxXCRkeoXB4jwLJlPEXb55sHdc9irb4SqIGW56KXJwD+w1b7NZOunVGkywmGQw38jKFgbZZlthMBOhDRYKuiwUdJoId5oId5g0F9ZuEsjaDJS2GihvMXgezEBlk44qfpEGzQVYXVoBmJoiphFb46aILsAoRZS9sCUJVC2mNLFiIbFY+YIEyuf5GEyV658gcF2xMomTqTE9ZXR27oM994mOJUezAOy4twbzm3zVMZUMk6/aA1NMvnOH1TvM3vSQRA7dnQETDDaoKoiWx3t4FzeYxXLRm/tt3NgvAEa11zU9Nq7uIXn+Sq6/LhM2Ka7BLuoGpuwhm1TNbkcROdwaLMoA8zea5URztj7Ydi/AJINt87nppcjhVxFHazRbboroq8FCG0yEOglgBR0WCjtMhNtNFLUbKG41UNJq0MqAFgPlzQS0iiadQNaoo6pBR6ReQ6ReQ7SWarBYbRqx9Rpi6whkMeGiV4y+wipFUj0BLMo1WNXiJCoVgEklkUFWNJscHUWzRpA/cwT//cAprHt9zNRDEWcHYB+nbCw/nmVM5fgZMNjxLBK9fwfiEd1VEH3sJSR6uWBUAdhDSooo0sP7By25FuCeg7x3Y8DGbbwaWwDsel7Ndm2vQ8ttuAYTAFNFjksUBdG1SikAyybTv+OqiGr9NXqKKADmZE0RC7IxmOqkf87JZLCnFJBtUkC2wUSoy0So00RBh8kAM1DUbqK4zSSQtegoa9FR1mzwygBiscoGnYYuBcjqBMgIXDGFweJrhJNelemTiDLAostSiCxJcg3GQoeSJpZ60kTXMjVpxilUzR/BFyfH/BDf2bvR/MrnBhYc+XYAkwricdfB4U8RF8j+l3eCWdxh9gNMzIA9rNZgov46KAy+tFhUHa4ked7Czf0WbuizXID1kPfwKn6iySxSxEv3iBoMrhdxty9FfFeMq/gA9rZPpt+R2QcTjeaiN4DCN7IDjFREf3roZO7lUNz0stH8lJWZInZZEmAhBlhhu4kifgQwA6UtOsqadQYYMVhlo46qBs1lMQZYVAJMQ0ykiGLIUhU5hB9xGbPY0qTbC1vMAFuo1GHSk+iy2E+mn8T6s3OE7+wB7G+6g7XvpbHkWMoLrqwqopIeHvctuTnqd9G7FyzpgormDlkqF1TEaVhh9H34EBl8p6vDlQwuwWB3Ddg0XDnAawEGbNzUL0ZTbDmaIvyHV3EPzJsiOrh4L3DRHgdTuoVdSnHT+2swUX/tdLKLHDsURz3Pg8n0UO2DbXN4Hmy0PphY4aaA7NlsKSIDa7O3Bgt1WQh1Wgi1myjgF24zUdRGaWJxi46SZgOlzQbKmnSUNxHIKhp1VNYTwKrqNUTrNETr0oiuTyO2Po3oujRiaylFjAkXRzaRQ/bCErIOq1xEaaK0TM3zNpxL5ozgvBmncPnKBE6Nbe0l4uwBDAD6T1BfbMXx061q868J8I6pqAATi26Ei2PusPfIg7sH0RU5hIuDJHrvgpv7Bi3cO8h7D3n3xh0DFm4fsHDrACuIDLDrem3uf9kMMD7wIHthrkx/sRi2ZD+ikOlFH8wrcpCS6Jfo/W56Tw2m2KXciWbejcgKYkG2RrPYkZitBhNOjowajEHWSXVYqMMFWGG7iXCrgaJWQ6aJpc30yhsJXC7ANFTVa4jUpSWDRde7aWJsbRox4eJY7WWwKPfCqA4jFbFqsZImKkqiYLGSOQmE/jCCnzx0EtuHxvwumIizCzAAeP5TThX9IMsKME02mdUemGfRjTx0rrlrAlSRQ3gQD+mYcVj3ODgEwNwmM61n8yy3GbDJwdHPK7L7leMODDCxHttdEyB8iJQeXuJx07tDl7LRzGsD1EazHFV5J3MezD+u4ll687oj7VIFysKbjN2IEmCOMnCZzYso2Mt2AdYlajCFwdoMFLQZBLAWBlizgZImnVisUUd5o4aKBg2V9fSq6jVEaulF12vEYpLB0u4uRJEirkpKBosJBluWoDqMR1YqFyVlmigazqVzEyiak8CPp5/C9K4x8x1mi7MPsIQJNH2oYcnRFIGMm81ZF92wyLFUSRHloOUxsaZNqcGG6dD57GGNbzAbni2+jx7W5fXKh4WLftCUIyr38xSzuzlKETi4yXxTnytwCIOvmyKKRrNNKaLYxbHXnQer8awMIJFDeBGjO50Mm5RgMnVlQOmb3t2I0o+oeBELtgkGUxrNqpveP3ApwPWcv9FseaxSBDBvDRZqM1HQSq+w1UC4xUBRs47iFgJZaZPOAGMWq9clg1XVaois1xBZn0a0VkkR17jLRuPqPNjKJNVgEmBJRJbQq1yUQOXChJsmzndZ7LzHRlCzNInPT5yV1FDE2QcYAHyctrHyeBqLWbrPaDIfEy56t9Gsuuhp0Y3bZJ53lBfdKHsQZw17BY7H+P7yo34GG6SzsNOG3OWi9xywcA8vFqUTRZQi3iQ2+LKD49pePq4nVURvH+wyXpc9Wg0W9zSaIRvNVTu9PkQ5E7bDK3R4GOx1v+HX50V8xZciqrsRpU1qFAbz26UEwDooRQy1GwgxgwmAFTfrKG42UNKkAKyBWKyyXkNlnYYqfpH1aUSYwaLr0oitS1ENtobSRC+DEXtJBlvqr8MIYBULEiifn0DF/ATyZyYQmjmC3WOzFuB0kRuAAcCRERuLj6ax5GhKpokZ6eHxLADz7ELUfCkisZdQEGcedm+ASaOvekHlkMkKoiU3+P4f3/4SJl/hoKcajBVEUYPJGTAXYHIWbJ+Q6Gkfx8Xd3hSR1gUIN72ylz6Lk8OTIio1WIlPRQxvE+MqwuzrfAPAbBdkgsGy9cEkg5luH0wROSTAWg0UthHAws0GA0xHSROliGUNBLKKeg2VdboEWaQ2TWniOg3RdX4WU2owVapfznUYz4VFliRQtUgBGMv1hbMS+N9HRrC5e0wP7Y0WuQMYABw8YWHJ0RSWHcsOsOW8B1Hd5ivSw4VyVEXzpIgk02dLEfWMIw9yyHLIwv1DlrRJ/ZYZ7M4BYrBbByx20FtkkZI9MO6D9SgA2+fapS7bJ7yI8GyUmqzI9LHdrsAR2emQk+OdzEZzOa9tK31LcXIIF8d2ZZpZtUq95htXyVaDebZKZfMiKuy1iRVEqSJyitjupomFLVSHhZspTSxp0lHSKFhMozqsnsBFACNwRdanEVnHdRi7OGIMrviTaY+KKNLEmDLZHFmSRGQxg4xrsPDsBH7+6AjWbhvzhvJokVuAAcDBEyaWHktj4ZHMGmyZ8vyrAhYec5fdzFOcHJLBWJ5/XPEhzjisexhMKohDlivTHxD7D12J/jYxYCk8iL1eBrtaehFdBfEy0Qfbq6zM3qNMNPPAZdxn9o2oIodoNL+VncEy+mCqguibByt4BVnc9CJFPJ2TQ+mDbXS9iKQiKgBrNRFqZRYTDNZEr6RJR6mPwSrqWU1UAeaX6T0gI6k+zgwm3ByCwaJL2NGxKInIogTCcxI4//cjWP1azsAFnAsAA4BDpyysPJ7GvOFUJsBGuQXm7qLX+ZIlyfSzh3XMOqJlOVWke/tgyprsBwYteVzPXTDKFikBMOFBFE1mCTDBYA5dUlEbzVKmhyJygHdyOBJgUZ+bXl3bJsdV2M1RoqxuU2swIdG7Ozmy1GD+ZrOYaM7qph9tXEVhLwkwShFDLQYKWhhgQuhoMlDS6AKsrEFDeb0uWayqLo2qWrUGozQxtoYApm71ja/iftgKBtlyZX0AK4nRJQmEZidw/uMjaHgzp+ACzhWAAWSnavpAw5zhFJYHBsKPAAALkUlEQVQLgCmbfD23mNVlo55jD+4+RM+hcz4V++hhA48c1t1dHArA7h+0cN8BwWA27h6gLVLUA3OP7F3fa2MqixzXcaP56v3EYldKkcNVEeXKNnZzqF7EuGdtm5Oxtq3ibZbqBcB2eM2+Jdu9W6UKeSbMNfsqS2+2KuzlXzzqmQezXTdHNquUdHIwyNpNAlebgVCLiQIBsmYDRc0GipooTSxtMAhk9QywOkXoYCWR6i8N0bVpRNcKkImhy7RH6IivcIWO6NKEtEz9+okEiuYm8HxPTmouf5w7AAOApOXgpc90LDyaxvwjaaUHlrlsVKSI84/ovIuDwcXsNZOPnHtOxY5Sg00bUnbQ8wbfu5U1AbcOqAfOBYM5rsghGs2cIl6hjqvscY8+uDI998Ey5sG8E83lPpGjTLDXDt/xB5XFtilS/WtKk3krsgBMmWgWLKbeCfPL9BJgCnspNVio1ctiRU06ipt0FDODlTYQi1U0qABTGIwFjmwih3R0rEwRuFakpJoYW5ZEyYIkLpw5ghtqkzjw57PWSP6mOLcAJuLACQv17+uYdTiFBUfTnnUBnmU3Sh9MLLsREr08tscq4gz2Ij5y2F+DWXIXouqiv3uA1wQcIB+iOBEr1wQwwK71AMzBFX4vIqeIFylr21Qnhzi855loVg/wiUbz265Mr6aIXrOv450He83tgZHQ4R9V8U01P2f7vIhKiuiR6bnJLBgsC8DCzQbCTbo3TWSAlde7QkdVbdplMK7BolyDxTlF9Ndg8RX0BINdOIuuqcx/UcOJ5Fntc31TnJsAA4Ck6WD7FwaWHktj5uE0Fh9VjL7HlEFLuc1Xw5xhzb3FfNhlMU8NdkiX6aG8Yjkk7i+bksHu4iHL2wd8a9p4TEWqiGqjWSy88cyDUR/sYumo92/2dZTd9N5RlUpFQZSN5reQdTe9UBEFyGhlgA9g/nGVrCKHf2WAkiJmazS3W5wimm6K2EwpYrjJZTEJsHpKEyu4F1YpUsRatkytc9PD+Nq0u1VK1mA0shJfkULpoiQueCKB21tT2HXsnGEtNc5dgIn4LG3jtS9MLD9OPa7Zw6QYylEVtQZTUkTVhygZ7JDqpjflJctpLHLcy0f25IE90WgesHDzgDWKiugoVinbnQfbp5h9lTqMGIwnmsV1FXUe7Bvc9BnXVbgGK/LMgnEN9ioQepWnmV9Gptk3owZTAeazSnnMvv4+mJkJsBYFYI06ShpcgJVzilgha7C0p9kc8zGYXJ29MomypSmEFyZQtCCBqfUpPNdrInVOlFtZ49wHmIi/6g7e+MLE+vcpJXx0KI3fH0pj9hHXTT/niEY9sCNCpjckg81QvIiP8ME9UYO5J2K5B3aA/zzoAuyWfgs39ZKKOFVtNPeKXfRqH0wFGNy1baL+4l5YfLeTNUWs9KWIGccfdngvXIbfcNwnU0RmsFeV9NCzeNRnlZIpoo/BnlIAJmT6DdlSREoPQ9kYrFH3pogegHGKWOtTEdemeKo5hfLlKVw4P4kL5yURX5XEvRs0/PGAiRNnxxH/XWL8AEyEYQNDp2y89JmJhg9Ion94UMPvhjTMOKTjsUMaHhfnYhUVkQYtdTxySMfDPKYyjbdJPSCuWSr3mEU/TKzKJpHDwg29Fq7r9Ts5+B7YfjdFFD5EsbLt4u5sG6UcPh/LjeZdmRK9qL/8Er1YFUAM5sitvgXb3MMPIZ4FC211kP+Kg/yXHeT/0UH+Sw7yX7KR/6KD/Bds5D/vIP85G/nPOch/1kb+0/y22MjfYtHbZCN/o4X8DRbyu0x6nSby2/m1mchvNZCvqIgCYEVNOoobdJTU6yit10iqryWAVdZSilhVq6FibRrlq9MoWZVG4fIUfrkwhV8uSGLKuhTu36xh3VsG+j8asw1QYxHjD2Bq6LaDPydt9J6gNHLDX0yse9/A4mPEYAQmHQ8P0RMTzA8NuX2w6cJRz4bf3yoWqVv7Sdi4vs/GtT0WrumxcFWPhSv327h8v3Br2Lhkr42L99m4aK+Nmr02avZQGljdTXsPo7sdRN5ll8YuB5U7HZTvdFC+EyjbBZS+46DkbaD4baDobSD8Fr2CHUBoBxB6E8jfDvz6DfrzV28Av3oduHAbcOFrwC+3Ab98DbjgVQcXbHVw/lbgvFeA8192cN4f6U16CZj0ooNJLziY9LyNSc87mPSsg0nP2pj0jI1JT/HbYmPSZhuTNtmYtNHCpA38Ovm1W5jUZtJrNTGpmV+TgUmNJs5rMHB+g4EL6nX8ql7Hr+p05NfpCNXpCNXqKFivoXCdhrB4qzUUrdZQvJrWBlzVrOHOTTpmvqyjcZeJ14ctDH82rkClxsk8AKdy/RXfV9gAUhZtFf5Kd/CF5uDztI3PUpZ8n4s/0/Tfn6csfJa08GnSxCdJEx8nLXyctPCXpIW/JCx8pLw/+96H4s8R+u8PRyx8MOL+qb731XfK+947zfuTeCf5qf/N77jy5/ETp3l/O4P39SjvK/8z3ffX7O9PyntPfV+KPy2896WFD76y8eHXDj454eDLEQcjGsZqV/zZjpN5AL7M9VcEEcQEjS/zAHyS668IIogJGp/kAfg0118RRBATND7NA/Bhrr8iiCAmaHyQB+BYrr8iiCAmaBzLA3A8118RRBATNI7nATic668IIogJGofyAPTl+iuCCGKCRl8egN25/ooggpigsTsPwPZcf0UQQUzQ2J4H4KVcf0UQQUzQeCkPQGeuvyKIICZodOYBWJfrrwgiiAkaa/MAzM/1VwQRxASN+XkApuX6K4IIYoLGtDwAV+f6K4IIYoLG1XkASnP9FUEEMUGjNA/AL3L9FUEEMUHjF3kA/gPBVHMQQXzf8SWA/8gD8AMAe3P8MUEEMdFiL4Af5OXl5eUB2JjrrwkiiAkWG/NEAJid668JIogJFrNVgP0m118TRBATLK5VAfZTjOMFpEEEcY7FSQA/VQH2TwB6c/xRQQQxUaIXwD/lqQGgJccfFUQQEyVa8vwB4Jpcf1UQQUyQuCYbwP4FwF9z/WVBBDHO4ysA/5IBMAZZMHwZRBDfLbqygosBFsv11wURxDiP6OkA9kMAf8r1FwYRxDiN9wH8cFSAMcj+kOuvDCKIcRp/OC24GGA/AnAixx8aRBDjLU4A+NE3AoxBVpvrrw0iiHEWtWcELgbY/wDQcv3FQQQxTkID8JMzBhiDbG2uvzqIIMZJrP1W4GKA/RuAz3P95UEEcY7H5wD+7VsDjEF2R66/PoggzvG44+8ClwKyHbn+GwQRxDkaO74TuBhgPwaQyPXfJIggzrEYAfDj7wwwBtmduf7bBBHEORZ3fS/gUkDWmOu/URBBnCPR8b2CiwH2QwTnZoMI4iCA//e9A4xB9iMAH+T0rxdEELmLD3GmdqjvALJfAziV479oEEGc7TgFIH9MwaWALITAEBzEP06cABA6K+BSQBYG8EWO/+JBBDHW8QWA8FkFlwKyQgAf5fgfIIggxio+AlCYE3ApIPtvBOpiEBMv+vB9NZK/awD4ZwAdOf4HCSKI7ys6AfxzrnGVEQDuQyB+BDF+4wSAe3ONo9MGgJ8jMAgHMf5iB4Cf5xo/ZxwA7gbwaW7/zYII4hvjUwB35xovf1eAhjYXI7jcEsS5FydBv5t/37DkuRQAfgZapBNMSAeR6/gc9Lv4s1zj4nsPAP8F4AkAwzn9Jw7iHzGGQb97/5VrHIx5APhX0JruTtA19iCCGIv4EvQ7FgPwr7n+vc9JgK66XAqgAXSZ/evc/TyCGOfxN9DvUAPodyr7lZN/5ADwvwCmApgF+n+fdwF8nKufWBDnbHwMYDeALtDvynUYTzL7uRIAfgDg3wFMAlAK4CoA0wAsAO1u7ATwIoA3+R+8H5RvHwVwnH8QnwD4C+h208ng5fR9xT+LT/hnc5x/VsP8s9vNP8sX+We7ln/W0/hnXwr6Xfh3AD/I9e/nN8X/Bwup6G0kq0raAAAAAElFTkSuQmCC"
,width:"100px",height:"100px"},signInLabel:"Auth.Title.SignInToICloud".loc()}}.property(),_maxNumberOfRetries:1,_numberOfRetries:0,isRepairStarted:function(e,t){return t!==undefined&&(this._isRepairStarted=t),this._isRepairStarted}.property("_isRepairStarted"),show:function(e,t){this.set("_pane",e),this.set("_url",t),this.set("isShowing",YES),this._loadURLInFrameWithTimeout(t)},destroy:function(){this._pane.remove(),this.set("_pane",null),this.set("_url",null),this.set("isShowing",NO),this._failureTimer&&this._failureTimer.invalidate(),arguments.callee.base.apply(this,arguments)},_authLoginCompleted:function(e,t,n,r){var i=CloudOS.statechart;if(!e)i.sendAction("loginFailed"),this.get("_paneContentView").shakeAuthFrame();else if(!t)this.get("isRepairStarted")?(SC.debug("Repair Failed"),i.sendAction("repairFailed")):(SC.debug("No dsWebAuthToken found"),i.sendAction("authDidNotConnect","loginDidFail - No dsWebAuthToken"));else if(e){var s={dsWebAuthToken:t};n&&(s.trustToken=n),r&&(s.accountCountryCode=r),i.sendAction("loginCompleted",s)}this._removePane()},_loadURLInFrameWithTimeout:function(e){var t=CloudOS.APPLE_AUTH_WIDGET_READY_TIMEOUT,n;try{n=URI.parse(e)}catch(r){throw r.message="Failed to parse the Apple Auth widget URL:\n"+r.message,r}this._flowOrigin=n.protocol+"://"+n.hostname,this._frameHasCalledReady=NO;var i=this.get("_pane"),s=this.get("_paneContentView"),o=i.get("childViews"),u=COS.statsController;i.set("authWidgetFrame",s),this.clearMessagesReceived(),this.get("_numberOfRetries")===0&&u.beginStat("cloudos","AuthWidget_TotalLoadTime"),u.beginStat("cloudos","AuthWidget_Loading_Successful"
),u.beginStat("cloudos","AuthWidget_Loading_Failed"),i.insertBefore(s,o&&o.objectAt(0)),this.invokeLast(function(){s.show(this._generateURL(e))}),SC.debug("Starting timer to track time taken by auth widget to load. Attempt Number %@",this.get("_numberOfRetries")+1),this._failureTimer=this.invokeLater(this._didFailToLoad,t)},_recordAuthLoadStats:function(){var e=SC.getCurrentTimeForPerformance()-SC.benchmarkPreloadEvents.headStart,t={renderDuration:e},n=window.screen,r,i=COS.statsController;i.cancelStat("cloudos","AuthWidget_Loading_Failed"),i.endStat("cloudos","AuthWidget_Loading_Successful",{retryAttemptNumber:this.get("_numberOfRetries")},{durationKeyName:"widgetLoadDuration",includeLocationAndLocale:YES}),i.endStat("cloudos","AuthWidget_TotalLoadTime",{retryAttempts:this.get("_numberOfRetries"),loadSuccessful:YES},{durationKeyName:"widgetLoadDuration",includeLocationAndLocale:YES});for(r in n)t["screen_"+r]=n[r];t.innerHeight=window.innerHeight,t.innerWidth=window.innerWidth,t.outerHeight=window.outerHeight,t.outerWidth=window.outerWidth,i.recordLocationStat("cloudos","DisplayLogin",t)},_didLoad:function(){var e=CW.getUrlParameters().retryWidgetLoginAttempts,t=this.get("_numberOfRetries"),n=this.get("_maxNumberOfRetries");if(e&&t<e&&e<=n)return;this._recordAuthLoadStats(),this._frameHasCalledReady=YES,this._failureTimer.invalidate(),CloudOS.workspaceController.hideCentralSpinner(function(){var e=CloudOS.authController,t=this.get("_paneContentView");t.animate("opacity",1,200,{onstop:function(){this.view.set("isLoaded",!0)}}),e.set("isAuthWidgetLoaded",YES),CloudOS.statechart
.sendAction("appleWidgetLoaded"),CloudOSBootstrap.isOnSupportedMobile||CW.notificationCenter.postNotification("springboardMayProceed"),e.clearUserState()}.bind(this))},_didFailToLoad:function(){if(this._frameHasCalledReady)return;SC.debug("Auth Widget failed to load"),this._retryReloadWidget()},_retryReloadWidget:function(){var e=this.get("_maxNumberOfRetries"),t=this.get("_numberOfRetries"),n=this.get("_pane"),r=COS.statsController;if(!n){SC.debug("Pane has already been removed.");return}r.cancelStat("cloudos","AuthWidget_Loading_Successful"),r.endStat("cloudos","AuthWidget_Loading_Failed",{retryAttempts:t,messagesReceivedFromIframe:this._messagesReceived.toString()},"widgetLoadDuration",YES),t===e?(r.endStat("cloudos","AuthWidget_TotalLoadTime",{retryAttempts:t,loadSuccessful:NO},{durationKeyName:"widgetLoadDuration",includeLocationAndLocale:YES}),SC.debug("Failed to load Auth Widget even after %@ retries",t),this._resetPaneContentView(n,YES),CloudOS.statechart.sendAction("appleAuthPaneFailedToLoad")):(t++,this.set("_numberOfRetries",t),SC.debug("Retrying to load the Auth Widget with attempt number %@",t+1),r.recordLocationStat("cloudos","AuthWidget_Retry_Loading_Started",{retryAttemptNumber:t}),this._resetPaneContentView(n),this.show(n,this.get("_url")))},_resetPaneContentView:function(e,t){var n=this.get("_paneContentView");e.removeChild(n),e.set("authWidgetFrame",null),this.resetContentView(),n.destroy(),this._failureTimer.invalidate(),t&&this.destroy()},_clearState:function(){this.set("isRepairStarted",NO)},_rpcMethodHandlers:{ready:function(e){e(YES)},config:function(
e){var t,n,r,i=CloudOS.authController.get("trustTokens");try{n=URI.parse(CloudOS.initializationController.get("accountLoginUrl")),r=URI.parseQuery(n.query).widgetKey}catch(s){CW.fatalError("No serviceKey to load the Apple Auth Widget.")}if(r){t={data:this.get("configUI")};var o=this.get("hideRememberMe");t.data.features={createLink:NO,rememberMe:!o};var u=t.data;u.rememberMeLabel="keep-me-signed-in",u.theme="lite",u.serviceKey=r,u.trustTokens=i,u.defaultAccountNameAutoFillDomain="icloud.com",e(t),this.invokeLater(this._didLoad,40)}else CW.fatalError("No serviceKey to load the Apple Auth Widget.")},passwordAuthDone:function(e,t,n){var r,i,s,o=this,u=CloudOS.get("authPane"),a=CloudOS.authController,f=COS.statsController;e(YES),n&&(r=n.rememberMe,i=n.dsWebAuthToken||n.session,s=n.accountType,accountCountryCode=n.accountCountry),a.set("loginAttempts",a.get("loginAttempts")+1);if(t){if(this.get("isRepairStarted"))return;if(s){var l=s.toLowerCase();f.recordLocationStat("cloudos","AuthWidget_AccountType",{accountType:s}),(l.indexOf("hsa")===0||l==="managed")&&this._pane.hideAuthPaneAndShowSpinner(function(){t&&a.set("isExtendedLogin",r),this._authLoginCompleted(t,i,null,accountCountryCode)}.bind(this),!0)}else SC.warn("No accountType value received from the widget")}else this._authLoginCompleted(t,i)},repairDidStart:function(e){var t=COS.statsController;this.set("isRepairStarted",YES),t.recordLocationStat("cloudos","AuthWidget_Repair_Started"),t.beginStat("cloudos","AuthWidget_Repair"),CloudOS.statechart.sendAction("repairStarted"),e(YES)},authDidCancel:function(e){var t=COS.statsController
,n=CloudOS.statechart;this.get("isRepairStarted")?(t.cancelStat("cloudos","AuthWidget_Repair"),t.recordLocationStat("cloudos","AuthWidget_Repair_Cancelled"),n.sendAction("repairDidCancel")):(t.recordLocationStat("cloudos","AuthWidget_Login_Cancelled"),n.sendAction("authDidCancel")),this._clearState(),e(YES)},complete:function(e,t){e(YES),this.get("isRepairStarted")&&COS.statsController.endStat("cloudos","AuthWidget_Repair",null,{durationKeyName:"duration",includeLocationAndLocale:YES});var n=CloudOS.authController,r,i,s,o;t&&(r=t.rememberMe,i=t.session,s=t.trustToken,o=t.accountCountry),n.set("userAuthenticationState",CK.AuthenticationStateEnum.AUTHENTICATED),n.set("isExtendedLogin",r),this._clearState(),this._pane.remove(function(){CloudOS.workspaceController.showCentralSpinner(function(){this._authLoginCompleted(YES,i,s,o)}.bind(this))}.bind(this))},authFailedToLoad:function(e){e(YES),this._didFailToLoad()},authWidgetWillChangeFlow:function(e,t){if(t&&t.to){var n=t.to;SC.debug("Auth UI flow is changing to -> '%@'",n),n==="INTERSTITIAL"&&this.set("isFederatedFlowUIStarted",YES),n==="SIGNIN"&&this.set("isFederatedFlowUIStarted",NO)}e(YES)},authWidgetDidChangeFlow:function(e,t){if(t&&t.to){var n=t.to;SC.debug("Auth UI flow has changed to -> '%@'",n)}e(YES)}}}),CloudOS.AppleIDWidgetFrameView=SC.View.extend({classNames:["apple-id-frame","iframe-pane"],adjustablePane:null,show:function(e){this._url=e},getFrame:function(){return this.getPath("_iframeView.layer")},paneDidShow:function(){var e=this.get("childViews"),t;if(e.length>0)return;t=this._iframeView=this.createChildView(CloudOS
.iFrameView,{src:this._url,toString:function(){return"CloudOS.AppleIDWidgetFrameView"}}),this.insertBefore(t,e&&e.objectAt(0))},paneDidHide:function(){var e=this._iframeView;e&&e.destroy()},_url:null,_iframeView:null}),CloudOS.APPLE_ID_WIDGET_READY_TIMEOUT=3e4,CloudOS.APPLE_ID_WIDGET_POST_MESSAGE_PREFIX="AppleID.",CloudOS.APPLE_ID_WIDGET_EXIT_REASON_NO_REPAIR_NEEDED=1,CloudOS.APPLE_ID_WIDGET_EXIT_REASON_TIMEOUT=2,CloudOS.APPLE_ID_WIDGET_BUTTON_INDEX_TO_PROPERTY_MAP=["rightButton","middleButton","leftButton"],CloudOS.AppleCreateWidgetController=SC.Object.extend(CloudOS.AppleWidgetCommonMethods,{_contentViewClass:CloudOS.AppleIDWidgetFrameView,prefix:CloudOS.APPLE_ID_WIDGET_POST_MESSAGE_PREFIX,minWidth:400,minHeight:200,configPayload:null,show:function(e,t,n){this.set("_pane",e),this.set("_url",t),n&&this._storeConfigPayload(n),this._loadURLInFrameWithTimeout(t)},_generateURL:function(e,t){t=e(t);var n=window.URI(t);return n.addQuery("v","2"),n.toString()}.enhance(),_loadURLInFrameWithTimeout:function(e){var t=CloudOS.APPLE_ID_WIDGET_READY_TIMEOUT,n=COS.statsController,r,i,s;try{r=URI.parse(e)}catch(o){throw o.message="Failed to parse the Apple ID widget URL:\n"+o.message,o}this._flowOrigin=r.protocol+"://"+r.hostname,this._frameHasCalledReady=NO,i=this.get("_pane"),i.set("isLoading",YES),i.set("maxWidth",i.constructor.prototype.maxWidth),i.set("maxHeight",i.constructor.prototype.maxHeight),s=this.get("_paneContentView"),s.set("adjustablePane",i),i.set("paneContentView",s),i.set("delegate",s),n.beginStat("cloudos","AppleID_CreateWidget_Loading_Successful"),n.beginStat("cloudos"
,"AppleID_CreateWidget_Loading_Failed"),i.show(this._generateURL(e)),SC.debug("Starting timer to track time taken by create widget to load."),this._failureTimer=this.invokeLater(this._didFailToLoad,t)},_didLoad:function(){var e=COS.statsController;this._frameHasCalledReady=YES,this.setPath("_pane.isLoading",NO),e.cancelStat("cloudos","AppleID_CreateWidget_Loading_Failed"),e.endStat("cloudos","AppleID_CreateWidget_Loading_Successful")},_didFailToLoad:function(){if(this._frameHasCalledReady)return;var e=COS.statsController;SC.debug("Create Widget failed to load"),CloudOS.statechart.sendAction("appleIDPaneFailedToLoad"),e.cancelStat("cloudos","AppleID_CreateWidget_Loading_Successful"),e.endStat("cloudos","AppleID_CreateWidget_Loading_Failed")},_storeConfigPayload:function(e){var t={language:CK.getCurrentLocaleInISOFormat(),customAlerts:!0};SC.mixin(t,e),this.set("configPayload",t)},_alertsByGUID:{},_createAlertForAppleIdWidget:function(e){var t={message:e.title,description:e.description},n=CloudOS.APPLE_ID_WIDGET_BUTTON_INDEX_TO_PROPERTY_MAP,r=e.buttons;for(var i=0,s=r.length;i<s;i++){var o=r[i],u=n[i];o&&u&&(t[u]={title:o,index:i,action:e.action.bind(null,i,o)})}var a=CW.Alert.create(t);return this._alertsByGUID[SC.guidFor(a)]=a,a.append(),a},_updateAlertForAppleIdWidget:function(e,t){var n=this._alertsByGUID[e];if(!n)return NO;var r=t.title;typeof r=="string"&&n.setPath("contentView.messageView.value",r);var i=t.description;return typeof i=="string"&&n.setPath("contentView.descriptionView.value",i),YES},_hideAlertForAppleIdWidget:function(e){var t=this._alertsByGUID[e];return!
t||typeof t.remove!="function"?NO:(t.remove(),YES)},_getAlertVisibilityForAppleIdWidget:function(e){var t=this._alertsByGUID[e];return t?t.get("isVisibleInWindow"):NO},_handleExitContext:function(e){var t="Alert.";CloudOS.authController.get("repairPayload")?t+="UpdateAppleID.":t+="CreateAppleID.";var n=e&&e.exitReason;n===CloudOS.APPLE_ID_WIDGET_EXIT_REASON_TIMEOUT?t+="SessionTimedOut.":t+="CouldNotLoad.";var r=this._createAlertForAppleIdWidget({title:(t+"Title").loc(),description:(t+"Description").loc(),buttons:["Button.OK".loc()],action:function(e){r.remove()}});r.append()},_rpcMethodHandlers:{ready:function(e){this._didLoad(),e(YES)},getConfig:function(e){e(this.get("configPayload"))},completed:function(e,t){var n=CloudOS.statechart;e(YES),typeof t=="boolean"&&!t?n.sendAction("appleIDPaneExitedForError"):n.sendAction("appleIDPaneCompletedWithPayload",t),this._removePane()},createAlert:function(e,t){var n=this,r=this._createAlertForAppleIdWidget({title:t.title,description:t.description,buttons:t.buttons,action:function(e,t){n._sendAppleIdWidgetMessage({jsonrpc:"2.0",id:null,method:"alertButtonClicked",params:[SC.guidFor(r),e,t]}),r.remove()}});e(SC.guidFor(r))},updateAlert:function(e,t,n){e(this._updateAlertForAppleIdWidget(t,n))},hideAlert:function(e,t){e(this._hideAlertForAppleIdWidget(t))},isAlertVisible:function(e,t){e(this._getAlertVisibilityForAppleIDWidget(t))},exit:function(e,t){this._removePane(),CloudOS.statechart.sendAction("appleIDPaneExited"),t&&t.error?this._handleExitContext(t):e(YES)},passwordChanged:function(e){CloudOS.statechart.sendAction("appleIDPaneExitedForPasswordChange"
),e(YES)},resize:function(e,t){if(t&&SC.typeOf(t)===SC.T_HASH){var n=this.get("_pane"),r=t.width;typeof r!="undefined"&&n.set("maxWidth",r===null?null:Math.max(this.get("minWidth"),r));var i=t.height;typeof i!="undefined"&&n.set("maxHeight",i===null?null:Math.max(this.get("minHeight"),i))}e(YES)}}}),CloudOS.workspaceController=SC.Object.create({init:function(){arguments.callee.base.apply(this,arguments),CW.notificationCenter.subscribeToNotification("authBadgeDidHide",this,"authBadgeDidHide"),CW.notificationCenter.subscribeToNotification("authBadgeDidAnimate",this,"authBadgeDidAnimate"),CW.notificationCenter.subscribeToNotification("authPaneWasInitialized",this,"authPaneWasInitialized"),CW.notificationCenter.subscribeToNotification("accountPrefsChanged",this,"accountPrefsChanged"),CW.notificationCenter.subscribeToNotification("environmentDidChange",this,"environmentDidChange")},nowShowing:CloudOS.NOWHERE,applicationIsFullwindow:NO,applicationIsOnscreen:NO,_envSashPane:null,layoutChanger:function(){var e=this.get("applicationIsFullwindow"),t=this.get("applicationIsOnscreen"),n=!e&&(!this._usingMin||!t);this._usingMin!==(this._usingMin=n)&&CW.notificationCenter.postNotification(n?"activateMinimumSize":"deactivateMinimumSize")}.observes("applicationIsOnscreen","applicationIsFullwindow"),_usingMin:YES,updateTitle:function(){var e=CloudOS.appController.get("currentApp"),t=e?e.get("name"):null,n=e?e.get("titleName"):null,r=e?e.get("title"):null,i;return!e||!e.get("isActive")?CK.get("isBeta")?i="TitleBar.Beta".loc():i="TitleBar.Production".loc():r?i=r:n?i=n:i=("AppTitleBar."+t).loc(
),this.set("title",i),i}.observes("CloudOS.appController*currentApp.title","CloudOS.appController*currentApp.isActive"),updateHash:function(){var e=CloudOS.appController.get("currentApp"),t=CloudOS.getShareDetailsFromUrl();if(!e&&t)return;if(e&&!e.get("isActive"))return;this.set("hash",e?e.get("locationHash"):this.retainedHash())}.observes("CloudOS.appController*currentApp","CloudOS.appController*currentApp.route","CloudOS.appController*currentApp.isActive"),clearHash:function(){this.beginPropertyChanges(),this.set("hash",this.retainedHash()),this.notifyPropertyChange("hash"),this.endPropertyChanges()},retainedHash:function(){var e=COS.getCredentialsFromHash();return e?":"+URI.buildQuery({username:e.username,password:e.password}):""},title:null,titleDidChange:function(){window.document.title=this.get("title")}.observes("title"),hash:null,hashDidChange:function(){var e=this.get("hash"),t=CloudOS.appController.get("currentApp");window.location.hash!=="#"+e&&(window.location.hash=e)}.observes("hash"),showCentralSpinner:function(e,t){window._showRHTMLSpinner&&window._showRHTMLSpinner(e)},hideCentralSpinner:function(e,t){window._hideRHTMLSpinner&&window._hideRHTMLSpinner(e,t)},set:function(e,t){if(e==="nowShowing"){this.beginPropertyChanges();var n=arguments.callee.base.apply(this,arguments);return this.chooseDelayFromNowShowing(),this.endPropertyChanges(),n}return arguments.callee.base.apply(this,arguments)},chooseDelayFromNowShowing:function(){var e=this.get("nowShowing"),t=this._previousNowShowing;this._previousNowShowing=e,COS.nextShowDelayTime=this.get("nowShowingDelays")[t||0
][e||0]},nowShowingDelays:[[0,0,0,500,500,0],[0,0,0,500,500,0],[0,0,0,0,500,0],[0,0,500,0,0,0],[0,0,500,0,0,0],[0,0,500,0,0,0]],accountSignoutHelpProtrusion:0,checkZoomLevel:function(){var e=this._zoomLevelAlert,t=this.isZoomed();t&&!e?this._createZoomLevelAlert():!t&&e&&(e.remove(),this._zoomLevelAlert=null)},isZoomed:function(){var e=NO,t=1;if(SC.browser.webkit){window.devicePixelRatio&&(t=window.devicePixelRatio);var n=(window.outerWidth*t-8)/window.innerWidth;if(n<=.92||n>1.1)e=YES}else SC.browser.msie&&screen.deviceXDPI/screen.logicalXDPI!==1&&(e=YES);return e},_createZoomLevelAlert:function(){return this._zoomLevelAlert?this._zoomLevelAlert:(this._zoomLevelAlert=CW.Alert.show({message:"ZoomLevel.Title".loc(),description:"ZoomLevel.Description".loc(),rightButton:"Button.OK".loc()}),this._zoomLevelAlert)},resize:function(){},environmentDidChange:function(e){this.createSash(e),this.setCurrentAppPropertyOnWindow()},createSash:function(e){var t=CloudOS.EXCLUDE_SASH_FOR_ENVS;!this._envSashPane&&CloudOS.EnvironmentSashPane&&(!t.contains(e)||CK.get("isCarry"))&&!CW.getUrlParameters().suppressEnvironmentSash&&(this._envSashPane=CloudOS.EnvironmentSashPane.create().append())},setCurrentAppPropertyOnWindow:function(){Object.defineProperty&&(CloudOS.getEnvironment()!=="PROD"||!SC.browser.isSafari)&&Object.defineProperty(window,"currentApp",{configurable:!0,get:function(){return CloudOS.appController.getPath("currentApp.contentWindow")}})},authBadgeDidHide:function(){if(!CloudOS.get("isCloudOSMini"))return;var e=CloudOS.appController.get("pendingApp");e&&(this._sleptApp=e,e.sleep()
)},authBadgeDidAnimate:function(){this.invokeLater(function(){this._sleptApp&&(this._sleptApp.wake(),this._sleptApp=null)},300)},authPaneWasInitialized:function(e){e.beginPropertyChanges(),e.bind("nowShowing","CloudOS.workspaceController.nowShowing"),e.set("displayKey",CloudOS.AUTH),e.endPropertyChanges()},accountPrefsChanged:function(e,t){var n;e!==t&&(CloudOS.blockUserInput(),n=YES);var r=CloudOS.moduleLocalizer.setLocale(),i=this._envSashPane;r?(n||CloudOS.blockUserInput(),i&&i.set("isVisible",NO),CW.notificationCenter.subscribeToNotification("relocalize",this,"_showEnvSash"),SC.Module.loadModule("cloudos_foundation/language",this,"_didReloadLanguageModule")):(n&&CloudOS.unblockUserInput(),CW.notificationCenter.postNotification("relocalize","User Changed Language and maybe we need to reload certain apps."))},_didReloadLanguageModule:function(){CloudOS.localizationController.relocalizeIfNeeded("User Changed Language and Language Loaded"),CloudOS.unblockUserInput(),CloudOS.authController.get("isAuthenticated")&&CloudOS.loadAlarms()},_showEnvSash:function(){this._envSashPane&&this.invokeLater(function(){this._envSashPane.set("isVisible",null)},200)}}),CloudOS.authController=COS.AuthUIController.create({postLoginRedirectUrl:null,hsaUserAction:CloudOS.HSASourceEnum.NONE,delayedTearDownApp:null,delayedTearDownUsed:!1,iCloudLiteSignUp:NO,isAuthWidgetLoaded:NO,isFirstRunLoaded:NO,performedLoginFlow:NO,_appReplacementsCompleted:NO,init:function(){arguments.callee.base.apply(this,arguments),CW.notificationCenter.subscribeToNotification("authModuleDidLoad",this,"authModuleDidLoad"),
CW.notificationCenter.subscribeToNotification("userDidCompleteFirstRun",this,"userDidCompleteFirstRun"),CW.notificationCenter.subscribeToNotification("quotaDataFetched",this,"quotaDataFetched"),CW.notificationCenter.subscribeToNotification("accountPreferencesLoaded",this,"accountPreferencesLoaded")},windowWillClose:function(){CloudOS.appController.applicationWillClose(),arguments.callee.base.apply(this,arguments)},loginDidFail:function(){CloudOS.appController.reset(),arguments.callee.base.apply(this,arguments)},customLoginBody:function(){var e={},t=CloudOS.appController.getDefaultAppName();return t&&(e.appName=t),e}.property(),accountPreferencesLoaded:function(){this.redirectToPostLoginRedirectUrl()},redirectToPostLoginRedirectUrl:function(){var e=!1;return this.shouldUsePostLoginRedirectUrl()&&!this.get("accountRepairRequired")&&(this.get("isPartiallyAuthenticated")?(CloudOS.statechart.sendAction("showHSA",CloudOS.HSASourceEnum.POST_LOGIN_REDIRECT),e=!0):!this.shouldShowFirstRun(this.get("accountPreferences"),CW.getUrlParameters())&&!this.get("isValidatingHsa")&&(CloudOSBootstrap.isTermsAndConditionUrl?this.logoutUser(this.reloadWithPostLoginRedirectUrl.bind(this)):this.reloadWithPostLoginRedirectUrl(),e=!0)),e},reloadWithPostLoginRedirectUrl:function(){CK.reloadWithReason("postLoginRedirectUrl",this.get("postLoginRedirectUrl"))},userHasLoggedIn:function(){var e=CloudOS.appController,t=CloudOS.statechart,n=this._auth_bag.apps,r,i;CloudOS.notificationsController||(CloudOS.notificationsController=CloudOS.NotificationsController.create());var s=function(){var t=this._auth_bag;
this.invokeLast(function(){CW.notificationCenter.unsubscribeFromNotification("appReplacementsCompleted",this,s)});if(t){var n=t.apps;e.replaceApps(n),e.detectAndLoadAdditionalApps(n),CloudOS.appController.get("isAllAppInfoLoaded")?this.removeUnsupportedApps():CW.notificationCenter.subscribeToNotification("receivedInfoForAllDynamicApps",this,"removeUnsupportedApps")}else SC.warn("No auth bag available. We might be in logout mode")}.bind(this);CW.notificationCenter.subscribeToNotification("appReplacementsCompleted",this,s),this.get("accountRepairRequired")||(this.get("isAtLeastPartiallyAuthenticated")&&!this._appReplacementsCompleted&&(this._appReplacementsCompleted=YES,e.setNewReplacementApps(["notes2"]),e.showNotes2AppIfNeeded(n)),this.get("isAuthenticated")&&(CloudOS.appController.notifyPropertyChange("appList"),COS.PushController.initiatePushConnection(CloudOS.notificationsController),CloudOS.notificationsController.getBadgeState(),this.measureLoadPerformance()))},removeUnsupportedApps:function(){var e,t=this._auth_bag.apps,n=CloudOS.appController;for(e in t){var r=CloudOS.getAppInfo(e);r&&(this.getPath("user.isLiteAccount")&&!r.get("supportsLite")&&delete t[e],this.getPath("user.isPrimaryAppleIdTypePhoneNumber")&&!r.get("supportsPhoneNumberBasedAppleId")&&delete t[e])}n.removeOmittedApps(t),n.notifyPropertyChange("appList")},measureLoadPerformance:function(){this.invokeLater(SC.run(function(){var e=this.get("currentDomain"),t=SC.buildMode==="debug"?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/blank.png":"https://%{currentDomain}/blank.png"
.fmt({currentDomain:e});CloudOS.loadImageUrlAndRecordStat(t,"OriginLoad");var n=SC.buildMode==="debug"?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/blank.png":"https://www.%{currentDomain}/blank.png".fmt({currentDomain:e});CloudOS.loadImageUrlAndRecordStat(n,"CDNLoadICloud");var r=SC.buildMode==="debug"?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/blank.png":"https://icloud.cdn-apple.com/blank.png";CloudOS.loadImageUrlAndRecordStat(r,"CDNLoadApple"),CloudOS.reportEdgePerformance()}.bind(this)),5e3)},shouldUsePostLoginRedirectUrl:function(){var e=this.get("postLoginRedirectUrl");if(e){var t=URI(e);if(t.domain()===this.get("currentDomain")&&t.protocol()==="https")return YES}return NO},authModuleDidLoad:function(){CloudOS.workspaceController.hideCentralSpinner(function(){CloudOS.get("isCloudOSMini")?CloudOS.authPane.show():CloudOS.workspaceController.set("nowShowing",CloudOS.AUTH)}.bind(this))},_firstRunViewDidChange:function(){CloudOS.appSwitcherController.hideAppSwitcher()},languageDidLoad:function(){CloudOS.localizationController.relocalizeIfNeeded("Signin Submission Succeeded and Language Loaded"),CloudOS.appController.get("areAllAppReplacementsCompleted")?this.checkIfDefaultAppIsCreated():CW.notificationCenter.subscribeToNotification("appReplacementsCompleted",this,"checkIfDefaultAppIsCreated")},checkIfDefaultAppIsCreated:function(){var e=CloudOS.appController,t=e.getDefaultAppName(),n=e.getDefaultApp(),r=e.getPath("pendingInfoJSONRequests."+t);this.invokeLast(function(){CW.notificationCenter
.unsubscribeFromNotification("appReplacementsCompleted",this,"checkIfDefaultAppIsCreated")}),!n&&t&&COS.apps[t]&&r?CW.notificationCenter.subscribeToNotification("receivedInfoForDynamicApp",this,function(e,n){if(t!==e)return;this.redirectToState()}):this.redirectToState()},redirectToState:function(){var e=CloudOS.appController,t=CloudOS.authController,n=CloudOS.getShareDetailsFromUrl(),r=e.get("currentApp"),i=e.getDefaultAppName(),s=e.getDefaultApp(),o=e.get("pendingApp"),u=e.get("isAllAppInfoLoaded"),a=this.get("hsaChallengeRequired"),f=this.get("isValidatingHsa"),l=this,c=CloudOS.statechart,h="active.springboard",p=CloudOS.isOnSupportedMobile(),d=this.shouldUsePostLoginRedirectUrl(),v=function(){c.gotoState("active.springboard.waitingForApp")};if(t.get("isPartiallyAuthenticated"))!o&&s&&e.set("pendingApp",s),!s||s.get("isLocked")?c.sendEvent("showHSA"):c.gotoState("active.authUI.waitingForApp");else if(t.get("isPartiallyAuthenticatedForManagedAppleId"))!o&&s&&e.set("pendingApp",s),c.gotoState("managedAppleId");else if(CloudOSBootstrap.isTermsAndConditionUrl&&!d)c.sendEvent("gotoShowTermsAndConditionConfirmation");else if(n)CloudOS.handleShareDetails(n);else if(o&&!o.get("isLocked"))c.gotoState(h,null,null,v);else if(!s)c.gotoState(h);else{var m=this.get("user");e.set("pendingApp",s),!m||!a||s.get("canLaunchWithOneFactor")?COS.authController.get("authBagLoadedFromOpenerWindow")?c.gotoState("active.authUI.waitingForApp"):s&&s.get("isPCSKeysDeletedLocked")?c.gotoState(h):p?CloudOS.workspaceController.showCentralSpinner(function(){c.gotoState("active.authUI.waitingForApp")}.bind
(this)):c.gotoState(h,null,null,v):c.gotoState(h)}a||CloudOS.loadAlarms()},userDidCompleteFirstRun:function(){this.userDidAuthenticate()},logoutUser:function(e,t){var n=CloudOS.appController.get("appsNotReadyToTerminate"),r=this;if(!n||!t)return e&&CloudOS.blockUserInput(0),arguments.callee.base.apply(this,arguments);var i=n.pop(),s=i.get("displayName");this._unsavedDialog||(this._unsavedDialog=CW.Alert.show({message:"Dialog.UnsavedChanges.Title".loc(),description:"Dialog.UnsavedChanges.Description".loc(s),superClassMethod:arguments.callee.base,superClassMethodDelegate:this,middleButton:{title:"Dialog.UnsavedChanges.DontSignOutButton".loc(),action:"logoutCancelled"},rightButton:{title:"Dialog.UnsavedChanges.SignOutButton".loc(),action:"continueLogout"},logoutCancelled:function(){SC.info("logout is cancelled"),this.remove();return},continueLogout:function(){return this.remove(),e&&CloudOS.blockUserInput(0),this.superClassMethod.apply(this.superClassMethodDelegate,[e,t])},remove:function(){r._unsavedDialog=null,arguments.callee.base.apply(this,arguments)}}))},userDidAuthenticate:function(e){var t=CloudOS.authController,n=CloudOS.appController,r=t._auth_bag,i=t.get("hsaChallengeRequired");this.set("performedLoginFlow",YES),i||CloudOS.moduleLocalizer.setLocale(),CloudOS.authController.setDomainSpecificClassNames(),t.get("isRevalidatingUser")||SC.Module.loadModule("cloudos_foundation/language",this,"languageDidLoad");if(!CloudOS.get("isCloudOSMini"))return;var s=t.get("accountPreferences");CloudOS.passMessageToAllApps("_cloudOSStateChange",{authBag:r,accountPreferences:s?s.prefsHash
():null,appPreferences:COS.prefsController.allAppPreferencesHash()}),t.get("isRevalidatingUser")||(t.get("isAuthenticated")?(this.showTermsNotificationIfRequired(),CloudOS.passMessageToAllApps("userDidAuthenticate",e)):(t.get("isPartiallyAuthenticated")&&CloudOS.passMessageToAllApps("userDidPartiallyAuthenticate",e),this._fromCurrentWindow=e))},userDidNotAuthenticate:function(e){CloudOS.passMessageToAllApps("userDidNotAuthenticate",e)},userDidLogout:function(e){if(!CloudOS.get("isCloudOSMini")){e||(window.location.hash="#:showlogin",CK.reloadWithReason("userDidLogout, fromCurrentWindow: "+e));return}CloudOS.passMessageToAllApps("userDidLogout",e)},redirectPostAuthenticationIfRequired:function(e){var t=window.location.href,n=e.isCarryUser,r=this.shouldUsePostLoginRedirectUrl();if(!r){if(CK.get("isCarry")&&!n)return window.location.href=t.replace("carry.","www."),YES;var i=CW.getUrlParameters(),s=i.carry,o=i.skipCarryRedirect;if(!s&&e&&!e.hsaChallengeRequired&&!this.accountTermsUpdateRequired&&CK.get("isWWW")&&n&&!o)return window.location.href=t.replace("www.","carry."),YES}return NO},validateUserIfNeeded:function(){this.serviceIdentitiesAreMissing()&&(COS.statsController.recordStat("cloudos","ValidatedUserForMissingServiceIdentities"),this.validateUser())},quotaDataFetched:function(e,t){if(!t){SC.warn("No quotaData found to send _cloudOSStateChange and quotaDataDidChange messages");return}CloudOS.passMessageToAllApps("_cloudOSStateChange",{quotaData:t}),CloudOS.passMessageToAllApps("quotaDataDidChange")},showPCSDeletedErrorMessage:function(e){if(!e)return;if(this._lastPCSAlertAppDisplayName===
e){SC.debug("PCS Deleted alert for %@ is already being shown.",e);return}this._lastAlert&&this._lastAlert.remove(),this._lastPCSAlertAppDisplayName=e;var t=this;this._lastAlert=CW.Alert.show({message:"Error.AppPCSDeleted.Title".loc(e),description:"Error.AppPCSDeleted.Description".loc(),rightButton:"Button.OK".loc(),remove:function(){arguments.callee.base.apply(this,arguments),t._lastAlert=null,t._lastPCSAlertAppDisplayName=null}})},setDomainSpecificClassNames:function(){this.getPath("user.isChineseAccount")&&CloudOSBootstrap.setChinaClassName(!0)}}),CloudOS.autoUpdateController=SC.Object.create({init:function(){return this.createOrReuseAutoUpdateTimer(),arguments.callee.base.apply(this,arguments)},autoUpdateTimer:null,createOrReuseAutoUpdateTimer:function(e){var t=this.get("autoUpdateTimer");if(t){if(!e)return;t.invalidate()}else e||(e=CloudOS.AUTO_UPDATE_INTERVAL);t=SC.Timer.schedule({target:this,action:"checkVersion",interval:e*1e3,repeats:YES}),this.set("autoUpdateTimer",t)},checkVersion:function(e){var t=(new Date).getTime(),n=CW.getUrlParameters(),r=this.get("autoUpdateTimer"),i=r.get("interval"),s=t-CloudOS._lastActivityEpoch,o;if(e!==YES&&this._lastCheck+(i-1e4)>t){SC.info("autoUpdate: Already checked %@ms ago, ignoring",t-this._lastCheck);return}this._lastCheck=t,o=s>CloudOS.AUTO_UPDATE_INACTIVITY_INTERVAL*1e3?CloudOS.AUTO_UPDATE_DELAYED_INTERVAL:CloudOS.AUTO_UPDATE_INTERVAL,o*1e3!==i&&this.createOrReuseAutoUpdateTimer(o);var u=SC.Request.getUrl("https://"+window.location.hostname+"/system/cloudos/current/version.json").json();u.notify(0,this,function(e){if(n.autoUpdate
)return SC.warn("autoUpdate: Will simulate response since autoUpdate flag is set."),this.handleVersionResponse("override",parseInt(n.autoUpdate,10)),YES;if(e.get("status")!==200)return SC.warn("autoUpdate: Could not fetch version.json"),YES;var t=e.get("body"),r,i;return t&&(r=t.buildNumber,i=t.autoUpdate,!SC.none(r)&&!SC.none(i)&&this.handleVersionResponse(r,parseInt(i,10))),YES}),u.send()},handleVersionResponse:function(e,t){if(t===CloudOS.UPDATE_IGNORE){SC.debug("autoUpdate: Update flag for %@ is UPDATE_IGNORE",e);return}if(SC.buildNumber===e){SC.debug("autoUpdate: Running latest build, %@",e);return}var n=CK.getValueFromLocalStorage("didReloadToBuild",YES);if(n===e){SC.warn("autoUpdate: We already reloaded the user to try an update to %@, so will not do it again!",e);return}var r=this;if(t===CloudOS.UPDATE_PROMPT){SC.debug("autoUpdate: Prompt the user to reload to %@",e);if(this._reloadPane&&this._reloadPane.get("isVisibleInWindow")){SC.info("autoUpdate: There is already an auto update alert pane showing, so ignoring request for a second one.");return}var i=CloudOS.authController.get("displayableCurrentDomain");this._reloadPane=CW.Alert.show({message:"AutoUpdate.Title".loc({currentDomain:i}),description:"AutoUpdate.Description".loc(),image:"me-icon-alert-68",rightButton:{title:"AutoUpdate.Reload".loc(),action:function(){r.reloadToBuildNumber(e)}},middleButton:{title:"AutoUpdate.Later".loc(),action:function(){this.get("pane").remove()}}})}t===CloudOS.UPDATE_FORCE&&(SC.debug("autoUpdate: Force the user to reload to %@",e),r.reloadToBuildNumber(e)),t===CloudOS.UPDATE_DELAYED_FORCE&&
(SC.debug("autoUpdate: Delay force the user to reload to %@",e),this.reloadIfAppropriate(e),this.invokeLater(function(){this.reloadToBuildNumber(e)},CloudOS.AUTO_UPDATE_DELAYED_FORCE_WAIT*1e3))},reloadIfAppropriate:function(e){var t=CloudOS._lastActivityEpoch,n=(new Date).getTime()-CloudOS._lastActivityEpoch;!t||n>6e4?this.reloadToBuildNumber(e):this.invokeLater(function(){this.reloadIfAppropriate(e)},6e4)},reloadToBuildNumber:function(e){CK.setValueInLocalStorage("didReloadToBuild",e,YES),CK.reloadWithReason("reloadToBuildNumber "+e)}}),CloudOS.mixin({UPDATE_IGNORE:0,UPDATE_PROMPT:1,UPDATE_FORCE:2,UPDATE_DELAYED_FORCE:3}),CloudOS.SINGLE_LINE_BANNER_HEIGHT=38,CloudOS.MULTI_LINE_BANNER_HEIGHT=58,CloudOS.BANNER_ANIMATION_DURATION=500,CloudOS.bannerManager=SC.Object.create({_bannerHeight:CloudOS.SINGLE_LINE_BANNER_HEIGHT,_currentQuotaBannerShowingType:null,init:function(){arguments.callee.base.apply(this,arguments),CW.notificationCenter.subscribeToNotification("quotaDataFetched",this,"quotaDataFetched"),CW.notificationCenter.subscribeToNotification("relocalize",this,"relocalize")},bannerHeight:function(e,t){return t!==undefined?(this._bannerHeight=t,this._bannerHeight):this.get("isBannerVisible")?this._bannerHeight:0}.property("isBannerVisible"),isBannerVisible:function(){return!!this.get("_currentBanner")}.property("_currentBanner"),_appsBannerHash:{},_currentBanner:null,findBannerToShowForApp:function(e){var t=this._appsBannerHash[e];if(!t||t.length===0)return null;var n=t[0];for(var r=1,i=t.length;r<i;r++)n.get("priority")<=t[r].get("priority")&&(n=t[r]);return n},setAppBanner
:function(e,t){var n=SC.typeOf(e),r=n===SC.T_HASH,i=n===SC.T_NULL;if(!r&&!i){SC.warn("bannerHash provided to setAppBanner function either has to be null or of type Hash.");return}t||(t="CloudOS"),e&&!e.localize&&(e.localize=NO);if(r){var s=this._appsBannerHash[t],o;if(s&&s.length!==0)if(t==="CloudOS")o=CloudOS.CloudOSBannerView.create(e),s.push(o);else{var u=s[0];this.updateBanner(u,e)}else o=CloudOS.CloudOSBannerView.create(e),this._appsBannerHash[t]=[o]}else this.removeBanner(t);this.selectBannerAndShow()},selectBannerAndShow:function(){var e=this.get("_currentBanner"),t=CloudOS.getPath("mainPage.mainPane.bannerContainer"),n=CloudOS.appController.getPath("currentApp.name")||"CloudOS",r=this.findBannerToShowForApp(n)||this.findBannerToShowForApp("CloudOS");if(e&&r===e)return;r||(e&&e.hide(),this.set("_currentBanner",null)),r&&(this.set("_currentBanner",r),t.addBannerView(r),e&&e.hide())},removeAllBanners:function(){var e=this.get("_appsBannerHash"),t=CloudOS.getPath("mainPage.mainPane.bannerContainer"),n;for(n in e){var r=e[n];t.childViews.indexOf(r)!==-1?t.removeBannerView(r):r.destroy()}this.set("_appsBannerHash",{}),this.set("_currentBanner",null)},updateBanner:function(e,t){var n;for(n in t)t.hasOwnProperty(n)&&e.set(n,t[n])},removeBanner:function(e){var t=this.findBannerToShowForApp(e);t&&(this._appsBannerHash[e].removeObject(t),this.invokeLater(function(){t.destroy()},CloudOS.BANNER_ANIMATION_DURATION))},quotaDataFetched:function(e,t){if(CloudOSBootstrap.isOnSupportedMobile)return;if(!e){SC.warn("No quotaData found to show/hide the quota banner");return}var n=e.get("overQuota"
),r=e.get("isAlmostOverQuota");n?this.showQuotaBanner():r?this.showQuotaBanner(CloudOS.BANNER_TYPE_QUOTA_ALMOST_EXCEEDED):this.removeQuotaBanner()},showQuotaBanner:function(e){e||(e=CloudOS.BANNER_TYPE_QUOTA_EXCEEDED);var t=this._currentQuotaBannerShowingType,n=COS.authController;if(!n||!n.get("user"))return;var r=n.get("user"),i=r.get("isLiteAccount")?"LiteAccount":"FullAccount",s=r.get("isManagedAppleID");if(t!==e){t&&this.removeQuotaBanner();var o={title:"Banner.%@.%@.Title".fmt(e,i),description:"Banner.%@.%@.Description".fmt(e,i),localize:YES};s||(o.optionalLink={text:"Banner.QuotaExceeded.OptionalLink.Text",url:"Banner.QuotaExceeded.OptionalLink.Url"}),this.setAppBanner(o),this._currentQuotaBannerShowingType=e}},removeQuotaBanner:function(){this._currentQuotaBannerShowingType&&(this.setAppBanner(null),this._currentQuotaBannerShowingType=null)},relocalize:function(){this.removeAllNonLocalizedBanners()},removeAllNonLocalizedBanners:function(){var e=this.get("_appsBannerHash"),t=CloudOS.getPath("mainPage.mainPane.bannerContainer"),n;for(n in e){var r=e[n];for(var i=0,s=r.length;i<s;i++){var o=r[i];if(o.get("localize"))return;t.childViews.indexOf(o)!==-1?t.removeBannerView(o):o.destroy(),e[n].removeObject(o),o===this.get("_currentBanner")&&this.set("_currentBanner",null)}}}}),CloudOS.blockInputController=SC.Object.create({showFeedbackAfter:1e3,shouldShowFeedback:NO,_userInputWasBlockedAt:0,block:function(e){e===undefined&&(e=this.get("showFeedbackAfter")),this.set("shouldShowFeedback",NO),this._userInputWasBlockedAt=SC.getCurrentTimeForPerformance()-this.get("showFeedbackAfter"
)+e,CloudOS.blockInputModalPane.get("modalPane").append(),this.invokeLater("showFeedback",e)},unblock:function(){this._userInputWasBlockedAt=0,CloudOS.blockInputModalPane.get("modalPane").remove()},showFeedback:function(){var e=this._userInputWasBlockedAt;e>0&&this.get("showFeedbackAfter")+e<=SC.getCurrentTimeForPerformance()&&(this._userInputWasBlockedAt=0,this.set("shouldShowFeedback",YES))}}),CloudOS.initializationController=SC.Object.create({createFrameURL:null,createFrameOrigin:null,repairFrameURL:null,repairFrameOrigin:null,accountLoginUrl:null,repairDoneEndpointURL:null,accountCreateEndpointURL:null,getICloudTermsEndpointURL:null,accountLoginEndpointURL:null,accountCreationEnabled:!1,extractOrigin:function(e){var t=URI.parse(e);return t.protocol+"://"+t.hostname+(t.port!==null?":"+t.port:"")},handleConfigBag:function(e){try{var t=e.urls,n=CW.getUrlParameters(),r=n.useUATLoginUI,i=n.useStableLoginUI;if(t){var s=t.accountLoginUI;this.set("createFrameURL",t.accountCreateUI),this.set("repairFrameURL",t.accountRepairUI),r?s=s.replace("stable","uat"):i&&(s=s.replace("uat","stable")),this.set("accountLoginUrl",s),this.set("accountLoginEndpointURL",t.accountLogin),this.set("repairDoneEndpointURL",t.repairDone),this.set("accountCreateEndpointURL",t.accountCreate),this.set("getICloudTermsEndpointURL",t.getICloudTerms)}var o=e.accountCreateEnabled;o&&!SC.browser.isIE9OrLower&&this.set("accountCreationEnabled",o)}catch(u){SC.Logger.warn("Failed to parse or extract properties from the config bag!")}}}),CloudOS.localizationController=SC.Object.create({_lastPreferredLanguage:null,relocalizeIfNeeded
:function(e,t){e=e||"unknown reason"+(t?" that was forced":""),this._reasons||(this._reasons=[]),this._reasons.push(e),this.invokeOnce(t?"_forceReloc":"_relocalizeIfNeeded")},_forceReloc:function(){this._relocalizeIfNeeded(!0)},_relocalizeIfNeeded:function(e){var t=this._reasons.join(", ")||"no reasons known";this._reasons.length=0;var n=e||String.preferredLanguage!==this._lastPreferredLanguage;SC.debug("Language check for CloudOS: "+this._lastPreferredLanguage+" -> "+String.preferredLanguage+". We "+(n?"WILL":"WILL NOT")+" relocalize cloudOS."),this._lastPreferredLanguage=String.preferredLanguage,CK.setValueInLocalStorage("locale",String.preferredLanguage),CW.notificationCenter.postNotification("relocalize",(e?"FORCED: ":"")+t,e)}}),CloudOS.NotificationsController=SC.Object.extend(SC.DelegateSupport,{getBadgeState:function(){if(!CK.servicesController.getServiceInfoFor("push")){SC.debug("getBadgeState(): PushWS is not available.");return}var e=CK.Request.postUrl("/getState");e.set("serviceName","push"),e.set("isJSON",YES),e.queryParameter("pcsEnabled",COS.authController.get("pcsEnabled")),e.notify(200,this,function(e){var t=e.get("body"),n=t?t.states:null;if(!n||n.length===0){SC.warn("There was a problem reading the badge state response.");return}var r,i,s,o,u,a;for(u=0,a=n.length;u<a;u++){i=n[u],r=i.pushTopic,s=CloudOS.appManagersForPushTopic(r)[0];if(!s)continue;o=i.data?i.data.badge:null,s&&SC.typeOf(o)===SC.T_NUMBER&&o>-1&&s.set("badgeCount",o)}return YES}),e.notify(0,this,function(e){return SC.warn("%@ received from pushws. Will not retry.",e.get("status")),YES}),e.send
({pushTopics:COS.pushController.get("pushTopics")})},didInitializePush:function(e){CloudOS.passMessageToAllApps("_cloudOSStateChange",{pushToken:e.pushToken})},handlePushNotification:function(e,t,n,r){var i,s,o;if(SC.typeOf(e)===SC.T_HASH)i=e;else try{i=SC.json.decode(e)}catch(u){SC.warn("handlePushNotification(): Exception parsing push notification");return}s=i.apsTopic,!s&&i.ck&&(o=i.ck.cid);if(!i||!t&&!s&&!o){SC.warn("Push notification has missing body, topic or container identifier");return}var a;t?a=[CloudOS.appManagerFor(n)]:s?a=CloudOS.appManagersForPushTopic(s):o&&(a=CloudOS.appManagersForContainerIdentifier(o)),a.forEach(function(n){this.handlePushNotificationForAppManager(i,e,n,t,r)},this),a.length===0&&SC.warn("Push notification has unknown topic or container identifier"),CW.notificationCenter.postNotification("didReceivePushNotification",a.getEach("name"),e)},handlePushNotificationForAppManager:function(e,t,n,r,i){var s=n.get("name"),o,u,a,f,l;if((!n.get("isActive")||e.omitWhenActive===NO)&&e.aps){u=e.aps.alert,a=e.aps.alertTitle,f=e.aps.badge,l=e.aps.sound;if(u||a)e.sessionID===COS.CLIENT_ID?SC.info("Not showing notification for %@ as it originated from this client session",s):this.displayNotification(n,e);SC.typeOf(f)===SC.T_NUMBER&&f>-1&&n.set("badgeCount",f)}i=i===undefined?n.get("awakesInBackgroundFromPush"):i;if(n.get("isReady"))SC.debug("Handing notification off to %@",s),n.passMessage("didReceiveNotification",t);else if(!n.get("isReady"))if(i){if(n.get("isDisabled")){SC.info("Cannot start app %@ since it's disabled",s);return}SC.debug("Starting application %@ as it might need to create a local notification"
,s),n.set("loadReason",CK.LOAD_REASON_NOTIFICATION);var c=n.get("notificationQueue")||[];c.push(t),n.set("notificationQueue",c),n.set("postDisplayAction",function(){c.forEach(function(e){n.passMessage("didReceiveNotification",t)})}),n.invokeLast("getReadyInBackground")}else SC.debug("Ignoring notification for %@ as it does not awakesInBackground",s)},shouldDisplayNotification:function(e){var t=CW.getUrlParameters();return t.suppressNotifications?NO:YES},displayNotification:function(e,t){var n=e.get("name"),r="Notification.PlaceholderDescription.",i=NO,s,o,u,a,f;if(!this.shouldDisplayNotification(n)){SC.info("Skipping visual notification for %@",n);return}u=t.aps.alert;if(SC.typeOf(u)===SC.T_HASH){o=u["loc-args"];if(!o||SC.typeOf(o)!==SC.T_ARRAY){SC.warn("loc-args array is missing or malformed: %@",o);return}s=("PushNotification."+n+"."+u["loc-key"]).loc(o[0],o[1],o[2])}else!u&&CK.hasLocalizedStringForKey(r+n)?(s=(r+n).loc(),i=YES):s=u;a=t.aps.alertTitle||e.get("displayName"),f=t.isDismissable!==undefined?!!t.isDismissable:YES;var l=CloudOS.iOSNotification.create({appDisplayName:e.get("displayName"),message:SC.RenderContext.escapeHTML(a),description:SC.RenderContext.escapeHTML(s),isDismissable:f,icon:e.get("notificationIcon"),classNames:function(){return i?["placeholder-description"]:[]}(),action:function(r){CloudOS.appController.switchToApplicationWithNotification(n,t,r),e.set("loadReason",CK.LOAD_REASON_NOTIFICATION),r.invokeLater(function(){r.dismiss()},CloudOS.MAX_NOTIFICATION_DISMISSAL_WAIT*1e3),r._wasAlreadyDismissed=YES,COS.statsController.recordStat("cloudos","Notification"
,{appName:n,dismissReason:"USER_CLICKED"})},didDismiss:function(e,t){if(e._wasAlreadyDismissed)return;COS.statsController.recordStat("cloudos","Notification",{appName:this._appName,dismissReason:t?"AUTO_DISMISSED":"USER_DISMISSED"})},_appName:n});return CW.iOSNotification.enqueue(l),l},activeAppTimer:null,inactiveAppTimer:null,hasPushConnectionBinding:"COS.pushController.hasPushConnection",isRegisteredToAllTopicsBinding:"COS.pushController.isRegisteredToAllTopics",appsMissingPushTopicBinding:"COS.pushController.appsMissingPushTopic",pushTopicsOrHasConnectionDidChange:function(){var e=this.get("hasPushConnection");e===YES&&this.get("isRegisteredToAllTopics")&&this.getPath("appsMissingPushTopic.length")===0?this.stopIdleTimers():this.startIdleTimers()}.observes("hasPushConnection","isRegisteredToAllTopics","appsMissingPushTopic"),startIdleTimers:function(){if(this.get("activeAppTimer"))return;var e=SC.Timer.schedule({target:this,action:"activeAppShouldRefresh",interval:CloudOS.ACTIVE_IDLE_INTERVAL*1e3,repeats:YES});this.set("activeAppTimer",e);var t=SC.Timer.schedule({target:this,action:"inActiveAppsShouldRefresh",interval:CloudOS.INACTIVE_IDLE_INTERVAL*1e3,repeats:YES});SC.debug("Started idle timers"),this.set("inactiveAppTimer",t)},stopIdleTimers:function(){var e=this.get("activeAppTimer"),t=this.get("inactiveAppTimer");if(!e&&!t)return;e&&(e.invalidate(),this.set("activeAppTimer",null)),t&&(t.invalidate(),this.set("inactiveAppTimer",null)),SC.debug("Stopped idle timers")},pushIsActiveForApp:function(e){var t=COS.pushController,n=t.get("registeredPushTopics"),r=t.get("registeredCloudKitContainers"
);return!this.get("hasPushConnection")||!n||n.indexOf(e.get("pushTopic"))===-1&&r[e.getPath("appInfo.containerIdentifier")]===undefined?NO:YES},activeAppShouldRefresh:function(){var e=CloudOS.appController.getPath("currentApp");e&&!this.pushIsActiveForApp(e)&&e.passMessage("applicationShouldRefresh",NO)},inActiveAppsShouldRefresh:function(){var e=CloudOS.appController.get("apps"),t,n;for(t in e){n=e[t];if(n.get("isActive")||this.pushIsActiveForApp(n))continue;n.passMessage("applicationShouldRefresh",NO)}}}),CloudOS.NewLoginFrameView=CloudOS.AppleAuthWidgetFrameView.extend(CW.Animatability,{classNames:["new-login-frame","iframe-pane"],adjustablePane:null,isVisible:YES,show:function(e){this._url=e;var t;t=this._iframeView=this.createChildView(CloudOS.iFrameView,{src:this._url,toString:function(){return"CloudOS.NewLoginFrameView"}}),this.appendChild(t),this.invokeLast(function(){var e=t.$();e.attr("id","new-login-frame"),e.attr("width","100%"),e.attr("height","100%"),e.attr("frameborder","0"),e.attr("scrolling","no"),e.attr("tabindex","-1")})},getFrame:function(){return this.getPath("_iframeView.layer")},layout:function(e,t){var n,r=CW.getUrlParameters().hasOwnProperty("showFullScreen");return r?n={top:0,left:0,right:0,bottom:0}:t!==undefined?n=t:n={centerY:-70,centerX:0,width:Math.min(this.DEFAULT_WIDTH,Math.max(COS.MIN_WIDTH,window.innerWidth)),height:Math.min(this.DEFAULT_HEIGHT,Math.max(COS.MIN_HEIGHT,window.innerHeight)),opacity:0},n.zIndex=5,n}.property().cacheable(),hide:function(){var e=this._iframeView;e&&e.destroy()},_url:null,_iframeView:null}),CloudOS.NEW_LOGIN_READY_TIMEOUT=45e3
,CloudOS.NewLoginController=SC.Object.extend(CloudOS.AppleWidgetCommonMethods,{_contentViewClass:CloudOS.NewLoginFrameView,show:function(e,t){this.set("_pane",e),this.set("_url",t),this._loadURLInFrameWithTimeout(t)},_loadURLInFrameWithTimeout:function(e){var t=CloudOS.NEW_LOGIN_READY_TIMEOUT,n;try{n=URI.parse(e)}catch(r){throw r.message="Failed to parse the new Login URL:\n"+r.message,r}this._flowOrigin=n.protocol+"://"+n.hostname,this._frameHasCalledReady=NO;var i=this.get("_pane"),s=this.get("_paneContentView"),o=i.get("childViews"),u=COS.statsController;i.set("authWidgetFrame",s),this.clearMessagesReceived(),this.get("_numberOfRetries")===0&&u.beginStat("cloudos","NewLogin_TotalLoadTime"),u.beginStat("cloudos","NewLogin_Loading_Successful"),u.beginStat("cloudos","NewLogin_Loading_Failed"),i.insertBefore(s,o&&o.objectAt(0)),this.invokeLast(function(){s.show(this._generateURL(e))}),SC.debug("Starting timer to track time taken by new Login to load. Attempt Number %@",this.get("_numberOfRetries")+1),this._failureTimer=this.invokeLater(this._didFailToLoad,t)},_didLoad:function(){this._frameHasCalledReady=YES,CloudOS.workspaceController.hideCentralSpinner(function(){this.get("_paneContentView").animate("opacity",1,350),CW.notificationCenter.postNotification("springboardMayProceed"),CloudOS.statechart.sendAction("newLoginLoaded")}.bind(this))},_didFailToLoad:function(){if(this._frameHasCalledReady)return;SC.debug("new Login failed to load"),CloudOS.statechart.sendAction("newLoginFailedToLoad")},_resetPaneContentView:function(e,t){var n=this.get("_paneContentView");e.removeChild
(n),e.set("authWidgetFrame",null),this.resetContentView(),n.destroy(),this._failureTimer.invalidate(),t&&this.destroy()},_rpcMethodHandlers:{ready:function(){this._didLoad()},complete:function(e,t){if(t){t.isNewLoginLogin=YES,this._resetPaneContentView(this.get("_pane"),YES);var n=t.completionMessage,r=t.channelInfo;if(r)try{CK.isStringBase64Encoded(r)&&(r=CW.decodeBase64(r)),r=JSON.parse(r),CloudOS.authController.set("secureChannelInfoData",r)}catch(i){CW.fatalError("secureChannelInfo is not in a JSON format which can be parsed.")}if(n)try{t.completionMessage=JSON.parse(n)}catch(s){CW.fatalError("Unable to read the payload in the complete message")}CloudOS.statechart.sendAction("loginCompleted",t)}},switchOverToAuth:function(e){this._resetPaneContentView(this.get("_pane"),YES),CloudOS.statechart.sendAction("gotoAppleIdLogin")}}});var FIRST_PARTY_ICON_MAP={keynote:"key",numbers:"numbers",pages:"pages"},ICLOUD_APPLE_ZONE="com.apple.icloud.applecorporate";CloudOS.ShareController=SC.ObjectController.extend({database:null,shortGUID:null,vettingToken:null,recordInfo:null,isVettingTokenVetted:NO,appNameFromUrl:null,containerIdentifier:null,isPublicShare:NO,didShowAcceptUIPreLogin:NO,_appWasReady:null,appName:function(){var e=this.get("appNameFromUrl"),t=e;if(!t){var n=this.containerIdentifier;if(n==="com.apple.clouddocs"){var r=this.recordInfo;if(!r)return;var i=r.rootRecord,s=i.fields.extension.value;switch(s){case"key":t="keynote";break;case"numbers":t="numbers";break;case"pages":t="pages";break;default:t="iclouddrive"}}else n&&(t=this.getAppNameForContainerId(n))}return t}.property
("appNameFromUrl","containerIdentifier","recordInfo").cacheable(),fileExtensionOrUTI:function(){var e=this.get("appName");if(e in FIRST_PARTY_ICON_MAP)return FIRST_PARTY_ICON_MAP[e]}.property("appName").cacheable(),isAppSupportedOnMobile:function(){var e=this.get("appNameFromUrl");if(e){var t=CloudOS.getAppInfo(e);return t?t.get("isSupportedOnMobile"):undefined}return YES}.property("appNameFromUrl").cacheable(),hasAppUIForAcceptedSharesOnMobile:function(){var e=this.get("appNameFromUrl");if(e){var t=CloudOS.getAppInfo(e);return t?t.get("hasUIForAcceptedSharesOnMobile"):undefined}return NO}.property("appNameFromUrl").cacheable(),init:function(){CW.notificationCenter.subscribeToNotification("sharingCancelled",this,"sharingCancelled"),SC.Logger.info("Loading CloudKit JS in CloudOS"),SC.Event.add(window,"cloudkitloadfailure",SC.RunLoop.wrapFunction(function(){CW.fatalError("Error resolving share: Unable to load CloudKitJS.")}.bind(this))),CK.loadCloudKitJS();var e=this.get("vettingToken"),t=this.get("isVettingTokenVetted"),n=this.get("shortGUID");this.resolveURL()},isShareThirdParty:function(){return this.get("recordInfo")&&!this.get("appNameFromUrl")&&!this.get("isGameCenterShare")}.property("recordInfo","appNameFromUrl").cacheable(),isGameCenterShare:function(){return this.getPath("recordInfo.containerIdentifier")==="com.apple.socialgaming.sessions"}.property("recordInfo").cacheable(),updateShareDetails:function(e){var t=e.vettingToken,n=e.isVettingTokenVetted,r=e.shortGUID,i=e.appNameFromUrl;this.set("vettingToken",t||null),this.set("isVettingTokenVetted",n||null),this.set("shortGUID"
,r||null),this.set("appNameFromUrl",i||null),this.set("recordInfo",null),this.resolveURL()},resolveURL:function(){window.CloudKit?(SC.Logger.info("CloudKit JS is already loaded"),this.cloudKitJSDidLoad()):SC.Event.add(window,"cloudkitloaded",function(){SC.Logger.info("Loaded CloudKit JS in CloudOS"),this.cloudKitJSDidLoad()}.bind(this))},cloudKitJSDidLoad:function(){window.Promise||(window.Promise=CloudKit.Promise),this.get("database")||this.set("database",CloudOS.Database.create({environment:"production",containerIdentifier:"com.apple.cloudkit",databaseType:CloudOS.DatabaseType.Public,partition:"",services:{fetch:CK.CKJSRequest.fetch}})),this.get("shortGUID")?this.retrieveShare():this.get("vettingToken")&&CloudOS.statechart.sendAction("completedShareControllerSetup")},retrieveShare:function(e){var t=this.get("shortGUID");if(!t)return;this.passMessageToApp("willResolveCKShortGUID",t);var n=window.CloudKit.getDefaultContainer();n.fetchRecordInfos({value:t}).then(SC.RunLoop.wrapFunction(function(t){var n=t.errors;if(n.length>0)this.retrieveShareDidFail(t);else{if(e){e(t);return}this.retrieveShareDidSucceed(t)}}.bind(this))).catch(SC.RunLoop.wrapFunction(function(e){this.passMessageToApp("didFailToResolveCKShortGUID",t,e),CW.fatalError("Error resolving share: "+e)}.bind(this)))},retrieveShareDidSucceed:function(e){SC.Logger.info("retrieveShare succeeded");var t=e.results[0];this.set("recordInfo",t);var n=t.rootRecord,r=t.share,i=t.participantStatus,s=this.get("shortGUID"),o=CloudOS.statechart,u=CloudOSBootstrap.isOnSupportedMobile,a=this.get("appName");if(r){SC.Logger.info("Share Record found"
);if(!this.get("appNameFromUrl"))CloudOS.statechart.sendAction("retrieveShareSucceeded",YES);else if(i===CloudKit.ShareParticipantAcceptanceStatus.ACCEPTED)if(u){if(this.redirectToIWorkIfRequired(a))return;this.get("hasAppUIForAcceptedSharesOnMobile")?o.sendAction("showAlreadyAcceptedState"):CK.reloadWithReason("Sharing: No UI for an already accepted share.","/")}else SC.Logger.info("Share already accepted. Launching app."),this.launchApp();else u&&!this.get("isAppSupportedOnMobile")?o.sendAction("appIsUnsupportedOnMobile"):r.publicPermission!=="NONE"?(this.set("isPublicShare",YES),this.get("isAppleCorporateZone")?o.sendAction("retrieveShareSucceeded"):this.isIWorkApp(a)?this.launchApp():o.sendAction("showPublicAcceptance")):(SC.Logger.info("Share not yet accepted. Launching acceptance flow."),o.sendAction("retrieveShareSucceeded"))}else n?(SC.Logger.info("No share record found. Launching app."),this.launchApp()):(SC.Logger.info("Invalid shortGUID or deleted share. Showing sharing error."),o.sendAction("retrieveShareFailed"));return YES},retrieveShareDidFail:function(e){SC.Logger.info("retrieveShare failed, showing sharing error.");var t=this.get("shortGUID");return this.passMessageToApp("didFailToResolveCKShortGUID",t,e.errors),CloudOS.statechart.sendAction("retrieveShareFailed"),YES},isIWorkApp:function(e){return e==="keynote"||e==="numbers"||e==="pages"},redirectToIWorkIfRequired:function(e){return this.isIWorkApp(e)?(window.location.href=URI(CloudOS.authController.get("defaultOrigin")+"/"+e+"/"+this.get("shortGUID")).addSearch("redirectReason","off").toString()+"#:nooverride"
,YES):NO},launchApp:function(){var e=this.get("appName");if(this.redirectToIWorkIfRequired(e))return;var t=CloudOS.appManagerFor(e);CloudOS.appController.set("pendingApp",t),this.set("_appWasReady",t.get("isReady")),t.set("loadReason",CK.LOAD_REASON_SHARE_ACCEPTED),t.set("route",this.get("shortGUID")),CW.notificationCenter.subscribeToNotification("App Loaded",this,"appDidLaunch"),CloudOS.statechart.sendAction("globalAppSwitchWasRequested")},appDidLaunch:function(e){var t=this.get("appName"),n=this.get("shortGUID");if(e!==t)return;this._appWasReady||this.passMessageToApp("willResolveCKShortGUID",n),this.passMessageToApp("didResolveCKShortGUID",n,this.get("recordInfo")),CW.notificationCenter.unsubscribeFromNotification("App Loaded",this,"appDidLaunch")},getAppNameForContainerId:function(e){var t;for(t in COS.apps){var n=COS.appsController.getAppInfoFor(t),r=n.get("containerIdentifier");if(r===e)return t}CW.fatalError("shareController: cannot find app for requested container name.")},passMessageToApp:function(){var e=this.get("appName"),t=CloudOS.appManagerFor(e);t&&t.get("isReady")&&(SC.debug("Passing %@ message to %@",arguments[0],e),t.passMessage.apply(t,arguments))},sharingCancelled:function(){CloudOS.statechart.sendAction("sharingCancelled")},resetProperties:function(){this.set("shortGUID",null),this.set("vettingToken",null),this.set("recordInfo",null),this.set("isVettingTokenVetted",null),this.set("appNameFromUrl",null),this.set("database",null),this.set("fileExtensionOrUTI",null),this.set("containerIdentifier",null),this.set("_appWasReady",null),this.set("isPublicShare",
NO),this.set("didShowAcceptUIPreLogin",NO)},isAppleCorporateZone:function(){var e=this.get("recordInfo");return e?e.zoneID&&e.zoneID.zoneName===ICLOUD_APPLE_ZONE:!1}.property("recordInfo")}),CloudOS.SharingAppleAuthWidgetController=CloudOS.AppleAuthWidgetController.extend({configUI:function(){var e,t="Auth.Title.SignInToICloud".loc(),n="Auth.Description.Share.",r=CloudOS.shareController,i=r.get("appName"),s=r.get("recordInfo");if(!s)return{signInLabel:"Auth.Title.SignInToICloud".loc()};var o=s.share.owner.userIdentity.nameComponents,u=o.givenName,a=o.familyName,f;return o&&(u||a)?CW.stringIsCJK(u)&&CW.stringIsCJK(a)?f=a+u:f=u+" "+a:CW.fatalError("No sharer name details in share details"),i==="notes"||i==="notes2"?(n+="notes2",e=n.loc({ownerName:f})):i?(n+=i,e=n.loc({ownerName:f})):(e="Auth.Title.SignInToICloud".loc(),t=null),{appName:t,signInLabel:e}}.property()}),CloudOS.DatabaseType={Public:"Public",Private:"Private",Shared:"Shared"},CloudOS.Database=SC.Object.extend({environment:null,containerIdentifier:null,databaseType:null,partition:null,services:null,databaseInstance:function(){var e=this.get("_databaseInstance");if(e)return e;var t=this.get("containerIdentifier"),n=this.get("databaseType"),r=window.CloudKit.getContainer(t);return n===Sharing.DatabaseType.Public?e=r.publicCloudDatabase:n===Sharing.DatabaseType.Private?e=r.privateCloudDatabase:n===Sharing.DatabaseType.Shared&&(e=r.sharedCloudDatabase),this.set("_databaseInstance",e),e}.property(),bootstrapConfiguration:function(){var e=this.get("partition"),t={containerIdentifier:this.get("containerIdentifier"),environment
:this.get("environment"),privateDatabasePartition:this.get("partition"),publicDatabasePartition:this.get("partition"),sharedDatabasePartition:this.get("partition")},n={containers:[t]},r=this.get("services");return r&&(n.services=r),n}.property(),init:function(e){arguments.callee.base.apply(this,arguments);var t=this.get("bootstrapConfiguration");window.CloudKit.configure(t)},_databaseInstance:null}),CloudOS.keyResponder=SC.Object.create(CW.KeyResponder,{keyboardShortcuts:{ctrl_shift_p:"refreshCurrentApplication",ctrl_shift_w:"exitCurrentApplication",ctrl_shift_1:"open1",ctrl_shift_2:"open2",ctrl_shift_3:"open3",ctrl_shift_4:"open4",ctrl_shift_5:"open5"},reloadCurrentApplication:function(){var e=CloudOS.appController.get("currentApp");return e&&CloudOS.appController.reloadApplication(e.get("name")),NO},exitCurrentApplication:function(){var e=CloudOS.appController.get("currentApp");e&&CloudOS.appController.exitApplication(e.get("name"),CK.EXIT_NON_FATAL)},refreshCurrentApplication:function(){var e=CloudOS.appController.get("currentApp");e&&e.passMessage("applicationShouldRefresh",YES)},open1:function(){CloudOS.openApp(0)},open2:function(){CloudOS.openApp(1)},open3:function(){CloudOS.openApp(2)},open4:function(){CloudOS.openApp(3)},open5:function(){CloudOS.openApp(4)}}),CloudOS.ValidatedDownload=SC.Object.extend({url:null,params:null,tokenParamKey:null,tokenCookieKey:null,downloadToken:function(){return CW.UUID()}.property().cacheable(),downloadStartCheckTimeout:3e5,start:function(){this._writeCookieAndBeginPolling(),this._startDownload()},_iframe:function(){var e=this.__iframe
;return e||(e=this.__iframe=document.createElement("iframe"),e.name=this.get("downloadToken")+"__iframe",e.style.display="none",e.src=this.get("_downloadURL")),e}.property(),_downloadURL:function(){var e=window.URI(this.get("url")),t=this.get("params");return t&&e.query(t),e.addQuery(this.get("tokenParamKey"),this.get("downloadToken")),e.toString()}.property("url","params","tokenParamKey","downloadToken"),_startDownload:function(){CloudOSBootstrap.isOnSupportedMobile?window.open(this.get("_downloadURL"),"_blank"):document.body.appendChild(this.get("_iframe"))},_writeCookieAndBeginPolling:function(){var e=".%{currentDomain}".fmt({currentDomain:CloudOS.authController.get("currentDomain")});CK.writeCookie(this.get("tokenCookieKey"),this.get("downloadToken"),null,e,1,YES),CloudOSBootstrap.isOnSupportedMobile||SC.Timer.schedule({target:this,action:"_checkDownloadStarted",interval:150,repeats:YES})},_checkDownloadStarted:function(e){if(!CK.readCookie(this.get("tokenCookieKey"))||Date.now()-e.get("startTime")>this.get("downloadStartCheckTimeout"))e.invalidate(),document.body.removeChild(this.get("_iframe")),this.__iframe=null}}),CloudOS.AdjustMaxWidthOnMobile={_windowWidth:null,initMixin:function(){if(CloudOSBootstrap.isOnSupportedMobile){var e=this._windowWidth?this._windowWidth:SC.RootResponder.responder.currentWindowSize.width,t=this.layout.maxWidth;t&&(t>e&&(this.layout.maxWidth=e),this.get("shouldAutoResize")&&(!this.maxWidth||this.maxWidth>e)&&this.set("maxWidth",e))}}},CloudOS.AdjustViewBasedOnIframe={iframe:null,distanceFromIframe:0,padding:function(){var e=SC.device.get("orientation"
)===SC.LANDSCAPE_ORIENTATION;return e&&!SC.browser.isiPad?15:0},adjustPosition:function(){var e=this.getPath("iframe.frame");if(e){var t=this.get("distanceFromIframe");this.adjust("top",e.y+e.height+t+this.padding())}}.observes("*iframe.frame")},CW.Alert.reopen({init:function(e){e(),CloudOSBootstrap.isOnSupportedMobile&&(this.set("originalLayout",SC.clone(this.get("layout"))),this.updateLayoutOnOrientationChange())}.enhance(),minimumPaneMargin:10,updateLayoutOnOrientationChange:function(){if(CloudOSBootstrap.isOnSupportedMobile){var e=this.get("minimumPaneMargin"),t=Math.max(COS.MIN_WIDTH,window.innerWidth)-e*2,n=Math.max(COS.MIN_HEIGHT,window.innerHeight)-e*2;this.getPath("layout.width")>t?(this.set("isCompact",YES),this.adjust("centerY",0),this.adjust("width",t),this.adjust("maxHeight",n)):(this.set("isCompact",NO),this.set("layout",this.get("originalLayout")))}},windowSizeDidChange:function(){arguments.callee.base.apply(this,arguments),this.updateLayoutOnOrientationChange()}}),CloudOS.HorizontalCenterAlign={frameObserver:function(){var e=this.getPath("frame.width"),t=this.getPath("parentView.frame.width"),n=this.get("flowSpacing");if(e===0)return;n||(n={}),n.left=Math.round(t-e)/2,this.set("flowSpacing",n)}.observes("frame")},SC.RootResponder.reopen({focus:function(e){SC.debug("CloudOS window received focus event"),this.get("hasFocus")||(SC.$("body").addClass("sc-focus").removeClass("sc-blur"),SC.run(function(){this.set("hasFocus",YES)},this));if(CloudOS.shouldAppHaveFocus()){var t=CloudOS.appController.get("currentApp");t&&(SC.debug("Active app "+t.get("name")+" focusing"
),t.focus())}else CW.notificationCenter.postNotification("windowDidFocus");return YES},blur:function(e){return SC.debug("CloudOS window received blur event"),CW.notificationCenter.postNotification("windowDidBlur"),YES},mousemove:function(e,t){return window.CloudOS&&CloudOS.relayMouseMove(t.clientX,t.clientY),e(t)}.enhance(),click:function(e,t){var n=this.targetViewForEvent(t),r=t.target.href,i=r&&t.target.nodeName==="A"&&(r.indexOf(CloudOS.authController.get("currentDomain"))!==-1||r.indexOf(".apple.com")!==-1)&&t.target.target.indexOf("blank")!==-1,s=n&&n.click&&SC.typeOf(n.click)===SC.T_FUNCTION;return n&&n.isControl&&!n.get("ignoreVirtualCursor")&&(s?this.sendEvent("click",t,n):e(t)),n&&!n.isControl&&!i&&(t.preventDefault(),e(t)),n&&n.get("ignoreVirtualCursor")&&n.set("ignoreVirtualCursor",NO),YES}.enhance(),ignoreTouchHandle:function(e){if(SC.browser.isMobileSafari||SC.browser.android||SC.browser.silk){var t=this.targetViewForEvent(e),n=t&&t.click&&SC.typeOf(t.click)===SC.T_FUNCTION,r=t&&t.touchStart&&SC.typeOf(t.touchStart)===SC.T_FUNCTION;if(n||r)return NO;var i=e.target.tagName;return(i==="INPUT"||i==="A")&&e.allowDefault(),YES}return NO},mouseup:function(e,t){var n=this.targetViewForEvent(t);return n&&n.set("ignoreVirtualCursor",YES),e(t)}.enhance()}),CloudOS.moduleLocalizer={localizedModules:["cloudkit/first_run","cloudkit/error_catcher","cloudkit/photo","cloudkit/photo/photoPicker","coreweb/date_formatter","coreweb/timezone_picker","cloudos_foundation/springboard","cloudos_foundation/alarms","cloudos_foundation/language","cloudos_foundation/sharing"],_defaultLocale
:String.preferredLanguage,_locale:"en-us",_previousLocale:null,setLocale:function(e){e||(CW.getUrlParameters().locale&&COS.get("localesSupportedByCloudOSOnly").indexOf(e)!==-1?e=String.preferredLanguage:e=CloudOS.authController.getPath("accountPreferences.localeForCloudOS"));if(this._locale===e||!e)return NO;this._previousLocale=this._locale,this._locale=e,String.preferredLanguage=e;var t=this._monkeyPatchModules();return this._replaceOldStyles(),SC.$(document.body).removeClass(this._defaultLocale).removeClass(this._previousLocale).addClass(this._locale),t},_monkeyPatchModules:function(){var e=SC.MODULE_INFO,t=this.localizedModules,n,r=t.length,i,s,o,u,a=NO;for(n=0;n<r;n++){i=t[n],s=SC.MODULE_INFO[i];if(!s)continue;o=this._updateURL(s.stringURL);if(o!==s.stringURL){s.stringURL=o,s.scriptURL=this._updateURL(s.scriptURL);var f=s.styles;for(var l=0;l<f.length;l++)u=f[l],this._removeOldStyle(i,u),f[l]=this._updateURL(u);f=s.styles2x;for(l=0;l<f.length;l++)u=f[l],this._removeOldStyle(i,u),f[l]=this._updateURL(u);this._unloadModule(i,s),a=YES}}return a},_unloadModule:function(e,t){t.isLoaded=NO,t.isReady=NO,t.isWaitingForRunLoop=NO,t.source=undefined;if(t.isPrefetched){var n=SC.Module.PrefetchModuleTask.create({prefetchedModuleName:e});SC.backgroundTaskQueue.push(n)}},_updateURL:function(e){return e.replace(this._defaultLocale,this._locale).replace(this._previousLocale,this._locale)},_removeOldStyle:function(e,t){var n=$('link[href$="%@"]'.fmt(t));if(n.length>0){var r=n[0];SC.LOG_MODULE_LOADING&&SC.debug("SC.Module: Removing old CSS file in '%@' -> '%@'",e,t),r.parentNode.removeChild
(r)}},_replaceOldStyles:function(){var e=window.BUILD_INFO,t=e.styles,n=e.stylesDPIUsed;if(t){var r=0,i=n===2?t.x2:t.normal,s=document.getElementsByTagName("head")[0]||document.documentElement,o=this;o.pendingStylesToLoad=i.length;for(var u=0;u<i.length;++u){var a=i[u],f=this._updateURL(a),l=$('link[href$="%@"]'.fmt(a)),c;if(l.length>0){var h=l[0];c=document.createElement("link"),c.setAttribute("href",f),c.setAttribute("rel","stylesheet"),c.setAttribute("type","text/css"),c.setAttribute("oldStyle",a),c.onload=function(){var e=this.getAttribute("oldStyle"),t=this.getAttribute("href"),n=$('link[href$="%@"]'.fmt(e));o._updatePendingStylesToLoad(),n.length>0&&(SC.debug("Removing old link tag with href = '%@'.",e),s.removeChild(n[0]))},s.appendChild(c),SC.debug("Adding new link tag with href = '%@'.",f),i[u]=f}c.onerror=function(){o._updatePendingStylesToLoad(),CW.fatalError("Unable to load link tag with href = '%@'.",this.getAttribute("href"))}}}},_updatePendingStylesToLoad:function(){--this.pendingStylesToLoad,this.pendingStylesToLoad===0&&SC.Locale.createCurrentLocale()}},CloudOS.blockInputModalPane=SC.Page.design({modalPane:SC.Pane.design({layout:{zIndex:1e3},childViews:"feedback".w(),shouldShowFeedback:NO,shouldShowFeedbackBinding:"CloudOS.blockInputController.shouldShowFeedback",shouldShowFeedbackDidChange:function(){var e=this.get("shouldShowFeedback"),t=this.get("feedback"),n=e?250:0;t.animate({opacity:e?1:0,duration:n}),t.set("isVisible",e)}.observes("shouldShowFeedback"),feedback:SC.View.design(CW.Animatability,{layout:{opacity:0},isVisible:NO,classNames:"block-input-feedback"
,childViews:"spinner".w(),spinner:CW.SpinnerView.design({asset:CloudOS.SPINNER_IMAGE_SRC,assetIsAlways2x:YES,layout:{centerX:0,centerY:0}})})})}),CloudOS.WaitingForAppState=SC.State.extend({succeededState:"active.application",disabledState:"active.desiredAppDisabled",failedState:"active.appLoadFailure",abortedState:"active.springboard",shouldForceDelegateMethods:NO,enterState:function(){var e=CloudOS.appController,t=e.get("loadingApp"),n=e.get("pendingApp"),r=n.get("name"),i=this;this._app=n;if(n&&t===n){SC.info("We are already waiting for %@ to load",n.get("name"));return}t&&e.loadingApp.teardown();if(n&&n.requiresMailAndIsMissing()){CW.Alert.show({message:"Error.MailNotEnabled.%@.Title".fmt(r).loc(),description:"Error.MailNotEnabled.%@.Description".fmt(r).loc(),rightButton:{title:"Button.OK".loc(),action:function(){this.get("pane").remove(),i.gotoState(i.get("abortedState")),e.set("pendingApp",null)}}});return}if(!n||n.get("isDisabled")){this.gotoState(this.get("disabledState"));return}if(n.get("isFailed")){this.applicationDidFailToBecomeReady();return}COS.statsController.beginStat("cloudos","LoadApplication",{appName:r,previouslyLoaded:n.get("isReady")});var s=function(){CW.notificationCenter.unsubscribeFromNotification("didFetchRegionFormattingSettings",null,this),CW.notificationCenter.unsubscribeFromNotification("receivedInfoForAllDynamicApps",null,this),n.get("isReady")?i.applicationDidBecomeReady(!0):(e.set("loadingApp",n),n.invokeLast("getReady"))},o=!!COS.regionController.regionFormattingRules;r==="settings"&&!e.get("isAllAppInfoLoaded")&&o?(n.set("isWaiting",YES),CW
.notificationCenter.subscribeToNotification("receivedInfoForAllDynamicApps",null,s)):o||CloudOS.authController.get("isPartiallyAuthenticated")&&!n.get("isLocked")?s():CW.notificationCenter.subscribeToNotification("didFetchRegionFormattingSettings",null,s)},abortLoad:function(){CloudOS.appController.get("loadingApp")&&CloudOS.appController.loadingApp.teardown(),this.gotoState(this.get("abortedState"))},exitState:function(){COS.statsController.cancelStat("cloudos","LoadApplication")},applicationDidFailToBecomeReady:function(){var e=CloudOS.appController;COS.statsController.cancelStat("cloudos","LoadApplication"),CW.notificationCenter.postNotification("App Loaded",this._app.get("name"),NO),this.gotoState(this.get("failedState")),e.set("loadingApp",null)},applicationDidBecomeReady:function(e){var t=CloudOS.appController,n=this._app,r=n.get("name"),i=n.get("canLaunchWithOneFactor"),s=CloudOS.authController,o=s.get("isPartiallyAuthenticated"),u=s.get("hsaEnabled"),a={loadReason:n.get("loadReason")||0,appBuildNumber:n.get("buildNumber")||"unknown",appMasteringNumber:n.get("masteringNumber")||"unknown",appName:n.get("name"),accountLocale:String.preferredLanguage,browserLocale:(navigator.language||navigator.browserLanguage).toLowerCase()};return u&&o&&(a.hsaVersion=CloudOS.authController.getPath("user.hsaVersion"),a.loadedAfterOneFactorAuthentication=YES),COS.statsController.endStat("cloudos","LoadApplication",a,{durationKeyName:"loadDuration",includeLocationAndLocale:YES}),t.set("loadingApp",null),t.set("pendingApp",null),t.beginPropertyChanges(),t.deactivateCurrentApp(),t.set("currentApp"
,this._app),t.endPropertyChanges(),i&&o&&n.set("notificationId",null),CW.notificationCenter.postNotification("App Loaded",r,YES),CloudOS.authPane&&CloudOS.authPane.hide(),t.activateCurrentApp(this.get("shouldForceDelegateMethods")),this.gotoState(this.get("succeededState"))},gotoState:function(){return this._gotoStateTimer&&this._gotoStateTimer.invalidate(),this._gotoStateTimer=null,arguments.callee.base.apply(this,arguments)},appMustExit:function(e){var t=this._app,n=e.statusCode,r=e.applicationLog;if(n===CK.EXIT_NON_FATAL){this.gotoState(this.get("abortedState")),t.teardown();return}if(t&&t.get("loadInBackground")){SC.info("Not showing error dialog since app would load in background"),t.teardown();return}var i=t.get("name"),s=t.get("displayName"),o,u;CloudOS.authController.validateUserIfNeeded();if(n===CK.EXIT_PCS_MISSING||n===CK.EXIT_PCS_INVALID){o="Error.AppPCSRequired.Title".loc(s),u="Error.AppPCSRequired.Description".loc();var a=n===CK.EXIT_PCS_MISSING?"Missing PCS":"Invalid PCS";CloudOS.recordStat("PCS Error: "+a)}else n===CK.EXIT_STARTUP_ERROR?(o="Error.AppNotLoading.Title".loc(s),u="Error.AppNotLoading.Description".loc()):(o="Error.AppCrashed.Title".loc(s),u="Error.AppCrashed.Description".loc());this.gotoState(this.get("abortedState")),CW.Alert.show({message:o,description:u,middleButton:{title:"Error.Button.Report".loc(),action:function(){this.getPath("pane.modalPane").set("paneFadeOutDuration",0),this.get("pane").remove(),CloudOS.appController.showErrorReporter(t,r),t.teardown()}},rightButton:{title:"Button.OK".loc(),action:function(){this.getPath("pane.modalPane")
.set("hideDelay",10),this.get("pane").remove(),t.teardown()}}}),CloudOS.appController.set("loadingApp",null),COS.statsController.recordStat("cloudos","AppMustExitWaitingForApp",{appName:i,statusCode:n})},showServiceLocked:function(e){var t=CloudOS.appController.get("loadingApp"),n=COS.appsController.getAppInfoFor(t.get("name")),r=e.serviceName;if(!r||n.isServiceRequired(r))e.appToDisable=t,this.gotoState("serviceLocked",e)},init:function(){var e="appCalledShowAppSwitcher appCalledSwitchToApplication appMustReload appMustExit appMustExitSilently".w(),t,n,r;for(n=0;t=e[n];n++)r=function(){var e=arguments.callee.state._app;if(!e)return;e.set("preDisplayAction",arguments.callee.actionName),e.set("preDisplayActionArgs",SC.$A(arguments))},r.actionName=t,r.state=this,this[t]||(this[t]=r);arguments.callee.base.apply(this,arguments)}}),CloudOS.WaitingForDefaultAppState=CloudOS.WaitingForAppState.extend({disabledState:"active.allAppsDisabled"}),CloudOS.ApplicationState=SC.State.extend({initialSubstate:"displayingCurrentApp",isReentering:NO,enterState:function(){CW.notificationCenter.postNotification("springboardMayProceed"),CloudOS.workspaceController.hideCentralSpinner(null,!0),CloudOS.workspaceController.set("nowShowing",CloudOS.APP)},displayingCurrentApp:SC.State.design({enterState:function(){this.get("parentState").set("isReentering",NO);var e=CloudOS.appController.get("currentApp");if(!e){SC.info("currentApp is not set! Return to springboard."),this.gotoState("active.springboard");return}var t=e.get("preDisplayAction"),n=e.get("preDisplayActionArgs");e.set("preDisplayAction",undefined
),e.set("preDisplayActionArgs",undefined),t&&this[t].apply(this,n),e.focus(),CloudOS.bannerManager.selectBannerAndShow(),CloudOS._executeReadyQueue()},appCalledShowAppSwitcher:function(e){e||(this.invokeLater(function(){CloudOS.autoUpdateController.checkVersion()},1e3),e={x:8,y:8,width:37,height:29},e.left=e.x,e.top=e.y),this.gotoState("showingSpringboardMini",e)},appCalledShowSpringBoard:function(){this.gotoState("active.springboard")},appCalledSwitchToApplication:function(){this.gotoState("active.application.waitingForNewApp")},globalAppSwitchWasRequested:function(){if(CloudOS.appController.get("currentApp")===CloudOS.appController.get("pendingApp")){SC.info("The new app is same as the current app and it is already loaded.");return}this.gotoState("active.application.waitingForNewApp")},appMustReload:function(e){this.gotoState("active.springboard",e)},appMustExit:function(e){var t=e.statusCode,n=e.applicationLog,r=e.appToLoadAfterAuthentication;if(this._exitPane&&this._exitPane.get("isVisibleInWindow")){SC.warn("There is already an app exit alert pane showing, so ignoring request for a second one.");return}var i=CloudOS.authController,s=CloudOS.appController,o=s.get("currentApp"),u=s.get("pendingApp"),a=CloudOS.statechart;if(t===CK.EXIT_NON_FATAL){r?i.get("isPartiallyAuthenticated")?(o.teardown(),s.set("pendingApp",r),a.sendAction("showHSA",CloudOS.HSASourceEnum.USER_SELECTED_APP)):i.get("isAuthenticated")&&o!==r&&(o.teardown(),a.sendAction("userDidChooseApp")):(this.gotoState("active.springboard"),o.teardown());return}if(o&&o.get("loadInBackground")){SC.info("Not showing error dialog since app would load in background"
),o.teardown();return}var f=o.get("name"),l=this,c=o.get("displayName"),h,p;i.validateUserIfNeeded();if(t===CK.EXIT_PCS_MISSING||t===CK.EXIT_PCS_INVALID){h="Error.AppPCSRequired.Title".loc(c),p="Error.AppPCSRequired.Description".loc();var d=t===CK.EXIT_PCS_MISSING?"Missing PCS":"Invalid PCS";CloudOS.recordStat("PCS Error: "+d)}else t===CK.EXIT_STARTUP_ERROR?(h="Error.AppNotLoading.Title".loc(c),p="Error.AppNotLoading.Description".loc()):(h="Error.AppCrashed.Title".loc(c),p="Error.AppCrashed.Description".loc());this._exitPane=CW.Alert.show({message:h,description:p,middleButton:{title:"Error.Button.Report".loc(),action:function(){this.getPath("pane.modalPane").set("paneFadeOutDuration",0),this.get("pane").remove(),CloudOS.appController.showErrorReporter(o,n)}},rightButton:{title:"Button.OK".loc(c),action:function(){this.getPath("pane.modalPane").set("hideDelay",10),this.get("pane").remove(),l.gotoState("active.springboard"),o.teardown()}}}),COS.statsController.recordStat("cloudos","AppMustExitDisplayingCurrentApp",{appName:f,statusCode:t})},appMustExitSilently:function(){this.gotoState("active.springboard")},showServiceLocked:function(e){var t=CloudOS.appController.get("currentApp"),n=COS.appsController.getAppInfoFor(t.get("name")),r=e.serviceName;if(!r||n.isServiceRequired(r))e.appToDisable=t,this.gotoState("serviceLocked",e)},showAccountSettings:function(){CloudOS.openApp("settings")},appSelected:function(){var e=CloudOS.appController.get("pendingApp");e?(e.set("loadInBackground",NO),CloudOS.statechart.sendAction("globalAppSwitchWasRequested")):this.gotoState("active.springboard"
)}.handleEvents("userDidChooseApp","globalAppSwitchWasRequested")}),showingSpringboardMini:SC.State.design({initialSubstate:"waitingForSpringBoardModule",enterState:function(e){var t=CloudOS.authController.get("delayedTearDownApp");t&&(t.teardown(),CloudOS.authController.set("delayedTearDownApp",null)),SC.Module.loadModule("cloudos_foundation/springboard",this,function(){this.gotoState("springBoardDidLoad",e)})},exitState:function(){CloudOS.authController.get("isValidatingHsa")||(CloudOS.appSwitcherController.hideAppSwitcher(),CloudOS.notifyRemovalOfDialogAboveApp())},waitingForSpringBoardModule:SC.State.design(),springBoardDidLoad:SC.State.design({enterState:function(e){var t;CloudOS.configureSpringboard(),CloudOS.notifyDialogAboveApp(),CloudOS.focus(),CloudOS.authController.get("isValidatingHsa")&&(e=CloudOS.appSwitcherController.getPath("pane.pointAtRectangle")),CloudOS.appSwitcherController.showAppSwitcher(e),this.gotoState("normal")}}),normal:SC.State.design({didDismiss:function(){this.gotoState("active.application.displayingCurrentApp")},appSelected:function(){var e=CloudOS.appController.get("pendingApp");e?(e.set("loadInBackground",NO),this.gotoState("active.application.showingSpringboardMini.waitingForApp")):this.gotoState("active.springboard")}.handleEvents("userDidChooseApp","globalAppSwitchWasRequested"),userDidBeginAnimatingHome:function(){this.gotoState("animatingHome")}}),waitingForApp:CloudOS.WaitingForAppState.design({shouldForceDelegateMethods:YES,abortedState:"active.application.displayingCurrentApp",userDidChooseApp:function(){var e=CloudOS.appController.get
("pendingApp");e?(e.set("loadInBackground",NO),this.gotoState("active.application.showingSpringboardMini.waitingForApp")):this.gotoState("active.springboard")},appCalledSwitchToApplication:function(){this.gotoState("active.application.showingSpringboardMini.waitingForApp")},globalAppSwitchWasRequested:function(){if(CloudOS.appController.get("pendingApp")===this._app){SC.info("Already waiting for app to load");return}this.gotoState("active.application.showingSpringboardMini.waitingForApp")},didDismiss:function(){this.abortLoad(),CloudOS.appController.set("pendingApp",null),CloudOS.appController.set("loadingApp",null),this.getPath("parentState.parentState").set("isReentering",YES)},userDidBeginAnimatingHome:function(){this.abortLoad(),CloudOS.appController.set("pendingApp",null),CloudOS.appController.set("loadingApp",null),this.gotoState("animatingHome")},exitState:function(){arguments.callee.base.apply(this,arguments),this.getPath("parentState.parentState").set("isReentering",YES)}}),animatingHome:SC.State.design({appSwitcherFinishedHiding:function(){CloudOS.authController.get("isPartiallyAuthenticated")?this.gotoState("active.authUI.hsa"):this.gotoState("active.springboard")}})}),waitingForNewApp:CloudOS.WaitingForAppState.design({shouldForceDelegateMethods:YES,enterState:function(){arguments.callee.base.apply(this,arguments),CloudOS.blockUserInput(0)},appCalledSwitchToApplication:function(){this.gotoState("active.application.waitingForNewApp")},globalAppSwitchWasRequested:function(){if(CloudOS.appController.get("pendingApp")===this._app){SC.info("Already waiting for app to load"
);return}this.gotoState("active.application.waitingForNewApp")},appCalledShowAppSwitcher:function(){this.gotoState("active.springboard")},appCalledShowSpringBoard:function(){this.gotoState("active.springboard")},exitState:function(){arguments.callee.base.apply(this,arguments),this.get("parentState").set("isReentering",YES),CloudOS.unblockUserInput()}}),serviceLocked:SC.State.plugin("CloudOS.ServiceLockedState"),exitState:function(){var e=CloudOS.authController,t=CloudOS.appController,n=t.get("currentApp"),r=t.get("pendingApp"),i=n&&n.get("canLaunchWithOneFactor");!this.get("isReentering")&&!CloudOS.get("isCloudOSMini")&&(!i||!e.get("isValidatingHsa"))&&t.deactivateCurrentApp(),CloudOS.focus()}}),CloudOS.SharingState=SC.State.extend({initialSubstate:"setupShareController",waitingForAppState:CloudOS.WaitingForDefaultAppState.design({enterState:function(){CloudOS.workspaceController.showCentralSpinner(),arguments.callee.base.apply(this,arguments)},exitState:function(){window.Sharing&&Sharing.sharingPane?Sharing.removePane(YES):CloudOS.workspaceController.hideCentralSpinner()}}),showAccountSettings:function(){Sharing.sharingPane.showSpinner(),CloudOS.openApp("settings")},globalAppSwitchWasRequested:function(){this.gotoState("waitingForAppState")},enterState:function(){CW.notificationCenter.postNotification("springboardMayProceed")},setupShareController:SC.State.design({enterState:function(e){var t=CloudOS.shareController&&CloudOS.shareController.get("isPublicShare");e?CloudOS.setupShareController(e):this.gotoState("downloadingSharingModule")},downloadSharingModule:function(){this
.gotoState("downloadingSharingModule")}.handleEvents("retrieveShareSucceeded","retrieveShareFailed","showPublicAcceptance","showAlreadyAcceptedState"),completedShareControllerSetup:function(){this.gotoState("downloadingSharingModule")},appIsUnsupportedOnMobile:function(){this.gotoState("downloadingSharingModule")}}),downloadingSharingModule:SC.State.design({enterState:function(){SC.Module.loadModule("cloudos_foundation/sharing",this,"moduleDidBecomeReady")},moduleDidBecomeReady:function(e,t){this.gotoState("displayingSharingUI")}}),displayingSharingUI:SC.State.design({enterState:function(){var e=CloudOS.shareController,t=e.get("shortGUID"),n=e.get("vettingToken"),r=e.get("isVettingTokenVetted"),i=e.get("isShareThirdParty"),s=e.get("isGameCenterShare"),o=e.get("isPublicShare"),u=CloudOS.authController.getPath("user.appleId"),a=CloudOS.isUserAuthenticated(),f=o&&a&&e.get("didShowAcceptUIPreLogin");CloudOS.workspaceController.set("nowShowing",CloudOS.SHARING),t?Sharing.showPane(t,u,i,s,o,f):n?Sharing.acceptVettingToken(n,r):CW.fatalError("Wrong State as there is no vettingToken or shortGUID")},sharingCancelled:function(){var e=CloudOS.isUserAuthenticated();if(CloudOS.shareController.get("isPublicShare")&&!e)return NO;CloudOSBootstrap.isOnSupportedMobile?CK.reloadWithReason("Sharing: Cancelled","/"):e&&this.gotoState("active.springboard")}}),exitState:function(){window.Sharing&&Sharing.sharingPane&&Sharing.removePane(YES),CloudOS.shareController.resetProperties()}}),CloudOS.TermsAndConditionConfirmationState=SC.State.extend({enterState:function(){var e=CloudOS.TermsAndConditionsAcceptanceConfirmationPane
.create();CloudOS.authController.set("termsAndConditionsAcceptanceConfirmationPane",e),CloudOS.workspaceController.hideCentralSpinner(function(){e.append()}.bind(this))},signOut:function(){CloudOS.workspaceController.showCentralSpinner(function(){CloudOS.authController.logoutUser(function(){CloudOS.workspaceController.clearHash(),CK.reloadWithReason("User accepted Terms and Conditions")},YES)}.bind(this))}}),CloudOS.statechart=SC.Statechart.create({trace:YES,monitorIsActive:NO,name:"cloudos-statechart",rootState:SC.State.design({initialSubstate:"loading",resendLoginOrValidateRequest:function(e){SC.debug("sending validate request again.");var t=CloudOS.authController;t.validateUser(t.validatePreferences,e)},loading:SC.State.design({enterState:function(){var e=function(){return CK.writeCookie("COS_BOOTSTRAP_COOKIE_TEST","1"),CK.readCookie("COS_BOOTSTRAP_COOKIE_TEST")==="1"};CloudOS.workspaceController.set("nowShowing",CloudOS.PREAUTH),!navigator.cookieEnabled&&!e()?this.gotoState("cookiesDisabled"):COS.authController.get("isLoadedFromSiteURL")?!CK.getValueFromSessionStorage("userIgnoredBrowserWarning")&&!CloudOSBootstrap.isBrowserVersionAtLeast({safari:7,firefox:21,chrome:35,ie:11,edge:12,otherwise:!1})&&!CloudOS.get("isCloudOSMini")&&!CloudOSBootstrap.didLoadWithShareURL&&!CloudOSBootstrap.willLoadMobileSupportedApp&&!CloudOSBootstrap.isTermsAndConditionUrl&&!CloudOSBootstrap.hasPostLoginRedirectUrl?this.gotoState("browserWarning"):COS.checkBodyFontsAvailability(this,this.postFontCheckSetup):this.gotoState("isNotLoadedFromSiteURL")},postFontCheckSetup:function(){if(CloudOS.hasOpenerWithCloudOS&&
CloudOS.hasOpenerWithCloudOS()){var e=CloudOS.getOpenerWithCloudOS(),t=!!CK.readCookie("X-APPLE-WEB-ID");t?this.gotoState("setupCloudOSWithOpener"):this.gotoState("validatingAuth")}else this.gotoState("validatingAuth")}}),cookiesDisabled:SC.State.design({enterState:function(){window.location="/enable_cookies/"}}),isNotLoadedFromSiteURL:SC.State.design({enterState:function(){window.location="https://www.icloud.com"}}),browserWarning:SC.State.design({enterState:function(){CloudOS.workspaceController.hideCentralSpinner(function(){CW.Alert.show({message:"Error.UnsupportedBrowser.Title".loc(),description:"Error.UnsupportedBrowser.Description".loc(),middleButton:{title:"Error.UnsupportedBrowser.Ignore".loc(),action:function(){this.get("pane").remove(),CK.setValueInSessionStorage("userIgnoredBrowserWarning",YES),CloudOS.statechart.gotoState("validatingAuth")}},rightButton:{title:"Error.UnsupportedBrowser.LearnMore".loc(),action:function(){this.get("pane").remove(),window.open("Error.UnsupportedBrowser.LearnMore.URL".loc()),CloudOS.statechart.gotoState("validatingAuth")}}})}.bind(this))}}),setupCloudOSWithOpener:SC.State.design({enterState:function(){var e=CloudOS.authController,t=CloudOS.hasOpenerWithCloudOS();if(t){var n=CloudOS.getOpenerWithCloudOS().CloudOS,r=n.userIsAuthenticated?n.userIsAuthenticated():NO;if(r&&n.getUser){var i=n.getUser()._auth_bag,s=i.hsaChallengeRequired,o=CloudOS.appController,u=o.getDefaultApp(),a=o.getDefaultAppName(),f=this;if(s){this.gotoState("validatingAuth");return}var l=function(){i?(e.saveAuthBag(i),e._authCompleted(i,e.validatePreferences,YES,null
)&&(e.invokeDelegateMethod(e.get("delegate"),"loginDidSucceed",i),e.monitorForUsernameChange())):(SC.warn("No authbag in opener cloudos. Re validating Auth"),f.gotoState("validatingAuth"))};a&&!u?CW.notificationCenter.subscribeToNotification("receivedInfoForDynamicApp",this,function(e,t){var n=CloudOS.appController,r;if(e!==n.getDefaultAppName())return;t?l():(r=n.getDefaultApp(),r.set("loadReason",CK.LOAD_REASON_LOCATION_HASH),CloudOS.appController.set("pendingApp",r),l())}):l()}else SC.warn("Opener window is either not a CloudOS window or the user is not authenticated in the Opener window."),this.gotoState("validatingAuth")}},authDidValidate:function(){COS.authUIController.userDidAuthenticate()},showFirstRun:function(){this.gotoState("active.authUI.loadFirstRun")},goToSharingState:function(e){this.gotoState("active.sharingState",e)}}),validatingAuth:SC.State.design({initialSubstate:"gettingReply",enterState:function(e){e&&!!e.showOnlyLiteApps&&CloudOS.authController.set("iCloudLiteSignUp",YES)},goToSharingState:function(e){this.gotoState("active.sharingState",e)},goToVettingState:function(e){this.gotoState("active.vettingState",e)},gettingReply:SC.State.design({initialSubstate:"parsingReply",parsingReply:SC.State.design({enterState:function(e){e=e||{};var t=e.successCallback;this._successCallback=typeof t=="function"?t:SC.K;var n=e.failureCallback;this._failureCallback=typeof n=="function"?n:SC.K;var r=window.location.hash,i=CloudOS.authController;if(r==="#:showlogin"){window.location.hash="",CloudOS.authController.logoutUser(function(){CK.reloadWithReason("Need to show the Login Screen"
)},YES);return}r=r.length>1?r.substr(1):null;if(r){var s=URI.parseQuery(r),o=s.postLoginRedirectUrl;try{o=atob(s.postLoginRedirectUrl)}catch(u){SC.Logger.info("Non-base64 postLoginRedirectUrl was specified")}var a=s.hideRememberMe;a&&JSON.parse(a)===!0&&CloudOS.authController.set("hideRememberMe",YES);var f=r.match(/(signup)\?origin=(.*)/),l,c=YES,h,p;f&&f.length===3?(h=f[1],p=f[2]):(h=s.signup,p=s.origin),h!==undefined&&(i.set("showSignup",YES),p&&i.set("signupOriginApp",p));if(o){var d=o.match(/(.*)\?origin=(.*)/);d&&d.length===3&&(o=d[1],p=d[2],i.set("signupOriginApp",p)),o=URI.decode(o),i.set("postLoginRedirectUrl",o);for(l in s){if(["postLoginRedirectUrl","signup","origin","terms","hideRememberMe"].indexOf(l)!==-1)continue;s.hasOwnProperty(l)&&(c=NO)}c&&(window.location.hash="")}}SC.Benchmark.start("AUTH_DURATION"),i.statechart=CloudOS.statechart,i.validateUser(i.validatePreferences)},authDidValidate:function(){var e=CloudOS.authController,t=e.get("isAuthenticated");this._successCallback();if(e.shouldUsePostLoginRedirectUrl())return;t&&CloudOS.moduleLocalizer.setLocale(),SC.Module.loadModule("cloudos_foundation/language",this,"languageDidLoad"),e.reportAuthSuccess("validate"),COS.statsController.beginStat("cloudos","Session")},languageDidLoad:function(){CloudOS.localizationController.relocalizeIfNeeded("Signin Submission Succeeded and Language Loaded"),CloudOS.appController.get("areAllAppReplacementsCompleted")?this.checkIfDefaultAppIsCreated():CW.notificationCenter.subscribeToNotification("appReplacementsCompleted",this,"checkIfDefaultAppIsCreated")},checkIfDefaultAppIsCreated
:function(){var e=CloudOS.appController,t=e.getDefaultAppName(),n=e.getDefaultApp(),r=e.getPath("pendingInfoJSONRequests."+t);this.invokeLast(function(){CW.notificationCenter.unsubscribeFromNotification("appReplacementsCompleted",this,"checkIfDefaultAppIsCreated")}),!n&&t&&COS.apps[t]&&r?CW.notificationCenter.subscribeToNotification("receivedInfoForDynamicApp",this,function(e,n){if(t!==e)return;this.redirectToState()}):this.redirectToState()},redirectToState:function(){var e=CloudOS.appController,t=CloudOS.getShareDetailsFromUrl(),n=e.getDefaultAppName(),r=e.getDefaultApp(),i=e.get("pendingApp"),s=CloudOS.authController,o=this.statechart,u=this,a=s.get("isPartiallyAuthenticated"),f=s.get("hsaChallengeRequired"),l=s.shouldUsePostLoginRedirectUrl(),c=function(e){e.get("isPCSKeysDeletedLocked")?u.gotoState("active.springboard"):(e.set("loadReason",CK.LOAD_REASON_LOCATION_HASH),CloudOS.appController.set("pendingApp",e),u.gotoState("validatingAuth.waitingForApp"))};a?(!i&&r&&e.set("pendingApp",r),!r||r.get("isLocked")?o.sendEvent("showHSA"):o.gotoState("active.authUI.waitingForApp")):s.get("isPartiallyAuthenticatedForManagedAppleId")?o.sendEvent("gotoManagedAppleId"):CloudOSBootstrap.isTermsAndConditionUrl&&!l?o.sendEvent("gotoShowTermsAndConditionConfirmation"):CloudOS.get("isCloudOSMini")&&r?c(r):t?CloudOS.handleShareDetails(t):!r||window.location.hash==="#springboard"?this.gotoState("active.springboard"):c(r),s.get("isAuthenticated")&&CloudOS.loadAlarms()},showHSA:function(){this.gotoState("active.authUI.hsa")},gotoPreAuthSharingOrAuthUIState:function(e){var t=CloudOS.getShareDetailsFromUrl
(),n=t&&t.longGUID;t&&!n?this.gotoState("preAuthSharingState"):this.gotoState("active.authUI")},authDidNotValidate:function(){var e=CloudOS.get("isCloudOSMini"),t=CloudOS.appController.getDefaultApp();e&&!t?CW.notificationCenter.subscribeToNotification("receivedInfoForDynamicApp",this,function(e,t){var n=CloudOS.appController,r;if(e!==n.getDefaultAppName())return;t?(CloudOS.authController.reportAuthError("validate","authDidNotValidate"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()):SC.Module.loadModule("cloudos_foundation/language",this,"languageDidLoad")}):e&&t?SC.Module.loadModule("cloudos_foundation/language",this,"languageDidLoad"):(CloudOS.authController.reportAuthError("validate","authDidNotValidate"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState())},authDidNotValidateLocked:function(){CloudOS.authController.reportAuthError("validate","authDidNotValidateLocked"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authDidNotValidateSupportLocked:function(){CloudOS.authController.reportAuthError("validate","authDidNotValidateSupportLocked"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authDidNotValidateNotICloudUser:function(){CloudOS.authController.reportAuthError("validate","authDidNotValidateNotICloudUser"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authDidNotValidateNotVerified:function(){CloudOS.authController.reportAuthError("validate","authDidNotValidateNotVerified"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authDidNotValidateAccountClosed:function(){CloudOS.
authController.reportAuthError("validate","authDidNotValidateAccountClosed"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authDidNotValidateExpiredPassword:function(){CloudOS.authController.reportAuthError("validate","authDidNotValidateExpiredPassword"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authDidNotValidateOffline:function(){CloudOS.authController.reportAuthError("validate","authDidNotValidateOffline"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authDidNotConnect:function(e){e?e="authDidNotConnect-"+e:e="authDidNotConnect",CloudOS.authController.reportAuthError("validate",e),this._failureCallback(),this.gotoState("validateFailureWithoutUsableData",e)},authDRLocked:function(){CloudOS.authController.reportAuthError("validate","authDRLocked"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authPartitionLocked:function(){CloudOS.authController.reportAuthError("validate","authPartitionLocked"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},incompleteHSAFlow:function(){CloudOS.authController.logoutUser(function(){CK.reloadWithReason("Incomplete HSA flow. Need to start afresh.")},YES)},showFirstRun:function(){this.gotoState("active.authUI.loadFirstRun"),this._successCallback()},showHSA:function(){this.gotoState("active.authUI.hsa")},gotoManagedAppleId:function(){this.gotoState("active.authUI.managedAppleId")},resendGetPrefsRequest:function(){SC.debug("sending get preferences request again."),COS.prefsController.getPreferences(null,COS.authController.validatePreferences)},gotoShowTermsAndConditionConfirmation
:function(){this.gotoState("active.termsAndConditionConfirmation")}}),validateFailureWithoutUsableData:SC.State.design({enterState:function(e){e||(e="No usable info in the validate call response."),CloudOS.UnableToProceedAlert.show({failureReason:e})}})}),waitingForApp:CloudOS.WaitingForDefaultAppState.design({}),gotoWaitingForAppState:function(){this.gotoState("validatingAuth.waitingForApp")},exitState:function(){CloudOS.authController.set("iCloudLiteSignUp",NO)}}),preAuthSharingState:SC.State.design({initialSubstate:"defaultState",defaultState:SC.State.design({enterState:function(){var e=CloudOS.getShareDetailsFromUrl();CloudOS.setupShareController(e),CloudOS.workspaceController.showCentralSpinner(function(){CloudOS.appleAuthWidgetController&&(CloudOS.appleAuthWidgetController.destroy(),CloudOS.appleAuthWidgetController=null)}.bind(this))},retrieveShareSucceeded:function(e){e?this.gotoState("thirdPartySharingState"):this.gotoState("active.authUI")},completedShareControllerSetup:function(){this.gotoState("active.authUI")},retrieveShareFailed:function(){CloudOSBootstrap.isOnSupportedMobile&&CK.reloadWithReason("Sharing: Invalid Share","/"),this.gotoState("active.authUI")},showPublicAcceptance:function(){this.gotoState("publicSharingState")},appIsUnsupportedOnMobile:function(){this.gotoState("active.sharingState")}}),publicSharingState:CloudOS.SharingState.design({sharingCancelled:function(){CloudOS.workspaceController.showCentralSpinner(function(){this.gotoState("active.authUI")}.bind(this))},exitState:function(){window.Sharing&&Sharing.sharingPane&&Sharing.removePane(YES),CloudOS
.getShareDetailsFromUrl()?CloudOS.shareController.set("didShowAcceptUIPreLogin",YES):CloudOS.shareController.resetProperties()}}),thirdPartySharingState:CloudOS.SharingState.design()}),active:SC.State.design({initialSubstate:"authUI",authUI:COS.AuthUIState.design({waitingForApp:CloudOS.WaitingForDefaultAppState.extend({exitState:function(){var e=CloudOS.get("authPane");e&&e.hide()}})}),sharingState:CloudOS.SharingState.design(),vettingState:CloudOS.SharingState.design(),application:SC.State.plugin("CloudOS.ApplicationState"),springboard:SC.State.plugin("CloudOS.SpringboardState"),termsAndConditionConfirmation:SC.State.plugin("CloudOS.TermsAndConditionConfirmationState"),goToSharingState:function(e){CloudOS.getUser()?CloudOS.statechart.stateIsEntered("sharingState")||this.gotoState("sharingState",e):this.gotoState("preAuthSharingState")},appIsUnsupportedOnMobile:function(){this.gotoState("active.sharingState")},goToVettingState:function(e){CloudOS.getUser()?CloudOS.statechart.stateIsEntered("vettingState")||this.gotoState("vettingState",e):this.gotoState("preAuthSharingState")},showHelp:function(){CloudOS.showHelp()},showHSA:function(){this.gotoState("hsa")},showPCSDeletedMessage:function(e){CloudOS.authController.showPCSDeletedErrorMessage(e)},allAppsDisabled:SC.State.design({enterState:function(){this.gotoState("active.springboard")}}),desiredAppDisabled:SC.State.design({enterState:function(){var e=CloudOS.appController.get("pendingApp");if(e){var t=e.get("displayName");if(e.get("isUnqualified")){var n=e.get("name")==="mail"?"Error.AppUnqualified.Description.mail".loc():"Error.AppUnqualified.Description.others"
.loc(t);CW.Alert.show({message:"Error.AppUnqualified.Title".loc(t),description:n,rightButton:"Button.OK".loc()})}}this.gotoState("active.springboard")}}),appLoadFailure:SC.State.design({enterState:function(){var e=CloudOS.authController,t=CloudOS.appController,n=t.get("pendingApp"),r=n.get("name"),i=n.get("displayName"),s,o;e.get("hsaChallengeRequired")?this.gotoState("active.authUI.hsa"):this.gotoState("active.springboard"),e.validateUserIfNeeded(),n.set("isWaiting",NO);var u=n.get("postDisplayAction");n.set("postDisplayAction",undefined),u&&u.apply(this);if(n.get("loadInBackground")){SC.info("Not showing error dialog since app would load in background"),n.teardown();return}if(n.get("isIntermediateFailedToLoad")){n.set("isIntermediateFailedToLoad",NO),n.teardown(),t.set("pendingApp",null);return}var a="Error.AppNotLoading.Title".loc(i);CW.stringIsCJK(i)&&(a=a.replace(/ /g,""));var f=this,l;CloudOS.get("isCloudOSMini")?l={title:"Button.TryAgain".loc(),action:function(){this.getPath("pane.modalPane").set("hideDelay",10),this.get("pane").remove(),n.teardown(),t.set("pendingApp",null),f.gotoState("active.springboard.waitingForApp")}}:l={title:"Button.OK".loc(),action:function(){this.getPath("pane.modalPane").set("hideDelay",10),this.get("pane").remove(),n.teardown(),t.set("pendingApp",null)}},CW.Alert.show({message:a,description:"Error.AppNotLoading.Description".loc(),middleButton:{title:"Error.Button.Report".loc(),action:function(){this.getPath("pane.modalPane").set("paneFadeOutDuration",0),this.get("pane").remove(),CloudOS.appController.showErrorReporter(n,null,NO,"loadFailure"
),n.teardown(),t.set("pendingApp",null)}},rightButton:l}),COS.statsController.recordStat("cloudos","AppLoadFailure",{appName:r})}}),reloadApp:function(){this.gotoState("active.springboard.waitingForApp")},authDidValidate:function(){var e=COS.authUIController;e.userDidAuthenticate(),e.reportAuthSuccess("validate")},authDidNotValidate:function(){window.location.hash="",CloudOS.authController.logoutUser(function(){CK.reloadWithReason("Intermediate validate call failed with 401/421 response")},YES)},authDidNotConnect:function(e){SC.warn('Intermediate validate call failed with failureReason as "%@"',e)}})})}),CloudOS.ServiceLockedState=SC.State.design({enterState:function(e){var t=this,n=e?e.retryAfter:null,r=CloudOS.appController,i=e.appToDisable||r.get("currentApp")||r.get("pendingApp"),s=i.get("name"),o=i.get("displayName"),u="Service.Locked.Title".loc({appName:o}),a=COS.authUIController.lockedAlertDescription("Service.Locked.Description.",n,o);CloudOS.notifyDialogAboveApp(),this.gotoState("active.springboard"),i.teardown(),CW.Alert.show({message:u,description:a,rightButton:{title:"Button.OK".loc(),action:function(){this.get("pane").remove(),CloudOS.notifyRemovalOfDialogAboveApp(),i.set("isDisabled",YES),n&&i.invokeLater(function(){this.set("isDisabled",NO)},n*1e3)}}})}}),CloudOS.SpringboardState=SC.State.extend({initialSubstate:"waitingForSpringBoardModule",enterState:function(e){SC.Module.loadModule("cloudos_foundation/springboard",this,function(){this.gotoState("springBoardDidLoad",e)})},waitingForSpringBoardModule:SC.State.design(),springBoardDidLoad:SC.State.design({enterState
:function(e){CloudOS.configureSpringboard(),CloudOS.workspaceController.set("nowShowing",CloudOS.SPRINGBOARD),CW.notificationCenter.postNotification("springboardMayProceed"),CloudOS._executeReadyQueue();var t=CloudOS.appController.getDefaultApp(),n,r;t&&(n=t.get("isHSALocked"),r=t.get("isPCSKeysDeletedLocked"),n&&(t.set("loadReason",CK.LOAD_REASON_LOCATION_HASH),CloudOS.appController.set("pendingApp",t))),CloudOS.workspaceController.clearHash(),this.gotoState("displayingSpringboard",{defaultHSALockedApp:n?t:null,defaultPCSDeletedLockedApp:r?t:null,callback:e})}}),displayingSpringboard:SC.State.design({initialSubstate:"springboard",springboard:SC.State.design({enterState:function(e){var t,n,r;e&&(t=e.callback,n=e.defaultHSALockedApp,r=e.defaultPCSDeletedLockedApp),CloudOS.bannerManager.selectBannerAndShow(),t instanceof Function&&t(),r?CloudOS.statechart.sendAction("showPCSDeletedMessage",r.get("displayName")):n&&CloudOS.statechart.sendAction("showHSA",CloudOS.HSASourceEnum.USER_SELECTED_APP)},userDidChooseApp:function(){var e=CloudOS.appController.get("pendingApp");e?(e.set("loadInBackground",NO),this.gotoState("active.springboard.waitingForApp")):this.gotoState("active.springboard")},globalAppSwitchWasRequested:function(){this.gotoState("active.springboard.waitingForApp")},appCalledSwitchToApplication:function(){this.gotoState("active.springboard.waitingForApp")},showAccountSettings:function(){CloudOS.openApp("settings")},logout:function(){try{CK.clearSessionStorage(),CloudOS.authController.logoutUser(function(){var e=window.location.toString();e.indexOf("#")===e.length-1?CK
.reloadWithReason("logout from springboard",e.substring(0,e.length-1)):CK.reloadWithReason("logout from springboard")},YES)}catch(e){SC.Logger.error("Error during Signout: "+e)}},showPCSDeletedMessage:function(e){CloudOS.authController.showPCSDeletedErrorMessage(e)}})}),waitingForApp:CloudOS.WaitingForAppState.design({userDidChooseApp:function(){var e=CloudOS.appController.get("pendingApp");e?(e.set("loadInBackground",NO),this.gotoState("active.springboard.waitingForApp")):this.gotoState("active.springboard")},globalAppSwitchWasRequested:function(){if(CloudOS.appController.get("pendingApp")===this._app){SC.info("Already waiting for app to load");return}this.gotoState("active.springboard.waitingForApp")},appCalledSwitchToApplication:function(){this.gotoState("active.springboard.waitingForApp")},logout:function(){this.abortLoad(),CloudOS.statechart.sendAction("logout")},showAccountSettings:function(){this.abortLoad(),CloudOS.statechart.sendAction("showAccountSettings")}}),exitState:function(){}}),window.VERSIONS={fonts:SC.buildNumber,cloudkitjs:2},CloudOS.AdjustablePane=CW.PanelPane.extend(CW.Animatability,CW.PaneAnimationSupport,COS.AnimatedPane,{classNames:["adjustable-pane"],classNameBindings:["isFullScreen:full-screen"],layout:{centerX:0,centerY:0},modalPane:COS.AnimatedPane.modalPane.extend({classNames:["adjustable-pane-modal"],showingState:{opacity:1}}),delegate:null,show:function(){var e=this.get("delegate");e&&typeof e.show=="function"&&e.show.apply(e,arguments)},paneDidShow:function(){var e=this.get("delegate"),t=this.get("layer");e&&typeof e.paneDidShow=="function"&&
e.paneDidShow.apply(e,arguments),t.focus()},paneDidHide:function(){var e=this.get("delegate");e&&typeof e.paneDidHide=="function"&&e.paneDidHide.apply(e,arguments)},minContainerWidth:Math.max(COS.MIN_WIDTH,window.innerWidth),minContainerHeight:Math.max(COS.MIN_HEIGHT,window.innerHeight),maxWidth:640,maxHeight:null,horizontalMargin:50,verticalMargin:52,isLoading:NO,acceptsFirstResponder:YES,isFullScreen:NO,viewWidth:function(){var e=this.get("minContainerWidth"),t=e?Math.max(window.innerWidth,this.get("minContainerWidth")):window.innerWidth,n=t-this.get("horizontalMargin")*2,r=this.get("maxWidth");return r?Math.min(r,n):n}.property("horizontalMargin","maxWidth"),viewHeight:function(){this.get("isFullScreen")&&this.set("maxHeight",null);var e=this.get("minContainerHeight"),t=e?Math.max(window.innerHeight,this.get("minContainerHeight")):window.innerHeight,n=t-this.get("verticalMargin")*2,r=this.get("maxHeight");return r?Math.min(r,n):n}.property("verticalMargin","maxHeight"),init:function(){arguments.callee.base.apply(this,arguments),CloudOSBootstrap.isOnSupportedMobile&&this.maxWidth>Math.min(this.minContainerWidth,this.minContainerHeight)&&(this.maxWidth=null,this.maxHeight=null,this.horizontalMargin=0,this.verticalMargin=0,this.set("isFullScreen",!0))},contentView:SC.View.extend({childViews:["openingTabCatcher","loadingView","closingTabCatcher"],paneContentViewObserver:function(){var e=this._lastPaneContentView;e&&this.removeChild(e);var t=this._lastPaneContentView=this.getPath("parentView.paneContentView");t&&this.insertBefore(t,this.get("loadingView"))}.observes("parentView.paneContentView"
),openingTabCatcher:SC.View.extend({tagName:"span",classNames:"tab-catcher".w(),attributeBindings:["aria-hidden"],"aria-hidden":"true",ariaRole:"presentation",acceptsFirstResponder:YES,keyDown:function(e){e.which===SC.Event.KEY_TAB&&(e.shiftKey?this.setPath("parentView.parentView.isAtStartOfPane",YES):(e.allowDefault(),this.resignFirstResponder()))}}),closingTabCatcher:SC.View.extend({tagName:"span",classNames:"tab-catcher".w(),attributeBindings:["aria-hidden"],"aria-hidden":"true",ariaRole:"presentation",acceptsFirstResponder:YES,keyDown:function(e){e.which===SC.Event.KEY_TAB&&(e.shiftKey?(e.allowDefault(),this.resignFirstResponder()):this.setPath("parentView.parentView.isAtEndOfPane",YES))}}),loadingView:SC.View.extend({classNames:["adjustable-pane-loading-view-container"],isVisibleBinding:".parentView.parentView.isLoading",layout:{top:0,right:0,bottom:0,left:0},childViews:["spinner"],spinner:SC.View.design({classNames:["adjustable-pane-loading-view"],childViews:["icon","label"],layout:{left:.5,top:.5,height:"auto",width:"auto"},useStaticLayout:YES,icon:CW.SpinnerView.design({classNames:["cw-spinner-view"],asset:SC.platform.dpi>1?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAJACAMAAAD8YRVdAAAAb1BMVEUAAABqfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo4vepBaAAAAJHRSTlMAAkVSBVZOShgL5aJ1P4kRLW42tVnZziUfXL6qkGaAxwGY9u0j4KR3AAATTElEQVR42uya6bKzKBCGjYoL4gbugMbo/V/jtHowJsETrK9mampquvLjVNKvTdMsDxwtvdkY29YFc8t5Lt3vfmmoBNM8T0pwv535t7iMfwR4nvGPILD9QO8fQjuq8F3g2kXh62O4wwPP/bsgQ55jnzTKmfE01a+C0PM8FJwl0c14Hl8FFPkots6MTtM020dBgDzPSa1TExCiOwpi5BeZJt27tVmAIW/5rEODfMcLP5MduBoHZMaPMrBuS6Vv0KXIQ7V6WBwHP39VuMQR/enaeQ1ByxK+qAsPxVv0lCJU+O4mGHBV4apf9fY8P+JFuaVcFOu3buZB9kpg2R0uhxIPcqmPJw7DtKGNBVb7yPM95Df7oCMQASScaodkjBC4O/SYfS3KEtqFNTUKEDzeQfS9GjaHdj0STTULcLcbTTFkN5WaCE3R+pl+MgVtpv26Dq0/spur7BcfZcvwipTxsT6Z6rGtLE4tNnTKKnHXPt4uHGWFbfHqKUgsAwEd9yaJ5qRJ9tOWoXUp6T+zwK+1LQpOliVnZJFGETgo1iVHEx6NrPj8IW499DlW65zzceRRpht8jgfzLQuPrWyjxZ332hwaHzkwwg8JUgGtgTLY21p6UAVZqmY0SOL051t4PHyKcPUXYxI8J1vrhNua4SyLgH1TAs7zrSNCkvQiAw/HSUHd+oj+tMtGzr5qxIKoZH3RJ3lo3REhzt1KPcdDzU+xa/+5arh7G/otwK3N8/a2JOQjWw3hUDN2WtELaT0Fru+otVJrddInSXMQWDXyHP90St9zCOBZR4EVIw/RMwEVkEJ4EJzvKM8uja2DQO1ZJyHSXoy5+y4IPVTYd70i7kljvQusxvODU3RwrU+BFYYGi1tBSHG3LlgjZWNdsbgs40vr7TDPg8Gasqfnlo/HDljnC5YzdPTHp3o8KrVllqVz8vxhmrrwXZDiFQp05rKywuRdkMzn+OfjqqyaV0H9AEF7lkSEB5y8Chj4V9aZZbBXl/FR4M9gv1SkhxD8KKjAP/qFl1JIAhfPOuTg/wg+k+VCRZWQd5eule5uVjCBoP/kJVYNQ5JtY4LjaoJOocMANSSqS195KWUVYwPL03XU4alcyn1fWumBwNPwUhxVHWMVL5bhZieHGSy51PJSKCEC64YxM+alpu9AAg0356V4HDpWkiu8hAAK6CVeSp1/By/RRCSbib4x4SXYnJWx3oSXjgJiwktZokyQ4F/HS2ncXOIlux+TxpyXslwk/eib8lLTgnsvktqQlzwoc58I2ZjxUkZWd0LX6Wg333gp7UUPn40QakJk+o2XEiFEu1XZbXOZQ+wwjsNzXqJEqvbFROaFa93joogtA15K5Rbg5juObcJLPgTw1gEKAgNeauD5eaAEBrxU5JLElhJ856WMQArhLvjOSy0EyKxd8JWXQkkIuj0F33mJSijfU2DAS6qnlcCcl+42goJdO91AO64Y7Tp6ab1lGDMTXtoRqSvLbu+B0wXL5jzbwaZkasusSl/v7/KqisJ3QVid4o87dqySR4G6SxlOGhUPrGPBq6DBE56dsyTEwAbyKhjX+6AzywAIBnoUxI9pmn6pSF6xQRwFHQQQn37PRQCSGPxnHSRkjIO9nHuyoldRC8ibp0BB08SBl8oHntU+5nWV/fPYkXNO6u0h48AqD7JhLFsDzD9dStkOZyBYD7ptuv5QVV2meMkGJ3t1EfOsBIfDq3db175Dp6AILWFzvPpPO7+GxbhKei1r2MO8Gq+PE2Y7gHONwtncu3d6pT0EYfJTwBb3UmqK4QumO+JLaHySnuz42nW3gC7/I7u7t80M0SEju+WBCS/1IlE2SgNeehUY8VJOlElDXrqU9J9ZSINLvEQldKw5L9UFUXuoCS8Ffp7LJYIZL4VxTqTMcycw46VaLu6kzdZYNPjKS+APHxr+nBa88AsvpTnJcz/4QUugkeAbL2Wtp/pt5Z3vvHTbs189DHlJgUV8gZcCx3Oc9AIv2RAgM+Ul9TjXnJdUg815CcgovsRLtWen/yFeytRWYWi3CDjlEi/xruPfeSkeheKlqOsid6e5+KTSgrMkfBeE3TR1J7zURyNH74IcVwt2aI3yMRqDV0Gz3Nb4p5c/fOTyVZDgAUfnF7RRFPHsKKDLjdMvFWkhRH8URBCg/4WXwhHytp91QBhSSD+TJVJF9SBvkQIFVdUIvNRBxlIhB+vi/aS4H0NvkDeDEPU41tDCaSj57WdwLQCxBQu3o6UXbj8wXiteioFB4/WZCZ4BR3G6H16TPhH9Oj+pPHSKv11SyxLcpxmjPVcfIoAkr7VDjM0PcH+MzXHCFMlyABcahT/PGD9mTrVHfPQp4DO4V61m0sRk1B3xW4jQh/r5o7+m8PI/5SUDLjjextTtbijVu9MBKwP2lyRXRhz94/H8NPwi8L4LpmWfVealZ7fmWFlpG8HQzd3tD3mpTq/w0i3zWyc14yXFBn6bmfJSSsHdQ05qyEuZA3yDgG/MeCnYbnjt2pCXQg+tMV1TXgodpLIy5KXGj4P/eel/Xvq7eEmIa7yUcJ5c4iURReI7L9Ge1D+CJIoSxUsRpyeV7oUg4bsgBJrj+hi3POmF/y5oB9aN7lnX9EmfvgqC5bYmPktCil6gVwEZtvsgvTUJbO/1UUAHxrpfKuJBo+RRIAZW5Zp090JAEoI+6+BDxiz9TFbuEz2GECQECmKsv1lpBBkX6qe9HqEkOfGCvWtH+L7ue3iGU7Fh/OGlEeOpS5VAwiferuLFmDSKl2hVVXR//ajCQ6r+l0BymRNJ7+8vR9i9vRavw+UA/v7zbL+dd5GWNWi0upfJ8dd0PYDnuUZhYwzsikf6sShBu4j9KRBAiph5uk2xJboIzjQN+QkvZdp5bMvmn+Wlxj5eHmktY2W1WdlRy0eOsiLWP76aH8rmyvKLS4LSCg5NOllEabU3qYqNeOkeupuF97+Fl2jhmvKSQumyvcJLwwzGYnNeyufVRGDMS+o+N3dNeSkYtyBDZsxLlK2KMjTnpbYEwSO9wEshmab2Gi8Fwf+89D8vWTUh9SVeyoXIDXjJ3ZMmSUKU4O6etkO2zacgS85ozpWEtO67IEwYEycLU5FLQt8FDh8BO866RuYyfRUEy23N6XB1iCT2q0Cu90FnFix7dXMUZMvbHL9UJIZGoaOghwDtb7wkIe/sKbA5pHCcPh/LDIUQbWjdl0rfrVRAxp76KRmfK9++rN7QFqJZscNmkPEWvu6HoeLhJvCL53G2ISQPFC8tl03Z8/WjiqfqZf/t9aT6/v5yBM3pVryqY0y9qH48zgZ6/h0W94687BDrcRYhjYIO68tQSfZetHjZsjSDoK/APbI1xagBCjQR7KpkMryy7cZF8O/jJSDqzTqemfASm0plEzPhpe4pwJ0RL7G9SWwp1JWk/x5eyrxrvOQ85gFd4SU2T/ODU3NekvMD43lKzHmp3e5zS3n/zktOHy/hkwkkj7n7yksOIM/qlPHHDO0avvGSAEG3aQvgaQCsL7xE5+erp25eYvSVlyIQYNecl7Z3PckVXiIL6TVXeKkEBb/CS/4MRq/wEgNBd7/ASzUIytsVXsofE7rGS3Xwr+Clv9o71x03YSAKExLu5uoEGzAQwr7/Mxaby5CNLQZVrVZVR/1RaX1q2O2Gj2HOwa8qrABG0DG8dNENuT+NSu7Z/l6w0VxmOA7vfrc/B/XJIMhNL5C/bdl3gS26xIB/Cszd4F2QzhYKQ8UrmIPAURYKU6XX2W4HAiY7TtwoUJ8BMQjmnpaupbH7lfAcDgKwUJh4iTkTpMy2EucJFgq1O+k0vPScwObOLMtXPrdi2L6lPG8aKjS85N8rJ115iYlBMBg/aoZAw0tvH8bZfMGw5wGnoUDyUjd7hVokL2VyedQQhuWlnE7LkxjPSzGlg3OKlwrv5/ESE9FagmF4Kdo54iLgJaQAw0tZ1KwWuij7Gbxkn+Ml7xE23hleisYyfAwZnpfu40MZVlM0LzmLYbVC8JLdFerj8jEbVpmRl+Dh96gWZcMkKUdq5qWslvjVfYUrN7g0nI7KxEvK6Fs+rWx8baOnt7buXQMvgZU4WSYxVfmpiZfArJzKWc/8kJdAYLXKi3zISyB4Kg/2IS+BwLJf4fg65iUQWJH81h7x0l7ARjCBGXgJBKraMXTNvKSz1nPEB5/aAQEnbx3+q/UnAetpT5zyxPISQCKel/YCXlX8mJdAcKsIqS6HvASCQlooDnkJBKpbww55CQQ2acn1kJdAwPO8zf1DXgLBVY5/HvISCJSFAsNL6rbsOVsoiq0LmDMzL6W2nc4bOJcFxoUQxMRL29aEEA7jR6I75CXmsbnXJhK5PsPxEmvV8uSaInlJgFcIxUvVoLxCeF4qxNDZt1OX3Tj9cbzEO7DQYXjpklBwxCUYXtoJGoHhJQauvuRn8BKLz/FSXPeDfYaXkpL2fXKCl1zVnKU5npe8pq9p3Teufn6pirx9HzxT49q16tEKruGlVrWUlrInbmBzT1pKyuH2wUvpODeIGKXTSvLqQ7FoJ54um09eGmR/KLUutWqXZDB6Kg2r1P74qMxUBwqsxNKLvA23pqne4NHvzMqpnPWsLGO5c6sHBNY9LB+9b1iuSE/BEQisJizDxCQgm10GBPGjfJgmYlMwP4PAEtN5D0+tgIP5eSfgZTiaTGDdGGqM7/eyt43Qp7XW8xTRzCmB23DlhaH3D/ES5C8heAnyl1C8BPlLSF6C/CUkL8EtCJKX4GkzkpcgfwnJS5C/hOSl9/wl7jr8iJcgf0m5c0h7wEuQvxTE84zTAS9t+UtyKkiuZzhe8q/zqJId4HiJz8tdH8tLHpFeIYbmJeWoLk7xEiv+Bi8tK5C85LfgV+MYXsrFLhEAwUsXshdgeInnZCuG5KVlxe/yEiPak+Cmn3M3Knco1Da52RX6Z2JTaRoMhA7SsPrpcZCl28Gm0WZYBf/JvFw/ohmvaUvP7WhGtTzM1Z3bsFMVLVN+9Uj1aDu+/PvLzJTa05m6B9lu4qzma096GGhyA4ShxRK59xplg4ipgYX20fQdZFLRtSudwzyj6g8tRt+nxWD0VBpWoSsdbGevOlBgJZZe5Oii56WtEUN3ZuW0qWnpWMayX+P4erNDu9KLbOYlGWyXfDNcKw+2ocD8DIJi2qI2RadBQwwEVjdtoY8CUU8c+9t3Aae90QSWj2XxaXx3KY2NKBDorPV+ijfv4yvue/s/L/3npT/AS5C/hOMlyF9C8hLkL+F4CfKXULwE+Us4XoL8JRQvQf4SkpcgfwnPS7+fv3Q7GUVUhVuVhek/cbXWdJJfuyqfhkf64IirrNdO0OuPp3oTXMH8ZnJG+GChu/OzoVO/VzwvtEeUXQy89FDRrVDb5GauOzmn/3rJa+hHtUOXJBX/8PjKKSXtDoVIFsMqFBfLvJH2HIrFsFpsP9brOtGkbhcSUC3+jGDNc/JXIvkKpz/zM0B3fJUMDpRGapFfScOqDEXc8u6abDE/zw0iLmS7yqFDk4NhdetKt4+tc0Sk+TmwLqKUyak8gtHTW0x2Xent7B9yA7ASSy9yYpg33hox0c6sHMhZT1O/Alo9ILBs5UU2X/+V+RkE4MHWVyXbVem7IJu2iEy8BObnvWl82iI38FIZjs1tJ9hSRRMDFLRlrTG+29FQGJEk2FnrI+AlvHkfX0VDi/+89J+XrOByjpfasXTO8BKH21AELymBqoGjeem62HG6G5aXfLFcpz00L2XNLHHxvOSUUtCc4KWATKfincv3JvGfzasMcOhwLdd61BkmfyncedkoIn/pXWAhBF6/HRJl5/Iqg7/AS60haNTAS3n/ehSaNlWea51WLpXh8kTzBdJuSUVQ2RDKKSXdDhmR7VNpWIXyl3mjSHsO2WJYhS96vVpeV9b3iDTmcchzIusnGlcG2JKkq9uBy79A2DckRt0XXpJsLBZeiuYGkU+IP6mHTlTLXhWZtrmtQ1bRFrwr+0OL0fep0rvX55WXom3ZJy/VcgOwEruiE7mBl7ZGTAJmZZj1NIYd0rrOQLBMk6bGi61sJuXvhutcebAN5ZYqOg8EECquraCpae9YINhiy6unVpDSvhxu3wVpp6xB2nJopDO+d11m5iWdtT4N8OZ9fGXDkP0IXkqDc7zUhg/7DC8FL/VsGs9LgWxkizO8dP+aip3hpXISNGd4KZZbeGd4KZI4AALE+1BekyI/5KXqUa/I0ElI8Y94aYRG+e0htzjgJT+Ut5aj8NcH+fYRL3nLzStRfY7BRbwPpVtuj2M8L0XKjvPl4XnJVbf4w5l873xqItjneKktfkS+t0fB/IbipT4E81uE4KV3AYaXYjik6Ae+D+WenclfCqoGQBSRv2RHMlw+R78PpZs9ocj3ofjrvFGGy1+KG7m8bK7W94g0Xvi696HQnk5/2iU5gMLPTzpm08/8JV73fd/NGwZibhD5beuryVPiafKX3EZswbuyPySNvoNMTvWX9G5zvrevOlBgJY5huFWbv6QaMcQCAcRlm2wIstUDApgmNV3/F/MzCCxHZZkYSpmfAxDsQsW1BQ0xEKi5AuIZeClqaPdhS09b83tIvCjRGd+BV03vQwEB/n0oBMz7uMqM3PYL4h8r2tYEYzUAAAAASUVORK5CYII="
:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAEgCAMAAACZ90O+AAAAclBMVEUAAABqfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo5qfo6hB9TKAAAAJXRSTlMAAwkUGWZNBgw/OFQqH08wRSQBanZe0LaqxOqPf2+HEJpX3aD2cXXUFAAACAVJREFUWMPNmdm22yAMReUBx2A8xROeR/3/L9bgJsGBdrV9Kg93JT4XYcS2kqPAZzh17cDX4KUL4CK6p8xDTSixfwlpyTUh7pBfQlhFrh6LYAMO4gNoEb+u5YUHADUmgAgzyQDgkbsq/lYBMBQQrcDkf+WJWsefDmwYUBUi9MDLSMWudVKBmL4ie4RQD14jWfzXy5C+VncfjyfcxtNxHIClbZqmZZ/LfpQESUQtwpoEwUpVKMcWSg1aeu/Fmf/J7VC3+TvSSNj888bbeuKQq3fhDH5QrPwBAFW3ZwB5s0IcAyUhPPlaygBxEsqMCQ7jCHFB5bz0fVi0qeBZFE/IiA/a8PrFA4cQ51wxeGhC0AZwCcDO+NpuM+cUxvH8+1Dx7xte1yfYhtM0Blf5+HjhE476GgUOp9B1pyBw0hffjvwSUsRYj7XiDk7XOVBj+aawkulrMJNcrdhdXF0QRnCGWCAIoMXszZVXbseeAlOheaBzxfvj+AVX2fQXXE1iWXaRmlwNUtjTv+WKVbONq7gQIja5mtddnKn2w2+uknZi56w+A9+/ceVnrsRuiiGKTK7SPoBnkhhczWMZghMEBld0ZyAFgyuPSa6i6BdcUfoLroQwuIorydW2yao16pRUOJ7R6/qUeyz1xdstBreuXeDY3bgKjv6qiQ2SdzrVo7Z3FLYNEqzlJSJnrd0eAKTHBFl2TmAA46H4nUkjH+fUVyRlENSI4tp9PtR1/iYJsc4AzJLBmxGu8TC4AgXD2A/D1HOTq0IKU27h6vE7rngQ2rjy137yTa7CbJhWHzz3myu6kBTAK9g3Vx6TckB8K1d5waxchVHlWrlKS27naubPf+Kq7w2u/Ehy1baSK6JTknTVGb1pTnnAQudqb3xwpZAf220jtC6vmrjj+v7vTN5fX6fQtpBhIy9VsSrGEwXI6xEoOyekAKTDQW4uWsS5W644ySnQFnGPzQJAEVv6yVU1f7iqXlw5xn5d1wVYR0IK/SmKDjxHC9G3UKEctQz1HeuhQqkRM/fDVfjJFC3IbHLlsopknoWrtExyK1ch/7+5GgYjz172OIMIIf9W+m1lbXJeWpZTKLDSF58W7xLirb1thDUEnH13oD+CT2l1f341EAJot8sAah22FClAfDKQpueE83VV43g9zv1JXqy4itMzKmLv/3wIpk8BYIiCAZglI98jvTjdU6BgyKLgLE++Xmm7rsMGqKpbngacEloV6mmGMrniS2LnKkJsUitXVYfYeyZXLrgT4mDnig/8/+GqKAyuZiaD9L3kKvF0SHZZ/YfhFKou0W93HOZL8JtdnwG8T8CZJgfK+l1IVErUV4O+B1b3ar/+O4l+HwDn54TzddIoft20Ks60+7MiiUO6HNvg/zwoQt4rpsexpADm0cb9RbUVhoeVq2yr63rbTa6yTgriF6FCc/F8yexcBYiCm1zlDJINcZrvXHlQYwrOgFh+c1XiJucN+RdXABtWdq4yPDw7Vy2Wdq78If9jrp5RZAgh/1iAzLsZxfRlGpKWaoIbVeEleMs0a4J6kp6EPIE07M5VRnxpZVKhspTdH848PyfEANneRR+uvFAdTQ58qtvCM7nidT1wG1f+QH/D1cPGFVM+sDe5opfw61Am1NTOVYa43LkKr6mQtdiV4S0lSQAN8vNcOiQaVzMgQoWtnFfeuHogOtJ1G1wpS8ZwM7hSAggkd65egjfERlna9HaCCZzJ1YWow0KDKwU1XZjBlRTmYQwNrmRBTnpuchVFkE+qINH5u+gn8oOOTW32zdUcQz6KfZ1NrnJxuiobVx5hv+PqYeEqFfuyiNLkionlFIa/4GpgN67CdyTsplznKlPvYg5UHDX5cJVgI62MwBycqsX1ncQOE8ADVhQq1+9zH7BVNly5bm1wxLdxr3WuFlxeVr+/lTg2OG+uSpOrtv03rriVK8W3jSvVv7JyRYvYypVPLnDCb65U/yotFvbNVehBvE5DFppcxdO0xjau5oj/LVe8n4ahJyZXqRIKFQpsodQY9XZCqn1FRWTvSFv786hioZxspt75ObC+blblmvEYZWHbgVLou/g8F9EFcu4ob2nDDLZNum7lNd+3P2Jz2fD9oKCN/MCXce+aWRMmnF5Wf8DkVsicV3NgLnxLO+G/5uqRuzauVP9K58rsiyqu7P0rj7mW/pXrPow2w0Oe0Dn0jMZjQciYQC2vH4He3iOnEKlQYPQZXsEr8T4Er+Lap6vWxuWN+OmL4l05WabeeTHwQSyBjN5jRwAY9sAYDK0PTta3VM4tJBYtUmmqaT3IeYH38azLZcOnmt2OY+vin8a9Xe4t71JZfRdg7DL9zEdHNQcecJ6tZ3C1LP8PV2np27nqUe5uNrhSad8CG1eq5ZDZuapEbHIVuq616dTi6fKOzOxf6YLev/p1KDWiT7N/DmLtQ1TjKu6nnyj4E2LDIL248iEnfakaVAPWlfQjg7TIRHjgsFFZk1x9TIqOSVPNmkKuQ+ePZ52kDX/CKPjtONra/2nc90E/2gLJy+pXrY5iTpxXcyAMPEs74c+54qVr52pCYecqRkztXJVYA3xxxVUJ75B8czVhp4p++82Vv1wfE7nJFWsQmZ2r1c6VvZkplP2jJleXYP0dxx7qGsFk+x1HOtmOm/0rv9ykk+XetcFP/2rEJpF+pJBWJpq8z+84lWoCtin0E/A+uvevsnq8bPg63TycLxrvp3GfiH5QVbe+rH6wpPrRru/mgEtnSztBw+cHG+C7rO6hXYcAAAAASUVORK5CYII="
,useStaticLayout:YES}),label:SC.LabelView.design({layout:{height:"auto",width:"auto"},useStaticLayout:YES,localize:YES,value:"HostingContext.Loading.Label"})})})}),isAtEndOfPane:NO,isAtStartOfPane:NO,isAtEndOfPaneDidChange:function(){this.isAtEndOfPane&&(this.get("layer").focus(),this.becomeFirstResponder(),this.set("isAtEndOfPane",NO))}.observes("isAtEndOfPane"),isAtStartOfPaneDidChange:function(){this.isAtStartOfPane&&(this.getPath("contentView.closingTabCatcher.layer").focus(),this.getPath("contentView.closingTabCatcher").becomeFirstResponder(),this.set("isAtStartOfPane",NO))}.observes("isAtStartOfPane"),_windowDidResize:function(e){SC.RunLoop.begin();if(this.get("isFullScreen"))this.set("layout",{left:0,right:0,top:0,bottom:0,minWidth:COS.MIN_WIDTH,minHeight:COS.MIN_HEIGHT});else{var t=Math.max(window.innerWidth,this.get("minContainerWidth")),n=(t-window.innerWidth)/2,r=Math.max(window.innerHeight,this.get("minContainerHeight")),i=(r-window.innerHeight)/2;e===!0||!this.get("isPaneAttached")?(this.stopAnimation("width"),this.stopAnimation("height"),this.adjust("width",this.get("viewWidth")),this.adjust("height",this.get("viewHeight")),this.adjust("centerX",n),this.adjust("centerY",i)):this.animate({width:this.get("viewWidth"),height:this.get("viewHeight"),centerX:n,centerY:i},{inertia:3,speed:10,headStart:2,ticked:2,discreteness:2})}SC.RunLoop.end()}.observes("viewWidth","viewHeight"),windowSizeDidChange:function(){var e=arguments.callee.base.apply(this,arguments);return this.get("isFullScreen")?(this.maxWidth=null,this.maxHeight=null):(this.set("minContainerWidth",Math.max
(COS.MIN_WIDTH,window.innerWidth)),this.set("minContainerHeight",Math.max(COS.MIN_HEIGHT,window.innerHeight))),this._windowDidResize(YES),e},didAppendToDocument:function(){this.windowSizeDidChange()}}),CloudOS.AppsContainerView=SC.View.extend(CW.Animatability,{layout:{top:0,zIndex:100},classNames:"apps-container-view overflow-visible".w(),isOnscreen:NO,isOnscreenBinding:"CloudOS.workspaceController.applicationIsOnscreen",isFullWindow:NO,isFullWindowBinding:"CloudOS.workspaceController.applicationIsFullwindow",wantsAcceleratedLayer:NO,displayProperties:["isOnscreen"],useDisplayNoneForHide:SC.browser.safari,_isViewBeingHidden:!1,update:function(){window.appsView=this;var e=this.get("isOnscreen"),t=document,n=t.body,r=t.documentElement,i=window.innerWidth||r.clientWidth||n.clientWidth,s=window.innerHeight||r.clientHeight||n.clientHeight,o,u=CloudOS.bannerManager,a=u.get("bannerHeight");e?(this.set("layout",{left:0,top:a,right:0,bottom:0,zIndex:100}),this.invokeLast(function(){this.get("layer").style.pointerEvents=""})):window.showHiddenApps?(this.set("layout",{left:0,top:a,width:i,height:s,zIndex:100,opacity:.1}),this.invokeLast(function(){this.get("layer").style.pointerEvents="none"})):this.set("layout",{left:-1e4,top:-1e4,width:i,height:s,zIndex:100}),e&&this.layoutAppForShow()},didCreateLayer:function(){this.update()},layoutAppForShow:function(e){var t,n,r="0",i="100%",s=CloudOS.bannerManager,o=s.get("bannerHeight");if(!e&&!(e=this._currentApp)||!(t=e.get("view")))return;if(!(n=t.get("layer")))return;t.get("usingPrevCreatedIframe")&&(r=o,i="calc(100% - "+o+"px)"),n.style.cssText="left:0px; top:%@px; width:100%; height:%@; z-index:10; position:absolute;"
.fmt(r,i),n.setAttribute("aria-hidden","false")},bannerHeightObserver:function(){var e=CloudOS.bannerManager.get("bannerHeight");this.animate("top",{to:e,duration:CloudOS.BANNER_ANIMATION_DURATION})}.observes("CloudOS.bannerManager.bannerHeight"),layoutAppForHide:function(e){var t,n;if(!(t=e.isAppFrameView?e:e.get("view")))return;if(!(n=t.get("layer")))return;var r=document,i=r.body,s=r.documentElement,o=window.innerWidth||s.clientWidth||i.clientWidth,u=window.innerHeight||s.clientHeight||i.clientHeight;n.style.cssText="left:-10000px; top:-10000px; width:"+o+"px; height:"+u+"px; z-index:10; position:absolute;",this.useDisplayNoneForHide&&(n.style.display="none"),n.setAttribute("width",""),n.setAttribute("height",""),window.showHiddenApps&&(n.style.webkitTransform="translate3d(10000px,10000px,0px) scale3d(0.8,0.8,1)",n.style.zIndex="2000"),this.get("layer").setAttribute("aria-hidden","true"),n.setAttribute("aria-hidden","true")},addAppFrame:function(e){this.appendChild(e),this.layoutAppForHide(e)},removeAppFrame:function(e){e&&e.get("parentView")===this&&this.removeChild(e),e===this._currentView&&(this._currentApp=null,this._currentView=null)},showApp:function(e,t,n){if(!e&&!(e=this._currentApp))return;var r=this,i=this._currentApp,s=this._currentView,o=e,u=e.get("view"),a=i!==o,f=s!==u;f&&(!n&&s&&this.get("isFullWindow")?s.animate({opacity:0,duration:550},{onstart:function(){t&&i.ensureWillSuspend(),s.adjust("zIndex",1e3),s.adjust("height","100%"),s.adjust("width","100%"),a&&(r._currentApp=o),r._currentView=u,r.layoutAppForShow(),t&&r._currentApp.ensureWillBecomeActive()},onfinish
:function(){s._shouldBeDestroyedAfterNextSwitch?(s.removeFromParent(),s.destroy()):(s.adjust("zIndex",1),s.adjust("opacity",1)),r.invokeLast(function(){a&&r.hideApp(i,NO),t&&(i.ensureDidSuspend(),r._currentApp&&r._currentApp.ensureDidBecomeActive()),r._currentApp.focus()})}}):(s&&s._shouldBeDestroyedAfterNextSwitch&&(s.removeFromParent(),s.destroy()),a&&(this.hideApp(undefined,t),this._currentApp=o),t&&(this._currentApp.ensureWillBecomeActive(),this._currentApp.ensureDidBecomeActive()),this._currentView=u,this.layoutAppForShow(),this._currentApp.focus())),this.get("layer").setAttribute("aria-hidden","false");var l=this.getPath("_currentView.layer");l&&l.setAttribute("aria-hidden","false")},hideApp:function(e,t){if(!e&&!(e=this._currentApp))return;t&&e.ensureWillSuspend(),this.layoutAppForHide(e),e===this._currentApp&&(this._currentApp=null,this._currentView=null),t&&e.ensureDidSuspend(),this.get("layer").setAttribute("aria-hidden","true")},zoomedOutScaleFactorForAnimation:function(){return.9}.property(),show:function(){var e={opacity:{from:0,to:1}};COS.ENABLE_TRANSFORM_ANIMATIONS&&COS.ENABLE_SCALE_ANIMATION&&(e.scale={to:1,from:this.get("zoomedOutScaleFactorForAnimation")}),this.set("isOnscreen",YES),this.invokeLast(function(){if(this._isViewBeingHidden)return;this.animate(e,this.gpuLayerFunctions,{duration:550*COS.ENABLE_APP_ANIMATION,onstart:function(){this.view.showAnimationDidBegin()},onfinish:function(){this.view.showAnimationDidComplete()}})})},hide:function(){this._isViewBeingHidden=!0;var e={opacity:0};COS.ENABLE_TRANSFORM_ANIMATIONS&&COS.ENABLE_SCALE_ANIMATION&&(e.scale=
this.get("zoomedOutScaleFactorForAnimation")),this.animate(e,this.gpuLayerFunctions,{duration:550*COS.ENABLE_APP_ANIMATION,onstart:function(){this.view.hideAnimationDidBegin()},onfinish:function(){var e=this.view;e._isViewBeingHidden=!1,e.hideAnimationDidComplete(),e.set("isOnscreen",NO)}})},gpuLayerFunctions:COS.ENABLE_TRANSFORM_ANIMATIONS&&COS.ENABLE_APP_ANIMATION?{addLayer:function(){this.view.set("wantsAcceleratedLayer",YES)}.listens("start"),removeLayer:function(){this.view.set("wantsAcceleratedLayer",NO)}.listens("finish")}:{},showAnimationDidComplete:function(){this._currentApp&&(this._currentApp.ensureDidBecomeActive(),this._currentApp.focus()),this.set("isFullWindow",YES)},showAnimationDidBegin:function(){this._currentApp&&this._currentApp.ensureWillBecomeActive()},hideAnimationDidComplete:function(){this._currentApp&&this._currentApp.ensureDidSuspend(),this.hideApp()},hideAnimationDidBegin:function(){this._currentApp&&this._currentApp.ensureWillSuspend(),this.set("isFullWindow",NO)}}),function(){function c(){this.init()}function h(e){this.camera=e,this.init()}var e=window.location.href.toLowerCase(),t=e.indexOf("disablebackgroundanimation")===-1,n=e.indexOf("crazyawesome")!==-1,r=e.indexOf("double")!==-1,i=e.indexOf("triple")!==-1,s=2*Math.PI,o=new Date*1,u=!SC.browser.chrome&&!SC.browser.mozilla,a=Date.now(),f=CloudOS.sin=u?function(){var e=[],t=1e3,n;for(n=0;n<t;n++)e[n]=Math.sin(n/t*s);return function(n){return e[(n/s*t|0)%t]}}():Math.sin,l=CloudOS.cos=u?function(){var e=[],t=1e3,n;for(n=0;n<t;n++)e[n]=Math.cos(n/t*s);return function(n){return e[(n/s*t|0)%t]}}()
:Math.cos;CloudOS.Camera=c,c.prototype={out:0,outX:0,outY:0,outZ:0,x:0,y:0,z:-1.4,fov:90,focalPlane:0,circleOfConfusionRadiusMultiplier:.02,maxCircleOfConfusionRadius:.01,windowWidth:1e3,windowHeight:1e3,xMin:-1,xMax:1,yMin:-1,yMax:1,init:function(){this.setFov(this.fov)},setFov:function(e){this.fov=e||this.fov,this._tanHalfFov=Math.tan(this.fov/2*Math.PI/180)},setWindowSize:function(e,t){this.windowWidth=e||this.windowWidth,this.windowHeight=t||this.windowHeight,this.zoomSquare()},zoomSquare:function(){var e=(this.yMin+this.yMax)/2,t=(this.xMax-this.xMin)/2*this.windowHeight/this.windowWidth;this.yMin=e-t,this.yMax=e+t},threePointToTwoPoint:function(e,t,n){var r=this._tanHalfFov*(n-this.z);this.outX=(e-this.x)/r,this.outY=(t-this.y)/r},twoPointToPxPoint:function(e,t){this.outX=(e-this.xMin)/(this.xMax-this.xMin)*this.windowWidth,this.outY=-(t-this.yMin)/(this.yMax-this.yMin)*this.windowHeight+this.windowHeight},threePointToPxPoint:function(e,t,n){this.threePointToTwoPoint(e,t,n),this.twoPointToPxPoint(this.outX,this.outY)},threeLengthToTwoLengthAtPoint:function(e,t,n,r){return this.out=e/(this._tanHalfFov*(r-this.z))},twoLengthToPxLength:function(e){return this.out=e/(this.xMax-this.xMin)*this.windowWidth},threeLengthToPxLengthAtPoint:function(e,t,n,r){return this.threeLengthToTwoLengthAtPoint(e,t,n,r),this.out=this.twoLengthToPxLength(this.out)},twoLengthToThreeLengthAtPoint:function(e,t,n,r){return this.out=e*this._tanHalfFov*(r-this.z)},pxLengthToTwoLength:function(e){return this.out=e*(this.xMax-this.xMin)/this.windowWidth},pxLengthToThreeLengthAtPoint:function(e,t,n,r)
{return this.pxLengthToTwoLength(e),this.out=this.twoLengthToThreeLengthAtPoint(this.out,t,n,r)},circleOfConfusionRadiusAtPoint:function(e,t,n){return this.out=Math.min(this.maxCircleOfConfusionRadius,Math.abs(n-this.focalPlane)*this.circleOfConfusionRadiusMultiplier)}},CloudOS.Circle=h,h.bitmapCache={},h.prototype={COLORS:"#127acb #5c6cde #0caeef #32e0ff #31eeda #d761e9".w().map(function(e){return CW.Anim.decodeColor(e)}),sx:0,sy:0,sz:0,dx:0,dy:0,dz:0,size:0,aspectModifier:1,aspectAmplitude:.01,aspectFrequency:1.3,initialRotation:0,rotationSpeed:.5,maxOpacity:.2,opacityAmplitude:.07,opacityFrequency:1.3,x:0,y:0,z:0,opacity:0,blur:0,color:null,lifespan:0,birthTime:.3,deathTime:.3,fadeInTime:.8,fadeOutTime:.8,additionalStaticBlur:0,age:0,camera:null,transformStyle:function(){var e="transform",t=SC.browser,n,r;if(n=t.webkit)r=parseFloat(n,0)||0,r<602.1&&(e="webkitTransform");else if(n=t.msie)r=parseFloat(n,0)||0,r<11&&(e="msTransform");else if(n=t.mozilla)r=parseFloat(n,0)||0,r<11&&(e="MozTransform");return e}(),hasMozElementBackgrounds:SC.browser.mozilla,avoidSmallBlurFractions:SC.browser.mozilla||SC.browser.safari&&parseInt(SC.browser.safari,10)<537,init:function(){var e=this.element=document.createElement("div");e.style.position="absolute",e.style.zIndex="1",this.randomize(!0)},update:function(){var e=this.camera;e.threePointToPxPoint(this.x,this.y,this.z);var t=e.outX,n=e.outY,r=e.threeLengthToPxLengthAtPoint(this.size,this.x,this.y,this.z),i=e.twoLengthToPxLength(this.blur)/r;this.renderToUntransformedSizeForBlurFraction(i);var s=r/this._untransformedCircleDiameter*this._devicePixelRatioAsOfRendering
,o=s*this.aspectModifier,u=s/this.aspectModifier,a="translateX("+t+"px) translateY("+n+"px)"+(this.owner.shouldForceGPU?" translateZ(0)":"")+" scale("+o+","+u+")"+" rotate("+this.rotation+"deg)";this._lastTransform!==(this._lastTransform=a)&&(this.element.style[this.transformStyle]=a),this._lastOpacity!==(this._lastOpacity=this.opacity)&&(this.element.style.opacity=this.opacity)},renderToUntransformedSizeForBlurFraction:function(e){if(this._lastRandomizedTrace===(this._lastRandomizedTrace=this.randomizedTrace))return;e=this.discretizeBlurFraction(e);if(this._lastRenderedBlurFraction===(this._lastRenderedBlurFraction=e))return;var t=this._untransformedCircleDiameter=this.decideUntransformedDiameterForBlurFraction(e),n=Math.ceil(e*t)*2+t,r=this._devicePixelRatioAsOfRendering=window.devicePixelRatio||1,i=n/r,s="bubble_"+this.color.join("_")+"_blurredTo"+Math.round(e*100),o=h.bitmapCache[s]||(h.bitmapCache[s]={}),u,a,f,l="rgba("+Math.round(this.color[0])+","+Math.round(this.color[1])+","+Math.round(this.color[2])+",%@)",c=0*e;o.isReady||(u=o.can=document.createElement("canvas"),u.width=u.height=n,a=o.con=u.getContext("2d"),f=a.createRadialGradient(n/2,n/2,0,n/2,n/2,n/2),f.addColorStop(1-2*e-c,CW.Anim.encodeColor(this.color)),f.addColorStop(1-1.8*e-c,l.fmt(.95)),f.addColorStop(1-.2*e-c,l.fmt(.03)),f.addColorStop(1-c,l.fmt(0)),a.fillStyle=f,a.fillRect(0,0,n,n),o.isReady=YES);var p=this.element.style;p.width=p.height=i+"px",p.left=p.top=Math.ceil(i/-2)+"px",p.backgroundSize=i+"px "+i+"px",p.backgroundImage="url("+o.can.toDataURL()+")"},discretizeBlurFraction:function(e){return e<=.010001?
this.avoidSmallBlurFractions?.03:.01:e<=.060001?Math.max(this.avoidSmallBlurFractions?.03:0,Math.round(e/.01)*.01):e<=.160001?Math.round(e/.02)*.02:e<=.330001?Math.round(e/.03)*.03:e<=.480001?Math.round(e/.04)*.04:.5},decideUntransformedDiameterForBlurFraction:function(e){return e<=.050001?160:e<=.100001?100:e<=.200001?70:50},randomize:function(e){var t=e||Math.random()<.05;t&&(this.sz=this.rand(0,6,Math.pow(Math.random(),1)));var n=this.camera.pxLengthToThreeLengthAtPoint(this.camera.windowWidth,0,0,this.sz),r=this.camera.pxLengthToThreeLengthAtPoint(this.camera.windowHeight,0,0,this.sz),i=this.camera.x,s=this.camera.y;this.sx=this.rand(i-n/2,i+n/2,CW.Anim.tweens.multiSineInOut(.4,Math.random())),this.sy=this.rand(s-r/2,s+r/2,CW.Anim.tweens.multiSineInOut(.4,Math.random())),this.dx=this.rand(-0.3,.3,.5-.5*Math.cos(Math.random()*Math.PI)),this.dy=this.rand(-0.3,.3,.5-.5*Math.cos(Math.random()*Math.PI)),this.dz=0,this.maxOpacity=this.rand(.15,.24,Math.pow(Math.random(),1.7)),this.opacityFrequency=this.rand(0,1,Math.pow(Math.random(),.4)),this.aspectFrequency=this.rand(.4,.9),this.aspectAmplitude=this.rand(0,.011),this.initialRotation=this.rand(0,45),this.rotationSpeed=0,t&&(this.size=this.rand(.6,1.2,Math.pow(Math.random(),.7))),t&&(this.color=this.COLORS[Math.floor(this.rand(0,this.COLORS.length))]),this.lifespan=this.rand(12,20,Math.pow(Math.random(),.5)),this.fadeInStartAge=this.fadeOutStartAge=undefined,this.randomizedTrace=Math.random()},cloneFrom:function(e){this.sz=e.sz,this.sx=e.sx,this.sy=e.sy,this.dx=e.dx,this.dy=e.dy,this.dz=e.dz,this.size=e.size,this.lifespan=e.lifespan
,this.maxOpacity=e.maxOpacity,this.color=e.color,this.randomizedTrace=Math.random(),this.age=e.age},rand:function(e,t,n){return(t-e)*(n||Math.random())+e},setAge:function(e){var t=this.age=e,n=this.lifespan,r=t/n,i=l(r*s)*-0.5+.5;this.x=this.sx+r*this.dx,this.y=this.sy+r*this.dy,this.z=this.sz+r*this.dz,this.blur=this.camera.circleOfConfusionRadiusAtPoint(this.x,this.y,this.z)+this.additionalStaticBlur;var o=Math.min(1,Math.max(0,t/(this.birthTime*n))),u=Math.min(1,Math.max(0,(n-t)/(this.deathTime*n))),a=this.fadeInStartAge?Math.min(1,Math.max(0,(t-this.fadeInStartAge)/this.fadeInTime)):1,c=this.fadeOutStartAge?Math.min(1,Math.max(0,1-(t-this.fadeOutStartAge)/this.fadeOutTime)):1,h=1+this.opacityAmplitude*f(t*s*this.opacityFrequency)*i;this.opacity=this.maxOpacity*o*u*a*c*h,this.aspectModifier=1+this.aspectAmplitude*f(t*s*this.aspectFrequency)*i,this.rotation=(this.initialRotation+this.rotationSpeed*360*t)%360},fadeIn:function(){this.fadeInStartAge=this.age},fadeOut:function(){this.fadeOutStartAge=this.age},appendTo:function(e){e!==this.element.parentNode&&this.remove(),e.appendChild(this.element)},remove:function(){if(!this.element.parentNode)return;this.element.parentNode.removeChild(this.element)}};var p=CloudOS.CircleAnim=CW.Animation.extend({speedMultiplier:n?1.3:1,maxCircles:n?100:24,authMaxCircles:24,mode:null,camera:null,circles:null,container:null,freevars:"cameraX cameraY cameraZ time timeSpeed".w(),cameraXMouseSensitivity:n?1:.2,cameraYMouseSensitivity:n?1:.2,wantsFPSEvaluation:YES,wantsFastFPSEvaluation:YES,stopAnimatingAfter:n?12e4:6e4,_lastActivityTime:0,shouldEverForceGPU
:!SC.browser.isIE9OrLower,shouldForceGPU:NO,cameraX:{inertia:3,speed:1,current:0,to:0},cameraY:{inertia:3,speed:1,current:0,to:0},cameraZ:{inertia:n?8:3,speed:n?1.5:4,current:-1.4,to:-1.4},time:{from:0,to:31536e6,speed:1,tween:CW.Anim.tweens.LINEAR},timeSpeed:{from:1,current:1,to:1,inertia:2,speed:.7,headStart:.2,redirectTo:function(e){e===1?this.speed=3:this.speed=1,CW.Animation._inertiaFreevar.prototype.redirectTo.apply(this,arguments)}},modes:{blurred:{additionalStaticBlur:.011},normal:{additionalStaticBlur:.011}},setWindowSize:function(e,t){this.windowWidth=e,this.windowHeight=t,this.camera.setWindowSize(e,t);if(!this.running)for(var n=0,r;r=this.circles[n];n++)r.update()},init:function(){r&&(this.maxCircles*=2),i&&(this.maxCircles*=6),this.camera=new c,this.circles=[];var e=this.modes,t,n,s,o=this.modes={};for(t in e){s=o[t]={options:e[t]},s.guidForAppearance="",s.optionKeys=[];for(n in s.options)s.guidForAppearance+=n+":"+s.options[n]+",",s.optionKeys.push(n)}arguments.callee.base.apply(this,arguments)},setShouldForceGPU:function(e){this.shouldForceGPU=this.shouldEverForceGPU&&e,this.running||this.update()},update:function(){var e=this.time.current,t,r;this.camera.x=this.cameraX.current,this.camera.y=this.cameraY.current,this.camera.z=this.cameraZ.current,this.frameCount%2===0&&this.frameCount>10&&this.mode&&this.circles.length<this.maxCircles&&(this.circles.length<this.authMaxCircles||CloudOS.workspaceController.nowShowing===CloudOS.SPRINGBOARD)&&(t=new h(this.camera),t.owner=this,this.applyModeToCircle(this.mode,t),t.appendTo(this.container),t._startTime=e,this.circles
.push(t));for(r=0;t=this.circles[r];r++)t.age>=t.lifespan&&(t.randomize(),t._startTime=e),t.setAge(e-t._startTime),t.update();if(this.oldMode&&this.oldMode.deadCircles){var i=YES;for(r=0;t=this.oldMode.deadCircles[r];r++)e-t._startTime-t.fadeOutStartAge<t.fadeOutTime&&(i=NO,t.setAge(e-t._startTime),t.update());if(i){for(r=0;t=this.oldMode.deadCircles[r];r++)t.remove();this.oldMode=null,this.pendingModeSwitchToMode&&this.selectMode(this.pendingModeSwitchToMode)}}(this.elapsedTime>this._lastActivityTime+this.stopAnimatingAfter||e>5&&!document.hasFocus())&&this.slowlyStopAnimating(),this.timeSpeed.current<1e-4&&this.timeSpeed.to<1e-4&&this.cameraX.to===this.cameraX.current&&this.cameraY.to===this.cameraY.current&&this.cameraZ.to===this.cameraZ.current&&this.stop(),this._lastTimeSpeed!==(this._lastTimeSpeed=this.timeSpeed.current)&&(this.time.speed=this.timeSpeed.current);if(!this.hasFastFPSEvaluation){var s=Math.max(Math.abs(this.cameraX.to-this.cameraX.current),Math.abs(this.cameraY.to-this.cameraY.current),Math.abs(this.cameraZ.to-this.cameraZ.current));s<.01?this.fps=12:s<.1?this.fps=15:s<.3?this.fps=20:this.fps=30}else this.fps=60;!n&&this.wantsFPSEvaluation&&!this.isDead&&CW.Anim.tasks[0]===this&&CW.Anim.tasks.length===1&&this.circles.length===this.maxCircles&&(this.recordedDampedFPS=.97*Math.min(60,this.recordedDampedFPS||30)+.03*CW.Anim.frameRate,this.recordedDampedFPS<(this.hasFastFPSEvaluation?40:9)&&this._dieBecauseTooSlow(),this.wantsFastFPSEvaluation&&(this._lastWFFPSE||this._turnOnFastFPSEvaluation(),this.hasFastFPSEvaluation&&CW.Anim.now-this.hasFastFPSEvaluation>1e3&&
this._turnOffFastFPSEvaluation(YES)))},_dieBecauseTooSlow:function(){SC.debug("Background View: Stopping background animation because the framerate has been consistently too slow"+(this.hasFastFPSEvaluation?" during the one-second fast-FPS background performance evaluation.":".")),this.slowlyStopAnimating(),this.isDead=YES,this.hasFastFPSEvaluation&&this._turnOffFastFPSEvaluation()},_turnOnFastFPSEvaluation:function(){this._lastWFFPSE=YES,this.hasFastFPSEvaluation=CW.Anim.now,this.recordedDampedFPS=this.fps=60,SC.debug("Background View: Now starting one-second fast-FPS background performance evaluation.")},_turnOffFastFPSEvaluation:function(e){this.wantsFastFPSEvaluation=this._lastWFFPSE=NO,this.hasFastFPSEvaluation=undefined,this.recordedDampedFPS=30,e&&SC.debug("Background View: Successfully completed one-second fast-FPS performance evaluation.")},selectMode:function(e){typeof e=="string"&&(e=this.modes[e]);if(this.oldMode){this.pendingModeSwitchToMode=e;return}this.pendingModeSwitchToMode=null;var t=this.mode,n=t&&t.guidForAppearance,r=e&&e.guidForAppearance;if(t===e||n===r)return;var i,s,o,u;if(t){i=[];for(s=0;o=this.circles[s];s++)u=new h(this.camera),u.owner=this,u.cloneFrom(o),this.applyModeToCircle(e,u),u._startTime=o._startTime,u.appendTo(this.container),i[s]=u,o.fadeOut(),u.fadeIn();t.deadCircles=this.circles,this.oldMode=t,this.circles=i}this.mode=e},applyModeToCircle:function(e,t){for(var n=0,r;r=e.optionKeys[n];n++)t[r]=e.options[r]},mouseMoved:function(){if(this.isDead)return;var e=SC.RootResponder.responder._lastMoveX||0,t=SC.RootResponder.responder._lastMoveY||0
,r=this.windowWidth,i=this.windowHeight;this.cameraX.redirectTo(-(2*e/r-1)*this.cameraXMouseSensitivity),this.cameraY.redirectTo(-(2-2*t/i-1)*this.cameraYMouseSensitivity),n&&this.cameraZ.redirectTo((this.cameraX.to+this.cameraY.to)*.8-2.5),this.startDueToActivity()},startDueToActivity:function(){if(this.isDead)return;this._lastActivityTime=this.elapsedTime,this.timeSpeed.to!==1&&this.timeSpeed.redirectTo(1),this.start()},shouldStart:function(){return!matchMedia("(prefers-reduced-motion)").matches},start:function(){if(!this.shouldStart())return;if(!this.isDead)return arguments.callee.base.apply(this,arguments)},slowlyStopAnimating:function(){this.timeSpeed.redirectTo(1e-5)},onstart:function(){this.recordedDampedFPS=30}});CloudOS.BackgroundView=SC.View.extend({layout:{left:0,top:0,right:0,bottom:0,minHeight:COS.MIN_HEIGHT,minWidth:COS.MIN_WIDTH,zIndex:1},classNames:"background-view".w(),ariaHidden:YES,render:function(e){window.bgv=this},update:function(){}}),t&&CloudOS.BackgroundView.reopen({classNames:"force-webkit-acceleration".w(),allowCirclesDuringAuth:!0,displayProperties:"frame".w(),init:function(){return this._startIfAppropriate=this._startIfAppropriate.bind(this),document.addEventListener("mousemove",this._startIfAppropriate.bind(this,"mousemove")),window.addEventListener("focus",this._startIfAppropriate.bind(this,"focus")),window.addEventListener("keypress",this._startIfAppropriate.bind(this,"keypress")),matchMedia("(prefers-reduced-motion)").addListener(this.reduceMotionListener.bind(this)),arguments.callee.base.apply(this,arguments)},reduceMotionListener:function()
{var e=this.circleAnim;matchMedia("(prefers-reduced-motion)").matches?e.stop():e.start()},update:function(){var e=this.get("frame");if(!e)return;this.circleAnim.setWindowSize(e.width,e.height)},didCreateLayer:function(){this._layer=this.get("layer"),this.circleAnim=p.create({container:this._layer,owner:this}),this.decideAboutGPU(),this.update()},startStopAnimationOnVisibility:function(){if(!this.circleAnim)return;this.get("isVisibleInWindow")?this.circleAnim.start():this.circleAnim.stop()}.observes("isVisibleInWindow"),_watchNowShowing:function(){this.invokeLater("watchNowShowing",200)}.observes("CloudOS.workspaceController.nowShowing"),watchNowShowing:function(){var e=CloudOS.workspaceController.get("nowShowing");this.circleAnim.selectMode(e<=CloudOS.AUTH?"blurred":"normal");var t=this._manageCameraZHasRan!==(this._manageCameraZHasRan=YES),n=e===CloudOS.APP?.8:e===CloudOS.SPRINGBOARD?1.1:e===CloudOS.AUTH?1.3:1.3,r=this.circleAnim.cameraZ;r.redirectTo(-n),(e===CloudOS.AUTH||t)&&r.force(),this.get("isVisibleInWindow")&&this.circleAnim.startDueToActivity()},decideAboutGPU:function(){if(!this.circleAnim)return;var e=CloudOS.workspaceController.get("isGPUEnabled");if(!SC.browser.safari||n)e=YES;this.circleAnim.isDead&&(e=NO);if(this._lastShouldForceGPU===(this._lastShouldForceGPU=e))return;this.circleAnim.setShouldForceGPU(e),this.circleAnim.wantsFastFPSEvaluation=YES;var t="force-webkit-acceleration",r=this.classNames;this.$().setClass(t,e),e?r.contains(t)||r.push(t):r.removeObject(t)}.observes("CloudOS.workspaceController.isGPUEnabled"),_startIfAppropriate:function(e){if(!this
.circleAnim)return;var t=this.get("isVisibleInWindow");if(e==="interval"){if(!(Date.now()<this._possiblyStartRepeatStopTime)||!t)clearInterval(this._possiblyStartRepeatInterval),this._possiblyStartRepeatStopTime=this._possiblyStartRepeatInterval=undefined}else this._possiblyStartRepeatStopTime=Date.now()+this.circleAnim.stopAnimatingAfter-1e3,this._possiblyStartRepeatInterval||(this._possiblyStartRepeatInterval=setInterval(this._startIfAppropriate,1e3,"interval"));t&&document.hasFocus()&&(e==="mousemove"?this.circleAnim.mouseMoved():this.circleAnim.startDueToActivity())}})}(),CloudOS.BannerContainerView=SC.View.extend(CW.Animatability,{wantsAcceleratedLayer:NO,layout:{left:0,right:0,top:0,height:0,zIndex:101},addBannerView:function(e){this.adjust("top",0),e.get("parentView")!==this&&this.appendChild(e),e.show()},removeBannerView:function(e){this.removeChild(e),e.destroy()},bannerHeightObserver:function(){var e=CloudOS.bannerManager.get("bannerHeight");this.animate("height",{to:e,duration:CloudOS.BANNER_ANIMATION_DURATION})}.observes("CloudOS.bannerManager.bannerHeight")}),CloudOS.iOSNotification=CW.iOSNotification.extend({appDisplayName:null,dismissNotificationOnMouseClickAndDrag:!1,render:function(e){var t=this.get("appDisplayName");t&&e.push('<div id="sr-alert-title">'+t+"</div>"),arguments.callee.base.apply(this,arguments)}}),CloudOS.iCloudTextView=SC.View.extend(SC.AutoResize,SC.RTLSupport,{supportsAutoResize:YES,classNames:["icloud-text-view"],layoutRecipe:{start:13,top:0,width:120,height:44},autoResizeLayer:function(){return this.get("layer").childNodes[0]}.property("layer"
).cacheable(),marginBetweenImageAndAppName:8,autoResizeText:function(){return CK.get("isBeta")?"Beta":CK.get("isFuture")?"Future":CK.get("isCarry")?"Carry":""}.property(),autoResizePadding:function(){var e=parseInt(window.getComputedStyle(document.querySelector(".icloud-text"),":before").width);return this.getPath("autoResizeText.length")>0?{width:e+this.get("marginBetweenImageAndAppName")}:{width:e}}.property("autoResizeText").cacheable(),render:function(e){var t="";CK.get("isBeta")&&(t=" beta"),CK.get("isFuture")&&(t=" future"),CK.get("isCarry")&&(t=" carry"),e.push('<span class="icloud-text'+t+'"></span>'),arguments.callee.base.apply(this,arguments)},click:function(){window.location.hash=""}}),CloudOS.iFrameView=SC.View.extend({attributeBindings:["src","title"],tagName:"iframe",title:null,src:null,init:function(){arguments.callee.base.apply(this,arguments),COS.statsController.beginStat("cloudos",this+"_load_time")},didAppendToDocument:function(){var e=this.get("layer");e?COS.statsController.endStat("cloudos",this+"_load_time",null,{durationKeyName:"duration",includeLocationAndLocale:YES}):SC.warn("Failed to Load iframe %@"+this)}}),CloudOS.UnableToProceedAlert=CW.Alert.extend({init:function(){arguments.callee.base.apply(this,arguments),this.get("failureReason")||CW.fatalError("Cannot show `UnableToProceed Alert` without value for failureReason property")}}),CloudOS.UnableToProceedAlert.mixin({show:function(e){var t={failureReason:null,message:"Error.AuthDidNotConnect.Title".loc(),description:"Error.AuthDidNotConnect.Description".loc(),middleButton:{title:"Error.AuthDidNotConnect.Support"
.loc(),action:"support"},rightButton:{title:"Button.OK".loc(),action:function(){var e=this.get("pane");e.remove(),e.clearUserStateAndLogoutUser()}},leftButton:{title:"Error.Button.Report".loc(),action:function(){var e=this.get("pane"),t=e.get("failureReason");e.get("modalPane").set("paneFadeOutDuration",0),e.remove(),CK.errorCatcher.reportServerError({applicationName:"cloudos",error:t,dismissCallback:function(){e.clearUserStateAndLogoutUser()}})}},clearUserStateAndLogoutUser:function(){var e=CloudOS.authController;e.clearUserState(),e.logoutUser(function(){CK.reloadWithReason("Restart the session due to authDidNotConnect error.")},YES)},support:function(){window.open("Error.AuthDidNotConnect.Support.URL".loc())}};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r=this.create(t);return r.append(),r}}),CloudOS.mainPage=SC.Page.design({mainPane:SC.MainPane.extend(CW.DropTarget,CloudOS.AdjustViewLayoutOnMobile,{layout:{left:0,right:0,top:0,bottom:0,zIndex:2,minHeight:COS.MIN_HEIGHT,minWidth:COS.MIN_WIDTH},init:function(){this.adjustLayoutOnMobile(["minWidth","minHeight"]),arguments.callee.base.apply(this,arguments),CW.notificationCenter.subscribeToNotification("activateMinimumSize",this,"activateMinimumSize"),CW.notificationCenter.subscribeToNotification("deactivateMinimumSize",this,"deactivateMinimumSize"),CW.notificationCenter.subscribeToNotification("icloudNoticeVisibilityChanged",this,"icloudNoticeVisibilityChanged")},activateMinimumSize:function(){this.set("layout",{left:0,right:0,top:0,bottom:0,zIndex:2,minHeight:COS.MIN_HEIGHT,minWidth:COS.MIN_WIDTH}),this.invokeLast(function(
){typeof this._prevScrollTop=="number"&&(document.body.scrollTop=this._prevScrollTop,this._prevScrollTop=undefined),typeof this._prevScrollLeft=="number"&&(document.body.scrollLeft=this._prevScrollLeft,this._prevScrollLeft=undefined)})},deactivateMinimumSize:function(){this._prevScrollTop=document.body.scrollTop,this._prevScrollLeft=document.body.scrollLeft,this.set("layout",{left:0,right:0,top:0,bottom:0,zIndex:2}),this.setBodyOverflowIfNeeded(!0)},icloudNoticeVisibilityChanged:function(e){this.adjust("top",e),e?this.adjust("minHeight",this.getPath("layout.minHeight")-e):this.adjust("minHeight",COS.MIN_HEIGHT)},classNames:"overflow-visible".w(),childViews:["bannerContainer","appsView","backgroundView"],bannerContainer:CloudOS.BannerContainerView.design({}),appsView:CloudOS.AppsContainerView.design(COS.IsShowingSupport,{displayKey:CloudOS.APP,nowShowingBinding:"CloudOS.workspaceController.nowShowing"}),backgroundView:CloudOS.BackgroundView.design({isVisible:NO,setIsVisible:function(){var e=CloudOS.workspaceController.get("nowShowing"),t=!CloudOS.workspaceController.get("applicationIsFullwindow")&&!!e;this.allowCirclesDuringAuth||(t=t&&e!==CloudOS.AUTH),this.get("isVisible")!==t&&this.set("isVisible",t)}.observes("CloudOS.workspaceController.applicationIsFullwindow","CloudOS.workspaceController.nowShowing")})})}),CloudOS.main=function(){var t=CloudOS.get("delegate");CloudOS.invokeDelegateMethod(t,"applicationWillStart"),CW.addKeyResponder(CloudOS.keyResponder),CloudOS.moduleLocalizer.setLocale(String.preferredLanguage),SC.Module.loadModule("cloudos_foundation/language",this,function(
){window.localeDidLoad=!0,SC.Event.add(document,"mousemove",function(e){var t=CloudOS.appController.getPath("currentApp"),n={clientX:e.clientX,clientY:e.clientY},r;if(!t||!t.get("contentWindow")||!t.get("isReady"))return YES;t.passMessage("_mouseMove",n)}),SC.Event.add(document,"mouseup",function(e){var t=CloudOS.appController.getPath("currentApp"),n={clientX:e.clientX,clientY:e.clientY},r;if(!t||!t.get("contentWindow")||!t.get("isReady"))return YES;t.passMessage("_mouseUp",n)});if(CloudOS.get("isCloudOSMini")){var e=CloudOS.appController.getDefaultAppName();CloudOS.displayApps.push({name:e,isDynamicallyLoaded:YES})}else CloudOSBootstrap.isOnSupportedMobile||SC.Module.loadModule("cloudos_foundation/springboard",this,function(){CloudOS.configureSpringboard()});CloudOS.getPath("mainPage.mainPane").append(),SC.debug("CloudOS.main() already has localized strings, proceeding to run CloudOS.run() now."),CloudOS.run(),CloudOS.invokeDelegateMethod(t,"applicationDidStart"),CloudOS.set("mainHasCompleted",YES)})},function(){var e="cloudkit/error_catcher";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/stylesheet.css"],styles2x:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/stylesheet.css"],scriptURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/",stringURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/"
,isPrefetched:YES})}(),function(){var e="cloudkit/core_types";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:[],styles2x:[],scriptURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/core_types/1812Project43/en-us/",stringURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/core_types/1812Project43/en-us/",isPrefetched:YES})}(),function(){var e="cloudos_foundation/language";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/language/1812Project43/en-us/stylesheet.css"],styles2x:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/language/1812Project43/en-us/stylesheet@2x.css"],scriptURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/language/1812Project43/en-us/",stringURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/language/1812Project43/en-us/",isPrefetched:YES})}(),function(){var e="cloudkit/first_run";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:["coreweb/timezone_picker","cloudkit/photo"],styles:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/stylesheet.css"],styles2x:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/stylesheet@2x.css"],scriptURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/",stringURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/"
,isPrefetched:YES})}(),function(){var e="cloudkit/photo";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:[],styles2x:[],scriptURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/photo/1812Project43/en-us/",stringURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudkit/photo/1812Project43/en-us/",isPrefetched:YES})}(),function(){var e="coreweb/date_formatter";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:[],styles2x:[],scriptURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/coreweb/date_formatter/1812Project43/en-us/",stringURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/coreweb/date_formatter/1812Project43/en-us/",isPrefetched:YES})}(),function(){var e="coreweb/timezone_picker";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/stylesheet.css"],styles2x:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/stylesheet@2x.css"],scriptURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/",stringURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/",isPrefetched:YES})}(),function(){var e="cloudos_foundation/alarms";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;
SC.MODULE_INFO[e]=SC.Object.create({dependencies:["coreweb/date_formatter"],styles:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/alarms/1812Project43/en-us/stylesheet.css"],styles2x:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/alarms/1812Project43/en-us/stylesheet.css"],scriptURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/alarms/1812Project43/en-us/",stringURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/alarms/1812Project43/en-us/",isPrefetched:YES})}(),function(){var e="cloudos_foundation/sharing";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:["cloudkit/core_types"],styles:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/sharing/1812Project43/en-us/stylesheet.css"],styles2x:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/sharing/1812Project43/en-us/stylesheet@2x.css"],scriptURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/sharing/1812Project43/en-us/",stringURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/sharing/1812Project43/en-us/",isPrefetched:YES})}(),function(){var e="cloudos_foundation/springboard";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/stylesheet.css"],styles2x:["https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/stylesheet@2x.css"],scriptURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/"
,stringURL:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/",isLoaded:YES,source:'CloudOS.mixin({configureSpringboard:function(){if(this._hasConfiguredSpringBoard)return;var e={isShowingObserver:function(){CloudOS.workspaceController.get("nowShowing")<=CloudOS.AUTH?(this.$(".springboard-button-view").attr("tabindex","-1"),this.$().attr("aria-hidden","true")):(this.$(".springboard-button-view").attr("tabindex","0"),this.$().removeAttr("aria-hidden"))},springboardView:CloudOS.SpringboardView.design(COS.IsShowingSupport,{isAllowedToGenerateButtons:NO,init:function(){arguments.callee.base.apply(this,arguments);var e=CW.notificationCenter;e.subscribeToNotification("springboardMayProceed",this,"springboardMayProceed"),e.subscribeToNotification("requestedInfoForDynamicApp",this,"springboardMustWaitForDynamicApp"),e.subscribeToNotification("receivedInfoForDynamicApp",this,"springboardMayProceedFromDynamicApp"),e.subscribeToNotification("calendarIconWillRedraw",this,"springboardMustWaitForCalendarIconDrawing"),e.subscribeToNotification("calendarIconFinishedDrawing",this,"springboardMayProceedFromCalendarIconDrawing"),window.sv=this},displayKeys:[CloudOS.SPRINGBOARD,CloudOS.AUTH,CloudOS.SHARING],nowShowingBinding:"CloudOS.workspaceController.nowShowing",appIndicesBinding:"CloudOS.appController.appIndices",wantsAcceleratedLayer:!0,willShow:function(){CloudOS.workspaceController.hideCentralSpinner(null,!0)},springboardMayProceed:function(){this.set("isAllowedToGenerateButtons",YES)},springboardMustWaitForDynamicApp:function(e){this.addShowCondition("dynamic app "+e)},springboardMayProceedFromDynamicApp:function(e,t){this.metShowCondition("dynamic app "+e)},springboardMustWaitForCalendarIconDrawing\n:function(e,t){this.addShowCondition("Calendar icon must be drawn for correct language")},springboardMayProceedFromCalendarIconDrawing:function(e,t){this.metShowCondition("Calendar icon must be drawn for correct language")},childViews:CloudOS.SpringboardView.prototype.childViews.concat("accountMenu blurOverlay iCloudText".w()),blurOverlay:SC.View.extend(CW.Animatability,{classNames:"blur-overlay".w(),shouldShow:!0,shouldShowBinding:".parentView.isDecorativeDimmed",layout:{left:0,top:0,right:0,bottom:0,zIndex:2,opacity:1},shouldShowDidChange:function(){if(this.get("shouldShow"))this.animate("opacity",1,250),this.set("isVisible",!0);else{var e=this;this.animate("opacity",0,{duration:250,_updateVisibility:function(){e.set("isVisible",!1)}.listens("finish")})}}.observes("shouldShow")}),iCloudText:CloudOS.iCloudTextView.design({isEnabled:NO}),accountMenu:CloudOS.AccountMenuView.design(),isOffscreen:YES,isDecorativeDimmed:function(){var e=this.get("nowShowing");return e===CloudOS.AUTH||e===CloudOS.SHARING||!!this.get("wantsDD")}.property("nowShowing","wantsDD"),_setWantsDD:function(){var e=this.get("nowShowing")===CloudOS.AUTH;e?(this.set("wantsDD",YES),this._ddSetter&&this._ddSetter.invalidate(),this._ddSetter=null):this._ddSetter=this.invokeLater(function(){this.set("wantsDD",NO)},200)}.observes("nowShowing"),toggleChrome:function(){var e=this.get("isDecorativeDimmed");if(this.__lastToggleChromeDim__===(this.__lastToggleChromeDim__=e))return;this.accountMenu.animate("opacity",1-e,{duration:e?0:500,mustKeepLayoutSync:NO})}.observes("isDecorativeDimmed"),__lastToggleChromeDim__:NO\n,didShow:function(){this.showNotificationsIfNeeded()},didUndim:function(){this.showNotificationsIfNeeded()},showNotificationsIfNeeded:function(){this.notifyUnqualified()},notifyUnqualified:function(){var e=CloudOS.authController;if(!this._hasNotifiedUnqualified&&e.get("userRequiresUnqualifiedNotification")){var t=e.get("displayableCurrentDomain");CloudOS.iOSNotificationForSpringboard.enqueue({message:"Auth.Notification.Unqualified.Title".loc({currentDomain:t}),description:"Auth.Notification.Unqualified.Description".loc()}),this._hasNotifiedUnqualified=YES}}})},t=CloudOS.mainPage.mainPane,n={owner:t};t.appendChild(e.springboardView.create(n)),t.addObserver("CloudOS.workspaceController.nowShowing",e.isShowingObserver),this._hasConfiguredSpringBoard=YES}}),window.console&&console.log("%c\\n ********* \\n ******* ******* \\n *** *** \\n ** ** \\n ***** ** *** \\n **** ***** ** \\n ** ** \\n * * \\n ** ** ** * \\n **** ** ** ** ****** \\n ** ** ** ** **** \\n *** ** *** \\n * ** ** \\n * **** * \\n * * \\n** ** \\n* ** ** * \\n** *********** * \\n * *** ** \\n ** ** \\n *** ** \\n **** **** \\n **** **** \\n ************************************************* \\n \\n Happy to see you here! We are hiring the sharpest minds in the\\n industry who want to build the most sophisticated and delightful\\n applications on the web.\\n \\n Check out https://www.icloud.com/jobs/\\n \\n"\n,"font-family: Menlo, monospace"),CloudOS.SpringboardView=SC.View.extend(CW.Animatability,{ALL_FOUR_EDGE_SPACING:0,TOP_INSET:0,BOTTOM_INSET:0,MIN_INTER_BUTTON_SPACING:35,ANIMATE_LAYOUT:COS.ANIMATE_SPRINGBOARD_LAYOUT,FORCE_READINESS_TIME:6e3,isMiniSpringBoard:NO,buttonSizeDiscreteness:0,layout:{left:0,top:0,width:0,height:0,minHeight:COS.MIN_HEIGHT,minWidth:COS.MIN_WIDTH,zIndex:50},bannerObserver:function(){if(this.get("isMiniSpringBoard")||!this.get("isOnscreen"))return;var e=CloudOS.bannerManager,t=e.get("bannerHeight");this.animate("top",{to:t,duration:500})}.observes("CloudOS.bannerManager.bannerHeight"),classNames:["springboard-view"],wantsAcceleratedLayer:NO,displayProperties:"isOnscreen isAnimating frame".w(),isVisibleBinding:SC.Binding.oneWay("*springboardView.shouldHideForScreenReader"),isOnscreen:NO,isDecorativeDimmed:NO,isDecorativeDimmedObserver:function(){if(!this.get("isOnscreen"))return;this.get("isDecorativeDimmed")||(this.set("shouldHideForScreenReader",NO),CloudOS.workspaceController.hideCentralSpinner())}.observes("isDecorativeDimmed","isOnscreen"),attributeBindings:["aria-hidden"],shouldHideForScreenReader:YES,ariaHidden:YES,tabIndex:-1,"aria-hidden":function(){return this.get("ariaHidden")}.property("ariaHidden"),shouldHideForScreenReaderObserver:function(){this.get("shouldHideForScreenReader")?this.set({tabIndex:-1,ariaHidden:YES}):this.set({tabIndex:0,ariaHidden:NO})}.observes("shouldHideForScreenReader","isOnscreen"),appIndices:undefined,childViews:"buttonsContainer".w(),buttonsContainer:SC.View.extend(CW.Animatability,{layout:{left:0,top:0,right:0,bottom\n:0,zIndex:1},ariaRole:"main",ariaLabel:function(){return"AppTitle.backToSpringboard".loc()}.property(),focusOnButtonsContainer:function(){var e=this.get("childViews"),t=CloudOS.bannerManager;t.get("isBannerVisible")||(this.set("acceptsFirstResponder",YES),this.$().attr("tabindex",0),e&&e.length&&this.get("layer").focus())},checkForAppsAfterAnim:function(){this.owner.invokeLater("updateToAppsWhenAppropriate",100)},postAnimation:function(){this.get("isAnimating")||(this.checkForAppsAfterAnim(),this.focusOnButtonsContainer())}.observes("isAnimating")}),apps:undefined,isReadyToShow:NO,isAllowedToGenerateButtons:YES,useAnimationWhenShowing:!0,init:function(){CloudOS.SpringboardView._isAllowedToGenerateButtons&&(this.isAllowedToGenerateButtons=YES),arguments.callee.base.apply(this,arguments),this._allButtons=[],this._displayButtons=[],this._buttonsByName={},this._finalDistanceAdjustment={},this._waitingForConditions=SC.Set.create(),this._conditionsMet=SC.Set.create(),this.addShowCondition("initial set of buttons"),this.sizeToParent(!0),this.handleOnscreen(),this.appsOneWayBindingImplementedViaObserver(),CW.notificationCenter.subscribeToNotification("relocalize",this,"relocalize")},relocalize:function(){var e=this._prevCloudOSLocaleRTL,t=CloudOS.get("isCloudOSLocaleRTLOriented");e!==t&&this._decideButtonLocations(),this._prevCloudOSLocaleRTL=t},appsOneWayBindingImplementedViaObserver:function(){this.pruneAppList()}.observes("CloudOS.appController.appList","CloudOS.appController.appList.[]"),pruneAppList:function(){var e=CloudOS.appController.get("appList"),t=CloudOS.authController,\nn=t.get("user"),r=t.get("iCloudLiteSignUp")||n&&n.get("isLiteAccount"),i=[],s,o;if(!e)return;for(s=0;o=e[s];s++){if(o.get("isHidden")||!o.get("supportsLite")&&r)continue;i.push(o)}this.set("apps",i)},awaitShow:function(){this._pendingShow=YES,this.get("isAllowedToGenerateButtons")&&this.scheduleForcedReadiness()},scheduleForcedReadiness:function(){if(this._scheduledForceReadiness)return;this._scheduledForceReadiness=this.invokeLater(function(){this._scheduledForceReadiness=null,this.forceReadiness()},this.FORCE_READINESS_TIME)},show:function(){this.showForScreenReader(YES);if(this._showing)return;if(!this.get("isReadyToShow"))return this.awaitShow();this.willShow(),this.becomeFirstResponder(),this._pendingShow=NO,this._showing=YES,this._decideButtonLocations(),this.get("useAnimationWhenShowing")?this.get("isDecorativeDimmed")?this.showWithDecorativeMode():COS.ENABLE_TRANSFORM_ANIMATIONS?this.showWithIconSlide():this.showWithFade():this.showWithNoAnimation()},showWithNoAnimation:function(){this.adjust("opacity",1),this.set("isOnscreen",YES),this.didShow()},showWithDecorativeMode:function(){this.animate("opacity",{from:0,to:1,duration:1500},{onstop:function(){this.view.adjust("opacity",1),this.view.didShow()}}),this.set("isOnscreen",YES),this.set("shouldHideForScreenReader",YES)},showWithIconSlide:function(){var e=this._iconSlideAnim||(this._iconSlideAnim=this.IconSlideAnim.create({from:0,to:1,view:this}));e.duration=450,e.redirectTo(1),e.start()},showWithFade:function(){this.animate("opacity",{from:0,to:1,duration:550*COS.ENABLE_APP_ANIMATION},{doneShowing:function(){this.view\n.didShow()}.listens("stop")}),this.set("isOnscreen",YES)},willShow:function(){},didShow:function(){this.establishFocusForScreenReader()},hide:function(){this.showForScreenReader(NO),this._pendingShow=NO;if(!this._showing)return;this.willHide(),this.resignFirstResponder(),this._showing=NO;if(!this.get("useAnimationWhenShowing"))this.hideWithNoAnimation();else{if(this.get("isDecorativeDimmed"))return this.hideWithDecorativeMode();COS.ENABLE_TRANSFORM_ANIMATIONS?this.hideWithIconSlide():this.hideWithFade()}},hideWithNoAnimation:function(){this.adjust("opacity",0),this.set("isOnscreen",NO),this.didHide()},hideWithDecorativeMode:function(){this.set("isOnscreen",NO),this.didHide(),this.finishAnimation("scale")},hideWithIconSlide:function(){var e=this._iconSlideAnim||(this._iconSlideAnim=this.IconSlideAnim.create({from:1,to:0,view:this}));e.duration=550,e.redirectTo(0),e.start()},hideWithFade:function(){this.animate("opacity",{to:0,duration:550*COS.ENABLE_APP_ANIMATION},{doneHiding:function(){this.view.set("isOnscreen",NO),this.view.didHide()}.listens("stop")})},willHide:function(){},didHide:function(){},showWhenReady:function(){var e=this.get("isReadyToShow");if(this._lastIsReadyToShow===e)return;this._lastIsReadyToShow=e,e&&this._pendingShow&&this.show()}.observes("isReadyToShow"),IconSlideAnim:CW.Animation.extend({TRAVEL:1,init:function(){this.TRAVEL=1-(CloudOS.getPath("mainPage.mainPane.appsView.zoomedOutScaleFactorForAnimation")||0),this.TRAVEL=2*this.TRAVEL,arguments.callee.base.apply(this,arguments)},update:function(){var e=this.view,t=e._buttonCenters,n=e._displayButtons,r=\nthis._frame,i=this.TRAVEL*(1-this.current),s=e._layoutBounds;if(!s)return;var o=s.centerX,u=s.centerY,a,f,l,c,h,p,d;for(a=0;(d=t[a])&&(c=n[a]);a++)h=d.x,p=d.y,h===o&&p===u&&a!==0&&(h=t[a-1].x,p=t[a-1].y),f=d.x+i*(h-o),l=d.y+i*(p-u),c.setCenter(f,l);this._layer.style.opacity=this.current,this.view.adjust("opacity",this.current)},onstop:function(){this.view.decrementAnimationCount()},onfinish:function(){this.to===0&&(this.view.set("isOnscreen",NO),this.view.didHide()),this.to===1&&this.view.didShow()},onstart:function(){this.to!==0&&(this.view.handleOnscreen(),this.view.set("isOnscreen",YES),this.view.sizeToParent(!0),this.view.update()),this._frame=this.view.get("frame"),this._layer=this.view.get("layer"),this.view.incrementAnimationCount()}}),decorativeDimmedSBOpacity:0,__lastDim__:NO,handleDecorativeDimming:function(){var e=this.get("isDecorativeDimmed");if(this.__lastDim__===(this.__lastDim__=e))return;e?(this.stopAnimation("scale"),this.buttonsContainer.adjust("scale",.95),this.buttonsContainer.adjust("opacity",this.decorativeDimmedSBOpacity),this.didDim()):this.get("isShowing")?(this.buttonsContainer.animate("scale",1,{duration:550,onstop:function(){this.view.owner.didUndim()}}),this.buttonsContainer.animate("opacity",1,{duration:550})):(this.buttonsContainer.adjust("scale",1),this.buttonsContainer.adjust("opacity",1),this.didUndim())}.observes("isDecorativeDimmed"),establishFocusForScreenReader:function(){if(this.nowShowing!==CloudOS.SPRINGBOARD)return;var e=SC.$(".icloud-text");e.length&&e[0].style.display!=="none"&&e[0].focus()}.observes("isDecorativeDimmed","isShowing"\n),showForScreenReader:function(e){this.get("isMiniSpringBoard")||this.set("shouldHideForScreenReader",e?NO:YES)},didDim:function(){},didUndim:function(){},sizeToParent:function(e){var t=this.getPath("parentView.frame");if(e!==!0&&!this.get("isOnscreen"))return;if(!t)return;var n=this._lastPFWidth!==(this._lastPFWidth=t.width),r=this._lastPFHeight!==(this._lastPFHeight=t.height);if(!n&&!r&&!this.didChangeFor("sizeToParent","isOnscreen"))return;this.adjust({width:t.width,height:t.height})}.observes("*parentView.frame","isOnscreen"),handleOnscreen:function(){var e=this.get("isOnscreen"),t=e?CloudOS.bannerManager.get("bannerHeight"):0;this.adjust({left:-2e4*!e,top:-2e4*!e+t})}.observes("isOnscreen"),handleNewPermissionToGenerateButtons:function(){SC.debug("At long last, SpringboardView is now allowed to generate button instances!"),this.get("isAllowedToGenerateButtons")&&(CloudOS.SpringboardView._isAllowedToGenerateButtons=YES),this._pendingShow&&this.scheduleForcedReadiness()}.observes("isAllowedToGenerateButtons"),update:function(e){if(this._isUpdating===(this._isUpdating=YES))return;var t=this.get("frame");if(!t)return;if(this.get("isAnimating")&&this._lastFrameHash===(this._lastFrameHash=t.width+","+t.height))return this._isUpdating=NO,this._isUpdating;if(!this._displayButtons.length)return this._isUpdating=NO;if(!this.get("isOnscreen"))return this._isUpdating=NO;var n=this.didChangeFor("update","isOnscreen");e!=="animatedLayoutBounds"&&this._decideButtonLocations();var r=this._buttonCenters.hClearance,i=this._buttonCenters.vClearance,s=r,o=i*CloudOS.SpringboardButtonView.prototype\n.ASPECT_RATIO,u=s/o,a;u>1?a=Math.ceil(o):a=Math.ceil(s),a=Math.min(142,a),this.buttonSizeDiscreteness&&(a=this.buttonSizeDiscreteness*Math.round(a/this.buttonSizeDiscreteness));for(var f=0,l,c;(c=this._buttonCenters[f])&&(l=this._displayButtons[f]);f++)!this.ANIMATE_LAYOUT||n?(l.stopAnimation(),l.setCenter(c.x,c.y,a)):l.animateCenter(c.x,c.y,a);this._isUpdating=NO},updateToAppsWhenAppropriate:function(){if(!this.get("layer"))return;if(this.getPath("buttonsContainer.isAnimating"))return;if(!this.get("isAllowedToGenerateButtons")){this._decideButtonLocations(this.getPath("apps.length")||0);return}var e=this.updateButtons()?"buttons changed":!1;e&&this.update(e)}.observes("apps","layer","isAllowedToGenerateButtons"),_globalVertOffsetsByColumnQuantity:[-5,-21,-20,-16,-18,function(e,t){return-18+Math.max(0,Math.min(18,(300-t)*18/108))}],maxSpreadDimensionsByColumnQuantity:[[Infinity,Infinity],[Infinity,1500],[767,1188],[[1320,1e3],null,null,null,[1320,Infinity]],[[1320,1e3],null,[1320,1120],[1320,1220],[1320,1320],[1320,Infinity]],[1500,1200],[1600,1400],[1700,1500],[1700,Infinity],[2e3,Infinity]],_decideButtonLocations:function(e,t){var n=this.get("frame"),r=n.width-this.ALL_FOUR_EDGE_SPACING*2,i=n.height-this.ALL_FOUR_EDGE_SPACING*2-this.TOP_INSET-this.BOTTOM_INSET,s=r/i;e===undefined&&(e=this._displayButtons.length);if(e===0)return;this._gridInfo=this._gridInfo||[],this._gridInfo.length=0;var o=1,u,a,f,l;for(var c=1;c<20;c++)o=c,f=Math.ceil(e/o),l=Math.ceil(e/f),a=r/(l+1)/(i/(f+1)),this._gridInfo[c]=a/CloudOS.SpringboardButtonView.prototype.ASPECT_RATIO;var h=Infinity,p=this._gridInfo\n.length,d;o=-1;for(c=0;c<p;c++)d=this._gridInfo[c],d<1&&(d=1/d),d<h&&(h=d,o=c);o===-1&&(o=3),u=Math.ceil(e/o),o=Math.ceil(e/u),u===1&&e>=4&&(u=2,o=Math.ceil(e/u)),t===undefined&&(t=this._forcedCols),t&&(o=t,u=Math.ceil(e/o)),this._rows=u,this._cols=o;var v=this.maxSpreadDimensionsByColumnQuantity;v=v&&v[o],v&&v[0].length&&(v=v[u]||v[u>=v.length?v.length-1:0]);var m=v&&v[0]||Infinity,g=v&&v[1]||Infinity,y=r,b=i;r=Math.min(y,m),i=Math.min(b,g);var w=this._globalVertOffsetsByColumnQuantity;w=w?w[Math.min(o,w.length-1)]||0:0,w instanceof Function&&(w=w.call(this,y,b));var E=this.ALL_FOUR_EDGE_SPACING+(y-r)/2,S=this.ALL_FOUR_EDGE_SPACING+this.TOP_INSET+(b-i)/2+w,x=this._buttonCenters||(this._buttonCenters=[]),T,N,C,k,L,A=CloudOS.get("isCloudOSLocaleRTLOriented");for(c=0;c<e;c++)k=Math.floor(c/o),L=A?o-1-Math.floor(c%o):Math.floor(c%o),N=(L+1)*r/(o+1),C=(k+1)*i/(u+1),N=Math.ceil(N+E),C=Math.ceil(C+S),T=x[c]||(x[c]={}),T.x=N,T.y=C;var O=this._layoutBounds;O||this.set("layoutBounds",O=this._layoutBounds={}),O.centerX=Math.ceil(.5*r+E),O.centerY=Math.ceil(.5*i+S),O.top=Math.ceil(S),O.bottom=Math.ceil(i+S),O.height=O.bottom-O.top,O.left=Math.ceil(E),O.right=Math.ceil(r+E),O.width=O.right-O.left,O.fullWidth=y,O.fullHeight=b;var M=this._animatedLayoutBounds,_=NO,D,P;if(!M){var H=this.ANIMATE_LAYOUT?15:Infinity;this.set("animatedLayoutBounds",M=this._animatedLayoutBounds=CW.Animation.create({view:this,freevars:"left top width height".w(),ticked:4,left:{from:O.left,to:O.left,inertia:3,speed:H,headStart:.1},top:{from:O.top,to:O.top,inertia:3,speed:H,headStart:.1},width:{from:O.width/y,to:O\n.width/y,inertia:3,speed:H,headStart:1e-5},height:{from:O.height/b,to:O.height/b,inertia:3,speed:H,headStart:1e-5},update:function(){this.view.update("animatedLayoutBounds"),this._doAllButtons("updateIfNotUpdatedLastFrame","reposition")},pickUpPossibleUpdateSlack:function(){this._doAllButtons("update","reposition")}.listens("finish"),_doAllButtons:function(e,t){var n=this.view._displayButtons,r,i;for(i=0;r=n[i];i++)r[e](t)},jumpIfSpringboardJustAppeared:function(){if(this._isMaybeJumping)return;this._isMaybeJumping=YES,this._shouldFinishNextFrame&&this.running&&this.finish(),this._shouldFinishNextFrame=NO,this._isMaybeJumping=NO}.listens("frame"),watchSpringboardForJump:function(){if(this._los===(this._los=this.getPath("view.isOnscreen")))return;this._shouldFinishNextFrame=YES}.observes(".view.isOnscreen")}))}else(D=M.left).to!==(P=O.left)&&(D.redirectTo(P),_=YES),(D=M.width).to!==(P=O.width/y)&&(D.redirectTo(P),_=YES),(D=M.top).to!==(P=O.top)&&(D.redirectTo(P),_=YES),(D=M.height).to!==(P=O.height/b)&&(D.redirectTo(P),_=YES),_&&M.start();var B=O.centerY-n.height/2;this.set("visualCenterY",B);var j=this.computeFinalDistanceAdjustment(O);for(c=0;T=x[c];c++)T.x=(T.x-O.centerX)*j.x+O.centerX,T.y=(T.y-O.centerY)*j.y+O.centerY;var F=1/(o+1)*r,I=1/(u+1)*i;this._buttonCenters.hClearance=F-this.MIN_INTER_BUTTON_SPACING,this._buttonCenters.vClearance=I-this.MIN_INTER_BUTTON_SPACING},computeFinalDistanceAdjustment:function(e){var t=Math.max(.95,.95+7/1440+(1440-e.width)*16/490/100),n=1,r=1.1,i=1,s=800,o=650,u=Math.min(r,Math.max(1,(e.height-s)/(o-s)*(r-i)+i)),a=this._finalDistanceAdjustment\n;return a.x=n*t,a.y=u*t,a},_waitingForConditions:null,_conditionsMet:null,addShowCondition:function(e){this._conditionsMet.contains(e)||this._waitingForConditions.add(e)},metShowCondition:function(e){this._conditionsMet.add(e),this._waitingForConditions.remove(e);var t=this._waitingForConditions.get("length");t>0?SC.debug("Springboard: A wait condition became satisfied. Still waiting on "+t+" conditions. Requirement was: "+e):(SC.debug("Springboard: Springboard View has become ready to show! All of its wait conditions have been satisfied."),this._showing&&SC.debug("Springboard: Readiness is moot: Springboard is already showing."),this.invokeLast("forceReadiness"))},createButtonForApp:function(e,t){return CloudOS.SpringboardButtonView.buttonTypeForAppManager(e).create({springboardView:this,app:e},t||{})},setupButtonForApp:function(e,t){if(!e.get("isReady")){var n=t.get("name"),r="Button for "+n;this.addShowCondition(r),e.addObserver("isReady",this,function(){e.get("isReady")&&this.metShowCondition(r),this.invokeOnce(function(){var e=this.updateButtons();e&&this.update("buttons changed")})})}},createButtons:function(){var e=this.get("apps"),t,n,r=this._buttonsByName,i=this._allButtons,s,o;e?n=e.length:n=0;for(t=0;t<n;t++){s=e[t],o=s.get("name");if(o in r){if(i&&s!==r[o].get("app")){var a=r[o];a.set("app",s)}}else{var u=this.createButtonForApp(s);this.setupButtonForApp(u,s),r[o]=u,i.push(u)}}},computeDisplayButtons:function(){var e,t,n=this,r=this.get("apps"),i=this._displayButtons,s=this._allButtons,o,u,a;i.length=0,this.hasOwnProperty("_buttonComparator")||(a=this._buttonComparator\n,this._buttonComparator=function(){return a.apply(n,arguments)}),o=this._appIndices=this.get("appIndices"),o&&s.sort(this._buttonComparator);for(e=0,t=s.length;e<t;e++)u=s[e],r.contains(u.get("app"))&&(u.get("isReady")||u.get("mustShow"))?(u._sb_shouldDisplay=!0,i.push(u)):u._sb_shouldDisplay=!1},updateChildViews:function(){var e=this._allButtons,t,n=e.length,r,i,s;for(t=0;t<n;t++)r=e[t],s=r._sb_shouldDisplay,i=!!r.get("parentView"),i&&!s?r.fancyRemoveFromParent():!i&&s&&this.buttonsContainer.appendChild(r)},_sb_tmp_buttonsBeforeArray:[],updateButtons:function(){var e=this._sb_tmp_buttonsBeforeArray;e.length=0;var t=this._displayButtons,n,r;for(n=0,r=t.length;n<r;n++)e.push(t[n]);this.createButtons(),this.computeDisplayButtons(),this.updateChildViews(),t=this._displayButtons,t.length>0&&e.length===0&&this.metShowCondition("initial set of buttons");if(t.length!==e.length)return!0;for(n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!0;return!1},_buttonComparator:function(e,t){var n=this._appIndices,r=e.getPath("app.name"),i=t.getPath("app.name");return(n[r]+1||Infinity)-(n[i]+1||Infinity)||(r>i?1:r===i?0:-1)},forceReadiness:function(){this.set("isReadyToShow",YES)},keyDown:function(e){if(!this._showing)return;var t=SC.FUNCTION_KEYS,n=SC.FUNCTION_KEYS[e.which]||SC.PRINTABLE_KEYS[e.which];return n==="right"&&this.focusRight(),n==="left"&&this.focusLeft(),n==="up"&&this.focusUp(),n==="down"&&this.focusDown(),(n==="return"||n===" ")&&this.activateFocusedButton(),e.allowDefault(),NO},currentFocus:NaN,_lastCurrentFocus:NaN,focusNone:function(){this.set("currentFocus",NaN)},focusRight:function(\n){var e=this.get("currentFocus");return isNaN(e)||e>=this._displayButtons.length-1?this.set("currentFocus",0):this.set("currentFocus",e+1)},focusLeft:function(){var e=this.get("currentFocus");return isNaN(e)||e<=0?this.set("currentFocus",this._displayButtons.length-1):this.set("currentFocus",e-1)},focusUp:function(){var e=this.get("currentFocus");if(e<this._cols)return;return isNaN(e)?this.set("currentFocus",this._displayButtons.length-1):this.set("currentFocus",(e-this._cols+this._displayButtons.length)%this._displayButtons.length)},focusDown:function(){var e=this.get("currentFocus");if(e>=(this._rows-1)*this._cols||e+this._cols>=this._displayButtons.length)return;return isNaN(e)?this.set("currentFocus",0):this.set("currentFocus",(e+this._cols)%this._displayButtons.length)},currentFocusObserver:function(){var e=this.get("currentFocus"),t=this._lastCurrentFocus;if(t===(this._lastCurrentFocus=e))return;!isNaN(t)&&this._displayButtons[t]&&this._displayButtons[t].set("isFocused",NO),!isNaN(e)&&this._displayButtons[e]&&this._displayButtons[e].set("isFocused",YES)}.observes("currentFocus"),activateFocusedButton:function(){var e=this.get("currentFocus");if(isNaN(e))return;var t=this._displayButtons[e];if(!t)return;t.mouseEntered("keyboard"),t.mouseDown("keyboard"),t.invokeLater(function(){this.mouseUp("keyboard"),this.mouseExited("keyboard")},100)},currentFocusedButton:function(){var e=this.get("currentFocus");return this._allButtons[e]}}),require("views/springboard_view"),function(){var e=!SC.browser.chrome||!SC.browser.windows;CloudOS.AppSwitcherPane=CW.PickerPane.extend(CW.Animatability\n).extend(e?CW.PaneAnimationSupport:{}).extend({layouts:["onBottom"],attributeBindings:["tabindex"],tabindex:"-1",layout:{left:-10,top:-10,width:2,height:2,opacity:0},desiredSize:{width:616,height:324},minimumSize:{width:616,height:324},desiredSizeMaxApps:{width:842,height:324},alsoScale:window.location.href.indexOf("animateAppSwitcher")!==-1,wantsAcceleratedLayer:YES,showingState:{opacity:1},hiddenState:{opacity:0},showDuration:200,hideDuration:350,firstShowDelay:1e3,acceptsKeyPane:YES,init:function(){this._originalHideDuration=this.hideDuration||this.duration,this.alsoScale&&(this.showingState.scale=1,this.hiddenState.scale=.9),arguments.callee.base.apply(this,arguments)},popup:function(){arguments.callee.base.apply(this,arguments),window.asv=this.contentView,window.asp=this,this.becomeKeyPane(),this.contentView.show(),this.contentView.becomeFirstResponder(),this.set("hideDuration",this._originalHideDuration)},chooseTransformOrigin:function(){this.alsoScale&&this.invokeLast("_chooseTransformOrigin")}.observes("layout","layer"),_chooseTransformOrigin:function(){var e=this.get("layer");if(!e)return;var t=this.$(".sc-pointer"),n;if(!t||!(t=t[0])||!(n=t.className)||typeof n!="string")return;if(n.indexOf("point-up")!==-1)return this._setTransformOrigin(t.offsetLeft+t.offsetWidth/2,t.offsetTop,e);if(n.indexOf("point-left")!==-1)return this._setTransformOrigin(t.offsetLeft,t.offsetTop+t.offsetHeight/2,e)},_setTransformOrigin:function(e,t,n){n||(n=this.get("layer")),n.style[SC.platform.domCSSPrefix+"TransformOrigin"]=Math.round(e)+"px "+Math.round(t)+"px"},paneDidHide:function(){CloudOS\n.statechart.sendAction("appSwitcherFinishedHiding"),CloudOS.appSwitcherController.set("isShowing",NO)},remove:function(){return e||this.invokeLast("paneDidHide"),arguments.callee.base.apply(this,arguments)},keyDown:function(e){if(!this.get("isVisibleInWindow")||!e)return;var t=SC.FUNCTION_KEYS[e.which]||SC.PRINTABLE_KEYS[e.which];t==="escape"&&!e.shiftKey&&CloudOS.appSwitcherController.hideAppSwitcher()},contentView:CloudOS.SpringboardView.extend({classNames:"app-switcher",isMiniSpringBoard:YES,MIN_INTER_BUTTON_SPACING:18,ALL_FOUR_EDGE_SPACING:25,TOP_INSET:-40,BOTTOM_INSET:-20,ANIMATE_LAYOUT:NO,buttonSizeDiscreteness:2,layout:{left:0,width:616,height:324,top:0},_globalVertOffsetsByColumnQuantity:null,maxSpreadDimensionsByColumnQuantity:null,useAnimationWhenShowing:NO,appIndicesBinding:"CloudOS.appController.appIndices",buttonsContainer:SC.View.extend(CW.Animatability,{ariaRole:"navigation",ariaLabel:"Toolbar.Tooltip.App.Switcher".loc()}),init:function(){this.FORCE_READINESS_TIME=this.getPath("owner.firstShowDelay")||1e3,arguments.callee.base.apply(this,arguments)},killParentDelay:function(){if(!this.get("isReadyToShow")||this._hasKilledParentDelay===(this._hasKilledParentDelay=YES))return;this.invokeLater("_killParentDelay",50)}.observes("isReadyToShow"),_killParentDelay:function(){var e=this.getPath("parentView._showTimer");if(!e)return;e.fire(),e.invalidate()},_sharedBadgeMeasurementCache:{},createButtonForApp:function(e){return arguments.callee.base.call(this,e,{ASPECT_RATIO:1/1.65,TITLE_SIZE_MULTIPLE:15/74,TITLE_TOP_MULTIPLE:170/142,SPINNER_SIZE_MULTIPLE:28/74,BADGE_H_PADDING\n:6,BADGE_V_PADDING:2,BADGE_RIGHT_INSET:-5,BADGE_TOP_INSET:-1,USE_TRANSFORM_SCALING:NO,USE_BORDER_ELEMENT:YES,USE_TITLE_HIGHLIGHT:YES,IS_INTENDED_FOR_SIGNIFICANT_DOWNSAMPLING:YES,mustShowRegardlessOfDynamicApp:YES,useExternalShadow:NO,mustHitTest:NO,_badgeMeasurementCache:this._sharedBadgeMeasurementCache,titleColor:{r:51,g:51,b:51},titleShadowSettings:{x:0,y:0,blur:0,r:0,g:0,b:0,opacity:0,opacityForIntensity:!1},action:function(){var e=this.get("pane");return e&&e.set("hideDuration",this.get("isCurrentApp")?e._originalHideDuration:0),arguments.callee.base.apply(this,arguments)},_adjustBadgeInfo:function(e){SC.browser.webkit&&e.countString[0]==="1"&&e.count>1&&e.left++}})},pruneAppList:function(e){e();var t=this.get("apps");t.unshift(this.get("dummyAppSwitcherHomeAppManager"));if(t.length>10){var n=this.get("pane"),r=n.get("desiredSizeMaxApps");n.set("desiredSize",r),n.set("minimumSize",r)}}.enhance(),dummyAppSwitcherHomeAppManager:function(){return this._dummyAppSwitcherHomeAppManager=CloudOS.AppManager.create({name:"",init:function(){this.set("appInfo",COS.AppInfo.create({displayName:function(){return"AppTitle.backToSpringboard".loc()}.property().cacheable()})),arguments.callee.base.apply(this,arguments),CW.notificationCenter.subscribeToNotification("relocalize",this,"relocalize")},relocalize:function(){this.get("appInfo").notifyPropertyChange("displayName")},appIconType:"home",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/source/resources/images/launchpad_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/source/resources/images/launchpad_icon@2x.png"\n,warningArrowAsset:"data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==",index:-1})}.property().cacheable(),_buttonComparator:function(e,t){var n=this._dummyAppSwitcherHomeAppManager;return e===t?0:e.get("app")===n?1:t.get("app")===n?-1:arguments.callee.base.apply(this,arguments)},computeFinalDistanceAdjustment:function(e){var t=Math.max(.95,.95+7/1440+(1440-e.width)*16/490/100),n=this._finalDistanceAdjustment;return n.x=n.y=t,n},handleOnscreen:function(){this.set("isVisible",this.get("isOnscreen"))}.observes("isOnscreen"),show:function(){arguments.callee.base.apply(this,arguments),CW.notificationCenter.postNotification("redrawCalendarIconIfNecessary"),this.invokeLast(function(){var e=this.get("currentFocus");if(e){var t=this.currentFocusedButton();t&&t.$()&&t.$().focus()}else this.$()&&this.$().focus()})}})})}(),CloudOS.appSwitcherController=SC.Object.create({pane:function(){return CloudOS.AppSwitcherPane.create({dismissTarget:this,dismissAction:"didDismiss"})}.property().cacheable(),showAppSwitcher:function(e){var t=30,n=10;e||(e={left:70,top:10,width:150,height:100});var r=CloudOS.bannerManager;r.get("isBannerVisible")&&(e.top+=r.get("bannerHeight")),e.top+e.height<n&&(e.top=0,e.height=n),e.left+e.width/2<t&&(e.left=0,e.width=t*2);var i=this.get("pane");this.get("isShowing")?i.set("pointAtRectangle",e):i.popup(e),this.set("isShowing",YES),i.get("layer").focus()},hideAppSwitcher:function(){if(!this.get("isShowing"))return;this.set("isShowing",NO),this.get("pane").dismiss(),CloudOS.passMessageToAllApps("miniSpringboardDismissed")},didDismiss:function(\n){CloudOS.statechart.sendAction("didDismiss")}}),function(){function t(e,t,s,o){if(!e)return;if(!t)return;if(!s||isNaN(s))s=2;var u=o!=="vertical",a=o!=="horizontal",f=e.getContext?e.getContext("2d"):e,l=e.getContext?e:e.canvas,c=l.width|0,h=l.height|0,p=s|0;t=Math.min(t,c,h),t=t/p*.8+t*.2;var d=t|0,v=c*h*4,m=d*2+1,g=c*4,y=d*g,b=d*4,w=b+4,E=y+g,S;try{S=f.getImageData(0,0,c,h)}catch(x){window.SC&&SC.warn instanceof Function&&SC.warn("Attempting to blur canvas contents, but unable to access image data: "+x);return}var T=i(c,h),N=S.data,C=T.data;n(N);var k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z,W,X,V,$,J,K;for(V=1;V<=p;V++){if(u){K=N,N=C,C=K;for(j=0;j<h;j++){F=j*g,k=L=A=O=0;for(I=0;I<d;I++)M=I*4+F,k+=C[M],L+=C[M+1],A+=C[M+2],O+=C[M+3];for(I=0;I<c;I++)M=I*4+F,_=M+1,D=_+1,P=D+1,U=d-I,U<0&&(U=0),W=d-(c-1-I),W<0&&(W=0),R=m-U-W,H=M-w,$=H<F,B=M+b,J=!!W,$||(k-=C[H],L-=C[H+1],A-=C[H+2],O-=C[H+3]),J||(k+=C[B],L+=C[B+1],A+=C[B+2],O+=C[B+3]),N[M]=k/R,N[_]=L/R,N[D]=A/R,N[P]=O/R}}if(a){K=N,N=C,C=K;for(I=0;I<c;I++){q=I*4,k=L=A=O=0;for(j=0;j<d;j++)M=j*g+q,k+=C[M],L+=C[M+1],A+=C[M+2],O+=C[M+3];for(j=0;j<h;j++)F=j*g,M=q+F,_=M+1,D=_+1,P=D+1,z=d-j,z<0&&(z=0),X=d-(h-1-j),X<0&&(X=0),R=m-z-X,H=M-E,$=H<0,B=M+y,J=!!X,$||(k-=C[H],L-=C[H+1],A-=C[H+2],O-=C[H+3]),J||(k+=C[B],L+=C[B+1],A+=C[B+2],O+=C[B+3]),N[M]=k/R,N[_]=L/R,N[D]=A/R,N[P]=O/R}}}r(N),f.putImageData(S,0,0)}function n(e,t){t||(t=e);var n=0,r=e.length,i,s;for(;n<r;n+=4)i=e[n+3]/255,t[n]=e[n]*i,t[s=n+1]=e[s]*i,t[s=n+2]=e[s]*i}function r(e,t){t||(t=e);var n=0,r=e.length,i,s;for(;n<r;n+=4)i=e[n+3]/255,t[n]=e[n]/i,t[s=n+1]=e[s]/i,t[s=n+2]=e[s]/i}function i\n(e,t){var n=this._temporaryBufferContext||(this._temporaryBufferContext=document.createElement("canvas").getContext("2d")),r=this._temporaryBufferCache||(this._temporaryBufferCache=[]);return r=r[e]||(r[e]={}),r=r[t]||(r[t]={}),r.buffer||(r.buffer=n.createImageData(e,t))}var e=document.createElement("canvas");if(!e.getContext||!e.toDataURL)return;window.CloudOS&&(CloudOS.canvasBoxBlur=t)}(),CloudOS.SpringboardButtonView=SC.View.extend(CW.Animatability,{tagName:"a",ARROW_WIDTH_MULTIPLE:64/142,ARROW_HEIGHT_MULTIPLE:58/142,ARROW_LEFT_MULTIPLE:85/142,ARROW_TOP_MULTIPLE:85/142,LOCK_WIDTH_MULTIPLE:36/142,LOCK_HEIGHT_MULTIPLE:36/142,LOCK_LEFT_MULTIPLE:113/142,LOCK_TOP_MULTIPLE:113/142,SHADOW_SIZE_MULTIPLE:204/142,SHADOW_DROP_RATIO:14/142,SPINNER_SIZE_MULTIPLE:32/142,TITLE_SIZE_MULTIPLE:21/142,TITLE_TOP_MULTIPLE:161/142,ERROR_SIZE_MULTIPLE:16/142,ERROR_TOP_MULTIPLE:1.3+1/142,ASPECT_RATIO:204/262,BADGE_H_PADDING:10,BADGE_V_PADDING:3,BADGE_RIGHT_INSET:-10,BADGE_TOP_INSET:-4,DECOR_BLUR_DERIVATIVES:SC.browser.msie?[100,75,50,28,16]:SC.browser.mozilla?[100,75,50,28,16,8,24,2]:SC.browser.webkit?[100,75,50,28,16,8,24,2]:[100,75,50,28],DECOR_BLUR_MAX_DOWNSAMPLE_RATIOS:{100:SC.browser.safari&&!SC.browser.chrome&&window.devicePixelRatio>1?2:4},USE_TITLE_HIGHLIGHT:NO,USE_BORDER_ELEMENT:NO,IS_INTENDED_FOR_SIGNIFICANT_DOWNSAMPLING:NO,requiresDownsampleableDerivative:SC.browser.msie>=9&&(window.devicePixelRatio||1)===1,mustShow:YES,titleColor:{r:255,g:255,b:255},titleShadowSettings:{r:0,g:0,b:0,x:0,y:7,blur:15,opacityForIntensity:function(e){return(e+2)/3*.25}},isCurrentApp:NO,isControl:YES,acceptsFirstResponder\n:function(){return this.get("ariaHidden")?NO:YES}.property("ariaHidden"),attributeBindings:["tabindex"],tabindex:function(){return this.get("acceptsFirstResponder")?"0":"-1"}.property("acceptsFirstResponder"),ariaHidden:function(){return this.get("springboardIsHidden")?YES:this.get("isDisabled")||this.get("isDecorativeDimmed")||this.get("isDimmed")?YES:NO}.property("isDisabled","isDecorativeDimmed","isDimmed","springboardIsHidden"),springboardIsHiddenBinding:"*springboardView.shouldHideForScreenReader",currentAppBinding:"CloudOS.appController.currentApp",isCurrentApp:function(){return this.get("app")===CloudOS.appController.get("currentApp")}.property("currentApp","app").cacheable(),makeTitleHighlightWhenCurrent:function(){if(!this.USE_TITLE_HIGHLIGHT)return;if(!this.get("isVisibleInWindow"))return;var e=this.get("layer");if(!e)return;var t=this.get("isCurrentApp"),n=this._titleHighlight;if(!n&&!t)return;n||(n=this._titleHighlight=document.createElement("div"),n.className="sb-title-highlight",n._in=NO),t?(n._in||e.appendChild(n),n._in=YES,this._titleHighlightWasSized||this.invokeLast("sizeTitleHighlightToTitleElement")):(n._in&&e.removeChild(n),n._in=NO)}.observes("isCurrentApp","isVisibleInWindow"),sizeTitleHighlightToTitleElement:function(){var e=this._titleText,t=this._title,n=this._titleHighlight;if(!t||!e||!n||!this.get("isVisibleInWindow"))return;this._titleHighlightWasSized=YES;var r=e.offsetWidth,i=e.offsetHeight,s=e.offsetTop+t.offsetTop,o=(this.get("size")||74)/2-r/2|0,u=10,a=5;n.style.left=o-u+"px",n.style.top=s-a+"px",n.style.height=i+2*a+"px",n.style.width=r+2*u+"px"\n},_badgeMeasurementCache:{},sizeBadge:function(){this.invokeLast("_sizeBadge")}.observes("isVisibleInWindow","layer"),_sizeBadge:function(){var e=this.get("badgeCount"),t=CloudOS.get("isCloudOSLocaleRTLOriented");if(!this.get("isVisibleInWindow")||!e||!this._badgeRed||!this._badgeMask)return;var n=this._badgeInfoHash||(this._badgeInfoHash={}),r=this._badgeRed.style,i=this._badgeMask.style,s=this._badgeText,o=this._badge,u=this.BADGE_H_PADDING,a=this.BADGE_V_PADDING,f,l,c;n.count=e,n.countString=e+"",l=n.countString.length,f=this._badgeMeasurementCache[l];if(!f){c=s.offsetWidth;if(!c){this._badgeSizeFallbackTimer?this._badgeSizeFallbackTimer=null:this._badgeSizeFallbackTimer=this.invokeLater("_sizeBadge",200);return}f=this._badgeMeasurementCache[l]={},f.top=n.top=s.offsetTop-a,f.left=n.left=s.offsetLeft+(t?s.offsetWidth:0)-u,f.width=n.width=c+u*2,f.height=n.height=s.offsetHeight+a*2}else n.top=f.top,n.left=f.left,n.width=f.width,n.height=f.height;this._badgeSizeFallbackTimer&&this._badgeSizeFallbackTimer.invalidate(),this._badgeSizeFallbackTimer=null,n.height>n.width&&(n.left-=(n.height-n.width)/2|0,n.width=n.height),this._adjustBadgeInfo(n),r.top=i.top=n.top+"px",t?(r.right=i.right=n.left+"px",r.removeProperty("left"),i.removeProperty("left")):(r.left=i.left=n.left+"px",r.removeProperty("right"),i.removeProperty("right")),r.width=i.width=n.width+"px",r.height=i.height=n.height+"px";var h=o.style,p=this.BADGE_RIGHT_INSET+n.left+n.width+"px";t?(h.left=p,h.removeProperty("right")):(h.right=p,h.removeProperty("left")),h.top=this.BADGE_TOP_INSET+n.top+"px"},_adjustBadgeInfo:function(\ne){SC.browser.mozilla&&e.top++,e.countString.length>1&&e.countString[0]!=="1"&&e.countString[e.countString.length-1]==="1"&&e.left--},init:function(){this.getPath("app.isDynamicallyLoaded")&&!this.mustShowRegardlessOfDynamicApp&&(this.mustShow=NO),arguments.callee.base.apply(this,arguments),this.wantsAcceleratedLayer=this.USE_TRANSFORM_SCALING,CW.notificationCenter.subscribeToNotification("relocalize",this,"relocalize")},USE_TRANSFORM_SCALING:!!SC.browser.chrome||!!SC.browser.mozilla,useExternalShadow:SC.browser.opera,mustHitTest:SC.browser.msie||SC.browser.opera,layout:{zIndex:15},classNames:"springboard-button-view".w(),ariaRole:"button",displayProperties:"titleColor titleShadowSettings isCurrentApp isDark size displayName isFocused x y isSpinning errorText isDarkTo app isUnclickable isShowingWarning isAnimatingWithParent iconElement titleIntensity isDecorativeDimmed isDecorativeDimmedOrUndimming badgeCount".w(),action:function(){var e=this.get("app"),t=CloudOS.statechart;if(!e)return;e.set("loadReason",CK.LOAD_REASON_USER_CLICK),CloudOS.appController.set("pendingApp",e),e.get("isPCSKeysDeletedLocked")?t.sendAction("showPCSDeletedMessage",e.get("displayName")):e.get("isHSALocked")?(CloudOS.authController.get("isPartiallyAuthenticated")&&CloudOS.appSwitcherController.hideAppSwitcher(),t.sendAction("showHSA",CloudOS.HSASourceEnum.USER_SELECTED_APP)):t.sendAction("userDidChooseApp")},size:142,x:0,y:0,isWaitingBinding:"*app.isWaiting",loadInBackgroundBinding:"*app.loadInBackground",displayNameBinding:"*app.appInfo.displayName",isFocused:NO,_lastIsFocused:NO,isActive:NO,appBadgeCountBinding\n:"*app.badgeCount",badgeCount:function(){return this.get("isDecorativeDimmedOrUndimming")||this.get("isLocked")?0:this.get("appBadgeCount")}.property("isDecorativeDimmedOrUndimming","appBadgeCount","isLocked"),layoutBoundsCacher:function(){if(this._layoutBounds)return this._layoutBounds;var e=this.get("springboardView"),t=e.get("layoutBounds");return t||(e._decideButtonLocations(),t=e.get("layoutBounds")),this._layoutBounds=t,t},_defaultLayoutBounds:{top:0,centerY:1,bottom:2,left:0,centerX:1,right:2},animatedLayoutBoundsCacher:function(){if(this._animatedLayoutBounds)return this._animatedLayoutBounds;var e=this.get("springboardView"),t=e.get("animatedLayoutBounds");return t||(e._decideButtonLocations(),t=e.get("animatedLayoutBounds")),this._animatedLayoutBounds=t,t},app:null,hitTest:function(e){if(isNaN(e.clientX)||isNaN(e.clientY))return YES;if(!this.convertPointToView(e))return NO;var t=this._pt_.x,n=this._pt_.y,r=this.get("frame");return r?t>=0&&t<=r.width&&n>=0&&n<=r.height:NO},mouseDown:function(e){if(e.metaKey||e.button===2||e.which==3)return e.allowDefault(),NO;this.set("isDown",YES),this.mustHitTest?this.hitTest(e)&&this.set("isActive",YES):this.set("isActive",YES)},mouseUp:function(e){var t=this.get("isActive")&&!this.get("isUnclickable");this.set("isActive",NO),this.set("isDown",NO),this.set("ignoreVirtualCursor",YES);if(!t)return;this.action();if(e!=="keyboard"){var n=this.get("springboardView");n&&n.focusNone&&n.focusNone()}},mouseMoved:function(e){if(!this.mustHitTest)return;var t=this.hitTest(e);this._lastIsOver!==t&&(this.set("isOver",this._lastIsOver=t),t?this\n.set("isActive",this.get("isDown")):this.set("isActive",NO))},mouseEntered:function(e){if(this.mustHitTest)return;this.get("isDown")&&this.set("isActive",YES),this.set("isOver",this._lastIsOver=YES)},mouseExited:function(){this.set("isActive",NO),this.set("isOver",this._lastIsOver=NO)},click:function(e){if(this.get("ignoreVirtualCursor"))return;this.mouseDown(e),this.mouseUp(e)},touchStart:function(e){return this.mouseEntered(e),this.mouseDown(e)},touchEnd:function(e){return this.mouseUp(e),this.mouseExited(e)},touchEntered:function(e){return this.mouseEntered(e)},touchExited:function(e){return this.mouseExited(e)},isDecorativeDimmedBinding:"*springboardView.isDecorativeDimmed",isSpinning:function(){return this.get("isWaiting")&&!this.get("loadInBackground")&&!this.get("isDecorativeDimmedOrUndimming")}.property("isWaiting","loadInBackground","isDecorativeDimmedOrUndimming"),isConventionallyDark:function(){return this.get("isActive")&&this.get("isDown")||this.get("isSpinning")}.property("isActive","isDown","isOver","isSpinning","isUnclickable").cacheable(),isFailedBinding:"*app.appInfo.isFailed",isDisabled:function(){var e=this.get("app");return e&&e.requiresMailAndIsMissing()?NO:this.getPath("app.isDisabled")}.property("app"),isDisabledObserver:function(){this.notifyPropertyChange("isDisabled")}.observes("*app.appInfo.isDisabled"),isLockedBinding:"*app.appInfo.isLocked",isHSALockedBinding:"*app.appInfo.isHSALocked",isPCSKeysDeletedLockedBinding:"*app.appInfo.isPCSKeysDeletedLocked",isUnqualifiedBinding:"*app.appInfo.isUnqualified",isDimmed:function(){return this.get("isDecorativeDimmedOrUndimming"\n)?NO:this.get("isUnqualified")}.property("isUnqualified","isDecorativeDimmedOrUndimming").cacheable(),isUnclickable:function(){return this.get("isDecorativeDimmedOrUndimming")?YES:this.get("isDimmed")?NO:this.get("isDisabled")}.property("isDisabled","isDimmed","isDecorativeDimmedOrUndimming"),isShowingWarning:function(){return this.get("isDecorativeDimmedOrUndimming")?NO:this.get("isDimmed")?NO:this.get("isDisabled")}.property("isDisabled","isDimmed","isDecorativeDimmedOrUndimming"),isDarkTo:function(){if(this.get("isDecorativeDimmedOrUndimming"))return 0;var e=this.get("isConventionallyDark"),t=this.get("isUnclickable"),n=this.get("isDimmed"),r;return!e&&!t&&!n&&(r=0),e&&!t&&!n&&(r=.28),!e&&t&&!n&&(r=.5),e&&t&&!n&&(r=.5),!e&&!t&&n&&(r=.5),e&&!t&&n&&(r=.7),!e&&t&&n&&(r=.5),e&&t&&n&&(r=.5),this.get("isLocked")&&(r=1-.58*(1-r)),r}.property("isConventionallyDark","isUnclickable","isDimmed","isDecorativeDimmedOrUndimming","isLocked"),isDecorativeUndimming:function(){return this.decorativeDimmingAnimationCount>0}.property("decorativeDimmingAnimationCount"),isDecorativeDimmedOrUndimming:function(){return this.get("isDecorativeDimmed")||this.get("isDecorativeUndimming")}.property("isDecorativeDimmed","isDecorativeUndimming").cacheable(),titleIntensity:function(){var e=this.get("isDimmed");return e?.25:1}.property("isDimmed"),_forceDisableChangeObserver:function(){this.invokeLast(function(){this.get("isDarkTo")===.5&&this.update()})}.observes("isDarkTo"),errorText:function(){return this.get("isUnclickable")?this.get("isDisabled")?this.getPath("app.isDisabledForMaintenance")?"Springboard.Icon.Maintenance"\n.loc():"Springboard.Icon.Offline".loc():"":""}.property("isUnclickable","isDisabled","isFailed"),stopAnimation:function(){return CW.Anim.tellFinish(this._enterAnimation),CW.Animatability.stopAnimation.apply(this,arguments)},detectAppends:function(){if(this._lastParentView===(this._lastParentView=this.get("parentView")))return;this._hasArrivedAtCoordsSinceLastAppend=NO}.observes("parentView"),setCenter:function(e,t,n){this.beginPropertyChanges(),this._hasArrivedAtCoordsSinceLastAppend=YES;var r=this._layoutBounds||this.layoutBoundsCacher(),i=this._positionSizeAnimation;i&&!i.running&&(i=null),isNaN(e)||(i&&i.removeProperty("x"),this.set("x",(e-r.left)/(r.right-r.left))),isNaN(t)||(i&&i.removeProperty("y"),this.set("y",(t-r.top)/(r.bottom-r.top))),isNaN(n)||(i&&i.removeProperty("size"),this.set("size",n)),this.endPropertyChanges()},animateCenter:function(e,t,n){var r=this._hasArrivedAtCoordsSinceLastAppend;this._hasArrivedAtCoordsSinceLastAppend=YES;var i=this.springboardView.isOnscreen;if(!i||this.get("isAnimatingWithParent"))return this.setCenter(e,t,n);if(!r){this.setCenter(e,t,n),i&&(this._enterAnimation=this.animate({duration:700,tween:CW.Anim.tweens.make("compound",function(e){return Math.max(0,e*10/7-3/7)},CW.Anim.tweens.WEBKIT_EASE),scale:{from:0,to:this.transformedScaleForSize(n)},opacity:{from:0,to:1}},{onstop:function(){this.view._enterAnimation=null}}));return}var s=this._layoutBounds||this.layoutBoundsCacher(),o={};isNaN(e)||(o.x=(e-s.left)/s.width),isNaN(t)||(o.y=(t-s.top)/s.height),isNaN(n)||(o.size=n);if(o.x||o.y||o.size)this._positionSizeAnimation=this.animateProperties\n(o,{speed:23,headStart:.002,inertia:8,ticked:4})},transformedScaleForSize:function(e){return this.USE_TRANSFORM_SCALING?e/142:1},getPxX:function(){var e=this._animatedLayoutBounds||this.animatedLayoutBoundsCacher(),t=this._layoutBounds||this.layoutBoundsCacher();return e.left.current+this.x*e.width.current*t.fullWidth},getPxY:function(){var e=this._animatedLayoutBounds||this.animatedLayoutBoundsCacher(),t=this._layoutBounds||this.layoutBoundsCacher();return e.top.current+this.y*e.height.current*t.fullHeight},fadersToKill:"mask focus arrow errorText decorBlur badge lockBadge".w(),finishAllAnimationExceptSpinner:function(){if(!this.get("isAnimatingWithParent"))return;this.finishAnimation();for(var e=0,t,n;t=this.fadersToKill[e];e++)n="_"+t+"Fader",CW.Anim.tellFinish(this[n]),this[n]=null}.observes("isAnimatingWithParent"),render:function(e){window["sb"+this.getPath("app.name").toLowerCase().substring(0,2)]=this,e.push(\'<div class="sb-spinner sb-el"><img class="sb-spinner-image sb-el" alt="" /></div><div class="sb-badge sb-el"><div class="text"></div><div class="red"></div><div class="mask"></div></div><div class="sb-focus sb-el"><div class="sb-focus-inner sb-focus-kid"></div><div class="sb-focus-outer sb-focus-kid"></div></div><div id="\'+SC.guidFor(this)+\'-label" class="sb-title sb-el"><span class="sb-title-text"></span><span class="sb-ax-text"></span></div>\'+\'<div class="sb-error-text sb-el"></div>\'+\'<img class="sb-arrow sb-el" alt="" />\'+(this.USE_BORDER_ELEMENT?\'<div class="sb-border sb-el"></div>\':"")+(this.useExternalShadow?"":\'<img class="sb-shadow sb-el" alt="" />\'));var t=\nwindow.location,n=t.search,r="/";n&&(r=""),e.attr("href","https://"+t.hostname+t.search+r+"#"+this.getPath("app.name"))},parentViewDidResize:function(){arguments.callee.base.apply(this,arguments),this.invokeLast(function(){this.update("reposition")})},handleMissingIconElement:function(){var e,t=this.get("layer");if(!t)return;var n=!this.get("iconElement")&&this.get("isReady")&&!this.get("isDecorativeDimmed");CW.Anim.tellFinish(this._missingElementFader),e=this._missingElement,n?(e||(e=this._missingElement=document.createElement("div"),e.style.cssText="position:absolute; z-index:11; left:0px; right:0px; top:0px; bottom:0px; border-radius:24%; background:white; opacity:0;"),this._missingElementFader=CW.Anim.Fader.create({element:e,to:1,duration:200}).start(),e.parentNode!==t&&e.parentNode&&e.parentNode.removeChild(e),e.parentNode===t||t.appendChild(e)):(e&&e.parentNode===t?this._missingElementFader=CW.Anim.Fader.create({element:e,to:0,duration:200,cleanup:function(){e.parentNode.removeChild(e)}.listens("stop")}).start():e&&e.parentNode&&e.parentNode.removeChild(e),this._missingElement=null)}.observes("layer","iconElement","isReady","isDecorativeDimmed"),darkenMissingIconElement:function(){if(!this._missingElement)return;var e=255-(this.get("isDarkTo")||0)*255;this._missingElement.style.backgroundColor=CW.Anim.encodeColor(e,e,e)}.observes("isDarkTo"),maintainDownsampleableDerivative:function(){if(!this.IS_INTENDED_FOR_SIGNIFICANT_DOWNSAMPLING||!this.requiresDownsampleableDerivative)return;var e=this.get("layer");if(!e)return;var t=this.get("iconElement"),n=this._iconCanvas||t,r=\nthis._downsampleableDerivative;r&&r._isForIconElement!==SC.guidFor(t)&&(t&&(t.style.visibility=""),r.parentNode&&r.parentNode.removeChild(r),r=this._downsampleableDerivative=null),t?(this._downsampleableDerivativeTimer&&this._downsampleableDerivativeTimer.invalidate(),this._downsampleableDerivativeTimer=this.invokeLater("ensurePresenceOfDownsampleableDerivative",Math.random()*15+15|0,r,t,n,e)):(r&&r.parentNode&&r.parentNode.removeChild(r),r=this._downsampleableDerivative=null,this._downsampleableDerivativeTimer&&this._downsampleableDerivativeTimer.invalidate())}.observes("layer","iconElement","size"),ensurePresenceOfDownsampleableDerivative:function(e,t,n,r){var i=142,s;if(!e){var o=new Date*1;e=this._downsampleableDerivative=document.createElement("canvas"),e._isForIconElement=SC.guidFor(t),e.className="downsampleable-derivative sb-icon sb-el",e.width=e.height=i,s=e.getContext("2d"),s.drawImage(n,0,0,i,i),CloudOS.canvasBoxBlur(e,1,1),s.globalAlpha=.5,s.drawImage(n,0,0,i,i),s.globalAlpha=1,o=new Date*1-o,SC.debug("Spent "+o+"ms creating new downsampleable derivative of "+this.getPath("app.name")+" icon.")}e.parentNode&&e.parentNode!==r&&e.parentNode.removeChild(e),e.parentNode||r.appendChild(e),e.style.left=e.style.top="0px",e.style.width=e.style.height=this.get("size")+"px",t.style.visibility="hidden",e.style.visibility="visible"},update:function(e){var t,n;e&&e.setClass?t=e:(n=e,t=this.renderContext(this.get("layer")).$());if(!this._layer)return;var r=this,i=this._layer,s=NO,o=this.get("isAnimatingWithParent"),u=this._decorBlurs?this._lastSeenDecorBlurCount!==(this._lastSeenDecorBlurCount=\nthis._decorBlurs.length):NO,a=NO,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I;this.$().attr("aria-labelledby",SC.guidFor(this)+"-label"),t.setClass("current-app",this.get("isCurrentApp")),k=this.get("iconElement"),L=this._lastIconElement,k&&k.parentNode!==i&&(s=YES,L&&L!==k&&L.parentNode&&L.parentNode.removeChild(L),L=this._lastIconElement=k,jQuery(k).addClass("sb-icon").addClass("sb-el"),k.parentNode||i.appendChild(k)),!k&&L&&L.parentNode&&L.parentNode.removeChild(L),this.useExternalShadow&&!this._isExternalShadowRemovalPermanent&&((g=this._externalShadow)||(g=new Image,this._externalShadow=g,g.className="sb-external-shadow",g.setAttribute("aria-hidden","true")),!g.parentNode&&i.parentNode&&i.parentNode.appendChild(g));if((c=this.didChangeFor("update","isDecorativeDimmed"))||s){N=this.get("app"),_=this.get("isDecorativeDimmed"),this._decDimAnimTrackingOptions||(this._decDimAnimTrackingOptions={owner:this,inc:function(){isNaN(this.owner.decorativeDimmingAnimationCount)&&(this.owner.decorativeDimmingAnimationCount=0),this.owner.incrementProperty("decorativeDimmingAnimationCount")}.listens("start"),dec:function(){this.owner.decorativeDimmingAnimationCount>0&&this.owner.decrementProperty("decorativeDimmingAnimationCount")}.listens("stop")}),c&&(this._titleFader=CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,this._decDimAnimTrackingOptions,{element:this._title,to:1-_,duration:_?0:550}).start(),this._shadowFader=CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,this._decDimAnimTrackingOptions,{element:this._shadow||this._externalShadow,to:1-_,duration:_?0:550}).start\n());if(_&&!this._decorBlurs){this._createNextDecorBlur();if(this._decorBlurs){u=YES;for(var q=0;q<this.DECOR_BLUR_DERIVATIVES.length;q++)setTimeout(function(){r._createNextDecorBlur()},Math.random()*3e3+1700)}}_&&this._decorBlurs&&(CW.Anim.tellStop(this._decorBlurFader),k&&(k.style.display="none"),i.appendChild(this._decorBlurs[0]),this._decorBlurs[0].style.display="",this._decorBlurs[0].style.opacity=""),c&&!_&&this._decorBlurs&&k&&(this._decorBlurFader=this._oldDecorBlurFader=CW.Animation.create(this._decDimAnimTrackingOptions,{owner:this,blurs:this._decorBlurs,duration:550,avoidFadingBlurs:NO,init:function(){return this.avoidFadingBlurs&&(this.tween=CW.Anim.tweens.LINEAR),arguments.callee.base.apply(this,arguments)},onstart:function(){for(var e=0,t;t=this.blurs[e];e++)t.parentNode||i.appendChild(t)},update:function(){var e=this.current,t=this.blurs,n,r,i=t[0]._blurRadius,s=(1-e)*i,o,u,a;for(a=0;u=t[a];a++)if(u._blurRadius<s){r=u,n=t[a-1];break}r||(r=k,n=t[t.length-1]),this.avoidFadingBlurs||(!r.style.display||(r.style.display=""),!n.style.display||(n.style.display=""));for(a=0;u=t[a];a++)u!==r&&u!==n&&(u.style.display==="none"||(u.style.display="none"));n.style.zIndex==="10"||(n.style.zIndex="10"),r.style.zIndex==="11"||(r.style.zIndex="11"),o=(s-(n._blurRadius||0))/((r._blurRadius||0)-(n._blurRadius||0)),this.avoidFadingBlurs?(n.style.opacity===""||(n.style.opacity=""),r.style.opacity===""||(r.style.opacity=""),n.style.display=o>.5?"none":"",r.style.display=o>.5?"":"none"):(n.style.opacity=1-Math.pow(o,1.6),r.style.opacity=1-Math.pow(1-o,1.6))},onfinish:function(){for(var e=0\n,t;t=this.blurs[e];e++)t.parentNode&&t.parentNode.removeChild(t);k.style.display="",k.style.zIndex="",k.style.opacity=""},onstop:function(){this.owner._decorBlurFader=null}}).start())}if(this.didChangeFor("update","isLocked")||this.didChangeFor("update","isDecorativeDimmedOrUndimming")){var R=this._lockBadge,U=this.get("isLocked")&&!this.get("isDecorativeDimmedOrUndimming"),z,W=NO;U&&(R||(R=this._lockBadge=document.createElement("div"),R.appendChild(z=this._lockImage=new Image),z.onload=function(){R._isLoaded=YES},z.src=this.getPath("app.lockBadgeAsset"),R.className="sb-lock-badge sb-el",R.style.opacity=0,i.appendChild(R)),W=YES),R&&(this._lockBadgeFader=CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,{element:R,to:0+U,duration:o?0:300,shouldSkipFrame:function(){return!this.element._isLoaded}}).start())}if((A=this._lastIsDarkTo)!==(this._lastIsDarkTo=this.get("isDarkTo"))||s){var X=180;x=this.get("isDarkTo"),Math.abs((1-x)/(1-A)-.6)<1e-7&&(X=0),A===0&&x===.28&&(X=0),A===.5&&x===.7&&(X=0),o&&(X=0),CW.Anim.tellStop(this._maskFader),!!x&&!this._mask&&k&&(a=YES,this.createMaskElementFromIconElement()),this._mask&&(this._maskFader=CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,{owner:this,element:this._mask,to:x,duration:X,renderBadgeOpacityAlso:function(){var e=this.owner._badgeMask;if(!e)return;CW.Anim.setOpacity(e,this.current)}.listens("frame")}).start())}f=this.didChangeFor("update","size"),l=this.didChangeFor("update","isSpinning");if(a||u||s||W||f||l){h=this.USE_TRANSFORM_SCALING?142:this.get("size");if(d=k&&k.style)d.width=d.height=Math.round(h)+"px";if(d=this._mask&&this.\n_mask.style)d.width=d.height=Math.round(h)+"px";if(d=this._shadow&&this._shadow.style)d.width=d.height=Math.round(y=h*this.SHADOW_SIZE_MULTIPLE)+"px",d.left=Math.round(b=Math.floor((h-y)/2))+"px",d.top=Math.round(b+h*this.SHADOW_DROP_RATIO)+"px";(d=this._warningArrow.style).width=Math.round(h*this.ARROW_WIDTH_MULTIPLE)+"px",d.height=Math.round(h*this.ARROW_HEIGHT_MULTIPLE)+"px",d.left=Math.round(h*this.ARROW_LEFT_MULTIPLE)+"px",d.top=Math.round(h*this.ARROW_TOP_MULTIPLE)+"px",(d=this._lockBadge&&this._lockBadge.style)&&(v=this._lockImage&&this._lockImage.style)&&(d.width=v.width=Math.round(h*this.LOCK_WIDTH_MULTIPLE)+"px",d.height=v.height=Math.round(h*this.LOCK_HEIGHT_MULTIPLE)+"px",d.left=Math.round(h*this.LOCK_LEFT_MULTIPLE)+"px",d.top=Math.round(h*this.LOCK_TOP_MULTIPLE)+"px"),(d=this._title.style).width=Math.round(h+60)+"px",d.height=Math.ceil(1.3*this.TITLE_SIZE_MULTIPLE*h)+"px",d.top=Math.round(this.TITLE_TOP_MULTIPLE*h)+"px",d.fontSize=Math.round(this.TITLE_SIZE_MULTIPLE*h)+"px",(d=this._errorText.style).width=Math.round(h)+"px",d.height=Math.ceil(1.3*this.ERROR_SIZE_MULTIPLE*h)+"px",d.top=Math.round(this.ERROR_TOP_MULTIPLE*h)+"px",d.fontSize=Math.round(this.ERROR_SIZE_MULTIPLE*h)+"px";if(this._decorBlurs)for(P=0;H=this._decorBlurs[P];P++)(d=H.style).width=d.height=Math.ceil(H._finalSize*h/142)+"px",d.left=d.top=Math.round(h/2-Math.ceil(H._finalSize*h/142)/2)+"px";this.get("isSpinning")&&((d=this._spinner.style).width=d.height=(this._spinnerSize=w=Math.round(this.SPINNER_SIZE_MULTIPLE*h))+"px",d.left=d.top=Math.round(h-w)/2+"px",(d=this._spinnerImage.style).width=w+"px"\n,d.height=w*(this._spinnerAssetFrameCount=this.getPath("app.spinnerAssetFrameCount"))+"px"),p=this.get("size")/142,this.USE_TRANSFORM_SCALING&&this.adjust("scale",p)}p||(p=this.get("size")/142),t.setClass("large-display-text",21*p>=20);if(n==="reposition"||f||this.didChangeFor("update","x","y")){var V=this.getPxY(),$=this.getPxX();!isNaN($)&&!isNaN(V)&&(this.adjust(m={top:Math.round(V-(T=Math.round((h=this.USE_TRANSFORM_SCALING?142:this.get("size"))/2))),left:Math.round($-T),width:Math.round(h),height:Math.round(h)}),this.useExternalShadow&&((d=this._externalShadow.style).width=d.height=(y=h*this.SHADOW_SIZE_MULTIPLE)+"px",d.left=(b=Math.floor((h-y)/2))+m.left+"px",d.top=b+h*this.SHADOW_DROP_RATIO+m.top+"px"))}this.didChangeFor("update","app")&&(N||(N=this.get("app")))&&(this._warningArrow.src=N.get("warningArrowAsset"),this._spinnerImage.src=N.get("spinnerAsset"),this._shadow&&(this._shadow.src=N.get("shadowAsset")),this._externalShadow&&(this._externalShadow.src=N.get("shadowAsset"))),this.didChangeFor("update","displayName")&&(C=this.get("displayName"))&&(this._titleText.innerHTML=C,this._titleHighlightWasSized=NO,this.invokeLast("sizeTitleHighlightToTitleElement"));if(this.didChangeFor("update","errorText")||n==="relocalization")this._errorText.innerHTML=this.get("errorText");this.didChangeFor("update","isFocused")&&this._lastIsFocused!==(this._lastIsFocused=this.get("isFocused"))&&this.$()[0].focus(),this.didChangeFor("update","isShowingWarning")&&this._lastisShowingWarning!==(this._lastisShowingWarning=this.get("isShowingWarning"))&&(this._arrowFader=CW.Anim.Fader.create\n(CW.Anim.DisplayNoneAtZero,{element:this._warningArrow,to:0+(M=this.get("isShowingWarning")),duration:o?0:M?300:300}).start(),this._errorTextFader=CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,{element:this._errorText,to:0+(M=this.get("isShowingWarning")),duration:o?0:M?300:300}).start());if(this.didChangeFor("update","titleIntensity","titleColor","titleShadowSettings")){var J=this.get("titleIntensity"),K=this.get("titleColor"),Q=this.get("titleShadowSettings");this._title.style.color="rgba("+K.r+","+K.g+","+K.b+","+J+")",SC.browser.isIE9OrLower||(this._title.style.textShadow=Q.x+"px "+Q.y+"px "+Q.blur+"px "+"rgba("+Q.r+","+Q.g+","+Q.b+","+(Q.opacityForIntensity?Q.opacityForIntensity(J):Q.opacity)+")")}if(this.didChangeFor("update","badgeCount")||n==="relocalization")j=this.get("badgeCount"),j&&(B=j>9999?"9999+":j,this._badgeText.innerHTML=B,F=j>1?"Badge.Count.Unit.Plural":"Badge.Count.Unit.Singular",this._screenReaderText.innerHTML=", "+B+" "+F.loc(),this.invokeLast("sizeBadge")),this._badgeFader=CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,{element:this._badge,to:j?1:0,duration:c?600:300}).start();if(l||this.didChangeFor("update","isAnimatingWithParent"))(E=this.get("isSpinning"))&&!o?(this._spinnerAnim||(this._spinnerAnim=CW.Animation.create({view:this,signal:function(e){return Math.round(e*12)%12},speed:1,name:"spinnerAnim"+this.toString(),update:function(){if(this._lastTop===(this._lastTop=this.current))return;CW.SpinnerView.renderPosition(this.current,this.view._spinnerSize,this.view._spinnerAssetFrameCount,this.view._spinnerImage)},onstart:function(){this.view._spinner\n.style.display="block",this.spinFader=CW.Fader.create({element:this.view._spinner,to:1,duration:0,name:"spinnerAnim"+this.toString()}).start()},fadeStop:function(){this.spinFader=CW.Fader.create({element:this.view._spinner,to:0,duration:500,owner:this,onfinish:function(){this.owner.stop()}}).start()},onstop:function(){this.view._spinner.style.display="none",this.spinFader&&this.spinFader.stop(),CW.Anim.setOpacity(this.view._spinner,0)}})),this._spinnerAnim.start()):this._spinnerAnim&&(!E&&!o&&this._spinnerAnim.fadeStop(),o&&this._spinnerAnim.stop());this._lastUpdateCompletion=CW.Anim.now-1},updateIfNotUpdatedLastFrame:function(e){var t=CW.Anim.frameTime;(isNaN(this._lastUpdateCompletion)||CW.Anim.now>this._lastUpdateCompletion+t)&&this.update(e)},_createNextDecorBlur:function(){if(this._decorBlurFader&&this._decorBlurs){var e=this;return}var t=this.DECOR_BLUR_DERIVATIVES[this._decorBlurs&&this._decorBlurs.length||0];if(!t)return;var n=this.generateBlurredIconDerivative(t,undefined);if(!n)return;var r=this._decorBlurs||(this._decorBlurs=[]);r.push(n),r.sort(this._sorterForDecreasingBlurRadius)},_sorterForDecreasingBlurRadius:function(e,t){return(t&&t._blurRadius||0)-(e&&e._blurRadius||0)},relocalize:function(){this.update("relocalization")},didCreateLayer:function(){if(!this.get("layer"))return;this._getPointers(),this._doInitialInlineCSS(),this.update()},_getPointers:function(){this._layer=this.get("layer"),this._spinner=this.$(".sb-spinner")[0],this._spinnerImage=this.$(".sb-spinner-image")[0],this._focus=this.$(".sb-focus")[0],this._warningArrow=this.$(".sb-arrow")[0],this\n._errorText=this.$(".sb-error-text")[0],this._title=this.$(".sb-title")[0],this._titleText=this.$(".sb-title-text")[0],this._badge=this.$(".sb-badge")[0],this._badgeText=this.$(".sb-badge .text")[0],this._badgeMask=this.$(".sb-badge .mask")[0],this._badgeRed=this.$(".sb-badge .red")[0],this._screenReaderText=this.$(".sb-ax-text")[0],this._shadow=(this._shadow=this.$(".sb-shadow"))&&this._shadow[0]},_doInitialInlineCSS:function(){this._layer.style.overflow="visible",this._spinner.style.display="none";var e="focus spinner warningArrow errorText badge badgeMask".w();for(var t=0,n;n=this["_"+e[t]];t++)CW.Anim.setOpacity(n,0)},willRemoveFromParent:function(){this.removeExternalShadow()},removeExternalShadow:function(e){this._externalShadow&&this._externalShadow.parentNode&&this._externalShadow.parentNode.removeChild(this._externalShadow),e&&(this._isExternalShadowRemovalPermanent=YES)},getLayerPositionInWindow:function(){var e=this._layerPos||(this._layerPos_={}),t=this.get("frame");return e.x=t.x,e.y=t.y,e},convertPointToView:function(e,t){var n,r;if(!this.getLayerPositionInWindow())return;return typeof e=="object"&&t===undefined&&(typeof e.clientX=="number"?(t=e.clientY,e=e.clientX):(t=e.y,e=e.x)),(n=this._pt_||(this._pt_={})).x=e-(r=this._layerPos_).x,n.y=t-r.y,n},fancyRemoveFromParent:function(){this.removeExternalShadow(YES);if(SC.browser.msie)return this.removeFromParent();if(!this.getPath("springboardView.isReadyToShow"))return this.removeFromParent();if(this._fancyRemovalAnim)return;this._fancyRemovalAnim=this.animate({opacity:0,scale:0,duration:700},{pull:function(){this\n.view._fancyRemovalAnim=null,this.view.removeFromParent(),this.view.adjust({opacity:1,scale:1})}.listens("stop")})},safeDrawImage:function(e){var t=arguments,n=t.length,r,i=this._drawImageFault=NO;if(n===4)try{e.drawImage(t[1],t[2],t[3])}catch(s){r=s}if(n===6)try{e.drawImage(t[1],t[2],t[3],t[4],t[5])}catch(s){r=s}if(n===10)try{e.drawImage(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9])}catch(s){r=s}return r?(this._drawImageFault=i=r,SC.warn("DrawImage failed. Perhaps an image was incompletely loaded? Error text: "+r),NO):YES},createMaskElementFromIconElement:function(){var e=this.get("layer"),t=this.get("iconElement");if(!e||!t)return;var n=this._mask;n&&n.parentNode&&n.parentNode.removeChild(n),n=this._mask=this.generateMaskElement(),e.appendChild(n)},generateMaskElement:function(e){var t,n,r;e||(e=this.get("iconElement"));if(!e||e.tagName==="IMG"&&!e._complete)return this._generateFallbackMaskElement();var i=e.naturalWidth||e.width||142*(window.devicePixelRatio||1),s=e.naturalHeight||e.height||142*(window.devicePixelRatio||1),o="maskForButton"+SC.guidFor(this),u=CloudOS.SpringboardView._maskCache||(CloudOS.SpringboardView._maskCache={}),a=u[o]||(u[o]={});if(a.isReady){r=document.createElement("canvas"),r.width=i,r.height=s;if(!this.safeDrawImage(r.getContext("2d"),a.can,0,0))return this._generateFallbackMaskElement()}else{r=t=document.createElement("canvas"),t.width=i,t.height=s,n=t.getContext("2d"),n.fillStyle="black",n.fillRect(0,0,i,s),n.globalCompositeOperation="destination-in";if(!this.safeDrawImage(n,e,0,0,i,s))return this._generateFallbackMaskElement();a.can=t||n.canvas\n,a.con=n,a.isReady=YES}return r.style.display="none",r.style.opacity=0,r.className="sb-mask sb-el",r},_generateFallbackMaskElement:function(){var e="";(window.devicePixelRatio||1)>1&&(e="");var t=new Image;return t.style.cssText="display:none; opacity:0;",t.src=e,t.className="sb-mask sb-el",t},generateBlurredIconDerivative:function(e,t){var n,r,i,s=new Date*1;t||(t=this.get("iconElement"));if(!t||t.tagName==="IMG"&&!t._complete)return null;e=Math.round(e||0);var o=e<=1?1:e<=6?2:e<=12?3:4,u=this.DECOR_BLUR_MAX_DOWNSAMPLE_RATIOS[e];u&&u<o&&(o=u),e=Math.round(e/o)*o;var a="blurredDerivativeForButton"+SC.guidFor(this)+"_at_"+e+"px",f=(this._blurredIconDerivatives||(this._blurredIconDerivatives={}))[a]||(this._blurredIconDerivatives[a]={}),l=(142+3*e)/o+4;l=Math.ceil(l/2)*2;var c=l*o,h=142/o,p=NO;return f.isReady?(p=YES,this.shouldKeepToImagesForDecorBlur?(i=new Image).src=f.dataURL:(i=document.createElement("canvas"),i.width=i.height=l,this.safeDrawImage(i.getContext("2d"),f.can,0,0))):(this.shouldKeepToImagesForDecorBlur?(i=new Image,n=document.createElement("canvas"),n.width=n.height=l,r=n.getContext("2d")):(i=n=document.createElement("canvas"),n.width=n.height=l,r=n.getContext("2d")),this.safeDrawImage(r,t,l/2-h/2,l/2-h/2,h,h),e&&CloudOS.canvasBoxBlur(n?n:r,Math.ceil(e/o)),f.isReady=YES,f.can=n||r.canvas,this.shouldKeepToImagesForDecorBlur&&(i.src=f.dataURL=n.toDataURL())),i.style.width=i.style.height=c+"px",i.style.position="absolute",i.setAttribute("aria-hidden","true"),i._blurRadius=e,i._finalSize=c,s=new Date*1-s,this._decorBlurLog("time = "+s+"ms, fromCache = "+p+", radius = "+\ne+", downsample = "+o+", bitmapSize = "+l),i},_decorBlurLogMessages:{},_decorBlurLog:function(e){var t=this._decorBlurLogMessages,n=this.getPath("app.name");t=t[n]||(t[n]=[]),t.push(e)},_dumpDecorLog:function(){var e=this._decorBlurLogMessages,t,n="The following blur generations occurred:\\n";for(var r in e){t=e[r],n+=r.toUpperCase()+"\\n";for(var i=0;i<t.length;i++)n+=" "+t[i]+"\\n"}SC.debug(n)},shouldKeepToImagesForDecorBlur:NO}),CloudOS.SpringboardButtonView.BUTTON_TYPES={},CloudOS.SpringboardButtonView.buttonTypeForAppManager=function(e){var t=e.get("appIconType")||"image",n=this.BUTTON_TYPES[t];return n||CW.fatalError("Could not find app icon type "+t,{type:n,buttonTypes:this.BUTTON_TYPES}),n},CloudOS.SpringboardImageButtonView=CloudOS.SpringboardButtonView.extend({isReady:NO,init:function(){arguments.callee.base.apply(this,arguments),this.invokeLast("prepareIcon")},appIconUrlBinding:".app.appIconUrl",appIconUrl2xBinding:".app.appIconUrl2x",icon:function(){var e=window.devicePixelRatio>1?this.get("appIconUrl2x"):this.get("appIconUrl"),t=URI(e);return t&&!t.domain()&&t.protocol()!=="data"?"https://"+window.location.hostname+e:e}.property("appIconUrl","appIconUrl2x").cacheable(),iconElement:null,iconDidLoad:function(){var e=this._iconAssetVessel;this.set("iconElement",e),e&&e.width&&this.set("isReady",YES)},iconDidErr:function(){this.set("isReady",YES)},prepareIcon:function(){var e=this.get("icon");if(this._lastIcon===(this._lastIcon=e)||!e)return;var t=this,n;n=this._iconAssetVessel=new Image,n._complete=NO,n._onload=function(){t._iconAssetVessel===this&&SC.run(function(\n){t.iconDidLoad()})},n.onload=function(){this._complete=YES,this._onload()},n.onerror=function(){this._complete=NO,t._iconAssetVessel===this&&SC.run(function(){t.iconDidErr()})},setTimeout(function(){if(t.get("isReady"))return;t.set("isReady",YES)},4e3),n.src=e,n.alt=""}.observes("icon")}),CloudOS.SpringboardButtonView.BUTTON_TYPES.image=CloudOS.SpringboardImageButtonView,function(){var e=window.devicePixelRatio>1?2:1;CloudOS.SpringboardCalendarButtonView=CloudOS.SpringboardImageButtonView.extend({shouldUseStaticImage:!1,requiresDownsampleableDerivative:(SC.browser.chrome||SC.browser.mozilla)&&e===1||CloudOS.SpringboardImageButtonView.prototype.requiresDownsampleableDerivative,_appendCanvas:!SC.browser.webkit,appIconSize:function(){return 142*e}.property().cacheable(),appIconPadding:21,desiredIconTextWidth:function(){var e=this.get("appIconSize"),t=this.get("_appIconPaddingAdjustedForDPR");return e-t*2}.property("appIconSize","_appIconPaddingAdjustedForDPR").cacheable(),weekdayFontFamily:"SFNSText",monthdayFontFamily:"SFNSDisplay-Numbers",weekdayFontWeight:"400",monthdayFontWeight:"300",weekdayMaxFontSize:26,monthdayMaxFontSize:91,weekdayTextColor:"#FF3B30",monthdayTextColor:"#030303",distanceFromTopToDrawWeekday:39,distanceFromTopToDrawMonthday:83,init:function(){this.staticIcon="_Springboard.CalendarTileStatic.Asset".loc(),this.get("shouldUseStaticImage")&&(this.icon=this.staticIcon);var e=this;CW.fontDetector(this.get("monthdayFontFamily"),{success:function(){e._fontLoaded()},fail:function(){e._fontNotLoaded()},timeout:3e3,testString:"1518"}),arguments.callee.base.apply(this\n,arguments);var t=CW.notificationCenter;t.subscribeToNotification("relocalize",this,"relocalize"),t.subscribeToNotification("redrawCalendarIconIfNecessary",this,"redrawCalendarIconIfNecessary"),t.subscribeToNotification("setCalendarIconDateForDebugging",this,"setCalendarIconDateForDebugging")},setCalendarIconDateForDebugging:function(e){this.customDateForDebugging||(this.customDateForDebugging=new Date),this.customDateForDebugging.setDate(e),this.redrawCalendarIconIfNecessary()},relocalize:function(){this.set("staticIcon","_Springboard.CalendarTileStatic.Asset".loc()),this.get("shouldUseStaticImage")&&this.set("icon",this.staticIcon),this.set("_isLocDifferentSinceLastDraw",!0)},isIconLoaded:!1,isMonthdayFontLoaded:!1,iconDidLoad:function(){this.set("isIconLoaded",!0),this.drawIconIfReady()},drawIconIfReady:function(){if(this.get("isMonthdayFontLoaded")&&this.get("isIconLoaded")){if(this.get("shouldUseStaticImage"))this._revertToStaticIcon();else{var e=this._iconAssetVessel,t,n,r,i=this.get("appIconSize");if(t=this._iconCanvas)t.width=t.height=1;t=this._iconCanvas=document.createElement("canvas"),n=this._iconContext=t.getContext("2d"),t.width=t.height=i,this._appendCanvas&&this.get("iconElement")!==t&&this.set("iconElement",t),this._paintIconAndScheduleUpdate()}this.set("isReady",YES),CW.notificationCenter.postNotification("calendarIconFinishedDrawing")}},redrawCalendarIconIfNecessary:function(){var e;if(!this._iconAssetVessel)return;if(this.get("shouldUseStaticImage")){this._revertToStaticIcon();return}!this.get("_isLocDifferentSinceLastDraw")&&!this.get("isDayDifferentSinceLastDraw"\n)&&(this.set("isReady",YES),CW.notificationCenter.postNotification("calendarIconFinishedDrawing")),date=this.get("customDateForDebugging")||new Date;var t=date.getDay(),n;switch(t){case 0:n="Sunday";break;case 1:n="Monday";break;case 2:n="Tuesday";break;case 3:n="Wednesday";break;case 4:n="Thursday";break;case 5:n="Friday";break;case 6:n="Saturday"}var r=("CalendarIcon."+n).loc(),i=date.getDate(),s=this.get("_lastPaintedWeekday"),o=this.get("_lastPaintedMonthday");if(s===r&&o===i)this.set("isReady",YES),CW.notificationCenter.postNotification("calendarIconFinishedDrawing");else try{this._drawIcon(date,r,i)}catch(e){SC.warn(e),this._revertToStaticIcon()}}.observes("_isLocDifferentSinceLastDraw"),generateMaskElement:function(e){return arguments.callee.base.call(this,e||this._iconCanvas)},generateBlurredIconDerivative:function(e,t){return arguments.callee.base.call(this,e,t||this._iconCanvas)},_appIconPaddingAdjustedForDPR:function(){return this.get("appIconPadding")*e}.property("appIconPadding").cacheable(),_weekdayMaxFontSizeAdjustedForDPR:function(){return this.get("weekdayMaxFontSize")*e}.property("weekdayMaxFontSize").cacheable(),_monthdayMaxFontSizeAdjustedForDPR:function(){return this.get("monthdayMaxFontSize")*e}.property("monthdayMaxFontSize").cacheable(),_distanceFromTopToDrawWeekdayAdjustedForDPR:function(){return this.get("distanceFromTopToDrawWeekday")*e}.property("distanceFromTopToDrawWeekday").cacheable(),_distanceFromTopToDrawMonthdayAdjustedForDPR:function(){return this.get("distanceFromTopToDrawMonthday")*e}.property("distanceFromTopToDrawMonthday").cacheable()\n,_isLocDifferentSinceLastDraw:!0,_isDayDifferentSinceLastDraw:function(){var e=new Date,t=e.getDay()==this.get("_lastPaintedZeroBasedWeekdayInteger"),n=e.getDate()==this.get("_lastPaintedMonthday"),r=e.getFullYear()==this.get("_lastPaintedYear");return!t||!n||!r}.property("_lastPaintedZeroBasedWeekdayInteger","_lastPaintedMonthday","_lastPaintedYear"),_lastPaintedWeekday:"",_lastPaintedZeroBasedWeekdayInteger:null,_lastPaintedMonthday:"",_lastPaintedYear:null,_fontLoaded:function(){this.set("isMonthdayFontLoaded",!0),this.drawIconIfReady()},_fontNotLoaded:function(){SC.warn("Unable to load monthday font for Calendar icon"),CloudOS.recordStat("CalendarIconUnableToLoad",{error:"Unable to load monthday font for Calendar icon",appName:"CloudOS",isFatal:!1}),this.set("shouldUseStaticImage",!0),this.set("isMonthdayFontLoaded",!0),this.drawIconIfReady()},_paintIconAndScheduleUpdate:function(){this.redrawCalendarIconIfNecessary();var e=this.customDateForDebugging||new Date*1,t=(new Date).getTimezoneOffset()*6e4,n=Math.ceil((e-t)/864e5)*864e5-(e-t),r=this;this._daySwitchTimer&&this._daySwitchTimer.invalidate(),this._daySwitchTimer=SC.Timer.schedule({action:function(){r._paintIconAndScheduleUpdate()},interval:n+1,repeats:NO})},_revertToStaticIcon:function(){if(this.get("isIconLoaded")){var e=new Image;e.src=this.get("staticIcon"),e._complete=YES,this.set("iconElement",e),this._iconCanvas&&this._iconCanvas.parentNode&&this._iconCanvas.parentNode.removeChild(this._iconCanvas),CW.notificationCenter.postNotification("calendarIconFinishedDrawing")}},_drawIcon:function(e,t,n){CW.notificationCenter\n.postNotification("calendarIconWillRedraw");var r,i=this._iconAssetVessel,s=this._iconCanvas,o=this._iconContext;if(!i._complete||!i.width||!i.height||!s||!o)throw r="Calendar background is not downloaded. Reverting to static image.",CloudOS.recordStat("CalendarIconUnableToLoad",{error:"Unable to download background image for Calendar icon",appName:"CloudOS",isFatal:!1}),r;s.width=0+s.width,this._drawBase(),this._drawWeekday(t),this._drawMonthday(n);if(!this._appendCanvas){var u=this.get("iconElement");u||(u=new Image,u.owner=this,u.onload=function(){this.owner.set("iconElement",this)}),u.src=s.toDataURL()}this.set("_isLocDifferentSinceLastDraw",!1),this.set("_isDayDifferentSinceLastDraw",!1),this.set("_lastPaintedZeroBasedWeekdayInteger",e.getDay()),this.set("_lastPaintedWeekday",t),this.set("_lastPaintedMonthday",n),this.set("_lastPaintedYear",e.getFullYear())},_drawBase:function(){var e=0,t=0,n=this.get("appIconSize"),r=n;this._iconContext.drawImage(this._iconAssetVessel,e,t,n,r,0,0,n,r)},_drawWeekday:function(t){var n=this.get("appIconSize"),r=this.get("_distanceFromTopToDrawWeekdayAdjustedForDPR"),i=this.get("desiredIconTextWidth"),s=this.get("weekdayFontFamily"),o=this.get("weekdayFontWeight"),u=this.get("_weekdayMaxFontSizeAdjustedForDPR"),a=this._iconContext,f=u;a.font=o+" "+f+"px "+s;var l=a.measureText(t).width;if(l===0)throw error="Width of weekday string was 0, reverting to static icon",CloudOS.recordStat("CalendarIconUnableToLoad",{error:"Calendar icon weekday string was too short.",appName:"CloudOS",isFatal:!1}),error;while(l>=i)f-=1,a.font=o+" "+f+"px "+s,l=a.\nmeasureText(t).width;if(f<5*e)throw error="Weekday string is too long, reverting to static icon",CloudOS.recordStat("CalendarIconUnableToLoad",{error:"Calendar icon weekday string was too long.",appName:"CloudOS",isFatal:!1}),error;a.textAlign="center",a.fillStyle=this.get("weekdayTextColor"),a.fillText(t,n/2,r)},_drawMonthday:function(t){var n=this.get("appIconSize"),r=this.get("_distanceFromTopToDrawMonthdayAdjustedForDPR"),i=this.get("desiredIconTextWidth"),s=this.get("monthdayFontFamily"),o=this.get("monthdayFontWeight"),u=this.get("_monthdayMaxFontSizeAdjustedForDPR"),a=this._iconContext,f=u;a.font=o+" "+f+"px "+s;var l=a.measureText(t).width;if(l===0)throw error="Width of day of the month was 0, reverting to static icon",CloudOS.recordStat("CalendarIconUnableToLoad",{error:"Calendar icon monthday string was too short.",appName:"CloudOS",isFatal:!1}),error;while(l>=i)f-=1,a.font=o+" "+f+"px "+s,l=a.measureText(t).width;if(f<5*e)throw error="Monthday string is too long, reverting to static icon",CloudOS.recordStat("CalendarIconUnableToLoad",{error:"Calendar icon monthday string was too long.",appName:"CloudOS",isFatal:!1}),error;a.textAlign="center",a.textBaseline="middle",a.fillStyle=this.get("monthdayTextColor"),a.fillText(t,n/2,r)}}),CloudOS.setCalendarIconDateForDebugging=function(e){CW.notificationCenter.postNotification("setCalendarIconDateForDebugging",e)},CloudOS.SpringboardButtonView.BUTTON_TYPES.calendar=CloudOS.SpringboardCalendarButtonView}(),CloudOS.SpringboardHomeButtonView=CloudOS.SpringboardImageButtonView.extend({action:function(){var e=this.get("paneHideDuration"\n);this.set("paneHideDuration",200),CloudOS.statechart.sendAction("userDidBeginAnimatingHome"),CloudOS.appSwitcherController.hideAppSwitcher(),this.set("paneHideDuration",e)},isShowingWarning:NO,isDimmed:NO,isUnclickable:NO}),CloudOS.SpringboardButtonView.BUTTON_TYPES.home=CloudOS.SpringboardHomeButtonView,CloudOS.iOSNotificationForSpringboard=CW.iOSNotification.extend({parentElement:function(){return CloudOS.getPath("mainPage.mainPane.springboardView.layer")}.property(),minimumSideClearanceBinding:SC.Binding.transform(function(e){return e-29}).from("CloudOS.workspaceController.accountSignoutHelpProtrusion")});'
,cssSource:".sc-view .sc-view.cos-account-menu{overflow:visible}.sc-view .cos-account-menu .sc-button-view .sc-button-label{padding-left:33px}.sc-view .cos-account-menu>.cw-photo-icon{pointer-events:none}.sc-view .cos-account-menu>.cw-photo-icon>.photo-container{box-sizing:border-box;position:absolute;left:0px;top:0px;width:28px;height:28px;z-index:1;overflow:hidden;border-radius:28px}.sc-view .cos-account-menu>.cw-photo-icon.no-photo>.photo-frame{display:none}.sc-view .cos-account-menu>.cw-photo-icon.no-photo>.photo-container{background-image: url('https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/language/1812Project43/en-us/stylesheet-1.png');\nbackground-position: 0px 0px;\nbackground-repeat:no-repeat}.springboard-view.app-switcher .sc-button-view{color:white;color:rgba(255,255,255,0.8)}.springboard-view.app-switcher .sc-button-view:hover{color:white}.springboard-view.app-switcher .sc-button-view.active{color:white;color:rgba(255,255,255,0.8)}.springboard-view.app-switcher .main-content{background-color:white}.springboard-view.app-switcher .sb-shadow{display:none}.springboard-view.app-switcher .sb-title-highlight{position:absolute;z-index:7;margin-left:-1px;margin-top:-1px;background:#ecf7ff;border-radius:20px;border:1px solid #b6d9ff;display:none}.springboard-view.app-switcher .current-app .sb-title-highlight{display:block}.springboard-view.app-switcher .current-app .sb-title-text{color:#1573fb}.springboard-view.app-switcher .sc-view .sb-title>.sb-title-text{text-shadow:none}.springboard-view.app-switcher .sb-border{position:absolute;pointer-events:none;cursor:pointer;left:0;right:0;bottom:0;top:0;z-index:12;border-radius:23%;border:1px solid rgba(0,0,0,0.11)}.springboard-view.app-switcher .sb-badge .text{font-size:17px}.springboard-view.app-switcher .sc-view a[role=button]{outline:0}.springboard-view.app-switcher .sc-view a[role=button]:focus .sb-icon{outline:dotted #7dadd9 1px;outline:auto -webkit-focus-ring-color 1px}.springboard-view .sb-el{position:absolute}.springboard-view .sb-ax-text{position:absolute;z-index:-1;opacity:0;top:-150px;left:35px}.springboard-view .sb-badge{z-index:50;cursor:pointer;text-align:right}.springboard-view .sb-badge .text,.springboard-view .sb-badge .mask,.springboard-view .sb-badge .red{position:absolute}.springboard-view .sb-badge .text{color:white;z-index:2;font-size:25px;text-align:right}.springboard-view .sb-badge .mask,.springboard-view .sb-badge .red{position:absolute;border-radius:50px}.springboard-view .sb-badge .mask{z-index:3;background:black}.springboard-view .sb-badge .red{z-index:1;background:red}.springboard-view .sb-decor-shadow{z-index:40;cursor:default;pointer-events:none}.springboard-view .sb-spinner{z-index:30;cursor:pointer;overflow:hidden}.springboard-view .sb-arrow{z-index:25;cursor:pointer;pointer-events:none}.springboard-view .sb-mask{z-index:20;cursor:pointer}.springboard-view .sb-icon{z-index:10;cursor:pointer;image-rendering:optimizeQuality}.springboard-view .sb-shadow{z-index:5;cursor:default;pointer-events:none}.springboard-view .sb-mask,.springboard-view .sb-icon{left:0px;top:0px}.springboard-view .springboard-button-view{overflow:visible !important;cursor:default;text-decoration:none}.springboard-view .sb-external-shadow{cursor:default;position:absolute;z-index:14;pointer-events:none}.springboard-view .sb-lock-badge{z-index:27;cursor:pointer;pointer-events:none}.springboard-view .sb-lock-badge img{position:absolute;left:0px;top:0px}.springboard-view div.sc-view div.sb-title{cursor:default;z-index:8;color:white;left:-30px;text-align:center;pointer-events:none}.msie .springboard-view div.sc-view div.sb-title{pointer-events:all}.springboard-view div.sc-view div.sb-title>.sb-title-text{pointer-events:all;cursor:pointer;text-shadow:#000 0 0 25px}.windows.mozilla.tr-tr .springboard-view div.sc-view div.sb-title>.sb-title-text{font-size:19px}.springboard-view div.sc-view div.sb-error-text{cursor:default;z-index:7;color:white;left:0px;text-align:center;pointer-events:none;white-space:nowrap}.springboard-view div.custom-button{background:transparent !important;max-height:none !important}.springboard-view .sc-view a[role=button]:focus .sb-shadow{outline:dotted #7dadd9 1px;outline-style:auto;outline-color:-webkit-focus-ring-color}.springboard-view .sc-view:-moz-focusring{outline:1px dotted #9d9d9d}.springboard-view .blur-overlay{background:rgba(0,0,0,0.1)}\n"
,cssLogicalUrl:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/stylesheet.css",css2xSource:".sc-view .sc-view.cos-account-menu{overflow:visible}.sc-view .cos-account-menu .sc-button-view .sc-button-label{padding-left:33px}.sc-view .cos-account-menu>.cw-photo-icon{pointer-events:none}.sc-view .cos-account-menu>.cw-photo-icon>.photo-container{box-sizing:border-box;position:absolute;left:0px;top:0px;width:28px;height:28px;z-index:1;overflow:hidden;border-radius:28px}.sc-view .cos-account-menu>.cw-photo-icon.no-photo>.photo-frame{display:none}.sc-view .cos-account-menu>.cw-photo-icon.no-photo>.photo-container{background-size: 28px 28px;\nbackground-image: url('https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/language/1812Project43/en-us/stylesheet-1@2x.png');\nbackground-position: 0px 0px;\nbackground-repeat:no-repeat}.springboard-view.app-switcher .sc-button-view{color:white;color:rgba(255,255,255,0.8)}.springboard-view.app-switcher .sc-button-view:hover{color:white}.springboard-view.app-switcher .sc-button-view.active{color:white;color:rgba(255,255,255,0.8)}.springboard-view.app-switcher .main-content{background-color:white}.springboard-view.app-switcher .sb-shadow{display:none}.springboard-view.app-switcher .sb-title-highlight{position:absolute;z-index:7;margin-left:-1px;margin-top:-1px;background:#ecf7ff;border-radius:20px;border:1px solid #b6d9ff;display:none}.springboard-view.app-switcher .current-app .sb-title-highlight{display:block}.springboard-view.app-switcher .current-app .sb-title-text{color:#1573fb}.springboard-view.app-switcher .sc-view .sb-title>.sb-title-text{text-shadow:none}.springboard-view.app-switcher .sb-border{position:absolute;pointer-events:none;cursor:pointer;left:0;right:0;bottom:0;top:0;z-index:12;border-radius:23%;border:1px solid rgba(0,0,0,0.11)}.springboard-view.app-switcher .sb-badge .text{font-size:17px}.springboard-view.app-switcher .sc-view a[role=button]{outline:0}.springboard-view.app-switcher .sc-view a[role=button]:focus .sb-icon{outline:dotted #7dadd9 1px;outline:auto -webkit-focus-ring-color 1px}.springboard-view .sb-el{position:absolute}.springboard-view .sb-ax-text{position:absolute;z-index:-1;opacity:0;top:-150px;left:35px}.springboard-view .sb-badge{z-index:50;cursor:pointer;text-align:right}.springboard-view .sb-badge .text,.springboard-view .sb-badge .mask,.springboard-view .sb-badge .red{position:absolute}.springboard-view .sb-badge .text{color:white;z-index:2;font-size:25px;text-align:right}.springboard-view .sb-badge .mask,.springboard-view .sb-badge .red{position:absolute;border-radius:50px}.springboard-view .sb-badge .mask{z-index:3;background:black}.springboard-view .sb-badge .red{z-index:1;background:red}.springboard-view .sb-decor-shadow{z-index:40;cursor:default;pointer-events:none}.springboard-view .sb-spinner{z-index:30;cursor:pointer;overflow:hidden}.springboard-view .sb-arrow{z-index:25;cursor:pointer;pointer-events:none}.springboard-view .sb-mask{z-index:20;cursor:pointer}.springboard-view .sb-icon{z-index:10;cursor:pointer;image-rendering:optimizeQuality}.springboard-view .sb-shadow{z-index:5;cursor:default;pointer-events:none}.springboard-view .sb-mask,.springboard-view .sb-icon{left:0px;top:0px}.springboard-view .springboard-button-view{overflow:visible !important;cursor:default;text-decoration:none}.springboard-view .sb-external-shadow{cursor:default;position:absolute;z-index:14;pointer-events:none}.springboard-view .sb-lock-badge{z-index:27;cursor:pointer;pointer-events:none}.springboard-view .sb-lock-badge img{position:absolute;left:0px;top:0px}.springboard-view div.sc-view div.sb-title{cursor:default;z-index:8;color:white;left:-30px;text-align:center;pointer-events:none}.msie .springboard-view div.sc-view div.sb-title{pointer-events:all}.springboard-view div.sc-view div.sb-title>.sb-title-text{pointer-events:all;cursor:pointer;text-shadow:#000 0 0 25px}.windows.mozilla.tr-tr .springboard-view div.sc-view div.sb-title>.sb-title-text{font-size:19px}.springboard-view div.sc-view div.sb-error-text{cursor:default;z-index:7;color:white;left:0px;text-align:center;pointer-events:none;white-space:nowrap}.springboard-view div.custom-button{background:transparent !important;max-height:none !important}.springboard-view .sc-view a[role=button]:focus .sb-shadow{outline:dotted #7dadd9 1px;outline-style:auto;outline-color:-webkit-focus-ring-color}.springboard-view .sc-view:-moz-focusring{outline:1px dotted #9d9d9d}.springboard-view .blur-overlay{background:rgba(0,0,0,0.1)}\n"
,css2xLogicalUrl:"https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/stylesheet@2x.css"})}();