jio-latest.min.js 195 KB
Newer Older
Vincent Bechu's avatar
Vincent Bechu committed
1 2
/*! jio v3.21.0 2017-08-10 */
function parseStringToObject(a){var b=function(){var a,b,c=[],d=arguments;for(a=0;a<d.length;a+=1)for(b=0;b<d[a].length;b+=1)c.push(d[a][b]);return c},c=function(a,b,c){var d={type:"simple",key:a,value:b};return void 0!==c&&(d.operator=c),d},d=function(a){return"NOT"===a.operator?a.query_list[0]:{type:"complex",operator:"NOT",query_list:[a]}},e=function(a,c){var d,e=[];for(d=0;d<c.length;d+=1)c[d].operator===a?e=b(e,c[d].query_list):e.push(c[d]);return{type:"complex",operator:a,query_list:e}},f=function(a,b){var c;if("complex"===a.type){for(c=0;c<a.query_list.length;++c)f(a.query_list[c],b);return!0}return"simple"!==a.type||a.key?!1:(a.key=b,!0)},g=function(){function a(){this.yy={}}var b=function(a,b,c,d){for(c=c||{},d=a.length;d--;c[a[d]]=b);return c},g=[1,5],h=[1,7],i=[1,8],j=[1,10],k=[1,12],l=[1,6,7,15],m=[1,6,7,9,12,14,15,16,19,21],n=[1,6,7,9,11,12,14,15,16,19,21],o=[2,17],p={trace:function(){},yy:{},symbols_:{error:2,begin:3,search_text:4,end:5,EOF:6,NEWLINE:7,and_expression:8,OR:9,boolean_expression:10,AND:11,NOT:12,expression:13,LEFT_PARENTHESE:14,RIGHT_PARENTHESE:15,WORD:16,DEFINITION:17,value:18,OPERATOR:19,string:20,QUOTE:21,QUOTED_STRING:22,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"NEWLINE",9:"OR",11:"AND",12:"NOT",14:"LEFT_PARENTHESE",15:"RIGHT_PARENTHESE",16:"WORD",17:"DEFINITION",19:"OPERATOR",21:"QUOTE",22:"QUOTED_STRING"},productions_:[0,[3,2],[5,0],[5,1],[5,1],[4,1],[4,2],[4,3],[8,1],[8,3],[10,2],[10,1],[13,3],[13,3],[13,1],[18,2],[18,1],[20,1],[20,3]],performAction:function(a,b,g,h,i,j,k){var l=j.length-1;switch(i){case 1:return j[l-1];case 5:case 8:case 11:case 14:case 16:this.$=j[l];break;case 6:this.$=e("AND",[j[l-1],j[l]]);break;case 7:this.$=e("OR",[j[l-2],j[l]]);break;case 9:this.$=e("AND",[j[l-2],j[l]]);break;case 10:this.$=d(j[l]);break;case 12:this.$=j[l-1];break;case 13:f(j[l],j[l-2]),this.$=j[l];break;case 15:j[l].operator=j[l-1],this.$=j[l];break;case 17:this.$=c("",j[l]);break;case 18:this.$=c("",j[l-1])}},table:[{3:1,4:2,8:3,10:4,12:g,13:6,14:h,16:i,18:9,19:j,20:11,21:k},{1:[3]},{1:[2,2],5:13,6:[1,14],7:[1,15]},b(l,[2,5],{8:3,10:4,13:6,18:9,20:11,4:16,9:[1,17],12:g,14:h,16:i,19:j,21:k}),b(m,[2,8],{11:[1,18]}),{13:19,14:h,16:i,18:9,19:j,20:11,21:k},b(n,[2,11]),{4:20,8:3,10:4,12:g,13:6,14:h,16:i,18:9,19:j,20:11,21:k},b(n,o,{17:[1,21]}),b(n,[2,14]),{16:[1,23],20:22,21:k},b(n,[2,16]),{22:[1,24]},{1:[2,1]},{1:[2,3]},{1:[2,4]},b(l,[2,6]),{4:25,8:3,10:4,12:g,13:6,14:h,16:i,18:9,19:j,20:11,21:k},{8:26,10:4,12:g,13:6,14:h,16:i,18:9,19:j,20:11,21:k},b(n,[2,10]),{15:[1,27]},{13:28,14:h,16:i,18:9,19:j,20:11,21:k},b(n,[2,15]),b(n,o),{21:[1,29]},b(l,[2,7]),b(m,[2,9]),b(n,[2,12]),b(n,[2,13]),b(n,[2,18])],defaultActions:{13:[2,1],14:[2,3],15:[2,4]},parseError:function(a,b){function c(a,b){this.message=a,this.hash=b}if(!b.recoverable)throw c.prototype=new Error,new c(a,b);this.trace(a)},parse:function(a){var b=this,c=[0],d=[null],e=[],f=this.table,g="",h=0,i=0,j=0,k=2,l=1,m=e.slice.call(arguments,1),n=Object.create(this.lexer),o={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(o.yy[p]=this.yy[p]);n.setInput(a,o.yy),o.yy.lexer=n,o.yy.parser=this,"undefined"==typeof n.yylloc&&(n.yylloc={});var q=n.yylloc;e.push(q);var r=n.options&&n.options.ranges;"function"==typeof o.yy.parseError?this.parseError=o.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var s,t,u,v,w,x,y,z,A,B=function(){var a;return a=n.lex()||l,"number"!=typeof a&&(a=b.symbols_[a]||a),a},C={};;){if(u=c[c.length-1],this.defaultActions[u]?v=this.defaultActions[u]:((null===s||"undefined"==typeof s)&&(s=B()),v=f[u]&&f[u][s]),"undefined"==typeof v||!v.length||!v[0]){var D="";A=[];for(x in f[u])this.terminals_[x]&&x>k&&A.push("'"+this.terminals_[x]+"'");D=n.showPosition?"Parse error on line "+(h+1)+":\n"+n.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[s]||s)+"'":"Parse error on line "+(h+1)+": Unexpected "+(s==l?"end of input":"'"+(this.terminals_[s]||s)+"'"),this.parseError(D,{text:n.match,token:this.terminals_[s]||s,line:n.yylineno,loc:q,expected:A})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+u+", token: "+s);switch(v[0]){case 1:c.push(s),d.push(n.yytext),e.push(n.yylloc),c.push(v[1]),s=null,t?(s=t,t=null):(i=n.yyleng,g=n.yytext,h=n.yylineno,q=n.yylloc,j>0&&j--);break;case 2:if(y=this.productions_[v[1]][1],C.$=d[d.length-y],C._$={first_line:e[e.length-(y||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(y||1)].first_column,last_column:e[e.length-1].last_column},r&&(C._$.range=[e[e.length-(y||1)].range[0],e[e.length-1].range[1]]),w=this.performAction.apply(C,[g,i,h,o.yy,v[1],d,e].concat(m)),"undefined"!=typeof w)return w;y&&(c=c.slice(0,-1*y*2),d=d.slice(0,-1*y),e=e.slice(0,-1*y)),c.push(this.productions_[v[1]][0]),d.push(C.$),e.push(C._$),z=f[c[c.length-2]][c[c.length-1]],c.push(z);break;case 3:return!0}}return!0}},q=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a,b){return this.yy=b||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},test_match:function(a,b){var c,d,e;if(this.options.backtrack_lexer&&(e={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(e.yylloc.range=this.yylloc.range.slice(0))),d=a[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length},this.yytext+=a[0],this.match+=a[0],this.matches=a,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(a[0].length),this.matched+=a[0],c=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var f in e)this[f]=e[f];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d;this._more||(this.yytext="",this.match="");for(var e=this._currentRules(),f=0;f<e.length;f++)if(c=this._input.match(this.rules[e[f]]),c&&(!b||c[0].length>b[0].length)){if(b=c,d=f,this.options.backtrack_lexer){if(a=this.test_match(c,e[f]),a!==!1)return a;if(this._backtrack){b=!1;continue}return!1}if(!this.options.flex)break}return b?(a=this.test_match(b,e[d]),a!==!1?a:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},pushState:function(a){this.begin(a)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(a,b,c,d){switch(c){case 0:return this.begin("letsquote"),"QUOTE";case 1:return this.popState(),this.begin("endquote"),"QUOTED_STRING";case 2:return this.popState(),"QUOTE";case 3:break;case 4:return"LEFT_PARENTHESE";case 5:return"RIGHT_PARENTHESE";case 6:return"AND";case 7:return"OR";case 8:return"NOT";case 9:return"DEFINITION";case 10:return 19;case 11:return 16;case 12:return 6}},rules:[/^(?:")/,/^(?:(\\"|[^"])*)/,/^(?:")/,/^(?:[^\S]+)/,/^(?:\()/,/^(?:\))/,/^(?:AND\b)/,/^(?:OR\b)/,/^(?:NOT\b)/,/^(?::)/,/^(?:(!?=|<=?|>=?))/,/^(?:[^\s\n"():><!=]+)/,/^(?:$)/],conditions:{endquote:{rules:[2],inclusive:!1},letsquote:{rules:[1],inclusive:!1},INITIAL:{rules:[0,3,4,5,6,7,8,9,10,11,12],inclusive:!0}}};return a}();return p.lexer=q,a.prototype=p,p.Parser=a,new a}();return g.parse(a)}!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.IPv6=b(a)}(this,function(a){var b=a&&a.IPv6;return{best:function(a){a=a.toLowerCase().split(":");var b=a.length,c=8;""===a[0]&&""===a[1]&&""===a[2]?(a.shift(),a.shift()):""===a[0]&&""===a[1]?a.shift():""===a[b-1]&&""===a[b-2]&&a.pop(),b=a.length,-1!==a[b-1].indexOf(".")&&(c=7);var d;for(d=0;b>d&&""!==a[d];d++);if(c>d)for(a.splice(d,1,"0000");a.length<c;)a.splice(d,0,"0000");for(d=0;c>d;d++){for(var b=a[d].split(""),e=0;3>e&&("0"===b[0]&&1<b.length);e++)b.splice(0,1);a[d]=b.join("")}var b=-1,f=e=0,g=-1,h=!1;for(d=0;c>d;d++)h?"0"===a[d]?f+=1:(h=!1,f>e&&(b=g,e=f)):"0"==a[d]&&(h=!0,g=d,f=1);for(f>e&&(b=g,e=f),e>1&&a.splice(b,e,""),b=a.length,c="",""===a[0]&&(beststr=":"),d=0;b>d&&(c+=a[d],d!==b-1);d++)c+=":";return""===a[b-1]&&(c+=":"),c},noConflict:function(){return a.IPv6===this&&(a.IPv6=b),this}}}),function(a){function b(a){throw RangeError(B[a])}function c(a,b){for(var c=a.length;c--;)a[c]=b(a[c]);return a}function d(a,b){return c(a.split(A),b).join(".")}function e(a){for(var b,c,d=[],e=0,f=a.length;f>e;)b=a.charCodeAt(e++),b>=55296&&56319>=b&&f>e?(c=a.charCodeAt(e++),56320==(64512&c)?d.push(((1023&b)<<10)+(1023&c)+65536):(d.push(b),e--)):d.push(b);return d}function f(a){return c(a,function(a){var b="";return a>65535&&(a-=65536,b+=E(a>>>10&1023|55296),a=56320|1023&a),b+=E(a)}).join("")}function g(a,b){return a+22+75*(26>a)-((0!=b)<<5)}function h(a,b,c){var d=0;for(a=c?D(a/u):a>>1,a+=D(a/b);a>C*s>>1;d+=q)a=D(a/C);return D(d+(C+1)*a/(a+t))}function i(a){var c,d,e,g,i,j,k=[],l=a.length,m=0,n=w,o=v;for(d=a.lastIndexOf(x),0>d&&(d=0),e=0;d>e;++e)128<=a.charCodeAt(e)&&b("not-basic"),k.push(a.charCodeAt(e));for(d=d>0?d+1:0;l>d;){for(e=m,c=1,g=q;d>=l&&b("invalid-input"),i=a.charCodeAt(d++),i=10>i-48?i-22:26>i-65?i-65:26>i-97?i-97:q,(i>=q||i>D((p-m)/c))&&b("overflow"),m+=i*c,j=o>=g?r:g>=o+s?s:g-o,!(j>i);g+=q)i=q-j,c>D(p/i)&&b("overflow"),c*=i;c=k.length+1,o=h(m-e,c,0==e),D(m/c)>p-n&&b("overflow"),n+=D(m/c),m%=c,k.splice(m++,0,n)}return f(k)}function j(a){var c,d,f,i,j,k,l,m,n,o,t,u,y=[];for(a=e(a),o=a.length,c=w,d=0,j=v,k=0;o>k;++k)n=a[k],128>n&&y.push(E(n));for((f=i=y.length)&&y.push(x);o>f;){for(l=p,k=0;o>k;++k)n=a[k],n>=c&&l>n&&(l=n);for(t=f+1,l-c>D((p-d)/t)&&b("overflow"),d+=(l-c)*t,c=l,k=0;o>k;++k)if(n=a[k],c>n&&++d>p&&b("overflow"),n==c){for(m=d,l=q;n=j>=l?r:l>=j+s?s:l-j,!(n>m);l+=q)u=m-n,m=q-n,y.push(E(g(n+u%m,0))),m=D(u/m);y.push(E(g(m,0))),j=h(d,t,f==i),d=0,++f}++d,++c}return y.join("")}var k="object"==typeof exports&&exports,l="object"==typeof module&&module&&module.exports==k&&module,m="object"==typeof global&&global;(m.global===m||m.window===m)&&(a=m);var n,o,p=2147483647,q=36,r=1,s=26,t=38,u=700,v=72,w=128,x="-",y=/^xn--/,z=/[^ -~]/,A=/\x2E|\u3002|\uFF0E|\uFF61/g,B={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=q-r,D=Math.floor,E=String.fromCharCode;if(n={version:"1.2.3",ucs2:{decode:e,encode:f},decode:i,encode:j,toASCII:function(a){return d(a,function(a){return z.test(a)?"xn--"+j(a):a})},toUnicode:function(a){return d(a,function(a){return y.test(a)?i(a.slice(4).toLowerCase()):a})}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return n});else if(k&&!k.nodeType)if(l)l.exports=n;else for(o in n)n.hasOwnProperty(o)&&(k[o]=n[o]);else a.punycode=n}(this),function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.SecondLevelDomains=b(a)}(this,function(a){var b=a&&a.SecondLevelDomains,c=Object.prototype.hasOwnProperty,d={list:{ac:"com|gov|mil|net|org",ae:"ac|co|gov|mil|name|net|org|pro|sch",af:"com|edu|gov|net|org",al:"com|edu|gov|mil|net|org",ao:"co|ed|gv|it|og|pb",ar:"com|edu|gob|gov|int|mil|net|org|tur",at:"ac|co|gv|or",au:"asn|com|csiro|edu|gov|id|net|org",ba:"co|com|edu|gov|mil|net|org|rs|unbi|unmo|unsa|untz|unze",bb:"biz|co|com|edu|gov|info|net|org|store|tv",bh:"biz|cc|com|edu|gov|info|net|org",bn:"com|edu|gov|net|org",bo:"com|edu|gob|gov|int|mil|net|org|tv",br:"adm|adv|agr|am|arq|art|ato|b|bio|blog|bmd|cim|cng|cnt|com|coop|ecn|edu|eng|esp|etc|eti|far|flog|fm|fnd|fot|fst|g12|ggf|gov|imb|ind|inf|jor|jus|lel|mat|med|mil|mus|net|nom|not|ntr|odo|org|ppg|pro|psc|psi|qsl|rec|slg|srv|tmp|trd|tur|tv|vet|vlog|wiki|zlg",bs:"com|edu|gov|net|org",bz:"du|et|om|ov|rg",ca:"ab|bc|mb|nb|nf|nl|ns|nt|nu|on|pe|qc|sk|yk",ck:"biz|co|edu|gen|gov|info|net|org",cn:"ac|ah|bj|com|cq|edu|fj|gd|gov|gs|gx|gz|ha|hb|he|hi|hl|hn|jl|js|jx|ln|mil|net|nm|nx|org|qh|sc|sd|sh|sn|sx|tj|tw|xj|xz|yn|zj",co:"com|edu|gov|mil|net|nom|org",cr:"ac|c|co|ed|fi|go|or|sa",cy:"ac|biz|com|ekloges|gov|ltd|name|net|org|parliament|press|pro|tm","do":"art|com|edu|gob|gov|mil|net|org|sld|web",dz:"art|asso|com|edu|gov|net|org|pol",ec:"com|edu|fin|gov|info|med|mil|net|org|pro",eg:"com|edu|eun|gov|mil|name|net|org|sci",er:"com|edu|gov|ind|mil|net|org|rochest|w",es:"com|edu|gob|nom|org",et:"biz|com|edu|gov|info|name|net|org",fj:"ac|biz|com|info|mil|name|net|org|pro",fk:"ac|co|gov|net|nom|org",fr:"asso|com|f|gouv|nom|prd|presse|tm",gg:"co|net|org",gh:"com|edu|gov|mil|org",gn:"ac|com|gov|net|org",gr:"com|edu|gov|mil|net|org",gt:"com|edu|gob|ind|mil|net|org",gu:"com|edu|gov|net|org",hk:"com|edu|gov|idv|net|org",id:"ac|co|go|mil|net|or|sch|web",il:"ac|co|gov|idf|k12|muni|net|org","in":"ac|co|edu|ernet|firm|gen|gov|i|ind|mil|net|nic|org|res",iq:"com|edu|gov|i|mil|net|org",ir:"ac|co|dnssec|gov|i|id|net|org|sch",it:"edu|gov",je:"co|net|org",jo:"com|edu|gov|mil|name|net|org|sch",jp:"ac|ad|co|ed|go|gr|lg|ne|or",ke:"ac|co|go|info|me|mobi|ne|or|sc",kh:"com|edu|gov|mil|net|org|per",ki:"biz|com|de|edu|gov|info|mob|net|org|tel",km:"asso|com|coop|edu|gouv|k|medecin|mil|nom|notaires|pharmaciens|presse|tm|veterinaire",kn:"edu|gov|net|org",kr:"ac|busan|chungbuk|chungnam|co|daegu|daejeon|es|gangwon|go|gwangju|gyeongbuk|gyeonggi|gyeongnam|hs|incheon|jeju|jeonbuk|jeonnam|k|kg|mil|ms|ne|or|pe|re|sc|seoul|ulsan",kw:"com|edu|gov|net|org",ky:"com|edu|gov|net|org",kz:"com|edu|gov|mil|net|org",lb:"com|edu|gov|net|org",lk:"assn|com|edu|gov|grp|hotel|int|ltd|net|ngo|org|sch|soc|web",lr:"com|edu|gov|net|org",lv:"asn|com|conf|edu|gov|id|mil|net|org",ly:"com|edu|gov|id|med|net|org|plc|sch",ma:"ac|co|gov|m|net|org|press",mc:"asso|tm",me:"ac|co|edu|gov|its|net|org|priv",mg:"com|edu|gov|mil|nom|org|prd|tm",mk:"com|edu|gov|inf|name|net|org|pro",ml:"com|edu|gov|net|org|presse",mn:"edu|gov|org",mo:"com|edu|gov|net|org",mt:"com|edu|gov|net|org",mv:"aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro",mw:"ac|co|com|coop|edu|gov|int|museum|net|org",mx:"com|edu|gob|net|org",my:"com|edu|gov|mil|name|net|org|sch",nf:"arts|com|firm|info|net|other|per|rec|store|web",ng:"biz|com|edu|gov|mil|mobi|name|net|org|sch",ni:"ac|co|com|edu|gob|mil|net|nom|org",np:"com|edu|gov|mil|net|org",nr:"biz|com|edu|gov|info|net|org",om:"ac|biz|co|com|edu|gov|med|mil|museum|net|org|pro|sch",pe:"com|edu|gob|mil|net|nom|org|sld",ph:"com|edu|gov|i|mil|net|ngo|org",pk:"biz|com|edu|fam|gob|gok|gon|gop|gos|gov|net|org|web",pl:"art|bialystok|biz|com|edu|gda|gdansk|gorzow|gov|info|katowice|krakow|lodz|lublin|mil|net|ngo|olsztyn|org|poznan|pwr|radom|slupsk|szczecin|torun|warszawa|waw|wroc|wroclaw|zgora",pr:"ac|biz|com|edu|est|gov|info|isla|name|net|org|pro|prof",ps:"com|edu|gov|net|org|plo|sec",pw:"belau|co|ed|go|ne|or",ro:"arts|com|firm|info|nom|nt|org|rec|store|tm|www",rs:"ac|co|edu|gov|in|org",sb:"com|edu|gov|net|org",sc:"com|edu|gov|net|org",sh:"co|com|edu|gov|net|nom|org",sl:"com|edu|gov|net|org",st:"co|com|consulado|edu|embaixada|gov|mil|net|org|principe|saotome|store",sv:"com|edu|gob|org|red",sz:"ac|co|org",tr:"av|bbs|bel|biz|com|dr|edu|gen|gov|info|k12|name|net|org|pol|tel|tsk|tv|web",tt:"aero|biz|cat|co|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel",tw:"club|com|ebiz|edu|game|gov|idv|mil|net|org",mu:"ac|co|com|gov|net|or|org",mz:"ac|co|edu|gov|org",na:"co|com",nz:"ac|co|cri|geek|gen|govt|health|iwi|maori|mil|net|org|parliament|school",pa:"abo|ac|com|edu|gob|ing|med|net|nom|org|sld",pt:"com|edu|gov|int|net|nome|org|publ",py:"com|edu|gov|mil|net|org",qa:"com|edu|gov|mil|net|org",re:"asso|com|nom",ru:"ac|adygeya|altai|amur|arkhangelsk|astrakhan|bashkiria|belgorod|bir|bryansk|buryatia|cbg|chel|chelyabinsk|chita|chukotka|chuvashia|com|dagestan|e-burg|edu|gov|grozny|int|irkutsk|ivanovo|izhevsk|jar|joshkar-ola|kalmykia|kaluga|kamchatka|karelia|kazan|kchr|kemerovo|khabarovsk|khakassia|khv|kirov|koenig|komi|kostroma|kranoyarsk|kuban|kurgan|kursk|lipetsk|magadan|mari|mari-el|marine|mil|mordovia|mosreg|msk|murmansk|nalchik|net|nnov|nov|novosibirsk|nsk|omsk|orenburg|org|oryol|penza|perm|pp|pskov|ptz|rnd|ryazan|sakhalin|samara|saratov|simbirsk|smolensk|spb|stavropol|stv|surgut|tambov|tatarstan|tom|tomsk|tsaritsyn|tsk|tula|tuva|tver|tyumen|udm|udmurtia|ulan-ude|vladikavkaz|vladimir|vladivostok|volgograd|vologda|voronezh|vrn|vyatka|yakutia|yamal|yekaterinburg|yuzhno-sakhalinsk",rw:"ac|co|com|edu|gouv|gov|int|mil|net",sa:"com|edu|gov|med|net|org|pub|sch",sd:"com|edu|gov|info|med|net|org|tv",se:"a|ac|b|bd|c|d|e|f|g|h|i|k|l|m|n|o|org|p|parti|pp|press|r|s|t|tm|u|w|x|y|z",sg:"com|edu|gov|idn|net|org|per",sn:"art|com|edu|gouv|org|perso|univ",sy:"com|edu|gov|mil|net|news|org",th:"ac|co|go|in|mi|net|or",tj:"ac|biz|co|com|edu|go|gov|info|int|mil|name|net|nic|org|test|web",tn:"agrinet|com|defense|edunet|ens|fin|gov|ind|info|intl|mincom|nat|net|org|perso|rnrt|rns|rnu|tourism",tz:"ac|co|go|ne|or",ua:"biz|cherkassy|chernigov|chernovtsy|ck|cn|co|com|crimea|cv|dn|dnepropetrovsk|donetsk|dp|edu|gov|if|in|ivano-frankivsk|kh|kharkov|kherson|khmelnitskiy|kiev|kirovograd|km|kr|ks|kv|lg|lugansk|lutsk|lviv|me|mk|net|nikolaev|od|odessa|org|pl|poltava|pp|rovno|rv|sebastopol|sumy|te|ternopil|uzhgorod|vinnica|vn|zaporizhzhe|zhitomir|zp|zt",ug:"ac|co|go|ne|or|org|sc",uk:"ac|bl|british-library|co|cym|gov|govt|icnet|jet|lea|ltd|me|mil|mod|national-library-scotland|nel|net|nhs|nic|nls|org|orgn|parliament|plc|police|sch|scot|soc",us:"dni|fed|isa|kids|nsn",uy:"com|edu|gub|mil|net|org",ve:"co|com|edu|gob|info|mil|net|org|web",vi:"co|com|k12|net|org",vn:"ac|biz|com|edu|gov|health|info|int|name|net|org|pro",ye:"co|com|gov|ltd|me|net|org|plc",yu:"ac|co|edu|gov|org",za:"ac|agric|alt|bourse|city|co|cybernet|db|edu|gov|grondar|iaccess|imt|inca|landesign|law|mil|net|ngo|nis|nom|olivetti|org|pix|school|tm|web",zm:"ac|co|com|edu|gov|net|org|sch"},has_expression:null,is_expression:null,has:function(a){return!!a.match(d.has_expression)},is:function(a){return!!a.match(d.is_expression)},get:function(a){return(a=a.match(d.has_expression))&&a[1]||null},noConflict:function(){return a.SecondLevelDomains===this&&(a.SecondLevelDomains=b),this},init:function(){var a,b="";for(a in d.list)c.call(d.list,a)&&(b+="|("+("("+d.list[a]+")."+a)+")");d.has_expression=RegExp("\\.("+b.substr(1)+")$","i"),d.is_expression=RegExp("^("+b.substr(1)+")$","i")}};return d.init(),d}),function(a,b){"object"==typeof exports?module.exports=b(require("./punycode"),require("./IPv6"),require("./SecondLevelDomains")):"function"==typeof define&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],b):a.URI=b(a.punycode,a.IPv6,a.SecondLevelDomains,a)}(this,function(a,b,c,d){function e(a,b){return this instanceof e?(void 0===a&&(a="undefined"!=typeof location?location.href+"":""),this.href(a),void 0!==b?this.absoluteTo(b):this):new e(a,b)}function f(a){return a.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function g(a){return void 0===a?"Undefined":String(Object.prototype.toString.call(a)).slice(8,-1)}function h(a){return"Array"===g(a)}function i(a,b){var c,d;if(h(b)){for(c=0,d=b.length;d>c;c++)if(!i(a,b[c]))return!1;return!0}var e=g(b);for(c=0,d=a.length;d>c;c++)if("RegExp"===e){if("string"==typeof a[c]&&a[c].match(b))return!0}else if(a[c]===b)return!0;return!1}function j(a,b){if(!h(a)||!h(b)||a.length!==b.length)return!1;a.sort(),b.sort();for(var c=0,d=a.length;d>c;c++)if(a[c]!==b[c])return!1;return!0}function k(a){return escape(a)}function l(a){return encodeURIComponent(a).replace(/[!'()*]/g,k).replace(/\*/g,"%2A")}var m=d&&d.URI;e.version="1.12.0";var n=e.prototype,o=Object.prototype.hasOwnProperty;e._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,duplicateQueryParameters:e.duplicateQueryParameters,escapeQuerySpace:e.escapeQuerySpace}},e.duplicateQueryParameters=!1,e.escapeQuerySpace=!0,e.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,e.idn_expression=/[^a-z0-9\.-]/i,e.punycode_expression=/(xn--)/i,e.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,e.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,e.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u2018\u2019]))/gi,e.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u201e\u2018\u2019]+$/},e.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},e.invalid_hostname_characters=/[^a-zA-Z0-9\.-]/,e.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src"},e.getDomAttribute=function(a){if(a&&a.nodeName){var b=a.nodeName.toLowerCase();return"input"===b&&"image"!==a.type?void 0:e.domAttributes[b]}},e.encode=l,e.decode=decodeURIComponent,e.iso8859=function(){e.encode=escape,e.decode=unescape},e.unicode=function(){e.encode=l,e.decode=decodeURIComponent},e.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}}},e.encodeQuery=function(a,b){var c=e.encode(a+"");return b?c.replace(/%20/g,"+"):c},e.decodeQuery=function(a,b){a+="";try{return e.decode(b?a.replace(/\+/g,"%20"):a)}catch(c){return a}},e.recodePath=function(a){a=(a+"").split("/");for(var b=0,c=a.length;c>b;b++)a[b]=e.encodePathSegment(e.decode(a[b]));return a.join("/")},e.decodePath=function(a){a=(a+"").split("/");for(var b=0,c=a.length;c>b;b++)a[b]=e.decodePathSegment(a[b]);return a.join("/")};var p,q={encode:"encode",decode:"decode"},r=function(a,b){return function(c){return e[b](c+"").replace(e.characters[a][b].expression,function(c){return e.characters[a][b].map[c]})}};for(p in q)e[p+"PathSegment"]=r("pathname",q[p]);e.encodeReserved=r("reserved","encode"),e.parse=function(a,b){var c;return b||(b={}),c=a.indexOf("#"),c>-1&&(b.fragment=a.substring(c+1)||null,a=a.substring(0,c)),c=a.indexOf("?"),c>-1&&(b.query=a.substring(c+1)||null,a=a.substring(0,c)),"//"===a.substring(0,2)?(b.protocol=null,a=a.substring(2),a=e.parseAuthority(a,b)):(c=a.indexOf(":"),c>-1&&(b.protocol=a.substring(0,c)||null,b.protocol&&!b.protocol.match(e.protocol_expression)?b.protocol=void 0:"file"===b.protocol?a=a.substring(c+3):"//"===a.substring(c+1,c+3)?(a=a.substring(c+3),a=e.parseAuthority(a,b)):(a=a.substring(c+1),b.urn=!0))),b.path=a,b},e.parseHost=function(a,b){var c,d=a.indexOf("/");return-1===d&&(d=a.length),"["===a.charAt(0)?(c=a.indexOf("]"),b.hostname=a.substring(1,c)||null,b.port=a.substring(c+2,d)||null):a.indexOf(":")!==a.lastIndexOf(":")?(b.hostname=a.substring(0,d)||null,b.port=null):(c=a.substring(0,d).split(":"),b.hostname=c[0]||null,b.port=c[1]||null),b.hostname&&"/"!==a.substring(d).charAt(0)&&(d++,a="/"+a),a.substring(d)||"/"},e.parseAuthority=function(a,b){return a=e.parseUserinfo(a,b),e.parseHost(a,b)},e.parseUserinfo=function(a,b){var c=a.indexOf("/"),d=c>-1?a.lastIndexOf("@",c):a.indexOf("@");return d>-1&&(-1===c||c>d)?(c=a.substring(0,d).split(":"),b.username=c[0]?e.decode(c[0]):null,c.shift(),b.password=c[0]?e.decode(c.join(":")):null,a=a.substring(d+1)):(b.username=null,b.password=null),a},e.parseQuery=function(a,b){if(!a)return{};if(a=a.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,""),!a)return{};for(var c,d,f={},g=a.split("&"),h=g.length,i=0;h>i;i++)c=g[i].split("="),d=e.decodeQuery(c.shift(),b),c=c.length?e.decodeQuery(c.join("="),b):null,f[d]?("string"==typeof f[d]&&(f[d]=[f[d]]),f[d].push(c)):f[d]=c;return f},e.build=function(a){var b="";return a.protocol&&(b+=a.protocol+":"),a.urn||!b&&!a.hostname||(b+="//"),b+=e.buildAuthority(a)||"","string"==typeof a.path&&("/"!==a.path.charAt(0)&&"string"==typeof a.hostname&&(b+="/"),b+=a.path),"string"==typeof a.query&&a.query&&(b+="?"+a.query),"string"==typeof a.fragment&&a.fragment&&(b+="#"+a.fragment),b},e.buildHost=function(a){var b="";return a.hostname?(e.ip6_expression.test(a.hostname)?b=a.port?b+("["+a.hostname+"]:"+a.port):b+a.hostname:(b+=a.hostname,a.port&&(b+=":"+a.port)),b):""},e.buildAuthority=function(a){return e.buildUserinfo(a)+e.buildHost(a)},e.buildUserinfo=function(a){var b="";return a.username&&(b+=e.encode(a.username),a.password&&(b+=":"+e.encode(a.password)),b+="@"),b},e.buildQuery=function(a,b,c){var d,f,g,i,j="";for(f in a)if(o.call(a,f)&&f)if(h(a[f]))for(d={},g=0,i=a[f].length;i>g;g++)void 0!==a[f][g]&&void 0===d[a[f][g]+""]&&(j+="&"+e.buildQueryParameter(f,a[f][g],c),!0!==b&&(d[a[f][g]+""]=!0));else void 0!==a[f]&&(j+="&"+e.buildQueryParameter(f,a[f],c));return j.substring(1)},e.buildQueryParameter=function(a,b,c){return e.encodeQuery(a,c)+(null!==b?"="+e.encodeQuery(b,c):"")},e.addQuery=function(a,b,c){if("object"==typeof b)for(var d in b)o.call(b,d)&&e.addQuery(a,d,b[d]);else{if("string"!=typeof b)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");void 0===a[b]?a[b]=c:("string"==typeof a[b]&&(a[b]=[a[b]]),h(c)||(c=[c]),a[b]=a[b].concat(c))}},e.removeQuery=function(a,b,c){var d;if(h(b))for(c=0,d=b.length;d>c;c++)a[b[c]]=void 0;else if("object"==typeof b)for(d in b)o.call(b,d)&&e.removeQuery(a,d,b[d]);else{if("string"!=typeof b)throw new TypeError("URI.addQuery() accepts an object, string as the first parameter");if(void 0!==c){if(a[b]===c)a[b]=void 0;else if(h(a[b])){d=a[b];var f,g,i={};if(h(c))for(f=0,g=c.length;g>f;f++)i[c[f]]=!0;else i[c]=!0;for(f=0,g=d.length;g>f;f++)void 0!==i[d[f]]&&(d.splice(f,1),g--,f--);a[b]=d}}else a[b]=void 0}},e.hasQuery=function(a,b,c,d){if("object"==typeof b){for(var f in b)if(o.call(b,f)&&!e.hasQuery(a,f,b[f]))return!1;return!0}if("string"!=typeof b)throw new TypeError("URI.hasQuery() accepts an object, string as the name parameter");switch(g(c)){case"Undefined":return b in a;case"Boolean":return a=Boolean(h(a[b])?a[b].length:a[b]),c===a;case"Function":return!!c(a[b],b,a);case"Array":return h(a[b])?(d?i:j)(a[b],c):!1;case"RegExp":return h(a[b])?d?i(a[b],c):!1:Boolean(a[b]&&a[b].match(c));case"Number":c=String(c);case"String":return h(a[b])?d?i(a[b],c):!1:a[b]===c;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},e.commonPath=function(a,b){var c,d=Math.min(a.length,b.length);for(c=0;d>c;c++)if(a.charAt(c)!==b.charAt(c)){c--;break}return 1>c?a.charAt(0)===b.charAt(0)&&"/"===a.charAt(0)?"/":"":(("/"!==a.charAt(c)||"/"!==b.charAt(c))&&(c=a.substring(0,c).lastIndexOf("/")),a.substring(0,c+1))},e.withinString=function(a,b,c){c||(c={});var d=c.start||e.findUri.start,f=c.end||e.findUri.end,g=c.trim||e.findUri.trim,h=/[a-z0-9-]=["']?$/i;for(d.lastIndex=0;;){var i=d.exec(a);if(!i)break;if(i=i.index,c.ignoreHtml){var j=a.slice(Math.max(i-3,0),i);if(j&&h.test(j))continue}var j=i+a.slice(i).search(f),k=a.slice(i,j).replace(g,"");c.ignore&&c.ignore.test(k)||(j=i+k.length,k=b(k,i,j,a),a=a.slice(0,i)+k+a.slice(j),d.lastIndex=i+k.length)}return d.lastIndex=0,a},e.ensureValidHostname=function(b){if(b.match(e.invalid_hostname_characters)){if(!a)throw new TypeError("Hostname '"+b+"' contains characters other than [A-Z0-9.-] and Punycode.js is not available");
Romain Courteaud's avatar
Romain Courteaud committed
3 4
if(a.toASCII(b).match(e.invalid_hostname_characters))throw new TypeError("Hostname '"+b+"' contains characters other than [A-Z0-9.-]")}},e.noConflict=function(a){return a?(a={URI:this.noConflict()},URITemplate&&"function"==typeof URITemplate.noConflict&&(a.URITemplate=URITemplate.noConflict()),b&&"function"==typeof b.noConflict&&(a.IPv6=b.noConflict()),SecondLevelDomains&&"function"==typeof SecondLevelDomains.noConflict&&(a.SecondLevelDomains=SecondLevelDomains.noConflict()),a):(d.URI===this&&(d.URI=m),this)},n.build=function(a){return!0===a?this._deferred_build=!0:(void 0===a||this._deferred_build)&&(this._string=e.build(this._parts),this._deferred_build=!1),this},n.clone=function(){return new e(this)},n.valueOf=n.toString=function(){return this.build(!1)._string},q={protocol:"protocol",username:"username",password:"password",hostname:"hostname",port:"port"},r=function(a){return function(b,c){return void 0===b?this._parts[a]||"":(this._parts[a]=b||null,this.build(!c),this)}};for(p in q)n[p]=r(q[p]);q={query:"?",fragment:"#"},r=function(a,b){return function(c,d){return void 0===c?this._parts[a]||"":(null!==c&&(c+="",c.charAt(0)===b&&(c=c.substring(1))),this._parts[a]=c,this.build(!d),this)}};for(p in q)n[p]=r(p,q[p]);q={search:["?","query"],hash:["#","fragment"]},r=function(a,b){return function(c,d){var e=this[a](c,d);return"string"==typeof e&&e.length?b+e:e}};for(p in q)n[p]=r(q[p][1],q[p][0]);n.pathname=function(a,b){if(void 0===a||!0===a){var c=this._parts.path||(this._parts.hostname?"/":"");return a?e.decodePath(c):c}return this._parts.path=a?e.recodePath(a):"/",this.build(!b),this},n.path=n.pathname,n.href=function(a,b){var c;if(void 0===a)return this.toString();this._string="",this._parts=e._parts();var d=a instanceof e,f="object"==typeof a&&(a.hostname||a.path||a.pathname);if(a.nodeName&&(f=e.getDomAttribute(a),a=a[f]||"",f=!1),!d&&f&&void 0!==a.pathname&&(a=a.toString()),"string"==typeof a)this._parts=e.parse(a,this._parts);else{if(!d&&!f)throw new TypeError("invalid input");for(c in d=d?a._parts:a)o.call(this._parts,c)&&(this._parts[c]=d[c])}return this.build(!b),this},n.is=function(a){var b=!1,d=!1,f=!1,g=!1,h=!1,i=!1,j=!1,k=!this._parts.urn;switch(this._parts.hostname&&(k=!1,d=e.ip4_expression.test(this._parts.hostname),f=e.ip6_expression.test(this._parts.hostname),b=d||f,h=(g=!b)&&c&&c.has(this._parts.hostname),i=g&&e.idn_expression.test(this._parts.hostname),j=g&&e.punycode_expression.test(this._parts.hostname)),a.toLowerCase()){case"relative":return k;case"absolute":return!k;case"domain":case"name":return g;case"sld":return h;case"ip":return b;case"ip4":case"ipv4":case"inet4":return d;case"ip6":case"ipv6":case"inet6":return f;case"idn":return i;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return j}return null};var s=n.protocol,t=n.port,u=n.hostname;n.protocol=function(a,b){if(void 0!==a&&a&&(a=a.replace(/:(\/\/)?$/,""),!a.match(e.protocol_expression)))throw new TypeError("Protocol '"+a+"' contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return s.call(this,a,b)},n.scheme=n.protocol,n.port=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0!==a&&(0===a&&(a=null),a&&(a+="",":"===a.charAt(0)&&(a=a.substring(1)),a.match(/[^0-9]/))))throw new TypeError("Port '"+a+"' contains characters other than [0-9]");return t.call(this,a,b)},n.hostname=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0!==a){var c={};e.parseHost(a,c),a=c.hostname}return u.call(this,a,b)},n.host=function(a,b){return this._parts.urn?void 0===a?"":this:void 0===a?this._parts.hostname?e.buildHost(this._parts):"":(e.parseHost(a,this._parts),this.build(!b),this)},n.authority=function(a,b){return this._parts.urn?void 0===a?"":this:void 0===a?this._parts.hostname?e.buildAuthority(this._parts):"":(e.parseAuthority(a,this._parts),this.build(!b),this)},n.userinfo=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a){if(!this._parts.username)return"";var c=e.buildUserinfo(this._parts);return c.substring(0,c.length-1)}return"@"!==a[a.length-1]&&(a+="@"),e.parseUserinfo(a,this._parts),this.build(!b),this},n.resource=function(a,b){var c;return void 0===a?this.path()+this.search()+this.hash():(c=e.parse(a),this._parts.path=c.path,this._parts.query=c.query,this._parts.fragment=c.fragment,this.build(!b),this)},n.subdomain=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var c=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,c)||""}return c=this._parts.hostname.length-this.domain().length,c=this._parts.hostname.substring(0,c),c=RegExp("^"+f(c)),a&&"."!==a.charAt(a.length-1)&&(a+="."),a&&e.ensureValidHostname(a),this._parts.hostname=this._parts.hostname.replace(c,a),this.build(!b),this},n.domain=function(a,b){if(this._parts.urn)return void 0===a?"":this;if("boolean"==typeof a&&(b=a,a=void 0),void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var c=this._parts.hostname.match(/\./g);return c&&2>c.length?this._parts.hostname:(c=this._parts.hostname.length-this.tld(b).length-1,c=this._parts.hostname.lastIndexOf(".",c-1)+1,this._parts.hostname.substring(c)||"")}if(!a)throw new TypeError("cannot set domain empty");return e.ensureValidHostname(a),!this._parts.hostname||this.is("IP")?this._parts.hostname=a:(c=RegExp(f(this.domain())+"$"),this._parts.hostname=this._parts.hostname.replace(c,a)),this.build(!b),this},n.tld=function(a,b){if(this._parts.urn)return void 0===a?"":this;if("boolean"==typeof a&&(b=a,a=void 0),void 0===a){if(!this._parts.hostname||this.is("IP"))return"";var d=this._parts.hostname.lastIndexOf("."),d=this._parts.hostname.substring(d+1);return!0!==b&&c&&c.list[d.toLowerCase()]?c.get(this._parts.hostname)||d:d}if(!a)throw new TypeError("cannot set TLD empty");if(a.match(/[^a-zA-Z0-9-]/)){if(!c||!c.is(a))throw new TypeError("TLD '"+a+"' contains characters other than [A-Z0-9]");d=RegExp(f(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(d,a)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");d=RegExp(f(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(d,a)}return this.build(!b),this},n.directory=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a||!0===a){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var c=this._parts.path.length-this.filename().length-1,c=this._parts.path.substring(0,c)||(this._parts.hostname?"/":"");return a?e.decodePath(c):c}return c=this._parts.path.length-this.filename().length,c=this._parts.path.substring(0,c),c=RegExp("^"+f(c)),this.is("relative")||(a||(a="/"),"/"!==a.charAt(0)&&(a="/"+a)),a&&"/"!==a.charAt(a.length-1)&&(a+="/"),a=e.recodePath(a),this._parts.path=this._parts.path.replace(c,a),this.build(!b),this},n.filename=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a||!0===a){if(!this._parts.path||"/"===this._parts.path)return"";var c=this._parts.path.lastIndexOf("/"),c=this._parts.path.substring(c+1);return a?e.decodePathSegment(c):c}c=!1,"/"===a.charAt(0)&&(a=a.substring(1)),a.match(/\.?\//)&&(c=!0);var d=RegExp(f(this.filename())+"$");return a=e.recodePath(a),this._parts.path=this._parts.path.replace(d,a),c?this.normalizePath(b):this.build(!b),this},n.suffix=function(a,b){if(this._parts.urn)return void 0===a?"":this;if(void 0===a||!0===a){if(!this._parts.path||"/"===this._parts.path)return"";var c=this.filename(),d=c.lastIndexOf(".");return-1===d?"":(c=c.substring(d+1),c=/^[a-z0-9%]+$/i.test(c)?c:"",a?e.decodePathSegment(c):c)}if("."===a.charAt(0)&&(a=a.substring(1)),c=this.suffix())d=a?RegExp(f(c)+"$"):RegExp(f("."+c)+"$");else{if(!a)return this;this._parts.path+="."+e.recodePath(a)}return d&&(a=e.recodePath(a),this._parts.path=this._parts.path.replace(d,a)),this.build(!b),this},n.segment=function(a,b,c){var d=this._parts.urn?":":"/",e=this.path(),f="/"===e.substring(0,1),e=e.split(d);if(void 0!==a&&"number"!=typeof a&&(c=b,b=a,a=void 0),void 0!==a&&"number"!=typeof a)throw Error("Bad segment '"+a+"', must be 0-based integer");if(f&&e.shift(),0>a&&(a=Math.max(e.length+a,0)),void 0===b)return void 0===a?e:e[a];if(null===a||void 0===e[a])if(h(b)){e=[],a=0;for(var g=b.length;g>a;a++)(b[a].length||e.length&&e[e.length-1].length)&&(e.length&&!e[e.length-1].length&&e.pop(),e.push(b[a]))}else(b||"string"==typeof b)&&(""===e[e.length-1]?e[e.length-1]=b:e.push(b));else b||"string"==typeof b&&b.length?e[a]=b:e.splice(a,1);return f&&e.unshift(""),this.path(e.join(d),c)},n.segmentCoded=function(a,b,c){var d,f;if("number"!=typeof a&&(c=b,b=a,a=void 0),void 0===b){if(a=this.segment(a,b,c),h(a))for(d=0,f=a.length;f>d;d++)a[d]=e.decode(a[d]);else a=void 0!==a?e.decode(a):void 0;return a}if(h(b))for(d=0,f=b.length;f>d;d++)b[d]=e.decode(b[d]);else b="string"==typeof b?e.encode(b):b;return this.segment(a,b,c)};var v=n.query;return n.query=function(a,b){if(!0===a)return e.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"==typeof a){var c=e.parseQuery(this._parts.query,this._parts.escapeQuerySpace),d=a.call(this,c);return this._parts.query=e.buildQuery(d||c,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!b),this}return void 0!==a&&"string"!=typeof a?(this._parts.query=e.buildQuery(a,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!b),this):v.call(this,a,b)},n.setQuery=function(a,b,c){var d=e.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("object"==typeof a)for(var f in a)o.call(a,f)&&(d[f]=a[f]);else{if("string"!=typeof a)throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");d[a]=void 0!==b?b:null}return this._parts.query=e.buildQuery(d,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof a&&(c=b),this.build(!c),this},n.addQuery=function(a,b,c){var d=e.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return e.addQuery(d,a,void 0===b?null:b),this._parts.query=e.buildQuery(d,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof a&&(c=b),this.build(!c),this},n.removeQuery=function(a,b,c){var d=e.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return e.removeQuery(d,a,b),this._parts.query=e.buildQuery(d,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeof a&&(c=b),this.build(!c),this},n.hasQuery=function(a,b,c){var d=e.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return e.hasQuery(d,a,b,c)},n.setSearch=n.setQuery,n.addSearch=n.addQuery,n.removeSearch=n.removeQuery,n.hasSearch=n.hasQuery,n.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},n.normalizeProtocol=function(a){return"string"==typeof this._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!a)),this},n.normalizeHostname=function(c){return this._parts.hostname&&(this.is("IDN")&&a?this._parts.hostname=a.toASCII(this._parts.hostname):this.is("IPv6")&&b&&(this._parts.hostname=b.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!c)),this},n.normalizePort=function(a){return"string"==typeof this._parts.protocol&&this._parts.port===e.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!a)),this},n.normalizePath=function(a){if(this._parts.urn||!this._parts.path||"/"===this._parts.path)return this;var b,c,d,f=this._parts.path,g="";for("/"!==f.charAt(0)&&(b=!0,f="/"+f),f=f.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),b&&(g=f.substring(1).match(/^(\.\.\/)+/)||"")&&(g=g[0]);c=f.indexOf("/.."),-1!==c;)0!==c?(d=f.substring(0,c).lastIndexOf("/"),-1===d&&(d=c),f=f.substring(0,d)+f.substring(c+3)):f=f.substring(3);return b&&this.is("relative")&&(f=g+f.substring(1)),f=e.recodePath(f),this._parts.path=f,this.build(!a),this},n.normalizePathname=n.normalizePath,n.normalizeQuery=function(a){return"string"==typeof this._parts.query&&(this._parts.query.length?this.query(e.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!a)),this},n.normalizeFragment=function(a){return this._parts.fragment||(this._parts.fragment=null,this.build(!a)),this},n.normalizeSearch=n.normalizeQuery,n.normalizeHash=n.normalizeFragment,n.iso8859=function(){var a=e.encode,b=e.decode;return e.encode=escape,e.decode=decodeURIComponent,this.normalize(),e.encode=a,e.decode=b,this},n.unicode=function(){var a=e.encode,b=e.decode;return e.encode=l,e.decode=unescape,this.normalize(),e.encode=a,e.decode=b,this},n.readable=function(){var b=this.clone();b.username("").password("").normalize();var c="";if(b._parts.protocol&&(c+=b._parts.protocol+"://"),b._parts.hostname&&(b.is("punycode")&&a?(c+=a.toUnicode(b._parts.hostname),b._parts.port&&(c+=":"+b._parts.port)):c+=b.host()),b._parts.hostname&&b._parts.path&&"/"!==b._parts.path.charAt(0)&&(c+="/"),c+=b.path(!0),b._parts.query){for(var d="",f=0,g=b._parts.query.split("&"),h=g.length;h>f;f++){var i=(g[f]||"").split("="),d=d+("&"+e.decodeQuery(i[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"));void 0!==i[1]&&(d+="="+e.decodeQuery(i[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}c+="?"+d.substring(1)}return c+=e.decodeQuery(b.hash(),!0)},n.absoluteTo=function(a){var b,c,d=this.clone(),f=["protocol","username","password","hostname","port"];if(this._parts.urn)throw Error("URNs do not have any generally defined hierarchical components");if(a instanceof e||(a=new e(a)),d._parts.protocol||(d._parts.protocol=a._parts.protocol),this._parts.hostname)return d;for(b=0;c=f[b];b++)d._parts[c]=a._parts[c];return d._parts.path?".."===d._parts.path.substring(-2)&&(d._parts.path+="/"):(d._parts.path=a._parts.path,d._parts.query||(d._parts.query=a._parts.query)),"/"!==d.path().charAt(0)&&(a=a.directory(),d._parts.path=(a?a+"/":"")+d._parts.path,d.normalizePath()),d.build(),d},n.relativeTo=function(a){var b,c,d,f,g=this.clone().normalize();if(g._parts.urn)throw Error("URNs do not have any generally defined hierarchical components");if(a=new e(a).normalize(),b=g._parts,c=a._parts,d=g.path(),f=a.path(),"/"!==d.charAt(0))throw Error("URI is already relative");if("/"!==f.charAt(0))throw Error("Cannot calculate a URI relative to another relative URI");return b.protocol===c.protocol&&(b.protocol=null),b.username!==c.username||b.password!==c.password||null!==b.protocol||null!==b.username||null!==b.password||b.hostname!==c.hostname||b.port!==c.port?g.build():(b.hostname=null,b.port=null,d===f?(b.path="",g.build()):(a=e.commonPath(g.path(),a.path()))?(c=c.path.substring(a.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../"),b.path=c+b.path.substring(a.length),g.build()):g.build())},n.equals=function(a){var b=this.clone();a=new e(a);var c,d={},f={},g={};if(b.normalize(),a.normalize(),b.toString()===a.toString())return!0;if(d=b.query(),f=a.query(),b.query(""),a.query(""),b.toString()!==a.toString()||d.length!==f.length)return!1;d=e.parseQuery(d,this._parts.escapeQuerySpace),f=e.parseQuery(f,this._parts.escapeQuerySpace);for(c in d)if(o.call(d,c)){if(h(d[c])){if(!j(d[c],f[c]))return!1}else if(d[c]!==f[c])return!1;g[c]=!0}for(c in f)if(o.call(f,c)&&!g[c])return!1;return!0},n.duplicateQueryParameters=function(a){return this._parts.duplicateQueryParameters=!!a,this},n.escapeQuerySpace=function(a){return this._parts.escapeQuerySpace=!!a,this},e}),function(a,b){"object"==typeof exports?module.exports=b(require("./URI")):"function"==typeof define&&define.amd?define(["./URI"],b):b(a.URI)}(this,function(a){var b=a.prototype,c=b.fragment;a.fragmentPrefix="?";var d=a._parts;return a._parts=function(){var b=d();return b.fragmentPrefix=a.fragmentPrefix,b},b.fragmentPrefix=function(a){return this._parts.fragmentPrefix=a,this},b.fragment=function(b,d){var e=this._parts.fragmentPrefix,f=this._parts.fragment||"";return!0===b?f.substring(0,e.length)!==e?{}:a.parseQuery(f.substring(e.length)):void 0!==b&&"string"!=typeof b?(this._parts.fragment=e+a.buildQuery(b),this.build(!d),this):c.call(this,b,d)},b.addFragment=function(b,c,d){var e=this._parts.fragmentPrefix,f=a.parseQuery((this._parts.fragment||"").substring(e.length));return a.addQuery(f,b,c),this._parts.fragment=e+a.buildQuery(f),"string"!=typeof b&&(d=c),this.build(!d),this},b.removeFragment=function(b,c,d){var e=this._parts.fragmentPrefix,f=a.parseQuery((this._parts.fragment||"").substring(e.length));return a.removeQuery(f,b,c),this._parts.fragment=e+a.buildQuery(f),"string"!=typeof b&&(d=c),this.build(!d),this},b.addHash=b.addFragment,b.removeHash=b.removeFragment,{}}),function(a){"use strict";function b(a){var c;if(null===a||void 0===a)return!1;if(d.isArray(a))return a.length>0;if("string"==typeof a||"number"==typeof a||"boolean"==typeof a)return!0;for(c in a)if(a.hasOwnProperty(c)&&b(a[c]))return!0;return!1}var c=function(){function a(a){this.options=a}return a.prototype.toString=function(){return JSON&&JSON.stringify?JSON.stringify(this.options):this.options},a}(),d=function(){function a(a){return"[object Array]"===Object.prototype.toString.apply(a)}function b(a){return"[object String]"===Object.prototype.toString.apply(a)}function c(a){return"[object Number]"===Object.prototype.toString.apply(a)}function d(a){return"[object Boolean]"===Object.prototype.toString.apply(a)}function e(a,b){var c,d="",e=!0;for(c=0;c<a.length;c+=1)e?e=!1:d+=b,d+=a[c];return d}function f(a,b){for(var c=[],d=0;d<a.length;d+=1)c.push(b(a[d]));return c}function g(a,b){for(var c=[],d=0;d<a.length;d+=1)b(a[d])&&c.push(a[d]);return c}function h(a){if("object"!=typeof a||null===a)return a;Object.freeze(a);var b,c;for(c in a)a.hasOwnProperty(c)&&(b=a[c],"object"!=typeof b||b instanceof RegExp||i(b));return a}function i(a){return"function"==typeof Object.freeze?h(a):a}return{isArray:a,isString:b,isNumber:c,isBoolean:d,join:e,map:f,filter:g,deepFreeze:i}}(),e=function(){function a(a){return a>="a"&&"z">=a||a>="A"&&"Z">=a}function b(a){return a>="0"&&"9">=a}function c(a){return b(a)||a>="a"&&"f">=a||a>="A"&&"F">=a}return{isAlpha:a,isDigit:b,isHexDigit:c}}(),f=function(){function a(a){var b,c,d="",e=g.encode(a);for(c=0;c<e.length;c+=1)b=e.charCodeAt(c),d+="%"+(16>b?"0":"")+b.toString(16).toUpperCase();return d}function b(a,b){return"%"===a.charAt(b)&&e.isHexDigit(a.charAt(b+1))&&e.isHexDigit(a.charAt(b+2))}function c(a,b){return parseInt(a.substr(b,2),16)}function d(a){if(!b(a,0))return!1;var d=c(a,1),e=g.numBytes(d);if(0===e)return!1;for(var f=1;e>f;f+=1)if(!b(a,3*f)||!g.isValidFollowingCharCode(c(a,3*f+1)))return!1;return!0}function f(a,d){var e=a.charAt(d);if(!b(a,d))return e;var f=c(a,d+1),h=g.numBytes(f);if(0===h)return e;for(var i=1;h>i;i+=1)if(!b(a,d+3*i)||!g.isValidFollowingCharCode(c(a,d+3*i+1)))return e;return a.substr(d,3*h)}var g={encode:function(a){return unescape(encodeURIComponent(a))},numBytes:function(a){return 127>=a?1:a>=194&&223>=a?2:a>=224&&239>=a?3:a>=240&&244>=a?4:0},isValidFollowingCharCode:function(a){return a>=128&&191>=a}};return{encodeCharacter:a,isPctEncoded:d,pctCharAt:f}}(),g=function(){function a(a){return e.isAlpha(a)||e.isDigit(a)||"_"===a||f.isPctEncoded(a)}function b(a){return e.isAlpha(a)||e.isDigit(a)||"-"===a||"."===a||"_"===a||"~"===a}function c(a){return":"===a||"/"===a||"?"===a||"#"===a||"["===a||"]"===a||"@"===a||"!"===a||"$"===a||"&"===a||"("===a||")"===a||"*"===a||"+"===a||","===a||";"===a||"="===a||"'"===a}return{isVarchar:a,isUnreserved:b,isReserved:c}}(),h=function(){function a(a,b){var c,d="",e="";for(("number"==typeof a||"boolean"==typeof a)&&(a=a.toString()),c=0;c<a.length;c+=e.length)e=a.charAt(c),d+=g.isUnreserved(e)||b&&g.isReserved(e)?e:f.encodeCharacter(e);return d}function b(b){return a(b,!0)}function c(a,b){var c=f.pctCharAt(a,b);return c.length>1?c:g.isReserved(c)||g.isUnreserved(c)?c:f.encodeCharacter(c)}function d(a){var b,c="",d="";for(b=0;b<a.length;b+=d.length)d=f.pctCharAt(a,b),c+=d.length>1?d:g.isReserved(d)||g.isUnreserved(d)?d:f.encodeCharacter(d);return c}return{encode:a,encodePassReserved:b,encodeLiteral:d,encodeLiteralCharacter:c}}(),i=function(){function a(a){b[a]={symbol:a,separator:"?"===a?"&":""===a||"+"===a||"#"===a?",":a,named:";"===a||"&"===a||"?"===a,ifEmpty:"&"===a||"?"===a?"=":"",first:"+"===a?"":a,encode:"+"===a||"#"===a?h.encodePassReserved:h.encode,toString:function(){return this.symbol}}}var b={};return a(""),a("+"),a("#"),a("."),a("/"),a(";"),a("?"),a("&"),{valueOf:function(a){return b[a]?b[a]:"=,!@|".indexOf(a)>=0?null:b[""]}}}(),j=function(){function a(a){this.literal=h.encodeLiteral(a)}return a.prototype.expand=function(){return this.literal},a.prototype.toString=a.prototype.expand,a}(),k=function(){function a(a){function b(){var b=a.substring(n,j);if(0===b.length)throw new c({expressionText:a,message:"a varname must be specified",position:j});m={varname:b,exploded:!1,maxLength:null},n=null}function d(){if(o===j)throw new c({expressionText:a,message:"after a ':' you have to specify the length",position:j});m.maxLength=parseInt(a.substring(o,j),10),o=null}var h,j,k=[],m=null,n=null,o=null,p="";for(h=function(b){var d=i.valueOf(b);if(null===d)throw new c({expressionText:a,message:"illegal use of reserved operator",position:j,operator:b});return d}(a.charAt(0)),j=h.symbol.length,n=j;j<a.length;j+=p.length){if(p=f.pctCharAt(a,j),null!==n){if("."===p){if(n===j)throw new c({expressionText:a,message:"a varname MUST NOT start with a dot",position:j});continue}if(g.isVarchar(p))continue;b()}if(null!==o){if(j===o&&"0"===p)throw new c({expressionText:a,message:"A :prefix must not start with digit 0",position:j});if(e.isDigit(p)){if(j-o>=4)throw new c({expressionText:a,message:"A :prefix must have max 4 digits",position:j});continue}d()}if(":"!==p)if("*"!==p){if(","!==p)throw new c({expressionText:a,message:"illegal character",character:p,position:j});k.push(m),m=null,n=j+1}else{if(null===m)throw new c({expressionText:a,message:"exploded without varspec",position:j});if(m.exploded)throw new c({expressionText:a,message:"exploded twice",position:j});if(m.maxLength)throw new c({expressionText:a,message:"an explode (*) MUST NOT follow to a prefix",position:j});m.exploded=!0}else{if(null!==m.maxLength)throw new c({expressionText:a,message:"only one :maxLength is allowed per varspec",position:j});if(m.exploded)throw new c({expressionText:a,message:"an exploeded varspec MUST NOT be varspeced",position:j});o=j+1}}return null!==n&&b(),null!==o&&d(),k.push(m),new l(a,h,k)}function b(a){return a.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function d(d){var e,f,g,h=[],i=null,k="",l=!0,n=0;for(e=0;e<d.length;e+=1)if(f=d.charAt(e),null===n){if(null===i)throw new Error("reached unreachable code");if("{"===f)throw new c({templateText:d,message:"brace already opened",position:e});if("}"===f){if(i+1===e)throw new c({templateText:d,message:"empty braces",position:i});try{g=a(d.substring(i+1,e))}catch(o){if(o.prototype===c.prototype)throw new c({templateText:d,message:o.options.message,position:i+o.options.position,details:o.options});throw o}h.push(g),0===g.operator.symbol.length?k+="([^/]+)":l=!1,i=null,n=e+1}}else{if("}"===f)throw new c({templateText:d,message:"unopened brace closed",position:e});"{"===f&&(e>n&&(g=new j(d.substring(n,e)),h.push(g),k+=b(g.literal)),n=null,i=e)}if(null!==i)throw new c({templateText:d,message:"unclosed brace",position:i});return n<d.length&&(g=new j(d.substring(n)),h.push(g),k+=b(g.literal)),l===!1&&(k=void 0),new m(d,h,k)}return d}(),l=function(){function a(a){return JSON&&JSON.stringify?JSON.stringify(a):a}function c(a){if(!b(a))return!0;if(d.isString(a))return""===a;if(d.isNumber(a)||d.isBoolean(a))return!1;if(d.isArray(a))return 0===a.length;for(var c in a)if(a.hasOwnProperty(c))return!1;return!0}function e(a){var b,c=[];for(b in a)a.hasOwnProperty(b)&&c.push({name:b,value:a[b]});return c}function f(a,b,c){this.templateText=a,this.operator=b,this.varspecs=c}function g(a,b,c){var d="";if(c=c.toString(),b.named){if(d+=h.encodeLiteral(a.varname),""===c)return d+=b.ifEmpty;d+="="}return null!==a.maxLength&&(c=c.substr(0,a.maxLength)),d+=b.encode(c)}function i(a){return b(a.value)}function j(a,f,g){var j=[],k="";if(f.named){if(k+=h.encodeLiteral(a.varname),c(g))return k+=f.ifEmpty;k+="="}return d.isArray(g)?(j=g,j=d.filter(j,b),j=d.map(j,f.encode),k+=d.join(j,",")):(j=e(g),j=d.filter(j,i),j=d.map(j,function(a){return f.encode(a.name)+","+f.encode(a.value)}),k+=d.join(j,",")),k}function k(a,f,g){var j=d.isArray(g),k=[];return j?(k=g,k=d.filter(k,b),k=d.map(k,function(b){var d=h.encodeLiteral(a.varname);return d+=c(b)?f.ifEmpty:"="+f.encode(b)})):(k=e(g),k=d.filter(k,i),k=d.map(k,function(a){var b=h.encodeLiteral(a.name);return b+=c(a.value)?f.ifEmpty:"="+f.encode(a.value)})),d.join(k,f.separator)}function l(a,c){var f=[],g="";return d.isArray(c)?(f=c,f=d.filter(f,b),f=d.map(f,a.encode),g+=d.join(f,a.separator)):(f=e(c),f=d.filter(f,function(a){return b(a.value)}),f=d.map(f,function(b){return a.encode(b.name)+"="+a.encode(b.value)}),g+=d.join(f,a.separator)),g}return f.prototype.toString=function(){return this.templateText},f.prototype.expand=function(e){var f,h,i,m,n=[],o=!1,p=this.operator;for(f=0;f<this.varspecs.length;f+=1)if(h=this.varspecs[f],i=e[h.varname],null!==i&&void 0!==i)if(h.exploded&&(o=!0),m=d.isArray(i),"string"==typeof i||"number"==typeof i||"boolean"==typeof i)n.push(g(h,p,i));else{if(h.maxLength&&b(i))throw new Error("Prefix modifiers are not applicable to variables that have composite values. You tried to expand "+this+" with "+a(i));h.exploded?b(i)&&(p.named?n.push(k(h,p,i)):n.push(l(p,i))):(p.named||!c(i))&&n.push(j(h,p,i))}return 0===n.length?"":p.first+d.join(n,p.separator)},f}(),m=function(){function a(a,b,c){this.templateText=a,this.expressions=b,void 0!==c&&(this.regexp=new RegExp("^"+c+"$")),d.deepFreeze(this)}return a.prototype.toString=function(){return this.templateText},a.prototype.expand=function(a){var b,c="";for(b=0;b<this.expressions.length;b+=1)c+=this.expressions[b].expand(a);return c},a.prototype.extract=function(a){var b,c,d,e,f=1,g=!0,h={};if(void 0!==this.regexp&&this.regexp.test(a)){for(e=this.regexp.exec(a),b=0;b<this.expressions.length;b+=1)c=this.expressions[b],void 0===c.literal&&(void 0!==c.operator&&0===c.operator.symbol.length&&1===c.varspecs.length?(d=c.varspecs[0],d.exploded===!1&&null===d.maxLength&&-1===e[f].indexOf(",")?(h[d.varname]=decodeURIComponent(e[f]),f+=1):g=!1):g=!1);if(g)return h}return!1},a.parse=k,a.UriTemplateError=c,a}();a(m)}(function(a){"use strict";"undefined"!=typeof module?module.exports=a:"function"==typeof define?define([],function(){return a}):"undefined"!=typeof window?window.UriTemplate=a:global.UriTemplate=a});var LZString=function(){function a(a,b){if(!e[a]){e[a]={};for(var c=0;c<a.length;c++)e[a][a.charAt(c)]=c}return e[a][b]}var b=String.fromCharCode,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",e={},f={compressToBase64:function(a){if(null==a)return"";var b=f._compress(a,6,function(a){return c.charAt(a)});switch(b.length%4){default:case 0:return b;case 1:return b+"===";case 2:return b+"==";case 3:return b+"="}},decompressFromBase64:function(b){return null==b?"":""==b?null:f._decompress(b.length,32,function(d){return a(c,b.charAt(d))})},compressToUTF16:function(a){return null==a?"":f._compress(a,15,function(a){return b(a+32)})+" "},decompressFromUTF16:function(a){return null==a?"":""==a?null:f._decompress(a.length,16384,function(b){return a.charCodeAt(b)-32})},compressToUint8Array:function(a){for(var b=f.compress(a),c=new Uint8Array(2*b.length),d=0,e=b.length;e>d;d++){var g=b.charCodeAt(d);c[2*d]=g>>>8,c[2*d+1]=g%256}return c},decompressFromUint8Array:function(a){if(null===a||void 0===a)return f.decompress(a);for(var c=new Array(a.length/2),d=0,e=c.length;e>d;d++)c[d]=256*a[2*d]+a[2*d+1];var g=[];return c.forEach(function(a){g.push(b(a))}),f.decompress(g.join(""))},compressToEncodedURIComponent:function(a){return null==a?"":f._compress(a,6,function(a){return d.charAt(a)})},decompressFromEncodedURIComponent:function(b){return null==b?"":""==b?null:(b=b.replace(/ /g,"+"),f._decompress(b.length,32,function(c){return a(d,b.charAt(c))}))},compress:function(a){return f._compress(a,16,function(a){return b(a)})},_compress:function(a,b,c){if(null==a)return"";var d,e,f,g={},h={},i="",j="",k="",l=2,m=3,n=2,o=[],p=0,q=0;for(f=0;f<a.length;f+=1)if(i=a.charAt(f),Object.prototype.hasOwnProperty.call(g,i)||(g[i]=m++,h[i]=!0),j=k+i,Object.prototype.hasOwnProperty.call(g,j))k=j;else{if(Object.prototype.hasOwnProperty.call(h,k)){if(k.charCodeAt(0)<256){for(d=0;n>d;d++)p<<=1,q==b-1?(q=0,o.push(c(p)),p=0):q++;for(e=k.charCodeAt(0),d=0;8>d;d++)p=p<<1|1&e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e>>=1}else{for(e=1,d=0;n>d;d++)p=p<<1|e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e=0;for(e=k.charCodeAt(0),d=0;16>d;d++)p=p<<1|1&e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e>>=1}l--,0==l&&(l=Math.pow(2,n),n++),delete h[k]}else for(e=g[k],d=0;n>d;d++)p=p<<1|1&e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e>>=1;l--,0==l&&(l=Math.pow(2,n),n++),g[j]=m++,k=String(i)}if(""!==k){if(Object.prototype.hasOwnProperty.call(h,k)){if(k.charCodeAt(0)<256){for(d=0;n>d;d++)p<<=1,q==b-1?(q=0,o.push(c(p)),p=0):q++;for(e=k.charCodeAt(0),d=0;8>d;d++)p=p<<1|1&e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e>>=1}else{for(e=1,d=0;n>d;d++)p=p<<1|e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e=0;for(e=k.charCodeAt(0),d=0;16>d;d++)p=p<<1|1&e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e>>=1}l--,0==l&&(l=Math.pow(2,n),n++),delete h[k]}else for(e=g[k],d=0;n>d;d++)p=p<<1|1&e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e>>=1;l--,0==l&&(l=Math.pow(2,n),n++)}for(e=2,d=0;n>d;d++)p=p<<1|1&e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e>>=1;for(;;){if(p<<=1,q==b-1){o.push(c(p));break}q++}return o.join("")},decompress:function(a){return null==a?"":""==a?null:f._decompress(a.length,32768,function(b){return a.charCodeAt(b)})},_decompress:function(a,c,d){var e,f,g,h,i,j,k,l,m=[],n=4,o=4,p=3,q="",r=[],s={val:d(0),position:c,index:1};for(f=0;3>f;f+=1)m[f]=f;for(h=0,j=Math.pow(2,2),k=1;k!=j;)i=s.val&s.position,s.position>>=1,0==s.position&&(s.position=c,s.val=d(s.index++)),h|=(i>0?1:0)*k,k<<=1;switch(e=h){case 0:for(h=0,j=Math.pow(2,8),k=1;k!=j;)i=s.val&s.position,s.position>>=1,0==s.position&&(s.position=c,s.val=d(s.index++)),h|=(i>0?1:0)*k,k<<=1;l=b(h);break;case 1:for(h=0,j=Math.pow(2,16),k=1;k!=j;)i=s.val&s.position,s.position>>=1,0==s.position&&(s.position=c,s.val=d(s.index++)),h|=(i>0?1:0)*k,k<<=1;l=b(h);break;case 2:return""}for(m[3]=l,g=l,r.push(l);;){if(s.index>a)return"";for(h=0,j=Math.pow(2,p),k=1;k!=j;)i=s.val&s.position,s.position>>=1,0==s.position&&(s.position=c,s.val=d(s.index++)),h|=(i>0?1:0)*k,k<<=1;switch(l=h){case 0:for(h=0,j=Math.pow(2,8),k=1;k!=j;)i=s.val&s.position,s.position>>=1,0==s.position&&(s.position=c,s.val=d(s.index++)),h|=(i>0?1:0)*k,k<<=1;m[o++]=b(h),l=o-1,n--;break;case 1:for(h=0,j=Math.pow(2,16),k=1;k!=j;)i=s.val&s.position,s.position>>=1,0==s.position&&(s.position=c,s.val=d(s.index++)),h|=(i>0?1:0)*k,k<<=1;m[o++]=b(h),l=o-1,n--;break;case 2:return r.join("")}if(0==n&&(n=Math.pow(2,p),p++),m[l])q=m[l];else{if(l!==o)return null;q=g+g.charAt(0)}r.push(q),m[o++]=g+q.charAt(0),n--,g=q,0==n&&(n=Math.pow(2,p),p++)}}};return f}();"function"==typeof define&&define.amd?define(function(){return LZString}):"undefined"!=typeof module&&null!=module&&(module.exports=LZString),function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return fd.apply(null,arguments)}function b(a){fd=a}function c(a){return a instanceof Array||"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a);
}function e(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function f(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function g(a,b){for(var c in b)f(b,c)&&(a[c]=b[c]);return f(b,"toString")&&(a.toString=b.toString),f(b,"valueOf")&&(a.valueOf=b.valueOf),a}function h(a,b,c,d){return Ja(a,b,c,d,!0).utc()}function i(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}}function j(a){return null==a._pf&&(a._pf=i()),a._pf}function k(a){if(null==a._isValid){var b=j(a),c=gd.call(b.parsedDateParts,function(a){return null!=a});a._isValid=!isNaN(a._d.getTime())&&b.overflow<0&&!b.empty&&!b.invalidMonth&&!b.invalidWeekday&&!b.nullInput&&!b.invalidFormat&&!b.userInvalidated&&(!b.meridiem||b.meridiem&&c),a._strict&&(a._isValid=a._isValid&&0===b.charsLeftOver&&0===b.unusedTokens.length&&void 0===b.bigHour)}return a._isValid}function l(a){var b=h(NaN);return null!=a?g(j(b),a):j(b).userInvalidated=!0,b}function m(a){return void 0===a}function n(a,b){var c,d,e;if(m(b._isAMomentObject)||(a._isAMomentObject=b._isAMomentObject),m(b._i)||(a._i=b._i),m(b._f)||(a._f=b._f),m(b._l)||(a._l=b._l),m(b._strict)||(a._strict=b._strict),m(b._tzm)||(a._tzm=b._tzm),m(b._isUTC)||(a._isUTC=b._isUTC),m(b._offset)||(a._offset=b._offset),m(b._pf)||(a._pf=j(b)),m(b._locale)||(a._locale=b._locale),hd.length>0)for(c in hd)d=hd[c],e=b[d],m(e)||(a[d]=e);return a}function o(b){n(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),id===!1&&(id=!0,a.updateOffset(this),id=!1)}function p(a){return a instanceof o||null!=a&&null!=a._isAMomentObject}function q(a){return 0>a?Math.ceil(a):Math.floor(a)}function r(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=q(b)),c}function s(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&r(a[d])!==r(b[d]))&&g++;return g+f}function t(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function u(b,c){var d=!0;return g(function(){return null!=a.deprecationHandler&&a.deprecationHandler(null,b),d&&(t(b+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),d=!1),c.apply(this,arguments)},c)}function v(b,c){null!=a.deprecationHandler&&a.deprecationHandler(b,c),jd[b]||(t(c),jd[b]=!0)}function w(a){return a instanceof Function||"[object Function]"===Object.prototype.toString.call(a)}function x(a){return"[object Object]"===Object.prototype.toString.call(a)}function y(a){var b,c;for(c in a)b=a[c],w(b)?this[c]=b:this["_"+c]=b;this._config=a,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function z(a,b){var c,d=g({},a);for(c in b)f(b,c)&&(x(a[c])&&x(b[c])?(d[c]={},g(d[c],a[c]),g(d[c],b[c])):null!=b[c]?d[c]=b[c]:delete d[c]);return d}function A(a){null!=a&&this.set(a)}function B(a){return a?a.toLowerCase().replace("_","-"):a}function C(a){for(var b,c,d,e,f=0;f<a.length;){for(e=B(a[f]).split("-"),b=e.length,c=B(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=D(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&s(e,c,!0)>=b-1)break;b--}f++}return null}function D(a){var b=null;if(!nd[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=ld._abbr,require("./locale/"+a),E(b)}catch(c){}return nd[a]}function E(a,b){var c;return a&&(c=m(b)?H(a):F(a,b),c&&(ld=c)),ld._abbr}function F(a,b){return null!==b?(b.abbr=a,null!=nd[a]?(v("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale"),b=z(nd[a]._config,b)):null!=b.parentLocale&&(null!=nd[b.parentLocale]?b=z(nd[b.parentLocale]._config,b):v("parentLocaleUndefined","specified parentLocale is not defined yet")),nd[a]=new A(b),E(a),nd[a]):(delete nd[a],null)}function G(a,b){if(null!=b){var c;null!=nd[a]&&(b=z(nd[a]._config,b)),c=new A(b),c.parentLocale=nd[a],nd[a]=c,E(a)}else null!=nd[a]&&(null!=nd[a].parentLocale?nd[a]=nd[a].parentLocale:null!=nd[a]&&delete nd[a]);return nd[a]}function H(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return ld;if(!c(a)){if(b=D(a))return b;a=[a]}return C(a)}function I(){return kd(nd)}function J(a,b){var c=a.toLowerCase();od[c]=od[c+"s"]=od[b]=a}function K(a){return"string"==typeof a?od[a]||od[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)f(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(b,c){return function(d){return null!=d?(O(this,b,d),a.updateOffset(this,c),this):N(this,b)}}function N(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function O(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}function P(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=K(a),w(this[a]))return this[a](b);return this}function Q(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function R(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(sd[a]=e),b&&(sd[b[0]]=function(){return Q(e.apply(this,arguments),b[1],b[2])}),c&&(sd[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function S(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function T(a){var b,c,d=a.match(pd);for(b=0,c=d.length;c>b;b++)sd[d[b]]?d[b]=sd[d[b]]:d[b]=S(d[b]);return function(b){var e,f="";for(e=0;c>e;e++)f+=d[e]instanceof Function?d[e].call(b,a):d[e];return f}}function U(a,b){return a.isValid()?(b=V(b,a.localeData()),rd[b]=rd[b]||T(b),rd[b](a)):a.localeData().invalidDate()}function V(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(qd.lastIndex=0;d>=0&&qd.test(a);)a=a.replace(qd,c),qd.lastIndex=0,d-=1;return a}function W(a,b,c){Kd[a]=w(b)?b:function(a,d){return a&&c?c:b}}function X(a,b){return f(Kd,a)?Kd[a](b._strict,b._locale):new RegExp(Y(a))}function Y(a){return Z(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function Z(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function $(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=r(a)}),c=0;c<a.length;c++)Ld[a[c]]=d}function _(a,b){$(a,function(a,c,d,e){d._w=d._w||{},b(a,d._w,d,e)})}function aa(a,b,c){null!=b&&f(Ld,a)&&Ld[a](b,c._a,c,a)}function ba(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function ca(a,b){return c(this._months)?this._months[a.month()]:this._months[Vd.test(b)?"format":"standalone"][a.month()]}function da(a,b){return c(this._monthsShort)?this._monthsShort[a.month()]:this._monthsShort[Vd.test(b)?"format":"standalone"][a.month()]}function ea(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],d=0;12>d;++d)f=h([2e3,d]),this._shortMonthsParse[d]=this.monthsShort(f,"").toLocaleLowerCase(),this._longMonthsParse[d]=this.months(f,"").toLocaleLowerCase();return c?"MMM"===b?(e=md.call(this._shortMonthsParse,g),-1!==e?e:null):(e=md.call(this._longMonthsParse,g),-1!==e?e:null):"MMM"===b?(e=md.call(this._shortMonthsParse,g),-1!==e?e:(e=md.call(this._longMonthsParse,g),-1!==e?e:null)):(e=md.call(this._longMonthsParse,g),-1!==e?e:(e=md.call(this._shortMonthsParse,g),-1!==e?e:null))}function fa(a,b,c){var d,e,f;if(this._monthsParseExact)return ea.call(this,a,b,c);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function ga(a,b){var c;if(!a.isValid())return a;if("string"==typeof b)if(/^\d+$/.test(b))b=r(b);else if(b=a.localeData().monthsParse(b),"number"!=typeof b)return a;return c=Math.min(a.date(),ba(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a}function ha(b){return null!=b?(ga(this,b),a.updateOffset(this,!0),this):N(this,"Month")}function ia(){return ba(this.year(),this.month())}function ja(a){return this._monthsParseExact?(f(this,"_monthsRegex")||la.call(this),a?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&a?this._monthsShortStrictRegex:this._monthsShortRegex}function ka(a){return this._monthsParseExact?(f(this,"_monthsRegex")||la.call(this),a?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&a?this._monthsStrictRegex:this._monthsRegex}function la(){function a(a,b){return b.length-a.length}var b,c,d=[],e=[],f=[];for(b=0;12>b;b++)c=h([2e3,b]),d.push(this.monthsShort(c,"")),e.push(this.months(c,"")),f.push(this.months(c,"")),f.push(this.monthsShort(c,""));for(d.sort(a),e.sort(a),f.sort(a),b=0;12>b;b++)d[b]=Z(d[b]),e[b]=Z(e[b]),f[b]=Z(f[b]);this._monthsRegex=new RegExp("^("+f.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+e.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+d.join("|")+")","i")}function ma(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[Nd]<0||c[Nd]>11?Nd:c[Od]<1||c[Od]>ba(c[Md],c[Nd])?Od:c[Pd]<0||c[Pd]>24||24===c[Pd]&&(0!==c[Qd]||0!==c[Rd]||0!==c[Sd])?Pd:c[Qd]<0||c[Qd]>59?Qd:c[Rd]<0||c[Rd]>59?Rd:c[Sd]<0||c[Sd]>999?Sd:-1,j(a)._overflowDayOfYear&&(Md>b||b>Od)&&(b=Od),j(a)._overflowWeeks&&-1===b&&(b=Td),j(a)._overflowWeekday&&-1===b&&(b=Ud),j(a).overflow=b),a}function na(a){var b,c,d,e,f,g,h=a._i,i=$d.exec(h)||_d.exec(h);if(i){for(j(a).iso=!0,b=0,c=be.length;c>b;b++)if(be[b][1].exec(i[1])){e=be[b][0],d=be[b][2]!==!1;break}if(null==e)return void(a._isValid=!1);if(i[3]){for(b=0,c=ce.length;c>b;b++)if(ce[b][1].exec(i[3])){f=(i[2]||" ")+ce[b][0];break}if(null==f)return void(a._isValid=!1)}if(!d&&null!=f)return void(a._isValid=!1);if(i[4]){if(!ae.exec(i[4]))return void(a._isValid=!1);g="Z"}a._f=e+(f||"")+(g||""),Ca(a)}else a._isValid=!1}function oa(b){var c=de.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(na(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function pa(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 100>a&&a>=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function qa(a){var b=new Date(Date.UTC.apply(null,arguments));return 100>a&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}function ra(a){return sa(a)?366:365}function sa(a){return a%4===0&&a%100!==0||a%400===0}function ta(){return sa(this.year())}function ua(a,b,c){var d=7+b-c,e=(7+qa(a,0,d).getUTCDay()-b)%7;return-e+d-1}function va(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ua(a,d,e),j=1+7*(b-1)+h+i;return 0>=j?(f=a-1,g=ra(f)+j):j>ra(a)?(f=a+1,g=j-ra(a)):(f=a,g=j),{year:f,dayOfYear:g}}function wa(a,b,c){var d,e,f=ua(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return 1>g?(e=a.year()-1,d=g+xa(e,b,c)):g>xa(a.year(),b,c)?(d=g-xa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function xa(a,b,c){var d=ua(a,b,c),e=ua(a+1,b,c);return(ra(a)-d+e)/7}function ya(a,b,c){return null!=a?a:null!=b?b:c}function za(b){var c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]}function Aa(a){var b,c,d,e,f=[];if(!a._d){for(d=za(a),a._w&&null==a._a[Od]&&null==a._a[Nd]&&Ba(a),a._dayOfYear&&(e=ya(a._a[Md],d[Md]),a._dayOfYear>ra(e)&&(j(a)._overflowDayOfYear=!0),c=qa(e,0,a._dayOfYear),a._a[Nd]=c.getUTCMonth(),a._a[Od]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[Pd]&&0===a._a[Qd]&&0===a._a[Rd]&&0===a._a[Sd]&&(a._nextDay=!0,a._a[Pd]=0),a._d=(a._useUTC?qa:pa).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[Pd]=24)}}function Ba(a){var b,c,d,e,f,g,h,i;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=ya(b.GG,a._a[Md],wa(Ka(),1,4).year),d=ya(b.W,1),e=ya(b.E,1),(1>e||e>7)&&(i=!0)):(f=a._locale._week.dow,g=a._locale._week.doy,c=ya(b.gg,a._a[Md],wa(Ka(),f,g).year),d=ya(b.w,1),null!=b.d?(e=b.d,(0>e||e>6)&&(i=!0)):null!=b.e?(e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):e=f),1>d||d>xa(c,f,g)?j(a)._overflowWeeks=!0:null!=i?j(a)._overflowWeekday=!0:(h=va(c,d,e,f,g),a._a[Md]=h.year,a._dayOfYear=h.dayOfYear)}function Ca(b){if(b._f===a.ISO_8601)return void na(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=V(b._f,b._locale).match(pd)||[],c=0;c<e.length;c++)f=e[c],d=(h.match(X(f,b))||[])[0],d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),sd[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),aa(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[Pd]<=12&&b._a[Pd]>0&&(j(b).bigHour=void 0),j(b).parsedDateParts=b._a.slice(0),j(b).meridiem=b._meridiem,b._a[Pd]=Da(b._locale,b._a[Pd],b._meridiem),Aa(b),ma(b)}function Da(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function Ea(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;e<a._f.length;e++)f=0,b=n({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._f=a._f[e],Ca(b),k(b)&&(f+=j(b).charsLeftOver,f+=10*j(b).unusedTokens.length,j(b).score=f,(null==d||d>f)&&(d=f,c=b));g(a,c||b)}function Fa(a){if(!a._d){var b=L(a._i);a._a=e([b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],function(a){return a&&parseInt(a,10)}),Aa(a)}}function Ga(a){var b=new o(ma(Ha(a)));return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function Ha(a){var b=a._i,e=a._f;return a._locale=a._locale||H(a._l),null===b||void 0===e&&""===b?l({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),p(b)?new o(ma(b)):(c(e)?Ea(a):e?Ca(a):d(b)?a._d=b:Ia(a),k(a)||(a._d=null),a))}function Ia(b){var f=b._i;void 0===f?b._d=new Date(a.now()):d(f)?b._d=new Date(f.valueOf()):"string"==typeof f?oa(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),Aa(b)):"object"==typeof f?Fa(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function Ja(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,Ga(f)}function Ka(a,b,c,d){return Ja(a,b,c,d,!1)}function La(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Ka();for(d=b[0],e=1;e<b.length;++e)(!b[e].isValid()||b[e][a](d))&&(d=b[e]);return d}function Ma(){var a=[].slice.call(arguments,0);return La("isBefore",a)}function Na(){var a=[].slice.call(arguments,0);return La("isAfter",a)}function Oa(a){var b=L(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+1e3*h*60*60,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=H(),this._bubble()}function Pa(a){return a instanceof Oa}function Qa(a,b){R(a,0,0,function(){var a=this.utcOffset(),c="+";return 0>a&&(a=-a,c="-"),c+Q(~~(a/60),2)+b+Q(~~a%60,2)})}function Ra(a,b){var c=(b||"").match(a)||[],d=c[c.length-1]||[],e=(d+"").match(ie)||["-",0,0],f=+(60*e[1])+r(e[2]);return"+"===e[0]?f:-f}function Sa(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(p(b)||d(b)?b.valueOf():Ka(b).valueOf())-e.valueOf(),e._d.setTime(e._d.valueOf()+f),a.updateOffset(e,!1),e):Ka(b).local()}function Ta(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ua(b,c){var d,e=this._offset||0;return this.isValid()?null!=b?("string"==typeof b?b=Ra(Hd,b):Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ta(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?jb(this,db(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ta(this):null!=b?this:NaN}function Va(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Wa(a){return this.utcOffset(0,a)}function Xa(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ta(this),"m")),this}function Ya(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ra(Gd,this._i)),this}function Za(a){return this.isValid()?(a=a?Ka(a).utcOffset():0,(this.utcOffset()-a)%60===0):!1}function $a(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function _a(){if(!m(this._isDSTShifted))return this._isDSTShifted;var a={};if(n(a,this),a=Ha(a),a._a){var b=a._isUTC?h(a._a):Ka(a._a);this._isDSTShifted=this.isValid()&&s(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function ab(){return this.isValid()?!this._isUTC:!1}function bb(){return this.isValid()?this._isUTC:!1}function cb(){return this.isValid()?this._isUTC&&0===this._offset:!1}function db(a,b){var c,d,e,g=a,h=null;return Pa(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=je.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:r(h[Od])*c,h:r(h[Pd])*c,m:r(h[Qd])*c,s:r(h[Rd])*c,ms:r(h[Sd])*c}):(h=ke.exec(a))?(c="-"===h[1]?-1:1,g={y:eb(h[2],c),M:eb(h[3],c),w:eb(h[4],c),d:eb(h[5],c),h:eb(h[6],c),m:eb(h[7],c),s:eb(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=gb(Ka(g.from),Ka(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Oa(g),Pa(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function eb(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function fb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function gb(a,b){var c;return a.isValid()&&b.isValid()?(b=Sa(b,a),a.isBefore(b)?c=fb(a,b):(c=fb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}function hb(a){return 0>a?-1*Math.round(-1*a):Math.round(a)}function ib(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(v(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=db(c,d),jb(this,e,a),this}}function jb(b,c,d,e){var f=c._milliseconds,g=hb(c._days),h=hb(c._months);b.isValid()&&(e=null==e?!0:e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&O(b,"Date",N(b,"Date")+g*d),h&&ga(b,N(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function kb(a,b){var c=a||Ka(),d=Sa(c,this).startOf("day"),e=this.diff(d,"days",!0),f=-6>e?"sameElse":-1>e?"lastWeek":0>e?"lastDay":1>e?"sameDay":2>e?"nextDay":7>e?"nextWeek":"sameElse",g=b&&(w(b[f])?b[f]():b[f]);return this.format(g||this.localeData().calendar(f,this,Ka(c)))}function lb(){return new o(this)}function mb(a,b){var c=p(a)?a:Ka(a);return this.isValid()&&c.isValid()?(b=K(m(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()<this.clone().startOf(b).valueOf()):!1}function nb(a,b){var c=p(a)?a:Ka(a);return this.isValid()&&c.isValid()?(b=K(m(b)?"millisecond":b),"millisecond"===b?this.valueOf()<c.valueOf():this.clone().endOf(b).valueOf()<c.valueOf()):!1}function ob(a,b,c,d){return d=d||"()",("("===d[0]?this.isAfter(a,c):!this.isBefore(a,c))&&(")"===d[1]?this.isBefore(b,c):!this.isAfter(b,c))}function pb(a,b){var c,d=p(a)?a:Ka(a);return this.isValid()&&d.isValid()?(b=K(b||"millisecond"),"millisecond"===b?this.valueOf()===d.valueOf():(c=d.valueOf(),this.clone().startOf(b).valueOf()<=c&&c<=this.clone().endOf(b).valueOf())):!1}function qb(a,b){return this.isSame(a,b)||this.isAfter(a,b)}function rb(a,b){return this.isSame(a,b)||this.isBefore(a,b)}function sb(a,b,c){var d,e,f,g;return this.isValid()?(d=Sa(a,this),d.isValid()?(e=6e4*(d.utcOffset()-this.utcOffset()),b=K(b),"year"===b||"month"===b||"quarter"===b?(g=tb(this,d),"quarter"===b?g/=3:"year"===b&&(g/=12)):(f=this-d,g="second"===b?f/1e3:"minute"===b?f/6e4:"hour"===b?f/36e5:"day"===b?(f-e)/864e5:"week"===b?(f-e)/6048e5:f),c?g:q(g)):NaN):NaN}function tb(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)||0}function ub(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function vb(){var a=this.clone().utc();return 0<a.year()&&a.year()<=9999?w(Date.prototype.toISOString)?this.toDate().toISOString():U(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):U(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function wb(b){b||(b=this.isUtc()?a.defaultFormatUtc:a.defaultFormat);var c=U(this,b);return this.localeData().postformat(c)}function xb(a,b){return this.isValid()&&(p(a)&&a.isValid()||Ka(a).isValid())?db({to:this,from:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function yb(a){return this.from(Ka(),a)}function zb(a,b){return this.isValid()&&(p(a)&&a.isValid()||Ka(a).isValid())?db({from:this,to:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function Ab(a){return this.to(Ka(),a)}function Bb(a){var b;return void 0===a?this._locale._abbr:(b=H(a),null!=b&&(this._locale=b),this)}function Cb(){return this._locale}function Db(a){switch(a=K(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a&&this.weekday(0),"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this}function Eb(a){return a=K(a),void 0===a||"millisecond"===a?this:("date"===a&&(a="day"),this.startOf(a).add(1,"isoWeek"===a?"week":a).subtract(1,"ms"))}function Fb(){return this._d.valueOf()-6e4*(this._offset||0)}function Gb(){return Math.floor(this.valueOf()/1e3)}function Hb(){return this._offset?new Date(this.valueOf()):this._d}function Ib(){var a=this;return[a.year(),a.month(),a.date(),a.hour(),a.minute(),a.second(),a.millisecond()]}function Jb(){var a=this;return{years:a.year(),months:a.month(),date:a.date(),hours:a.hours(),minutes:a.minutes(),seconds:a.seconds(),milliseconds:a.milliseconds()}}function Kb(){return this.isValid()?this.toISOString():null}function Lb(){return k(this)}function Mb(){return g({},j(this))}function Nb(){return j(this).overflow}function Ob(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Pb(a,b){R(0,[a,a.length],0,b)}function Qb(a){return Ub.call(this,a,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Rb(a){return Ub.call(this,a,this.isoWeek(),this.isoWeekday(),1,4)}function Sb(){return xa(this.year(),1,4)}function Tb(){var a=this.localeData()._week;return xa(this.year(),a.dow,a.doy)}function Ub(a,b,c,d,e){var f;return null==a?wa(this,d,e).year:(f=xa(a,d,e),b>f&&(b=f),Vb.call(this,a,b,c,d,e))}function Vb(a,b,c,d,e){var f=va(a,b,c,d,e),g=qa(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}function Wb(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Xb(a){return wa(a,this._week.dow,this._week.doy).week}function Yb(){return this._week.dow}function Zb(){return this._week.doy}function $b(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function _b(a){var b=wa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function ac(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function bc(a,b){return c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]}function cc(a){return this._weekdaysShort[a.day()]}function dc(a){return this._weekdaysMin[a.day()]}function ec(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;7>d;++d)f=h([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=md.call(this._weekdaysParse,g),-1!==e?e:null):"ddd"===b?(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:null):(e=md.call(this._minWeekdaysParse,g),-1!==e?e:null):"dddd"===b?(e=md.call(this._weekdaysParse,g),-1!==e?e:(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:(e=md.call(this._minWeekdaysParse,g),-1!==e?e:null))):"ddd"===b?(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:(e=md.call(this._weekdaysParse,g),-1!==e?e:(e=md.call(this._minWeekdaysParse,g),-1!==e?e:null))):(e=md.call(this._minWeekdaysParse,g),-1!==e?e:(e=md.call(this._weekdaysParse,g),-1!==e?e:(e=md.call(this._shortWeekdaysParse,g),-1!==e?e:null)))}function fc(a,b,c){var d,e,f;if(this._weekdaysParseExact)return ec.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;7>d;d++){if(e=h([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}function gc(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=ac(a,this.localeData()),this.add(a-b,"d")):b}function hc(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function ic(a){return this.isValid()?null==a?this.day()||7:this.day(this.day()%7?a:a-7):null!=a?this:NaN}function jc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex}function kc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex}function lc(a){return this._weekdaysParseExact?(f(this,"_weekdaysRegex")||mc.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex}function mc(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],i=[],j=[],k=[];for(b=0;7>b;b++)c=h([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),i.push(e),j.push(f),k.push(d),k.push(e),k.push(f);for(g.sort(a),i.sort(a),j.sort(a),k.sort(a),b=0;7>b;b++)i[b]=Z(i[b]),j[b]=Z(j[b]),k[b]=Z(k[b]);this._weekdaysRegex=new RegExp("^("+k.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function nc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function oc(){return this.hours()%12||12}function pc(){return this.hours()||24}function qc(a,b){R(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function rc(a,b){return b._meridiemParse}function sc(a){return"p"===(a+"").toLowerCase().charAt(0)}function tc(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function uc(a,b){b[Sd]=r(1e3*("0."+a))}function vc(){return this._isUTC?"UTC":""}function wc(){return this._isUTC?"Coordinated Universal Time":""}function xc(a){return Ka(1e3*a)}function yc(){return Ka.apply(null,arguments).parseZone()}function zc(a,b,c){var d=this._calendar[a];return w(d)?d.call(b,c):d}function Ac(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function Bc(){return this._invalidDate}function Cc(a){return this._ordinal.replace("%d",a)}function Dc(a){return a}function Ec(a,b,c,d){var e=this._relativeTime[c];return w(e)?e(a,b,c,d):e.replace(/%d/i,a)}function Fc(a,b){var c=this._relativeTime[a>0?"future":"past"];return w(c)?c(b):c.replace(/%s/i,b)}function Gc(a,b,c,d){var e=H(),f=h().set(d,b);return e[c](f,a)}function Hc(a,b,c){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return Gc(a,b,c,"month");var d,e=[];for(d=0;12>d;d++)e[d]=Gc(a,d,c,"month");return e}function Ic(a,b,c,d){"boolean"==typeof a?("number"==typeof b&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,"number"==typeof b&&(c=b,b=void 0),b=b||"");var e=H(),f=a?e._week.dow:0;if(null!=c)return Gc(b,(c+f)%7,d,"day");var g,h=[];for(g=0;7>g;g++)h[g]=Gc(b,(g+f)%7,d,"day");return h}function Jc(a,b){return Hc(a,b,"months")}function Kc(a,b){return Hc(a,b,"monthsShort")}function Lc(a,b,c){return Ic(a,b,c,"weekdays")}function Mc(a,b,c){return Ic(a,b,c,"weekdaysShort")}function Nc(a,b,c){return Ic(a,b,c,"weekdaysMin")}function Oc(){var a=this._data;return this._milliseconds=Le(this._milliseconds),this._days=Le(this._days),this._months=Le(this._months),a.milliseconds=Le(a.milliseconds),a.seconds=Le(a.seconds),a.minutes=Le(a.minutes),a.hours=Le(a.hours),a.months=Le(a.months),a.years=Le(a.years),this}function Pc(a,b,c,d){var e=db(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function Qc(a,b){return Pc(this,a,b,1)}function Rc(a,b){return Pc(this,a,b,-1)}function Sc(a){return 0>a?Math.floor(a):Math.ceil(a)}function Tc(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||0>=f&&0>=g&&0>=h||(f+=864e5*Sc(Vc(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=q(f/1e3),i.seconds=a%60,b=q(a/60),i.minutes=b%60,c=q(b/60),i.hours=c%24,g+=q(c/24),e=q(Uc(g)),h+=e,g-=Sc(Vc(e)),d=q(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function Uc(a){return 4800*a/146097}function Vc(a){return 146097*a/4800}function Wc(a){var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+Uc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(Vc(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function Xc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*r(this._months/12)}function Yc(a){return function(){return this.as(a)}}function Zc(a){return a=K(a),this[a+"s"]()}function $c(a){return function(){return this._data[a]}}function _c(){return q(this.days()/7)}function ad(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function bd(a,b,c){var d=db(a).abs(),e=_e(d.as("s")),f=_e(d.as("m")),g=_e(d.as("h")),h=_e(d.as("d")),i=_e(d.as("M")),j=_e(d.as("y")),k=e<af.s&&["s",e]||1>=f&&["m"]||f<af.m&&["mm",f]||1>=g&&["h"]||g<af.h&&["hh",g]||1>=h&&["d"]||h<af.d&&["dd",h]||1>=i&&["M"]||i<af.M&&["MM",i]||1>=j&&["y"]||["yy",j];
Vincent Bechu's avatar
Vincent Bechu committed
5 6 7 8
return k[2]=b,k[3]=+a>0,k[4]=c,ad.apply(null,k)}function cd(a,b){return void 0===af[a]?!1:void 0===b?af[a]:(af[a]=b,!0)}function dd(a){var b=this.localeData(),c=bd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function ed(){var a,b,c,d=bf(this._milliseconds)/1e3,e=bf(this._days),f=bf(this._months);a=q(d/60),b=q(a/60),d%=60,a%=60,c=q(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(0>m?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var fd,gd;gd=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;c>d;d++)if(d in b&&a.call(this,b[d],d,b))return!0;return!1};var hd=a.momentProperties=[],id=!1,jd={};a.suppressDeprecationWarnings=!1,a.deprecationHandler=null;var kd;kd=Object.keys?Object.keys:function(a){var b,c=[];for(b in a)f(a,b)&&c.push(b);return c};var ld,md,nd={},od={},pd=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,qd=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,rd={},sd={},td=/\d/,ud=/\d\d/,vd=/\d{3}/,wd=/\d{4}/,xd=/[+-]?\d{6}/,yd=/\d\d?/,zd=/\d\d\d\d?/,Ad=/\d\d\d\d\d\d?/,Bd=/\d{1,3}/,Cd=/\d{1,4}/,Dd=/[+-]?\d{1,6}/,Ed=/\d+/,Fd=/[+-]?\d+/,Gd=/Z|[+-]\d\d:?\d\d/gi,Hd=/Z|[+-]\d\d(?::?\d\d)?/gi,Id=/[+-]?\d+(\.\d{1,3})?/,Jd=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Kd={},Ld={},Md=0,Nd=1,Od=2,Pd=3,Qd=4,Rd=5,Sd=6,Td=7,Ud=8;md=Array.prototype.indexOf?Array.prototype.indexOf:function(a){var b;for(b=0;b<this.length;++b)if(this[b]===a)return b;return-1},R("M",["MM",2],"Mo",function(){return this.month()+1}),R("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),R("MMMM",0,0,function(a){return this.localeData().months(this,a)}),J("month","M"),W("M",yd),W("MM",yd,ud),W("MMM",function(a,b){return b.monthsShortRegex(a)}),W("MMMM",function(a,b){return b.monthsRegex(a)}),$(["M","MM"],function(a,b){b[Nd]=r(a)-1}),$(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[Nd]=e:j(c).invalidMonth=a});var Vd=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,Wd="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Xd="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Yd=Jd,Zd=Jd,$d=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,_d=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,ae=/Z|[+-]\d\d(?::?\d\d)?/,be=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],ce=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],de=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=u("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),R("Y",0,0,function(){var a=this.year();return 9999>=a?""+a:"+"+a}),R(0,["YY",2],0,function(){return this.year()%100}),R(0,["YYYY",4],0,"year"),R(0,["YYYYY",5],0,"year"),R(0,["YYYYYY",6,!0],0,"year"),J("year","y"),W("Y",Fd),W("YY",yd,ud),W("YYYY",Cd,wd),W("YYYYY",Dd,xd),W("YYYYYY",Dd,xd),$(["YYYYY","YYYYYY"],Md),$("YYYY",function(b,c){c[Md]=2===b.length?a.parseTwoDigitYear(b):r(b)}),$("YY",function(b,c){c[Md]=a.parseTwoDigitYear(b)}),$("Y",function(a,b){b[Md]=parseInt(a,10)}),a.parseTwoDigitYear=function(a){return r(a)+(r(a)>68?1900:2e3)};var ee=M("FullYear",!0);a.ISO_8601=function(){};var fe=u("moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Ka.apply(null,arguments);return this.isValid()&&a.isValid()?this>a?this:a:l()}),ge=u("moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Ka.apply(null,arguments);return this.isValid()&&a.isValid()?a>this?this:a:l()}),he=function(){return Date.now?Date.now():+new Date};Qa("Z",":"),Qa("ZZ",""),W("Z",Hd),W("ZZ",Hd),$(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ra(Hd,a)});var ie=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var je=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/,ke=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;db.fn=Oa.prototype;var le=ib(1,"add"),me=ib(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var ne=u("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});R(0,["gg",2],0,function(){return this.weekYear()%100}),R(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Pb("gggg","weekYear"),Pb("ggggg","weekYear"),Pb("GGGG","isoWeekYear"),Pb("GGGGG","isoWeekYear"),J("weekYear","gg"),J("isoWeekYear","GG"),W("G",Fd),W("g",Fd),W("GG",yd,ud),W("gg",yd,ud),W("GGGG",Cd,wd),W("gggg",Cd,wd),W("GGGGG",Dd,xd),W("ggggg",Dd,xd),_(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=r(a)}),_(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),R("Q",0,"Qo","quarter"),J("quarter","Q"),W("Q",td),$("Q",function(a,b){b[Nd]=3*(r(a)-1)}),R("w",["ww",2],"wo","week"),R("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),W("w",yd),W("ww",yd,ud),W("W",yd),W("WW",yd,ud),_(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=r(a)});var oe={dow:0,doy:6};R("D",["DD",2],"Do","date"),J("date","D"),W("D",yd),W("DD",yd,ud),W("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),$(["D","DD"],Od),$("Do",function(a,b){b[Od]=r(a.match(yd)[0],10)});var pe=M("Date",!0);R("d",0,"do","day"),R("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),R("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),R("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),R("e",0,0,"weekday"),R("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),W("d",yd),W("e",yd),W("E",yd),W("dd",function(a,b){return b.weekdaysMinRegex(a)}),W("ddd",function(a,b){return b.weekdaysShortRegex(a)}),W("dddd",function(a,b){return b.weekdaysRegex(a)}),_(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);null!=e?b.d=e:j(c).invalidWeekday=a}),_(["d","e","E"],function(a,b,c,d){b[d]=r(a)});var qe="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),re="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),se="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),te=Jd,ue=Jd,ve=Jd;R("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),W("DDD",Bd),W("DDDD",vd),$(["DDD","DDDD"],function(a,b,c){c._dayOfYear=r(a)}),R("H",["HH",2],0,"hour"),R("h",["hh",2],0,oc),R("k",["kk",2],0,pc),R("hmm",0,0,function(){return""+oc.apply(this)+Q(this.minutes(),2)}),R("hmmss",0,0,function(){return""+oc.apply(this)+Q(this.minutes(),2)+Q(this.seconds(),2)}),R("Hmm",0,0,function(){return""+this.hours()+Q(this.minutes(),2)}),R("Hmmss",0,0,function(){return""+this.hours()+Q(this.minutes(),2)+Q(this.seconds(),2)}),qc("a",!0),qc("A",!1),J("hour","h"),W("a",rc),W("A",rc),W("H",yd),W("h",yd),W("HH",yd,ud),W("hh",yd,ud),W("hmm",zd),W("hmmss",Ad),W("Hmm",zd),W("Hmmss",Ad),$(["H","HH"],Pd),$(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),$(["h","hh"],function(a,b,c){b[Pd]=r(a),j(c).bigHour=!0}),$("hmm",function(a,b,c){var d=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d)),j(c).bigHour=!0}),$("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d,2)),b[Rd]=r(a.substr(e)),j(c).bigHour=!0}),$("Hmm",function(a,b,c){var d=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d))}),$("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[Pd]=r(a.substr(0,d)),b[Qd]=r(a.substr(d,2)),b[Rd]=r(a.substr(e))});var we=/[ap]\.?m?\.?/i,xe=M("Hours",!0);R("m",["mm",2],0,"minute"),J("minute","m"),W("m",yd),W("mm",yd,ud),$(["m","mm"],Qd);var ye=M("Minutes",!1);R("s",["ss",2],0,"second"),J("second","s"),W("s",yd),W("ss",yd,ud),$(["s","ss"],Rd);var ze=M("Seconds",!1);R("S",0,0,function(){return~~(this.millisecond()/100)}),R(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),R(0,["SSS",3],0,"millisecond"),R(0,["SSSS",4],0,function(){return 10*this.millisecond()}),R(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),R(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),R(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),R(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),R(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),J("millisecond","ms"),W("S",Bd,td),W("SS",Bd,ud),W("SSS",Bd,vd);var Ae;for(Ae="SSSS";Ae.length<=9;Ae+="S")W(Ae,Ed);for(Ae="S";Ae.length<=9;Ae+="S")$(Ae,uc);var Be=M("Milliseconds",!1);R("z",0,0,"zoneAbbr"),R("zz",0,0,"zoneName");var Ce=o.prototype;Ce.add=le,Ce.calendar=kb,Ce.clone=lb,Ce.diff=sb,Ce.endOf=Eb,Ce.format=wb,Ce.from=xb,Ce.fromNow=yb,Ce.to=zb,Ce.toNow=Ab,Ce.get=P,Ce.invalidAt=Nb,Ce.isAfter=mb,Ce.isBefore=nb,Ce.isBetween=ob,Ce.isSame=pb,Ce.isSameOrAfter=qb,Ce.isSameOrBefore=rb,Ce.isValid=Lb,Ce.lang=ne,Ce.locale=Bb,Ce.localeData=Cb,Ce.max=ge,Ce.min=fe,Ce.parsingFlags=Mb,Ce.set=P,Ce.startOf=Db,Ce.subtract=me,Ce.toArray=Ib,Ce.toObject=Jb,Ce.toDate=Hb,Ce.toISOString=vb,Ce.toJSON=Kb,Ce.toString=ub,Ce.unix=Gb,Ce.valueOf=Fb,Ce.creationData=Ob,Ce.year=ee,Ce.isLeapYear=ta,Ce.weekYear=Qb,Ce.isoWeekYear=Rb,Ce.quarter=Ce.quarters=Wb,Ce.month=ha,Ce.daysInMonth=ia,Ce.week=Ce.weeks=$b,Ce.isoWeek=Ce.isoWeeks=_b,Ce.weeksInYear=Tb,Ce.isoWeeksInYear=Sb,Ce.date=pe,Ce.day=Ce.days=gc,Ce.weekday=hc,Ce.isoWeekday=ic,Ce.dayOfYear=nc,Ce.hour=Ce.hours=xe,Ce.minute=Ce.minutes=ye,Ce.second=Ce.seconds=ze,Ce.millisecond=Ce.milliseconds=Be,Ce.utcOffset=Ua,Ce.utc=Wa,Ce.local=Xa,Ce.parseZone=Ya,Ce.hasAlignedHourOffset=Za,Ce.isDST=$a,Ce.isDSTShifted=_a,Ce.isLocal=ab,Ce.isUtcOffset=bb,Ce.isUtc=cb,Ce.isUTC=cb,Ce.zoneAbbr=vc,Ce.zoneName=wc,Ce.dates=u("dates accessor is deprecated. Use date instead.",pe),Ce.months=u("months accessor is deprecated. Use month instead",ha),Ce.years=u("years accessor is deprecated. Use year instead",ee),Ce.zone=u("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Va);var De=Ce,Ee={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Fe={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Ge="Invalid date",He="%d",Ie=/\d{1,2}/,Je={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Ke=A.prototype;Ke._calendar=Ee,Ke.calendar=zc,Ke._longDateFormat=Fe,Ke.longDateFormat=Ac,Ke._invalidDate=Ge,Ke.invalidDate=Bc,Ke._ordinal=He,Ke.ordinal=Cc,Ke._ordinalParse=Ie,Ke.preparse=Dc,Ke.postformat=Dc,Ke._relativeTime=Je,Ke.relativeTime=Ec,Ke.pastFuture=Fc,Ke.set=y,Ke.months=ca,Ke._months=Wd,Ke.monthsShort=da,Ke._monthsShort=Xd,Ke.monthsParse=fa,Ke._monthsRegex=Zd,Ke.monthsRegex=ka,Ke._monthsShortRegex=Yd,Ke.monthsShortRegex=ja,Ke.week=Xb,Ke._week=oe,Ke.firstDayOfYear=Zb,Ke.firstDayOfWeek=Yb,Ke.weekdays=bc,Ke._weekdays=qe,Ke.weekdaysMin=dc,Ke._weekdaysMin=se,Ke.weekdaysShort=cc,Ke._weekdaysShort=re,Ke.weekdaysParse=fc,Ke._weekdaysRegex=te,Ke.weekdaysRegex=jc,Ke._weekdaysShortRegex=ue,Ke.weekdaysShortRegex=kc,Ke._weekdaysMinRegex=ve,Ke.weekdaysMinRegex=lc,Ke.isPM=sc,Ke._meridiemParse=we,Ke.meridiem=tc,E("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===r(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=u("moment.lang is deprecated. Use moment.locale instead.",E),a.langData=u("moment.langData is deprecated. Use moment.localeData instead.",H);var Le=Math.abs,Me=Yc("ms"),Ne=Yc("s"),Oe=Yc("m"),Pe=Yc("h"),Qe=Yc("d"),Re=Yc("w"),Se=Yc("M"),Te=Yc("y"),Ue=$c("milliseconds"),Ve=$c("seconds"),We=$c("minutes"),Xe=$c("hours"),Ye=$c("days"),Ze=$c("months"),$e=$c("years"),_e=Math.round,af={s:45,m:45,h:22,d:26,M:11},bf=Math.abs,cf=Oa.prototype;cf.abs=Oc,cf.add=Qc,cf.subtract=Rc,cf.as=Wc,cf.asMilliseconds=Me,cf.asSeconds=Ne,cf.asMinutes=Oe,cf.asHours=Pe,cf.asDays=Qe,cf.asWeeks=Re,cf.asMonths=Se,cf.asYears=Te,cf.valueOf=Xc,cf._bubble=Tc,cf.get=Zc,cf.milliseconds=Ue,cf.seconds=Ve,cf.minutes=We,cf.hours=Xe,cf.days=Ye,cf.weeks=_c,cf.months=Ze,cf.years=$e,cf.humanize=dd,cf.toISOString=ed,cf.toString=ed,cf.toJSON=ed,cf.locale=Bb,cf.localeData=Cb,cf.toIsoString=u("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",ed),cf.lang=ne,R("X",0,0,"unix"),R("x",0,0,"valueOf"),W("x",Fd),W("X",Id),$("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),$("x",function(a,b,c){c._d=new Date(r(a))}),a.version="2.13.0",b(Ka),a.fn=De,a.min=Ma,a.max=Na,a.now=he,a.utc=h,a.unix=xc,a.months=Jc,a.isDate=d,a.locale=E,a.invalid=l,a.duration=db,a.isMoment=p,a.weekdays=Lc,a.parseZone=yc,a.localeData=H,a.isDuration=Pa,a.monthsShort=Kc,a.weekdaysMin=Nc,a.defineLocale=F,a.updateLocale=G,a.locales=I,a.weekdaysShort=Mc,a.normalizeUnits=K,a.relativeTimeThreshold=cd,a.prototype=De;var df=a;return df}),function(a,b,c){"use strict";function d(a){var b,c=[];if(void 0===a)return void 0;for(Array.isArray(a)||(a=[a]),b=0;b<a.length;b+=1)"object"==typeof a[b]?c[b]=a[b].content:c[b]=a[b];return c}function e(a,b){var c;if("descending"===b)c=1;else{if("ascending"!==b)throw new TypeError("Query.sortFunction(): Argument 2 must be 'ascending' or 'descending'");c=-1}return function(b,e){var f,g;for(b=d(b[a])||[],e=d(e[a])||[],g=b.length>e.length?b.length:e.length,f=0;g>f;f+=1){if(void 0===b[f])return c;if(void 0===e[f])return-c;if(b[f]>e[f])return-c;if(b[f]<e[f])return c}return 0}}function f(a,b){var c;if(!Array.isArray(a))throw new TypeError("jioquery.sortOn(): Argument 1 is not of type 'array'");for(c=a.length-1;c>=0;c-=1)b.sort(e(a[c][0],a[c][1]));return b}function g(a,b){if(!Array.isArray(a))throw new TypeError("jioquery.limit(): Argument 1 is not of type 'array'");if(!Array.isArray(b))throw new TypeError("jioquery.limit(): Argument 2 is not of type 'array'");return b.splice(0,a[0]),a[1]&&b.splice(a[1]),b}function h(a,b){var c,d,e;if(!Array.isArray(a))throw new TypeError("jioquery.select(): Argument 1 is not of type Array");if(!Array.isArray(b))throw new TypeError("jioquery.select(): Argument 2 is not of type Array");for(c=0;c<b.length;c+=1){for(e={},d=0;d<a.length;d+=1)b[c].hasOwnProperty([a[d]])&&(e[a[d]]=b[c][a[d]]);for(d in e)if(e.hasOwnProperty(d)){b[c]=e;break}}return b}function i(){}function j(){}function k(a){return a.replace(t,"\\$&")}function l(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{configurable:!0,enumerable:!1,writable:!0,value:a}})}function m(a,b){if("string"!=typeof a)throw new TypeError("jioquery.searchTextToRegExp(): Argument 1 is not of type 'string'");return b===!1?new RegExp("^"+k(a)+"$"):new RegExp("^"+k(a).replace(u,"[\\s\\S]*").replace(v,".")+"$")}function n(a,b){i.call(this),this.operator=a.operator,this.query_list=a.query_list||[],this.query_list=this.query_list.map(function(a){return j.create(a,b)})}function o(a){var b=[];if("complex"===a.type)return b.push("("),(a.query_list||[]).forEach(function(c){b.push(o(c)),b.push(a.operator)}),b.length-=1,b.push(")"),b.join(" ");if("simple"===a.type)return(a.key?a.key+": ":"")+(a.operator||"")+' "'+a.value+'"';throw new TypeError("This object is not a query")}function p(a){var b;if(void 0!==a){if("object"!=typeof a)throw new TypeError("SimpleQuery().create(): key_schema is not of type 'object'");if(void 0===a.key_set)throw new TypeError("SimpleQuery().create(): key_schema has no 'key_set' property");for(b in a)if(a.hasOwnProperty(b))switch(b){case"key_set":case"cast_lookup":case"match_lookup":break;default:throw new TypeError("SimpleQuery().create(): key_schema has unknown property '"+b+"'")}}}function q(a,b){i.call(this),p(b),this._key_schema=b||{},this.operator=a.operator,this.key=a.key,this.value=a.value}function r(a){var b;if(void 0===a.read_from)throw new TypeError("Custom key is missing the read_from property");for(b in a)if(a.hasOwnProperty(b))switch(b){case"read_from":case"cast_to":case"equal_match":break;default:throw new TypeError("Custom key has unknown property '"+b+"'")}}var s={},t=/[\-\[\]{}()*+?.,\\\^$|#\s]/g,u=/%/g,v=/_/g,w=/^(?:AND|OR|NOT)$/i,x=/^(?:!?=|<=?|>=?)$/i;i.prototype.exec=function(b,c){if(!Array.isArray(b))throw new TypeError("Query().exec(): Argument 1 is not of type 'array'");if(void 0===c&&(c={}),"object"!=typeof c)throw new TypeError("Query().exec(): Optional argument 2 is not of type 'object'");var d,e=this;for(d=b.length-1;d>=0;d-=1)e.match(b[d])||b.splice(d,1);return c.sort_on&&f(c.sort_on,b),c.limit&&g(c.limit,b),h(c.select_list||[],b),(new a.Queue).push(function(){return b})},i.prototype.match=function(){return!0},i.prototype.parse=function(b){function c(b,d){function f(a){i.push(function(){return b.parsed=h.query_list[a],c(b,d)}).push(function(){h.query_list[a]=b.parsed})}var g,h=b.parsed,i=new a.Queue;if("complex"===h.type){for(g=0;g<h.query_list.length;g+=1)f(g);return i.push(function(){return b.parsed=h,e.onParseComplexQuery(b,d)})}return"simple"===h.type?e.onParseSimpleQuery(b,d):void 0}var d,e=this;return d={parsed:JSON.parse(JSON.stringify(e.serialized()))},(new a.Queue).push(function(){return e.onParseStart(d,b)}).push(function(){return c(d,b)}).push(function(){return e.onParseEnd(d,b)}).push(function(){return d.parsed})},i.prototype.toString=function(){return""},i.prototype.serialized=function(){return void 0},l(n,i),n.prototype.operator="AND",n.prototype.type="complex",n.prototype.match=function(a){var b=this.operator;return w.test(b)||(b="AND"),this[b.toUpperCase()](a)},n.prototype.toString=function(){var a=[],b=this.operator;return"NOT"===this.operator?(a.push("NOT ("),a.push(this.query_list[0].toString()),a.push(")"),a.join(" ")):(this.query_list.forEach(function(c){a.push("("),a.push(c.toString()),a.push(")"),a.push(b)}),a.length-=1,a.join(" "))},n.prototype.serialized=function(){var a={type:"complex",operator:this.operator,query_list:[]};return this.query_list.forEach(function(b){a.query_list.push("function"==typeof b.toJSON?b.toJSON():b)}),a},n.prototype.toJSON=n.prototype.serialized,n.prototype.AND=function(a){for(var b=!0,c=0;b&&c!==this.query_list.length;)b=this.query_list[c].match(a),c+=1;return b},n.prototype.OR=function(a){for(var b=!1,c=0;!b&&c!==this.query_list.length;)b=this.query_list[c].match(a),c+=1;return b},n.prototype.NOT=function(a){return!this.query_list[0].match(a)},j.create=function(a,b){if(""===a)return new i;if("string"==typeof a&&(a=c(a)),"string"==typeof(a||{}).type&&s[a.type])return new s[a.type](a,b);throw new TypeError("QueryFactory.create(): Argument 1 is not a search text or a parsable object")},l(q,i),q.prototype.type="simple",q.prototype.match=function(a){var b,c=null,d=null,e=null,f=null,g=this.operator,h=null,i=this.key;if(x.test(g)||(g=u.test(this.value)?"like":"="),f=this[g],this._key_schema.key_set&&void 0!==this._key_schema.key_set[i]&&(i=this._key_schema.key_set[i]),""===i){f=this.like,h="%"+this.value+"%";for(b in a)if(a.hasOwnProperty(b)&&"__id"!==b&&f(a[b],h)===!0)return!0;return!1}if("object"==typeof i){if(r(i),c=a[i.read_from],d=i.equal_match,"string"==typeof d&&(d=this._key_schema.match_lookup[d]),void 0!==d&&(f="="===g||"like"===g?d:f),h=this.value,e=i.cast_to){"string"==typeof e&&(e=this._key_schema.cast_lookup[e]);try{h=e(h)}catch(j){h=void 0}try{c=e(c)}catch(j){c=void 0}}}else c=a[i],h=this.value;return void 0===c||void 0===h?!1:f(c,h)},q.prototype.toString=function(){return(this.key?this.key+":":"")+(this.operator?" "+this.operator:"")+' "'+this.value+'"'},q.prototype.serialized=function(){var a={type:"simple",key:this.key,value:this.value};return void 0!==this.operator&&(a.operator=this.operator),a},q.prototype.toJSON=q.prototype.serialized,q.prototype["="]=function(a,b){var c,d;for(Array.isArray(a)||(a=[a]),d=0;d<a.length;d+=1){if(c=a[d],"object"==typeof c&&c.hasOwnProperty("content")&&(c=c.content),"function"==typeof c.cmp)return 0===c.cmp(b);if(b.toString()===c.toString())return!0}return!1},q.prototype.like=function(a,b){var c,d;for(Array.isArray(a)||(a=[a]),d=0;d<a.length;d+=1){if(c=a[d],"object"==typeof c&&c.hasOwnProperty("content")&&(c=c.content),"function"==typeof c.cmp)return 0===c.cmp(b);if(m(b.toString()).test(c.toString()))return!0}return!1},q.prototype["!="]=function(a,b){var c,d;for(Array.isArray(a)||(a=[a]),d=0;d<a.length;d+=1){if(c=a[d],"object"==typeof c&&c.hasOwnProperty("content")&&(c=c.content),"function"==typeof c.cmp)return 0!==c.cmp(b);if(b.toString()===c.toString())return!1}return!0},q.prototype["<"]=function(a,b){var c;return Array.isArray(a)||(a=[a]),c=a[0],"object"==typeof c&&c.hasOwnProperty("content")&&(c=c.content),"function"==typeof c.cmp?c.cmp(b)<0:b>c},q.prototype["<="]=function(a,b){var c;return Array.isArray(a)||(a=[a]),c=a[0],"object"==typeof c&&c.hasOwnProperty("content")&&(c=c.content),"function"==typeof c.cmp?c.cmp(b)<=0:b>=c},q.prototype[">"]=function(a,b){var c;return Array.isArray(a)||(a=[a]),c=a[0],"object"==typeof c&&c.hasOwnProperty("content")&&(c=c.content),"function"==typeof c.cmp?c.cmp(b)>0:c>b},q.prototype[">="]=function(a,b){var c;return Array.isArray(a)||(a=[a]),c=a[0],"object"==typeof c&&c.hasOwnProperty("content")&&(c=c.content),"function"==typeof c.cmp?c.cmp(b)>=0:c>=b},s.simple=q,s.complex=n,i.parseStringToObject=c,i.objectToSearchText=o,b.Query=i,b.SimpleQuery=q,b.ComplexQuery=n,b.QueryFactory=j}(RSVP,window,parseStringToObject),function(a,b){"use strict";var c,d="year",e="month",f="day",g="hour",h="minute",i="second",j="millisecond",k={year:0,month:1,day:2,hour:3,minute:4,second:5,millisecond:6},l=function(a,b){return k[a]<k[b]?a:b};c=function(a){if(!(this instanceof c))return new c(a);if(a instanceof c)return this.mom=a.mom.clone(),void(this._precision=a._precision);if(void 0===a)return this.mom=b(),void this.setPrecision(j);if(this.mom=null,this._str=a,a.match(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+\-][0-2]\d:[0-5]\d|Z)/)||a.match(/\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\.\d\d\d/)?(this.mom=b(a),this.setPrecision(j)):a.match(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+\-][0-2]\d:[0-5]\d|Z)/)||a.match(/\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d/)?(this.mom=b(a),this.setPrecision(i)):a.match(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+\-][0-2]\d:[0-5]\d|Z)/)||a.match(/\d\d\d\d-\d\d-\d\d \d\d:\d\d/)?(this.mom=b(a),this.setPrecision(h)):a.match(/\d\d\d\d-\d\d-\d\d \d\d/)?(this.mom=b(a),this.setPrecision(g)):a.match(/\d\d\d\d-\d\d-\d\d/)?(this.mom=b(a),this.setPrecision(f)):a.match(/\d\d\d\d-\d\d/)?(this.mom=b(a),this.setPrecision(e)):a.match(/\d\d\d\d/)&&(this.mom=b(a,"YYYY"),this.setPrecision(d)),!this.mom)throw new Error("Cannot parse: "+a)},c.prototype.setPrecision=function(a){this._precision=a},c.prototype.getPrecision=function(){return this._precision},c.prototype.cmp=function(a){var b=this.mom,c=a.mom,d=l(this._precision,a._precision);return b.isBefore(c,d)?-1:b.isSame(c,d)?0:1},c.prototype.toPrecisionString=function(a){var b;if(a=a||this._precision,b={millisecond:"YYYY-MM-DD HH:mm:ss.SSS",second:"YYYY-MM-DD HH:mm:ss",minute:"YYYY-MM-DD HH:mm",hour:"YYYY-MM-DD HH",day:"YYYY-MM-DD",month:"YYYY-MM",year:"YYYY"}[a],!b)throw new TypeError("Unsupported precision value '"+a+"'");return this.mom.format(b)},c.prototype.toString=function(){return this._str},a.jiodate={JIODate:c,YEAR:d,MONTH:e,DAY:f,HOUR:g,MIN:h,SEC:i,MSEC:j}}(window,moment),function(a,b,c,d,e,f,g,h,i,j){"use strict";function k(a,b){if(void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Default Message",this.status_code=b||500}function l(a){var c=new XMLHttpRequest;return new b.Promise(function(b,d,e){var f;if(c.open(a.type||"GET",a.url,!0),c.responseType=a.dataType||"","object"==typeof a.headers&&null!==a.headers)for(f in a.headers)a.headers.hasOwnProperty(f)&&c.setRequestHeader(f,a.headers[f]);if(c.addEventListener("load",function(a){return a.target.status>=400?d(a):void b(a)}),c.addEventListener("error",d),c.addEventListener("progress",e),"object"==typeof a.xhrFields&&null!==a.xhrFields)for(f in a.xhrFields)a.xhrFields.hasOwnProperty(f)&&(c[f]=a.xhrFields[f]);"function"==typeof a.beforeSend&&a.beforeSend(c),c.send(a.data)},function(){c.abort()})}function m(a,c){var d=new g;return new b.Promise(function(b,e,f){d.addEventListener("load",b),d.addEventListener("error",e),d.addEventListener("progress",f),d.readAsText(a,c)},function(){d.abort()})}function n(a){var c=new g;return new b.Promise(function(b,d,e){c.addEventListener("load",b),c.addEventListener("error",d),c.addEventListener("progress",e),c.readAsArrayBuffer(a)},function(){c.abort()})}function o(a){var c=new g;return new b.Promise(function(b,d,e){c.addEventListener("load",b),c.addEventListener("error",d),c.addEventListener("progress",e),c.readAsDataURL(a)},function(){c.abort()})}function p(a){var b,c,d,e,f;if(void 0===a)return void 0;if(a.constructor===Object){for(c=Object.keys(a).sort(),f=[],d=0;d<c.length;d+=1)b=c[d],e=p(a[b]),void 0!==e&&f.push(p(b)+":"+e);return"{"+f.join(",")+"}"}if(a.constructor===Array){for(f=[],d=0;d<a.length;d+=1)f.push(p(a[d]));return"["+f.join(",")+"]"}return JSON.stringify(a)}function q(a){if("data:"===a)return new c;var b,d=f(a.split(",")[1]),e=a.split(",")[0].split(":")[1],g=new h(d.length),j=new i(g);for(e=e.slice(0,e.length-";base64".length),b=0;b<d.length;b+=1)j[b]=d.charCodeAt(b);return new c([g],{type:e})}function r(a,b,c){if("string"!=typeof a[0]||""===a[0])throw new w.util.jIOError("Document id must be a non empty string on '"+b.__type+"."+c+"'.",400)}function s(a,b,c){if("string"!=typeof a[1]||""===a[1])throw new w.util.jIOError("Attachment id must be a non empty string on '"+b.__type+"."+c+"'.",400)}function t(a,c,d,e){return a.prototype[c]=function(){var a,f=arguments,g=this;return(new b.Queue).push(function(){return void 0!==d?d.apply(g.__storage,[f,g,c]):void 0}).push(function(b){var d=g.__storage[c];if(a=b,void 0===d)throw new w.util.jIOError("Capacity '"+c+"' is not implemented on '"+g.__type+"'",501);return d.apply(g.__storage,f)}).push(function(b){return void 0!==e?e.call(g,f,b,a):b})},this}function u(a,b){return this instanceof u?(this.__type=a,void(this.__storage=b)):new u}function v(){return this instanceof v?void(this.__storage_types={}):new v}void 0===a.openDatabase&&(a.openDatabase=function(){throw new Error("WebSQL is not supported by "+j.userAgent)}),void 0===a.DOMError&&(a.DOMError={});var w,x={};k.prototype=new Error,k.prototype.constructor=k,x.jIOError=k,x.ajax=l,x.readBlobAsText=m,x.readBlobAsArrayBuffer=n,x.readBlobAsDataURL=o,x.stringify=p,x.dataURItoBlob=q,t(u,"put",r,function(a){return a[0]}),t(u,"get",r),t(u,"bulk"),t(u,"remove",r,function(a){return a[0]}),u.prototype.post=function(){var a=this,c=arguments;return(new b.Queue).push(function(){var b=a.__storage.post;if(void 0===b)throw new w.util.jIOError("Capacity 'post' is not implemented on '"+a.__type+"'",501);return a.__storage.post.apply(a.__storage,c)})},t(u,"putAttachment",function(a,b,d){r(a,b,d),s(a,b,d);var e=a[3]||{};if("string"==typeof a[2])a[2]=new c([a[2]],{type:e._content_type||e._mimetype||"text/plain;charset=utf-8"});else if(!(a[2]instanceof c))throw new w.util.jIOError("Attachment content is not a blob",400)}),t(u,"removeAttachment",function(a,b,c){r(a,b,c),s(a,b,c)}),t(u,"getAttachment",function(a,b,c){var d="blob";return r(a,b,c),s(a,b,c),void 0!==a[2]&&(d=a[2].format||d,delete a[2].format),d},function(a,d,e){var f;if(!(d instanceof c))throw new w.util.jIOError("'getAttachment' ("+a[0]+" , "+a[1]+") on '"+this.__type+"' does not return a Blob.",501);if("blob"===e)f=d;else if("data_url"===e)f=(new b.Queue).push(function(){return w.util.readBlobAsDataURL(d)}).push(function(a){return a.target.result});else if("array_buffer"===e)f=(new b.Queue).push(function(){return w.util.readBlobAsArrayBuffer(d)}).push(function(a){return a.target.result});else if("text"===e)f=(new b.Queue).push(function(){return w.util.readBlobAsText(d)}).push(function(a){return a.target.result});else{if("json"!==e)throw new w.util.jIOError(this.__type+".getAttachment format: '"+e+"' is not supported",400);f=(new b.Queue).push(function(){return w.util.readBlobAsText(d)}).push(function(a){return JSON.parse(a.target.result)})}return f}),u.prototype.buildQuery=function(){var a=this.__storage.buildQuery,c=this,d=arguments;if(void 0===a)throw new w.util.jIOError("Capacity 'buildQuery' is not implemented on '"+this.__type+"'",501);return(new b.Queue).push(function(){return a.apply(c.__storage,d)})},u.prototype.hasCapacity=function(a){var b=this.__storage.hasCapacity,c=this.__storage[a];if(void 0!==c)return!0;if(void 0===b||!b.apply(this.__storage,arguments))throw new w.util.jIOError("Capacity '"+a+"' is not implemented on '"+this.__type+"'",501);return!0},u.prototype.allDocs=function(a){var c=this;return void 0===a&&(a={}),(new b.Queue).push(function(){return!c.hasCapacity("list")||void 0!==a.query&&!c.hasCapacity("query")||void 0!==a.sort_on&&!c.hasCapacity("sort")||void 0!==a.select_list&&!c.hasCapacity("select")||void 0!==a.include_docs&&!c.hasCapacity("include")||void 0!==a.limit&&!c.hasCapacity("limit")?void 0:c.buildQuery(a)}).push(function(a){return{data:{rows:a,total_rows:a.length}}})},t(u,"allAttachments",r),t(u,"repair"),u.prototype.repair=function(){var a=this,c=arguments;return(new b.Queue).push(function(){var b=a.__storage.repair;return void 0!==b?a.__storage.repair.apply(a.__storage,c):void 0})},v.prototype.createJIO=function(a,b){if("string"!=typeof a.type)throw new TypeError("Invalid storage description");if(!this.__storage_types[a.type])throw new TypeError("Unknown storage '"+a.type+"'");return new u(a.type,new this.__storage_types[a.type](a,b))},v.prototype.addStorage=function(a,b){if("string"!=typeof a)throw new TypeError("jIO.addStorage(): Argument 1 is not of type 'string'");if("function"!=typeof b)throw new TypeError("jIO.addStorage(): Argument 2 is not of type 'function'");if(void 0!==this.__storage_types[a])throw new TypeError("jIO.addStorage(): Storage type already exists");this.__storage_types[a]=b},v.prototype.util=x,v.prototype.QueryFactory=d,v.prototype.Query=e,w=new v,a.jIO=w}(window,RSVP,Blob,QueryFactory,Query,atob,FileReader,ArrayBuffer,Uint8Array,navigator),function(){function a(a){"use strict";var d={fill:0},f=function(a){for(a+=9;a%64>0;a+=1);return a},g=function(a,b){for(var c=b>>2;c<a.length;c++)a[c]=0},h=function(a,b,c){a[b>>2]|=128<<24-(b%4<<3),a[((b>>2)+2&-16)+14]=c>>29,a[((b>>2)+2&-16)+15]=c<<3},i=function(a,b,c,d,e){var f,g=this,h=e%4,i=d%4,j=d-i;if(j>0)switch(h){case 0:a[e+3|0]=g.charCodeAt(c);case 1:a[e+2|0]=g.charCodeAt(c+1);case 2:a[e+1|0]=g.charCodeAt(c+2);case 3:a[0|e]=g.charCodeAt(c+3)}for(f=h;j>f;f=f+4|0)b[e+f>>2]=g.charCodeAt(c+f)<<24|g.charCodeAt(c+f+1)<<16|g.charCodeAt(c+f+2)<<8|g.charCodeAt(c+f+3);switch(i){case 3:a[e+j+1|0]=g.charCodeAt(c+j+2);case 2:a[e+j+2|0]=g.charCodeAt(c+j+1);case 1:a[e+j+3|0]=g.charCodeAt(c+j)}},j=function(a,b,c,d,e){var f,g=this,h=e%4,i=d%4,j=d-i;if(j>0)switch(h){
case 0:a[e+3|0]=g[c];case 1:a[e+2|0]=g[c+1];case 2:a[e+1|0]=g[c+2];case 3:a[0|e]=g[c+3]}for(f=4-h;j>f;f=f+=4)b[e+f>>2]=g[c+f]<<24|g[c+f+1]<<16|g[c+f+2]<<8|g[c+f+3];switch(i){case 3:a[e+j+1|0]=g[c+j+2];case 2:a[e+j+2|0]=g[c+j+1];case 1:a[e+j+3|0]=g[c+j]}},k=function(a,b,d,e,f){var g,h=this,i=f%4,j=e%4,k=e-j,l=new Uint8Array(c.readAsArrayBuffer(h.slice(d,d+e)));if(k>0)switch(i){case 0:a[f+3|0]=l[0];case 1:a[f+2|0]=l[1];case 2:a[f+1|0]=l[2];case 3:a[0|f]=l[3]}for(g=4-i;k>g;g=g+=4)b[f+g>>2]=l[g]<<24|l[g+1]<<16|l[g+2]<<8|l[g+3];switch(j){case 3:a[f+k+1|0]=l[k+2];case 2:a[f+k+2|0]=l[k+1];case 1:a[f+k+3|0]=l[k]}},l=function(a){switch(e.getDataType(a)){case"string":return i.bind(a);case"array":return j.bind(a);case"buffer":return j.bind(a);case"arraybuffer":return j.bind(new Uint8Array(a));case"view":return j.bind(new Uint8Array(a.buffer,a.byteOffset,a.byteLength));case"blob":return k.bind(a)}},m=function(a){var b,c,d="0123456789abcdef",e=[],f=new Uint8Array(a);for(b=0;b<f.length;b++)c=f[b],e[b]=d.charAt(c>>4&15)+d.charAt(c>>0&15);return e.join("")},n=function(a){var b;if(65536>=a)return 65536;if(16777216>a)for(b=1;a>b;b<<=1);else for(b=16777216;a>b;b+=16777216);return b},o=function(a){if(a%64>0)throw new Error("Chunk size must be a multiple of 128 bit");d.maxChunkLen=a,d.padMaxChunkLen=f(a),d.heap=new ArrayBuffer(n(d.padMaxChunkLen+320+20)),d.h32=new Int32Array(d.heap),d.h8=new Int8Array(d.heap),d.core=b({Int32Array:Int32Array,DataView:DataView},{},d.heap),d.buffer=null};o(a||65536);var p=function(a,b){var c=new Int32Array(a,b+320,5);c[0]=1732584193,c[1]=-271733879,c[2]=-1732584194,c[3]=271733878,c[4]=-1009589776},q=function(a,b){var c=f(a),e=new Int32Array(d.heap,0,c>>2);return g(e,a),h(e,a,b),c},r=function(a,b,c){l(a)(d.h8,d.h32,b,c,0)},s=function(a,b,c,e,f){var g=c;f&&(g=q(c,e)),r(a,b,c),d.core.hash(g,d.padMaxChunkLen)},t=function(a,b){var c=new Int32Array(a,b+320,5),d=new Int32Array(5),e=new DataView(d.buffer);return e.setInt32(0,c[0],!1),e.setInt32(4,c[1],!1),e.setInt32(8,c[2],!1),e.setInt32(12,c[3],!1),e.setInt32(16,c[4],!1),d},u=this.rawDigest=function(a){var b=a.byteLength||a.length||a.size||0;p(d.heap,d.padMaxChunkLen);var c=0,e=d.maxChunkLen;for(c=0;b>c+e;c+=e)s(a,c,e,b,!1);return s(a,c,b-c,b,!0),t(d.heap,d.padMaxChunkLen)};this.digest=this.digestFromString=this.digestFromBuffer=this.digestFromArrayBuffer=function(a){return m(u(a).buffer)}}function b(a,b,c){"use asm";function d(a,b){a|=0,b|=0;var c=0,d=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;for(f=e[b+320>>2]|0,h=e[b+324>>2]|0,j=e[b+328>>2]|0,l=e[b+332>>2]|0,n=e[b+336>>2]|0,c=0;(c|0)<(a|0);c=c+64|0){for(g=f,i=h,k=j,m=l,o=n,d=0;(d|0)<64;d=d+4|0)q=e[c+d>>2]|0,p=((f<<5|f>>>27)+(h&j|~h&l)|0)+((q+n|0)+1518500249|0)|0,n=l,l=j,j=h<<30|h>>>2,h=f,f=p,e[a+d>>2]=q;for(d=a+64|0;(d|0)<(a+80|0);d=d+4|0)q=(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])<<1|(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])>>>31,p=((f<<5|f>>>27)+(h&j|~h&l)|0)+((q+n|0)+1518500249|0)|0,n=l,l=j,j=h<<30|h>>>2,h=f,f=p,e[d>>2]=q;for(d=a+80|0;(d|0)<(a+160|0);d=d+4|0)q=(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])<<1|(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])>>>31,p=((f<<5|f>>>27)+(h^j^l)|0)+((q+n|0)+1859775393|0)|0,n=l,l=j,j=h<<30|h>>>2,h=f,f=p,e[d>>2]=q;for(d=a+160|0;(d|0)<(a+240|0);d=d+4|0)q=(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])<<1|(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])>>>31,p=((f<<5|f>>>27)+(h&j|h&l|j&l)|0)+((q+n|0)-1894007588|0)|0,n=l,l=j,j=h<<30|h>>>2,h=f,f=p,e[d>>2]=q;for(d=a+240|0;(d|0)<(a+320|0);d=d+4|0)q=(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])<<1|(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])>>>31,p=((f<<5|f>>>27)+(h^j^l)|0)+((q+n|0)-899497514|0)|0,n=l,l=j,j=h<<30|h>>>2,h=f,f=p,e[d>>2]=q;f=f+g|0,h=h+i|0,j=j+k|0,l=l+m|0,n=n+o|0}e[b+320>>2]=f,e[b+324>>2]=h,e[b+328>>2]=j,e[b+332>>2]=l,e[b+336>>2]=n}var e=new a.Int32Array(c);return{hash:d}}if("undefined"!=typeof module?module.exports=a:"undefined"!=typeof window&&(window.Rusha=a),"undefined"!=typeof FileReaderSync){var c=new FileReaderSync,d=new a(4194304);self.onmessage=function(a){var b,c=a.data.data;try{b=d.digest(c),self.postMessage({id:a.data.id,hash:b})}catch(e){self.postMessage({id:a.data.id,error:e.name})}}}var e={getDataType:function(a){if("string"==typeof a)return"string";if(a instanceof Array)return"array";if("undefined"!=typeof global&&global.Buffer&&global.Buffer.isBuffer(a))return"buffer";if(a instanceof ArrayBuffer)return"arraybuffer";if(a.buffer instanceof ArrayBuffer)return"view";if(a instanceof Blob)return"blob";throw new Error("Unsupported data type.")}}}(),function(a,b,c,d){"use strict";function e(a){if(void 0!==a&&"string"!=typeof a)throw new TypeError("You must pass a string.");this.message=a||"Skip some asynchronous code"}function f(a){return B.digestFromString(a)}function g(a){return B.digestFromArrayBuffer(a)}function h(b){if(this._query_options=b.query||{},void 0!==b.signature_hash_key&&(this._query_options.select_list=[b.signature_hash_key]),this._signature_hash_key=b.signature_hash_key,this._local_sub_storage=a.createJIO(b.local_sub_storage),this._remote_sub_storage=a.createJIO(b.remote_sub_storage),b.hasOwnProperty("signature_sub_storage")?(this._signature_sub_storage=a.createJIO(b.signature_sub_storage),this._custom_signature_sub_storage=!0):(this._signature_hash="_replicate_"+f(d(b.local_sub_storage)+d(b.remote_sub_storage)+d(this._query_options)),this._signature_sub_storage=a.createJIO({type:"query",sub_storage:{type:"document",document_id:this._signature_hash,sub_storage:b.local_sub_storage}}),this._custom_signature_sub_storage=!1),this._use_remote_post=b.use_remote_post||!1,this._parallel_operation_attachment_amount=b.parallel_operation_attachment_amount||1,this._parallel_operation_amount=b.parallel_operation_amount||1,this._conflict_handling=b.conflict_handling||0,this._conflict_handling!==C&&this._conflict_handling!==D&&this._conflict_handling!==E&&this._conflict_handling!==F)throw new a.util.jIOError("Unsupported conflict handling: "+this._conflict_handling,400);this._check_local_modification=b.check_local_modification,void 0===this._check_local_modification&&(this._check_local_modification=!0),this._check_local_creation=b.check_local_creation,void 0===this._check_local_creation&&(this._check_local_creation=!0),this._check_local_deletion=b.check_local_deletion,void 0===this._check_local_deletion&&(this._check_local_deletion=!0),this._check_remote_modification=b.check_remote_modification,void 0===this._check_remote_modification&&(this._check_remote_modification=!0),this._check_remote_creation=b.check_remote_creation,void 0===this._check_remote_creation&&(this._check_remote_creation=!0),this._check_remote_deletion=b.check_remote_deletion,void 0===this._check_remote_deletion&&(this._check_remote_deletion=!0),this._check_local_attachment_modification=b.check_local_attachment_modification,void 0===this._check_local_attachment_modification&&(this._check_local_attachment_modification=!1),this._check_local_attachment_creation=b.check_local_attachment_creation,void 0===this._check_local_attachment_creation&&(this._check_local_attachment_creation=!1),this._check_local_attachment_deletion=b.check_local_attachment_deletion,void 0===this._check_local_attachment_deletion&&(this._check_local_attachment_deletion=!1),this._check_remote_attachment_modification=b.check_remote_attachment_modification,void 0===this._check_remote_attachment_modification&&(this._check_remote_attachment_modification=!1),this._check_remote_attachment_creation=b.check_remote_attachment_creation,void 0===this._check_remote_attachment_creation&&(this._check_remote_attachment_creation=!1),this._check_remote_attachment_deletion=b.check_remote_attachment_deletion,void 0===this._check_remote_attachment_deletion&&(this._check_remote_attachment_deletion=!1)}function i(a,c,d,e){function f(e){e.push(function(){if(d.length>0){var g=d.shift(),h=new b.Queue;return g[0]=h,c.apply(a,g),f(e),h}})}var g,h=[];for(g=0;e>g;g+=1)h.push(new b.Queue),f(h[g]);return e>1?b.all(h):h[0]}function j(a,c,d,e){return(new b.Queue).push(function(){return d.hasOwnProperty(e)?void 0:c.allDocs(a._query_options).push(function(a){var b,c={};for(b=0;b<a.data.total_rows;b+=1)c[a.data.rows[b].id]=a.data.rows[b].value;d[e]=c})}).push(function(){return d[e]})}function k(a,b,c,d,e){return c.removeAttachment(d,e).push(function(){return a._signature_sub_storage.removeAttachment(d,e)}).push(function(){b[e]=null})}function l(a,b,c,d,e,f,g){return c.putAttachment(f,g,d).push(function(){return a._signature_sub_storage.putAttachment(f,g,JSON.stringify({hash:e}))}).push(function(){b[g]=null})}function m(b,c,d,e,f,h,i,j,m,n,o,p){var q;return i.getAttachment(j,m).push(function(b){return q=b,a.util.readBlobAsArrayBuffer(q)}).push(function(a){return g(a.target.result)},function(b){if(b instanceof a.util.jIOError&&404===b.status_code)return q=null,null;throw b}).push(function(g){if(e===g)return null===e?b._signature_sub_storage.removeAttachment(j,m).push(function(){c[m]=null}):b._signature_sub_storage.putAttachment(j,m,JSON.stringify({hash:e})).push(function(){c[m]=null});if(g===d||n===!0)return null===e?k(b,c,i,j,m):l(b,c,i,f,e,j,m);if(p!==!0){if(o===!0||null===e)return null===g?k(b,c,h,j,m):l(b,c,h,q,g,j,m);if(null===g)return l(b,c,i,f,e,j,m);throw new a.util.jIOError("Conflict on '"+j+"' with attachment '"+m+"'",409)}})}function n(c,d,e,f,h,i,j,k,l,n,o,p){var q,r;c.push(function(){if(o===!0)return b.all([f.getAttachment(i,j),{hash:null}]);if(p===!0)return b.all([f.getAttachment(i,j),d._signature_sub_storage.getAttachment(i,j,{format:"json"})]);throw new a.util.jIOError("Unexpected call of checkAttachmentSignatureDifference",409)}).push(function(b){return q=b[0],r=b[1].hash,a.util.readBlobAsArrayBuffer(q)}).push(function(a){var b=a.target.result,c=g(b);return c!==r?m(d,e,r,c,q,f,h,i,j,k,l,n):void 0})}function o(a,b,c,d,e,f,g,h,i,j){var k;a.push(function(){return b._signature_sub_storage.getAttachment(e,f,{format:"json"})}).push(function(a){return k=a.hash,m(b,c,k,null,null,g,d,e,f,h,i,j)})}function p(b,c,d,e,f,g,h){var j={},k={};return e.allAttachments(d).push(void 0,function(b){if(b instanceof a.util.jIOError&&404===b.status_code)return{};throw b}).push(function(a){var l,m,o,p=[];for(o in a)a.hasOwnProperty(o)&&(c.hasOwnProperty(o)||(j[o]=null));for(o in g)g.hasOwnProperty(o)&&(c.hasOwnProperty(o)||(k[o]=null));for(o in j)j.hasOwnProperty(o)&&(l=k.hasOwnProperty(o)&&h.check_modification,m=!k.hasOwnProperty(o)&&h.check_creation,(l===!0||m===!0)&&p.push([void 0,b,c,e,f,d,o,h.conflict_force,h.conflict_revert,h.conflict_ignore,m,l]));return i(b,n,p,b._parallel_operation_attachment_amount)}).push(function(){var a,g=[];if(h.check_deletion===!0){for(a in k)k.hasOwnProperty(a)&&(j.hasOwnProperty(a)||g.push([void 0,b,c,f,d,a,e,h.conflict_force,h.conflict_revert,h.conflict_ignore]));return i(b,o,g,b._parallel_operation_attachment_amount)}})}function q(a,b,c,d){return a.push(function(){return d.removeAttachment(b,c)})}function r(b,c,d,e,f,g,h){return b.push(function(){return g.getAttachment(c,d,{format:"json"}).push(void 0,function(b){if(b instanceof a.util.jIOError&&404===b.status_code)return{hash:null};throw b}).push(function(a){return a.hash!==h?e.getAttachment(c,d).push(function(a){return f.putAttachment(c,d,a)}).push(function(){return g.putAttachment(c,d,JSON.stringify({hash:h}))}):void 0})})}function s(a,c,d,e,f){return d!==e?(new b.Queue).push(function(){return b.all([a._signature_sub_storage.allAttachments(c),a._local_sub_storage.allAttachments(c),a._remote_sub_storage.allAttachments(c)])}).push(function(e){var g,h,j,k,l,m=[],n=[],o=e[0],p=e[1],s=e[2],t=a._check_local_attachment_modification,u=a._check_local_attachment_creation,v=a._check_local_attachment_deletion,w=a._check_remote_attachment_modification,x=a._check_remote_attachment_creation,y=a._check_remote_attachment_deletion;f?(h=p,j=s,k=a._local_sub_storage,l=a._remote_sub_storage):(h=s,j=p,k=a._remote_sub_storage,l=a._local_sub_storage,t=w,u=x,v=y,x=u,y=v);for(g in h)h.hasOwnProperty(g)&&(u&&!o.hasOwnProperty(g)||t&&o.hasOwnProperty(g))&&m.push([void 0,c,g,k,l,a._signature_sub_storage,d]);for(g in o)o.hasOwnProperty(g)&&v&&!h.hasOwnProperty(g)&&n.push([void 0,c,g,a._signature_sub_storage]);for(g in j)j.hasOwnProperty(g)&&(h.hasOwnProperty(g)||(v&&o.hasOwnProperty(g)||x&&!o.hasOwnProperty(g))&&n.push([void 0,c,g,l]));return b.all([i(a,r,m,a._parallel_operation_attachment_amount),i(a,q,n,a._parallel_operation_attachment_amount)])}).push(function(){return a._signature_sub_storage.put(c,{hash:d,attachment_hash:d,from_local:f})}):void 0}function t(c,d,e,f,g,h){if(void 0!==e)return s(c,d,f,g,h);var i={};return(new b.Queue).push(function(){return c._check_local_attachment_modification||c._check_local_attachment_creation||c._check_local_attachment_deletion||c._check_remote_attachment_modification||c._check_remote_attachment_creation||c._check_remote_attachment_deletion?c._signature_sub_storage.allAttachments(d):{}}).push(void 0,function(b){if(b instanceof a.util.jIOError&&404===b.status_code)return{};throw b}).push(function(a){return c._check_local_attachment_modification||c._check_local_attachment_creation||c._check_local_attachment_deletion?p(c,i,d,c._local_sub_storage,c._remote_sub_storage,a,{conflict_force:c._conflict_handling===D,conflict_revert:c._conflict_handling===E,conflict_ignore:c._conflict_handling===F,check_modification:c._check_local_attachment_modification,check_creation:c._check_local_attachment_creation,check_deletion:c._check_local_attachment_deletion}).push(function(){return a}):a}).push(function(a){return c._check_remote_attachment_modification||c._check_remote_attachment_creation||c._check_remote_attachment_deletion?p(c,i,d,c._remote_sub_storage,c._local_sub_storage,a,{use_revert_post:c._use_remote_post,conflict_force:c._conflict_handling===E,conflict_revert:c._conflict_handling===D,conflict_ignore:c._conflict_handling===F,check_modification:c._check_remote_attachment_modification,check_creation:c._check_remote_attachment_creation,check_deletion:c._check_remote_attachment_deletion}):void 0})}function u(c,d,f,g,h,i,j,k,l){var m,n,o=new b.Queue,p=!0;return void 0===l&&(l={}),n=l.from_local,null===g&&o.push(function(){return d.get(i)}).push(function(a){g=a},function(b){if(b instanceof a.util.jIOError&&404===b.status_code)throw new e(i);throw b}),l.use_post?o.push(function(){return f.post(g)}).push(function(a){return p=!1,m=a,d.put(m,g)}).push(function(){return d.allAttachments(i)}).push(function(a){function c(a){f.push(function(){return d.getAttachment(i,a)}).push(function(b){return d.putAttachment(m,a,b)})}var e,f=new b.Queue;for(e in a)a.hasOwnProperty(e)&&c(e);return f}).push(function(){return d.remove(i)}).push(function(){return c._signature_sub_storage.remove(i)}).push(function(){return p=!0,c._signature_sub_storage.put(m,{hash:h,from_local:n})}).push(function(){j[m]=null}):o.push(function(){return l.create_new_document===!0?(delete k[i],c._signature_sub_storage.remove(i)):void 0}).push(function(){return f.put(i,g)}).push(function(){return c._signature_sub_storage.put(i,{hash:h,from_local:n})}),o.push(function(){p&&(j[i]=null)}).push(void 0,function(a){if(!(a instanceof e))throw a})}function v(b,c,d,e,f){var g;return g=void 0!==b._signature_hash_key?c.remove(d).push(function(){return b._signature_sub_storage.remove(d)}):t(b,d).push(function(){return c.allAttachments(d)}).push(function(a){return"{}"===JSON.stringify(a)?c.remove(d).push(function(){return b._signature_sub_storage.remove(d)}):void 0},function(b){if(!(b instanceof a.util.jIOError&&404===b.status_code))throw b}),g.push(function(){e[d]=null,f[d]=null})}function w(c,e,g,h,i,k,l,m,n,o,p,q,r,s,t){var w=t.from_local;return(new b.Queue).push(function(){return void 0!==t.signature_hash_key?j(c,o,h,i).push(function(a){return a.hasOwnProperty(p)?[null,a[p][t.signature_hash_key]]:[null,null]}):o.get(p).push(function(a){return[a,f(d(a))]},function(b){if(b instanceof a.util.jIOError&&404===b.status_code)return[null,null];throw b})}).push(function(b){var f=b[0],h=b[1];if(l===h)return null===l?c._signature_sub_storage.remove(p).push(function(){e[p]=null}):c._signature_sub_storage.put(p,{hash:l,from_local:w}).push(function(){e[p]=null});if(h===k||q===!0)return null===l?v(c,o,p,e,g):u(c,n,o,m,l,p,e,g,{use_post:t.use_post&&null===h,from_local:w,create_new_document:null===h&&null!==k});if(s!==!0){if(r===!0||null===l)return null===h?v(c,n,p,e,g):u(c,o,n,f,h,p,e,g,{use_post:t.use_revert_post&&null===l,from_local:!w,create_new_document:null===l&&null!==k});if(null===h)return u(c,n,o,m,l,p,e,g,{use_post:t.use_post,from_local:w,create_new_document:null!==k});throw m=m||l,f=f||h,new a.util.jIOError("Conflict on '"+p+"': "+d(m)+" !== "+d(f),409)}})}function x(a,b,c,d,e,f,g,h,i,j,k,l,m){var n;a.push(function(){return b._signature_sub_storage.get(h)}).push(function(a){return n=a.hash,w(b,c,d,e,f,n,null,null,i,g,h,j,k,l,m)})}function y(a,b,c,e,g,h,i,j,k,l,m,n,o,p,q){a.push(function(){return null===o?i.get(k):null}).push(function(a){return null===o&&(o=f(d(a))),o!==p?w(b,c,e,g,h,p,o,a,i,j,k,l,m,n,q):void 0})}function z(a,c,d,e,f,g,h,k,l,m){var n=[],o=[];return m.hasOwnProperty("use_post")||(m.use_post=!1),m.hasOwnProperty("use_revert_post")||(m.use_revert_post=!1),j(a,h,e,f).push(function(f){var j,p,q,r,s,t,u={},v={},w=new b.Queue;for(t in f)f.hasOwnProperty(t)&&(c.hasOwnProperty(t)||(u[t]=f[t]));for(j=0;j<l.data.total_rows;j+=1)c.hasOwnProperty(l.data.rows[j].id)||(v[l.data.rows[j].id]=l.data.rows[j].value.hash);for(t in u)u.hasOwnProperty(t)&&(p=v.hasOwnProperty(t)&&m.check_modification,q=!v.hasOwnProperty(t)&&m.check_creation,q===!0?r=null:p===!0&&(r=v[t]),s=null,void 0!==m.signature_hash_key&&(s=u[t][m.signature_hash_key],p===!0&&(p=!1,s!==r&&(p=!0))),(p===!0||q===!0)&&n.push([void 0,a,c,d,e,g,h,k,t,m.conflict_force,m.conflict_revert,m.conflict_ignore,s,r,m]));w.push(function(){return i(a,y,n,m.operation_amount)});for(t in v)v.hasOwnProperty(t)&&(u.hasOwnProperty(t)||(m.check_deletion===!0?o.push([void 0,a,c,d,e,g,k,t,h,m.conflict_force,m.conflict_revert,m.conflict_ignore,m]):d[t]=null));return 0!==o.length&&w.push(function(){return i(a,x,o,m.operation_amount)}),w})}function A(a,b,c,d,e,f,g){a.push(function(){return t(b,c,d,e,f,g)})}var B=new c,C=0,D=1,E=2,F=3;e.prototype=new Error,e.prototype.constructor=e,h.prototype.remove=function(b){if(b===this._signature_hash)throw new a.util.jIOError(this._signature_hash+" is frozen",403);return this._local_sub_storage.remove.apply(this._local_sub_storage,arguments)},h.prototype.post=function(){return this._local_sub_storage.post.apply(this._local_sub_storage,arguments)},h.prototype.put=function(b){if(b===this._signature_hash)throw new a.util.jIOError(this._signature_hash+" is frozen",403);return this._local_sub_storage.put.apply(this._local_sub_storage,arguments)},h.prototype.get=function(){return this._local_sub_storage.get.apply(this._local_sub_storage,arguments)},h.prototype.getAttachment=function(){return this._local_sub_storage.getAttachment.apply(this._local_sub_storage,arguments)},h.prototype.allAttachments=function(){return this._local_sub_storage.allAttachments.apply(this._local_sub_storage,arguments)},h.prototype.putAttachment=function(b){if(b===this._signature_hash)throw new a.util.jIOError(this._signature_hash+" is frozen",403);return this._local_sub_storage.putAttachment.apply(this._local_sub_storage,arguments)},h.prototype.removeAttachment=function(b){if(b===this._signature_hash)throw new a.util.jIOError(this._signature_hash+" is frozen",403);return this._local_sub_storage.removeAttachment.apply(this._local_sub_storage,arguments)},h.prototype.hasCapacity=function(){return this._local_sub_storage.hasCapacity.apply(this._local_sub_storage,arguments)},h.prototype.buildQuery=function(){return this._local_sub_storage.buildQuery.apply(this._local_sub_storage,arguments)},h.prototype.repair=function(){var c=this,d=arguments,e={},f={},g={};return(new b.Queue).push(function(){return c._custom_signature_sub_storage===!1?(e[c._signature_hash]=null,c._signature_sub_storage.__storage._sub_storage.__storage._sub_storage.get(c._signature_hash)):void 0}).push(void 0,function(b){if(b instanceof a.util.jIOError&&404===b.status_code)return c._signature_sub_storage.__storage._sub_storage.__storage._sub_storage.put(c._signature_hash,{});throw b}).push(function(){return b.all([c._local_sub_storage.repair.apply(c._local_sub_storage,d),c._remote_sub_storage.repair.apply(c._remote_sub_storage,d)])}).push(function(){return c._check_local_modification||c._check_local_creation||c._check_local_deletion||c._check_remote_modification||c._check_remote_creation||c._check_remote_deletion?c._signature_sub_storage.allDocs({select_list:["hash"]}):void 0}).push(function(a){return c._check_local_modification||c._check_local_creation||c._check_local_deletion?z(c,e,f,g,"local","remote",c._local_sub_storage,c._remote_sub_storage,a,{use_post:c._use_remote_post,conflict_force:c._conflict_handling===D,conflict_revert:c._conflict_handling===E,conflict_ignore:c._conflict_handling===F,check_modification:c._check_local_modification,check_creation:c._check_local_creation,check_deletion:c._check_local_deletion,operation_amount:c._parallel_operation_amount,signature_hash_key:c._signature_hash_key,from_local:!0}).push(function(){return a}):a}).push(function(a){return c._check_remote_modification||c._check_remote_creation||c._check_remote_deletion?z(c,e,f,g,"remote","local",c._remote_sub_storage,c._local_sub_storage,a,{use_revert_post:c._use_remote_post,conflict_force:c._conflict_handling===E,conflict_revert:c._conflict_handling===D,conflict_ignore:c._conflict_handling===F,check_modification:c._check_remote_modification,check_creation:c._check_remote_creation,check_deletion:c._check_remote_deletion,operation_amount:c._parallel_operation_amount,signature_hash_key:c._signature_hash_key,from_local:!1}):void 0}).push(function(){return c._check_local_attachment_modification||c._check_local_attachment_creation||c._check_local_attachment_deletion||c._check_remote_attachment_modification||c._check_remote_attachment_creation||c._check_remote_attachment_deletion?c._signature_sub_storage.allDocs({select_list:["hash","attachment_hash","from_local"]}).push(function(a){var b,d,e=[],g=a.data.total_rows;for(b=0;g>b;b+=1)d=a.data.rows[b],f.hasOwnProperty(d.id)||e.push([void 0,c,d.id,c._signature_hash_key,d.value.hash,d.value.attachment_hash,d.value.from_local]);return i(c,A,e,c._parallel_operation_amount)}):void 0})},a.addStorage("replicate",h)}(jIO,RSVP,Rusha,jIO.util.stringify),function(a){"use strict";function b(a){this._sub_storage=jIO.createJIO(a.sub_storage)}var c=new a;b.prototype.post=function(a){return this._sub_storage.put(c.digestFromString(JSON.stringify(a)),a)},b.prototype.get=function(){return this._sub_storage.get.apply(this._sub_storage,arguments)},b.prototype.remove=function(){return this._sub_storage.remove.apply(this._sub_storage,arguments)},b.prototype.hasCapacity=function(){return this._sub_storage.hasCapacity.apply(this._sub_storage,arguments)},b.prototype.buildQuery=function(){return this._sub_storage.buildQuery.apply(this._sub_storage,arguments)},b.prototype.getAttachment=function(){return this._sub_storage.getAttachment.apply(this._sub_storage,arguments)},b.prototype.putAttachment=function(){return this._sub_storage.putAttachment.apply(this._sub_storage,arguments)},b.prototype.removeAttachment=function(){return this._sub_storage.removeAttachment.apply(this._sub_storage,arguments)},b.prototype.allAttachments=function(){return this._sub_storage.allAttachments.apply(this._sub_storage,arguments)},b.prototype.repair=function(){return this._sub_storage.repair.apply(this._sub_storage,arguments)},jIO.addStorage("sha",b)}(Rusha),function(a){"use strict";function b(b){this._sub_storage=a.createJIO(b.sub_storage)}b.prototype.get=function(){return this._sub_storage.get.apply(this._sub_storage,arguments)},b.prototype.allAttachments=function(){return this._sub_storage.allAttachments.apply(this._sub_storage,arguments)},b.prototype.post=function(a){function b(){return("0000"+Math.floor(65536*Math.random()).toString(16)).slice(-4)}var c=b()+b()+"-"+b()+"-"+b()+"-"+b()+"-"+b()+b()+b();return this.put(c,a)},b.prototype.put=function(){return this._sub_storage.put.apply(this._sub_storage,arguments)},b.prototype.remove=function(){return this._sub_storage.remove.apply(this._sub_storage,arguments)},b.prototype.getAttachment=function(){return this._sub_storage.getAttachment.apply(this._sub_storage,arguments)},b.prototype.putAttachment=function(){return this._sub_storage.putAttachment.apply(this._sub_storage,arguments)},b.prototype.removeAttachment=function(){return this._sub_storage.removeAttachment.apply(this._sub_storage,arguments)},b.prototype.repair=function(){return this._sub_storage.repair.apply(this._sub_storage,arguments)},b.prototype.hasCapacity=function(a){return this._sub_storage.hasCapacity(a)},b.prototype.buildQuery=function(){return this._sub_storage.buildQuery.apply(this._sub_storage,arguments)},a.addStorage("uuid",b)}(jIO),function(a,b,c){"use strict";function d(){this._database={}}d.prototype.put=function(a,c){return this._database.hasOwnProperty(a)||(this._database[a]={attachments:{}}),this._database[a].doc=b.stringify(c),a},d.prototype.get=function(c){try{return b.parse(this._database[c].doc)}catch(d){if(d instanceof TypeError)throw new a.util.jIOError("Cannot find document: "+c,404);throw d}},d.prototype.allAttachments=function(b){var c,d={};try{for(c in this._database[b].attachments)this._database[b].attachments.hasOwnProperty(c)&&(d[c]={})}catch(e){if(e instanceof TypeError)throw new a.util.jIOError("Cannot find document: "+b,404);throw e}return d},d.prototype.remove=function(a){return delete this._database[a],a},d.prototype.getAttachment=function(b,c){try{var d=this._database[b].attachments[c];if(void 0===d)throw new a.util.jIOError("Cannot find attachment: "+b+" , "+c,404);return a.util.dataURItoBlob(d)}catch(e){if(e instanceof TypeError)throw new a.util.jIOError("Cannot find attachment: "+b+" , "+c,404);throw e}},d.prototype.putAttachment=function(b,d,e){var f;try{f=this._database[b].attachments}catch(g){if(g instanceof TypeError)throw new a.util.jIOError("Cannot find document: "+b,404);throw g}return(new c.Queue).push(function(){return a.util.readBlobAsDataURL(e)}).push(function(a){f[d]=a.target.result})},d.prototype.removeAttachment=function(b,c){try{delete this._database[b].attachments[c]}catch(d){if(d instanceof TypeError)throw new a.util.jIOError("Cannot find document: "+b,404);throw d}},d.prototype.hasCapacity=function(a){return"list"===a||"include"===a},d.prototype.buildQuery=function(a){var c,d=[];for(c in this._database)this._database.hasOwnProperty(c)&&(a.include_docs===!0?d.push({id:c,value:{},doc:b.parse(this._database[c].doc)}):d.push({id:c,value:{}}));return d},a.addStorage("memory",d)}(jIO,JSON,RSVP),function(a,b,c,d){"use strict";function e(a){this._sub_storage=jIO.createJIO(a.sub_storage)}function f(a,b){return a.indexOf(b)===a.length-b.length}var g="application/x-jio-utf16_lz_string";e.prototype.get=function(){return this._sub_storage.get.apply(this._sub_storage,arguments)},e.prototype.post=function(){return this._sub_storage.post.apply(this._sub_storage,arguments)},e.prototype.put=function(){return this._sub_storage.put.apply(this._sub_storage,arguments)},e.prototype.remove=function(){return this._sub_storage.remove.apply(this._sub_storage,arguments)},e.prototype.hasCapacity=function(){return this._sub_storage.hasCapacity.apply(this._sub_storage,arguments)},e.prototype.buildQuery=function(){return this._sub_storage.buildQuery.apply(this._sub_storage,arguments)},e.prototype.getAttachment=function(b,e){var f=this;return f._sub_storage.getAttachment(b,e).push(function(b){return b.type!==g?b:(new a.Queue).push(function(){return jIO.util.readBlobAsText(b,"utf16")}).push(function(a){var e=c.decompressFromUTF16(a.target.result);if(""===e)return b;try{return jIO.util.dataURItoBlob(e)}catch(f){if(f instanceof d)return b;throw f}})})},e.prototype.putAttachment=function(d,e,h){var i=this;return 0===h.type.indexOf("text/")||f(h.type,"xml")||f(h.type,"json")?(new a.Queue).push(function(){return jIO.util.readBlobAsDataURL(h)}).push(function(a){var f=c.compressToUTF16(a.target.result);return h=new b([f],{type:g}),i._sub_storage.putAttachment(d,e,h)}):this._sub_storage.putAttachment.apply(this._sub_storage,arguments)},e.prototype.removeAttachment=function(){return this._sub_storage.removeAttachment.apply(this._sub_storage,arguments)},e.prototype.allAttachments=function(){return this._sub_storage.allAttachments.apply(this._sub_storage,arguments)},jIO.addStorage("zip",e)}(RSVP,Blob,LZString,DOMException),function(a,b,c,d){"use strict";function e(b){if(0!==b.indexOf("/"))throw new a.util.jIOError("id "+b+" is forbidden (no begin /)",400);if(b.lastIndexOf("/")!==b.length-1)throw new a.util.jIOError("id "+b+" is forbidden (no end /)",400);return b}function f(b){if(-1!==b.indexOf("/"))throw new a.util.jIOError("attachment "+b+" is forbidden",400)}function g(a){if("string"!=typeof a.access_token||!a.access_token)throw new TypeError("Access Token' must be a string which contains more than one character.");if("string"!=typeof a.root||!a.root||"dropbox"!==a.root&&"sandbox"!==a.root)throw new TypeError("root must be 'dropbox' or 'sandbox'");this._access_token=a.access_token,this._root=a.root}var h="https://content.dropboxapi.com/1/files_put/{+root}{+id}{+name}{?access_token}",i=d.parse(h),j="https://api.dropboxapi.com/1/fileops/create_folder{?access_token,root,path}",k=d.parse(j),l="https://api.dropboxapi.com/1/fileops/delete/{?access_token,root,path}",m=d.parse(l),n="https://content.dropboxapi.com/1/files{/root,id}{+name}{?access_token}",o=d.parse(n),p="https://api.dropboxapi.com/1/metadata{/root}{+id}{?access_token}",q=d.parse(p);g.prototype.put=function(c,d){var f=this;if(c=e(c),Object.getOwnPropertyNames(d).length>0)throw new a.util.jIOError("Can not store properties: "+Object.getOwnPropertyNames(d),400);return(new b.Queue).push(function(){return a.util.ajax({type:"POST",url:k.expand({access_token:f._access_token,root:f._root,path:c})})}).push(void 0,function(a){if(void 0===a.target||405!==a.target.status)throw a})},g.prototype.remove=function(b){return b=e(b),a.util.ajax({type:"POST",url:m.expand({access_token:this._access_token,root:this._root,path:b})})},g.prototype.get=function(c){var d=this;return"/"===c?{}:(c=e(c),(new b.Queue).push(function(){return a.util.ajax({type:"GET",url:q.expand({access_token:d._access_token,root:d._root,id:c})})}).push(function(b){var d=JSON.parse(b.target.response||b.target.responseText);if(d.is_dir)return{};throw new a.util.jIOError("Not a directory: "+c,404)},function(b){if(void 0!==b.target&&404===b.target.status)throw new a.util.jIOError("Cannot find document: "+c,404);throw b}))},g.prototype.allAttachments=function(c){var d=this;return c=e(c),(new b.Queue).push(function(){return a.util.ajax({type:"GET",url:q.expand({access_token:d._access_token,root:d._root,id:c})})}).push(function(b){var d,e=JSON.parse(b.target.response||b.target.responseText),f={};if(!e.is_dir)throw new a.util.jIOError("Not a directory: "+c,404);for(d=0;d<e.contents.length;d+=1)e.contents[d].is_dir||(f[e.contents[d].path.split("/").pop()]={});return f},function(b){if(void 0!==b.target&&404===b.target.status)throw new a.util.jIOError("Cannot find document: "+c,404);throw b})},g.prototype.putAttachment=function(b,c,d){return b=e(b),f(c),a.util.ajax({type:"PUT",url:i.expand({root:this._root,id:b,name:c,access_token:this._access_token}),dataType:d.type,data:d})},g.prototype.getAttachment=function(d,g){var h=this;return d=e(d),f(g),(new b.Queue).push(function(){return a.util.ajax({type:"GET",dataType:"blob",url:o.expand({root:h._root,id:d,name:g,access_token:h._access_token})})}).push(function(a){return new c([a.target.response||a.target.responseText],{type:a.target.getResponseHeader("Content-Type")||"application/octet-stream"})},function(b){
if(void 0!==b.target&&404===b.target.status)throw new a.util.jIOError("Cannot find attachment: "+d+", "+g,404);throw b})},g.prototype.removeAttachment=function(c,d){var g=this;return c=e(c),f(d),(new b.Queue).push(function(){return a.util.ajax({type:"POST",url:m.expand({access_token:g._access_token,root:g._root,path:c+d})})}).push(void 0,function(b){if(void 0!==b.target&&404===b.target.status)throw new a.util.jIOError("Cannot find attachment: "+c+", "+d,404);throw b})},a.addStorage("dropbox",g)}(jIO,RSVP,Blob,UriTemplate),function(a,b,c,d){"use strict";function e(c,d){return void 0===d&&(d={}),void 0!==c._authorization&&(void 0===d.headers&&(d.headers={}),d.headers.Authorization=c._authorization),void 0!==c._with_credentials&&(void 0===d.xhrFields&&(d.xhrFields={}),d.xhrFields.withCredentials=c._with_credentials),(new b.Queue).push(function(){return a.util.ajax(d)})}function f(b){if(0!==b.indexOf("/"))throw new a.util.jIOError("id "+b+" is forbidden (no begin /)",400);if(b.lastIndexOf("/")!==b.length-1)throw new a.util.jIOError("id "+b+" is forbidden (no end /)",400);return b}function g(b){if(-1!==b.indexOf("/"))throw new a.util.jIOError("attachment "+b+" is forbidden",400)}function h(a){if("string"!=typeof a.url)throw new TypeError("DavStorage 'url' is not of type string");this._url=a.url,"string"==typeof a.basic_login&&(this._authorization="Basic "+a.basic_login),this._with_credentials=a.with_credentials}h.prototype.put=function(c,d){var g=this;if(c=f(c),Object.getOwnPropertyNames(d).length>0)throw new a.util.jIOError("Can not store properties: "+Object.getOwnPropertyNames(d),400);return(new b.Queue).push(function(){return e(g,{type:"MKCOL",url:g._url+c})}).push(void 0,function(a){if(void 0===a.target||405!==a.target.status)throw a})},h.prototype.remove=function(a){return a=f(a),e(this,{type:"DELETE",url:this._url+a})},h.prototype.get=function(c){var d=this;return c=f(c),(new b.Queue).push(function(){return e(d,{type:"PROPFIND",url:d._url+c,dataType:"text",headers:{Depth:"1"}})}).push(function(){return{}},function(b){if(void 0!==b.target&&404===b.target.status)throw new a.util.jIOError("Cannot find document",404);throw b})},h.prototype.allAttachments=function(d){var g=this;return d=f(d),(new b.Queue).push(function(){return e(g,{type:"PROPFIND",url:g._url+d,dataType:"text",headers:{Depth:"1"}})}).push(function(a){var b,d,e={},f=(new c).parseFromString(a.target.responseText,"text/xml").querySelectorAll("D\\:response, response");for(b=1;b<f.length;b+=1)d=f[b].querySelector("D\\:href, href").textContent.split("/").slice(-1)[0],void 0!==d&&""!==d&&(e[d]={});return e},function(b){if(void 0!==b.target&&404===b.target.status)throw new a.util.jIOError("Cannot find document",404);throw b})},h.prototype.putAttachment=function(c,d,h){var i=this;return c=f(c),g(d),(new b.Queue).push(function(){return e(i,{type:"PUT",url:i._url+c+d,data:h})}).push(void 0,function(b){if(403===b.target.status||424===b.target.status)throw new a.util.jIOError("Cannot access subdocument",404);throw b})},h.prototype.getAttachment=function(c,h){var i=this;return c=f(c),g(h),(new b.Queue).push(function(){return e(i,{type:"GET",url:i._url+c+h,dataType:"blob"})}).push(function(a){return new d([a.target.response||a.target.responseText],{type:a.target.getResponseHeader("Content-Type")||"application/octet-stream"})},function(b){if(void 0!==b.target&&404===b.target.status)throw new a.util.jIOError("Cannot find attachment: "+c+" , "+h,404);throw b})},h.prototype.removeAttachment=function(c,d){var h=this;return c=f(c),g(d),(new b.Queue).push(function(){return e(h,{type:"DELETE",url:h._url+c+d})}).push(void 0,function(b){if(void 0!==b.target&&404===b.target.status)throw new a.util.jIOError("Cannot find attachment: "+c+" , "+d,404);throw b})},a.addStorage("dav",h)}(jIO,RSVP,DOMParser,Blob),function(a,b,c,d,e){"use strict";function f(b,c){if(404===b.target.status)throw new a.util.jIOError("Cannot find document: "+c,404);throw b}function g(b,d){var g,h;return(new c.Queue).push(function(){return a.util.ajax({type:"GET",url:s.expand({pageToken:b.nextPageToken||"",access_token:d})})}).push(function(a){for(h=e.parse(a.target.response||a.target.responseText),g=0;g<h.items.length;g+=1)h.items[g].value={},b.push(h.items[g]);return b.nextPageToken=h.nextPageToken,b},f)}function h(b){if("enclosure"!==b)throw new a.util.jIOError("Only support 'enclosure' attachment",400)}function i(a){if(void 0===a||void 0===a.access_token||"string"!=typeof a.access_token)throw new TypeError("Access Token must be a string which contains more than one character.");if(void 0!==a.trashing&&a.trashing!==!0&&a.trashing!==!1)throw new TypeError("trashing parameter must be a boolean (true or false)");this._trashing=a.trashing||!0,this._access_token=a.access_token}function j(a,b){return(new c.Queue).push(function(){return g(a,b)}).push(function(){return a.nextPageToken?j(a,b):a})}function k(b,d,g){var h="-------314159265358979323846";return(new c.Queue).push(function(){return a.util.ajax({type:b?"PUT":"POST",url:o.expand({access_token:g,id:b||[],upload:b?[]:"upload",uploadType:"multipart"}),headers:{"Content-Type":'multipart/related; boundary="'+h+'"'},data:"--"+h+"\nContent-Type: application/json; charset=UTF-8\n\n"+e.stringify(d)+"\n\n--"+h+"--"})}).push(function(a){var b=e.parse(a.target.responseText);return b.id},function(a){f(a,b)})}function l(b,d,g){return(new c.Queue).push(function(){return a.util.ajax({type:"PUT",url:o.expand({access_token:g,upload:"upload",id:b,uploadType:"media"}),data:d})}).push(function(b){if(b=e.parse(b.target.responseText),"application/vnd.google-apps.folder"===b.mimeType)throw new a.util.jIOError("cannot put attachments to folder",400);return b},function(a){f(a,b)})}function m(d,g,h){return(new c.Queue).push(function(){return a.util.ajax({type:"GET",dataType:g?"blob":"json",url:u.expand({id:d,alt:g?"media":[],access_token:h}),headers:{Authorization:"Bearer "+h}})}).push(function(a){return a.target.response||(g?new b([a.target.responseText],{type:a.target.responseHeaders["Content-Type"]}):e.parse(a.target.responseText))},function(a){f(a,d)})}var n="https://www.googleapis.com{/upload}/drive/v2/files{/id}{?uploadType,access_token}",o=d.parse(n),p="https://www.googleapis.com/drive/v2/files{/id,trash}{?access_token}",q=d.parse(p),r="https://www.googleapis.com/drive/v2/files?prettyPrint=false{&pageToken}&q=trashed=false&fields=nextPageToken,items(id){&access_token}",s=d.parse(r),t="https://www.googleapis.com/drive/v2/files{/id}{?alt}",u=d.parse(t);i.prototype.hasCapacity=function(a){return"list"===a},i.prototype.buildQuery=function(){return j([],this._access_token)},i.prototype.put=function(a,b){return k(a,b,this._access_token)},i.prototype.post=function(a){return k(void 0,a,this._access_token)},i.prototype.putAttachment=function(a,b,c){return h(b),l(a,c,this._access_token)},i.prototype.remove=function(b){var d=this;return(new c.Queue).push(function(){return a.util.ajax({type:d._trashing?"POST":"DELETE",url:q.expand({id:b,access_token:d._access_token,trash:d._trashing?"trash":[]})})}).push(void 0,function(a){f(a,b)})},i.prototype.get=function(a){return m(a,!1,this._access_token)},i.prototype.getAttachment=function(a,b){return h(b),m(a,!0,this._access_token)},i.prototype.allAttachments=function(a){var b=this._access_token;return(new c.Queue).push(function(){return m(a,!1,b)}).push(function(a){return"application/vnd.google-apps.folder"===a.mimeType?{}:{enclosure:{}}})},a.addStorage("gdrive",i)}(jIO,Blob,RSVP,UriTemplate,JSON),function(a,b){"use strict";function c(b){if(!Array.isArray(b.storage_list))throw new a.util.jIOError("storage_list is not an Array",400);var c;for(this._storage_list=[],c=0;c<b.storage_list.length;c+=1)this._storage_list.push(a.createJIO(b.storage_list[c]))}c.prototype._getWithStorageIndex=function(){function b(b){g.push(void 0,function(c){if(c instanceof a.util.jIOError&&404===c.status_code)return e._storage_list[b].get.apply(e._storage_list[b],f).push(function(a){return d=b,a});throw c})}var c,d=0,e=this,f=arguments,g=this._storage_list[0].get.apply(this._storage_list[0],f);for(c=1;c<this._storage_list.length;c+=1)b(c);return g.push(function(a){return[d,a]})},c.prototype.get=function(){return this._getWithStorageIndex.apply(this,arguments).push(function(a){return a[1]})},c.prototype.allAttachments=function(){var a=arguments,b=this;return this._getWithStorageIndex.apply(this,arguments).push(function(c){var d=b._storage_list[c[0]];return d.allAttachments.apply(d,a)})},c.prototype.post=function(){return this._storage_list[0].post.apply(this._storage_list[0],arguments)},c.prototype.put=function(){var b=arguments,c=this;return this._getWithStorageIndex(b[0]).push(void 0,function(b){if(b instanceof a.util.jIOError&&404===b.status_code)return[0];throw b}).push(function(a){var d=c._storage_list[a[0]];return d.put.apply(d,b)})},c.prototype.remove=function(){var a=arguments,b=this;return this._getWithStorageIndex(a[0]).push(function(c){var d=b._storage_list[c[0]];return d.remove.apply(d,a)})},c.prototype.buildQuery=function(){var a,c,d=[],e={},f=this._storage_list.length;for(a=0;f>a;a+=1)c=this._storage_list[a],d.push(c.buildQuery.apply(c,arguments));return(new b.Queue).push(function(){return b.all(d)}).push(function(b){var c,d,g,h=[];for(f=b.length,a=0;f>a;a+=1)for(c=b[a],d=c.length,g=0;d>g;g+=1)e.hasOwnProperty(c[g].id)||(e[c[g].id]=null,h.push(c[g]));return h})},c.prototype.hasCapacity=function(a){var b,c,d,e;if("list"===a||"query"===a||"select"===a){for(d=!0,c=this._storage_list.length,b=0;c>b;b+=1)e=this._storage_list[b],d=d&&e.hasCapacity(a);return d}return!1},c.prototype.repair=function(){var a,c=[];for(a=0;a<this._storage_list.length;a+=1)c.push(this._storage_list[a].repair.apply(this._storage_list[a],arguments));return b.all(c)},c.prototype.getAttachment=function(){var a=arguments,b=this;return this._getWithStorageIndex.apply(this,arguments).push(function(c){var d=b._storage_list[c[0]];return d.getAttachment.apply(d,a)})},c.prototype.putAttachment=function(){var a=arguments,b=this;return this._getWithStorageIndex.apply(this,arguments).push(function(c){var d=b._storage_list[c[0]];return d.putAttachment.apply(d,a)})},c.prototype.removeAttachment=function(){var a=arguments,b=this;return this._getWithStorageIndex.apply(this,arguments).push(function(c){var d=b._storage_list[c[0]];return d.removeAttachment.apply(d,a)})},a.addStorage("union",c)}(jIO,RSVP),function(a,b,c,d,e,f,g,h){"use strict";function i(b){return(new d.Queue).push(function(){return a.util.ajax({type:"GET",url:b._url,xhrFields:{withCredentials:!0}})}).push(function(a){return JSON.parse(a.target.responseText)})}function j(c,e,f){return void 0===f&&(f={}),i(c).push(function(c){return(new d.Queue).push(function(){return a.util.ajax({type:"GET",url:b.parse(c._links.traverse.href).expand({relative_url:e,view:f._view}),xhrFields:{withCredentials:!0}})}).push(void 0,function(b){if(void 0!==b.target&&404===b.target.status)throw new a.util.jIOError("Cannot find document: "+e,404);throw b})})}function k(a){return(new d.Queue).push(function(){var b,c,d,f,g=a._embedded._view,h={portal_type:a._links.type.name},i={};a._links.hasOwnProperty("parent")&&(h.parent_relative_url=new e(a._links.parent.href).segment(2)),i.form_id={key:[g.form_id.key],"default":g.form_id["default"]};for(c in g)g.hasOwnProperty(c)&&(b=g[c],d=0,0===c.indexOf("my_")&&b.editable&&(d=3),0===c.indexOf("your_")&&(d=5),0!==d&&q.hasOwnProperty(b.type)&&(i[c.substring(d)]={"default":b["default"],key:b.key},h[c.substring(d)]=b["default"]));return f={data:h,form_data:i},g.hasOwnProperty("_actions")&&g._actions.hasOwnProperty("put")&&(f.action_href=g._actions.put.href),f})}function l(b,c){return b.getAttachment(c,"view").push(function(b){return a.util.readBlobAsText(b)}).push(function(a){return JSON.parse(a.target.result)}).push(function(a){return k(a)})}function m(a){if("string"!=typeof a.url||!a.url)throw new TypeError("ERP5 'url' must be a string which contains more than one character.");this._url=a.url,this._default_view_reference=a.default_view_reference}function n(a){var b,c=a.data;for(b in c)c.hasOwnProperty(b)&&(c[b]||delete c[b]);return c}function o(a){return a instanceof g&&"local_roles"===a.key?a.value:void 0}function p(a){var b,c,d=!0,e=[];if(a instanceof h&&"OR"===a.operator){for(b=0;b<a.query_list.length;b+=1)c=a.query_list[b],c instanceof g&&"local_roles"===c.key?e.push(c.value):d=!1;if(d)return e}}var q={StringField:null,EmailField:null,IntegerField:null,FloatField:null,TextAreaField:null};m.prototype.get=function(a){return l(this,a).push(function(a){return n(a)})},m.prototype.post=function(b){var d,f=this;return i(this).push(function(d){var e=new c;return e.append("portal_type",b.portal_type),e.append("parent_relative_url",b.parent_relative_url),a.util.ajax({type:"POST",url:d._actions.add.href,data:e,xhrFields:{withCredentials:!0}})}).push(function(a){var c=a.target.getResponseHeader("X-Location"),g=new e(c);return d=g.segment(2),f.put(d,b)}).push(function(){return d})},m.prototype.put=function(b,c){var d=this;return l(d,b).push(function(e){var g,h=e.form_data,i={};i[h.form_id.key]=h.form_id["default"];for(g in c)if(c.hasOwnProperty(g)){if("form_id"===g)throw new a.util.jIOError("ERP5: forbidden property: "+g,400);if("portal_type"!==g&&"parent_relative_url"!==g){if(!h.hasOwnProperty(g))throw new a.util.jIOError("ERP5: can not store property: "+g,400);i[h[g].key]=c[g]}}if(!e.hasOwnProperty("action_href"))throw new a.util.jIOError("ERP5: can not modify document: "+b,403);return d.putAttachment(b,e.action_href,new f([JSON.stringify(i)],{type:"application/json"}))})},m.prototype.allAttachments=function(a){var b=this;return j(this,a).push(function(){return void 0===b._default_view_reference?{links:{}}:{view:{},links:{}}})},m.prototype.getAttachment=function(b,c,e){if(void 0===e&&(e={}),"view"===c){if(void 0===this._default_view_reference)throw new a.util.jIOError("Cannot find attachment view for: "+b,404);return j(this,b,{_view:this._default_view_reference}).push(function(a){var b=JSON.parse(a.target.responseText);return new f([JSON.stringify(b)],{type:"application/hal+json"})})}if("links"===c)return j(this,b).push(function(a){return new f([JSON.stringify(JSON.parse(a.target.responseText))],{type:"application/hal+json"})});if(0===c.indexOf(this._url))return(new d.Queue).push(function(){var b,d,f,g={type:"GET",dataType:"blob",url:c,xhrFields:{withCredentials:!0}};if(void 0!==e.start||void 0!==e.end){if(b=e.start||0,d=e.end,void 0!==d&&0>d)throw new a.util.jIOError("end must be positive",400);if(0>b)f="bytes="+b;else if(void 0===d)f="bytes="+b+"-";else{if(b>d)throw new a.util.jIOError("start is greater than end",400);f="bytes="+b+"-"+d}g.headers={Range:f}}return a.util.ajax(g)}).push(function(a){return void 0===a.target.response?new f([a.target.responseText],{type:a.target.getResponseHeader("Content-Type")}):a.target.response});throw new a.util.jIOError("ERP5: not support get attachment: "+c,400)},m.prototype.putAttachment=function(b,e,f){if(0!==e.indexOf(this._url))throw new a.util.jIOError("Can not store outside ERP5: "+e,400);return(new d.Queue).push(function(){return a.util.readBlobAsText(f)}).push(function(b){var d,f,g,h,i=JSON.parse(b.target.result),j=new c;for(g in i)if(i.hasOwnProperty(g))for(d=Array.isArray(i[g])?i[g]:[i[g]],f=0;f<d.length;f+=1)h=d[f],"object"==typeof h?j.append(g,a.util.dataURItoBlob(h.url),h.file_name):j.append(g,h);return a.util.ajax({type:"POST",url:e,data:j,dataType:"blob",xhrFields:{withCredentials:!0}})})},m.prototype.hasCapacity=function(a){return"list"===a||"query"===a||"select"===a||"limit"===a||"sort"===a},m.prototype.buildQuery=function(c){return i(this).push(function(d){var e,f,g,i,j,k=c.query,l=[];if(c.query)if(f=a.QueryFactory.create(c.query),i=o(f))k=void 0,j=i;else if(i=p(f))k=void 0,j=i;else if(f instanceof h&&"AND"===f.operator)for(e=0;e<f.query_list.length;e+=1)g=f.query_list[e],i=o(g),i?(j=i,f.query_list.splice(e,1),k=a.Query.objectToSearchText(f),e=f.query_list.length):(i=p(g),i&&(j=i,f.query_list.splice(e,1),k=a.Query.objectToSearchText(f),e=f.query_list.length));if(c.sort_on)for(e=0;e<c.sort_on.length;e+=1)l.push(JSON.stringify(c.sort_on[e]));return a.util.ajax({type:"GET",url:b.parse(d._links.raw_search.href).expand({query:k,select_list:c.select_list||["title","reference"],limit:c.limit,sort_on:l,local_roles:j}),xhrFields:{withCredentials:!0}})}).push(function(a){return JSON.parse(a.target.responseText)}).push(function(a){var b,c,d,f=a._embedded.contents,g=f.length,h=[];for(b=0;g>b;b+=1)d=f[b],c=new e(d._links.self.href),delete d._links,h.push({id:c.segment(2),value:d});return h})},a.addStorage("erp5",m)}(jIO,UriTemplate,FormData,RSVP,URI,Blob,SimpleQuery,ComplexQuery),function(a,b){"use strict";function c(b){this._sub_storage=a.createJIO(b.sub_storage),this._key_schema=b.key_schema}c.prototype.get=function(){return this._sub_storage.get.apply(this._sub_storage,arguments)},c.prototype.allAttachments=function(){return this._sub_storage.allAttachments.apply(this._sub_storage,arguments)},c.prototype.post=function(){return this._sub_storage.post.apply(this._sub_storage,arguments)},c.prototype.put=function(){return this._sub_storage.put.apply(this._sub_storage,arguments)},c.prototype.remove=function(){return this._sub_storage.remove.apply(this._sub_storage,arguments)},c.prototype.getAttachment=function(){return this._sub_storage.getAttachment.apply(this._sub_storage,arguments)},c.prototype.putAttachment=function(){return this._sub_storage.putAttachment.apply(this._sub_storage,arguments)},c.prototype.removeAttachment=function(){return this._sub_storage.removeAttachment.apply(this._sub_storage,arguments)},c.prototype.repair=function(){return this._sub_storage.repair.apply(this._sub_storage,arguments)},c.prototype.hasCapacity=function(a){var b=["limit","sort","select","query"];return-1!==b.indexOf(a)?!0:"list"===a?this._sub_storage.hasCapacity(a):!1},c.prototype.buildQuery=function(c){var d=this._sub_storage,e=this,f={},g=!1,h=!1;if(d.hasCapacity("list")){try{void 0!==c.query&&!d.hasCapacity("query")||void 0!==c.sort_on&&!d.hasCapacity("sort")||void 0!==c.select_list&&!d.hasCapacity("select")||void 0!==c.limit&&!d.hasCapacity("limit")||(f.query=c.query,f.sort_on=c.sort_on,f.select_list=c.select_list,f.limit=c.limit)}catch(i){if(!(i instanceof a.util.jIOError&&501===i.status_code))throw i;g=!0}try{(g||c.include_docs===!0)&&d.hasCapacity("include")&&(f.include_docs=!0)}catch(i){if(!(i instanceof a.util.jIOError&&501===i.status_code))throw i;h=!0}return d.buildQuery(f).push(function(c){function e(b){var e=c[b].id;return d.get(e).push(function(a){return a._id=e,a},function(b){if(!(b instanceof a.util.jIOError&&404===b.status_code))throw b})}var f,g,i=[c];if(h){for(f=c.length,g=0;f>g;g+=1)i.push(e(g));c=b.all(i)}return c}).push(function(a){var b,c,d;if(h){for(b=a[0],c=b.length,d=0;c>d;d+=1)b[d].doc=a[d+1];a=b}return a}).push(function(b){var d,f,h=[];if(g){for(d=b.length,f=0;d>f;f+=1)b[f].doc.__id=b[f].id,h.push(b[f].doc);c.select_list&&c.select_list.push("__id"),b=a.QueryFactory.create(c.query||"",e._key_schema).exec(h,c)}return b}).push(function(a){var b,d,e,f=[];if(g){for(d=a.length,e=0;d>e;e+=1){if(b={id:a[e].__id,value:c.select_list?a[e]:{},doc:{}},c.select_list&&delete b.value.__id,c.include_docs)throw new Error("QueryStorage does not support include docs");f.push(b)}a=f}return a})}},a.addStorage("query",c)}(jIO,RSVP),function(a,b,c){"use strict";function d(b){this._sub_storage=a.createJIO(b.sub_storage)}function e(a,b){return-1!==a.indexOf(b,a.length-b.length)}var f=".json",g="/.jio_documents/",h="/";d.prototype.get=function(c){var d=this;return(new b.Queue).push(function(){return d._sub_storage.getAttachment(g,c+f,{format:"json"})}).push(void 0,function(b){if(b instanceof a.util.jIOError&&404===b.status_code)return d._sub_storage.allAttachments(h).push(function(b){if(b.hasOwnProperty(c))return{};throw new a.util.jIOError("Cannot find document "+c,404)});throw b})},d.prototype.allAttachments=function(b){var c=this;return c._sub_storage.allAttachments(h).push(function(d){return d.hasOwnProperty(b)?{enclosure:{}}:c._sub_storage.getAttachment(g,b+f).push(function(){return{}},function(c){if(c instanceof a.util.jIOError&&404===c.status_code)throw new a.util.jIOError("Cannot find document "+b,404);throw c})})},d.prototype.put=function(b,d){var e=this;return e._sub_storage.putAttachment(g,b+f,new c([JSON.stringify(d)],{type:"application/json"})).push(void 0,function(h){if(h instanceof a.util.jIOError&&404===h.status_code)return e._sub_storage.put(g,{}).push(function(){return e._sub_storage.putAttachment(g,b+f,new c([JSON.stringify(d)],{type:"application/json"}))});throw h}).push(function(){return b})},d.prototype.remove=function(c){var d=this,e=!1;return(new b.Queue).push(function(){return d._sub_storage.removeAttachment(h,c)}).push(void 0,function(b){if(b instanceof a.util.jIOError&&404===b.status_code)return void(e=!0);throw b}).push(function(){return d._sub_storage.removeAttachment(g,c+f)}).push(void 0,function(b){if(!e&&b instanceof a.util.jIOError&&404===b.status_code)return c;throw b})},d.prototype.hasCapacity=function(a){return"list"===a},d.prototype.buildQuery=function(){var c={},d=this;return(new b.Queue).push(function(){return d._sub_storage.allAttachments(g)}).push(function(a){var b;for(b in a)a.hasOwnProperty(b)&&e(b,f)&&(c[b.substring(0,b.length-f.length)]=null)},function(b){if(!(b instanceof a.util.jIOError&&404===b.status_code))throw b}).push(function(){return d._sub_storage.allAttachments(h)}).push(function(a){var b;for(b in a)a.hasOwnProperty(b)&&(c[b]=null)}).push(function(){var a,b=[];for(a in c)c.hasOwnProperty(a)&&b.push({id:a,value:{}});return b})},d.prototype.getAttachment=function(b,c){if("enclosure"!==c)throw new a.util.jIOError("Only support 'enclosure' attachment",400);return this._sub_storage.getAttachment(h,b)},d.prototype.putAttachment=function(b,c,d){if("enclosure"!==c)throw new a.util.jIOError("Only support 'enclosure' attachment",400);return this._sub_storage.putAttachment(h,b,d)},d.prototype.removeAttachment=function(b,c){if("enclosure"!==c)throw new a.util.jIOError("Only support 'enclosure' attachment",400);return this._sub_storage.removeAttachment(h,b)},d.prototype.repair=function(){return this._sub_storage.repair.apply(this._sub_storage,arguments)},a.addStorage("drivetojiomapping",d)}(jIO,RSVP,Blob),function(a,b,c,d,e){"use strict";function f(b){this._sub_storage=a.createJIO(b.sub_storage),this._document_id=b.document_id,this._repair_attachment=b.repair_attachment||!1}function g(a,b){return void 0===b?"jio_document/"+d(a)+h:"jio_attachment/"+d(a)+"/"+d(b)}var h=".json",i=new RegExp("^jio_document/([\\w=]+)"+h+"$"),j=new RegExp("^jio_attachment/([\\w=]+)/([\\w=]+)$");f.prototype.get=function(a){return this._sub_storage.getAttachment(this._document_id,g(a),{format:"json"})},f.prototype.allAttachments=function(a){return this._sub_storage.allAttachments(this._document_id).push(function(b){var d,e,f={};for(e in b)if(b.hasOwnProperty(e)&&j.test(e)){d=j.exec(e);try{c(d[1])===a&&(f[c(d[2])]={})}catch(g){if(!g instanceof ReferenceError)throw g}}return f})},f.prototype.put=function(a,c){return this._sub_storage.putAttachment(this._document_id,g(a),new b([JSON.stringify(c)],{type:"application/json"})).push(function(){return a})},f.prototype.remove=function(a){var b=this;return this.allAttachments(a).push(function(c){var d,f=[];for(d in c)c.hasOwnProperty(d)&&f.push(b.removeAttachment(a,d));return e.all(f)}).push(function(){return b._sub_storage.removeAttachment(b._document_id,g(a))}).push(function(){return a})},f.prototype.repair=function(){var a=this;return this._sub_storage.repair.apply(this._sub_storage,arguments).push(function(b){return a._repair_attachment?a._sub_storage.allAttachments(a._document_id).push(function(b){var d,f,g,h,k=[],l={},m={};for(h in b)if(b.hasOwnProperty(h))if(d=void 0,f=void 0,i.test(h)){try{d=c(i.exec(h)[1])}catch(n){if(!n instanceof ReferenceError)throw n}void 0!==d&&(l[d]=null)}else if(j.test(h)){g=j.exec(h);try{d=c(g[1]),f=c(g[2])}catch(n){if(!n instanceof ReferenceError)throw n}void 0!==f&&(l.hasOwnProperty(d)||(m.hasOwnProperty(d)||(m[d]={}),m[d][f]=null))}for(d in m)if(m.hasOwnProperty(d)&&!l.hasOwnProperty(d))for(f in m[d])m[d].hasOwnProperty(f)&&k.push(a.removeAttachment(d,f));return e.all(k)}):b})},f.prototype.hasCapacity=function(a){return"list"===a},f.prototype.buildQuery=function(){return this._sub_storage.allAttachments(this._document_id).push(function(a){var b,d=[];for(b in a)if(a.hasOwnProperty(b)&&i.test(b))try{d.push({id:c(i.exec(b)[1]),value:{}})}catch(e){if(!e instanceof ReferenceError)throw e}return d})},f.prototype.getAttachment=function(a,b){return this._sub_storage.getAttachment(this._document_id,g(a,b))},f.prototype.putAttachment=function(a,b,c){return this._sub_storage.putAttachment(this._document_id,g(a,b),c)},f.prototype.removeAttachment=function(a,b){return this._sub_storage.removeAttachment(this._document_id,g(a,b))},a.addStorage("document",f)}(jIO,Blob,atob,btoa,RSVP),function(a,b,c,d){"use strict";function e(a){a.sessiononly===!0?this._storage=b:this._storage=c}function f(b){if("/"!==b)throw new a.util.jIOError("id "+b+" is forbidden (!== /)",400)}e.prototype.get=function(a){return f(a),{}},e.prototype.allAttachments=function(a){f(a);var b,c={};for(b in this._storage)this._storage.hasOwnProperty(b)&&(c[b]={});return c},e.prototype.getAttachment=function(b,c){f(b);var d=this._storage.getItem(c);if(null===d)throw new a.util.jIOError("Cannot find attachment "+c,404);return a.util.dataURItoBlob(d)},e.prototype.putAttachment=function(b,c,e){var g=this;return f(b),(new d.Queue).push(function(){return a.util.readBlobAsDataURL(e)}).push(function(a){g._storage.setItem(c,a.target.result)})},e.prototype.removeAttachment=function(a,b){return f(a),this._storage.removeItem(b)},e.prototype.hasCapacity=function(a){return"list"===a},e.prototype.buildQuery=function(){return[{id:"/",value:{}}]},a.addStorage("local",e)}(jIO,sessionStorage,localStorage,RSVP),function(a,b,c,d,e,f,g,h){"use strict";function i(a){if("string"!=typeof a.database||""===a.database)throw new TypeError("IndexedDBStorage 'database' description property must be a non-empty string");this._database_name="jio:"+a.database}function j(a){return a.join("_")}function k(a){var b,c=a.target.result;b=c.createObjectStore("metadata",{keyPath:"_id",autoIncrement:!1}),b.createIndex("_id","_id",{unique:!0}),b=c.createObjectStore("attachment",{keyPath:"_key_path",autoIncrement:!1}),b.createIndex("_id","_id",{unique:!1}),b=c.createObjectStore("blob",{keyPath:"_key_path",autoIncrement:!1}),b.createIndex("_id_attachment",["_id","_attachment"],{unique:!1}),b.createIndex("_id","_id",{unique:!1})}function l(b){function d(b,c){var d=a.open(e);d.onerror=function(a){d.result&&d.result.close(),c(void 0!==a&&a.target instanceof g&&a.target.error instanceof h?"Connection to: "+e+" failed: "+a.target.error.message:a)},d.onabort=function(){d.result.close(),c("Aborting connection to: "+e)},d.ontimeout=function(){d.result.close(),c("Connection to: "+e+" timeout")},d.onblocked=function(){d.result.close(),c("Connection to: "+e+" was blocked")},d.onupgradeneeded=k,d.onversionchange=function(){d.result.close(),c(e+" was upgraded")},d.onsuccess=function(){b(d.result)}}var e=b._database_name;return(new c.Queue).push(function(){return new c.Promise(d)})}function m(a,b,c,d){var e=a.transaction(b,c);return d!==!1&&(e.oncomplete=function(){a.close()}),e.onabort=function(){a.close()},e}function n(a,b,c,d){a.onerror=function(b){a.transaction&&a.transaction.abort(),d(b)},a.onsuccess=function(a){var e=a.target.result;if(e){try{b(e)}catch(f){d(f)}e["continue"]()}else c()}}function o(a,c,d,e){var f=a.get(c);f.onerror=e,f.onsuccess=function(){f.result?d(f.result):e(new b.util.jIOError("IndexedDB: cannot find object '"+c+"' in the '"+a.name+"' store",404))}}function p(a,b,c){a.onerror=c,a.onsuccess=function(){b(a.result)}}function q(a){a["delete"]()}function r(a,b,c,d,e){function g(){n(a.objectStore("blob").index("_id_attachment").openCursor(f.only([b,c])),q,d,e)}p(a.objectStore("attachment")["delete"](j([b,c])),g,e)}var s=2e6;i.prototype.hasCapacity=function(a){return"list"===a||"include"===a},i.prototype.buildQuery=function(a){function b(a){e.push({id:a.key,value:{},doc:a.value.doc})}function d(a){e.push({id:a.key,value:{}})}var e=[];return l(this).push(function(e){return new c.Promise(function(c,f){var g=m(e,["metadata"],"readonly");a.include_docs===!0?n(g.objectStore("metadata").index("_id").openCursor(),b,c,f):n(g.objectStore("metadata").index("_id").openKeyCursor(),d,c,f)})}).push(function(){return e})},i.prototype.get=function(a){return l(this).push(function(b){return new c.Promise(function(c,d){var e=m(b,["metadata"],"readonly");o(e.objectStore("metadata"),a,c,d)})}).push(function(a){return a.doc})},i.prototype.allAttachments=function(a){function b(a){d[a.value._attachment]={}}var d={};return l(this).push(function(d){return new c.Promise(function(c,e){function g(){n(h.objectStore("attachment").index("_id").openCursor(f.only(a)),b,c,e)}var h=m(d,["metadata","attachment"],"readonly");o(h.objectStore("metadata"),a,g,e)})}).push(function(){return d})},i.prototype.put=function(a,b){return l(this).push(function(d){return new c.Promise(function(c,e){var f=m(d,["metadata"],"readwrite");p(f.objectStore("metadata").put({_id:a,doc:b}),c,e)})})},i.prototype.remove=function(a){var b=0;return l(this).push(function(d){return new c.Promise(function(c,e){function g(){2>b?b+=1:c()}var h=m(d,["metadata","attachment","blob"],"readwrite");p(h.objectStore("metadata")["delete"](a),g,e),n(h.objectStore("attachment").index("_id").openCursor(f.only(a)),q,g,e),n(h.objectStore("blob").index("_id").openCursor(f.only(a)),q,g,e)})})},i.prototype.getAttachment=function(a,f,g){var h,i,k,n;return void 0===g&&(g={}),l(this).push(function(d){return new c.Promise(function(c,l){function p(d){function m(a){u.push(a),c(u)}function p(b){return function(c){c&&u.push(c),b+=1,o(v,j([a,f,b]),r>=b?p(b):m,l)}}var q,r,t=d.info.length,u=[],v=h.objectStore("blob");if(i=d.info.content_type,k=g.start||0,n=g.end||t,n>t&&(n=t),0>k||0>n)throw new b.util.jIOError("_start and _end must be positive",400);if(k>n)throw new b.util.jIOError("_start is greater than _end",400);q=e.floor(k/s),r=e.floor(n/s)-1,n%s===0&&(r-=1),p(q-1)()}h=m(d,["attachment","blob"],"readonly"),o(h.objectStore("attachment"),j([a,f]),p,l)})}).push(function(a){var b,c,f,h=[],j=a.length;for(c=0;j>c;c+=1)h.push(a[c].blob);return void 0===g.start&&void 0===g.end?new d(h,{type:i}):(f=e.floor(k/s)*s,b=new d(h,{type:"application/octet-stream"}),b.slice(k-f,n-f,"application/octet-stream"))})},i.prototype.putAttachment=function(a,d,e){var f,g,h=[];return l(this).push(function(a){return g=a,b.util.readBlobAsArrayBuffer(e)}).push(function(b){for(var i=b.target.result,k=e.size,l=0;k>l;)h.push(i.slice(l,l+s)),l+=s;return f=m(g,["attachment","blob"],"readwrite"),new c.Promise(function(b,c){function g(){function g(e){return function(){e+=1,p(l.put({_key_path:j([a,d,e]),_id:a,_attachment:d,_part:e,blob:h[e]}),i>e?g(e):b,c)}}var i=h.length-1,k=f.objectStore("attachment"),l=f.objectStore("blob");p(k.put({_key_path:j([a,d]),_id:a,_attachment:d,info:{content_type:e.type,length:e.size}}),g(-1),c)}r(f,a,d,g,c)})})},i.prototype.removeAttachment=function(a,b){return l(this).push(function(d){var e=m(d,["attachment","blob"],"readwrite");return new c.Promise(function(c,d){r(e,a,b,c,d)})})},b.addStorage("indexeddb",i)}(indexedDB,jIO,RSVP,Blob,Math,IDBKeyRange,IDBOpenDBRequest,DOMError),function(a,b,c,d,e,f,g){"use strict";function h(b){this._key=b.key,this._jsonKey=!0,this._sub_storage=a.createJIO(b.sub_storage)}function i(a){return(new b.Queue).push(function(){return e.subtle.importKey("jwk",a._key,"AES-GCM",!1,["encrypt","decrypt"])}).push(function(b){a._key=b,a._jsonKey=!1})}var j="application/x-jio-aes-gcm-encryption";h.prototype.get=function(){return this._sub_storage.get.apply(this._sub_storage,arguments);
},h.prototype.post=function(){return this._sub_storage.post.apply(this._sub_storage,arguments)},h.prototype.put=function(){return this._sub_storage.put.apply(this._sub_storage,arguments)},h.prototype.remove=function(){return this._sub_storage.remove.apply(this._sub_storage,arguments)},h.prototype.hasCapacity=function(){return this._sub_storage.hasCapacity.apply(this._sub_storage,arguments)},h.prototype.buildQuery=function(){return this._sub_storage.buildQuery.apply(this._sub_storage,arguments)},h.prototype.putAttachment=function(c,h,k){var l=e.getRandomValues(new f(12)),m=this;return(new b.Queue).push(function(){return m._jsonKey===!0?i(m):void 0}).push(function(){return a.util.readBlobAsDataURL(k)}).push(function(a){var b,c=a.target.result.length,d=new g(c),h=new f(d);for(a=a.target.result,b=0;c>b;b+=1)h[b]=a.charCodeAt(b);return e.subtle.encrypt({name:"AES-GCM",iv:l},m._key,d)}).push(function(a){var b=new d([l,a],{type:j});return m._sub_storage.putAttachment(c,h,b)})},h.prototype.getAttachment=function(d,g){var h=this;return h._sub_storage.getAttachment(d,g).push(function(d){return d.type!==j?d:(new b.Queue).push(function(){return h._jsonKey===!0?i(h):void 0}).push(function(){return a.util.readBlobAsArrayBuffer(d)}).push(function(g){var i;return g=g.target.result,i=new f(g.slice(0,12)),(new b.Queue).push(function(){return e.subtle.decrypt({name:"AES-GCM",iv:i},h._key,g.slice(12))}).push(function(b){return b=String.fromCharCode.apply(null,new f(b)),a.util.dataURItoBlob(b)}).push(void 0,function(a){if(a instanceof c)return d;throw a})})})},h.prototype.removeAttachment=function(){return this._sub_storage.removeAttachment.apply(this._sub_storage,arguments)},h.prototype.allAttachments=function(){return this._sub_storage.allAttachments.apply(this._sub_storage,arguments)},a.addStorage("crypt",h)}(jIO,RSVP,DOMException,Blob,crypto,Uint8Array,ArrayBuffer),function(a,b,c,d){"use strict";function e(a,c,d){return new b.Promise(function(b,e){a.transaction(function(a){function f(a,c){j.push(c),j.length===i&&b(j)}function g(a,b){return e(b),!0}var h,i=c.length,j=[];for(h=0;i>h;h+=1)a.executeSql(c[h],d[h],f,g)},function(a,b){e(b)})})}function f(a){var c=["CREATE TABLE IF NOT EXISTS document(id VARCHAR PRIMARY KEY NOT NULL, data TEXT)","CREATE TABLE IF NOT EXISTS attachment(id VARCHAR, attachment VARCHAR, part INT, blob TEXT)","CREATE TRIGGER IF NOT EXISTS removeAttachment BEFORE DELETE ON document FOR EACH ROW BEGIN DELETE from attachment WHERE id = OLD.id;END;","CREATE INDEX IF NOT EXISTS index_document ON document (id);","CREATE INDEX IF NOT EXISTS index_attachment ON attachment (id, attachment);"];return(new b.Queue).push(function(){return e(a,c,[])})}function g(a){if("string"!=typeof a.database||!a.database)throw new TypeError("database must be a string which contains more than one character.");if(this._database=d("jio:"+a.database,"1.0","",2097152),a.blob_length&&("number"!=typeof a.blob_length||a.blob_length<20))throw new TypeError("blob_len parameter must be a number >= 20");this._blob_length=a.blob_length||2e6,this._init_db_promise=f(this._database)}function h(b,c,d,e){e.push(function(){return a.util.readBlobAsDataURL(b)}).push(function(a){c[d+2].push(a.target.result)})}g.prototype.put=function(a,c){var d=this._database,f=this,g=JSON.stringify(c);return(new b.Queue).push(function(){return f._init_db_promise}).push(function(){return e(d,["INSERT OR REPLACE INTO document(id, data) VALUES(?,?)"],[[a,g]])}).push(function(){return a})},g.prototype.remove=function(c){var d=this._database,f=this;return(new b.Queue).push(function(){return f._init_db_promise}).push(function(){return e(d,["DELETE FROM document WHERE id = ?"],[[c]])}).push(function(b){if(0===b[0].rowsAffected)throw new a.util.jIOError("Cannot find document",404);return c})},g.prototype.get=function(c){var d=this._database,f=this;return(new b.Queue).push(function(){return f._init_db_promise}).push(function(){return e(d,["SELECT data FROM document WHERE id = ?"],[[c]])}).push(function(b){if(0===b[0].rows.length)throw new a.util.jIOError("Cannot find document",404);return JSON.parse(b[0].rows[0].data)})},g.prototype.allAttachments=function(c){var d=this._database,f=this;return(new b.Queue).push(function(){return f._init_db_promise}).push(function(){return e(d,["SELECT id FROM document WHERE id = ?","SELECT DISTINCT attachment FROM attachment WHERE id = ?"],[[c],[c]])}).push(function(b){if(0===b[0].rows.length)throw new a.util.jIOError("Cannot find document",404);var c,d=b[1].rows.length,e={};for(c=0;d>c;c+=1)e[b[1].rows[c].attachment]={};return e})},g.prototype.putAttachment=function(c,d,f){var g=this._database,i=this,j=this._blob_length;return(new b.Queue).push(function(){return i._init_db_promise}).push(function(){return e(g,["SELECT id FROM document WHERE id = ?"],[[c]])}).push(function(i){var k,l,m=[],n=[],o=f.size,p=new b.Queue;if(0===i[0].rows.length)throw new a.util.jIOError("Cannot access subdocument",404);for(m.push("DELETE FROM attachment WHERE id = ? AND attachment = ?"),n.push([c,d]),m.push("INSERT INTO attachment(id, attachment, part, blob)VALUES(?, ?, ?, ?)"),n.push([c,d,-1,f.type||"application/octet-stream"]),k=0,l=0;o>k;k+=j,l+=1)m.push("INSERT INTO attachment(id, attachment, part, blob)VALUES(?, ?, ?, ?)"),n.push([c,d,l]),h(f.slice(k,k+j),n,l,p);return p.push(function(){return e(g,m,n)}),p})},g.prototype.getAttachment=function(d,f,g){var h,i,j,k,l=this._database,m=this,n=this._blob_length;if(void 0===g&&(g={}),h=g.start||0,i=g.end||-1,0>h||void 0!==g.end&&g.end<0)throw new a.util.jIOError("_start and _end must be positive",400);if(h>i&&-1!==i)throw new a.util.jIOError("_start is greater than _end",400);return j=Math.floor(h/n),0===h&&(j-=1),k=Math.floor(i/n),i%n===0&&(k-=1),(new b.Queue).push(function(){return m._init_db_promise}).push(function(){var a="SELECT part, blob FROM attachment WHERE id = ? AND attachment = ? AND part >= ?",b=[d,f,j];return-1!==i&&(a+=" AND part <= ?",b.push(k)),e(l,[a],[b])}).push(function(b){var d,e,f,k,l=[];if(e=b[0].rows,0===e.length)throw new a.util.jIOError("Cannot find document",404);for(d=0;d<e.length;d+=1)-1===e[d].part?(k=e[d].blob,j+=1):l.push(a.util.dataURItoBlob(e[d].blob));return 0===h&&void 0===g.end?new c(l,{type:k}):(f=new c(l,{}),f.slice(h-j*n,-1===i?f.size:i-j*n,"application/octet-stream"))})},g.prototype.removeAttachment=function(c,d){var f=this._database,g=this;return(new b.Queue).push(function(){return g._init_db_promise}).push(function(){return e(f,["DELETE FROM attachment WHERE id = ? AND attachment = ?"],[[c,d]])}).push(function(b){if(0===b[0].rowsAffected)throw new a.util.jIOError("Cannot find document",404);return d})},g.prototype.hasCapacity=function(a){return"list"===a||"include"===a},g.prototype.buildQuery=function(a){var c=this._database,d=this,f="SELECT id";return(new b.Queue).push(function(){return d._init_db_promise}).push(function(){return void 0===a&&(a={}),a.include_docs===!0&&(f+=", data AS doc"),f+=" FROM document",e(c,[f],[[]])}).push(function(a){var b,c=[],d=a[0].rows.length;for(b=0;d>b;b+=1)c.push(a[0].rows[b]),c[b].value={},void 0!==c[b].doc&&(c[b].doc=JSON.parse(c[b].doc));return c})},a.addStorage("websql",g)}(jIO,RSVP,Blob,openDatabase);