-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.js
More file actions
260 lines (259 loc) · 33.5 KB
/
util.js
File metadata and controls
260 lines (259 loc) · 33.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
Function.prototype.bind=function(a){if(typeof this!="function"){throw new Error("Bind must be called as a method of a function object.");}var b=this;var c=Array.prototype.splice.call(arguments,1,arguments.length);return function(){var d=c.concat();for(var e=0;e<arguments.length;e++){d.push(arguments[e])}return b.apply(a,d)}
}
;var Ta;var Ya;(function(){var a={};var b=0;function c(f){if(!f.Da){f.Da=++b}return f.Da}
function d(f,h,l,n){var k=c(f);var q=c(l);n=!(!n);var s=k+"_"+h+"_"+q+"_"+n;return s}
Ta=function(f,h,l,n){var k=d(f,h,l,n);if(k in a){return k}var q=e.bind(null,k);a[k]={listener:l,proxy:q};if(f.addEventListener){f.addEventListener(h,q,n)}else if(f.attachEvent){f.attachEvent("on"+h,q)}else{throw new Error("Node {"+f+"} does not support event listeners.");}return k}
;Ya=function(f,h,l,n){var k=d(f,h,l,n);if(!(k in a)){return false}var q=a[k].proxy;if(f.removeEventListener){f.removeEventListener(h,q,n)}else if(f.detachEvent){f.detachEvent("on"+h,q)}delete a[k];return true}
;function e(f){var h=Array.prototype.splice.call(arguments,1,arguments.length);return a[f].listener.apply(null,h)}
}
)();var oa=["Su","M","Tu","W","Th","F","Sa"];var Z=[,"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var aa=[,"January","February","March","April","May","June","July","August","September","October","November","December"];var Aa;var Qa;var Ba;var Ca;var W;var Sa;var Ra;(function(){var a=navigator.userAgent.toLowerCase();Aa=a.indexOf("msie")!=-1;Qa=a.indexOf("msie 5")!=-1&&document.all;Ba=a.indexOf("konqueror")!=-1;Ca=a.indexOf("safari")!=-1||Ba;W=!Aa&&!Ca&&a.indexOf("mozilla"
)!=-1;Sa=a.indexOf("win")!=-1;Ra=!(!window.opera)}
)();function na(a,b){}
;function ca(a){if(!a)return"";return a.replace(/&#(\d+);/g,function(b,c){return String.fromCharCode(parseInt(c,10))}
).replace(/&#x([a-f0-9]+);/gi,function(b,c){return String.fromCharCode(parseInt(c,16))}
).replace(/&(\w+);/g,function(b,c){c=c.toLowerCase();return c in ca.unesc?ca.unesc[c]:"?"}
)}
ca.unesc={lt:"<",gt:">",quot:'"',nbsp:" ",amp:"&"};function Y(a){return Y.Ba[a]}
function ma(a){if(!Y.Ba){var b={};b["\\"]="\\\\";b["'"]="\\047";b["\u0008"]="\\b";b['"']="\\042";b["<"]="\\074";b[">"]="\\076";b["&"]="\\046";b["\n"]="\\n";b["\r"]="\\r";b["\u0085"]="\\205";b["\u2028"]="\\u2028";b["\u2029"]="\\u2029";Y.Ba=b}return"'"+a.toString().replace(/[\'\\\r\n\b\"<>&\u0085\u2028\u2029]/g,Y)+"'"}
function Ea(a){var b={};b.clientX=a.clientX;b.clientY=a.clientY;b.pageX=a.pageX;b.pageY=a.pageY;b.type=a.type;b.srcElement=a.srcElement;b.target=a.target;b.cancelBubble=a.cancelBubble;b.explicitOriginalTarget=a.explicitOriginalTarget;return b}
function Oa(a){return document.getElementById(a)}
function Pa(a){return document.all[a]}
var z=document.getElementById?Oa:Pa;function ba(a){var b;if(!("name" in a)){var c=/\W*function\s+([\w\$]+)\(/.exec(a);if(!c){throw new Error("Cannot extract name from function: "+a);}b=c[1];a.name=b}else{b=a.name}if(!b||b=="anonymous"){throw new Error("Anonymous function has no name: "+a);}return a.name}
function _showLogWindow(){}
function N(a){return a<0?-1:1}
function X(a){return a|0}
function ta(a){DumpError(a);throw a;}
function p(a,b){var c=a.toString();while(c.length<b){c="0"+c}return c}
var ea=[undefined,31,undefined,31,30,31,30,31,31,30,31,30,31];function H(a,b){if(2!==b){return ea[b]}var c=a<<4;var d=ea[c];if(!d){d=Math.round((Date.UTC(a,2,1)-Date.UTC(a,1,1))/86400000);ea[c]=d}return d}
var ua=new Object;function Ka(a,b){var c=a<<4|b;var d=ua[c];if(!d){d=(new Date(a,b-1,1,0,0,0,0)).getDay();ua[c]=d}return d}
function fa(a){return(a.date-1+Ka(a.year,a.month))%7}
function ra(a,b,c,d,e,f){var h;if(a===d){if((h=b-e)===0){return c-f}else if(h<0){h=c-f;do{h-=H(a,b++)}while(b<e);return h}else{h=c-f;do{h+=H(d,e++)}while(e<b);return h}}else{return Math.round((Date.UTC(a,b-1,c)-Date.UTC(d,e-1,f))/86400000)}}
function sa(a,b){return ra(a.year,a.month,a.date,b.year,b.month,b.date)}
function y(a,b,c,d,e,f){if(!isNaN(a)){this.year=a}if(!isNaN(b)){this.month=b}if(!isNaN(c)){this.date=c}if(!isNaN(d)){this.hour=d}if(!isNaN(e)){this.minute=e}if(!isNaN(f)){this.second=f}}
y.prototype.year=NaN;y.prototype.month=NaN;y.prototype.date=NaN;y.prototype.hour=NaN;y.prototype.minute=NaN;y.prototype.second=NaN;y.prototype.Ya=function(){return fa(this)}
;y.prototype.toString=function(){if(this.l!==undefined)return this.l;this.l=this.D();return this.l}
;function K(){}
K.prototype=new y;K.prototype.constructor=K;function j(a,b,c){y.call(this,a,b,c,NaN,NaN,NaN)}
j.prototype=new K;j.prototype.constructor=j;j.now=function(){var a=new Date;return j.create(a.getFullYear(),a.getMonth()+1,a.getDate())}
;j.prototype.type="Date";j.prototype.i=function(){return this}
;j.prototype.P=function(){return new t(this.year,this.month,this.date,0,0,0)}
;j.prototype.a=function(){if(undefined===this.e){this.e=j.wa(this.year,this.month,this.date)}return this.e}
;j.wa=function(a,b,c){return this.e=(((a-1970)*12+b<<5)+c)*86400}
;j.prototype.da=function(){return true}
;j.prototype.D=function(){return p(this.year,4)+p(this.month,2)+p(this.date,2)}
;j.prototype.equals=function(a){return this.constructor===a.constructor&&this.date===a.date&&this.month===a.month&&this.year===a.year}
;j.V={};j.Ra=0;j.Ma=200;j.create=function(a,b,c){var d=j.wa(a,b,c);if(d in j.V){return j.V[d]}else{var e=new j(a,b,c);e.e=d;if(j.Ra<j.Ma){j.V[d]=e}return e}}
;function t(a,b,c,d,e,f){y.call(this,a,b,c,d,e,f)}
t.prototype=new K;t.prototype.constructor=t;t.now=function(){var a=new Date;return new t(a.getFullYear(),a.getMonth()+1,a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds())}
;t.prototype.type="DateTime";t.prototype.i=function(){return j.create(this.year,this.month,this.date)}
;t.prototype.P=function(){return this}
;t.prototype.La=function(){return new F(this.hour,this.minute,this.second)}
;t.prototype.a=function(){if(undefined===this.e){this.e=(((((this.year-1970)*12+this.month<<5)+this.date)*24+this.hour)*60+this.minute)*60+this.second}return this.e}
;t.prototype.da=function(){return true}
;t.prototype.D=function(){return p(this.year,4)+p(this.month,2)+p(this.date,2)+"T"+p(this.hour,2)+p(this.minute,2)+p(this.second,2)}
;t.prototype.equals=function(a){return this.constructor===a.constructor&&this.date===a.date&&this.month===a.month&&this.year===a.year&&this.hour===a.hour&&this.minute===a.minute&&this.second===a.second}
;t.prototype.clone=function(){var a=new t(this.year,this.month,this.date,this.hour,this.minute,this.second);if(this.l!==undefined)a.l=this.l;return a}
;function F(a,b,c){y.call(this,NaN,NaN,NaN,a,b,c)}
F.prototype=new y;F.prototype.constructor=F;F.prototype.type="Time";F.prototype.La=function(){return this}
;F.prototype.D=function(){return"T"+p(this.hour,2)+p(this.minute,2)+p(this.second,2)}
;F.prototype.equals=function(a){return this.constructor===a.constructor&&this.hour===a.hour&&this.minute===a.minute&&this.second===a.second}
;F.prototype.a=function(){return(this.hour*60+this.minute)*60+this.second}
;function E(a,b,c,d){var e=d+60*(c+60*(b+24*a));var f=X(e/86400);e-=f*86400;var h=X(e/3600);e-=h*3600;var l=X(e/60);e-=l*60;var n=X(e);y.call(this,NaN,NaN,f,h,l,n)}
E.prototype=new y;E.prototype.constructor=E;E.prototype.type="Duration";E.prototype.Wb=function(){return this.date}
;E.prototype.Xb=function(){return this.date*24+this.hour}
;E.prototype.Yb=function(){return 1440*this.date+this.hour*60+this.minute}
;E.prototype.Zb=function(){return this.second+this.minute*60+this.hour*3600+86400*this.date}
;E.prototype.a=function(){if(undefined===this.e){this.e=((this.date*24+this.hour)*60+this.minute)*60+this.second}return this.e}
;E.prototype.D=function(){var a=this.year?N(this.year):(this.month?N(this.month):(this.date?N(this.date):(this.hour?N(this.hour):(this.minute?N(this.minute):(this.second?N(this.second):0)))));var b=a<0?"-P":"P";if(this.year){b+=a*this.year+"Y"}if(this.month){b+=a*this.month+"N"}if(this.date){b+=this.date%7?a*this.date+"D":a*this.date/7+"W"}if(this.hour||this.minute||this.second){b+="T"}if(this.hour){b+=a*this.hour+"H"}if(this.minute){b+=a*this.minute+"M"}if(this.second){b+=a*this.second+"S"}if(!a)
{b+="0D"}return b}
;E.prototype.equals=function(a){return this.constructor===a.constructor&&this.date===a.date&&this.hour===a.hour&&this.minute===a.minute&&this.second===a.second}
;function Q(a){var b=new o;b.year=a.year||0;b.month=a.month||0;b.date=a.date||0;b.hour=a.hour||0;b.minute=a.minute||0;b.second=a.second||0;return b}
function $(a,b,c){na(!(isNaN(a)|isNaN(b)|isNaN(c)));var d=new o;d.year=a||0;d.month=b||0;d.date=c||0;return d}
function o(){}
o.prototype=new y;o.prototype.constructor=o;o.prototype.type="DTBuilder";o.prototype.year=(o.prototype.month=(o.prototype.date=(o.prototype.hour=(o.prototype.minute=(o.prototype.second=0)))));o.prototype.a=function(){this.normalize()}
;o.prototype.advance=function(a){if(a.date){this.date+=a.date}if(a.hour){this.hour+=a.hour}if(a.minute){this.minute+=a.minute}if(a.second){this.second+=a.second}}
;o.prototype.normalize=function(){this.ib();this.ia();var a=H(this.year,this.month);while(this.date<1){this.month-=1;this.ia();a=H(this.year,this.month);this.date+=a}while(this.date>a){this.date-=a;this.month+=1;this.ia();a=H(this.year,this.month)}}
;o.prototype.ib=function(){var a;if(this.second<0){a=Math.ceil(this.second/-60);this.second+=60*a;this.minute-=a}else if(this.second>=60){a=Math.floor(this.second/60);this.second-=60*a;this.minute+=a}if(this.minute<0){a=Math.ceil(this.minute/-60);this.minute+=60*a;this.hour-=a}else if(this.minute>=60){a=Math.floor(this.minute/60);this.minute-=60*a;this.hour+=a}if(this.hour<0){a=Math.ceil(this.hour/-24);this.hour+=24*a;this.date-=a}else if(this.hour>=24){a=Math.floor(this.hour/24);this.hour-=24*a;
this.date+=a}}
;o.prototype.ia=function(){var a;if(this.month<1){a=Math.ceil((this.month-1)/-12);this.month+=12*a;this.year-=a}else if(this.month>12){a=Math.floor((this.month-1)/12);this.month-=12*a;this.year+=a}}
;o.prototype.i=function(){this.normalize();return j.create(this.year,this.month,this.date)}
;o.prototype.P=function(){this.normalize();return new t(this.year,this.month,this.date,this.hour,this.minute,this.second)}
;o.prototype.Ja=function(){this.normalize();return new B(isFinite(this.year)?this.year:undefined,isFinite(this.month)?this.month:undefined,isFinite(this.date)?this.date:undefined)}
;o.prototype.Ka=function(){this.normalize();return new C(isFinite(this.year)?this.year:undefined,isFinite(this.month)?this.month:undefined,isFinite(this.date)?this.date:undefined,isFinite(this.hour)?this.hour:undefined,isFinite(this.minute)?this.minute:undefined,isFinite(this.second)?this.second:undefined)}
;o.prototype.La=function(){this.normalize();return new F(this.hour,this.minute,this.second)}
;o.prototype.rb=function(){if(this.year||this.month){ta("Can't convert months or years to ICAL_Duration");return undefined}else{return new E(this.date,this.hour,this.minute,this.second)}}
;o.prototype.sb=function(){return"number"==typeof this.year&&1+this.year%1===1&&"number"==typeof this.month&&1+this.month%1===1&&"number"==typeof this.date&&1+this.date%1===1}
;o.prototype.$b=function(){return this.sb()&&this.tb()}
;o.prototype.tb=function(){return"number"==typeof this.hour&&1+this.hour%1===1&&"number"==typeof this.minute&&1+this.minute%1===1&&"number"==typeof this.second&&1+this.second%1===1}
;o.prototype.toString=function(){return"["+(undefined!==this.year?p(this.year,4):"????")+"/"+(undefined!==this.month?p(this.month,2):"??")+"/"+(undefined!==this.date?p(this.date,2):"??")+" "+(undefined!==this.hour?p(this.hour,2):"??")+" "+(undefined!==this.minute?p(this.minute,2):"??")+" "+(undefined!==this.second?p(this.second,2):"??")+"]"}
;o.prototype.equals=function(a){return this.constructor===a.constructor&&this.date===a.date&&this.month===a.month&&this.year===a.year&&this.hour===a.hour&&this.minute===a.minute&&this.second===a.second}
;function M(a,b){this.start=a;if(b.constructor==E){var c=Q(a);c.advance(b);this.end=this.start instanceof t?c.P():c.i()}else{this.end=b}this.duration=pa(this.end,this.start)}
M.prototype.type="PeriodOfTime";M.prototype.toString=function(){if(this.l!==undefined)return this.l;this.l=this.start+"/"+this.end;return this.l}
;M.prototype.equals=function(a){return this.constructor===a.constructor&&this.start.equals(a.start)&&this.end.equals(a.end)}
;M.prototype.overlaps=function(a){return a.end.a()>this.start.a()&&a.start.a()<this.end.a()}
;M.prototype.Kb=function(a,b){return b.a()>this.start.a()&&a.a()<this.end.a()}
;M.prototype.contains=function(a){return this.start.a()<=a.start.a()&&this.end.a()>=a.end.a()}
;function da(a,b){this.start=a;this.end=b;try{this.duration=pa(this.end,this.start)}catch(c){this.duration=null}}
da.prototype.type="PartialPeriodOfTime";da.prototype.D=function(){return this.start+"/"+this.end}
;da.prototype.equals=function(a){return this.constructor===a.constructor&&this.start.equals(a.start)&&this.end.equals(a.end)}
;function pa(a,b){if(isNaN(a.year)!=isNaN(b.year)||isNaN(a.hour)!=isNaN(b.hour)){ta("diff("+a+", "+b+")");return undefined}var c=Q(a);if(isNaN(a.year)){c.hour-=b.hour;c.minute-=b.minute;c.second-=b.second}else{c.year=NaN;c.month=NaN;c.date=ra(a.year,a.month,a.date,b.year,b.month,b.date);if(!isNaN(a.hour)){c.hour-=b.hour;c.minute-=b.minute;c.second-=b.second}}return c.rb()}
function B(a,b,c){this.year=a;this.month=b;this.date=c}
B.prototype=new K;B.prototype.constructor=B;B.prototype.type="PartialDate";B.prototype.i=function(){return j.create(this.year||0,this.month||1,this.date||1)}
;B.prototype.P=function(){return new t(this.year||0,this.month||1,this.date||1,0,0,0)}
;B.prototype.Ja=function(){return this}
;B.prototype.Ka=function(){return new C(this.year,this.month,this.date,0,0,0)}
;B.prototype.da=function(){return!isNaN(this.a())}
;B.prototype.a=function(){if(undefined===this.e){this.e=(((this.year-1970)*12+this.month<<5)+this.date)*86400}return this.e}
;B.prototype.equals=function(a){return this.constructor===a.constructor&&(this.date===a.date||isNaN(this.date)&&isNaN(a.date))&&(this.month===a.month||isNaN(this.month)&&isNaN(a.month))&&(this.year===a.year||isNaN(this.year)&&isNaN(a.year))}
;B.prototype.D=function(){return(undefined!==this.year?p(this.year,4):"????")+(undefined!==this.month?p(this.month,2):"??")+(undefined!==this.date?p(this.date,2):"??")}
;function C(a,b,c,d,e,f){this.year=a;this.month=b;this.date=c;this.hour=d;this.minute=e;this.second=f}
C.prototype=new K;C.prototype.constructor=C;C.prototype.type="PartialDateTime";C.prototype.i=function(){return j.create(this.year||0,this.month||1,this.date||1)}
;C.prototype.P=function(){return new t(this.year||0,this.month||1,this.date||1,this.hour||0,this.minute||0,this.second||0)}
;C.prototype.Ja=function(){return new B(this.year,this.month,this.date)}
;C.prototype.Ka=function(){return this}
;C.prototype.da=function(){return!isNaN(this.a())}
;C.prototype.a=function(){if(undefined===this.e){this.e=(((((this.year-1970)*12+this.month<<5)+this.date)*24+this.hour)*60+this.minute)*60+this.second}return this.e}
;C.prototype.equals=function(a){return this.constructor===a.constructor&&(this.date===a.date||isNaN(this.date)&&isNaN(a.date))&&(this.month===a.month||isNaN(this.month)&&isNaN(a.month))&&(this.year===a.year||isNaN(this.year)&&isNaN(a.year))&&(this.hour===a.hour||isNaN(this.hour)&&isNaN(a.hour))&&(this.minute===a.minute||isNaN(this.minute)&&isNaN(a.minute))&&(this.second===a.second||isNaN(this.second)&&isNaN(a.second))}
;C.prototype.D=function(){return(undefined!==this.year?p(this.year,4):"????")+(undefined!==this.month?p(this.month,2):"??")+(undefined!==this.date?p(this.date,2):"??")+"T"+(undefined!==this.hour?p(this.hour,2):"??")+(undefined!==this.minute?p(this.minute,2):"??")+(undefined!==this.second?p(this.second,2):"??")}
;var S=undefined;var va=[];function qa(a,b,c){var d=b>2&&29===H(a,2);return qa.Na[b]+d+c-1}
qa.Na=[undefined,0,31,59,90,120,151,181,212,243,273,304,334];function Da(){var a=new Date;var b=S;S=j.create(a.getFullYear(),a.getMonth()+1,a.getDate());if(b&&!b.equals(S)){for(var c=0;c<va.length;++c){var d=va[c];try{d(S)}catch(e){}}}var f=new Date(a.getFullYear(),a.getMonth(),a.getDate(),0,0,0,0);f.setDate(f.getDate()+1);var h=f.getTime()-a.getTime();if(h<0||h>=1800000){h=1800000}setTimeout(Da,h)}
Da();function P(a,b,c){this.x=a;this.y=b;this.coordinateFrame=c}
P.prototype.toString=function(){return"[P "+this.x+","+this.y+"]"}
;P.prototype.clone=function(){return new P(this.x,this.y,this.coordinateFrame)}
;function Ia(a,b){this.dx=a;this.dy=b}
Ia.prototype.toString=function(){return"[D "+this.dx+","+this.dy+"]"}
;function L(a,b,c,d,e){this.x=a;this.y=b;this.w=c;this.h=d;this.coordinateFrame=e}
L.prototype.contains=function(a){return this.x<=a.x&&a.x<this.x+this.w&&this.y<=a.y&&a.y<this.y+this.h}
;L.prototype.toString=function(){return"[R "+this.w+"x"+this.h+"+"+this.x+"+"+this.y+"]"}
;L.prototype.clone=function(){return new L(this.x,this.y,this.w,this.h,this.coordinateFrame)}
;function Ua(a){var b=a.ownerDocument;if(W&&b){var c=b.getBoxObjectFor(a);return new L(c.x,c.y,c.width,c.height,window)}var d=0;var e=0;for(var f=a;f.offsetParent;f=f.offsetParent){d+=f.offsetLeft;e+=f.offsetTop}return new L(d,e,a.offsetWidth,a.offsetHeight,window)}
function Va(a){var b=a.ownerDocument;if(W&&b){var c=b.getBoxObjectFor(a);return c.height}else{return a.offsetHeight}}
function Xa(a){var b=a.ownerDocument;if(W&&b){var c=b.getBoxObjectFor(a);return c.width}else{return a.offsetWidth}}
function Wa(a){var b=a.ownerDocument;if(W&&b){var c=b.getBoxObjectFor(a);return new P(c.x,c.y,window)}var d=0;var e=0;while(a.offsetParent){d+=a.offsetLeft;e+=a.offsetTop;a=a.offsetParent}return new P(d,e,window)}
function Ja(a){var b=0;var c=0;if(a.pageX||a.pageY){b=a.pageX;c=a.pageY}else if(a.clientX||a.clientY){b=a.clientX+document.body.scrollLeft;c=a.clientY+document.body.scrollTop}return new P(b,c,window)}
function g(a,b,c,d,e){this.Q=a;this.g=c?c:this.Q.id+"_";this.c=d?d:"DP_";this.Qa();g.K[this.g]=this;if(e){this.j=e}else{this.j=j.now()}this.r=j.create(this.j.year,this.j.month,1);this.L=0;this.Ua=!(!b);this.T=false;this.Fa=null;this.Ea=null;this.J={};this.t={};this.F={};this.b={};this.n=null;this.N=null;this.ka=new J(this);this.ga=new J(this);this.pa=false;this.G=false;this.f=new G;this.ya=false;this.A=0;this.E=null;this.X=null;this.na=true;this.ja=null;this.W=null;this.ha=null;this.p();this.qa=false;
this.pb(0);this.Ga(0);this.ba=false;this.o=null;this.d=null;this.m=null;this.I=null;this.H=null;this.Ca=null;this.M=false;this.ta=null;this.sa=null;var f=this;var h=function(l){var n=l.startDate;var k=l.endDate;var q;if(!n){q=R[this.O]}else if(!k||n.equals(k)){q="Selected: "+f.$(n,true)}else{q="Selected: "+f.$(n)+" - "+f.$(k)}f.jb(q)}
;if(this.pa)this.ua(h);this.fa=new J(this)}
;g.prototype.Qa=function(){var a=this.c+"day_top ",b=this.c+"day_left ",c=this.c+"day_right ",d=this.c+"onmonth ",e=this.c+"onmonth ",f=this.c+"month_top ",h=this.c+"month_left ",l=this.c+"weekend ",n=this.c+"weekday ",k=this.c+"weekend_selected ",q=this.c+"weekday_selected ";var s={};s[0]="";s[1]=a;s[3]=a+b;s[5]=a+c;s[2]=b;s[4]=c;var u={};for(var i in s){u[i|16|256]=s[i]+d+l;u[i|16|512]=s[i]+d+n;u[i|32|256]=s[i]+e+l;u[i|32|512]=s[i]+e+n;u[i|16|1024]=s[i]+d+k;u[i|16|2048]=s[i]+d+q;u[i|32|1024]=s[
i]+e+k;u[i|32|2048]=s[i]+e+q}var v={};for(var i in u){v[i]=u[i];v[i|64]=u[i]+f;v[i|64|128]=u[i]+f+h}this._classMap=v}
;var R={};R[0]="Select a date";R[1]="Select a range of dates";R[2]="Select dates";R[3]=" ";g.prototype.Ga=function(a,b){if(a!=0&&a!=1&&a!=7&&a!=30&&a!=-1&&!(b instanceof Function)){throw new Error("Invalid click mode: "+a);}this.Ta=a;this.xa=b}
;g.prototype.Hb=function(){return this.T}
;g.prototype.qb=function(a){if(a!=this.T){this.T=a;this.p()}}
;g.prototype.Wa=function(){return this.Ta}
;g.prototype.pb=function(a){if(this.O==a){return}this.O=a;this.u()}
;g.prototype.aa=function(){return this.O}
;g.prototype.show=function(){this.G=true;this.p()}
;g.prototype.hide=function(){this.Q.innerHTML="";this.G=false}
;g.prototype.gb=function(){return this.G}
;g.prototype.Cb=function(a){return this.t[a.id]}
;g.prototype.Eb=function(a){return this.F[a.id]}
;g.prototype.Xa=function(a){return this.b[a.id]}
;g.prototype.Fb=function(){return z(this.g+"tbl")}
;g.prototype.mb=function(a){this.L=a;this.p()}
;g.prototype.Aa=function(){return this.L}
;g.prototype.Pb=function(a){this.E=a;this.p();return true}
;g.prototype.lb=function(a){this.X=a}
;g.prototype.yb=function(){return this.E}
;g.prototype.Ab=function(){return this.n}
;g.prototype.$a=function(){if(!this.G)return null;return this.b[this.n.id]}
;g.prototype.ab=function(){if(!this.G)return null;var a=z(this.g+"day_"+(this.A-1)+"_6");return this.b[a.id]}
;g.prototype.Ub=function(a){if(a!=this.na){this.na=a;this.p()}}
;g.prototype.ob=function(a){this.ja=a}
;g.prototype.Ob=function(a){this.W=a}
;g.prototype.nb=function(a){this.ha=a}
;g.prototype.bb=function(){return Z}
;g.prototype.Bb=function(){return aa}
;g.prototype.p=function(){if(!this.G){return}var a=this.g;var b;var c=this.r.month;var d=this.r.year;var e=oa.length;var f=[c==1?12:c-1,c,c==12?1:c+1];var h=j.create(this.j.year,this.j.month,1);var l=$(d,c-1,1).i();var n=$(d,c+1,1).i();if(this.ja){f[0]=this.ja(l)}else{var k=l.a()>=h.a()?"«":"‹ ";f[0]=k+Z[f[0]]}if(this.W){f[1]=this.W(this.r)}else{f[1]=aa[f[1]]+" "+d}if(this.ha){f[2]=this.ha(n)}else{var q=n.a()-h.a()<=0?"»":" ›";f[2]=Z[f[2]]+q}var s=H(d,c);var u=
H(l.year,l.month);var i=new Array(49);var v=this.r.Ya()-this.L;if(v<0)v+=7;if(s<30||v<5)v+=7;for(var r=0;r<v;++r){i[r]=j.create(l.year,l.month,u-v+r+1)}for(var r=v,m=0;m<s;++r){i[r]=j.create(d,c,++m)}var A=v+s;for(var r=A,m=0;r<i.length;++r){i[r]=j.create(n.year,n.month,++m)}this.ta=i[0];this.sa=i[i.length-1];var D=new Array;var O=this.Ua?[2,3,2]:[1,5,1];D.push('<table cols=7 cellspacing="0" cellpadding="3" id="',a,'tbl"',' class="',this.c,'monthtable" ',' style="-moz-user-select:none; cursor:pointer;">'
,'<tr class="',this.c,'heading" id="',a,'header">',"<td colspan=",O[0]," unselectable=on",' onmousedown="'+ba(Ha)+"(",ma(this.g),')"',' id="',a,'mhl" class="',this.c,'prev">',f[0],"</td>","<td colspan=",O[1],' unselectable="on"',' id="',a,'mhc" class="',this.c,'cur">',f[1],"</td>","<td colspan=",O[2],' unselectable="on"',' onmousedown="'+ba(Ga)+"(",ma(this.g),')"',' id="',a,'mhr" class="',this.c,'next">',f[2],"</td>","</tr>");if(this.T){D.push('<tr class="',this.c,'days" id="',a,'dow">');for(var r=
0;r<e;++r){D.push('<td unselectable="on"',' class="',this.c,'dayh" id="',a,"day_",r,'">',oa[(r+this.L)%7],"</td>")}D.push("</tr>")}var T=(7-this.L)%7;var La=(T+6)%7;this.J={};var b=null;var w=null;var Ma=ba(Fa);var wa;var w;var ga=null;if(this.X){ga=this.X.call(null,this.ta,this.sa)}for(var r=0,m=-1;r<7;++r){D.push('<tr id="',a,"week_",r,'">');for(var I=0;I<e;++I){++m;var ha=this.f.contains(i[m]);w=0;if(r==0)w|=1;if(I==0)w|=2;else if(I==6)w|=4;w|=I==T||I==La?(ha?1024:256):(ha?2048:512);if(m<v||m>=
A){w|=32;if(i[m].date<=7){w|=64;if(i[m].date==1&&I!=0){w|=128}}w=this._classMap[w]}else{w|=16;if(i[m].date<=7){w|=64;if(i[m].date==1&&I!=0){w|=128}}if(i[m].date==this.j.date&&c==this.j.month&&d==this.j.year){w=this._classMap[w]+(this.c+"today"+(ha?"_selected ":" "))}else{w=this._classMap[w]}}D.push('<td id="',a,"day_",r,"_",I,'"',' class="',w,'"');if(ga&&(wa=ga[i[m]])){D.push(' style="',wa,'"')}D.push(' onclick="',Ma,'(this)"',' unselectable="on">',i[m].date,"</td>")}D.push("</tr>")}if(this.pa){D.push(
'<tr class="',this.c,'months">','<td colspan="7" id="',a,'sel"></td></tr>')}D.push("</table>");this.Q.innerHTML=D.join("");this.n=z(a+"day_0_0");this.N=z(a+"day_6_6");var b=this.n;var U=b.parentNode;var ia=null;var xa=null;var m=-1;var ja=-1;while(U!=null){++ja;if(ja==7)break;var ya=-1;while(b!=null){++m;++ya;var ka=a+"day_"+ja+"_"+ya;this.b[ka]=i[m];this.J[i[m].toString()]=b;this.F[ka]=ia;if(ia)this.t[xa]=b;ia=b;xa=ka;b=b.nextSibling}U=U.nextSibling;if(U!=null){b=U.firstChild}}this.A=7;if(!this.na)
{var Na=z(a+"week_4");var za=z(a+"week_5");var la=z(a+"week_6");if(this.b[a+"day_4_0"].month!=c){Na.style.display="none";za.style.display="none";la.style.display="none";this.A=4}else if(this.b[a+"day_5_0"].month!=c){za.style.display="none";la.style.display="none";this.A=5}else if(this.b[a+"day_6_0"].month!=c){la.style.display="none";this.A=6}}this.Fa=l;this.Ea=n;if(this.E){this.E.call(null,this)}this.Oa()}
;g.prototype.refresh=function(){if(this.E){this.E.call(null,this)}}
;g.prototype.ua=function(a){return this.ka.add(a)}
;g.prototype.Nb=function(a){return this.ka.remove(a)}
;g.prototype.u=function(a){a=arguments.length===0||a;var b=this.f.U();for(var c=0;c<b.length;++c){var d=this.J[b[c].toString()];this.C(d,false)}this.f.clear();if(!this.M){this.Ha(null);this.la(null)}if(a)this.z()}
;g.prototype.Jb=function(a){return this.f.contains(a)}
;g.prototype.Sa=function(a){if(this.xa){this.xa.call(null,a);return}var b=z(a);var c=this.f;switch(this.O){case 1:var d=this.Wa();if(d==0)break;if(d!=1&&(d!=-1||!c.contains(this.b[a]))){var e=this.b[b.id];var f;switch(d){case -1:if(c.s()>7&&this.R()){var h=b.id.substr(b.id.length-3,1);e=this.b[this.g+"day_"+h+"_0"]}f=c.s()-1;break;case 7:var h=b.id.substr(b.id.length-3,1);e=this.b[this.g+"day_"+h+"_0"];f=6;break;case 30:e=this.b[b.id];e=j.create(e.year,e.month,1);var l=Q(e);f=H(e.year,e.month)-1;
break;default:}var l=Q(e);l.date+=f;var n=l.i();this.ma(e,n);return}na(d==1||d==-1&&c.contains(this.b[a]),"not a case for single date selection");this.u(false);case 0:if(c.s()>0){var k=c.U()[0];c.remove(k);var q=this.J[k.toString()];if(q)this.C(q,false)}c.add(this.b[b.id]);this.C(b);this.z(this.b[b.id]);break;case 2:break;case 3:default:break}}
;g.prototype.Ha=function(a){this.d=a;this.I=a?this.b[a.id]:null}
;g.prototype.la=function(a){this.m=a;this.H=a?this.b[a.id]:null}
;g.prototype.fb=function(){return this.M}
;g.prototype.Vb=function(a,b){this.u(false);this.M=true;this.Ha(this.Y(a));var c=this.b[this.d.id];this.f.add(c);this.C(this.d);this.ma(c);this.la(this.d)}
;g.prototype.xb=function(a,b,c){this.M=false;this.m=this.Y(a);if(this.R()){this.z(this.I,this.H,false);return}var d,e;if(this.b[this.m.id].a()<this.b[this.d.id].a()){d=this.b[this.m.id];e=this.b[this.d.id]}else{d=this.b[this.d.id];e=this.b[this.m.id]}this.z(d,e,false)}
;g.prototype.Ib=function(a,b,c,d){this.Ca=Ea(a);if(this.O!=1||this.ba)return;this.ba=true;var e=this;setTimeout(function(){try{if(e.M){e.Va.call(e,b,c,d)}}finally{e.ba=false}}
,50)}
;g.prototype.Sb=function(a){if(this.qa==a)return;this.qa=!(!a);this.u()}
;g.prototype.R=function(){return this.qa}
;g.prototype.Va=function(a,b,c){var d=this.Ca;var e=this.Y(d);if(e===this.m)return;var f=this.m;this.la(e);var h=this.b;var l=h[f.id].a()<h[e.id].a();var n=h[f.id].a()<h[this.d.id].a();var k=h[e.id].a()<h[this.d.id].a();var q=h[this.d.id].a()<h[e.id].a();var s=h[this.d.id].a()<h[f.id].a();var u,i;var v,r;var m=k?this.m:this.d;var A=k?this.d:this.m;if(this.R()){var D=sa(h[A.id],h[m.id]);if(D>=7){var O,T;O=parseInt(m.id.charAt(m.id.length-3),10);T=parseInt(A.id.charAt(A.id.length-3),10);m=z(this.g+
"day_"+O+"_0");A=z(this.g+"day_"+T+"_6")}this.B(this.n,m,false);this.B(A,this.N,false);this.B(m,A,true);this.I=h[m.id];this.H=h[A.id]}else{if(l){if(n){i=k?this.F[e.id]:this.F[this.d.id];this.B(f,i,false)}if(q){u=s?this.t[f.id]:this.t[this.d.id];this.B(u,e,true)}}else{if(s){u=q?this.t[e.id]:this.t[this.d.id];this.B(u,f,false)}if(k){i=k?this.F[this.d.id]:this.F[f.id];this.B(e,i,true)}}}v=h[m.id];r=h[A.id];this.z(v,r,true)}
;g.prototype.B=function(a,b,c){var d=false;while(a){if(c){d=this.f.add(this.b[a.id])}else{d=this.f.remove(this.b[a.id])}if(d){this.C(a,c)}if(a.id===b.id)break;a=this.t[a.id]}}
;g.LAST_DAY_OF_WEEK={4:"day_3_6",5:"day_4_6",6:"day_5_6",7:"day_6_6"};g.prototype.Rb=function(a){if(a){this.o={};this.o.x=a.x;this.o.y=a.y}else{this.o=null}}
;g.prototype.Pa=function(a,b){if(!this.o)return;if(b){a.x-=this.o.x;a.y-=this.o.y}else{a.x+=this.o.x;a.y+=this.o.y}}
;g.prototype.Y=function(a){var b=Xa(this.n);var c=Va(this.n);var d=this.db();var e=Ja(a);this.Pa(e);var f=7;var h=this.za(d.x,b,f,e.x);var l=this.za(d.y,c,this.A,e.y);return z(this.g+"day_"+l+"_"+h)}
;g.prototype.za=function(a,b,c,d){if(d<a)return 0;var e=Math.floor((d-a)/b);return e>=c?c-1:e}
;g.prototype.db=function(){var a=this.g;var b=this.A;var c=Wa(this.n);var d=Ua(z(a+g.LAST_DAY_OF_WEEK[b]));return new L(c.x,c.y,d.x+d.w-c.x,d.y+d.h-c.y,c.coordinateFrame)}
;g.prototype.$=function(a,b){var c=b?aa:Z;return c[a.month]+" "+a.date}
;g.prototype.z=function(a,b,c){var d={};d.startDate=a;d.endDate=b||a;d.fb=!(!c);d.mode=this.aa();this.ka.Z(d)}
;g.prototype.Gb=function(){return this.j}
;g.prototype.Tb=function(a){if(a.equals(this.j))return;this.j=a;this.p()}
;g.prototype.va=function(a){if(a instanceof j)return a;if(a instanceof t){return j.create(a.year,a.month,a.date)}}
;g.prototype.Qb=function(a){this.ya=!(!a)}
;g.prototype.ma=function(a,b,c){var d=this.aa();c=c!==false;if(a)a=this.va(a);if(b)b=this.va(b);if(a)this.Ia(a);if(!a||d==3){this.u(c);return}if(d==0){this.u(false);var e=this.J[a.toString()];this.f.add(a);this.C(e);if(c)this.z(a)}else if(d==1){if(!b)b=a;var f=sa(b,a);var h=false;if(this.R()&&f>=7){var l=fa(a)+7;var n=fa(b)+7;l=(l-this.Aa())%7;n=(n-this.Aa())%7;var k;k=$(a.year,a.month,a.date-l);a=k.i();k=$(b.year,b.month,b.date+(6-n));b=k.i();h=this.Ia(a)}if(h){this.u(false)}var e=this.n;this.I=
a;this.H=b;var q=this.N;var s=a.a();var u=b.a();var i=new G;for(;e;e=this.t[e.id]){var v=this.b[e.id];var r=this.f.contains(v);var m=v.a()>=s&&v.a()<=u;if(r!=m){this.C(e,m)}if(m){i.add(v)}}this.f=i;if(this.b[q.id].a()<u){q=this.N;var k=Q(this.b[this.N.id]);var A=null;do{k.date+=1;A=k.i();this.f.add(A)}while(!A.equals(b))}if(c)this.z(a,b)}}
;g.prototype.oa=function(a,b,c){if(this.r.month==a.month&&this.r.year==a.year&&!c)return false;b=arguments.length==1||b;this.r=j.create(a.year,a.month,1);this.p();if(b)this.ga.Z();return true}
;g.prototype.Za=function(){return this.r}
;g.prototype.Ia=function(a,b){if(a.a()>=this.ta.a()&&a.a()<=this.sa.a()){return false}return this.oa(a,b)}
;g.prototype.cb=function(){switch(this.aa()){case 0:if(this.f.s()){return this.f.U()[0]}else{return null}case 1:var a=this.I?this.I:null;var b=this.H?this.H:null;if(!a||!b)return null;return[a,b];case 2:return null;case 3:default:return null}}
;g.prototype.Db=function(){return this.f.s()}
;g.prototype.jb=function(a){if(this.pa){z(this.g+"sel").innerHTML=a}}
;g.prototype.C=function(a,b){if(this.ya||!a)return;if(!(typeof b!="undefined"))b=true;var c=[];var d=[];var e=" "+a.className+" ";var f=" "+this.c;if(b){if(-1!=e.indexOf(f+"today ")){c.push(f+"today ");d.push(f+"today_selected ")}if(-1!=e.indexOf(f+"weekday ")){c.push(f+"weekday ");d.push(f+"weekday_selected ")}else if(-1!=e.indexOf(f+"weekend ")){c.push(f+"weekend ");d.push(f+"weekend_selected ")}}else{if(-1!=e.indexOf(f+"today_selected ")){d.push(f+"today ");c.push(f+"today_selected ")}if(-1!=e.indexOf(
f+"weekday_selected ")){d.push(f+"weekday ");c.push(f+"weekday_selected ")}else if(-1!=e.indexOf(f+"weekend_selected ")){d.push(f+"weekend ");c.push(f+"weekend_selected ")}}for(var h=0;h<c.length;++h){e=e.replace(c[h],d[h])}if(c.length!=0){a.className=e}}
;g.prototype.wb=function(a){this.ga.add(a)}
;g.prototype.Mb=function(a){this.ga.remove(a)}
;g.K=new Object;g.prototype.ub=function(){return this.g}
;g.staticGetPickerById=function(a){return g.K[a]}
;function Ha(a){var b=g.K[a];return b.oa(b.Fa)}
function Ga(a){var b=g.K[a];return b.oa(b.Ea)}
function Fa(a){var b=a.id;var c=b.match(/(.*)day_\d+_\d+/);var d=g.K[c[1]];return d.Sa(b)}
g.prototype.Oa=function(){if(this.hb===true)return;this.hb=true}
;g.prototype.vb=function(a){return this.fa.add(a)}
;g.prototype.Lb=function(a){return this.fa.remove(a)}
;g.prototype.log=function(){this.fa.Z(arguments)}
;g.prototype.zb=function(){return this.Q}
;function G(){this.q={};this.S=0}
G.prototype.s=function(){return this.S}
;G.prototype.add=function(a){var b=this.ra(a);if(b in this.q)return false;this.q[b]=a.i();++this.S;return true}
;G.prototype.remove=function(a){var b=this.ra(a);if(!(b in this.q))return false;delete this.q[b];--this.S;return true}
;G.prototype.clear=function(a){this.q={};this.S=0}
;G.prototype.contains=function(a){var b=this.ra(a);return b in this.q}
;G.prototype.U=function(){var a=new Array(this.s());var b=-1;for(var c in this.q)a[++b]=this.q[c];return a}
;G.prototype.ra=function(a){return a.toString().substr(0,9)}
;function J(a){this.kb=a;this.k=[]}
J.prototype.add=function(a){if(!a)return false;for(var b=0;b<this.k.length;++b){if(a===this.k[b])return false}this.k.push(a);return true}
;J.prototype.remove=function(a){if(!a)return false;for(var b=0;b<this.k.length;++b){if(a===this.k[b]){this.k.splice(b,1);return true}}return false}
;J.prototype.Z=function(){for(var a=0;a<this.k.length;++a){this.k[a].apply(this.kb,arguments)}}
;J.prototype.s=function(){return this.k.length}
;J.prototype.iterator=function(){return new V(this)}
;function V(a){this.ea=a;this.ca=0;this.v=null}
V.prototype.eb=function(){return this.ca<this.ea.s()}
;V.prototype.next=function(){if(this.eb()){this.v=this.ea.k[this.ca++]}else{this.v=null}return this.v}
;V.prototype.current=function(){return this.v}
;V.prototype.remove=function(){if(!this.v)throw new Error("no current element!");this.ea.remove(this.v);this.v=null;--this.ca}
;var x=null;function _InitializeDatePicker(a,b,c,d,e){var f=z(a);x=new g(f,false);x.qb(true);x.ob(function(){return"«"}
);x.nb(function(){return"»"}
);x.lb(b);x.Ga(1,c);x.mb(d["Sunday"]);x.ua(e);z("pickerContainer").style.display="";x.show()}
function _DatePickerSetSelection(a){x.ma(a)}
function _DatePickerGetSelection(){return x.cb()}
function _DatePickerGetDateForCell(a){return x.Xa(a)}
function _DatePickerGetMonths(){return x.bb()}
function _DatePickerGetFirstDate(){return x.$a()}
function _DatePickerGetLastDate(){return x.ab()}
function _DatePickerPopulateHtml(){return x.p()}
function _DatePickerIsVisible(){return x.gb()}
function _DatePickerGetDisplayedMonth(){return x.Za()}
function _ICAL_Date_create(a,b,c){return j.create(a,b,c)}
function _ICAL_ToDate(a){return a.i()}
function _ICAL_GetComparable(a){return a.a()}
var _ICAL_DateTime=t;var _forid=z;var _ICAL_todaysDate=S;var _ical_builderCopy=Q;var _ToJSString=ma;