forked from dangrossman/daterangepicker
-
Notifications
You must be signed in to change notification settings - Fork 6
/
sugar.min.js
120 lines (120 loc) · 44.3 KB
/
sugar.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
* Sugar Library v1.3.8
*
* Freely distributable and licensed under the MIT-style license.
* Copyright (c) 2013 Andrew Plummer
* http://sugarjs.com/
*
* ---------------------------- */
(function(){var k=true,l=null,n=false;function aa(a){return function(){return a}}var p=Object,q=Array,r=RegExp,s=Date,t=String,u=Number,v=Math,ba=typeof global!=="undefined"?global:this,ca={},da=p.defineProperty&&p.defineProperties,w="Array,Boolean,Date,Function,Number,String,RegExp".split(","),ea=y(w[0]),fa=y(w[1]),ga=y(w[2]),A=y(w[3]),B=y(w[4]),C=y(w[5]),D=y(w[6]);
function y(a){var b,c;if(/String|Number|Boolean/.test(a))b=a.toLowerCase();c=a==="Array"&&q.isArray||function(d){if(b&&typeof d===b)return k;return p.prototype.toString.call(d)==="[object "+a+"]"};return ca[a]=c}
function ha(a){if(!a.SugarMethods){E(a,"SugarMethods",{});F(a,n,n,{extend:function(b,c,d){F(a,d!==n,c,b)},sugarRestore:function(){return ia(a,arguments,function(b,c,d){E(b,c,d.method)})},sugarRevert:function(){return ia(a,arguments,function(b,c,d){if(d.qa)E(b,c,d.Ba);else delete b[c]})}})}}function F(a,b,c,d){var e=b?a.prototype:a;ha(a);G(d,function(f,h){var i=e[f],j=H(e,f);if(typeof c==="function")h=ja(e[f],h,c);if(c!==n||!e[f])E(e,f,h);a.SugarMethods[f]={xa:b,method:h,Ba:i,qa:j}})}
function I(a,b,c,d,e){var f={};d=C(d)?d.split(","):d;d.forEach(function(h,i){e(f,h,i)});F(a,b,c,f)}function ia(a,b,c){var d=b.length===0,e=K(b),f=n;G(a.SugarMethods,function(h,i){if(d||e.indexOf(h)>-1){f=k;c(i.xa?a.prototype:a,h,i)}});return f}function ja(a,b,c){return function(){return(a&&(c===k||!c.apply(this,arguments))?a:b).apply(this,arguments)}}function E(a,b,c){if(da)p.defineProperty(a,b,{value:c,configurable:k,enumerable:n,writable:k});else a[b]=c}
function K(a,b){var c=[],d,e;d=0;for(e=a.length;d<e;d++){c.push(a[d]);b&&b.call(a,a[d],d)}return c}function ka(a,b,c){K(q.prototype.concat.apply([],q.prototype.slice.call(a,c||0)),b)}function la(a){if(!a||!a.call)throw new TypeError("Callback is not callable");}function L(a){return a!==void 0}function N(a){return a===void 0}function ma(a){return a&&typeof a==="object"}function na(a){return!!a&&p.prototype.toString.call(a)==="[object Object]"&&"hasOwnProperty"in a}
function H(a,b){return p.hasOwnProperty.call(a,b)}function G(a,b){for(var c in a)if(H(a,c))if(b.call(a,c,a[c],a)===n)break}function oa(a,b){G(b,function(c){a[c]=b[c]});return a}function pa(a){oa(this,a)}pa.prototype.constructor=p;function qa(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}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 ra(a,b){return O(a,b,"floor")}
function P(a,b,c,d){d=v.abs(a).toString(d||10);d=sa(b-d.replace(/\.\d+/,"").length,"0")+d;if(c||a<0)d=(a<0?"-":"+")+d;return d}function ta(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"}}function ua(){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 sa(a,b){return q(v.max(0,L(a)?a:1)+1).join(b||"")}
function va(a,b){var c=a.toString().match(/[^/]*$/)[0];if(b)c=(c+b).split("").sort().join("").replace(/([gimy])\1+/g,"$1");return c}function R(a){C(a)||(a=t(a));return a.replace(/([\\/'*+?|()\[\]{}.^$])/g,"\\$1")}
function wa(a,b){var c=typeof a,d,e,f,h,i,j,g;if(c==="string")return a;f=p.prototype.toString.call(a);d=na(a);e=f==="[object Array]";if(a!=l&&d||e){b||(b=[]);if(b.length>1)for(j=b.length;j--;)if(b[j]===a)return"CYC";b.push(a);d=t(a.constructor);h=e?a:p.keys(a).sort();j=0;for(g=h.length;j<g;j++){i=e?j:h[j];d+=i+wa(a[i],b)}b.pop()}else d=1/a===-Infinity?"-0":t(a&&a.valueOf?a.valueOf():a);return c+f+d}
function xa(a){return/^\[object Date|Array|String|Number|RegExp|Boolean|Arguments\]$/.test(p.prototype.toString.call(a))||na(a)}function ya(a,b,c){var d=[],e=a.length,f=b[b.length-1]!==n,h;K(b,function(i){if(fa(i))return n;if(f){i%=e;if(i<0)i=e+i}h=c?a.charAt(i)||"":a[i];d.push(h)});return d.length<2?d[0]:d}function za(a,b){I(b,k,n,a,function(c,d){c[d+(d==="equal"?"s":"")]=function(){return p[d].apply(l,[this].concat(K(arguments)))}})}ha(p);G(w,function(a,b){ha(ba[b])});
F(p,n,n,{keys:function(a){var b=[];if(!ma(a)&&!D(a)&&!A(a))throw new TypeError("Object required");G(a,function(c){b.push(c)});return b}});function Aa(a,b,c,d){var e=a.length,f=d==-1,h=f?e-1:0;c=isNaN(c)?h:parseInt(c>>0);if(c<0)c=e+c;if(!f&&c<0||f&&c>=e)c=h;for(;f&&c>=0||!f&&c<e;){if(a[c]===b)return c;c+=d}return-1}
function Ba(a,b,c,d){var e=a.length,f=0,h=L(c);la(b);if(e==0&&!h)throw new TypeError("Reduce called on empty array with no initial value");else if(h)c=c;else{c=a[d?e-1:f];f++}for(;f<e;){h=d?e-f-1:f;if(h in a)c=b(c,a[h],h,a);f++}return c}function Ca(a){if(a.length===0)throw new TypeError("First argument must be defined");}F(q,n,n,{isArray:function(a){return ea(a)}});
F(q,k,n,{every:function(a,b){var c=this.length,d=0;for(Ca(arguments);d<c;){if(d in this&&!a.call(b,this[d],d,this))return n;d++}return k},some:function(a,b){var c=this.length,d=0;for(Ca(arguments);d<c;){if(d in this&&a.call(b,this[d],d,this))return k;d++}return n},map:function(a,b){var c=this.length,d=0,e=Array(c);for(Ca(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(Ca(arguments);d<c;){d in this&&a.call(b,this[d],d,this)&&
e.push(this[d]);d++}return e},indexOf:function(a,b){if(C(this))return this.indexOf(a,b);return Aa(this,a,b,1)},lastIndexOf:function(a,b){if(C(this))return this.lastIndexOf(a,b);return Aa(this,a,b,-1)},forEach:function(a,b){var c=this.length,d=0;for(la(a);d<c;){d in this&&a.call(b,this[d],d,this);d++}},reduce:function(a,b){return Ba(this,a,b)},reduceRight:function(a,b){return Ba(this,a,b,k)}});
F(Function,k,n,{bind:function(a){var b=this,c=K(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(K(arguments)))};d.prototype=this.prototype;return d}});F(s,n,n,{now:function(){return(new s).getTime()}});
(function(){var a=ua().match(/^\s+$/);try{t.prototype.trim.call([1])}catch(b){a=n}F(t,k,!a,{trim:function(){return this.toString().trimLeft().trimRight()},trimLeft:function(){return this.replace(r("^["+ua()+"]+"),"")},trimRight:function(){return this.replace(r("["+ua()+"]+$"),"")}})})();
(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 P(this.getUTCFullYear(),4)+"-"+P(this.getUTCMonth()+1,2)+"-"+P(this.getUTCDate(),2)+"T"+P(this.getUTCHours(),2)+":"+P(this.getUTCMinutes(),2)+":"+P(this.getUTCSeconds(),2)+"."+P(this.getUTCMilliseconds(),3)+"Z"}})})();
function Ea(a,b,c,d){var e=k;if(a===b)return k;else if(D(b)&&C(a))return r(b).test(a);else if(A(b))return b.apply(c,d);else if(na(b)&&ma(a)){G(b,function(f){Ea(a[f],b[f],c,[a[f],a])||(e=n)});return e}else return xa(a)&&xa(b)?wa(a)===wa(b):a===b}function S(a,b,c,d){return N(b)?a:A(b)?b.apply(c,d||[]):A(a[b])?a[b].call(a):a[b]}
function T(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)===n)break}else return Fa(a,b,f,d);f++}}function Fa(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 Ga(a,b,c,d,e){var f,h;T(a,function(i,j,g){if(Ea(i,b,g,[i,j,g])){f=i;h=j;return n}},c,d);return e?h:f}
function Ha(a,b){var c=[],d={},e;T(a,function(f,h){e=b?S(f,b,a,[f,h,a]):f;Ia(d,e)||c.push(f)});return c}function Ja(a,b,c){var d=[],e={};b.each(function(f){Ia(e,f)});a.each(function(f){var h=wa(f),i=!xa(f);if(Ka(e,h,f,i)!=c){var j=0;if(i)for(h=e[h];j<h.length;)if(h[j]===f)h.splice(j,1);else j+=1;else delete e[h];d.push(f)}});return d}function La(a,b,c){b=b||Infinity;c=c||0;var d=[];T(a,function(e){if(ea(e)&&c<b)d=d.concat(La(e,b,c+1));else d.push(e)});return d}
function Ma(a){var b=[];K(a,function(c){b=b.concat(c)});return b}function Ka(a,b,c,d){var e=b in a;if(d){a[b]||(a[b]=[]);e=a[b].indexOf(c)!==-1}return e}function Ia(a,b){var c=wa(b),d=!xa(b),e=Ka(a,c,b,d);if(d)a[c].push(b);else a[c]=b;return e}
function Na(a,b,c,d){var e,f=[],h=c==="max",i=c==="min",j=Array.isArray(a);G(a,function(g){var m=a[g];g=S(m,b,a,j?[m,parseInt(g),a]:[]);if(N(g))throw new TypeError("Cannot compare with undefined");if(g===e)f.push(m);else if(N(e)||h&&g>e||i&&g<e){f=[m];e=g}});j||(f=La(f,1));return d?f:f[0]}function Oa(a){if(q[Pa])a=a.toLowerCase();return a.replace(q[Qa],"")}function Ra(a,b){var c=a.charAt(b);return(q[Sa]||{})[c]||c}function Ta(a){var b=q[Ua];return a?b.indexOf(a):l}
var Ua="AlphanumericSortOrder",Qa="AlphanumericSortIgnore",Pa="AlphanumericSortIgnoreCase",Sa="AlphanumericSortEquivalents";F(q,n,n,{create:function(){var a=[],b;K(arguments,function(c){if(ma(c))try{b=q.prototype.slice.call(c,0);if(b.length>0)c=b}catch(d){}a=a.concat(c)});return a}});
F(q,k,n,{find:function(a,b,c){return Ga(this,a,b,c)},findAll:function(a,b,c){var d=[];T(this,function(e,f,h){Ea(e,a,h,[e,f,h])&&d.push(e)},b,c);return d},findIndex:function(a,b,c){a=Ga(this,a,b,c,k);return N(a)?-1:a},count:function(a){if(N(a))return this.length;return this.findAll(a).length},removeAt:function(a,b){var c,d;if(N(a))return this;if(N(b))b=a;c=0;for(d=b-a;c<=d;c++)this.splice(a,1);return this},include:function(a,b){return this.clone().add(a,b)},exclude:function(){return q.prototype.remove.apply(this.clone(),
arguments)},clone:function(){return oa([],this)},unique:function(a){return Ha(this,a)},flatten:function(a){return La(this,a)},union:function(){return Ha(this.concat(Ma(arguments)))},intersect:function(){return Ja(this,Ma(arguments),n)},subtract:function(){return Ja(this,Ma(arguments),k)},at:function(){return ya(this,arguments)},first:function(a){if(N(a))return this[0];if(a<0)a=0;return this.slice(0,a)},last:function(a){if(N(a))return this[this.length-1];return this.slice(this.length-a<0?0:this.length-
a)},from:function(a){return this.slice(a)},to:function(a){if(N(a))a=this.length;return this.slice(0,a)},min:function(a,b){return Na(this,a,"min",b)},max:function(a,b){return Na(this,a,"max",b)},least:function(a,b){return Na(this.groupBy.apply(this,[a]),"length","min",b)},most:function(a,b){return Na(this.groupBy.apply(this,[a]),"length","max",b)},sum:function(a){a=a?this.map(a):this;return a.length>0?a.reduce(function(b,c){return b+c}):0},average:function(a){a=a?this.map(a):this;return a.length>0?
a.sum()/a.length:0},inGroups:function(a,b){var c=arguments.length>1,d=this,e=[],f=O(this.length/a,void 0,"ceil");qa(0,a-1,function(h){h=h*f;var i=d.slice(h,h+f);c&&i.length<f&&qa(1,f-i.length,function(){i=i.add(b)});e.push(i)});return e},inGroupsOf:function(a,b){var c=[],d=this.length,e=this,f;if(d===0||a===0)return e;if(N(a))a=1;if(N(b))b=l;qa(0,O(d/a,void 0,"ceil")-1,function(h){for(f=e.slice(a*h,a*h+a);f.length<a;)f.push(b);c.push(f)});return c},isEmpty:function(){return this.compact().length==
0},sortBy:function(a,b){var c=this.clone();c.sort(function(d,e){var f,h;f=S(d,a,c,[d]);h=S(e,a,c,[e]);if(C(f)&&C(h)){f=f;h=h;var i,j,g,m,o=0,x=0;f=Oa(f);h=Oa(h);do{g=Ra(f,o);m=Ra(h,o);i=Ta(g);j=Ta(m);if(i===-1||j===-1){i=f.charCodeAt(o)||l;j=h.charCodeAt(o)||l}g=g!==f.charAt(o);m=m!==h.charAt(o);if(g!==m&&x===0)x=g-m;o+=1}while(i!=l&&j!=l&&i===j);f=i===j?x:i<j?-1:1}else f=f<h?-1:f>h?1:0;return f*(b?-1:1)});return c},randomize:function(){for(var a=this.concat(),b=a.length,c,d;b;){c=v.random()*b|0;
d=a[--b];a[b]=a[c];a[c]=d}return a},zip:function(){var a=K(arguments);return this.map(function(b,c){return[b].concat(a.map(function(d){return c in d?d[c]:l}))})},sample:function(a){var b=this.randomize();return arguments.length>0?b.slice(0,a):b[0]},each:function(a,b,c){T(this,a,b,c);return this},add:function(a,b){if(!B(u(b))||isNaN(b))b=this.length;q.prototype.splice.apply(this,[b,0].concat(a));return this},remove:function(){var a,b=this;K(arguments,function(c){for(a=0;a<b.length;)if(Ea(b[a],c,b,
[b[a],a,b]))b.splice(a,1);else a++});return b},compact:function(a){var b=[];T(this,function(c){if(ea(c))b.push(c.compact());else if(a&&c)b.push(c);else!a&&c!=l&&c.valueOf()===c.valueOf()&&b.push(c)});return b},groupBy:function(a,b){var c=this,d={},e;T(c,function(f,h){e=S(f,a,c,[f,h,c]);d[e]||(d[e]=[]);d[e].push(f)});b&&G(d,b);return d},none:function(){return!this.any.apply(this,arguments)}});F(q,k,n,{all:q.prototype.every,any:q.prototype.some,insert:q.prototype.add});
function Va(a){if(a&&a.valueOf)a=a.valueOf();return p.keys(a)}function Wa(a,b){I(p,n,n,a,function(c,d){c[d]=function(e,f,h){var i=Va(e);h=q.prototype[d].call(i,function(j){return b?S(e[j],f,e,[j,e[j],e]):Ea(e[j],f,e,[j,e[j],e])},h);if(ea(h))h=h.reduce(function(j,g){j[g]=e[g];return j},{});return h}});za(a,pa)}
F(p,n,n,{map:function(a,b){return Va(a).reduce(function(c,d){c[d]=S(a[d],b,a,[d,a[d],a]);return c},{})},reduce:function(a){var b=Va(a).map(function(c){return a[c]});return b.reduce.apply(b,K(arguments).slice(1))},each:function(a,b){la(b);G(a,b);return a},size:function(a){return Va(a).length}});var Xa="any,all,none,count,find,findAll,isEmpty".split(","),Ya="sum,average,min,max,least,most".split(","),Za="map,reduce,size".split(","),$a=Xa.concat(Ya).concat(Za);
(function(){I(q,k,function(){var a=arguments;return a.length>0&&!A(a[0])},"map,every,all,some,any,none,filter",function(a,b){a[b]=function(c){return this[b](function(d,e){return b==="map"?S(d,c,this,[d,e,this]):Ea(d,c,this,[d,e,this])})}})})();
(function(){q[Ua]="A\u00c1\u00c0\u00c2\u00c3\u0104BC\u0106\u010c\u00c7D\u010e\u00d0E\u00c9\u00c8\u011a\u00ca\u00cb\u0118FG\u011eH\u0131I\u00cd\u00cc\u0130\u00ce\u00cfJKL\u0141MN\u0143\u0147\u00d1O\u00d3\u00d2\u00d4PQR\u0158S\u015a\u0160\u015eT\u0164U\u00da\u00d9\u016e\u00db\u00dcVWXY\u00ddZ\u0179\u017b\u017d\u00de\u00c6\u0152\u00d8\u00d5\u00c5\u00c4\u00d6".split("").map(function(b){return b+b.toLowerCase()}).join("");var a={};T("A\u00c1\u00c0\u00c2\u00c3\u00c4,C\u00c7,E\u00c9\u00c8\u00ca\u00cb,I\u00cd\u00cc\u0130\u00ce\u00cf,O\u00d3\u00d2\u00d4\u00d5\u00d6,S\u00df,U\u00da\u00d9\u00db\u00dc".split(","),
function(b){var c=b.charAt(0);T(b.slice(1).split(""),function(d){a[d]=c;a[d.toLowerCase()]=c.toLowerCase()})});q[Pa]=k;q[Sa]=a})();Wa(Xa);Wa(Ya,k);za(Za,pa);
var V,ab,bb=["ampm","hour","minute","second","ampm","utc","offset_sign","offset_hours","offset_minutes","ampm"],cb="({t})?\\s*(\\d{1,2}(?:[,.]\\d+)?)(?:{h}([0-5]\\d(?:[,.]\\d+)?)?{m}(?::?([0-5]\\d(?:[,.]\\d+)?){s})?\\s*(?:({t})|(Z)|(?:([+-])(\\d{2,2})(?::?(\\d{2,2}))?)?)?|\\s*({t}))",db={},eb,fb,gb,hb=[],ib=[{ba:"f{1,4}|ms|milliseconds",format:function(a){return W(a,"Milliseconds")}},{ba:"ss?|seconds",format:function(a){return W(a,"Seconds")}},{ba:"mm?|minutes",format:function(a){return W(a,"Minutes")}},
{ba:"hh?|hours|12hr",format:function(a){a=W(a,"Hours");return a===0?12:a-ra(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}",
format:function(a,b,c,d){if(b.ampm.length==0)return"";a=W(a,"Hours");b=b.ampm[ra(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 P(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+ta(a)}}],jb=[{$:"year",method:"FullYear",
ja:k,da:function(a){return(365+(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},error:0.919},{$:"week",method:"ISOWeek",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)}],kb={};
function lb(a){oa(this,a);this.ga=hb.concat()}
lb.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},ua:function(a){var b=this;return a.replace(r(this.num,"g"),function(c){return b.oa(c)||""})},sa:function(a){return V.units[this.units.indexOf(a)%8]},va:function(a){return this.na(a,a[2]>0?"future":"past")},ra:function(a){return this.na(mb(a),"duration")},wa:function(a){a=a||this.code;
return a==="en"||a==="en-US"?k:this.variant},za:function(a){return a===this.ampm[0]},Aa:function(a){return a&&a===this.ampm[1]},na:function(a,b){var c,d,e=a[0],f=a[1],h=a[2],i=this[b]||this.relative;if(A(i))return i.call(this,e,f,h,b);d=this.units[(this.plural&&e>1?1:0)*8+f]||this.units[f];if(this.capitalizeUnit)d=nb(d);c=this.modifiers.filter(function(j){return j.name=="sign"&&j.value==(h>0?1:-1)})[0];return i.replace(/\{(.*?)\}/g,function(j,g){switch(g){case "num":return e;case "unit":return d;
case "sign":return c.src}})},ta:function(){return this.ma?[this.ma].concat(this.ga):this.ga},addFormat:function(a,b,c,d,e){var f=c||[],h=this,i;a=a.replace(/\s+/g,"[-,. ]*");a=a.replace(/\{([^,]+?)\}/g,function(j,g){var m,o,x,z=g.match(/\?$/);x=g.match(/^(\d+)\??$/);var J=g.match(/(\d)(?:-(\d))?/),M=g.replace(/[^a-z]+$/,"");if(x)m=h.tokens[x[1]];else if(h[M])m=h[M];else if(h[M+"s"]){m=h[M+"s"];if(J){o=[];m.forEach(function(Q,Da){var U=Da%(h.units?8:m.length);if(U>=J[1]&&U<=(J[2]||J[1]))o.push(Q)});
m=o}m=ob(m)}if(x)x="(?:"+m+")";else{c||f.push(M);x="("+m+")"}if(z)x+="?";return x});if(b){b=pb(cb,h,e);e=["t","[\\s\\u3000]"].concat(h.timeMarker);i=a.match(/\\d\{\d,\d\}\)+\??$/);qb(h,"(?:"+b+")[,\\s\\u3000]+?"+a,bb.concat(f),d);qb(h,a+"(?:[,\\s]*(?:"+e.join("|")+(i?"+":"*")+")"+b+")?",f.concat(bb),d)}else qb(h,a,f,d)}};function rb(a,b){var c;C(a)||(a="");c=kb[a]||kb[a.slice(0,2)];if(b===n&&!c)throw Error("Invalid locale.");return c||ab}
function sb(a,b){function c(g){var m=i[g];if(C(m))i[g]=m.split(",");else m||(i[g]=[])}function d(g,m){g=g.split("+").map(function(o){return o.replace(/(.+):(.+)$/,function(x,z,J){return J.split("|").map(function(M){return z+M}).join("|")})}).join("|");return g.split("|").forEach(m)}function e(g,m,o){var x=[];i[g].forEach(function(z,J){if(m)z+="+"+z.slice(0,3);d(z,function(M,Q){x[Q*o+J]=M.toLowerCase()})});i[g]=x}function f(g,m,o){g="\\d{"+g+","+m+"}";if(o)g+="|(?:"+ob(i.numbers)+")+";return g}function h(g,
m){i[g]=i[g]||m}var i,j;i=new lb(b);c("modifiers");"months,weekdays,units,numbers,articles,tokens,timeMarker,ampm,timeSuffixes,dateParse,timeParse".split(",").forEach(c);j=!i.monthSuffix;e("months",j,12);e("weekdays",j,7);e("units",n,8);e("numbers",n,10);h("code",a);h("date",f(1,2,i.digitDate));h("year","'\\d{2}|"+f(4,4));h("num",function(){var g=["\\d+"].concat(i.articles);if(i.numbers)g=g.concat(i.numbers);return ob(g)}());(function(){var g=[];i.ha={};i.modifiers.forEach(function(m){var o=m.name;
d(m.src,function(x){var z=i[o];i.ha[x]=m;g.push({name:o,src:x,value:m.value});i[o]=z?z+"|"+x:x})});i.day+="|"+ob(i.weekdays);i.modifiers=g})();if(i.monthSuffix){i.month=f(1,2);i.months=qa(1,12).map(function(g){return g+i.monthSuffix})}i.full_month=f(1,2)+"|"+ob(i.months);i.timeSuffixes.length>0&&i.addFormat(pb(cb,i),n,bb);i.addFormat("{day}",k);i.addFormat("{month}"+(i.monthSuffix||""));i.addFormat("{year}"+(i.yearSuffix||""));i.timeParse.forEach(function(g){i.addFormat(g,k)});i.dateParse.forEach(function(g){i.addFormat(g)});
return kb[a]=i}function qb(a,b,c,d){a.ga.unshift({Da:d,ya:a,Ca:r("^"+b+"$","i"),to:c})}function nb(a){return a.slice(0,1).toUpperCase()+a.slice(1)}function ob(a){return a.filter(function(b){return!!b}).join("|")}function tb(a,b){var c;if(na(a[0]))return a;else if(B(a[0])&&!B(a[1]))return[a[0]];else if(C(a[0])&&b)return[ub(a[0]),a[1]];c={};fb.forEach(function(d,e){c[d.$]=a[e]});return[c]}
function ub(a,b){var c={};if(match=a.match(/^(\d+)?\s?(\w+?)s?$/i)){if(N(b))b=parseInt(match[1])||1;c[match[2].toLowerCase()]=b}return c}function vb(a,b){var c={},d,e;b.forEach(function(f,h){d=a[h+1];if(!(N(d)||d==="")){if(f==="year")c.Ea=d.replace(/'/,"");e=parseFloat(d.replace(/'/,"").replace(/,/,"."));c[f]=!isNaN(e)?e:d.toLowerCase()}});return c}function wb(a){a=a.trim().replace(/^just (?=now)|\.+$/i,"");return xb(a)}
function xb(a){return a.replace(eb,function(b,c,d){var e=0,f=1,h,i;if(c)return b;d.split("").reverse().forEach(function(j){j=db[j];var g=j>9;if(g){if(h)e+=f;f*=j/(i||1);i=j}else{if(h===n)f*=10;e+=f*j}h=g});if(h)e+=f;return e})}
function yb(a,b,c,d){var e=new s,f=n,h,i,j,g,m,o,x,z,J;e.utc(d);if(ga(a))e.utc(a.isUTC()).setTime(a.getTime());else if(B(a))e.setTime(a);else if(na(a)){e.set(a,k);g=a}else if(C(a)){h=rb(b);a=wb(a);h&&G(h.ta(),function(M,Q){var Da=a.match(Q.Ca);if(Da){j=Q;i=j.ya;g=vb(Da,j.to,i);g.utc&&e.utc();i.ma=j;if(g.timestamp){g=g.timestamp;return n}if(j.Da&&!C(g.month)&&(C(g.date)||h.wa(b))){z=g.month;g.month=g.date;g.date=z}if(g.year&&g.Ea.length===2)g.year=O(W(new s,"FullYear")/100)*100-O(g.year/100)*100+g.year;
if(g.month){g.month=i.getMonth(g.month);if(g.shift&&!g.unit)g.unit=i.units[7]}if(g.weekday&&g.date)delete g.weekday;else if(g.weekday){g.weekday=i.getWeekday(g.weekday);if(g.shift&&!g.unit)g.unit=i.units[5]}if(g.day&&(z=i.ha[g.day])){g.day=z.value;e.reset();f=k}else if(g.day&&(o=i.getWeekday(g.day))>-1){delete g.day;if(g.num&&g.month){J=function(){var U=e.getWeekday();e.setWeekday(7*(g.num-1)+(U>o?o+7:o))};g.day=1}else g.weekday=o}if(g.date&&!B(g.date))g.date=i.ua(g.date);if(i.Aa(g.ampm)&&g.hour<
12)g.hour+=12;else if(i.za(g.ampm)&&g.hour===12)g.hour=0;if("offset_hours"in g||"offset_minutes"in g){e.utc();g.offset_minutes=g.offset_minutes||0;g.offset_minutes+=g.offset_hours*60;if(g.offset_sign==="-")g.offset_minutes*=-1;g.minute-=g.offset_minutes}if(g.unit){f=k;x=i.oa(g.num);m=i.sa(g.unit);if(g.shift||g.edge){x*=(z=i.ha[g.shift])?z.value:0;if(m==="month"&&L(g.date)){e.set({day:g.date},k);delete g.date}if(m==="year"&&L(g.month)){e.set({month:g.month,day:g.date},k);delete g.month;delete g.date}}if(g.sign&&
(z=i.ha[g.sign]))x*=z.value;if(L(g.weekday)){e.set({weekday:g.weekday},k);delete g.weekday}g[m]=(g[m]||0)+x}if(g.year_sign==="-")g.year*=-1;gb.slice(1,4).forEach(function(U,cc){var Gb=g[U.$],Hb=Gb%1;if(Hb){g[gb[cc].$]=O(Hb*(U.$==="second"?1E3:60));g[U.$]=ra(Gb)}});return n}});if(j)if(f)e.advance(g);else{e._utc&&e.reset();zb(e,g,k,n,c)}else{if(a!=="now")e=new s(a);d&&e.addMinutes(-e.getTimezoneOffset())}if(g&&g.edge){z=i.ha[g.edge];G(gb.slice(4),function(M,Q){if(L(g[Q.$])){m=Q.$;return n}});if(m===
"year")g.fa="month";else if(m==="month"||m==="week")g.fa="day";e[(z.value<0?"endOf":"beginningOf")+nb(m)]();z.value===-2&&e.reset()}J&&J();e.utc(n)}return{ea:e,set:g}}function mb(a){var b,c=v.abs(a),d=c,e=0;gb.slice(1).forEach(function(f,h){b=ra(O(c/f.da()*10)/10);if(b>=1){d=b;e=h+1}});return[d,e,a]}function Ab(a){var b=mb(a.millisecondsFromNow());if(b[1]===6)b[0]=v.abs(a.monthsFromNow());return b}
function Bb(a,b,c,d){var e,f=rb(d),h=r(/^[A-Z]/);if(a.isValid())if(Date[b])b=Date[b];else{if(A(b)){e=Ab(a);b=b.apply(a,e.concat(f))}}else return"Invalid Date";if(!b&&c){e=e||Ab(a);if(e[1]===0){e[1]=1;e[0]=1}return f.va(e)}b=b||"long";b=f[b]||b;ib.forEach(function(i){b=b.replace(r("\\{("+i.ba+")(\\d)?\\}",i.la?"i":""),function(j,g,m){j=i.format(a,f,m||1,g);m=g.length;var o=g.match(/^(.)\1+$/);if(i.la){if(m===3)j=j.slice(0,3);if(o||g.match(h))j=nb(j)}else if(o&&!i.text)j=(B(j)?P(j,m):j.toString()).slice(-m);
return j})});return b}function Cb(a,b,c,d){var e,f,h,i=0,j=0,g=0;e=yb(b,l,l,d);if(c>0){j=g=c;f=k}if(!e.ea.isValid())return n;if(e.set&&e.set.fa){jb.forEach(function(m){if(m.$===e.set.fa)i=m.da(e.ea,a-e.ea)-1});b=nb(e.set.fa);if(e.set.edge||e.set.shift)e.ea["beginningOf"+b]();if(e.set.fa==="month")h=e.ea.clone()["endOf"+b]().getTime();if(!f&&e.set.sign&&e.set.fa!="millisecond"){j=50;g=-50}}f=a.getTime();b=e.ea.getTime();h=h||b+i;h=Db(a,b,h);return f>=b-j&&f<=h+g}
function Db(a,b,c){b=new Date(b);a=(new Date(c)).utc(a.isUTC());if(W(a,"Hours")!==23){b=b.getTimezoneOffset();a=a.getTimezoneOffset();if(b!==a)c+=(a-b).minutes()}return c}
function zb(a,b,c,d,e){function f(g){return L(b[g])?b[g]:b[g+"s"]}function h(g){return L(f(g))}var i,j;if(B(b)&&d)b={milliseconds:b};else if(B(b)){a.setTime(b);return a}if(L(b.date))b.day=b.date;G(gb,function(g,m){var o=m.$==="day";if(h(m.$)||o&&h("weekday")){b.fa=m.$;j=+g;return n}else if(c&&m.$!=="week"&&(!o||!h("week")))Eb(a,m.method,o?1:0)});jb.forEach(function(g){var m=g.$;g=g.method;var o;o=f(m);if(!N(o)){if(d){if(m==="week"){o=(b.day||0)+o*7;g="Date"}o=o*d+W(a,g)}else m==="month"&&h("day")&&
Eb(a,"Date",15);Eb(a,g,o);if(d&&m==="month"){m=o;if(m<0)m=m%12+12;m%12!=W(a,"Month")&&Eb(a,"Date",0)}}});if(!d&&!h("day")&&h("weekday")){i=f("weekday");a.setWeekday(i)}(function(){var g=new s;return e===-1&&a>g||e===1&&a<g})()&&G(gb.slice(j+1),function(g,m){if((m.ja||m.$==="week"&&h("weekday"))&&!(h(m.$)||m.$==="day"&&h("weekday"))){a[m.ia](e);return n}});return a}function W(a,b){return a["get"+(a._utc?"UTC":"")+b]()}function Eb(a,b,c){return a["set"+(a._utc&&b!="ISOWeek"?"UTC":"")+b](c)}
function pb(a,b,c){var d={h:0,m:1,s:2},e;b=b||V;return a.replace(/{([a-z])}/g,function(f,h){var i=[],j=h==="h",g=j&&!c;if(h==="t")return b.ampm.join("|");else{j&&i.push(":");if(e=b.timeSuffixes[d[h]])i.push(e+"\\s*");return i.length===0?"":"(?:"+i.join("|")+")"+(g?"":"?")}})}function X(a,b,c){var d,e;if(B(a[1]))d=tb(a)[0];else{d=a[0];e=a[1]}return yb(d,e,b,c).ea}
s.extend({create:function(){return X(arguments)},past:function(){return X(arguments,-1)},future:function(){return X(arguments,1)},addLocale:function(a,b){return sb(a,b)},setLocale:function(a){var b=rb(a,n);ab=b;if(a&&a!=b.code)b.code=a;return b},getLocale:function(a){return!a?ab:rb(a,n)},addFormat:function(a,b,c){qb(rb(c),a,b)}},n,n);
s.extend({set:function(){var a=tb(arguments);return zb(this,a[0],a[1])},setWeekday:function(a){if(!N(a))return Eb(this,"Date",W(this,"Date")+a-W(this,"Day"))},setISOWeek:function(a){var b=W(this,"Day")||7;if(!N(a)){this.set({month:0,date:4});this.set({weekday:1});a>1&&this.addWeeks(a-1);b!==1&&this.advance({days:b-1});return this.getTime()}},getISOWeek:function(){var a=this;a=a.clone();var b=W(a,"Day")||7;a.addDays(4-b).reset();return 1+ra(a.daysSince(a.clone().beginningOfYear())/7)},getUTCOffset:function(a){var b=
this._utc?0:this.getTimezoneOffset(),c=a===k?":":"";if(!b&&a)return"Z";return P(O(-b/60),2,k)+c+P(b%60,2)},utc:function(a){E(this,"_utc",a===k||arguments.length===0);return this},isUTC:function(){return!!this._utc||this.getTimezoneOffset()===0},advance:function(){var a=tb(arguments,k);return zb(this,a[0],a[1],1)},rewind:function(){var a=tb(arguments,k);return zb(this,a[0],a[1],-1)},isValid:function(){return!isNaN(this.getTime())},isAfter:function(a,b){return this.getTime()>s.create(a).getTime()-(b||
0)},isBefore:function(a,b){return this.getTime()<s.create(a).getTime()+(b||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 Bb(this,a,n,b)},relative:function(a,b){if(C(a)){b=a;a=l}return Bb(this,
a,k,b)},is:function(a,b,c){var d,e;if(this.isValid()){if(C(a)){a=a.trim().toLowerCase();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 Cb(this,a,b,c)}},reset:function(a){var b=
{},c;a=a||"hours";if(a==="date")a="days";c=jb.some(function(d){return a===d.$||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});
function Fb(a,b){function c(){return O(this*b)}function d(){return X(arguments)[a.ia](this)}function e(){return X(arguments)[a.ia](-this)}var f=a.$,h={};h[f]=c;h[f+"s"]=c;h[f+"Before"]=e;h[f+"sBefore"]=e;h[f+"Ago"]=e;h[f+"sAgo"]=e;h[f+"After"]=d;h[f+"sAfter"]=d;h[f+"FromNow"]=d;h[f+"sFromNow"]=d;u.extend(h)}u.extend({duration:function(a){return rb(a).ra(this)}});
V=ab=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",tokens:"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}",
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|later",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",value:1}],dateParse:["{num} {unit} {sign}","{sign} {num} {unit}","{month} {year}","{shift} {unit=5-7}","{0?} {date}{1}","{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}","{date} {month}","{shift} {weekday}","{shift} week {weekday}","{weekday} {2?} {shift} week","{num} {unit=4-5} {sign} {day}","{0?} {date}{1} of {month}","{0?}{month?} {date?}{1?} of {shift} {unit=6-7}"]});
gb=jb.concat().reverse();fb=jb.concat();fb.splice(2,1);
I(s,k,n,jb,function(a,b,c){function d(g){g=g/h;var m=g%1,o=b.error||0.999;if(m&&v.abs(m%1)>o)g=O(g);return parseInt(g)}var e=b.$,f=nb(e),h=b.da(),i,j;b.ia="add"+f+"s";i=function(g,m){return d(this.getTime()-s.create(g,m).getTime())};j=function(g,m){return d(s.create(g,m).getTime()-this.getTime())};a[e+"sAgo"]=j;a[e+"sUntil"]=j;a[e+"sSince"]=i;a[e+"sFromNow"]=i;a[b.ia]=function(g,m){var o={};o[e]=g;return this.advance(o,m)};Fb(b,h);c<3&&["Last","This","Next"].forEach(function(g){a["is"+g+f]=function(){return this.is(g+
" "+e)}});if(c<4){a["beginningOf"+f]=function(){var g={};switch(e){case "year":g.year=W(this,"FullYear");break;case "month":g.month=W(this,"Month");break;case "day":g.day=W(this,"Date");break;case "week":g.weekday=0}return this.set(g,k)};a["endOf"+f]=function(){var g={hours:23,minutes:59,seconds:59,milliseconds:999};switch(e){case "year":g.month=11;g.day=31;break;case "month":g.day=this.daysInMonth();break;case "week":g.weekday=6}return this.set(g,k)}}});
V.addFormat("([+-])?(\\d{4,4})[-.]?{full_month}[-.]?(\\d{1,2})?",k,["year_sign","year","month","date"],n,k);V.addFormat("(\\d{1,2})[-.\\/]{full_month}(?:[-.\\/](\\d{2,4}))?",k,["date","month","year"],k);V.addFormat("{full_month}[-.](\\d{4,4})",n,["month","year"]);V.addFormat("\\/Date\\((\\d+(?:\\+\\d{4,4})?)\\)\\/",n,["timestamp"]);V.addFormat(pb(cb,V),n,bb);hb=V.ga.slice(0,7).reverse();V.ga=V.ga.slice(7).concat(hb);I(s,k,n,"short,long,full",function(a,b){a[b]=function(c){return Bb(this,b,n,c)}});
"\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u767e\u5343\u4e07".split("").forEach(function(a,b){if(b>9)b=v.pow(10,b-9);db[a]=b});"\uff10\uff11\uff12\uff13\uff14\uff15\uff16\uff17\uff18\uff19".split("").forEach(function(a,b){db[a]=b});eb=r("([\u671f\u9031\u5468])?([\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u767e\u5343\u4e07\uff10\uff11\uff12\uff13\uff14\uff15\uff16\uff17\uff18\uff19]+)(?!\u6628)","g");
(function(){var a="today,yesterday,tomorrow,weekday,weekend,future,past".split(","),b=V.weekdays.slice(0,7),c=V.months.slice(0,12);I(s,k,n,a.concat(b).concat(c),function(d,e){d["is"+nb(e)]=function(f){return this.is(e,0,f)}})})();(function(){s.extend({utc:{create:function(){return X(arguments,0,k)},past:function(){return X(arguments,-1,k)},future:function(){return X(arguments,1,k)}}},n,n)})();
s.extend({RFC1123:"{Dow}, {dd} {Mon} {yyyy} {HH}:{mm}:{ss} {tz}",RFC1036:"{Weekday}, {dd}-{Mon}-{yy} {HH}:{mm}:{ss} {tz}",ISO8601_DATE:"{yyyy}-{MM}-{dd}",ISO8601_DATETIME:"{yyyy}-{MM}-{dd}T{HH}:{mm}:{ss}.{fff}{isotz}"},n,n);
DateRange=function(a,b){this.start=s.create(a);this.end=s.create(b)};DateRange.prototype.toString=function(){return this.isValid()?this.start.full()+".."+this.end.full():"Invalid DateRange"};
F(DateRange,k,n,{isValid:function(){return this.start<this.end},duration:function(){return this.isValid()?this.end.getTime()-this.start.getTime():NaN},contains:function(a){var b=this;return(a.start&&a.end?[a.start,a.end]:[a]).every(function(c){return c>=b.start&&c<=b.end})},every:function(a,b){var c=this.start.clone(),d=[],e=0,f,h;if(C(a)){c.advance(ub(a,0),k);f=ub(a);h=a.toLowerCase()==="day"}else f={milliseconds:a};for(;c<=this.end;){d.push(c);b&&b(c,e);if(h&&W(c,"Hours")===23){c=c.clone();Eb(c,
"Hours",48)}else c=c.clone().advance(f,k);e++}return d},union:function(a){return new DateRange(this.start<a.start?this.start:a.start,this.end>a.end?this.end:a.end)},intersect:function(a){return new DateRange(this.start>a.start?this.start:a.start,this.end<a.end?this.end:a.end)},clone:function(){return new DateRange(this.start,this.end)}});I(DateRange,k,n,"Millisecond,Second,Minute,Hour,Day,Week,Month,Year",function(a,b){a["each"+b]=function(c){return this.every(b,c)}});
F(s,n,n,{range:function(a,b){return new DateRange(a,b)}});
function Ib(a,b,c,d,e){var f;if(b!==Infinity){if(!a.timers)a.timers=[];B(b)||(b=0);a.timers.push(setTimeout(function(){a.timers.splice(f,1);c.apply(d,e||[])},b));f=a.timers.length}}
F(Function,k,n,{lazy:function(a,b){function c(){if(!f||e.length<b-1){e.push([this,arguments]);h()}return g}var d=this,e=[],f=n,h,i,j,g;a=a||1;b=b||Infinity;i=O(a,void 0,"ceil");j=O(i/a)||1;h=function(){if(!(f||e.length==0)){for(var m=v.max(e.length-j,0);e.length>m;)g=Function.prototype.apply.apply(d,e.shift());Ib(c,i,function(){f=n;h()});f=k}};return c},delay:function(a){var b=K(arguments).slice(1);Ib(this,a,this,this,b);return this},throttle:function(a){return this.lazy(a,1)},debounce:function(a){function b(){b.cancel();
Ib(b,a,c,this,arguments)}var c=this;return b},cancel:function(){if(ea(this.timers))for(;this.timers.length>0;)clearTimeout(this.timers.shift());return this},after:function(a){var b=this,c=0,d=[];if(B(a)){if(a===0){b.call();return b}}else a=1;return function(){var e;d.push(K(arguments));c++;if(c==a){e=b.call(this,d);c=0;d=[];return e}}},once:function(){return this.throttle(Infinity)},fill:function(){var a=this,b=K(arguments);return function(){var c=K(arguments);b.forEach(function(d,e){if(d!=l||e>=
c.length)c.splice(e,0,d)});return a.apply(this,c)}}});
function Jb(a,b,c,d,e,f){var h=a.toFixed(20),i=h.search(/\./);h=h.search(/[1-9]/);i=i-h;if(i>0)i-=1;e=v.max(v.min((i/3).floor(),e===n?c.length:e),-d);d=c.charAt(e+d-1);if(i<-9){e=-3;b=i.abs()-9;d=c.slice(0,1)}return(a/(f?(2).pow(10*e):(10).pow(e*3))).round(b||0).format()+d.trim()}
F(u,n,n,{random:function(a,b){var c,d;if(arguments.length==1){b=a;a=0}c=v.min(a||0,N(b)?1:b);d=v.max(a||0,N(b)?1:b)+1;return ra(v.random()*(d-c)+c)}});
F(u,k,n,{log:function(a){return v.log(this)/(a?v.log(a):1)},abbr:function(a){return Jb(this,a,"kmbt",0,4)},metric:function(a,b){return Jb(this,a,"n\u03bcm kMGTPE",4,N(b)?1:b)},bytes:function(a,b){return Jb(this,a,"kMGTPE",0,N(b)?4:b,k)+"B"},isInteger:function(){return this%1==0},isOdd:function(){return!isNaN(this)&&!this.isMultipleOf(2)},isEven:function(){return this.isMultipleOf(2)},isMultipleOf:function(a){return this%a===0},format:function(a,b,c){var d,e,f,h="";if(N(b))b=",";if(N(c))c=".";d=(B(a)?
O(this,a||0).toFixed(v.max(a,0)):this.toString()).replace(/^-/,"").split(".");e=d[0];f=d[1];for(d=e.length;d>0;d-=3){if(d<e.length)h=b+h;h=e.slice(v.max(0,d-3),d)+h}if(f)h+=c+sa((a||0)-f.length,"0")+f;return(this<0?"-":"")+h},hex:function(a){return this.pad(a||1,n,16)},upto:function(a,b,c){return qa(this,a,b,c||1)},downto:function(a,b,c){return qa(this,a,b,-(c||1))},times:function(a){if(a)for(var b=0;b<this;b++)a.call(this,b);return this.toNumber()},chr:function(){return t.fromCharCode(this)},pad:function(a,
b,c){return P(this,a,b,c)},ordinalize:function(){var a=this.abs();a=parseInt(a.toString().slice(-2));return this+ta(a)},toNumber:function(){return parseFloat(this,10)}});I(u,k,n,"round,floor,ceil",function(a,b){a[b]=function(c){return O(this,c,b)}});I(u,k,n,"abs,pow,sin,asin,cos,acos,tan,atan,exp,pow,sqrt",function(a,b){a[b]=function(c,d){return v[b](this,c,d)}});
var Kb="isObject,isNaN".split(","),Lb="keys,values,select,reject,each,merge,clone,equal,watch,tap,has".split(",");
function Mb(a,b,c,d){var e=/^(.+?)(\[.*\])$/,f,h,i;if(d!==n&&(h=b.match(e))){i=h[1];b=h[2].replace(/^\[|\]$/g,"").split("][");b.forEach(function(j){f=!j||j.match(/^\d+$/);if(!i&&ea(a))i=a.length;H(a,i)||(a[i]=f?[]:{});a=a[i];i=j});if(!i&&f)i=a.length.toString();Mb(a,i,c)}else a[b]=c.match(/^[+-]?\d+(\.\d+)?$/)?parseFloat(c):c==="true"?k:c==="false"?n:c}function Nb(a,b,c){var d={},e;G(a,function(f,h){e=n;ka(b,function(i){if(D(i)?i.test(f):ma(i)?H(i,f):f===t(i))e=k},1);if(e===c)d[f]=h});return d}
F(p,n,k,{watch:function(a,b,c){if(da){var d=a[b];p.defineProperty(a,b,{enumerable:k,configurable:k,get:function(){return d},set:function(e){d=c.call(a,b,d,e)}})}}});F(p,n,function(a,b){return A(b)},{keys:function(a,b){var c=p.keys(a);c.forEach(function(d){b.call(a,d,a[d])});return c}});
F(p,n,n,{isObject:function(a){return na(a)},isNaN:function(a){return B(a)&&a.valueOf()!==a.valueOf()},equal:function(a,b){return xa(a)&&xa(b)?wa(a)===wa(b):a===b},extended:function(a){return new pa(a)},merge:function(a,b,c,d){var e,f;if(a&&typeof b!="string")for(e in b)if(H(b,e)&&a){f=b[e];if(L(a[e])){if(d===n)continue;if(A(d))f=d.call(b,e,a[e],b[e])}if(c===k&&f&&ma(f))if(ga(f))f=new s(f.getTime());else if(D(f))f=new r(f.source,va(f));else{a[e]||(a[e]=q.isArray(f)?[]:{});p.merge(a[e],b[e],c,d);continue}a[e]=
f}return a},values:function(a,b){var c=[];G(a,function(d,e){c.push(e);b&&b.call(a,e)});return c},clone:function(a,b){var c;if(ga(a)&&a.clone)return a.clone();else if(ma(a))c=a instanceof pa?new pa:new a.constructor;else return a;return p.merge(c,a,b)},fromQueryString:function(a,b){var c=p.extended();a=a&&a.toString?a.toString():"";a.replace(/^.*?\?/,"").split("&").forEach(function(d){d=d.split("=");d.length===2&&Mb(c,d[0],decodeURIComponent(d[1]),b)});return c},tap:function(a,b){var c=b;A(b)||(c=
function(){b&&a[b]()});c.call(a,a);return a},has:function(a,b){return H(a,b)},select:function(a){return Nb(a,arguments,k)},reject:function(a){return Nb(a,arguments,n)}});I(p,n,n,w,function(a,b){var c="is"+b;Kb.push(c);a[c]=ca[b]});(function(){F(p,n,function(){return arguments.length===0},{extend:function(){var a=Kb.concat(Lb);if(typeof $a!=="undefined")a=a.concat($a);za(a,p)}})})();za(Lb,pa);
F(r,n,n,{escape:function(a){return R(a)}});
F(r,k,n,{getFlags:function(){return va(this)},setFlags:function(a){return r(this.source,a)},addFlag:function(a){return this.setFlags(va(this,a))},removeFlag:function(a){return this.setFlags(va(this).replace(a,""))}});
var Ob,Pb;
F(t,k,function(a){return D(a)||arguments.length>2},{startsWith:function(a,b,c){var d=this;if(b)d=d.slice(b);if(N(c))c=k;a=D(a)?a.source.replace("^",""):R(a);return r("^"+a,c?"":"i").test(d)},endsWith:function(a,b,c){var d=this;if(L(b))d=d.slice(0,b);if(N(c))c=k;a=D(a)?a.source.replace("$",""):R(a);return r(a+"$",c?"":"i").test(d)}});
F(t,k,n,{escapeRegExp:function(){return R(this)},escapeURL:function(a){return a?encodeURIComponent(this):encodeURI(this)},unescapeURL:function(a){return a?decodeURI(this):decodeURIComponent(this)},escapeHTML:function(){return this.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")},unescapeHTML:function(){return this.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(///g,
"/").replace(/&/g,"&")},encodeBase64:function(){return Ob(this)},decodeBase64:function(){return Pb(this)},each:function(a,b){var c,d,e;if(A(a)){b=a;a=/[\s\S]/g}else if(a)if(C(a))a=r(R(a),"gi");else{if(D(a))a=r(a.source,va(a,"g"))}else a=/[\s\S]/g;c=this.match(a)||[];if(b){d=0;for(e=c.length;d<e;d++)c[d]=b.call(this,c[d],d,c)||c[d]}return c},shift:function(a){var b="";a=a||0;this.codes(function(c){b+=t.fromCharCode(c+a)});return b},codes:function(a){var b=[],c,d;c=0;for(d=this.length;c<d;c++){var e=
this.charCodeAt(c);b.push(e);a&&a.call(this,e,c)}return b},chars:function(a){return this.each(a)},words:function(a){return this.trim().each(/\S+/g,a)},lines:function(a){return this.trim().each(/^.*$/gm,a)},paragraphs:function(a){var b=this.trim().split(/[\r\n]{2,}/);return b=b.map(function(c){if(a)var d=a.call(c);return d?d:c})},isBlank:function(){return this.trim().length===0},has:function(a){return this.search(D(a)?a:R(a))!==-1},add:function(a,b){b=N(b)?this.length:b;return this.slice(0,b)+a+this.slice(b)},
remove:function(a){return this.replace(a,"")},reverse:function(){return this.split("").reverse().join("")},compact:function(){return this.trim().replace(/([\r\n\s\u3000])+/g,function(a,b){return b==="\u3000"?b:" "})},at:function(){return ya(this,arguments,k)},from:function(a){return this.slice(a)},to:function(a){if(N(a))a=this.length;return this.slice(0,a)},dasherize:function(){return this.underscore().replace(/_/g,"-")},underscore:function(){return this.replace(/[-\s]+/g,"_").replace(t.Inflector&&
t.Inflector.acronymRegExp,function(a,b){return(b>0?"_":"")+a.toLowerCase()}).replace(/([A-Z\d]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase()},camelize:function(a){return this.underscore().replace(/(^|_)([^_]+)/g,function(b,c,d,e){b=d;b=(c=t.Inflector)&&c.acronyms[b];b=C(b)?b:void 0;e=a!==n||e>0;if(b)return e?b:b.toLowerCase();return e?d.capitalize():d})},spacify:function(){return this.underscore().replace(/_/g," ")},stripTags:function(){var a=this;ka(arguments.length>
0?arguments:[""],function(b){a=a.replace(r("</?"+R(b)+"[^<>]*>","gi"),"")});return a},removeTags:function(){var a=this;ka(arguments.length>0?arguments:["\\S+"],function(b){b=r("<("+b+")[^<>]*(?:\\/>|>.*?<\\/\\1>)","gi");a=a.replace(b,"")});return a},truncate:function(a,b,c,d){var e="",f="",h=this.toString(),i="["+ua()+"]+",j="[^"+ua()+"]*",g=r(i+j+"$");d=N(d)?"...":t(d);if(h.length<=a)return h;switch(c){case "left":a=h.length-a;e=d;h=h.slice(a);g=r("^"+j+i);break;case "middle":a=ra(a/2);f=d+h.slice(h.length-
a).trimLeft();h=h.slice(0,a);break;default:a=a;f=d;h=h.slice(0,a)}if(b===n&&this.slice(a,a+1).match(/\S/))h=h.remove(g);return e+h+f},pad:function(a,b){return sa(b,a)+this+sa(b,a)},padLeft:function(a,b){return sa(b,a)+this},padRight:function(a,b){return this+sa(b,a)},first:function(a){if(N(a))a=1;return this.substr(0,a)},last:function(a){if(N(a))a=1;return this.substr(this.length-a<0?0:this.length-a)},repeat:function(a){var b="",c=this;if(!B(a)||a<1)return"";for(;a;){if(a&1)b+=c;if(a>>=1)c+=c}return b},
toNumber:function(a){var b=this.replace(/,/g,"");return b.match(/\./)?parseFloat(b):parseInt(b,a||10)},capitalize:function(a){var b;return this.toLowerCase().replace(a?/[\s\S]/g:/^\S/,function(c){var d=c.toUpperCase(),e;e=b?c:d;b=d!==c;return e})},assign:function(){var a={};K(arguments,function(b,c){if(na(b))oa(a,b);else a[c+1]=b});return this.replace(/\{([^{]+?)\}/g,function(b,c){return H(a,c)?a[c]:b})},namespace:function(a){a=a||ba;G(this.split("."),function(b,c){return!!(a=a[c])});return a}});
F(t,k,n,{insert:t.prototype.add});
(function(a){if(this.btoa){Ob=this.btoa;Pb=this.atob}else{var b=/[^A-Za-z0-9\+\/\=]/g;Ob=function(c){var d="",e,f,h,i,j,g,m=0;do{e=c.charCodeAt(m++);f=c.charCodeAt(m++);h=c.charCodeAt(m++);i=e>>2;e=(e&3)<<4|f>>4;j=(f&15)<<2|h>>6;g=h&63;if(isNaN(f))j=g=64;else if(isNaN(h))g=64;d=d+a.charAt(i)+a.charAt(e)+a.charAt(j)+a.charAt(g)}while(m<c.length);return d};Pb=function(c){var d="",e,f,h,i,j,g=0;if(c.match(b))throw Error("String contains invalid base64 characters");c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");
do{e=a.indexOf(c.charAt(g++));f=a.indexOf(c.charAt(g++));i=a.indexOf(c.charAt(g++));j=a.indexOf(c.charAt(g++));e=e<<2|f>>4;f=(f&15)<<4|i>>2;h=(i&3)<<6|j;d+=t.fromCharCode(e);if(i!=64)d+=t.fromCharCode(f);if(j!=64)d+=t.fromCharCode(h)}while(g<c.length);return d}}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");})();