t)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:Je=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:Je=i)}return null!=r?r:Je}var Xe=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,r=/[stwN]/,i=/[LRr]/,o=/[Lb1n]/,a=/[1n]/;function u(e,t,n){this.level=e,this.from=t,this.to=n}return function(s,l){var c,f="ltr"==l?"L":"R";if(0==s.length||"ltr"==l&&!n.test(s))return!1;for(var p=s.length,d=[],h=0;h-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function it(e,t){var n=nt(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function st(e){e.prototype.on=function(e,t){tt(this,e,t)},e.prototype.off=function(e,t){rt(this,e,t)}}function lt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ct(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ft(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function pt(e){lt(e),ct(e)}function dt(e){return e.target||e.srcElement}function ht(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var mt,vt,gt=function(){if(a&&u<9)return!1;var e=N("div");return"draggable"in e||"dragDrop"in e}();function yt(e){if(null==mt){var t=N("span","\u200b");C(e,N("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(mt=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&u<8))}var n=mt?N("span","\u200b"):N("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function bt(e){if(null!=vt)return vt;var t=C(e,document.createTextNode("A\u062eA")),n=O(t,0,1).getBoundingClientRect(),r=O(t,1,2).getBoundingClientRect();return x(e),!(!n||n.left==n.right)&&(vt=r.right-n.right<3)}var wt=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Et=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Tt=function(){var e=N("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),_t=null,kt={},Ot={};function St(e){if("string"==typeof e&&Ot.hasOwnProperty(e))e=Ot[e];else if(e&&"string"==typeof e.name&&Ot.hasOwnProperty(e.name)){var t=Ot[e.name];"string"==typeof t&&(t={name:t}),(e=X(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return St("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return St("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function xt(e,t){t=St(t);var n=kt[t.name];if(!n)return xt(e,"text/plain");var r=n(e,t);if(Ct.hasOwnProperty(t.name)){var i=Ct[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var Ct={};function Nt(e,t){var n=Ct.hasOwnProperty(e)?Ct[e]:Ct[e]={};M(t,n)}function Dt(e,t){if(!0===t)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 At(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Lt(e,t,n){return!e.startState||e.startState(t,n)}var jt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};jt.prototype.eol=function(){return this.pos>=this.string.length},jt.prototype.sol=function(){return this.pos==this.lineStart},jt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},jt.prototype.next=function(){if(this.post},jt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},jt.prototype.skipToEnd=function(){this.pos=this.string.length},jt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},jt.prototype.backUp=function(e){this.pos-=e},jt.prototype.column=function(){return this.lastColumnPos0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(i(o)==i(e))return!1!==t&&(this.pos+=e.length),!0},jt.prototype.current=function(){return this.string.slice(this.start,this.pos)},jt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},jt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},jt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var It=function(e,t){this.state=e,this.lookAhead=t},Ft=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function Pt(e,t,n,r){var i=[e.state.modeGen],o={};Kt(e,t.text,e.doc.mode,n,function(e,t){return i.push(e,t)},o,r);for(var a=n.state,u=function(r){n.baseTokens=i;var u=e.state.overlays[r],s=1,l=0;n.state=!0,Kt(e,t.text,u.mode,n,function(e,t){for(var n=s;le&&i.splice(s,1,e,i[s+1],r),s+=2,l=Math.min(e,r)}if(t)if(u.opaque)i.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;ne.options.maxHighlightLength&&Dt(e.doc.mode,r.state),o=Pt(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Rt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Ft(r,!0,t);var o=function(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),u=t;u>a;--u){if(u<=o.first)return o.first;var s=se(o,u-1),l=s.stateAfter;if(l&&(!n||u+(l instanceof It?l.lookAhead:0)<=o.modeFrontier))return u;var c=R(s.text,null,e.options.tabSize);(null==i||r>c)&&(i=u-1,r=c)}return i}(e,t,n),a=o>r.first&&se(r,o-1).stateAfter,u=a?Ft.fromSaved(r,a,o):new Ft(r,Lt(r.mode),o);return r.iter(o,t,function(n){Vt(e,n.text,u);var r=u.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&rt.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}Ft.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Ft.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Ft.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Ft.fromSaved=function(e,t,n){return t instanceof It?new Ft(e,Dt(e.mode,t.state),n,t.lookAhead):new Ft(e,Dt(e.mode,t),n)},Ft.prototype.save=function(e){var t=!1!==e?Dt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new It(t,this.maxLookAhead):t};var zt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function qt(e,t,n,r){var i,o=e.doc,a=o.mode;t=_e(o,t);var u,s=se(o,t.line),l=Rt(e,t.line,n),c=new jt(s.text,e.options.tabSize,l);for(r&&(u=[]);(r||c.pose.options.maxHighlightLength?(u=!1,a&&Vt(e,t,r,f.pos),f.pos=t.length,s=null):s=Ht(Bt(n,f,r.state,p),o),p){var d=p[0].name;d&&(s="m-"+(s?d+" "+s:d))}if(!u||c!=s){for(;l1&&!/ /.test(e))return e;for(var n=t,r="",i=0;il&&f.from<=l);p++);if(f.to>=c)return e(n,r,i,o,a,u,s);e(n,r.slice(0,f.to-l),i,o,null,u,s),o=null,r=r.slice(f.to-l),l=f.to}}}function tn(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function nn(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,u,s,l,c,f,p,d=i.length,h=0,m=1,v="",g=0;;){if(g==h){s=l=c=u="",p=null,f=null,g=1/0;for(var y=[],b=void 0,w=0;wh||T.collapsed&&E.to==h&&E.from==h)){if(null!=E.to&&E.to!=h&&g>E.to&&(g=E.to,l=""),T.className&&(s+=" "+T.className),T.css&&(u=(u?u+";":"")+T.css),T.startStyle&&E.from==h&&(c+=" "+T.startStyle),T.endStyle&&E.to==g&&(b||(b=[])).push(T.endStyle,E.to),T.title&&((p||(p={})).title=T.title),T.attributes)for(var _ in T.attributes)(p||(p={}))[_]=T.attributes[_];T.collapsed&&(!f||Pe(f.marker,T)<0)&&(f=E)}else E.from>h&&g>E.from&&(g=E.from)}if(b)for(var k=0;k=d)break;for(var S=Math.min(d,g);;){if(v){var x=h+v.length;if(!f){var C=x>S?v.slice(0,S-h):v;t.addToken(t,C,a?a+s:s,c,h+C.length==g?l:"",u,p)}if(x>=S){v=v.slice(S-h),h=S;break}h=x,c=""}v=i.slice(o,o=n[m++]),a=Jt(n[m++],t.cm.options)}}else for(var N=1;Nn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Dn(e,t,n,r){return jn(e,Ln(e,t),n,r)}function An(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&t2&&o.push((s.bottom+l.top)/2-n.top)}}o.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,n,r){var i,o=Pn(t.map,n,r),s=o.node,l=o.start,c=o.end,f=o.collapse;if(3==s.nodeType){for(var p=0;p<4;p++){for(;l&&ie(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+c1}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}(e.display.measure,i))}else{var d;l>0&&(f=r="right"),i=e.options.lineWrapping&&(d=s.getClientRects()).length>1?d["right"==r?d.length-1:0]:s.getBoundingClientRect()}if(a&&u<9&&!l&&(!i||!i.left&&!i.right)){var h=s.parentNode.getClientRects()[0];i=h?{left:h.left,right:h.left+nr(e.display),top:h.top,bottom:h.bottom}:Fn}for(var m=i.top-t.rect.top,v=i.bottom-t.rect.top,g=(m+v)/2,y=t.view.measure.heights,b=0;bt)&&(i=(o=s-u)-1,t>=s&&(a="right")),null!=i){if(r=e[l+2],u==s&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;l&&e[l-2]==e[l-3]&&e[l-1].insertLeft;)r=e[2+(l-=3)],a="left";if("right"==n&&i==s-u)for(;l=0&&(n=e[i]).left==n.right;i--);return n}function Rn(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=r.text.length?(s=r.text.length,l="before"):s<=0&&(s=0,l="after"),!u)return a("before"==l?s-1:s,"before"==l);function c(e,t,n){var r=u[t],i=1==r.level;return a(n?e-1:e,i!=n)}var f=$e(u,s,l),p=Je,d=c(s,f,"before"==l);return null!=p&&(d.other=c(s,p,"before"!=l)),d}function Qn(e,t){var n=0;t=_e(e.doc,t),e.options.lineWrapping||(n=nr(e.display)*t.ch);var r=se(e.doc,t.line),i=We(r)+_n(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Yn(e,t,n,r,i){var o=ve(e,t,n);return o.xRel=i,r&&(o.outside=!0),o}function Jn(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return Yn(r.first,0,null,!0,-1);var i=de(r,n),o=r.first+r.size-1;if(i>o)return Yn(r.first+r.size-1,se(r,o).text.length,null,!0,1);t<0&&(t=0);for(var a=se(r,i);;){var u=er(e,a,i,t,n),s=Ue(a,u.ch+(u.xRel>0?1:0));if(!s)return u;var l=s.find(1);if(l.line==i)return l;a=se(r,i=l.line)}}function $n(e,t,n,r){r-=qn(t);var i=t.text.length,o=ae(function(t){return jn(e,n,t-1).bottom<=r},i,0);return i=ae(function(t){return jn(e,n,t).top>r},o,i),{begin:o,end:i}}function Xn(e,t,n,r){n||(n=Ln(e,t));var i=Hn(e,t,jn(e,n,r),"line").top;return $n(e,t,n,i)}function Zn(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function er(e,t,n,r,i){i-=We(t);var o=Ln(e,t),a=qn(t),u=0,s=t.text.length,l=!0,c=Ze(t,e.doc.direction);if(c){var f=(e.options.lineWrapping?function(e,t,n,r,i,o,a){var u=$n(e,t,r,a),s=u.begin,l=u.end;/\s/.test(t.text.charAt(l-1))&&l--;for(var c=null,f=null,p=0;p=l||d.to<=s)){var h=1!=d.level,m=jn(e,r,h?Math.min(l,d.to)-1:Math.max(s,d.from)).right,v=mv)&&(c=d,f=v)}}return c||(c=i[i.length-1]),c.froml&&(c={from:c.from,to:l,level:c.level}),c}:function(e,t,n,r,i,o,a){var u=ae(function(u){var s=i[u],l=1!=s.level;return Zn(Wn(e,ve(n,l?s.to:s.from,l?"before":"after"),"line",t,r),o,a,!0)},0,i.length-1),s=i[u];if(u>0){var l=1!=s.level,c=Wn(e,ve(n,l?s.from:s.to,l?"after":"before"),"line",t,r);Zn(c,o,a,!0)&&c.top>a&&(s=i[u-1])}return s})(e,t,n,o,c,r,i);l=1!=f.level,u=l?f.from:f.to-1,s=l?f.to:f.from-1}var p,d,h=null,m=null,v=ae(function(t){var n=jn(e,o,t);return n.top+=a,n.bottom+=a,!!Zn(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(h=t,m=n),!0)},u,s),g=!1;if(m){var y=r-m.left=w.bottom}return v=oe(t.text,v,1),Yn(n,v,d,g,r-p)}function tr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==In){In=N("pre");for(var t=0;t<49;++t)In.appendChild(document.createTextNode("x")),In.appendChild(N("br"));In.appendChild(document.createTextNode("x"))}C(e.measure,In);var n=In.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),x(e.measure),n||1}function nr(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=N("span","xxxxxxxxxx"),n=N("pre",[t]);C(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function rr(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)n[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,r[e.options.gutters[a]]=o.clientWidth;return{fixedPos:ir(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ir(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function or(e){var t=tr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/nr(e.display)-3);return function(i){if(Ke(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;r=e.display.viewTo||u.to().linet||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}(m,n||0,null==r?p:r,function(e,t,i,f){var v="ltr"==i,g=d(e,v?"left":"right"),y=d(t-1,v?"right":"left"),b=null==n&&0==e,w=null==r&&t==p,E=0==f,T=!m||f==m.length-1;if(y.top-g.top<=3){var _=(l?b:w)&&E,k=(l?w:b)&&T,O=_?u:(v?g:y).left,S=k?s:(v?y:g).right;c(O,g.top,S-O,g.bottom)}else{var x,C,N,D;v?(x=l&&b&&E?u:g.left,C=l?s:h(e,i,"before"),N=l?u:h(t,i,"after"),D=l&&w&&T?s:y.right):(x=l?h(e,i,"before"):u,C=!l&&b&&E?s:g.right,N=!l&&w&&T?u:y.left,D=l?h(t,i,"after"):s),c(x,g.top,C-x,g.bottom),g.bottom0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function mr(e){e.state.focused||(e.display.input.focus(),gr(e))}function vr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,yr(e))},100)}function gr(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(it(e,"focus",e,t),e.state.focused=!0,j(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),s&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),hr(e))}function yr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(it(e,"blur",e,t),e.state.focused=!1,S(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function br(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r.005||p<-.005)&&(fe(i.line,s),wr(i.line),i.rest))for(var d=0;de.display.sizerWidth){var h=Math.ceil(l/nr(e.display));h>e.display.maxLineLength&&(e.display.maxLineLength=h,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function wr(e){if(e.widgets)for(var t=0;t=a&&(o=de(t,We(se(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function Tr(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=ir(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;ao&&(t.bottom=t.top+o);var u=e.doc.height+kn(n),s=t.topu-r;if(t.topi+o){var c=Math.min(t.top,(l?u:t.bottom)-o);c!=i&&(a.scrollTop=c)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,p=xn(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),d=t.right-t.left>p;return d&&(t.right=t.left+p),t.left<10?a.scrollLeft=0:t.leftp+f-3&&(a.scrollLeft=t.right+(d?0:10)-p),a}function Or(e,t){null!=t&&(Cr(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Sr(e){Cr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function xr(e,t,n){null==t&&null==n||Cr(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Cr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=Qn(e,t.from),r=Qn(e,t.to);Nr(e,n,r,t.margin)}}function Nr(e,t,n,r){var i=kr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});xr(e,i.scrollLeft,i.scrollTop)}function Dr(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||ui(e,{top:t}),Ar(e,t,!0),n&&ui(e),ni(e,100))}function Ar(e,t,n){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Lr(e,t,n,r){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,Tr(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function jr(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+kn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Sn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Ir=function(e,t,n){this.cm=n;var r=this.vert=N("div",[N("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=N("div",[N("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),tt(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),tt(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,a&&u<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Ir.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Ir.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Ir.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Ir.prototype.zeroWidthHack=function(){var e=y&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new V,this.disableVert=new V},Ir.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto",t.set(1e3,function r(){var i=e.getBoundingClientRect(),o="vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.pointerEvents="none":t.set(1e3,r)})},Ir.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Fr=function(){};function Pr(e,t){t||(t=jr(e));var n=e.display.barWidth,r=e.display.barHeight;Mr(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&br(e),Mr(e,jr(e)),n=e.display.barWidth,r=e.display.barHeight}function Mr(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}Fr.prototype.update=function(){return{bottom:0,right:0}},Fr.prototype.setScrollLeft=function(){},Fr.prototype.setScrollTop=function(){},Fr.prototype.clear=function(){};var Rr={native:Ir,null:Fr};function Vr(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&S(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Rr[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),tt(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){"horizontal"==n?Lr(e,t):Dr(e,t)},e),e.display.scrollbars.addClass&&j(e.display.wrapper,e.display.scrollbars.addClass)}var Ur=0;function Br(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ur},t=e.curOp,an?an.ops.push(t):t.ownsGroup=an={ops:[t],delayedCallbacks:[]}}function zr(e){var t=e.curOp;t&&function(e,t){var n=e.ownsGroup;if(n)try{!function(e){var t=e.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ii(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Hr(e){var t=e.cm,n=t.display;e.updatedDisplay&&br(t),e.barMeasure=jr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Dn(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Sn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-xn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Kr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft1&&(a=!0)),null!=l.scrollLeft&&(Lr(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(a=!0)),!a)break}return i}(t,_e(r,e.scrollToPos.from),_e(r,e.scrollToPos.to),e.scrollToPos.margin);!function(e,t){if(!ot(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!h){var o=N("div","\u200b",null,"position: absolute;\n top: "+(t.top-n.viewOffset-_n(e.display))+"px;\n height: "+(t.bottom-t.top+Sn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var u=0;ut)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Se&&qe(e.doc,t)i.viewFrom?Zr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Zr(e);else if(t<=i.viewFrom){var o=ei(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):Zr(e)}else if(n>=i.viewTo){var a=ei(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):Zr(e)}else{var u=ei(e,t,t,-1),s=ei(e,n,n+r,1);u&&s?(i.view=i.view.slice(0,u.index).concat(on(e,u.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):Zr(e)}var l=i.externalMeasured;l&&(n=i.lineN&&t=r.viewTo)){var o=r.view[sr(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==U(a,n)&&a.push(n)}}}function Zr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ei(e,t,n,r){var i,o=sr(e,t),a=e.display.view;if(!Se||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var u=e.display.viewFrom,s=0;s0){if(o==a.length-1)return null;i=u+a[o].size-t,o++}else i=u-t;t+=i,n+=i}for(;qe(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function ti(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo)){var n=+new Date+e.options.workTime,r=Rt(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var a=o.styles,u=o.text.length>e.options.maxHighlightLength?Dt(t.mode,r.state):null,s=Pt(e,o,r,!0);u&&(r.state=u),o.styles=s.styles;var l=o.styleClasses,c=s.classes;c?o.styleClasses=c:l&&(o.styleClasses=null);for(var f=!a||a.length!=o.styles.length||l!=c&&(!l||!c||l.bgClass!=c.bgClass||l.textClass!=c.textClass),p=0;!f&&pn)return ni(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Wr(e,function(){for(var t=0;t=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==ti(e))return!1;_r(e)&&(Zr(e),t.dims=rr(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Se&&(o=qe(e.doc,o),a=He(e.doc,a));var u=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;!function(e,t,n){var r=e.display;0==r.view.length||t>=r.viewTo||n<=r.viewFrom?(r.view=on(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=on(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,sr(e,n)))),r.viewTo=n}(e,o,a),n.viewOffset=We(se(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var l=ti(e);if(!u&&0==l&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=function(e){if(e.hasFocus())return null;var t=L();if(!t||!A(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&A(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}(e);return l>4&&(n.lineDiv.style.display="none"),function(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function u(t){var n=t.nextSibling;return s&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var l=r.view,c=r.viewFrom,f=0;f-1&&(d=!1),cn(e,p,c,n)),d&&(x(p.lineNumber),p.lineNumber.appendChild(document.createTextNode(me(e.options,c)))),a=p.node.nextSibling}else{var h=gn(e,p,c,n);o.insertBefore(h,a)}c+=p.size}for(;a;)a=u(a)}(e,n.updateLineNumbers,t.dims),l>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(e){if(e&&e.activeElt&&e.activeElt!=L()&&(e.activeElt.focus(),e.anchorNode&&A(document.body,e.anchorNode)&&A(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}(c),x(n.cursorDiv),x(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,u&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ni(e,400)),n.updateLineNumbers=null,!0}function ai(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=xn(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+kn(e.display)-Cn(e),n.top)}),t.visible=Er(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&oi(e,t);r=!1){br(e);var i=jr(e);lr(e),Pr(e,i),li(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ui(e,t){var n=new ii(e,t);if(oi(e,n)){br(e),ai(e,n);var r=jr(e);lr(e),Pr(e,r),li(e,r),n.finish()}}function si(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function li(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Sn(e)+"px"}function ci(e){var t=e.display.gutters,n=e.options.gutters;x(t);for(var r=0;r-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}ii.prototype.signal=function(e,t){ut(e,t)&&this.events.push(arguments)},ii.prototype.finish=function(){for(var e=0;eu.clientWidth,c=u.scrollHeight>u.clientHeight;if(i&&l||o&&c){if(o&&y&&s)e:for(var p=t.target,d=a.view;p!=u;p=p.parentNode)for(var h=0;h=0&&ge(e,r.to())<=0)return n}return-1};var yi=function(e,t){this.anchor=e,this.head=t};function bi(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(e,t){return ge(e.from(),t.from())}),n=U(t,i);for(var o=1;o0:s>=0){var l=Ee(u.from(),a.from()),c=we(u.to(),a.to()),f=u.empty()?a.from()==a.head:u.from()==u.head;o<=n&&--n,t.splice(--o,2,new yi(f?c:l,f?l:c))}}return new gi(t,n)}function wi(e,t){return new gi([new yi(e,t||e)],0)}function Ei(e){return e.text?ve(e.from.line+e.text.length-1,Y(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Ti(e,t){if(ge(e,t.from)<0)return e;if(ge(e,t.to)<=0)return Ei(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Ei(t).ch-t.to.ch),ve(n,r)}function _i(e,t){for(var n=[],r=0;r1&&e.remove(u.line+1,h-1),e.insert(u.line+1,g)}sn(e,"change",e,t)}function Ni(e,t,n){!function e(r,i,o){if(r.linked)for(var a=0;au-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Ii(e.done),Y(e.done)):e.done.length&&!Y(e.done).ranges?Y(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Y(e.done)):void 0}(i,i.lastOp==r)))a=Y(o.changes),0==ge(t.from,t.to)&&0==ge(t.from,a.to)?a.to=Ei(t):o.changes.push(ji(e,t));else{var s=Y(i.done);for(s&&s.ranges||Mi(e.sel,i.done),o={changes:[ji(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=u,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||it(e,"historyAdded")}function Pi(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,Y(i.done),t))?i.done[i.done.length-1]=t:Mi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&Ii(i.undone)}function Mi(e,t){var n=Y(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Ri(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 Vi(e){if(!e)return null;for(var t,n=0;n-1&&(Y(u)[f]=l[f],delete l[f])}}}return r}function zi(e,t,n,r){if(r){var i=e.anchor;if(n){var o=ge(t,i)<0;o!=ge(n,i)<0?(i=t,t=n):o!=ge(t,n)<0&&(t=n)}return new yi(i,t)}return new yi(n||t,t)}function qi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qi(e,new gi([zi(e.sel.primary(),t,n,i)],0),r)}function Hi(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:u.to>t.ch))){if(i&&(it(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(n){var l=s.find(r<0?1:-1),c=void 0;if((r<0?s.inclusiveRight:s.inclusiveLeft)&&(l=to(e,l,-r,l&&l.line==t.line?o:null)),l&&l.line==t.line&&(c=ge(l,n))&&(r<0?c<0:c>0))return Zi(e,l,t,r,i)}var f=s.find(r<0?-1:1);return(r<0?s.inclusiveLeft:s.inclusiveRight)&&(f=to(e,f,r,f.line==t.line?o:null)),f?Zi(e,f,t,r,i):null}}return t}function eo(e,t,n,r,i){var o=r||1,a=Zi(e,t,n,o,i)||!i&&Zi(e,t,n,o,!0)||Zi(e,t,n,-o,i)||!i&&Zi(e,t,n,-o,!0);return a||(e.cantEdit=!0,ve(e.first,0))}function to(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?_e(e,ve(t.line-1)):null:n>0&&t.ch==(r||se(e,t.line)).text.length?t.line0)){var c=[s,1],f=ge(l.from,u.from),p=ge(l.to,u.to);(f<0||!a.inclusiveLeft&&!f)&&c.push({from:l.from,to:u.from}),(p>0||!a.inclusiveRight&&!p)&&c.push({from:u.to,to:l.to}),i.splice.apply(i,c),s+=c.length-3}}return i}(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)oo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else oo(e,t)}}function oo(e,t){if(1!=t.text.length||""!=t.text[0]||0!=ge(t.from,t.to)){var n=_i(e,t);Fi(e,t,n,e.cm?e.cm.curOp.id:NaN),so(e,t,n,De(e,t));var r=[];Ni(e,function(e,n){n||-1!=U(r,e.history)||(po(e.history,t),r.push(e.history)),so(e,t,null,De(e,t))})}}function ao(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!r||n){for(var i,o=e.history,a=e.sel,u="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,l=0;l=0;--d){var h=p(d);if(h)return h.v}}}}function uo(e,t){if(0!=t&&(e.first+=t,e.sel=new gi(J(e.sel.ranges,function(e){return new yi(ve(e.anchor.line+t,e.anchor.ch),ve(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){$r(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:ve(o,se(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=le(e,t.from,t.to),n||(n=_i(e,t)),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,u=!1,s=o.line;e.options.lineWrapping||(s=pe(ze(se(r,o.line))),r.iter(s,a.line+1,function(e){if(e==i.maxLine)return u=!0,!0})),r.sel.contains(t.from,t.to)>-1&&at(e),Ci(r,t,n,or(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,function(e){var t=Qe(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,u=!1)}),u&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=se(e,r).stateAfter;if(i&&(!(i instanceof It)||r+i.lookAhead1||!(this.children[0]instanceof mo))){var u=[];this.collapse(u),this.children=[new mo(u)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=i.lines.length%25+25,u=a;u10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=D("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Be(e,t.line,t,n,o)||t.line!=n.line&&Be(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Se=!0}o.addToHistory&&Fi(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var u,s=t.line,l=e.cm;if(e.iter(s,n.line+1,function(e){l&&o.collapsed&&!l.options.lineWrapping&&ze(e)==l.display.maxLine&&(u=!0),o.collapsed&&s!=t.line&&fe(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new xe(o,s==t.line?t.ch:null,s==n.line?n.ch:null)),++s}),o.collapsed&&e.iter(t.line,n.line+1,function(t){Ke(e,t)&&fe(t,0)}),o.clearOnEnter&&tt(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Oe=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++bo,o.atomic=!0),l){if(u&&(l.curOp.updateMaxLine=!0),o.collapsed)$r(l,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=n.line;c++)Xr(l,c,"text");o.atomic&&$i(l.doc),sn(l,"markerAdded",l,o)}return o}wo.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Br(e),ut(this,"clear")){var n=this.find();n&&sn(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=l,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&$r(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&$i(e.doc)),e&&sn(e,"markerCleared",e,this,r,i),t&&zr(e),this.parent&&this.parent.clear()}},wo.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i=0;s--)io(this,r[s]);u?Wi(this,u):this.cm&&Sr(this.cm)}),undo:Jr(function(){ao(this,"undo")}),redo:Jr(function(){ao(this,"redo")}),undoSelection:Jr(function(){ao(this,"undo",!0)}),redoSelection:Jr(function(){ao(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=_e(this,e),t=_e(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var u=0;u=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||n&&!n(s.marker)||r.push(s.marker.parent||s.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=o,++n}),_e(this,ve(n,t))},indexFromPos:function(e){var t=(e=_e(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var c=e.dataTransfer.getData("Text");if(c){var f;if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),Yi(t.doc,wi(n,n)),f)for(var p=0;p=0;t--)lo(e.doc,"",r[t].from,r[t].to,"+delete");Sr(e)})}function Wo(e,t,n){var r=oe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Qo(e,t,n){var r=Wo(e,t.ch,n);return null==r?null:new ve(t.line,r,n<0?"after":"before")}function Yo(e,t,n,r,i){if(e){var o=Ze(n,t.doc.direction);if(o){var a,u=i<0?Y(o):o[0],s=i<0==(1==u.level),l=s?"after":"before";if(u.level>0||"rtl"==t.doc.direction){var c=Ln(t,n);a=i<0?n.text.length-1:0;var f=jn(t,c,a).top;a=ae(function(e){return jn(t,c,e).top==f},i<0==(1==u.level)?u.from:u.to-1,a),"before"==l&&(a=Wo(n,a,1))}else a=i<0?u.to:u.from;return new ve(r,a,l)}}return new ve(r,i<0?n.text.length:0,i<0?"before":"after")}Ro.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ro.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","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","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ro.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","Ctrl-O":"openLine"},Ro.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","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","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ro.default=y?Ro.macDefault:Ro.pcDefault;var Jo={selectAll:no,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),q)},killLine:function(e){return Go(e,function(t){if(t.empty()){var n=se(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new ve(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),ve(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=se(e.doc,i.line-1).text;a&&(i=new ve(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),ve(i.line-1,a.length-1),i,"+transpose"))}n.push(new yi(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return Wr(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r-1&&(ge((i=l.ranges[i]).from(),t)<0||t.xRel>0)&&(ge(i.to(),t)>0||t.xRel<0)?function(e,t,n,r){var i=e.display,o=!1,l=Qr(e,function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,rt(i.wrapper.ownerDocument,"mouseup",l),rt(i.wrapper.ownerDocument,"mousemove",c),rt(i.scroller,"dragstart",f),rt(i.scroller,"drop",l),o||(lt(t),r.addNew||qi(e.doc,n,null,null,r.extend),s||a&&9==u?setTimeout(function(){i.wrapper.ownerDocument.body.focus(),i.input.focus()},20):i.input.focus())}),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},f=function(){return o=!0};s&&(i.scroller.draggable=!0),e.state.draggingText=l,l.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),tt(i.wrapper.ownerDocument,"mouseup",l),tt(i.wrapper.ownerDocument,"mousemove",c),tt(i.scroller,"dragstart",f),tt(i.scroller,"drop",l),vr(e),setTimeout(function(){return i.input.focus()},20)}(e,r,t,o):function(e,t,n,r){var i=e.display,o=e.doc;lt(t);var a,u,s=o.sel,l=s.ranges;if(r.addNew&&!r.extend?(u=o.sel.contains(n),a=u>-1?l[u]:new yi(n,n)):(a=o.sel.primary(),u=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(a=new yi(n,n)),n=ur(e,t,!0,!0),u=-1;else{var c=pa(e,n,r.unit);a=r.extend?zi(a,c.anchor,c.head,r.extend):c}r.addNew?-1==u?(u=l.length,Qi(o,bi(e,l.concat([a]),u),{scroll:!1,origin:"*mouse"})):l.length>1&&l[u].empty()&&"char"==r.unit&&!r.extend?(Qi(o,bi(e,l.slice(0,u).concat(l.slice(u+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):Ki(o,u,a,H):(u=0,Qi(o,new gi([a],0),H),s=o.sel);var f=n;function p(t){if(0!=ge(f,t))if(f=t,"rectangle"==r.unit){for(var i=[],l=e.options.tabSize,c=R(se(o,n.line).text,n.ch,l),p=R(se(o,t.line).text,t.ch,l),d=Math.min(c,p),h=Math.max(c,p),m=Math.min(n.line,t.line),v=Math.min(e.lastLine(),Math.max(n.line,t.line));m<=v;m++){var g=se(o,m).text,y=G(g,d,l);d==h?i.push(new yi(ve(m,y),ve(m,y))):g.length>y&&i.push(new yi(ve(m,y),ve(m,G(g,h,l))))}i.length||i.push(new yi(n,n)),Qi(o,bi(e,s.ranges.slice(0,u).concat(i),u),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=a,E=pa(e,t,r.unit),T=w.anchor;ge(E.anchor,T)>0?(b=E.head,T=Ee(w.from(),E.anchor)):(b=E.anchor,T=we(w.to(),E.head));var _=s.ranges.slice(0);_[u]=function(e,t){var n=t.anchor,r=t.head,i=se(e.doc,n.line);if(0==ge(n,r)&&n.sticky==r.sticky)return t;var o=Ze(i);if(!o)return t;var a=$e(o,n.ch,n.sticky),u=o[a];if(u.from!=n.ch&&u.to!=n.ch)return t;var s,l=a+(u.from==n.ch==(1!=u.level)?0:1);if(0==l||l==o.length)return t;if(r.line!=n.line)s=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=$e(o,r.ch,r.sticky),f=c-a||(r.ch-n.ch)*(1==u.level?-1:1);s=c==l-1||c==l?f<0:f>0}var p=o[l+(s?-1:0)],d=s==(1==p.level),h=d?p.from:p.to,m=d?"after":"before";return n.ch==h&&n.sticky==m?t:new yi(new ve(n.line,h,m),r)}(e,new yi(_e(o,T),b)),Qi(o,bi(e,_,u),H)}}var d=i.wrapper.getBoundingClientRect(),h=0;function m(t){e.state.selectingText=!1,h=1/0,lt(t),i.input.focus(),rt(i.wrapper.ownerDocument,"mousemove",v),rt(i.wrapper.ownerDocument,"mouseup",g),o.history.lastSelOrigin=null}var v=Qr(e,function(t){0!==t.buttons&&ht(t)?function t(n){var a=++h,u=ur(e,n,!0,"rectangle"==r.unit);if(u)if(0!=ge(u,f)){e.curOp.focus=L(),p(u);var s=Er(i,o);(u.line>=s.to||u.lined.bottom?20:0;l&&setTimeout(Qr(e,function(){h==a&&(i.scroller.scrollTop+=l,t(n))}),50)}}(t):m(t)}),g=Qr(e,m);e.state.selectingText=g,tt(i.wrapper.ownerDocument,"mousemove",v),tt(i.wrapper.ownerDocument,"mouseup",g)}(e,r,t,o)}(t,r,o,e):dt(e)==n.scroller&<(e):2==i?(r&&qi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):3==i&&(_?t.display.input.onContextMenu(e):vr(t)))}}function pa(e,t,n){if("char"==n)return new yi(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new yi(ve(t.line,0),_e(e.doc,ve(t.line+1,0)));var r=n(e,t);return new yi(r.from,r.to)}function da(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&<(t);var a=e.display,u=a.lineDiv.getBoundingClientRect();if(o>u.bottom||!ut(e,n))return ft(t);o-=u.top-a.viewOffset;for(var s=0;s=i){var c=de(e.doc,o),f=e.options.gutters[s];return it(e,n,e,c,f,t),ft(t)}}}function ha(e,t){return da(e,t,"gutterClick",!0)}function ma(e,t){Tn(e.display,t)||function(e,t){return!!ut(e,"gutterContextMenu")&&da(e,t,"gutterContextMenu",!1)}(e,t)||ot(e,t,"contextmenu")||_||e.display.input.onContextMenu(t)}function va(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Un(e)}ca.prototype.compare=function(e,t,n){return this.time+400>e&&0==ge(t,this.pos)&&n==this.button};var ga={toString:function(){return"CodeMirror.Init"}},ya={},ba={};function wa(e){ci(e),$r(e),Tr(e)}function Ea(e,t,n){var r=n&&n!=ga;if(!t!=!r){var i=e.display.dragFunctions,o=t?tt:rt;o(e.display.scroller,"dragstart",i.start),o(e.display.scroller,"dragenter",i.enter),o(e.display.scroller,"dragover",i.over),o(e.display.scroller,"dragleave",i.leave),o(e.display.scroller,"drop",i.drop)}}function Ta(e){e.options.lineWrapping?(j(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(S(e.display.wrapper,"CodeMirror-wrap"),Ye(e)),ar(e),$r(e),Un(e),setTimeout(function(){return Pr(e)},100)}function _a(e,t){var n=this;if(!(this instanceof _a))return new _a(e,t);this.options=t=t?M(t):{},M(ya,t,!1),fi(t);var r=t.value;"string"==typeof r?r=new So(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new _a.inputStyles[t.inputStyle](this),o=this.display=new ue(e,r,i);for(var l in o.wrapper.CodeMirror=this,ci(this),va(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Vr(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new V,keySeq:null,specialChars:null},t.autofocus&&!g&&o.input.focus(),a&&u<11&&setTimeout(function(){return n.display.input.reset(!0)},20),function(e){var t=e.display;tt(t.scroller,"mousedown",Qr(e,fa)),tt(t.scroller,"dblclick",a&&u<11?Qr(e,function(t){if(!ot(e,t)){var n=ur(e,t);if(n&&!ha(e,t)&&!Tn(e.display,t)){lt(t);var r=e.findWordAt(n);qi(e.doc,r.anchor,r.head)}}}):function(t){return ot(e,t)||lt(t)}),tt(t.scroller,"contextmenu",function(t){return ma(e,t)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),(r=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}tt(t.scroller,"touchstart",function(i){if(!ot(e,i)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(i)&&!ha(e,i)){t.input.ensurePolled(),clearTimeout(n);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-r.end<=300?r:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}}),tt(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),tt(t.scroller,"touchend",function(n){var r=t.activeTouch;if(r&&!Tn(t,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var a,u=e.coordsChar(t.activeTouch,"page");a=!r.prev||o(r,r.prev)?new yi(u,u):!r.prev.prev||o(r,r.prev.prev)?e.findWordAt(u):new yi(ve(u.line,0),_e(e.doc,ve(u.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),lt(n)}i()}),tt(t.scroller,"touchcancel",i),tt(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Dr(e,t.scroller.scrollTop),Lr(e,t.scroller.scrollLeft,!0),it(e,"scroll",e))}),tt(t.scroller,"mousewheel",function(t){return vi(e,t)}),tt(t.scroller,"DOMMouseScroll",function(t){return vi(e,t)}),tt(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(t){ot(e,t)||pt(t)},over:function(t){ot(e,t)||(function(e,t){var n=ur(e,t);if(n){var r=document.createDocumentFragment();fr(e,n,r),e.display.dragCursor||(e.display.dragCursor=N("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),C(e.display.dragCursor,r)}}(e,t),pt(t))},start:function(t){return function(e,t){if(a&&(!e.state.draggingText||+new Date-xo<100))pt(t);else if(!ot(e,t)&&!Tn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!p)){var n=N("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),f&&n.parentNode.removeChild(n)}}(e,t)},drop:Qr(e,Co),leave:function(t){ot(e,t)||No(e)}};var s=t.input.getField();tt(s,"keyup",function(t){return aa.call(e,t)}),tt(s,"keydown",Qr(e,oa)),tt(s,"keypress",Qr(e,ua)),tt(s,"focus",function(t){return gr(e,t)}),tt(s,"blur",function(t){return yr(e,t)})}(this),Lo(),Br(this),this.curOp.forceUpdate=!0,Di(this,r),t.autofocus&&!g||this.hasFocus()?setTimeout(P(gr,this),20):yr(this),ba)ba.hasOwnProperty(l)&&ba[l](n,t[l],ga);_r(this),t.finishInit&&t.finishInit(this);for(var c=0;c150)){if(!r)return;n="prev"}}else l=0,n="not";"prev"==n?l=t>o.first?R(se(o,t-1).text,null,a):0:"add"==n?l=s+e.options.indentUnit:"subtract"==n?l=s-e.options.indentUnit:"number"==typeof n&&(l=s+n),l=Math.max(0,l);var f="",p=0;if(e.options.indentWithTabs)for(var d=Math.floor(l/a);d;--d)p+=a,f+="\t";if(pa,s=wt(t),l=null;if(u&&r.ranges.length>1)if(Sa&&Sa.text.join("\n")==t){if(r.ranges.length%Sa.text.length==0){l=[];for(var c=0;c=0;p--){var d=r.ranges[p],h=d.from(),m=d.to();d.empty()&&(n&&n>0?h=ve(h.line,h.ch-n):e.state.overwrite&&!u?m=ve(m.line,Math.min(se(o,m.line).text.length,m.ch+Y(s).length)):u&&Sa&&Sa.lineWise&&Sa.text.join("\n")==t&&(h=m=ve(h.line,0)));var v={from:h,to:m,text:l?l[p%l.length]:s,origin:i||(u?"paste":e.state.cutIncoming>a?"cut":"+input")};io(e.doc,v),sn(e,"inputRead",e,v)}t&&!u&&Da(e,t),Sr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=f),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Na(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Wr(t,function(){return Ca(t,n,0,null,"paste")}),!0}function Da(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var u=0;u-1){a=Oa(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(se(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Oa(e,i.head.line,"smart"));a&&sn(e,"electricInput",e,i.head.line)}}}function Aa(e){for(var t=[],n=[],r=0;r=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=$e(i,n.ch,n.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from=a.from&&p>=c.begin)){var d=f?"before":"after";return new ve(n.line,p,d)}}var h=function(e,t,r){for(var o=function(e,t){return t?new ve(n.line,s(e,1),"before"):new ve(n.line,e,"after")};e>=0&&e0==(1!=a.level),l=u?r.begin:s(r.end,-1);if(a.from<=l&&l0?c.end:s(c.begin,-1);return null==v||r>0&&v==t.text.length||!(m=h(r>0?0:i.length-1,r,l(v)))?null:m}(e.cm,u,t,n):Qo(u,t,n))){if(r||!function(){var r=t.line+n;return!(r=e.first+e.size)&&(t=new ve(r,t.ch,t.sticky),u=se(e,r))}())return!1;t=Yo(i,e.cm,u,t.line,n)}else t=o;return!0}if("char"==r)s();else if("column"==r)s(!0);else if("word"==r||"group"==r)for(var l=null,c="group"==r,f=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;!(n<0)||s(!p);p=!1){var d=u.text.charAt(t.ch)||"\n",h=te(d,f)?"w":c&&"\n"==d?"n":!c||/\s/.test(d)?null:"p";if(!c||p||h||(h="s"),l&&l!=h){n<0&&(n=1,s(),t.sticky="after");break}if(h&&(l=h),n>0&&!s(!p))break}var m=eo(e,t,o,a,!0);return ye(o,m)&&(m.hitSide=!0),m}function Fa(e,t,n,r){var i,o,a=e.doc,u=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),l=Math.max(s-.5*tr(e.display),3);i=(n>0?t.bottom:t.top)+n*l}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;(o=Jn(e,u,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*n}return o}var Pa=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new V,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Ma(e,t){var n=An(e,t.line);if(!n||n.hidden)return null;var r=se(e.doc,t.line),i=Nn(n,r,t.line),o=Ze(r,e.doc.direction),a="left";if(o){var u=$e(o,t.ch);a=u%2?"right":"left"}var s=Pn(i.map,t.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function Ra(e,t){return t&&(e.bad=!0),e}function Va(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return Ra(e.clipPos(ve(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i=t.display.viewTo||o.line=t.display.viewFrom&&Ma(t,i)||{node:s[0].measure.map[2],offset:0},c=o.liner.firstLine()&&(a=ve(a.line-1,se(r.doc,a.line-1).length)),u.ch==se(r.doc,u.line).text.length&&u.linei.viewTo-1)return!1;a.line==i.viewFrom||0==(e=sr(r,a.line))?(t=pe(i.view[0].line),n=i.view[0].node):(t=pe(i.view[e].line),n=i.view[e-1].node.nextSibling);var s,l,c=sr(r,u.line);if(c==i.view.length-1?(s=i.viewTo-1,l=i.lineDiv.lastChild):(s=pe(i.view[c+1].line)-1,l=i.view[c+1].node.previousSibling),!n)return!1;for(var f=r.doc.splitLines(function(e,t,n,r,i){var o="",a=!1,u=e.doc.lineSeparator(),s=!1;function l(){a&&(o+=u,s&&(o+=u),a=s=!1)}function c(e){e&&(l(),o+=e)}function f(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void c(n);var o,p=t.getAttribute("cm-marker");if(p){var d=e.findMarks(ve(r,0),ve(i+1,0),(v=+p,function(e){return e.id==v}));return void(d.length&&(o=d[0].find(0))&&c(le(e.doc,o.from,o.to).join(u)))}if("false"==t.getAttribute("contenteditable"))return;var h=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;h&&l();for(var m=0;m1&&p.length>1;)if(Y(f)==Y(p))f.pop(),p.pop(),s--;else{if(f[0]!=p[0])break;f.shift(),p.shift(),t++}for(var d=0,h=0,m=f[0],v=p[0],g=Math.min(m.length,v.length);da.ch&&y.charCodeAt(y.length-h-1)==b.charCodeAt(b.length-h-1);)d--,h++;f[f.length-1]=y.slice(0,y.length-h).replace(/^\u200b+/,""),f[0]=f[0].slice(d).replace(/\u200b+$/,"");var E=ve(t,d),T=ve(s,p.length?Y(p).length-h:0);return f.length>1||f[0]||ge(E,T)?(lo(r.doc,f,E,T,"+input"),!0):void 0},Pa.prototype.ensurePolled=function(){this.forceCompositionEnd()},Pa.prototype.reset=function(){this.forceCompositionEnd()},Pa.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Pa.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},Pa.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Wr(this.cm,function(){return $r(e.cm)})},Pa.prototype.setUneditable=function(e){e.contentEditable="false"},Pa.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Qr(this.cm,Ca)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Pa.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Pa.prototype.onContextMenu=function(){},Pa.prototype.resetPosition=function(){},Pa.prototype.needsContentAttribute=!0;var Ba=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new V,this.hasSelection=!1,this.composing=null};Ba.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!ot(r,e)){if(r.somethingSelected())xa({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var t=Aa(r);xa({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,q):(n.prevInput="",i.value=t.text.join("\n"),F(i))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),m&&(i.style.width="0px"),tt(i,"input",function(){a&&u>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),tt(i,"paste",function(e){ot(r,e)||Na(e,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())}),tt(i,"cut",o),tt(i,"copy",o),tt(e.scroller,"paste",function(t){if(!Tn(e,t)&&!ot(r,t)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,i.dispatchEvent(o)}}),tt(e.lineSpace,"selectstart",function(t){Tn(e,t)||lt(t)}),tt(i,"compositionstart",function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),tt(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Ba.prototype.createField=function(e){this.wrapper=ja(),this.textarea=this.wrapper.firstChild},Ba.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=cr(e);if(e.options.moveInputWithCursor){var i=Wn(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},Ba.prototype.showSelection=function(e){var t=this.cm,n=t.display;C(n.cursorDiv,e.cursors),C(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ba.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&F(this.textarea),a&&u>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",a&&u>=9&&(this.hasSelection=null))}},Ba.prototype.getField=function(){return this.textarea},Ba.prototype.supportsTouch=function(){return!1},Ba.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!g||L()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ba.prototype.blur=function(){this.textarea.blur()},Ba.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ba.prototype.receivedFocus=function(){this.slowPoll()},Ba.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ba.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,function n(){var r=t.poll();r||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))})},Ba.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Et(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(a&&u>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r="\u200b"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,l=Math.min(r.length,i.length);s1e3||i.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Ba.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ba.prototype.onKeyPress=function(){a&&u>=9&&(this.hasSelection=null),this.fastPoll()},Ba.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=ur(n,e),l=r.scroller.scrollTop;if(o&&!f){var c=n.options.resetSelectionOnContextMenu;c&&-1==n.doc.sel.contains(o)&&Qr(n,Qi)(n.doc,wi(o),q);var p,d=i.style.cssText,h=t.wrapper.style.cssText,m=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-m.top-5)+"px; left: "+(e.clientX-m.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(p=window.scrollY),r.input.focus(),s&&window.scrollTo(null,p),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=g,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),a&&u>=9&&v(),_?(pt(e),tt(window,"mouseup",function e(){rt(window,"mouseup",e),setTimeout(g,20)})):setTimeout(g,50)}function v(){if(null!=i.selectionStart){var e=n.somethingSelected(),o="\u200b"+(e?i.value:"");i.value="\u21da",i.value=o,t.prevInput=e?"":"\u200b",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function g(){if(t.contextMenuPending==g&&(t.contextMenuPending=!1,t.wrapper.style.cssText=h,i.style.cssText=d,a&&u<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=l),null!=i.selectionStart)){(!a||a&&u<9)&&v();var e=0;r.detectingSelectAll=setTimeout(function o(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"\u200b"==t.prevInput?Qr(n,no)(n):e++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())},200)}}},Ba.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Ba.prototype.setUneditable=function(){},Ba.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function n(n,r,i,o){e.defaults[n]=r,i&&(t[n]=o?function(e,t,n){n!=ga&&i(e,t,n)}:i)}e.defineOption=n,e.Init=ga,n("value","",function(e,t){return e.setValue(t)},!0),n("mode",null,function(e,t){e.doc.modeOption=t,Oi(e)},!0),n("indentUnit",2,Oi,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(e){Si(e),Un(e),$r(e)},!0),n("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,n.push(ve(r,o))}r++});for(var i=n.length-1;i>=0;i--)lo(e.doc,t,n[i],ve(n[i].line,n[i].ch+t.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=ga&&e.refresh()}),n("specialCharPlaceholder",Xt,function(e){return e.refresh()},!0),n("electricChars",!0),n("inputStyle",g?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),n("autocorrect",!1,function(e,t){return e.getInputField().autocorrect=t},!0),n("autocapitalize",!1,function(e,t){return e.getInputField().autocapitalize=t},!0),n("rtlMoveVisually",!w),n("wholeLineUpdateBefore",!0),n("theme","default",function(e){va(e),wa(e)},!0),n("keyMap","default",function(e,t,n){var r=Ko(t),i=n!=ga&&Ko(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ta,!0),n("gutters",[],function(e){fi(e.options),wa(e)},!0),n("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?ir(e.display)+"px":"0",e.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(e){return Pr(e)},!0),n("scrollbarStyle","native",function(e){Vr(e),Pr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),n("lineNumbers",!1,function(e){fi(e.options),wa(e)},!0),n("firstLineNumber",1,wa,!0),n("lineNumberFormatter",function(e){return e},wa,!0),n("showCursorWhenSelecting",!1,lr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(e,t){"nocursor"==t&&(yr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),n("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),n("dragDrop",!0,Ea),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,lr,!0),n("singleCursorHeightPerLine",!0,lr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Si,!0),n("addModeClass",!1,Si,!0),n("pollInterval",100),n("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),n("historyEventDelay",1250),n("viewportMargin",10,function(e){return e.refresh()},!0),n("maxHighlightLength",1e4,Si,!0),n("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),n("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),n("autofocus",null),n("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),n("phrases",null)}(_a),function(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e];r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&Qr(this,t[e])(this,n,i),it(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Ko(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(Oa(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Sr(this));else{var o=i.from(),a=i.to(),u=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=u;s0&&Ki(this.doc,r,new yi(o,l[r].to()),q)}}}),getTokenAt:function(e,t){return qt(this,e,t)},getLineTokens:function(e,t){return qt(this,ve(e),t,!0)},getTokenTypeAt:function(e){e=_e(this.doc,e);var t,n=Mt(this,se(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]o&&(e=o,i=!0),r=se(this.doc,e)}else r=e;return Hn(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-We(r):0)},defaultTextHeight:function(){return tr(this.display)},defaultCharWidth:function(){return nr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display,a=(e=Wn(this,_e(this.doc,e))).bottom,u=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)a=e.top;else if("above"==r||"near"==r){var s=Math.max(o.wrapper.clientHeight,this.doc.height),l=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),u+t.offsetWidth>l&&(u=l-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(u=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?u=0:"middle"==i&&(u=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),n&&function(e,t){var n=kr(e,t);null!=n.scrollTop&&Dr(e,n.scrollTop),null!=n.scrollLeft&&Lr(e,n.scrollLeft)}(this,{left:u,top:a,right:u+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:Yr(oa),triggerOnKeyPress:Yr(ua),triggerOnKeyUp:aa,triggerOnMouseDown:Yr(fa),execCommand:function(e){if(Jo.hasOwnProperty(e))return Jo[e].call(null,this)},triggerElectric:Yr(function(e){Da(this,e)}),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=_e(this.doc,e),a=0;a0&&u(n.charAt(r-1));)--r;for(;i.5)&&ar(this),it(this,"refresh",this)}),swapDoc:Yr(function(e){var t=this.doc;return t.cm=null,Di(this,e),Un(this),this.display.input.reset(),xr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,sn(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},st(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}(_a);var za="iter insert remove copy getEditor constructor".split(" ");for(var qa in So.prototype)So.prototype.hasOwnProperty(qa)&&U(za,qa)<0&&(_a.prototype[qa]=function(e){return function(){return e.apply(this.doc,arguments)}}(So.prototype[qa]));return st(So),_a.inputStyles={textarea:Ba,contenteditable:Pa},_a.defineMode=function(e){_a.defaults.mode||"null"==e||(_a.defaults.mode=e),function(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),kt[e]=t}.apply(this,arguments)},_a.defineMIME=function(e,t){Ot[e]=t},_a.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),_a.defineMIME("text/plain","null"),_a.defineExtension=function(e,t){_a.prototype[e]=t},_a.defineDocExtension=function(e,t){So.prototype[e]=t},_a.fromTextArea=function(e,t){if((t=t?M(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=L();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function r(){e.value=u.getValue()}var i;if(e.form&&(tt(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(s){}}t.finishInit=function(t){t.save=r,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,r(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(rt(e.form,"submit",r),"function"==typeof e.form.submit&&(e.form.submit=i))}},e.style.display="none";var u=_a(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return u},function(e){e.off=rt,e.on=tt,e.wheelEventPixels=mi,e.Doc=So,e.splitLines=wt,e.countColumn=R,e.findColumn=G,e.isWordChar=ee,e.Pass=z,e.signal=it,e.Line=Gt,e.changeEnd=Ei,e.scrollbarModel=Rr,e.Pos=ve,e.cmpPos=ge,e.modes=kt,e.mimeModes=Ot,e.resolveMode=St,e.getMode=xt,e.modeExtensions=Ct,e.extendMode=Nt,e.copyState=Dt,e.startState=Lt,e.innerMode=At,e.commands=Jo,e.keyMap=Ro,e.keyName=Ho,e.isModifierKey=zo,e.lookupKey=Bo,e.normalizeKeyMap=Uo,e.StringStream=jt,e.SharedTextMarker=To,e.TextMarker=wo,e.LineWidget=go,e.e_preventDefault=lt,e.e_stopPropagation=ct,e.e_stop=pt,e.addClass=j,e.contains=A,e.rmClass=S,e.keyNames=Io}(_a),_a.version="5.45.0",_a}()},function(e,t,n){"use strict";e.exports=n(167)},function(e,t,n){"use strict";n.d(t,"a",function(){return o});var r=n(13),i=n(34);function o(e){return Object(r.c)(e,{leave:a})}var a={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return s(e.definitions,"\n\n")+"\n"},OperationDefinition:function(e){var t=e.operation,n=e.name,r=c("(",s(e.variableDefinitions,", "),")"),i=s(e.directives," "),o=e.selectionSet;return n||i||r||"query"!==t?s([t,s([n,r]),i,o]," "):o},VariableDefinition:function(e){var t=e.variable,n=e.type,r=e.defaultValue,i=e.directives;return t+": "+n+c(" = ",r)+c(" ",s(i," "))},SelectionSet:function(e){return l(e.selections)},Field:function(e){var t=e.alias,n=e.name,r=e.arguments,i=e.directives,o=e.selectionSet;return s([c("",t,": ")+n+c("(",s(r,", "),")"),s(i," "),o]," ")},Argument:function(e){return e.name+": "+e.value},FragmentSpread:function(e){return"..."+e.name+c(" ",s(e.directives," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,r=e.selectionSet;return s(["...",c("on ",t),s(n," "),r]," ")},FragmentDefinition:function(e){var t=e.name,n=e.typeCondition,r=e.variableDefinitions,i=e.directives,o=e.selectionSet;return"fragment ".concat(t).concat(c("(",s(r,", "),")")," ")+"on ".concat(n," ").concat(c("",s(i," ")," "))+o},IntValue:function(e){return e.value},FloatValue:function(e){return e.value},StringValue:function(e,t){var n=e.value;return e.block?Object(i.b)(n,"description"===t?"":" "):JSON.stringify(n)},BooleanValue:function(e){return e.value?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){return e.value},ListValue:function(e){return"["+s(e.values,", ")+"]"},ObjectValue:function(e){return"{"+s(e.fields,", ")+"}"},ObjectField:function(e){return e.name+": "+e.value},Directive:function(e){return"@"+e.name+c("(",s(e.arguments,", "),")")},NamedType:function(e){return e.name},ListType:function(e){return"["+e.type+"]"},NonNullType:function(e){return e.type+"!"},SchemaDefinition:function(e){var t=e.directives,n=e.operationTypes;return s(["schema",s(t," "),l(n)]," ")},OperationTypeDefinition:function(e){return e.operation+": "+e.type},ScalarTypeDefinition:u(function(e){return s(["scalar",e.name,s(e.directives," ")]," ")}),ObjectTypeDefinition:u(function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return s(["type",t,c("implements ",s(n," & ")),s(r," "),l(i)]," ")}),FieldDefinition:u(function(e){var t=e.name,n=e.arguments,r=e.type,i=e.directives;return t+(d(n)?c("(\n",f(s(n,"\n")),"\n)"):c("(",s(n,", "),")"))+": "+r+c(" ",s(i," "))}),InputValueDefinition:u(function(e){var t=e.name,n=e.type,r=e.defaultValue,i=e.directives;return s([t+": "+n,c("= ",r),s(i," ")]," ")}),InterfaceTypeDefinition:u(function(e){var t=e.name,n=e.directives,r=e.fields;return s(["interface",t,s(n," "),l(r)]," ")}),UnionTypeDefinition:u(function(e){var t=e.name,n=e.directives,r=e.types;return s(["union",t,s(n," "),r&&0!==r.length?"= "+s(r," | "):""]," ")}),EnumTypeDefinition:u(function(e){var t=e.name,n=e.directives,r=e.values;return s(["enum",t,s(n," "),l(r)]," ")}),EnumValueDefinition:u(function(e){return s([e.name,s(e.directives," ")]," ")}),InputObjectTypeDefinition:u(function(e){var t=e.name,n=e.directives,r=e.fields;return s(["input",t,s(n," "),l(r)]," ")}),DirectiveDefinition:u(function(e){var t=e.name,n=e.arguments,r=e.locations;return"directive @"+t+(d(n)?c("(\n",f(s(n,"\n")),"\n)"):c("(",s(n,", "),")"))+" on "+s(r," | ")}),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return s(["extend schema",s(t," "),l(n)]," ")},ScalarTypeExtension:function(e){return s(["extend scalar",e.name,s(e.directives," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return s(["extend type",t,c("implements ",s(n," & ")),s(r," "),l(i)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return s(["extend interface",t,s(n," "),l(r)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,r=e.types;return s(["extend union",t,s(n," "),r&&0!==r.length?"= "+s(r," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,r=e.values;return s(["extend enum",t,s(n," "),l(r)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return s(["extend input",t,s(n," "),l(r)]," ")}};function u(e){return function(t){return s([t.description,e(t)],"\n")}}function s(e,t){return e?e.filter(function(e){return e}).join(t||""):""}function l(e){return e&&0!==e.length?"{\n"+f(s(e,"\n"))+"\n}":""}function c(e,t,n){return t?e+t+(n||""):""}function f(e){return e&&" "+e.replace(/\n/g,"\n ")}function p(e){return-1!==e.indexOf("\n")}function d(e){return e&&e.some(p)}},function(e,t,n){"use strict";n.d(t,"a",function(){return o}),n.d(t,"c",function(){return a}),n.d(t,"d",function(){return s}),n.d(t,"e",function(){return l}),n.d(t,"b",function(){return c});var r=n(2),i={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},o={};function a(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i,a=void 0,s=Array.isArray(e),l=[e],f=-1,p=[],d=void 0,h=void 0,m=void 0,v=[],g=[],y=e;do{var b=++f===l.length,w=b&&0!==p.length;if(b){if(h=0===g.length?void 0:v[v.length-1],d=m,m=g.pop(),w){if(s)d=d.slice();else{for(var E={},T=Object.keys(d),_=0;_1&&"_"===e[0]&&"_"===e[1]?new L.a('Name "'.concat(e,'" must not begin with "__", which is reserved by ')+"GraphQL introspection.",t):j.test(e)?void 0:new L.a('Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "'.concat(e,'" does not.'),t)}function P(e,t){return e===t||(Object(u.L)(e)&&Object(u.L)(t)?P(e.ofType,t.ofType):!(!Object(u.J)(e)||!Object(u.J)(t))&&P(e.ofType,t.ofType))}function M(e,t,n){return t===n||(Object(u.L)(n)?!!Object(u.L)(t)&&M(e,t.ofType,n.ofType):Object(u.L)(t)?M(e,t.ofType,n):Object(u.J)(n)?!!Object(u.J)(t)&&M(e,t.ofType,n.ofType):!Object(u.J)(t)&&!!(Object(u.C)(n)&&Object(u.N)(t)&&e.isPossibleType(n,t)))}function R(e,t,n){return t===n||(Object(u.C)(t)?Object(u.C)(n)?e.getPossibleTypes(t).some(function(t){return e.isPossibleType(n,t)}):e.isPossibleType(t,n):!!Object(u.C)(n)&&e.isPossibleType(n,t))}function V(e){if(C(e),e.__validationErrors)return e.__validationErrors;var t=new B(e);!function(e){var t=e.schema,n=t.getQueryType();n?Object(u.N)(n)||e.reportError("Query root type must be Object type, it cannot be ".concat(Object(d.a)(n),"."),z(t,n,"query")):e.reportError("Query root type must be provided.",t.astNode);var r=t.getMutationType();r&&!Object(u.N)(r)&&e.reportError("Mutation root type must be Object type if provided, it cannot be "+"".concat(Object(d.a)(r),"."),z(t,r,"mutation"));var i=t.getSubscriptionType();i&&!Object(u.N)(i)&&e.reportError("Subscription root type must be Object type if provided, it cannot be "+"".concat(Object(d.a)(i),"."),z(t,i,"subscription"))}(t),function(e){var t=!0,n=!1,r=void 0;try{for(var i,o=e.schema.getDirectives()[Symbol.iterator]();!(t=(i=o.next()).done);t=!0){var a=i.value;if(v(a)){q(e,a);var s=Object.create(null),l=!0,c=!1,f=void 0;try{for(var p,h=a.args[Symbol.iterator]();!(l=(p=h.next()).done);l=!0){var m=p.value,g=m.name;q(e,m),s[g]?e.reportError("Argument @".concat(a.name,"(").concat(g,":) can only be defined once."),oe(a,g)):(s[g]=!0,Object(u.G)(m.type)||e.reportError("The type of @".concat(a.name,"(").concat(g,":) must be Input Type ")+"but got: ".concat(Object(d.a)(m.type),"."),ae(a,g)))}}catch(y){c=!0,f=y}finally{try{l||null==h.return||h.return()}finally{if(c)throw f}}}else e.reportError("Expected directive but got: ".concat(Object(d.a)(a),"."),a&&a.astNode)}}catch(y){n=!0,r=y}finally{try{t||null==o.return||o.return()}finally{if(n)throw r}}}(t),function(e){var t=e.schema.getTypeMap(),n=!0,r=!1,i=void 0;try{for(var a,s=Object(o.a)(t)[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){var l=a.value;Object(u.K)(l)?(Object(O.isIntrospectionType)(l)||q(e,l),Object(u.N)(l)?(H(e,l),K(e,l)):Object(u.H)(l)?H(e,l):Object(u.T)(l)?W(e,l):Object(u.E)(l)?Q(e,l):Object(u.F)(l)&&Y(e,l)):e.reportError("Expected GraphQL named type but got: ".concat(Object(d.a)(l),"."),l&&l.astNode)}}catch(c){r=!0,i=c}finally{try{n||null==s.return||s.return()}finally{if(r)throw i}}}(t);var n=t.getErrors();return e.__validationErrors=n,n}function U(e){var t=V(e);if(0!==t.length)throw new Error(t.map(function(e){return e.message}).join("\n\n"))}var B=function(){function e(e){this._errors=[],this.schema=e}var t=e.prototype;return t.reportError=function(e,t){var n=Array.isArray(t)?t.filter(Boolean):t;this.addError(new L.a(e,n))},t.addError=function(e){this._errors.push(e)},t.getErrors=function(){return this._errors},e}();function z(e,t,n){var r=$(e,function(e){return e.operationTypes}),i=!0,o=!1,a=void 0;try{for(var u,s=r[Symbol.iterator]();!(i=(u=s.next()).done);i=!0){var l=u.value;if(l.operation===n)return l.type}}catch(c){o=!0,a=c}finally{try{i||null==s.return||s.return()}finally{if(o)throw a}}return t.astNode}function q(e,t){if(-1===e.schema.__allowedLegacyNames.indexOf(t.name)){var n=F(t.name,t.astNode||void 0);n&&e.addError(n)}}function H(e,t){var n=Object(o.a)(t.getFields());0===n.length&&e.reportError("Type ".concat(t.name," must define one or more fields."),J(t));var r=!0,i=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value;q(e,c),Object(u.O)(c.type)||e.reportError("The type of ".concat(t.name,".").concat(c.name," must be Output Type ")+"but got: ".concat(Object(d.a)(c.type),"."),te(t,c.name));var f=Object.create(null),p=!0,h=!1,m=void 0;try{for(var v,g=c.args[Symbol.iterator]();!(p=(v=g.next()).done);p=!0){var y=v.value,b=y.name;q(e,y),f[b]&&e.reportError("Field argument ".concat(t.name,".").concat(c.name,"(").concat(b,":) can only ")+"be defined once.",re(t,c.name,b)),f[b]=!0,Object(u.G)(y.type)||e.reportError("The type of ".concat(t.name,".").concat(c.name,"(").concat(b,":) must be Input ")+"Type but got: ".concat(Object(d.a)(y.type),"."),ie(t,c.name,b))}}catch(w){h=!0,m=w}finally{try{p||null==g.return||g.return()}finally{if(h)throw m}}}}catch(w){i=!0,a=w}finally{try{r||null==l.return||l.return()}finally{if(i)throw a}}}function K(e,t){var n=Object.create(null),r=!0,i=!1,o=void 0;try{for(var a,s=t.getInterfaces()[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var l=a.value;Object(u.H)(l)?n[l.name]?e.reportError("Type ".concat(t.name," can only implement ").concat(l.name," once."),Z(t,l)):(n[l.name]=!0,G(e,t,l)):e.reportError("Type ".concat(Object(d.a)(t)," must only implement Interface types, ")+"it cannot implement ".concat(Object(d.a)(l),"."),X(t,l))}}catch(c){i=!0,o=c}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}}function G(e,t,n){var i=t.getFields(),o=n.getFields(),s=!0,l=!1,c=void 0;try{for(var f,p=Object(a.a)(o)[Symbol.iterator]();!(s=(f=p.next()).done);s=!0){var h=f.value,m=h[0],v=h[1],g=i[m];if(g){M(e.schema,g.type,v.type)||e.reportError("Interface field ".concat(n.name,".").concat(m," expects type ")+"".concat(Object(d.a)(v.type)," but ").concat(t.name,".").concat(m," ")+"is type ".concat(Object(d.a)(g.type),"."),[te(n,m),te(t,m)]);var y=!0,b=!1,w=void 0;try{for(var E,T=function(){var i=E.value,o=i.name,a=r(g.args,function(e){return e.name===o});if(!a)return e.reportError("Interface field argument ".concat(n.name,".").concat(m,"(").concat(o,":) ")+"expected but ".concat(t.name,".").concat(m," does not provide it."),[ne(n,m,o),ee(t,m)]),"continue";P(i.type,a.type)||e.reportError("Interface field argument ".concat(n.name,".").concat(m,"(").concat(o,":) ")+"expects type ".concat(Object(d.a)(i.type)," but ")+"".concat(t.name,".").concat(m,"(").concat(o,":) is type ")+"".concat(Object(d.a)(a.type),"."),[ie(n,m,o),ie(t,m,o)])},_=v.args[Symbol.iterator]();!(y=(E=_.next()).done);y=!0)T()}catch(D){b=!0,w=D}finally{try{y||null==_.return||_.return()}finally{if(b)throw w}}var k=!0,O=!1,S=void 0;try{for(var x,C=function(){var i=x.value,o=i.name;!r(v.args,function(e){return e.name===o})&&Object(u.P)(i)&&e.reportError("Object field ".concat(t.name,".").concat(m," includes required ")+"argument ".concat(o," that is missing from the Interface field ")+"".concat(n.name,".").concat(m,"."),[ne(t,m,o),ee(n,m)])},N=g.args[Symbol.iterator]();!(k=(x=N.next()).done);k=!0)C()}catch(D){O=!0,S=D}finally{try{k||null==N.return||N.return()}finally{if(O)throw S}}}else e.reportError("Interface field ".concat(n.name,".").concat(m," expected but ")+"".concat(t.name," does not provide it."),[ee(n,m)].concat(J(t)))}}catch(D){l=!0,c=D}finally{try{s||null==p.return||p.return()}finally{if(l)throw c}}}function W(e,t){var n=t.getTypes();0===n.length&&e.reportError("Union type ".concat(t.name," must define one or more member types."),J(t));var r=Object.create(null),i=!0,o=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(i=(s=l.next()).done);i=!0){var c=s.value;r[c.name]?e.reportError("Union type ".concat(t.name," can only include type ")+"".concat(c.name," once."),ue(t,c.name)):(r[c.name]=!0,Object(u.N)(c)||e.reportError("Union type ".concat(t.name," can only include Object types, ")+"it cannot include ".concat(Object(d.a)(c),"."),ue(t,String(c))))}}catch(f){o=!0,a=f}finally{try{i||null==l.return||l.return()}finally{if(o)throw a}}}function Q(e,t){var n=t.getValues();0===n.length&&e.reportError("Enum type ".concat(t.name," must define one or more values."),J(t));var r=!0,i=!1,o=void 0;try{for(var a,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var s=a.value,l=s.name;q(e,s),"true"!==l&&"false"!==l&&"null"!==l||e.reportError("Enum type ".concat(t.name," cannot include value: ").concat(l,"."),s.astNode)}}catch(c){i=!0,o=c}finally{try{r||null==u.return||u.return()}finally{if(i)throw o}}}function Y(e,t){var n=Object(o.a)(t.getFields());0===n.length&&e.reportError("Input Object type ".concat(t.name," must define one or more fields."),J(t));var r=!0,i=!1,a=void 0;try{for(var s,l=n[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var c=s.value;q(e,c),Object(u.G)(c.type)||e.reportError("The type of ".concat(t.name,".").concat(c.name," must be Input Type ")+"but got: ".concat(Object(d.a)(c.type),"."),c.astNode&&c.astNode.type)}}catch(f){i=!0,a=f}finally{try{r||null==l.return||l.return()}finally{if(i)throw a}}}function J(e){var t=e.astNode,n=e.extensionASTNodes;return t?n?[t].concat(n):[t]:n||[]}function $(e,t){return i(J(e),function(e){return t(e)||[]})}function X(e,t){return Z(e,t)[0]}function Z(e,t){return $(e,function(e){return e.interfaces}).filter(function(e){return e.name.value===t.name})}function ee(e,t){return r($(e,function(e){return e.fields}),function(e){return e.name.value===t})}function te(e,t){var n=ee(e,t);return n&&n.type}function ne(e,t,n){return re(e,t,n)[0]}function re(e,t,n){var r=[],i=ee(e,t);if(i&&i.arguments){var o=!0,a=!1,u=void 0;try{for(var s,l=i.arguments[Symbol.iterator]();!(o=(s=l.next()).done);o=!0){var c=s.value;c.name.value===n&&r.push(c)}}catch(f){a=!0,u=f}finally{try{o||null==l.return||l.return()}finally{if(a)throw u}}}return r}function ie(e,t,n){var r=ne(e,t,n);return r&&r.type}function oe(e,t){return $(e,function(e){return e.arguments}).filter(function(e){return e.name.value===t})}function ae(e,t){var n=oe(e,t)[0];return n&&n.type}function ue(e,t){return $(e,function(e){return e.types}).filter(function(e){return e.name.value===t})}var se=function(e,t,n){this.body=e,this.name=t||"GraphQL request",this.locationOffset=n||{line:1,column:1},this.locationOffset.line>0||Object(p.a)(0,"line in locationOffset is 1-indexed and must be positive"),this.locationOffset.column>0||Object(p.a)(0,"column in locationOffset is 1-indexed and must be positive")};function le(e,t,n){return new L.a("Syntax Error: ".concat(n),void 0,e,[t])}Object(l.a)(se);var ce=n(34);function fe(e,t){var n=new ve(he.SOF,0,0,0,0,null);return{source:e,options:t,lastToken:n,token:n,line:1,lineStart:0,advance:pe,lookahead:de}}function pe(){return this.lastToken=this.token,this.token=this.lookahead()}function de(){var e=this.token;if(e.kind!==he.EOF)do{e=e.next||(e.next=ye(this,e))}while(e.kind===he.COMMENT);return e}var he=Object.freeze({SOF:"",EOF:"",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function me(e){var t=e.value;return t?"".concat(e.kind,' "').concat(t,'"'):e.kind}function ve(e,t,n,r,i,o,a){this.kind=e,this.start=t,this.end=n,this.line=r,this.column=i,this.value=a,this.prev=o,this.next=null}function ge(e){return isNaN(e)?he.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function ye(e,t){var n=e.source,r=n.body,i=r.length,o=function(e,t,n){var r=e.length,i=t;for(;i=i)return new ve(he.EOF,i,i,a,u,t);var s=r.charCodeAt(o);switch(s){case 33:return new ve(he.BANG,o,o+1,a,u,t);case 35:return function(e,t,n,r,i){var o,a=e.body,u=t;do{o=a.charCodeAt(++u)}while(!isNaN(o)&&(o>31||9===o));return new ve(he.COMMENT,t,u,n,r,i,a.slice(t+1,u))}(n,o,a,u,t);case 36:return new ve(he.DOLLAR,o,o+1,a,u,t);case 38:return new ve(he.AMP,o,o+1,a,u,t);case 40:return new ve(he.PAREN_L,o,o+1,a,u,t);case 41:return new ve(he.PAREN_R,o,o+1,a,u,t);case 46:if(46===r.charCodeAt(o+1)&&46===r.charCodeAt(o+2))return new ve(he.SPREAD,o,o+3,a,u,t);break;case 58:return new ve(he.COLON,o,o+1,a,u,t);case 61:return new ve(he.EQUALS,o,o+1,a,u,t);case 64:return new ve(he.AT,o,o+1,a,u,t);case 91:return new ve(he.BRACKET_L,o,o+1,a,u,t);case 93:return new ve(he.BRACKET_R,o,o+1,a,u,t);case 123:return new ve(he.BRACE_L,o,o+1,a,u,t);case 124:return new ve(he.PIPE,o,o+1,a,u,t);case 125:return new ve(he.BRACE_R,o,o+1,a,u,t);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return function(e,t,n,r,i){var o=e.body,a=o.length,u=t+1,s=0;for(;u!==a&&!isNaN(s=o.charCodeAt(u))&&(95===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122);)++u;return new ve(he.NAME,t,u,n,r,i,o.slice(t,u))}(n,o,a,u,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return function(e,t,n,r,i,o){var a=e.body,u=n,s=t,l=!1;45===u&&(u=a.charCodeAt(++s));if(48===u){if((u=a.charCodeAt(++s))>=48&&u<=57)throw le(e,s,"Invalid number, unexpected digit after 0: ".concat(ge(u),"."))}else s=be(e,s,u),u=a.charCodeAt(s);46===u&&(l=!0,u=a.charCodeAt(++s),s=be(e,s,u),u=a.charCodeAt(s));69!==u&&101!==u||(l=!0,43!==(u=a.charCodeAt(++s))&&45!==u||(u=a.charCodeAt(++s)),s=be(e,s,u));return new ve(l?he.FLOAT:he.INT,t,s,r,i,o,a.slice(t,s))}(n,o,s,a,u,t);case 34:return 34===r.charCodeAt(o+1)&&34===r.charCodeAt(o+2)?function(e,t,n,r,i,o){var a=e.body,u=t+3,s=u,l=0,c="";for(;u=48&&o<=57){do{o=r.charCodeAt(++i)}while(o>=48&&o<=57);return i}throw le(e,i,"Invalid number, expected digit but got: ".concat(ge(o),"."))}function we(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}Object(c.a)(ve,function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}});var Ee=n(1);function Te(e,t){var n="string"===typeof e?new se(e):e;if(!(n instanceof se))throw new TypeError("Must provide Source. Received: ".concat(Object(d.a)(n)));return function(e){var t=e.token;return{kind:Ee.Kind.DOCUMENT,definitions:vt(e,he.SOF,Se,he.EOF),loc:ut(e,t)}}(fe(n,t||{}))}function _e(e,t){var n=fe("string"===typeof e?new se(e):e,t||{});ct(n,he.SOF);var r=Ve(n,!1);return ct(n,he.EOF),r}function ke(e,t){var n=fe("string"===typeof e?new se(e):e,t||{});ct(n,he.SOF);var r=Ke(n);return ct(n,he.EOF),r}function Oe(e){var t=ct(e,he.NAME);return{kind:Ee.Kind.NAME,value:t.value,loc:ut(e,t)}}function Se(e){if(lt(e,he.NAME))switch(e.token.value){case"query":case"mutation":case"subscription":case"fragment":return xe(e);case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return We(e);case"extend":return function(e){var t=e.lookahead();if(t.kind===he.NAME)switch(t.value){case"schema":return function(e){var t=e.token;pt(e,"extend"),pt(e,"schema");var n=qe(e,!0),r=lt(e,he.BRACE_L)?vt(e,he.BRACE_L,Je,he.BRACE_R):[];if(0===n.length&&0===r.length)throw ht(e);return{kind:Ee.Kind.SCHEMA_EXTENSION,directives:n,operationTypes:r,loc:ut(e,t)}}(e);case"scalar":return function(e){var t=e.token;pt(e,"extend"),pt(e,"scalar");var n=Oe(e),r=qe(e,!0);if(0===r.length)throw ht(e);return{kind:Ee.Kind.SCALAR_TYPE_EXTENSION,name:n,directives:r,loc:ut(e,t)}}(e);case"type":return function(e){var t=e.token;pt(e,"extend"),pt(e,"type");var n=Oe(e),r=$e(e),i=qe(e,!0),o=Xe(e);if(0===r.length&&0===i.length&&0===o.length)throw ht(e);return{kind:Ee.Kind.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:o,loc:ut(e,t)}}(e);case"interface":return function(e){var t=e.token;pt(e,"extend"),pt(e,"interface");var n=Oe(e),r=qe(e,!0),i=Xe(e);if(0===r.length&&0===i.length)throw ht(e);return{kind:Ee.Kind.INTERFACE_TYPE_EXTENSION,name:n,directives:r,fields:i,loc:ut(e,t)}}(e);case"union":return function(e){var t=e.token;pt(e,"extend"),pt(e,"union");var n=Oe(e),r=qe(e,!0),i=nt(e);if(0===r.length&&0===i.length)throw ht(e);return{kind:Ee.Kind.UNION_TYPE_EXTENSION,name:n,directives:r,types:i,loc:ut(e,t)}}(e);case"enum":return function(e){var t=e.token;pt(e,"extend"),pt(e,"enum");var n=Oe(e),r=qe(e,!0),i=rt(e);if(0===r.length&&0===i.length)throw ht(e);return{kind:Ee.Kind.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i,loc:ut(e,t)}}(e);case"input":return function(e){var t=e.token;pt(e,"extend"),pt(e,"input");var n=Oe(e),r=qe(e,!0),i=ot(e);if(0===r.length&&0===i.length)throw ht(e);return{kind:Ee.Kind.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i,loc:ut(e,t)}}(e)}throw ht(e,t)}(e)}else{if(lt(e,he.BRACE_L))return xe(e);if(Qe(e))return We(e)}throw ht(e)}function xe(e){if(lt(e,he.NAME))switch(e.token.value){case"query":case"mutation":case"subscription":return Ce(e);case"fragment":return function(e){var t=e.token;if(pt(e,"fragment"),e.options.experimentalFragmentVariables)return{kind:Ee.Kind.FRAGMENT_DEFINITION,name:Re(e),variableDefinitions:De(e),typeCondition:(pt(e,"on"),Ge(e)),directives:qe(e,!1),selectionSet:je(e),loc:ut(e,t)};return{kind:Ee.Kind.FRAGMENT_DEFINITION,name:Re(e),typeCondition:(pt(e,"on"),Ge(e)),directives:qe(e,!1),selectionSet:je(e),loc:ut(e,t)}}(e)}else if(lt(e,he.BRACE_L))return Ce(e);throw ht(e)}function Ce(e){var t=e.token;if(lt(e,he.BRACE_L))return{kind:Ee.Kind.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:je(e),loc:ut(e,t)};var n,r=Ne(e);return lt(e,he.NAME)&&(n=Oe(e)),{kind:Ee.Kind.OPERATION_DEFINITION,operation:r,name:n,variableDefinitions:De(e),directives:qe(e,!1),selectionSet:je(e),loc:ut(e,t)}}function Ne(e){var t=ct(e,he.NAME);switch(t.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw ht(e,t)}function De(e){return lt(e,he.PAREN_L)?vt(e,he.PAREN_L,Ae,he.PAREN_R):[]}function Ae(e){var t=e.token;return{kind:Ee.Kind.VARIABLE_DEFINITION,variable:Le(e),type:(ct(e,he.COLON),Ke(e)),defaultValue:ft(e,he.EQUALS)?Ve(e,!0):void 0,directives:qe(e,!0),loc:ut(e,t)}}function Le(e){var t=e.token;return ct(e,he.DOLLAR),{kind:Ee.Kind.VARIABLE,name:Oe(e),loc:ut(e,t)}}function je(e){var t=e.token;return{kind:Ee.Kind.SELECTION_SET,selections:vt(e,he.BRACE_L,Ie,he.BRACE_R),loc:ut(e,t)}}function Ie(e){return lt(e,he.SPREAD)?function(e){var t=e.token;ct(e,he.SPREAD);var n=dt(e,"on");if(!n&<(e,he.NAME))return{kind:Ee.Kind.FRAGMENT_SPREAD,name:Re(e),directives:qe(e,!1),loc:ut(e,t)};return{kind:Ee.Kind.INLINE_FRAGMENT,typeCondition:n?Ge(e):void 0,directives:qe(e,!1),selectionSet:je(e),loc:ut(e,t)}}(e):function(e){var t,n,r=e.token,i=Oe(e);ft(e,he.COLON)?(t=i,n=Oe(e)):n=i;return{kind:Ee.Kind.FIELD,alias:t,name:n,arguments:Fe(e,!1),directives:qe(e,!1),selectionSet:lt(e,he.BRACE_L)?je(e):void 0,loc:ut(e,r)}}(e)}function Fe(e,t){var n=t?Me:Pe;return lt(e,he.PAREN_L)?vt(e,he.PAREN_L,n,he.PAREN_R):[]}function Pe(e){var t=e.token,n=Oe(e);return ct(e,he.COLON),{kind:Ee.Kind.ARGUMENT,name:n,value:Ve(e,!1),loc:ut(e,t)}}function Me(e){var t=e.token;return{kind:Ee.Kind.ARGUMENT,name:Oe(e),value:(ct(e,he.COLON),Be(e)),loc:ut(e,t)}}function Re(e){if("on"===e.token.value)throw ht(e);return Oe(e)}function Ve(e,t){var n=e.token;switch(n.kind){case he.BRACKET_L:return function(e,t){var n=e.token,r=t?Be:ze;return{kind:Ee.Kind.LIST,values:mt(e,he.BRACKET_L,r,he.BRACKET_R),loc:ut(e,n)}}(e,t);case he.BRACE_L:return function(e,t){var n=e.token;return{kind:Ee.Kind.OBJECT,fields:mt(e,he.BRACE_L,function(){return function(e,t){var n=e.token,r=Oe(e);return ct(e,he.COLON),{kind:Ee.Kind.OBJECT_FIELD,name:r,value:Ve(e,t),loc:ut(e,n)}}(e,t)},he.BRACE_R),loc:ut(e,n)}}(e,t);case he.INT:return e.advance(),{kind:Ee.Kind.INT,value:n.value,loc:ut(e,n)};case he.FLOAT:return e.advance(),{kind:Ee.Kind.FLOAT,value:n.value,loc:ut(e,n)};case he.STRING:case he.BLOCK_STRING:return Ue(e);case he.NAME:return"true"===n.value||"false"===n.value?(e.advance(),{kind:Ee.Kind.BOOLEAN,value:"true"===n.value,loc:ut(e,n)}):"null"===n.value?(e.advance(),{kind:Ee.Kind.NULL,loc:ut(e,n)}):(e.advance(),{kind:Ee.Kind.ENUM,value:n.value,loc:ut(e,n)});case he.DOLLAR:if(!t)return Le(e)}throw ht(e)}function Ue(e){var t=e.token;return e.advance(),{kind:Ee.Kind.STRING,value:t.value,block:t.kind===he.BLOCK_STRING,loc:ut(e,t)}}function Be(e){return Ve(e,!0)}function ze(e){return Ve(e,!1)}function qe(e,t){for(var n=[];lt(e,he.AT);)n.push(He(e,t));return n}function He(e,t){var n=e.token;return ct(e,he.AT),{kind:Ee.Kind.DIRECTIVE,name:Oe(e),arguments:Fe(e,t),loc:ut(e,n)}}function Ke(e){var t,n=e.token;return ft(e,he.BRACKET_L)?(t=Ke(e),ct(e,he.BRACKET_R),t={kind:Ee.Kind.LIST_TYPE,type:t,loc:ut(e,n)}):t=Ge(e),ft(e,he.BANG)?{kind:Ee.Kind.NON_NULL_TYPE,type:t,loc:ut(e,n)}:t}function Ge(e){var t=e.token;return{kind:Ee.Kind.NAMED_TYPE,name:Oe(e),loc:ut(e,t)}}function We(e){var t=Qe(e)?e.lookahead():e.token;if(t.kind===he.NAME)switch(t.value){case"schema":return function(e){var t=e.token;pt(e,"schema");var n=qe(e,!0),r=vt(e,he.BRACE_L,Je,he.BRACE_R);return{kind:Ee.Kind.SCHEMA_DEFINITION,directives:n,operationTypes:r,loc:ut(e,t)}}(e);case"scalar":return function(e){var t=e.token,n=Ye(e);pt(e,"scalar");var r=Oe(e),i=qe(e,!0);return{kind:Ee.Kind.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i,loc:ut(e,t)}}(e);case"type":return function(e){var t=e.token,n=Ye(e);pt(e,"type");var r=Oe(e),i=$e(e),o=qe(e,!0),a=Xe(e);return{kind:Ee.Kind.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:o,fields:a,loc:ut(e,t)}}(e);case"interface":return function(e){var t=e.token,n=Ye(e);pt(e,"interface");var r=Oe(e),i=qe(e,!0),o=Xe(e);return{kind:Ee.Kind.INTERFACE_TYPE_DEFINITION,description:n,name:r,directives:i,fields:o,loc:ut(e,t)}}(e);case"union":return function(e){var t=e.token,n=Ye(e);pt(e,"union");var r=Oe(e),i=qe(e,!0),o=nt(e);return{kind:Ee.Kind.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:o,loc:ut(e,t)}}(e);case"enum":return function(e){var t=e.token,n=Ye(e);pt(e,"enum");var r=Oe(e),i=qe(e,!0),o=rt(e);return{kind:Ee.Kind.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:o,loc:ut(e,t)}}(e);case"input":return function(e){var t=e.token,n=Ye(e);pt(e,"input");var r=Oe(e),i=qe(e,!0),o=ot(e);return{kind:Ee.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:o,loc:ut(e,t)}}(e);case"directive":return function(e){var t=e.token,n=Ye(e);pt(e,"directive"),ct(e,he.AT);var r=Oe(e),i=et(e);pt(e,"on");var o=function(e){ft(e,he.PIPE);var t=[];do{t.push(at(e))}while(ft(e,he.PIPE));return t}(e);return{kind:Ee.Kind.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,locations:o,loc:ut(e,t)}}(e)}throw ht(e,t)}function Qe(e){return lt(e,he.STRING)||lt(e,he.BLOCK_STRING)}function Ye(e){if(Qe(e))return Ue(e)}function Je(e){var t=e.token,n=Ne(e);ct(e,he.COLON);var r=Ge(e);return{kind:Ee.Kind.OPERATION_TYPE_DEFINITION,operation:n,type:r,loc:ut(e,t)}}function $e(e){var t=[];if(dt(e,"implements")){ft(e,he.AMP);do{t.push(Ge(e))}while(ft(e,he.AMP)||e.options.allowLegacySDLImplementsInterfaces&<(e,he.NAME))}return t}function Xe(e){return e.options.allowLegacySDLEmptyFields&<(e,he.BRACE_L)&&e.lookahead().kind===he.BRACE_R?(e.advance(),e.advance(),[]):lt(e,he.BRACE_L)?vt(e,he.BRACE_L,Ze,he.BRACE_R):[]}function Ze(e){var t=e.token,n=Ye(e),r=Oe(e),i=et(e);ct(e,he.COLON);var o=Ke(e),a=qe(e,!0);return{kind:Ee.Kind.FIELD_DEFINITION,description:n,name:r,arguments:i,type:o,directives:a,loc:ut(e,t)}}function et(e){return lt(e,he.PAREN_L)?vt(e,he.PAREN_L,tt,he.PAREN_R):[]}function tt(e){var t=e.token,n=Ye(e),r=Oe(e);ct(e,he.COLON);var i,o=Ke(e);ft(e,he.EQUALS)&&(i=Be(e));var a=qe(e,!0);return{kind:Ee.Kind.INPUT_VALUE_DEFINITION,description:n,name:r,type:o,defaultValue:i,directives:a,loc:ut(e,t)}}function nt(e){var t=[];if(ft(e,he.EQUALS)){ft(e,he.PIPE);do{t.push(Ge(e))}while(ft(e,he.PIPE))}return t}function rt(e){return lt(e,he.BRACE_L)?vt(e,he.BRACE_L,it,he.BRACE_R):[]}function it(e){var t=e.token,n=Ye(e),r=Oe(e),i=qe(e,!0);return{kind:Ee.Kind.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i,loc:ut(e,t)}}function ot(e){return lt(e,he.BRACE_L)?vt(e,he.BRACE_L,tt,he.BRACE_R):[]}function at(e){var t=e.token,n=Oe(e);if(h.a.hasOwnProperty(n.value))return n;throw ht(e,t)}function ut(e,t){if(!e.options.noLocation)return new st(t,e.lastToken,e.source)}function st(e,t,n){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=n}function lt(e,t){return e.token.kind===t}function ct(e,t){var n=e.token;if(n.kind===t)return e.advance(),n;throw le(e.source,n.start,"Expected ".concat(t,", found ").concat(me(n)))}function ft(e,t){var n=e.token;if(n.kind===t)return e.advance(),n}function pt(e,t){var n=e.token;if(n.kind===he.NAME&&n.value===t)return e.advance(),n;throw le(e.source,n.start,'Expected "'.concat(t,'", found ').concat(me(n)))}function dt(e,t){var n=e.token;if(n.kind===he.NAME&&n.value===t)return e.advance(),n}function ht(e,t){var n=t||e.token;return le(e.source,n.start,"Unexpected ".concat(me(n)))}function mt(e,t,n,r){ct(e,t);for(var i=[];!ft(e,r);)i.push(n(e));return i}function vt(e,t,n,r){ct(e,t);for(var i=[n(e)];!ft(e,r);)i.push(n(e));return i}Object(c.a)(st,function(){return{start:this.start,end:this.end}});var gt=n(13);function yt(e,t){var n;if(t.kind===Ee.Kind.LIST_TYPE)return(n=yt(e,t.type))&&Object(u.d)(n);if(t.kind===Ee.Kind.NON_NULL_TYPE)return(n=yt(e,t.type))&&Object(u.e)(n);if(t.kind===Ee.Kind.NAMED_TYPE)return e.getType(t.name.value);throw new Error('Unexpected type node: "'.concat(Object(d.a)(t),'".'))}var bt=function(){function e(e,t,n){this._schema=e,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._defaultValueStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._getFieldDef=t||wt,n&&(Object(u.G)(n)&&this._inputTypeStack.push(n),Object(u.D)(n)&&this._parentTypeStack.push(n),Object(u.O)(n)&&this._typeStack.push(n))}var t=e.prototype;return t.getType=function(){if(this._typeStack.length>0)return this._typeStack[this._typeStack.length-1]},t.getParentType=function(){if(this._parentTypeStack.length>0)return this._parentTypeStack[this._parentTypeStack.length-1]},t.getInputType=function(){if(this._inputTypeStack.length>0)return this._inputTypeStack[this._inputTypeStack.length-1]},t.getParentInputType=function(){if(this._inputTypeStack.length>1)return this._inputTypeStack[this._inputTypeStack.length-2]},t.getFieldDef=function(){if(this._fieldDefStack.length>0)return this._fieldDefStack[this._fieldDefStack.length-1]},t.getDefaultValue=function(){if(this._defaultValueStack.length>0)return this._defaultValueStack[this._defaultValueStack.length-1]},t.getDirective=function(){return this._directive},t.getArgument=function(){return this._argument},t.getEnumValue=function(){return this._enumValue},t.enter=function(e){var t=this._schema;switch(e.kind){case Ee.Kind.SELECTION_SET:var n=Object(u.A)(this.getType());this._parentTypeStack.push(Object(u.D)(n)?n:void 0);break;case Ee.Kind.FIELD:var i,o,a=this.getParentType();a&&(i=this._getFieldDef(t,a,e))&&(o=i.type),this._fieldDefStack.push(i),this._typeStack.push(Object(u.O)(o)?o:void 0);break;case Ee.Kind.DIRECTIVE:this._directive=t.getDirective(e.name.value);break;case Ee.Kind.OPERATION_DEFINITION:var s;"query"===e.operation?s=t.getQueryType():"mutation"===e.operation?s=t.getMutationType():"subscription"===e.operation&&(s=t.getSubscriptionType()),this._typeStack.push(Object(u.N)(s)?s:void 0);break;case Ee.Kind.INLINE_FRAGMENT:case Ee.Kind.FRAGMENT_DEFINITION:var l=e.typeCondition,c=l?yt(t,l):Object(u.A)(this.getType());this._typeStack.push(Object(u.O)(c)?c:void 0);break;case Ee.Kind.VARIABLE_DEFINITION:var f=yt(t,e.type);this._inputTypeStack.push(Object(u.G)(f)?f:void 0);break;case Ee.Kind.ARGUMENT:var p,d,h=this.getDirective()||this.getFieldDef();h&&(p=r(h.args,function(t){return t.name===e.name.value}))&&(d=p.type),this._argument=p,this._defaultValueStack.push(p?p.defaultValue:void 0),this._inputTypeStack.push(Object(u.G)(d)?d:void 0);break;case Ee.Kind.LIST:var m=Object(u.B)(this.getInputType()),v=Object(u.J)(m)?m.ofType:m;this._defaultValueStack.push(void 0),this._inputTypeStack.push(Object(u.G)(v)?v:void 0);break;case Ee.Kind.OBJECT_FIELD:var g,y,b=Object(u.A)(this.getInputType());Object(u.F)(b)&&(y=b.getFields()[e.name.value])&&(g=y.type),this._defaultValueStack.push(y?y.defaultValue:void 0),this._inputTypeStack.push(Object(u.G)(g)?g:void 0);break;case Ee.Kind.ENUM:var w,E=Object(u.A)(this.getInputType());Object(u.E)(E)&&(w=E.getValue(e.value)),this._enumValue=w}},t.leave=function(e){switch(e.kind){case Ee.Kind.SELECTION_SET:this._parentTypeStack.pop();break;case Ee.Kind.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case Ee.Kind.DIRECTIVE:this._directive=null;break;case Ee.Kind.OPERATION_DEFINITION:case Ee.Kind.INLINE_FRAGMENT:case Ee.Kind.FRAGMENT_DEFINITION:this._typeStack.pop();break;case Ee.Kind.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case Ee.Kind.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case Ee.Kind.LIST:case Ee.Kind.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case Ee.Kind.ENUM:this._enumValue=null}},e}();function wt(e,t,n){var r=n.name.value;return r===O.SchemaMetaFieldDef.name&&e.getQueryType()===t?O.SchemaMetaFieldDef:r===O.TypeMetaFieldDef.name&&e.getQueryType()===t?O.TypeMetaFieldDef:r===O.TypeNameMetaFieldDef.name&&Object(u.D)(t)?O.TypeNameMetaFieldDef:Object(u.N)(t)||Object(u.H)(t)?t.getFields()[r]:void 0}var Et=n(101);function Tt(e){var t=Object.create(null);return{OperationDefinition:function(n){var r=n.name;return r&&(t[r.value]?e.reportError(new L.a(function(e){return'There can be only one operation named "'.concat(e,'".')}(r.value),[t[r.value],r])):t[r.value]=r),!1},FragmentDefinition:function(){return!1}}}function _t(e){var t=0;return{Document:function(e){t=e.definitions.filter(function(e){return e.kind===Ee.Kind.OPERATION_DEFINITION}).length},OperationDefinition:function(n){!n.name&&t>1&&e.reportError(new L.a("This anonymous operation must be the only defined operation.",n))}}}function kt(e){return{OperationDefinition:function(t){var n;"subscription"===t.operation&&1!==t.selectionSet.selections.length&&e.reportError(new L.a(((n=t.name&&t.name.value)?'Subscription "'.concat(n,'" '):"Anonymous Subscription ")+"must select only one top level field.",t.selectionSet.selections.slice(1)))}}}function Ot(e,t){for(var n=Object.create(null),r=t.length,i=e.length/2,o=0;o1&&r>1&&o[n-1]===a[r-2]&&o[n-2]===a[r-1]&&(i[n][r]=Math.min(i[n][r],i[n-2][r-2]+l))}return i[u][s]}var xt=5;function Ct(e){if(0===e.length&&Object(p.a)(0),1===e.length)return e[0];if(2===e.length)return e[0]+" or "+e[1];var t=e.slice(0,xt),n=t.pop();return t.join(", ")+", or "+n}function Nt(e){return Ct(e.map(function(e){return'"'.concat(e,'"')}))}var Dt=n(15);function At(e){var t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),r=Object.create(null),i=!0,o=!1,a=void 0;try{for(var u,s=e.getDocument().definitions[Symbol.iterator]();!(i=(u=s.next()).done);i=!0){var l=u.value;Object(Dt.d)(l)&&(r[l.name.value]=!0)}}catch(f){o=!0,a=f}finally{try{i||null==s.return||s.return()}finally{if(o)throw a}}var c=Object.keys(n).concat(Object.keys(r));return{NamedType:function(t,i,o,a,u){var s,l=t.name.value;if(!n[l]&&!r[l]){var f=u[2]||o,p=(s=f,Boolean(s&&!Array.isArray(s)&&(Object(Dt.g)(s)||Object(Dt.h)(s))));if(p&&function(e){return-1!==Lt.indexOf(e)}(l))return;var d=Ot(l,p?Lt.concat(c):c);e.reportError(new L.a(function(e,t){var n='Unknown type "'.concat(e,'".');return t.length&&(n+=" Did you mean ".concat(Nt(t),"?")),n}(l,d),t))}}}}var Lt=s.g.map(function(e){return e.name});var jt=n(12);function It(e){return{InlineFragment:function(t){var n=t.typeCondition;if(n){var r=yt(e.getSchema(),n);r&&!Object(u.D)(r)&&e.reportError(new L.a(function(e){return'Fragment cannot condition on non composite type "'.concat(e,'".')}(Object(jt.a)(n)),n))}},FragmentDefinition:function(t){var n=yt(e.getSchema(),t.typeCondition);n&&!Object(u.D)(n)&&e.reportError(new L.a(function(e,t){return'Fragment "'.concat(e,'" cannot condition on non composite ')+'type "'.concat(t,'".')}(t.name.value,Object(jt.a)(t.typeCondition)),t.typeCondition))}}}function Ft(e){return{VariableDefinition:function(t){var n=yt(e.getSchema(),t.type);if(n&&!Object(u.G)(n)){var r=t.variable.name.value;e.reportError(new L.a(function(e,t){return'Variable "$'.concat(e,'" cannot be non-input type "').concat(t,'".')}(r,Object(jt.a)(t.type)),t.type))}}}}function Pt(e){return{Field:function(t){var n=e.getType(),r=t.selectionSet;n&&(Object(u.I)(Object(u.A)(n))?r&&e.reportError(new L.a(function(e,t){return'Field "'.concat(e,'" must not have a selection since ')+'type "'.concat(t,'" has no subfields.')}(t.name.value,Object(d.a)(n)),r)):r||e.reportError(new L.a(function(e,t){return'Field "'.concat(e,'" of type "').concat(t,'" must have a ')+'selection of subfields. Did you mean "'.concat(e,' { ... }"?')}(t.name.value,Object(d.a)(n)),t)))}}}function Mt(e){return{Field:function(t){var n=e.getParentType();if(n&&!e.getFieldDef()){var r=e.getSchema(),i=t.name.value,o=function(e,t,n){if(Object(u.C)(t)){var r=[],i=Object.create(null),o=!0,a=!1,s=void 0;try{for(var l,c=e.getPossibleTypes(t)[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var f=l.value;if(f.getFields()[n]){r.push(f.name);var p=!0,d=!1,h=void 0;try{for(var m,v=f.getInterfaces()[Symbol.iterator]();!(p=(m=v.next()).done);p=!0){var g=m.value;g.getFields()[n]&&(i[g.name]=(i[g.name]||0)+1)}}catch(b){d=!0,h=b}finally{try{p||null==v.return||v.return()}finally{if(d)throw h}}}}}catch(b){a=!0,s=b}finally{try{o||null==c.return||c.return()}finally{if(a)throw s}}var y=Object.keys(i).sort(function(e,t){return i[t]-i[e]});return y.concat(r)}return[]}(r,n,i),a=0!==o.length?[]:function(e,t,n){if(Object(u.N)(t)||Object(u.H)(t)){var r=Object.keys(t.getFields());return Ot(n,r)}return[]}(0,n,i);e.reportError(new L.a(function(e,t,n,r){var i='Cannot query field "'.concat(e,'" on type "').concat(t,'".');if(0!==n.length){var o=Nt(n);i+=" Did you mean to use an inline fragment on ".concat(o,"?")}else 0!==r.length&&(i+=" Did you mean ".concat(Nt(r),"?"));return i}(i,n.name,o,a),t))}}}}function Rt(e){var t=Object.create(null);return{OperationDefinition:function(){return!1},FragmentDefinition:function(n){var r=n.name.value;return t[r]?e.reportError(new L.a('There can be only one fragment named "'.concat(r,'".'),[t[r],n.name])):t[r]=n.name,!1}}}var Vt=n(53),Ut=n(54);function Bt(e){return{InlineFragment:function(t){var n=e.getType(),r=e.getParentType();Object(u.D)(n)&&Object(u.D)(r)&&!R(e.getSchema(),n,r)&&e.reportError(new L.a(function(e,t){return"Fragment cannot be spread here as objects of "+'type "'.concat(e,'" can never be of type "').concat(t,'".')}(Object(d.a)(r),Object(d.a)(n)),t))},FragmentSpread:function(t){var n=t.name.value,r=function(e,t){var n=e.getFragment(t);if(n){var r=yt(e.getSchema(),n.typeCondition);if(Object(u.D)(r))return r}}(e,n),i=e.getParentType();r&&i&&!R(e.getSchema(),r,i)&&e.reportError(new L.a(function(e,t,n){return'Fragment "'.concat(e,'" cannot be spread here as objects of ')+'type "'.concat(t,'" can never be of type "').concat(n,'".')}(n,Object(d.a)(i),Object(d.a)(r)),t))}}}function zt(e,t){var n=t.length?" via "+t.join(", "):"";return'Cannot spread fragment "'.concat(e,'" within itself').concat(n,".")}function qt(e){var t=Object.create(null),n=[],r=Object.create(null);return{OperationDefinition:function(){return!1},FragmentDefinition:function(i){return function i(o){if(t[o.name.value])return;var a=o.name.value;t[a]=!0;var u=e.getFragmentSpreads(o.selectionSet);if(0===u.length)return;r[a]=n.length;for(var s=0;s1)for(var h=0;h0)return[[t,e.map(function(e){var t=e[0];return t})],e.reduce(function(e,t){var n=t[1];return e.concat(n)},[n]),e.reduce(function(e,t){var n=t[2];return e.concat(n)},[r])]}(function(e,t,n,r,i,o,a,u){var s=[],l=kn(e,t,i,o),c=l[0],f=l[1],p=kn(e,t,a,u),d=p[0],h=p[1];if(Tn(e,s,t,n,r,c,d),0!==h.length)for(var m=Object.create(null),v=0;v0&&e.reportError(new L.a("Must provide only one schema definition.",t)),++r)}}},function(e){var t=e.getSchema(),n=Object.create(null),r=t?{query:t.getQueryType(),mutation:t.getMutationType(),subscription:t.getSubscriptionType()}:{};return{SchemaDefinition:i,SchemaExtension:i};function i(t){if(t.operationTypes){var i=!0,o=!1,a=void 0;try{for(var u,s=(t.operationTypes||[])[Symbol.iterator]();!(i=(u=s.next()).done);i=!0){var l=u.value,c=l.operation,f=n[c];r[c]?e.reportError(new L.a(An(c),l)):f?e.reportError(new L.a(Dn(c),[f,l])):n[c]=l}}catch(p){o=!0,a=p}finally{try{i||null==s.return||s.return()}finally{if(o)throw a}}}return!1}},function(e){var t=Object.create(null),n=e.getSchema();return{ScalarTypeDefinition:r,ObjectTypeDefinition:r,InterfaceTypeDefinition:r,UnionTypeDefinition:r,EnumTypeDefinition:r,InputObjectTypeDefinition:r};function r(r){var i=r.name.value;if(!n||!n.getType(i))return t[i]?e.reportError(new L.a(function(e){return'There can be only one type named "'.concat(e,'".')}(i),[t[i],r.name])):t[i]=r.name,!1;e.reportError(new L.a(function(e){return'Type "'.concat(e,'" already exists in the schema. ')+"It cannot also be defined in this type definition."}(i),r.name))}},function(e){var t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),r=Object.create(null);return{EnumTypeDefinition:i,EnumTypeExtension:i};function i(t){var i=t.name.value;if(r[i]||(r[i]=Object.create(null)),t.values){var o=r[i],a=!0,s=!1,l=void 0;try{for(var c,f=t.values[Symbol.iterator]();!(a=(c=f.next()).done);a=!0){var p=c.value,d=p.name.value,h=n[i];Object(u.E)(h)&&h.getValue(d)?e.reportError(new L.a(jn(i,d),p.name)):o[d]?e.reportError(new L.a(Ln(i,d),[o[d],p.name])):o[d]=p.name}}catch(m){s=!0,l=m}finally{try{a||null==f.return||f.return()}finally{if(s)throw l}}}return!1}},function(e){var t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),r=Object.create(null);return{InputObjectTypeDefinition:i,InputObjectTypeExtension:i,InterfaceTypeDefinition:i,InterfaceTypeExtension:i,ObjectTypeDefinition:i,ObjectTypeExtension:i};function i(t){var i=t.name.value;if(r[i]||(r[i]=Object.create(null)),t.fields){var o=r[i],a=!0,u=!1,s=void 0;try{for(var l,c=t.fields[Symbol.iterator]();!(a=(l=c.next()).done);a=!0){var f=l.value,p=f.name.value;Pn(n[i],p)?e.reportError(new L.a(Fn(i,p),f.name)):o[p]?e.reportError(new L.a(In(i,p),[o[p],f.name])):o[p]=f.name}}catch(d){u=!0,s=d}finally{try{a||null==c.return||c.return()}finally{if(u)throw s}}}return!1}},function(e){var t=Object.create(null),n=e.getSchema();return{DirectiveDefinition:function(r){var i=r.name.value;if(!n||!n.getDirective(i))return t[i]?e.reportError(new L.a(function(e){return'There can be only one directive named "'.concat(e,'".')}(i),[t[i],r.name])):t[i]=r.name,!1;e.reportError(new L.a(function(e){return'Directive "'.concat(e,'" already exists in the schema. ')+"It cannot be redefined."}(i),r.name))}}},At,Yt,$t,function(e){var t=e.getSchema(),n=Object.create(null),r=!0,i=!1,o=void 0;try{for(var a,s=e.getDocument().definitions[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var l=a.value;Object(Dt.d)(l)&&(n[l.name.value]=l)}}catch(f){i=!0,o=f}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return{ScalarTypeExtension:c,ObjectTypeExtension:c,InterfaceTypeExtension:c,UnionTypeExtension:c,EnumTypeExtension:c,InputObjectTypeExtension:c};function c(r){var i,o=r.name.value,a=n[o],s=t&&t.getType(o);if(a){var l=Vn[a.kind];l!==r.kind&&e.reportError(new L.a(Rn(o,Un(l)),[a,r]))}else if(s){var c=(i=s,Object(u.R)(i)?Ee.Kind.SCALAR_TYPE_EXTENSION:Object(u.N)(i)?Ee.Kind.OBJECT_TYPE_EXTENSION:Object(u.H)(i)?Ee.Kind.INTERFACE_TYPE_EXTENSION:Object(u.T)(i)?Ee.Kind.UNION_TYPE_EXTENSION:Object(u.E)(i)?Ee.Kind.ENUM_TYPE_EXTENSION:Object(u.F)(i)?Ee.Kind.INPUT_OBJECT_TYPE_EXTENSION:void 0);c!==r.kind&&e.reportError(new L.a(Rn(o,Un(c)),r))}else{var f=Object.keys(n);t&&(f=f.concat(Object.keys(t.getTypeMap())));var p=Ot(o,f);e.reportError(new L.a(function(e,t){var n='Cannot extend type "'.concat(e,'" because it is not defined.');return t.length&&(n+=" Did you mean ".concat(Nt(t),"?")),n}(o,p),r.name))}}},tn,nn,Nn,dn];function qn(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var Hn=function(){function e(e){this._ast=e,this._errors=[],this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map}var t=e.prototype;return t.reportError=function(e){this._errors.push(e)},t.getErrors=function(){return this._errors},t.getDocument=function(){return this._ast},t.getFragment=function(e){var t=this._fragments;return t||(this._fragments=t=this.getDocument().definitions.reduce(function(e,t){return t.kind===Ee.Kind.FRAGMENT_DEFINITION&&(e[t.name.value]=t),e},Object.create(null))),t[e]},t.getFragmentSpreads=function(e){var t=this._fragmentSpreads.get(e);if(!t){t=[];for(var n=[e];0!==n.length;)for(var r=n.pop(),i=0;i2&&void 0!==arguments[2]?arguments[2]:Bn,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new bt(e);t||Object(p.a)(0,"Must provide document"),U(e);var i=new Gn(e,t,r),o=Object(gt.d)(n.map(function(e){return e(i)}));return Object(gt.c)(t,Object(gt.e)(r,o)),i.getErrors()}function Qn(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:zn,r=new Kn(e,t),i=n.map(function(e){return e(r)});return Object(gt.c)(e,Object(gt.d)(i)),r.getErrors()}var Yn=n(21);function Jn(e,t,n){return e&&Array.isArray(e.path)?e:new L.a(e&&e.message,e&&e.nodes||t,e&&e.source,e&&e.positions,n,e)}var $n=n(70);function Xn(e){return Boolean(e&&"function"===typeof e.then)}function Zn(e,t){switch(t.operation){case"query":var n=e.getQueryType();if(!n)throw new L.a("Schema does not define the required query root type.",t);return n;case"mutation":var r=e.getMutationType();if(!r)throw new L.a("Schema is not configured for mutations.",t);return r;case"subscription":var i=e.getSubscriptionType();if(!i)throw new L.a("Schema is not configured for subscriptions.",t);return i;default:throw new L.a("Can only have query, mutation and subscription operations.",t)}}function er(e){return(er="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tr(e,t,n,r){if(Object(u.L)(t))return null==e?rr([ar("Expected non-nullable type ".concat(Object(d.a)(t)," not to be null"),n,r)]):tr(e,t.ofType,n,r);if(null==e)return nr(null);if(Object(u.R)(t))try{var i=t.parseValue(e);return Object(rn.a)(i)?rr([ar("Expected type ".concat(t.name),n,r)]):nr(i)}catch(A){return rr([ar("Expected type ".concat(t.name),n,r,A.message,A)])}if(Object(u.E)(t)){if("string"===typeof e){var a=t.getValue(e);if(a)return nr(a.value)}var s=Ot(String(e),t.getValues().map(function(e){return e.name})),l=0!==s.length?"did you mean ".concat(Ct(s),"?"):void 0;return rr([ar("Expected type ".concat(t.name),n,r,l)])}if(Object(u.J)(t)){var c=t.ofType;if(Object(Yn.e)(e)){var f,p=[];return Object(Yn.b)(e,function(e,t){var i=tr(e,c,n,or(r,t));i.errors?f=ir(f,i.errors):f||p.push(i.value)}),f?rr(f):nr(p)}var h=tr(e,c,n);return h.errors?h:nr([h.value])}if(Object(u.F)(t)){if("object"!==er(e))return rr([ar("Expected type ".concat(t.name," to be an object"),n,r)]);var m,v={},g=t.getFields(),y=!0,b=!1,w=void 0;try{for(var E,T=Object(o.a)(g)[Symbol.iterator]();!(y=(E=T.next()).done);y=!0){var _=E.value,k=e[_.name];if(Object(rn.a)(k))Object(rn.a)(_.defaultValue)?Object(u.L)(_.type)&&(m=ir(m,ar("Field ".concat(ur(or(r,_.name))," of required ")+"type ".concat(Object(d.a)(_.type)," was not provided"),n))):v[_.name]=_.defaultValue;else{var O=tr(k,_.type,n,or(r,_.name));O.errors?m=ir(m,O.errors):m||(v[_.name]=O.value)}}}catch(L){b=!0,w=L}finally{try{y||null==T.return||T.return()}finally{if(b)throw w}}for(var S=Object.keys(e),x=0;x0)return{errors:l};try{s=Te(t)}catch(le){return{errors:[le]}}var c=Wn(e,s);return c.length>0?{errors:c}:hr(e,s,n,r,i,o,a,u)}var zr=n(38);function qr(e,t,n){var r,i,o,a,u,s,l=Object(Yn.c)(e);function c(e){return e.done?e:Hr(e.value,t).then(Kr,i)}if("function"===typeof l.return&&(r=l.return,i=function(e){var t=function(){return Promise.reject(e)};return r.call(l).then(t,t)}),n){var f=n;o=function(e){return Hr(e,f).then(Kr,i)}}return a={next:function(){return l.next().then(c,o)},return:function(){return r?r.call(l).then(c,o):Promise.resolve({value:void 0,done:!0})},throw:function(e){return"function"===typeof l.throw?l.throw(e).then(c,o):Promise.reject(e).catch(i)}},u=Yn.a,s=function(){return this},u in a?Object.defineProperty(a,u,{value:s,enumerable:!0,configurable:!0,writable:!0}):a[u]=s,a}function Hr(e,t){return new Promise(function(n){return n(t(e))})}function Kr(e){return{value:e,done:!1}}function Gr(e,t,n,r,i,o,a,u){return 1===arguments.length?Qr(e.schema,e.document,e.rootValue,e.contextValue,e.variableValues,e.operationName,e.fieldResolver,e.subscribeFieldResolver):Qr(e,t,n,r,i,o,a,u)}function Wr(e){if(e instanceof L.a)return{errors:[e]};throw e}function Qr(e,t,n,r,i,o,a,u){var s=Yr(e,t,n,r,i,o,u),l=function(n){return hr(e,t,n,r,i,o,a)};return s.then(function(e){return Object(Yn.d)(e)?qr(e,l,Wr):e},Wr)}function Yr(e,t,n,r,i,o,a){yr(e,t,i);try{var u=br(e,t,n,r,i,o,a);if(Array.isArray(u))return Promise.resolve({errors:u});var s=Zn(e,u.operation),l=Er(u,s,u.operation.selectionSet,Object.create(null),Object.create(null)),c=Object.keys(l)[0],f=l[c],p=f[0].name.value,h=Rr(e,s,p);if(!h)throw new L.a('The subscription field "'.concat(p,'" is not defined.'),f);var m=h.subscribe||u.fieldResolver,v=gr(void 0,c),g=Or(u,h,f,s,v),y=Sr(u,h,f,m,n,g);return Promise.resolve(y).then(function(e){if(e instanceof Error)throw Jn(e,f,vr(v));if(Object(Yn.d)(e))return e;throw new Error("Subscription field must return Async Iterable. Received: "+Object(d.a)(e))})}catch(b){return Promise.reject(b)}}var Jr=n(69);function $r(e){e||Object(p.a)(0,"Received null or undefined error.");var t=e.message||"An unknown error occurred.",n=e.locations,r=e.path,i=e.extensions;return i?{message:t,locations:n,path:r,extensions:i}:{message:t,locations:n,path:r}}function Xr(e){var t=!(e&&!1===e.descriptions);return"\n query IntrospectionQuery {\n __schema {\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n ".concat(t?"description":"","\n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n ").concat(t?"description":"","\n fields(includeDeprecated: true) {\n name\n ").concat(t?"description":"","\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n ").concat(t?"description":"","\n isDeprecated\n deprecationReason\n }\n possibleTypes {\n ...TypeRef\n }\n }\n\n fragment InputValue on __InputValue {\n name\n ").concat(t?"description":"","\n type { ...TypeRef }\n defaultValue\n }\n\n fragment TypeRef on __Type {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n ofType {\n kind\n name\n }\n }\n }\n }\n }\n }\n }\n }\n ")}var Zr=Xr();function ei(e,t){for(var n=null,r=0;r0?function(){return n.map(function(e){return t.getNamedType(e)})}:[],o=r&&r.length>0?function(){return ui(r,function(e){return t.buildField(e)})}:Object.create(null);return new u.f({name:e.name.value,description:li(e,this._options),interfaces:i,fields:o,astNode:e})},t._makeInterfaceDef=function(e){var t=this,n=e.fields,r=n&&n.length>0?function(){return ui(n,function(e){return t.buildField(e)})}:Object.create(null);return new u.c({name:e.name.value,description:li(e,this._options),fields:r,astNode:e})},t._makeEnumDef=function(e){var t=this,n=e.values||[];return new u.a({name:e.name.value,description:li(e,this._options),values:ui(n,function(e){return t.buildEnumValue(e)}),astNode:e})},t._makeUnionDef=function(e){var t=this,n=e.types,r=n&&n.length>0?function(){return n.map(function(e){return t.getNamedType(e)})}:[];return new u.h({name:e.name.value,description:li(e,this._options),types:r,astNode:e})},t._makeScalarDef=function(e){return new u.g({name:e.name.value,description:li(e,this._options),astNode:e,serialize:function(e){return e}})},t._makeInputObjectDef=function(e){var t=this,n=e.fields;return new u.b({name:e.name.value,description:li(e,this._options),fields:n?function(){return ui(n,function(e){return t.buildInputField(e)})}:Object.create(null),astNode:e})},e}();function ui(e,t){return Object(ni.a)(e,function(e){return e.name.value},t)}function si(e){var t=fr(T,e);return t&&t.reason}function li(e,t){if(e.description)return e.description.value;if(t&&t.commentDescriptions){var n=function(e){var t=e.loc;if(!t)return;var n=[],r=t.startToken.prev;for(;r&&r.kind===he.COMMENT&&r.next&&r.prev&&r.line+1===r.next.line&&r.line!==r.prev.line;){var i=String(r.value);n.push(i),r=r.prev}return n.reverse().join("\n")}(e);if(void 0!==n)return Object(ce.a)("\n"+n)}}function ci(e,t){return ii(Te(e,t),t)}var fi=n(28);function pi(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:"";return 0===t.length?"":t.every(function(e){return!e.description})?"("+t.map(Ai).join(", ")+")":"(\n"+t.map(function(t,r){return ji(e,t," "+n,!r)+" "+n+Ai(t)}).join("\n")+"\n"+n+")"}function Ai(e){var t=Object(Ei.a)(e.defaultValue,e.type),n=e.name+": "+String(e.type);return t&&(n+=" = ".concat(Object(jt.a)(t))),n}function Li(e){if(!e.isDeprecated)return"";var t=e.deprecationReason,n=Object(Ei.a)(t,s.e);return n&&""!==t&&t!==E?" @deprecated(reason: "+Object(jt.a)(n)+")":" @deprecated"}function ji(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(!t.description)return"";var o=function(e,t){var n=e.split("\n");return i(n,function(e){return e.length70;return(n&&!r?"\n"+n:n)+Object(ce.b)(a,"",u).replace(/\n/g,"\n"+n)+"\n"}var Ii=n(68);function Fi(e,t){var n=tr(e,t).errors;return n?n.map(function(e){return e.message}):[]}function Pi(e,t){var n=new N({}),r={kind:Ee.Kind.DOCUMENT,definitions:[]},i=new bt(n,void 0,e),o=new Gn(n,r,i),a=un(o);return Object(gt.c)(t,Object(gt.e)(i,a)),o.getErrors()}function Mi(e){return{kind:"Document",definitions:i(e,function(e){return e.definitions})}}function Ri(e){var t,n=[],r=Object.create(null),i=new Map,o=Object.create(null),a=0;Object(gt.c)(e,{OperationDefinition:function(e){t=Vi(e),n.push(e),i.set(e,a++)},FragmentDefinition:function(e){t=e.name.value,r[t]=e,i.set(e,a++)},FragmentSpread:function(e){var n=e.name.value;(o[t]||(o[t]=Object.create(null)))[n]=!0}});for(var u=Object.create(null),s=n,l=0;l=0&&t%1===0}function u(e){return Object(e)===e&&(a(e)||function(e){return!!l(e)}(e))}function s(e){var t=l(e);if(t)return t.call(e)}function l(e){if(null!=e){var t=i&&e[i]||e["@@iterator"];if("function"===typeof t)return t}}function c(e){this._o=e,this._i=0}function f(e,t,n){if(null!=e){if("function"===typeof e.forEach)return e.forEach(t,n);var r=0,i=s(e);if(i){for(var o;!(o=i.next()).done;)if(t.call(n,o.value,r++,e),r>9999999)throw new TypeError("Near-infinite iteration.")}else if(a(e))for(;r=this._o.length?(this._o=void 0,{value:void 0,done:!0}):{value:this._o[this._i++],done:!1}};var p=r&&r.asyncIterator,d=p||"@@asyncIterator";function h(e){return!!v(e)}function m(e){var t=v(e);if(t)return t.call(e)}function v(e){if(null!=e){var t=p&&e[p]||e["@@asyncIterator"];if("function"===typeof t)return t}}function g(e){this._i=e}g.prototype[d]=function(){return this},g.prototype.next=function(){var e=this._i.next();return Promise.resolve(e.value).then(function(t){return{value:t,done:e.done}})}},function(e,t,n){"use strict";function r(e){"function"===typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return this.constructor.name}})}n.d(t,"a",function(){return r})},function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=n(55);function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.prototype.toString;e.prototype.toJSON=t,e.prototype.inspect=t,r.a&&(e.prototype[r.a]=t)}},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var r=n(88)("wks"),i=n(61),o=n(24).Symbol,a="function"==typeof o;(e.exports=function(e){return r[e]||(r[e]=a&&o[e]||(a?o:i)("Symbol."+e))}).store=r},function(e,t,n){"use strict";t.a=function(e,t){return e instanceof t}},function(e,t,n){"use strict";var r=Object.entries||function(e){return Object.keys(e).map(function(t){return[t,e[t]]})};t.a=r},function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=n(27);function i(e,t){var n=Object.create(null),i=!0,o=!1,a=void 0;try{for(var u,s=Object(r.a)(e)[Symbol.iterator]();!(i=(u=s.next()).done);i=!0){var l=u.value,c=l[0],f=l[1];n[c]=t(f,c)}}catch(p){o=!0,a=p}finally{try{i||null==s.return||s.return()}finally{if(o)throw a}}return n}},function(e,t,n){var r=n(24),i=n(20),o=n(49),a=n(36),u=n(35),s=function e(t,n,s){var l,c,f,p=t&e.F,d=t&e.G,h=t&e.S,m=t&e.P,v=t&e.B,g=t&e.W,y=d?i:i[n]||(i[n]={}),b=y.prototype,w=d?r:h?r[n]:(r[n]||{}).prototype;for(l in d&&(s=n),s)(c=!p&&w&&void 0!==w[l])&&u(y,l)||(f=c?w[l]:s[l],y[l]=d&&"function"!=typeof w[l]?s[l]:v&&c?o(f,r):g&&w[l]==f?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(f):m&&"function"==typeof f?o(Function.call,f):f,m&&((y.virtual||(y.virtual={}))[l]=f,t&e.R&&b&&!b[l]&&a(b,l,f)))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,e.exports=s},function(e,t,n){var r=n(32);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){var r=n(30),i=n(131),o=n(90),a=Object.defineProperty;t.f=n(33)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(u){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t){e.exports=function(e){return"object"===typeof e?null!==e:"function"===typeof e}},function(e,t,n){e.exports=!n(50)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";function r(e){for(var t=e.split(/\r\n|[\n\r]/g),n=null,r=1;r0&&o(t[0]);)t.shift();for(;t.length>0&&o(t[t.length-1]);)t.pop();return t.join("\n")}function i(e){for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=-1===e.indexOf("\n"),i=" "===e[0]||"\t"===e[0],o='"'===e[e.length-1],a=!r||o||n,u="";return!a||r&&i||(u+="\n"+t),u+=t?e.replace(/\n/g,"\n"+t):e,a&&(u+="\n"),'"""'+u.replace(/"""/g,'\\"""')+'"""'}n.d(t,"a",function(){return r}),n.d(t,"b",function(){return a})},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(31),i=n(63);e.exports=n(33)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";n.d(t,"a",function(){return p});var r=n(21),i=n(8),o=n(2),a=n(70),u=n(18),s=n(1),l=n(0),c=n(7);function f(e){return(f="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){if(Object(l.L)(t)){var n=p(e,t.ofType);return n&&n.kind===s.Kind.NULL?null:n}if(null===e)return{kind:s.Kind.NULL};if(Object(u.a)(e))return null;if(Object(l.J)(t)){var h=t.ofType;if(Object(r.e)(e)){var m=[];return Object(r.b)(e,function(e){var t=p(e,h);t&&m.push(t)}),{kind:s.Kind.LIST,values:m}}return p(e,h)}if(Object(l.F)(t)){if(null===e||"object"!==f(e))return null;var v=Object(i.a)(t.getFields()),g=[],y=!0,b=!1,w=void 0;try{for(var E,T=v[Symbol.iterator]();!(y=(E=T.next()).done);y=!0){var _=E.value,k=p(e[_.name],_.type);k&&g.push({kind:s.Kind.OBJECT_FIELD,name:{kind:s.Kind.NAME,value:_.name},value:k})}}catch(x){b=!0,w=x}finally{try{y||null==T.return||T.return()}finally{if(b)throw w}}return{kind:s.Kind.OBJECT,fields:g}}if(Object(l.I)(t)){var O=t.serialize(e);if(Object(a.a)(O))return null;if("boolean"===typeof O)return{kind:s.Kind.BOOLEAN,value:O};if("number"===typeof O){var S=String(O);return d.test(S)?{kind:s.Kind.INT,value:S}:{kind:s.Kind.FLOAT,value:S}}if("string"===typeof O)return Object(l.E)(t)?{kind:s.Kind.ENUM,value:O}:t===c.c&&d.test(O)?{kind:s.Kind.INT,value:O}:{kind:s.Kind.STRING,value:O};throw new TypeError("Cannot convert value to AST: ".concat(Object(o.a)(O)))}throw new Error('Unexpected input type: "'.concat(Object(o.a)(t),'".'))}var d=/^-?(?:0|[1-9][0-9]*)$/},function(e,t,n){"use strict";function r(e,t){for(var n,r=/\r\n|[\n\r]/g,i=1,o=t+1;(n=r.exec(e.body))&&n.index>1,u=r(e.slice(0,a)).length;if(u==n)return a;u>n?o=a:i=a+1}}function s(e,s,l,c){var f;this.atOccurrence=!1,this.doc=e,l=l?e.clipPos(l):r(0,0),this.pos={from:l,to:l},"object"==typeof c?f=c.caseFold:(f=c,c=null),"string"==typeof s?(null==f&&(f=!1),this.matches=function(i,o){return(i?function(e,i,o,a){if(!i.length)return null;var s=a?t:n,l=s(i).split(/\r|\n\r?/);e:for(var c=o.line,f=o.ch,p=e.firstLine()-1+l.length;c>=p;c--,f=-1){var d=e.getLine(c);f>-1&&(d=d.slice(0,f));var h=s(d);if(1==l.length){var m=h.lastIndexOf(l[0]);if(-1==m)continue e;return{from:r(c,u(d,h,m,s)),to:r(c,u(d,h,m+l[0].length,s))}}var v=l[l.length-1];if(h.slice(0,v.length)==v){for(var g=1,o=c-l.length+1;g=s;o--,u=-1){var l=e.getLine(o);u>-1&&(l=l.slice(0,u));var c=a(l,t);if(c)return{from:r(o,c.index),to:r(o,c.index+c[0].length),match:c}}}:o)(e,s,n)}:this.matches=function(t,n){return(t?function(e,t,n){t=i(t,"gm");for(var o,u=1,s=n.line,l=e.firstLine();s>=l;){for(var c=0;cl);c++){var f=e.getLine(s++);a=null==a?f:a+"\n"+f}u*=2,t.lastIndex=n.ch;var p=t.exec(a);if(p){var d=a.slice(0,p.index).split("\n"),h=p[0].split("\n"),m=n.line+d.length-1,v=d[d.length-1].length;return{from:r(m,v),to:r(m+h.length-1,1==h.length?v+h[0].length:h[h.length-1].length),match:p}}}})(e,s,n)})}String.prototype.normalize?(t=function(e){return e.normalize("NFD").toLowerCase()},n=function(e){return e.normalize("NFD")}):(t=function(e){return e.toLowerCase()},n=function(e){return e}),s.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(t){for(var n=this.matches(t,this.doc.clipPos(t?this.pos.from:this.pos.to));n&&0==e.cmpPos(n.from,n.to);)t?n.from.ch?n.from=r(n.from.line,n.from.ch-1):n=n.from.line==this.doc.firstLine()?null:this.matches(t,this.doc.clipPos(r(n.from.line-1))):n.to.ch0);)r.push({anchor:i.from(),head:i.to()});r.length&&this.setSelections(r,0)})}(n(10))},function(e,t,n){!function(e){function t(t,n,r){var i,o=t.getWrapperElement();return(i=o.appendChild(document.createElement("div"))).className=r?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof n?i.innerHTML=n:i.appendChild(n),e.addClass(o,"dialog-opened"),i}function n(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(r,i,o){o||(o={}),n(this,null);var a=t(this,r,o.bottom),u=!1,s=this;function l(t){if("string"==typeof t)f.value=t;else{if(u)return;u=!0,e.rmClass(a.parentNode,"dialog-opened"),a.parentNode.removeChild(a),s.focus(),o.onClose&&o.onClose(a)}}var c,f=a.getElementsByTagName("input")[0];return f?(f.focus(),o.value&&(f.value=o.value,!1!==o.selectValueOnOpen&&f.select()),o.onInput&&e.on(f,"input",function(e){o.onInput(e,f.value,l)}),o.onKeyUp&&e.on(f,"keyup",function(e){o.onKeyUp(e,f.value,l)}),e.on(f,"keydown",function(t){o&&o.onKeyDown&&o.onKeyDown(t,f.value,l)||((27==t.keyCode||!1!==o.closeOnEnter&&13==t.keyCode)&&(f.blur(),e.e_stop(t),l()),13==t.keyCode&&i(f.value,t))}),!1!==o.closeOnBlur&&e.on(f,"blur",l)):(c=a.getElementsByTagName("button")[0])&&(e.on(c,"click",function(){l(),s.focus()}),!1!==o.closeOnBlur&&e.on(c,"blur",l),c.focus()),l}),e.defineExtension("openConfirm",function(r,i,o){n(this,null);var a=t(this,r,o&&o.bottom),u=a.getElementsByTagName("button"),s=!1,l=this,c=1;function f(){s||(s=!0,e.rmClass(a.parentNode,"dialog-opened"),a.parentNode.removeChild(a),l.focus())}u[0].focus();for(var p=0;p=t.character)return n=u,i=r({},a),o=e.current(),"BREAK"});return{start:a.start,end:a.end,string:o||a.string,state:i||a.state,style:n||a.style}}function s(e,t){for(var n=e.split("\n"),r=(0,o.onlineParser)(),i=r.startState(),a="",u=new o.CharacterStream(""),s=0;s=0;i--)t(n[i])}function a(e,t){var n=e.filter(t);return 0===n.length?e:n}function u(e){return e.toLowerCase().replace(/\W/g,"")}function s(e,t){var n=function(e,t){var n=void 0,r=void 0,i=[],o=e.length,a=t.length;for(n=0;n<=o;n++)i[n]=[n];for(r=1;r<=a;r++)i[0][r]=r;for(n=1;n<=o;n++)for(r=1;r<=a;r++){var u=e[n-1]===t[r-1]?0:1;i[n][r]=Math.min(i[n-1][r]+1,i[n][r-1]+1,i[n-1][r-1]+u),n>1&&r>1&&e[n-1]===t[r-2]&&e[n-2]===t[r-1]&&(i[n][r]=Math.min(i[n][r],i[n-2][r-2]+u))}return i[o][a]}(t,e);return e.length>t.length&&(n-=e.length-t.length-1,n+=0===e.indexOf(t)?0:.5),n}},function(e,t,n){"use strict";(function(e){var r=n(39);Object.defineProperty(t,"__esModule",{value:!0}),t.LANGUAGE=void 0,t.getDefinitionQueryResultForNamedType=function(t,n,i){var o,a,u;return r.async(function(r){for(;;)switch(r.prev=r.next){case 0:if(o=n.name.value,0!==(a=i.filter(function(e){var t=e.definition;return t.name&&t.name.value===o})).length){r.next=5;break}return e.stderr.write("Definition not found for GraphQL type "+o),r.abrupt("return",{queryRange:[],definitions:[]});case 5:return u=a.map(function(e){var t=e.filePath,n=e.content,r=e.definition;return p(t||"",n,r)}),r.abrupt("return",{definitions:u,queryRange:u.map(function(e){return l(t,n)})});case 7:case"end":return r.stop()}},null,this)},t.getDefinitionQueryResultForFragmentSpread=function(t,n,i){var o,a,u;return r.async(function(r){for(;;)switch(r.prev=r.next){case 0:if(o=n.name.value,0!==(a=i.filter(function(e){var t=e.definition;return t.name.value===o})).length){r.next=5;break}return e.stderr.write("Definition not found for GraphQL fragment "+o),r.abrupt("return",{queryRange:[],definitions:[]});case 5:return u=a.map(function(e){var t=e.filePath,n=e.content,r=e.definition;return f(t||"",n,r)}),r.abrupt("return",{definitions:u,queryRange:u.map(function(e){return l(t,n)})});case 7:case"end":return r.stop()}},null,this)},t.getDefinitionQueryResultForDefinitionNode=function(e,t,n){return{definitions:[f(e,t,n)],queryRange:n.name?[l(t,n.name)]:[]}};var i,o=n(58),a=n(120),u=(i=a)&&i.__esModule?i:{default:i};var s=t.LANGUAGE="GraphQL";function l(e,t){var n=t.loc;return(0,u.default)(n,"Expected ASTNode to have a location."),(0,o.locToRange)(e,n)}function c(e,t){var n=t.loc;return(0,u.default)(n,"Expected ASTNode to have a location."),(0,o.offsetToPosition)(e,n.start)}function f(e,t,n){var r=n.name;return(0,u.default)(r,"Expected ASTNode to have a Name."),{path:e,position:c(t,n),range:l(t,n),name:r.value||"",language:s,projectRoot:e}}function p(e,t,n){var r=n.name;return(0,u.default)(r,"Expected ASTNode to have a Name."),{path:e,position:c(t,n),range:l(t,n),name:r.value||"",language:s,projectRoot:e}}}).call(this,n(80))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(243);Object.defineProperty(t,"getASTNodeAtPosition",{enumerable:!0,get:function(){return r.getASTNodeAtPosition}}),Object.defineProperty(t,"pointToOffset",{enumerable:!0,get:function(){return r.pointToOffset}});var i=n(119);Object.defineProperty(t,"Position",{enumerable:!0,get:function(){return i.Position}}),Object.defineProperty(t,"Range",{enumerable:!0,get:function(){return i.Range}}),Object.defineProperty(t,"locToRange",{enumerable:!0,get:function(){return i.locToRange}}),Object.defineProperty(t,"offsetToPosition",{enumerable:!0,get:function(){return i.offsetToPosition}});var o=n(244);Object.defineProperty(t,"validateWithCustomRules",{enumerable:!0,get:function(){return o.validateWithCustomRules}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SEVERITY=void 0,t.getDiagnostics=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments[2],r=arguments[3],i=null;try{i=(0,a.parse)(e)}catch(u){var o=d(u.locations[0],e);return[{severity:l.ERROR,message:u.message,source:"GraphQL: Syntax",range:o}]}return c(i,t,n,r)},t.validateQuery=c,t.getRange=d;var r,i=n(120),o=(r=i)&&r.__esModule?r:{default:r},a=n(14),u=n(46),s=n(58);var l=t.SEVERITY={ERROR:1,WARNING:2,INFORMATION:3,HINT:4};function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments[2],r=arguments[3];if(!t)return[];var i=f((0,s.validateWithCustomRules)(t,e,n,r),function(e){return p(e,l.ERROR,"Validation")}),o=a.findDeprecatedUsages?f((0,a.findDeprecatedUsages)(t,e),function(e){return p(e,l.WARNING,"Deprecation")}):[];return i.concat(o)}function f(e,t){return Array.prototype.concat.apply([],e.map(t))}function p(e,t,n){return e.nodes?e.nodes.map(function(r){var i="Variable"!==r.kind&&r.name?r.name:r.variable?r.variable:r;(0,o.default)(e.locations,"GraphQL validation error requires locations.");var a=e.locations[0],u=function(e){var t=e.loc;return(0,o.default)(t,"Expected ASTNode to have a location."),t}(i),l=a.column+(u.end-u.start);return{source:"GraphQL: "+n,message:e.message,severity:t,range:new s.Range(new s.Position(a.line-1,a.column-1),new s.Position(a.line-1,l))}}):[]}function d(e,t){var n=(0,u.onlineParser)(),r=n.startState(),i=t.split("\n");(0,o.default)(i.length>=e.line,"Query text must have more lines than where the error happened");for(var a=null,l=0;l=0&&(n=this.attrs[t][1]),n},r.prototype.attrJoin=function(e,t){var n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=this.attrs[n][1]+" "+t},e.exports=r},function(e,t,n){!function(e){var t=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),n=e.Pos,r={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function i(e){return e&&e.bracketRegex||/[(){}[\]]/}function o(e,t,o){var u=e.getLineHandle(t.line),s=t.ch-1,l=o&&o.afterCursor;null==l&&(l=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var c=i(o),f=!l&&s>=0&&c.test(u.text.charAt(s))&&r[u.text.charAt(s)]||c.test(u.text.charAt(s+1))&&r[u.text.charAt(++s)];if(!f)return null;var p=">"==f.charAt(1)?1:-1;if(o&&o.strict&&p>0!=(s==t.ch))return null;var d=e.getTokenTypeAt(n(t.line,s+1)),h=a(e,n(t.line,s+(p>0?1:0)),p,d||null,o);return null==h?null:{from:n(t.line,s),to:h&&h.pos,match:h&&h.ch==f.charAt(0),forward:p>0}}function a(e,t,o,a,u){for(var s=u&&u.maxScanLineLength||1e4,l=u&&u.maxScanLines||1e3,c=[],f=i(u),p=o>0?Math.min(t.line+l,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-l),d=t.line;d!=p;d+=o){var h=e.getLine(d);if(h){var m=o>0?0:h.length-1,v=o>0?h.length:-1;if(!(h.length>s))for(d==t.line&&(m=t.ch-(o<0?1:0));m!=v;m+=o){var g=h.charAt(m);if(f.test(g)&&(void 0===a||e.getTokenTypeAt(n(d,m+1))==a)){var y=r[g];if(y&&">"==y.charAt(1)==o>0)c.push(g);else{if(!c.length)return{pos:n(d,m),ch:g};c.pop()}}}}}return d-o!=(o>0?e.lastLine():e.firstLine())&&null}function u(e,r,i){for(var a=e.state.matchBrackets.maxHighlightLineLength||1e3,u=[],s=e.listSelections(),l=0;l=s&&(o=i(a.indicatorOpen))}e.setGutterMarker(n,a.gutter,o),++u})}function a(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation(function(){o(e,t.from,t.to)}),n.from=t.from,n.to=t.to)}function u(e,n,i){var o=e.state.foldGutter;if(o){var a=o.options;if(i==a.gutter){var u=r(e,n);u?u.clear():e.foldCode(t(n,0),a.rangeFinder)}}}function s(e){var t=e.state.foldGutter;if(t){var n=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){a(e)},n.foldOnChangeTimeSpan||600)}}function l(e){var t=e.state.foldGutter;if(t){var n=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var n=e.getViewport();t.from==t.to||n.from-t.to>20||t.from-n.to>20?a(e):e.operation(function(){n.fromt.to&&(o(e,t.to,n.to),t.to=n.to)})},n.updateViewportTimeSpan||400)}}function c(e,t){var n=e.state.foldGutter;if(n){var r=t.line;r>=n.from&&rt.lastLine())return null;var r=t.getTokenAt(e.Pos(n,1));if(/\S/.test(r.string)||(r=t.getTokenAt(e.Pos(n,r.end+1))),"keyword"!=r.type||"import"!=r.string)return null;for(var i=n,o=Math.min(t.lastLine(),n+10);i<=o;++i){var a=t.getLine(i),u=a.indexOf(";");if(-1!=u)return{startCh:r.end,end:e.Pos(i,u)}}}var i,o=n.line,a=r(o);if(!a||r(o-1)||(i=r(o-2))&&i.end.line==o-1)return null;for(var u=a.end;;){var s=r(u.line+1);if(null==s)break;u=s.end}return{from:t.clipPos(e.Pos(o,a.startCh+1)),to:u}}),e.registerHelper("fold","include",function(t,n){function r(n){if(nt.lastLine())return null;var r=t.getTokenAt(e.Pos(n,1));return/\S/.test(r.string)||(r=t.getTokenAt(e.Pos(n,r.end+1))),"meta"==r.type&&"#include"==r.string.slice(0,8)?r.start+8:void 0}var i=n.line,o=r(i);if(null==o||null!=r(i-1))return null;for(var a=i;;){var u=r(a+1);if(null==u)break;++a}return{from:e.Pos(i,o+1),to:t.clipPos(e.Pos(a))}})}(n(10))},function(e,t,n){!function(e){"use strict";function t(e,t){var n=Number(t);return/^[-+]/.test(t)?e.getCursor().line+n:n-1}e.commands.jumpToLine=function(e){var n=e.getCursor();!function(e,t,n,r,i){e.openDialog?e.openDialog(t,i,{value:r,selectValueOnOpen:!0}):i(prompt(n,r))}(e,function(e){return e.phrase("Jump to line:")+' '+e.phrase("(Use line:column or scroll% syntax)")+""}(e),e.phrase("Jump to line:"),n.line+1+":"+n.ch,function(r){var i;if(r)if(i=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(r))e.setCursor(t(e,i[1]),Number(i[2]));else if(i=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(r)){var o=Math.round(e.lineCount()*Number(i[1])/100);/^[-+]/.test(i[1])&&(o=n.line+o+1),e.setCursor(o-1,n.ch)}else(i=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(r))&&e.setCursor(t(e,i[1]),n.ch)})},e.keyMap.default["Alt-G"]="jumpToLine"}(n(10),n(44))},function(e,t,n){!function(e){"use strict";var t=e.commands,n=e.Pos;function r(t,r){t.extendSelectionsBy(function(i){return t.display.shift||t.doc.extend||i.empty()?function(t,r,i){if(i<0&&0==r.ch)return t.clipPos(n(r.line-1));var o=t.getLine(r.line);if(i>0&&r.ch>=o.length)return t.clipPos(n(r.line+1,0));for(var a,u="start",s=r.ch,l=i<0?0:o.length,c=0;s!=l;s+=i,c++){var f=o.charAt(i<0?s-1:s),p="_"!=f&&e.isWordChar(f)?"w":"o";if("w"==p&&f.toUpperCase()==f&&(p="W"),"start"==u)"o"!=p&&(u="in",a=p);else if("in"==u&&a!=p){if("w"==a&&"W"==p&&i<0&&s--,"W"==a&&"w"==p&&i>0){a="w";continue}break}}return n(r.line,s)}(t.doc,i.head,r):r<0?i.from():i.to()})}function i(t,r){if(t.isReadOnly())return e.Pass;t.operation(function(){for(var e=t.listSelections().length,i=[],o=-1,a=0;a=n&&e.execCommand("goLineUp")}e.scrollTo(null,t.top-e.defaultTextHeight())},t.scrollLineDown=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var n=e.lineAtHeight(t.top,"local")+1;e.getCursor().line<=n&&e.execCommand("goLineDown")}e.scrollTo(null,t.top+e.defaultTextHeight())},t.splitSelectionByLine=function(e){for(var t=e.listSelections(),r=[],i=0;io.line&&u==a.line&&0==a.ch||r.push({anchor:u==o.line?o:n(u,0),head:u==a.line?a:n(u)});e.setSelections(r,0)},t.singleSelectionTop=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},t.selectLine=function(e){for(var t=e.listSelections(),r=[],i=0;i=0;u--){var s=r[i[u]];if(!(l&&e.cmpPos(s.head,l)>0)){var c=o(t,s.head);l=c.from,t.replaceRange(n(c.word),c.from,c.to)}}})}function f(t){var n=t.getCursor("from"),r=t.getCursor("to");if(0==e.cmpPos(n,r)){var i=o(t,n);if(!i.word)return;n=i.from,r=i.to}return{from:n,to:r,query:t.getRange(n,r),word:i}}function p(e,t){var r=f(e);if(r){var i=r.query,o=e.getSearchCursor(i,t?r.to:r.from);(t?o.findNext():o.findPrevious())?e.setSelection(o.from(),o.to()):(o=e.getSearchCursor(i,t?n(e.firstLine(),0):e.clipPos(n(e.lastLine()))),(t?o.findNext():o.findPrevious())?e.setSelection(o.from(),o.to()):r.word&&e.setSelection(r.from,r.to))}}t.selectScope=function(e){s(e)||e.execCommand("selectAll")},t.selectBetweenBrackets=function(t){if(!s(t))return e.Pass},t.goToBracket=function(t){t.extendSelectionsBy(function(r){var i=t.scanForBracket(r.head,1);if(i&&0!=e.cmpPos(i.pos,r.head))return i.pos;var o=t.scanForBracket(r.head,-1);return o&&n(o.pos.line,o.pos.ch+1)||r.head})},t.swapLineUp=function(t){if(t.isReadOnly())return e.Pass;for(var r=t.listSelections(),i=[],o=t.firstLine()-1,a=[],u=0;uo?i.push(l,c):i.length&&(i[i.length-1]=c),o=c}t.operation(function(){for(var e=0;et.lastLine()?t.replaceRange("\n"+u,n(t.lastLine()),null,"+swapLine"):t.replaceRange(u+"\n",n(o,0),null,"+swapLine")}t.setSelections(a),t.scrollIntoView()})},t.swapLineDown=function(t){if(t.isReadOnly())return e.Pass;for(var r=t.listSelections(),i=[],o=t.lastLine()+1,a=r.length-1;a>=0;a--){var u=r[a],s=u.to().line+1,l=u.from().line;0!=u.to().ch||u.empty()||s--,s=0;e-=2){var r=i[e],o=i[e+1],a=t.getLine(r);r==t.lastLine()?t.replaceRange("",n(r-1),n(r),"+swapLine"):t.replaceRange("",n(r,0),n(r+1,0),"+swapLine"),t.replaceRange(a+"\n",n(o,0),null,"+swapLine")}t.scrollIntoView()})},t.toggleCommentIndented=function(e){e.toggleComment({indent:!0})},t.joinLines=function(e){for(var t=e.listSelections(),r=[],i=0;i=0;o--){var a=r[o].head,u=t.getRange({line:a.line,ch:0},a),s=e.countColumn(u,null,t.getOption("tabSize")),l=t.findPosH(a,-1,"char",!1);if(u&&!/\S/.test(u)&&s%i==0){var c=new n(a.line,e.findColumn(u,s-i,i));c.ch!=a.ch&&(l=c)}t.replaceRange("",l,a,"+delete")}})},t.delLineRight=function(e){e.operation(function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange("",t[r].anchor,n(t[r].to().line),"+delete");e.scrollIntoView()})},t.upcaseAtCursor=function(e){c(e,function(e){return e.toUpperCase()})},t.downcaseAtCursor=function(e){c(e,function(e){return e.toLowerCase()})},t.setSublimeMark=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},t.selectToSublimeMark=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},t.deleteToSublimeMark=function(t){var n=t.state.sublimeMark&&t.state.sublimeMark.find();if(n){var r=t.getCursor(),i=n;if(e.cmpPos(r,i)>0){var o=i;i=r,r=o}t.state.sublimeKilled=t.getRange(r,i),t.replaceRange("",r,i)}},t.swapWithSublimeMark=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},t.sublimeYank=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},t.showInCenter=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)},t.findUnder=function(e){p(e,!0)},t.findUnderPrevious=function(e){p(e,!1)},t.findAllUnder=function(e){var t=f(e);if(t){for(var n=e.getSearchCursor(t.query),r=[],i=-1;n.findNext();)r.push({anchor:n.from(),head:n.to()}),n.from().line<=t.from.line&&n.from().ch<=t.from.ch&&i++;e.setSelections(r,i)}};var d=e.keyMap;d.macSublime={"Cmd-Left":"goLineStartSmart","Shift-Tab":"indentLess","Shift-Ctrl-K":"deleteLine","Alt-Q":"wrapLines","Ctrl-Left":"goSubwordLeft","Ctrl-Right":"goSubwordRight","Ctrl-Alt-Up":"scrollLineUp","Ctrl-Alt-Down":"scrollLineDown","Cmd-L":"selectLine","Shift-Cmd-L":"splitSelectionByLine",Esc:"singleSelectionTop","Cmd-Enter":"insertLineAfter","Shift-Cmd-Enter":"insertLineBefore","Cmd-D":"selectNextOccurrence","Shift-Cmd-Space":"selectScope","Shift-Cmd-M":"selectBetweenBrackets","Cmd-M":"goToBracket","Cmd-Ctrl-Up":"swapLineUp","Cmd-Ctrl-Down":"swapLineDown","Cmd-/":"toggleCommentIndented","Cmd-J":"joinLines","Shift-Cmd-D":"duplicateLine",F5:"sortLines","Cmd-F5":"sortLinesInsensitive",F2:"nextBookmark","Shift-F2":"prevBookmark","Cmd-F2":"toggleBookmark","Shift-Cmd-F2":"clearBookmarks","Alt-F2":"selectBookmarks",Backspace:"smartBackspace","Cmd-K Cmd-K":"delLineRight","Cmd-K Cmd-U":"upcaseAtCursor","Cmd-K Cmd-L":"downcaseAtCursor","Cmd-K Cmd-Space":"setSublimeMark","Cmd-K Cmd-A":"selectToSublimeMark","Cmd-K Cmd-W":"deleteToSublimeMark","Cmd-K Cmd-X":"swapWithSublimeMark","Cmd-K Cmd-Y":"sublimeYank","Cmd-K Cmd-C":"showInCenter","Cmd-K Cmd-G":"clearBookmarks","Cmd-K Cmd-Backspace":"delLineLeft","Cmd-K Cmd-0":"unfoldAll","Cmd-K Cmd-J":"unfoldAll","Ctrl-Shift-Up":"addCursorToPrevLine","Ctrl-Shift-Down":"addCursorToNextLine","Cmd-F3":"findUnder","Shift-Cmd-F3":"findUnderPrevious","Alt-F3":"findAllUnder","Shift-Cmd-[":"fold","Shift-Cmd-]":"unfold","Cmd-I":"findIncremental","Shift-Cmd-I":"findIncrementalReverse","Cmd-H":"replace",F3:"findNext","Shift-F3":"findPrev",fallthrough:"macDefault"},e.normalizeKeyMap(d.macSublime),d.pcSublime={"Shift-Tab":"indentLess","Shift-Ctrl-K":"deleteLine","Alt-Q":"wrapLines","Ctrl-T":"transposeChars","Alt-Left":"goSubwordLeft","Alt-Right":"goSubwordRight","Ctrl-Up":"scrollLineUp","Ctrl-Down":"scrollLineDown","Ctrl-L":"selectLine","Shift-Ctrl-L":"splitSelectionByLine",Esc:"singleSelectionTop","Ctrl-Enter":"insertLineAfter","Shift-Ctrl-Enter":"insertLineBefore","Ctrl-D":"selectNextOccurrence","Shift-Ctrl-Space":"selectScope","Shift-Ctrl-M":"selectBetweenBrackets","Ctrl-M":"goToBracket","Shift-Ctrl-Up":"swapLineUp","Shift-Ctrl-Down":"swapLineDown","Ctrl-/":"toggleCommentIndented","Ctrl-J":"joinLines","Shift-Ctrl-D":"duplicateLine",F9:"sortLines","Ctrl-F9":"sortLinesInsensitive",F2:"nextBookmark","Shift-F2":"prevBookmark","Ctrl-F2":"toggleBookmark","Shift-Ctrl-F2":"clearBookmarks","Alt-F2":"selectBookmarks",Backspace:"smartBackspace","Ctrl-K Ctrl-K":"delLineRight","Ctrl-K Ctrl-U":"upcaseAtCursor","Ctrl-K Ctrl-L":"downcaseAtCursor","Ctrl-K Ctrl-Space":"setSublimeMark","Ctrl-K Ctrl-A":"selectToSublimeMark","Ctrl-K Ctrl-W":"deleteToSublimeMark","Ctrl-K Ctrl-X":"swapWithSublimeMark","Ctrl-K Ctrl-Y":"sublimeYank","Ctrl-K Ctrl-C":"showInCenter","Ctrl-K Ctrl-G":"clearBookmarks","Ctrl-K Ctrl-Backspace":"delLineLeft","Ctrl-K Ctrl-0":"unfoldAll","Ctrl-K Ctrl-J":"unfoldAll","Ctrl-Alt-Up":"addCursorToPrevLine","Ctrl-Alt-Down":"addCursorToNextLine","Ctrl-F3":"findUnder","Shift-Ctrl-F3":"findUnderPrevious","Alt-F3":"findAllUnder","Shift-Ctrl-[":"fold","Shift-Ctrl-]":"unfold","Ctrl-I":"findIncremental","Shift-Ctrl-I":"findIncrementalReverse","Ctrl-H":"replace",F3:"findNext","Shift-F3":"findPrev",fallthrough:"pcDefault"},e.normalizeKeyMap(d.pcSublime);var h=d.default==d.macDefault;d.sublime=h?d.macSublime:d.pcSublime}(n(10),n(43),n(75))},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"===typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"===typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s,l=[],c=!1,f=-1;function p(){c&&s&&(c=!1,s.length?l=s.concat(l):f=-1,l.length&&d())}function d(){if(!c){var e=u(p);c=!0;for(var t=l.length;t;){for(s=l,l=[];++f1)for(var n=1;n0?r:n)(e)}},function(e,t,n){var r=n(30),i=n(298),o=n(94),a=n(87)("IE_PROTO"),u=function(){},s=function(){var e,t=n(89)("iframe"),r=o.length;for(t.style.display="none",n(140).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("Hylo