// Copyright 2011 Software Freedom Conservatory // 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(){return function(){function f(a){throw a;}var h=void 0,l=null;function m(a){return function(){return this[a]}}function o(a){return function(){return a}}var p,r=this; function s(a){var b=typeof a;if(b=="object")if(a){if(a instanceof Array)return"array";else if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if(c=="[object Window]")return"object";if(c=="[object Array]"||typeof a.length=="number"&&typeof a.splice!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("splice"))return"array";if(c=="[object Function]"||typeof a.call!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("call"))return"function"}else return"null"; else if(b=="function"&&typeof a.call=="undefined")return"object";return b}function t(a){var b=s(a);return b=="array"||b=="object"&&typeof a.length=="number"}function u(a){return typeof a=="string"}function aa(a){a=s(a);return a=="object"||a=="array"||a=="function"}var ba="closure_uid_"+Math.floor(Math.random()*2147483648).toString(36),ca=0,da=Date.now||function(){return+new Date};function v(a,b){function c(){}c.prototype=b.prototype;a.Q=b.prototype;a.prototype=new c};function ea(a){this.stack=Error().stack||"";if(a)this.message=String(a)}v(ea,Error);ea.prototype.name="CustomError";function fa(a){for(var b=1;b")!=-1&&(a=a.replace(ja,">"));a.indexOf('"')!=-1&&(a=a.replace(ka,"""));return a}var ha=/&/g,ia=//g,ka=/\"/g,ga=/[&<>\"]/;function la(a,b){if(ab)return 1;return 0} var ma=Math.random()*2147483648|0;function na(a,b){b.unshift(a);ea.call(this,fa.apply(l,b));b.shift();this.ra=a}v(na,ea);na.prototype.name="AssertionError";function oa(a,b){if(!a){var c=Array.prototype.slice.call(arguments,2),d="Assertion failed";if(b){d+=": "+b;var e=c}f(new na(""+d,e||[]))}}function pa(a){f(new na("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1)))};function x(a){return a[a.length-1]}var qa=Array.prototype;function z(a,b){if(u(a)){if(!u(b)||b.length!=1)return-1;return a.indexOf(b,0)}for(var c=0;cparseFloat(Ja)){Ia=String(Ma);break a}}Ia=Ja}var Pa={}; function E(a){var b;if(!(b=Pa[a])){b=0;for(var c=String(Ia).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=Math.max(c.length,d.length),g=0;b==0&&g=0}return b}var Qa={};function Ra(){return Qa[9]||(Qa[9]=B&&document.documentMode&&document.documentMode>=9)};var Sa,Ta=!B||E("9");!C&&!B||B&&E("9")||C&&E("1.9.1");B&&E("9");function Ua(a){var b;b=(b=a.className)&&typeof b.split=="function"?b.split(/\s+/):[];var c=za(arguments,1),d;d=b;for(var e=0,g=0;g=0||(d.push(c[g]),e++);d=e==c.length;a.className=b.join(" ");return d};function Va(a,b){for(var c in a)b.call(h,a[c],c,a)}var Wa=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];function Xa(a){for(var b,c,d=1;d0)?ra(db(g)?xa(g):g,d):d(g)}}function eb(a){return a&&a.parentNode?a.parentNode.removeChild(a):l}function G(a,b){if(a.contains&&b.nodeType==1)return a==b||a.contains(b);if(typeof a.compareDocumentPosition!="undefined")return a==b||Boolean(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a} function fb(a,b){if(a==b)return 0;if(a.compareDocumentPosition)return a.compareDocumentPosition(b)&2?1:-1;if("sourceIndex"in a||a.parentNode&&"sourceIndex"in a.parentNode){var c=a.nodeType==1,d=b.nodeType==1;if(c&&d)return a.sourceIndex-b.sourceIndex;else{var e=a.parentNode,g=b.parentNode;if(e==g)return gb(a,b);if(!c&&G(e,b))return-1*hb(a,b);if(!d&&G(g,a))return hb(b,a);return(c?a.sourceIndex:e.sourceIndex)-(d?b.sourceIndex:g.sourceIndex)}}d=F(a);c=d.createRange();c.selectNode(a);c.collapse(!0);d= d.createRange();d.selectNode(b);d.collapse(!0);return c.compareBoundaryPoints(r.Range.START_TO_END,d)}function hb(a,b){var c=a.parentNode;if(c==b)return-1;for(var d=b;d.parentNode!=c;)d=d.parentNode;return gb(d,a)}function gb(a,b){for(var c=b;c=c.previousSibling;)if(c==a)return-1;return 1} function ib(){var a,b=arguments.length;if(b){if(b==1)return arguments[0]}else return l;var c=[],d=Infinity;for(a=0;a");c=c.join("")}c=a.createElement(c);if(d)u(d)?c.className=d:s(d)=="array"?Ua.apply(l,[c].concat(d)):$a(c,d);b.length>2&&cb(a,c,b);return c};p.createElement=function(a){return this.v.createElement(a)};p.createTextNode=function(a){return this.v.createTextNode(a)}; p.$=function(){return this.v.parentWindow||this.v.defaultView};p.appendChild=function(a,b){a.appendChild(b)};p.removeNode=eb;p.contains=G;function jb(){kb&&(this[ba]||(this[ba]=++ca))}var kb=!1;var H="StopIteration"in r?r.StopIteration:Error("StopIteration");function I(){}I.prototype.next=function(){f(H)};I.prototype.w=function(){return this};function lb(a){if(a instanceof I)return a;if(typeof a.w=="function")return a.w(!1);if(t(a)){var b=0,c=new I;c.next=function(){for(;;)if(b>=a.length&&f(H),b in a)return a[b++];else b++};return c}f(Error("Not implemented"))} function mb(a,b){if(t(a))try{ra(a,b,h)}catch(c){c!==H&&f(c)}else{a=lb(a);try{for(;;)b.call(h,a.next(),h,a)}catch(d){d!==H&&f(d)}}}function nb(a){if(t(a))return ya(a);var a=lb(a),b=[];mb(a,function(a){b.push(a)});return b};function ob(a){return pb(a||arguments.callee.caller,[])} function pb(a,b){var c=[];if(z(b,a)>=0)c.push("[...circular reference...]");else if(a&&b.length<50){c.push(qb(a)+"(");for(var d=a.arguments,e=0;e0&&c.push(", ");var g;g=d[e];switch(typeof g){case "object":g=g?"object":"null";break;case "string":break;case "number":g=String(g);break;case "boolean":g=g?"true":"false";break;case "function":g=(g=qb(g))?g:"[fn]";break;default:g=typeof g}g.length>40&&(g=g.substr(0,40)+"...");c.push(g)}b.push(a);c.push(")\n");try{c.push(pb(a.caller,b))}catch(i){c.push("[exception trying to get caller]\n")}}else a? c.push("[...long stack...]"):c.push("[end]");return c.join("")}function qb(a){a=String(a);if(!rb[a]){var b=/function ([^\(]+)/.exec(a);rb[a]=b?b[1]:"[Anonymous]"}return rb[a]}var rb={};function J(a,b,c,d,e){this.reset(a,b,c,d,e)}J.prototype.ia=0;J.prototype.Z=l;J.prototype.Y=l;var sb=0;J.prototype.reset=function(a,b,c,d,e){this.ia=typeof e=="number"?e:sb++;this.ta=d||da();this.H=a;this.ga=b;this.qa=c;delete this.Z;delete this.Y};J.prototype.ba=function(a){this.H=a};function K(a){this.ha=a}K.prototype.O=l;K.prototype.H=l;K.prototype.R=l;K.prototype.aa=l;function tb(a,b){this.name=a;this.value=b}tb.prototype.toString=m("name");var ub=new tb("SEVERE",1E3),vb=new tb("WARNING",900),wb=new tb("CONFIG",700);K.prototype.getParent=m("O");K.prototype.ba=function(a){this.H=a};function xb(a){if(a.H)return a.H;if(a.O)return xb(a.O);pa("Root logger has no level set.");return l} K.prototype.log=function(a,b,c){if(a.value>=xb(this).value){a=this.ea(a,b,c);r.console&&r.console.markTimeline&&r.console.markTimeline("log:"+a.ga);for(b=this;b;){var c=b,d=a;if(c.aa)for(var e=0,g=h;g=c.aa[e];e++)g(d);b=b.getParent()}}}; K.prototype.ea=function(a,b,c){var d=new J(a,String(b),this.ha);if(c){d.Z=c;var e;var g=arguments.callee.caller;try{var i;var j;c:{for(var k="window.location.href".split("."),q=r,n;n=k.shift();)if(q[n]!=l)q=q[n];else{j=l;break c}j=q}if(u(c))i={message:c,name:"Unknown error",lineNumber:"Not available",fileName:j,stack:"Not available"};else{var y,Oa,k=!1;try{y=c.lineNumber||c.pa||"Not available"}catch(hc){y="Not available",k=!0}try{Oa=c.fileName||c.filename||c.sourceURL||j}catch(ic){Oa="Not available", k=!0}i=k||!c.lineNumber||!c.fileName||!c.stack?{message:c.message,name:c.name,lineNumber:y,fileName:Oa,stack:c.stack||"Not available"}:c}e="Message: "+w(i.message)+'\nUrl: '+i.fileName+"\nLine: "+i.lineNumber+"\n\nBrowser stack:\n"+w(i.stack+"-> ")+"[end]\n\nJS stack traversal:\n"+w(ob(g)+"-> ")}catch(fc){e="Exception trying to expose exception! You win, we lose. "+fc}d.Y=e}return d};var yb={},zb=l; function Ab(a){zb||(zb=new K(""),yb[""]=zb,zb.ba(wb));var b;if(!(b=yb[a])){b=new K(a);var c=a.lastIndexOf("."),d=a.substr(c+1),c=Ab(a.substr(0,c));if(!c.R)c.R={};c.R[d]=b;b.O=c;yb[a]=b}return b};function L(){jb.call(this)}v(L,jb);Ab("goog.dom.SavedRange");v(function(a){jb.call(this);this.ja="goog_"+ma++;this.da="goog_"+ma++;this.X=Ya(a.T());a.K(this.X.S("SPAN",{id:this.ja}),this.X.S("SPAN",{id:this.da}))},L);function M(a,b,c,d,e){this.l=!!b;a&&N(this,a,d);this.r=e!=h?e:this.n||0;this.l&&(this.r*=-1);this.ca=!c}v(M,I);p=M.prototype;p.m=l;p.n=0;p.W=!1;function N(a,b,c,d){if(a.m=b)a.n=typeof c=="number"?c:a.m.nodeType!=1?0:a.l?-1:1;if(typeof d=="number")a.r=d} p.next=function(){var a;if(this.W){(!this.m||this.ca&&this.r==0)&&f(H);a=this.m;var b=this.l?-1:1;if(this.n==b){var c=this.l?a.lastChild:a.firstChild;c?N(this,c):N(this,a,b*-1)}else(c=this.l?a.previousSibling:a.nextSibling)?N(this,c):N(this,a.parentNode,b*-1);this.r+=this.n*(this.l?-1:1)}else this.W=!0;(a=this.m)||f(H);return a}; p.splice=function(){var a=this.m,b=this.l?1:-1;if(this.n==b)this.n=b*-1,this.r+=this.n*(this.l?-1:1);this.l=!this.l;M.prototype.next.call(this);this.l=!this.l;for(var b=t(arguments[0])?arguments[0]:arguments,c=b.length-1;c>=0;c--)a.parentNode&&a.parentNode.insertBefore(b[c],a.nextSibling);eb(a)};function O(){}function Bb(a){if(a.getSelection)return a.getSelection();else{var a=a.document,b=a.selection;if(b){try{var c=b.createRange();if(c.parentElement){if(c.parentElement().document!=a)return l}else if(!c.length||c.item(0).document!=a)return l}catch(d){return l}return b}return l}}function Cb(a){for(var b=[],c=0,d=a.z();c=0&&this.j(d,1,0)<=0:this.j(d,0,0)>=0&&this.j(d,1,1)<=0}catch(e){return B||f(e),!1}};S.prototype.containsNode=function(a,b){return this.q(T(a),b)};S.prototype.w=function(){return new R(this.b(),this.h(),this.g(),this.i())};function U(a){this.a=a}v(U,S);function Eb(a){var b=F(a).createRange();if(a.nodeType==3)b.setStart(a,0),b.setEnd(a,a.length);else if(V(a)){for(var c,d=a;(c=d.firstChild)&&V(c);)d=c;b.setStart(d,0);for(d=a;(c=d.lastChild)&&V(c);)d=c;b.setEnd(d,d.nodeType==1?d.childNodes.length:d.length)}else c=a.parentNode,a=z(c.childNodes,a),b.setStart(c,a),b.setEnd(c,a+1);return b}function Fb(a,b,c,d){var e=F(a).createRange();e.setStart(a,b);e.setEnd(c,d);return e}p=U.prototype;p.s=function(){return this.a.commonAncestorContainer}; p.b=function(){return this.a.startContainer};p.h=function(){return this.a.startOffset};p.g=function(){return this.a.endContainer};p.i=function(){return this.a.endOffset};p.j=function(a,b,c){return this.a.compareBoundaryPoints(c==1?b==1?r.Range.START_TO_START:r.Range.START_TO_END:b==1?r.Range.END_TO_START:r.Range.END_TO_END,a)};p.isCollapsed=function(){return this.a.collapsed};p.select=function(a){this.P(bb(F(this.b())).getSelection(),a)};p.P=function(a){a.removeAllRanges();a.addRange(this.a)}; p.insertNode=function(a,b){var c=this.a.cloneRange();c.collapse(b);c.insertNode(a);c.detach();return a}; p.K=function(a,b){var c=bb(F(this.b()));if(c=(c=Bb(c||window))&&Gb(c))var d=c.b(),e=c.g(),g=c.h(),i=c.i();var j=this.a.cloneRange(),k=this.a.cloneRange();j.collapse(!1);k.collapse(!0);j.insertNode(b);k.insertNode(a);j.detach();k.detach();if(c){if(d.nodeType==3)for(;g>d.length;){g-=d.length;do d=d.nextSibling;while(d==a||d==b)}if(e.nodeType==3)for(;i>e.length;){i-=e.length;do e=e.nextSibling;while(e==a||e==b)}Hb(d,g,e,i).select()}};p.collapse=function(a){this.a.collapse(a)};function W(a){this.a=a}v(W,U);W.prototype.P=function(a,b){var c=b?this.g():this.b(),d=b?this.i():this.h(),e=b?this.b():this.g(),g=b?this.h():this.i();a.collapse(c,d);(c!=e||d!=g)&&a.extend(e,g)};function Ib(a,b,c,d){M.call(this,a,b,c,l,d)}v(Ib,M);Ib.prototype.next=function(){do Ib.Q.next.call(this);while(this.n==-1);return this.m};function X(a,b){this.a=a;this.ma=b}v(X,S);var Jb=Ab("goog.dom.browserrange.IeRange");function Kb(a){var b=F(a).body.createTextRange();if(a.nodeType==1)b.moveToElementText(a),V(a)&&!a.childNodes.length&&b.collapse(!1);else{for(var c=0,d=a;d=d.previousSibling;){var e=d.nodeType;if(e==3)c+=d.length;else if(e==1){b.moveToElementText(d);break}}d||b.moveToElementText(a.parentNode);b.collapse(!d);c&&b.move("character",c);b.moveEnd("character",a.length)}return b}p=X.prototype;p.u=l;p.d=l;p.c=l;p.f=-1; p.e=-1;p.o=function(){this.u=this.d=this.c=l;this.f=this.e=-1}; p.s=function(){if(!this.u){var a=this.a.text,b=this.a.duplicate(),c=a.replace(/ +$/,"");(c=a.length-c.length)&&b.moveEnd("character",-c);c=b.parentElement();b=b.htmlText.replace(/(\r\n|\r|\n)+/g," ").length;if(this.isCollapsed()&&b>0)return this.u=c;for(;b>c.outerHTML.replace(/(\r\n|\r|\n)+/g," ").length;)c=c.parentNode;for(;c.childNodes.length==1&&c.innerText==(c.firstChild.nodeType==3?c.firstChild.nodeValue:c.firstChild.innerText);){if(!V(c.firstChild))break;c=c.firstChild}a.length==0&&(c=Lb(this, c));this.u=c}return this.u};function Lb(a,b){for(var c=b.childNodes,d=0,e=c.length;d=0&&a.j(i,1,0)<=0:a.a.inRange(i))return Lb(a,g)}}return b}p.b=function(){if(!this.d&&(this.d=Mb(this,1),this.isCollapsed()))this.c=this.d;return this.d};p.h=function(){if(this.f<0&&(this.f=Nb(this,1),this.isCollapsed()))this.e=this.f;return this.f}; p.g=function(){if(this.isCollapsed())return this.b();if(!this.c)this.c=Mb(this,0);return this.c};p.i=function(){if(this.isCollapsed())return this.h();if(this.e<0&&(this.e=Nb(this,0),this.isCollapsed()))this.f=this.e;return this.e};p.j=function(a,b,c){return this.a.compareEndPoints((b==1?"Start":"End")+"To"+(c==1?"Start":"End"),a)}; function Mb(a,b,c){c=c||a.s();if(!c||!c.firstChild)return c;for(var d=b==1,e=0,g=c.childNodes.length;e0)return Mb(a,b,j)}return c} function Nb(a,b){var c=b==1,d=c?a.b():a.g();if(d.nodeType==1){for(var d=d.childNodes,e=d.length,g=c?1:-1,i=c?0:e-1;i>=0&&ig.childNodes.length&&Jb.log(ub,"Cannot have startOffset > startNode child count",h),i=g.childNodes[i],q=!i,g=i||g.lastChild||g,i=0);var n=Kb(g);i&&n.move("character",i);g==j&&i==k?n.collapse(!0):(q&&n.collapse(!1),q=!1,j.nodeType==1&&(k>j.childNodes.length&&Jb.log(ub,"Cannot have endOffset > endNode child count",h),y=(i=j.childNodes[k])||j.lastChild||j,j=y,k=0,q=!i),g= Kb(j),g.collapse(!q),k&&g.moveEnd("character",k),n.setEndPoint("EndToEnd",g));k=new X(n,F(b));k.d=b;k.f=c;k.c=d;k.e=e;b=k}else b=Ha?new Y(Fb(b,c,d,e)):C?new W(Fb(b,c,d,e)):Ga?new Pb(Fb(b,c,d,e)):new U(Fb(b,c,d,e));b=a.F=b}return b}p.s=function(){return Z(this).s()};p.b=function(){return this.d||(this.d=Z(this).b())};p.h=function(){return this.f!=l?this.f:this.f=Z(this).h()};p.g=function(){return this.c||(this.c=Z(this).g())};p.i=function(){return this.e!=l?this.e:this.e=Z(this).i()};p.A=m("B"); p.q=function(a,b){var c=a.U();if(c=="text")return Z(this).q(Z(a),b);else if(c=="control")return c=Ub(a),(b?ta:ua)(c,function(a){return this.containsNode(a,b)},this);return!1};p.isCollapsed=function(){return Z(this).isCollapsed()};p.w=function(){return new R(this.b(),this.h(),this.g(),this.i())};p.select=function(){Z(this).select(this.B)};p.insertNode=function(a,b){var c=Z(this).insertNode(a,b);this.o();return c};p.K=function(a,b){Z(this).K(a,b);this.o()};p.V=function(){return new Vb(this)}; p.collapse=function(a){a=this.A()?!a:a;this.F&&this.F.collapse(a);a?(this.c=this.d,this.e=this.f):(this.d=this.c,this.f=this.e);this.B=!1};function Vb(a){this.ka=a.A()?a.g():a.b();this.la=a.A()?a.i():a.h();this.na=a.A()?a.b():a.g();this.oa=a.A()?a.h():a.i()}v(Vb,L);function Wb(){}v(Wb,Q);p=Wb.prototype;p.a=l;p.k=l;p.J=l;p.o=function(){this.J=this.k=l};p.U=o("control");p.N=function(){return this.a||document.body.createControlRange()};p.z=function(){return this.a?this.a.length:0};p.t=function(a){a=this.a.item(a);return Sb(T(a),h)};p.s=function(){return ib.apply(l,Ub(this))};p.b=function(){return Xb(this)[0]};p.h=o(0);p.g=function(){var a=Xb(this),b=x(a);return va(a,function(a){return G(a,b)})};p.i=function(){return this.g().childNodes.length}; function Ub(a){if(!a.k&&(a.k=[],a.a))for(var b=0;b1&&this.fa.log(vb,"getBrowserRangeObject called on MultiRange with more than 1 range",h);return this.p[0]};p.z=function(){return this.p.length};p.t=function(a){this.I[a]||(this.I[a]=Sb(Qb(this.p[a]),h));return this.I[a]}; p.s=function(){if(!this.L){for(var a=[],b=0,c=this.z();b1){b=new $b;for(var c=0,e=a.rangeCount;c0};function dc(a,b){var c=new Db(a);(c=va(nb(c),function(a){return a.nodeType==3&&a.data.indexOf(b)!=-1}))||f("could not find text node matching: "+b);var d=c.data.indexOf(b);Hb(c,d,c,d+b.length).select()}var ec="_".split("."),$=r;!(ec[0]in $)&&$.execScript&&$.execScript("var "+ec[0]);for(var gc;ec.length&&(gc=ec.shift());)!ec.length&&dc!==h?$[gc]=dc:$=$[gc]?$[gc]:$[gc]={};; return this._.apply(null,arguments);}.apply({navigator:typeof window!='undefined'?window.navigator:null}, arguments);}