genghisapp 2.3.3 → 2.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/genghis.rb +7 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTgwZGViMGVmMmQ0YWRiOTIxYTBlMDRlOWJjOTczMGEyZjRkMmY1OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTVjMjg5Mjk5ZTE3Njg2NWM1ZDI5NWMwZDA3NWViOWJlZjliMTJmMQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDk1NGQ0NWM0OWMwNWUyMzY0MGM0NTg3ZDkyNzYwMTdhNjMwZmQ1YjgxZTE5
|
10
|
+
YTgzNTUzNjU2Yzg2MTExZTMyNGUyNjI2NGMwYTA0MmRmNzUzNTc3NDQzZTJl
|
11
|
+
MGIxMTQxOGRmZDdkYzQ2Yzg5OTBmNThlM2Q3M2U1OTBhNjIwNDI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjFmYjc5YzI1NjRjMTA3NmRlODgzOWQ2YTkyNzJlNGQ0Zjc3ZTUxYTE4ZGUz
|
14
|
+
MDFkZGMxM2MxOGJkYzkyYjIzZjViZjQ1Y2ExMTNmZWNlMDE3YjA4ZmVmYzky
|
15
|
+
Y2EwOTc2NzU3ZDg5M2I0YzZkMjk2ZGQ1MWE5ZDQyZjM1YTAzMGQ=
|
data/genghis.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# Genghis v2.3.
|
3
|
+
# Genghis v2.3.4
|
4
4
|
#
|
5
5
|
# The single-file MongoDB admin app
|
6
6
|
#
|
@@ -9,7 +9,7 @@
|
|
9
9
|
# @author Justin Hileman <justin@justinhileman.info>
|
10
10
|
#
|
11
11
|
module Genghis
|
12
|
-
VERSION = "2.3.
|
12
|
+
VERSION = "2.3.4"
|
13
13
|
end
|
14
14
|
GENGHIS_VERSION = Genghis::VERSION
|
15
15
|
|
@@ -530,13 +530,13 @@ module Genghis
|
|
530
530
|
# name this server something useful
|
531
531
|
name = uri.host
|
532
532
|
|
533
|
-
if user = uri.auths.map { |a| a['username'] }.first
|
533
|
+
if user = uri.auths.map { |a| a[:username] || a['username'] }.first
|
534
534
|
name = "#{user}@#{name}"
|
535
535
|
end
|
536
536
|
|
537
537
|
name = "#{name}:#{uri.port}" unless uri.port == 27017
|
538
538
|
|
539
|
-
if db = uri.auths.map { |a| a['db_name'] }.first
|
539
|
+
if db = uri.auths.map { |a| a[:db_name] || a['db_name'] }.first
|
540
540
|
unless db == 'admin'
|
541
541
|
name = "#{name}/#{db}"
|
542
542
|
@db = db
|
@@ -1056,7 +1056,7 @@ __END__
|
|
1056
1056
|
|
1057
1057
|
@@ style.css
|
1058
1058
|
/**
|
1059
|
-
* Genghis v2.3.
|
1059
|
+
* Genghis v2.3.4
|
1060
1060
|
*
|
1061
1061
|
* The single-file MongoDB admin app
|
1062
1062
|
*
|
@@ -1068,7 +1068,7 @@ __END__
|
|
1068
1068
|
|
1069
1069
|
@@ script.js
|
1070
1070
|
/**
|
1071
|
-
* Genghis v2.3.
|
1071
|
+
* Genghis v2.3.4
|
1072
1072
|
*
|
1073
1073
|
* The single-file MongoDB admin app
|
1074
1074
|
*
|
@@ -1085,7 +1085,7 @@ if(e.options.fixedGutter&&(o.alignable||(o.alignable=[])).push(b),!e.options.lin
|
|
1085
1085
|
r.scrollTop=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,r.scrollTop+n)),r.scrollLeft=Math.max(0,Math.min(i.scrollWidth-i.clientWidth,r.scrollLeft+t))}function an(e,t,n,r){var i=e.doc;if(n||(n="add"),"smart"==n)if(e.doc.mode.indent)var o=O(e,t);else n="prev";var s,a=e.options.tabSize,l=cr(i,t),c=Br(l.text,null,a),u=l.text.match(/^\s*/)[0];if("smart"==n&&(s=e.doc.mode.indent(o,l.text.slice(u.length),l.text),s==uo)){if(!r)return;n="prev"}"prev"==n?s=t>i.first?Br(cr(i,t-1).text,null,a):0:"add"==n?s=c+e.options.indentUnit:"subtract"==n&&(s=c-e.options.indentUnit),s=Math.max(0,s);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(s/a);h;--h)f+=a,d+=" ";s>f&&(d+=Rr(s-f)),d!=u&&jt(e.doc,d,Bt(t,0),Bt(t,u.length),"+input"),l.stateAfter=null}function ln(e,t,n){var r=t,i=t,o=e.doc;return"number"==typeof t?i=cr(o,Vt(o,t)):r=hr(t),null==r?null:n(i,r)?(it(e,r,r+1),i):null}function cn(e,t,n,r,i){function o(){var t=a+n;return e.first>t||t>=e.first+e.size?u=!1:(a=t,c=cr(e,t))}function s(e){var t=(i?fi:hi)(c,l,n,!0);if(null==t){if(e||!o())return u=!1;l=i?(0>n?ci:li)(c):0>n?c.text.length:0}else l=t;return!0}var a=t.line,l=t.ch,c=cr(e,a),u=!0;if("char"==r)s();else if("column"==r)s(!0);else if("word"==r||"group"==r)for(var d=null,f="group"==r,h=!0;!(0>n)||s(!h);h=!1){var p=c.text.charAt(l)||"\n",m=Jr(p)?"w":f?/\s/.test(p)?null:"p":null;if(d&&d!=m){0>n&&(n=1,s());break}if(m&&(d=m),n>0&&!s(!h))break}var g=Zt(e,Bt(a,l),n,!0);return u||(g.hitSide=!0),g}function un(e,t,n,r){var i,o=e.doc,s=t.left;if("page"==r){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+n*(a-(0>n?1.5:.5)*Q(e.display))}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;;){var l=X(e,s,i);if(!l.outside)break;if(0>n?0>=i:i>=o.height){l.hitSide=!0;break}i+=5*n}return l}function dn(e,t){var n=t.ch,r=t.ch;if(e){t.after===!1||r==e.length?--n:++r;for(var i=e.charAt(n),o=Jr(i)?Jr:/\s/.test(i)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!Jr(e)};n>0&&o(e.charAt(n-1));)--n;for(;e.length>r&&o(e.charAt(r));)++r}return{from:Bt(t.line,n),to:Bt(t.line,r)}}function fn(e,t){Xt(e.doc,Bt(t,0),Ut(e.doc,Bt(t+1,0)))}function hn(t,n,r,i){e.defaults[t]=n,r&&(Vi[t]=i?function(e,t,n){n!=qi&&r(e,t,n)}:r)}function pn(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function mn(e,t,n){return e.startState?e.startState(t,n):!0}function gn(e){return"string"==typeof e?Zi[e]:e}function vn(e,t,n){function r(t){t=gn(t);var i=t[e];if(i===!1)return"stop";if(null!=i&&n(i))return!0;if(t.nofallthrough)return"stop";var o=t.fallthrough;if(null==o)return!1;if("[object Array]"!=Object.prototype.toString.call(o))return r(o);for(var s=0,a=o.length;a>s;++s){var l=r(o[s]);if(l)return l}return!1}for(var i=0;t.length>i;++i){var o=r(t[i]);if(o)return o}}function bn(e){var t=Co[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function yn(e,t){var n=Co[e.keyCode];return null==n||e.altGraphKey?!1:(e.altKey&&(n="Alt-"+n),(Pi?e.metaKey:e.ctrlKey)&&(n="Ctrl-"+n),(Pi?e.ctrlKey:e.metaKey)&&(n="Cmd-"+n),!t&&e.shiftKey&&(n="Shift-"+n),n)}function wn(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0}function xn(e,t){this.lines=[],this.type=t,this.doc=e}function Cn(e,t,n,r,i){if(r&&r.shared)return kn(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return tt(e.cm,Cn)(e,t,n,r,i);var o=new xn(e,i);if("range"==i&&!zt(t,n))return o;r&&qr(r,o),o.replacedWith&&(o.collapsed=!0,o.replacedWith=Yr("span",[o.replacedWith],"CodeMirror-widget")),o.collapsed&&(Hi=!0);var s,a,l,c=t.line,u=0,d=e.cm;if(e.iter(c,n.line+1,function(r){d&&o.collapsed&&!d.options.lineWrapping&&_n(e,r)==d.display.maxLine&&(l=!0);var i={from:null,to:null,marker:o};u+=r.text.length,c==t.line&&(i.from=t.ch,u-=t.ch),c==n.line&&(i.to=n.ch,u-=r.text.length-n.ch),o.collapsed&&(c==n.line&&(a=$n(r,n.ch)),c==t.line?s=$n(r,t.ch):fr(r,0)),Ln(r,i),++c}),o.collapsed&&e.iter(t.line,n.line+1,function(t){Fn(e,t)&&fr(t,0)}),o.clearOnEnter&&Or(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Fi=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed){if(s!=a)throw new Error("Inserting collapsed marker overlapping an existing one");o.size=u,o.atomic=!0}return d&&(l&&(d.curOp.updateMaxLine=!0),(o.className||o.startStyle||o.endStyle||o.collapsed)&&it(d,t.line,n.line+1),o.atomic&&Yt(d)),o}function Sn(e,t){this.markers=e,this.primary=t;for(var n=0,r=this;e.length>n;++n)e[n].parent=this,Or(e[n],"clear",function(){r.clear()})}function kn(e,t,n,r,i){r=qr(r),r.shared=!1;var o=[Cn(e,t,n,r,i)],s=o[0],a=r.replacedWith;return ar(e,function(e){a&&(r.replacedWith=a.cloneNode(!0)),o.push(Cn(e,Ut(e,t),Ut(e,n),r,i));for(var l=0;e.linked.length>l;++l)if(e.linked[l].isParent)return;s=zr(o)}),new Sn(o,s)}function Tn(e,t){if(e)for(var n=0;e.length>n;++n){var r=e[n];if(r.marker==t)return r}}function En(e,t){for(var n,r=0;e.length>r;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Ln(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Nn(e,t,n){if(e)for(var r,i=0;e.length>i;++i){var o=e[i],s=o.marker,a=null==o.from||(s.inclusiveLeft?t>=o.from:t>o.from);if(a||"bookmark"==s.type&&o.from==t&&(!n||!o.marker.insertLeft)){var l=null==o.to||(s.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push({from:o.from,to:l?null:o.to,marker:s})}}return r}function An(e,t,n){if(e)for(var r,i=0;e.length>i;++i){var o=e[i],s=o.marker,a=null==o.to||(s.inclusiveRight?o.to>=t:o.to>t);if(a||"bookmark"==s.type&&o.from==t&&(!n||o.marker.insertLeft)){var l=null==o.from||(s.inclusiveLeft?t>=o.from:t>o.from);(r||(r=[])).push({from:l?null:o.from-t,to:null==o.to?null:o.to-t,marker:s})}}return r}function Dn(e,t){var n=Kt(e,t.from.line)&&cr(e,t.from.line).markedSpans,r=Kt(e,t.to.line)&&cr(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,s=Rt(t.from,t.to),a=Nn(n,i,s),l=An(r,o,s),c=1==t.text.length,u=zr(t.text).length+(c?i:0);if(a)for(var d=0;a.length>d;++d){var f=a[d];if(null==f.to){var h=Tn(l,f.marker);h?c&&(f.to=null==h.to?null:h.to+u):f.to=i}}if(l)for(var d=0;l.length>d;++d){var f=l[d];if(null!=f.to&&(f.to+=u),null==f.from){var h=Tn(a,f.marker);h||(f.from=u,c&&(a||(a=[])).push(f))}else f.from+=u,c&&(a||(a=[])).push(f)}var p=[a];if(!c){var m,g=t.text.length-2;if(g>0&&a)for(var d=0;a.length>d;++d)null==a[d].to&&(m||(m=[])).push({from:null,to:null,marker:a[d].marker});for(var d=0;g>d;++d)p.push(m);p.push(l)}return p}function Mn(e,t){var n=Cr(e,t),r=Dn(e,t);if(!n)return r;if(!r)return n;for(var i=0;n.length>i;++i){var o=n[i],s=r[i];if(o&&s)e:for(var a=0;s.length>a;++a){for(var l=s[a],c=0;o.length>c;++c)if(o[c].marker==l.marker)continue e;o.push(l)}else s&&(n[i]=s)}return n}function In(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;e.markedSpans.length>t;++t){var n=e.markedSpans[t].marker;!n.readOnly||r&&-1!=Vr(r,n)||(r||(r=[])).push(n)}}),!r)return null;for(var i=[{from:t,to:n}],o=0;r.length>o;++o)for(var s=r[o],a=s.find(),l=0;i.length>l;++l){var c=i[l];if(!zt(c.to,a.from)&&!zt(a.to,c.from)){var u=[l,1];(zt(c.from,a.from)||!s.inclusiveLeft&&Rt(c.from,a.from))&&u.push({from:c.from,to:a.from}),(zt(a.to,c.to)||!s.inclusiveRight&&Rt(c.to,a.to))&&u.push({from:a.to,to:c.to}),i.splice.apply(i,u),l+=u.length-1}}return i}function $n(e,t){var n,r=Hi&&e.markedSpans;if(r)for(var i,o=0;r.length>o;++o)i=r[o],i.marker.collapsed&&(null==i.from||t>i.from)&&(null==i.to||i.to>t)&&(!n||n.width<i.marker.width)&&(n=i.marker);return n}function On(e){return $n(e,-1)}function Pn(e){return $n(e,e.text.length+1)}function _n(e,t){for(var n;n=On(t);)t=cr(e,n.find().from.line);return t}function Fn(e,t){var n=Hi&&t.markedSpans;if(n)for(var r,i=0;n.length>i;++i)if(r=n[i],r.marker.collapsed){if(null==r.from)return!0;if(0==r.from&&r.marker.inclusiveLeft&&Hn(e,t,r))return!0}}function Hn(e,t,n){if(null==n.to){var r=n.marker.find().to,i=cr(e,r.line);return Hn(e,i,Tn(i.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var o,s=0;t.markedSpans.length>s;++s)if(o=t.markedSpans[s],o.marker.collapsed&&o.from==n.to&&(o.marker.inclusiveLeft||n.marker.inclusiveRight)&&Hn(e,t,o))return!0}function Gn(e){var t=e.markedSpans;if(t){for(var n=0;t.length>n;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function jn(e,t){if(t){for(var n=0;t.length>n;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function Bn(e){return function(){var t=!this.cm.curOp;t&&Z(this.cm);try{var n=e.apply(this,arguments)}finally{t&&et(this.cm)}return n}}function Rn(e){return null!=e.height?e.height:(e.node.parentNode&&1==e.node.parentNode.nodeType||ei(e.cm.display.measure,Yr("div",[e.node],null,"position: relative")),e.height=e.node.offsetHeight)}function zn(e,t,n,r){var i=new eo(e,n,r);return i.noHScroll&&(e.display.alignWidgets=!0),ln(e,t,function(t){if((t.widgets||(t.widgets=[])).push(i),i.line=t,!Fn(e.doc,t)||i.showIfHidden){var n=mr(e,t)<e.display.scroller.scrollTop;fr(t,t.height+Rn(i)),n&&sn(e,0,i.height)}return!0}),i}function Wn(e,t,n){var r={text:e};return jn(r,t),r.height=n?n(r):1,r}function Vn(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Gn(e),jn(e,n);var i=r?r(e):1;i!=e.height&&fr(e,i)}function Un(e){e.parent=null,Gn(e)}function qn(e,t,n,r,i){var o=n.flattenSpans;null==o&&(o=e.options.flattenSpans);var s="",a=null,l=new wn(t,e.options.tabSize);for(""==t&&n.blankLine&&n.blankLine(r);!l.eol();){var c=n.token(l,r);l.pos>5e3&&(o=!1,l.pos=Math.min(t.length,l.start+5e4),c=null);var u=l.current();l.start=l.pos,o&&a==c?s+=u:(s&&i(s,a),s=u,a=c)}s&&i(s,a)}function Kn(e,t,n){var r=[e.state.modeGen];qn(e,t.text,e.doc.mode,n,function(e,t){r.push(e,t)});for(var i=0;e.state.overlays.length>i;++i){var o=e.state.overlays[i],s=1;qn(e,t.text,o.mode,!0,function(e,t){for(var n=s,i=e.length;i;){var a=r[s],l=a.length;i>=l?i-=l:(r.splice(s,1,a.slice(0,i),r[s+1],a.slice(i)),i=0),s+=2}if(t)if(o.opaque)r.splice(n,s-n,e,t),s=n+2;else for(;s>n;n+=2){var a=r[n+1];r[n+1]=a?a+" "+t:t}})}return r}function Xn(e,t){return t.styles&&t.styles[0]==e.state.modeGen||(t.styles=Kn(e,t,t.stateAfter=O(e,hr(t)))),t.styles}function Jn(e,t,n){var r=e.doc.mode,i=new wn(t.text,e.options.tabSize);for(""==t.text&&r.blankLine&&r.blankLine(n);!i.eol()&&5e3>=i.pos;)r.token(i,n),i.start=i.pos}function Qn(e){return e?to[e]||(to[e]="cm-"+e.replace(/ +/g," cm-")):null}function Yn(e,t,n){for(var r,i,o,s=t,a=!0;r=On(s);)a=!1,s=cr(e.doc,r.find().from.line),i||(i=s);var l={pre:Yr("pre"),col:0,pos:0,display:!n,measure:null,addedOne:!1,cm:e};s.textClass&&(l.pre.className=s.textClass);do{l.measure=s==t&&n,l.pos=0,l.addToken=l.measure?er:Zn,(mi||bi)&&e.getOption("lineWrapping")&&(l.addToken=tr(l.addToken)),n&&o&&s!=t&&!l.addedOne&&(n[0]=l.pre.appendChild(ii(e.display.measure)),l.addedOne=!0);var c=rr(s,l,Xn(e,s));o=s==i,c&&(s=cr(e.doc,c.to.line),a=!1)}while(c);n&&!l.addedOne&&(n[0]=l.pre.appendChild(a?Yr("span","\u00a0"):ii(e.display.measure))),l.pre.firstChild||Fn(e.doc,t)||l.pre.appendChild(document.createTextNode("\u00a0"));var u;if(n&&mi&&(u=gr(s))){var d=u.length-1;u[d].from==u[d].to&&--d;var f=u[d],h=u[d-1];if(f.from+1==f.to&&h&&f.level<h.level){var p=n[l.pos-1];p&&p.parentNode.insertBefore(p.measureRight=ii(e.display.measure),p.nextSibling)}}return _r(e,"renderLine",e,t,l.pre),l.pre}function Zn(e,t,n,r,i){if(t){if(no.test(t))for(var o=document.createDocumentFragment(),s=0;;){no.lastIndex=s;var a=no.exec(t),l=a?a.index-s:t.length-s;if(l&&(o.appendChild(document.createTextNode(t.slice(s,s+l))),e.col+=l),!a)break;if(s+=l+1," "==a[0]){var c=e.cm.options.tabSize,u=c-e.col%c;o.appendChild(Yr("span",Rr(u),"cm-tab")),e.col+=u}else{var d=Yr("span","\u2022","cm-invalidchar");d.title="\\u"+a[0].charCodeAt(0).toString(16),o.appendChild(d),e.col+=1}}else{e.col+=t.length;var o=document.createTextNode(t)}if(n||r||i||e.measure){var f=n||"";return r&&(f+=r),i&&(f+=i),e.pre.appendChild(Yr("span",[o],f))}e.pre.appendChild(o)}}function er(e,t,n,r,i){for(var o=e.cm.options.lineWrapping,s=0;t.length>s;++s){var a=t.charAt(s),l=0==s;a>="\ud800"&&"\udbff">a&&t.length-1>s?(a=t.slice(s,s+2),++s):s&&o&&go.test(t.slice(s-1,s+1))&&e.pre.appendChild(Yr("wbr"));var c=e.measure[e.pos]=Zn(e,a,n,l&&r,s==t.length-1&&i);mi&&o&&" "==a&&s&&!/\s/.test(t.charAt(s-1))&&t.length-1>s&&!/\s/.test(t.charAt(s+1))&&(c.style.whiteSpace="normal"),e.pos+=a.length}t.length&&(e.addedOne=!0)}function tr(e){function t(e){for(var t=" ",n=0;e.length-2>n;++n)t+=n%2?" ":"\u00a0";return t+=" "}return function(n,r,i,o,s){return e(n,r.replace(/ {3,}/,t),i,o,s)}}function nr(e,t,n){n&&(e.display||(n=n.cloneNode(!0)),e.pre.appendChild(n),e.measure&&t&&(e.measure[e.pos]=n,e.addedOne=!0)),e.pos+=t}function rr(e,t,n){var r=e.markedSpans;if(r)for(var i,o,s,a,l,c=e.text,u=c.length,d=0,f=1,h="",p=0;;){if(p==d){o=s=a="",l=null,p=1/0;for(var m=null,g=0;r.length>g;++g){var v=r[g],b=v.marker;d>=v.from&&(null==v.to||v.to>d)?(null!=v.to&&p>v.to&&(p=v.to,s=""),b.className&&(o+=" "+b.className),b.startStyle&&v.from==d&&(a+=" "+b.startStyle),b.endStyle&&v.to==p&&(s+=" "+b.endStyle),b.collapsed&&(!l||l.marker.width<b.width)&&(l=v)):v.from>d&&p>v.from&&(p=v.from),"bookmark"==b.type&&v.from==d&&b.replacedWith&&(m=b.replacedWith)}if(l&&(l.from||0)==d&&(nr(t,(null==l.to?u:l.to)-d,null!=l.from&&l.marker.replacedWith),null==l.to))return l.marker.find();m&&!l&&nr(t,0,m)}if(d>=u)break;for(var y=Math.min(u,p);;){if(h){var w=d+h.length;if(!l){var x=w>y?h.slice(0,y-d):h;t.addToken(t,x,i?i+o:o,a,d+x.length==p?s:"")}if(w>=y){h=h.slice(y-d),d=y;break}d=w,a=""}h=n[f++],i=Qn(n[f++])}}else for(var f=1;n.length>f;f+=2)t.addToken(t,n[f],Qn(n[f+1]))}function ir(e,t,n,r,i){function o(e){return n?n[e]:null}function s(e,n,r){Vn(e,n,r,i),Fr(e,"change",e,t)}var a=t.from,l=t.to,c=t.text,u=cr(e,a.line),d=cr(e,l.line),f=zr(c),h=o(c.length-1),p=l.line-a.line;if(0==a.ch&&0==l.ch&&""==f){for(var m=0,g=c.length-1,v=[];g>m;++m)v.push(Wn(c[m],o(m),i));s(d,d.text,h),p&&e.remove(a.line,p),v.length&&e.insert(a.line,v)}else if(u==d)if(1==c.length)s(u,u.text.slice(0,a.ch)+f+u.text.slice(l.ch),h);else{for(var v=[],m=1,g=c.length-1;g>m;++m)v.push(Wn(c[m],o(m),i));v.push(Wn(f+u.text.slice(l.ch),h,i)),s(u,u.text.slice(0,a.ch)+c[0],o(0)),e.insert(a.line+1,v)}else if(1==c.length)s(u,u.text.slice(0,a.ch)+c[0]+d.text.slice(l.ch),o(0)),e.remove(a.line+1,p);else{s(u,u.text.slice(0,a.ch)+c[0],o(0)),s(d,f+d.text.slice(l.ch),h);for(var m=1,g=c.length-1,v=[];g>m;++m)v.push(Wn(c[m],o(m),i));p>1&&e.remove(a.line+1,p-1),e.insert(a.line+1,v)}Fr(e,"change",e,t),Qt(e,r.anchor,r.head,null,!0)}function or(e){this.lines=e,this.parent=null;for(var t=0,n=e.length,r=0;n>t;++t)e[t].parent=this,r+=e[t].height;this.height=r}function sr(e){this.children=e;for(var t=0,n=0,r=0,i=e.length;i>r;++r){var o=e[r];t+=o.chunkSize(),n+=o.height,o.parent=this}this.size=t,this.height=n,this.parent=null}function ar(e,t,n){function r(e,i,o){if(e.linked)for(var s=0;e.linked.length>s;++s){var a=e.linked[s];if(a.doc!=i){var l=o&&a.sharedHist;(!n||l)&&(t(a.doc,l),r(a.doc,e,l))}}}r(e,null,!0)}function lr(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,o(e),n(e),e.options.lineWrapping||d(e),e.options.mode=t.modeOption,it(e)}function cr(e,t){for(t-=e.first;!e.lines;)for(var n=0;;++n){var r=e.children[n],i=r.chunkSize();if(i>t){e=r;break}t-=i}return e.lines[t]}function ur(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i}),r}function dr(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function fr(e,t){for(var n=t-e.height,r=e;r;r=r.parent)r.height+=n}function hr(e){if(null==e.parent)return null;for(var t=e.parent,n=Vr(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function pr(e,t){var n=e.first;e:do{for(var r=0,i=e.children.length;i>r;++r){var o=e.children[r],s=o.height;if(s>t){e=o;continue e}t-=s,n+=o.chunkSize()}return n}while(!e.lines);for(var r=0,i=e.lines.length;i>r;++r){var a=e.lines[r],l=a.height;if(l>t)break;t-=l}return n+r}function mr(e,t){t=_n(e.doc,t);for(var n=0,r=t.parent,i=0;r.lines.length>i;++i){var o=r.lines[i];if(o==t)break;n+=o.height}for(var s=r.parent;s;r=s,s=r.parent)for(var i=0;s.children.length>i;++i){var a=s.children[i];if(a==r)break;n+=a.height}return n}function gr(e){var t=e.order;return null==t&&(t=e.order=So(e.text)),t}function vr(){return{done:[],undone:[],undoDepth:1/0,lastTime:0,lastOp:null,lastOrigin:null,dirtyCounter:0}}function br(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function yr(e,t){var n={from:t.from,to:Dt(t),text:ur(e,t.from,t.to)};return br(e,n,t.from.line,t.to.line+1),ar(e,function(e){br(e,n,t.from.line,t.to.line+1)},!0),n}function wr(e,t,n,r){var i=e.history;i.undone.length=0;var o=+new Date,s=zr(i.done);if(s&&(i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastTime>o-600||"*"==t.origin.charAt(0)))){var a=zr(s.changes);Rt(t.from,t.to)&&Rt(t.from,a.to)?a.to=Dt(t):s.changes.push(yr(e,t)),s.anchorAfter=n.anchor,s.headAfter=n.head}else{for(s={changes:[yr(e,t)],anchorBefore:e.sel.anchor,headBefore:e.sel.head,anchorAfter:n.anchor,headAfter:n.head},i.done.push(s);i.done.length>i.undoDepth;)i.done.shift();0>i.dirtyCounter?i.dirtyCounter=0/0:i.dirtyCounter++}i.lastTime=o,i.lastOp=r,i.lastOrigin=t.origin}function xr(e){if(!e)return null;for(var t,n=0;e.length>n;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function Cr(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=0,i=[];t.text.length>r;++r)i.push(xr(n[r]));return i}function Sr(e,t){for(var n=0,r=[];e.length>n;++n){var i=e[n],o=i.changes,s=[];r.push({changes:s,anchorBefore:i.anchorBefore,headBefore:i.headBefore,anchorAfter:i.anchorAfter,headAfter:i.headAfter});for(var a=0;o.length>a;++a){var l,c=o[a];if(s.push({from:c.from,to:c.to,text:c.text}),t)for(var u in c)(l=u.match(/^spans_(\d+)$/))&&Vr(t,Number(l[1]))>-1&&(zr(s)[u]=c[u],delete c[u])}}return r}function kr(e,t,n,r){e.line>n?e.line+=r:e.line>t&&(e.line=t,e.ch=0)}function Tr(e,t,n,r){for(var i=0;e.length>i;++i){for(var o=e[i],s=!0,a=0;o.changes.length>a;++a){var l=o.changes[a];if(o.copied||(l.from=Wt(l.from),l.to=Wt(l.to)),l.from.line>n)l.from.line+=r,l.to.line+=r;else if(l.to.line>=t){s=!1;break}}o.copied||(o.anchorBefore=Wt(o.anchorBefore),o.headBefore=Wt(o.headBefore),o.anchorAfter=Wt(o.anchorAfter),o.readAfter=Wt(o.headAfter),o.copied=!0),s?(kr(o.anchorBefore),kr(o.headBefore),kr(o.anchorAfter),kr(o.headAfter)):(e.splice(0,i+1),i=0)}}function Er(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Tr(e.done,n,r,i),Tr(e.undone,n,r,i)}function Lr(){Mr(this)}function Nr(e){return e.stop||(e.stop=Lr),e}function Ar(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Dr(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Mr(e){Ar(e),Dr(e)}function Ir(e){return e.target||e.srcElement}function $r(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Ai&&e.ctrlKey&&1==t&&(t=3),t}function Or(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={}),i=r[t]||(r[t]=[]);i.push(n)}}function Pr(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers&&e._handlers[t];if(!r)return;for(var i=0;r.length>i;++i)if(r[i]==n){r.splice(i,1);break}}}function _r(e,t){var n=e._handlers&&e._handlers[t];if(n)for(var r=Array.prototype.slice.call(arguments,2),i=0;n.length>i;++i)n[i].apply(null,r)}function Fr(e,t){function n(e){return function(){e.apply(null,i)}}var r=e._handlers&&e._handlers[t];if(r){var i=Array.prototype.slice.call(arguments,2);ao||(++lo,ao=[],setTimeout(Hr,0));for(var o=0;r.length>o;++o)ao.push(n(r[o]))}}function Hr(){--lo;var e=ao;ao=null;for(var t=0;e.length>t;++t)e[t]()}function Gr(e,t){var n=e._handlers&&e._handlers[t];return n&&n.length>0}function jr(){this.id=null}function Br(e,t,n,r,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=r||0,s=i||0;t>o;++o)" "==e.charAt(o)?s+=n-s%n:++s;return s}function Rr(e){for(;e>=fo.length;)fo.push(zr(fo)+" ");return fo[e]}function zr(e){return e[e.length-1]}function Wr(e){Li?(e.selectionStart=0,e.selectionEnd=e.value.length):e.select()}function Vr(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;r>n;++n)if(e[n]==t)return n;return-1}function Ur(e,t){function n(){}n.prototype=e;var r=new n;return t&&qr(t,r),r}function qr(e,t){t||(t={});for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function Kr(e){for(var t=[],n=0;e>n;++n)t.push(void 0);return t}function Xr(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Jr(e){return/\w/.test(e)||e>"\u0080"&&(e.toUpperCase()!=e.toLowerCase()||ho.test(e))}function Qr(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Yr(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)ti(i,t);else if(t)for(var o=0;t.length>o;++o)i.appendChild(t[o]);return i}function Zr(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function ei(e,t){return Zr(e).appendChild(t)}function ti(e,t){vi?(e.innerHTML="",e.appendChild(document.createTextNode(t))):e.textContent=t}function ni(e){return e.getBoundingClientRect()}function ri(e){if(null!=vo)return vo;var t=Yr("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return ei(e,t),t.offsetWidth&&(vo=t.offsetHeight-t.clientHeight),vo||0}function ii(e){if(null==bo){var t=Yr("span","\u200b");ei(e,Yr("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(bo=1>=t.offsetWidth&&t.offsetHeight>2&&!gi)}return bo?Yr("span","\u200b"):Yr("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px")}function oi(e,t,n,r){if(!e)return r(t,n,"ltr");for(var i=0;e.length>i;++i){var o=e[i];(n>o.from&&o.to>t||t==n&&o.to==t)&&r(Math.max(o.from,t),Math.min(o.to,n),1==o.level?"rtl":"ltr")}}function si(e){return e.level%2?e.to:e.from}function ai(e){return e.level%2?e.from:e.to}function li(e){var t=gr(e);return t?si(t[0]):0}function ci(e){var t=gr(e);return t?ai(zr(t)):e.text.length}function ui(e,t){var n=cr(e.doc,t),r=_n(e.doc,n);r!=n&&(t=hr(r));var i=gr(r),o=i?i[0].level%2?ci(r):li(r):0;return Bt(t,o)}function di(e,t){for(var n,r;n=Pn(r=cr(e.doc,t));)t=n.find().to.line;var i=gr(r),o=i?i[0].level%2?li(r):ci(r):r.text.length;return Bt(t,o)}function fi(e,t,n,r){var i=gr(e);if(!i)return hi(e,t,n,r);for(var o=r?function(t,n){do t+=n;while(t>0&&po.test(e.text.charAt(t)));return t}:function(e,t){return e+t},s=i[0].level,a=0;i.length>a;++a){var l=i[a],c=l.level%2==s;if(t>l.from&&l.to>t||c&&(l.from==t||l.to==t))break}for(var u=o(t,l.level%2?-n:n);null!=u;)if(l.level%2==s){if(!(l.from>u||u>l.to))break;l=i[a+=n],u=l&&(n>0==l.level%2?o(l.to,-1):o(l.from,1))}else if(u==si(l))l=i[--a],u=l&&ai(l);else{if(u!=ai(l))break;l=i[++a],u=l&&si(l)}return 0>u||u>e.text.length?null:u}function hi(e,t,n,r){var i=t+n;if(r)for(;i>0&&po.test(e.text.charAt(i));)i+=n;return 0>i||i>e.text.length?null:i}var pi=/gecko\/\d/i.test(navigator.userAgent),mi=/MSIE \d/.test(navigator.userAgent),gi=mi&&(null==document.documentMode||8>document.documentMode),vi=mi&&(null==document.documentMode||9>document.documentMode),bi=/WebKit\//.test(navigator.userAgent),yi=bi&&/Qt\/\d+\.\d+/.test(navigator.userAgent),wi=/Chrome\//.test(navigator.userAgent),xi=/Opera\//.test(navigator.userAgent),Ci=/Apple Computer/.test(navigator.vendor),Si=/KHTML\//.test(navigator.userAgent),ki=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),Ti=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Ei=/PhantomJS/.test(navigator.userAgent),Li=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Ni=Li||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Ai=Li||/Mac/.test(navigator.platform),Di=/windows/i.test(navigator.platform),Mi=xi&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);Mi&&(Mi=Number(Mi[1]));var Ii,$i,Oi,Pi=Ai&&(yi||xi&&(null==Mi||12.11>Mi)),_i=pi||mi&&!vi,Fi=!1,Hi=!1,Gi=0,ji=0,Bi=null;mi?Bi=-.53:pi?Bi=15:wi?Bi=-.7:Ci&&(Bi=-1/3);var Ri,zi,Wi=null;e.Pos=Bt,e.prototype={focus:function(){window.focus(),ct(this),Lt(this),st(this)},setOption:function(e,t){var n=this.options,r=n[e];(n[e]!=t||"mode"==e)&&(n[e]=t,Vi.hasOwnProperty(e)&&tt(this,Vi[e])(this,t,r))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](e)},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;t.length>n;++n)if(("string"==typeof e?t[n].name:t[n])==e)return t.splice(n,1),!0},addOverlay:tt(null,function(t,n){var r=t.token?t:e.getMode(this.options,t);if(r.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:r,modeSpec:t,opaque:n&&n.opaque}),this.state.modeGen++,it(this)}),removeOverlay:tt(null,function(e){for(var t=this.state.overlays,n=0;t.length>n;++n)if(t[n].modeSpec==e)return t.splice(n,1),this.state.modeGen++,it(this),void 0}),indentLine:tt(null,function(e,t,n){"string"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),Kt(this.doc,e)&&an(this,e,t,n)}),indentSelection:tt(null,function(e){var t=this.doc.sel;if(Rt(t.from,t.to))return an(this,t.from.line,e);for(var n=t.to.line-(t.to.ch?0:1),r=t.from.line;n>=r;++r)an(this,r,e)}),getTokenAt:function(e){var t=this.doc;e=Ut(t,e);for(var n=O(this,e.line),r=this.doc.mode,i=cr(t,e.line),o=new wn(i.text,this.options.tabSize);o.pos<e.ch&&!o.eol();){o.start=o.pos;var s=r.token(o,n)}return{start:o.start,end:o.pos,string:o.current(),className:s||null,type:s||null,state:n}},getStateAfter:function(e){var t=this.doc;return e=Vt(t,null==e?t.first+t.size-1:e),O(this,e+1)},cursorCoords:function(e,t){var n,r=this.doc.sel;return n=null==e?r.head:"object"==typeof e?Ut(this.doc,e):e?r.from:r.to,q(this,n,t||"page")},charCoords:function(e,t){return U(this,Ut(this.doc,e),t||"page")},coordsChar:function(e,t){return e=V(this,e,t||"page"),X(this,e.left,e.top)},defaultTextHeight:function(){return Q(this.display)},defaultCharWidth:function(){return Y(this.display)},setGutterMarker:tt(null,function(e,t,n){return ln(this,e,function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&Qr(r)&&(e.gutterMarkers=null),!0})}),clearGutter:tt(null,function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,it(t,r,r+1),Qr(n.gutterMarkers)&&(n.gutterMarkers=null)),++r})}),addLineClass:tt(null,function(e,t,n){return ln(this,e,function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"wrapClass";if(e[r]){if(new RegExp("\\b"+n+"\\b").test(e[r]))return!1;e[r]+=" "+n}else e[r]=n;return!0})}),removeLineClass:tt(null,function(e,t,n){return ln(this,e,function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"wrapClass",i=e[r];if(!i)return!1;if(null==n)e[r]=null;else{var o=i.replace(new RegExp("^"+n+"\\b\\s*|\\s*\\b"+n+"\\b"),"");if(o==i)return!1;e[r]=o||null}return!0})}),addLineWidget:tt(null,function(e,t,n){return zn(this,e,t,n)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if("number"==typeof e){if(!Kt(this.doc,e))return null;var t=e;if(e=cr(this.doc,e),!e)return null}else{var t=hr(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(e,t,n,r,i){var o=this.display;e=q(this,Ut(this.doc,e));var s=e.bottom,a=e.left;if(t.style.position="absolute",o.sizer.appendChild(t),"over"==r)s=e.top;else if("above"==r||"near"==r){var l=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?s=e.top-t.offsetHeight:l>=e.bottom+t.offsetHeight&&(s=e.bottom),a+t.offsetWidth>c&&(a=c-t.offsetWidth)}t.style.top=s+P(o)+"px",t.style.left=t.style.right="","right"==i?(a=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?a=0:"middle"==i&&(a=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=a+"px"),n&&nn(this,a,s,a+t.offsetWidth,s+t.offsetHeight)},triggerOnKeyDown:tt(null,Tt),execCommand:function(e){return Yi[e](this)},findPosH:function(e,t,n,r){var i=1;0>t&&(i=-1,t=-t);for(var o=0,s=Ut(this.doc,e);t>o&&(s=cn(this.doc,s,i,n,r),!s.hitSide);++o);return s},moveH:tt(null,function(e,t){var n,r=this.doc.sel;n=r.shift||r.extend||Rt(r.from,r.to)?cn(this.doc,r.head,e,t,this.options.rtlMoveVisually):0>e?r.from:r.to,Xt(this.doc,n,n,e)}),deleteH:tt(null,function(e,t){var n=this.doc.sel;Rt(n.from,n.to)?jt(this.doc,"",n.from,cn(this.doc,n.head,e,t,!1),"+delete"):jt(this.doc,"",n.from,n.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(e,t,n,r){var i=1,o=r;0>t&&(i=-1,t=-t);for(var s=0,a=Ut(this.doc,e);t>s;++s){var l=q(this,a,"div");if(null==o?o=l.left:l.left=o,a=un(this,l,i,n),a.hitSide)break}return a},moveV:tt(null,function(e,t){var n=this.doc.sel,r=q(this,n.head,"div");null!=n.goalColumn&&(r.left=n.goalColumn);var i=un(this,r,e,t);"page"==t&&sn(this,0,U(this,i,"div").top-r.top),Xt(this.doc,i,i,e),n.goalColumn=r.left}),toggleOverwrite:function(){(this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite","")},hasFocus:function(){return this.state.focused},scrollTo:tt(null,function(e,t){on(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller,t=co;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-t,width:e.scrollWidth-t,clientHeight:e.clientHeight-t,clientWidth:e.clientWidth-t}},scrollIntoView:function(e,t){"number"==typeof e&&(e=Bt(e,0)),e&&null==e.line?nn(this,e.left,e.top-t,e.right,e.bottom+t):(e=e?Ut(this.doc,e):this.doc.sel.head,tn(this,e,t))},setSize:function(e,t){function n(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.refresh()},on:function(e,t){Or(this,e,t)},off:function(e,t){Pr(this,e,t)},operation:function(e){return rt(this,e)},refresh:tt(null,function(){z(this),on(this,this.doc.scrollLeft,this.doc.scrollTop),it(this)}),swapDoc:tt(null,function(e){var t=this.doc;return t.cm=null,lr(this,e),z(this),on(this,e.scrollLeft,e.scrollTop),t}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};var Vi=e.optionHandlers={},Ui=e.defaults={},qi=e.Init={toString:function(){return"CodeMirror.Init"}};hn("value","",function(e,t){e.setValue(t)},!0),hn("mode",null,function(e,t){e.doc.modeOption=t,n(e)},!0),hn("indentUnit",2,n,!0),hn("indentWithTabs",!1),hn("smartIndent",!0),hn("tabSize",4,function(e){n(e),z(e),it(e)},!0),hn("electricChars",!0),hn("rtlMoveVisually",!Di),hn("theme","default",function(e){a(e),l(e)},!0),hn("keyMap","default",s),hn("extraKeys",null),hn("onKeyEvent",null),hn("onDragEvent",null),hn("lineWrapping",!1,r,!0),hn("gutters",[],function(e){f(e.options),l(e)},!0),hn("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?b(e.display)+"px":"0",e.refresh()},!0),hn("lineNumbers",!1,function(e){f(e.options),l(e)},!0),hn("firstLineNumber",1,l,!0),hn("lineNumberFormatter",function(e){return e},l,!0),hn("showCursorWhenSelecting",!1,L,!0),hn("readOnly",!1,function(e,t){"nocursor"==t?(Nt(e),e.display.input.blur()):t||lt(e,!0)}),hn("dragDrop",!0),hn("cursorBlinkRate",530),hn("cursorHeight",1),hn("workTime",100),hn("workDelay",100),hn("flattenSpans",!0),hn("pollInterval",100),hn("undoDepth",40,function(e,t){e.doc.history.undoDepth=t}),hn("viewportMargin",10,function(e){e.refresh()},!0),hn("tabindex",null,function(e,t){e.display.input.tabIndex=t||""}),hn("autofocus",null);var Ki=e.modes={},Xi=e.mimeModes={};e.defineMode=function(t,n){if(e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2){n.dependencies=[];for(var r=2;arguments.length>r;++r)n.dependencies.push(arguments[r])}Ki[t]=n},e.defineMIME=function(e,t){Xi[e]=t},e.resolveMode=function(t){if("string"==typeof t&&Xi.hasOwnProperty(t))t=Xi[t];
|
1086
1086
|
else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,n){n=e.resolveMode(n);var r=Ki[n.name];if(!r)return e.getMode(t,"text/plain");var i=r(t,n);if(Ji.hasOwnProperty(n.name)){var o=Ji[n.name];for(var s in o)o.hasOwnProperty(s)&&(i.hasOwnProperty(s)&&(i["_"+s]=i[s]),i[s]=o[s])}return i.name=n.name,i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var Ji=e.modeExtensions={};e.extendMode=function(e,t){var n=Ji.hasOwnProperty(e)?Ji[e]:Ji[e]={};qr(t,n)},e.defineExtension=function(t,n){e.prototype[t]=n},e.defineOption=hn;var Qi=[];e.defineInitHook=function(e){Qi.push(e)},e.copyState=pn,e.startState=mn,e.innerMode=function(e,t){for(;e.innerMode;){var n=e.innerMode(t);t=n.state,e=n.mode}return n||{mode:e,state:t}};var Yi=e.commands={selectAll:function(e){e.setSelection(Bt(e.firstLine(),0),Bt(e.lastLine()))},killLine:function(e){var t=e.getCursor(!0),n=e.getCursor(!1),r=!Rt(t,n);r||e.getLine(t.line).length!=t.ch?e.replaceRange("",t,r?n:Bt(t.line),"+delete"):e.replaceRange("",t,Bt(t.line+1,0),"+delete")},deleteLine:function(e){var t=e.getCursor().line;e.replaceRange("",Bt(t,0),Bt(t),"+delete")},undo:function(e){e.undo()},redo:function(e){e.redo()},goDocStart:function(e){e.extendSelection(Bt(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(Bt(e.lastLine()))},goLineStart:function(e){e.extendSelection(ui(e,e.getCursor().line))},goLineStartSmart:function(e){var t=e.getCursor(),n=ui(e,t.line),r=e.getLineHandle(n.line),i=gr(r);if(i&&0!=i[0].level)e.extendSelection(n);else{var o=Math.max(0,r.text.search(/\S/)),s=t.line==n.line&&o>=t.ch&&t.ch;e.extendSelection(Bt(n.line,s?0:o))}},goLineEnd:function(e){e.extendSelection(di(e,e.getCursor().line))},goLineRight:function(e){var t=e.charCoords(e.getCursor(),"div").top+5;e.extendSelection(e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:t},"div"))},goLineLeft:function(e){var t=e.charCoords(e.getCursor(),"div").top+5;e.extendSelection(e.coordsChar({left:0,top:t},"div"))},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection(" ","end","+input")},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.replaceSelection(" ","end","+input")},transposeChars:function(e){var t=e.getCursor(),n=e.getLine(t.line);t.ch>0&&t.ch<n.length-1&&e.replaceRange(n.charAt(t.ch)+n.charAt(t.ch-1),Bt(t.line,t.ch-1),Bt(t.line,t.ch+1))},newlineAndIndent:function(e){tt(e,function(){e.replaceSelection("\n","end","+input"),e.indentLine(e.getCursor().line,null,!0)})()},toggleOverwrite:function(e){e.toggleOverwrite()}},Zi=e.keyMap={};Zi.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"},Zi.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"},Zi.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore",fallthrough:["basic","emacsy"]},Zi["default"]=Ai?Zi.macDefault:Zi.pcDefault,Zi.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},e.lookupKey=vn,e.isModifierKey=bn,e.keyName=yn,e.fromTextArea=function(t,n){function r(){t.value=c.getValue()}if(n||(n={}),n.value=t.value,!n.tabindex&&t.tabindex&&(n.tabindex=t.tabindex),!n.placeholder&&t.placeholder&&(n.placeholder=t.placeholder),null==n.autofocus){var i=document.body;try{i=document.activeElement}catch(o){}n.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(Or(t.form,"submit",r),!n.leaveSubmitMethodAlone)){var s=t.form,a=s.submit;try{var l=s.submit=function(){r(),s.submit=a,s.submit(),s.submit=l}}catch(o){}}t.style.display="none";var c=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},n);return c.save=r,c.getTextArea=function(){return t},c.toTextArea=function(){r(),t.parentNode.removeChild(c.getWrapperElement()),t.style.display="",t.form&&(Pr(t.form,"submit",r),"function"==typeof t.form.submit&&(t.form.submit=a))},c},wn.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var n=t==e;else var n=t&&(e.test?e.test(t):e(t));return n?(++this.pos,t):void 0},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Br(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue},indentation:function(){return Br(this.string,null,this.tabSize)},match:function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&t!==!1&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},e.StringStream=wn,e.TextMarker=xn,xn.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;t&&Z(e);for(var n=null,r=null,i=0;this.lines.length>i;++i){var o=this.lines[i],s=Tn(o.markedSpans,this);null!=s.to&&(r=hr(o)),o.markedSpans=En(o.markedSpans,s),null!=s.from?n=hr(o):this.collapsed&&!Fn(this.doc,o)&&e&&fr(o,Q(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var i=0;this.lines.length>i;++i){var a=_n(e.doc,this.lines[i]),l=u(e.doc,a);l>e.display.maxLineLength&&(e.display.maxLine=a,e.display.maxLineLength=l,e.display.maxLineChanged=!0)}null!=n&&e&&it(e,n,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.collapsed&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Yt(e)),t&&et(e),Fr(this,"clear")}},xn.prototype.find=function(){for(var e,t,n=0;this.lines.length>n;++n){var r=this.lines[n],i=Tn(r.markedSpans,this);if(null!=i.from||null!=i.to){var o=hr(r);null!=i.from&&(e=Bt(o,i.from)),null!=i.to&&(t=Bt(o,i.to))}}return"bookmark"==this.type?e:e&&{from:e,to:t}},xn.prototype.getOptions=function(e){var t=this.replacedWith;return{className:this.className,inclusiveLeft:this.inclusiveLeft,inclusiveRight:this.inclusiveRight,atomic:this.atomic,collapsed:this.collapsed,replacedWith:e?t&&t.cloneNode(!0):t,readOnly:this.readOnly,startStyle:this.startStyle,endStyle:this.endStyle}},xn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=Vr(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},xn.prototype.detachLine=function(e){if(this.lines.splice(Vr(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},e.SharedTextMarker=Sn,Sn.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;this.markers.length>e;++e)this.markers[e].clear();Fr(this,"clear")}},Sn.prototype.find=function(){return this.primary.find()},Sn.prototype.getOptions=function(e){var t=this.primary.getOptions(e);return t.shared=!0,t};var eo=e.LineWidget=function(e,t,n){for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.cm=e,this.node=t};eo.prototype.clear=Bn(function(){var e=this.line.widgets,t=hr(this.line);if(null!=t&&e){for(var n=0;e.length>n;++n)e[n]==this&&e.splice(n--,1);e.length||(this.line.widgets=null),fr(this.line,Math.max(0,this.line.height-Rn(this))),it(this.cm,t,t+1)}}),eo.prototype.changed=Bn(function(){var e=this.height;this.height=null;var t=Rn(this)-e;if(t){fr(this.line,this.line.height+t);var n=hr(this.line);it(this.cm,n,n+1)}});var to={},no=/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\uFEFF]/g;or.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;r>n;++n){var i=this.lines[n];this.height-=i.height,Un(i),Fr(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.splice.apply(e,[e.length,0].concat(this.lines))},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0,i=t.length;i>r;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;r>e;++e)if(n(this.lines[e]))return!0}},sr.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;this.children.length>n;++n){var r=this.children[n],i=r.chunkSize();if(i>e){var o=Math.min(t,i-e),s=r.height;if(r.removeInner(e,o),this.height-=s-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(t-=o))break;e=0}else e-=i}if(25>this.size-t){var a=[];this.collapse(a),this.children=[new or(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0,n=this.children.length;n>t;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0,i=this.children.length;i>r;++r){var o=this.children[r],s=o.chunkSize();if(s>=e){if(o.insertInner(e,t,n),o.lines&&o.lines.length>50){for(;o.lines.length>50;){var a=o.lines.splice(o.lines.length-25,25),l=new or(a);o.height-=l.height,this.children.splice(r+1,0,l),l.parent=this}this.maybeSpill()}break}e-=s}},maybeSpill:function(){if(!(10>=this.children.length)){var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new sr(t);if(e.parent){e.size-=n.size,e.height-=n.height;var r=Vr(e.parent.children,e);e.parent.children.splice(r+1,0,n)}else{var i=new sr(e.children);i.parent=e,e.children=[i,n],e=i}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0,i=this.children.length;i>r;++r){var o=this.children[r],s=o.chunkSize();if(s>e){var a=Math.min(t,s-e);if(o.iterN(e,a,n))return!0;if(0==(t-=a))break;e=0}else e-=s}}};var ro=0,io=e.Doc=function(e,t,n){if(!(this instanceof io))return new io(e,t,n);null==n&&(n=0),sr.call(this,[new or([Wn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=vr(),this.frontier=n;var r=Bt(n,0);this.sel={from:r,to:r,head:r,anchor:r,shift:!1,extend:!1,goalColumn:null},this.id=++ro,this.modeOption=t,"string"==typeof e&&(e=yo(e)),ir(this,{from:r,to:r,text:e},null,{head:r,anchor:r})};io.prototype=Ur(sr.prototype,{iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0,i=t.length;i>r;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=dr(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:function(e){var t=Bt(this.first,0),n=this.first+this.size-1;Ot(this,{from:t,to:Bt(n,cr(this,n).text.length),text:yo(e),origin:"setValue"},{head:t,anchor:t},!0)},replaceRange:function(e,t,n,r){t=Ut(this,t),n=n?Ut(this,n):t,jt(this,e,t,n,r)},getRange:function(e,t,n){var r=ur(this,Ut(this,e),Ut(this,t));return n===!1?r:r.join(n||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},setLine:function(e,t){Kt(this,e)&&jt(this,t,Bt(e,0),Ut(this,Bt(e)))},removeLine:function(e){Kt(this,e)&&jt(this,"",Bt(e,0),Ut(this,Bt(e+1,0)))},getLineHandle:function(e){return Kt(this,e)?cr(this,e):void 0},getLineNumber:function(e){return hr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Ut(this,e)},getCursor:function(e){var t,n=this.sel;return t=null==e||"head"==e?n.head:"anchor"==e?n.anchor:"end"==e||e===!1?n.to:n.from,Wt(t)},somethingSelected:function(){return!Rt(this.sel.head,this.sel.anchor)},setCursor:nt(function(e,t,n){var r=Ut(this,"number"==typeof e?Bt(e,t||0):e);n?Xt(this,r):Qt(this,r,r)}),setSelection:nt(function(e,t){Qt(this,Ut(this,e),Ut(this,t||e))}),extendSelection:nt(function(e,t){Xt(this,Ut(this,e),t&&Ut(this,t))}),getSelection:function(e){return this.getRange(this.sel.from,this.sel.to,e)},replaceSelection:function(e,t,n){Ot(this,{from:this.sel.from,to:this.sel.to,text:yo(e),origin:n},t||"around")},undo:nt(function(){_t(this,"undo")}),redo:nt(function(){_t(this,"redo")}),setExtending:function(e){this.sel.extend=e},historySize:function(){var e=this.history;return{undo:e.done.length,redo:e.undone.length}},clearHistory:function(){this.history=vr()},markClean:function(){this.history.dirtyCounter=0,this.history.lastOp=this.history.lastOrigin=null},isClean:function(){return 0==this.history.dirtyCounter},getHistory:function(){return{done:Sr(this.history.done),undone:Sr(this.history.undone)}},setHistory:function(e){var t=this.history=vr();t.done=e.done.slice(0),t.undone=e.undone.slice(0)},markText:function(e,t,n){return Cn(this,Ut(this,e),Ut(this,t),n,"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft};return e=Ut(this,e),Cn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=Ut(this,e);var t=[],n=cr(this,e.line).markedSpans;if(n)for(var r=0;n.length>r;++r){var i=n[r];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;n.length>r;++r)null!=n[r].from&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first;return this.iter(function(r){var i=r.text.length+1;return i>e?(t=e,!0):(e-=i,++n,void 0)}),Ut(this,Bt(n,t))},indexFromPos:function(e){e=Ut(this,e);var t=e.ch;return e.line<this.first||0>e.ch?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new io(dr(this,this.first,this.first+this.size),this.modeOption,this.first);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:!1,goalColumn:this.sel.goalColumn},e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&n>e.to&&(n=e.to);var r=new io(dr(this,t,n),e.mode||this.modeOption,t);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],r},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var n=0;this.linked.length>n;++n){var r=this.linked[n];if(r.doc==t){this.linked.splice(n,1),t.unlinkDoc(this);break}}if(t.history==this.history){var i=[t.id];ar(t,function(e){i.push(e.id)},!0),t.history=vr(),t.history.done=Sr(this.history.done,i),t.history.undone=Sr(this.history.undone,i)}},iterLinkedDocs:function(e){ar(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),io.prototype.eachLine=io.prototype.iter;var oo="iter insert remove copy getEditor".split(" ");for(var so in io.prototype)io.prototype.hasOwnProperty(so)&&0>Vr(oo,so)&&(e.prototype[so]=function(e){return function(){return e.apply(this.doc,arguments)}}(io.prototype[so]));e.e_stop=Mr,e.e_preventDefault=Ar,e.e_stopPropagation=Dr;var ao,lo=0;e.on=Or,e.off=Pr,e.signal=_r;var co=30,uo=e.Pass={toString:function(){return"CodeMirror.Pass"}};jr.prototype={set:function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)}},e.countColumn=Br;var fo=[""],ho=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc]/,po=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff]/;e.replaceGetRect=function(e){ni=e};var mo=function(){if(vi)return!1;var e=Yr("div");return"draggable"in e||"dragDrop"in e}(),go=/^$/;pi?go=/$'/:Ci&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)?go=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:bi&&(go=/[~!#%&*)=+}\]|\"\.>,:;][({[<]|-[^\-?\.]|\?[\w~`@#$%\^&*(_=+{[|><]/);var vo,bo,yo=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;r>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),s=o.indexOf("\r");-1!=s?(n.push(o.slice(0,s)),t+=s+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)};e.splitLines=yo;var wo=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},xo=function(){var e=Yr("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Co={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};e.keyNames=Co,function(){for(var e=0;10>e;e++)Co[e+48]=String(e);for(var e=65;90>=e;e++)Co[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)Co[e+111]=Co[e+63235]="F"+e}();var So=function(){function e(e){return 255>=e?t.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1791>=e?n.charAt(e-1536):e>=1792&&2220>=e?"r":"L"}var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,s=/[Lb1n]/,a=/[1n]/,l="L";return function(t){if(!r.test(t))return!1;for(var n,c=t.length,u=[],d=0;c>d;++d)u.push(n=e(t.charCodeAt(d)));for(var d=0,f=l;c>d;++d){var n=u[d];"m"==n?u[d]=f:f=n}for(var d=0,h=l;c>d;++d){var n=u[d];"1"==n&&"r"==h?u[d]="n":o.test(n)&&(h=n,"r"==n&&(u[d]="R"))}for(var d=1,f=u[0];c-1>d;++d){var n=u[d];"+"==n&&"1"==f&&"1"==u[d+1]?u[d]="1":","!=n||f!=u[d+1]||"1"!=f&&"n"!=f||(u[d]=f),f=n}for(var d=0;c>d;++d){var n=u[d];if(","==n)u[d]="N";else if("%"==n){for(var p=d+1;c>p&&"%"==u[p];++p);for(var m=d&&"!"==u[d-1]||c-1>p&&"1"==u[p]?"1":"N",g=d;p>g;++g)u[g]=m;d=p-1}}for(var d=0,h=l;c>d;++d){var n=u[d];"L"==h&&"1"==n?u[d]="L":o.test(n)&&(h=n)}for(var d=0;c>d;++d)if(i.test(u[d])){for(var p=d+1;c>p&&i.test(u[p]);++p);for(var v="L"==(d?u[d-1]:l),b="L"==(c-1>p?u[p]:l),m=v||b?"L":"R",g=d;p>g;++g)u[g]=m;d=p-1}for(var y,w=[],d=0;c>d;)if(s.test(u[d])){var x=d;for(++d;c>d&&s.test(u[d]);++d);w.push({from:x,to:d,level:0})}else{var C=d,S=w.length;for(++d;c>d&&"L"!=u[d];++d);for(var g=C;d>g;)if(a.test(u[g])){g>C&&w.splice(S,0,{from:C,to:g,level:1});var k=g;for(++g;d>g&&a.test(u[g]);++g);w.splice(S,0,{from:k,to:g,level:2}),C=g}else++g;d>C&&w.splice(S,0,{from:C,to:d,level:1})}return 1==w[0].level&&(y=t.match(/^\s+/))&&(w[0].from=y[0].length,w.unshift({from:0,to:y[0].length,level:0})),1==zr(w).level&&(y=t.match(/\s+$/))&&(zr(w).to-=y[0].length,w.push({from:c-y[0].length,to:c,level:0})),w[0].level!=zr(w).level&&w.push({from:c,to:c,level:w[0].level}),w}}();return e.version="3.11",e}(),function(){function e(e){function t(t,n,r){if(t.text){var o=c?0:t.text.length-1,a=c?t.text.length:-1;for(null!=r&&(o=r+u);o!=a;o+=u){var l=t.text.charAt(o);if(h.test(l)&&e.getTokenAt(i(n,o+1)).type==d){var p=s[l];if(">"==p.charAt(1)==c)f.push(l);else{if(f.pop()!=p.charAt(0))return{pos:o,match:!1};if(!f.length)return{pos:o,match:!0}}}}}}var n=e.getCursor(),r=e.getLineHandle(n.line),o=n.ch-1,a=o>=0&&s[r.text.charAt(o)]||s[r.text.charAt(++o)];if(!a)return null;for(var l,c=">"==a.charAt(1),u=c?1:-1,d=e.getTokenAt(i(n.line,o+1)).type,f=[r.text.charAt(o)],h=/[(){}[\]]/,p=n.line,m=c?Math.min(p+100,e.lineCount()):Math.max(-1,p-100);p!=m&&!(l=p==n.line?t(r,p,o):t(e.getLineHandle(p),p));p+=u);return{from:i(n.line,o),to:l&&i(p,l.pos),match:l&&l.match}}function t(t,n){var s=e(t);if(!(!s||t.getLine(s.from.line).length>o||s.to&&t.getLine(s.to.line).length>o)){var a=s.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",l=t.markText(s.from,i(s.from.line,s.from.ch+1),{className:a}),c=s.to&&t.markText(s.to,i(s.to.line,s.to.ch+1),{className:a});r&&t.state.focused&&t.display.input.focus();var u=function(){t.operation(function(){l.clear(),c&&c.clear()})};return n?(setTimeout(u,800),void 0):u}}function n(e){e.operation(function(){a&&(a(),a=null),e.somethingSelected()||(a=t(e,!1))})}var r=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||8>document.documentMode),i=CodeMirror.Pos,o=1e3,s={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},a=null;CodeMirror.defineOption("matchBrackets",!1,function(e,t){t?e.on("cursorActivity",n):e.off("cursorActivity",n)}),CodeMirror.defineExtension("matchBrackets",function(){t(this,!0)}),CodeMirror.defineExtension("findMatchingBracket",function(){return e(this)})}(),CodeMirror.defineMode("javascript",function(e,t){function n(e,t,n){return t.tokenize=n,n(e,t)}function r(e,t){for(var n,r=!1;null!=(n=e.next());){if(n==t&&!r)return!1;r=!r&&"\\"==n}return r}function i(e,t,n){return G=e,j=n,t}function o(e,t){var o=e.next();if('"'==o||"'"==o)return n(e,t,s(o));if(/[\[\]{}\(\),;\:\.]/.test(o))return i(o);if("0"==o&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),i("number","number");if(/\d/.test(o)||"-"==o&&e.eat(/\d/))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),i("number","number");if("/"==o)return e.eat("*")?n(e,t,a):e.eat("/")?(e.skipToEnd(),i("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(r(e,"/"),e.eatWhile(/[gimy]/),i("regexp","string-2")):(e.eatWhile(V),i("operator",null,e.current()));if("#"==o)return e.skipToEnd(),i("error","error");if(V.test(o))return e.eatWhile(V),i("operator",null,e.current());e.eatWhile(/[\w\$_]/);var l=e.current(),c=W.propertyIsEnumerable(l)&&W[l];return c&&"."!=t.lastType?i(c.type,c.style,l):i("variable","variable",l)}function s(e){return function(t,n){return r(t,e)||(n.tokenize=o),i("string","string")}}function a(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=o;break}r="*"==n}return i("comment","comment")}function l(e,t,n,r,i,o){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=o,null!=r&&(this.align=r)}function c(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0}function u(e,t,n,r,i){var o=e.cc;for(q.state=e,q.stream=i,q.marked=null,q.cc=o,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var s=o.length?o.pop():R?w:y;if(s(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return q.marked?q.marked:"variable"==n&&c(e,r)?"variable-2":t}}}function d(){for(var e=arguments.length-1;e>=0;e--)q.cc.push(arguments[e])}function f(){return d.apply(null,arguments),!0}function h(e){function t(t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}var n=q.state;if(n.context){if(q.marked="def",t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;n.globalVars={name:e,next:n.globalVars}}}function p(){q.state.context={prev:q.state.context,vars:q.state.localVars},q.state.localVars=K}function m(){q.state.localVars=q.state.context.vars,q.state.context=q.state.context.prev}function g(e,t){var n=function(){var n=q.state;n.lexical=new l(n.indented,q.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function v(){var e=q.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function b(e){return function(t){return t==e?f():";"==e?d():f(arguments.callee)}}function y(e){return"var"==e?f(g("vardef"),M,b(";"),v):"keyword a"==e?f(g("form"),w,y,v):"keyword b"==e?f(g("form"),y,v):"{"==e?f(g("}"),N,v):";"==e?f():"function"==e?f(F):"for"==e?f(g("form"),b("("),g(")"),$,b(")"),v,y,v):"variable"==e?f(g("stat"),S):"switch"==e?f(g("form"),w,g("}","switch"),b("{"),N,v,v):"case"==e?f(w,b(":")):"default"==e?f(b(":")):"catch"==e?f(g("form"),p,b("("),H,b(")"),y,v,m):d(g("stat"),w,b(";"),v)}function w(e){return U.hasOwnProperty(e)?f(C):"function"==e?f(F):"keyword c"==e?f(x):"("==e?f(g(")"),x,b(")"),v,C):"operator"==e?f(w):"["==e?f(g("]"),L(w,"]"),v,C):"{"==e?f(g("}"),L(T,"}"),v,C):f()}function x(e){return e.match(/[;\}\)\],]/)?d():d(w)}function C(e,t){if("operator"==e)return/\+\+|--/.test(t)?f(C):"?"==t?f(w,b(":"),w):f(w);if(";"!=e)return"("==e?f(g(")"),L(w,")"),v,C):"."==e?f(k,C):"["==e?f(g("]"),w,b("]"),v,C):void 0}function S(e){return":"==e?f(v,y):d(C,b(";"),v)}function k(e){return"variable"==e?(q.marked="property",f()):void 0}function T(e,t){if("variable"==e){if(q.marked="property","get"==t||"set"==t)return f(E)}else("number"==e||"string"==e)&&(q.marked=e+" property");return U.hasOwnProperty(e)?f(b(":"),w):void 0}function E(e){return":"==e?f(w):"variable"!=e?f(b(":"),w):(q.marked="property",f(F))}function L(e,t){function n(r){return","==r?f(e,n):r==t?f():f(b(t))}return function(r){return r==t?f():d(e,n)}}function N(e){return"}"==e?f():d(y,N)}function A(e){return":"==e?f(D):d()}function D(e){return"variable"==e?(q.marked="variable-3",f()):d()}function M(e,t){return"variable"==e?(h(t),z?f(A,I):f(I)):d()}function I(e,t){return"="==t?f(w,I):","==e?f(M):void 0}function $(e){return"var"==e?f(M,b(";"),P):";"==e?f(P):"variable"==e?f(O):f(P)}function O(e,t){return"in"==t?f(w):f(C,P)}function P(e,t){return";"==e?f(_):"in"==t?f(w):f(w,b(";"),_)}function _(e){")"!=e&&f(w)}function F(e,t){return"variable"==e?(h(t),f(F)):"("==e?f(g(")"),p,L(H,")"),v,y,m):void 0}function H(e,t){return"variable"==e?(h(t),z?f(A):f()):void 0}var G,j,B=e.indentUnit,R=t.json,z=t.typescript,W=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),n=e("keyword b"),r=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},s={"if":t,"while":t,"with":t,"else":n,"do":n,"try":n,"finally":n,"return":r,"break":r,"continue":r,"new":r,"delete":r,"throw":r,"var":e("var"),"const":e("var"),let:e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":e("this")};if(z){var a={type:"variable",style:"variable-3"},l={"interface":e("interface"),"class":e("class"),"extends":e("extends"),constructor:e("constructor"),"public":e("public"),"private":e("private"),"protected":e("protected"),"static":e("static"),"super":e("super"),string:a,number:a,bool:a,any:a};for(var c in l)s[c]=l[c]}return s}(),V=/[+\-*&%=<>!?|~^]/,U={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0},q={state:null,column:null,marked:null,cc:null},K={name:"this",next:{name:"arguments"}};return v.lex=!0,{startState:function(e){return{tokenize:o,lastType:null,cc:[],lexical:new l((e||0)-B,0,"block",!1),localVars:t.localVars,globalVars:t.globalVars,context:t.localVars&&{vars:t.localVars},indented:0}},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation()),e.eatSpace())return null;var n=t.tokenize(e,t);return"comment"==G?n:(t.lastType=G,u(t,n,G,j,e))},indent:function(e,t){if(e.tokenize==a)return CodeMirror.Pass;if(e.tokenize!=o)return 0;var n=t&&t.charAt(0),r=e.lexical;"stat"==r.type&&"}"==n&&(r=r.prev);var i=r.type,s=n==i;return"vardef"==i?r.indented+("operator"==e.lastType||","==e.lastType?4:0):"form"==i&&"{"==n?r.indented:"form"==i?r.indented+B:"stat"==i?r.indented+("operator"==e.lastType||","==e.lastType?B:0):"switch"!=r.info||s?r.align?r.column+(s?0:1):r.indented+(s?0:B):r.indented+(/^(?:case|default)\b/.test(t)?B:2*B)},electricChars:":{}",jsonMode:R}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("text/ecmascript","javascript"),CodeMirror.defineMIME("application/javascript","javascript"),CodeMirror.defineMIME("application/ecmascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:!0}),CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:!0}),!function(e){"use strict";function t(){e(r).each(function(){n(e(this)).removeClass("open")})}function n(t){var n,r=t.attr("data-target");return r||(r=t.attr("href"),r=r&&/#/.test(r)&&r.replace(/.*(?=#[^\s]*$)/,"")),n=r&&e(r),n&&n.length||(n=t.parent()),n}var r="[data-toggle=dropdown]",i=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};i.prototype={constructor:i,toggle:function(){var r,i,o=e(this);if(!o.is(".disabled, :disabled"))return r=n(o),i=r.hasClass("open"),t(),i||r.toggleClass("open"),o.focus(),!1},keydown:function(t){var i,o,s,a,l;if(/(38|40|27)/.test(t.keyCode)&&(i=e(this),t.preventDefault(),t.stopPropagation(),!i.is(".disabled, :disabled"))){if(s=n(i),a=s.hasClass("open"),!a||a&&27==t.keyCode)return 27==t.which&&s.find(r).focus(),i.click();o=e("[role=menu] li:not(.divider):visible a",s),o.length&&(l=o.index(o.filter(":focus")),38==t.keyCode&&l>0&&l--,40==t.keyCode&&o.length-1>l&&l++,~l||(l=0),o.eq(l).focus())}}};var o=e.fn.dropdown;e.fn.dropdown=function(t){return this.each(function(){var n=e(this),r=n.data("dropdown");r||n.data("dropdown",r=new i(this)),"string"==typeof t&&r[t].call(n)})},e.fn.dropdown.Constructor=i,e.fn.dropdown.noConflict=function(){return e.fn.dropdown=o,this},e(document).on("click.dropdown.data-api",t).on("click.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.dropdown-menu",function(e){e.stopPropagation()}).on("click.dropdown.data-api",r,i.prototype.toggle).on("keydown.dropdown.data-api",r+", [role=menu]",i.prototype.keydown)}(window.jQuery),!function(e){"use strict";
|
1087
1087
|
var t=function(e,t){this.init("tooltip",e,t)};t.prototype={constructor:t,init:function(t,n,r){var i,o,s,a,l;for(this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.enabled=!0,s=this.options.trigger.split(" "),l=s.length;l--;)a=s[l],"click"==a?this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this)):"manual"!=a&&(i="hover"==a?"mouseenter":"focus",o="hover"==a?"mouseleave":"blur",this.$element.on(i+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(o+"."+this.type,this.options.selector,e.proxy(this.leave,this)));this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(t){return t=e.extend({},e.fn[this.type].defaults,this.$element.data(),t),t.delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var n,r=e.fn[this.type].defaults,i={};return this._options&&e.each(this._options,function(e,t){r[e]!=t&&(i[e]=t)},this),n=e(t.currentTarget)[this.type](i).data(this.type),n.options.delay&&n.options.delay.show?(clearTimeout(this.timeout),n.hoverState="in",this.timeout=setTimeout(function(){"in"==n.hoverState&&n.show()},n.options.delay.show),void 0):n.show()},leave:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);return this.timeout&&clearTimeout(this.timeout),n.options.delay&&n.options.delay.hide?(n.hoverState="out",this.timeout=setTimeout(function(){"out"==n.hoverState&&n.hide()},n.options.delay.hide),void 0):n.hide()},show:function(){var t,n,r,i,o,s,a=e.Event("show");if(this.hasContent()&&this.enabled){if(this.$element.trigger(a),a.isDefaultPrevented())return;switch(t=this.tip(),this.setContent(),this.options.animation&&t.addClass("fade"),o="function"==typeof this.options.placement?this.options.placement.call(this,t[0],this.$element[0]):this.options.placement,t.detach().css({top:0,left:0,display:"block"}),this.options.container?t.appendTo(this.options.container):t.insertAfter(this.$element),n=this.getPosition(),r=t[0].offsetWidth,i=t[0].offsetHeight,o){case"bottom":s={top:n.top+n.height,left:n.left+n.width/2-r/2};break;case"top":s={top:n.top-i,left:n.left+n.width/2-r/2};break;case"left":s={top:n.top+n.height/2-i/2,left:n.left-r};break;case"right":s={top:n.top+n.height/2-i/2,left:n.left+n.width}}this.applyPlacement(s,o),this.$element.trigger("shown")}},applyPlacement:function(e,t){var n,r,i,o,s=this.tip(),a=s[0].offsetWidth,l=s[0].offsetHeight;s.offset(e).addClass(t).addClass("in"),n=s[0].offsetWidth,r=s[0].offsetHeight,"top"==t&&r!=l&&(e.top=e.top+l-r,o=!0),"bottom"==t||"top"==t?(i=0,0>e.left&&(i=-2*e.left,e.left=0,s.offset(e),n=s[0].offsetWidth,r=s[0].offsetHeight),this.replaceArrow(i-a+n,n,"left")):this.replaceArrow(r-l,r,"top"),o&&s.offset(e)},replaceArrow:function(e,t,n){this.arrow().css(n,e?50*(1-e/t)+"%":"")},setContent:function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},hide:function(){function t(){var t=setTimeout(function(){n.off(e.support.transition.end).detach()},500);n.one(e.support.transition.end,function(){clearTimeout(t),n.detach()})}var n=this.tip(),r=e.Event("hide");return this.$element.trigger(r),r.isDefaultPrevented()?void 0:(n.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?t():n.detach(),this.$element.trigger("hidden"),this)},fixTitle:function(){var e=this.$element;(e.attr("title")||"string"!=typeof e.attr("data-original-title"))&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},hasContent:function(){return this.getTitle()},getPosition:function(){var t=this.$element[0];return e.extend({},"function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{width:t.offsetWidth,height:t.offsetHeight},this.$element.offset())},getTitle:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||("function"==typeof n.title?n.title.call(t[0]):n.title)},tip:function(){return this.$tip=this.$tip||e(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(t){var n=t?e(t.currentTarget)[this.type](this._options).data(this.type):this;n.tip().hasClass("in")?n.hide():n.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var n=e.fn.tooltip;e.fn.tooltip=function(n){return this.each(function(){var r=e(this),i=r.data("tooltip"),o="object"==typeof n&&n;i||r.data("tooltip",i=new t(this,o)),"string"==typeof n&&i[n]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},e.fn.tooltip.noConflict=function(){return e.fn.tooltip=n,this}}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("popover",e,t)};t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:t,setContent:function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content")[this.options.html?"html":"text"](n),e.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var e,t=this.$element,n=this.options;return e=("function"==typeof n.content?n.content.call(t[0]):n.content)||t.attr("data-content")},tip:function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var n=e.fn.popover;e.fn.popover=function(n){return this.each(function(){var r=e(this),i=r.data("popover"),o="object"==typeof n&&n;i||r.data("popover",i=new t(this,o)),"string"==typeof n&&i[n]()})},e.fn.popover.Constructor=t,e.fn.popover.defaults=e.extend({},e.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),e.fn.popover.noConflict=function(){return e.fn.popover=n,this}}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.options=n,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};t.prototype={constructor:t,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,n=e.Event("show");this.$element.trigger(n),this.isShown||n.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.backdrop(function(){var n=e.support.transition&&t.$element.hasClass("fade");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),n&&t.$element[0].offsetWidth,t.$element.addClass("in").attr("aria-hidden",!1),t.enforceFocus(),n?t.$element.one(e.support.transition.end,function(){t.$element.focus().trigger("shown")}):t.$element.focus().trigger("shown")}))},hide:function(t){t&&t.preventDefault(),t=e.Event("hide"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),e(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),e.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal())},enforceFocus:function(){var t=this;e(document).on("focusin.modal",function(e){t.$element[0]===e.target||t.$element.has(e.target).length||t.$element.focus()})},escape:function(){var e=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(t){27==t.which&&e.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var t=this,n=setTimeout(function(){t.$element.off(e.support.transition.end),t.hideModal()},500);this.$element.one(e.support.transition.end,function(){clearTimeout(n),t.hideModal()})},hideModal:function(){var e=this;this.$element.hide(),this.backdrop(function(){e.removeBackdrop(),e.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(t){var n=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var r=e.support.transition&&n;if(this.$backdrop=e('<div class="modal-backdrop '+n+'" />').appendTo(document.body),this.$backdrop.click("static"==this.options.backdrop?e.proxy(this.$element[0].focus,this.$element[0]):e.proxy(this.hide,this)),r&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;r?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,t):t()):t&&t()}};var n=e.fn.modal;e.fn.modal=function(n){return this.each(function(){var r=e(this),i=r.data("modal"),o=e.extend({},e.fn.modal.defaults,r.data(),"object"==typeof n&&n);i||r.data("modal",i=new t(this,o)),"string"==typeof n?i[n]():o.show&&i.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=n,this},e(document).on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),r=n.attr("href"),i=e(n.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),o=i.data("modal")?"toggle":e.extend({remote:!/#/.test(r)&&r},i.data(),n.data());t.preventDefault(),i.modal(o).one("hide",function(){n.focus()})})}(window.jQuery),function(e,t){"use strict";"function"==typeof define&&define.amd?define(["exports"],t):"undefined"!=typeof exports?t(exports):t(e.esprima={})}(this,function(e){"use strict";function t(e,t){if(!e)throw new Error("ASSERT: "+t)}function n(e,t){return hn.slice(e,t)}function r(e){return"0123456789".indexOf(e)>=0}function i(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function o(e){return"01234567".indexOf(e)>=0}function s(e){return" "===e||" "===e||""===e||"\f"===e||"\u00a0"===e||e.charCodeAt(0)>=5760&&"\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\ufeff".indexOf(e)>=0}function a(e){return"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e}function l(e){return"$"===e||"_"===e||"\\"===e||e>="a"&&"z">=e||e>="A"&&"Z">=e||e.charCodeAt(0)>=128&&fn.NonAsciiIdentifierStart.test(e)}function c(e){return"$"===e||"_"===e||"\\"===e||e>="a"&&"z">=e||e>="A"&&"Z">=e||e>="0"&&"9">=e||e.charCodeAt(0)>=128&&fn.NonAsciiIdentifierPart.test(e)}function u(e){switch(e){case"class":case"enum":case"export":case"extends":case"import":case"super":return!0}return!1}function d(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0}return!1}function f(e){return"eval"===e||"arguments"===e}function h(e){var t=!1;switch(e.length){case 2:t="if"===e||"in"===e||"do"===e;break;case 3:t="var"===e||"for"===e||"new"===e||"try"===e;break;case 4:t="this"===e||"else"===e||"case"===e||"void"===e||"with"===e;break;case 5:t="while"===e||"break"===e||"catch"===e||"throw"===e;break;case 6:t="return"===e||"typeof"===e||"delete"===e||"switch"===e;break;case 7:t="default"===e||"finally"===e;break;case 8:t="function"===e||"continue"===e||"debugger"===e;break;case 10:t="instanceof"===e}if(t)return!0;switch(e){case"const":return!0;case"yield":case"let":return!0}return pn&&d(e)?!0:u(e)}function p(){var e,t,n;for(t=!1,n=!1;bn>mn;)if(e=hn[mn],n)e=hn[mn++],a(e)&&(n=!1,"\r"===e&&"\n"===hn[mn]&&++mn,++gn,vn=mn);else if(t)a(e)?("\r"===e&&"\n"===hn[mn+1]&&++mn,++gn,++mn,vn=mn,mn>=bn&&E({},dn.UnexpectedToken,"ILLEGAL")):(e=hn[mn++],mn>=bn&&E({},dn.UnexpectedToken,"ILLEGAL"),"*"===e&&(e=hn[mn],"/"===e&&(++mn,t=!1)));else if("/"===e)if(e=hn[mn+1],"/"===e)mn+=2,n=!0;else{if("*"!==e)break;mn+=2,t=!0,mn>=bn&&E({},dn.UnexpectedToken,"ILLEGAL")}else if(s(e))++mn;else{if(!a(e))break;++mn,"\r"===e&&"\n"===hn[mn]&&++mn,++gn,vn=mn}}function m(e){var t,n,r,o=0;for(n="u"===e?4:2,t=0;n>t;++t){if(!(bn>mn&&i(hn[mn])))return"";r=hn[mn++],o=16*o+"0123456789abcdef".indexOf(r.toLowerCase())}return String.fromCharCode(o)}function g(){var e,t,n,r;if(e=hn[mn],l(e)){if(t=mn,"\\"===e){if(++mn,"u"!==hn[mn])return;if(++mn,r=mn,e=m("u")){if("\\"===e||!l(e))return;n=e}else mn=r,n="u"}else n=hn[mn++];for(;bn>mn&&(e=hn[mn],c(e));)if("\\"===e){if(++mn,"u"!==hn[mn])return;if(++mn,r=mn,e=m("u")){if("\\"===e||!c(e))return;n+=e}else mn=r,n+="u"}else n+=hn[mn++];return 1===n.length?{type:an.Identifier,value:n,lineNumber:gn,lineStart:vn,range:[t,mn]}:h(n)?{type:an.Keyword,value:n,lineNumber:gn,lineStart:vn,range:[t,mn]}:"null"===n?{type:an.NullLiteral,value:n,lineNumber:gn,lineStart:vn,range:[t,mn]}:"true"===n||"false"===n?{type:an.BooleanLiteral,value:n,lineNumber:gn,lineStart:vn,range:[t,mn]}:{type:an.Identifier,value:n,lineNumber:gn,lineStart:vn,range:[t,mn]}}}function v(){var e,t,n,i=mn,o=hn[mn];return";"===o||"{"===o||"}"===o?(++mn,{type:an.Punctuator,value:o,lineNumber:gn,lineStart:vn,range:[i,mn]}):","===o||"("===o||")"===o?(++mn,{type:an.Punctuator,value:o,lineNumber:gn,lineStart:vn,range:[i,mn]}):(e=hn[mn+1],"."!==o||r(e)?(t=hn[mn+2],n=hn[mn+3],">"===o&&">"===e&&">"===t&&"="===n?(mn+=4,{type:an.Punctuator,value:">>>=",lineNumber:gn,lineStart:vn,range:[i,mn]}):"="===o&&"="===e&&"="===t?(mn+=3,{type:an.Punctuator,value:"===",lineNumber:gn,lineStart:vn,range:[i,mn]}):"!"===o&&"="===e&&"="===t?(mn+=3,{type:an.Punctuator,value:"!==",lineNumber:gn,lineStart:vn,range:[i,mn]}):">"===o&&">"===e&&">"===t?(mn+=3,{type:an.Punctuator,value:">>>",lineNumber:gn,lineStart:vn,range:[i,mn]}):"<"===o&&"<"===e&&"="===t?(mn+=3,{type:an.Punctuator,value:"<<=",lineNumber:gn,lineStart:vn,range:[i,mn]}):">"===o&&">"===e&&"="===t?(mn+=3,{type:an.Punctuator,value:">>=",lineNumber:gn,lineStart:vn,range:[i,mn]}):"="===e&&"<>=!+-*%&|^/".indexOf(o)>=0?(mn+=2,{type:an.Punctuator,value:o+e,lineNumber:gn,lineStart:vn,range:[i,mn]}):o===e&&"+-<>&|".indexOf(o)>=0&&"+-<>&|".indexOf(e)>=0?(mn+=2,{type:an.Punctuator,value:o+e,lineNumber:gn,lineStart:vn,range:[i,mn]}):"[]<>+-*%&|^!~?:=/".indexOf(o)>=0?{type:an.Punctuator,value:hn[mn++],lineNumber:gn,lineStart:vn,range:[i,mn]}:void 0):{type:an.Punctuator,value:hn[mn++],lineNumber:gn,lineStart:vn,range:[i,mn]})}function b(){var e,n,s;if(s=hn[mn],t(r(s)||"."===s,"Numeric literal must start with a decimal digit or a decimal point"),n=mn,e="","."!==s){if(e=hn[mn++],s=hn[mn],"0"===e){if("x"===s||"X"===s){for(e+=hn[mn++];bn>mn&&(s=hn[mn],i(s));)e+=hn[mn++];return 2>=e.length&&E({},dn.UnexpectedToken,"ILLEGAL"),bn>mn&&(s=hn[mn],l(s)&&E({},dn.UnexpectedToken,"ILLEGAL")),{type:an.NumericLiteral,value:parseInt(e,16),lineNumber:gn,lineStart:vn,range:[n,mn]}}if(o(s)){for(e+=hn[mn++];bn>mn&&(s=hn[mn],o(s));)e+=hn[mn++];return bn>mn&&(s=hn[mn],(l(s)||r(s))&&E({},dn.UnexpectedToken,"ILLEGAL")),{type:an.NumericLiteral,value:parseInt(e,8),octal:!0,lineNumber:gn,lineStart:vn,range:[n,mn]}}r(s)&&E({},dn.UnexpectedToken,"ILLEGAL")}for(;bn>mn&&(s=hn[mn],r(s));)e+=hn[mn++]}if("."===s)for(e+=hn[mn++];bn>mn&&(s=hn[mn],r(s));)e+=hn[mn++];if("e"===s||"E"===s)if(e+=hn[mn++],s=hn[mn],("+"===s||"-"===s)&&(e+=hn[mn++]),s=hn[mn],r(s))for(e+=hn[mn++];bn>mn&&(s=hn[mn],r(s));)e+=hn[mn++];else s="character "+s,mn>=bn&&(s="<end>"),E({},dn.UnexpectedToken,"ILLEGAL");return bn>mn&&(s=hn[mn],l(s)&&E({},dn.UnexpectedToken,"ILLEGAL")),{type:an.NumericLiteral,value:parseFloat(e),lineNumber:gn,lineStart:vn,range:[n,mn]}}function y(){var e,n,r,i,s,l,c="",u=!1;for(e=hn[mn],t("'"===e||'"'===e,"String literal must starts with a quote"),n=mn,++mn;bn>mn;){if(r=hn[mn++],r===e){e="";break}if("\\"===r)if(r=hn[mn++],a(r))++gn,"\r"===r&&"\n"===hn[mn]&&++mn;else switch(r){case"n":c+="\n";break;case"r":c+="\r";break;case"t":c+=" ";break;case"u":case"x":l=mn,s=m(r),s?c+=s:(mn=l,c+=r);break;case"b":c+="\b";break;case"f":c+="\f";break;case"v":c+="";break;default:o(r)?(i="01234567".indexOf(r),0!==i&&(u=!0),bn>mn&&o(hn[mn])&&(u=!0,i=8*i+"01234567".indexOf(hn[mn++]),"0123".indexOf(r)>=0&&bn>mn&&o(hn[mn])&&(i=8*i+"01234567".indexOf(hn[mn++]))),c+=String.fromCharCode(i)):c+=r}else{if(a(r))break;c+=r}}return""!==e&&E({},dn.UnexpectedToken,"ILLEGAL"),{type:an.StringLiteral,value:c,octal:u,lineNumber:gn,lineStart:vn,range:[n,mn]}}function w(){var e,n,r,i,o,s,l,u=!1,d=!1;for(yn=null,p(),r=mn,n=hn[mn],t("/"===n,"Regular expression literal must start with a slash"),e=hn[mn++];bn>mn;)if(n=hn[mn++],e+=n,u)"]"===n&&(u=!1);else if("\\"===n)n=hn[mn++],a(n)&&E({},dn.UnterminatedRegExp),e+=n;else{if("/"===n){d=!0;break}"["===n?u=!0:a(n)&&E({},dn.UnterminatedRegExp)}for(d||E({},dn.UnterminatedRegExp),i=e.substr(1,e.length-2),o="";bn>mn&&(n=hn[mn],c(n));)if(++mn,"\\"===n&&bn>mn)if(n=hn[mn],"u"===n)if(++mn,l=mn,n=m("u"))for(o+=n,e+="\\u";mn>l;++l)e+=hn[l];else mn=l,o+="u",e+="\\u";else e+="\\";else o+=n,e+=n;try{s=new RegExp(i,o)}catch(f){E({},dn.InvalidRegExp)}return{literal:e,value:s,range:[r,mn]}}function x(e){return e.type===an.Identifier||e.type===an.Keyword||e.type===an.BooleanLiteral||e.type===an.NullLiteral}function C(){var e,t;return p(),mn>=bn?{type:an.EOF,lineNumber:gn,lineStart:vn,range:[mn,mn]}:(t=v(),"undefined"!=typeof t?t:(e=hn[mn],"'"===e||'"'===e?y():"."===e||r(e)?b():(t=g(),"undefined"!=typeof t?t:(E({},dn.UnexpectedToken,"ILLEGAL"),void 0))))}function S(){var e;return yn?(mn=yn.range[1],gn=yn.lineNumber,vn=yn.lineStart,e=yn,yn=null,e):(yn=null,C())}function k(){var e,t,n;return null!==yn?yn:(e=mn,t=gn,n=vn,yn=C(),mn=e,gn=t,vn=n,yn)}function T(){var e,t,n,r;return e=mn,t=gn,n=vn,p(),r=gn!==t,mn=e,gn=t,vn=n,r}function E(e,t){var n,r=Array.prototype.slice.call(arguments,2),i=t.replace(/%(\d)/g,function(e,t){return r[t]||""});throw"number"==typeof e.lineNumber?(n=new Error("Line "+e.lineNumber+": "+i),n.index=e.range[0],n.lineNumber=e.lineNumber,n.column=e.range[0]-vn+1):(n=new Error("Line "+gn+": "+i),n.index=mn,n.lineNumber=gn,n.column=mn-vn+1),n}function L(){try{E.apply(null,arguments)}catch(e){if(!xn.errors)throw e;xn.errors.push(e)}}function N(e){if(e.type===an.EOF&&E(e,dn.UnexpectedEOS),e.type===an.NumericLiteral&&E(e,dn.UnexpectedNumber),e.type===an.StringLiteral&&E(e,dn.UnexpectedString),e.type===an.Identifier&&E(e,dn.UnexpectedIdentifier),e.type===an.Keyword){if(u(e.value))E(e,dn.UnexpectedReserved);else if(pn&&d(e.value))return L(e,dn.StrictReservedWord),void 0;E(e,dn.UnexpectedToken,e.value)}E(e,dn.UnexpectedToken,e.value)}function A(e){var t=S();(t.type!==an.Punctuator||t.value!==e)&&N(t)}function D(e){var t=S();(t.type!==an.Keyword||t.value!==e)&&N(t)}function M(e){var t=k();return t.type===an.Punctuator&&t.value===e}function I(e){var t=k();return t.type===an.Keyword&&t.value===e}function $(){var e=k(),t=e.value;return e.type!==an.Punctuator?!1:"="===t||"*="===t||"/="===t||"%="===t||"+="===t||"-="===t||"<<="===t||">>="===t||">>>="===t||"&="===t||"^="===t||"|="===t}function O(){var e,t;if(";"===hn[mn])return S(),void 0;if(t=gn,p(),gn===t){if(M(";"))return S(),void 0;e=k(),e.type===an.EOF||M("}")||N(e)}}function P(e){return e.type===cn.Identifier||e.type===cn.MemberExpression}function _(){var e=[];for(A("[");!M("]");)M(",")?(S(),e.push(null)):(e.push(ct()),M("]")||A(","));return A("]"),{type:cn.ArrayExpression,elements:e}}function F(e,t){var n,r;return n=pn,r=_t(),t&&pn&&f(e[0].name)&&L(t,dn.StrictParamName),pn=n,{type:cn.FunctionExpression,id:null,params:e,defaults:[],body:r,rest:null,generator:!1,expression:!1}}function H(){var e=S();return e.type===an.StringLiteral||e.type===an.NumericLiteral?(pn&&e.octal&&L(e,dn.StrictOctalLiteral),Kt(e)):{type:cn.Identifier,name:e.value}}function G(){var e,t,n,r;return e=k(),e.type===an.Identifier?(n=H(),"get"!==e.value||M(":")?"set"!==e.value||M(":")?(A(":"),{type:cn.Property,key:n,value:ct(),kind:"init"}):(t=H(),A("("),e=k(),e.type!==an.Identifier&&N(S()),r=[ht()],A(")"),{type:cn.Property,key:t,value:F(r,e),kind:"set"}):(t=H(),A("("),A(")"),{type:cn.Property,key:t,value:F([]),kind:"get"})):e.type!==an.EOF&&e.type!==an.Punctuator?(t=H(),A(":"),{type:cn.Property,key:t,value:ct(),kind:"init"}):(N(e),void 0)}function j(){var e,t,n,r=[],i={},o=String;for(A("{");!M("}");)e=G(),t=e.key.type===cn.Identifier?e.key.name:o(e.key.value),n="init"===e.kind?un.Data:"get"===e.kind?un.Get:un.Set,Object.prototype.hasOwnProperty.call(i,t)?(i[t]===un.Data?pn&&n===un.Data?L({},dn.StrictDuplicateProperty):n!==un.Data&&L({},dn.AccessorDataProperty):n===un.Data?L({},dn.AccessorDataProperty):i[t]&n&&L({},dn.AccessorGetSet),i[t]|=n):i[t]=n,r.push(e),M("}")||A(",");return A("}"),{type:cn.ObjectExpression,properties:r}}function B(){var e;return A("("),e=ut(),A(")"),e}function R(){var e=k(),t=e.type;if(t===an.Identifier)return{type:cn.Identifier,name:S().value};if(t===an.StringLiteral||t===an.NumericLiteral)return pn&&e.octal&&L(e,dn.StrictOctalLiteral),Kt(S());if(t===an.Keyword){if(I("this"))return S(),{type:cn.ThisExpression};if(I("function"))return Ht()}return t===an.BooleanLiteral?(S(),e.value="true"===e.value,Kt(e)):t===an.NullLiteral?(S(),e.value=null,Kt(e)):M("[")?_():M("{")?j():M("(")?B():M("/")||M("/=")?Kt(w()):N(S())}function z(){var e=[];if(A("("),!M(")"))for(;bn>mn&&(e.push(ct()),!M(")"));)A(",");return A(")"),e}function W(){var e=S();return x(e)||N(e),{type:cn.Identifier,name:e.value}}function V(){return A("."),W()}function U(){var e;return A("["),e=ut(),A("]"),e}function q(){var e;return D("new"),e={type:cn.NewExpression,callee:X(),arguments:[]},M("(")&&(e.arguments=z()),e}function K(){var e;for(e=I("new")?q():R();M(".")||M("[")||M("(");)e=M("(")?{type:cn.CallExpression,callee:e,arguments:z()}:M("[")?{type:cn.MemberExpression,computed:!0,object:e,property:U()}:{type:cn.MemberExpression,computed:!1,object:e,property:V()};return e}function X(){var e;for(e=I("new")?q():R();M(".")||M("[");)e=M("[")?{type:cn.MemberExpression,computed:!0,object:e,property:U()}:{type:cn.MemberExpression,computed:!1,object:e,property:V()};return e}function J(){var e,t=K();return e=k(),e.type!==an.Punctuator?t:(!M("++")&&!M("--")||T()||(pn&&t.type===cn.Identifier&&f(t.name)&&L({},dn.StrictLHSPostfix),P(t)||E({},dn.InvalidLHSInAssignment),t={type:cn.UpdateExpression,operator:S().value,argument:t,prefix:!1}),t)}function Q(){var e,t;return e=k(),e.type!==an.Punctuator&&e.type!==an.Keyword?J():M("++")||M("--")?(e=S(),t=Q(),pn&&t.type===cn.Identifier&&f(t.name)&&L({},dn.StrictLHSPrefix),P(t)||E({},dn.InvalidLHSInAssignment),t={type:cn.UpdateExpression,operator:e.value,argument:t,prefix:!0}):M("+")||M("-")||M("~")||M("!")?t={type:cn.UnaryExpression,operator:S().value,argument:Q()}:I("delete")||I("void")||I("typeof")?(t={type:cn.UnaryExpression,operator:S().value,argument:Q()},pn&&"delete"===t.operator&&t.argument.type===cn.Identifier&&L({},dn.StrictDelete),t):J()}function Y(){for(var e=Q();M("*")||M("/")||M("%");)e={type:cn.BinaryExpression,operator:S().value,left:e,right:Q()};return e}function Z(){for(var e=Y();M("+")||M("-");)e={type:cn.BinaryExpression,operator:S().value,left:e,right:Y()};return e}function et(){for(var e=Z();M("<<")||M(">>")||M(">>>");)e={type:cn.BinaryExpression,operator:S().value,left:e,right:Z()};return e}function tt(){var e,t;for(t=wn.allowIn,wn.allowIn=!0,e=et();M("<")||M(">")||M("<=")||M(">=")||t&&I("in")||I("instanceof");)e={type:cn.BinaryExpression,operator:S().value,left:e,right:et()};return wn.allowIn=t,e}function nt(){for(var e=tt();M("==")||M("!=")||M("===")||M("!==");)e={type:cn.BinaryExpression,operator:S().value,left:e,right:tt()};return e}function rt(){for(var e=nt();M("&");)S(),e={type:cn.BinaryExpression,operator:"&",left:e,right:nt()};return e}function it(){for(var e=rt();M("^");)S(),e={type:cn.BinaryExpression,operator:"^",left:e,right:rt()};return e}function ot(){for(var e=it();M("|");)S(),e={type:cn.BinaryExpression,operator:"|",left:e,right:it()};return e}function st(){for(var e=ot();M("&&");)S(),e={type:cn.LogicalExpression,operator:"&&",left:e,right:ot()};return e}function at(){for(var e=st();M("||");)S(),e={type:cn.LogicalExpression,operator:"||",left:e,right:st()};return e}function lt(){var e,t,n;return e=at(),M("?")&&(S(),t=wn.allowIn,wn.allowIn=!0,n=ct(),wn.allowIn=t,A(":"),e={type:cn.ConditionalExpression,test:e,consequent:n,alternate:ct()}),e}function ct(){var e,t;return e=k(),t=lt(),$()&&(P(t)||E({},dn.InvalidLHSInAssignment),pn&&t.type===cn.Identifier&&f(t.name)&&L(e,dn.StrictLHSAssignment),t={type:cn.AssignmentExpression,operator:S().value,left:t,right:ct()}),t}function ut(){var e=ct();if(M(","))for(e={type:cn.SequenceExpression,expressions:[e]};bn>mn&&M(",");)S(),e.expressions.push(ct());return e}function dt(){for(var e,t=[];bn>mn&&!M("}")&&(e=Gt(),"undefined"!=typeof e);)t.push(e);return t}function ft(){var e;return A("{"),e=dt(),A("}"),{type:cn.BlockStatement,body:e}}function ht(){var e=S();return e.type!==an.Identifier&&N(e),{type:cn.Identifier,name:e.value}}function pt(e){var t=ht(),n=null;return pn&&f(t.name)&&L({},dn.StrictVarName),"const"===e?(A("="),n=ct()):M("=")&&(S(),n=ct()),{type:cn.VariableDeclarator,id:t,init:n}}function mt(e){for(var t=[];bn>mn&&(t.push(pt(e)),M(","));)S();return t}function gt(){var e;return D("var"),e=mt(),O(),{type:cn.VariableDeclaration,declarations:e,kind:"var"}}function vt(e){var t;return D(e),t=mt(e),O(),{type:cn.VariableDeclaration,declarations:t,kind:e}}function bt(){return A(";"),{type:cn.EmptyStatement}}function yt(){var e=ut();return O(),{type:cn.ExpressionStatement,expression:e}}function wt(){var e,t,n;return D("if"),A("("),e=ut(),A(")"),t=Pt(),I("else")?(S(),n=Pt()):n=null,{type:cn.IfStatement,test:e,consequent:t,alternate:n}}function xt(){var e,t,n;return D("do"),n=wn.inIteration,wn.inIteration=!0,e=Pt(),wn.inIteration=n,D("while"),A("("),t=ut(),A(")"),M(";")&&S(),{type:cn.DoWhileStatement,body:e,test:t}}function Ct(){var e,t,n;return D("while"),A("("),e=ut(),A(")"),n=wn.inIteration,wn.inIteration=!0,t=Pt(),wn.inIteration=n,{type:cn.WhileStatement,test:e,body:t}}function St(){var e=S();return{type:cn.VariableDeclaration,declarations:mt(),kind:e.value}}function kt(){var e,t,n,r,i,o,s;return e=t=n=null,D("for"),A("("),M(";")?S():(I("var")||I("let")?(wn.allowIn=!1,e=St(),wn.allowIn=!0,1===e.declarations.length&&I("in")&&(S(),r=e,i=ut(),e=null)):(wn.allowIn=!1,e=ut(),wn.allowIn=!0,I("in")&&(P(e)||E({},dn.InvalidLHSInForIn),S(),r=e,i=ut(),e=null)),"undefined"==typeof r&&A(";")),"undefined"==typeof r&&(M(";")||(t=ut()),A(";"),M(")")||(n=ut())),A(")"),s=wn.inIteration,wn.inIteration=!0,o=Pt(),wn.inIteration=s,"undefined"==typeof r?{type:cn.ForStatement,init:e,test:t,update:n,body:o}:{type:cn.ForInStatement,left:r,right:i,body:o,each:!1}}function Tt(){var e,t=null;return D("continue"),";"===hn[mn]?(S(),wn.inIteration||E({},dn.IllegalContinue),{type:cn.ContinueStatement,label:null}):T()?(wn.inIteration||E({},dn.IllegalContinue),{type:cn.ContinueStatement,label:null}):(e=k(),e.type===an.Identifier&&(t=ht(),Object.prototype.hasOwnProperty.call(wn.labelSet,t.name)||E({},dn.UnknownLabel,t.name)),O(),null!==t||wn.inIteration||E({},dn.IllegalContinue),{type:cn.ContinueStatement,label:t})}function Et(){var e,t=null;return D("break"),";"===hn[mn]?(S(),wn.inIteration||wn.inSwitch||E({},dn.IllegalBreak),{type:cn.BreakStatement,label:null}):T()?(wn.inIteration||wn.inSwitch||E({},dn.IllegalBreak),{type:cn.BreakStatement,label:null}):(e=k(),e.type===an.Identifier&&(t=ht(),Object.prototype.hasOwnProperty.call(wn.labelSet,t.name)||E({},dn.UnknownLabel,t.name)),O(),null!==t||wn.inIteration||wn.inSwitch||E({},dn.IllegalBreak),{type:cn.BreakStatement,label:t})}function Lt(){var e,t=null;return D("return"),wn.inFunctionBody||L({},dn.IllegalReturn)," "===hn[mn]&&l(hn[mn+1])?(t=ut(),O(),{type:cn.ReturnStatement,argument:t}):T()?{type:cn.ReturnStatement,argument:null}:(M(";")||(e=k(),M("}")||e.type===an.EOF||(t=ut())),O(),{type:cn.ReturnStatement,argument:t})}function Nt(){var e,t;return pn&&L({},dn.StrictModeWith),D("with"),A("("),e=ut(),A(")"),t=Pt(),{type:cn.WithStatement,object:e,body:t}}function At(){var e,t,n=[];for(I("default")?(S(),e=null):(D("case"),e=ut()),A(":");bn>mn&&!(M("}")||I("default")||I("case"))&&(t=Pt(),"undefined"!=typeof t);)n.push(t);return{type:cn.SwitchCase,test:e,consequent:n}}function Dt(){var e,t,n,r,i;if(D("switch"),A("("),e=ut(),A(")"),A("{"),M("}"))return S(),{type:cn.SwitchStatement,discriminant:e};for(t=[],r=wn.inSwitch,wn.inSwitch=!0,i=!1;bn>mn&&!M("}");)n=At(),null===n.test&&(i&&E({},dn.MultipleDefaultsInSwitch),i=!0),t.push(n);return wn.inSwitch=r,A("}"),{type:cn.SwitchStatement,discriminant:e,cases:t}}function Mt(){var e;return D("throw"),T()&&E({},dn.NewlineAfterThrow),e=ut(),O(),{type:cn.ThrowStatement,argument:e}}function It(){var e;return D("catch"),A("("),M(")")||(e=ut(),pn&&e.type===cn.Identifier&&f(e.name)&&L({},dn.StrictCatchVariable)),A(")"),{type:cn.CatchClause,param:e,body:ft()}}function $t(){var e,t=[],n=null;return D("try"),e=ft(),I("catch")&&t.push(It()),I("finally")&&(S(),n=ft()),0!==t.length||n||E({},dn.NoCatchOrFinally),{type:cn.TryStatement,block:e,guardedHandlers:[],handlers:t,finalizer:n}}function Ot(){return D("debugger"),O(),{type:cn.DebuggerStatement}}function Pt(){var e,t,n=k();if(n.type===an.EOF&&N(n),n.type===an.Punctuator)switch(n.value){case";":return bt();case"{":return ft();case"(":return yt();default:}if(n.type===an.Keyword)switch(n.value){case"break":return Et();case"continue":return Tt();case"debugger":return Ot();case"do":return xt();case"for":return kt();case"function":return Ft();case"if":return wt();case"return":return Lt();case"switch":return Dt();case"throw":return Mt();case"try":return $t();case"var":return gt();case"while":return Ct();case"with":return Nt();default:}return e=ut(),e.type===cn.Identifier&&M(":")?(S(),Object.prototype.hasOwnProperty.call(wn.labelSet,e.name)&&E({},dn.Redeclaration,"Label",e.name),wn.labelSet[e.name]=!0,t=Pt(),delete wn.labelSet[e.name],{type:cn.LabeledStatement,label:e,body:t}):(O(),{type:cn.ExpressionStatement,expression:e})}function _t(){var e,t,r,i,o,s,a,l,c=[];for(A("{");bn>mn&&(t=k(),t.type===an.StringLiteral)&&(e=Gt(),c.push(e),e.expression.type===cn.Literal);)r=n(t.range[0]+1,t.range[1]-1),"use strict"===r?(pn=!0,i&&L(i,dn.StrictOctalLiteral)):!i&&t.octal&&(i=t);for(o=wn.labelSet,s=wn.inIteration,a=wn.inSwitch,l=wn.inFunctionBody,wn.labelSet={},wn.inIteration=!1,wn.inSwitch=!1,wn.inFunctionBody=!0;bn>mn&&!M("}")&&(e=Gt(),"undefined"!=typeof e);)c.push(e);return A("}"),wn.labelSet=o,wn.inIteration=s,wn.inSwitch=a,wn.inFunctionBody=l,{type:cn.BlockStatement,body:c}}function Ft(){var e,t,n,r,i,o,s,a,l,c=[];if(D("function"),r=k(),e=ht(),pn?f(r.value)&&L(r,dn.StrictFunctionName):f(r.value)?(o=r,s=dn.StrictFunctionName):d(r.value)&&(o=r,s=dn.StrictReservedWord),A("("),!M(")"))for(l={};bn>mn&&(r=k(),t=ht(),pn?(f(r.value)&&(i=r,s=dn.StrictParamName),Object.prototype.hasOwnProperty.call(l,r.value)&&(i=r,s=dn.StrictParamDupe)):o||(f(r.value)?(o=r,s=dn.StrictParamName):d(r.value)?(o=r,s=dn.StrictReservedWord):Object.prototype.hasOwnProperty.call(l,r.value)&&(o=r,s=dn.StrictParamDupe)),c.push(t),l[t.name]=!0,!M(")"));)A(",");return A(")"),a=pn,n=_t(),pn&&o&&E(o,s),pn&&i&&L(i,s),pn=a,{type:cn.FunctionDeclaration,id:e,params:c,defaults:[],body:n,rest:null,generator:!1,expression:!1}}function Ht(){var e,t,n,r,i,o,s,a,l=null,c=[];if(D("function"),M("(")||(e=k(),l=ht(),pn?f(e.value)&&L(e,dn.StrictFunctionName):f(e.value)?(n=e,r=dn.StrictFunctionName):d(e.value)&&(n=e,r=dn.StrictReservedWord)),A("("),!M(")"))for(a={};bn>mn&&(e=k(),i=ht(),pn?(f(e.value)&&(t=e,r=dn.StrictParamName),Object.prototype.hasOwnProperty.call(a,e.value)&&(t=e,r=dn.StrictParamDupe)):n||(f(e.value)?(n=e,r=dn.StrictParamName):d(e.value)?(n=e,r=dn.StrictReservedWord):Object.prototype.hasOwnProperty.call(a,e.value)&&(n=e,r=dn.StrictParamDupe)),c.push(i),a[i.name]=!0,!M(")"));)A(",");return A(")"),s=pn,o=_t(),pn&&n&&E(n,r),pn&&t&&L(t,r),pn=s,{type:cn.FunctionExpression,id:l,params:c,defaults:[],body:o,rest:null,generator:!1,expression:!1}}function Gt(){var e=k();if(e.type===an.Keyword)switch(e.value){case"const":case"let":return vt(e.value);case"function":return Ft();default:return Pt()}return e.type!==an.EOF?Pt():void 0}function jt(){for(var e,t,r,i,o=[];bn>mn&&(t=k(),t.type===an.StringLiteral)&&(e=Gt(),o.push(e),e.expression.type===cn.Literal);)r=n(t.range[0]+1,t.range[1]-1),"use strict"===r?(pn=!0,i&&L(i,dn.StrictOctalLiteral)):!i&&t.octal&&(i=t);for(;bn>mn&&(e=Gt(),"undefined"!=typeof e);)o.push(e);return o}function Bt(){var e;return pn=!1,e={type:cn.Program,body:jt()}}function Rt(e,n,r,i,o){t("number"==typeof r,"Comment must have valid position"),xn.comments.length>0&&xn.comments[xn.comments.length-1].range[1]>r||xn.comments.push({type:e,value:n,range:[r,i],loc:o})
|
1088
|
-
}function zt(){var e,t,n,r,i,o;for(e="",i=!1,o=!1;bn>mn;)if(t=hn[mn],o)t=hn[mn++],a(t)?(n.end={line:gn,column:mn-vn-1},o=!1,Rt("Line",e,r,mn-1,n),"\r"===t&&"\n"===hn[mn]&&++mn,++gn,vn=mn,e=""):mn>=bn?(o=!1,e+=t,n.end={line:gn,column:bn-vn},Rt("Line",e,r,bn,n)):e+=t;else if(i)a(t)?("\r"===t&&"\n"===hn[mn+1]?(++mn,e+="\r\n"):e+=t,++gn,++mn,vn=mn,mn>=bn&&E({},dn.UnexpectedToken,"ILLEGAL")):(t=hn[mn++],mn>=bn&&E({},dn.UnexpectedToken,"ILLEGAL"),e+=t,"*"===t&&(t=hn[mn],"/"===t&&(e=e.substr(0,e.length-1),i=!1,++mn,n.end={line:gn,column:mn-vn},Rt("Block",e,r,mn,n),e="")));else if("/"===t)if(t=hn[mn+1],"/"===t)n={start:{line:gn,column:mn-vn}},r=mn,mn+=2,o=!0,mn>=bn&&(n.end={line:gn,column:mn-vn},o=!1,Rt("Line",e,r,mn,n));else{if("*"!==t)break;r=mn,mn+=2,i=!0,n={start:{line:gn,column:mn-vn-2}},mn>=bn&&E({},dn.UnexpectedToken,"ILLEGAL")}else if(s(t))++mn;else{if(!a(t))break;++mn,"\r"===t&&"\n"===hn[mn]&&++mn,++gn,vn=mn}}function Wt(){var e,t,n,r=[];for(e=0;xn.comments.length>e;++e)t=xn.comments[e],n={type:t.type,value:t.value},xn.range&&(n.range=t.range),xn.loc&&(n.loc=t.loc),r.push(n);xn.comments=r}function Vt(){var e,t,r,i,o;return p(),e=mn,t={start:{line:gn,column:mn-vn}},r=xn.advance(),t.end={line:gn,column:mn-vn},r.type!==an.EOF&&(i=[r.range[0],r.range[1]],o=n(r.range[0],r.range[1]),xn.tokens.push({type:ln[r.type],value:o,range:i,loc:t})),r}function Ut(){var e,t,n,r;return p(),e=mn,t={start:{line:gn,column:mn-vn}},n=xn.scanRegExp(),t.end={line:gn,column:mn-vn},xn.tokens.length>0&&(r=xn.tokens[xn.tokens.length-1],r.range[0]===e&&"Punctuator"===r.type&&("/"===r.value||"/="===r.value)&&xn.tokens.pop()),xn.tokens.push({type:"RegularExpression",value:n.literal,range:[e,mn],loc:t}),n}function qt(){var e,t,n,r=[];for(e=0;xn.tokens.length>e;++e)t=xn.tokens[e],n={type:t.type,value:t.value},xn.range&&(n.range=t.range),xn.loc&&(n.loc=t.loc),r.push(n);xn.tokens=r}function Kt(e){return{type:cn.Literal,value:e.value}}function Xt(e){return{type:cn.Literal,value:e.value,raw:n(e.range[0],e.range[1])}}function Jt(){var e={};return e.range=[mn,mn],e.loc={start:{line:gn,column:mn-vn},end:{line:gn,column:mn-vn}},e.end=function(){this.range[1]=mn,this.loc.end.line=gn,this.loc.end.column=mn-vn},e.applyGroup=function(e){xn.range&&(e.groupRange=[this.range[0],this.range[1]]),xn.loc&&(e.groupLoc={start:{line:this.loc.start.line,column:this.loc.start.column},end:{line:this.loc.end.line,column:this.loc.end.column}})},e.apply=function(e){xn.range&&(e.range=[this.range[0],this.range[1]]),xn.loc&&(e.loc={start:{line:this.loc.start.line,column:this.loc.start.column},end:{line:this.loc.end.line,column:this.loc.end.column}})},e}function Qt(){var e,t;return p(),e=Jt(),A("("),t=ut(),A(")"),e.end(),e.applyGroup(t),t}function Yt(){var e,t;for(p(),e=Jt(),t=I("new")?q():R();M(".")||M("[");)M("[")?(t={type:cn.MemberExpression,computed:!0,object:t,property:U()},e.end(),e.apply(t)):(t={type:cn.MemberExpression,computed:!1,object:t,property:V()},e.end(),e.apply(t));return t}function Zt(){var e,t;for(p(),e=Jt(),t=I("new")?q():R();M(".")||M("[")||M("(");)M("(")?(t={type:cn.CallExpression,callee:t,arguments:z()},e.end(),e.apply(t)):M("[")?(t={type:cn.MemberExpression,computed:!0,object:t,property:U()},e.end(),e.apply(t)):(t={type:cn.MemberExpression,computed:!1,object:t,property:V()},e.end(),e.apply(t));return t}function en(e){var t,n,r;t="[object Array]"===Object.prototype.toString.apply(e)?[]:{};for(n in e)e.hasOwnProperty(n)&&"groupRange"!==n&&"groupLoc"!==n&&(r=e[n],t[n]=null===r||"object"!=typeof r||r instanceof RegExp?r:en(r));return t}function tn(e,t){return function(n){function r(e){return e.type===cn.LogicalExpression||e.type===cn.BinaryExpression}function i(n){var o,s;r(n.left)&&i(n.left),r(n.right)&&i(n.right),e&&(n.left.groupRange||n.right.groupRange?(o=n.left.groupRange?n.left.groupRange[0]:n.left.range[0],s=n.right.groupRange?n.right.groupRange[1]:n.right.range[1],n.range=[o,s]):"undefined"==typeof n.range&&(o=n.left.range[0],s=n.right.range[1],n.range=[o,s])),t&&(n.left.groupLoc||n.right.groupLoc?(o=n.left.groupLoc?n.left.groupLoc.start:n.left.loc.start,s=n.right.groupLoc?n.right.groupLoc.end:n.right.loc.end,n.loc={start:o,end:s}):"undefined"==typeof n.loc&&(n.loc={start:n.left.loc.start,end:n.right.loc.end}))}return function(){var o,s;return p(),o=Jt(),s=n.apply(null,arguments),o.end(),e&&"undefined"==typeof s.range&&o.apply(s),t&&"undefined"==typeof s.loc&&o.apply(s),r(s)&&i(s),s}}}function nn(){var e;xn.comments&&(xn.skipComment=p,p=zt),xn.raw&&(xn.createLiteral=Kt,Kt=Xt),(xn.range||xn.loc)&&(xn.parseGroupExpression=B,xn.parseLeftHandSideExpression=X,xn.parseLeftHandSideExpressionAllowCall=K,B=Qt,X=Yt,K=Zt,e=tn(xn.range,xn.loc),xn.parseAdditiveExpression=Z,xn.parseAssignmentExpression=ct,xn.parseBitwiseANDExpression=rt,xn.parseBitwiseORExpression=ot,xn.parseBitwiseXORExpression=it,xn.parseBlock=ft,xn.parseFunctionSourceElements=_t,xn.parseCatchClause=It,xn.parseComputedMember=U,xn.parseConditionalExpression=lt,xn.parseConstLetDeclaration=vt,xn.parseEqualityExpression=nt,xn.parseExpression=ut,xn.parseForVariableDeclaration=St,xn.parseFunctionDeclaration=Ft,xn.parseFunctionExpression=Ht,xn.parseLogicalANDExpression=st,xn.parseLogicalORExpression=at,xn.parseMultiplicativeExpression=Y,xn.parseNewExpression=q,xn.parseNonComputedProperty=W,xn.parseObjectProperty=G,xn.parseObjectPropertyKey=H,xn.parsePostfixExpression=J,xn.parsePrimaryExpression=R,xn.parseProgram=Bt,xn.parsePropertyFunction=F,xn.parseRelationalExpression=tt,xn.parseStatement=Pt,xn.parseShiftExpression=et,xn.parseSwitchCase=At,xn.parseUnaryExpression=Q,xn.parseVariableDeclaration=pt,xn.parseVariableIdentifier=ht,Z=e(xn.parseAdditiveExpression),ct=e(xn.parseAssignmentExpression),rt=e(xn.parseBitwiseANDExpression),ot=e(xn.parseBitwiseORExpression),it=e(xn.parseBitwiseXORExpression),ft=e(xn.parseBlock),_t=e(xn.parseFunctionSourceElements),It=e(xn.parseCatchClause),U=e(xn.parseComputedMember),lt=e(xn.parseConditionalExpression),vt=e(xn.parseConstLetDeclaration),nt=e(xn.parseEqualityExpression),ut=e(xn.parseExpression),St=e(xn.parseForVariableDeclaration),Ft=e(xn.parseFunctionDeclaration),Ht=e(xn.parseFunctionExpression),X=e(X),st=e(xn.parseLogicalANDExpression),at=e(xn.parseLogicalORExpression),Y=e(xn.parseMultiplicativeExpression),q=e(xn.parseNewExpression),W=e(xn.parseNonComputedProperty),G=e(xn.parseObjectProperty),H=e(xn.parseObjectPropertyKey),J=e(xn.parsePostfixExpression),R=e(xn.parsePrimaryExpression),Bt=e(xn.parseProgram),F=e(xn.parsePropertyFunction),tt=e(xn.parseRelationalExpression),Pt=e(xn.parseStatement),et=e(xn.parseShiftExpression),At=e(xn.parseSwitchCase),Q=e(xn.parseUnaryExpression),pt=e(xn.parseVariableDeclaration),ht=e(xn.parseVariableIdentifier)),"undefined"!=typeof xn.tokens&&(xn.advance=C,xn.scanRegExp=w,C=Vt,w=Ut)}function rn(){"function"==typeof xn.skipComment&&(p=xn.skipComment),xn.raw&&(Kt=xn.createLiteral),(xn.range||xn.loc)&&(Z=xn.parseAdditiveExpression,ct=xn.parseAssignmentExpression,rt=xn.parseBitwiseANDExpression,ot=xn.parseBitwiseORExpression,it=xn.parseBitwiseXORExpression,ft=xn.parseBlock,_t=xn.parseFunctionSourceElements,It=xn.parseCatchClause,U=xn.parseComputedMember,lt=xn.parseConditionalExpression,vt=xn.parseConstLetDeclaration,nt=xn.parseEqualityExpression,ut=xn.parseExpression,St=xn.parseForVariableDeclaration,Ft=xn.parseFunctionDeclaration,Ht=xn.parseFunctionExpression,B=xn.parseGroupExpression,X=xn.parseLeftHandSideExpression,K=xn.parseLeftHandSideExpressionAllowCall,st=xn.parseLogicalANDExpression,at=xn.parseLogicalORExpression,Y=xn.parseMultiplicativeExpression,q=xn.parseNewExpression,W=xn.parseNonComputedProperty,G=xn.parseObjectProperty,H=xn.parseObjectPropertyKey,R=xn.parsePrimaryExpression,J=xn.parsePostfixExpression,Bt=xn.parseProgram,F=xn.parsePropertyFunction,tt=xn.parseRelationalExpression,Pt=xn.parseStatement,et=xn.parseShiftExpression,At=xn.parseSwitchCase,Q=xn.parseUnaryExpression,pt=xn.parseVariableDeclaration,ht=xn.parseVariableIdentifier),"function"==typeof xn.scanRegExp&&(C=xn.advance,w=xn.scanRegExp)}function on(e){var t,n=e.length,r=[];for(t=0;n>t;++t)r[t]=e.charAt(t);return r}function sn(e,t){var n,r;r=String,"string"==typeof e||e instanceof String||(e=r(e)),hn=e,mn=0,gn=hn.length>0?1:0,vn=0,bn=hn.length,yn=null,wn={allowIn:!0,labelSet:{},inFunctionBody:!1,inIteration:!1,inSwitch:!1},xn={},"undefined"!=typeof t&&(xn.range="boolean"==typeof t.range&&t.range,xn.loc="boolean"==typeof t.loc&&t.loc,xn.raw="boolean"==typeof t.raw&&t.raw,"boolean"==typeof t.tokens&&t.tokens&&(xn.tokens=[]),"boolean"==typeof t.comment&&t.comment&&(xn.comments=[]),"boolean"==typeof t.tolerant&&t.tolerant&&(xn.errors=[])),bn>0&&"undefined"==typeof hn[0]&&(e instanceof String&&(hn=e.valueOf()),"undefined"==typeof hn[0]&&(hn=on(e))),nn();try{n=Bt(),"undefined"!=typeof xn.comments&&(Wt(),n.comments=xn.comments),"undefined"!=typeof xn.tokens&&(qt(),n.tokens=xn.tokens),"undefined"!=typeof xn.errors&&(n.errors=xn.errors),(xn.range||xn.loc)&&(n.body=en(n.body))}catch(i){throw i}finally{rn(),xn={}}return n}var an,ln,cn,un,dn,fn,hn,pn,mn,gn,vn,bn,yn,wn,xn;an={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8},ln={},ln[an.BooleanLiteral]="Boolean",ln[an.EOF]="<end>",ln[an.Identifier]="Identifier",ln[an.Keyword]="Keyword",ln[an.NullLiteral]="Null",ln[an.NumericLiteral]="Numeric",ln[an.Punctuator]="Punctuator",ln[an.StringLiteral]="String",cn={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement"},un={Data:1,Get:2,Set:4},dn={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictDuplicateProperty:"Duplicate data property in object literal not allowed in strict mode",AccessorDataProperty:"Object literal may not have data and accessor property with the same name",AccessorGetSet:"Object literal may not have multiple get/set accessors with the same name",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode"},fn={NonAsciiIdentifierStart:new RegExp("[\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]"),NonAsciiIdentifierPart:new RegExp("[\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0963\u0966-\u096f\u0971-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09e6-\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772\u1773\u1780-\u17d3\u17d7\u17dc\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19d9\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1cd0-\u1cd2\u1cd4-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u200c\u200d\u203f\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u2e2f\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua697\ua69f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua827\ua840-\ua873\ua880-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua900-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a\uaa7b\uaa80-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabea\uabec\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]")},"undefined"==typeof"esprima"[0]&&(n=function(e,t){return hn.slice(e,t).join("")}),e.version="1.0.1",e.parse=sn,e.Syntax=function(){var e,t={};"function"==typeof Object.create&&(t=Object.create(null));for(e in cn)cn.hasOwnProperty(e)&&(t[e]=cn[e]);return"function"==typeof Object.freeze&&Object.freeze(t),t}()}),function(){function e(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),void 0):(e.attachEvent("on"+t,n),void 0)}function t(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return b[e.which]?b[e.which]:y[e.which]?y[e.which]:String.fromCharCode(e.which).toLowerCase()}function n(e,t){return e.sort().join(",")===t.sort().join(",")}function r(e,t){e=e||{};var n,r=!1;for(n in k)e[n]&&k[n]>t?r=!0:k[n]=0;r||(E=!1)}function i(e,t,r,i,o){var s,a,l=[],u=r.type;if(!C[e])return[];for("keyup"==u&&c(e)&&(t=[e]),s=0;C[e].length>s;++s)a=C[e][s],a.seq&&k[a.seq]!=a.level||u==a.action&&("keypress"==u&&!r.metaKey&&!r.ctrlKey||n(t,a.modifiers))&&(i&&a.combo==o&&C[e].splice(s,1),l.push(a));return l}function o(e){var t=[];return e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t}function s(e,t,n){N.stopCallback(t,t.target||t.srcElement,n)||e(t,n)===!1&&(t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.returnValue=!1,t.cancelBubble=!0)}function a(e,t){var n,a=i(e,o(t),t),l={},u=0,d=!1;for(n=0;a.length>n;++n)a[n].seq?(d=!0,u=Math.max(u,a[n].level),l[a[n].seq]=1,s(a[n].callback,t,a[n].combo)):d||E||s(a[n].callback,t,a[n].combo);t.type!=E||c(e)||r(l,u)}function l(e){"number"!=typeof e.which&&(e.which=e.keyCode);var n=t(e);if(n)return"keyup"==e.type&&T==n?(T=!1,void 0):(a(n,e),void 0)}function c(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function u(){clearTimeout(v),v=setTimeout(r,1e3)}function d(){if(!g){g={};for(var e in b)e>95&&112>e||b.hasOwnProperty(e)&&(g[b[e]]=e)}return g}function f(e,t,n){return n||(n=d()[e]?"keydown":"keypress"),"keypress"==n&&t.length&&(n="keydown"),n}function h(e,n,i,o){k[e]=0,o||(o=f(n[0],[]));var a,l=function(){E=o,++k[e],u()},c=function(n){s(i,n,e),"keyup"!==o&&(T=t(n)),setTimeout(r,10)};for(a=0;n.length>a;++a)p(n[a],n.length-1>a?l:c,o,e,a)}function p(e,t,n,r,o){S[e+":"+n]=t,e=e.replace(/\s+/g," ");var s,a,l,u=e.split(" "),d=[];if(u.length>1)return h(e,u,t,n),void 0;for(l="+"===e?["+"]:e.split("+"),s=0;l.length>s;++s)a=l[s],x[a]&&(a=x[a]),n&&"keypress"!=n&&w[a]&&(a=w[a],d.push("shift")),c(a)&&d.push(a);n=f(a,d,n),C[a]||(C[a]=[]),i(a,d,{type:n},!r,e),C[a][r?"unshift":"push"]({callback:t,modifiers:d,action:n,seq:r,level:o,combo:e})}function m(e,t,n){for(var r=0;e.length>r;++r)p(e[r],t,n)}for(var g,v,b={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},y={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},w={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},x={option:"alt",command:"meta","return":"enter",escape:"esc"},C={},S={},k={},T=!1,E=!1,L=1;20>L;++L)b[111+L]="f"+L;for(L=0;9>=L;++L)b[L+96]=L;e(document,"keypress",l),e(document,"keydown",l),e(document,"keyup",l);var N={bind:function(e,t,n){return e=e instanceof Array?e:[e],m(e,t,n),this},unbind:function(e,t){return N.bind(e,function(){},t)},trigger:function(e,t){return S[e+":"+t]&&S[e+":"+t]({},e),this},reset:function(){return C={},S={},this},stopCallback:function(e,t){return(" "+t.className+" ").indexOf(" mousetrap ")>-1?!1:"INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.contentEditable&&"true"==t.contentEditable}};window.Mousetrap=N,"function"==typeof define&&define.amd&&define(N)}();var Hogan={};(function(e,t){function n(e,t,n){var r;return t&&"object"==typeof t&&(null!=t[e]?r=t[e]:n&&t.get&&"function"==typeof t.get&&(r=t.get(e))),r}function r(e,t,n,r){function i(){}function o(){}i.prototype=e,o.prototype=e.subs;var s,a=new i;a.subs=new o,a.subsText={},a.ib();for(s in t)a.subs[s]=t[s],a.subsText[s]=r;for(s in n)a.partials[s]=n[s];return a}function i(e){return String(null===e||void 0===e?"":e)}function o(e){return e=i(e),d.test(e)?e.replace(s,"&").replace(a,"<").replace(l,">").replace(c,"'").replace(u,"""):e}e.Template=function(e,t,n,r){e=e||{},this.r=e.code||this.r,this.c=n,this.options=r||{},this.text=t||"",this.partials=e.partials||{},this.subs=e.subs||{},this.ib()},e.Template.prototype={r:function(){return""},v:o,t:i,render:function(e,t,n){return this.ri([e],t||{},n)},ri:function(e,t,n){return this.r(e,t,n)},ep:function(e,t){var n=this.partials[e],i=t[n.name];if(n.instance&&n.base==i)return n.instance;if("string"==typeof i){if(!this.c)throw new Error("No compiler available.");i=this.c.compile(i,this.options)}return i?(this.partials[e].base=i,n.subs&&(void 0===this.activeSub&&(t.stackText=this.text),i=r(i,n.subs,n.partials,t.stackText||this.text)),this.partials[e].instance=i,i):null},rp:function(e,t,n,r){var i=this.ep(e,n);return i?i.ri(t,n,r):""},rs:function(e,t,n){var r=e[e.length-1];if(!f(r))return n(e,t,this),void 0;for(var i=0;r.length>i;i++)e.push(r[i]),n(e,t,this),e.pop()},s:function(e,t,n,r,i,o,s){var a;return f(e)&&0===e.length?!1:("function"==typeof e&&(e=this.ms(e,t,n,r,i,o,s)),a=!!e,!r&&a&&t&&t.push("object"==typeof e?e:t[t.length-1]),a)},d:function(e,t,r,i){var o,s=e.split("."),a=this.f(s[0],t,r,i),l=this.options.modelGet,c=null;if("."===e&&f(t[t.length-2]))a=t[t.length-1];else for(var u=1;s.length>u;u++)o=n(s[u],a,l),null!=o?(c=a,a=o):a="";return i&&!a?!1:(i||"function"!=typeof a||(t.push(c),a=this.mv(a,t,r),t.pop()),a)},f:function(e,t,r,i){for(var o=!1,s=null,a=!1,l=this.options.modelGet,c=t.length-1;c>=0;c--)if(s=t[c],o=n(e,s,l),null!=o){a=!0;break}return a?(i||"function"!=typeof o||(o=this.mv(o,t,r)),o):i?!1:""},ls:function(e,t,n,r,o){var s=this.options.delimiters;return this.options.delimiters=o,this.b(this.ct(i(e.call(t,r)),t,n)),this.options.delimiters=s,!1},ct:function(e,t,n){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(t,n)},b:t?function(e){this.buf.push(e)}:function(e){this.buf+=e},fl:t?function(){var e=this.buf.join("");return this.buf=[],e}:function(){var e=this.buf;return this.buf="",e},ib:function(){this.buf=t?[]:""},ms:function(e,t,n,r,i,o,s){var a,l=t[t.length-1],c=e.call(l);return"function"==typeof c?r?!0:(a=this.activeSub&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(c,l,n,a.substring(i,o),s)):c},mv:function(e,t,n){var r=t[t.length-1],o=e.call(r);return"function"==typeof o?this.ct(i(o.call(r)),r,n):o},sub:function(e,t,n,r){var i=this.subs[e];i&&(this.activeSub=e,i(t,n,this,r),this.activeSub=!1)}};var s=/&/g,a=/</g,l=/>/g,c=/\'/g,u=/\"/g,d=/[&<>\"\']/,f=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}})("undefined"!=typeof exports?exports:Hogan),jQuery.tablesorter.addParser({id:"size",is:function(e){return e.trim().match(/^\d+(\.\d+)? (Bytes|KB|MB|GB|TB|PB)$/)},format:function(e){var t=["Bytes","KB","MB","GB","TB","PB"],n=e.trim().split(" ");return parseFloat(n.shift())*Math.pow(1024,_.indexOf(t,n.shift()))},type:"numeric"}),window.Genghis={Models:{},Collections:{},Views:{},Templates:{},defaults:{codeMirror:{mode:"application/json",lineNumbers:!0,tabSize:4,indentUnit:4,matchBrackets:!0}},boot:function(e){e+="/"==e.charAt(e.length-1)?"":"/",window.app=new Genghis.Views.App({baseUrl:e}),Backbone.history.start({pushState:!0,root:e})}},Genghis.version="2.3.3",Genghis.Templates.Alert=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b('<div class="alert'),r.s(r.f("block",e,t,1),e,t,0,29,41,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" alert-block")}),e.pop()),r.b(" alert-"),r.b(r.v(r.f("level",e,t,0))),r.b('">'),r.b("\n"+n),r.b(' <a class="close" href="#">×</a>'),r.b("\n"+n),r.s(r.f("block",e,t,1),e,t,0,132,164,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" <p>"),n.b(n.t(n.f("msg",e,t,0))),n.b("</p>"),n.b("\n")}),e.pop()),r.s(r.f("block",e,t,1),e,t,1,0,0,"")||(r.b(" "),r.b(r.t(r.f("msg",e,t,0))),r.b("\n")),r.b("</div>"),r.fl()}}),Genghis.Templates.CollectionRow=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b("<td>"),r.b("\n"+n),r.b(' <a href="'),r.b(r.v(r.f("url",e,t,0))),r.b('" class="name value">'),r.b(r.v(r.f("name",e,t,0))),r.b("</a>"),r.b("\n"+n),r.b("</td>"),r.b("\n"+n),r.b("<td>"),r.b("\n"+n),r.b(' <span class="documents value">'),r.b(r.v(r.f("count",e,t,0))),r.b("</span>"),r.b("\n"+n),r.b("</td>"),r.b("\n"+n),r.b("<td>"),r.b("\n"+n),r.b(' <span class="indexes has-details value">'),r.b(r.v(r.f("indexCount",e,t,0))),r.b("</span>"),r.b("\n"+n),r.b(' <div class="details" title="'),r.b(r.v(r.f("indexCount",e,t,0))),r.b(" Index"),r.s(r.f("indexesIsPlural",e,t,1),e,t,0,282,284,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b("es")}),e.pop()),r.b('">'),r.b("\n"+n),r.s(r.f("indexCount",e,t,1),e,t,0,334,501,"{{ }}")&&(r.rs(e,t,function(e,t,r){r.b(' <ul class="index-details">'),r.b("\n"+n),r.s(r.f("indexes",e,t,1),e,t,0,404,460,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" <li>"),n.b(n.t(n.d(".",e,t,0))),n.b("</li>"),n.b("\n")}),e.pop()),r.b(" </ul>"),r.b("\n")}),e.pop()),r.s(r.f("indexCount",e,t,1),e,t,1,0,0,"")||(r.b(" <em>None.</em>"),r.b("\n")),r.b(" </div>"),r.b("\n"+n),r.b("</td>"),r.b("\n"+n),r.b("<td>"),r.b("\n"+n),r.b(' <span class="size has-details value">'),r.b(r.v(r.f("humanSize",e,t,0))),r.b("</span>"),r.b("\n"+n),r.b(' <div class="details" title="Collection Stats">'),r.b("\n"+n),r.b(' <dl class="stats-details">'),r.b("\n"+n),r.s(r.f("stats",e,t,1),e,t,0,794,881,"{{ }}")&&(r.rs(e,t,function(e,t,r){r.b(" <dt>"),r.b(r.v(r.f("name",e,t,0))),r.b("</dt>"),r.b("\n"+n),r.b(" <dd>"),r.b(r.v(r.f("value",e,t,0))),r.b("</dd>"),r.b("\n")}),e.pop()),r.b(" </dl>"),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b("</td>"),r.b("\n"+n),r.b('<td class="action-column">'),r.b("\n"+n),r.b(' <button class="btn btn-mini btn-danger destroy">Remove</button>'),r.b("\n"+n),r.b("</td>"),r.b("\n"),r.fl()}}),Genghis.Templates.Collections=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b("<header><h2>"),r.b(r.v(r.f("title",e,t,0))),r.b("</h2></header>"),r.b("\n"+n),r.b('<div class="content">'),r.b("\n"+n),r.b(" <table>"),r.b("\n"+n),r.b(" <thead>"),r.b("\n"+n),r.b(" <tr>"),r.b("\n"+n),r.b(" <th>name</th>"),r.b("\n"+n),r.b(" <th>documents</th>"),r.b("\n"+n),r.b(" <th>indexes</th>"),r.b("\n"+n),r.b(" <th>size</th>"),r.b("\n"+n),r.b(' <th data-sorter="false"></th>'),r.b("\n"+n),r.b(" </tr>"),r.b("\n"+n),r.b(" </thead>"),r.b("\n"+n),r.b(" <tbody>"),r.b("\n"+n),r.b(" </tbody>"),r.b("\n"+n),r.b(" </table>"),r.b("\n"+n),r.b("</div>"),r.b("\n"+n),r.b('<div class="add-form inactive form-horizontal">'),r.b("\n"+n),r.b(' <input class="name span4" type="text" size="30">'),r.b("\n"+n),r.b(' <div class="btn-group">'),r.b("\n"+n),r.b(' <button class="show btn">Add collection</button>'),r.b("\n"+n),r.b(' <button class="btn dropdown-toggle" data-toggle="dropdown">'),r.b("\n"+n),r.b(' <span class="caret"></span>'),r.b("\n"+n),r.b(" </button>"),r.b("\n"+n),r.b(' <ul class="dropdown-menu">'),r.b("\n"+n),r.b(' <li><a class="show" href="#">Add collection</a></li>'),r.b("\n"+n),r.b(' <li><a class="show show-gridfs" href="#">Add GridFS collection</a></li>'),r.b("\n"+n),r.b(" </ul>"),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b("\n"+n),r.b(' <button class="add btn btn-primary">Add collection</button>'),r.b("\n"+n),r.b(' <button class="cancel btn">Cancel</button>'),r.b("\n"+n),r.b("</div>"),r.b("\n"),r.fl()
|
1088
|
+
}function zt(){var e,t,n,r,i,o;for(e="",i=!1,o=!1;bn>mn;)if(t=hn[mn],o)t=hn[mn++],a(t)?(n.end={line:gn,column:mn-vn-1},o=!1,Rt("Line",e,r,mn-1,n),"\r"===t&&"\n"===hn[mn]&&++mn,++gn,vn=mn,e=""):mn>=bn?(o=!1,e+=t,n.end={line:gn,column:bn-vn},Rt("Line",e,r,bn,n)):e+=t;else if(i)a(t)?("\r"===t&&"\n"===hn[mn+1]?(++mn,e+="\r\n"):e+=t,++gn,++mn,vn=mn,mn>=bn&&E({},dn.UnexpectedToken,"ILLEGAL")):(t=hn[mn++],mn>=bn&&E({},dn.UnexpectedToken,"ILLEGAL"),e+=t,"*"===t&&(t=hn[mn],"/"===t&&(e=e.substr(0,e.length-1),i=!1,++mn,n.end={line:gn,column:mn-vn},Rt("Block",e,r,mn,n),e="")));else if("/"===t)if(t=hn[mn+1],"/"===t)n={start:{line:gn,column:mn-vn}},r=mn,mn+=2,o=!0,mn>=bn&&(n.end={line:gn,column:mn-vn},o=!1,Rt("Line",e,r,mn,n));else{if("*"!==t)break;r=mn,mn+=2,i=!0,n={start:{line:gn,column:mn-vn-2}},mn>=bn&&E({},dn.UnexpectedToken,"ILLEGAL")}else if(s(t))++mn;else{if(!a(t))break;++mn,"\r"===t&&"\n"===hn[mn]&&++mn,++gn,vn=mn}}function Wt(){var e,t,n,r=[];for(e=0;xn.comments.length>e;++e)t=xn.comments[e],n={type:t.type,value:t.value},xn.range&&(n.range=t.range),xn.loc&&(n.loc=t.loc),r.push(n);xn.comments=r}function Vt(){var e,t,r,i,o;return p(),e=mn,t={start:{line:gn,column:mn-vn}},r=xn.advance(),t.end={line:gn,column:mn-vn},r.type!==an.EOF&&(i=[r.range[0],r.range[1]],o=n(r.range[0],r.range[1]),xn.tokens.push({type:ln[r.type],value:o,range:i,loc:t})),r}function Ut(){var e,t,n,r;return p(),e=mn,t={start:{line:gn,column:mn-vn}},n=xn.scanRegExp(),t.end={line:gn,column:mn-vn},xn.tokens.length>0&&(r=xn.tokens[xn.tokens.length-1],r.range[0]===e&&"Punctuator"===r.type&&("/"===r.value||"/="===r.value)&&xn.tokens.pop()),xn.tokens.push({type:"RegularExpression",value:n.literal,range:[e,mn],loc:t}),n}function qt(){var e,t,n,r=[];for(e=0;xn.tokens.length>e;++e)t=xn.tokens[e],n={type:t.type,value:t.value},xn.range&&(n.range=t.range),xn.loc&&(n.loc=t.loc),r.push(n);xn.tokens=r}function Kt(e){return{type:cn.Literal,value:e.value}}function Xt(e){return{type:cn.Literal,value:e.value,raw:n(e.range[0],e.range[1])}}function Jt(){var e={};return e.range=[mn,mn],e.loc={start:{line:gn,column:mn-vn},end:{line:gn,column:mn-vn}},e.end=function(){this.range[1]=mn,this.loc.end.line=gn,this.loc.end.column=mn-vn},e.applyGroup=function(e){xn.range&&(e.groupRange=[this.range[0],this.range[1]]),xn.loc&&(e.groupLoc={start:{line:this.loc.start.line,column:this.loc.start.column},end:{line:this.loc.end.line,column:this.loc.end.column}})},e.apply=function(e){xn.range&&(e.range=[this.range[0],this.range[1]]),xn.loc&&(e.loc={start:{line:this.loc.start.line,column:this.loc.start.column},end:{line:this.loc.end.line,column:this.loc.end.column}})},e}function Qt(){var e,t;return p(),e=Jt(),A("("),t=ut(),A(")"),e.end(),e.applyGroup(t),t}function Yt(){var e,t;for(p(),e=Jt(),t=I("new")?q():R();M(".")||M("[");)M("[")?(t={type:cn.MemberExpression,computed:!0,object:t,property:U()},e.end(),e.apply(t)):(t={type:cn.MemberExpression,computed:!1,object:t,property:V()},e.end(),e.apply(t));return t}function Zt(){var e,t;for(p(),e=Jt(),t=I("new")?q():R();M(".")||M("[")||M("(");)M("(")?(t={type:cn.CallExpression,callee:t,arguments:z()},e.end(),e.apply(t)):M("[")?(t={type:cn.MemberExpression,computed:!0,object:t,property:U()},e.end(),e.apply(t)):(t={type:cn.MemberExpression,computed:!1,object:t,property:V()},e.end(),e.apply(t));return t}function en(e){var t,n,r;t="[object Array]"===Object.prototype.toString.apply(e)?[]:{};for(n in e)e.hasOwnProperty(n)&&"groupRange"!==n&&"groupLoc"!==n&&(r=e[n],t[n]=null===r||"object"!=typeof r||r instanceof RegExp?r:en(r));return t}function tn(e,t){return function(n){function r(e){return e.type===cn.LogicalExpression||e.type===cn.BinaryExpression}function i(n){var o,s;r(n.left)&&i(n.left),r(n.right)&&i(n.right),e&&(n.left.groupRange||n.right.groupRange?(o=n.left.groupRange?n.left.groupRange[0]:n.left.range[0],s=n.right.groupRange?n.right.groupRange[1]:n.right.range[1],n.range=[o,s]):"undefined"==typeof n.range&&(o=n.left.range[0],s=n.right.range[1],n.range=[o,s])),t&&(n.left.groupLoc||n.right.groupLoc?(o=n.left.groupLoc?n.left.groupLoc.start:n.left.loc.start,s=n.right.groupLoc?n.right.groupLoc.end:n.right.loc.end,n.loc={start:o,end:s}):"undefined"==typeof n.loc&&(n.loc={start:n.left.loc.start,end:n.right.loc.end}))}return function(){var o,s;return p(),o=Jt(),s=n.apply(null,arguments),o.end(),e&&"undefined"==typeof s.range&&o.apply(s),t&&"undefined"==typeof s.loc&&o.apply(s),r(s)&&i(s),s}}}function nn(){var e;xn.comments&&(xn.skipComment=p,p=zt),xn.raw&&(xn.createLiteral=Kt,Kt=Xt),(xn.range||xn.loc)&&(xn.parseGroupExpression=B,xn.parseLeftHandSideExpression=X,xn.parseLeftHandSideExpressionAllowCall=K,B=Qt,X=Yt,K=Zt,e=tn(xn.range,xn.loc),xn.parseAdditiveExpression=Z,xn.parseAssignmentExpression=ct,xn.parseBitwiseANDExpression=rt,xn.parseBitwiseORExpression=ot,xn.parseBitwiseXORExpression=it,xn.parseBlock=ft,xn.parseFunctionSourceElements=_t,xn.parseCatchClause=It,xn.parseComputedMember=U,xn.parseConditionalExpression=lt,xn.parseConstLetDeclaration=vt,xn.parseEqualityExpression=nt,xn.parseExpression=ut,xn.parseForVariableDeclaration=St,xn.parseFunctionDeclaration=Ft,xn.parseFunctionExpression=Ht,xn.parseLogicalANDExpression=st,xn.parseLogicalORExpression=at,xn.parseMultiplicativeExpression=Y,xn.parseNewExpression=q,xn.parseNonComputedProperty=W,xn.parseObjectProperty=G,xn.parseObjectPropertyKey=H,xn.parsePostfixExpression=J,xn.parsePrimaryExpression=R,xn.parseProgram=Bt,xn.parsePropertyFunction=F,xn.parseRelationalExpression=tt,xn.parseStatement=Pt,xn.parseShiftExpression=et,xn.parseSwitchCase=At,xn.parseUnaryExpression=Q,xn.parseVariableDeclaration=pt,xn.parseVariableIdentifier=ht,Z=e(xn.parseAdditiveExpression),ct=e(xn.parseAssignmentExpression),rt=e(xn.parseBitwiseANDExpression),ot=e(xn.parseBitwiseORExpression),it=e(xn.parseBitwiseXORExpression),ft=e(xn.parseBlock),_t=e(xn.parseFunctionSourceElements),It=e(xn.parseCatchClause),U=e(xn.parseComputedMember),lt=e(xn.parseConditionalExpression),vt=e(xn.parseConstLetDeclaration),nt=e(xn.parseEqualityExpression),ut=e(xn.parseExpression),St=e(xn.parseForVariableDeclaration),Ft=e(xn.parseFunctionDeclaration),Ht=e(xn.parseFunctionExpression),X=e(X),st=e(xn.parseLogicalANDExpression),at=e(xn.parseLogicalORExpression),Y=e(xn.parseMultiplicativeExpression),q=e(xn.parseNewExpression),W=e(xn.parseNonComputedProperty),G=e(xn.parseObjectProperty),H=e(xn.parseObjectPropertyKey),J=e(xn.parsePostfixExpression),R=e(xn.parsePrimaryExpression),Bt=e(xn.parseProgram),F=e(xn.parsePropertyFunction),tt=e(xn.parseRelationalExpression),Pt=e(xn.parseStatement),et=e(xn.parseShiftExpression),At=e(xn.parseSwitchCase),Q=e(xn.parseUnaryExpression),pt=e(xn.parseVariableDeclaration),ht=e(xn.parseVariableIdentifier)),"undefined"!=typeof xn.tokens&&(xn.advance=C,xn.scanRegExp=w,C=Vt,w=Ut)}function rn(){"function"==typeof xn.skipComment&&(p=xn.skipComment),xn.raw&&(Kt=xn.createLiteral),(xn.range||xn.loc)&&(Z=xn.parseAdditiveExpression,ct=xn.parseAssignmentExpression,rt=xn.parseBitwiseANDExpression,ot=xn.parseBitwiseORExpression,it=xn.parseBitwiseXORExpression,ft=xn.parseBlock,_t=xn.parseFunctionSourceElements,It=xn.parseCatchClause,U=xn.parseComputedMember,lt=xn.parseConditionalExpression,vt=xn.parseConstLetDeclaration,nt=xn.parseEqualityExpression,ut=xn.parseExpression,St=xn.parseForVariableDeclaration,Ft=xn.parseFunctionDeclaration,Ht=xn.parseFunctionExpression,B=xn.parseGroupExpression,X=xn.parseLeftHandSideExpression,K=xn.parseLeftHandSideExpressionAllowCall,st=xn.parseLogicalANDExpression,at=xn.parseLogicalORExpression,Y=xn.parseMultiplicativeExpression,q=xn.parseNewExpression,W=xn.parseNonComputedProperty,G=xn.parseObjectProperty,H=xn.parseObjectPropertyKey,R=xn.parsePrimaryExpression,J=xn.parsePostfixExpression,Bt=xn.parseProgram,F=xn.parsePropertyFunction,tt=xn.parseRelationalExpression,Pt=xn.parseStatement,et=xn.parseShiftExpression,At=xn.parseSwitchCase,Q=xn.parseUnaryExpression,pt=xn.parseVariableDeclaration,ht=xn.parseVariableIdentifier),"function"==typeof xn.scanRegExp&&(C=xn.advance,w=xn.scanRegExp)}function on(e){var t,n=e.length,r=[];for(t=0;n>t;++t)r[t]=e.charAt(t);return r}function sn(e,t){var n,r;r=String,"string"==typeof e||e instanceof String||(e=r(e)),hn=e,mn=0,gn=hn.length>0?1:0,vn=0,bn=hn.length,yn=null,wn={allowIn:!0,labelSet:{},inFunctionBody:!1,inIteration:!1,inSwitch:!1},xn={},"undefined"!=typeof t&&(xn.range="boolean"==typeof t.range&&t.range,xn.loc="boolean"==typeof t.loc&&t.loc,xn.raw="boolean"==typeof t.raw&&t.raw,"boolean"==typeof t.tokens&&t.tokens&&(xn.tokens=[]),"boolean"==typeof t.comment&&t.comment&&(xn.comments=[]),"boolean"==typeof t.tolerant&&t.tolerant&&(xn.errors=[])),bn>0&&"undefined"==typeof hn[0]&&(e instanceof String&&(hn=e.valueOf()),"undefined"==typeof hn[0]&&(hn=on(e))),nn();try{n=Bt(),"undefined"!=typeof xn.comments&&(Wt(),n.comments=xn.comments),"undefined"!=typeof xn.tokens&&(qt(),n.tokens=xn.tokens),"undefined"!=typeof xn.errors&&(n.errors=xn.errors),(xn.range||xn.loc)&&(n.body=en(n.body))}catch(i){throw i}finally{rn(),xn={}}return n}var an,ln,cn,un,dn,fn,hn,pn,mn,gn,vn,bn,yn,wn,xn;an={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8},ln={},ln[an.BooleanLiteral]="Boolean",ln[an.EOF]="<end>",ln[an.Identifier]="Identifier",ln[an.Keyword]="Keyword",ln[an.NullLiteral]="Null",ln[an.NumericLiteral]="Numeric",ln[an.Punctuator]="Punctuator",ln[an.StringLiteral]="String",cn={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement"},un={Data:1,Get:2,Set:4},dn={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictDuplicateProperty:"Duplicate data property in object literal not allowed in strict mode",AccessorDataProperty:"Object literal may not have data and accessor property with the same name",AccessorGetSet:"Object literal may not have multiple get/set accessors with the same name",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode"},fn={NonAsciiIdentifierStart:new RegExp("[\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]"),NonAsciiIdentifierPart:new RegExp("[\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0963\u0966-\u096f\u0971-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09e6-\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772\u1773\u1780-\u17d3\u17d7\u17dc\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19d9\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1cd0-\u1cd2\u1cd4-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u200c\u200d\u203f\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u2e2f\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua697\ua69f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua827\ua840-\ua873\ua880-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua900-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a\uaa7b\uaa80-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabea\uabec\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]")},"undefined"==typeof"esprima"[0]&&(n=function(e,t){return hn.slice(e,t).join("")}),e.version="1.0.1",e.parse=sn,e.Syntax=function(){var e,t={};"function"==typeof Object.create&&(t=Object.create(null));for(e in cn)cn.hasOwnProperty(e)&&(t[e]=cn[e]);return"function"==typeof Object.freeze&&Object.freeze(t),t}()}),function(){function e(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),void 0):(e.attachEvent("on"+t,n),void 0)}function t(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return b[e.which]?b[e.which]:y[e.which]?y[e.which]:String.fromCharCode(e.which).toLowerCase()}function n(e,t){return e.sort().join(",")===t.sort().join(",")}function r(e,t){e=e||{};var n,r=!1;for(n in k)e[n]&&k[n]>t?r=!0:k[n]=0;r||(E=!1)}function i(e,t,r,i,o){var s,a,l=[],u=r.type;if(!C[e])return[];for("keyup"==u&&c(e)&&(t=[e]),s=0;C[e].length>s;++s)a=C[e][s],a.seq&&k[a.seq]!=a.level||u==a.action&&("keypress"==u&&!r.metaKey&&!r.ctrlKey||n(t,a.modifiers))&&(i&&a.combo==o&&C[e].splice(s,1),l.push(a));return l}function o(e){var t=[];return e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t}function s(e,t,n){N.stopCallback(t,t.target||t.srcElement,n)||e(t,n)===!1&&(t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.returnValue=!1,t.cancelBubble=!0)}function a(e,t){var n,a=i(e,o(t),t),l={},u=0,d=!1;for(n=0;a.length>n;++n)a[n].seq?(d=!0,u=Math.max(u,a[n].level),l[a[n].seq]=1,s(a[n].callback,t,a[n].combo)):d||E||s(a[n].callback,t,a[n].combo);t.type!=E||c(e)||r(l,u)}function l(e){"number"!=typeof e.which&&(e.which=e.keyCode);var n=t(e);if(n)return"keyup"==e.type&&T==n?(T=!1,void 0):(a(n,e),void 0)}function c(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function u(){clearTimeout(v),v=setTimeout(r,1e3)}function d(){if(!g){g={};for(var e in b)e>95&&112>e||b.hasOwnProperty(e)&&(g[b[e]]=e)}return g}function f(e,t,n){return n||(n=d()[e]?"keydown":"keypress"),"keypress"==n&&t.length&&(n="keydown"),n}function h(e,n,i,o){k[e]=0,o||(o=f(n[0],[]));var a,l=function(){E=o,++k[e],u()},c=function(n){s(i,n,e),"keyup"!==o&&(T=t(n)),setTimeout(r,10)};for(a=0;n.length>a;++a)p(n[a],n.length-1>a?l:c,o,e,a)}function p(e,t,n,r,o){S[e+":"+n]=t,e=e.replace(/\s+/g," ");var s,a,l,u=e.split(" "),d=[];if(u.length>1)return h(e,u,t,n),void 0;for(l="+"===e?["+"]:e.split("+"),s=0;l.length>s;++s)a=l[s],x[a]&&(a=x[a]),n&&"keypress"!=n&&w[a]&&(a=w[a],d.push("shift")),c(a)&&d.push(a);n=f(a,d,n),C[a]||(C[a]=[]),i(a,d,{type:n},!r,e),C[a][r?"unshift":"push"]({callback:t,modifiers:d,action:n,seq:r,level:o,combo:e})}function m(e,t,n){for(var r=0;e.length>r;++r)p(e[r],t,n)}for(var g,v,b={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},y={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},w={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},x={option:"alt",command:"meta","return":"enter",escape:"esc"},C={},S={},k={},T=!1,E=!1,L=1;20>L;++L)b[111+L]="f"+L;for(L=0;9>=L;++L)b[L+96]=L;e(document,"keypress",l),e(document,"keydown",l),e(document,"keyup",l);var N={bind:function(e,t,n){return e=e instanceof Array?e:[e],m(e,t,n),this},unbind:function(e,t){return N.bind(e,function(){},t)},trigger:function(e,t){return S[e+":"+t]&&S[e+":"+t]({},e),this},reset:function(){return C={},S={},this},stopCallback:function(e,t){return(" "+t.className+" ").indexOf(" mousetrap ")>-1?!1:"INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.contentEditable&&"true"==t.contentEditable}};window.Mousetrap=N,"function"==typeof define&&define.amd&&define(N)}();var Hogan={};(function(e,t){function n(e,t,n){var r;return t&&"object"==typeof t&&(null!=t[e]?r=t[e]:n&&t.get&&"function"==typeof t.get&&(r=t.get(e))),r}function r(e,t,n,r){function i(){}function o(){}i.prototype=e,o.prototype=e.subs;var s,a=new i;a.subs=new o,a.subsText={},a.ib();for(s in t)a.subs[s]=t[s],a.subsText[s]=r;for(s in n)a.partials[s]=n[s];return a}function i(e){return String(null===e||void 0===e?"":e)}function o(e){return e=i(e),d.test(e)?e.replace(s,"&").replace(a,"<").replace(l,">").replace(c,"'").replace(u,"""):e}e.Template=function(e,t,n,r){e=e||{},this.r=e.code||this.r,this.c=n,this.options=r||{},this.text=t||"",this.partials=e.partials||{},this.subs=e.subs||{},this.ib()},e.Template.prototype={r:function(){return""},v:o,t:i,render:function(e,t,n){return this.ri([e],t||{},n)},ri:function(e,t,n){return this.r(e,t,n)},ep:function(e,t){var n=this.partials[e],i=t[n.name];if(n.instance&&n.base==i)return n.instance;if("string"==typeof i){if(!this.c)throw new Error("No compiler available.");i=this.c.compile(i,this.options)}return i?(this.partials[e].base=i,n.subs&&(void 0===this.activeSub&&(t.stackText=this.text),i=r(i,n.subs,n.partials,t.stackText||this.text)),this.partials[e].instance=i,i):null},rp:function(e,t,n,r){var i=this.ep(e,n);return i?i.ri(t,n,r):""},rs:function(e,t,n){var r=e[e.length-1];if(!f(r))return n(e,t,this),void 0;for(var i=0;r.length>i;i++)e.push(r[i]),n(e,t,this),e.pop()},s:function(e,t,n,r,i,o,s){var a;return f(e)&&0===e.length?!1:("function"==typeof e&&(e=this.ms(e,t,n,r,i,o,s)),a=!!e,!r&&a&&t&&t.push("object"==typeof e?e:t[t.length-1]),a)},d:function(e,t,r,i){var o,s=e.split("."),a=this.f(s[0],t,r,i),l=this.options.modelGet,c=null;if("."===e&&f(t[t.length-2]))a=t[t.length-1];else for(var u=1;s.length>u;u++)o=n(s[u],a,l),null!=o?(c=a,a=o):a="";return i&&!a?!1:(i||"function"!=typeof a||(t.push(c),a=this.mv(a,t,r),t.pop()),a)},f:function(e,t,r,i){for(var o=!1,s=null,a=!1,l=this.options.modelGet,c=t.length-1;c>=0;c--)if(s=t[c],o=n(e,s,l),null!=o){a=!0;break}return a?(i||"function"!=typeof o||(o=this.mv(o,t,r)),o):i?!1:""},ls:function(e,t,n,r,o){var s=this.options.delimiters;return this.options.delimiters=o,this.b(this.ct(i(e.call(t,r)),t,n)),this.options.delimiters=s,!1},ct:function(e,t,n){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(t,n)},b:t?function(e){this.buf.push(e)}:function(e){this.buf+=e},fl:t?function(){var e=this.buf.join("");return this.buf=[],e}:function(){var e=this.buf;return this.buf="",e},ib:function(){this.buf=t?[]:""},ms:function(e,t,n,r,i,o,s){var a,l=t[t.length-1],c=e.call(l);return"function"==typeof c?r?!0:(a=this.activeSub&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(c,l,n,a.substring(i,o),s)):c},mv:function(e,t,n){var r=t[t.length-1],o=e.call(r);return"function"==typeof o?this.ct(i(o.call(r)),r,n):o},sub:function(e,t,n,r){var i=this.subs[e];i&&(this.activeSub=e,i(t,n,this,r),this.activeSub=!1)}};var s=/&/g,a=/</g,l=/>/g,c=/\'/g,u=/\"/g,d=/[&<>\"\']/,f=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}})("undefined"!=typeof exports?exports:Hogan),jQuery.tablesorter.addParser({id:"size",is:function(e){return e.trim().match(/^\d+(\.\d+)? (Bytes|KB|MB|GB|TB|PB)$/)},format:function(e){var t=["Bytes","KB","MB","GB","TB","PB"],n=e.trim().split(" ");return parseFloat(n.shift())*Math.pow(1024,_.indexOf(t,n.shift()))},type:"numeric"}),window.Genghis={Models:{},Collections:{},Views:{},Templates:{},defaults:{codeMirror:{mode:"application/json",lineNumbers:!0,tabSize:4,indentUnit:4,matchBrackets:!0}},boot:function(e){e+="/"==e.charAt(e.length-1)?"":"/",window.app=new Genghis.Views.App({baseUrl:e}),Backbone.history.start({pushState:!0,root:e})}},Genghis.version="2.3.4",Genghis.Templates.Alert=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b('<div class="alert'),r.s(r.f("block",e,t,1),e,t,0,29,41,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" alert-block")}),e.pop()),r.b(" alert-"),r.b(r.v(r.f("level",e,t,0))),r.b('">'),r.b("\n"+n),r.b(' <a class="close" href="#">×</a>'),r.b("\n"+n),r.s(r.f("block",e,t,1),e,t,0,132,164,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" <p>"),n.b(n.t(n.f("msg",e,t,0))),n.b("</p>"),n.b("\n")}),e.pop()),r.s(r.f("block",e,t,1),e,t,1,0,0,"")||(r.b(" "),r.b(r.t(r.f("msg",e,t,0))),r.b("\n")),r.b("</div>"),r.fl()}}),Genghis.Templates.CollectionRow=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b("<td>"),r.b("\n"+n),r.b(' <a href="'),r.b(r.v(r.f("url",e,t,0))),r.b('" class="name value">'),r.b(r.v(r.f("name",e,t,0))),r.b("</a>"),r.b("\n"+n),r.b("</td>"),r.b("\n"+n),r.b("<td>"),r.b("\n"+n),r.b(' <span class="documents value">'),r.b(r.v(r.f("count",e,t,0))),r.b("</span>"),r.b("\n"+n),r.b("</td>"),r.b("\n"+n),r.b("<td>"),r.b("\n"+n),r.b(' <span class="indexes has-details value">'),r.b(r.v(r.f("indexCount",e,t,0))),r.b("</span>"),r.b("\n"+n),r.b(' <div class="details" title="'),r.b(r.v(r.f("indexCount",e,t,0))),r.b(" Index"),r.s(r.f("indexesIsPlural",e,t,1),e,t,0,282,284,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b("es")}),e.pop()),r.b('">'),r.b("\n"+n),r.s(r.f("indexCount",e,t,1),e,t,0,334,501,"{{ }}")&&(r.rs(e,t,function(e,t,r){r.b(' <ul class="index-details">'),r.b("\n"+n),r.s(r.f("indexes",e,t,1),e,t,0,404,460,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" <li>"),n.b(n.t(n.d(".",e,t,0))),n.b("</li>"),n.b("\n")}),e.pop()),r.b(" </ul>"),r.b("\n")}),e.pop()),r.s(r.f("indexCount",e,t,1),e,t,1,0,0,"")||(r.b(" <em>None.</em>"),r.b("\n")),r.b(" </div>"),r.b("\n"+n),r.b("</td>"),r.b("\n"+n),r.b("<td>"),r.b("\n"+n),r.b(' <span class="size has-details value">'),r.b(r.v(r.f("humanSize",e,t,0))),r.b("</span>"),r.b("\n"+n),r.b(' <div class="details" title="Collection Stats">'),r.b("\n"+n),r.b(' <dl class="stats-details">'),r.b("\n"+n),r.s(r.f("stats",e,t,1),e,t,0,794,881,"{{ }}")&&(r.rs(e,t,function(e,t,r){r.b(" <dt>"),r.b(r.v(r.f("name",e,t,0))),r.b("</dt>"),r.b("\n"+n),r.b(" <dd>"),r.b(r.v(r.f("value",e,t,0))),r.b("</dd>"),r.b("\n")}),e.pop()),r.b(" </dl>"),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b("</td>"),r.b("\n"+n),r.b('<td class="action-column">'),r.b("\n"+n),r.b(' <button class="btn btn-mini btn-danger destroy">Remove</button>'),r.b("\n"+n),r.b("</td>"),r.b("\n"),r.fl()}}),Genghis.Templates.Collections=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b("<header><h2>"),r.b(r.v(r.f("title",e,t,0))),r.b("</h2></header>"),r.b("\n"+n),r.b('<div class="content">'),r.b("\n"+n),r.b(" <table>"),r.b("\n"+n),r.b(" <thead>"),r.b("\n"+n),r.b(" <tr>"),r.b("\n"+n),r.b(" <th>name</th>"),r.b("\n"+n),r.b(" <th>documents</th>"),r.b("\n"+n),r.b(" <th>indexes</th>"),r.b("\n"+n),r.b(" <th>size</th>"),r.b("\n"+n),r.b(' <th data-sorter="false"></th>'),r.b("\n"+n),r.b(" </tr>"),r.b("\n"+n),r.b(" </thead>"),r.b("\n"+n),r.b(" <tbody>"),r.b("\n"+n),r.b(" </tbody>"),r.b("\n"+n),r.b(" </table>"),r.b("\n"+n),r.b("</div>"),r.b("\n"+n),r.b('<div class="add-form inactive form-horizontal">'),r.b("\n"+n),r.b(' <input class="name span4" type="text" size="30">'),r.b("\n"+n),r.b(' <div class="btn-group">'),r.b("\n"+n),r.b(' <button class="show btn">Add collection</button>'),r.b("\n"+n),r.b(' <button class="btn dropdown-toggle" data-toggle="dropdown">'),r.b("\n"+n),r.b(' <span class="caret"></span>'),r.b("\n"+n),r.b(" </button>"),r.b("\n"+n),r.b(' <ul class="dropdown-menu">'),r.b("\n"+n),r.b(' <li><a class="show" href="#">Add collection</a></li>'),r.b("\n"+n),r.b(' <li><a class="show show-gridfs" href="#">Add GridFS collection</a></li>'),r.b("\n"+n),r.b(" </ul>"),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b("\n"+n),r.b(' <button class="add btn btn-primary">Add collection</button>'),r.b("\n"+n),r.b(' <button class="cancel btn">Cancel</button>'),r.b("\n"+n),r.b("</div>"),r.b("\n"),r.fl()
|
1089
1089
|
}}),Genghis.Templates.Confirm=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.s(r.f("header",e,t,1),e,t,0,13,148,"{{ }}")&&(r.rs(e,t,function(e,t,r){r.b(' <div class="modal-header">'),r.b("\n"+n),r.b(' <button class="dismiss close" aria-hidden="true">×</button>'),r.b("\n"+n),r.b(" <h3>"),r.b(r.v(r.f("header",e,t,0))),r.b("</h3>"),r.b("\n"+n),r.b(" </div>"),r.b("\n")}),e.pop()),r.b("\n"+n),r.b('<div class="modal-body">'),r.b("\n"+n),r.s(r.f("body",e,t,1),e,t,0,201,228,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" <p>"),n.b(n.t(n.f("body",e,t,0))),n.b("</p>"),n.b("\n")}),e.pop()),r.s(r.f("confirmInput",e,t,1),e,t,0,261,333,"{{ }}")&&(r.rs(e,t,function(e,t,r){r.b(" <div>"),r.b("\n"+n),r.b(' <input type="text" class="confirm-input">'),r.b("\n"+n),r.b(" </div>"),r.b("\n")}),e.pop()),r.b("</div>"),r.b("\n"+n),r.b("\n"+n),r.b("\n"+n),r.b('<div class="modal-footer">'),r.b("\n"+n),r.b(' <button class="dismiss btn" aria-hidden="true">'),r.b(r.v(r.f("dismissText",e,t,0))),r.b("</button>"),r.b("\n"+n),r.b(' <button class="confirm btn btn-primary"'),r.s(r.f("confirmInput",e,t,1),e,t,0,525,534,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" disabled")}),e.pop()),r.b(">"),r.b(r.t(r.f("confirmText",e,t,0))),r.b("</button>"),r.b("\n"+n),r.b("</div>"),r.b("\n"),r.fl()}}),Genghis.Templates.DatabaseRow=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.s(r.f("error",e,t,1),e,t,0,12,167,"{{ }}")&&(r.rs(e,t,function(e,t,r){r.b(' <td colspan="4">'),r.b("\n"+n),r.b(' <span class="value">'),r.b(r.v(r.f("name",e,t,0))),r.b("</span>"),r.b("\n"+n),r.b(' <span class="label label-important" title="'),r.b(r.v(r.f("error",e,t,0))),r.b('">Error</span>'),r.b("\n"+n),r.b(" </td>"),r.b("\n")}),e.pop()),r.s(r.f("error",e,t,1),e,t,1,0,0,"")||(r.b(" <td>"),r.b("\n"+n),r.b(' <a href="'),r.b(r.v(r.f("url",e,t,0))),r.b('" class="name value">'),r.b(r.v(r.f("name",e,t,0))),r.b("</a>"),r.b("\n"+n),r.b(" </td>"),r.b("\n"+n),r.b(" <td>"),r.b("\n"+n),r.b(' <span class="collections has-details value">'),r.b(r.v(r.f("count",e,t,0))),r.b("</span>"),r.b("\n"+n),r.b(' <div class="details" title="'),r.b(r.v(r.f("count",e,t,0))),r.b(" Collection"),r.s(r.f("isPlural",e,t,1),e,t,0,427,428,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b("s")}),e.pop()),r.b('">'),r.b("\n"+n),r.s(r.f("count",e,t,1),e,t,0,470,777,"{{ }}")&&(r.rs(e,t,function(e,t,r){r.b(" <ul>"),r.b("\n"+n),r.s(r.f("firstChildren",e,t,1),e,t,0,532,594,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" <li>"),n.b(n.v(n.d(".",e,t,0))),n.b("</li>"),n.b("\n")}),e.pop()),r.s(r.f("hasMoreChildren",e,t,1),e,t,0,657,720,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" <li>…</li>"),n.b("\n")}),e.pop()),r.b(" </ul>"),r.b("\n")}),e.pop()),r.s(r.f("count",e,t,1),e,t,1,0,0,"")||(r.b(" <em>None.</em>"),r.b("\n")),r.b(" </div>"),r.b("\n"+n),r.b(" </td>"),r.b("\n"+n),r.b(" <td>"),r.b("\n"+n),r.b(' <span class="size has-details value">'),r.b(r.v(r.f("humanSize",e,t,0))),r.b("</span>"),r.b("\n"+n),r.b(' <div class="details" title="Database Stats">'),r.b("\n"+n),r.b(' <dl class="stats-details">'),r.b("\n"+n),r.s(r.f("stats",e,t,1),e,t,0,1093,1192,"{{ }}")&&(r.rs(e,t,function(e,t,r){r.b(" <dt>"),r.b(r.v(r.f("name",e,t,0))),r.b("</dt>"),r.b("\n"+n),r.b(" <dd>"),r.b(r.v(r.f("value",e,t,0))),r.b("</dd>"),r.b("\n")}),e.pop()),r.b(" </dl>"),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b(" </td>"),r.b("\n"+n),r.b(' <td class="action-column">'),r.b("\n"+n),r.b(' <button class="btn btn-mini btn-danger destroy">Remove</button>'),r.b("\n"+n),r.b(" </td>"),r.b("\n")),r.fl()}}),Genghis.Templates.Databases=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b("<header><h2>"),r.b(r.v(r.f("title",e,t,0))),r.b("</h2></header>"),r.b("\n"+n),r.b('<div class="content">'),r.b("\n"+n),r.b(" <table>"),r.b("\n"+n),r.b(" <thead>"),r.b("\n"+n),r.b(" <tr>"),r.b("\n"+n),r.b(" <th>name</th>"),r.b("\n"+n),r.b(" <th>collections</th>"),r.b("\n"+n),r.b(" <th>size</th>"),r.b("\n"+n),r.b(' <th data-sorter="false"></th>'),r.b("\n"+n),r.b(" </tr>"),r.b("\n"+n),r.b(" </thead>"),r.b("\n"+n),r.b(" <tbody>"),r.b("\n"+n),r.b(" </tbody>"),r.b("\n"+n),r.b(" </table>"),r.b("\n"+n),r.b("</div>"),r.b("\n"+n),r.b('<div class="add-form inactive form-horizontal">'),r.b("\n"+n),r.b(' <input class="name span4" type="text" size="30">'),r.b("\n"+n),r.b(' <button class="show btn">Add database</button>'),r.b("\n"+n),r.b(' <button class="add btn btn-primary">Add database</button>'),r.b("\n"+n),r.b(' <button class="cancel btn">Cancel</button>'),r.b("\n"+n),r.b("</div>"),r.fl()}}),Genghis.Templates.Document=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b("<header>"),r.b("\n"+n),r.b(" <h2>"),r.b("\n"+n),r.b(" "),r.b(r.v(r.d("model.prettyId",e,t,0))),r.b("\n"+n),r.s(r.d("model.prettyTime",e,t,1),e,t,0,78,184,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(' <small><time datetime="'),n.b(n.v(n.d("model.prettyTime",e,t,0))),n.b('">'),n.b(n.v(n.d("model.prettyTime",e,t,0))),n.b("</time></small>"),n.b("\n")}),e.pop()),r.b(" </h2>"),r.b("\n"+n),r.b("</header>"),r.b("\n"+n),r.b('<div class="content document-wrapper"></div>'),r.fl()}}),Genghis.Templates.DocumentView=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b('<div class="well">'),r.b("\n"+n),r.b(' <div class="document-actions">'),r.b("\n"+n),r.s(r.f("isGridFile",e,t,1),e,t,0,79,189,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(' <a class="btn btn-small btn-primary grid-download" href="'),n.b(n.v(n.f("downloadUrl",e,t,0))),n.b('">Download</a>'),n.b("\n")}),e.pop()),r.s(r.f("isGridChunk",e,t,1),e,t,0,233,324,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(' <a class="btn btn-small grid-file" href="'),n.b(n.v(n.f("fileUrl",e,t,0))),n.b('">Grid File</a>'),n.b("\n")}),e.pop()),r.b(' <button class="btn btn-small btn-primary save">Save</button>'),r.b("\n"+n),r.b(' <button class="btn btn-small cancel">Cancel</button>'),r.b("\n"+n),r.b(' <button class="btn btn-small edit">Edit</button>'),r.b("\n"+n),r.b(' <button class="btn btn-small btn-danger destroy">Delete</button>'),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b("\n"+n),r.b(" <h3>"),r.b("\n"+n),r.b(' <a class="id" href="'),r.b(r.v(r.f("url",e,t,0))),r.b('">'),r.b(r.v(r.f("prettyId",e,t,0))),r.b("</a>"),r.b("\n"+n),r.s(r.f("prettyTime",e,t,1),e,t,0,707,801,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(' <small><time datetime="'),n.b(n.v(n.f("prettyTime",e,t,0))),n.b('">'),n.b(n.v(n.f("prettyTime",e,t,0))),n.b("</time></small>"),n.b("\n")}),e.pop()),r.b(" </h3>"),r.b("\n"+n),r.b("\n"+n),r.b(' <div class="document"></div>'),r.b("\n"+n),r.b("</div>"),r.b("\n"),r.fl()}}),Genghis.Templates.Documents=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b("<header><h2>Documents</h2></header>"),r.b("\n"+n),r.b('<div class="controls">'),r.b("\n"+n),r.b(' <button class="add-document btn btn-large">Add document</button>'),r.b("\n"+n),r.b(' <div class="pagination-wrapper top"></div>'),r.b("\n"+n),r.b("</div>"),r.b("\n"+n),r.b('<div class="content document-wrapper"></div>'),r.b("\n"+n),r.b('<div class="controls">'),r.b("\n"+n),r.b(' <button class="add-document btn btn-large">Add document</button>'),r.b("\n"+n),r.b(' <div class="pagination-wrapper top"></div>'),r.b("\n"+n),r.b("</div>"),r.b("\n"),r.fl()}}),Genghis.Templates.KeyboardShortcuts=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b('<div id="keyboard-shortcuts" class="modal">'),r.b("\n"+n),r.b(' <div class="modal-header">'),r.b("\n"+n),r.b(' <a href="#" class="close">×</a>'),r.b("\n"+n),r.b(" <h3>Keyboard shortcuts</h3>"),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b(' <div class="modal-body">'),r.b("\n"+n),r.b(" <ul>"),r.b("\n"+n),r.b(" <li>"),r.b("\n"+n),r.b(" <h4>Global</h4>"),r.b("\n"+n),r.b(" <dl>"),r.b("\n"+n),r.b(" <dt><kbd>?</kbd></dt>"),r.b("\n"+n),r.b(" <dd>This cheat sheet</dd>"),r.b("\n"+n),r.b("\n"+n),r.b(" <dt><kbd>s</kbd></dt>"),r.b("\n"+n),r.b(" <dd>Go to servers</dd>"),r.b("\n"+n),r.b("\n"+n),r.b(" <dt><kbd>u</kbd></dt>"),r.b("\n"+n),r.b(" <dd>Go up one level</dd>"),r.b("\n"+n),r.b(" </dl>"),r.b("\n"+n),r.b("\n"+n),r.b(" <h4>Servers</h4>"),r.b("\n"+n),r.b(" <dl>"),r.b("\n"+n),r.b(" <dt><kbd>c</kbd></dt>"),r.b("\n"+n),r.b(" <dd>New server</dd>"),r.b("\n"+n),r.b(" </dl>"),r.b("\n"+n),r.b("\n"+n),r.b(" <h4>Databases</h4>"),r.b("\n"+n),r.b(" <dl>"),r.b("\n"+n),r.b(" <dt><kbd>c</kbd></dt>"),r.b("\n"+n),r.b(" <dd>New database</dd>"),r.b("\n"+n),r.b(" </dl>"),r.b("\n"+n),r.b(" </li>"),r.b("\n"+n),r.b(" <li>"),r.b("\n"+n),r.b(" <h4>Collections</h4>"),r.b("\n"+n),r.b(" <dl>"),r.b("\n"+n),r.b(" <dt><kbd>c</kbd></dt>"),r.b("\n"+n),r.b(" <dd>New collection</dd>"),r.b("\n"+n),r.b(" <dt><kbd>shift</kbd> + <kbd>c</kbd></dt>"),r.b("\n"+n),r.b(" <dd>New GridFS collection</dd>"),r.b("\n"+n),r.b(" </dl>"),r.b("\n"+n),r.b("\n"+n),r.b(" <h4>Documents</h4>"),r.b("\n"+n),r.b(" <dl>"),r.b("\n"+n),r.b(" <dt><kbd>/</kbd></dt>"),r.b("\n"+n),r.b(" <dd>Search</dd>"),r.b("\n"+n),r.b("\n"+n),r.b(" <dt><kbd>c</kbd></dt>"),r.b("\n"+n),r.b(" <dd>New document</dd>"),r.b("\n"+n),r.b("\n"+n),r.b(" <dt><kbd>n</kbd></dt>"),r.b("\n"+n),r.b(" <dd>Next page</dd>"),r.b("\n"+n),r.b("\n"+n),r.b(" <dt><kbd>p</kbd></dt>"),r.b("\n"+n),r.b(" <dd>Previous page</dd>"),r.b("\n"+n),r.b("\n"+n),r.b("<!--"),r.b("\n"+n),r.b(" <dt><kbd>-</kbd></dt>"),r.b("\n"+n),r.b(" <dd>Collapse all</dd>"),r.b("\n"+n),r.b("\n"+n),r.b(" <dt><kbd>+</kbd></dt>"),r.b("\n"+n),r.b(" <dd>Expand all</dd>"),r.b("\n"+n),r.b("\n"+n),r.b(" <dt><kbd>Alt+1</kbd> – <kbd>Alt+9</kbd></dt>"),r.b("\n"+n),r.b(" <dd>Expand to depth</dd>"),r.b("\n"+n),r.b("-->"),r.b("\n"+n),r.b(" </dl>"),r.b("\n"+n),r.b(" </li>"),r.b("\n"+n),r.b(" </ul>"),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b("</div>"),r.fl()}}),Genghis.Templates.Masthead=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b('<div class="container">'),r.b("\n"+n),r.b(" "),r.s(r.f("heading",e,t,1),e,t,0,42,64,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b("<h1>"),n.b(n.v(n.f("heading",e,t,0))),n.b("</h1>")}),e.pop()),r.b("\n"+n),r.b(" "),r.b(r.t(r.f("content",e,t,0))),r.b("\n"+n),r.b("</div>"),r.fl()}}),Genghis.Templates.Nav=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b('<ul class="nav">'),r.b("\n"+n),r.b(' <li class="nav-section servers"><a class="btn-servers" href="'),r.b(r.v(r.f("baseUrl",e,t,0))),r.b('">Servers</a></li>'),r.b("\n"+n),r.b(' <li class="nav-section dropdown server"></li>'),r.b("\n"+n),r.b(' <li class="nav-section dropdown database"></li>'),r.b("\n"+n),r.b(' <li class="nav-section dropdown collection"></li>'),r.b("\n"+n),r.b("</ul>"),r.b("\n"),r.fl()}}),Genghis.Templates.NavSection=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b('<a href="#" class="dropdown-toggle" data-toggle="dropdown">'),r.b(r.v(r.f("id",e,t,0))),r.b("</a>"),r.b("\n"+n),r.b('<ul class="dropdown-menu"></ul>'),r.b("\n"),r.fl()}}),Genghis.Templates.NavSectionMenu=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.s(r.d("collection.firstChildren",e,t,1),e,t,0,31,130,"{{ }}")&&(r.rs(e,t,function(e,t,r){r.b(' <li><a href="'),r.b(r.v(r.f("url",e,t,0))),r.b('">'),r.b("\n"+n),r.b(" "),r.b(r.v(r.f("id",e,t,0))),r.b("\n"+n),r.b(" <span>"),r.b(r.v(r.f("humanCount",e,t,0))),r.b("</span>"),r.b("\n"+n),r.b(" </a></li>"),r.b("\n")}),e.pop()),r.s(r.d("collection.hasMoreChildren",e,t,1),e,t,0,195,287,"{{ }}")&&(r.rs(e,t,function(e,t,r){r.b(' <li class="divider"></li>'),r.b("\n"+n),r.b(' <li><a href="'),r.b(r.v(r.d("collection.url",e,t,0))),r.b('">More »</a></li>'),r.b("\n")}),e.pop()),r.fl()}}),Genghis.Templates.NewDocument=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b('<div id="new-document" class="modal modal-editor">'),r.b("\n"+n),r.b(' <div class="modal-header">'),r.b("\n"+n),r.b(' <a class="close" data-dismiss="modal">×</a>'),r.b("\n"+n),r.b(" <h3>New Document</h3>"),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b(' <div class="modal-body">'),r.b("\n"+n),r.b(' <div class="wrapper">'),r.b("\n"+n),r.b(' <textarea id="editor-new" class="genghis-document-editor"></textarea>'),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b(' <div class="modal-footer">'),r.b("\n"+n),r.b(' <button class="btn cancel">Cancel</button>'),r.b("\n"+n),r.b(' <button class="btn btn-primary save">Save</button>'),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b("</div>"),r.fl()}}),Genghis.Templates.NewGridFile=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b('<div id="new-grid-file" class="modal modal-file-upload">'),r.b("\n"+n),r.b(' <div class="modal-header">'),r.b("\n"+n),r.b(' <a class="close" data-dismiss="modal">×</a>'),r.b("\n"+n),r.b(" <h3>Upload File</h3>"),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b(' <div class="modal-body">'),r.b("\n"+n),r.b(' <div class="wrapper">'),r.b("\n"+n),r.b(' <textarea id="editor-upload" class="genghis-document-editor"></textarea>'),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b(' <div class="modal-footer">'),r.b("\n"+n),r.b(' <button class="btn cancel">Cancel</button>'),r.b("\n"+n),r.b(' <button class="btn btn-primary save">Upload</button>'),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b("</div>"),r.b("\n"),r.fl()}}),Genghis.Templates.Pagination=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b('<div class="pagination pagination-right">'),r.b("\n"+n),r.b(" <ul>"),r.b("\n"+n),r.b(' <li class="prev'),r.s(r.f("isFirst",e,t,1),e,t,0,82,91,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" disabled")}),e.pop()),r.b('">'),r.b("\n"+n),r.b(" <a"),r.s(r.f("isFirst",e,t,1),e,t,1,0,0,"")||(r.b(' href="'),r.b(r.v(r.f("prevUrl",e,t,0))),r.b('"')),r.b(">←</a>"),r.b("\n"+n),r.b(" </li>"),r.b("\n"+n),r.b("\n"+n),r.s(r.f("isStart",e,t,1),e,t,1,0,0,"")||(r.b(' <li class="first"><a href="'),r.b(r.v(r.f("firstUrl",e,t,0))),r.b('">1</a></li>'),r.b("\n"+n),r.b(' <li class="disabled"><a>…</a></li>'),r.b("\n")),r.b("\n"+n),r.b("\n"+n),r.s(r.f("pageUrls",e,t,1),e,t,0,361,460,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" <li"),n.s(n.f("active",e,t,1),e,t,0,386,401,"{{ }}")&&(n.rs(e,t,function(e,t,n){n.b(' class="active"')}),e.pop()),n.b('><a href="'),n.b(n.v(n.f("url",e,t,0))),n.b('">'),n.b(n.v(n.f("index",e,t,0))),n.b("</a></li>"),n.b("\n")}),e.pop()),r.b("\n"+n),r.s(r.f("isEnd",e,t,1),e,t,1,0,0,"")||(r.b(' <li class="disabled"><a>…</a></li>'),r.b("\n"+n),r.b(' <li class="last"><a href="'),r.b(r.v(r.f("lastUrl",e,t,0))),r.b('">'),r.b(r.v(r.f("last",e,t,0))),r.b("</a></li>"),r.b("\n")),r.b("\n"+n),r.b(' <li class="next'),r.s(r.f("isLast",e,t,1),e,t,0,663,672,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" disabled")}),e.pop()),r.b('">'),r.b("\n"+n),r.b(" <a"),r.s(r.f("isLast",e,t,1),e,t,1,0,0,"")||(r.b(' href="'),r.b(r.v(r.f("nextUrl",e,t,0))),r.b('"')),r.b(">→</a>"),r.b("\n"+n),r.b(" </li>"),r.b("\n"+n),r.b(" </ul>"),r.b("\n"+n),r.b("</div>"),r.fl()}}),Genghis.Templates.Search=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b('<input id="navbar-query" class="search-query" name="q" type="text" value="'),r.b(r.v(r.f("query",e,t,0))),r.b('" />'),r.b("\n"+n),r.b('<div class="search-advanced">'),r.b("\n"+n),r.b(' <div class="well"></div>'),r.b("\n"+n),r.b(' <div class="form-actions">'),r.b("\n"+n),r.b(' <button class="search btn btn-primary">Search</button>'),r.b("\n"+n),r.b(' <button class="cancel btn">Cancel</button>'),r.b("\n"+n),r.b(" </div>"),r.b("\n"+n),r.b("</div>"),r.b("\n"+n),r.b('<span class="grippie"></span>'),r.b("\n"),r.fl()}}),Genghis.Templates.ServerRow=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.s(r.f("error",e,t,1),e,t,0,12,167,"{{ }}")&&(r.rs(e,t,function(e,t,r){r.b(' <td colspan="3">'),r.b("\n"+n),r.b(' <span class="value">'),r.b(r.v(r.f("name",e,t,0))),r.b("</span>"),r.b("\n"+n),r.b(' <span class="label label-important" title="'),r.b(r.v(r.f("error",e,t,0))),r.b('">Error</span>'),r.b("\n"+n),r.b(" </td>"),r.b("\n")}),e.pop()),r.s(r.f("error",e,t,1),e,t,1,0,0,"")||(r.b(" <td>"),r.b("\n"+n),r.b(' <a href="'),r.b(r.v(r.f("url",e,t,0))),r.b('" class="name value">'),r.b(r.v(r.f("name",e,t,0))),r.b("</a>"),r.b("\n"+n),r.b(" </td>"),r.b("\n"+n),r.b(" <td>"),r.b("\n"+n),r.b(' <span class="databases has-details value">'),r.b(r.v(r.f("count",e,t,0))),r.b("</span>"),r.b("\n"+n),r.b(' <div class="details" title="'),r.b(r.v(r.f("count",e,t,0))),r.b(" Database"),r.s(r.f("isPlural",e,t,1),e,t,0,423,424,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b("s")}),e.pop()),r.b('">'),r.b("\n"+n),r.s(r.f("count",e,t,1),e,t,0,466,773,"{{ }}")&&(r.rs(e,t,function(e,t,r){r.b(" <ul>"),r.b("\n"+n),r.s(r.f("firstChildren",e,t,1),e,t,0,528,590,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" <li>"),n.b(n.v(n.d(".",e,t,0))),n.b("</li>"),n.b("\n")}),e.pop()),r.s(r.f("hasMoreChildren",e,t,1),e,t,0,653,716,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b(" <li>…</li>"),n.b("\n")}),e.pop()),r.b(" </ul>"),r.b("\n")}),e.pop()),r.s(r.f("count",e,t,1),e,t,1,0,0,"")||(r.b(" <em>None.</em>"),r.b("\n")),r.b(" </div>"),r.b("\n"+n),r.b(" </td>"),r.b("\n"+n),r.b(" <td>"),r.b("\n"+n),r.b(' <span class="size value">'),r.b(r.v(r.f("humanSize",e,t,0))),r.b("</span>"),r.b("\n"+n),r.b(" </td>"),r.b("\n")),r.b('<td class="action-column">'),r.b("\n"+n),r.b(" "),r.s(r.f("editable",e,t,1),e,t,0,1026,1089,"{{ }}")&&(r.rs(e,t,function(e,t,n){n.b('<button class="btn btn-mini btn-danger destroy">Remove</button>')}),e.pop()),r.b("\n"+n),r.b("</td>"),r.b("\n"),r.fl()}}),Genghis.Templates.Servers=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b("<header><h2>Servers</h2></header>"),r.b("\n"+n),r.b('<div class="content">'),r.b("\n"+n),r.b(" <table>"),r.b("\n"+n),r.b(" <thead>"),r.b("\n"+n),r.b(" <tr>"),r.b("\n"+n),r.b(" <th>name</th>"),r.b("\n"+n),r.b(" <th>databases</th>"),r.b("\n"+n),r.b(" <th>size</th>"),r.b("\n"+n),r.b(' <th data-sorter="false"></th>'),r.b("\n"+n),r.b(" </tr>"),r.b("\n"+n),r.b(" </thead>"),r.b("\n"+n),r.b(" <tbody>"),r.b("\n"+n),r.b(" </tbody>"),r.b("\n"+n),r.b(" </table>"),r.b("\n"+n),r.b("</div>"),r.b("\n"+n),r.b('<div class="add-form inactive form-horizontal">'),r.b("\n"+n),r.b(' <span class="input-append">'),r.b("\n"+n),r.b(' <input class="name span4" type="text" size="30"><span class="add-on help" title="user:pass@localhost:27017">?</span>'),r.b("\n"+n),r.b(" </span>"),r.b("\n"+n),r.b(' <button class="show btn">Add server</button>'),r.b("\n"+n),r.b(' <button class="add btn btn-primary">Add server</button>'),r.b("\n"+n),r.b(' <button class="cancel btn">Cancel</button>'),r.b("\n"+n),r.b("</div>"),r.b("\n"),r.fl()}}),Genghis.Templates.Welcome=new Hogan.Template({code:function(e,t,n){var r=this;return r.b(n=n||""),r.b("<h2>Welcome to</h2>"),r.b("\n"+n),r.b("<h1>Genghis</h1>"),r.b("\n"+n),r.b("<p>The single-file MongoDB admin app.</p>"),r.b("\n"+n),r.b('<ul class="welcome-links">'),r.b("\n"+n),r.b(' <li><a href="http://genghisapp.com">Homepage</a></li>'),r.b("\n"+n),r.b(' <li><a href="https://github.com/bobthecow/genghis/issues">Issues</a></li>'),r.b("\n"+n),r.b(" <li>Version "),r.b(r.v(r.f("version",e,t,0))),r.b("</li>"),r.b("\n"+n),r.b("</ul>"),r.fl()}}),Genghis.Util={route:function(e){return e.replace(app.baseUrl,"").replace(/^\//,"")},parseQuery:function(e){var t={};return e.length&&_.each(e.split("&"),function(e){var n=e.split("="),r=n.shift();t[r]=decodeURIComponent(n.join("="))}),t},buildQuery:function(e){return _.map(e,function(e,t){return t+"="+e}).join("&")},humanizeSize:function(e){if(e==-0)return"n/a";var t=["Bytes","KB","MB","GB","TB","PB"],n=parseInt(Math.floor(Math.log(e)/Math.log(1024)),10),r=0===n?e/Math.pow(1024,n):(e/Math.pow(1024,n)).toFixed(1);return r=Genghis.Util.round(r,2).toString().replace(/\.0+/,""),r+" "+t[n]},humanizeCount:function(e){var t="";return e=e||0,e>1e3&&(e=Math.floor(e/1e3),t=" k"),e>1e3&&(e=Math.floor(e/1e3),t=" M"),e>1e3?"...":e+t},round:function(e,t){if("undefined"==typeof t||0===+t)return Math.round(e);e=+e;var n=-1*+t;return isNaN(e)||"number"!=typeof n||0!==n%1?0/0:(e=e.toString().split("e"),e=Math.round(+(e[0]+"e"+(e[1]?+e[1]-n:-n))),e=e.toString().split("e"),+(e[0]+"e"+(e[1]?+e[1]+n:n)))},escape:function(e){return e?String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):void 0},attachCollapsers:function(e){$(".document",e).on("click","button,span.e",function(e){var t,n,r=$(this).parent(),i=r.children(".v"),o=/^\s*(name|title)\s*/i,s=i.hasClass("o"),a="";r.children(".e").length||(s&&(n=$(_.detect(i.find("> span.p > var"),function(e){return o.test($(e).text())})).siblings("span.v"),0===n.length&&(n=$(_.detect(i.find("> span.p > span.v"),function(e){var t=$(e);return t.hasClass("n")||t.hasClass("b")||t.hasClass("q")&&64>t.text().length}))),n&&n.length&&(t=n.siblings("var").text(),a=(t?t+": ":"")+Genghis.Util.escape(n.text()))),r.append('<span class="e">'+(s?"{":"[")+" <q>"+a+" …</q> "+(s?"}":"]")+"</span>")),r.toggleClass("collapsed"),e.preventDefault()})},base64Encode:function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=e.length,r="",i=0;n>i;i+=3){var o=[e.charCodeAt(i),e.charCodeAt(i+1),e.charCodeAt(i+2)],s=[o[0]>>2,(3&o[0])<<4|o[1]>>4,(15&o[1])<<2|o[2]>>6,63&o[2]];isNaN(o[1])&&(s[2]=64),isNaN(o[2])&&(s[3]=64),r+=t[s[0]]+t[s[1]]+t[s[2]]+t[s[3]]}return r},base64Decode:function(e){var t,n,r,i,o,s,a,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=e.length,u="";e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var d=0;c>d;)i=l.indexOf(e.charAt(d++)),o=l.indexOf(e.charAt(d++)),s=l.indexOf(e.charAt(d++)),a=l.indexOf(e.charAt(d++)),t=i<<2|o>>4,n=(15&o)<<4|s>>2,r=(3&s)<<6|a,u+=String.fromCharCode(t),64!=s&&(u+=String.fromCharCode(n)),64!=a&&(u+=String.fromCharCode(r));return u},base64ToHex:function(e){for(var t=[],n=atob(e.replace(/[=\s]+$/,"")),r=n.length,i=0;r>i;++i){var o=n.charCodeAt(i).toString(16);t.push(1===o.length?"0"+o:o)}return t.join("")},encodeDocumentId:function(e){return _.isObject(e)&&e.hasOwnProperty("$genghisType")&&"ObjectId"==e.$genghisType?e.$value:_.isUndefined(e)?void 0:"~"+this.base64Encode(JSON.stringify(e))},decodeDocumentId:function(e){return _.isString(e)&&"~"===e[0]?this.base64Decode(e.substr(1)):e},download:function(){var e;return function(t){e||(e=$("<iframe>",{id:"genghis-util-download"}).hide().appendTo("body")),e.attr("src",t)}}()},Genghis.JSON={parse:function(src){function addError(e,t){t.error||(error=new Error(e),error.loc=t.loc,error.node=t,t.error=error,errors.push(error))}function throwErrors(e){var t=new Error(""+e.length+" parse error"+(1===e.length?"":"s"));throw t.errors=e,t}function replaceCallExpression(src){function ObjectId(e){return{$genghisType:"ObjectId",$value:e?e.toString():null}}function GenghisDate(e){function t(e){function t(e){return 10>e?"0"+e:e}return e=new Date(e),e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"Z"}return{$genghisType:"ISODate",$value:e?t(e):null}}function ISODate(e){if(!e)return new GenghisDate;var t=/(\d{4})-?(\d{2})-?(\d{2})([T ](\d{2})(:?(\d{2})(:?(\d{2}(\.\d+)?))?)?(Z|([+\-])(\d{2}):?(\d{2})?)?)?/,n=t.exec(e);if(!n)throw"Invalid ISO date";var r=parseInt(n[1],10)||1970,i=(parseInt(n[2],10)||1)-1,o=parseInt(n[3],10)||0,s=parseInt(n[5],10)||0,a=parseInt(n[7],10)||0,l=parseFloat(n[9])||0,c=Math.round(1e3*(l%1));l-=c/1e3;var u=Date.UTC(r,i,o,s,a,l,c);if(n[11]&&"Z"!=n[11]){var d=0;d+=1e3*60*60*(parseInt(n[13],10)||0),d+=1e3*60*(parseInt(n[14],10)||0),"+"==n[12]&&(d*=-1),u+=d}return new GenghisDate(u)}function DBRef(e,t){return{$ref:e,$id:t}}function GenghisRegExp(e,t){return{$genghisType:"RegExp",$value:{$pattern:e?e.toString():null,$flags:t?t.toString():null}}}function BinData(e,t){return{$genghisType:"BinData",$value:{$subtype:e,$binary:t}}}return src=src.replace(/^\s*(new\s+)?(Date|RegExp)(\b)/,"$1Genghis$2$3"),JSON.stringify(eval(src))}function replaceRegExpLiteral(e){var t="";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),replaceCallExpression("GenghisRegExp("+JSON.stringify(e.source)+', "'+t+'")')}function insertHelpers(e){function t(t){chunks[e.range[0]]=t;for(var n=e.range[0]+1;e.range[1]>n;n++)chunks[n]=""}if(e.range)if(e.source=function(){return chunks.slice(e.range[0],e.range[1]).join("")},e.update&&_.isObject(e.update)){var n=e.update;Object.keys(n).forEach(function(e){t[e]=n[e]}),e.update=t}else e.update=t}function assertType(e,t){t.type!==e&&addError("Expecting "+e+" but found "+t.type,t)}"string"!=typeof src&&(src=String(src)),src="var __genghis_json__ = "+src;var opts={loc:!0,raw:!0,tokens:!0,tolerant:!0,range:!0},allowedCalls={ObjectId:!0,Date:!0,ISODate:!0,DBRef:!0,RegExp:!0,BinData:!0},allowedPropertyValues={Literal:!0,ObjectExpression:!0,ArrayExpression:!0,NewExpression:!0,CallExpression:!0,UnaryExpression:!0},errors=[],chunks=src.split(""),ast;try{ast=esprima.parse(src,opts)}catch(e){throwErrors([e])}ast.errors.length&&throwErrors(ast.errors);var node;return node=ast,assertType("Program",node),node=node.body,1!==node.length&&addError("Unexpected statement "+node[1].type,node[1]),node=node[0],assertType("VariableDeclaration",node),node=node.declarations,1!==node.length&&addError("Unexpected variable declarations "+node.length,node[1]),node=node[0],assertType("VariableDeclarator",node),node=node.init,"ObjectExpression"!==node.type&&addError("Expected an object expression, found "+node.type,node),errors.length&&throwErrors(errors),function walk(e){switch(insertHelpers(e),Object.keys(e).forEach(function(t){var n=e[t];Array.isArray(n)?n.forEach(function(e){e&&"string"==typeof e.type&&walk(e)}):n&&"string"==typeof n.type&&(insertHelpers(e),walk(n))}),e.type){case"NewExpression":case"CallExpression":e.callee&&!allowedCalls[e.callee.name]?addError("Bad call, bro: "+e.callee.name,e):e.update(replaceCallExpression(e.source()));break;case"Property":e.value&&!allowedPropertyValues[e.value.type]&&addError("Unexpected value: "+e.value.source(),e.value);break;case"Identifier":case"ArrayExpression":case"ObjectExpression":case"UnaryExpression":break;case"Literal":_.isRegExp(e.value)&&e.update(replaceRegExpLiteral(e.value));break;default:addError("Unexpected "+e.type,e)}}(node),errors.length&&throwErrors(errors),function(node){var __genghis_json__;return eval("__genghis_json__ = "+node.source()),__genghis_json__}(node)},stringify:function(e,t){return jQuery("<div>"+this.prettyPrint(e,t,!1)+"</div>").text()},prettyPrint:function(e,t,n){function r(e){function r(e,t){return i("SPAN",e,t)}function i(e,t,n){var r=document.createElement(e);return t&&(r.className=t),n&&("string"==typeof n&&(n=o(n)),r.appendChild(n)),r}function o(e){return document.createTextNode(e)}function s(e){var t,n=r("v q");return n.appendChild(o('"')),u.lastIndex=0,u.test(e)&&(e=e.replace(u,function(e){var t=y[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),d.test(e)?(t=i("A","s"),t.href=e):t=r("s"),t.appendChild(o(e)),n.appendChild(t),n.appendChild(o('"')),n}function a(e){return(m.test(e)||!p.test(e))&&(e='"'+e.replace(u,function(e){var t=y[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"'),i("VAR",!1,e)}function l(e,t,n){var i=r("call "+n);return i.appendChild(o(e+"(")),_.each(t,function(e,n){i.appendChild(e),t.length-1>n&&i.appendChild(o(", "))}),i.appendChild(o(")")),i}function c(e,t){var u,d,f,h,p,m,v,y,w=g,x="",C=t[e];switch(_.isObject(C)&&"function"==typeof C.toJSON&&(C=C.toJSON(e)),typeof C){case"string":return s(C);case"number":return r("v n",isFinite(C)?String(C):"null");case"boolean":return r("v b",String(C));case"object":if(_.isNull(C))return r("v z","null");if(Object.hasOwnProperty.call(C,"$genghisType"))switch(C.$genghisType){case"ObjectId":return l("ObjectId",[s(C.$value)],"oid");case"ISODate":return l("ISODate",[s(C.$value)],"date");case"RegExp":var S=C.$value.$pattern,k=C.$value.$flags||"";return r("v re","/"+S+"/"+k);case"BinData":return l("BinData",[r("n",String(C.$value.$subtype)),s(C.$value.$binary)],"bindata")}if(g+=b,_.isArray(C)){if(0===C.length)return g=w,r("v a","[]");for(m=r("v a"),n&&g&&(m.collapsible=!0,C.length>10&&(m.collapsed=!0)),m.appendChild(o(g?"[\n"+g:"[")),x=o(g?",\n"+g:","),h=C.length,u=0;h>u;u+=1)u>0&&m.appendChild(x.cloneNode(!1)),m.appendChild(c(u,C)||r("v z","null"));return m.appendChild(o(g?"\n"+w+"]":"]")),g=w,m}p=[];var T=o(g?": ":":"),E=!(!C.$ref||!C.$id);for(d in C)Object.hasOwnProperty.call(C,d)&&(f=c(d,C),f&&(y="p"+(f.collapsed?" collapsed":""),E&&("$ref"==d||"$id"==d||"$db"==d)&&(y=y+" ref-"+d.substr(1)),v=r(y),E&&"$id"==d&&v.setAttribute("data-document-id",Genghis.Util.encodeDocumentId(C[d])),f.collapsible&&v.appendChild(i("button")),v.appendChild(a(d)),v.appendChild(T.cloneNode(!1)),v.appendChild(f),f.collapsed&&(child=r("e"),child.appendChild(o("[ ")),child.appendChild(i("Q",!1,o(" \u2026"))),child.appendChild(o(" ]")),v.appendChild(child)),p.push(v)));if(y="v o",0===p.length)return g=w,r(y,o("{}"));for(E&&(y+=" ref"),m=r(y),m.collapsible=!!n,m.appendChild(o(g?"{\n"+g:"{")),x=o(g?",\n"+g:","),h=p.length,u=0;p.length>u;u++)u>0&&m.appendChild(x.cloneNode(!0)),m.appendChild(p[u]);return m.appendChild(o(g?"\n"+w+"}":"}")),g=w,m}}var u=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,d=/^https?:\/\/[^\s]+$/,f="$A-Z_a-z\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc",h="0-9\u0300-\u036f\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e4-\u08fe\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d02\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19b0-\u19c0\u19c8\u19c9\u19d0-\u19d9\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1dc0-\u1de6\u1dfc-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f1\ua900-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f",p=RegExp("^["+f+"]["+f+h+"]*$"),m=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/,g="",b=t===!1?"":" ",y={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};
|
1090
1090
|
return g="",v=c("_",{_:e}).innerHTML}return n=n!==!1,r(e)},normalize:function(e,t){return Genghis.JSON.stringify(Genghis.JSON.parse(e),t)}},Genghis.Collections.BaseCollection=Backbone.Collection.extend({firstChildren:function(){return this.collection.toArray().slice(0,10)},hasMoreChildren:function(){return this.collection.length>10}}),Genghis.Models.BaseModel=Backbone.Model.extend({name:function(){return this.get("name")},count:function(){return this.get("count")},humanCount:function(){return Genghis.Util.humanizeCount(this.get("count")||0)},isPlural:function(){return 1!==this.get("count")},humanSize:function(){var e=this.get("size");return e?Genghis.Util.humanizeSize(e):void 0},hasMoreChildren:function(){return this.get("count")>15}}),Genghis.Views.BaseDocument=Backbone.View.extend({errorLines:[],clearErrors:function(){var e=this.editor;this.getErrorBlock().html(""),_.each(this.errorLines,function(t){e.removeLineClass(t,"background","error-line")}),this.errorLines=[]},getEditorValue:function(){this.clearErrors();var e=this.getErrorBlock(),t=this.editor,n=this.errorLines;try{return Genghis.JSON.parse(t.getValue())}catch(r){_.each(r.errors||[r],function(r){var i=r.message;r.lineNumber&&!/Line \d+/i.test(i)&&(i="Line "+r.lineNumber+": "+r.message);var o=new Genghis.Views.Alert({model:new Genghis.Models.Alert({level:"error",msg:i,block:!0})});e.append(o.render().el),r.lineNumber&&n.push(t.addLineClass(r.lineNumber-1,"background","error-line"))})}return!1}}),Genghis.Views.BaseNewDocument=Genghis.Views.BaseDocument.extend({initialize:function(){_.bindAll(this,"render","getTextArea","show","refreshEditor","closeModal","cancelEdit","saveDocument","showServerError"),this.render()},render:function(){this.$el=$(this.template.render()).hide().appendTo("body"),this.el=this.$el[0],this.modal=this.$el.modal({backdrop:"static",show:!1,keyboard:!1});var e=this.$(".wrapper");return this.editor=CodeMirror.fromTextArea(this.getTextArea(),_.extend({},Genghis.defaults.codeMirror,{extraKeys:{"Ctrl-Enter":this.saveDocument,"Cmd-Enter":this.saveDocument}})),this.editor.on("focus",function(){e.addClass("focused")}),this.editor.on("blur",function(){e.removeClass("focused")}),$(window).resize(_.throttle(this.refreshEditor,100)),this.modal.bind("hide",this.cancelEdit),this.modal.bind("shown",this.refreshEditor),this.modal.find("button.cancel").bind("click",this.closeModal),this.modal.find("button.save").bind("click",this.saveDocument),this},refreshEditor:function(){this.editor.refresh(),this.editor.focus()},closeModal:function(){this.modal.modal("hide")},cancelEdit:function(){this.editor.setValue("")},getErrorBlock:function(){var e=this.$("div.errors");return 0===e.length&&(e=$('<div class="errors"></div>').prependTo(this.$(".modal-body"))),e},showServerError:function(e){var t=new Genghis.Views.Alert({model:new Genghis.Models.Alert({level:"error",msg:e,block:!0})});this.getErrorBlock().append(t.render().el)}}),Genghis.Views.BaseRow=Backbone.View.extend({tagName:"tr",events:{"click a.name":"navigate","click button.destroy":"destroy"},initialize:function(){_.bindAll(this,"render","navigate","remove","destroy"),this.model.bind("change",this.render),this.model.bind("destroy",this.remove)},render:function(){return this.$el.html(this.template.render(this.model)).toggleClass("error",!!this.model.get("error")).find(".label[title]").tooltip({placement:"bottom"}),this.$(".has-details").popover({html:!0,content:function(){return $(this).siblings(".details").html()},title:function(){return $(this).siblings(".details").attr("title")},trigger:"manual"}).hoverIntent(function(){$(this).popover("show")},function(){$(this).popover("hide")}),this},navigate:function(e){e.preventDefault(),app.router.navigate(Genghis.Util.route($(e.target).attr("href")),!0)},remove:function(){this.$el.remove()},isParanoid:!1,destroy:function(){var e=this.model,t=e.has("name")?e.get("name"):"";if(this.isParanoid){if(!t)throw"Unable to confirm destruction without a confirmation string.";new Genghis.Views.Confirm({header:"Deleting is forever.",body:"Type <strong>"+t+"</strong> to continue:",confirmInput:t,confirmText:"Delete "+t+" forever",confirm:function(){e.destroy()}})}else new Genghis.Views.Confirm({confirmText:this.destroyConfirmButton(t),confirm:function(){e.destroy()}})},destroyConfirmButton:function(e){return"<strong>Yes</strong>, delete "+e+" forever"}}),Genghis.Views.BaseSection=Backbone.View.extend({events:{"click .add-form button.show":"showAddForm","click .add-form button.add":"submitAddForm","click .add-form button.cancel":"closeAddForm","keyup .add-form input.name":"updateOnKeyup"},initialize:function(){_.bindAll(this,"render","updateTitle","showAddForm","submitAddForm","closeAddForm","updateOnKeyup","addModel","addModelAndUpdate","addAll"),this.model&&this.model.bind("change",this.updateTitle),this.collection&&(this.collection.bind("reset",this.render),this.collection.bind("add",this.addModelAndUpdate)),this.render()},render:function(){return this.$el.html(this.template.render({title:this.formatTitle(this.model)})),this.addForm=this.$(".add-form"),this.addButton=this.$(".add-form button.add"),this.addInput=this.$(".add-form input"),this.cancelButton=this.$(".add-form button.cancel"),this.addAll(),this.$("table").tablesorter({textExtraction:function(e){return $(".value",e).text()||$(e).text()}}),this.collection.size()&&this.$("table").trigger("sorton",[[[0,0]]]),this},updateTitle:function(){this.$("> header h2").text(this.formatTitle(this.model))},showAddForm:function(e){e&&e.preventDefault()&&e.preventDefault(),this.addForm.removeClass("inactive"),this.addInput.select().focus()},submitAddForm:function(){this.collection.create({name:this.addInput.val()},{wait:!0,success:this.closeAddForm,error:function(e,t){window.app.alerts.handleError(t)}})},closeAddForm:function(){this.addForm.addClass("inactive"),this.addInput.val("")},updateOnKeyup:function(e){13==e.keyCode&&this.submitAddForm(),27==e.keyCode&&this.closeAddForm()},addModel:function(e){var t=new this.rowView({model:e});this.$("table tbody").append(t.render().el)},addModelAndUpdate:function(e){this.addModel(e),this.$("table").trigger("update")},addAll:function(){this.$("table tbody").html(""),this.collection.each(this.addModel),this.$el.removeClass("spinning")},show:function(){Mousetrap.bind("c",this.showAddForm),$("body").addClass("section-"+this.$el.attr("id")),this.$el.addClass("spinning").show(),$(document).scrollTop(0)},hide:function(){Mousetrap.unbind("c"),$("body").removeClass("section-"+this.$el.attr("id")),this.$el.hide()}}),Genghis.Models.Alert=Backbone.Model.extend({defaults:{level:"warning",block:!1},block:function(){return!!this.get("block")},level:function(){return this.get("level")},msg:function(){return this.get("msg")}}),Genghis.Models.Collection=Genghis.Models.BaseModel.extend({indexesIsPlural:function(){return 1!==this.indexCount()},indexCount:function(){return(this.get("indexes")||[]).length},indexes:function(){return _.map(this.get("indexes"),function(e){return Genghis.JSON.prettyPrint(e.key)})},isGridCollection:function(){return/\.files$/.test(this.get("name"))},humanSize:function(){var e=this.get("stats");return e?Genghis.Util.humanizeSize((e.storageSize||0)+(e.totalIndexSize||0)):void 0},stats:function(){var e=Genghis.Util.humanizeSize,t=this.get("stats");return t?[{name:"Avg. object size",value:e(t.avgObjSize||0)},{name:"Padding factor",value:t.paddingFactor||"n/a"},{name:"Data size",value:e(t.size||0)},{name:"Index size",value:e(t.totalIndexSize||0)},{name:"Storage size",value:e(t.storageSize||0)}]:void 0}}),Genghis.Models.Database=Genghis.Models.BaseModel.extend({firstChildren:function(){return _.first(this.get("collections")||[],15)},humanSize:function(){var e=this.get("stats");return e?Genghis.Util.humanizeSize((e.fileSize||0)+(e.indexSize||0)):void 0},stats:function(){var e=Genghis.Util.humanizeSize,t=this.get("stats");return t?[{name:"Avg. object size",value:e(t.avgObjSize||0)},{name:"Data size",value:e(t.dataSize||0)},{name:"Index size",value:e(t.indexSize||0)},{name:"Storage size",value:e(t.fileSize||0)}]:void 0},error:function(){return this.get("error")}}),Genghis.Models.Document=Backbone.Model.extend({idAttribute:null,initialize:function(){_.bindAll(this,"prettyId","prettyTime","prettyPrint","JSONish","isGridFile","isGridChunk","downloadUrl","fileUrl")},parse:function(e){var t=Genghis.Util.encodeDocumentId(e._id);return t&&(this.id=t),e},url:function(){var e=function(e){return e&&e.url?_.isFunction(e.url)?e.url():e.url:null},t=e(this.collection)||this.urlRoot||urlError();return t=t.split("?").shift(),this.isNew()?t:t+("/"==t.charAt(t.length-1)?"":"/")+encodeURIComponent(this.id)},prettyId:function(){var e=this.get("_id");if(_.isObject(e)&&e.hasOwnProperty("$genghisType"))switch(e.$genghisType){case"ObjectId":return e.$value;case"BinData":if(3==e.$value.$subtype){var t=/^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})$/i,n=Genghis.Util.base64ToHex(e.$value.$binary);if(t.test(n))return n.replace(t,"$1-$2-$3-$4-$5")}return e.$value.$binary.replace(/\=+$/,"")}return Genghis.JSON.stringify(e,!1)},prettyTime:function(){if(!this.collection||this.collection.guessCreationTime){if("undefined"==typeof this._prettyTime){var e=this.get("_id");if(_.isObject(e)&&e.hasOwnProperty("$genghisType")&&"ObjectId"===e.$genghisType&&24==e.$value.length){var t=new Date;t.setTime(1e3*parseInt(e.$value.substring(0,8),16)),this._prettyTime=t.toUTCString()}}return this._prettyTime}},prettyPrint:function(){return Genghis.JSON.prettyPrint(this.toJSON())},JSONish:function(){return Genghis.JSON.stringify(this.toJSON())},isGridFile:function(){return this.get("chunkSize")&&/\.files\/documents\//.test(this.url())},isGridChunk:function(){return this.get("files_id")&&/\.chunks\/documents\//.test(this.url())},downloadUrl:function(){if(!this.isGridFile())throw"Not a GridFS file.";return this.url().replace(/\.files\/documents\//,".files/files/")},fileUrl:function(){if(!this.isGridChunk())throw"Not a GridFS chunk.";return this.url().replace(/\.chunks\/documents\//,".files/documents/").replace(this.id,Genghis.Util.encodeDocumentId(this.get("files_id")))}}),Genghis.Models.Pagination=Backbone.Model.extend({defaults:{page:1,pages:1,limit:50,count:0,total:0},initialize:function(){_.bindAll(this,"decrementTotal")},decrementTotal:function(){this.set({total:this.get("total")-1,count:this.get("count")-1})}}),Genghis.Models.Selection=Backbone.Model.extend({defaults:{server:null,database:null,collection:null,query:null,page:null},initialize:function(){_.bindAll(this,"select","update","nextPage","previousPage"),this.bind("change",this.update),this.pagination=new Genghis.Models.Pagination,this.servers=new Genghis.Collections.Servers,this.currentServer=new Genghis.Models.Server,this.databases=new Genghis.Collections.Databases,this.currentDatabase=new Genghis.Models.Database,this.collections=new Genghis.Collections.Collections,this.currentCollection=new Genghis.Models.Collection,this.documents=new Genghis.Collections.Documents,this.currentDocument=new Genghis.Models.Document},select:function(e,t,n,r,i,o){this.set({server:e||null,database:t||null,collection:n||null,document:r||null,query:i||null,page:o||null})},update:function(){function e(e,t){if(404!==t.status){try{data=JSON.parse(t.responseText)}catch(n){data={}}app.alerts.create({msg:data.error||"Unknown error",level:"error",block:!0})}}function t(t,n,r){return n=n||"Not Found",r=r||"Please try again.",function(t,i){switch(i.status){case 404:app.showSection(),app.showMasthead("404: "+n,"<p>"+r+"</p>",{error:!0});break;default:e(t,i)}}}var n=this.get("server"),r=this.get("database"),i=this.get("collection"),o=this.get("document"),s=this.get("query"),a=this.get("page"),l=app.baseUrl,c={};if(l+="servers",this.servers.url=l,this.servers.fetch({reset:!0,error:e}),n?(l=l+"/"+encodeURIComponent(n),this.currentServer.url=l,this.currentServer.fetch({reset:!0,error:t("databases","Server Not Found")}),l+="/databases",this.databases.url=l,this.databases.fetch({reset:!0,error:e})):(this.currentServer.clear(),this.databases.reset()),r?(l=l+"/"+encodeURIComponent(r),this.currentDatabase.url=l,this.currentDatabase.fetch({reset:!0,error:t("collections","Database Not Found")}),l+="/collections",this.collections.url=l,this.collections.fetch({reset:!0,error:e})):(this.currentDatabase.clear(),this.collections.reset()),i){l=l+"/"+encodeURIComponent(i),this.currentCollection.url=l,this.currentCollection.fetch({reset:!0,error:t("documents","Collection Not Found")}),l+="/documents";var u="";(s||a)&&(s&&(c.q=encodeURIComponent(JSON.stringify(Genghis.JSON.parse(s)))),a&&(c.page=encodeURIComponent(a)),u="?"+Genghis.Util.buildQuery(c)),this.documents.url=l+u,this.documents.fetch({reset:!0,error:e})}else this.currentCollection.clear(),this.documents.reset();o&&(this.currentDocument.clear({silent:!0}),this.currentDocument.id=o,this.currentDocument.urlRoot=l,this.currentDocument.fetch({reset:!0,error:t("document","Document Not Found","But I’m sure there are plenty of other nice documents out there…")}))},nextPage:function(){return 1+(this.get("page")||1)},previousPage:function(){return Math.max(1,(this.get("page")||1)-1)}}),Genghis.Models.Server=Genghis.Models.BaseModel.extend({editable:function(){return!!this.get("editable")},firstChildren:function(){return _.first(this.get("databases")||[],15)},error:function(){return this.get("error")}}),Genghis.Collections.Alerts=Backbone.Collection.extend({model:Genghis.Models.Alert,initialize:function(){_.bindAll(this,"handleError")},handleError:function(e){if(0!==e.readyState){try{data=JSON.parse(e.responseText)}catch(t){data={error:e.responseText}}msg=data.error||"<strong>FAIL</strong> An unexpected server error has occurred.",this.add({level:"error",msg:msg,block:!msg.search(/<(p|ul|ol|div)[ >]/)})}}}),Genghis.Collections.Collections=Genghis.Collections.BaseCollection.extend({model:Genghis.Models.Collection}),Genghis.Collections.Databases=Genghis.Collections.BaseCollection.extend({model:Genghis.Models.Database}),Genghis.Collections.Documents=Backbone.Collection.extend({model:Genghis.Models.Document,parse:function(e){return app.selection.pagination.set({page:e.page,pages:e.pages,count:e.documents.length,total:e.count}),this.guessCreationTime=_.all(e.documents,function(e){var t=e._id||null;if(!_.isObject(t)||"ObjectId"!=t.$genghisType)return!0;if(24!=t.$value.length)return!1;var n=1e3*parseInt(t.$value.substring(0,8),16);return n>this.start&&this.end>n},{start:1251388342e3,end:(new Date).getTime()+1728e5}),e.documents}}),Genghis.Collections.Servers=Backbone.Collection.extend({model:Genghis.Models.Server,firstChildren:function(){return this.collection.reject(function(e){return e.has("error")}).slice(0,10)},hasMoreChildren:function(){return this.collection.length>10||this.collection.detect(function(e){return e.has("error")})}}),Genghis.Views.Alert=Backbone.View.extend({tagName:"div",template:Genghis.Templates.Alert,events:{"click a.close":"destroy"},initialize:function(){_.bindAll(this,"render","remove","destroy"),this.model.bind("change",this.render),this.model.bind("destroy",this.remove)},render:function(){return this.$el.html(this.template.render(this.model)),this},destroy:function(){this.model.destroy()},remove:function(){this.$el.remove()}}),Genghis.Views.Alerts=Backbone.View.extend({el:"aside#alerts",initialize:function(){_.bindAll(this,"render","addModel"),this.collection.bind("reset",this.render),this.collection.bind("add",this.addModel)},render:function(){return this.$el.html(""),this},addModel:function(e){var t=new Genghis.Views.Alert({model:e});this.$el.append(t.render().el)}}),Genghis.Views.App=Backbone.View.extend({el:"section#genghis",initialize:function(){_.bindAll(this,"showMasthead","removeMasthead","showSection");var e=this.baseUrl=this.options.baseUrl,t=this.selection=new Genghis.Models.Selection,n=this.alerts=new Genghis.Collections.Alerts,r=this.router=new Genghis.Router;this.navbarView=new Genghis.Views.Navbar({model:t,baseUrl:e,router:r}),this.alertsView=new Genghis.Views.Alerts({collection:n}),this.keyboardShortcutsView=new Genghis.Views.KeyboardShortcuts,this.serversView=new Genghis.Views.Servers({collection:t.servers}),this.databasesView=new Genghis.Views.Databases({model:t.currentServer,collection:t.databases}),this.collectionsView=new Genghis.Views.Collections({model:t.currentDatabase,collection:t.collections}),this.documentsView=new Genghis.Views.Documents({model:t.currentCollection,collection:t.documents,pagination:t.pagination}),this.documentView=new Genghis.Views.Document({model:t.currentDocument}),this.sections={servers:this.serversView,databases:this.databasesView,collections:this.collectionsView,documents:this.documentsView,document:this.documentView},$.getJSON(this.baseUrl+"check-status").error(n.handleError).success(function(e){_.each(e.alerts,function(e){n.add(_.extend({block:!e.msg.search(/<(p|ul|ol|div)[ >]/i)},e))})}),_.defer(function(){t.trigger("change")})},showMasthead:function(e,t,n){this.removeMasthead(!0),mastheadView=new Genghis.Views.Masthead(_.extend(n||{},{heading:e,content:t||""}))},removeMasthead:function(e){var t=$("header.masthead");e||(t=t.not(".sticky")),t.remove()},showSection:function(e){var t=e&&_.has(this.sections,e);this.removeMasthead(),"servers"==e&&this.showWelcome(),$("body").toggleClass("has-section",t),_.each(this.sections,function(t,n){n!=e&&t.hide()}),t&&this.sections[e].show()},showWelcome:_.once(function(){this.showMasthead("",Genghis.Templates.Welcome.render({version:Genghis.version}),{epic:!0,className:"masthead welcome"})})}),Genghis.Views.CollectionRow=Genghis.Views.BaseRow.extend({template:Genghis.Templates.CollectionRow,isParanoid:!0}),Genghis.Views.Collections=Genghis.Views.BaseSection.extend({el:"section#collections",template:Genghis.Templates.Collections,rowView:Genghis.Views.CollectionRow,events:{"click .add-form button.show":"showAddForm","click .add-form a.show":"showAddForm","click .add-form a.show-gridfs":"showGridFSAddForm","click .add-form button.add":"submitAddForm","click .add-form button.cancel":"closeAddForm","keyup .add-form input.name":"updateOnKeyup"},initialize:function(){_.bindAll(this,"showGridFSAddForm"),Genghis.Views.BaseSection.prototype.initialize.apply(this,arguments)},render:function(){return Genghis.Views.BaseSection.prototype.render.apply(this,arguments),this.$(".dropdown-toggle").dropdown(),this},formatTitle:function(e){return e.id?e.id+" Collections":"Collections"},submitAddForm:function(){var e=this.addInput.val().replace(/^\s+/,"").replace(/\s+$/,"");return""===e?(window.app.alerts.add({msg:"Please enter a valid collection name."}),void 0):(this.addButton.hasClass("add-gridfs")?(e=e.replace(/\.(files|chunks)$/,""),this.collection.create({name:e+".files"}),this.collection.create({name:e+".chunks"})):this.collection.create({name:e}),this.closeAddForm(),void 0)},showAddForm:function(){var e=this.$(".input-wrapper");e.length&&e.replaceWith(e.find("input")),this.addButton.removeClass("add-gridfs").text("Add collection"),Genghis.Views.BaseSection.prototype.showAddForm.apply(this,arguments)},showGridFSAddForm:function(e){e&&e.preventDefault&&e.preventDefault(),0===this.$(".input-wrapper").length&&(this.addInput.wrap('<div class="input-wrapper input-append">'),$('<span class="add-on">.files</span>').insertAfter(this.addInput)),this.addButton.addClass("add-gridfs").text("Add GridFS collection"),this.addForm.removeClass("inactive"),""===this.addInput.val()&&this.addInput.val("fs"),this.addInput.select().focus()},show:function(){Mousetrap.bind("shift+c",this.showGridFSAddForm),Genghis.Views.BaseSection.prototype.show.apply(this,arguments)},hide:function(){Mousetrap.unbind("shift+c"),Genghis.Views.BaseSection.prototype.hide.apply(this,arguments)}}),Genghis.Views.Confirm=Backbone.View.extend({className:"modal confirm-modal",template:Genghis.Templates.Confirm,events:{"click button.dismiss":"dismiss","click button.confirm":"confirm","keyup .confirm-input":"validateInput"},defaults:{header:null,body:"Really? There is no undo.",confirmText:"Okay",dismissText:"Cancel"},initialize:function(){_.bindAll(this,"render","confirm","validateInput","dismiss","remove"),this.onConfirm=this.options.confirm||function(){},this.confirmInput=this.options.confirmInput,this.modalOptions=_.pick(this.options,"backdrop","keyboard"),this.renderContext=_.defaults(_.pick(this.options,"header","body","confirmText","confirmInput","dismissText"),this.defaults),this.options.show!==!1&&this.render()},render:function(){var e=this.$el.html(this.template.render(this.renderContext));return this.confirmInput&&e.on("shown",function(){e.find(".confirm-input").focus()}),e.modal(this.modalOptions),this},confirm:function(){this.onConfirm(),this.dismiss()},validateInput:function(e){var t=this.$("button.confirm");$(e.target).val()==this.confirmInput?(t.removeAttr("disabled"),13==e.keyCode&&(e.preventDefault(),t.click())):t.attr("disabled",!0)},dismiss:function(){this.$el.on("hidden",this.remove).modal("hide")},remove:function(){this.$el.remove()}}),Genghis.Views.DatabaseRow=Genghis.Views.BaseRow.extend({template:Genghis.Templates.DatabaseRow,isParanoid:!0}),Genghis.Views.Databases=Genghis.Views.BaseSection.extend({el:"section#databases",template:Genghis.Templates.Databases,rowView:Genghis.Views.DatabaseRow,formatTitle:function(e){return e.id?e.id+" Databases":"Databases"}}),Genghis.Views.Document=Backbone.View.extend({el:"section#document",template:Genghis.Templates.Document,initialize:function(){_.bindAll(this,"render"),this.model.bind("change",this.render)},render:function(){var e=new Genghis.Views.DocumentView({model:this.model});return this.$el.removeClass("spinning").html(this.template.render({model:this.model})),this.$(".content").html(e.render().el),this},show:function(){$("body").addClass("section-"+this.$el.attr("id")),this.$el.addClass("spinning").show(),$(document).scrollTop(0)},hide:function(){$("body").removeClass("section-"+this.$el.attr("id")),this.$el.hide()}}),Genghis.Views.DocumentView=Genghis.Views.BaseDocument.extend({tagName:"article",template:Genghis.Templates.DocumentView,events:{"click a.id":"navigate","click button.edit":"openEditDialog","click button.save":"saveDocument","click button.cancel":"cancelEdit","click button.destroy":"destroy","click a.grid-download":"download","click a.grid-file":"navigate","click .ref .ref-ref .v .s":"navigateColl","click .ref .ref-db .v .s":"navigateDb","click .ref .ref-id .v .s, .ref .ref-id .v.n":"navigateId"},initialize:function(){_.bindAll(this,"render","updateDocument","navigate","openEditDialog","cancelEdit","saveDocument","destroy","remove","download","navigateColl","navigateDb","navigateId","showServerError"),this.model.bind("change",this.updateDocument),this.model.bind("destroy",this.remove)},render:function(){return this.$el.html(this.template.render(this.model)),Genghis.Util.attachCollapsers(this.el),setTimeout(this.updateDocument,1),this},updateDocument:function(){this.$(".document").html("").append(this.model.prettyPrint()).show()},navigate:function(e){e.preventDefault(),app.router.navigate(Genghis.Util.route($(e.target).attr("href")),!0)},navigateDb:function(e){var t=$(e.target).parents(".ref"),n=t.find(".ref-db .v .s").text();app.router.redirectToDatabase(app.selection.currentServer.id,n)},navigateColl:function(e){var t=$(e.target).parents(".ref"),n=t.find(".ref-db .v .s").text()||app.selection.currentDatabase.id,r=t.find(".ref-ref .v .s").text();app.router.redirectToCollection(app.selection.currentServer.id,n,r)},navigateId:function(e){var t=$(e.target).parents(".ref"),n=t.find(".ref-db .v .s").text()||app.selection.currentDatabase.id,r=t.find(".ref-ref .v .s").text()||app.selection.currentCollection.id,i=t.find(".ref-id").attr("data-document-id");app.router.redirectToDocument(app.selection.currentServer.id,n,r,encodeURIComponent(i))},openEditDialog:function(){var e=this.$(".well"),t=Math.max(180,Math.min(600,e.height()+40)),n="editor-"+this.model.id.replace("~","-"),r=$('<textarea id="'+n+'"></textarea>').text(this.model.JSONish()).appendTo(e);this.$(".document").hide();var i=this.$el.addClass("edit");this.editor=CodeMirror.fromTextArea(r[0],_.extend({},Genghis.defaults.codeMirror,{autofocus:!0,extraKeys:{"Ctrl-Enter":this.saveDocument,"Cmd-Enter":this.saveDocument}})),this.editor.on("focus",function(){i.addClass("focused")}),this.editor.on("blur",function(){i.removeClass("focused")}),this.editor.setSize(null,t),r.resize(_.throttle(this.editor.refresh,100))},cancelEdit:function(){this.$el.removeClass("edit focused"),this.editor.toTextArea(),this.$("textarea").remove(),this.updateDocument(),this.$(".well").height("auto")},getErrorBlock:function(){var e=this.$("div.errors");return 0===e.length&&(e=$('<div class="errors"></div>').prependTo(this.el)),e},showServerError:function(e){var t=new Genghis.Views.Alert({model:new Genghis.Models.Alert({level:"error",msg:e,block:!0})});this.getErrorBlock().append(t.render().el)},saveDocument:function(){var e=this.getEditorValue();if(e!==!1){var t=this.showServerError;this.model.clear({silent:!0}),this.model.save(e,{wait:!0,success:this.cancelEdit,error:function(e,n){var r;try{r=JSON.parse(n.responseText).error}catch(i){}t(r||"Error updating document.")}})}},destroy:function(){var e=this.model,t=this.model.isGridFile(),n=t?"file":"document";t&&(this.model.url=this.model.url().replace(".files/documents/",".files/files/")),new Genghis.Views.Confirm({body:"<strong>Really?</strong> "+(t?"This will delete all GridFS chunks as well. <br><br>":"")+"There is no undo.",confirmText:"<strong>Yes</strong>, delete "+n+" forever",confirm:function(){var t=app.selection;e.destroy({wait:!0,error:function(e,t){var r;try{r=JSON.parse(t.responseText).error}catch(i){}app.alerts.create({level:"error",msg:r||"Error deleting "+n+"."})},success:function(){t.pagination.decrementTotal(),t.get("document")&&app.router.redirectTo(t.get("server"),t.get("database"),t.get("collection"),null,t.get("query"))}})}})},remove:function(){this.$el.remove()},download:function(e){Genghis.Util.download(this.model.downloadUrl()),e.preventDefault()}}),Genghis.Views.Documents=Backbone.View.extend({el:"section#documents",template:Genghis.Templates.Documents,events:{"click button.add-document":"createDocument","dragover button.file-upload":"dragGridFile","dragleave button.file-upload":"dragLeave","drop button.file-upload":"dropGridFile"},initialize:function(){_.bindAll(this,"render","addAll","addDocument","createDocument","dragGridFile","dragLeave","dropGridFile"),this.pagination=this.options.pagination,this.collection.bind("reset",this.addAll,this),this.collection.bind("add",this.addDocument,this),this.render()},render:function(){return this.$el.html(this.template.render({})),this.headerView=new Genghis.Views.DocumentsHeader({model:this.pagination}),this.paginationView=new Genghis.Views.Pagination({el:this.$(".pagination-wrapper"),model:this.pagination,collection:this.collection}),this.addAll(),this},addAll:function(){this.$(".content").html(""),this.$("button.add-document").text(this.model.isGridCollection()?"Upload file":"Add document").toggleClass("file-upload",this.model.isGridCollection()),this.collection.each(this.addDocument),this.$el.removeClass("spinning")},addDocument:function(e){var t=new Genghis.Views.DocumentView({model:e});this.$(".content").append(t.render().el)},createDocument:function(e){if(e&&e.preventDefault&&e.preventDefault(),this.model.isGridCollection()){if(!Modernizr.filereader)return app.alerts.create({msg:"<h2>Unable to upload file.</h2> Your browser does not support the File API. Please use a modern browser.",level:"error",block:!0}),void 0;this.getNewGridFileView().show()}else this.getNewDocumentView().show()},dragGridFile:function(e){e.stopPropagation(),e.preventDefault(),e.originalEvent.dataTransfer.dropEffect="copy",$(e.target).addClass("active")},dragLeave:function(e){$(e.target).removeClass("active")},dropGridFile:function(e){return e.stopPropagation(),e.preventDefault(),$(e.target).removeClass("active"),Modernizr.filereader?(this.getNewGridFileView().showMetadata(e.originalEvent.dataTransfer.files[0]),void 0):(app.alerts.create({msg:"<h2>Unable to upload file.</h2> Your browser does not support the File API. Please use a modern browser.",level:"error",block:!0}),void 0)},getNewDocumentView:function(){return this.newDocumentView||(this.newDocumentView=new Genghis.Views.NewDocument({collection:this.collection})),this.newDocumentView},getNewGridFileView:function(){return this.newGridFileView||(this.newGridFileView=new Genghis.Views.NewGridFile({collection:this.collection})),this.newGridFileView},show:function(){Mousetrap.bind("c",this.createDocument),$("body").addClass("section-"+this.$el.attr("id")),this.$el.addClass("spinning").show(),$(document).scrollTop(0)},hide:function(){Mousetrap.unbind("c"),$("body").removeClass("section-"+this.$el.attr("id")),this.$el.hide()}}),Genghis.Views.DocumentsHeader=Backbone.View.extend({el:"section#documents > header h2",initialize:function(){_.bindAll(this,"render"),this.model.bind("change",this.render)},render:function(){var e,t=this.model.get("count"),n=this.model.get("page");this.model.get("pages");var r=this.model.get("limit"),i=this.model.get("total");if(e=""+i+" Document"+(1!=i?"s":""),i!=t){var o=(n-1)*r+1,s=Math.min((n-1)*r+t,i);e=""+o+" - "+s+" of "+e}return this.$el.html(e),this}}),Genghis.Views.KeyboardShortcuts=Backbone.View.extend({tagName:"div",template:Genghis.Templates.KeyboardShortcuts,events:{"click a.close":"hide"},initialize:function(){_.bindAll(this,"render","show","hide","toggle"),Mousetrap.bind("?",this.toggle),$("footer a.keyboard-shortcuts").click(this.show),this.render()},render:function(){return this.$el.html(this.template.render()).modal({backdrop:!0,keyboard:!0,show:!1}),this},show:function(e){e.preventDefault(),this.$el.modal("show")},hide:function(e){e.preventDefault(),this.$el.modal("hide")},toggle:function(){this.$el.modal("toggle")}}),Genghis.Views.Masthead=Backbone.View.extend({tagName:"header",attributes:{"class":"masthead"},template:Genghis.Templates.Masthead,initialize:function(){this.heading=this.options.heading,this.content=this.options.content||"",this.error=this.options.error||!1,this.epic=this.options.epic||!1,this.sticky=this.options.sticky||!1,this.render()},render:function(){return this.$el.html(this.template.render({heading:this.heading,content:this.content})).toggleClass("error",this.error).toggleClass("epic",this.epic).toggleClass("sticky",this.sticky).insertAfter("header.navbar"),this}}),Genghis.Views.Nav=Backbone.View.extend({el:".navbar nav",template:Genghis.Templates.Nav,events:{"click a":"navigate"},initialize:function(){_.bindAll(this,"render","navigate","navigateToServers","navigateUp"),this.baseUrl=this.options.baseUrl,this.model.bind("change",this.updateQuery),$("body").bind("click",function(){$(".dropdown-toggle, .menu").parent("li").removeClass("open")}),Mousetrap.bind("s",this.navigateToServers),Mousetrap.bind("u",this.navigateUp),this.render()},render:function(){return this.$el.html(this.template.render({baseUrl:this.baseUrl})),this.serverNavView=new Genghis.Views.NavSection({el:this.$("li.server"),model:this.model.currentServer,collection:this.model.servers}),this.databaseNavView=new Genghis.Views.NavSection({el:this.$("li.database"),model:this.model.currentDatabase,collection:this.model.databases}),this.collectionNavView=new Genghis.Views.NavSection({el:this.$("li.collection"),model:this.model.currentCollection,collection:this.model.collections}),this.searchView=new Genghis.Views.Search({model:this.model}),this.$el.append(this.searchView.render().el),this},navigate:function(e){e.preventDefault(),app.router.navigate(Genghis.Util.route($(e.target).attr("href")),!0)},navigateToServers:function(e){e.preventDefault(),app.router.redirectToIndex()},navigateUp:function(e){e.preventDefault(),app.router.redirectTo(this.model.has("database")&&this.model.get("server"),this.model.has("collection")&&this.model.get("database"),(this.model.has("document")||this.model.has("query"))&&this.model.get("collection"))}}),Genghis.Views.NavSection=Backbone.View.extend({template:Genghis.Templates.NavSection,menuTemplate:Genghis.Templates.NavSectionMenu,initialize:function(){_.bindAll(this,"render"),this.model.bind("change",this.updateLink,this),this.collection.bind("reset",this.renderMenu,this),this.render()},render:function(){return this.$el.html(this.template.render(this.model)),this.$(".dropdown-toggle").hoverIntent(function(e){$(e.target).parent("li").addClass("open").siblings("li").removeClass("open")},$.noop),this},updateLink:function(){this.$("a.dropdown-toggle").text(this.model.id?this.model.id:"").attr("href",this.model.id?this.model.url:"")
|
1091
1091
|
},renderMenu:function(){this.$("ul.dropdown-menu").html(this.menuTemplate.render({model:this.model,collection:this.collection})),this.$("ul.dropdown-menu a span").each(function(e,t){var n=$(t),r=n.text().length;r>3&&n.parent().css("padding-right",""+(r+.5)+"em")})}}),Genghis.Views.Navbar=Backbone.View.extend({el:".navbar",events:{"click a.brand":"onClickBrand"},initialize:function(){this.router=this.options.router,this.navView=new Genghis.Views.Nav({model:this.model,baseUrl:this.options.baseUrl})},onClickBrand:function(e){e.preventDefault(),this.router.navigate("",!0)}}),Genghis.Views.NewDocument=Genghis.Views.BaseNewDocument.extend({el:"#new-document",template:Genghis.Templates.NewDocument,getTextArea:function(){return this.$("#editor-new")[0]},show:function(){this.editor.setValue("{\n \n}\n"),this.editor.setCursor({line:1,ch:4}),this.modal.modal("show")},saveDocument:function(){var e=this.getEditorValue();if(e!==!1){var t=this.closeModal,n=this.showServerError;this.collection.create(e,{wait:!0,success:function(e){t(),app.router.navigate(Genghis.Util.route(e.url()),!0)},error:function(e,t){var r;try{r=JSON.parse(t.responseText).error}catch(i){}n(r||"Error creating document.")}})}}}),Genghis.Views.NewGridFile=Genghis.Views.BaseNewDocument.extend({el:"#new-grid-file",template:Genghis.Templates.NewGridFile,initialize:function(){_.bindAll(this,"handleFileInputChange","showMetadata"),Genghis.Views.BaseNewDocument.prototype.initialize.apply(this,arguments)},render:function(){return Genghis.Views.BaseNewDocument.prototype.render.apply(this,arguments),this.fileInput=$('<input id="new-grid-file-input" type="file">').hide().appendTo("body"),this.currentFile=null,this.fileInput.bind("change",this.handleFileInputChange),this},getTextArea:function(){return this.$("#editor-upload")[0]},show:function(){this.fileInput.click()},handleFileInputChange:function(e){this.showMetadata(e.target.files[0])},showMetadata:function(e){this.currentFile=e,e&&(this.fileInput.val(""),this.editor.setValue(Genghis.JSON.stringify({filename:e.name,contentType:e.type||"binary/octet-stream",metadata:{}})),this.editor.setCursor({line:3,ch:15}),this.modal.modal("show"))},saveDocument:function(){var e=this.getEditorValue();if(e!==!1){if(e.file)return this.showServerError("Unexpected property: 'file'"),void 0;var t=this.closeModal,n=this.showServerError,r=this.collection,i=this.collection.url.replace(".files/documents",".files/files"),o=new FileReader;o.onload=function(o){e.file=o.target.result,$.ajax({type:"POST",url:i,data:JSON.stringify(e),contentType:"application/json"}).success(function(e){r.add(e),t();var n=new Genghis.Models.Document(e).prettyId();app.router.navigate(Genghis.Util.route(r.url+"/"+n),!0)}).error(function(e){var t;try{t=JSON.parse(e.responseText).error}catch(r){}n(t||"Error uploading file.")})},o.readAsDataURL(this.currentFile)}}}),Genghis.Views.Pagination=Backbone.View.extend({template:Genghis.Templates.Pagination,events:{"click a":"navigate"},initialize:function(){_.bindAll(this,"render","urlTemplate","navigate","nextPage","prevPage"),this.model.bind("change",this.render),Mousetrap.bind("n",this.nextPage),Mousetrap.bind("p",this.prevPage)},render:function(){if(1==this.model.get("pages"))this.$el.hide();else{var e=9,t=Math.ceil(e/2),n=this.model.get("page"),r=this.model.get("pages"),i=n>t?Math.max(n-(t-3),1):1,o=r-n>t?Math.min(n+(t-3),r):r,s=o==r?Math.max(r-(e-3),1):i,a=1==i?Math.min(s+(e-3),r):o;a>=r-2&&(a=r),3>=s&&(s=1);var l=this.urlTemplate;this.$el.html(this.template.render({page:n,last:r,firstUrl:l(1),prevUrl:l(Math.max(1,n-1)),nextUrl:l(Math.min(n+1,r)),lastUrl:l(r),pageUrls:_.range(s,a+1).map(function(e){return{index:e,url:l(e),active:e===n}}),isFirst:1===n,isStart:1===s,isEnd:a>=r,isLast:n===r})).show()}return this},urlTemplate:function(e){var t=this.collection.url,n=t.split("?"),r=n.shift(),i=Genghis.Util.parseQuery(n.join("?")),o={page:e};return i.q&&(o.q=encodeURIComponent(app.selection.get("query"))),r+"?"+Genghis.Util.buildQuery(_.extend(i,o))},navigate:function(e){e.preventDefault();var t=$(e.target).attr("href");t&&app.router.navigate(Genghis.Util.route(t),!0)},nextPage:function(e){this.$el.is(":visible")&&(e.preventDefault(),this.$("li.next a[href]").click())},prevPage:function(e){this.$el.is(":visible")&&(e.preventDefault(),this.$("li.prev a[href]").click())}}),Genghis.Views.Search=Backbone.View.extend({tagName:"form",className:"navbar-search form-search control-group",template:Genghis.Templates.Search,events:{"keyup input#navbar-query":"handleSearchKeyup","click span.grippie":"toggleExpanded","dragmove span.grippie":"handleGrippieDrag","click button.cancel":"collapseSearch","click button.search":"findDocumentsAdvanced"},initialize:function(){_.bindAll(this,"render","updateQuery","handleSearchKeyup","findDocuments","findDocumentsAdvanced","focusSearch","blurSearch","advancedSearchToQuery","queryToAdvancedSearch","expandSearch","collapseSearch","collapseNoFocus","toggleExpanded","handleGrippieDrag"),this.model.bind("change",this.updateQuery),this.model.bind("change:collection",this.collapseNoFocus)},render:function(){this.$el.html(this.template.render({query:this.model.get("query")})),this.$el.submit(function(e){e.preventDefault()}),Mousetrap.bind("/",this.focusSearch);var e=this.$el;e.find(".well");var t=this.expandSearch,n=this.collapseSearch;return this.$(".grippie").bind("mousedown",function(r){function i(r){var i=r.clientY+document.documentElement.scrollTop-e.offset().top;return i>=s&&a>=i&&e.height(i+"px"),e.hasClass("expanded")?s>i&&n():i>100&&t(),!1}function o(t){$(document).unbind("mousemove",i).unbind("mouseup",o),e.hasClass("expanded")||n(),t.preventDefault()}r.preventDefault();var s=30,a=Math.min($(window).height()/2,350);$(document).mousemove(i).mouseup(o)}),this},updateQuery:function(){var e=this.normalizeQuery(this.model.get("query")||this.getDocumentQuery()||"");this.$("input#navbar-query").val(e)},getDocumentQuery:function(){var e=this.model.get("document");return _.isString(e)&&"~"===e[0]&&(e=Genghis.JSON.normalize('{"_id":'+Genghis.Util.decodeDocumentId(e)+"}")),e},handleSearchKeyup:function(e){this.$el.removeClass("error"),13==e.keyCode?(e.preventDefault(),this.findDocuments($(e.target).val())):27==e.keyCode&&this.blurSearch()},findDocuments:function(e){var t=Genghis.Util.route(this.model.currentCollection.url+"/documents");if(e=e.trim(),e.match(/^([a-z\d]+)$/i))t=t+"/"+e;else{try{e=Genghis.JSON.normalize(e,!1)}catch(n){return this.$el.addClass("error"),void 0}t=t+"?"+Genghis.Util.buildQuery({q:encodeURIComponent(e)})}app.router.navigate(t,!0)},findDocumentsAdvanced:function(){this.findDocuments(this.editor.getValue()),this.collapseSearch()},focusSearch:function(e){this.$("input#navbar-query").is(":visible")?(e&&e.preventDefault(),this.$("input#navbar-query").focus()):this.editor&&this.$(".well").is(":visible")&&(e&&e.preventDefault(),this.editor.focus())},blurSearch:function(){this.$("input#navbar-query").blur(),this.updateQuery()},normalizeQuery:function(e){if(e=e.trim(),""!==e)try{e=Genghis.JSON.normalize(e,!1)}catch(t){}return e.replace(/^\{\s*\}$/,"").replace(/^\{\s*(['"]?)_id\1\s*:\s*\{\s*(['"]?)\$id\2\s*:\s*(["'])([a-z\d]+)\3\s*\}\s*\}$/,"$4").replace(/^\{\s*(['"]?)_id\1\s*:\s*(new\s+)?ObjectId\s*\(\s*(["'])([a-z\d]+)\3\s*\)\s*\}$/,"$4")},advancedSearchToQuery:function(){this.$("input#navbar-query").val(this.normalizeQuery(this.editor.getValue()))},queryToAdvancedSearch:function(){var e=this.$("input#navbar-query").val().trim();if(e.match(/^[a-z\d]+$/i)&&(e='{_id:ObjectId("'+e+'")}'),""!==e)try{e=Genghis.JSON.normalize(e,!0)}catch(t){}this.editor.setValue(e)},expandSearch:function(){if(!this.editor){var e=this.$(".search-advanced");this.editor=CodeMirror(this.$(".well")[0],_.extend({},Genghis.defaults.codeMirror,{lineNumbers:!1,extraKeys:{"Ctrl-Enter":this.findDocumentsAdvanced,"Cmd-Enter":this.findDocumentsAdvanced,Esc:this.findDocumentsAdvanced}})),this.editor.on("focus",function(){e.addClass("focused")}),this.editor.on("blur",function(){e.removeClass("focused")}),this.editor.on("change",this.advancedSearchToQuery)}this.queryToAdvancedSearch(),this.$el.addClass("expanded");var t=this.editor,n=this.focusSearch;_.defer(function(){t.refresh(),n()})},collapseSearch:function(){this.collapseNoFocus(),this.focusSearch()},collapseNoFocus:function(){this.$el.removeClass("expanded").css("height","auto")},toggleExpanded:function(){this.$el.hasClass("expanded")?this.collapseSearch():(this.expandSearch(),this.$el.height(Math.floor($(window).height()/4)+"px"))},handleGrippieDrag:function(e){console.log(e)}}),Genghis.Views.ServerRow=Genghis.Views.BaseRow.extend({template:Genghis.Templates.ServerRow,destroyConfirmButton:function(e){return"<strong>Yes</strong>, remove "+e+" from server list"}}),Genghis.Views.Servers=Genghis.Views.BaseSection.extend({el:"section#servers",template:Genghis.Templates.Servers,rowView:Genghis.Views.ServerRow,render:function(){return Genghis.Views.BaseSection.prototype.render.apply(this,arguments),$(".help",this.addForm).tooltip(),this},updateTitle:function(){},formatTitle:function(){return"Servers"}}),Genghis.Router=function(){function e(){var e=Array.prototype.slice.call(arguments);document.title=e.length?"Genghis \u2014 "+e.join(" \u203a "):"Genghis"}var t=encodeURIComponent;return Backbone.Router.extend({routes:{"":"index",servers:"redirectToIndex","servers/:server":"server","servers/:server/databases":"redirectToServer","servers/:server/databases/:database":"database","servers/:server/databases/:database/collections":"redirectToDatabase","servers/:server/databases/:database/collections/:collection":"collection","servers/:server/databases/:database/collections/:collection/documents":"collectionQueryOrRedirect","servers/:server/databases/:database/collections/:collection/documents?*query":"collectionQueryOrRedirect","servers/:server/databases/:database/collections/:collection/documents/:documentId":"document","*path":"notFound"},index:function(){e(),app.selection.select(),app.showSection("servers")},redirectToIndex:function(){this.navigate("",!0)},server:function(t){e(t),app.selection.select(t),app.showSection("databases")},redirectToServer:function(e){this.navigate("servers/"+t(e),!0)},database:function(t,n){e(t,n),app.selection.select(t,n),app.showSection("collections")},redirectToDatabase:function(e,n){this.navigate("servers/"+t(e)+"/databases/"+t(n),!0)},collection:function(t,n,r){return window.location.search?this.collectionQueryOrRedirect(t,n,r):(e(t,n,r),app.selection.select(t,n,r),app.showSection("documents"),void 0)},redirectToCollection:function(e,n,r){this.navigate("servers/"+t(e)+"/databases/"+t(n)+"/collections/"+t(r),!0)},collectionQueryOrRedirect:function(e,t,n){return window.location.search?this.collectionQuery(e,t,n,window.location.search.substr(1)):(this.redirectToCollection(e,t,n),void 0)},collectionQuery:function(t,n,r,i){e(t,n,r,"Query results");var o=Genghis.Util.parseQuery(i);app.selection.select(t,n,r,null,o.q,o.page),app.showSection("documents")},redirectToQuery:function(e,n,r,i){this.navigate("servers/"+t(e)+"/databases/"+t(n)+"/collections/"+t(r)+"/documents?"+Genghis.Util.buildQuery({q:t(i)}),!0)},document:function(t,n,r,i){e(t,n,r,Genghis.Util.decodeDocumentId(i)),app.selection.select(t,n,r,i),app.showSection("document")},redirectToDocument:function(e,t,n,r){var i=encodeURIComponent;this.navigate("servers/"+i(e)+"/databases/"+i(t)+"/collections/"+i(n)+"/documents/"+i(r),!0)},redirectTo:function(e,t,n,r,i){return e?t?n?r||i?i?this.redirectToQuery(e,t,n,i):this.redirectToDocument(e,t,n,r):this.redirectToCollection(e,t,n):this.redirectToDatabase(e,t):this.redirectToServer(e):this.redirectToIndex()},notFound:function(){e("404: Not Found"),app.showSection(),app.showMasthead("404: Not Found","<p>If you think you've reached this message in error, please press <strong>0</strong> to speak with an operator. Otherwise, hang up and try again.</p>",{error:!0,epic:!0})}})}();
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genghisapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Hileman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vegas
|