@graphiql/plugin-code-exporter
Version:
This package provides a plugin that integrates the [GraphiQL Code Exporter](https://github.com/OneGraph/graphiql-code-exporter) into the GraphiQL UI.
5 lines (4 loc) • 219 kB
JavaScript
(function(It,jr){typeof exports=="object"&&typeof module<"u"?jr(exports,require("@graphiql/react"),require("react"),require("graphql")):typeof define=="function"&&define.amd?define(["exports","@graphiql/react","react","graphql"],jr):(It=typeof globalThis<"u"?globalThis:It||self,jr(It.GraphiQLPluginCodeExporter={},It.GraphiQL.React,It.React,It.GraphiQL.GraphQL))})(this,function(It,jr,V,bo){"use strict";var Nl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xo(k){return k&&k.__esModule&&Object.prototype.hasOwnProperty.call(k,"default")?k.default:k}var Ol=function(){var k=document.getSelection();if(!k.rangeCount)return function(){};for(var b=document.activeElement,m=[],P=0;P<k.rangeCount;P++)m.push(k.getRangeAt(P));switch(b.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":b.blur();break;default:b=null;break}return k.removeAllRanges(),function(){k.type==="Caret"&&k.removeAllRanges(),k.rangeCount||m.forEach(function(E){k.addRange(E)}),b&&b.focus()}},Dl=Ol,wo={"text/plain":"Text","text/html":"Url",default:"Text"},El="Copy to clipboard: #{key}, Enter";function Al(k){var b=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return k.replace(/#{\s*key\s*}/g,b)}function Wl(k,b){var m,P,E,T,_,z,C=!1;b||(b={}),m=b.debug||!1;try{E=Dl(),T=document.createRange(),_=document.getSelection(),z=document.createElement("span"),z.textContent=k,z.ariaHidden="true",z.style.all="unset",z.style.position="fixed",z.style.top=0,z.style.clip="rect(0, 0, 0, 0)",z.style.whiteSpace="pre",z.style.webkitUserSelect="text",z.style.MozUserSelect="text",z.style.msUserSelect="text",z.style.userSelect="text",z.addEventListener("copy",function(A){if(A.stopPropagation(),b.format)if(A.preventDefault(),typeof A.clipboardData>"u"){m&&console.warn("unable to use e.clipboardData"),m&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var te=wo[b.format]||wo.default;window.clipboardData.setData(te,k)}else A.clipboardData.clearData(),A.clipboardData.setData(b.format,k);b.onCopy&&(A.preventDefault(),b.onCopy(A.clipboardData))}),document.body.appendChild(z),T.selectNodeContents(z),_.addRange(T);var q=document.execCommand("copy");if(!q)throw new Error("copy command was unsuccessful");C=!0}catch(A){m&&console.error("unable to copy using execCommand: ",A),m&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(b.format||"text",k),b.onCopy&&b.onCopy(window.clipboardData),C=!0}catch(te){m&&console.error("unable to copy using clipboardData: ",te),m&&console.error("falling back to prompt"),P=Al("message"in b?b.message:El),window.prompt(P,k)}}finally{_&&(typeof _.removeRange=="function"?_.removeRange(T):_.removeAllRanges()),z&&document.body.removeChild(z),E()}return C}var Hl=Wl;const Pl=xo(Hl);var So={exports:{}};(function(k,b){(function(m,P){k.exports=P()})(Nl,function(){var m=navigator.userAgent,P=navigator.platform,E=/gecko\/\d/i.test(m),T=/MSIE \d/.test(m),_=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(m),z=/Edge\/(\d+)/.exec(m),C=T||_||z,q=C&&(T?document.documentMode||6:+(z||_)[1]),A=!z&&/WebKit\//.test(m),te=A&&/Qt\/\d+\.\d+/.test(m),K=!z&&/Chrome\//.test(m),B=/Opera\//.test(m),Z=/Apple Computer/.test(navigator.vendor),oe=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(m),be=/PhantomJS/.test(m),ne=Z&&(/Mobile\/\w+/.test(m)||navigator.maxTouchPoints>2),ie=/Android/.test(m),ve=ne||ie||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(m),ye=ne||/Mac/.test(P),bt=/\bCrOS\b/.test(m),je=/win/i.test(P),ue=B&&m.match(/Version\/(\d*\.\d*)/);ue&&(ue=Number(ue[1])),ue&&ue>=15&&(B=!1,A=!0);var st=ye&&(te||B&&(ue==null||ue<12.11)),Mt=E||C&&q>=9;function gt(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var Ie=function(e,t){var n=e.className,r=gt(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function ut(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function S(e,t){return ut(e).appendChild(t)}function M(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function h(e,t,n,r){var i=M(e,t,n,r);return i.setAttribute("role","presentation"),i}var I;document.createRange?I=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:I=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function D(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function j(){var e;try{e=document.activeElement}catch{e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function xe(e,t){var n=e.className;gt(t).test(n)||(e.className+=(n?" ":"")+t)}function Ze(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!gt(n[r]).test(t)&&(t+=" "+n[r]);return t}var xt=function(e){e.select()};ne?xt=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:C&&(xt=function(e){try{e.select()}catch{}});function Qr(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Qe(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function Re(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var o=r||0,a=i||0;;){var l=e.indexOf(" ",o);if(l<0||l>=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}}var De=function(){this.id=null,this.f=null,this.time=0,this.handler=Qr(this.onTimeout,this)};De.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},De.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function Y(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var re=50,le={toString:function(){return"CodeMirror.Pass"}},ge={scroll:!1},Jr={origin:"*mouse"},de={origin:"+move"};function Ue(e,t,n){for(var r=0,i=0;;){var o=e.indexOf(" ",r);o==-1&&(o=e.length);var a=o-r;if(o==e.length||i+a>=t)return r+Math.min(a,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var Xt=[""];function xr(e){for(;Xt.length<=e;)Xt.push(se(Xt)+" ");return Xt[e]}function se(e){return e[e.length-1]}function yt(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Yt(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function ar(){}function Rn(e,t){var n;return Object.create?n=Object.create(e):(ar.prototype=e,n=new ar),t&&Qe(t,n),n}var Un=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function wr(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Un.test(e))}function Sr(e,t){return t?t.source.indexOf("\\w")>-1&&wr(e)?!0:t.test(e):wr(e)}function _n(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ki=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Vr(e){return e.charCodeAt(0)>=768&&ki.test(e)}function Gn(e,t,n){for(;(n<0?t>0:t<e.length)&&Vr(e.charAt(t));)t+=n;return t}function Nt(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function Li(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<n&&a.to>t||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),a.level==1?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var ft=null;function Ce(e,t,n){var r;ft=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&n=="before"?r=i:ft=i),o.from==t&&(o.from!=o.to&&n!="before"?r=i:ft=i)}return r??ft}var lr=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,l=/[1n]/;function s(u,c,d){this.level=u,this.from=c,this.to=d}return function(u,c){var d=c=="ltr"?"L":"R";if(u.length==0||c=="ltr"&&!r.test(u))return!1;for(var g=u.length,v=[],y=0;y<g;++y)v.push(n(u.charCodeAt(y)));for(var w=0,O=d;w<g;++w){var W=v[w];W=="m"?v[w]=O:O=W}for(var F=0,H=d;F<g;++F){var U=v[F];U=="1"&&H=="r"?v[F]="n":o.test(U)&&(H=U,U=="r"&&(v[F]="R"))}for(var Q=1,X=v[0];Q<g-1;++Q){var ae=v[Q];ae=="+"&&X=="1"&&v[Q+1]=="1"?v[Q]="1":ae==","&&X==v[Q+1]&&(X=="1"||X=="n")&&(v[Q]=X),X=ae}for(var me=0;me<g;++me){var Pe=v[me];if(Pe==",")v[me]="N";else if(Pe=="%"){var Se=void 0;for(Se=me+1;Se<g&&v[Se]=="%";++Se);for(var lt=me&&v[me-1]=="!"||Se<g&&v[Se]=="1"?"1":"N",tt=me;tt<Se;++tt)v[tt]=lt;me=Se-1}}for(var Ne=0,rt=d;Ne<g;++Ne){var Be=v[Ne];rt=="L"&&Be=="1"?v[Ne]="L":o.test(Be)&&(rt=Be)}for(var Ee=0;Ee<g;++Ee)if(i.test(v[Ee])){var Oe=void 0;for(Oe=Ee+1;Oe<g&&i.test(v[Oe]);++Oe);for(var Le=(Ee?v[Ee-1]:d)=="L",nt=(Oe<g?v[Oe]:d)=="L",Xr=Le==nt?Le?"L":"R":d,ir=Ee;ir<Oe;++ir)v[ir]=Xr;Ee=Oe-1}for(var Ke=[],Ft,Fe=0;Fe<g;)if(a.test(v[Fe])){var yo=Fe;for(++Fe;Fe<g&&a.test(v[Fe]);++Fe);Ke.push(new s(0,yo,Fe))}else{var Kt=Fe,mr=Ke.length,br=c=="rtl"?1:0;for(++Fe;Fe<g&&v[Fe]!="L";++Fe);for(var Ye=Kt;Ye<Fe;)if(l.test(v[Ye])){Kt<Ye&&(Ke.splice(mr,0,new s(1,Kt,Ye)),mr+=br);var Yr=Ye;for(++Ye;Ye<Fe&&l.test(v[Ye]);++Ye);Ke.splice(mr,0,new s(2,Yr,Ye)),mr+=br,Kt=Ye}else++Ye;Kt<Fe&&Ke.splice(mr,0,new s(1,Kt,Fe))}return c=="ltr"&&(Ke[0].level==1&&(Ft=u.match(/^\s+/))&&(Ke[0].from=Ft[0].length,Ke.unshift(new s(0,0,Ft[0].length))),se(Ke).level==1&&(Ft=u.match(/\s+$/))&&(se(Ke).to-=Ft[0].length,Ke.push(new s(0,g-Ft[0].length,g)))),c=="rtl"?Ke.reverse():Ke}}();function it(e,t){var n=e.order;return n==null&&(n=e.order=lr(e.text,t)),n}var zt=[],J=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||zt).concat(n)}};function Cr(e,t){return e._handlers&&e._handlers[t]||zt}function Je(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=Y(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function $(e,t){var n=Cr(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Me(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),$(e,n||t.type,e,t),ct(t)||t.codemirrorIgnore}function kr(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)Y(n,t[r])==-1&&n.push(t[r])}function ze(e,t){return Cr(e,t).length>0}function Ot(e){e.prototype.on=function(t,n){J(this,t,n)},e.prototype.off=function(t,n){Je(this,t,n)}}function _e(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Lr(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ct(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function sr(e){_e(e),Lr(e)}function jt(e){return e.target||e.srcElement}function qn(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),ye&&e.ctrlKey&&t==1&&(t=3),t}var $r=function(){if(C&&q<9)return!1;var e=M("div");return"draggable"in e||"dragDrop"in e}(),Ve;function Kn(e){if(Ve==null){var t=M("span","");S(e,M("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ve=t.offsetWidth<=1&&t.offsetHeight>2&&!(C&&q<8))}var n=Ve?M("span",""):M("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var en;function Dt(e){if(en!=null)return en;var t=S(e,document.createTextNode("AخA")),n=I(t,0,1).getBoundingClientRect(),r=I(t,1,2).getBoundingClientRect();return ut(e),!n||n.left==n.right?!1:en=r.right-n.right<3}var tn=`
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
`,t);i==-1&&(i=e.length);var o=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),a=o.indexOf("\r");a!=-1?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Xn=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Yn=function(){var e=M("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),rn=null;function Zt(e){if(rn!=null)return rn;var t=S(e,M("span","x")),n=t.getBoundingClientRect(),r=I(t,0,1).getBoundingClientRect();return rn=Math.abs(n.left-r.left)>1}var mt={},ht={};function jn(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),mt[e]=t}function Bt(e,t){ht[e]=t}function Tr(e){if(typeof e=="string"&&ht.hasOwnProperty(e))e=ht[e];else if(e&&typeof e.name=="string"&&ht.hasOwnProperty(e.name)){var t=ht[e.name];typeof t=="string"&&(t={name:t}),e=Rn(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Tr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Tr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Mr(e,t){t=Tr(t);var n=mt[t.name];if(!n)return Mr(e,"text/plain");var r=n(e,t);if(wt.hasOwnProperty(t.name)){var i=wt[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var wt={};function St(e,t){var n=wt.hasOwnProperty(e)?wt[e]:wt[e]={};Qe(t,n)}function dt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function nn(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function on(e,t,n){return e.startState?e.startState(t,n):!0}var ke=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};ke.prototype.eol=function(){return this.pos>=this.string.length},ke.prototype.sol=function(){return this.pos==this.lineStart},ke.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},ke.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},ke.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},ke.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},ke.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},ke.prototype.skipToEnd=function(){this.pos=this.string.length},ke.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},ke.prototype.backUp=function(e){this.pos-=e},ke.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Re(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Re(this.string,this.lineStart,this.tabSize):0)},ke.prototype.indentation=function(){return Re(this.string,null,this.tabSize)-(this.lineStart?Re(this.string,this.lineStart,this.tabSize):0)},ke.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(a){return n?a.toLowerCase():a},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var o=this.string.slice(this.pos).match(e);return o&&o.index>0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}},ke.prototype.current=function(){return this.string.slice(this.start,this.pos)},ke.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},ke.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},ke.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function G(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function Et(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(o){var a=o.text;i==n.line&&(a=a.slice(0,n.ch)),i==t.line&&(a=a.slice(t.ch)),r.push(a),++i}),r}function an(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function ot(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function ce(e){if(e.parent==null)return null;for(var t=e.parent,n=Y(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function At(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var a=0;a<e.lines.length;++a){var l=e.lines[a],s=l.height;if(t<s)break;t-=s}return n+a}function ur(e,t){return t>=e.first&&t<e.first+e.size}function ln(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function L(e,t,n){if(n===void 0&&(n=null),!(this instanceof L))return new L(e,t,n);this.line=e,this.ch=t,this.sticky=n}function f(e,t){return e.line-t.line||e.ch-t.ch}function p(e,t){return e.sticky==t.sticky&&f(e,t)==0}function x(e){return L(e.line,e.ch)}function N(e,t){return f(e,t)<0?t:e}function ee(e,t){return f(e,t)<0?e:t}function fe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function R(e,t){if(t.line<e.first)return L(e.first,0);var n=e.first+e.size-1;return t.line>n?L(n,G(e,n).text.length):Ge(t,G(e,t.line).text.length)}function Ge(e,t){var n=e.ch;return n==null||n>t?L(e.line,t):n<0?L(e.line,0):e}function pt(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=R(e,t[r]);return n}var Nr=function(e,t){this.state=e,this.lookAhead=t},Wt=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};Wt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Wt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Wt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Wt.fromSaved=function(e,t,n){return t instanceof Nr?new Wt(e,dt(e.mode,t.state),n,t.lookAhead):new Wt(e,dt(e.mode,t),n)},Wt.prototype.save=function(e){var t=e!==!1?dt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Nr(t,this.maxLookAhead):t};function Do(e,t,n,r){var i=[e.state.modeGen],o={};Fo(e,t.text,e.doc.mode,n,function(u,c){return i.push(u,c)},o,r);for(var a=n.state,l=function(u){n.baseTokens=i;var c=e.state.overlays[u],d=1,g=0;n.state=!0,Fo(e,t.text,c.mode,n,function(v,y){for(var w=d;g<v;){var O=i[d];O>v&&i.splice(d,1,v,i[d+1],O),d+=2,g=Math.min(v,O)}if(y)if(c.opaque)i.splice(w,d-w,v,"overlay "+y),d=w+2;else for(;w<d;w+=2){var W=i[w+1];i[w+1]=(W?W+" ":"")+"overlay "+y}},o),n.state=a,n.baseTokens=null,n.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)l(s);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Eo(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=sn(e,ce(t)),i=t.text.length>e.options.maxHighlightLength&&dt(e.doc.mode,r.state),o=Do(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function sn(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Wt(r,!0,t);var o=os(e,t,n),a=o>r.first&&G(r,o-1).stateAfter,l=a?Wt.fromSaved(r,a,o):new Wt(r,on(r.mode),o);return r.iter(o,t,function(s){Ti(e,s.text,l);var u=l.line;s.stateAfter=u==t-1||u%5==0||u>=i.viewFrom&&u<i.viewTo?l.save():null,l.nextLine()}),n&&(r.modeFrontier=l.line),l}function Ti(e,t,n,r){var i=e.doc.mode,o=new ke(t,e.options.tabSize,n);for(o.start=o.pos=r||0,t==""&&Ao(i,n.state);!o.eol();)Mi(i,o,n.state),o.start=o.pos}function Ao(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=nn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}}function Mi(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=nn(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}var Wo=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ho(e,t,n,r){var i=e.doc,o=i.mode,a;t=R(i,t);var l=G(i,t.line),s=sn(e,t.line,n),u=new ke(l.text,e.options.tabSize,s),c;for(r&&(c=[]);(r||u.pos<t.ch)&&!u.eol();)u.start=u.pos,a=Mi(o,u,s.state),r&&c.push(new Wo(u,a,dt(i.mode,s.state)));return r?c:new Wo(u,a,s.state)}function Po(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Fo(e,t,n,r,i,o,a){var l=n.flattenSpans;l==null&&(l=e.options.flattenSpans);var s=0,u=null,c=new ke(t,e.options.tabSize,r),d,g=e.options.addModeClass&&[null];for(t==""&&Po(Ao(n,r.state),o);!c.eol();){if(c.pos>e.options.maxHighlightLength?(l=!1,a&&Ti(e,t,r,c.pos),c.pos=t.length,d=null):d=Po(Mi(n,c,r.state,g),o),g){var v=g[0].name;v&&(d="m-"+(d?v+" "+d:v))}if(!l||u!=d){for(;s<c.start;)s=Math.min(c.start,s+5e3),i(s,u);u=d}c.start=c.pos}for(;s<c.pos;){var y=Math.min(c.pos,s+5e3);i(y,u),s=y}}function os(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=G(o,l-1),u=s.stateAfter;if(u&&(!n||l+(u instanceof Nr?u.lookAhead:0)<=o.modeFrontier))return l;var c=Re(s.text,null,e.options.tabSize);(i==null||r>c)&&(i=l-1,r=c)}return i}function as(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;r>n;r--){var i=G(e,r).stateAfter;if(i&&(!(i instanceof Nr)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}var Io=!1,Rt=!1;function ls(){Io=!0}function ss(){Rt=!0}function Zn(e,t,n){this.marker=e,this.from=t,this.to=n}function un(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function us(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function fs(e,t,n){var r=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));r&&e.markedSpans&&r.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],r&&r.add(e.markedSpans)),t.marker.attachLine(e)}function cs(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker,l=o.from==null||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&a.type=="bookmark"&&(!n||!o.marker.insertLeft)){var s=o.to==null||(a.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new Zn(a,o.from,s?null:o.to))}}return r}function hs(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker,l=o.to==null||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&a.type=="bookmark"&&(!n||o.marker.insertLeft)){var s=o.from==null||(a.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new Zn(a,s?null:o.from-t,o.to==null?null:o.to-t))}}return r}function Ni(e,t){if(t.full)return null;var n=ur(e,t.from.line)&&G(e,t.from.line).markedSpans,r=ur(e,t.to.line)&&G(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,a=f(t.from,t.to)==0,l=cs(n,i,a),s=hs(r,o,a),u=t.text.length==1,c=se(t.text).length+(u?i:0);if(l)for(var d=0;d<l.length;++d){var g=l[d];if(g.to==null){var v=un(s,g.marker);v?u&&(g.to=v.to==null?null:v.to+c):g.to=i}}if(s)for(var y=0;y<s.length;++y){var w=s[y];if(w.to!=null&&(w.to+=c),w.from==null){var O=un(l,w.marker);O||(w.from=c,u&&(l||(l=[])).push(w))}else w.from+=c,u&&(l||(l=[])).push(w)}l&&(l=zo(l)),s&&s!=l&&(s=zo(s));var W=[l];if(!u){var F=t.text.length-2,H;if(F>0&&l)for(var U=0;U<l.length;++U)l[U].to==null&&(H||(H=[])).push(new Zn(l[U].marker,null,null));for(var Q=0;Q<F;++Q)W.push(H);W.push(s)}return W}function zo(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function ds(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(v){if(v.markedSpans)for(var y=0;y<v.markedSpans.length;++y){var w=v.markedSpans[y].marker;w.readOnly&&(!r||Y(r,w)==-1)&&(r||(r=[])).push(w)}}),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var a=r[o],l=a.find(0),s=0;s<i.length;++s){var u=i[s];if(!(f(u.to,l.from)<0||f(u.from,l.to)>0)){var c=[s,1],d=f(u.from,l.from),g=f(u.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&c.push({from:u.from,to:l.from}),(g>0||!a.inclusiveRight&&!g)&&c.push({from:l.to,to:u.to}),i.splice.apply(i,c),s+=c.length-3}}return i}function Bo(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function Ro(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function Qn(e){return e.inclusiveLeft?-1:0}function Jn(e){return e.inclusiveRight?1:0}function Oi(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),o=f(r.from,i.from)||Qn(e)-Qn(t);if(o)return-o;var a=f(r.to,i.to)||Jn(e)-Jn(t);return a||t.id-e.id}function Uo(e,t){var n=Rt&&e.markedSpans,r;if(n)for(var i=void 0,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Oi(r,i.marker)<0)&&(r=i.marker);return r}function _o(e){return Uo(e,!0)}function Vn(e){return Uo(e,!1)}function ps(e,t){var n=Rt&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var o=n[i];o.marker.collapsed&&(o.from==null||o.from<t)&&(o.to==null||o.to>t)&&(!r||Oi(r,o.marker)<0)&&(r=o.marker)}return r}function Go(e,t,n,r,i){var o=G(e,t),a=Rt&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var u=s.marker.find(0),c=f(u.from,n)||Qn(s.marker)-Qn(i),d=f(u.to,r)||Jn(s.marker)-Jn(i);if(!(c>=0&&d<=0||c<=0&&d>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?f(u.to,n)>=0:f(u.to,n)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?f(u.from,r)<=0:f(u.from,r)<0)))return!0}}}function Ct(e){for(var t;t=_o(e);)e=t.find(-1,!0).line;return e}function vs(e){for(var t;t=Vn(e);)e=t.find(1,!0).line;return e}function gs(e){for(var t,n;t=Vn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Di(e,t){var n=G(e,t),r=Ct(n);return n==r?t:ce(r)}function qo(e,t){if(t>e.lastLine())return t;var n=G(e,t),r;if(!Qt(e,n))return t;for(;r=Vn(n);)n=r.find(1,!0).line;return ce(n)+1}function Qt(e,t){var n=Rt&&t.markedSpans;if(n){for(var r=void 0,i=0;i<n.length;++i)if(r=n[i],!!r.marker.collapsed){if(r.from==null)return!0;if(!r.marker.widgetNode&&r.from==0&&r.marker.inclusiveLeft&&Ei(e,t,r))return!0}}}function Ei(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Ei(e,r.line,un(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Ei(e,t,i))return!0}function Ut(e){e=Ct(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;n=o,o=n.parent)for(var a=0;a<o.children.length;++a){var l=o.children[a];if(l==n)break;t+=l.height}return t}function $n(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=_o(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Vn(r);){var o=n.find(0,!0);t-=r.text.length-o.from.ch,r=o.to.line,t+=r.text.length-o.to.ch}return t}function Ai(e){var t=e.display,n=e.doc;t.maxLine=G(n,n.first),t.maxLineLength=$n(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=$n(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Or=function(e,t,n){this.text=e,Ro(this,t),this.height=n?n(this):1};Or.prototype.lineNo=function(){return ce(this)},Ot(Or);function ys(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Bo(e),Ro(e,n);var i=r?r(e):1;i!=e.height&&ot(e,i)}function ms(e){e.parent=null,Bo(e)}var bs={},xs={};function Ko(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?xs:bs;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Xo(e,t){var n=h("span",null,null,A?"padding-right: .1px":null),r={pre:h("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;r.pos=0,r.addToken=Ss,Dt(e.display.measure)&&(a=it(o,e.doc.direction))&&(r.addToken=ks(r.addToken,a)),r.map=[];var l=t!=e.display.externalMeasured&&ce(o);Ls(o,r,Eo(e,o,l)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=Ze(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=Ze(o.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Kn(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(A){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return $(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ze(r.pre.className,r.textClass||"")),r}function ws(e){var t=M("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ss(e,t,n,r,i,o,a){if(t){var l=e.splitSpaces?Cs(t,e.trailingSpace):t,s=e.cm.state.specialChars,u=!1,c;if(!s.test(t))e.col+=t.length,c=document.createTextNode(l),e.map.push(e.pos,e.pos+t.length,c),C&&q<9&&(u=!0),e.pos+=t.length;else{c=document.createDocumentFragment();for(var d=0;;){s.lastIndex=d;var g=s.exec(t),v=g?g.index-d:t.length-d;if(v){var y=document.createTextNode(l.slice(d,d+v));C&&q<9?c.appendChild(M("span",[y])):c.appendChild(y),e.map.push(e.pos,e.pos+v,y),e.col+=v,e.pos+=v}if(!g)break;d+=v+1;var w=void 0;if(g[0]==" "){var O=e.cm.options.tabSize,W=O-e.col%O;w=c.appendChild(M("span",xr(W),"cm-tab")),w.setAttribute("role","presentation"),w.setAttribute("cm-text"," "),e.col+=W}else g[0]=="\r"||g[0]==`
`?(w=c.appendChild(M("span",g[0]=="\r"?"␍":"","cm-invalidchar")),w.setAttribute("cm-text",g[0]),e.col+=1):(w=e.cm.options.specialCharPlaceholder(g[0]),w.setAttribute("cm-text",g[0]),C&&q<9?c.appendChild(M("span",[w])):c.appendChild(w),e.col+=1);e.map.push(e.pos,e.pos+1,w),e.pos++}}if(e.trailingSpace=l.charCodeAt(t.length-1)==32,n||r||i||u||o||a){var F=n||"";r&&(F+=r),i&&(F+=i);var H=M("span",[c],F,o);if(a)for(var U in a)a.hasOwnProperty(U)&&U!="style"&&U!="class"&&H.setAttribute(U,a[U]);return e.content.appendChild(H)}e.content.appendChild(c)}}function Cs(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i);o==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(o=" "),r+=o,n=o==" "}return r}function ks(e,t){return function(n,r,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var u=n.pos,c=u+r.length;;){for(var d=void 0,g=0;g<t.length&&(d=t[g],!(d.to>u&&d.from<=u));g++);if(d.to>=c)return e(n,r,i,o,a,l,s);e(n,r.slice(0,d.to-u),i,o,null,l,s),o=null,r=r.slice(d.to-u),u=d.to}}}function Yo(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ls(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(!r){for(var a=1;a<n.length;a+=2)t.addToken(t,i.slice(o,o=n[a]),Ko(n[a+1],t.cm.options));return}for(var l=i.length,s=0,u=1,c="",d,g,v=0,y,w,O,W,F;;){if(v==s){y=w=O=g="",F=null,W=null,v=1/0;for(var H=[],U=void 0,Q=0;Q<r.length;++Q){var X=r[Q],ae=X.marker;if(ae.type=="bookmark"&&X.from==s&&ae.widgetNode)H.push(ae);else if(X.from<=s&&(X.to==null||X.to>s||ae.collapsed&&X.to==s&&X.from==s)){if(X.to!=null&&X.to!=s&&v>X.to&&(v=X.to,w=""),ae.className&&(y+=" "+ae.className),ae.css&&(g=(g?g+";":"")+ae.css),ae.startStyle&&X.from==s&&(O+=" "+ae.startStyle),ae.endStyle&&X.to==v&&(U||(U=[])).push(ae.endStyle,X.to),ae.title&&((F||(F={})).title=ae.title),ae.attributes)for(var me in ae.attributes)(F||(F={}))[me]=ae.attributes[me];ae.collapsed&&(!W||Oi(W.marker,ae)<0)&&(W=X)}else X.from>s&&v>X.from&&(v=X.from)}if(U)for(var Pe=0;Pe<U.length;Pe+=2)U[Pe+1]==v&&(w+=" "+U[Pe]);if(!W||W.from==s)for(var Se=0;Se<H.length;++Se)Yo(t,0,H[Se]);if(W&&(W.from||0)==s){if(Yo(t,(W.to==null?l+1:W.to)-s,W.marker,W.from==null),W.to==null)return;W.to==s&&(W=!1)}}if(s>=l)break;for(var lt=Math.min(l,v);;){if(c){var tt=s+c.length;if(!W){var Ne=tt>lt?c.slice(0,lt-s):c;t.addToken(t,Ne,d?d+y:y,O,s+Ne.length==v?w:"",g,F)}if(tt>=lt){c=c.slice(lt-s),s=lt;break}s=tt,O=""}c=i.slice(o,o=n[u++]),d=Ko(n[u++],t.cm.options)}}}function jo(e,t,n){this.line=t,this.rest=gs(t),this.size=this.rest?ce(se(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Qt(e,t)}function ei(e,t,n){for(var r=[],i,o=t;o<n;o=i){var a=new jo(e.doc,G(e.doc,o),o);i=o+a.size,r.push(a)}return r}var Dr=null;function Ts(e){Dr?Dr.ops.push(e):e.ownsGroup=Dr={ops:[e],delayedCallbacks:[]}}function Ms(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Ns(e,t){var n=e.ownsGroup;if(n)try{Ms(n)}finally{Dr=null,t(n)}}var fn=null;function Ae(e,t){var n=Cr(e,t);if(n.length){var r=Array.prototype.slice.call(arguments,2),i;Dr?i=Dr.delayedCallbacks:fn?i=fn:(i=fn=[],setTimeout(Os,0));for(var o=function(l){i.push(function(){return n[l].apply(null,r)})},a=0;a<n.length;++a)o(a)}}function Os(){var e=fn;fn=null;for(var t=0;t<e.length;++t)e[t]()}function Zo(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];o=="text"?Es(e,t):o=="gutter"?Jo(e,t,n,r):o=="class"?Wi(e,t):o=="widget"&&As(e,t,r)}t.changes=null}function cn(e){return e.node==e.text&&(e.node=M("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),C&&q<8&&(e.node.style.zIndex=2)),e.node}function Ds(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=cn(t);t.background=r.insertBefore(M("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Qo(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Xo(e,t)}function Es(e,t){var n=t.text.className,r=Qo(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,Wi(e,t)):n&&(t.text.className=n)}function Wi(e,t){Ds(e,t),t.line.wrapClass?cn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Jo(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=cn(t);t.gutterBackground=M("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var a=cn(t),l=t.gutter=M("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(l.setAttribute("aria-hidden","true"),e.display.input.setUneditable(l),a.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!o||!o["CodeMirror-linenumbers"])&&(t.lineNumber=l.appendChild(M("div",ln(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.display.gutterSpecs.length;++s){var u=e.display.gutterSpecs[s].className,c=o.hasOwnProperty(u)&&o[u];c&&l.appendChild(M("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[u]+"px; width: "+r.gutterWidth[u]+"px"))}}}function As(e,t,n){t.alignable&&(t.alignable=null);for(var r=gt("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Vo(e,t,n)}function Ws(e,t,n,r){var i=Qo(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Wi(e,t),Jo(e,t,n,r),Vo(e,t,r),t.node}function Vo(e,t,n){if($o(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)$o(e,t.rest[r],t,n,!1)}function $o(e,t,n,r,i){if(t.widgets)for(var o=cn(n),a=0,l=t.widgets;a<l.length;++a){var s=l[a],u=M("div",[s.node],"CodeMirror-linewidget"+(s.className?" "+s.className:""));s.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),Hs(s,u,n,r),e.display.input.setUneditable(u),i&&s.above?o.insertBefore(u,n.gutter||n.text):o.appendChild(u),Ae(s,"redraw")}}function Hs(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function hn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),S(t.display.measure,M("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function _t(e,t){for(var n=jt(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function ti(e){return e.lineSpace.offsetTop}function Hi(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ea(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=S(e.measure,M("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Ht(e){return re-e.display.nativeBarWidth}function fr(e){return e.display.scroller.clientWidth-Ht(e)-e.display.barWidth}function Pi(e){return e.display.scroller.clientHeight-Ht(e)-e.display.barHeight}function Ps(e,t,n){var r=e.options.lineWrapping,i=r&&fr(e);if(!t.measure.heights||r&&t.measure.width!=i){var o=t.measure.heights=[];if(r){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],u=a[l+1];Math.abs(s.bottom-u.bottom)>2&&o.push((s.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function ta(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(ce(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function Fs(e,t){t=Ct(t);var n=ce(t),r=e.display.externalMeasured=new jo(e.doc,t,n);r.lineN=n;var i=r.built=Xo(e,r);return r.text=i.pre,S(e.display.lineMeasure,i.pre),r}function ra(e,t,n,r){return Pt(e,Er(e,t),n,r)}function Fi(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[dr(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Er(e,t){var n=ce(t),r=Fi(e,n);r&&!r.text?r=null:r&&r.changes&&(Zo(e,r,n,Ui(e)),e.curOp.forceUpdate=!0),r||(r=Fs(e,t));var i=ta(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Pt(e,t,n,r,i){t.before&&(n=-1);var o=n+(r||""),a;return t.cache.hasOwnProperty(o)?a=t.cache[o]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ps(e,t.view,t.rect),t.hasHeights=!0),a=zs(e,t,n,r),a.bogus||(t.cache[o]=a)),{left:a.left,right:a.right,top:i?a.rtop:a.top,bottom:i?a.rbottom:a.bottom}}var na={left:0,right:0,top:0,bottom:0};function ia(e,t,n){for(var r,i,o,a,l,s,u=0;u<e.length;u+=3)if(l=e[u],s=e[u+1],t<l?(i=0,o=1,a="left"):t<s?(i=t-l,o=i+1):(u==e.length-3||t==s&&e[u+3]>t)&&(o=s-l,i=o-1,t>=s&&(a="right")),i!=null){if(r=e[u+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),n=="left"&&i==0)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[(u-=3)+2],a="left";if(n=="right"&&i==s-l)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)r=e[(u+=3)+2],a="right";break}return{node:r,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function Is(e,t){var n=na;if(t=="left")for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;i>=0&&(n=e[i]).left==n.right;i--);return n}function zs(e,t,n,r){var i=ia(t.map,n,r),o=i.node,a=i.start,l=i.end,s=i.collapse,u;if(o.nodeType==3){for(var c=0;c<4;c++){for(;a&&Vr(t.line.text.charAt(i.coverStart+a));)--a;for(;i.coverStart+l<i.coverEnd&&Vr(t.line.text.charAt(i.coverStart+l));)++l;if(C&&q<9&&a==0&&l==i.coverEnd-i.coverStart?u=o.parentNode.getBoundingClientRect():u=Is(I(o,a,l).getClientRects(),r),u.left||u.right||a==0)break;l=a,a=a-1,s="right"}C&&q<11&&(u=Bs(e.display.measure,u))}else{a>0&&(s=r="right");var d;e.options.lineWrapping&&(d=o.getClientRects()).length>1?u=d[r=="right"?d.length-1:0]:u=o.getBoundingClientRect()}if(C&&q<9&&!a&&(!u||!u.left&&!u.right)){var g=o.parentNode.getClientRects()[0];g?u={left:g.left,right:g.left+Wr(e.display),top:g.top,bottom:g.bottom}:u=na}for(var v=u.top-t.rect.top,y=u.bottom-t.rect.top,w=(v+y)/2,O=t.view.measure.heights,W=0;W<O.length-1&&!(w<O[W]);W++);var F=W?O[W-1]:0,H=O[W],U={left:(s=="right"?u.right:u.left)-t.rect.left,right:(s=="left"?u.left:u.right)-t.rect.left,top:F,bottom:H};return!u.left&&!u.right&&(U.bogus=!0),e.options.singleCursorHeightPerLine||(U.rtop=v,U.rbottom=y),U}function Bs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Zt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function oa(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function aa(e){e.display.externalMeasure=null,ut(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)oa(e.display.view[t])}function dn(e){aa(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function la(){return K&&ie?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function sa(){return K&&ie?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Ii(e){var t=Ct(e),n=t.widgets,r=0;if(n)for(var i=0;i<n.length;++i)n[i].above&&(r+=hn(n[i]));return r}function ri(e,t,n,r,i){if(!i){var o=Ii(t);n.top+=o,n.bottom+=o}if(r=="line")return n;r||(r="local");var a=Ut(t);if(r=="local"?a+=ti(e.display):a-=e.display.viewOffset,r=="page"||r=="window"){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+(r=="window"?0:sa());var s=l.left+(r=="window"?0:la());n.left+=s,n.right+=s}return n.top+=a,n.bottom+=a,n}function ua(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=la(),i-=sa();else if(n=="local"||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function ni(e,t,n,r,i){return r||(r=G(e.doc,t.line)),ri(e,r,ra(e,r,t.ch,i),n)}function kt(e,t,n,r,i,o){r=r||G(e.doc,t.line),i||(i=Er(e,r));function a(y,w){var O=Pt(e,i,y,w?"right":"left",o);return w?O.left=O.right:O.right=O.left,ri(e,r,O,n)}var l=it(r,e.doc.direction),s=t.ch,u=t.sticky;if(s>=r.text.length?(s=r.text.length,u="before"):s<=0&&(s=0,u="after"),!l)return a(u=="before"?s-1:s,u=="before");function c(y,w,O){var W=l[w],F=W.level==1;return a(O?y-1:y,F!=O)}var d=Ce(l,s,u),g=ft,v=c(s,d,u=="before");return g!=null&&(v.other=c(s,g,u!="before")),v}function fa(e,t){var n=0;t=R(e.doc,t),e.options.lineWrapping||(n=Wr(e.display)*t.ch);var r=G(e.doc,t.line),i=Ut(r)+ti(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function zi(e,t,n,r,i){var o=L(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Bi(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return zi(r.first,0,null,-1,-1);var i=At(r,n),o=r.first+r.size-1;if(i>o)return zi(r.first+r.size-1,G(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=G(r,i);;){var l=Rs(e,a,i,t,n),s=ps(a,l.ch+(l.xRel>0||l.outside>0?1:0));if(!s)return l;var u=s.find(1);if(u.line==i)return u;a=G(r,i=u.line)}}function ca(e,t,n,r){r-=Ii(t);var i=t.text.length,o=Nt(function(a){return Pt(e,n,a-1).bottom<=r},i,0);return i=Nt(function(a){return Pt(e,n,a).top>r},o,i),{begin:o,end:i}}function ha(e,t,n,r){n||(n=Er(e,t));var i=ri(e,t,Pt(e,n,r),"line").top;return ca(e,t,n,i)}function Ri(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Rs(e,t,n,r,i){i-=Ut(t);var o=Er(e,t),a=Ii(t),l=0,s=t.text.length,u=!0,c=it(t,e.doc.direction);if(c){var d=(e.options.lineWrapping?_s:Us)(e,t,n,o,c,r,i);u=d.level!=1,l=u?d.from:d.to-1,s=u?d.to:d.from-1}var g=null,v=null,y=Nt(function(Q){var X=Pt(e,o,Q);return X.top+=a,X.bottom+=a,Ri(X,r,i,!1)?(X.top<=i&&X.left<=r&&(g=Q,v=X),!0):!1},l,s),w,O,W=!1;if(v){var F=r-v.left<v.right-r,H=F==u;y=g+(H?0:1),O=H?"after":"before",w=F?v.left:v.right}else{!u&&(y==s||y==l)&&y++,O=y==0?"after":y==t.text.length?"before":Pt(e,o,y-(u?1:0)).bottom+a<=i==u?"after":"before";var U=kt(e,L(n,y,O),"line",t,o);w=U.left,W=i<U.top?-1:i>=U.bottom?1:0}return y=Gn(t.text,y,1),zi(n,y,O,W,r-w)}function Us(e,t,n,r,i,o,a){var l=Nt(function(d){var g=i[d],v=g.level!=1;return Ri(kt(e,L(n,v?g.to:g.from,v?"before":"after"),"line",t,r),o,a,!0)},0,i.length-1),s=i[l];if(l>0){var u=s.level!=1,c=kt(e,L(n,u?s.from:s.to,u?"after":"before"),"line",t,r);Ri(c,o,a,!0)&&c.top>a&&(s=i[l-1])}return s}function _s(e,t,n,r,i,o,a){var l=ca(e,t,r,a),s=l.begin,u=l.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,d=null,g=0;g<i.length;g++){var v=i[g];if(!(v.from>=u||v.to<=s)){var y=v.level!=1,w=Pt(e,r,y?Math.min(u,v.to)-1:Math.max(s,v.from)).right,O=w<o?o-w+1e9:w-o;(!c||d>O)&&(c=v,d=O)}}return c||(c=i[i.length-1]),c.from<s&&(c={from:s,to:c.to,level:c.level}),c.to>u&&(c