sugar-rails 1.3.1 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sugar/rails/version.rb +2 -2
- data/vendor/assets/javascripts/precompiled/development/array.js +8 -65
- data/vendor/assets/javascripts/precompiled/development/core.js +1 -1
- data/vendor/assets/javascripts/precompiled/development/date.js +3 -0
- data/vendor/assets/javascripts/precompiled/development/es5.js +87 -49
- data/vendor/assets/javascripts/precompiled/minified/array.js +1 -1
- data/vendor/assets/javascripts/precompiled/minified/core.js +2 -2
- data/vendor/assets/javascripts/precompiled/minified/date.js +11 -11
- data/vendor/assets/javascripts/precompiled/minified/es5.js +2 -2
- data/vendor/assets/javascripts/sugar-development.js +100 -116
- data/vendor/assets/javascripts/sugar-full.js +17 -17
- data/vendor/assets/javascripts/sugar.js +17 -17
- metadata +4 -4
data/lib/sugar/rails/version.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
} else if(isRegExp(match) && isString(el)) {
|
17
17
|
// Match against a regexp
|
18
18
|
return regexp(match).test(el);
|
19
|
-
} else if(isFunction(match)) {
|
19
|
+
} else if(isFunction(match) && !isFunction(el)) {
|
20
20
|
// Match against a filtering function
|
21
21
|
return match.apply(scope, params);
|
22
22
|
} else if(isObject(match) && isObjectPrimitive(el)) {
|
@@ -263,63 +263,6 @@
|
|
263
263
|
|
264
264
|
|
265
265
|
|
266
|
-
/***
|
267
|
-
* @method every(<f>, [scope])
|
268
|
-
* @returns Boolean
|
269
|
-
* @short Returns true if all elements in the array match <f>.
|
270
|
-
* @extra [scope] is the %this% object. In addition to providing this method for browsers that don't support it natively, this enhanced method also directly accepts strings, numbers, deep objects, and arrays for <f>. %all% is provided an alias.
|
271
|
-
* @example
|
272
|
-
*
|
273
|
-
+ ['a','a','a'].every(function(n) {
|
274
|
-
* return n == 'a';
|
275
|
-
* });
|
276
|
-
* ['a','a','a'].every('a') -> true
|
277
|
-
* [{a:2},{a:2}].every({a:2}) -> true
|
278
|
-
*
|
279
|
-
***
|
280
|
-
* @method some(<f>, [scope])
|
281
|
-
* @returns Boolean
|
282
|
-
* @short Returns true if any element in the array matches <f>.
|
283
|
-
* @extra [scope] is the %this% object. In addition to providing this method for browsers that don't support it natively, this enhanced method also directly accepts strings, numbers, deep objects, and arrays for <f>. %any% is provided as aliases.
|
284
|
-
* @example
|
285
|
-
*
|
286
|
-
+ ['a','b','c'].some(function(n) {
|
287
|
-
* return n == 'a';
|
288
|
-
* });
|
289
|
-
+ ['a','b','c'].some(function(n) {
|
290
|
-
* return n == 'd';
|
291
|
-
* });
|
292
|
-
* ['a','b','c'].some('a') -> true
|
293
|
-
* [{a:2},{b:5}].some({a:2}) -> true
|
294
|
-
*
|
295
|
-
***
|
296
|
-
* @method map(<map>, [scope])
|
297
|
-
* @returns Array
|
298
|
-
* @short Maps the array to another array containing the values that are the result of calling <map> on each element.
|
299
|
-
* @extra [scope] is the %this% object. In addition to providing this method for browsers that don't support it natively, this enhanced method also directly accepts a string, which is a shortcut for a function that gets that property (or invokes a function) on each element.
|
300
|
-
* @example
|
301
|
-
*
|
302
|
-
+ [1,2,3].map(function(n) {
|
303
|
-
* return n * 3;
|
304
|
-
* }); -> [3,6,9]
|
305
|
-
* ['one','two','three'].map(function(n) {
|
306
|
-
* return n.length;
|
307
|
-
* }); -> [3,3,5]
|
308
|
-
* ['one','two','three'].map('length') -> [3,3,5]
|
309
|
-
*
|
310
|
-
***
|
311
|
-
* @method filter(<f>, [scope])
|
312
|
-
* @returns Array
|
313
|
-
* @short Returns any elements in the array that match <f>.
|
314
|
-
* @extra [scope] is the %this% object. In addition to providing this method for browsers that don't support it natively, this enhanced method also directly accepts strings, numbers, deep objects, and arrays for <f>.
|
315
|
-
* @example
|
316
|
-
*
|
317
|
-
+ [1,2,3].filter(function(n) {
|
318
|
-
* return n > 1;
|
319
|
-
* });
|
320
|
-
* [1,2,2,4].filter(2) -> 2
|
321
|
-
*
|
322
|
-
***/
|
323
266
|
function buildEnhancements() {
|
324
267
|
var callbackCheck = function() { var a = arguments; return a.length > 0 && !isFunction(a[0]); };
|
325
268
|
extendSimilar(array, true, callbackCheck, 'map,every,all,some,any,none,filter', function(methods, name) {
|
@@ -390,7 +333,7 @@
|
|
390
333
|
* @method find(<f>, [index] = 0, [loop] = false)
|
391
334
|
* @returns Mixed
|
392
335
|
* @short Returns the first element that matches <f>.
|
393
|
-
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex. Starts at [index], and will continue once from index = 0 if [loop] is true.
|
336
|
+
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex. Starts at [index], and will continue once from index = 0 if [loop] is true. This method implements @array_matching.
|
394
337
|
* @example
|
395
338
|
*
|
396
339
|
+ [{a:1,b:2},{a:1,b:3},{a:1,b:4}].find(function(n) {
|
@@ -407,7 +350,7 @@
|
|
407
350
|
* @method findAll(<f>, [index] = 0, [loop] = false)
|
408
351
|
* @returns Array
|
409
352
|
* @short Returns all elements that match <f>.
|
410
|
-
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex. Starts at [index], and will continue once from index = 0 if [loop] is true.
|
353
|
+
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex. Starts at [index], and will continue once from index = 0 if [loop] is true. This method implements @array_matching.
|
411
354
|
* @example
|
412
355
|
*
|
413
356
|
+ [{a:1,b:2},{a:1,b:3},{a:2,b:4}].findAll(function(n) {
|
@@ -431,7 +374,7 @@
|
|
431
374
|
* @method findIndex(<f>, [startIndex] = 0, [loop] = false)
|
432
375
|
* @returns Number
|
433
376
|
* @short Returns the index of the first element that matches <f> or -1 if not found.
|
434
|
-
* @extra This method has a few notable differences to native %indexOf%. Although <f> will similarly match a primitive such as a string or number, it will also match deep objects and arrays that are not equal by reference (%===%). Additionally, if a function is passed it will be run as a matching function (similar to the behavior of %Array#filter%) rather than attempting to find that function itself by reference in the array.
|
377
|
+
* @extra This method has a few notable differences to native %indexOf%. Although <f> will similarly match a primitive such as a string or number, it will also match deep objects and arrays that are not equal by reference (%===%). Additionally, if a function is passed it will be run as a matching function (similar to the behavior of %Array#filter%) rather than attempting to find that function itself by reference in the array. Starts at [index], and will continue once from index = 0 if [loop] is true. This method implements @array_matching.
|
435
378
|
* @example
|
436
379
|
*
|
437
380
|
+ [1,2,3,4].findIndex(3); -> 2
|
@@ -450,7 +393,7 @@
|
|
450
393
|
* @method count(<f>)
|
451
394
|
* @returns Number
|
452
395
|
* @short Counts all elements in the array that match <f>.
|
453
|
-
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex.
|
396
|
+
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex. This method implements @array_matching.
|
454
397
|
* @example
|
455
398
|
*
|
456
399
|
* [1,2,3,1].count(1) -> 2
|
@@ -504,7 +447,7 @@
|
|
504
447
|
* @method exclude([f1], [f2], ...)
|
505
448
|
* @returns Array
|
506
449
|
* @short Removes any element in the array that matches [f1], [f2], etc.
|
507
|
-
* @extra This is a non-destructive alias for %remove%. It will not change the original array.
|
450
|
+
* @extra This is a non-destructive alias for %remove%. It will not change the original array. This method implements @array_matching.
|
508
451
|
* @example
|
509
452
|
*
|
510
453
|
* [1,2,3].exclude(3) -> [1,2]
|
@@ -1013,7 +956,7 @@
|
|
1013
956
|
* @method remove([f1], [f2], ...)
|
1014
957
|
* @returns Array
|
1015
958
|
* @short Removes any element in the array that matches [f1], [f2], etc.
|
1016
|
-
* @extra Will match a string, number, array, object, or alternately test against a function or regex. This method will change the array! Use %exclude% for a non-destructive alias.
|
959
|
+
* @extra Will match a string, number, array, object, or alternately test against a function or regex. This method will change the array! Use %exclude% for a non-destructive alias. This method implements @array_matching.
|
1017
960
|
* @example
|
1018
961
|
*
|
1019
962
|
* [1,2,3].remove(3) -> [1,2]
|
@@ -1094,7 +1037,7 @@
|
|
1094
1037
|
* @method none(<f>)
|
1095
1038
|
* @returns Boolean
|
1096
1039
|
* @short Returns true if none of the elements in the array match <f>.
|
1097
|
-
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex.
|
1040
|
+
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex. This method implements @array_matching.
|
1098
1041
|
* @example
|
1099
1042
|
*
|
1100
1043
|
* [1,2,3].none(5) -> true
|
@@ -125,8 +125,19 @@
|
|
125
125
|
|
126
126
|
extend(array, true, false, {
|
127
127
|
|
128
|
-
|
129
|
-
|
128
|
+
/***
|
129
|
+
* @method every(<f>, [scope])
|
130
|
+
* @returns Boolean
|
131
|
+
* @short Returns true if all elements in the array match <f>.
|
132
|
+
* @extra [scope] is the %this% object. %all% is provided an alias. In addition to providing this method for browsers that don't support it natively, this method also implements @array_matching.
|
133
|
+
* @example
|
134
|
+
*
|
135
|
+
+ ['a','a','a'].every(function(n) {
|
136
|
+
* return n == 'a';
|
137
|
+
* });
|
138
|
+
* ['a','a','a'].every('a') -> true
|
139
|
+
* [{a:2},{a:2}].every({a:2}) -> true
|
140
|
+
***/
|
130
141
|
'every': function(fn, scope) {
|
131
142
|
var length = this.length, index = 0;
|
132
143
|
checkFirstArgumentExists(arguments);
|
@@ -139,8 +150,22 @@
|
|
139
150
|
return true;
|
140
151
|
},
|
141
152
|
|
142
|
-
|
143
|
-
|
153
|
+
/***
|
154
|
+
* @method some(<f>, [scope])
|
155
|
+
* @returns Boolean
|
156
|
+
* @short Returns true if any element in the array matches <f>.
|
157
|
+
* @extra [scope] is the %this% object. %any% is provided as an alias. In addition to providing this method for browsers that don't support it natively, this method also implements @array_matching.
|
158
|
+
* @example
|
159
|
+
*
|
160
|
+
+ ['a','b','c'].some(function(n) {
|
161
|
+
* return n == 'a';
|
162
|
+
* });
|
163
|
+
+ ['a','b','c'].some(function(n) {
|
164
|
+
* return n == 'd';
|
165
|
+
* });
|
166
|
+
* ['a','b','c'].some('a') -> true
|
167
|
+
* [{a:2},{b:5}].some({a:2}) -> true
|
168
|
+
***/
|
144
169
|
'some': function(fn, scope) {
|
145
170
|
var length = this.length, index = 0;
|
146
171
|
checkFirstArgumentExists(arguments);
|
@@ -153,8 +178,21 @@
|
|
153
178
|
return false;
|
154
179
|
},
|
155
180
|
|
156
|
-
|
157
|
-
|
181
|
+
/***
|
182
|
+
* @method map(<map>, [scope])
|
183
|
+
* @returns Array
|
184
|
+
* @short Maps the array to another array containing the values that are the result of calling <map> on each element.
|
185
|
+
* @extra [scope] is the %this% object. In addition to providing this method for browsers that don't support it natively, this enhanced method also directly accepts a string, which is a shortcut for a function that gets that property (or invokes a function) on each element.
|
186
|
+
* @example
|
187
|
+
*
|
188
|
+
+ [1,2,3].map(function(n) {
|
189
|
+
* return n * 3;
|
190
|
+
* }); -> [3,6,9]
|
191
|
+
* ['one','two','three'].map(function(n) {
|
192
|
+
* return n.length;
|
193
|
+
* }); -> [3,3,5]
|
194
|
+
* ['one','two','three'].map('length') -> [3,3,5]
|
195
|
+
***/
|
158
196
|
'map': function(fn, scope) {
|
159
197
|
var length = this.length, index = 0, result = new Array(length);
|
160
198
|
checkFirstArgumentExists(arguments);
|
@@ -167,8 +205,19 @@
|
|
167
205
|
return result;
|
168
206
|
},
|
169
207
|
|
170
|
-
|
171
|
-
|
208
|
+
/***
|
209
|
+
* @method filter(<f>, [scope])
|
210
|
+
* @returns Array
|
211
|
+
* @short Returns any elements in the array that match <f>.
|
212
|
+
* @extra [scope] is the %this% object. In addition to providing this method for browsers that don't support it natively, this method also implements @array_matching.
|
213
|
+
* @example
|
214
|
+
*
|
215
|
+
+ [1,2,3].filter(function(n) {
|
216
|
+
* return n > 1;
|
217
|
+
* });
|
218
|
+
* [1,2,2,4].filter(2) -> 2
|
219
|
+
*
|
220
|
+
***/
|
172
221
|
'filter': function(fn, scope) {
|
173
222
|
var length = this.length, index = 0, result = [];
|
174
223
|
checkFirstArgumentExists(arguments);
|
@@ -333,49 +382,39 @@
|
|
333
382
|
***/
|
334
383
|
|
335
384
|
|
336
|
-
|
337
|
-
var support = false;
|
338
|
-
if(Function.prototype.bind) {
|
339
|
-
function F() {};
|
340
|
-
var B = F.bind();
|
341
|
-
support = (new B instanceof B) && !(new F instanceof B);
|
342
|
-
}
|
343
|
-
extend(Function, true, !support, {
|
385
|
+
extend(Function, true, false, {
|
344
386
|
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
}
|
368
|
-
bound = function() {
|
369
|
-
return fn.apply(fn.prototype && this instanceof fn ? this : scope, args.concat(multiArgs(arguments)));
|
370
|
-
}
|
371
|
-
nop = function() {};
|
372
|
-
nop.prototype = this.prototype;
|
373
|
-
bound.prototype = new nop();
|
374
|
-
return bound;
|
387
|
+
/***
|
388
|
+
* @method bind(<scope>, [arg1], ...)
|
389
|
+
* @returns Function
|
390
|
+
* @short Binds <scope> as the %this% object for the function when it is called. Also allows currying an unlimited number of parameters.
|
391
|
+
* @extra "currying" means setting parameters ([arg1], [arg2], etc.) ahead of time so that they are passed when the function is called later. If you pass additional parameters when the function is actually called, they will be added will be added to the end of the curried parameters. This method is provided for browsers that don't support it internally.
|
392
|
+
* @example
|
393
|
+
*
|
394
|
+
+ (function() {
|
395
|
+
* return this;
|
396
|
+
* }).bind('woof')(); -> returns 'woof'; function is bound with 'woof' as the this object.
|
397
|
+
* (function(a) {
|
398
|
+
* return a;
|
399
|
+
* }).bind(1, 2)(); -> returns 2; function is bound with 1 as the this object and 2 curried as the first parameter
|
400
|
+
* (function(a, b) {
|
401
|
+
* return a + b;
|
402
|
+
* }).bind(1, 2)(3); -> returns 5; function is bound with 1 as the this object, 2 curied as the first parameter and 3 passed as the second when calling the function
|
403
|
+
*
|
404
|
+
***/
|
405
|
+
'bind': function(scope) {
|
406
|
+
var fn = this, args = multiArgs(arguments).slice(1), nop, bound;
|
407
|
+
if(!isFunction(this)) {
|
408
|
+
throw new TypeError('Function.prototype.bind called on a non-function');
|
375
409
|
}
|
410
|
+
bound = function() {
|
411
|
+
return fn.apply(fn.prototype && this instanceof fn ? this : scope, args.concat(multiArgs(arguments)));
|
412
|
+
}
|
413
|
+
bound.prototype = this.prototype;
|
414
|
+
return bound;
|
415
|
+
}
|
376
416
|
|
377
|
-
|
378
|
-
}
|
417
|
+
});
|
379
418
|
|
380
419
|
/***
|
381
420
|
* Date module
|
@@ -438,6 +477,5 @@
|
|
438
477
|
|
439
478
|
// Initialize
|
440
479
|
buildTrim();
|
441
|
-
buildBind();
|
442
480
|
buildISOString();
|
443
481
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
function Aa(a,b,c,d){var e=k;if(a===b)return k;else if(E(b)&&D(a))return q(b).test(a);else if(A(b))return b.apply(c,d);else if(L(b)&&la(a)){H(b,function(f){Aa(a[f],b[f],c,[a[f],a])||(e=m)});return e}else return ta(a)&&ta(b)?sa(a)===sa(b):a===b}function T(a,b,c,d){return K(b)?a:A(b)?b.apply(c,d||[]):A(a[b])?a[b].call(a):a[b]}
|
1
|
+
function Aa(a,b,c,d){var e=k;if(a===b)return k;else if(E(b)&&D(a))return q(b).test(a);else if(A(b)&&!A(a))return b.apply(c,d);else if(L(b)&&la(a)){H(b,function(f){Aa(a[f],b[f],c,[a[f],a])||(e=m)});return e}else return ta(a)&&ta(b)?sa(a)===sa(b):a===b}function T(a,b,c,d){return K(b)?a:A(b)?b.apply(c,d||[]):A(a[b])?a[b].call(a):a[b]}
|
2
2
|
function U(a,b,c,d){var e,f;if(c<0)c=a.length+c;f=isNaN(c)?0:c;for(c=d===k?a.length+f:a.length;f<c;){e=f%a.length;if(e in a){if(b.call(a,a[e],e,a)===m)break}else return Ba(a,b,f,d);f++}}function Ba(a,b,c){var d=[],e;for(e in a)e in a&&e>>>0==e&&e!=4294967295&&e>=c&&d.push(parseInt(e));d.sort().each(function(f){return b.call(a,a[f],f,a)});return a}function Ca(a,b,c,d,e){var f,g;U(a,function(j,i,h){if(Aa(j,b,h,[j,i,h])){f=j;g=i;return m}},c,d);return e?g:f}
|
3
3
|
function Ea(a,b){var c=[],d={},e;U(a,function(f,g){e=b?T(f,b,a,[f,g,a]):f;Fa(d,e)||c.push(f)});return c}function Ga(a,b,c){var d=[],e={};b.each(function(f){Fa(e,f)});a.each(function(f){var g=sa(f),j=!ta(f);if(Ha(e,g,f,j)!=c){var i=0;if(j)for(g=e[g];i<g.length;)if(g[i]===f)g.splice(i,1);else i+=1;else delete e[g];d.push(f)}});return d}function Ia(a,b,c){b=b||Infinity;c=c||0;var d=[];U(a,function(e){if(fa(e)&&c<b)d=d.concat(Ia(e,b,c+1));else d.push(e)});return d}
|
4
4
|
function Ja(a){var b=[];G(a,function(c){b=b.concat(c)});return b}function Ha(a,b,c,d){var e=b in a;if(d){a[b]||(a[b]=[]);e=a[b].indexOf(c)!==-1}return e}function Fa(a,b){var c=sa(b),d=!ta(b),e=Ha(a,c,b,d);if(d)a[c].push(b);else a[c]=b;return e}function Ka(a,b,c,d){var e,f=[],g=c==="max",j=c==="min",i=Array.isArray(a);H(a,function(h){var n=a[h];h=T(n,b,a,i?[n,parseInt(h),a]:[]);if(h===e)f.push(n);else if(K(e)||g&&h>e||j&&h<e){f=[n];e=h}});i||(f=Ia(f,1));return d?f:f[0]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
var k=true,l=null,m=false;function aa(a){return function(){return a}}var o=Object,p=Array,q=RegExp,s=Date,t=String,u=Number,v=Math,ba=typeof global!=="undefined"?global:this,ea=o.defineProperty&&o.defineProperties,w="Array,Boolean,Date,Function,Number,String,RegExp".split(","),fa=x(w[0]),ga=x(w[1]),ha=x(w[2]),A=x(w[3]),B=x(w[4]),D=x(w[5]),E=x(w[6]);function x(a){return function(b){return o.prototype.toString.call(b)==="[object "+a+"]"}}
|
2
|
-
function ia(a){if(!a.SugarMethods){ja(a,"SugarMethods",{});F(a,m,m,{restore:function(){var b=arguments.length===0,c=G(arguments);H(a.SugarMethods,function(d,e){if(b||c.indexOf(d)>-1)ja(e.
|
3
|
-
function I(a,b,c,d,e){var f={};d=D(d)?d.split(","):d;d.forEach(function(g,j){e(f,g,j)});F(a,b,c,f)}function ka(a,b,c){return function(){return a&&(c===k||!c.apply(this,arguments))?a.apply(this,arguments):b.apply(this,arguments)}}function ja(a,b,c){if(ea)o.defineProperty(a,b,{value:c,configurable:k,enumerable:m,writable:k});else a[b]=c}function G(a,b){var c=[],d
|
2
|
+
function ia(a){if(!a.SugarMethods){ja(a,"SugarMethods",{});F(a,m,m,{restore:function(){var b=arguments.length===0,c=G(arguments);H(a.SugarMethods,function(d,e){if(b||c.indexOf(d)>-1)ja(e.va?a.prototype:a,d,e.method)})},extend:function(b,c,d){F(a,d!==m,c,b)}})}}function F(a,b,c,d){var e=b?a.prototype:a,f;ia(a);H(d,function(g,j){f=e[g];if(typeof c==="function")j=ka(e[g],j,c);if(c!==m||!e[g])ja(e,g,j);a.SugarMethods[g]={va:b,method:j,Da:f}})}
|
3
|
+
function I(a,b,c,d,e){var f={};d=D(d)?d.split(","):d;d.forEach(function(g,j){e(f,g,j)});F(a,b,c,f)}function ka(a,b,c){return function(){return a&&(c===k||!c.apply(this,arguments))?a.apply(this,arguments):b.apply(this,arguments)}}function ja(a,b,c){if(ea)o.defineProperty(a,b,{value:c,configurable:k,enumerable:m,writable:k});else a[b]=c}function G(a,b){var c=[],d;for(d=0;d<a.length;d++){c.push(a[d]);b&&b.call(a,a[d],d)}return c}function J(a){return a!==void 0}function K(a){return a===void 0}
|
4
4
|
function la(a){return a&&typeof a==="object"}function L(a){return!!a&&o.prototype.toString.call(a)==="[object Object]"&&"hasOwnProperty"in a}function ma(a,b){return o.hasOwnProperty.call(a,b)}function H(a,b){for(var c in a)if(ma(a,c))if(b.call(a,c,a[c])===m)break}function na(a,b){H(b,function(c){a[c]=b[c]});return a}function M(a){na(this,a)}M.prototype.constructor=o;function N(a,b,c,d){var e=[];a=parseInt(a);for(var f=d<0;!f&&a<=b||f&&a>=b;){e.push(a);c&&c.call(this,a);a+=d||1}return e}
|
5
5
|
function O(a,b,c){c=v[c||"round"];var d=v.pow(10,v.abs(b||0));if(b<0)d=1/d;return c(a*d)/d}function P(a,b){return O(a,b,"floor")}function R(a,b,c,d){d=v.abs(a).toString(d||10);d=oa(b-d.replace(/\.\d+/,"").length,"0")+d;if(c||a<0)d=(a<0?"-":"+")+d;return d}function pa(a){if(a>=11&&a<=13)return"th";else switch(a%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}
|
6
6
|
function qa(){return"\t\n\u000b\u000c\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u2028\u2029\u3000\ufeff"}function oa(a,b){return p(v.max(0,J(a)?a:1)+1).join(b||"")}function ra(a,b){var c=a.toString().match(/[^/]*$/)[0];if(b)c=(c+b).split("").sort().join("").replace(/([gimy])\1+/g,"$1");return c}function S(a){D(a)||(a=t(a));return a.replace(/([\\/'*+?|()\[\]{}.^$])/g,"\\$1")}
|
@@ -2,23 +2,23 @@ var V,Ua,Va=["ampm","hour","minute","second","ampm","utc","offset_sign","offset_
|
|
2
2
|
{ba:"hh?|hours|12hr",format:function(a){a=W(a,"Hours");return a===0?12:a-P(a/13)*12}},{ba:"HH?|24hr",format:function(a){return W(a,"Hours")}},{ba:"dd?|date|day",format:function(a){return W(a,"Date")}},{ba:"dow|weekday",la:k,format:function(a,b,c){a=W(a,"Day");return b.weekdays[a+(c-1)*7]}},{ba:"MM?",format:function(a){return W(a,"Month")+1}},{ba:"mon|month",la:k,format:function(a,b,c){a=W(a,"Month");return b.months[a+(c-1)*12]}},{ba:"y{2,4}|year",format:function(a){return W(a,"FullYear")}},{ba:"[Tt]{1,2}",
|
3
3
|
format:function(a,b,c,d){a=W(a,"Hours");b=b.ampm[P(a/12)];if(d.length===1)b=b.slice(0,1);if(d.slice(0,1)==="T")b=b.toUpperCase();return b}},{ba:"z{1,4}|tz|timezone",text:k,format:function(a,b,c,d){a=a.getUTCOffset();if(d=="z"||d=="zz")a=a.replace(/(\d{2})(\d{2})/,function(e,f){return R(f,d.length)});return a}},{ba:"iso(tz|timezone)",format:function(a){return a.getUTCOffset(k)}},{ba:"ord",format:function(a){a=W(a,"Date");return a+pa(a)}}],cb=[{$:"year",method:"FullYear",ja:k,da:function(a){return(365+
|
4
4
|
(a?a.isLeapYear()?1:0:0.25))*24*60*60*1E3}},{$:"month",method:"Month",ja:k,da:function(a,b){var c=30.4375,d;if(a){d=a.daysInMonth();if(b<=d.days())c=d}return c*24*60*60*1E3}},{$:"week",method:"Week",da:aa(6048E5)},{$:"day",method:"Date",ja:k,da:aa(864E5)},{$:"hour",method:"Hours",da:aa(36E5)},{$:"minute",method:"Minutes",da:aa(6E4)},{$:"second",method:"Seconds",da:aa(1E3)},{$:"millisecond",method:"Milliseconds",da:aa(1)}],db={};function eb(a){na(this,a);this.ga=ab.concat()}
|
5
|
-
eb.prototype={getMonth:function(a){return B(a)?a-1:this.months.indexOf(a)%12},getWeekday:function(a){return this.weekdays.indexOf(a)%7},oa:function(a){var b;return B(a)?a:a&&(b=this.numbers.indexOf(a))!==-1?(b+1)%10:1},
|
6
|
-
return a==="en"||a==="en-US"?k:this.variant},
|
7
|
-
function(i,h){switch(h){case "num":return c;case "unit":return g;case "sign":return f.src}})},
|
5
|
+
eb.prototype={getMonth:function(a){return B(a)?a-1:this.months.indexOf(a)%12},getWeekday:function(a){return this.weekdays.indexOf(a)%7},oa:function(a){var b;return B(a)?a:a&&(b=this.numbers.indexOf(a))!==-1?(b+1)%10:1},ta:function(a){var b=this;return a.replace(q(this.num,"g"),function(c){return b.oa(c)||""})},ra:function(a){return V.units[this.units.indexOf(a)%8]},Aa:function(a){return this.na(a,a[2]>0?"future":"past")},qa:function(a){return this.na(fb(a),"duration")},ua:function(a){a=a||this.code;
|
6
|
+
return a==="en"||a==="en-US"?k:this.variant},xa:function(a){return a===this.ampm[0]},ya:function(a){return a===this.ampm[1]},na:function(a,b){var c=a[0],d=a[1],e=a[2],f,g,j;if(this.code=="ru"){j=c.toString().slice(-1);switch(k){case j==1:j=1;break;case j>=2&&j<=4:j=2;break;default:j=3}}else j=this.plural&&c>1?1:0;g=this.units[j*8+d]||this.units[d];if(this.capitalizeUnit)g=gb(g);f=this.modifiers.filter(function(i){return i.name=="sign"&&i.value==(e>0?1:-1)})[0];return this[b].replace(/\{(.*?)\}/g,
|
7
|
+
function(i,h){switch(h){case "num":return c;case "unit":return g;case "sign":return f.src}})},sa:function(){return this.ma?[this.ma].concat(this.ga):this.ga},addFormat:function(a,b,c,d,e){var f=c||[],g=this,j;a=a.replace(/\s+/g,"[-,. ]*");a=a.replace(/\{([^,]+?)\}/g,function(i,h){var n=h.match(/\?$/),r=h.match(/(\d)(?:-(\d))?/),y=h.match(/^\d+$/),z=h.replace(/[^a-z]+$/,""),C,ca;if(y)C=g.optionals[y[0]];else if(g[z])C=g[z];else if(g[z+"s"]){C=g[z+"s"];if(r){ca=[];C.forEach(function(da,Da){var Q=Da%
|
8
8
|
(g.units?8:C.length);if(Q>=r[1]&&Q<=(r[2]||r[1]))ca.push(da)});C=ca}C=hb(C)}if(y)return"(?:"+C+")?";else{c||f.push(z);return"("+C+")"+(n?"?":"")}});if(b){b=ib(Wa,g,e);e=["t","[\\s\\u3000]"].concat(g.timeMarker);j=a.match(/\\d\{\d,\d\}\)+\??$/);jb(g,"(?:"+b+")[,\\s\\u3000]+?"+a,Va.concat(f),d);jb(g,a+"(?:[,\\s]*(?:"+e.join("|")+(j?"+":"*")+")"+b+")?",f.concat(Va),d)}else jb(g,a,f,d)}};
|
9
9
|
function kb(a,b){var c;D(a)||(a="");c=db[a]||db[a.slice(0,2)];if(b===m&&!c)throw Error("Invalid locale.");return c||Ua}
|
10
10
|
function lb(a,b){function c(i){var h=g[i];if(D(h))g[i]=h.split(",");else h||(g[i]=[])}function d(i,h){i=i.split("+").map(function(n){return n.replace(/(.+):(.+)$/,function(r,y,z){return z.split("|").map(function(C){return y+C}).join("|")})}).join("|");return i.split("|").forEach(h)}function e(i,h,n){var r=[];g[i].forEach(function(y,z){if(h)y+="+"+y.slice(0,3);d(y,function(C,ca){r[ca*n+z]=C.toLowerCase()})});g[i]=r}function f(i,h,n){i="\\d{"+i+","+h+"}";if(n)i+="|(?:"+hb(g.numbers)+")+";return i}var g,
|
11
11
|
j;g=new eb(b);c("modifiers");"months,weekdays,units,numbers,articles,optionals,timeMarker,ampm,timeSuffixes,dateParse,timeParse".split(",").forEach(c);j=!g.monthSuffix;e("months",j,12);e("weekdays",j,7);e("units",m,8);e("numbers",m,10);g.code=a;g.date=f(1,2,g.digitDate);g.year=f(4,4);g.num=function(){var i=["\\d+"].concat(g.articles);if(g.numbers)i=i.concat(g.numbers);return hb(i)}();(function(){var i=[];g.ha={};g.modifiers.forEach(function(h){var n=h.name;d(h.src,function(r){var y=g[n];g.ha[r]=h;
|
12
12
|
i.push({name:n,src:r,value:h.value});g[n]=y?y+"|"+r:r})});g.day+="|"+hb(g.weekdays);g.modifiers=i})();if(g.monthSuffix){g.month=f(1,2);g.months=N(1,12).map(function(i){return i+g.monthSuffix})}g.full_month=f(1,2)+"|"+hb(g.months);g.timeSuffixes.length>0&&g.addFormat(ib(Wa,g),m,Va);g.addFormat("{day}",k);g.addFormat("{month}"+(g.monthSuffix||""));g.addFormat("{year}"+(g.yearSuffix||""));g.timeParse.forEach(function(i){g.addFormat(i,k)});g.dateParse.forEach(function(i){g.addFormat(i)});return db[a]=
|
13
|
-
g}function jb(a,b,c,d){a.ga.unshift({
|
14
|
-
function nb(a,b){var c={};if(match=a.match(/^(\d+)?\s?(\w+?)s?$/i)){if(K(b))b=parseInt(match[1])||1;c[match[2].toLowerCase()]=b}return c}function ob(a,b){var c={},d,e;b.forEach(function(f,g){d=a[g+1];if(!(K(d)||d==="")){if(f==="year")c.
|
13
|
+
g}function jb(a,b,c,d){a.ga.unshift({Ba:d,wa:a,za:q("^"+b+"$","i"),to:c})}function gb(a){return a.slice(0,1).toUpperCase()+a.slice(1)}function hb(a){return a.filter(function(b){return!!b}).join("|")}function mb(a,b){var c;if(L(a[0]))return a;else if(B(a[0])&&!B(a[1]))return[a[0]];else if(D(a[0])&&b)return[nb(a[0]),a[1]];c={};Za.forEach(function(d,e){c[d.$]=a[e]});return[c]}
|
14
|
+
function nb(a,b){var c={};if(match=a.match(/^(\d+)?\s?(\w+?)s?$/i)){if(K(b))b=parseInt(match[1])||1;c[match[2].toLowerCase()]=b}return c}function ob(a,b){var c={},d,e;b.forEach(function(f,g){d=a[g+1];if(!(K(d)||d==="")){if(f==="year")c.Ca=d;e=parseFloat(d.replace(/,/,"."));c[f]=!isNaN(e)?e:d.toLowerCase()}});return c}function pb(a){a=a.trim().replace(/^(just )?now|\.+$/i,"");return qb(a)}
|
15
15
|
function qb(a){return a.replace(Ya,function(b,c,d){var e=0,f=1,g,j;if(c)return b;d.split("").reverse().forEach(function(i){i=Xa[i];var h=i>9;if(h){if(g)e+=f;f*=i/(j||1);j=i}else{if(g===m)f*=10;e+=f*i}g=h});if(g)e+=f;return e})}
|
16
|
-
function rb(a,b,c,d){var e=new s,f=m,g,j,i,h,n,r,y,z,C;e.utc(d);if(ha(a))e=a.clone();else if(B(a))e=new s(a);else if(L(a)){e.set(a,k);h=a}else if(D(a)){g=kb(b);a=pb(a);g&&H(g.
|
17
|
-
j.getMonth(h.month);if(h.shift&&!h.unit)h.unit=j.units[7]}if(h.weekday&&h.date)delete h.weekday;else if(h.weekday){h.weekday=j.getWeekday(h.weekday);if(h.shift&&!h.unit)h.unit=j.units[5]}if(h.day&&(z=j.ha[h.day])){h.day=z.value;e.reset();f=k}else if(h.day&&(r=j.getWeekday(h.day))>-1){delete h.day;if(h.num&&h.month){C=function(){var Q=e.getWeekday();e.setWeekday(7*(h.num-1)+(Q>r?r+7:r))};h.day=1}else h.weekday=r}if(h.date&&!B(h.date))h.date=j.
|
18
|
-
h.hour===12)h.hour=0;if("offset_hours"in h||"offset_minutes"in h){e.utc();h.offset_minutes=h.offset_minutes||0;h.offset_minutes+=h.offset_hours*60;if(h.offset_sign==="-")h.offset_minutes*=-1;h.minute-=h.offset_minutes}if(h.unit){f=k;y=j.oa(h.num);n=j.
|
16
|
+
function rb(a,b,c,d){var e=new s,f=m,g,j,i,h,n,r,y,z,C;e.utc(d);if(ha(a))e=a.clone();else if(B(a))e=new s(a);else if(L(a)){e.set(a,k);h=a}else if(D(a)){g=kb(b);a=pb(a);g&&H(g.sa(),function(ca,da){var Da=a.match(da.za);if(Da){i=da;j=i.wa;h=ob(Da,i.to,j);h.utc&&e.utc();j.ma=i;if(h.timestamp){h=h.timestamp;return m}if(i.Ba&&!D(h.month)&&(D(h.date)||g.ua(b))){z=h.month;h.month=h.date;h.date=z}if(h.year&&h.Ca.length===2)h.year=O(W(new s,"FullYear")/100)*100-O(h.year/100)*100+h.year;if(h.month){h.month=
|
17
|
+
j.getMonth(h.month);if(h.shift&&!h.unit)h.unit=j.units[7]}if(h.weekday&&h.date)delete h.weekday;else if(h.weekday){h.weekday=j.getWeekday(h.weekday);if(h.shift&&!h.unit)h.unit=j.units[5]}if(h.day&&(z=j.ha[h.day])){h.day=z.value;e.reset();f=k}else if(h.day&&(r=j.getWeekday(h.day))>-1){delete h.day;if(h.num&&h.month){C=function(){var Q=e.getWeekday();e.setWeekday(7*(h.num-1)+(Q>r?r+7:r))};h.day=1}else h.weekday=r}if(h.date&&!B(h.date))h.date=j.ta(h.date);if(j.ya(h.ampm)&&h.hour<12)h.hour+=12;else if(j.xa(h.ampm)&&
|
18
|
+
h.hour===12)h.hour=0;if("offset_hours"in h||"offset_minutes"in h){e.utc();h.offset_minutes=h.offset_minutes||0;h.offset_minutes+=h.offset_hours*60;if(h.offset_sign==="-")h.offset_minutes*=-1;h.minute-=h.offset_minutes}if(h.unit){f=k;y=j.oa(h.num);n=j.ra(h.unit);if(h.shift||h.edge){y*=(z=j.ha[h.shift])?z.value:0;if(n==="month"&&J(h.date)){e.set({day:h.date},k);delete h.date}if(n==="year"&&J(h.month)){e.set({month:h.month,day:h.date},k);delete h.month;delete h.date}}if(h.sign&&(z=j.ha[h.sign]))y*=z.value;
|
19
19
|
if(J(h.weekday)){e.set({weekday:h.weekday},k);delete h.weekday}h[n]=(h[n]||0)+y}if(h.year_sign==="-")h.year*=-1;$a.slice(1,4).forEach(function(Q,Ub){var zb=h[Q.$],Ab=zb%1;if(Ab){h[$a[Ub].$]=O(Ab*(Q.$==="second"?1E3:60));h[Q.$]=P(zb)}});return m}});if(i)if(f)e.advance(h);else{e._utc&&e.reset();sb(e,h,k,m,c)}else e=a?new s(a):new s;if(h&&h.edge){z=j.ha[h.edge];H($a.slice(4),function(ca,da){if(J(h[da.$])){n=da.$;return m}});if(n==="year")h.fa="month";else if(n==="month"||n==="week")h.fa="day";e[(z.value<
|
20
|
-
0?"endOf":"beginningOf")+gb(n)]();z.value===-2&&e.reset()}C&&C()}return{ea:e,set:h}}function fb(a){var b,c=v.abs(a),d=c,e=0;$a.slice(1).forEach(function(f,g){b=P(O(c/f.da()*10)/10);if(b>=1){d=b;e=g+1}});return[d,e,a]}
|
21
|
-
function tb(a,b,c,d){var e,f=kb(d),g=q(/^[A-Z]/);if(a.isValid())if(Date[b])b=Date[b];else{if(A(b)){e=fb(a.millisecondsFromNow());b=b.apply(a,e.concat(f))}}else return"Invalid Date";if(!b&&c){e=e||fb(a.millisecondsFromNow());if(e[1]===0){e[1]=1;e[0]=1}return f.
|
20
|
+
0?"endOf":"beginningOf")+gb(n)]();z.value===-2&&e.reset()}C&&C()}d||e.utc(m);return{ea:e,set:h}}function fb(a){var b,c=v.abs(a),d=c,e=0;$a.slice(1).forEach(function(f,g){b=P(O(c/f.da()*10)/10);if(b>=1){d=b;e=g+1}});return[d,e,a]}
|
21
|
+
function tb(a,b,c,d){var e,f=kb(d),g=q(/^[A-Z]/);if(a.isValid())if(Date[b])b=Date[b];else{if(A(b)){e=fb(a.millisecondsFromNow());b=b.apply(a,e.concat(f))}}else return"Invalid Date";if(!b&&c){e=e||fb(a.millisecondsFromNow());if(e[1]===0){e[1]=1;e[0]=1}return f.Aa(e)}b=b||"long";b=f[b]||b;bb.forEach(function(j){b=b.replace(q("\\{("+j.ba+")(\\d)?\\}",j.la?"i":""),function(i,h,n){i=j.format(a,f,n||1,h);n=h.length;var r=h.match(/^(.)\1+$/);if(j.la){if(n===3)i=i.slice(0,3);if(r||h.match(g))i=gb(i)}else if(r&&
|
22
22
|
!j.text)i=(B(i)?R(i,n):i.toString()).slice(-n);return i})});return b}
|
23
23
|
function ub(a,b,c,d){var e=rb(b,l,l,d),f=0;d=b=0;var g;if(c>0){b=d=c;g=k}if(!e.ea.isValid())return m;if(e.set&&e.set.fa){cb.forEach(function(i){if(i.$===e.set.fa)f=i.da(e.ea,a-e.ea)-1});c=gb(e.set.fa);if(e.set.edge||e.set.shift)e.ea["beginningOf"+c]();if(e.set.fa==="month")j=e.ea.clone()["endOf"+c]().getTime();if(!g&&e.set.sign&&e.set.fa!="millisecond"){b=50;d=-50}}g=a.getTime();c=e.ea.getTime();var j=j||c+f;return g>=c-b&&g<=j+d}
|
24
24
|
function sb(a,b,c,d,e){function f(i){return J(b[i])?b[i]:b[i+"s"]}var g,j;if(B(b)&&d)b={milliseconds:b};else if(B(b)){a.setTime(b);return a}if(b.date)b.day=b.date;H($a,function(i,h){var n=h.$==="day";if(J(f(h.$))||n&&J(f("weekday"))){b.fa=h.$;j=+i;return m}else if(c&&h.$!=="week"&&(!n||!J(f("week"))))X(a,h.method,n?1:0)});cb.forEach(function(i){var h=i.$;i=i.method;var n;n=f(h);if(!K(n)){if(d){if(h==="week"){n=(b.day||0)+n*7;i="Date"}n=n*d+W(a,i)}else h==="month"&&J(f("day"))&&X(a,"Date",15);X(a,
|
@@ -30,7 +30,7 @@ return R(O(-b/60),2,k)+c+R(b%60,2)},utc:function(a){this._utc=a===k||arguments.l
|
|
30
30
|
0)},isBetween:function(a,b,c){var d=this.getTime();a=s.create(a).getTime();var e=s.create(b).getTime();b=v.min(a,e);a=v.max(a,e);c=c||0;return b-c<d&&a+c>d},isLeapYear:function(){var a=W(this,"FullYear");return a%4===0&&a%100!==0||a%400===0},daysInMonth:function(){return 32-W(new s(W(this,"FullYear"),W(this,"Month"),32),"Date")},format:function(a,b){return tb(this,a,m,b)},relative:function(a,b){if(D(a)){b=a;a=l}return tb(this,a,k,b)},is:function(a,b,c){var d,e;if(this.isValid()){if(D(a)){a=a.trim().toLowerCase();
|
31
31
|
e=this.clone().utc(c);switch(k){case a==="future":return this.getTime()>(new s).getTime();case a==="past":return this.getTime()<(new s).getTime();case a==="weekday":return W(e,"Day")>0&&W(e,"Day")<6;case a==="weekend":return W(e,"Day")===0||W(e,"Day")===6;case (d=V.weekdays.indexOf(a)%7)>-1:return W(e,"Day")===d;case (d=V.months.indexOf(a)%12)>-1:return W(e,"Month")===d}}return ub(this,a,b,c)}},reset:function(a){var b={},c;a=a||"hours";if(a==="date")a="days";c=cb.some(function(d){return a===d.$||
|
32
32
|
a===d.$+"s"});b[a]=a.match(/^days?/)?1:0;return c?this.set(b,k):this},clone:function(){var a=new s(this.getTime());a._utc=this._utc;return a}});s.extend({iso:function(){return this.toISOString()},getWeekday:s.prototype.getDay,getUTCWeekday:s.prototype.getUTCDay});
|
33
|
-
function wb(a,b){function c(){return O(this*b)}function d(){return vb(arguments)[a.ia](this)}function e(){return vb(arguments)[a.ia](-this)}var f=a.$,g={};g[f]=c;g[f+"s"]=c;g[f+"Before"]=e;g[f+"sBefore"]=e;g[f+"Ago"]=e;g[f+"sAgo"]=e;g[f+"After"]=d;g[f+"sAfter"]=d;g[f+"FromNow"]=d;g[f+"sFromNow"]=d;u.extend(g)}u.extend({duration:function(a){return kb(a).
|
33
|
+
function wb(a,b){function c(){return O(this*b)}function d(){return vb(arguments)[a.ia](this)}function e(){return vb(arguments)[a.ia](-this)}var f=a.$,g={};g[f]=c;g[f+"s"]=c;g[f+"Before"]=e;g[f+"sBefore"]=e;g[f+"Ago"]=e;g[f+"sAgo"]=e;g[f+"After"]=d;g[f+"sAfter"]=d;g[f+"FromNow"]=d;g[f+"sFromNow"]=d;u.extend(g)}u.extend({duration:function(a){return kb(a).qa(this)}});
|
34
34
|
V=Ua=s.addLocale("en",{plural:k,timeMarker:"at",ampm:"am,pm",months:"January,February,March,April,May,June,July,August,September,October,November,December",weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",units:"millisecond:|s,second:|s,minute:|s,hour:|s,day:|s,week:|s,month:|s,year:|s",numbers:"one,two,three,four,five,six,seven,eight,nine,ten",articles:"a,an,the",optionals:"the,st|nd|rd|th,of","short":"{Month} {d}, {yyyy}","long":"{Month} {d}, {yyyy} {h}:{mm}{tt}",full:"{Weekday} {Month} {d}, {yyyy} {h}:{mm}:{ss}{tt}",
|
35
35
|
past:"{num} {unit} {sign}",future:"{num} {unit} {sign}",duration:"{num} {unit}",modifiers:[{name:"day",src:"yesterday",value:-1},{name:"day",src:"today",value:0},{name:"day",src:"tomorrow",value:1},{name:"sign",src:"ago|before",value:-1},{name:"sign",src:"from now|after|from|in",value:1},{name:"edge",src:"last day",value:-2},{name:"edge",src:"end",value:-1},{name:"edge",src:"first day|beginning",value:1},{name:"shift",src:"last",value:-1},{name:"shift",src:"the|this",value:0},{name:"shift",src:"next",
|
36
36
|
value:1}],dateParse:["{num} {unit} {sign}","{sign} {num} {unit}","{num} {unit=4-5} {sign} {day}","{month} {year}","{shift} {unit=5-7}","{0} {edge} of {shift?} {unit=4-7?}{month?}{year?}"],timeParse:["{0} {num}{1} {day} of {month} {year?}","{weekday?} {month} {date}{1} {year?}","{date} {month} {year}","{shift} {weekday}","{shift} week {weekday}","{weekday} {2} {shift} week","{0} {date}{1} of {month}","{0}{month?} {date?}{1} of {shift} {unit=6-7}"]});$a=cb.concat().reverse();Za=cb.concat();
|
@@ -2,7 +2,7 @@ F(o,m,m,{keys:function(a){var b=[];if(!la(a)&&!E(a)&&!A(a))throw new TypeError("
|
|
2
2
|
function wa(a,b,c,d){var e=a.length,f=d==-1,g=f?e-1:0;c=isNaN(c)?g:parseInt(c>>0);if(c<0)c=e+c;if(!f&&c<0||f&&c>=e)c=g;for(;f&&c>=0||!f&&c<e;){if(a[c]===b)return c;c+=d}return-1}function xa(a,b,c,d){var e=a.length,f=0,g=J(c);ya(b);if(e==0&&!g)throw new TypeError("Reduce called on empty array with no initial value");else if(g)c=c;else{c=a[d?e-1:f];f++}for(;f<e;){g=d?e-f-1:f;if(g in a)c=b(c,a[g],g,a);f++}return c}function ya(a){if(!a||!a.call)throw new TypeError("Callback is not callable");}
|
3
3
|
function za(a){if(a.length===0)throw new TypeError("First argument must be defined");}F(p,m,m,{isArray:function(a){return fa(a)}});
|
4
4
|
F(p,k,m,{every:function(a,b){var c=this.length,d=0;for(za(arguments);d<c;){if(d in this&&!a.call(b,this[d],d,this))return m;d++}return k},some:function(a,b){var c=this.length,d=0;for(za(arguments);d<c;){if(d in this&&a.call(b,this[d],d,this))return k;d++}return m},map:function(a,b){var c=this.length,d=0,e=Array(c);for(za(arguments);d<c;){if(d in this)e[d]=a.call(b,this[d],d,this);d++}return e},filter:function(a,b){var c=this.length,d=0,e=[];for(za(arguments);d<c;){d in this&&a.call(b,this[d],d,this)&&
|
5
|
-
e.push(this[d]);d++}return e},indexOf:function(a,b){if(D(this))return this.indexOf(a,b);return wa(this,a,b,1)},lastIndexOf:function(a,b){if(D(this))return this.lastIndexOf(a,b);return wa(this,a,b,-1)},forEach:function(a,b){var c=this.length,d=0;for(ya(a);d<c;){d in this&&a.call(b,this[d],d,this);d++}},reduce:function(a,b){return xa(this,a,b)},reduceRight:function(a,b){return xa(this,a,b,k)}});
|
5
|
+
e.push(this[d]);d++}return e},indexOf:function(a,b){if(D(this))return this.indexOf(a,b);return wa(this,a,b,1)},lastIndexOf:function(a,b){if(D(this))return this.lastIndexOf(a,b);return wa(this,a,b,-1)},forEach:function(a,b){var c=this.length,d=0;for(ya(a);d<c;){d in this&&a.call(b,this[d],d,this);d++}},reduce:function(a,b){return xa(this,a,b)},reduceRight:function(a,b){return xa(this,a,b,k)}});
|
6
|
+
F(Function,k,m,{bind:function(a){var b=this,c=G(arguments).slice(1),d;if(!A(this))throw new TypeError("Function.prototype.bind called on a non-function");d=function(){return b.apply(b.prototype&&this instanceof b?this:a,c.concat(G(arguments)))};d.prototype=this.prototype;return d}});F(s,m,m,{now:function(){return(new s).getTime()}});
|
6
7
|
(function(){var a=qa().match(/^\s+$/);try{t.prototype.trim.call([1])}catch(b){a=m}F(t,k,!a,{trim:function(){return this.toString().trimLeft().trimRight()},trimLeft:function(){return this.replace(q("^["+qa()+"]+"),"")},trimRight:function(){return this.replace(q("["+qa()+"]+$"),"")}})})();
|
7
|
-
(function(){var a=m;if(Function.prototype.qa){a=function(){};var b=a.qa();a=new b instanceof b&&!(new a instanceof b)}F(Function,k,!a,{bind:function(c){var d=this,e=G(arguments).slice(1),f,g;if(!A(this))throw new TypeError("Function.prototype.bind called on a non-function");g=function(){return d.apply(d.prototype&&this instanceof d?this:c,e.concat(G(arguments)))};f=function(){};f.prototype=this.prototype;g.prototype=new f;return g}})})();
|
8
8
|
(function(){var a=new s(s.UTC(1999,11,31));a=a.toISOString&&a.toISOString()==="1999-12-31T00:00:00.000Z";I(s,k,!a,"toISOString,toJSON",function(b,c){b[c]=function(){return R(this.getUTCFullYear(),4)+"-"+R(this.getUTCMonth()+1,2)+"-"+R(this.getUTCDate(),2)+"T"+R(this.getUTCHours(),2)+":"+R(this.getUTCMinutes(),2)+":"+R(this.getUTCSeconds(),2)+"."+R(this.getUTCMilliseconds(),3)+"Z"}})})();
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Sugar Library v1.3.
|
2
|
+
* Sugar Library v1.3.3
|
3
3
|
*
|
4
4
|
* Freely distributable and licensed under the MIT-style license.
|
5
5
|
* Copyright (c) 2012 Andrew Plummer
|
@@ -120,7 +120,7 @@
|
|
120
120
|
// Argument helpers
|
121
121
|
|
122
122
|
function multiArgs(args, fn) {
|
123
|
-
var result = [], i
|
123
|
+
var result = [], i;
|
124
124
|
for(i = 0; i < args.length; i++) {
|
125
125
|
result.push(args[i]);
|
126
126
|
if(fn) fn.call(args, args[i], i);
|
@@ -488,8 +488,19 @@
|
|
488
488
|
|
489
489
|
extend(array, true, false, {
|
490
490
|
|
491
|
-
|
492
|
-
|
491
|
+
/***
|
492
|
+
* @method every(<f>, [scope])
|
493
|
+
* @returns Boolean
|
494
|
+
* @short Returns true if all elements in the array match <f>.
|
495
|
+
* @extra [scope] is the %this% object. %all% is provided an alias. In addition to providing this method for browsers that don't support it natively, this method also implements @array_matching.
|
496
|
+
* @example
|
497
|
+
*
|
498
|
+
+ ['a','a','a'].every(function(n) {
|
499
|
+
* return n == 'a';
|
500
|
+
* });
|
501
|
+
* ['a','a','a'].every('a') -> true
|
502
|
+
* [{a:2},{a:2}].every({a:2}) -> true
|
503
|
+
***/
|
493
504
|
'every': function(fn, scope) {
|
494
505
|
var length = this.length, index = 0;
|
495
506
|
checkFirstArgumentExists(arguments);
|
@@ -502,8 +513,22 @@
|
|
502
513
|
return true;
|
503
514
|
},
|
504
515
|
|
505
|
-
|
506
|
-
|
516
|
+
/***
|
517
|
+
* @method some(<f>, [scope])
|
518
|
+
* @returns Boolean
|
519
|
+
* @short Returns true if any element in the array matches <f>.
|
520
|
+
* @extra [scope] is the %this% object. %any% is provided as an alias. In addition to providing this method for browsers that don't support it natively, this method also implements @array_matching.
|
521
|
+
* @example
|
522
|
+
*
|
523
|
+
+ ['a','b','c'].some(function(n) {
|
524
|
+
* return n == 'a';
|
525
|
+
* });
|
526
|
+
+ ['a','b','c'].some(function(n) {
|
527
|
+
* return n == 'd';
|
528
|
+
* });
|
529
|
+
* ['a','b','c'].some('a') -> true
|
530
|
+
* [{a:2},{b:5}].some({a:2}) -> true
|
531
|
+
***/
|
507
532
|
'some': function(fn, scope) {
|
508
533
|
var length = this.length, index = 0;
|
509
534
|
checkFirstArgumentExists(arguments);
|
@@ -516,8 +541,21 @@
|
|
516
541
|
return false;
|
517
542
|
},
|
518
543
|
|
519
|
-
|
520
|
-
|
544
|
+
/***
|
545
|
+
* @method map(<map>, [scope])
|
546
|
+
* @returns Array
|
547
|
+
* @short Maps the array to another array containing the values that are the result of calling <map> on each element.
|
548
|
+
* @extra [scope] is the %this% object. In addition to providing this method for browsers that don't support it natively, this enhanced method also directly accepts a string, which is a shortcut for a function that gets that property (or invokes a function) on each element.
|
549
|
+
* @example
|
550
|
+
*
|
551
|
+
+ [1,2,3].map(function(n) {
|
552
|
+
* return n * 3;
|
553
|
+
* }); -> [3,6,9]
|
554
|
+
* ['one','two','three'].map(function(n) {
|
555
|
+
* return n.length;
|
556
|
+
* }); -> [3,3,5]
|
557
|
+
* ['one','two','three'].map('length') -> [3,3,5]
|
558
|
+
***/
|
521
559
|
'map': function(fn, scope) {
|
522
560
|
var length = this.length, index = 0, result = new Array(length);
|
523
561
|
checkFirstArgumentExists(arguments);
|
@@ -530,8 +568,19 @@
|
|
530
568
|
return result;
|
531
569
|
},
|
532
570
|
|
533
|
-
|
534
|
-
|
571
|
+
/***
|
572
|
+
* @method filter(<f>, [scope])
|
573
|
+
* @returns Array
|
574
|
+
* @short Returns any elements in the array that match <f>.
|
575
|
+
* @extra [scope] is the %this% object. In addition to providing this method for browsers that don't support it natively, this method also implements @array_matching.
|
576
|
+
* @example
|
577
|
+
*
|
578
|
+
+ [1,2,3].filter(function(n) {
|
579
|
+
* return n > 1;
|
580
|
+
* });
|
581
|
+
* [1,2,2,4].filter(2) -> 2
|
582
|
+
*
|
583
|
+
***/
|
535
584
|
'filter': function(fn, scope) {
|
536
585
|
var length = this.length, index = 0, result = [];
|
537
586
|
checkFirstArgumentExists(arguments);
|
@@ -696,49 +745,39 @@
|
|
696
745
|
***/
|
697
746
|
|
698
747
|
|
699
|
-
|
700
|
-
var support = false;
|
701
|
-
if(Function.prototype.bind) {
|
702
|
-
function F() {};
|
703
|
-
var B = F.bind();
|
704
|
-
support = (new B instanceof B) && !(new F instanceof B);
|
705
|
-
}
|
706
|
-
extend(Function, true, !support, {
|
748
|
+
extend(Function, true, false, {
|
707
749
|
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
}
|
734
|
-
nop = function() {};
|
735
|
-
nop.prototype = this.prototype;
|
736
|
-
bound.prototype = new nop();
|
737
|
-
return bound;
|
750
|
+
/***
|
751
|
+
* @method bind(<scope>, [arg1], ...)
|
752
|
+
* @returns Function
|
753
|
+
* @short Binds <scope> as the %this% object for the function when it is called. Also allows currying an unlimited number of parameters.
|
754
|
+
* @extra "currying" means setting parameters ([arg1], [arg2], etc.) ahead of time so that they are passed when the function is called later. If you pass additional parameters when the function is actually called, they will be added will be added to the end of the curried parameters. This method is provided for browsers that don't support it internally.
|
755
|
+
* @example
|
756
|
+
*
|
757
|
+
+ (function() {
|
758
|
+
* return this;
|
759
|
+
* }).bind('woof')(); -> returns 'woof'; function is bound with 'woof' as the this object.
|
760
|
+
* (function(a) {
|
761
|
+
* return a;
|
762
|
+
* }).bind(1, 2)(); -> returns 2; function is bound with 1 as the this object and 2 curried as the first parameter
|
763
|
+
* (function(a, b) {
|
764
|
+
* return a + b;
|
765
|
+
* }).bind(1, 2)(3); -> returns 5; function is bound with 1 as the this object, 2 curied as the first parameter and 3 passed as the second when calling the function
|
766
|
+
*
|
767
|
+
***/
|
768
|
+
'bind': function(scope) {
|
769
|
+
var fn = this, args = multiArgs(arguments).slice(1), nop, bound;
|
770
|
+
if(!isFunction(this)) {
|
771
|
+
throw new TypeError('Function.prototype.bind called on a non-function');
|
772
|
+
}
|
773
|
+
bound = function() {
|
774
|
+
return fn.apply(fn.prototype && this instanceof fn ? this : scope, args.concat(multiArgs(arguments)));
|
738
775
|
}
|
776
|
+
bound.prototype = this.prototype;
|
777
|
+
return bound;
|
778
|
+
}
|
739
779
|
|
740
|
-
|
741
|
-
}
|
780
|
+
});
|
742
781
|
|
743
782
|
/***
|
744
783
|
* Date module
|
@@ -801,7 +840,6 @@
|
|
801
840
|
|
802
841
|
// Initialize
|
803
842
|
buildTrim();
|
804
|
-
buildBind();
|
805
843
|
buildISOString();
|
806
844
|
|
807
845
|
|
@@ -822,7 +860,7 @@
|
|
822
860
|
} else if(isRegExp(match) && isString(el)) {
|
823
861
|
// Match against a regexp
|
824
862
|
return regexp(match).test(el);
|
825
|
-
} else if(isFunction(match)) {
|
863
|
+
} else if(isFunction(match) && !isFunction(el)) {
|
826
864
|
// Match against a filtering function
|
827
865
|
return match.apply(scope, params);
|
828
866
|
} else if(isObject(match) && isObjectPrimitive(el)) {
|
@@ -1069,63 +1107,6 @@
|
|
1069
1107
|
|
1070
1108
|
|
1071
1109
|
|
1072
|
-
/***
|
1073
|
-
* @method every(<f>, [scope])
|
1074
|
-
* @returns Boolean
|
1075
|
-
* @short Returns true if all elements in the array match <f>.
|
1076
|
-
* @extra [scope] is the %this% object. In addition to providing this method for browsers that don't support it natively, this enhanced method also directly accepts strings, numbers, deep objects, and arrays for <f>. %all% is provided an alias.
|
1077
|
-
* @example
|
1078
|
-
*
|
1079
|
-
+ ['a','a','a'].every(function(n) {
|
1080
|
-
* return n == 'a';
|
1081
|
-
* });
|
1082
|
-
* ['a','a','a'].every('a') -> true
|
1083
|
-
* [{a:2},{a:2}].every({a:2}) -> true
|
1084
|
-
*
|
1085
|
-
***
|
1086
|
-
* @method some(<f>, [scope])
|
1087
|
-
* @returns Boolean
|
1088
|
-
* @short Returns true if any element in the array matches <f>.
|
1089
|
-
* @extra [scope] is the %this% object. In addition to providing this method for browsers that don't support it natively, this enhanced method also directly accepts strings, numbers, deep objects, and arrays for <f>. %any% is provided as aliases.
|
1090
|
-
* @example
|
1091
|
-
*
|
1092
|
-
+ ['a','b','c'].some(function(n) {
|
1093
|
-
* return n == 'a';
|
1094
|
-
* });
|
1095
|
-
+ ['a','b','c'].some(function(n) {
|
1096
|
-
* return n == 'd';
|
1097
|
-
* });
|
1098
|
-
* ['a','b','c'].some('a') -> true
|
1099
|
-
* [{a:2},{b:5}].some({a:2}) -> true
|
1100
|
-
*
|
1101
|
-
***
|
1102
|
-
* @method map(<map>, [scope])
|
1103
|
-
* @returns Array
|
1104
|
-
* @short Maps the array to another array containing the values that are the result of calling <map> on each element.
|
1105
|
-
* @extra [scope] is the %this% object. In addition to providing this method for browsers that don't support it natively, this enhanced method also directly accepts a string, which is a shortcut for a function that gets that property (or invokes a function) on each element.
|
1106
|
-
* @example
|
1107
|
-
*
|
1108
|
-
+ [1,2,3].map(function(n) {
|
1109
|
-
* return n * 3;
|
1110
|
-
* }); -> [3,6,9]
|
1111
|
-
* ['one','two','three'].map(function(n) {
|
1112
|
-
* return n.length;
|
1113
|
-
* }); -> [3,3,5]
|
1114
|
-
* ['one','two','three'].map('length') -> [3,3,5]
|
1115
|
-
*
|
1116
|
-
***
|
1117
|
-
* @method filter(<f>, [scope])
|
1118
|
-
* @returns Array
|
1119
|
-
* @short Returns any elements in the array that match <f>.
|
1120
|
-
* @extra [scope] is the %this% object. In addition to providing this method for browsers that don't support it natively, this enhanced method also directly accepts strings, numbers, deep objects, and arrays for <f>.
|
1121
|
-
* @example
|
1122
|
-
*
|
1123
|
-
+ [1,2,3].filter(function(n) {
|
1124
|
-
* return n > 1;
|
1125
|
-
* });
|
1126
|
-
* [1,2,2,4].filter(2) -> 2
|
1127
|
-
*
|
1128
|
-
***/
|
1129
1110
|
function buildEnhancements() {
|
1130
1111
|
var callbackCheck = function() { var a = arguments; return a.length > 0 && !isFunction(a[0]); };
|
1131
1112
|
extendSimilar(array, true, callbackCheck, 'map,every,all,some,any,none,filter', function(methods, name) {
|
@@ -1196,7 +1177,7 @@
|
|
1196
1177
|
* @method find(<f>, [index] = 0, [loop] = false)
|
1197
1178
|
* @returns Mixed
|
1198
1179
|
* @short Returns the first element that matches <f>.
|
1199
|
-
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex. Starts at [index], and will continue once from index = 0 if [loop] is true.
|
1180
|
+
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex. Starts at [index], and will continue once from index = 0 if [loop] is true. This method implements @array_matching.
|
1200
1181
|
* @example
|
1201
1182
|
*
|
1202
1183
|
+ [{a:1,b:2},{a:1,b:3},{a:1,b:4}].find(function(n) {
|
@@ -1213,7 +1194,7 @@
|
|
1213
1194
|
* @method findAll(<f>, [index] = 0, [loop] = false)
|
1214
1195
|
* @returns Array
|
1215
1196
|
* @short Returns all elements that match <f>.
|
1216
|
-
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex. Starts at [index], and will continue once from index = 0 if [loop] is true.
|
1197
|
+
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex. Starts at [index], and will continue once from index = 0 if [loop] is true. This method implements @array_matching.
|
1217
1198
|
* @example
|
1218
1199
|
*
|
1219
1200
|
+ [{a:1,b:2},{a:1,b:3},{a:2,b:4}].findAll(function(n) {
|
@@ -1237,7 +1218,7 @@
|
|
1237
1218
|
* @method findIndex(<f>, [startIndex] = 0, [loop] = false)
|
1238
1219
|
* @returns Number
|
1239
1220
|
* @short Returns the index of the first element that matches <f> or -1 if not found.
|
1240
|
-
* @extra This method has a few notable differences to native %indexOf%. Although <f> will similarly match a primitive such as a string or number, it will also match deep objects and arrays that are not equal by reference (%===%). Additionally, if a function is passed it will be run as a matching function (similar to the behavior of %Array#filter%) rather than attempting to find that function itself by reference in the array.
|
1221
|
+
* @extra This method has a few notable differences to native %indexOf%. Although <f> will similarly match a primitive such as a string or number, it will also match deep objects and arrays that are not equal by reference (%===%). Additionally, if a function is passed it will be run as a matching function (similar to the behavior of %Array#filter%) rather than attempting to find that function itself by reference in the array. Starts at [index], and will continue once from index = 0 if [loop] is true. This method implements @array_matching.
|
1241
1222
|
* @example
|
1242
1223
|
*
|
1243
1224
|
+ [1,2,3,4].findIndex(3); -> 2
|
@@ -1256,7 +1237,7 @@
|
|
1256
1237
|
* @method count(<f>)
|
1257
1238
|
* @returns Number
|
1258
1239
|
* @short Counts all elements in the array that match <f>.
|
1259
|
-
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex.
|
1240
|
+
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex. This method implements @array_matching.
|
1260
1241
|
* @example
|
1261
1242
|
*
|
1262
1243
|
* [1,2,3,1].count(1) -> 2
|
@@ -1310,7 +1291,7 @@
|
|
1310
1291
|
* @method exclude([f1], [f2], ...)
|
1311
1292
|
* @returns Array
|
1312
1293
|
* @short Removes any element in the array that matches [f1], [f2], etc.
|
1313
|
-
* @extra This is a non-destructive alias for %remove%. It will not change the original array.
|
1294
|
+
* @extra This is a non-destructive alias for %remove%. It will not change the original array. This method implements @array_matching.
|
1314
1295
|
* @example
|
1315
1296
|
*
|
1316
1297
|
* [1,2,3].exclude(3) -> [1,2]
|
@@ -1819,7 +1800,7 @@
|
|
1819
1800
|
* @method remove([f1], [f2], ...)
|
1820
1801
|
* @returns Array
|
1821
1802
|
* @short Removes any element in the array that matches [f1], [f2], etc.
|
1822
|
-
* @extra Will match a string, number, array, object, or alternately test against a function or regex. This method will change the array! Use %exclude% for a non-destructive alias.
|
1803
|
+
* @extra Will match a string, number, array, object, or alternately test against a function or regex. This method will change the array! Use %exclude% for a non-destructive alias. This method implements @array_matching.
|
1823
1804
|
* @example
|
1824
1805
|
*
|
1825
1806
|
* [1,2,3].remove(3) -> [1,2]
|
@@ -1900,7 +1881,7 @@
|
|
1900
1881
|
* @method none(<f>)
|
1901
1882
|
* @returns Boolean
|
1902
1883
|
* @short Returns true if none of the elements in the array match <f>.
|
1903
|
-
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex.
|
1884
|
+
* @extra <f> will match a string, number, array, object, or alternately test against a function or regex. This method implements @array_matching.
|
1904
1885
|
* @example
|
1905
1886
|
*
|
1906
1887
|
* [1,2,3].none(5) -> true
|
@@ -2819,6 +2800,9 @@
|
|
2819
2800
|
}
|
2820
2801
|
|
2821
2802
|
}
|
2803
|
+
if(!forceUTC) {
|
2804
|
+
d.utc(false);
|
2805
|
+
}
|
2822
2806
|
return {
|
2823
2807
|
date: d,
|
2824
2808
|
set: set
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Sugar Library v1.3.
|
2
|
+
* Sugar Library v1.3.3
|
3
3
|
*
|
4
4
|
* Freely distributable and licensed under the MIT-style license.
|
5
5
|
* Copyright (c) 2012 Andrew Plummer
|
@@ -7,8 +7,8 @@
|
|
7
7
|
*
|
8
8
|
* ---------------------------- */
|
9
9
|
(function(){var k=true,l=null,m=false;function aa(a){return function(){return a}}var o=Object,p=Array,q=RegExp,s=Date,t=String,u=Number,v=Math,ba=typeof global!=="undefined"?global:this,ea=o.defineProperty&&o.defineProperties,w="Array,Boolean,Date,Function,Number,String,RegExp".split(","),fa=x(w[0]),ga=x(w[1]),ha=x(w[2]),A=x(w[3]),B=x(w[4]),D=x(w[5]),E=x(w[6]);function x(a){return function(b){return o.prototype.toString.call(b)==="[object "+a+"]"}}
|
10
|
-
function ia(a){if(!a.SugarMethods){ja(a,"SugarMethods",{});F(a,m,m,{restore:function(){var b=arguments.length===0,c=G(arguments);H(a.SugarMethods,function(d,e){if(b||c.indexOf(d)>-1)ja(e.
|
11
|
-
function I(a,b,c,d,e){var f={};d=D(d)?d.split(","):d;d.forEach(function(g,j){e(f,g,j)});F(a,b,c,f)}function ka(a,b,c){return function(){return a&&(c===k||!c.apply(this,arguments))?a.apply(this,arguments):b.apply(this,arguments)}}function ja(a,b,c){if(ea)o.defineProperty(a,b,{value:c,configurable:k,enumerable:m,writable:k});else a[b]=c}function G(a,b){var c=[],d
|
10
|
+
function ia(a){if(!a.SugarMethods){ja(a,"SugarMethods",{});F(a,m,m,{restore:function(){var b=arguments.length===0,c=G(arguments);H(a.SugarMethods,function(d,e){if(b||c.indexOf(d)>-1)ja(e.va?a.prototype:a,d,e.method)})},extend:function(b,c,d){F(a,d!==m,c,b)}})}}function F(a,b,c,d){var e=b?a.prototype:a,f;ia(a);H(d,function(g,j){f=e[g];if(typeof c==="function")j=ka(e[g],j,c);if(c!==m||!e[g])ja(e,g,j);a.SugarMethods[g]={va:b,method:j,Da:f}})}
|
11
|
+
function I(a,b,c,d,e){var f={};d=D(d)?d.split(","):d;d.forEach(function(g,j){e(f,g,j)});F(a,b,c,f)}function ka(a,b,c){return function(){return a&&(c===k||!c.apply(this,arguments))?a.apply(this,arguments):b.apply(this,arguments)}}function ja(a,b,c){if(ea)o.defineProperty(a,b,{value:c,configurable:k,enumerable:m,writable:k});else a[b]=c}function G(a,b){var c=[],d;for(d=0;d<a.length;d++){c.push(a[d]);b&&b.call(a,a[d],d)}return c}function J(a){return a!==void 0}function K(a){return a===void 0}
|
12
12
|
function la(a){return a&&typeof a==="object"}function L(a){return!!a&&o.prototype.toString.call(a)==="[object Object]"&&"hasOwnProperty"in a}function ma(a,b){return o.hasOwnProperty.call(a,b)}function H(a,b){for(var c in a)if(ma(a,c))if(b.call(a,c,a[c])===m)break}function na(a,b){H(b,function(c){a[c]=b[c]});return a}function M(a){na(this,a)}M.prototype.constructor=o;function N(a,b,c,d){var e=[];a=parseInt(a);for(var f=d<0;!f&&a<=b||f&&a>=b;){e.push(a);c&&c.call(this,a);a+=d||1}return e}
|
13
13
|
function O(a,b,c){c=v[c||"round"];var d=v.pow(10,v.abs(b||0));if(b<0)d=1/d;return c(a*d)/d}function P(a,b){return O(a,b,"floor")}function R(a,b,c,d){d=v.abs(a).toString(d||10);d=oa(b-d.replace(/\.\d+/,"").length,"0")+d;if(c||a<0)d=(a<0?"-":"+")+d;return d}function pa(a){if(a>=11&&a<=13)return"th";else switch(a%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}
|
14
14
|
function qa(){return"\t\n\u000b\u000c\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u2028\u2029\u3000\ufeff"}function oa(a,b){return p(v.max(0,J(a)?a:1)+1).join(b||"")}function ra(a,b){var c=a.toString().match(/[^/]*$/)[0];if(b)c=(c+b).split("").sort().join("").replace(/([gimy])\1+/g,"$1");return c}function S(a){D(a)||(a=t(a));return a.replace(/([\\/'*+?|()\[\]{}.^$])/g,"\\$1")}
|
@@ -19,11 +19,11 @@ F(o,m,m,{keys:function(a){var b=[];if(!la(a)&&!E(a)&&!A(a))throw new TypeError("
|
|
19
19
|
function wa(a,b,c,d){var e=a.length,f=d==-1,g=f?e-1:0;c=isNaN(c)?g:parseInt(c>>0);if(c<0)c=e+c;if(!f&&c<0||f&&c>=e)c=g;for(;f&&c>=0||!f&&c<e;){if(a[c]===b)return c;c+=d}return-1}function xa(a,b,c,d){var e=a.length,f=0,g=J(c);ya(b);if(e==0&&!g)throw new TypeError("Reduce called on empty array with no initial value");else if(g)c=c;else{c=a[d?e-1:f];f++}for(;f<e;){g=d?e-f-1:f;if(g in a)c=b(c,a[g],g,a);f++}return c}function ya(a){if(!a||!a.call)throw new TypeError("Callback is not callable");}
|
20
20
|
function za(a){if(a.length===0)throw new TypeError("First argument must be defined");}F(p,m,m,{isArray:function(a){return fa(a)}});
|
21
21
|
F(p,k,m,{every:function(a,b){var c=this.length,d=0;for(za(arguments);d<c;){if(d in this&&!a.call(b,this[d],d,this))return m;d++}return k},some:function(a,b){var c=this.length,d=0;for(za(arguments);d<c;){if(d in this&&a.call(b,this[d],d,this))return k;d++}return m},map:function(a,b){var c=this.length,d=0,e=Array(c);for(za(arguments);d<c;){if(d in this)e[d]=a.call(b,this[d],d,this);d++}return e},filter:function(a,b){var c=this.length,d=0,e=[];for(za(arguments);d<c;){d in this&&a.call(b,this[d],d,this)&&
|
22
|
-
e.push(this[d]);d++}return e},indexOf:function(a,b){if(D(this))return this.indexOf(a,b);return wa(this,a,b,1)},lastIndexOf:function(a,b){if(D(this))return this.lastIndexOf(a,b);return wa(this,a,b,-1)},forEach:function(a,b){var c=this.length,d=0;for(ya(a);d<c;){d in this&&a.call(b,this[d],d,this);d++}},reduce:function(a,b){return xa(this,a,b)},reduceRight:function(a,b){return xa(this,a,b,k)}});
|
22
|
+
e.push(this[d]);d++}return e},indexOf:function(a,b){if(D(this))return this.indexOf(a,b);return wa(this,a,b,1)},lastIndexOf:function(a,b){if(D(this))return this.lastIndexOf(a,b);return wa(this,a,b,-1)},forEach:function(a,b){var c=this.length,d=0;for(ya(a);d<c;){d in this&&a.call(b,this[d],d,this);d++}},reduce:function(a,b){return xa(this,a,b)},reduceRight:function(a,b){return xa(this,a,b,k)}});
|
23
|
+
F(Function,k,m,{bind:function(a){var b=this,c=G(arguments).slice(1),d;if(!A(this))throw new TypeError("Function.prototype.bind called on a non-function");d=function(){return b.apply(b.prototype&&this instanceof b?this:a,c.concat(G(arguments)))};d.prototype=this.prototype;return d}});F(s,m,m,{now:function(){return(new s).getTime()}});
|
23
24
|
(function(){var a=qa().match(/^\s+$/);try{t.prototype.trim.call([1])}catch(b){a=m}F(t,k,!a,{trim:function(){return this.toString().trimLeft().trimRight()},trimLeft:function(){return this.replace(q("^["+qa()+"]+"),"")},trimRight:function(){return this.replace(q("["+qa()+"]+$"),"")}})})();
|
24
|
-
(function(){var a=m;if(Function.prototype.qa){a=function(){};var b=a.qa();a=new b instanceof b&&!(new a instanceof b)}F(Function,k,!a,{bind:function(c){var d=this,e=G(arguments).slice(1),f,g;if(!A(this))throw new TypeError("Function.prototype.bind called on a non-function");g=function(){return d.apply(d.prototype&&this instanceof d?this:c,e.concat(G(arguments)))};f=function(){};f.prototype=this.prototype;g.prototype=new f;return g}})})();
|
25
25
|
(function(){var a=new s(s.UTC(1999,11,31));a=a.toISOString&&a.toISOString()==="1999-12-31T00:00:00.000Z";I(s,k,!a,"toISOString,toJSON",function(b,c){b[c]=function(){return R(this.getUTCFullYear(),4)+"-"+R(this.getUTCMonth()+1,2)+"-"+R(this.getUTCDate(),2)+"T"+R(this.getUTCHours(),2)+":"+R(this.getUTCMinutes(),2)+":"+R(this.getUTCSeconds(),2)+"."+R(this.getUTCMilliseconds(),3)+"Z"}})})();
|
26
|
-
function Aa(a,b,c,d){var e=k;if(a===b)return k;else if(E(b)&&D(a))return q(b).test(a);else if(A(b))return b.apply(c,d);else if(L(b)&&la(a)){H(b,function(f){Aa(a[f],b[f],c,[a[f],a])||(e=m)});return e}else return ta(a)&&ta(b)?sa(a)===sa(b):a===b}function T(a,b,c,d){return K(b)?a:A(b)?b.apply(c,d||[]):A(a[b])?a[b].call(a):a[b]}
|
26
|
+
function Aa(a,b,c,d){var e=k;if(a===b)return k;else if(E(b)&&D(a))return q(b).test(a);else if(A(b)&&!A(a))return b.apply(c,d);else if(L(b)&&la(a)){H(b,function(f){Aa(a[f],b[f],c,[a[f],a])||(e=m)});return e}else return ta(a)&&ta(b)?sa(a)===sa(b):a===b}function T(a,b,c,d){return K(b)?a:A(b)?b.apply(c,d||[]):A(a[b])?a[b].call(a):a[b]}
|
27
27
|
function U(a,b,c,d){var e,f;if(c<0)c=a.length+c;f=isNaN(c)?0:c;for(c=d===k?a.length+f:a.length;f<c;){e=f%a.length;if(e in a){if(b.call(a,a[e],e,a)===m)break}else return Ba(a,b,f,d);f++}}function Ba(a,b,c){var d=[],e;for(e in a)e in a&&e>>>0==e&&e!=4294967295&&e>=c&&d.push(parseInt(e));d.sort().each(function(f){return b.call(a,a[f],f,a)});return a}function Ca(a,b,c,d,e){var f,g;U(a,function(j,i,h){if(Aa(j,b,h,[j,i,h])){f=j;g=i;return m}},c,d);return e?g:f}
|
28
28
|
function Ea(a,b){var c=[],d={},e;U(a,function(f,g){e=b?T(f,b,a,[f,g,a]):f;Fa(d,e)||c.push(f)});return c}function Ga(a,b,c){var d=[],e={};b.each(function(f){Fa(e,f)});a.each(function(f){var g=sa(f),j=!ta(f);if(Ha(e,g,f,j)!=c){var i=0;if(j)for(g=e[g];i<g.length;)if(g[i]===f)g.splice(i,1);else i+=1;else delete e[g];d.push(f)}});return d}function Ia(a,b,c){b=b||Infinity;c=c||0;var d=[];U(a,function(e){if(fa(e)&&c<b)d=d.concat(Ia(e,b,c+1));else d.push(e)});return d}
|
29
29
|
function Ja(a){var b=[];G(a,function(c){b=b.concat(c)});return b}function Ha(a,b,c,d){var e=b in a;if(d){a[b]||(a[b]=[]);e=a[b].indexOf(c)!==-1}return e}function Fa(a,b){var c=sa(b),d=!ta(b),e=Ha(a,c,b,d);if(d)a[c].push(b);else a[c]=b;return e}function Ka(a,b,c,d){var e,f=[],g=c==="max",j=c==="min",i=Array.isArray(a);H(a,function(h){var n=a[h];h=T(n,b,a,i?[n,parseInt(h),a]:[]);if(h===e)f.push(n);else if(K(e)||g&&h>e||j&&h<e){f=[n];e=h}});i||(f=Ia(f,1));return d?f:f[0]}
|
@@ -43,23 +43,23 @@ var V,Ua,Va=["ampm","hour","minute","second","ampm","utc","offset_sign","offset_
|
|
43
43
|
{ba:"hh?|hours|12hr",format:function(a){a=W(a,"Hours");return a===0?12:a-P(a/13)*12}},{ba:"HH?|24hr",format:function(a){return W(a,"Hours")}},{ba:"dd?|date|day",format:function(a){return W(a,"Date")}},{ba:"dow|weekday",la:k,format:function(a,b,c){a=W(a,"Day");return b.weekdays[a+(c-1)*7]}},{ba:"MM?",format:function(a){return W(a,"Month")+1}},{ba:"mon|month",la:k,format:function(a,b,c){a=W(a,"Month");return b.months[a+(c-1)*12]}},{ba:"y{2,4}|year",format:function(a){return W(a,"FullYear")}},{ba:"[Tt]{1,2}",
|
44
44
|
format:function(a,b,c,d){a=W(a,"Hours");b=b.ampm[P(a/12)];if(d.length===1)b=b.slice(0,1);if(d.slice(0,1)==="T")b=b.toUpperCase();return b}},{ba:"z{1,4}|tz|timezone",text:k,format:function(a,b,c,d){a=a.getUTCOffset();if(d=="z"||d=="zz")a=a.replace(/(\d{2})(\d{2})/,function(e,f){return R(f,d.length)});return a}},{ba:"iso(tz|timezone)",format:function(a){return a.getUTCOffset(k)}},{ba:"ord",format:function(a){a=W(a,"Date");return a+pa(a)}}],cb=[{$:"year",method:"FullYear",ja:k,da:function(a){return(365+
|
45
45
|
(a?a.isLeapYear()?1:0:0.25))*24*60*60*1E3}},{$:"month",method:"Month",ja:k,da:function(a,b){var c=30.4375,d;if(a){d=a.daysInMonth();if(b<=d.days())c=d}return c*24*60*60*1E3}},{$:"week",method:"Week",da:aa(6048E5)},{$:"day",method:"Date",ja:k,da:aa(864E5)},{$:"hour",method:"Hours",da:aa(36E5)},{$:"minute",method:"Minutes",da:aa(6E4)},{$:"second",method:"Seconds",da:aa(1E3)},{$:"millisecond",method:"Milliseconds",da:aa(1)}],db={};function eb(a){na(this,a);this.ga=ab.concat()}
|
46
|
-
eb.prototype={getMonth:function(a){return B(a)?a-1:this.months.indexOf(a)%12},getWeekday:function(a){return this.weekdays.indexOf(a)%7},oa:function(a){var b;return B(a)?a:a&&(b=this.numbers.indexOf(a))!==-1?(b+1)%10:1},
|
47
|
-
return a==="en"||a==="en-US"?k:this.variant},
|
48
|
-
function(i,h){switch(h){case "num":return c;case "unit":return g;case "sign":return f.src}})},
|
46
|
+
eb.prototype={getMonth:function(a){return B(a)?a-1:this.months.indexOf(a)%12},getWeekday:function(a){return this.weekdays.indexOf(a)%7},oa:function(a){var b;return B(a)?a:a&&(b=this.numbers.indexOf(a))!==-1?(b+1)%10:1},ta:function(a){var b=this;return a.replace(q(this.num,"g"),function(c){return b.oa(c)||""})},ra:function(a){return V.units[this.units.indexOf(a)%8]},Aa:function(a){return this.na(a,a[2]>0?"future":"past")},qa:function(a){return this.na(fb(a),"duration")},ua:function(a){a=a||this.code;
|
47
|
+
return a==="en"||a==="en-US"?k:this.variant},xa:function(a){return a===this.ampm[0]},ya:function(a){return a===this.ampm[1]},na:function(a,b){var c=a[0],d=a[1],e=a[2],f,g,j;if(this.code=="ru"){j=c.toString().slice(-1);switch(k){case j==1:j=1;break;case j>=2&&j<=4:j=2;break;default:j=3}}else j=this.plural&&c>1?1:0;g=this.units[j*8+d]||this.units[d];if(this.capitalizeUnit)g=gb(g);f=this.modifiers.filter(function(i){return i.name=="sign"&&i.value==(e>0?1:-1)})[0];return this[b].replace(/\{(.*?)\}/g,
|
48
|
+
function(i,h){switch(h){case "num":return c;case "unit":return g;case "sign":return f.src}})},sa:function(){return this.ma?[this.ma].concat(this.ga):this.ga},addFormat:function(a,b,c,d,e){var f=c||[],g=this,j;a=a.replace(/\s+/g,"[-,. ]*");a=a.replace(/\{([^,]+?)\}/g,function(i,h){var n=h.match(/\?$/),r=h.match(/(\d)(?:-(\d))?/),y=h.match(/^\d+$/),z=h.replace(/[^a-z]+$/,""),C,ca;if(y)C=g.optionals[y[0]];else if(g[z])C=g[z];else if(g[z+"s"]){C=g[z+"s"];if(r){ca=[];C.forEach(function(da,Da){var Q=Da%
|
49
49
|
(g.units?8:C.length);if(Q>=r[1]&&Q<=(r[2]||r[1]))ca.push(da)});C=ca}C=hb(C)}if(y)return"(?:"+C+")?";else{c||f.push(z);return"("+C+")"+(n?"?":"")}});if(b){b=ib(Wa,g,e);e=["t","[\\s\\u3000]"].concat(g.timeMarker);j=a.match(/\\d\{\d,\d\}\)+\??$/);jb(g,"(?:"+b+")[,\\s\\u3000]+?"+a,Va.concat(f),d);jb(g,a+"(?:[,\\s]*(?:"+e.join("|")+(j?"+":"*")+")"+b+")?",f.concat(Va),d)}else jb(g,a,f,d)}};
|
50
50
|
function kb(a,b){var c;D(a)||(a="");c=db[a]||db[a.slice(0,2)];if(b===m&&!c)throw Error("Invalid locale.");return c||Ua}
|
51
51
|
function lb(a,b){function c(i){var h=g[i];if(D(h))g[i]=h.split(",");else h||(g[i]=[])}function d(i,h){i=i.split("+").map(function(n){return n.replace(/(.+):(.+)$/,function(r,y,z){return z.split("|").map(function(C){return y+C}).join("|")})}).join("|");return i.split("|").forEach(h)}function e(i,h,n){var r=[];g[i].forEach(function(y,z){if(h)y+="+"+y.slice(0,3);d(y,function(C,ca){r[ca*n+z]=C.toLowerCase()})});g[i]=r}function f(i,h,n){i="\\d{"+i+","+h+"}";if(n)i+="|(?:"+hb(g.numbers)+")+";return i}var g,
|
52
52
|
j;g=new eb(b);c("modifiers");"months,weekdays,units,numbers,articles,optionals,timeMarker,ampm,timeSuffixes,dateParse,timeParse".split(",").forEach(c);j=!g.monthSuffix;e("months",j,12);e("weekdays",j,7);e("units",m,8);e("numbers",m,10);g.code=a;g.date=f(1,2,g.digitDate);g.year=f(4,4);g.num=function(){var i=["\\d+"].concat(g.articles);if(g.numbers)i=i.concat(g.numbers);return hb(i)}();(function(){var i=[];g.ha={};g.modifiers.forEach(function(h){var n=h.name;d(h.src,function(r){var y=g[n];g.ha[r]=h;
|
53
53
|
i.push({name:n,src:r,value:h.value});g[n]=y?y+"|"+r:r})});g.day+="|"+hb(g.weekdays);g.modifiers=i})();if(g.monthSuffix){g.month=f(1,2);g.months=N(1,12).map(function(i){return i+g.monthSuffix})}g.full_month=f(1,2)+"|"+hb(g.months);g.timeSuffixes.length>0&&g.addFormat(ib(Wa,g),m,Va);g.addFormat("{day}",k);g.addFormat("{month}"+(g.monthSuffix||""));g.addFormat("{year}"+(g.yearSuffix||""));g.timeParse.forEach(function(i){g.addFormat(i,k)});g.dateParse.forEach(function(i){g.addFormat(i)});return db[a]=
|
54
|
-
g}function jb(a,b,c,d){a.ga.unshift({
|
55
|
-
function nb(a,b){var c={};if(match=a.match(/^(\d+)?\s?(\w+?)s?$/i)){if(K(b))b=parseInt(match[1])||1;c[match[2].toLowerCase()]=b}return c}function ob(a,b){var c={},d,e;b.forEach(function(f,g){d=a[g+1];if(!(K(d)||d==="")){if(f==="year")c.
|
54
|
+
g}function jb(a,b,c,d){a.ga.unshift({Ba:d,wa:a,za:q("^"+b+"$","i"),to:c})}function gb(a){return a.slice(0,1).toUpperCase()+a.slice(1)}function hb(a){return a.filter(function(b){return!!b}).join("|")}function mb(a,b){var c;if(L(a[0]))return a;else if(B(a[0])&&!B(a[1]))return[a[0]];else if(D(a[0])&&b)return[nb(a[0]),a[1]];c={};Za.forEach(function(d,e){c[d.$]=a[e]});return[c]}
|
55
|
+
function nb(a,b){var c={};if(match=a.match(/^(\d+)?\s?(\w+?)s?$/i)){if(K(b))b=parseInt(match[1])||1;c[match[2].toLowerCase()]=b}return c}function ob(a,b){var c={},d,e;b.forEach(function(f,g){d=a[g+1];if(!(K(d)||d==="")){if(f==="year")c.Ca=d;e=parseFloat(d.replace(/,/,"."));c[f]=!isNaN(e)?e:d.toLowerCase()}});return c}function pb(a){a=a.trim().replace(/^(just )?now|\.+$/i,"");return qb(a)}
|
56
56
|
function qb(a){return a.replace(Ya,function(b,c,d){var e=0,f=1,g,j;if(c)return b;d.split("").reverse().forEach(function(i){i=Xa[i];var h=i>9;if(h){if(g)e+=f;f*=i/(j||1);j=i}else{if(g===m)f*=10;e+=f*i}g=h});if(g)e+=f;return e})}
|
57
|
-
function rb(a,b,c,d){var e=new s,f=m,g,j,i,h,n,r,y,z,C;e.utc(d);if(ha(a))e=a.clone();else if(B(a))e=new s(a);else if(L(a)){e.set(a,k);h=a}else if(D(a)){g=kb(b);a=pb(a);g&&H(g.
|
58
|
-
j.getMonth(h.month);if(h.shift&&!h.unit)h.unit=j.units[7]}if(h.weekday&&h.date)delete h.weekday;else if(h.weekday){h.weekday=j.getWeekday(h.weekday);if(h.shift&&!h.unit)h.unit=j.units[5]}if(h.day&&(z=j.ha[h.day])){h.day=z.value;e.reset();f=k}else if(h.day&&(r=j.getWeekday(h.day))>-1){delete h.day;if(h.num&&h.month){C=function(){var Q=e.getWeekday();e.setWeekday(7*(h.num-1)+(Q>r?r+7:r))};h.day=1}else h.weekday=r}if(h.date&&!B(h.date))h.date=j.
|
59
|
-
h.hour===12)h.hour=0;if("offset_hours"in h||"offset_minutes"in h){e.utc();h.offset_minutes=h.offset_minutes||0;h.offset_minutes+=h.offset_hours*60;if(h.offset_sign==="-")h.offset_minutes*=-1;h.minute-=h.offset_minutes}if(h.unit){f=k;y=j.oa(h.num);n=j.
|
57
|
+
function rb(a,b,c,d){var e=new s,f=m,g,j,i,h,n,r,y,z,C;e.utc(d);if(ha(a))e=a.clone();else if(B(a))e=new s(a);else if(L(a)){e.set(a,k);h=a}else if(D(a)){g=kb(b);a=pb(a);g&&H(g.sa(),function(ca,da){var Da=a.match(da.za);if(Da){i=da;j=i.wa;h=ob(Da,i.to,j);h.utc&&e.utc();j.ma=i;if(h.timestamp){h=h.timestamp;return m}if(i.Ba&&!D(h.month)&&(D(h.date)||g.ua(b))){z=h.month;h.month=h.date;h.date=z}if(h.year&&h.Ca.length===2)h.year=O(W(new s,"FullYear")/100)*100-O(h.year/100)*100+h.year;if(h.month){h.month=
|
58
|
+
j.getMonth(h.month);if(h.shift&&!h.unit)h.unit=j.units[7]}if(h.weekday&&h.date)delete h.weekday;else if(h.weekday){h.weekday=j.getWeekday(h.weekday);if(h.shift&&!h.unit)h.unit=j.units[5]}if(h.day&&(z=j.ha[h.day])){h.day=z.value;e.reset();f=k}else if(h.day&&(r=j.getWeekday(h.day))>-1){delete h.day;if(h.num&&h.month){C=function(){var Q=e.getWeekday();e.setWeekday(7*(h.num-1)+(Q>r?r+7:r))};h.day=1}else h.weekday=r}if(h.date&&!B(h.date))h.date=j.ta(h.date);if(j.ya(h.ampm)&&h.hour<12)h.hour+=12;else if(j.xa(h.ampm)&&
|
59
|
+
h.hour===12)h.hour=0;if("offset_hours"in h||"offset_minutes"in h){e.utc();h.offset_minutes=h.offset_minutes||0;h.offset_minutes+=h.offset_hours*60;if(h.offset_sign==="-")h.offset_minutes*=-1;h.minute-=h.offset_minutes}if(h.unit){f=k;y=j.oa(h.num);n=j.ra(h.unit);if(h.shift||h.edge){y*=(z=j.ha[h.shift])?z.value:0;if(n==="month"&&J(h.date)){e.set({day:h.date},k);delete h.date}if(n==="year"&&J(h.month)){e.set({month:h.month,day:h.date},k);delete h.month;delete h.date}}if(h.sign&&(z=j.ha[h.sign]))y*=z.value;
|
60
60
|
if(J(h.weekday)){e.set({weekday:h.weekday},k);delete h.weekday}h[n]=(h[n]||0)+y}if(h.year_sign==="-")h.year*=-1;$a.slice(1,4).forEach(function(Q,Ub){var zb=h[Q.$],Ab=zb%1;if(Ab){h[$a[Ub].$]=O(Ab*(Q.$==="second"?1E3:60));h[Q.$]=P(zb)}});return m}});if(i)if(f)e.advance(h);else{e._utc&&e.reset();sb(e,h,k,m,c)}else e=a?new s(a):new s;if(h&&h.edge){z=j.ha[h.edge];H($a.slice(4),function(ca,da){if(J(h[da.$])){n=da.$;return m}});if(n==="year")h.fa="month";else if(n==="month"||n==="week")h.fa="day";e[(z.value<
|
61
|
-
0?"endOf":"beginningOf")+gb(n)]();z.value===-2&&e.reset()}C&&C()}return{ea:e,set:h}}function fb(a){var b,c=v.abs(a),d=c,e=0;$a.slice(1).forEach(function(f,g){b=P(O(c/f.da()*10)/10);if(b>=1){d=b;e=g+1}});return[d,e,a]}
|
62
|
-
function tb(a,b,c,d){var e,f=kb(d),g=q(/^[A-Z]/);if(a.isValid())if(Date[b])b=Date[b];else{if(A(b)){e=fb(a.millisecondsFromNow());b=b.apply(a,e.concat(f))}}else return"Invalid Date";if(!b&&c){e=e||fb(a.millisecondsFromNow());if(e[1]===0){e[1]=1;e[0]=1}return f.
|
61
|
+
0?"endOf":"beginningOf")+gb(n)]();z.value===-2&&e.reset()}C&&C()}d||e.utc(m);return{ea:e,set:h}}function fb(a){var b,c=v.abs(a),d=c,e=0;$a.slice(1).forEach(function(f,g){b=P(O(c/f.da()*10)/10);if(b>=1){d=b;e=g+1}});return[d,e,a]}
|
62
|
+
function tb(a,b,c,d){var e,f=kb(d),g=q(/^[A-Z]/);if(a.isValid())if(Date[b])b=Date[b];else{if(A(b)){e=fb(a.millisecondsFromNow());b=b.apply(a,e.concat(f))}}else return"Invalid Date";if(!b&&c){e=e||fb(a.millisecondsFromNow());if(e[1]===0){e[1]=1;e[0]=1}return f.Aa(e)}b=b||"long";b=f[b]||b;bb.forEach(function(j){b=b.replace(q("\\{("+j.ba+")(\\d)?\\}",j.la?"i":""),function(i,h,n){i=j.format(a,f,n||1,h);n=h.length;var r=h.match(/^(.)\1+$/);if(j.la){if(n===3)i=i.slice(0,3);if(r||h.match(g))i=gb(i)}else if(r&&
|
63
63
|
!j.text)i=(B(i)?R(i,n):i.toString()).slice(-n);return i})});return b}
|
64
64
|
function ub(a,b,c,d){var e=rb(b,l,l,d),f=0;d=b=0;var g;if(c>0){b=d=c;g=k}if(!e.ea.isValid())return m;if(e.set&&e.set.fa){cb.forEach(function(i){if(i.$===e.set.fa)f=i.da(e.ea,a-e.ea)-1});c=gb(e.set.fa);if(e.set.edge||e.set.shift)e.ea["beginningOf"+c]();if(e.set.fa==="month")j=e.ea.clone()["endOf"+c]().getTime();if(!g&&e.set.sign&&e.set.fa!="millisecond"){b=50;d=-50}}g=a.getTime();c=e.ea.getTime();var j=j||c+f;return g>=c-b&&g<=j+d}
|
65
65
|
function sb(a,b,c,d,e){function f(i){return J(b[i])?b[i]:b[i+"s"]}var g,j;if(B(b)&&d)b={milliseconds:b};else if(B(b)){a.setTime(b);return a}if(b.date)b.day=b.date;H($a,function(i,h){var n=h.$==="day";if(J(f(h.$))||n&&J(f("weekday"))){b.fa=h.$;j=+i;return m}else if(c&&h.$!=="week"&&(!n||!J(f("week"))))X(a,h.method,n?1:0)});cb.forEach(function(i){var h=i.$;i=i.method;var n;n=f(h);if(!K(n)){if(d){if(h==="week"){n=(b.day||0)+n*7;i="Date"}n=n*d+W(a,i)}else h==="month"&&J(f("day"))&&X(a,"Date",15);X(a,
|
@@ -71,7 +71,7 @@ return R(O(-b/60),2,k)+c+R(b%60,2)},utc:function(a){this._utc=a===k||arguments.l
|
|
71
71
|
0)},isBetween:function(a,b,c){var d=this.getTime();a=s.create(a).getTime();var e=s.create(b).getTime();b=v.min(a,e);a=v.max(a,e);c=c||0;return b-c<d&&a+c>d},isLeapYear:function(){var a=W(this,"FullYear");return a%4===0&&a%100!==0||a%400===0},daysInMonth:function(){return 32-W(new s(W(this,"FullYear"),W(this,"Month"),32),"Date")},format:function(a,b){return tb(this,a,m,b)},relative:function(a,b){if(D(a)){b=a;a=l}return tb(this,a,k,b)},is:function(a,b,c){var d,e;if(this.isValid()){if(D(a)){a=a.trim().toLowerCase();
|
72
72
|
e=this.clone().utc(c);switch(k){case a==="future":return this.getTime()>(new s).getTime();case a==="past":return this.getTime()<(new s).getTime();case a==="weekday":return W(e,"Day")>0&&W(e,"Day")<6;case a==="weekend":return W(e,"Day")===0||W(e,"Day")===6;case (d=V.weekdays.indexOf(a)%7)>-1:return W(e,"Day")===d;case (d=V.months.indexOf(a)%12)>-1:return W(e,"Month")===d}}return ub(this,a,b,c)}},reset:function(a){var b={},c;a=a||"hours";if(a==="date")a="days";c=cb.some(function(d){return a===d.$||
|
73
73
|
a===d.$+"s"});b[a]=a.match(/^days?/)?1:0;return c?this.set(b,k):this},clone:function(){var a=new s(this.getTime());a._utc=this._utc;return a}});s.extend({iso:function(){return this.toISOString()},getWeekday:s.prototype.getDay,getUTCWeekday:s.prototype.getUTCDay});
|
74
|
-
function wb(a,b){function c(){return O(this*b)}function d(){return vb(arguments)[a.ia](this)}function e(){return vb(arguments)[a.ia](-this)}var f=a.$,g={};g[f]=c;g[f+"s"]=c;g[f+"Before"]=e;g[f+"sBefore"]=e;g[f+"Ago"]=e;g[f+"sAgo"]=e;g[f+"After"]=d;g[f+"sAfter"]=d;g[f+"FromNow"]=d;g[f+"sFromNow"]=d;u.extend(g)}u.extend({duration:function(a){return kb(a).
|
74
|
+
function wb(a,b){function c(){return O(this*b)}function d(){return vb(arguments)[a.ia](this)}function e(){return vb(arguments)[a.ia](-this)}var f=a.$,g={};g[f]=c;g[f+"s"]=c;g[f+"Before"]=e;g[f+"sBefore"]=e;g[f+"Ago"]=e;g[f+"sAgo"]=e;g[f+"After"]=d;g[f+"sAfter"]=d;g[f+"FromNow"]=d;g[f+"sFromNow"]=d;u.extend(g)}u.extend({duration:function(a){return kb(a).qa(this)}});
|
75
75
|
V=Ua=s.addLocale("en",{plural:k,timeMarker:"at",ampm:"am,pm",months:"January,February,March,April,May,June,July,August,September,October,November,December",weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",units:"millisecond:|s,second:|s,minute:|s,hour:|s,day:|s,week:|s,month:|s,year:|s",numbers:"one,two,three,four,five,six,seven,eight,nine,ten",articles:"a,an,the",optionals:"the,st|nd|rd|th,of","short":"{Month} {d}, {yyyy}","long":"{Month} {d}, {yyyy} {h}:{mm}{tt}",full:"{Weekday} {Month} {d}, {yyyy} {h}:{mm}:{ss}{tt}",
|
76
76
|
past:"{num} {unit} {sign}",future:"{num} {unit} {sign}",duration:"{num} {unit}",modifiers:[{name:"day",src:"yesterday",value:-1},{name:"day",src:"today",value:0},{name:"day",src:"tomorrow",value:1},{name:"sign",src:"ago|before",value:-1},{name:"sign",src:"from now|after|from|in",value:1},{name:"edge",src:"last day",value:-2},{name:"edge",src:"end",value:-1},{name:"edge",src:"first day|beginning",value:1},{name:"shift",src:"last",value:-1},{name:"shift",src:"the|this",value:0},{name:"shift",src:"next",
|
77
77
|
value:1}],dateParse:["{num} {unit} {sign}","{sign} {num} {unit}","{num} {unit=4-5} {sign} {day}","{month} {year}","{shift} {unit=5-7}","{0} {edge} of {shift?} {unit=4-7?}{month?}{year?}"],timeParse:["{0} {num}{1} {day} of {month} {year?}","{weekday?} {month} {date}{1} {year?}","{date} {month} {year}","{shift} {weekday}","{shift} week {weekday}","{weekday} {2} {shift} week","{0} {date}{1} of {month}","{0}{month?} {date?}{1} of {shift} {unit=6-7}"]});$a=cb.concat().reverse();Za=cb.concat();
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Sugar Library v1.3.
|
2
|
+
* Sugar Library v1.3.3
|
3
3
|
*
|
4
4
|
* Freely distributable and licensed under the MIT-style license.
|
5
5
|
* Copyright (c) 2012 Andrew Plummer
|
@@ -7,8 +7,8 @@
|
|
7
7
|
*
|
8
8
|
* ---------------------------- */
|
9
9
|
(function(){var k=true,l=null,m=false;function aa(a){return function(){return a}}var o=Object,p=Array,q=RegExp,s=Date,t=String,u=Number,v=Math,ba=typeof global!=="undefined"?global:this,ea=o.defineProperty&&o.defineProperties,w="Array,Boolean,Date,Function,Number,String,RegExp".split(","),fa=x(w[0]),ga=x(w[1]),ha=x(w[2]),A=x(w[3]),B=x(w[4]),D=x(w[5]),E=x(w[6]);function x(a){return function(b){return o.prototype.toString.call(b)==="[object "+a+"]"}}
|
10
|
-
function ia(a){if(!a.SugarMethods){ja(a,"SugarMethods",{});F(a,m,m,{restore:function(){var b=arguments.length===0,c=G(arguments);H(a.SugarMethods,function(d,e){if(b||c.indexOf(d)>-1)ja(e.
|
11
|
-
function I(a,b,c,d,e){var f={};d=D(d)?d.split(","):d;d.forEach(function(g,j){e(f,g,j)});F(a,b,c,f)}function ka(a,b,c){return function(){return a&&(c===k||!c.apply(this,arguments))?a.apply(this,arguments):b.apply(this,arguments)}}function ja(a,b,c){if(ea)o.defineProperty(a,b,{value:c,configurable:k,enumerable:m,writable:k});else a[b]=c}function G(a,b){var c=[],d
|
10
|
+
function ia(a){if(!a.SugarMethods){ja(a,"SugarMethods",{});F(a,m,m,{restore:function(){var b=arguments.length===0,c=G(arguments);H(a.SugarMethods,function(d,e){if(b||c.indexOf(d)>-1)ja(e.va?a.prototype:a,d,e.method)})},extend:function(b,c,d){F(a,d!==m,c,b)}})}}function F(a,b,c,d){var e=b?a.prototype:a,f;ia(a);H(d,function(g,j){f=e[g];if(typeof c==="function")j=ka(e[g],j,c);if(c!==m||!e[g])ja(e,g,j);a.SugarMethods[g]={va:b,method:j,Da:f}})}
|
11
|
+
function I(a,b,c,d,e){var f={};d=D(d)?d.split(","):d;d.forEach(function(g,j){e(f,g,j)});F(a,b,c,f)}function ka(a,b,c){return function(){return a&&(c===k||!c.apply(this,arguments))?a.apply(this,arguments):b.apply(this,arguments)}}function ja(a,b,c){if(ea)o.defineProperty(a,b,{value:c,configurable:k,enumerable:m,writable:k});else a[b]=c}function G(a,b){var c=[],d;for(d=0;d<a.length;d++){c.push(a[d]);b&&b.call(a,a[d],d)}return c}function J(a){return a!==void 0}function K(a){return a===void 0}
|
12
12
|
function la(a){return a&&typeof a==="object"}function L(a){return!!a&&o.prototype.toString.call(a)==="[object Object]"&&"hasOwnProperty"in a}function ma(a,b){return o.hasOwnProperty.call(a,b)}function H(a,b){for(var c in a)if(ma(a,c))if(b.call(a,c,a[c])===m)break}function na(a,b){H(b,function(c){a[c]=b[c]});return a}function M(a){na(this,a)}M.prototype.constructor=o;function N(a,b,c,d){var e=[];a=parseInt(a);for(var f=d<0;!f&&a<=b||f&&a>=b;){e.push(a);c&&c.call(this,a);a+=d||1}return e}
|
13
13
|
function O(a,b,c){c=v[c||"round"];var d=v.pow(10,v.abs(b||0));if(b<0)d=1/d;return c(a*d)/d}function P(a,b){return O(a,b,"floor")}function R(a,b,c,d){d=v.abs(a).toString(d||10);d=oa(b-d.replace(/\.\d+/,"").length,"0")+d;if(c||a<0)d=(a<0?"-":"+")+d;return d}function pa(a){if(a>=11&&a<=13)return"th";else switch(a%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}
|
14
14
|
function qa(){return"\t\n\u000b\u000c\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u2028\u2029\u3000\ufeff"}function oa(a,b){return p(v.max(0,J(a)?a:1)+1).join(b||"")}function ra(a,b){var c=a.toString().match(/[^/]*$/)[0];if(b)c=(c+b).split("").sort().join("").replace(/([gimy])\1+/g,"$1");return c}function S(a){D(a)||(a=t(a));return a.replace(/([\\/'*+?|()\[\]{}.^$])/g,"\\$1")}
|
@@ -19,11 +19,11 @@ F(o,m,m,{keys:function(a){var b=[];if(!la(a)&&!E(a)&&!A(a))throw new TypeError("
|
|
19
19
|
function wa(a,b,c,d){var e=a.length,f=d==-1,g=f?e-1:0;c=isNaN(c)?g:parseInt(c>>0);if(c<0)c=e+c;if(!f&&c<0||f&&c>=e)c=g;for(;f&&c>=0||!f&&c<e;){if(a[c]===b)return c;c+=d}return-1}function xa(a,b,c,d){var e=a.length,f=0,g=J(c);ya(b);if(e==0&&!g)throw new TypeError("Reduce called on empty array with no initial value");else if(g)c=c;else{c=a[d?e-1:f];f++}for(;f<e;){g=d?e-f-1:f;if(g in a)c=b(c,a[g],g,a);f++}return c}function ya(a){if(!a||!a.call)throw new TypeError("Callback is not callable");}
|
20
20
|
function za(a){if(a.length===0)throw new TypeError("First argument must be defined");}F(p,m,m,{isArray:function(a){return fa(a)}});
|
21
21
|
F(p,k,m,{every:function(a,b){var c=this.length,d=0;for(za(arguments);d<c;){if(d in this&&!a.call(b,this[d],d,this))return m;d++}return k},some:function(a,b){var c=this.length,d=0;for(za(arguments);d<c;){if(d in this&&a.call(b,this[d],d,this))return k;d++}return m},map:function(a,b){var c=this.length,d=0,e=Array(c);for(za(arguments);d<c;){if(d in this)e[d]=a.call(b,this[d],d,this);d++}return e},filter:function(a,b){var c=this.length,d=0,e=[];for(za(arguments);d<c;){d in this&&a.call(b,this[d],d,this)&&
|
22
|
-
e.push(this[d]);d++}return e},indexOf:function(a,b){if(D(this))return this.indexOf(a,b);return wa(this,a,b,1)},lastIndexOf:function(a,b){if(D(this))return this.lastIndexOf(a,b);return wa(this,a,b,-1)},forEach:function(a,b){var c=this.length,d=0;for(ya(a);d<c;){d in this&&a.call(b,this[d],d,this);d++}},reduce:function(a,b){return xa(this,a,b)},reduceRight:function(a,b){return xa(this,a,b,k)}});
|
22
|
+
e.push(this[d]);d++}return e},indexOf:function(a,b){if(D(this))return this.indexOf(a,b);return wa(this,a,b,1)},lastIndexOf:function(a,b){if(D(this))return this.lastIndexOf(a,b);return wa(this,a,b,-1)},forEach:function(a,b){var c=this.length,d=0;for(ya(a);d<c;){d in this&&a.call(b,this[d],d,this);d++}},reduce:function(a,b){return xa(this,a,b)},reduceRight:function(a,b){return xa(this,a,b,k)}});
|
23
|
+
F(Function,k,m,{bind:function(a){var b=this,c=G(arguments).slice(1),d;if(!A(this))throw new TypeError("Function.prototype.bind called on a non-function");d=function(){return b.apply(b.prototype&&this instanceof b?this:a,c.concat(G(arguments)))};d.prototype=this.prototype;return d}});F(s,m,m,{now:function(){return(new s).getTime()}});
|
23
24
|
(function(){var a=qa().match(/^\s+$/);try{t.prototype.trim.call([1])}catch(b){a=m}F(t,k,!a,{trim:function(){return this.toString().trimLeft().trimRight()},trimLeft:function(){return this.replace(q("^["+qa()+"]+"),"")},trimRight:function(){return this.replace(q("["+qa()+"]+$"),"")}})})();
|
24
|
-
(function(){var a=m;if(Function.prototype.qa){a=function(){};var b=a.qa();a=new b instanceof b&&!(new a instanceof b)}F(Function,k,!a,{bind:function(c){var d=this,e=G(arguments).slice(1),f,g;if(!A(this))throw new TypeError("Function.prototype.bind called on a non-function");g=function(){return d.apply(d.prototype&&this instanceof d?this:c,e.concat(G(arguments)))};f=function(){};f.prototype=this.prototype;g.prototype=new f;return g}})})();
|
25
25
|
(function(){var a=new s(s.UTC(1999,11,31));a=a.toISOString&&a.toISOString()==="1999-12-31T00:00:00.000Z";I(s,k,!a,"toISOString,toJSON",function(b,c){b[c]=function(){return R(this.getUTCFullYear(),4)+"-"+R(this.getUTCMonth()+1,2)+"-"+R(this.getUTCDate(),2)+"T"+R(this.getUTCHours(),2)+":"+R(this.getUTCMinutes(),2)+":"+R(this.getUTCSeconds(),2)+"."+R(this.getUTCMilliseconds(),3)+"Z"}})})();
|
26
|
-
function Aa(a,b,c,d){var e=k;if(a===b)return k;else if(E(b)&&D(a))return q(b).test(a);else if(A(b))return b.apply(c,d);else if(L(b)&&la(a)){H(b,function(f){Aa(a[f],b[f],c,[a[f],a])||(e=m)});return e}else return ta(a)&&ta(b)?sa(a)===sa(b):a===b}function T(a,b,c,d){return K(b)?a:A(b)?b.apply(c,d||[]):A(a[b])?a[b].call(a):a[b]}
|
26
|
+
function Aa(a,b,c,d){var e=k;if(a===b)return k;else if(E(b)&&D(a))return q(b).test(a);else if(A(b)&&!A(a))return b.apply(c,d);else if(L(b)&&la(a)){H(b,function(f){Aa(a[f],b[f],c,[a[f],a])||(e=m)});return e}else return ta(a)&&ta(b)?sa(a)===sa(b):a===b}function T(a,b,c,d){return K(b)?a:A(b)?b.apply(c,d||[]):A(a[b])?a[b].call(a):a[b]}
|
27
27
|
function U(a,b,c,d){var e,f;if(c<0)c=a.length+c;f=isNaN(c)?0:c;for(c=d===k?a.length+f:a.length;f<c;){e=f%a.length;if(e in a){if(b.call(a,a[e],e,a)===m)break}else return Ba(a,b,f,d);f++}}function Ba(a,b,c){var d=[],e;for(e in a)e in a&&e>>>0==e&&e!=4294967295&&e>=c&&d.push(parseInt(e));d.sort().each(function(f){return b.call(a,a[f],f,a)});return a}function Ca(a,b,c,d,e){var f,g;U(a,function(j,i,h){if(Aa(j,b,h,[j,i,h])){f=j;g=i;return m}},c,d);return e?g:f}
|
28
28
|
function Ea(a,b){var c=[],d={},e;U(a,function(f,g){e=b?T(f,b,a,[f,g,a]):f;Fa(d,e)||c.push(f)});return c}function Ga(a,b,c){var d=[],e={};b.each(function(f){Fa(e,f)});a.each(function(f){var g=sa(f),j=!ta(f);if(Ha(e,g,f,j)!=c){var i=0;if(j)for(g=e[g];i<g.length;)if(g[i]===f)g.splice(i,1);else i+=1;else delete e[g];d.push(f)}});return d}function Ia(a,b,c){b=b||Infinity;c=c||0;var d=[];U(a,function(e){if(fa(e)&&c<b)d=d.concat(Ia(e,b,c+1));else d.push(e)});return d}
|
29
29
|
function Ja(a){var b=[];G(a,function(c){b=b.concat(c)});return b}function Ha(a,b,c,d){var e=b in a;if(d){a[b]||(a[b]=[]);e=a[b].indexOf(c)!==-1}return e}function Fa(a,b){var c=sa(b),d=!ta(b),e=Ha(a,c,b,d);if(d)a[c].push(b);else a[c]=b;return e}function Ka(a,b,c,d){var e,f=[],g=c==="max",j=c==="min",i=Array.isArray(a);H(a,function(h){var n=a[h];h=T(n,b,a,i?[n,parseInt(h),a]:[]);if(h===e)f.push(n);else if(K(e)||g&&h>e||j&&h<e){f=[n];e=h}});i||(f=Ia(f,1));return d?f:f[0]}
|
@@ -43,23 +43,23 @@ var V,Ua,Va=["ampm","hour","minute","second","ampm","utc","offset_sign","offset_
|
|
43
43
|
{ba:"hh?|hours|12hr",format:function(a){a=W(a,"Hours");return a===0?12:a-P(a/13)*12}},{ba:"HH?|24hr",format:function(a){return W(a,"Hours")}},{ba:"dd?|date|day",format:function(a){return W(a,"Date")}},{ba:"dow|weekday",la:k,format:function(a,b,c){a=W(a,"Day");return b.weekdays[a+(c-1)*7]}},{ba:"MM?",format:function(a){return W(a,"Month")+1}},{ba:"mon|month",la:k,format:function(a,b,c){a=W(a,"Month");return b.months[a+(c-1)*12]}},{ba:"y{2,4}|year",format:function(a){return W(a,"FullYear")}},{ba:"[Tt]{1,2}",
|
44
44
|
format:function(a,b,c,d){a=W(a,"Hours");b=b.ampm[P(a/12)];if(d.length===1)b=b.slice(0,1);if(d.slice(0,1)==="T")b=b.toUpperCase();return b}},{ba:"z{1,4}|tz|timezone",text:k,format:function(a,b,c,d){a=a.getUTCOffset();if(d=="z"||d=="zz")a=a.replace(/(\d{2})(\d{2})/,function(e,f){return R(f,d.length)});return a}},{ba:"iso(tz|timezone)",format:function(a){return a.getUTCOffset(k)}},{ba:"ord",format:function(a){a=W(a,"Date");return a+pa(a)}}],cb=[{$:"year",method:"FullYear",ja:k,da:function(a){return(365+
|
45
45
|
(a?a.isLeapYear()?1:0:0.25))*24*60*60*1E3}},{$:"month",method:"Month",ja:k,da:function(a,b){var c=30.4375,d;if(a){d=a.daysInMonth();if(b<=d.days())c=d}return c*24*60*60*1E3}},{$:"week",method:"Week",da:aa(6048E5)},{$:"day",method:"Date",ja:k,da:aa(864E5)},{$:"hour",method:"Hours",da:aa(36E5)},{$:"minute",method:"Minutes",da:aa(6E4)},{$:"second",method:"Seconds",da:aa(1E3)},{$:"millisecond",method:"Milliseconds",da:aa(1)}],db={};function eb(a){na(this,a);this.ga=ab.concat()}
|
46
|
-
eb.prototype={getMonth:function(a){return B(a)?a-1:this.months.indexOf(a)%12},getWeekday:function(a){return this.weekdays.indexOf(a)%7},oa:function(a){var b;return B(a)?a:a&&(b=this.numbers.indexOf(a))!==-1?(b+1)%10:1},
|
47
|
-
return a==="en"||a==="en-US"?k:this.variant},
|
48
|
-
function(i,h){switch(h){case "num":return c;case "unit":return g;case "sign":return f.src}})},
|
46
|
+
eb.prototype={getMonth:function(a){return B(a)?a-1:this.months.indexOf(a)%12},getWeekday:function(a){return this.weekdays.indexOf(a)%7},oa:function(a){var b;return B(a)?a:a&&(b=this.numbers.indexOf(a))!==-1?(b+1)%10:1},ta:function(a){var b=this;return a.replace(q(this.num,"g"),function(c){return b.oa(c)||""})},ra:function(a){return V.units[this.units.indexOf(a)%8]},Aa:function(a){return this.na(a,a[2]>0?"future":"past")},qa:function(a){return this.na(fb(a),"duration")},ua:function(a){a=a||this.code;
|
47
|
+
return a==="en"||a==="en-US"?k:this.variant},xa:function(a){return a===this.ampm[0]},ya:function(a){return a===this.ampm[1]},na:function(a,b){var c=a[0],d=a[1],e=a[2],f,g,j;if(this.code=="ru"){j=c.toString().slice(-1);switch(k){case j==1:j=1;break;case j>=2&&j<=4:j=2;break;default:j=3}}else j=this.plural&&c>1?1:0;g=this.units[j*8+d]||this.units[d];if(this.capitalizeUnit)g=gb(g);f=this.modifiers.filter(function(i){return i.name=="sign"&&i.value==(e>0?1:-1)})[0];return this[b].replace(/\{(.*?)\}/g,
|
48
|
+
function(i,h){switch(h){case "num":return c;case "unit":return g;case "sign":return f.src}})},sa:function(){return this.ma?[this.ma].concat(this.ga):this.ga},addFormat:function(a,b,c,d,e){var f=c||[],g=this,j;a=a.replace(/\s+/g,"[-,. ]*");a=a.replace(/\{([^,]+?)\}/g,function(i,h){var n=h.match(/\?$/),r=h.match(/(\d)(?:-(\d))?/),y=h.match(/^\d+$/),z=h.replace(/[^a-z]+$/,""),C,ca;if(y)C=g.optionals[y[0]];else if(g[z])C=g[z];else if(g[z+"s"]){C=g[z+"s"];if(r){ca=[];C.forEach(function(da,Da){var Q=Da%
|
49
49
|
(g.units?8:C.length);if(Q>=r[1]&&Q<=(r[2]||r[1]))ca.push(da)});C=ca}C=hb(C)}if(y)return"(?:"+C+")?";else{c||f.push(z);return"("+C+")"+(n?"?":"")}});if(b){b=ib(Wa,g,e);e=["t","[\\s\\u3000]"].concat(g.timeMarker);j=a.match(/\\d\{\d,\d\}\)+\??$/);jb(g,"(?:"+b+")[,\\s\\u3000]+?"+a,Va.concat(f),d);jb(g,a+"(?:[,\\s]*(?:"+e.join("|")+(j?"+":"*")+")"+b+")?",f.concat(Va),d)}else jb(g,a,f,d)}};
|
50
50
|
function kb(a,b){var c;D(a)||(a="");c=db[a]||db[a.slice(0,2)];if(b===m&&!c)throw Error("Invalid locale.");return c||Ua}
|
51
51
|
function lb(a,b){function c(i){var h=g[i];if(D(h))g[i]=h.split(",");else h||(g[i]=[])}function d(i,h){i=i.split("+").map(function(n){return n.replace(/(.+):(.+)$/,function(r,y,z){return z.split("|").map(function(C){return y+C}).join("|")})}).join("|");return i.split("|").forEach(h)}function e(i,h,n){var r=[];g[i].forEach(function(y,z){if(h)y+="+"+y.slice(0,3);d(y,function(C,ca){r[ca*n+z]=C.toLowerCase()})});g[i]=r}function f(i,h,n){i="\\d{"+i+","+h+"}";if(n)i+="|(?:"+hb(g.numbers)+")+";return i}var g,
|
52
52
|
j;g=new eb(b);c("modifiers");"months,weekdays,units,numbers,articles,optionals,timeMarker,ampm,timeSuffixes,dateParse,timeParse".split(",").forEach(c);j=!g.monthSuffix;e("months",j,12);e("weekdays",j,7);e("units",m,8);e("numbers",m,10);g.code=a;g.date=f(1,2,g.digitDate);g.year=f(4,4);g.num=function(){var i=["\\d+"].concat(g.articles);if(g.numbers)i=i.concat(g.numbers);return hb(i)}();(function(){var i=[];g.ha={};g.modifiers.forEach(function(h){var n=h.name;d(h.src,function(r){var y=g[n];g.ha[r]=h;
|
53
53
|
i.push({name:n,src:r,value:h.value});g[n]=y?y+"|"+r:r})});g.day+="|"+hb(g.weekdays);g.modifiers=i})();if(g.monthSuffix){g.month=f(1,2);g.months=N(1,12).map(function(i){return i+g.monthSuffix})}g.full_month=f(1,2)+"|"+hb(g.months);g.timeSuffixes.length>0&&g.addFormat(ib(Wa,g),m,Va);g.addFormat("{day}",k);g.addFormat("{month}"+(g.monthSuffix||""));g.addFormat("{year}"+(g.yearSuffix||""));g.timeParse.forEach(function(i){g.addFormat(i,k)});g.dateParse.forEach(function(i){g.addFormat(i)});return db[a]=
|
54
|
-
g}function jb(a,b,c,d){a.ga.unshift({
|
55
|
-
function nb(a,b){var c={};if(match=a.match(/^(\d+)?\s?(\w+?)s?$/i)){if(K(b))b=parseInt(match[1])||1;c[match[2].toLowerCase()]=b}return c}function ob(a,b){var c={},d,e;b.forEach(function(f,g){d=a[g+1];if(!(K(d)||d==="")){if(f==="year")c.
|
54
|
+
g}function jb(a,b,c,d){a.ga.unshift({Ba:d,wa:a,za:q("^"+b+"$","i"),to:c})}function gb(a){return a.slice(0,1).toUpperCase()+a.slice(1)}function hb(a){return a.filter(function(b){return!!b}).join("|")}function mb(a,b){var c;if(L(a[0]))return a;else if(B(a[0])&&!B(a[1]))return[a[0]];else if(D(a[0])&&b)return[nb(a[0]),a[1]];c={};Za.forEach(function(d,e){c[d.$]=a[e]});return[c]}
|
55
|
+
function nb(a,b){var c={};if(match=a.match(/^(\d+)?\s?(\w+?)s?$/i)){if(K(b))b=parseInt(match[1])||1;c[match[2].toLowerCase()]=b}return c}function ob(a,b){var c={},d,e;b.forEach(function(f,g){d=a[g+1];if(!(K(d)||d==="")){if(f==="year")c.Ca=d;e=parseFloat(d.replace(/,/,"."));c[f]=!isNaN(e)?e:d.toLowerCase()}});return c}function pb(a){a=a.trim().replace(/^(just )?now|\.+$/i,"");return qb(a)}
|
56
56
|
function qb(a){return a.replace(Ya,function(b,c,d){var e=0,f=1,g,j;if(c)return b;d.split("").reverse().forEach(function(i){i=Xa[i];var h=i>9;if(h){if(g)e+=f;f*=i/(j||1);j=i}else{if(g===m)f*=10;e+=f*i}g=h});if(g)e+=f;return e})}
|
57
|
-
function rb(a,b,c,d){var e=new s,f=m,g,j,i,h,n,r,y,z,C;e.utc(d);if(ha(a))e=a.clone();else if(B(a))e=new s(a);else if(L(a)){e.set(a,k);h=a}else if(D(a)){g=kb(b);a=pb(a);g&&H(g.
|
58
|
-
j.getMonth(h.month);if(h.shift&&!h.unit)h.unit=j.units[7]}if(h.weekday&&h.date)delete h.weekday;else if(h.weekday){h.weekday=j.getWeekday(h.weekday);if(h.shift&&!h.unit)h.unit=j.units[5]}if(h.day&&(z=j.ha[h.day])){h.day=z.value;e.reset();f=k}else if(h.day&&(r=j.getWeekday(h.day))>-1){delete h.day;if(h.num&&h.month){C=function(){var Q=e.getWeekday();e.setWeekday(7*(h.num-1)+(Q>r?r+7:r))};h.day=1}else h.weekday=r}if(h.date&&!B(h.date))h.date=j.
|
59
|
-
h.hour===12)h.hour=0;if("offset_hours"in h||"offset_minutes"in h){e.utc();h.offset_minutes=h.offset_minutes||0;h.offset_minutes+=h.offset_hours*60;if(h.offset_sign==="-")h.offset_minutes*=-1;h.minute-=h.offset_minutes}if(h.unit){f=k;y=j.oa(h.num);n=j.
|
57
|
+
function rb(a,b,c,d){var e=new s,f=m,g,j,i,h,n,r,y,z,C;e.utc(d);if(ha(a))e=a.clone();else if(B(a))e=new s(a);else if(L(a)){e.set(a,k);h=a}else if(D(a)){g=kb(b);a=pb(a);g&&H(g.sa(),function(ca,da){var Da=a.match(da.za);if(Da){i=da;j=i.wa;h=ob(Da,i.to,j);h.utc&&e.utc();j.ma=i;if(h.timestamp){h=h.timestamp;return m}if(i.Ba&&!D(h.month)&&(D(h.date)||g.ua(b))){z=h.month;h.month=h.date;h.date=z}if(h.year&&h.Ca.length===2)h.year=O(W(new s,"FullYear")/100)*100-O(h.year/100)*100+h.year;if(h.month){h.month=
|
58
|
+
j.getMonth(h.month);if(h.shift&&!h.unit)h.unit=j.units[7]}if(h.weekday&&h.date)delete h.weekday;else if(h.weekday){h.weekday=j.getWeekday(h.weekday);if(h.shift&&!h.unit)h.unit=j.units[5]}if(h.day&&(z=j.ha[h.day])){h.day=z.value;e.reset();f=k}else if(h.day&&(r=j.getWeekday(h.day))>-1){delete h.day;if(h.num&&h.month){C=function(){var Q=e.getWeekday();e.setWeekday(7*(h.num-1)+(Q>r?r+7:r))};h.day=1}else h.weekday=r}if(h.date&&!B(h.date))h.date=j.ta(h.date);if(j.ya(h.ampm)&&h.hour<12)h.hour+=12;else if(j.xa(h.ampm)&&
|
59
|
+
h.hour===12)h.hour=0;if("offset_hours"in h||"offset_minutes"in h){e.utc();h.offset_minutes=h.offset_minutes||0;h.offset_minutes+=h.offset_hours*60;if(h.offset_sign==="-")h.offset_minutes*=-1;h.minute-=h.offset_minutes}if(h.unit){f=k;y=j.oa(h.num);n=j.ra(h.unit);if(h.shift||h.edge){y*=(z=j.ha[h.shift])?z.value:0;if(n==="month"&&J(h.date)){e.set({day:h.date},k);delete h.date}if(n==="year"&&J(h.month)){e.set({month:h.month,day:h.date},k);delete h.month;delete h.date}}if(h.sign&&(z=j.ha[h.sign]))y*=z.value;
|
60
60
|
if(J(h.weekday)){e.set({weekday:h.weekday},k);delete h.weekday}h[n]=(h[n]||0)+y}if(h.year_sign==="-")h.year*=-1;$a.slice(1,4).forEach(function(Q,Ub){var zb=h[Q.$],Ab=zb%1;if(Ab){h[$a[Ub].$]=O(Ab*(Q.$==="second"?1E3:60));h[Q.$]=P(zb)}});return m}});if(i)if(f)e.advance(h);else{e._utc&&e.reset();sb(e,h,k,m,c)}else e=a?new s(a):new s;if(h&&h.edge){z=j.ha[h.edge];H($a.slice(4),function(ca,da){if(J(h[da.$])){n=da.$;return m}});if(n==="year")h.fa="month";else if(n==="month"||n==="week")h.fa="day";e[(z.value<
|
61
|
-
0?"endOf":"beginningOf")+gb(n)]();z.value===-2&&e.reset()}C&&C()}return{ea:e,set:h}}function fb(a){var b,c=v.abs(a),d=c,e=0;$a.slice(1).forEach(function(f,g){b=P(O(c/f.da()*10)/10);if(b>=1){d=b;e=g+1}});return[d,e,a]}
|
62
|
-
function tb(a,b,c,d){var e,f=kb(d),g=q(/^[A-Z]/);if(a.isValid())if(Date[b])b=Date[b];else{if(A(b)){e=fb(a.millisecondsFromNow());b=b.apply(a,e.concat(f))}}else return"Invalid Date";if(!b&&c){e=e||fb(a.millisecondsFromNow());if(e[1]===0){e[1]=1;e[0]=1}return f.
|
61
|
+
0?"endOf":"beginningOf")+gb(n)]();z.value===-2&&e.reset()}C&&C()}d||e.utc(m);return{ea:e,set:h}}function fb(a){var b,c=v.abs(a),d=c,e=0;$a.slice(1).forEach(function(f,g){b=P(O(c/f.da()*10)/10);if(b>=1){d=b;e=g+1}});return[d,e,a]}
|
62
|
+
function tb(a,b,c,d){var e,f=kb(d),g=q(/^[A-Z]/);if(a.isValid())if(Date[b])b=Date[b];else{if(A(b)){e=fb(a.millisecondsFromNow());b=b.apply(a,e.concat(f))}}else return"Invalid Date";if(!b&&c){e=e||fb(a.millisecondsFromNow());if(e[1]===0){e[1]=1;e[0]=1}return f.Aa(e)}b=b||"long";b=f[b]||b;bb.forEach(function(j){b=b.replace(q("\\{("+j.ba+")(\\d)?\\}",j.la?"i":""),function(i,h,n){i=j.format(a,f,n||1,h);n=h.length;var r=h.match(/^(.)\1+$/);if(j.la){if(n===3)i=i.slice(0,3);if(r||h.match(g))i=gb(i)}else if(r&&
|
63
63
|
!j.text)i=(B(i)?R(i,n):i.toString()).slice(-n);return i})});return b}
|
64
64
|
function ub(a,b,c,d){var e=rb(b,l,l,d),f=0;d=b=0;var g;if(c>0){b=d=c;g=k}if(!e.ea.isValid())return m;if(e.set&&e.set.fa){cb.forEach(function(i){if(i.$===e.set.fa)f=i.da(e.ea,a-e.ea)-1});c=gb(e.set.fa);if(e.set.edge||e.set.shift)e.ea["beginningOf"+c]();if(e.set.fa==="month")j=e.ea.clone()["endOf"+c]().getTime();if(!g&&e.set.sign&&e.set.fa!="millisecond"){b=50;d=-50}}g=a.getTime();c=e.ea.getTime();var j=j||c+f;return g>=c-b&&g<=j+d}
|
65
65
|
function sb(a,b,c,d,e){function f(i){return J(b[i])?b[i]:b[i+"s"]}var g,j;if(B(b)&&d)b={milliseconds:b};else if(B(b)){a.setTime(b);return a}if(b.date)b.day=b.date;H($a,function(i,h){var n=h.$==="day";if(J(f(h.$))||n&&J(f("weekday"))){b.fa=h.$;j=+i;return m}else if(c&&h.$!=="week"&&(!n||!J(f("week"))))X(a,h.method,n?1:0)});cb.forEach(function(i){var h=i.$;i=i.method;var n;n=f(h);if(!K(n)){if(d){if(h==="week"){n=(b.day||0)+n*7;i="Date"}n=n*d+W(a,i)}else h==="month"&&J(f("day"))&&X(a,"Date",15);X(a,
|
@@ -71,7 +71,7 @@ return R(O(-b/60),2,k)+c+R(b%60,2)},utc:function(a){this._utc=a===k||arguments.l
|
|
71
71
|
0)},isBetween:function(a,b,c){var d=this.getTime();a=s.create(a).getTime();var e=s.create(b).getTime();b=v.min(a,e);a=v.max(a,e);c=c||0;return b-c<d&&a+c>d},isLeapYear:function(){var a=W(this,"FullYear");return a%4===0&&a%100!==0||a%400===0},daysInMonth:function(){return 32-W(new s(W(this,"FullYear"),W(this,"Month"),32),"Date")},format:function(a,b){return tb(this,a,m,b)},relative:function(a,b){if(D(a)){b=a;a=l}return tb(this,a,k,b)},is:function(a,b,c){var d,e;if(this.isValid()){if(D(a)){a=a.trim().toLowerCase();
|
72
72
|
e=this.clone().utc(c);switch(k){case a==="future":return this.getTime()>(new s).getTime();case a==="past":return this.getTime()<(new s).getTime();case a==="weekday":return W(e,"Day")>0&&W(e,"Day")<6;case a==="weekend":return W(e,"Day")===0||W(e,"Day")===6;case (d=V.weekdays.indexOf(a)%7)>-1:return W(e,"Day")===d;case (d=V.months.indexOf(a)%12)>-1:return W(e,"Month")===d}}return ub(this,a,b,c)}},reset:function(a){var b={},c;a=a||"hours";if(a==="date")a="days";c=cb.some(function(d){return a===d.$||
|
73
73
|
a===d.$+"s"});b[a]=a.match(/^days?/)?1:0;return c?this.set(b,k):this},clone:function(){var a=new s(this.getTime());a._utc=this._utc;return a}});s.extend({iso:function(){return this.toISOString()},getWeekday:s.prototype.getDay,getUTCWeekday:s.prototype.getUTCDay});
|
74
|
-
function wb(a,b){function c(){return O(this*b)}function d(){return vb(arguments)[a.ia](this)}function e(){return vb(arguments)[a.ia](-this)}var f=a.$,g={};g[f]=c;g[f+"s"]=c;g[f+"Before"]=e;g[f+"sBefore"]=e;g[f+"Ago"]=e;g[f+"sAgo"]=e;g[f+"After"]=d;g[f+"sAfter"]=d;g[f+"FromNow"]=d;g[f+"sFromNow"]=d;u.extend(g)}u.extend({duration:function(a){return kb(a).
|
74
|
+
function wb(a,b){function c(){return O(this*b)}function d(){return vb(arguments)[a.ia](this)}function e(){return vb(arguments)[a.ia](-this)}var f=a.$,g={};g[f]=c;g[f+"s"]=c;g[f+"Before"]=e;g[f+"sBefore"]=e;g[f+"Ago"]=e;g[f+"sAgo"]=e;g[f+"After"]=d;g[f+"sAfter"]=d;g[f+"FromNow"]=d;g[f+"sFromNow"]=d;u.extend(g)}u.extend({duration:function(a){return kb(a).qa(this)}});
|
75
75
|
V=Ua=s.addLocale("en",{plural:k,timeMarker:"at",ampm:"am,pm",months:"January,February,March,April,May,June,July,August,September,October,November,December",weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",units:"millisecond:|s,second:|s,minute:|s,hour:|s,day:|s,week:|s,month:|s,year:|s",numbers:"one,two,three,four,five,six,seven,eight,nine,ten",articles:"a,an,the",optionals:"the,st|nd|rd|th,of","short":"{Month} {d}, {yyyy}","long":"{Month} {d}, {yyyy} {h}:{mm}{tt}",full:"{Weekday} {Month} {d}, {yyyy} {h}:{mm}:{ss}{tt}",
|
76
76
|
past:"{num} {unit} {sign}",future:"{num} {unit} {sign}",duration:"{num} {unit}",modifiers:[{name:"day",src:"yesterday",value:-1},{name:"day",src:"today",value:0},{name:"day",src:"tomorrow",value:1},{name:"sign",src:"ago|before",value:-1},{name:"sign",src:"from now|after|from|in",value:1},{name:"edge",src:"last day",value:-2},{name:"edge",src:"end",value:-1},{name:"edge",src:"first day|beginning",value:1},{name:"shift",src:"last",value:-1},{name:"shift",src:"the|this",value:0},{name:"shift",src:"next",
|
77
77
|
value:1}],dateParse:["{num} {unit} {sign}","{sign} {num} {unit}","{num} {unit=4-5} {sign} {day}","{month} {year}","{shift} {unit=5-7}","{0} {edge} of {shift?} {unit=4-7?}{month?}{year?}"],timeParse:["{0} {num}{1} {day} of {month} {year?}","{weekday?} {month} {date}{1} {year?}","{date} {month} {year}","{shift} {weekday}","{shift} week {weekday}","{weekday} {2} {shift} week","{0} {date}{1} of {month}","{0}{month?} {date?}{1} of {shift} {unit=6-7}"]});$a=cb.concat().reverse();Za=cb.concat();
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugar-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -123,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
123
|
version: '0'
|
124
124
|
segments:
|
125
125
|
- 0
|
126
|
-
hash:
|
126
|
+
hash: 2781525137147057059
|
127
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
128
|
none: false
|
129
129
|
requirements:
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
version: '0'
|
133
133
|
segments:
|
134
134
|
- 0
|
135
|
-
hash:
|
135
|
+
hash: 2781525137147057059
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
138
|
rubygems_version: 1.8.24
|