s-r;if(t.topi+o){var c=Math.min(t.top,(u?s:t.bottom)-o);c!=i&&(a.scrollTop=c)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,h=Nn(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),f=t.right-t.left>h;return f&&(t.right=t.left+h),t.left<10?a.scrollLeft=0:t.lefth+p-3&&(a.scrollLeft=t.right+(f?0:10)-h),a}function _r(e,t){null!=t&&(Dr(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Or(e){Dr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Rr(e,t,n){null==t&&null==n||Dr(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Dr(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Pr(e,Xn(e,t.from),Xn(e,t.to),t.margin))}function Pr(e,t,n,r){var i=wr(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});Rr(e,i.scrollLeft,i.scrollTop)}function kr(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||li(e,{top:t}),Mr(e,t,!0),n&&li(e),ri(e,100))}function Mr(e,t,n){t=Math.max(0,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 jr(e,t,n,r){t=Math.max(0,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,pi(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Fr(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Cn(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+Ln(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Br=function(e,t,n){this.cm=n;var r=this.vert=w("div",[w("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=w("div",[w("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),pe(r,"scroll",(function(){r.clientHeight&&t(r.scrollTop,"vertical")})),pe(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Br.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}},Br.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Br.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Br.prototype.zeroWidthHack=function(){var e=y&&!f?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new B,this.disableVert=new B},Br.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto",t.set(1e3,(function r(){var i=e.getBoundingClientRect();("vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,r)}))},Br.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Gr=function(){};function Ur(e,t){t||(t=Fr(e));var n=e.display.barWidth,r=e.display.barHeight;Hr(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Lr(e),Hr(e,Fr(e)),n=e.display.barWidth,r=e.display.barHeight}function Hr(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=""}Gr.prototype.update=function(){return{bottom:0,right:0}},Gr.prototype.setScrollLeft=function(){},Gr.prototype.setScrollTop=function(){},Gr.prototype.clear=function(){};var qr={native:Br,null:Gr};function Vr(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&L(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new qr[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),pe(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?jr(e,t):kr(e,t)}),e),e.display.scrollbars.addClass&&D(e.display.wrapper,e.display.scrollbars.addClass)}var Wr=0;function zr(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:++Wr},t=e.curOp,an?an.ops.push(t):t.ownsGroup=an={ops:[t],delayedCallbacks:[]}}function Yr(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 oi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function $r(e){e.updatedDisplay=e.mustUpdate&&ai(e.cm,e.update)}function Jr(e){var t=e.cm,n=t.display;e.updatedDisplay&&Lr(t),e.barMeasure=Fr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=_n(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+Ln(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Nn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Qr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!d){var o=w("div","",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Tn(e.display))+"px;\n height: "+(t.bottom-t.top+Ln(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,function(e,t,n,r){var i;null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==(t=t.ch?et(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?et(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var a=!1,s=Yn(e,t),l=n&&n!=t?Yn(e,n):s,u=wr(e,i={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-r,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+r}),c=e.doc.scrollTop,p=e.doc.scrollLeft;if(null!=u.scrollTop&&(kr(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),null!=u.scrollLeft&&(jr(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-p)>1&&(a=!0)),!a)break}return i}(t,st(r,e.scrollToPos.from),st(r,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var a=0;a=e.display.viewTo)){var n=+new Date+e.options.workTime,r=ft(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,s=o.text.length>e.options.maxHighlightLength?He(t.mode,r.state):null,l=pt(e,o,r,!0);s&&(r.state=s),o.styles=l.styles;var u=o.styleClasses,c=l.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var p=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),h=0;!p&&hn)return ri(e,e.options.workDelay),!0})),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Zr(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==gr(e))return!1;hi(e)&&(fr(e),t.dims=or(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)),St&&(o=Bt(e.doc,o),a=Gt(e.doc,a));var s=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,cr(e,n)))),r.viewTo=n}(e,o,a),n.viewOffset=qt(ze(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var u=gr(e);if(!s&&0==u&&!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=R();if(!t||!O(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&O(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 u>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 s(t){var n=t.nextSibling;return l&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var u=r.view,c=r.viewFrom,p=0;p-1&&(f=!1),cn(e,h,c,n)),f&&(N(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(Ze(e.options,c)))),a=h.node.nextSibling}else{var d=mn(e,h,c,n);o.insertBefore(d,a)}c+=h.size}for(;a;)a=s(a)}(e,n.updateLineNumbers,t.dims),u>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(e){if(e&&e.activeElt&&e.activeElt!=R()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&O(document.body,e.anchorNode)&&O(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),N(n.cursorDiv),N(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ri(e,400)),n.updateLineNumbers=null,!0}function si(e,t){for(var n=t.viewport,r=!0;;r=!1){if(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Nn(e))r&&(t.visible=Ir(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Cn(e.display)-In(e),n.top)}),t.visible=Ir(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!ai(e,t))break;Lr(e);var i=Fr(e);vr(e),Ur(e,i),ci(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 li(e,t){var n=new oi(e,t);if(ai(e,n)){Lr(e),si(e,n);var r=Fr(e);vr(e),Ur(e,r),ci(e,r),n.finish()}}function ui(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ci(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+Ln(e)+"px"}function pi(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=ar(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;as.clientWidth,c=s.scrollHeight>s.clientHeight;if(i&&u||o&&c){if(o&&y&&l)e:for(var h=t.target,f=a.view;h!=s;h=h.parentNode)for(var d=0;d=0&&tt(e,r.to())<=0)return n}return-1};var Ti=function(e,t){this.anchor=e,this.head=t};function Ci(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort((function(e,t){return tt(e.from(),t.from())})),n=G(t,i);for(var o=1;o0:l>=0){var u=ot(s.from(),a.from()),c=it(s.to(),a.to()),p=s.empty()?a.from()==a.head:s.from()==s.head;o<=n&&--n,t.splice(--o,2,new Ti(p?c:u,p?u:c))}}return new Si(t,n)}function Ai(e,t){return new Si([new Ti(e,t||e)],0)}function Li(e){return e.text?et(e.from.line+e.text.length-1,X(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Ni(e,t){if(tt(e,t.from)<0)return e;if(tt(e,t.to)<=0)return Li(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+=Li(t).ch-t.to.ch),et(n,r)}function Ii(e,t){for(var n=[],r=0;r1&&e.remove(s.line+1,d-1),e.insert(s.line+1,m)}ln(e,"change",e,t)}function Pi(e,t,n){!function e(r,i,o){if(r.linked)for(var a=0;as-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Bi(e.done),X(e.done)):e.done.length&&!X(e.done).ranges?X(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),X(e.done)):void 0}(i,i.lastOp==r)))a=X(o.changes),0==tt(t.from,t.to)&&0==tt(t.from,a.to)?a.to=Li(t):o.changes.push(Fi(e,t));else{var l=X(i.done);for(l&&l.ranges||Hi(e.sel,i.done),o={changes:[Fi(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=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||de(e,"historyAdded")}function Ui(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,X(i.done),t))?i.done[i.done.length-1]=t:Hi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&Bi(i.undone)}function Hi(e,t){var n=X(t);n&&n.ranges&&n.equals(e)||t.push(e)}function qi(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&&(X(s)[p]=u[p],delete u[p])}}}return r}function Yi(e,t,n,r){if(r){var i=e.anchor;if(n){var o=tt(t,i)<0;o!=tt(n,i)<0?(i=t,t=n):o!=tt(t,n)<0&&(t=n)}return new Ti(i,t)}return new Ti(n||t,t)}function Xi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Zi(e,new Si([Yi(e.sel.primary(),t,n,i)],0),r)}function $i(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:s.to>t.ch))){if(i&&(de(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(n){var p=l.find(r<0?1:-1),h=void 0;if((r<0?c:u)&&(p=ao(e,p,-r,p&&p.line==t.line?o:null)),p&&p.line==t.line&&(h=tt(p,n))&&(r<0?h<0:h>0))return io(e,p,t,r,i)}var f=l.find(r<0?-1:1);return(r<0?u:c)&&(f=ao(e,f,r,f.line==t.line?o:null)),f?io(e,f,t,r,i):null}}return t}function oo(e,t,n,r,i){var o=r||1,a=io(e,t,n,o,i)||!i&&io(e,t,n,o,!0)||io(e,t,n,-o,i)||!i&&io(e,t,n,-o,!0);return a||(e.cantEdit=!0,et(e.first,0))}function ao(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?st(e,et(t.line-1)):null:n>0&&t.ch==(r||ze(e,t.line)).text.length?t.line0)){var c=[l,1],p=tt(u.from,s.from),h=tt(u.to,s.to);(p<0||!a.inclusiveLeft&&!p)&&c.push({from:u.from,to:s.from}),(h>0||!a.inclusiveRight&&!h)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),l+=c.length-3}}return i}(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)co(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else co(e,t)}}function co(e,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var n=Ii(e,t);Gi(e,t,n,e.cm?e.cm.curOp.id:NaN),fo(e,t,n,Lt(e,t));var r=[];Pi(e,(function(e,n){n||-1!=G(r,e.history)||(yo(e.history,t),r.push(e.history)),fo(e,t,null,Lt(e,t))}))}}function po(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!r||n){for(var i,o=e.history,a=e.sel,s="undo"==t?o.done:o.undone,l="undo"==t?o.undone:o.done,u=0;u=0;--f){var d=h(f);if(d)return d.v}}}}function ho(e,t){if(0!=t&&(e.first+=t,e.sel=new Si($(e.sel.ranges,(function(e){return new Ti(et(e.anchor.line+t,e.anchor.ch),et(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){pr(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:et(o,ze(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ye(e,t.from,t.to),n||(n=Ii(e,t)),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,s=!1,l=o.line;e.options.lineWrapping||(l=Je(Ft(ze(r,o.line))),r.iter(l,a.line+1,(function(e){if(e==i.maxLine)return s=!0,!0}))),r.sel.contains(t.from,t.to)>-1&&ve(e),Di(r,t,n,sr(e)),e.options.lineWrapping||(r.iter(l,o.line+t.text.length,(function(e){var t=Vt(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)})),s&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=ze(e,r).stateAfter;if(i&&(!(i instanceof ut)||r+i.lookAhead1||!(this.children[0]instanceof bo))){var s=[];this.collapse(s),this.children=[new bo(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=i.lines.length%25+25,s=a;s10);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=_("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(jt(e,t.line,t,n,o)||t.line!=n.line&&jt(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");St=!0}o.addToHistory&&Gi(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var s,l=t.line,u=e.cm;if(e.iter(l,n.line+1,(function(e){u&&o.collapsed&&!u.options.lineWrapping&&Ft(e)==u.display.maxLine&&(s=!0),o.collapsed&&l!=t.line&&$e(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new Tt(o,l==t.line?t.ch:null,l==n.line?n.ch:null)),++l})),o.collapsed&&e.iter(t.line,n.line+1,(function(t){Ut(e,t)&&$e(t,0)})),o.clearOnEnter&&pe(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(xt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++Co,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)pr(u,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++)hr(u,c,"text");o.atomic&&no(u.doc),ln(u,"markerAdded",u,o)}return o}Ao.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&zr(e),me(this,"clear")){var n=this.find();n&&ln(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&pr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&no(e.doc)),e&&ln(e,"markerCleared",e,this,r,i),t&&Yr(e),this.parent&&this.parent.clear()}},Ao.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i=0;l--)uo(this,r[l]);s?Ki(this,s):this.cm&&Or(this.cm)})),undo:ni((function(){po(this,"undo")})),redo:ni((function(){po(this,"redo")})),undoSelection:ni((function(){po(this,"undo",!0)})),redoSelection:ni((function(){po(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=st(this,e),t=st(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 s=0;s=l.to||null==l.from&&i!=e.line||null!=l.from&&i==t.line&&l.from>=t.ch||n&&!n(l.marker)||r.push(l.marker.parent||l.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})),st(this,et(n,t))},indexFromPos:function(e){var t=(e=st(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 p=e.dataTransfer.getData("Text");if(p){var h;if(t.state.draggingText&&!t.state.draggingText.copy&&(h=t.listSelections()),eo(t.doc,Ai(n,n)),h)for(var f=0;f=0;t--)go(e.doc,"",r[t].from,r[t].to,"+delete");Or(e)}))}function Ko(e,t,n){var r=ie(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Zo(e,t,n){var r=Ko(e,t.ch,n);return null==r?null:new et(t.line,r,n<0?"after":"before")}function ea(e,t,n,r,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=ue(n,t.doc.direction);if(o){var a,s=i<0?X(o):o[0],l=i<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var u=Rn(t,n);a=i<0?n.text.length-1:0;var c=Dn(t,u,a).top;a=oe((function(e){return Dn(t,u,e).top==c}),i<0==(1==s.level)?s.from:s.to-1,a),"before"==l&&(a=Ko(n,a,1))}else a=i<0?s.to:s.from;return new et(r,a,l)}}return new et(r,i<0?n.text.length:0,i<0?"before":"after")}qo.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"},qo.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"},qo.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"},qo.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"]},qo.default=y?qo.macDefault:qo.pcDefault;var ta={selectAll:so,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),H)},killLine:function(e){return Qo(e,(function(t){if(t.empty()){var n=ze(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new et(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),et(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=ze(e.doc,i.line-1).text;a&&(i=new et(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),et(i.line-1,a.length-1),i,"+transpose"))}n.push(new Ti(i,i))}e.setSelections(n)}))},newlineAndIndent:function(e){return Zr(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&&(tt((i=u.ranges[i]).from(),t)<0||t.xRel>0)&&(tt(i.to(),t)>0||t.xRel<0)?function(e,t,n,r){var i=e.display,o=!1,u=ei(e,(function(t){l&&(i.scroller.draggable=!1),e.state.draggingText=!1,fe(i.wrapper.ownerDocument,"mouseup",u),fe(i.wrapper.ownerDocument,"mousemove",c),fe(i.scroller,"dragstart",p),fe(i.scroller,"drop",u),o||(Ee(t),r.addNew||Xi(e.doc,n,null,null,r.extend),l&&!h||a&&9==s?setTimeout((function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),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},p=function(){return o=!0};l&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),pe(i.wrapper.ownerDocument,"mouseup",u),pe(i.wrapper.ownerDocument,"mousemove",c),pe(i.scroller,"dragstart",p),pe(i.scroller,"drop",u),Tr(e),setTimeout((function(){return i.input.focus()}),20)}(e,r,t,o):function(e,t,n,r){var i=e.display,o=e.doc;Ee(t);var a,s,l=o.sel,u=l.ranges;if(r.addNew&&!r.extend?(s=o.sel.contains(n),a=s>-1?u[s]:new Ti(n,n)):(a=o.sel.primary(),s=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(a=new Ti(n,n)),n=ur(e,t,!0,!0),s=-1;else{var c=ma(e,n,r.unit);a=r.extend?Yi(a,c.anchor,c.head,r.extend):c}r.addNew?-1==s?(s=u.length,Zi(o,Ci(e,u.concat([a]),s),{scroll:!1,origin:"*mouse"})):u.length>1&&u[s].empty()&&"char"==r.unit&&!r.extend?(Zi(o,Ci(e,u.slice(0,s).concat(u.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),l=o.sel):Ji(o,s,a,q):(s=0,Zi(o,new Si([a],0),q),l=o.sel);var p=n;function h(t){if(0!=tt(p,t))if(p=t,"rectangle"==r.unit){for(var i=[],u=e.options.tabSize,c=F(ze(o,n.line).text,n.ch,u),h=F(ze(o,t.line).text,t.ch,u),f=Math.min(c,h),d=Math.max(c,h),g=Math.min(n.line,t.line),v=Math.min(e.lastLine(),Math.max(n.line,t.line));g<=v;g++){var m=ze(o,g).text,y=W(m,f,u);f==d?i.push(new Ti(et(g,y),et(g,y))):m.length>y&&i.push(new Ti(et(g,y),et(g,W(m,d,u))))}i.length||i.push(new Ti(n,n)),Zi(o,Ci(e,l.ranges.slice(0,s).concat(i),s),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var E,b=a,x=ma(e,t,r.unit),S=b.anchor;tt(x.anchor,S)>0?(E=x.head,S=ot(b.from(),x.anchor)):(E=x.anchor,S=it(b.to(),x.head));var T=l.ranges.slice(0);T[s]=function(e,t){var n=t.anchor,r=t.head,i=ze(e.doc,n.line);if(0==tt(n,r)&&n.sticky==r.sticky)return t;var o=ue(i);if(!o)return t;var a=se(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return t;var l,u=a+(s.from==n.ch==(1!=s.level)?0:1);if(0==u||u==o.length)return t;if(r.line!=n.line)l=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=se(o,r.ch,r.sticky),p=c-a||(r.ch-n.ch)*(1==s.level?-1:1);l=c==u-1||c==u?p<0:p>0}var h=o[u+(l?-1:0)],f=l==(1==h.level),d=f?h.from:h.to,g=f?"after":"before";return n.ch==d&&n.sticky==g?t:new Ti(new et(n.line,d,g),r)}(e,new Ti(st(o,S),E)),Zi(o,Ci(e,T,s),q)}}var f=i.wrapper.getBoundingClientRect(),d=0;function g(t){e.state.selectingText=!1,d=1/0,t&&(Ee(t),i.input.focus()),fe(i.wrapper.ownerDocument,"mousemove",v),fe(i.wrapper.ownerDocument,"mouseup",m),o.history.lastSelOrigin=null}var v=ei(e,(function(t){0!==t.buttons&&Ce(t)?function t(n){var a=++d,s=ur(e,n,!0,"rectangle"==r.unit);if(s)if(0!=tt(s,p)){e.curOp.focus=R(),h(s);var l=Ir(i,o);(s.line>=l.to||s.linef.bottom?20:0;u&&setTimeout(ei(e,(function(){d==a&&(i.scroller.scrollTop+=u,t(n))})),50)}}(t):g(t)})),m=ei(e,g);e.state.selectingText=m,pe(i.wrapper.ownerDocument,"mousemove",v),pe(i.wrapper.ownerDocument,"mouseup",m)}(e,r,t,o)}(t,r,o,e):Te(e)==n.scroller&&Ee(e):2==i?(r&&Xi(t.doc,r),setTimeout((function(){return n.input.focus()}),20)):3==i&&(T?t.display.input.onContextMenu(e):Tr(t)))}}function ma(e,t,n){if("char"==n)return new Ti(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new Ti(et(t.line,0),st(e.doc,et(t.line+1,0)));var r=n(e,t);return new Ti(r.from,r.to)}function ya(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(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Ee(t);var a=e.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!me(e,n))return xe(t);o-=s.top-a.viewOffset;for(var l=0;l=i)return de(e,n,e,Qe(e.doc,o),e.display.gutterSpecs[l].className,t),xe(t)}}function Ea(e,t){return ya(e,t,"gutterClick",!0)}function ba(e,t){Sn(e.display,t)||function(e,t){return!!me(e,"gutterContextMenu")&&ya(e,t,"gutterContextMenu",!1)}(e,t)||ge(e,t,"contextmenu")||T||e.display.input.onContextMenu(t)}function xa(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Gn(e)}ga.prototype.compare=function(e,t,n){return this.time+400>e&&0==tt(t,this.pos)&&n==this.button};var Sa={toString:function(){return"CodeMirror.Init"}},Ta={},Ca={};function Aa(e,t,n){if(!t!=!(n&&n!=Sa)){var r=e.display.dragFunctions,i=t?pe:fe;i(e.display.scroller,"dragstart",r.start),i(e.display.scroller,"dragenter",r.enter),i(e.display.scroller,"dragover",r.over),i(e.display.scroller,"dragleave",r.leave),i(e.display.scroller,"drop",r.drop)}}function La(e){e.options.lineWrapping?(D(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(L(e.display.wrapper,"CodeMirror-wrap"),Wt(e)),lr(e),pr(e),Gn(e),setTimeout((function(){return Ur(e)}),100)}function Na(e,t){var n=this;if(!(this instanceof Na))return new Na(e,t);this.options=t=t?j(t):{},j(Ta,t,!1);var r=t.value;"string"==typeof r?r=new Oo(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Na.inputStyles[t.inputStyle](this),o=this.display=new vi(e,r,i,t);for(var u in o.wrapper.CodeMirror=this,xa(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 B,keySeq:null,specialChars:null},t.autofocus&&!m&&o.input.focus(),a&&s<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),function(e){var t=e.display;pe(t.scroller,"mousedown",ei(e,va)),pe(t.scroller,"dblclick",a&&s<11?ei(e,(function(t){if(!ge(e,t)){var n=ur(e,t);if(n&&!Ea(e,t)&&!Sn(e.display,t)){Ee(t);var r=e.findWordAt(n);Xi(e.doc,r.anchor,r.head)}}})):function(t){return ge(e,t)||Ee(t)}),pe(t.scroller,"contextmenu",(function(t){return ba(e,t)})),pe(t.input.getField(),"contextmenu",(function(n){t.scroller.contains(n.target)||ba(e,n)}));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}pe(t.scroller,"touchstart",(function(i){if(!ge(e,i)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(i)&&!Ea(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)}})),pe(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),pe(t.scroller,"touchend",(function(n){var r=t.activeTouch;if(r&&!Sn(t,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var a,s=e.coordsChar(t.activeTouch,"page");a=!r.prev||o(r,r.prev)?new Ti(s,s):!r.prev.prev||o(r,r.prev.prev)?e.findWordAt(s):new Ti(et(s.line,0),st(e.doc,et(s.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),Ee(n)}i()})),pe(t.scroller,"touchcancel",i),pe(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(kr(e,t.scroller.scrollTop),jr(e,t.scroller.scrollLeft,!0),de(e,"scroll",e))})),pe(t.scroller,"mousewheel",(function(t){return xi(e,t)})),pe(t.scroller,"DOMMouseScroll",(function(t){return xi(e,t)})),pe(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){ge(e,t)||Se(t)},over:function(t){ge(e,t)||(function(e,t){var n=ur(e,t);if(n){var r=document.createDocumentFragment();yr(e,n,r),e.display.dragCursor||(e.display.dragCursor=w("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),I(e.display.dragCursor,r)}}(e,t),Se(t))},start:function(t){return function(e,t){if(a&&(!e.state.draggingText||+new Date-Ro<100))Se(t);else if(!ge(e,t)&&!Sn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!h)){var n=w("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),p&&n.parentNode.removeChild(n)}}(e,t)},drop:ei(e,Do),leave:function(t){ge(e,t)||Po(e)}};var l=t.input.getField();pe(l,"keyup",(function(t){return pa.call(e,t)})),pe(l,"keydown",ei(e,ca)),pe(l,"keypress",ei(e,ha)),pe(l,"focus",(function(t){return Cr(e,t)})),pe(l,"blur",(function(t){return Ar(e,t)}))}(this),jo(),zr(this),this.curOp.forceUpdate=!0,ki(this,r),t.autofocus&&!m||this.hasFocus()?setTimeout(M(Cr,this),20):Ar(this),Ca)Ca.hasOwnProperty(u)&&Ca[u](this,t[u],Sa);hi(this),t.finishInit&&t.finishInit(this);for(var c=0;c150)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?F(ze(o,t-1).text,null,a):0:"add"==n?u=l+e.options.indentUnit:"subtract"==n?u=l-e.options.indentUnit:"number"==typeof n&&(u=l+n),u=Math.max(0,u);var p="",h=0;if(e.options.indentWithTabs)for(var f=Math.floor(u/a);f;--f)h+=a,p+="\t";if(ha,l=Oe(t),u=null;if(s&&r.ranges.length>1)if(_a&&_a.text.join("\n")==t){if(r.ranges.length%_a.text.length==0){u=[];for(var c=0;c<_a.text.length;c++)u.push(o.splitLines(_a.text[c]))}}else l.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(u=$(l,(function(e){return[e]})));for(var p=e.curOp.updateInput,h=r.ranges.length-1;h>=0;h--){var f=r.ranges[h],d=f.from(),g=f.to();f.empty()&&(n&&n>0?d=et(d.line,d.ch-n):e.state.overwrite&&!s?g=et(g.line,Math.min(ze(o,g.line).text.length,g.ch+X(l).length)):s&&_a&&_a.lineWise&&_a.text.join("\n")==t&&(d=g=et(d.line,0)));var v={from:d,to:g,text:u?u[h%u.length]:l,origin:i||(s?"paste":e.state.cutIncoming>a?"cut":"+input")};uo(e.doc,v),ln(e,"inputRead",e,v)}t&&!s&&Pa(e,t),Or(e),e.curOp.updateInput<2&&(e.curOp.updateInput=p),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Da(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Zr(t,(function(){return Ra(t,n,0,null,"paste")})),!0}function Pa(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 s=0;s-1){a=wa(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(ze(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=wa(e,i.head.line,"smart"));a&&ln(e,"electricInput",e,i.head.line)}}}function ka(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=se(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&&h>=c.begin)){var f=p?"before":"after";return new et(n.line,h,f)}}var d=function(e,t,r){for(var o=function(e,t){return t?new et(n.line,l(e,1),"before"):new et(n.line,e,"after")};e>=0&&e0==(1!=a.level),u=s?r.begin:l(r.end,-1);if(a.from<=u&&u0?c.end:l(c.begin,-1);return null==v||r>0&&v==t.text.length||!(g=d(r>0?0:i.length-1,r,u(v)))?null:g}(e.cm,s,t,n):Zo(s,t,n))){if(r||(a=t.line+l)=e.first+e.size||(t=new et(a,t.ch,t.sticky),!(s=ze(e,a))))return!1;t=ea(i,e.cm,s,t.line,l)}else t=o;return!0}if("char"==r)u();else if("column"==r)u(!0);else if("word"==r||"group"==r)for(var c=null,p="group"==r,h=e.cm&&e.cm.getHelper(t,"wordChars"),f=!0;!(n<0)||u(!f);f=!1){var d=s.text.charAt(t.ch)||"\n",g=ee(d,h)?"w":p&&"\n"==d?"n":!p||/\s/.test(d)?null:"p";if(!p||f||g||(g="s"),c&&c!=g){n<0&&(n=1,u(),t.sticky="after");break}if(g&&(c=g),n>0&&!u(!f))break}var v=oo(e,t,o,a,!0);return nt(o,v)&&(v.hitSide=!0),v}function Ba(e,t,n,r){var i,o,a=e.doc,s=t.left;if("page"==r){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(l-.5*rr(e.display),3);i=(n>0?t.bottom:t.top)+n*u}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;(o=Jn(e,s,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*n}return o}var Ga=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new B,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Ua(e,t){var n=On(e,t.line);if(!n||n.hidden)return null;var r=ze(e.doc,t.line),i=wn(n,r,t.line),o=ue(r,e.doc.direction),a="left";o&&(a=se(o,t.ch)%2?"right":"left");var s=Mn(i.map,t.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function Ha(e,t){return t&&(e.bad=!0),e}function qa(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return Ha(e.clipPos(et(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&&Ua(t,i)||{node:l[0].measure.map[2],offset:0},c=o.liner.firstLine()&&(a=et(a.line-1,ze(r.doc,a.line-1).length)),s.ch==ze(r.doc,s.line).text.length&&s.linei.viewTo-1)return!1;a.line==i.viewFrom||0==(e=cr(r,a.line))?(t=Je(i.view[0].line),n=i.view[0].node):(t=Je(i.view[e].line),n=i.view[e-1].node.nextSibling);var l,u,c=cr(r,s.line);if(c==i.view.length-1?(l=i.viewTo-1,u=i.lineDiv.lastChild):(l=Je(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!n)return!1;for(var p=r.doc.splitLines(function(e,t,n,r,i){var o="",a=!1,s=e.doc.lineSeparator(),l=!1;function u(){a&&(o+=s,l&&(o+=s),a=l=!1)}function c(e){e&&(u(),o+=e)}function p(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void c(n);var o,h=t.getAttribute("cm-marker");if(h){var f=e.findMarks(et(r,0),et(i+1,0),(v=+h,function(e){return e.id==v}));return void(f.length&&(o=f[0].find(0))&&c(Ye(e.doc,o.from,o.to).join(s)))}if("false"==t.getAttribute("contenteditable"))return;var d=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;d&&u();for(var g=0;g1&&h.length>1;)if(X(p)==X(h))p.pop(),h.pop(),l--;else{if(p[0]!=h[0])break;p.shift(),h.shift(),t++}for(var f=0,d=0,g=p[0],v=h[0],m=Math.min(g.length,v.length);fa.ch&&y.charCodeAt(y.length-d-1)==E.charCodeAt(E.length-d-1);)f--,d++;p[p.length-1]=y.slice(0,y.length-d).replace(/^\u200b+/,""),p[0]=p[0].slice(f).replace(/\u200b+$/,"");var x=et(t,f),S=et(l,h.length?X(h).length-d:0);return p.length>1||p[0]||tt(x,S)?(go(r.doc,p,x,S,"+input"),!0):void 0},Ga.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ga.prototype.reset=function(){this.forceCompositionEnd()},Ga.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Ga.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))},Ga.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Zr(this.cm,(function(){return pr(e.cm)}))},Ga.prototype.setUneditable=function(e){e.contentEditable="false"},Ga.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ei(this.cm,Ra)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Ga.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Ga.prototype.onContextMenu=function(){},Ga.prototype.resetPosition=function(){},Ga.prototype.needsContentAttribute=!0;var Wa=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new B,this.hasSelection=!1,this.composing=null};Wa.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!ge(r,e)){if(r.somethingSelected())Oa({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var t=ka(r);Oa({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,H):(n.prevInput="",i.value=t.text.join("\n"),k(i))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(i.style.width="0px"),pe(i,"input",(function(){a&&s>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),pe(i,"paste",(function(e){ge(r,e)||Da(e,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())})),pe(i,"cut",o),pe(i,"copy",o),pe(e.scroller,"paste",(function(t){if(!Sn(e,t)&&!ge(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)}})),pe(e.lineSpace,"selectstart",(function(t){Sn(e,t)||Ee(t)})),pe(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"})}})),pe(i,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},Wa.prototype.createField=function(e){this.wrapper=ja(),this.textarea=this.wrapper.firstChild},Wa.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Wa.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=mr(e);if(e.options.moveInputWithCursor){var i=Yn(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},Wa.prototype.showSelection=function(e){var t=this.cm.display;I(t.cursorDiv,e.cursors),I(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Wa.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&&k(this.textarea),a&&s>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",a&&s>=9&&(this.hasSelection=null))}},Wa.prototype.getField=function(){return this.textarea},Wa.prototype.supportsTouch=function(){return!1},Wa.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!m||R()!=this.textarea))try{this.textarea.focus()}catch(e){}},Wa.prototype.blur=function(){this.textarea.blur()},Wa.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Wa.prototype.receivedFocus=function(){this.slowPoll()},Wa.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},Wa.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function n(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}))},Wa.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Re(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&&s>=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=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,u=Math.min(r.length,i.length);l1e3||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},Wa.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Wa.prototype.onKeyPress=function(){a&&s>=9&&(this.hasSelection=null),this.fastPoll()},Wa.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),u=r.scroller.scrollTop;if(o&&!p){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&ei(n,Zi)(n.doc,Ai(o),H);var c,h=i.style.cssText,f=t.wrapper.style.cssText,d=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-d.top-5)+"px; left: "+(e.clientX-d.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);",l&&(c=window.scrollY),r.input.focus(),l&&window.scrollTo(null,c),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=m,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),a&&s>=9&&v(),T){Se(e);var g=function(){fe(window,"mouseup",g),setTimeout(m,20)};pe(window,"mouseup",g)}else setTimeout(m,50)}function v(){if(null!=i.selectionStart){var e=n.somethingSelected(),o=""+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function m(){if(t.contextMenuPending==m&&(t.contextMenuPending=!1,t.wrapper.style.cssText=f,i.style.cssText=h,a&&s<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=u),null!=i.selectionStart)){(!a||a&&s<9)&&v();var e=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&""==t.prevInput?ei(n,so)(n):e++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(o,200)}}},Wa.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Wa.prototype.setUneditable=function(){},Wa.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!=Sa&&i(e,t,n)}:i)}e.defineOption=n,e.Init=Sa,n("value","",(function(e,t){return e.setValue(t)}),!0),n("mode",null,(function(e,t){e.doc.modeOption=t,_i(e)}),!0),n("indentUnit",2,_i,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(e){Oi(e),Gn(e),pr(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(et(r,o))}r++}));for(var i=n.length-1;i>=0;i--)go(e.doc,t,n[i],et(n[i].line,n[i].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=Sa&&e.refresh()})),n("specialCharPlaceholder",Kt,(function(e){return e.refresh()}),!0),n("electricChars",!0),n("inputStyle",m?"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",!b),n("wholeLineUpdateBefore",!0),n("theme","default",(function(e){xa(e),gi(e)}),!0),n("keyMap","default",(function(e,t,n){var r=Jo(t),i=n!=Sa&&Jo(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,La,!0),n("gutters",[],(function(e,t){e.display.gutterSpecs=fi(t,e.options.lineNumbers),gi(e)}),!0),n("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?ar(e.display)+"px":"0",e.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(e){return Ur(e)}),!0),n("scrollbarStyle","native",(function(e){Vr(e),Ur(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=fi(e.options.gutters,t),gi(e)}),!0),n("firstLineNumber",1,gi,!0),n("lineNumberFormatter",(function(e){return e}),gi,!0),n("showCursorWhenSelecting",!1,vr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(e,t){"nocursor"==t&&(Ar(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),n("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),n("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),n("dragDrop",!0,Aa),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,vr,!0),n("singleCursorHeightPerLine",!0,vr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Oi,!0),n("addModeClass",!1,Oi,!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,Oi,!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)}(Na),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)&&ei(this,t[e])(this,n,i),de(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"](Jo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(wa(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Or(this));else{var o=i.from(),a=i.to(),s=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;l0&&Ji(this.doc,r,new Ti(o,u[r].to()),H)}}})),getTokenAt:function(e,t){return yt(this,e,t)},getLineTokens:function(e,t){return yt(this,et(e),t,!0)},getTokenTypeAt:function(e){e=st(this.doc,e);var t,n=ht(this,ze(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=ze(this.doc,e)}else r=e;return Vn(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-qt(r):0)},defaultTextHeight:function(){return rr(this.display)},defaultCharWidth:function(){return ir(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o,a,s,l=this.display,u=(e=Yn(this,st(this.doc,e))).bottom,c=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),l.sizer.appendChild(t),"over"==r)u=e.top;else if("above"==r||"near"==r){var p=Math.max(l.wrapper.clientHeight,this.doc.height),h=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>p)&&e.top>t.offsetHeight?u=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=p&&(u=e.bottom),c+t.offsetWidth>h&&(c=h-t.offsetWidth)}t.style.top=u+"px",t.style.left=t.style.right="","right"==i?(c=l.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?c=0:"middle"==i&&(c=(l.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),n&&(o=this,a={left:c,top:u,right:c+t.offsetWidth,bottom:u+t.offsetHeight},null!=(s=wr(o,a)).scrollTop&&kr(o,s.scrollTop),null!=s.scrollLeft&&jr(o,s.scrollLeft))},triggerOnKeyDown:ti(ca),triggerOnKeyPress:ti(ha),triggerOnKeyUp:pa,triggerOnMouseDown:ti(va),execCommand:function(e){if(ta.hasOwnProperty(e))return ta[e].call(null,this)},triggerElectric:ti((function(e){Pa(this,e)})),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=st(this.doc,e),a=0;a0&&a(t.charAt(n-1));)--n;for(;r.5||this.options.lineWrapping)&&lr(this),de(this,"refresh",this)})),swapDoc:ti((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),ki(this,e),Gn(this),this.display.input.reset(),Rr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,ln(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}},ye(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})}}(Na);var za="iter insert remove copy getEditor constructor".split(" ");for(var Ya in Oo.prototype)Oo.prototype.hasOwnProperty(Ya)&&G(za,Ya)<0&&(Na.prototype[Ya]=function(e){return function(){return e.apply(this.doc,arguments)}}(Oo.prototype[Ya]));return ye(Oo),Na.inputStyles={textarea:Wa,contenteditable:Ga},Na.defineMode=function(e){Na.defaults.mode||"null"==e||(Na.defaults.mode=e),je.apply(this,arguments)},Na.defineMIME=function(e,t){Me[e]=t},Na.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),Na.defineMIME("text/plain","null"),Na.defineExtension=function(e,t){Na.prototype[e]=t},Na.defineDocExtension=function(e,t){Oo.prototype[e]=t},Na.fromTextArea=function(e,t){if((t=t?j(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=R();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function r(){e.value=s.getValue()}var i;if(e.form&&(pe(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(e){}}t.finishInit=function(n){n.save=r,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,r(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(fe(e.form,"submit",r),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var s=Na((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return s},function(e){e.off=fe,e.on=pe,e.wheelEventPixels=bi,e.Doc=Oo,e.splitLines=Oe,e.countColumn=F,e.findColumn=W,e.isWordChar=Z,e.Pass=U,e.signal=de,e.Line=zt,e.changeEnd=Li,e.scrollbarModel=qr,e.Pos=et,e.cmpPos=tt,e.modes=ke,e.mimeModes=Me,e.resolveMode=Fe,e.getMode=Be,e.modeExtensions=Ge,e.extendMode=Ue,e.copyState=He,e.startState=Ve,e.innerMode=qe,e.commands=ta,e.keyMap=qo,e.keyName=$o,e.isModifierKey=Yo,e.lookupKey=zo,e.normalizeKeyMap=Wo,e.StringStream=We,e.SharedTextMarker=No,e.TextMarker=Ao,e.LineWidget=So,e.e_preventDefault=Ee,e.e_stopPropagation=be,e.e_stop=Se,e.addClass=D,e.contains=O,e.rmClass=L,e.keyNames=Bo}(Na),Na.version="5.55.0",Na}()},function(e,t,n){"use strict";var r=n(3).a.Symbol;t.a=r},function(e,t,n){"use strict";var r,i=n(44),o=n(3).a["__core-js_shared__"],a=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";var s=function(e){return!!a&&a in e},l=n(2),u=n(22),c=/^\[object .+?Constructor\]$/,p=Function.prototype,h=Object.prototype,f=p.toString,d=h.hasOwnProperty,g=RegExp("^"+f.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var v=function(e){return!(!Object(l.a)(e)||s(e))&&(Object(i.a)(e)?g:c).test(Object(u.a)(e))};var m=function(e,t){return null==e?void 0:e[t]};t.a=function(e,t){var n=m(e,t);return v(n)?n:void 0}},function(e,t,n){"use strict";var r=n(44),i=n(43);t.a=function(e){return null!=e&&Object(i.a)(e.length)&&!Object(r.a)(e)}},function(e,t,n){"use strict";var r=n(8),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=r.a?r.a.toStringTag:void 0;var l=function(e){var t=o.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var i=a.call(e);return r&&(t?e[s]=n:delete e[s]),i},u=Object.prototype.toString;var c=function(e){return u.call(e)},p=r.a?r.a.toStringTag:void 0;t.a=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":p&&p in Object(e)?l(e):c(e)}},function(e,t,n){"use strict";t.a=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){"use strict";var r=n(68),i=n(80),o=n(10);t.a=function(e){return Object(o.a)(e)?Object(r.a)(e):Object(i.a)(e)}},function(e,t,n){"use strict";(function(e){var r=n(3),i=n(93),o="object"==typeof exports&&exports&&!exports.nodeType&&exports,a=o&&"object"==typeof e&&e&&!e.nodeType&&e,s=a&&a.exports===o?r.a.Buffer:void 0,l=(s?s.isBuffer:void 0)||i.a;t.a=l}).call(this,n(83)(e))},function(e,t,n){"use strict";var r=n(11),i=n(6);var o=function(e){return Object(i.a)(e)&&"[object Arguments]"==Object(r.a)(e)},a=Object.prototype,s=a.hasOwnProperty,l=a.propertyIsEnumerable,u=o(function(){return arguments}())?o:function(e){return Object(i.a)(e)&&s.call(e,"callee")&&!l.call(e,"callee")};t.a=u},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,n){"use strict";var r=n(11),i=n(6);t.a=function(e){return"symbol"==typeof e||Object(i.a)(e)&&"[object Symbol]"==Object(r.a)(e)}},function(e,t,n){"use strict";var r=n(26);var i=function(){this.__data__=new r.a,this.size=0};var o=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var a=function(e){return this.__data__.get(e)};var s=function(e){return this.__data__.has(e)},l=n(28),u=n(34);var c=function(e,t){var n=this.__data__;if(n instanceof r.a){var i=n.__data__;if(!l.a||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new u.a(i)}return n.set(e,t),this.size=n.size,this};function p(e){var t=this.__data__=new r.a(e);this.size=t.size}p.prototype.clear=i,p.prototype.delete=o,p.prototype.get=a,p.prototype.has=s,p.prototype.set=c;t.a=p},function(e,t,n){e.exports=n(105)},function(e,t,n){"use strict";var r=n(9),i=n(3),o=Object(r.a)(i.a,"DataView"),a=n(28),s=Object(r.a)(i.a,"Promise"),l=Object(r.a)(i.a,"Set"),u=Object(r.a)(i.a,"WeakMap"),c=n(11),p=n(22),h=Object(p.a)(o),f=Object(p.a)(a.a),d=Object(p.a)(s),g=Object(p.a)(l),v=Object(p.a)(u),m=c.a;(o&&"[object DataView]"!=m(new o(new ArrayBuffer(1)))||a.a&&"[object Map]"!=m(new a.a)||s&&"[object Promise]"!=m(s.resolve())||l&&"[object Set]"!=m(new l)||u&&"[object WeakMap]"!=m(new u))&&(m=function(e){var t=Object(c.a)(e),n="[object Object]"==t?e.constructor:void 0,r=n?Object(p.a)(n):"";if(r)switch(r){case h:return"[object DataView]";case f:return"[object Map]";case d:return"[object Promise]";case g:return"[object Set]";case v:return"[object WeakMap]"}return t});t.a=m},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){"use strict";var r=Function.prototype.toString;t.a=function(e){if(null!=e){try{return r.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t,n){"use strict";var r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i="http://www.w3.org/2001/XMLSchema#",o="http://www.w3.org/2000/10/swap/";t.a={xsd:{decimal:i+"decimal",boolean:i+"boolean",double:i+"double",integer:i+"integer",string:i+"string"},rdf:{type:r+"type",nil:r+"nil",first:r+"first",rest:r+"rest",langString:r+"langString"},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:o+"reify#forSome",forAll:o+"reify#forAll"},log:{implies:o+"log#implies"}}},function(e,t,n){"use strict";var r=n(17);t.a=function(e){if("string"==typeof e||Object(r.a)(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},function(e,t,n){"use strict";t.a=function(e){return e}},function(e,t,n){"use strict";var r=function(){this.__data__=[],this.size=0},i=n(12);var o=function(e,t){for(var n=e.length;n--;)if(Object(i.a)(e[n][0],t))return n;return-1},a=Array.prototype.splice;var s=function(e){var t=this.__data__,n=o(t,e);return!(n<0)&&(n==t.length-1?t.pop():a.call(t,n,1),--this.size,!0)};var l=function(e){var t=this.__data__,n=o(t,e);return n<0?void 0:t[n][1]};var u=function(e){return o(this.__data__,e)>-1};var c=function(e,t){var n=this.__data__,r=o(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function p(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e0||e instanceof Object)?t(e):null)},y.prototype.toError=function(){var e=this.req,t=e.method,n=e.url,r="cannot ".concat(t," ").concat(n," (").concat(this.status,")"),i=new Error(r);return i.status=this.status,i.method=t,i.url=n,i},h.Response=y,o(E.prototype),s(E.prototype),E.prototype.type=function(e){return this.set("Content-Type",h.types[e]||e),this},E.prototype.accept=function(e){return this.set("Accept",h.types[e]||e),this},E.prototype.auth=function(e,t,n){1===arguments.length&&(t=""),"object"===r(t)&&null!==t&&(n=t,t=""),n||(n={type:"function"==typeof btoa?"basic":"auto"});var i=function(e){if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,n,i)},E.prototype.query=function(e){return"string"!=typeof e&&(e=d(e)),e&&this._query.push(e),this},E.prototype.attach=function(e,t,n){if(t){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,n||t.name)}return this},E.prototype._getFormData=function(){return this._formData||(this._formData=new i.FormData),this._formData},E.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();var n=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),n(e,t)},E.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},E.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},E.prototype.ca=E.prototype.agent,E.prototype.buffer=E.prototype.ca,E.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},E.prototype.pipe=E.prototype.write,E.prototype._isHost=function(e){return e&&"object"===r(e)&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},E.prototype.end=function(e){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||p,this._finalizeQueryString(),this._end()},E.prototype._setUploadTimeout=function(){var e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((function(){e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},E.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var e=this;this.xhr=h.getXHR();var t=this.xhr,n=this._formData||this._data;this._setTimeouts(),t.onreadystatechange=function(){var n=t.readyState;if(n>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4===n){var r;try{r=t.status}catch(e){r=0}if(!r){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var r=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100,100===n.percent&&clearTimeout(e._uploadTimeoutTimer)),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{t.addEventListener("progress",r.bind(null,"download")),t.upload&&t.upload.addEventListener("progress",r.bind(null,"upload"))}catch(e){}t.upload&&this._setUploadTimeout();try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof n&&!this._isHost(n)){var i=this._header["content-type"],o=this._serializer||h.serialize[i?i.split(";")[0]:""];!o&&m(i)&&(o=h.serialize["application/json"]),o&&(n=o(n))}for(var a in this.header)null!==this.header[a]&&Object.prototype.hasOwnProperty.call(this.header,a)&&t.setRequestHeader(a,this.header[a]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===n?null:n)},h.agent=function(){return new c},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(e){c.prototype[e.toLowerCase()]=function(t,n){var r=new h.Request(e,t);return this._setDefaults(r),n&&r.end(n),r}})),c.prototype.del=c.prototype.delete,h.get=function(e,t,n){var r=h("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},h.head=function(e,t,n){var r=h("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},h.options=function(e,t,n){var r=h("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},h.del=b,h.delete=b,h.patch=function(e,t,n){var r=h("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},h.post=function(e,t,n){var r=h("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},h.put=function(e,t,n){var r=h("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}},function(e,t,n){(function(t){var n=Object.assign?Object.assign:function(e,t,n,r){for(var i=1;i-1&&e%1==0&&e<=9007199254740991}},function(e,t,n){"use strict";var r=n(11),i=n(2);t.a=function(e){if(!Object(i.a)(e))return!1;var t=Object(r.a)(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,n){"use strict";t.a=function(e){return function(t){return e(t)}}},function(e,t,n){"use strict";var r=n(1),i=n(17),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.a=function(e,t){if(Object(r.a)(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Object(i.a)(e))||(a.test(e)||!o.test(e)||null!=t&&e in Object(t))}},function(e,t,n){"use strict";var r=n(3).a.Uint8Array;t.a=r},function(e,t,n){"use strict";var r=n(9),i=function(){try{var e=Object(r.a)(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();t.a=i},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(e,t)||a(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e){return(i="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 o(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n-1?n.split(e.arrayFormatSeparator).map((function(t){return f(t,e)})):null===n?n:f(n,e);r[t]=i};default:return function(e,t,n){void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),o=Object.create(null);if("string"!=typeof e)return o;if(!(e=e.trim().replace(/^[?#&]/,"")))return o;var s,l=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=a(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,l=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw o}}}}(e.split("&"));try{for(l.s();!(s=l.n()).done;){var u=s.value,h=r(c(t.decode?u.replace(/\+/g," "):u,"="),2),d=h[0],g=h[1];g=void 0===g?null:["comma","separator"].includes(t.arrayFormat)?g:f(g,t),n(f(d,t),g,o)}}catch(e){l.e(e)}finally{l.f()}for(var m=0,y=Object.keys(o);m0})).join("&")},t.parseUrl=function(e,t){t=Object.assign({decode:!0},t);var n=r(c(e,"#"),2),i=n[0],o=n[1];return Object.assign({url:i.split("?")[0]||"",query:m(g(e),t)},t&&t.parseFragmentIdentifier&&o?{fragmentIdentifier:f(o,t)}:{})},t.stringifyUrl=function(e,n){n=Object.assign({encode:!0,strict:!0},n);var r=d(e.url).split("?")[0]||"",i=t.extract(e.url),o=t.parse(i,{sort:!1}),a=Object.assign(o,e.query),s=t.stringify(a,n);s&&(s="?".concat(s));var l=function(e){var t="",n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(e.url);return e.fragmentIdentifier&&(l="#".concat(h(e.fragmentIdentifier,n))),"".concat(r).concat(s).concat(l)}},function(e,t,n){"use strict";var r=n(65),i=Object(r.a)(Object.getPrototypeOf,Object);t.a=i},function(e,t,n){"use strict";var r=n(18),i=n(59);var o=function(e,t,n,o){var a=n.length,s=a,l=!o;if(null==e)return!s;for(e=Object(e);a--;){var u=n[a];if(l&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++a0&&a.length>i&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function d(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=i[e];if(void 0===l)return!1;if("function"==typeof l)o(l,this,t);else{var u=l.length,c=v(l,u);for(n=0;n=0;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},s.prototype.listenerCount=g,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";var r=n(53),i=n(24);t.a=function(e,t){for(var n=0,o=(t=Object(r.a)(t,e)).length;null!=e&&ns))return!1;var h=o.get(e);if(h&&o.get(t))return h==t;var f=-1,d=!0,g=2&n?new l:void 0;for(o.set(e,t),o.set(t,e);++f0?"INF":"-INF"))));return""===n||n===W.string?new Q('"'+e+'"'):new Q('"'+e+'"^^'+n)},defaultGraph:function(){return q},quad:te,triple:te},X=Y,$=function(){function e(t){G(this,e),this.id=t}return H(e,[{key:"equals",value:function(t){return t instanceof e?this.id===t.id:!!t&&this.termType===t.termType&&this.value===t.value}},{key:"toJSON",value:function(){return{termType:this.termType,value:this.value}}},{key:"value",get:function(){return this.id}}]),e}(),J=function(e){P(n,e);var t=M(n);function n(){return G(this,n),t.apply(this,arguments)}return H(n,[{key:"termType",get:function(){return"NamedNode"}}]),n}($),Q=function(e){P(n,e);var t=M(n);function n(){return G(this,n),t.apply(this,arguments)}return H(n,[{key:"equals",value:function(e){return e instanceof n?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}},{key:"toJSON",value:function(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}},{key:"termType",get:function(){return"Literal"}},{key:"value",get:function(){return this.id.substring(1,this.id.lastIndexOf('"'))}},{key:"language",get:function(){var e=this.id,t=e.lastIndexOf('"')+1;return t=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}else this._base="",this._basePath=""}},{key:"_saveContext",value:function(e,t,n,r,i){var o=this._n3Mode;this._contextStack.push({subject:n,predicate:r,object:i,graph:t,type:e,inverse:!!o&&this._inversePredicate,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?this._graph.id.substr(2)+".":".",this._quantified=Object.create(this._quantified))}},{key:"_restoreContext",value:function(){var e=this._contextStack.pop(),t=this._n3Mode;this._subject=e.subject,this._predicate=e.predicate,this._object=e.object,this._graph=e.graph,t&&(this._inversePredicate=e.inverse,this._prefixes._=e.blankPrefix,this._quantified=e.quantified)}},{key:"_readInTopContext",value:function(e){switch(e.type){case"eof":return null!==this._graph?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}},{key:"_readEntity",value:function(e,t){var n;switch(e.type){case"IRI":case"typeIRI":var r=this._resolveIRI(e.value);if(null===r)return this._error("Invalid IRI",e);n=this._namedNode(r);break;case"type":case"prefixed":var i=this._prefixes[e.prefix];if(void 0===i)return this._error('Undefined prefix "'+e.prefix+':"',e);n=this._namedNode(i+e.value);break;case"blank":n=this._blankNode(this._prefixes[e.prefix]+e.value);break;case"var":n=this._variable(e.value.substr(1));break;default:return this._error("Expected entity but got "+e.type,e)}return!t&&this._n3Mode&&n.id in this._quantified&&(n=this._quantified[n.id]),n}},{key:"_readSubject",value:function(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=this._blankNode,this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=this._variable,this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(0===e.prefix.length)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._literal(e.value,this._namedNode(e.prefix));break;default:if(void 0===(this._subject=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}},{key:"_readPredicate",value:function(e){var t=e.type;switch(t){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return null===this._predicate?this._error("Unexpected "+t,e):(this._subject=null,"]"===t?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",e);case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if(void 0===(this._predicate=this._readEntity(e)))return}return this._readObject}},{key:"_readObject",value:function(e){switch(e.type){case"literal":if(0===e.prefix.length)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._literal(e.value,this._namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if(void 0===(this._object=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}},{key:"_readPredicateOrNamedGraph",value:function(e){return"{"===e.type?this._readGraph(e):this._readPredicate(e)}},{key:"_readGraph",value:function(e){return"{"!==e.type?this._error("Expected graph but got "+e.type,e):(this._graph=this._subject,this._subject=null,this._readSubject)}},{key:"_readBlankNodeHead",value:function(e){return"]"===e.type?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}},{key:"_readBlankNodeTail",value:function(e){if("]"!==e.type)return this._readBlankNodePunctuation(e);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);var t=null===this._predicate;return this._restoreContext(),null===this._object?t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank:this._getContextEndReader()}},{key:"_readPredicateAfterBlank",value:function(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}},{key:"_readListItem",value:function(e){var t=null,n=null,r=this._subject,i=this._contextStack,o=i[i.length-1],a=this._readListItem;switch(e.type){case"[":this._saveContext("blank",this._graph,n=this._blankNode(),this.RDF_FIRST,this._subject=t=this._blankNode()),a=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,n=this._blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext(),0!==i.length&&"list"===i[i.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(a=this._readPredicate,this._subject===this.RDF_NIL)return a}else if(a=this._getContextEndReader(),this._object===this.RDF_NIL)return a;n=this.RDF_NIL;break;case"literal":0===e.prefix.length?(this._literalValue=e.value,a=this._readListItemDataTypeOrLang):(t=this._literal(e.value,this._namedNode(e.prefix)),a=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if(void 0===(t=this._readEntity(e)))return}if(null===n&&(this._subject=n=this._blankNode()),null===r?null===o.predicate?o.subject=n:o.object=n:this._emit(r,this.RDF_REST,n,this._graph),null!==t){if(this._n3Mode&&("IRI"===e.type||"prefixed"===e.type))return this._saveContext("item",this._graph,n,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(n,this.RDF_FIRST,t,this._graph)}return a}},{key:"_readDataTypeOrLang",value:function(e){return this._completeObjectLiteral(e,!1)}},{key:"_readListItemDataTypeOrLang",value:function(e){return this._completeObjectLiteral(e,!0)}},{key:"_completeLiteral",value:function(e){var t=this._literal(this._literalValue);switch(e.type){case"type":case"typeIRI":var n=this._readEntity(e);if(void 0===n)return;t=this._literal(this._literalValue,n),e=null;break;case"langcode":t=this._literal(this._literalValue,e.value),e=null}return{token:e,literal:t}}},{key:"_completeSubjectLiteral",value:function(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}},{key:"_completeObjectLiteral",value:function(e,t){var n=this._completeLiteral(e);if(n)return this._object=n.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===n.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(n.token))}},{key:"_readFormulaTail",value:function(e){return"}"!==e.type?this._readPunctuation(e):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext(),null===this._object?this._readPredicate:this._getContextEndReader())}},{key:"_readPunctuation",value:function(e){var t,n=this._subject,r=this._graph,i=this._inversePredicate;switch(e.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(r=this._readEntity(e))){t=this._readQuadPunctuation;break}return this._error('Expected punctuation to follow "'+this._object.id+'"',e)}if(null!==n){var o=this._predicate,a=this._object;i?this._emit(a,o,n,r):this._emit(n,o,a,r)}return t}},{key:"_readBlankNodePunctuation",value:function(e){var t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error('Expected punctuation to follow "'+this._object.id+'"',e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}},{key:"_readQuadPunctuation",value:function(e){return"."!==e.type?this._error("Expected dot to follow quad",e):this._readInTopContext}},{key:"_readPrefix",value:function(e){return"prefix"!==e.type?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}},{key:"_readPrefixIRI",value:function(e){if("IRI"!==e.type)return this._error('Expected IRI to follow prefix "'+this._prefix+':"',e);var t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}},{key:"_readBaseIRI",value:function(e){var t="IRI"===e.type&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}},{key:"_readNamedGraphLabel",value:function(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}},{key:"_readNamedGraphBlankLabel",value:function(e){return"]"!==e.type?this._error("Invalid graph label",e):(this._subject=this._blankNode(),this._readGraph)}},{key:"_readDeclarationPunctuation",value:function(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):"."!==e.type?this._error("Expected declaration to end with a dot",e):this._readInTopContext}},{key:"_readQuantifierList",value:function(e){var t;switch(e.type){case"IRI":case"prefixed":if(void 0!==(t=this._readEntity(e,!0)))break;default:return this._error("Unexpected "+e.type,e)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._quantifier(this._blankNode().value),this._readQuantifierPunctuation}},{key:"_readQuantifierPunctuation",value:function(e){return","===e.type?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}},{key:"_getPathReader",value:function(e){return this._afterPath=e,this._readPath}},{key:"_readPath",value:function(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:var t=this._contextStack,n=t.length&&t[t.length-1];if(n&&"item"===n.type){var r=this._subject;this._restoreContext(),this._emit(this._subject,this.RDF_FIRST,r,this._graph)}return this._afterPath(e)}}},{key:"_readForwardPath",value:function(e){var t,n,r=this._blankNode();if(void 0!==(n=this._readEntity(e)))return null===this._predicate?(t=this._subject,this._subject=r):(t=this._object,this._object=r),this._emit(t,n,r,this._graph),this._readPath}},{key:"_readBackwardPath",value:function(e){var t,n,r=this._blankNode();if(void 0!==(t=this._readEntity(e)))return null===this._predicate?(n=this._subject,this._subject=r):(n=this._object,this._object=r),this._emit(r,t,n,this._graph),this._readPath}},{key:"_getContextEndReader",value:function(){var e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail}}},{key:"_emit",value:function(e,t,n,r){this._callback(null,this._quad(e,t,n,r||this.DEFAULTGRAPH))}},{key:"_error",value:function(e,t){var n=new Error(e+" on line "+t.line+".");n.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=oe}},{key:"_resolveIRI",value:function(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}},{key:"_resolveRelativeIRI",value:function(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return("/"===e[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}},{key:"_removeDotSegments",value:function(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;for(var t="",n=e.length,r=-1,i=-1,o=0,a="/";r=i&&(t=t.substr(0,o)),"/"!==a)return t+"/"+e.substr(r+1);o=r+1}}}a=e[++r]}return t+e.substring(o)}},{key:"parse",value:function(e,t,n){var r=this;if(this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):"b"+re+++"_",this._prefixCallback=n||oe,this._inversePredicate=!1,this._quantified=Object.create(null),!t){var i,o=[];if(this._callback=function(e,t){e?i=e:t&&o.push(t)},this._lexer.tokenize(e).every((function(e){return r._readCallback=r._readCallback(e)})),i)throw i;return o}this._callback=t,this._lexer.tokenize(e,(function(e,t){null!==e?(r._callback(e),r._callback=oe):r._readCallback&&(r._readCallback=r._readCallback(t))}))}}])&&ne(t.prototype,n),r&&ne(t,r),e}();function oe(){}function ae(e,t){var n=t.namedNode;e._namedNode=n,e._blankNode=t.blankNode,e._literal=t.literal,e._variable=t.variable,e._quad=t.quad,e.DEFAULTGRAPH=t.defaultGraph(),e.RDF_FIRST=n(R.a.rdf.first),e.RDF_REST=n(R.a.rdf.rest),e.RDF_NIL=n(R.a.rdf.nil),e.N3_FORALL=n(R.a.r.forAll),e.N3_FORSOME=n(R.a.r.forSome),e.ABBREVIATIONS={a:n(R.a.rdf.type),"=":n(R.a.owl.sameAs),">":n(R.a.log.implies)},e.QUANTIFIERS_GRAPH=n("urn:n3:quantifiers")}function se(e){if("NamedNode"===e.termType)return{value:e.value,type:"uri"};if("Literal"===e.termType){var t={value:e.value,type:"literal"},n=e.language;n&&(t["xml:lang"]=n);var r=e.datatypeString;return r&&(t.datatype=r),t}return"BlankNode"===e.termType?{value:e.value,type:"bnode"}:{value:e.value,type:"uri"}}ae(ie.prototype,X);function le(e){return(new ie).parse(e||"")}var ue=n(64),ce=Object(ue.a)({"&":"&","<":"<",">":">",""":'"',"'":"'"}),pe=/&(?:amp|lt|gt|quot|#39);/g,he=RegExp(pe.source);var fe=function(e){return(e=Object(E.a)(e))&&he.test(e)?e.replace(pe,ce):e},de=n(80),ge=n(20),ve=n(15),me=n(10),ye=n(14),Ee=n(30),be=n(33),xe=Object.prototype.hasOwnProperty;var Se=function(e){if(null==e)return!0;if(Object(me.a)(e)&&(Object(L.a)(e)||"string"==typeof e||"function"==typeof e.splice||Object(ye.a)(e)||Object(be.a)(e)||Object(ve.a)(e)))return!e.length;var t=Object(ge.a)(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(Object(Ee.a)(e))return!Object(de.a)(e).length;for(var n in e)if(xe.call(e,n))return!1;return!0};function Te(e){for(var t={vars:[]},n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=400)||(!!this.errorSummary||(!!this.error||!(!this.summary||!this.summary.error)))}},{key:"getError",value:function(){return this.errorSummary||(this.res&&this.res.status>=400&&(this.errorSummary={text:this.res.text,status:this.res.status,statusText:this.res.error?this.res.error.text:void 0}),this.summary&&this.summary.error&&(this.errorSummary=this.summary.error),this.error&&("response"in this.error&&void 0!==this.error.response?(this.errorSummary={text:this.error.response.text,status:this.error.response.status,statusText:this.error.response.statusText},this.error.response.body&&"object"===i()(this.error.response.body)&&"message"in this.error.response.body&&(this.errorSummary.text=this.error.response.body.message)):this.errorSummary={text:this.error.message})),this.errorSummary}},{key:"getContentType",value:function(){return this.res?this.res.header["content-type"]:this.summary?this.summary.contentType:void 0}},{key:"getAsJson",value:function(){return this.json?this.json:!1===this.json||this.hasError()?void 0:(this.getParserFromContentType()||this.doLuckyGuess()||this.json||(this.json=!1),this.json)}},{key:"getData",value:function(){if(this.res){if(this.res.body)return this.res.body;if(this.res.text)return this.res.text}if(this.summary)return this.summary.data}},{key:"getResponseTime",value:function(){return this.executionTime}},{key:"getParserFromContentType",value:function(){var e=this.getContentType();if(e){var t=Object(Me.a)(this.getData());try{if(e.indexOf("json")>-1){if(e.indexOf("sparql-results+json")>=0)return this.json=_(t,je),this.type="json",!0;if(e.indexOf("application/rdf+json")>-1)return this.type="json",!0;this.type="json"}else{if(e.indexOf("xml")>-1)return this.json=Ne(t,je),this.type="xml",!0;if(e.indexOf("csv")>-1)return this.json=function(e){var t=Ie.parse(e,{header:!0,skipEmptyLines:!0});if(void 0===t.meta.fields)throw new Error("Could not parse CSV, no headers found!");return{head:{vars:t.meta.fields},results:{bindings:t.data.map((function(e){var t={};for(var n in e)t[n]={value:e[n],type:"literal"};return t}))}}}(t),this.type="csv",!0;if(e.indexOf("tab-separated")>-1)return this.json=function(e){var t=e.split("\n");t.pop();var n=Re()(t),r=n[0],i=n.slice(1),o=r.split("\t").map((function(e){return e.substring(1)})),a=i.map((function(e){var t,n={},r=De(e.split("\t").entries());try{for(r.s();!(t=r.n()).done;){var i=_e()(t.value,2),a=i[0],s=i[1],l=o[a];if("<"===s[0])n[l]={value:s.substring(1,s.length-1),type:"uri"};else if('"'===s[0]){var u=s.lastIndexOf('"'),c=s.substring(1,u);if(u===s.length-1)n[l]={value:c,type:"literal"};else if(u0||e.indexOf("trig")>0||e.indexOf("triple")>0||e.indexOf("quad")>0)return this.json={head:{vars:["subject","predicate","object"]},results:{bindings:le(t).map((function(e){return{subject:se(e.subject),predicate:se(e.predicate),object:se(e.object)}}))}},this.type="ttl",!0}}catch(e){e instanceof Error?this.errorSummary={text:e.message}:this.errorSummary={text:e}}}return!1}},{key:"doLuckyGuess",value:function(){var e=Object(Me.a)(this.getData());try{return this.json=_(e,je),this.type="json",!0}catch(e){}try{return this.json=Ne(e,je),this.type="xml",!0}catch(e){}return!1}},{key:"getVariables",value:function(){var e=this.getAsJson();return e&&e.head?e.head.vars:[]}},{key:"getBoolean",value:function(){var e=this.getAsJson();if(e&&"boolean"in e)return e.boolean}},{key:"getBindings",value:function(){var e=this.getAsJson();return e&&e.results?e.results.bindings:null}},{key:"getStatements",value:function(){return this.statements||"ttl"!==this.type||(this.statements=le(this.getData())),this.statements?this.statements:null}},{key:"getOriginalResponseAsString",value:function(){var e=this.getData();return"string"==typeof e?e:"json"===this.type?JSON.stringify(e,void 0,2):e}},{key:"getOriginalResponse",value:function(){var e;return null===(e=this.res)||void 0===e?void 0:e.body}},{key:"getType",value:function(){return this.type||this.getAsJson(),this.type}},{key:"getStatus",value:function(){return this.res?this.res.status:this.summary?this.summary.status:void 0}},{key:"getAsStoreObject",value:function(e){var t=this.summary;if(!t&&this.res&&(t={contentType:this.getContentType(),data:this.getOriginalResponseAsString(),error:this.getError(),status:this.getStatus(),executionTime:this.getResponseTime()}),t){if(t.data&&t.data.length>e)return;return t}if(this.error)return{error:this.getError(),executionTime:this.getResponseTime()}}},{key:"asCsv",value:function(){var e,t,n,r,i=this.getAsJson();return"csv"===this.type?this.getOriginalResponseAsString():i&&i.results?(n=(e=i).head.vars,r=null===(t=e.results)||void 0===t?void 0:t.bindings,new ke.Parser({fields:n}).parse(r?r.map((function(e){return Object(I.a)(e,(function(e){return e.value}))})):[])):void 0}}]),e}();function Be(e){var t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("type","text/css"),t.setAttribute("href",e),document.getElementsByTagName("head")[0].appendChild(t)}function Ge(e,t){return new Promise((function(n,r){var i=document.createElement("script");i.setAttribute("type","text/javascript"),i.setAttribute("async",""),i.setAttribute("src",e),t&&(i.innerHTML=t),i.onload=function(){return n()},document.getElementsByTagName("head")[0].appendChild(i)}))}var Ue=n(98);Ue.addHook("afterSanitizeAttributes",(function(e){e instanceof HTMLAnchorElement&&(e.target="_blank",e.rel="noopener noreferrer")}));var He=Ue.sanitize,qe=n(128),Ve=n(129),We=n(36),ze=n.n(We),Ye=n(95),Xe=n.n(Ye),$e=n(171),Je=n(130);n(140),n(141),n(142);var Qe=n(143);function Ke(e){Object(w.b)(this,"expanded"),e.preventDefault()}var Ze=function(){function e(t){var n=this;l()(this,e),this.persistentConfig={},this.helpReference="https://triply.cc/docs/yasgui#table",this.label="Table",this.priority=10,this.setEllipsisHandlers=function(){var e;null===(e=n.dataTable)||void 0===e||e.cells({page:"current"}).every((function(e,t){var r,i,o=null===(r=n.dataTable)||void 0===r?void 0:r.cell(e,t);if(""!==(null==o?void 0:o.data())){var a=null==o?void 0:o.node();if(a){var s=a.firstChild;((null===(i=s.firstElementChild)||void 0===i?void 0:i.getBoundingClientRect().width)||0)>s.getBoundingClientRect().width?s.classList.contains("expandable")||(Object(w.b)(s,"expandable"),s.addEventListener("click",Ke,{once:!0})):s.classList.contains("expandable")&&(Object(w.g)(s,"expandable"),s.removeEventListener("click",Ke))}}}))},this.handleTableSearch=function(e){var t;null===(t=n.dataTable)||void 0===t||t.search(e.target.value).draw("page")},this.handleTableSizeSelect=function(e){var t,r=parseInt(e.target.value);null===(t=n.dataTable)||void 0===t||t.page.len(r).draw("page"),n.persistentConfig.pageSize=r,n.yasr.storePluginConfig("table",n.persistentConfig)},this.handleSetCompactToggle=function(e){n.persistentConfig.compact=e.target.checked,n.draw(n.persistentConfig),n.yasr.storePluginConfig("table",n.persistentConfig)},this.handleSetEllipsisToggle=function(e){n.persistentConfig.isEllipsed=e.target.checked,n.draw(n.persistentConfig),n.yasr.storePluginConfig("table",n.persistentConfig)},this.yasr=t,this.config=e.defaults}return c()(e,[{key:"getIcon",value:function(){return Object(w.d)(Object(w.c)(Je))}},{key:"getRows",value:function(){if(!this.yasr.results)return[];var e=this.yasr.results.getBindings();if(!e)return[];var t=this.yasr.results.getVariables();return e.map((function(e,n){return[n+1].concat(ze()(t.map((function(t){var n;return null!==(n=e[t])&&void 0!==n?n:""}))))}))}},{key:"getUriLinkFromBinding",value:function(e,t){var n=e.value,r=n,i=!1;if(t)for(var o in t)if(0==r.indexOf(t[o])){r=o+":"+n.substring(t[o].length),i=!0;break}var a=i||this.persistentConfig.compact;return"".concat(a?"":"<","").concat(r,"").concat(a?"":">")}},{key:"getCellContent",value:function(e,t){var n;return n="uri"==e.type?"".concat(this.getUriLinkFromBinding(e,t),""):"".concat(this.formatLiteral(e,t),""),"".concat(n,"
")}},{key:"formatLiteral",value:function(e,t){var n=Object($e.a)(e.value);if(this.persistentConfig.compact)return n;if(e["xml:lang"])n='"'.concat(n,'"@').concat(e["xml:lang"],"");else if(e.datatype){var r=this.getUriLinkFromBinding({type:"uri",value:e.datatype},t);n='"'.concat(n,'"^^').concat(r,"")}return n}},{key:"getColumns",value:function(){var e,t=this;if(!this.yasr.results)return[];var n=this.yasr.getPrefixes();return[{name:"",searchable:!1,width:"".concat(this.getSizeFirstColumn(),"px"),type:"num",orderable:!1,visible:!0!==this.persistentConfig.compact,render:function(e,t){return"filter"!==t&&"sort"!==t&&t?''.concat(e,"
"):e}}].concat(ze()(null===(e=this.yasr.results)||void 0===e?void 0:e.getVariables().map((function(e){return{name:e,title:e,render:function(e,r,i,o){return""===e?e:"filter"!==r&&"sort"!==r&&r?t.getCellContent(e,n):e.value}}}))))}},{key:"getSizeFirstColumn",value:function(){var e,t;return 8*((null===(t=null===(e=this.yasr.results)||void 0===e?void 0:e.getBindings())||void 0===t?void 0:t.length)||0).toString().length}},{key:"draw",value:function(e){var t,n,r=this;this.persistentConfig=Object.assign(Object.assign({},this.persistentConfig),e),this.tableEl=document.createElement("table");var i=this.getRows(),o=this.getColumns();i.length<=((null==e?void 0:e.pageSize)||50)?(this.yasr.pluginControls,Object(w.b)(this.yasr.rootEl,"isSinglePage")):Object(w.g)(this.yasr.rootEl,"isSinglePage"),this.dataTable&&(this.destroyResizer(),this.dataTable.destroy(!0),this.dataTable=void 0),this.yasr.resultsEl.appendChild(this.tableEl);var a=Object.assign(Object.assign({},Object(Me.a)(this.config.tableConfig)),{pageLength:(null==e?void 0:e.pageSize)?e.pageSize:50,data:i,columns:o});this.dataTable=Xe()(this.tableEl).DataTable(a),this.tableEl.style.removeProperty("width"),this.tableEl.style.width=this.tableEl.clientWidth+"px";var s=Array.from(this.tableEl.querySelectorAll("th")).map((function(e){return e.offsetWidth-26}));this.tableResizer=new Qe.default(this.tableEl,{widths:!0===this.persistentConfig.compact?s:[this.getSizeFirstColumn()].concat(ze()(s.slice(1))),partialRefresh:!0,onResize:!1!==this.persistentConfig.isEllipsed&&this.setEllipsisHandlers,headerOnly:!0}),!1!==this.persistentConfig.isEllipsed&&(null===(t=this.dataTable)||void 0===t||t.on("preDraw",(function(){var e,t,n;return null===(e=r.tableResizer)||void 0===e||e.reset({disable:!0}),Object(w.g)(r.tableEl,"ellipseTable"),null===(t=r.tableEl)||void 0===t||t.style.removeProperty("width"),null===(n=r.tableEl)||void 0===n||n.style.setProperty("width",r.tableEl.clientWidth+"px"),!0})),null===(n=this.dataTable)||void 0===n||n.on("draw",(function(){var e,t;if(r.tableEl){var n=r.tableEl.clientWidth;r.tableEl.style.removeProperty("width"),n>r.tableEl.clientWidth&&(n=r.tableEl.clientWidth),null===(e=r.tableEl)||void 0===e||e.style.setProperty("width","".concat(n,"px")),null===(t=r.tableResizer)||void 0===t||t.reset({disable:!1,partialRefresh:!0,onResize:r.setEllipsisHandlers,headerOnly:!0}),Object(w.b)(r.tableEl,"ellipseTable"),r.setEllipsisHandlers()}}))),this.drawControls(),!1!==this.persistentConfig.isEllipsed&&(Object(w.b)(this.tableEl,"ellipseTable"),this.setEllipsisHandlers())}},{key:"drawControls",value:function(){var e;this.removeControls(),this.tableControls=document.createElement("div"),this.tableControls.className="tableControls";var t=document.createElement("div"),n=document.createElement("label"),r=document.createElement("span");r.innerText="Simple view",Object(w.b)(r,"label"),n.appendChild(r),Object(w.b)(n,"switch"),t.appendChild(n),this.tableCompactSwitch=document.createElement("input"),n.addEventListener("change",this.handleSetCompactToggle),this.tableCompactSwitch.type="checkbox",n.appendChild(this.tableCompactSwitch),this.tableCompactSwitch.defaultChecked=!!this.persistentConfig.compact,this.tableControls.appendChild(t);var i=document.createElement("div"),o=document.createElement("label"),a=document.createElement("span");a.innerText="Ellipse",Object(w.b)(a,"label"),o.appendChild(a),Object(w.b)(o,"switch"),i.appendChild(o),this.tableEllipseSwitch=document.createElement("input"),o.addEventListener("change",this.handleSetEllipsisToggle),this.tableEllipseSwitch.type="checkbox",o.appendChild(this.tableEllipseSwitch),this.tableEllipseSwitch.defaultChecked=!1!==this.persistentConfig.isEllipsed,this.tableControls.appendChild(i),this.tableFilterField=document.createElement("input"),this.tableFilterField.className="tableFilter",this.tableFilterField.placeholder="Filter query results",this.tableFilterField.setAttribute("aria-label","Filter query results"),this.tableControls.appendChild(this.tableFilterField),this.tableFilterField.addEventListener("keyup",this.handleTableSearch);var s=document.createElement("div");s.className="pageSizeWrapper";var l=document.createElement("span");l.textContent="Page size: ",l.className="pageSizerLabel",s.appendChild(l),this.tableSizeField=document.createElement("select"),this.tableSizeField.className="tableSizer";for(var u=0,c=[10,50,100,1e3,-1];u0?p+"":"All",(null===(e=this.dataTable)||void 0===e?void 0:e.page.len())===p&&(h.selected=!0),this.tableSizeField.appendChild(h)}s.appendChild(this.tableSizeField),this.tableSizeField.addEventListener("change",this.handleTableSizeSelect),this.tableControls.appendChild(s),this.yasr.pluginControls.appendChild(this.tableControls)}},{key:"download",value:function(e){var t=this;return{getData:function(){var e;return(null===(e=t.yasr.results)||void 0===e?void 0:e.asCsv())||""},contentType:"text/csv",title:"Download result",filename:"".concat(e||"queryResults",".csv")}}},{key:"canHandleResults",value:function(){return!!this.yasr.results&&this.yasr.results.getVariables()&&this.yasr.results.getVariables().length>0}},{key:"removeControls",value:function(){var e,t,n,r,i,o;for(null===(e=this.tableFilterField)||void 0===e||e.removeEventListener("keyup",this.handleTableSearch),this.tableFilterField=void 0,null===(t=this.tableSizeField)||void 0===t||t.removeEventListener("change",this.handleTableSizeSelect),this.tableSizeField=void 0,null===(n=this.tableCompactSwitch)||void 0===n||n.removeEventListener("change",this.handleSetCompactToggle),this.tableCompactSwitch=void 0,null===(r=this.tableEllipseSwitch)||void 0===r||r.removeEventListener("change",this.handleSetEllipsisToggle),this.tableEllipseSwitch=void 0;null===(i=this.tableControls)||void 0===i?void 0:i.firstChild;)this.tableControls.firstChild.remove();null===(o=this.tableControls)||void 0===o||o.remove()}},{key:"destroyResizer",value:function(){this.tableResizer&&(this.tableResizer.reset({disable:!0}),window.removeEventListener("resize",this.tableResizer.onResize),this.tableResizer=void 0)}},{key:"destroy",value:function(){var e;this.removeControls(),this.destroyResizer(),null===(e=this.dataTable)||void 0===e||e.destroy(!0),this.dataTable=void 0,Object(w.g)(this.yasr.rootEl,"isSinglePage")}}]),e}();Ze.defaults={openIriInNewWindow:!0,tableConfig:{dom:"tip",pageLength:50,lengthChange:!0,data:[],columns:[],order:[],deferRender:!0,orderClasses:!1,language:{paginate:{first:"<<",last:">>",next:">",previous:"<"}}}},n(144);var et=function(){function e(t){l()(this,e),this.priority=10,this.hideFromSelection=!0,this.yasr=t}return c()(e,[{key:"draw",value:function(){var e,t=document.createElement("div");t.className="booleanResult";var n=null===(e=this.yasr.results)||void 0===e?void 0:e.getBoolean();t.appendChild(Object(w.d)(n?'':''));var r=document.createElement("span");r.textContent=n?"True":"False",t.appendChild(r),this.yasr.resultsEl.appendChild(t)}},{key:"canHandleResults",value:function(){var e;return!!(null===(e=this.yasr.results)||void 0===e?void 0:e.getBoolean)&&(!0===this.yasr.results.getBoolean()||0==this.yasr.results.getBoolean())}},{key:"getIcon",value:function(){return document.createElement("")}}]),e}(),tt=n(131),nt='';n(145);var rt=n(7);n(92),n(99),n(100),n(101),n(102),n(146),n(147),n(103);var it=function(){function e(t){l()(this,e),this.label="Response",this.priority=2,this.helpReference="https://triply.cc/docs/yasgui#response",this.yasr=t,this.config=e.defaults,t.config.plugins.response&&t.config.plugins.response.dynamicConfig&&(this.config=Object.assign(Object.assign({},this.config),t.config.plugins.response.dynamicConfig))}return c()(e,[{key:"canHandleResults",value:function(){if(!this.yasr.results)return!1;if(!this.yasr.results.getOriginalResponseAsString)return!1;var e=this.yasr.results.getOriginalResponseAsString();return!((!e||0==e.length)&&this.yasr.results.getError())}},{key:"getIcon",value:function(){return Object(w.d)(Object(w.c)(tt))}},{key:"download",value:function(e){var t=this;if(this.yasr.results){var n=this.yasr.results.getContentType(),r=this.yasr.results.getType(),i="xml"===r?"rdf":r;return{getData:function(){var e;return(null===(e=t.yasr.results)||void 0===e?void 0:e.getOriginalResponseAsString())||""},filename:"".concat(e||"queryResults").concat(i?"."+i:""),contentType:n||"text/plain",title:"Download result"}}}},{key:"draw",value:function(e){var t,n,r=Object.assign(Object.assign({},this.config),e),i=(null===(t=this.yasr.results)||void 0===t?void 0:t.getOriginalResponseAsString())||"",o=i.split("\n");o.length>r.maxLines&&(i=o.slice(0,r.maxLines).join("\n"));var a={readOnly:"nocursor",lineNumbers:!0,lineWrapping:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],value:i};"json"===(null===(n=this.yasr.results)||void 0===n?void 0:n.getType())&&(a.mode={name:"javascript",json:!0}),this.cm=rt(this.yasr.resultsEl,a),o.length>r.maxLines&&this.showLess(!1)}},{key:"limitData",value:function(e){var t=e.split("\n");return t.length>this.config.maxLines&&(e=t.slice(0,this.config.maxLines).join("\n")),e}},{key:"showLess",value:function(){var e,t=this,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.cm){Object(w.b)(this.cm.getWrapperElement(),"overflow"),this.overLay&&(this.overLay.remove(),this.overLay=void 0),this.overLay=document.createElement("div"),Object(w.b)(this.overLay,"overlay");var r=document.createElement("div");Object(w.b)(r,"overlay_content");var i=document.createElement("button");i.title="Show all",Object(w.b)(i,"yasr_btn","overlay_btn"),i.textContent="Show all",i.addEventListener("click",(function(){return t.showMore()})),r.append(i);var o=document.createElement("button");o.title="Download result",Object(w.b)(o,"yasr_btn","overlay_btn");var a=document.createElement("span");a.innerText="Download result",o.appendChild(a),o.appendChild(Object(w.d)(nt)),o.addEventListener("click",(function(){return t.yasr.download()})),o.addEventListener("keydown",(function(e){"Space"!==e.code&&"Enter"!==e.code||t.yasr.download()})),r.appendChild(o),this.overLay.appendChild(r),this.cm.getWrapperElement().appendChild(this.overLay),n&&this.cm.setValue(this.limitData((null===(e=this.yasr.results)||void 0===e?void 0:e.getOriginalResponseAsString())||""))}}},{key:"showMore",value:function(){var e,t;this.cm&&(Object(w.g)(this.cm.getWrapperElement(),"overflow"),null===(e=this.overLay)||void 0===e||e.remove(),this.overLay=void 0,this.cm.setValue((null===(t=this.yasr.results)||void 0===t?void 0:t.getOriginalResponseAsString())||""),this.cm.refresh())}}]),e}();it.defaults={maxLines:30};var ot=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};n(148);var at=function(){function e(t){l()(this,e),this.priority=20,this.hideFromSelection=!0,this.yasr=t}return c()(e,[{key:"canHandleResults",value:function(){return!!this.yasr.results&&!!this.yasr.results.getError()}},{key:"getTryBtn",value:function(e){var t=document.createElement("a");return t.href=e,t.rel="noopener noreferrer",t.target="_blank",t.className="yasr_tryQuery",t.textContent="Try query in a new browser window",t}},{key:"getCorsMessage",value:function(){var e=document.createElement("div");e.className="redOutline";var t=document.createElement("p");t.textContent="Unable to get response from endpoint. Possible reasons:",e.appendChild(t);var n=document.createElement("ul"),r=document.createElement("li");r.textContent="Incorrect endpoint URL",n.appendChild(r);var i=document.createElement("li");i.textContent="Endpoint is down",n.appendChild(i);var o=document.createElement("li"),a=document.createElement("span");a.textContent="Endpoint is not accessible from the YASGUI server and website, and the endpoint is not ",o.appendChild(a);var s=document.createElement("a");return s.textContent="CORS-enabled",s.href="http://enable-cors.org/",s.target="_blank",s.rel="noopener noreferrer",o.appendChild(s),n.appendChild(o),e.appendChild(n),e}},{key:"draw",value:function(){var e;return ot(this,void 0,void 0,a.a.mark((function t(){var n,r,i,o,s,l,u,c,p,h,f,d;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((n=document.createElement("div")).className="errorResult",this.yasr.resultsEl.appendChild(n),r=null===(e=this.yasr.results)||void 0===e?void 0:e.getError()){t.next=6;break}return t.abrupt("return");case 6:return(i=document.createElement("div")).className="errorHeader",n.appendChild(i),t.next=11,this.yasr.renderError(r);case 11:if(!(o=t.sent)){t.next=18;break}return(s=document.createElement("div")).className="redOutline",s.appendChild(o),n.appendChild(s),t.abrupt("return");case 18:r.status?(l="Error",r.statusText&&r.statusText.length<100&&(l=r.statusText),l+=" (#".concat(r.status,")"),(u=document.createElement("span")).className="status",u.textContent=l,i.appendChild(u),this.yasr.config.getPlainQueryLinkToEndpoint&&(c=this.yasr.config.getPlainQueryLinkToEndpoint())&&i.appendChild(this.getTryBtn(c)),r.text&&(p=document.createElement("div"),Object(w.b)(p,"errorMessageContainer"),n.appendChild(p),h=document.createElement("pre"),Object(w.b)(h,"errorMessage"),h.textContent=r.text,p.appendChild(h))):(this.yasr.config.getPlainQueryLinkToEndpoint&&(f=this.yasr.config.getPlainQueryLinkToEndpoint())&&i.appendChild(this.getTryBtn(f)),!r.text||r.text.indexOf("Request has been terminated")>=0?n.appendChild(this.getCorsMessage()):((d=document.createElement("pre")).textContent=r.text,n.appendChild(d)));case 19:case"end":return t.stop()}}),t,this)})))}},{key:"getIcon",value:function(){return document.createElement("")}}]),e}();function st(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return lt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function lt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;if(l()(this,n),(r=t.call(this)).plugins={},r.helpDrawn=!1,r.utils={addScript:Ge,addCSS:Be,sanitize:He},!e)throw new Error("No parent passed as argument. Dont know where to draw YASR");r.rootEl=document.createElement("div"),r.rootEl.className="yasr",e.appendChild(r.rootEl),r.config=Object(y.a)({},n.defaults,i),r.storage=new w.a(n.storageNamespace),r.getConfigFromStorage(),r.headerEl=document.createElement("div"),r.headerEl.className="yasr_header",r.rootEl.appendChild(r.headerEl),r.fallbackInfoEl=document.createElement("div"),r.fallbackInfoEl.className="yasr_fallback_info",r.rootEl.appendChild(r.fallbackInfoEl),r.resultsEl=document.createElement("div"),r.resultsEl.className="yasr_results",r.resultsEl.id=x("resultsId"),r.rootEl.appendChild(r.resultsEl),r.initializePlugins(),r.drawHeader();var a=o||r.getResponseFromStorage();return a&&r.setResponse(a),r}return c()(n,[{key:"getConfigFromStorage",value:function(){var e=this.getStorageId(this.config.persistenceLabelConfig);if(e){var t=this.storage.get(e);if(t)for(var n in this.selectedPlugin=t.selectedPlugin,t.pluginsConfig){var r=t.pluginsConfig[n];r&&this.config.plugins[n]&&(this.config.plugins[n].dynamicConfig=r)}}}},{key:"renderError",value:function(e){return ct(this,void 0,void 0,a.a.mark((function t(){var n,r,i,o;return a.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=void 0,void 0===this.config.errorRenderers){t.next=22;break}r=st(this.config.errorRenderers),t.prev=3,r.s();case 5:if((i=r.n()).done){t.next=14;break}return o=i.value,t.next=9,o(e);case 9:if(void 0===(n=t.sent)){t.next=12;break}return t.abrupt("break",14);case 12:t.next=5;break;case 14:t.next=19;break;case 16:t.prev=16,t.t0=t.catch(3),r.e(t.t0);case 19:return t.prev=19,r.f(),t.finish(19);case 22:return t.abrupt("return",n);case 23:case"end":return t.stop()}}),t,this,[[3,16,19,22]])})))}},{key:"getStorageId",value:function(e,t){var n=t||this.config.persistenceId;if(n)return"string"==typeof n?n+"_"+e:n(this)+"_"+e}},{key:"somethingDrawn",value:function(){return!!this.resultsEl.children.length}},{key:"emptyFallbackElement",value:function(){for(;this.fallbackInfoEl.firstChild;)this.fallbackInfoEl.removeChild(this.fallbackInfoEl.firstChild)}},{key:"getSelectedPluginName",value:function(){return this.selectedPlugin||this.config.defaultPlugin}},{key:"getSelectedPlugin",value:function(){if(this.plugins[this.getSelectedPluginName()])return this.plugins[this.getSelectedPluginName()];console.warn("Tried using plugin ".concat(this.getSelectedPluginName(),", but seems this plugin isnt registered in yasr."))}},{key:"updatePluginSelectors",value:function(e){if(this.pluginSelectorsEl)for(var t in this.config.plugins){var n=this.plugins[t];n&&!n.hideFromSelection&&(e&&(e.indexOf(t)>=0?Object(w.g)(this.pluginSelectorsEl.querySelector(".select_"+t),"disabled"):Object(w.b)(this.pluginSelectorsEl.querySelector(".select_"+t),"disabled")),t===this.getSelectedPluginName()?Object(w.b)(this.pluginSelectorsEl.querySelector(".select_"+t),"selected"):Object(w.g)(this.pluginSelectorsEl.querySelector(".select_"+t),"selected"))}}},{key:"getCompatiblePlugins",value:function(){if(!this.results)return Object.keys(N(this.config.plugins,(function(e){return"object"===i()(e)&&e.enabled||!0===e})));var e=[];for(var t in this.plugins)this.plugins[t].canHandleResults()&&e.push({name:t,priority:this.plugins[t].priority});return e.sort((function(e,t){return t.priority-e.priority})).map((function(e){return e.name}))}},{key:"draw",value:function(){var e,t,n,r,i,o=this;if(this.updateHelpButton(),this.updateResponseInfo(),this.results){var s,l=this.getCompatiblePlugins();if(this.drawnPlugin&&this.getSelectedPluginName()!==this.drawnPlugin){for(;this.pluginControls.firstChild;)this.pluginControls.firstChild.remove();null===(t=(e=this.plugins[this.drawnPlugin]).destroy)||void 0===t||t.call(e)}if(this.getSelectedPlugin()&&(null===(n=this.getSelectedPlugin())||void 0===n?void 0:n.canHandleResults())?(s=this.getSelectedPluginName(),this.emptyFallbackElement()):l[0]&&(this.drawnPlugin&&(null===(i=(r=this.plugins[this.drawnPlugin]).destroy)||void 0===i||i.call(r)),s=l[0],this.fillFallbackBox(s)),s){this.drawnPlugin=s,this.emit("draw",this,this.plugins[s]);var u=this.plugins[s];(u.initialize?u.initialize():Promise.resolve()).then((function(){return ct(o,void 0,void 0,a.a.mark((function e(){return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!s){e.next=7;break}for(;this.resultsEl.firstChild;)this.resultsEl.firstChild.remove();return e.next=4,this.plugins[s].draw(this.config.plugins[s].dynamicConfig);case 4:this.emit("drawn",this,this.plugins[s]),this.updateExportHeaders(),this.updatePluginSelectors(l);case 7:case"end":return e.stop()}}),e,this)})))}),(function(e){return console.error}))}else this.resultsEl.textContent="cannot render result",this.updateExportHeaders(),this.updatePluginSelectors(l)}}},{key:"refresh",value:function(){this.draw()}},{key:"destroy",value:function(){var e,t;this.drawnPlugin&&(null===(t=null===(e=this.plugins[this.drawnPlugin])||void 0===e?void 0:e.destroy)||void 0===t||t.call(e)),this.removeAllListeners(),this.rootEl.remove()}},{key:"getPrefixes",value:function(){return this.config.prefixes?"function"==typeof this.config.prefixes?this.config.prefixes(this):this.config.prefixes:{}}},{key:"selectPlugin",value:function(e){this.selectedPlugin!==e&&(this.config.plugins[e]?this.selectedPlugin=e:(console.warn("Plugin ".concat(e," does not exist.")),this.selectedPlugin=this.config.defaultPlugin),this.storeConfig(),this.emit("change",this),this.updatePluginSelectors(),this.draw())}},{key:"drawPluginSelectors",value:function(){var e=this;this.pluginSelectorsEl=document.createElement("ul"),this.pluginSelectorsEl.className="yasr_btnGroup";var t=this.config.pluginOrder;Object.keys(this.config.plugins).sort().forEach((function(e){-1===t.indexOf(e)&&t.push(e)}));var n,r=st(t);try{var i=function(){var t=n.value;if(!e.config.plugins[t]||!e.config.plugins[t].enabled)return"continue";var r=e.plugins[t];if(!r)return"continue";if(r.hideFromSelection)return"continue";var i=r.label||t,o=document.createElement("button");if(Object(w.b)(o,"yasr_btn","select_"+t),o.title=i,o.type="button",o.setAttribute("aria-label","Shows ".concat(i," view")),r.getIcon){var a=r.getIcon();a&&(Object(w.b)(a,"plugin_icon"),o.appendChild(a))}var s=document.createElement("span");s.textContent=i,o.appendChild(s),o.addEventListener("click",(function(){return e.selectPlugin(t)}));var l=document.createElement("li");l.appendChild(o),e.pluginSelectorsEl.appendChild(l)};for(r.s();!(n=r.n()).done;)i()}catch(e){r.e(e)}finally{r.f()}this.pluginSelectorsEl.children.length>=1&&this.headerEl.appendChild(this.pluginSelectorsEl),this.updatePluginSelectors()}},{key:"fillFallbackBox",value:function(e){var t,n,r;if(this.emptyFallbackElement(),!(null===(t=this.plugins[e||this.drawnPlugin||""])||void 0===t?void 0:t.hideFromSelection)){var i=this.getSelectedPlugin(),o=(null===(n=this.plugins[e||this.drawnPlugin||""])||void 0===n?void 0:n.label)||e||this.drawnPlugin,a=(null==i?void 0:i.label)||this.getSelectedPluginName(),s=document.createElement("p");if(s.innerText="Could not render results with the ".concat(a," plugin, the results currently are rendered with the ").concat(o," plugin. ").concat((null===(r=this.getSelectedPlugin())||void 0===r?void 0:r.helpReference)?"See ":""),null==i?void 0:i.helpReference){var l=document.createElement("a");l.innerText="".concat(a," documentation"),l.href=i.helpReference,l.rel="noopener noreferrer",l.target="_blank",s.append(l),s.innerHTML+=" for more information."}this.fallbackInfoEl.appendChild(s)}}},{key:"drawPluginElement",value:function(){var e=document.createElement("div");Object(w.b)(e,"space_element"),this.headerEl.appendChild(e),this.pluginControls=document.createElement("div"),this.pluginControls.setAttribute("id","yasr_plugin_control"),Object(w.b)(this.pluginControls,"yasr_plugin_control"),this.pluginControls.setAttribute("aria-controls",this.resultsEl.id),this.headerEl.appendChild(this.pluginControls)}},{key:"drawHeader",value:function(){this.drawPluginSelectors(),this.drawResponseInfo(),this.drawPluginElement(),this.drawDownloadIcon(),this.drawDocumentationButton()}},{key:"drawDownloadIcon",value:function(){var e=this;this.downloadBtn=document.createElement("a"),Object(w.b)(this.downloadBtn,"yasr_btn","yasr_downloadIcon","btn_icon"),this.downloadBtn.download="",this.downloadBtn.setAttribute("aria-label","Download Results"),this.downloadBtn.setAttribute("tabindex","0"),this.downloadBtn.setAttribute("role","button");var t=Object(w.d)(Object(w.c)(qe));t.setAttribute("aria-hidden","true"),this.downloadBtn.appendChild(t),this.downloadBtn.addEventListener("click",(function(){Object(w.f)(e.downloadBtn,"disabled")||e.download()})),this.downloadBtn.addEventListener("keydown",(function(t){if("Space"===t.code||"Enter"===t.code){if(Object(w.f)(e.downloadBtn,"disabled"))return;e.download()}})),this.headerEl.appendChild(this.downloadBtn)}},{key:"drawResponseInfo",value:function(){this.dataElement=document.createElement("div"),Object(w.b)(this.dataElement,"yasr_response_chip"),this.headerEl.appendChild(this.dataElement),this.updateResponseInfo()}},{key:"updateResponseInfo",value:function(){var e="";if(this.results){Object(w.g)(this.dataElement,"empty");var t=this.results.getBindings();t&&(e+="".concat(t.length," result").concat(1===t.length?"":"s"));var n=this.results.getResponseTime();if(n){e||(e="Response");var r=n/1e3;e+=" in ".concat(r," second").concat(1===r?"":"s")}}else Object(w.b)(this.dataElement,"empty");this.dataElement.innerText=e}},{key:"updateHelpButton",value:function(){var e=this.getSelectedPlugin();if(null==e?void 0:e.helpReference){var t="View documentation of ".concat(e.label||this.getSelectedPluginName());this.documentationLink.href=e.helpReference,this.documentationLink.title=t,this.documentationLink.setAttribute("aria-label",t),Object(w.g)(this.documentationLink,"disabled")}else Object(w.b)(this.documentationLink,"disabled"),this.documentationLink.title="This plugin doesn't have a help reference yet. Please contact the maintainer to fix this"}},{key:"updateExportHeaders",value:function(){var e,t;if(this.downloadBtn&&this.drawnPlugin){this.downloadBtn.title="";var n=this.plugins[this.drawnPlugin];if(n&&n.download){var r=n.download(null===(t=(e=this.config).getDownloadFileName)||void 0===t?void 0:t.call(e));if(Object(w.g)(this.downloadBtn,"disabled"),r)return void(r.title&&(this.downloadBtn.title=r.title))}this.downloadBtn.title="Download not supported",Object(w.b)(this.downloadBtn,"disabled")}}},{key:"drawDocumentationButton",value:function(){this.documentationLink=document.createElement("a"),Object(w.b)(this.documentationLink,"yasr_btn","yasr_external_ref_btn"),this.documentationLink.appendChild(Object(w.d)(Object(w.c)(Ve))),this.documentationLink.href="//triply.cc/docs/yasgui",this.documentationLink.target="_blank",this.documentationLink.rel="noopener noreferrer",this.headerEl.appendChild(this.documentationLink)}},{key:"download",value:function(){var e,t,n;if(this.drawnPlugin){var r=this.plugins[this.drawnPlugin];if(r&&r.download){var i=r.download(null===(t=(e=this.config).getDownloadFileName)||void 0===t?void 0:t.call(e));if(!i)return;var o,a=i.getData();if(a.startsWith("data:"))o=a;else{var s=new Blob([a],{type:null!==(n=i.contentType)&&void 0!==n?n:"text/plain"});o=window.URL.createObjectURL(s)}var l=document.createElement("a");l.href=o,l.download=i.filename,l.click()}}}},{key:"handleLocalStorageQuotaFull",value:function(e){console.warn("Localstorage quota exceeded. Clearing all queries"),n.clearStorage()}},{key:"getResponseFromStorage",value:function(){var e=this.getStorageId(this.config.persistenceLabelResponse);if(e)return this.storage.get(e)}},{key:"getPersistentConfig",value:function(){return{selectedPlugin:this.getSelectedPluginName(),pluginsConfig:Object(I.a)(this.config.plugins,(function(e){return e.dynamicConfig}))}}},{key:"storePluginConfig",value:function(e,t){this.config.plugins[e].dynamicConfig=t,this.storeConfig(),this.emit("change",this)}},{key:"storeConfig",value:function(){var e=this.getStorageId(this.config.persistenceLabelConfig);e&&this.storage.set(e,this.getPersistentConfig(),this.config.persistencyExpire,this.handleLocalStorageQuotaFull)}},{key:"storeResponse",value:function(){var e=this.getStorageId(this.config.persistenceLabelResponse);if(e&&this.results){var t=this.results.getAsStoreObject(this.config.maxPersistentResponseSize);t&&!t.error?this.storage.set(e,t,this.config.persistencyExpire,this.handleLocalStorageQuotaFull):this.storage.remove(e)}}},{key:"setResponse",value:function(e,t){e&&(this.results=new Fe(e,t),this.draw(),this.storeResponse())}},{key:"initializePlugins",value:function(){for(var e in this.config.plugins)this.config.plugins[e]&&(n.plugins[e]?this.plugins[e]=new n.plugins[e](this):console.warn("Wanted to initialize plugin "+e+" but could not find a matching registered plugin"))}}],[{key:"registerPlugin",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];n.plugins[e]=t,n.defaults.plugins[e]=r?{enabled:!0}:{enabled:!1}}},{key:"clearStorage",value:function(){new w.a(n.storageNamespace).removeNamespace()}}]),n}(m.EventEmitter);function ht(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];pt.plugins[e]=t,pt.defaults.plugins[e]=n?{enabled:!0}:{enabled:!1}}pt.defaults={persistenceId:function(e){var t="",n=e.rootEl;for(n.id&&(t=n.id);n&&n!==document;n=n.parentNode)if(n){n.id&&(t=n.id);break}return"yasr_"+t},getPlainQueryLinkToEndpoint:void 0,persistencyExpire:2592e3,persistenceLabelResponse:"response",persistenceLabelConfig:"config",maxPersistentResponseSize:1e5,prefixes:{},plugins:{},pluginOrder:["table","response"],defaultPlugin:"table"},pt.plugins={},pt.Dependencies={},pt.storageNamespace="triply",pt.registerPlugin("table",Ze),pt.registerPlugin("boolean",et),pt.registerPlugin("response",it),pt.registerPlugin("error",at);t.default=pt},function(e,t,n){"use strict";(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.a=n}).call(this,n(72))},function(e,t,n){"use strict";t.a=function(e){return function(t){return null==e?void 0:e[t]}}},function(e,t,n){"use strict";t.a=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){"use strict";var r=n(69),i=n(13);t.a=function(e,t){return e&&Object(r.a)(e,t,i.a)}},function(e,t,n){"use strict";var r=n(31),i=n(12),o=Object.prototype.hasOwnProperty;t.a=function(e,t,n){var a=e[t];o.call(e,t)&&Object(i.a)(a,n)&&(void 0!==n||t in e)||Object(r.a)(e,t,n)}},function(e,t,n){"use strict";var r=function(e,t){for(var n=-1,r=Array(e);++n=0){var i=n.string.indexOf(" ");return n.string=n.string.substr(0,i),n.end=n.start+n.string.length,n}if(!n.type)return n;var o=t.getTokenAt({line:r.line,ch:n.end+1});return"ws"!==o.type&&n.state.possibleFullIri&&null!==n.type&&"ws"!==n.type&&o.end!==n.end?(n.end=o.end,n.string=n.string+o.string,e(t,n,{line:r.line,ch:o.end})):"ws"===n.type?(n.end=n.end+1,n.string=n.string.substring(n.string.length-1),n):n}(e,function e(t,n,r){var i=t.getTokenAt({line:r.line,ch:n.start});if(!("punc"!==n.type&&"error"!==n.type||n.state.possibleFullIri||n.state.inPrefixDecl))return n.state.possibleCurrent=n.state.possibleNext,n;if("punc"===i.type&&!i.state.possibleFullIri&&!i.state.inPrefixDecl)return n;return null!=i.type&&"ws"!=i.type&&null!=n.type&&"ws"!=n.type?(n.start=i.start,n.string=i.string+n.string,e(t,n,{line:r.line,ch:i.start})):null!=n.type&&"ws"==n.type?(n.start=n.start+1,n.string=n.string.substring(1),n):n}(e,t,n),n)}function b(e,t,n){null==n&&(n=1);var r=e.getTokenAt({line:t,ch:n});if(!(null==r||null==r||r.end=0)return n}}function S(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0;r||(r=e.getDoc().getLine(t));var i=(r=r.toUpperCase()).indexOf("PREFIX ",n);if(i>=0){var o=e.getTokenTypeAt(y.a.Pos(t,i+1));if("keyword"===o)return i}}function T(e,t){e.getDoc().replaceRange("PREFIX "+t+"\n",{line:0,ch:0}),e.collapsePrefixes(!1)}var C=n(0),A=n(50);function L(e,t,n){var r;t.onmouseover=function(){r||((r=document.createElement("div")).className="yasqe_tooltip"),r.style.display="block",r.innerHTML=n,t.appendChild(r)},t.onmouseout=function(){r&&(r.style.display="none"),r.innerHTML=n}}var N=n(19),I=n.n(N),w=n(44),_=n(170),O=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};function R(e,t){return Object(w.a)(t)?t(e):t}function D(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object(_.a)({},R(e,e.config.requestConfig),R(e,t));if(n.endpoint&&0!=n.endpoint.length){var r=e.getQueryMode(),i=Object(w.a)(n.endpoint)?n.endpoint(e):n.endpoint,o="update"==r?"POST":Object(w.a)(n.method)?n.method(e):n.method,a=Object(w.a)(n.headers)?n.headers(e):n.headers,s=Object(w.a)(n.withCredentials)?n.withCredentials(e):n.withCredentials;return{reqMethod:o,url:i,args:k(e,n),headers:a,accept:M(e,n),withCredentials:s}}}function P(e,t){return O(this,void 0,void 0,I.a.mark((function n(){var r,i,o;return I.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,D(e,t),i=D(e,t)){n.next=5;break}return n.abrupt("return");case 5:return o=Date.now(),(r="POST"===i.reqMethod?v.post(i.url).type("form").send(i.args):v.get(i.url).query(i.args)).accept(i.accept).set(i.headers||{}),i.withCredentials&&r.withCredentials(),e.emit("query",r,i),n.next=12,r.then((function(t){return e.emit("queryResponse",t,Date.now()-o),e.emit("queryResults",t.body,Date.now()-o),t.body}),(function(t){throw t instanceof Error&&"Aborted"===t.message||e.emit("queryResponse",t,Date.now()-o),e.emit("error",t),t}));case 12:return n.abrupt("return",n.sent);case 15:n.prev=15,n.t0=n.catch(0),console.error(n.t0);case 18:case"end":return n.stop()}}),n,null,[[0,15]])})))}function k(e,t){var n=e.getQueryMode(),r={},i=R(e,t),o=Object(w.a)(i.queryArgument)?i.queryArgument(e):i.queryArgument;o||(o=e.getQueryMode()),r[o]=i.adjustQueryBeforeRequest?i.adjustQueryBeforeRequest(e):e.getValue();var a=Object(w.a)(i.namedGraphs)?i.namedGraphs(e):i.namedGraphs;a&&a.length>0&&(r["query"===n?"named-graph-uri":"using-named-graph-uri "]=a);var s=Object(w.a)(i.defaultGraphs)?i.defaultGraphs(e):i.defaultGraphs;s&&s.length>0&&(r["query"==n?"default-graph-uri":"using-graph-uri "]=a);var l=Object(w.a)(i.args)?i.args(e):i.args;return l&&l.length>0&&Object(_.a)(r,l.reduce((function(e,t){return e[t.name]?e[t.name].push(t.value):e[t.name]=[t.value],e}),{})),r}function M(e,t){var n=R(e,t),r=null;if("update"==e.getQueryMode())r=Object(w.a)(n.acceptHeaderUpdate)?n.acceptHeaderUpdate(e):n.acceptHeaderUpdate;else{var i=e.getQueryType();r="DESCRIBE"==i||"CONSTRUCT"==i?Object(w.a)(n.acceptHeaderGraph)?n.acceptHeaderGraph(e):n.acceptHeaderGraph:Object(w.a)(n.acceptHeaderSelect)?n.acceptHeaderSelect(e):n.acceptHeaderSelect}return r}function j(e,t){var n=D(e,R(e,t));if(!n)return"";var r=n.url;0!==n.url.indexOf("http")&&(r="".concat(window.location.protocol,"//").concat(window.location.host),0===n.url.indexOf("/")?r+=n.url:r+=window.location.pathname+n.url);var i=["curl"];for(var o in"GET"===n.reqMethod?(r+="?".concat(A.stringify(n.args)),i.push(r)):"POST"===n.reqMethod?(i.push(r),i.push("--data",A.stringify(n.args))):(console.warn("Unexpected request-method",n.reqMethod),i.push(r)),i.push("-X",n.reqMethod),n.headers)i.push("-H '".concat(o,": ").concat(n.headers[o],"'"));return i.join(" ")}var F='',B=function(){function e(){o()(this,e),this.words=0,this.prefixes=0,this.children={}}return s()(e,[{key:"insert",value:function(t,n){if(0!=t.length){var r,i=this;void 0===n&&(n=0),n!==t.length?(i.prefixes++,r=t[n],void 0===i.children[r]&&(i.children[r]=new e),i.children[r].insert(t,n+1)):i.words++}}},{key:"remove",value:function(e,t){if(0!=e.length){var n,r=this;void 0===t&&(t=0),void 0!==r&&(t!==e.length?(r.prefixes--,n=e[t],r.children[n].remove(e,t+1)):r.words--)}}},{key:"update",value:function(e,t){0!=e.length&&0!=t.length&&(this.remove(e),this.insert(t))}},{key:"countWord",value:function(e,t){if(0==e.length)return 0;var n,r,i=0;return void 0===t&&(t=0),t===e.length?this.words:(n=e[t],void 0!==(r=this.children[n])&&(i=r.countWord(e,t+1)),i)}},{key:"countPrefix",value:function(e,t){if(0==e.length)return 0;var n,r=0;if(void 0===t&&(t=0),t===e.length)return this.prefixes;var i=e[t];return void 0!==(n=this.children[i])&&(r=n.countPrefix(e,t+1)),r}},{key:"find",value:function(e){return 0!=e.length&&this.countWord(e)>0}},{key:"getAllWords",value:function(e){var t,n,r=this,i=[];if(void 0===e&&(e=""),void 0===r)return[];for(t in r.words>0&&i.push(e),r.children)r.children.hasOwnProperty(t)&&(n=r.children[t],i=i.concat(n.getAllWords(e+t)));return i}},{key:"autoComplete",value:function(e,t){var n,r;return 0==e.length?void 0===t?this.getAllWords(e):[]:(void 0===t&&(t=0),n=e[t],void 0===(r=this.children[n])?[]:t===e.length-1?r.getAllWords(e):r.autoComplete(e,t+1))}}]),e}(),G=n(54);var U=function(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r=0&&(s+=l.innerText),n[s])continue;if(s.length<=1)continue;if(0!==s.indexOf(t.string))continue;if(s===t.string)continue;n[s]=!0,r.push(s)}}return r.sort()},bulk:!1,autoShow:!0},W=n(97),z=n(60),Y=n(52),X=n(90),$=n(10);var J=function(e,t){var n=-1,r=Object($.a)(e)?Array(e.length):[];return Object(X.a)(e,(function(e,i,o){r[++n]=t(e,i,o)})),r};var Q=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e},K=n(45),Z=n(17);var ee=function(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,o=Object(Z.a)(e),a=void 0!==t,s=null===t,l=t==t,u=Object(Z.a)(t);if(!s&&!u&&!o&&e>t||o&&a&&l&&!s&&!u||r&&a&&l||!n&&l||!i)return 1;if(!r&&!o&&!u&&e=s?l:l*("desc"==n[r]?-1:1)}return e.index-t.index},ne=n(25);var re=function(e,t,n){var r=-1;t=Object(z.a)(t.length?t:[ne.a],Object(K.a)(Y.a));var i=J(e,(function(e,n,i){return{criteria:Object(z.a)(t,(function(t){return t(e)})),index:++r,value:e}}));return Q(i,(function(e,t){return te(e,t,n)}))},ie=n(79),oe=n(70),ae=Object(ie.a)((function(e,t){if(null==e)return[];var n=t.length;return n>1&&Object(oe.a)(e,t[0],t[1])?t=[]:n>2&&Object(oe.a)(t[0],t[1],t[2])&&(t=[t[0]]),re(e,Object(W.a)(t,1),[])})),se={"string-2":"prefixed",atom:"var"},le=(0===window.location.protocol.indexOf("http")?"//":"http://")+"prefix.cc/popular/all.file.json",ue={postprocessHints:function(e,t){return ae(t,(function(e){return e.text.split(":")[0]}))},onInitialize:function(e){var t=this;e.on("change",(function(){var n;if(e.config.autocompleters&&-1!=e.config.autocompleters.indexOf(t.name)){var r=e.getDoc().getCursor(),i=e.getTokenAt(r);if(i.type&&"prefixed"==se[i.type]){var o=i.string.indexOf(":");if(-1!==o){var a=e.getPreviousNonWsToken(r.line,i).string.toUpperCase(),s=e.getTokenAt({line:r.line,ch:i.start});if("PREFIX"!==a&&("ws"==s.type||null==s.type||"punc"===s.type&&("|"===s.string||"/"===s.string||"^^"==s.string||"{"==s.string||"("===s.string))){var l=i.string.substring(0,o+1);null==e.getPrefixesFromQuery()[l.slice(0,-1)]&&(i.autocompletionString=l,null===(n=e.autocompleters[t.name])||void 0===n||n.getCompletions(i).then((function(t){t.length&&(e.addPrefixes(t[0]),e.autocomplete())}),console.warn))}}}}}))},isValidCompletionPosition:function(e){var t=e.getDoc().getCursor(),n=e.getTokenAt(t);if(e.getDoc().getLine(t.line).length>t.ch)return!1;if("ws"!=n.type&&(n=e.getCompleteToken()),0!==n.string.indexOf("a")&&n.state.possibleCurrent.indexOf("PNAME_NS")<0)return!1;var r=e.getPreviousNonWsToken(t.line,n);return!(!r||"PREFIX"!=r.string.toUpperCase())},get:function(e){return v.get(le).then((function(e){var t=[];for(var n in e.body){var r=n+": <"+e.body[n]+">";t.push(r)}return t.sort()}))},preProcessToken:function(e,t){var n=e.getPreviousNonWsToken(e.getDoc().getCursor().line,t);return n&&n.string&&":"==n.string.slice(-1)&&(t={start:n.start,end:t.end,string:n.string+" "+t.string,state:t.state,type:t.type}),t},bulk:!0,autoShow:!0,persistenceId:"prefixes",name:"prefixes"},ce={onInitialize:function(e){},get:function(e,t){return Ee(e,"property",t)},isValidCompletionPosition:function(e){var t=e.getCompleteToken();return 0!=t.string.length&&("?"!==t.string[0]&&"$"!==t.string[0]&&t.state.possibleCurrent.indexOf("a")>=0)},preProcessToken:function(e,t){return me(e,t)},postProcessSuggestion:function(e,t,n){return ye(e,t,n)},bulk:!1,name:"property"},pe={onInitialize:function(e){},get:function(e,t){return Ee(e,"class",t)},isValidCompletionPosition:function(e){var t=e.getCompleteToken();if("?"===t.string[0]||"$"===t.string[0])return!1;var n=e.getDoc().getCursor(),r=e.getPreviousNonWsToken(n.line,t);return"a"===r.state.lastProperty||("rdf:type"===r.state.lastProperty||("rdfs:domain"===r.state.lastProperty||"rdfs:range"===r.state.lastProperty))},preProcessToken:function(e,t){return me(e,t)},postProcessSuggestion:function(e,t,n){return ye(e,t,n)},bulk:!1,name:"class"};function he(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return fe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fe(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function fe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?(this.storeBulkCompletions(t),Promise.resolve()):this.getCompletions().then((function(t){return e.storeBulkCompletions(t)}))}return Promise.resolve()}},{key:"isValidPosition",value:function(){return!!this.config.isValidCompletionPosition&&(this.config.isValidCompletionPosition(this.yasqe)?(this.config.autoShow||this.yasqe.showNotification(this.config.name,"Press CTRL - to autocomplete"),this.emit("validPosition",this),!0):(this.emit("invalidPosition",this),this.yasqe.hideNotification(this.config.name),!1))}},{key:"getHint",value:function(e,t){var n,r;this.config.postProcessSuggestion&&(t=this.config.postProcessSuggestion(this.yasqe,e,t));var i=this.yasqe.getDoc().getCursor();e.from&&(r=Object.assign(Object.assign({},i),e.from));var o=this.yasqe.getDoc().getCursor().line;return{text:t,displayText:t,from:r,to:e.to?{ch:(null===(n=null==e?void 0:e.to)||void 0===n?void 0:n.ch)||this.yasqe.getCompleteToken().end,line:o}:e.string.length>0?{ch:this.yasqe.getCompleteToken().end,line:o}:e.from}}},{key:"getHints",value:function(e){var t=this;return this.config.preProcessToken&&(e=this.config.preProcessToken(this.yasqe,e)),e?this.getCompletions(e).then((function(n){return n.map((function(n){return t.getHint(e,n)}))})).then((function(e){return t.config.postprocessHints?t.config.postprocessHints(t.yasqe,e):e})):Promise.resolve([])}},{key:"autocomplete",value:function(e){var t=this;if(!this.isValidPosition())return!1;var n=this.yasqe.state.completionActive,r=this.yasqe.getDoc().getCursor();if(n&&r.sticky&&r.ch!==n.startPos.ch?this.yasqe.state.completionActive.startPos=r:n&&!r.sticky&&r.ch"]/,completeSingle:!1,hint:i,container:this.yasqe.rootEl,extraKeys:{Home:function(e,t){e.getDoc().setCursor({ch:0,line:t.data.from.line})},End:function(e,t){e.getDoc().setCursor({ch:e.getLine(t.data.to.line).length,line:t.data.to.line})}}},this.yasqe.config.hintConfig);return this.yasqe.showHint(o),!0}}]),n}(G.EventEmitter);function me(e,t){var n=e.getPrefixesFromQuery(),r=t.string;if(r.indexOf("<")<0&&(t.tokenPrefix=r.substring(0,r.indexOf(":")+1),null!=n[t.tokenPrefix.slice(0,-1)]&&(t.tokenPrefixUri=n[t.tokenPrefix.slice(0,-1)])),t.autocompletionString=r.trim(),r.indexOf("<")<0&&r.indexOf(":")>-1)for(var i in n)if(t.tokenPrefix===i+":"){t.autocompletionString=n[i],t.autocompletionString+=r.substring(i.length+1);break}return 0==t.autocompletionString.indexOf("<")&&(t.autocompletionString=t.autocompletionString.substring(1)),t.autocompletionString.indexOf(">",t.autocompletionString.length-1)>0&&(t.autocompletionString=t.autocompletionString.substring(0,t.autocompletionString.length-1)),t}function ye(e,t,n){return n=t.tokenPrefix&&t.autocompletionString&&t.tokenPrefixUri?t.tokenPrefix+n.substring(t.tokenPrefixUri.length):"<"+n+">"}var Ee=function(e,t,n){var r=0===window.location.protocol.indexOf("http")?"https://":"http://",i="autocomplete_"+t;return n&&n.string&&0!=n.string.trim().length?v.get(r+"lov.linkeddata.es/dataset/lov/api/v2/autocomplete/terms").query({q:n.autocompletionString,page_size:50,type:t}).then((function(e){return e.body.results?e.body.results.map((function(e){return e.uri[0]})):[]}),(function(t){e.showNotification(i,"Failed fetching suggestions")})):(e.showNotification(i,"Nothing to autocomplete yet!"),Promise.resolve([]))},be=[V,ue,ce,pe],xe=n(171);var Se=n(7);n(92),n(99),n(100),n(101),n(162),n(122),n(163),n(102),n(166),n(103),n(167),n(168),Se.registerHelper("fold","prefix",(function(e,t){var n=t.line,r=e.getDoc().getLine(n);var i=function(t,n){var r=e.getTokenAt(y.a.Pos(t,n+1));if(!r||"keyword"!=r.type)return-1;var i=b(e,t,r.end+1);if(!i||"string-2"!=i.type)return-1;var o=b(e,t,i.end+1);return o&&"variable-3"==o.type?o.end:-1};if(!function(){for(var t=!1,r=n-1;r>=0;r--)if(e.getDoc().getLine(r).toUpperCase().indexOf("PREFIX ")>=0){t=!0;break}return t}()){var o=S(e,n,t.ch,r);if(null!=o){for(var a,s=!1,l=e.getDoc().lastLine(),u=i(n,o),c=n,p=n;p<=l&&!s;++p)for(var h=e.getDoc().getLine(p),f=p==n?o+1:0;;){!s&&h.indexOf("{")>=0&&(s=!0);var d=h.toUpperCase().indexOf("PREFIX ",f);if(!(d>=0))break;(a=i(p,d))>0&&(c=p,f=u=a),f++}return{from:y.a.Pos(n,o+"PREFIX ".length),to:y.a.Pos(c,u)}}}})),Se.defineMode("sparql11",(function(e){var t=n(161),r=t.table,i="[0-9A-Fa-f]",o="(([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD])(((([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]))|\\.)*(([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])))?)?:",a="[eE][\\+-]?[0-9]+",s="[0-9]*\\.[0-9]+",l="(([0-9]+\\.[0-9]*"+a+")|(\\.[0-9]+"+a+")|([0-9]+"+a+"))",u="\\\\[tbnrf\\\\\"']",c=i+"{4}",p="(\\\\u"+c+"|\\\\U00(10|0"+i+")"+c+")",h={SINGLE:{CAT:"STRING_LITERAL_LONG1",QUOTES:"'''",CONTENTS:"(('|'')?([^'\\\\]|"+u+"|"+p+"))*"},DOUBLE:{CAT:"STRING_LITERAL_LONG2",QUOTES:'"""',CONTENTS:'(("|"")?([^"\\\\]|'+u+"|"+p+"))*"}};for(var f in h)h[f].COMPLETE=h[f].QUOTES+h[f].CONTENTS+h[f].QUOTES;var d={};for(var g in h)d[g]={complete:{name:"STRING_LITERAL_LONG_"+g,regex:new RegExp("^"+h[g].COMPLETE),style:"string"},contents:{name:"STRING_LITERAL_LONG_"+g,regex:new RegExp("^"+h[g].CONTENTS),style:"string"},closing:{name:"STRING_LITERAL_LONG_"+g,regex:new RegExp("^"+h[g].CONTENTS+h[g].QUOTES),style:"string"},quotes:{name:"STRING_LITERAL_LONG_QUOTES_"+g,regex:new RegExp("^"+h[g].QUOTES),style:"string"}};var v="[\\x20\\x09\\x0D\\x0A]",m="#([^\\n\\r]*[\\n\\r]|[^\\n\\r]*$)",y=[{name:"WS",regex:new RegExp("^"+v+"+"),style:"ws"},{name:"COMMENT",regex:new RegExp("^"+m),style:"comment"},{name:"IRI_REF",regex:new RegExp('^<[^<>"`|{}^\\\0- ]*>'),style:"variable-3"},{name:"VAR1",regex:new RegExp("^\\?([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|[0-9])([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])*"),style:"atom"},{name:"VAR2",regex:new RegExp("^\\$([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|[0-9])([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])*"),style:"atom"},{name:"LANGTAG",regex:new RegExp("^@[a-zA-Z]+(-[a-zA-Z0-9]+)*"),style:"meta"},{name:"DOUBLE",regex:new RegExp("^"+l),style:"number"},{name:"DECIMAL",regex:new RegExp("^"+s),style:"number"},{name:"INTEGER",regex:new RegExp("^[0-9]+"),style:"number"},{name:"DOUBLE_POSITIVE",regex:new RegExp("^\\+(([0-9]+\\.[0-9]*[eE][\\+-]?[0-9]+)|(\\.[0-9]+[eE][\\+-]?[0-9]+)|([0-9]+[eE][\\+-]?[0-9]+))"),style:"number"},{name:"DECIMAL_POSITIVE",regex:new RegExp("^\\+[0-9]*\\.[0-9]+"),style:"number"},{name:"INTEGER_POSITIVE",regex:new RegExp("^\\+[0-9]+"),style:"number"},{name:"DOUBLE_NEGATIVE",regex:new RegExp("^-(([0-9]+\\.[0-9]*[eE][\\+-]?[0-9]+)|(\\.[0-9]+[eE][\\+-]?[0-9]+)|([0-9]+[eE][\\+-]?[0-9]+))"),style:"number"},{name:"DECIMAL_NEGATIVE",regex:new RegExp("^-[0-9]*\\.[0-9]+"),style:"number"},{name:"INTEGER_NEGATIVE",regex:new RegExp("^-[0-9]+"),style:"number"},{name:"STRING_LITERAL1",regex:new RegExp("^'(([^\\x27\\x5C\\x0A\\x0D])|\\\\[tbnrf\\\\\"']|(\\\\u[0-9A-Fa-f]{4}|\\\\U00(10|0[0-9A-Fa-f])[0-9A-Fa-f]{4}))*'"),style:"string"},{name:"STRING_LITERAL2",regex:new RegExp('^"(([^\\x22\\x5C\\x0A\\x0D])|\\\\[tbnrf\\\\"\']|(\\\\u[0-9A-Fa-f]{4}|\\\\U00(10|0[0-9A-Fa-f])[0-9A-Fa-f]{4}))*"'),style:"string"},{name:"NIL",regex:new RegExp("^\\(([\\x20\\x09\\x0D\\x0A]|(#([^\\n\\r]*[\\n\\r]|[^\\n\\r]*$)))*\\)"),style:"punc"},{name:"ANON",regex:new RegExp("^\\[([\\x20\\x09\\x0D\\x0A]|(#([^\\n\\r]*[\\n\\r]|[^\\n\\r]*$)))*\\]"),style:"punc"},{name:"PNAME_LN",regex:new RegExp("^(([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD])(((([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]))|\\.)*(([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])))?)?:([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|:|[0-9]|((%[0-9A-Fa-f][0-9A-Fa-f])|(\\\\[_~\\.\\-!\\$&'\\(\\)\\*\\+,;=/\\?#@%])))((([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])|\\.|:|((%[0-9A-Fa-f][0-9A-Fa-f])|(\\\\[_~\\.\\-!\\$&'\\(\\)\\*\\+,;=/\\?#@%])))*(([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])|:|((%[0-9A-Fa-f][0-9A-Fa-f])|(\\\\[_~\\.\\-!\\$&'\\(\\)\\*\\+,;=/\\?#@%]))))?"),style:"string-2"},{name:"PNAME_NS",regex:new RegExp("^"+o),style:"string-2"},{name:"BLANK_NODE_LABEL",regex:new RegExp("^_:([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|[0-9])((([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])|\\.)*([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]))?"),style:"string-2"}];function E(e){var t=[],n=r[e];if(null!=n)for(var i in n)t.push(i.toString());else t.push(e);return t}function b(e,n){function i(){var t=e.column();n.errorStartPos=t,n.errorEndPos=t+l.string.length}function o(e){if(null==n.queryType)switch(e){case"SELECT":case"CONSTRUCT":case"ASK":case"DESCRIBE":case"INSERT":case"DELETE":case"LOAD":case"CLEAR":case"CREATE":case"DROP":case"COPY":case"MOVE":case"ADD":n.queryType=e}}function a(e){switch(n.inPrefixDecl="prefixDecl"===e,e){case"disallowVars":n.allowVars=!1;break;case"allowVars":n.allowVars=!0;break;case"disallowBnodes":n.allowBnodes=!1;break;case"allowBnodes":n.allowBnodes=!0;break;case"storeProperty":n.storeProperty=!0}}function s(e){return(n.allowVars||"var"!=e)&&(n.allowBnodes||"blankNode"!=e&&"blankNodePropertyList"!=e&&"blankNodePropertyListPath"!=e)}0==e.pos&&(n.possibleCurrent=n.possibleNext);var l=function(){var r;if(n.inLiteral){var i=!1;if((r=e.match(d[n.inLiteral].contents.regex,!0,!1))&&0==r[0].length&&(r=e.match(d[n.inLiteral].closing.regex,!0,!1),i=!0),r&&r[0].length>0){var o={quotePos:i?"end":"content",cat:h[n.inLiteral].CAT,style:d[n.inLiteral].complete.style,string:r[0],start:e.start};return i&&(n.inLiteral=void 0),o}}for(var a in d){var s;if(r=e.match(d[a].quotes.regex,!0,!1))return n.inLiteral?(n.inLiteral=void 0,s="end"):(n.inLiteral=a,s="start"),{cat:h[a].CAT,style:d[a].quotes.style,string:r[0],quotePos:s,start:e.start}}for(var l=0;l",style:"error",string:(r=e.match(/^.[A-Za-z0-9]*/,!0,!1))[0],start:e.start,quotePos:void 0}}();if(""==l.cat)return 1==n.OK&&(n.OK=!1,i()),n.complete=!1,l.style;if("WS"===l.cat||"COMMENT"===l.cat||l.quotePos&&"end"!=l.quotePos)return n.possibleCurrent=n.possibleNext,n.possibleFullIri=!1,l.style;var u,c=!1,p=l.cat;if(n.possibleFullIri&&">"===l.string&&(n.possibleFullIri=!1),n.possibleFullIri||"<"!==l.string||(n.possibleFullIri=!0),!l.quotePos||"end"==l.quotePos)for(;n.stack.length>0&&p&&n.OK&&!c;)if("var"===(u=n.stack.pop())&&l.string&&(n.variables[l.string]=l.string),r[u]){var f=r[u][p];if(null!=f&&s(u)){for(var g=f.length-1;g>=0;--g)n.stack.push(f[g]);a(u)}else n.OK=!1,n.complete=!1,i(),n.stack.push(u)}else if(u==p){n.inPrefixDecl&&("PNAME_NS"===u&&l.string.length>0?n.currentPnameNs=l.string.slice(0,-1):"string"==typeof n.currentPnameNs&&l.string.length>1&&(n.prefixes[n.currentPnameNs]=l.string.slice(1,-1),n.currentPnameNs=void 0)),c=!0,o(u);for(var v=!0,m=n.stack.length;m>0;--m){var b=r[n.stack[m-1]];b&&b.$||(v=!1)}if(n.complete=v,n.storeProperty&&"punc"!=p?(n.lastProperty=l.string,n.lastPropertyIndex=l.start,n.storeProperty=!1):"."!==p&&";"!==p||(n.lastProperty="",n.lastPropertyIndex=0),!n.inPrefixDecl&&("PNAME_NS"===p||"PNAME_LN"===p)){var x=l.string.indexOf(":");if(x>=0){var S=l.string.slice(0,x);void 0===n.prefixes[S]&&(n.OK=!1,i(),n.errorMsg="Prefix '"+S+"' is not defined")}}}else n.OK=!1,n.complete=!1,i();if(!c&&n.OK&&(n.OK=!1,n.complete=!1,i()),n.possibleNext.indexOf("a")>=0)for(var T=e.string,C=l.start;C>=0;C--)if(" "!==T[C-1]){"|"===T[C-1]||"/"===T[C-1]||"punc"===l.style||(n.lastPredicateOffset=l.start);break}return n.possibleCurrent=n.possibleNext,n.possibleNext=E(n.stack[n.stack.length-1]),l.style}var x={"*[,, object]":3,"*[(,),object]":3,"*[(,),objectPath]":3,"*[/,pathEltOrInverse]":2,object:2,objectPath:2,objectList:2,objectListPath:2,storeProperty:2,pathMod:2,"?pathMod":2,propertyListNotEmpty:1,propertyList:1,propertyListPath:1,propertyListPathNotEmpty:1,"?[verb,objectList]":1},S={"}":1,"]":1,")":1,"{":-1,"(":-1,"[":-1};return{token:b,startState:function(){return{tokenize:b,OK:!0,complete:t.acceptEmpty,errorStartPos:void 0,errorEndPos:void 0,queryType:void 0,possibleCurrent:E(t.startSymbol),possibleNext:E(t.startSymbol),allowVars:!0,allowBnodes:!0,storeProperty:!1,lastProperty:"",lastPropertyIndex:0,inLiteral:void 0,stack:[t.startSymbol],lastPredicateOffset:e.indentUnit||2,prefixes:{},variables:{},currentPnameNs:void 0,errorMsg:void 0,inPrefixDecl:!1,possibleFullIri:!1}},indent:function(t,n){var r;if(t.inLiteral)return 0;if(void 0!==t.lastPredicateOffset&&t.stack.length&&"?[or([verbPath,verbSimple]),objectListPath]"==t.stack[t.stack.length-1])return t.lastPredicateOffset;var i=0,o=t.stack.length-1;if(/^[\}\]\)]/.test(n)){for(var a=n.substr(0,1);o>=0;--o)if(t.stack[o]==a){--o;break}}else{var s=x[t.stack[o]];s&&(i+=s,--o)}for(;o>=0;--o){var l=S[t.stack[o]];l&&(i+=l)}return i*(null!==(r=e.indentUnit)&&void 0!==r?r:2)},electricChars:"}])"}}));var Te=Se;function Ce(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ae(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ae(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:{};if(o()(this,n),(r=t.call(this)).autocompleters={},r.prevQueryValid=!1,r.queryValid=!0,r.superagent=v,r.handleHashChange=function(){var e,t;null===(t=(e=r.config).consumeShareLink)||void 0===t||t.call(e,u()(r))},r.notificationEls={},!e)throw new Error("No parent passed as argument. Dont know where to draw YASQE");r.rootEl=document.createElement("div"),r.rootEl.className="yasqe",e.appendChild(r.rootEl),r.config=Object(_.a)({},n.defaults,i);var a,s=Te(r.rootEl,r.config),l=Ce(Object.getOwnPropertyNames(n.prototype));try{for(l.s();!(a=l.n()).done;){var c=a.value;s[c]=n.prototype[c].bind(u()(r))}}catch(e){l.e(e)}finally{l.f()}Object.assign(u()(r),Te.prototype,s),r.storage=new C.a(n.storageNamespace),r.drawButtons();var p=r.getStorageId();if(p){var h=r.storage.get(p);r.persistentConfig=h&&"string"==typeof h?{query:h,editorHeight:r.config.editorHeight}:h,r.persistentConfig||(r.persistentConfig={query:r.getValue(),editorHeight:r.config.editorHeight}),r.persistentConfig&&r.persistentConfig.query&&r.setValue(r.persistentConfig.query)}return r.config.autocompleters.forEach((function(e){return r.enableCompleter(e).then((function(){}),console.warn)})),r.config.consumeShareLink&&(r.config.consumeShareLink(u()(r)),window.addEventListener("hashchange",r.handleHashChange)),r.checkSyntax(),r.persistentConfig&&r.persistentConfig.editorHeight?r.getWrapperElement().style.height=r.persistentConfig.editorHeight:r.config.editorHeight&&(r.getWrapperElement().style.height=r.config.editorHeight),r.config.resizeable&&r.drawResizer(),r.config.collapsePrefixesOnLoad&&r.collapsePrefixes(!0),r.registerEventListeners(),r}return s()(n,[{key:"handleChange",value:function(){this.checkSyntax(),this.updateQueryButton()}},{key:"handleBlur",value:function(){this.saveQuery()}},{key:"handleChanges",value:function(){this.checkSyntax(),this.updateQueryButton()}},{key:"handleCursorActivity",value:function(){this.autocomplete(!0)}},{key:"handleQuery",value:function(e,t){this.req=t,this.updateQueryButton()}},{key:"handleQueryResponse",value:function(e,t,n){this.lastQueryDuration=n,this.req=void 0,this.updateQueryButton()}},{key:"handleQueryAbort",value:function(e,t){this.req=void 0,this.updateQueryButton()}},{key:"registerEventListeners",value:function(){this.on("change",this.handleChange),this.on("blur",this.handleBlur),this.on("changes",this.handleChanges),this.on("cursorActivity",this.handleCursorActivity),this.on("query",this.handleQuery),this.on("queryResponse",this.handleQueryResponse),this.on("queryAbort",this.handleQueryAbort)}},{key:"unregisterEventListeners",value:function(){this.off("change",this.handleChange),this.off("blur",this.handleBlur),this.off("changes",this.handleChanges),this.off("cursorActivity",this.handleCursorActivity),this.off("query",this.handleQuery),this.off("queryResponse",this.handleQueryResponse),this.off("queryAbort",this.handleQueryAbort)}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r'),s=document.createElement("button");s.className="yasqe_share",s.title="Share query",s.setAttribute("aria-label","Share query"),s.appendChild(a),t.appendChild(s),s.addEventListener("click",(function(e){return l(e)})),s.addEventListener("keydown",(function(e){"Enter"===e.code&&l(e)}));var l=function(n){n.stopPropagation();var r=document.createElement("div");r.className="yasqe_sharePopup",t.appendChild(r),document.body.addEventListener("click",(function(e){r&&e.target!==r&&!r.contains(e.target)&&(r.remove(),r=void 0)}),!0);var i=document.createElement("input");i.type="text",i.value=e.config.createShareableLink(e),i.onfocus=function(){i.select()},i.onmouseup=function(){return!1},r.innerHTML="";var o=document.createElement("div");o.className="inputWrapper",o.appendChild(i),r.appendChild(o);var s=[],l=e.config.createShortLink;if(l){r.className=r.className+=" enableShort";var u=document.createElement("button");s.push(u),u.innerHTML="Shorten",u.className="yasqe_btn yasqe_btn-sm shorten",r.appendChild(u),u.onclick=function(){s.forEach((function(e){return e.disabled=!0})),l(e,i.value).then((function(e){i.value=e,i.focus()}),(function(e){var t=document.createElement("span");t.className="shortlinkErr";var n="An error has occurred";"string"==typeof e&&0!==e.length?n=e:e.message&&0!==e.message.length&&(n=e.message),t.textContent=n,i.replaceWith(t)}))}}var c=document.createElement("button");s.push(c),c.innerText="cURL",c.className="yasqe_btn yasqe_btn-sm curl",r.appendChild(c),c.onclick=function(){s.forEach((function(e){return e.disabled=!0})),i.value=e.getAsCurlString(),i.focus(),null==r||r.appendChild(c)};var p=a.getBoundingClientRect();r.style.top=a.offsetTop+p.height+"px",r.style.left=a.offsetLeft+a.clientWidth-r.clientWidth+"px",i.focus()}}if(this.config.showQueryButton){this.queryBtn=document.createElement("button"),Object(C.b)(this.queryBtn,"yasqe_queryButton");var u=Object(C.d)('');Object(C.b)(u,"queryIcon"),this.queryBtn.appendChild(u);var c=Object(C.d)(F);Object(C.b)(c,"warningIcon"),this.queryBtn.appendChild(c),this.queryBtn.onclick=function(){e.config.queryingDisabled||(e.req?e.abortQuery():e.query().catch((function(){})))},this.queryBtn.title="Run query",this.queryBtn.setAttribute("aria-label","Run query"),t.appendChild(this.queryBtn),this.updateQueryButton()}}},{key:"drawResizer",value:function(){if(!this.resizeWrapper){this.resizeWrapper=document.createElement("div"),Object(C.b)(this.resizeWrapper,"resizeWrapper");var e=document.createElement("div");Object(C.b)(e,"resizeChip"),this.resizeWrapper.appendChild(e),this.resizeWrapper.addEventListener("mousedown",this.initDrag,!1),this.resizeWrapper.addEventListener("dblclick",this.expandEditor),this.rootEl.appendChild(this.resizeWrapper)}}},{key:"initDrag",value:function(){document.documentElement.addEventListener("mousemove",this.doDrag,!1),document.documentElement.addEventListener("mouseup",this.stopDrag,!1)}},{key:"calculateDragOffset",value:function(e,t){var n=0;t.offsetParent&&(n=t.offsetParent.offsetTop);for(var r=0,i=t.parentElement;i;)r+=i.scrollTop,i=i.parentElement;return e.clientY-n-this.rootEl.offsetTop+r}},{key:"doDrag",value:function(e){this.getWrapperElement().style.height=this.calculateDragOffset(e,this.rootEl)+"px"}},{key:"stopDrag",value:function(){document.documentElement.removeEventListener("mousemove",this.doDrag,!1),document.documentElement.removeEventListener("mouseup",this.stopDrag,!1),this.emit("resize",this.getWrapperElement().style.height),this.getStorageId()&&this.persistentConfig&&(this.persistentConfig.editorHeight=this.getWrapperElement().style.height,this.saveQuery()),this.refresh()}},{key:"duplicateLine",value:function(){var e=this.getDoc().getCursor();if(e){var t=this.getDoc().getLine(e.line);this.getDoc().replaceRange(t+"\n"+t,{ch:0,line:e.line},{ch:t.length,line:e.line})}}},{key:"updateQueryButton",value:function(e){this.queryBtn&&(this.config.queryingDisabled?(Object(C.b)(this.queryBtn,"query_disabled"),this.queryBtn.title=this.config.queryingDisabled):(Object(C.g)(this.queryBtn,"query_disabled"),this.queryBtn.title="Run query",this.queryBtn.setAttribute("aria-label","Run query")),e||(e=this.queryValid?"valid":"error"),e!=this.queryStatus&&(Object(C.g)(this.queryBtn,"query_"+this.queryStatus),Object(C.b)(this.queryBtn,"query_"+e),this.queryStatus=e),this.req&&this.queryBtn.className.indexOf("busy")<0&&(this.queryBtn.className=this.queryBtn.className+=" busy"),!this.req&&this.queryBtn.className.indexOf("busy")>=0&&(this.queryBtn.className=this.queryBtn.className.replace("busy","")))}},{key:"handleLocalStorageQuotaFull",value:function(e){console.warn("Localstorage quota exceeded. Clearing all queries"),n.clearStorage()}},{key:"saveQuery",value:function(){var e=this.getStorageId();e&&this.persistentConfig&&(this.persistentConfig.query=this.getValue(),this.storage.set(e,this.persistentConfig,this.config.persistencyExpire,this.handleLocalStorageQuotaFull))}},{key:"getQueryType",value:function(){return this.getOption("queryType")}},{key:"getQueryMode",value:function(){switch(this.getQueryType()){case"INSERT":case"DELETE":case"LOAD":case"CLEAR":case"CREATE":case"DROP":case"COPY":case"MOVE":case"ADD":return"update";default:return"query"}}},{key:"getVariablesFromQuery",value:function(){var e=this.getTokenAt({line:this.getDoc().lastLine(),ch:this.getDoc().getLine(this.getDoc().lastLine()).length},!0),t=[];for(var n in e.state.variables)t.push(n);return t.sort()}},{key:"autoformatSelection",value:function(e,t){var r=this.getValue();return r=r.substring(e,t),n.autoformatString(r)}},{key:"commentLines",value:function(){for(var e=this.getDoc().getCursor("start").line,t=this.getDoc().getCursor("end").line,n=Math.min(e,t),r=Math.max(e,t),i=!0,o=n;o<=r;o++){var a=this.getDoc().getLine(o);if(0==a.length||"#"!=a.substring(0,1)){i=!1;break}}for(o=n;o<=r;o++)i?this.getDoc().replaceRange("",{line:o,ch:0},{line:o,ch:1}):this.getDoc().replaceRange("#",{line:o,ch:0})}},{key:"autoformat",value:function(){var e=this;this.getDoc().somethingSelected()||this.execCommand("selectAll");var t=this.getDoc().getCursor("start"),n={line:this.getDoc().getCursor("end").line,ch:this.getDoc().getSelection().length},r=this.getDoc().indexFromPos(t),i=this.getDoc().indexFromPos(n),o=this.autoformatSelection(r,i);this.operation((function(){e.getDoc().replaceRange(o,t,n);for(var i=e.getDoc().posFromIndex(r).line,a=e.getDoc().posFromIndex(r+o.length).line,s=i;s<=a;s++)e.indentLine(s,"smart")}))}},{key:"getQueryWithValues",value:function(e){if(!e)return this.getValue();var t;if("string"==typeof e)t=e;else{e instanceof Array||(e=[e]);var r=e.reduce((function(e,t){for(var n in t)e[n]=n;return e}),{}),i=[];for(var o in r)i.push(o);if(!i.length)return this.getValue();t="VALUES ("+i.join(" ")+") {\n",e.forEach((function(e){t+="( ",i.forEach((function(n){t+=e[n]||"UNDEF"})),t+=" )\n"})),t+="}\n"}if(!t)return this.getValue();var a="",s=!1,l=!1;return n.runMode(this.getValue(),"sparql11",(function(e,n,r,i,o){"keyword"===n&&"select"===e.toLowerCase()&&(l=!0),a+=e,l&&!s&&"punc"===n&&"{"===e&&(s=!0,a+="\n"+t)})),a}},{key:"getValueWithoutComments",value:function(){var e="";return n.runMode(this.getValue(),"sparql11",(function(t,n){"comment"!=n&&(e+=t)})),e}},{key:"setCheckSyntaxErrors",value:function(e){this.config.syntaxErrorCheck=e,this.checkSyntax()}},{key:"checkSyntax",value:function(){this.queryValid=!0,this.clearGutter("gutterErrorBar");for(var e=0;e0){var l=[];r.possibleCurrent.forEach((function(e){l.push(""+Object(xe.a)(e)+"")})),L(0,s,"This line is invalid. Expected: "+l.join(", "))}s.className="parseErrorIcon",this.setGutterMarker(e,"gutterErrorBar",s),this.queryValid=!1;break}}}},{key:"getCompleteToken",value:function(e,t){return E(this,e,t)}},{key:"getPreviousNonWsToken",value:function(e,t){return function e(t,n,r){var i=t.getTokenAt({line:n,ch:r.start});return null!=i&&"ws"==i.type&&(i=e(t,n,i)),i}(this,e,t)}},{key:"getNextNonWsToken",value:function(e,t){return b(this,e,t)}},{key:"showNotification",value:function(e,t){if(!this.notificationEls[e]){var n=document.createElement("div");Object(C.b)(n,"notificationContainer"),this.getWrapperElement().appendChild(n),this.notificationEls[e]=document.createElement("div"),Object(C.b)(this.notificationEls[e],"notification","notif_"+e),n.appendChild(this.notificationEls[e])}for(var r in this.notificationEls)r!==e&&this.hideNotification(r);var i=this.notificationEls[e];Object(C.b)(i,"active"),i.innerText=t}},{key:"hideNotification",value:function(e){this.notificationEls[e]&&Object(C.g)(this.notificationEls[e],"active")}},{key:"enableCompleter",value:function(e){return n.Autocompleters[e]?(this.config.autocompleters.indexOf(e)<0&&this.config.autocompleters.push(e),(this.autocompleters[e]=new ve(this,n.Autocompleters[e])).initialize()):Promise.reject(new Error("Autocompleter "+e+" is not a registered autocompleter"))}},{key:"disableCompleter",value:function(e){this.config.autocompleters=this.config.autocompleters.filter((function(t){return t!==e})),this.autocompleters[e]=void 0}},{key:"autocomplete",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.getDoc().somethingSelected())for(var t in this.config.autocompleters){var n=this.autocompleters[this.config.autocompleters[t]];n&&n.autocomplete(e)}}},{key:"collapsePrefixes",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=x(this);void 0!==t&&this.foldCode(t,Te.fold.prefix,e?"fold":"unfold")}},{key:"getPrefixesFromQuery",value:function(){return(e=this).getTokenAt({line:e.getDoc().lastLine(),ch:e.getDoc().getLine(e.getDoc().lastLine()).length},!0).state.prefixes;var e}},{key:"addPrefixes",value:function(e){return function(e,t){var n=e.getPrefixesFromQuery();if("string"==typeof t)T(e,t);else for(var r in t)r in n||T(e,r+": <"+t[r]+">");e.collapsePrefixes(!1)}(this,e)}},{key:"removePrefixes",value:function(e){return function(e,t){for(var n in t)e.setValue(e.getValue().replace(new RegExp("PREFIX\\s*"+n+":\\s*"+(("<"+t[n]+">").replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"\\s*"),"ig"),""));e.collapsePrefixes(!1)}(this,e)}},{key:"updateWidget",value:function(){if(this.cursorCoords&&this.state.completionActive&&this.state.completionActive.widget){var e=this.cursorCoords(null).bottom;this.state.completionActive.widget.hints.style.top=e+"px"}}},{key:"query",value:function(e){return this.config.queryingDisabled?Promise.reject("Querying is disabled."):(this.abortQuery(),P(this,e))}},{key:"getUrlParams",value:function(){var e={};return window.location.hash.length>1&&(e=A.parse(location.hash)),e&&"query"in e||!(window.location.search.length>1)||(e=A.parse(window.location.search)),e}},{key:"configToQueryParams",value:function(){var e={};return window.location.hash.length>1&&(e=A.parse(window.location.hash)),e.query=this.getValue(),e}},{key:"queryParamsToConfig",value:function(e){e&&e.query&&"string"==typeof e.query&&this.setValue(e.query)}},{key:"getAsCurlString",value:function(e){return j(this,e)}},{key:"abortQuery",value:function(){this.req&&(this.req.abort(),this.emit("queryAbort",this,this.req))}},{key:"expandEditor",value:function(){this.setSize(null,"100%")}},{key:"destroy",value:function(){var e,t;for(var n in this.abortQuery(),this.unregisterEventListeners(),null===(e=this.resizeWrapper)||void 0===e||e.removeEventListener("mousedown",this.initDrag,!1),null===(t=this.resizeWrapper)||void 0===t||t.removeEventListener("dblclick",this.expandEditor),this.autocompleters)this.disableCompleter(n);window.removeEventListener("hashchange",this.handleHashChange),this.rootEl.remove()}}],[{key:"autoformatString",value:function(e){var t=[["keyword","ws","string-2","ws","variable-3"],["keyword","ws","variable-3"]],r=["}"],i="",o="",a=[];return n.runMode(e,"sparql11",(function(e,n){a.push(n);var s=function(e){if("{"===e)return 1;if("."===e)return 1;if(";"===e)return a.length>2&&"punc"===a[a.length-2]?0:1;for(var n=0;n1&&void 0!==arguments[1])||arguments[1],r=e.name;n.Autocompleters[r]=e,t&&n.defaults.autocompleters.indexOf(r)<0&&n.defaults.autocompleters.push(r)}},{key:"forkAutocompleter",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!n.Autocompleters[e])throw new Error("Autocompleter "+e+" does not exist");if(!(null==t?void 0:t.name))throw new Error("Expected a name for newly registered autocompleter");var i=t.name;n.Autocompleters[i]=Object.assign(Object.assign({},n.Autocompleters[e]),t),r&&n.defaults.autocompleters.indexOf(i)<0&&n.defaults.autocompleters.push(i)}}]),n}(Te);_e.storageNamespace="triply",_e.Sparql=r,_e.runMode=Te.runMode,_e.Autocompleters={},_e.defaults=(Ne=n(7),Ie={mode:"sparql11",value:"PREFIX rdf: \nPREFIX rdfs: \nSELECT * WHERE {\n ?sub ?pred ?obj .\n} LIMIT 10",highlightSelectionMatches:{showToken:/\w/},tabMode:"indent",lineNumbers:!0,lineWrapping:!0,foldGutter:{rangeFinder:new Ne.fold.combine(Ne.fold.brace,Ne.fold.prefix)},collapsePrefixesOnLoad:!1,gutters:["gutterErrorBar","CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,fixedGutter:!0,syntaxErrorCheck:!0,autocompleters:[],extraKeys:{"Ctrl-Space":function(e){e.autocomplete()},"Shift-Ctrl-K":function(e){var t=e,n=t.getDoc().getCursor().line;return n===t.getDoc().lastLine()&&n>1?t.getDoc().replaceRange("",{ch:t.getDoc().getLine(n-1).length,line:n-1},{ch:t.getDoc().getLine(n).length,line:n}):t.getDoc().replaceRange("",{ch:0,line:n},{ch:0,line:n+1})},"Ctrl-/":function(e){e.commentLines()},"Shift-Ctrl-D":function(e){e.duplicateLine()},"Shift-Ctrl-F":function(e){e.autoformat()},"Ctrl-S":function(e){e.saveQuery()},"Cmd-Enter":function(e){e.query().catch((function(){}))},"Ctrl-Enter":function(e){e.query().catch((function(){}))},Esc:function(e){e.getInputField().blur()}},createShareableLink:function(e){return document.location.protocol+"//"+document.location.host+document.location.pathname+document.location.search+"#"+A.stringify(e.configToQueryParams())},pluginButtons:void 0,createShortLink:void 0,consumeShareLink:function(e){e.queryParamsToConfig(e.getUrlParams())},persistenceId:function(e){var t="",n=e.rootEl;for(n.id&&(t=n.id);n&&n!==document;n=n.parentNode)if(n){n.id&&(t=n.id);break}return"yasqe_"+t+"_query"},persistencyExpire:2592e3,showQueryButton:!0,hintConfig:{},resizeable:!0,editorHeight:"300px",queryingDisabled:void 0},we={queryArgument:void 0,endpoint:"https://dbpedia.org/sparql",method:"POST",acceptHeaderGraph:"application/n-triples,*/*;q=0.9",acceptHeaderSelect:"application/sparql-results+json,*/*;q=0.9",acceptHeaderUpdate:"text/plain,*/*;q=0.9",namedGraphs:[],defaultGraphs:[],args:[],headers:{},withCredentials:!1,adjustQueryBeforeRequest:!1},Object.assign(Object.assign({},Ie),{requestConfig:we})),Object.assign(Te.prototype,_e.prototype),be.forEach((function(e){_e.registerAutocompleter(e)}));t.default=_e},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,n){"use strict";t.a=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},function(e,t,n){"use strict";var r=n(79),i=n(70);t.a=function(e){return Object(r.a)((function(t,n){var r=-1,o=n.length,a=o>1?n[o-1]:void 0,s=o>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(o--,a):void 0,s&&Object(i.a)(n[0],n[1],s)&&(a=o<3?void 0:a,o=1),t=Object(t);++r0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(a);t.a=l},function(e,t,n){"use strict";var r=n(66),i=n(10);var o=function(e,t){return function(n,r){if(null==n)return n;if(!Object(i.a)(n))return e(n,r);for(var o=n.length,a=t?o:-1,s=Object(n);(t?a--:++at.firstLine();)n=e.Pos(n.line-1,0),u=l(!1);if(u&&!u.cleared&&"unfold"!==o){var c=function(e,t,n){var i=r(e,t,"widget");if("function"==typeof i&&(i=i(n.from,n.to)),"string"==typeof i){var o=document.createTextNode(i);(i=document.createElement("span")).appendChild(o),i.className="CodeMirror-foldmarker"}else i&&(i=i.cloneNode(!0));return i}(t,i,u);e.on(c,"mousedown",(function(t){p.clear(),e.e_preventDefault(t)}));var p=t.markText(u.from,u.to,{replacedWith:c,clearOnEnter:r(t,i,"clearOnEnter"),__isFold:!0});p.on("clear",(function(n,r){e.signal(t,"unfold",t,n,r)})),e.signal(t,"fold",t,u.from,u.to)}}e.newFoldFunction=function(e,n){return function(r,i){t(r,i,{rangeFinder:e,widget:n})}},e.defineExtension("foldCode",(function(e,n,r){t(this,e,n,r)})),e.defineExtension("isFolded",(function(e){for(var t=this.findMarksAt(e),n=0;n0&&t-1 in e)}T.fn=T.prototype={jquery:"3.5.1",constructor:T,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=T.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return T.each(this,e)},map:function(e){return this.pushStack(T.map(this,(function(t,n){return e.call(t,n,t)})))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(T.grep(this,(function(e,t){return(t+1)%2})))},odd:function(){return this.pushStack(T.grep(this,(function(e,t){return t%2})))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n+~]|"+j+")"+j+"*"),W=new RegExp(j+"|>"),z=new RegExp(G),Y=new RegExp("^"+F+"$"),X={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),TAG:new RegExp("^("+F+"|[*])"),ATTR:new RegExp("^"+B),PSEUDO:new RegExp("^"+G),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+j+"*(even|odd|(([+-]|)(\\d*)n|)"+j+"*(?:([+-]|)"+j+"*(\\d+)|))"+j+"*\\)|)","i"),bool:new RegExp("^(?:"+M+")$","i"),needsContext:new RegExp("^"+j+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+j+"*((?:-\\d)?\\d*)"+j+"*\\)|)(?=[^-]|$)","i")},$=/HTML$/i,J=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+j+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){h()},ae=be((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{D.apply(_=P.call(x.childNodes),x.childNodes),_[x.childNodes.length].nodeType}catch(e){D={apply:_.length?function(e,t){R.apply(e,P.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function se(e,t,r,i){var o,s,u,c,p,d,m,y=t&&t.ownerDocument,x=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==x&&9!==x&&11!==x)return r;if(!i&&(h(t),t=t||f,g)){if(11!==x&&(p=Z.exec(e)))if(o=p[1]){if(9===x){if(!(u=t.getElementById(o)))return r;if(u.id===o)return r.push(u),r}else if(y&&(u=y.getElementById(o))&&E(t,u)&&u.id===o)return r.push(u),r}else{if(p[2])return D.apply(r,t.getElementsByTagName(e)),r;if((o=p[3])&&n.getElementsByClassName&&t.getElementsByClassName)return D.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!N[e+" "]&&(!v||!v.test(e))&&(1!==x||"object"!==t.nodeName.toLowerCase())){if(m=e,y=t,1===x&&(W.test(e)||V.test(e))){for((y=ee.test(e)&&me(t.parentNode)||t)===t&&n.scope||((c=t.getAttribute("id"))?c=c.replace(re,ie):t.setAttribute("id",c=b)),s=(d=a(e)).length;s--;)d[s]=(c?"#"+c:":scope")+" "+Ee(d[s]);m=d.join(",")}try{return D.apply(r,y.querySelectorAll(m)),r}catch(t){N(e,!0)}finally{c===b&&t.removeAttribute("id")}}}return l(e.replace(H,"$1"),t,r,i)}function le(){var e=[];return function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}}function ue(e){return e[b]=!0,e}function ce(e){var t=f.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function pe(e,t){for(var n=e.split("|"),i=n.length;i--;)r.attrHandle[n[i]]=t}function he(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function de(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ge(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ae(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function ve(e){return ue((function(t){return t=+t,ue((function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))}))}))}function me(e){return e&&void 0!==e.getElementsByTagName&&e}for(t in n=se.support={},o=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!$.test(t||n&&n.nodeName||"HTML")},h=se.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:x;return a!=f&&9===a.nodeType&&a.documentElement?(d=(f=a).documentElement,g=!o(f),x!=f&&(i=f.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",oe,!1):i.attachEvent&&i.attachEvent("onunload",oe)),n.scope=ce((function(e){return d.appendChild(e).appendChild(f.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length})),n.attributes=ce((function(e){return e.className="i",!e.getAttribute("className")})),n.getElementsByTagName=ce((function(e){return e.appendChild(f.createComment("")),!e.getElementsByTagName("*").length})),n.getElementsByClassName=K.test(f.getElementsByClassName),n.getById=ce((function(e){return d.appendChild(e).id=b,!f.getElementsByName||!f.getElementsByName(b).length})),n.getById?(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];for(i=t.getElementsByName(e),r=0;o=i[r++];)if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&g)return t.getElementsByClassName(e)},m=[],v=[],(n.qsa=K.test(f.querySelectorAll))&&(ce((function(e){var t;d.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+j+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+j+"*(?:value|"+M+")"),e.querySelectorAll("[id~="+b+"-]").length||v.push("~="),(t=f.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+j+"*name"+j+"*="+j+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")})),ce((function(e){e.innerHTML="";var t=f.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+j+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),d.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")}))),(n.matchesSelector=K.test(y=d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ce((function(e){n.disconnectedMatch=y.call(e,"*"),y.call(e,"[s!='']:x"),m.push("!=",G)})),v=v.length&&new RegExp(v.join("|")),m=m.length&&new RegExp(m.join("|")),t=K.test(d.compareDocumentPosition),E=t||K.test(d.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},I=t?function(e,t){if(e===t)return p=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e==f||e.ownerDocument==x&&E(x,e)?-1:t==f||t.ownerDocument==x&&E(x,t)?1:c?k(c,e)-k(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return p=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==f?-1:t==f?1:i?-1:o?1:c?k(c,e)-k(c,t):0;if(i===o)return he(e,t);for(n=e;n=n.parentNode;)a.unshift(n);for(n=t;n=n.parentNode;)s.unshift(n);for(;a[r]===s[r];)r++;return r?he(a[r],s[r]):a[r]==x?-1:s[r]==x?1:0},f):f},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(h(e),n.matchesSelector&&g&&!N[t+" "]&&(!m||!m.test(t))&&(!v||!v.test(t)))try{var r=y.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){N(t,!0)}return se(t,f,null,[e]).length>0},se.contains=function(e,t){return(e.ownerDocument||e)!=f&&h(e),E(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!=f&&h(e);var i=r.attrHandle[t.toLowerCase()],o=i&&w.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},se.escape=function(e){return(e+"").replace(re,ie)},se.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},se.uniqueSort=function(e){var t,r=[],i=0,o=0;if(p=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(I),p){for(;t=e[o++];)t===e[o]&&(i=r.push(o));for(;i--;)e.splice(r[i],1)}return c=null,e},i=se.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r++];)n+=i(t);return n},(r=se.selectors={cacheLength:50,createPseudo:ue,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return X.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&z.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=C[e+" "];return t||(t=new RegExp("(^|"+j+")"+e+"("+j+"|$)"))&&C(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(r){var i=se.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace(U," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,h,f,d,g=o!==a?"nextSibling":"previousSibling",v=t.parentNode,m=s&&t.nodeName.toLowerCase(),y=!l&&!s,E=!1;if(v){if(o){for(;g;){for(h=t;h=h[g];)if(s?h.nodeName.toLowerCase()===m:1===h.nodeType)return!1;d=g="only"===e&&!d&&"nextSibling"}return!0}if(d=[a?v.firstChild:v.lastChild],a&&y){for(E=(f=(u=(c=(p=(h=v)[b]||(h[b]={}))[h.uniqueID]||(p[h.uniqueID]={}))[e]||[])[0]===S&&u[1])&&u[2],h=f&&v.childNodes[f];h=++f&&h&&h[g]||(E=f=0)||d.pop();)if(1===h.nodeType&&++E&&h===t){c[e]=[S,f,E];break}}else if(y&&(E=f=(u=(c=(p=(h=t)[b]||(h[b]={}))[h.uniqueID]||(p[h.uniqueID]={}))[e]||[])[0]===S&&u[1]),!1===E)for(;(h=++f&&h&&h[g]||(E=f=0)||d.pop())&&((s?h.nodeName.toLowerCase()!==m:1!==h.nodeType)||!++E||(y&&((c=(p=h[b]||(h[b]={}))[h.uniqueID]||(p[h.uniqueID]={}))[e]=[S,E]),h!==t)););return(E-=i)===r||E%r==0&&E/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||se.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?ue((function(e,n){for(var r,o=i(e,t),a=o.length;a--;)e[r=k(e,o[a])]=!(n[r]=o[a])})):function(e){return i(e,0,n)}):i}},pseudos:{not:ue((function(e){var t=[],n=[],r=s(e.replace(H,"$1"));return r[b]?ue((function(e,t,n,i){for(var o,a=r(e,null,i,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))})):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}})),has:ue((function(e){return function(t){return se(e,t).length>0}})),contains:ue((function(e){return e=e.replace(te,ne),function(t){return(t.textContent||i(t)).indexOf(e)>-1}})),lang:ue((function(e){return Y.test(e||"")||se.error("unsupported lang: "+e),e=e.replace(te,ne).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:ge(!1),disabled:ge(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return J.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ve((function(){return[0]})),last:ve((function(e,t){return[t-1]})),eq:ve((function(e,t,n){return[n<0?n+t:n]})),even:ve((function(e,t){for(var n=0;nt?t:n;--r>=0;)e.push(r);return e})),gt:ve((function(e,t,n){for(var r=n<0?n+t:n;++r1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function Se(e,t,n,r,i){for(var o,a=[],s=0,l=e.length,u=null!=t;s-1&&(o[u]=!(a[u]=p))}}else m=Se(m===a?m.splice(d,m.length):m),i?i(null,a,m,l):D.apply(a,m)}))}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],l=a?1:0,c=be((function(e){return e===t}),s,!0),p=be((function(e){return k(t,e)>-1}),s,!0),h=[function(e,n,r){var i=!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r));return t=null,i}];l1&&xe(h),l>1&&Ee(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(H,"$1"),n,l0,i=e.length>0,o=function(o,a,s,l,c){var p,d,v,m=0,y="0",E=o&&[],b=[],x=u,T=o||i&&r.find.TAG("*",c),C=S+=null==x?1:Math.random()||.1,A=T.length;for(c&&(u=a==f||a||c);y!==A&&null!=(p=T[y]);y++){if(i&&p){for(d=0,a||p.ownerDocument==f||(h(p),s=!g);v=e[d++];)if(v(p,a||f,s)){l.push(p);break}c&&(S=C)}n&&((p=!v&&p)&&m--,o&&E.push(p))}if(m+=y,n&&y!==m){for(d=0;v=t[d++];)v(E,b,a,s);if(o){if(m>0)for(;y--;)E[y]||b[y]||(b[y]=O.call(l));b=Se(b)}D.apply(l,b),c&&!o&&b.length>0&&m+t.length>1&&se.uniqueSort(l)}return c&&(S=C,u=x),E};return n?ue(o):o}(o,i))).selector=e}return s},l=se.select=function(e,t,n,i){var o,l,u,c,p,h="function"==typeof e&&e,f=!i&&a(e=h.selector||e);if(n=n||[],1===f.length){if((l=f[0]=f[0].slice(0)).length>2&&"ID"===(u=l[0]).type&&9===t.nodeType&&g&&r.relative[l[1].type]){if(!(t=(r.find.ID(u.matches[0].replace(te,ne),t)||[])[0]))return n;h&&(t=t.parentNode),e=e.slice(l.shift().value.length)}for(o=X.needsContext.test(e)?0:l.length;o--&&(u=l[o],!r.relative[c=u.type]);)if((p=r.find[c])&&(i=p(u.matches[0].replace(te,ne),ee.test(l[0].type)&&me(t.parentNode)||t))){if(l.splice(o,1),!(e=i.length&&Ee(l)))return D.apply(n,i),n;break}}return(h||s(e,f))(i,t,!g,n,!t||ee.test(e)&&me(t.parentNode)||t),n},n.sortStable=b.split("").sort(I).join("")===b,n.detectDuplicates=!!p,h(),n.sortDetached=ce((function(e){return 1&e.compareDocumentPosition(f.createElement("fieldset"))})),ce((function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")}))||pe("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),n.attributes&&ce((function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||pe("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),ce((function(e){return null==e.getAttribute("disabled")}))||pe(M,(function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null})),se}(n);T.find=A,T.expr=A.selectors,T.expr[":"]=T.expr.pseudos,T.uniqueSort=T.unique=A.uniqueSort,T.text=A.getText,T.isXMLDoc=A.isXML,T.contains=A.contains,T.escapeSelector=A.escape;var L=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&T(e).is(n))break;r.push(e)}return r},N=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},I=T.expr.match.needsContext;function w(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var _=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function O(e,t,n){return m(t)?T.grep(e,(function(e,r){return!!t.call(e,r,e)!==n})):t.nodeType?T.grep(e,(function(e){return e===t!==n})):"string"!=typeof t?T.grep(e,(function(e){return c.call(t,e)>-1!==n})):T.filter(t,e,n)}T.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?T.find.matchesSelector(r,e)?[r]:[]:T.find.matches(e,T.grep(t,(function(e){return 1===e.nodeType})))},T.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(T(e).filter((function(){for(t=0;t1?T.uniqueSort(n):n},filter:function(e){return this.pushStack(O(this,e||[],!1))},not:function(e){return this.pushStack(O(this,e||[],!0))},is:function(e){return!!O(this,"string"==typeof e&&I.test(e)?T(e):e||[],!1).length}});var R,D=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(T.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||R,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:D.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof T?t[0]:t,T.merge(this,T.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),_.test(r[1])&&T.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(T):T.makeArray(e,this)}).prototype=T.fn,R=T(E);var P=/^(?:parents|prev(?:Until|All))/,k={children:!0,contents:!0,next:!0,prev:!0};function M(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}T.fn.extend({has:function(e){var t=T(e,this),n=t.length;return this.filter((function(){for(var e=0;e-1:1===n.nodeType&&T.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?T.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?c.call(T(e),this[0]):c.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(T.uniqueSort(T.merge(this.get(),T(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),T.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return L(e,"parentNode")},parentsUntil:function(e,t,n){return L(e,"parentNode",n)},next:function(e){return M(e,"nextSibling")},prev:function(e){return M(e,"previousSibling")},nextAll:function(e){return L(e,"nextSibling")},prevAll:function(e){return L(e,"previousSibling")},nextUntil:function(e,t,n){return L(e,"nextSibling",n)},prevUntil:function(e,t,n){return L(e,"previousSibling",n)},siblings:function(e){return N((e.parentNode||{}).firstChild,e)},children:function(e){return N(e.firstChild)},contents:function(e){return null!=e.contentDocument&&a(e.contentDocument)?e.contentDocument:(w(e,"template")&&(e=e.content||e),T.merge([],e.childNodes))}},(function(e,t){T.fn[e]=function(n,r){var i=T.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=T.filter(r,i)),this.length>1&&(k[e]||T.uniqueSort(i),P.test(e)&&i.reverse()),this.pushStack(i)}}));var j=/[^\x20\t\r\n\f]+/g;function F(e){return e}function B(e){throw e}function G(e,t,n,r){var i;try{e&&m(i=e.promise)?i.call(e).done(t).fail(n):e&&m(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}T.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return T.each(e.match(j)||[],(function(e,n){t[n]=!0})),t}(e):T.extend({},e);var t,n,r,i,o=[],a=[],s=-1,l=function(){for(i=i||e.once,r=t=!0;a.length;s=-1)for(n=a.shift();++s-1;)o.splice(n,1),n<=s&&s--})),this},has:function(e){return e?T.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||l()),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!r}};return u},T.extend({Deferred:function(e){var t=[["notify","progress",T.Callbacks("memory"),T.Callbacks("memory"),2],["resolve","done",T.Callbacks("once memory"),T.Callbacks("once memory"),0,"resolved"],["reject","fail",T.Callbacks("once memory"),T.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},catch:function(e){return i.then(null,e)},pipe:function(){var e=arguments;return T.Deferred((function(n){T.each(t,(function(t,r){var i=m(e[r[4]])&&e[r[4]];o[r[1]]((function(){var e=i&&i.apply(this,arguments);e&&m(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[r[0]+"With"](this,i?[e]:arguments)}))})),e=null})).promise()},then:function(e,r,i){var o=0;function a(e,t,r,i){return function(){var s=this,l=arguments,u=function(){var n,u;if(!(e=o&&(r!==B&&(s=void 0,l=[n]),t.rejectWith(s,l))}};e?c():(T.Deferred.getStackHook&&(c.stackTrace=T.Deferred.getStackHook()),n.setTimeout(c))}}return T.Deferred((function(n){t[0][3].add(a(0,n,m(i)?i:F,n.notifyWith)),t[1][3].add(a(0,n,m(e)?e:F)),t[2][3].add(a(0,n,m(r)?r:B))})).promise()},promise:function(e){return null!=e?T.extend(e,i):i}},o={};return T.each(t,(function(e,n){var a=n[2],s=n[5];i[n[1]]=a.add,s&&a.add((function(){r=s}),t[3-e][2].disable,t[3-e][3].disable,t[0][2].lock,t[0][3].lock),a.add(n[3].fire),o[n[0]]=function(){return o[n[0]+"With"](this===o?void 0:this,arguments),this},o[n[0]+"With"]=a.fireWith})),i.promise(o),e&&e.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=s.call(arguments),o=T.Deferred(),a=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?s.call(arguments):n,--t||o.resolveWith(r,i)}};if(t<=1&&(G(e,o.done(a(n)).resolve,o.reject,!t),"pending"===o.state()||m(i[n]&&i[n].then)))return o.then();for(;n--;)G(i[n],a(n),o.reject);return o.promise()}});var U=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;T.Deferred.exceptionHook=function(e,t){n.console&&n.console.warn&&e&&U.test(e.name)&&n.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},T.readyException=function(e){n.setTimeout((function(){throw e}))};var H=T.Deferred();function q(){E.removeEventListener("DOMContentLoaded",q),n.removeEventListener("load",q),T.ready()}T.fn.ready=function(e){return H.then(e).catch((function(e){T.readyException(e)})),this},T.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--T.readyWait:T.isReady)||(T.isReady=!0,!0!==e&&--T.readyWait>0||H.resolveWith(E,[T]))}}),T.ready.then=H.then,"complete"===E.readyState||"loading"!==E.readyState&&!E.documentElement.doScroll?n.setTimeout(T.ready):(E.addEventListener("DOMContentLoaded",q),n.addEventListener("load",q));var V=function(e,t,n,r,i,o,a){var s=0,l=e.length,u=null==n;if("object"===S(n))for(s in i=!0,n)V(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,m(r)||(a=!0),u&&(a?(t.call(e,r),t=null):(u=t,t=function(e,t,n){return u.call(T(e),n)})),t))for(;s1,null,!0)},removeData:function(e){return this.each((function(){K.remove(this,e)}))}}),T.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Q.get(e,t),n&&(!r||Array.isArray(n)?r=Q.access(e,t,T.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=T.queue(e,t),r=n.length,i=n.shift(),o=T._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,(function(){T.dequeue(e,t)}),o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Q.get(e,n)||Q.access(e,n,{empty:T.Callbacks("once memory").add((function(){Q.remove(e,[t+"queue",n])}))})}}),T.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]*)/i,me=/^$|^module$|\/(?:java|ecma)script/i;fe=E.createDocumentFragment().appendChild(E.createElement("div")),(de=E.createElement("input")).setAttribute("type","radio"),de.setAttribute("checked","checked"),de.setAttribute("name","t"),fe.appendChild(de),v.checkClone=fe.cloneNode(!0).cloneNode(!0).lastChild.checked,fe.innerHTML="",v.noCloneChecked=!!fe.cloneNode(!0).lastChild.defaultValue,fe.innerHTML="",v.option=!!fe.lastChild;var ye={thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};function Ee(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&w(e,t)?T.merge([e],n):n}function be(e,t){for(var n=0,r=e.length;n",""]);var xe=/<|?\w+;/;function Se(e,t,n,r,i){for(var o,a,s,l,u,c,p=t.createDocumentFragment(),h=[],f=0,d=e.length;f-1)i&&i.push(o);else if(u=ae(o),a=Ee(p.appendChild(o),"script"),u&&be(a),n)for(c=0;o=a[c++];)me.test(o.type||"")&&n.push(o);return p}var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ae=/^([^.]*)(?:\.(.+)|)/;function Le(){return!0}function Ne(){return!1}function Ie(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function we(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)we(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Ne;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return T().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=T.guid++)),e.each((function(){T.event.add(this,t,i,r,n)}))}function _e(e,t,n){n?(Q.set(e,t,!1),T.event.add(e,t,{namespace:!1,handler:function(e){var r,i,o=Q.get(this,t);if(1&e.isTrigger&&this[t]){if(o.length)(T.event.special[t]||{}).delegateType&&e.stopPropagation();else if(o=s.call(arguments),Q.set(this,t,o),r=n(this,t),this[t](),o!==(i=Q.get(this,t))||r?Q.set(this,t,!1):i={},o!==i)return e.stopImmediatePropagation(),e.preventDefault(),i.value}else o.length&&(Q.set(this,t,{value:T.event.trigger(T.extend(o[0],T.Event.prototype),o.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,t)&&T.event.add(e,t,Le)}T.event={global:{},add:function(e,t,n,r,i){var o,a,s,l,u,c,p,h,f,d,g,v=Q.get(e);if($(e))for(n.handler&&(n=(o=n).handler,i=o.selector),i&&T.find.matchesSelector(oe,i),n.guid||(n.guid=T.guid++),(l=v.events)||(l=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(t){return void 0!==T&&T.event.triggered!==t.type?T.event.dispatch.apply(e,arguments):void 0}),u=(t=(t||"").match(j)||[""]).length;u--;)f=g=(s=Ae.exec(t[u])||[])[1],d=(s[2]||"").split(".").sort(),f&&(p=T.event.special[f]||{},f=(i?p.delegateType:p.bindType)||f,p=T.event.special[f]||{},c=T.extend({type:f,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&T.expr.match.needsContext.test(i),namespace:d.join(".")},o),(h=l[f])||((h=l[f]=[]).delegateCount=0,p.setup&&!1!==p.setup.call(e,r,d,a)||e.addEventListener&&e.addEventListener(f,a)),p.add&&(p.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?h.splice(h.delegateCount++,0,c):h.push(c),T.event.global[f]=!0)},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,h,f,d,g,v=Q.hasData(e)&&Q.get(e);if(v&&(l=v.events)){for(u=(t=(t||"").match(j)||[""]).length;u--;)if(f=g=(s=Ae.exec(t[u])||[])[1],d=(s[2]||"").split(".").sort(),f){for(p=T.event.special[f]||{},h=l[f=(r?p.delegateType:p.bindType)||f]||[],s=s[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=h.length;o--;)c=h[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(h.splice(o,1),c.selector&&h.delegateCount--,p.remove&&p.remove.call(e,c));a&&!h.length&&(p.teardown&&!1!==p.teardown.call(e,d,v.handle)||T.removeEvent(e,f,v.handle),delete l[f])}else for(f in l)T.event.remove(e,f+t[u],n,r,!0);T.isEmptyObject(l)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),l=T.event.fix(e),u=(Q.get(this,"events")||Object.create(null))[l.type]||[],c=T.event.special[l.type]||{};for(s[0]=l,t=1;t=1))for(;u!==this;u=u.parentNode||this)if(1===u.nodeType&&("click"!==e.type||!0!==u.disabled)){for(o=[],a={},n=0;n-1:T.find(i,this,null,[u]).length),a[i]&&o.push(r);o.length&&s.push({elem:u,handlers:o})}return u=this,l\s*$/g;function Pe(e,t){return w(e,"table")&&w(11!==t.nodeType?t:t.firstChild,"tr")&&T(e).children("tbody")[0]||e}function ke(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Me(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function je(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Q.hasData(e)&&(s=Q.get(e).events))for(i in Q.remove(t,"handle events"),s)for(n=0,r=s[i].length;n1&&"string"==typeof d&&!v.checkClone&&Re.test(d))return e.each((function(i){var o=e.eq(i);g&&(t[0]=d.call(this,i,o.html())),Be(o,t,n,r)}));if(h&&(o=(i=Se(t,e[0].ownerDocument,!1,e,r)).firstChild,1===i.childNodes.length&&(i=o),o||r)){for(s=(a=T.map(Ee(i,"script"),ke)).length;p0&&be(a,!l&&Ee(e,"script")),s},cleanData:function(e){for(var t,n,r,i=T.event.special,o=0;void 0!==(n=e[o]);o++)if($(n)){if(t=n[Q.expando]){if(t.events)for(r in t.events)i[r]?T.event.remove(n,r):T.removeEvent(n,r,t.handle);n[Q.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),T.fn.extend({detach:function(e){return Ge(this,e,!0)},remove:function(e){return Ge(this,e)},text:function(e){return V(this,(function(e){return void 0===e?T.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return Be(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Pe(this,e).appendChild(e)}))},prepend:function(){return Be(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Pe(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return Be(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return Be(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(T.cleanData(Ee(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return T.clone(this,e,t)}))},html:function(e){return V(this,(function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Oe.test(e)&&!ye[(ve.exec(e)||["",""])[1].toLowerCase()]){e=T.htmlPrefilter(e);try{for(;n3,oe.removeChild(e)),s}}))}();var Ye=["Webkit","Moz","ms"],Xe=E.createElement("div").style,$e={};function Je(e){var t=T.cssProps[e]||$e[e];return t||(e in Xe?e:$e[e]=function(e){for(var t=e[0].toUpperCase()+e.slice(1),n=Ye.length;n--;)if((e=Ye[n]+t)in Xe)return e}(e)||e)}var Qe=/^(none|table(?!-c[ea]).+)/,Ke=/^--/,Ze={position:"absolute",visibility:"hidden",display:"block"},et={letterSpacing:"0",fontWeight:"400"};function tt(e,t,n){var r=re.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function nt(e,t,n,r,i,o){var a="width"===t?1:0,s=0,l=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(l+=T.css(e,n+ie[a],!0,i)),r?("content"===n&&(l-=T.css(e,"padding"+ie[a],!0,i)),"margin"!==n&&(l-=T.css(e,"border"+ie[a]+"Width",!0,i))):(l+=T.css(e,"padding"+ie[a],!0,i),"padding"!==n?l+=T.css(e,"border"+ie[a]+"Width",!0,i):s+=T.css(e,"border"+ie[a]+"Width",!0,i));return!r&&o>=0&&(l+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-l-s-.5))||0),l}function rt(e,t,n){var r=He(e),i=(!v.boxSizingReliable()||n)&&"border-box"===T.css(e,"boxSizing",!1,r),o=i,a=We(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(Ue.test(a)){if(!n)return a;a="auto"}return(!v.boxSizingReliable()&&i||!v.reliableTrDimensions()&&w(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===T.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===T.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+nt(e,t,n||(i?"border":"content"),o,r,a)+"px"}function it(e,t,n,r,i){return new it.prototype.init(e,t,n,r,i)}T.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=We(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=X(t),l=Ke.test(t),u=e.style;if(l||(t=Je(s)),a=T.cssHooks[t]||T.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:u[t];"string"===(o=typeof n)&&(i=re.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||l||(n+=i&&i[3]||(T.cssNumber[s]?"":"px")),v.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(l?u.setProperty(t,n):u[t]=n))}},css:function(e,t,n,r){var i,o,a,s=X(t);return Ke.test(t)||(t=Je(s)),(a=T.cssHooks[t]||T.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=We(e,t,r)),"normal"===i&&t in et&&(i=et[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),T.each(["height","width"],(function(e,t){T.cssHooks[t]={get:function(e,n,r){if(n)return!Qe.test(T.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?rt(e,t,r):qe(e,Ze,(function(){return rt(e,t,r)}))},set:function(e,n,r){var i,o=He(e),a=!v.scrollboxSize()&&"absolute"===o.position,s=(a||r)&&"border-box"===T.css(e,"boxSizing",!1,o),l=r?nt(e,t,r,s,o):0;return s&&a&&(l-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-nt(e,t,"border",!1,o)-.5)),l&&(i=re.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=T.css(e,t)),tt(0,n,l)}}})),T.cssHooks.marginLeft=ze(v.reliableMarginLeft,(function(e,t){if(t)return(parseFloat(We(e,"marginLeft"))||e.getBoundingClientRect().left-qe(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+"px"})),T.each({margin:"",padding:"",border:"Width"},(function(e,t){T.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+ie[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(T.cssHooks[e+t].set=tt)})),T.fn.extend({css:function(e,t){return V(this,(function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=He(e),i=t.length;a1)}}),T.Tween=it,it.prototype={constructor:it,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||T.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(T.cssNumber[n]?"":"px")},cur:function(){var e=it.propHooks[this.prop];return e&&e.get?e.get(this):it.propHooks._default.get(this)},run:function(e){var t,n=it.propHooks[this.prop];return this.options.duration?this.pos=t=T.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):it.propHooks._default.set(this),this}},it.prototype.init.prototype=it.prototype,it.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=T.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){T.fx.step[e.prop]?T.fx.step[e.prop](e):1!==e.elem.nodeType||!T.cssHooks[e.prop]&&null==e.elem.style[Je(e.prop)]?e.elem[e.prop]=e.now:T.style(e.elem,e.prop,e.now+e.unit)}}},it.propHooks.scrollTop=it.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},T.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},T.fx=it.prototype.init,T.fx.step={};var ot,at,st=/^(?:toggle|show|hide)$/,lt=/queueHooks$/;function ut(){at&&(!1===E.hidden&&n.requestAnimationFrame?n.requestAnimationFrame(ut):n.setTimeout(ut,T.fx.interval),T.fx.tick())}function ct(){return n.setTimeout((function(){ot=void 0})),ot=Date.now()}function pt(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=ie[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function ht(e,t,n){for(var r,i=(ft.tweeners[t]||[]).concat(ft.tweeners["*"]),o=0,a=i.length;o1)},removeAttr:function(e){return this.each((function(){T.removeAttr(this,e)}))}}),T.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===e.getAttribute?T.prop(e,t,n):(1===o&&T.isXMLDoc(e)||(i=T.attrHooks[t.toLowerCase()]||(T.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void T.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=T.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!v.radioValue&&"radio"===t&&w(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(j);if(i&&1===e.nodeType)for(;n=i[r++];)e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?T.removeAttr(e,n):e.setAttribute(n,n),n}},T.each(T.expr.match.bool.source.match(/\w+/g),(function(e,t){var n=gt[t]||T.find.attr;gt[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=gt[a],gt[a]=i,i=null!=n(e,t,r)?a:null,gt[a]=o),i}}));var vt=/^(?:input|select|textarea|button)$/i,mt=/^(?:a|area)$/i;function yt(e){return(e.match(j)||[]).join(" ")}function Et(e){return e.getAttribute&&e.getAttribute("class")||""}function bt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(j)||[]}T.fn.extend({prop:function(e,t){return V(this,T.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[T.propFix[e]||e]}))}}),T.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&T.isXMLDoc(e)||(t=T.propFix[t]||t,i=T.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=T.find.attr(e,"tabindex");return t?parseInt(t,10):vt.test(e.nodeName)||mt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),v.optSelected||(T.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),T.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){T.propFix[this.toLowerCase()]=this})),T.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,l=0;if(m(e))return this.each((function(t){T(this).addClass(e.call(this,t,Et(this)))}));if((t=bt(e)).length)for(;n=this[l++];)if(i=Et(n),r=1===n.nodeType&&" "+yt(i)+" "){for(a=0;o=t[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=yt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,l=0;if(m(e))return this.each((function(t){T(this).removeClass(e.call(this,t,Et(this)))}));if(!arguments.length)return this.attr("class","");if((t=bt(e)).length)for(;n=this[l++];)if(i=Et(n),r=1===n.nodeType&&" "+yt(i)+" "){for(a=0;o=t[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");i!==(s=yt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):m(e)?this.each((function(n){T(this).toggleClass(e.call(this,n,Et(this),t),t)})):this.each((function(){var t,i,o,a;if(r)for(i=0,o=T(this),a=bt(e);t=a[i++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else void 0!==e&&"boolean"!==n||((t=Et(this))&&Q.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":Q.get(this,"__className__")||""))}))},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+yt(Et(n))+" ").indexOf(t)>-1)return!0;return!1}});var xt=/\r/g;T.fn.extend({val:function(e){var t,n,r,i=this[0];return arguments.length?(r=m(e),this.each((function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,T(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=T.map(i,(function(e){return null==e?"":e+""}))),(t=T.valHooks[this.type]||T.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))}))):i?(t=T.valHooks[i.type]||T.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(xt,""):null==n?"":n:void 0}}),T.extend({valHooks:{option:{get:function(e){var t=T.find.attr(e,"value");return null!=t?t:yt(T.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],l=a?o+1:i.length;for(r=o<0?l:a?o:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),T.each(["radio","checkbox"],(function(){T.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=T.inArray(T(e).val(),t)>-1}},v.checkOn||(T.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})})),v.focusin="onfocusin"in n;var St=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};T.extend(T.event,{trigger:function(e,t,r,i){var o,a,s,l,u,c,p,h,d=[r||E],g=f.call(e,"type")?e.type:e,v=f.call(e,"namespace")?e.namespace.split("."):[];if(a=h=s=r=r||E,3!==r.nodeType&&8!==r.nodeType&&!St.test(g+T.event.triggered)&&(g.indexOf(".")>-1&&(v=g.split("."),g=v.shift(),v.sort()),u=g.indexOf(":")<0&&"on"+g,(e=e[T.expando]?e:new T.Event(g,"object"==typeof e&&e)).isTrigger=i?2:3,e.namespace=v.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+v.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=r),t=null==t?[e]:T.makeArray(t,[e]),p=T.event.special[g]||{},i||!p.trigger||!1!==p.trigger.apply(r,t))){if(!i&&!p.noBubble&&!y(r)){for(l=p.delegateType||g,St.test(l+g)||(a=a.parentNode);a;a=a.parentNode)d.push(a),s=a;s===(r.ownerDocument||E)&&d.push(s.defaultView||s.parentWindow||n)}for(o=0;(a=d[o++])&&!e.isPropagationStopped();)h=a,e.type=o>1?l:p.bindType||g,(c=(Q.get(a,"events")||Object.create(null))[e.type]&&Q.get(a,"handle"))&&c.apply(a,t),(c=u&&a[u])&&c.apply&&$(a)&&(e.result=c.apply(a,t),!1===e.result&&e.preventDefault());return e.type=g,i||e.isDefaultPrevented()||p._default&&!1!==p._default.apply(d.pop(),t)||!$(r)||u&&m(r[g])&&!y(r)&&((s=r[u])&&(r[u]=null),T.event.triggered=g,e.isPropagationStopped()&&h.addEventListener(g,Tt),r[g](),e.isPropagationStopped()&&h.removeEventListener(g,Tt),T.event.triggered=void 0,s&&(r[u]=s)),e.result}},simulate:function(e,t,n){var r=T.extend(new T.Event,n,{type:e,isSimulated:!0});T.event.trigger(r,null,t)}}),T.fn.extend({trigger:function(e,t){return this.each((function(){T.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return T.event.trigger(e,t,n,!0)}}),v.focusin||T.each({focus:"focusin",blur:"focusout"},(function(e,t){var n=function(e){T.event.simulate(t,e.target,T.event.fix(e))};T.event.special[t]={setup:function(){var r=this.ownerDocument||this.document||this,i=Q.access(r,t);i||r.addEventListener(e,n,!0),Q.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this.document||this,i=Q.access(r,t)-1;i?Q.access(r,t,i):(r.removeEventListener(e,n,!0),Q.remove(r,t))}}}));var Ct=n.location,At={guid:Date.now()},Lt=/\?/;T.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new n.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||T.error("Invalid XML: "+e),t};var Nt=/\[\]$/,It=/\r?\n/g,wt=/^(?:submit|button|image|reset|file)$/i,_t=/^(?:input|select|textarea|keygen)/i;function Ot(e,t,n,r){var i;if(Array.isArray(t))T.each(t,(function(t,i){n||Nt.test(e)?r(e,i):Ot(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)}));else if(n||"object"!==S(t))r(e,t);else for(i in t)Ot(e+"["+i+"]",t[i],n,r)}T.param=function(e,t){var n,r=[],i=function(e,t){var n=m(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!T.isPlainObject(e))T.each(e,(function(){i(this.name,this.value)}));else for(n in e)Ot(n,e[n],t,i);return r.join("&")},T.fn.extend({serialize:function(){return T.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=T.prop(this,"elements");return e?T.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!T(this).is(":disabled")&&_t.test(this.nodeName)&&!wt.test(e)&&(this.checked||!ge.test(e))})).map((function(e,t){var n=T(this).val();return null==n?null:Array.isArray(n)?T.map(n,(function(e){return{name:t.name,value:e.replace(It,"\r\n")}})):{name:t.name,value:n.replace(It,"\r\n")}})).get()}});var Rt=/%20/g,Dt=/#.*$/,Pt=/([?&])_=[^&]*/,kt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Mt=/^(?:GET|HEAD)$/,jt=/^\/\//,Ft={},Bt={},Gt="*/".concat("*"),Ut=E.createElement("a");function Ht(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(j)||[];if(m(n))for(;r=o[i++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qt(e,t,n,r){var i={},o=e===Bt;function a(s){var l;return i[s]=!0,T.each(e[s]||[],(function(e,s){var u=s(t,n,r);return"string"!=typeof u||o||i[u]?o?!(l=u):void 0:(t.dataTypes.unshift(u),a(u),!1)})),l}return a(t.dataTypes[0])||!i["*"]&&a("*")}function Vt(e,t){var n,r,i=T.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&T.extend(!0,e,r),e}Ut.href=Ct.href,T.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Gt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":T.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Vt(Vt(e,T.ajaxSettings),t):Vt(T.ajaxSettings,e)},ajaxPrefilter:Ht(Ft),ajaxTransport:Ht(Bt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,i,o,a,s,l,u,c,p,h,f=T.ajaxSetup({},t),d=f.context||f,g=f.context&&(d.nodeType||d.jquery)?T(d):T.event,v=T.Deferred(),m=T.Callbacks("once memory"),y=f.statusCode||{},b={},x={},S="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(u){if(!a)for(a={};t=kt.exec(o);)a[t[1].toLowerCase()+" "]=(a[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=a[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return u?o:null},setRequestHeader:function(e,t){return null==u&&(e=x[e.toLowerCase()]=x[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==u&&(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(u)C.always(e[C.status]);else for(t in e)y[t]=[y[t],e[t]];return this},abort:function(e){var t=e||S;return r&&r.abort(t),A(0,t),this}};if(v.promise(C),f.url=((e||f.url||Ct.href)+"").replace(jt,Ct.protocol+"//"),f.type=t.method||t.type||f.method||f.type,f.dataTypes=(f.dataType||"*").toLowerCase().match(j)||[""],null==f.crossDomain){l=E.createElement("a");try{l.href=f.url,l.href=l.href,f.crossDomain=Ut.protocol+"//"+Ut.host!=l.protocol+"//"+l.host}catch(e){f.crossDomain=!0}}if(f.data&&f.processData&&"string"!=typeof f.data&&(f.data=T.param(f.data,f.traditional)),qt(Ft,f,t,C),u)return C;for(p in(c=T.event&&f.global)&&0==T.active++&&T.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!Mt.test(f.type),i=f.url.replace(Dt,""),f.hasContent?f.data&&f.processData&&0===(f.contentType||"").indexOf("application/x-www-form-urlencoded")&&(f.data=f.data.replace(Rt,"+")):(h=f.url.slice(i.length),f.data&&(f.processData||"string"==typeof f.data)&&(i+=(Lt.test(i)?"&":"?")+f.data,delete f.data),!1===f.cache&&(i=i.replace(Pt,"$1"),h=(Lt.test(i)?"&":"?")+"_="+At.guid+++h),f.url=i+h),f.ifModified&&(T.lastModified[i]&&C.setRequestHeader("If-Modified-Since",T.lastModified[i]),T.etag[i]&&C.setRequestHeader("If-None-Match",T.etag[i])),(f.data&&f.hasContent&&!1!==f.contentType||t.contentType)&&C.setRequestHeader("Content-Type",f.contentType),C.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+Gt+"; q=0.01":""):f.accepts["*"]),f.headers)C.setRequestHeader(p,f.headers[p]);if(f.beforeSend&&(!1===f.beforeSend.call(d,C,f)||u))return C.abort();if(S="abort",m.add(f.complete),C.done(f.success),C.fail(f.error),r=qt(Bt,f,t,C)){if(C.readyState=1,c&&g.trigger("ajaxSend",[C,f]),u)return C;f.async&&f.timeout>0&&(s=n.setTimeout((function(){C.abort("timeout")}),f.timeout));try{u=!1,r.send(b,A)}catch(e){if(u)throw e;A(-1,e)}}else A(-1,"No Transport");function A(e,t,a,l){var p,h,E,b,x,S=t;u||(u=!0,s&&n.clearTimeout(s),r=void 0,o=l||"",C.readyState=e>0?4:0,p=e>=200&&e<300||304===e,a&&(b=function(e,t,n){for(var r,i,o,a,s=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){l.unshift(i);break}if(l[0]in n)o=l[0];else{for(i in n){if(!l[0]||e.converters[i+" "+l[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==l[0]&&l.unshift(o),n[o]}(f,C,a)),!p&&T.inArray("script",f.dataTypes)>-1&&(f.converters["text script"]=function(){}),b=function(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];for(o=c.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(!(a=u[l+" "+o]||u["* "+o]))for(i in u)if((s=i.split(" "))[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){!0===a?a=u[i]:!0!==u[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e.throws)t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}(f,b,C,p),p?(f.ifModified&&((x=C.getResponseHeader("Last-Modified"))&&(T.lastModified[i]=x),(x=C.getResponseHeader("etag"))&&(T.etag[i]=x)),204===e||"HEAD"===f.type?S="nocontent":304===e?S="notmodified":(S=b.state,h=b.data,p=!(E=b.error))):(E=S,!e&&S||(S="error",e<0&&(e=0))),C.status=e,C.statusText=(t||S)+"",p?v.resolveWith(d,[h,S,C]):v.rejectWith(d,[C,S,E]),C.statusCode(y),y=void 0,c&&g.trigger(p?"ajaxSuccess":"ajaxError",[C,f,p?h:E]),m.fireWith(d,[C,S]),c&&(g.trigger("ajaxComplete",[C,f]),--T.active||T.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return T.get(e,t,n,"json")},getScript:function(e,t){return T.get(e,void 0,t,"script")}}),T.each(["get","post"],(function(e,t){T[t]=function(e,n,r,i){return m(n)&&(i=i||r,r=n,n=void 0),T.ajax(T.extend({url:e,type:t,dataType:i,data:n,success:r},T.isPlainObject(e)&&e))}})),T.ajaxPrefilter((function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")})),T._evalUrl=function(e,t,n){return T.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){T.globalEval(e,t,n)}})},T.fn.extend({wrapAll:function(e){var t;return this[0]&&(m(e)&&(e=e.call(this[0])),t=T(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(e){return m(e)?this.each((function(t){T(this).wrapInner(e.call(this,t))})):this.each((function(){var t=T(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=m(e);return this.each((function(n){T(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(e){return this.parent(e).not("body").each((function(){T(this).replaceWith(this.childNodes)})),this}}),T.expr.pseudos.hidden=function(e){return!T.expr.pseudos.visible(e)},T.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},T.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(e){}};var Wt={0:200,1223:204},zt=T.ajaxSettings.xhr();v.cors=!!zt&&"withCredentials"in zt,v.ajax=zt=!!zt,T.ajaxTransport((function(e){var t,r;if(v.cors||zt&&!e.crossDomain)return{send:function(i,o){var a,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)s[a]=e.xhrFields[a];for(a in e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest"),i)s.setRequestHeader(a,i[a]);t=function(e){return function(){t&&(t=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Wt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=t(),r=s.onerror=s.ontimeout=t("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&n.setTimeout((function(){t&&r()}))},t=t("abort");try{s.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}})),T.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=!1)})),T.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return T.globalEval(e),e}}}),T.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),T.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain||e.scriptAttrs)return{send:function(r,i){t=T("