bookstack/public/dist/code.js

34 lines
430 KiB
JavaScript
Raw Normal View History

var nf=Object.create;var go=Object.defineProperty;var of=Object.getOwnPropertyDescriptor;var lf=Object.getOwnPropertyNames;var af=Object.getPrototypeOf,sf=Object.prototype.hasOwnProperty;var uf=f=>go(f,"__esModule",{value:!0});var Be=(f,q)=>()=>(q||f((q={exports:{}}).exports,q),q.exports);var cf=(f,q,A,O)=>{if(q&&typeof q=="object"||typeof q=="function")for(let P of lf(q))!sf.call(f,P)&&(A||P!=="default")&&go(f,P,{get:()=>q[P],enumerable:!(O=of(q,P))||O.enumerable});return f},Ke=(f,q)=>cf(uf(go(f!=null?nf(af(f)):{},"default",!q&&f&&f.__esModule?{get:()=>f.default,enumerable:!0}:{value:f,enumerable:!0})),f);var je=Be((mo,vo)=>{(function(f,q){typeof mo=="object"&&typeof vo<"u"?vo.exports=q():typeof define=="function"&&define.amd?define(q):(f=f||self,f.CodeMirror=q())})(mo,function(){"use strict";var f=navigator.userAgent,q=navigator.platform,A=/gecko\/\d/i.test(f),O=/MSIE \d/.test(f),P=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(f),N=/Edge\/(\d+)/.exec(f),g=O||P||N,j=g&&(O?document.documentMode||6:+(N||P)[1]),T=!N&&/WebKit\//.test(f),D=T&&/Qt\/\d+\.\d+/.test(f),E=!N&&/Chrome\//.test(f),h=/Opera\//.test(f),v=/Apple Computer/.test(navigator.vendor),b=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(f),M=/PhantomJS/.test(f),C=v&&(/Mobile\/\w+/.test(f)||navigator.maxTouchPoints>2),y=/Android/.test(f),G=C||y||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(f),_=C||/Mac/.test(q),H=/\bCrOS\b/.test(f),K=/win/i.test(q),ee=h&&f.match(/Version\/(\d*\.\d*)/);ee&&(ee=Number(ee[1])),ee&&ee>=15&&(h=!1,T=!0);var J=_&&(D||h&&(ee==null||ee<12.11)),ne=A||g&&j>=9;function V(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var X=function(e,t){var n=e.className,r=V(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 re(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function F(e,t){return re(e).appendChild(t)}function S(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 p(e,t,n,r){var i=S(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 W(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 w(){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 k(e,t){var n=e.className;V(t).test(n)||(e.className+=(n?" ":"")+t)}function Z(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!V(n[r]).test(t)&&(t+=" "+n[r]);return t}var $=function(e){e.select()};C?$=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:g&&($=function(e){try{e.select()}catch{}});function m(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function d(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 ae(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var o=r||0,l=i||0;;){var a=e.indexOf(" ",o);if(a<0||a>=t)return l+(t-o);l+=a-o,l+=n-l%n,o=a+1}}var be=function(){this.id=null,this.f=null,this.time=0,this.handler=m(this.onTimeout,this)};be.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},be.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 le(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ve=50,Ee={toString:function(){return"CodeMirror.Pass"}},Me={scroll:!1},oe={origin:"*mouse"},de={origin:"+move"};functi
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),l=o.indexOf("\r");l!=-1?(n.push(o.slice(0,l)),t+=l+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Bn=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},jn=function(){var e=S("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ln=null;function sr(e){if(ln!=null)return ln;var t=F(e,S("span","x")),n=t.getBoundingClientRect(),r=I(t,0,1).getBoundingClientRect();return ln=Math.abs(n.left-r.left)>1}var qt={},Ot={};function Hn(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),qt[e]=t}function er(e,t){Ot[e]=t}function Or(e){if(typeof e=="string"&&Ot.hasOwnProperty(e))e=Ot[e];else if(e&&typeof e.name=="string"&&Ot.hasOwnProperty(e.name)){var t=Ot[e.name];typeof t=="string"&&(t={name:t}),e=lt(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Or("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Or("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Ir(e,t){t=Or(t);var n=qt[t.name];if(!n)return Ir(e,"text/plain");var r=n(e,t);if(Rt.hasOwnProperty(t.name)){var i=Rt[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 l in t.modeProps)r[l]=t.modeProps[l];return r}var Rt={};function Wt(e,t){var n=Rt.hasOwnProperty(e)?Rt[e]:Rt[e]={};d(t,n)}function It(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 an(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 sn(e,t,n){return e.startState?e.startState(t,n):!0}var et=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};et.prototype.eol=function(){return this.pos>=this.string.length},et.prototype.sol=function(){return this.pos==this.lineStart},et.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},et.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},et.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},et.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},et.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},et.prototype.skipToEnd=function(){this.pos=this.string.length},et.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},et.prototype.backUp=function(e){this.pos-=e},et.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ae(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?ae(this.string,this.lineStart,this.tabSize):0)},et.prototype.indentation=function(){return ae(this.string,null,this.tabSize)-(this.lineStart?ae(this.string,this.lineStart,this.tabSize):0)},et.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(l){return n?l.toLowerCase():l},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)}},et.prototype.current=function(){return this.string.slice(this.start,this.pos)},et.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},et.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},et.p
`?(ie=x.appendChild(S("span",B[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ie.setAttribute("cm-text",B[0]),e.col+=1):(ie=e.cm.options.specialCharPlaceholder(B[0]),ie.setAttribute("cm-text",B[0]),g&&j<9?x.appendChild(S("span",[ie])):x.appendChild(ie),e.col+=1);e.map.push(e.pos,e.pos+1,ie),e.pos++}}if(e.trailingSpace=a.charCodeAt(t.length-1)==32,n||r||i||u||o||l){var ge=n||"";r&&(ge+=r),i&&(ge+=i);var he=S("span",[x],ge,o);if(l)for(var ye in l)l.hasOwnProperty(ye)&&ye!="style"&&ye!="class"&&he.setAttribute(ye,l[ye]);return e.content.appendChild(he)}e.content.appendChild(x)}}function wu(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="\xA0"),r+=o,n=o==" "}return r}function Su(e,t){return function(n,r,i,o,l,a,s){i=i?i+" cm-force-border":"cm-force-border";for(var u=n.pos,x=u+r.length;;){for(var L=void 0,B=0;B<t.length&&(L=t[B],!(L.to>u&&L.from<=u));B++);if(L.to>=x)return e(n,r,i,o,l,a,s);e(n,r.slice(0,L.to-u),i,o,null,a,s),o=null,r=r.slice(L.to-u),u=L.to}}}function Bo(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 Tu(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(!r){for(var l=1;l<n.length;l+=2)t.addToken(t,i.slice(o,o=n[l]),Ro(n[l+1],t.cm.options));return}for(var a=i.length,s=0,u=1,x="",L,B,R=0,Y,ie,fe,pe,ge;;){if(R==s){Y=ie=fe=B="",ge=null,pe=null,R=1/0;for(var he=[],ye=void 0,Te=0;Te<r.length;++Te){var we=r[Te],Pe=we.marker;if(Pe.type=="bookmark"&&we.from==s&&Pe.widgetNode)he.push(Pe);else if(we.from<=s&&(we.to==null||we.to>s||Pe.collapsed&&we.to==s&&we.from==s)){if(we.to!=null&&we.to!=s&&R>we.to&&(R=we.to,ie=""),Pe.className&&(Y+=" "+Pe.className),Pe.css&&(B=(B?B+";":"")+Pe.css),Pe.startStyle&&we.from==s&&(fe+=" "+Pe.startStyle),Pe.endStyle&&we.to==R&&(ye||(ye=[])).push(Pe.endStyle,we.to),Pe.title&&((ge||(ge={})).title=Pe.title),Pe.attributes)for(var Ze in Pe.attributes)(ge||(ge={}))[Ze]=Pe.attributes[Ze];Pe.collapsed&&(!pe||Ti(pe.marker,Pe)<0)&&(pe=we)}else we.from>s&&R>we.from&&(R=we.from)}if(ye)for(var ft=0;ft<ye.length;ft+=2)ye[ft+1]==R&&(ie+=" "+ye[ft]);if(!pe||pe.from==s)for(var Je=0;Je<he.length;++Je)Bo(t,0,he[Je]);if(pe&&(pe.from||0)==s){if(Bo(t,(pe.to==null?a+1:pe.to)-s,pe.marker,pe.from==null),pe.to==null)return;pe.to==s&&(pe=!1)}}if(s>=a)break;for(var At=Math.min(a,R);;){if(x){var Ct=s+x.length;if(!pe){var it=Ct>At?x.slice(0,At-s):x;t.addToken(t,it,L?L+Y:Y,fe,s+it.length==R?ie:"",B,ge)}if(Ct>=At){x=x.slice(At-s),s=At;break}s=Ct,fe=""}x=i.slice(o,o=n[u++]),L=Ro(n[u++],t.cm.options)}}}function jo(e,t,n){this.line=t,this.rest=mu(t),this.size=this.rest?He(De(this.rest))-n+1:1,this.node=this.text=null,this.hidden=ur(e,t)}function Zn(e,t,n){for(var r=[],i,o=t;o<n;o=i){var l=new jo(e.doc,ke(e.doc,o),o);i=o+l.size,r.push(l)}return r}var qr=null;function Cu(e){qr?qr.ops.push(e):e.ownsGroup=qr={ops:[e],delayedCallbacks:[]}}function Lu(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 Eu(e,t){var n=e.ownsGroup;if(!!n)try{Lu(n)}finally{qr=null,t(n)}}var pn=null;function st(e,t){var n=Ar(e,t);if(!!n.length){var r=Array.prototype.slice.call(arguments,2),i;qr?i=qr.delayedCallbacks:pn?i=pn:(i=pn=[],setTimeout(Mu,0));for(var o=function(a){i.push(function(){return n[a].apply(null,r)})},l=0;l<n.length;++l)o(l)}}function Mu(){var e=pn;pn=null;for(var t=0;t<e.length;++t)e[t]()}function Ho(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];o=="text"?Au(e,t):o=="gutter"?Ko(e,t,n,r):o=="class"?Mi(e,t):o=="widget"&&Du(e,t,r)}t.changes=null}function hn(e){return e.node==e.text&&(e.node=S("div",null,null,"position: relat
top: `+ye+"px; width: "+(Te??s-he)+`px;
height: `+(we-ye)+"px"))}function L(he,ye,Te){var we=ke(i,he),Pe=we.text.length,Ze,ft;function Je(it,Lt){return Jn(e,se(he,it),"div",we,Lt)}function At(it,Lt,ht){var at=ll(e,we,null,it),ot=Lt=="ltr"==(ht=="after")?"left":"right",tt=ht=="after"?at.begin:at.end-(/\s/.test(we.text.charAt(at.end-1))?2:1);return Je(tt,ot)[ot]}var Ct=bt(we,i.direction);return Se(Ct,ye||0,Te??Pe,function(it,Lt,ht,at){var ot=ht=="ltr",tt=Je(it,ot?"left":"right"),Et=Je(Lt-1,ot?"right":"left"),en=ye==null&&it==0,vr=Te==null&&Lt==Pe,yt=at==0,Jt=!Ct||at==Ct.length-1;if(Et.top-tt.top<=3){var dt=(u?en:vr)&&yt,po=(u?vr:en)&&Jt,lr=dt?a:(ot?tt:Et).left,Er=po?s:(ot?Et:tt).right;x(lr,tt.top,Er-lr,tt.bottom)}else{var Mr,_t,tn,ho;ot?(Mr=u&&en&&yt?a:tt.left,_t=u?s:At(it,ht,"before"),tn=u?a:At(Lt,ht,"after"),ho=u&&vr&&Jt?s:Et.right):(Mr=u?At(it,ht,"before"):a,_t=!u&&en&&yt?s:tt.right,tn=!u&&vr&&Jt?a:Et.left,ho=u?At(Lt,ht,"after"):s),x(Mr,tt.top,_t-Mr,tt.bottom),tt.bottom<Et.top&&x(a,tt.bottom,null,Et.top),x(tn,Et.top,ho-tn,Et.bottom)}(!Ze||ei(tt,Ze)<0)&&(Ze=tt),ei(Et,Ze)<0&&(Ze=Et),(!ft||ei(tt,ft)<0)&&(ft=tt),ei(Et,ft)<0&&(ft=Et)}),{start:Ze,end:ft}}var B=t.from(),R=t.to();if(B.line==R.line)L(B.line,B.ch,R.ch);else{var Y=ke(i,B.line),ie=ke(i,R.line),fe=Bt(Y)==Bt(ie),pe=L(B.line,B.ch,fe?Y.text.length+1:null).end,ge=L(R.line,fe?0:null,R.ch).start;fe&&(pe.top<ge.top-2?(x(pe.right,pe.top,null,pe.bottom),x(a,ge.top,ge.left,ge.bottom)):x(pe.right,pe.top,ge.left-pe.right,pe.bottom)),pe.bottom<ge.top&&x(a,pe.bottom,null,ge.top)}n.appendChild(o)}function Bi(e){if(!!e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||jr(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function cl(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Hi(e))}function ji(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&jr(e))},100)}function Hi(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(ze(e,"focus",e,t),e.state.focused=!0,k(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),T&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Bi(e))}function jr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(ze(e,"blur",e,t),e.state.focused=!1,X(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function ti(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,o=0,l=0;l<t.view.length;l++){var a=t.view[l],s=e.options.lineWrapping,u=void 0,x=0;if(!a.hidden){if(i+=a.line.height,g&&j<8){var L=a.node.offsetTop+a.node.offsetHeight;u=L-n,n=L}else{var B=a.node.getBoundingClientRect();u=B.bottom-B.top,!s&&a.text.firstChild&&(x=a.text.firstChild.getBoundingClientRect().right-B.left-1)}var R=a.line.height-u;if((R>.005||R<-.005)&&(i<r&&(o-=R),Mt(a.line,u),fl(a.line),a.rest))for(var Y=0;Y<a.rest.length;Y++)fl(a.rest[Y]);if(x>e.display.sizerWidth){var ie=Math.ceil(x/Br(e.display));ie>e.display.maxLineLength&&(e.display.maxLineLength=ie,e.display.maxLine=a.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function fl(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function ri(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Yn(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,o=Xt(t,r),l=Xt(t,i);if(n&&n.ensure){var a=n.ensure.from.line,s=n.ensure.to.line;a<o?(o=a,l=Xt(t,rr(ke(t,a))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=l&&(o=Xt(t,rr(ke(t,s))-e.wrapper.clientHeight)
top: `+(t.top-n.viewOffset-Yn(e.display))+`px;
height: `+(t.bottom-t.top+Yt(e)+n.barHeight)+`px;
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)}}}function $u(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?se(t.line,t.ch+1,"before"):t,t=t.ch?se(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var l=!1,a=jt(e,t),s=!n||n==t?a:jt(e,n);i={left:Math.min(a.left,s.left),top:Math.min(a.top,s.top)-r,right:Math.max(a.left,s.left),bottom:Math.max(a.bottom,s.bottom)+r};var u=Ui(e,i),x=e.doc.scrollTop,L=e.doc.scrollLeft;if(u.scrollTop!=null&&(bn(e,u.scrollTop),Math.abs(e.doc.scrollTop-x)>1&&(l=!0)),u.scrollLeft!=null&&(Sr(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-L)>1&&(l=!0)),!l)break}return i}function Gu(e,t){var n=Ui(e,t);n.scrollTop!=null&&bn(e,n.scrollTop),n.scrollLeft!=null&&Sr(e,n.scrollLeft)}function Ui(e,t){var n=e.display,r=Wr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,o=Ai(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var a=e.doc.height+zi(n),s=t.top<r,u=t.bottom>a-r;if(t.top<i)l.scrollTop=s?0:t.top;else if(t.bottom>i+o){var x=Math.min(t.top,(u?a:t.bottom)-o);x!=i&&(l.scrollTop=x)}var L=e.options.fixedGutter?0:n.gutters.offsetWidth,B=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-L,R=xr(e)-n.gutters.offsetWidth,Y=t.right-t.left>R;return Y&&(t.right=t.left+R),t.left<10?l.scrollLeft=0:t.left<B?l.scrollLeft=Math.max(0,t.left+L-(Y?0:10)):t.right>R+B-3&&(l.scrollLeft=t.right+(Y?0:10)-R),l}function Ki(e,t){t!=null&&(ni(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Hr(e){ni(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function yn(e,t,n){(t!=null||n!=null)&&ni(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Xu(e,t){ni(e),e.curOp.scrollToPos=t}function ni(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=il(e,t.from),r=il(e,t.to);dl(e,n,r,t.margin)}}function dl(e,t,n,r){var i=Ui(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});yn(e,i.scrollLeft,i.scrollTop)}function bn(e,t){Math.abs(e.doc.scrollTop-t)<2||(A||Gi(e,{top:t}),pl(e,t,!0),A&&Gi(e),kn(e,100))}function pl(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 Sr(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,yl(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function xn(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+zi(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+Yt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Tr=function(e,t,n){this.cm=n;var r=this.vert=S("div",[S("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=S("div",[S("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Ce(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ce(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,g&&j<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Tr.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
`},setDirection:ct(function(e){e!="rtl"&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&cc(this.cm))})}),Tt.prototype.eachLine=Tt.prototype.iter;var Zl=0;function wc(e){var t=this;if(Yl(t),!(nt(t,e)||nr(t.display,e))){gt(e),g&&(Zl=+new Date);var n=kr(t,e,!0),r=e.dataTransfer.files;if(!(!n||t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),l=0,a=function(){++l==i&&ut(t,function(){n=me(t.doc,n);var R={from:n,to:n,text:t.doc.splitLines(o.filter(function(Y){return Y!=null}).join(t.doc.lineSeparator())),origin:"paste"};Gr(t.doc,R),Ol(t.doc,dr(me(t.doc,n),me(t.doc,pr(R))))})()},s=function(R,Y){if(t.options.allowDropFileTypes&&le(t.options.allowDropFileTypes,R.type)==-1){a();return}var ie=new FileReader;ie.onerror=function(){return a()},ie.onload=function(){var fe=ie.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(fe)){a();return}o[Y]=fe,a()},ie.readAsText(R)},u=0;u<r.length;u++)s(r[u],u);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var x=e.dataTransfer.getData("Text");if(x){var L;if(t.state.draggingText&&!t.state.draggingText.copy&&(L=t.listSelections()),ui(t.doc,dr(n,n)),L)for(var B=0;B<L.length;++B)Xr(t.doc,"",L[B].anchor,L[B].head,"drag");t.replaceSelection(x,"around","paste"),t.display.input.focus()}}catch{}}}}function Sc(e,t){if(g&&(!e.state.draggingText||+new Date-Zl<100)){yr(t);return}if(!(nt(e,t)||nr(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!v)){var n=S("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",h&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),h&&n.parentNode.removeChild(n)}}function Tc(e,t){var n=kr(e,t);if(!!n){var r=document.createDocumentFragment();Wi(e,n,r),e.display.dragCursor||(e.display.dragCursor=S("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),F(e.display.dragCursor,r)}}function Yl(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Ql(e){if(!!document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var o=0;o<n.length;o++)e(n[o])})}}var Jl=!1;function Cc(){Jl||(Lc(),Jl=!0)}function Lc(){var e;Ce(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Ql(Ec)},100))}),Ce(window,"blur",function(){return Ql(jr)})}function Ec(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var mr={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},An=0;An<10;An++)mr[An+48]=mr[An+96]=String(An);for(var di=65;di<=90;di++)mr[di]=String.fromCharCode(di);for(var Dn=1;Dn<=12;Dn++)mr[Dn+111]=mr[Dn+63235]="F"+Dn;var or={};or.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"},or.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine"
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ra(e,t){var n=ke(e.doc,t),r=Bt(n);return r!=n&&(t=He(r)),oo(!0,e,r,t,1)}function Dc(e,t){var n=ke(e.doc,t),r=gu(n);return r!=n&&(t=He(r)),oo(!0,e,n,t,-1)}function na(e,t){var n=ra(e,t.line),r=ke(e.doc,n.line),i=bt(r,e.doc.direction);if(!i||i[0].level==0){var o=Math.max(n.ch,r.text.search(/\S/)),l=t.line==n.line&&t.ch<=o&&t.ch;return se(n.line,l?0:o,n.sticky)}return n}function hi(e,t,n){if(typeof t=="string"&&(t=Fn[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ee}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Fc(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Yr(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Yr(t,e.options.extraKeys,n,e)||Yr(t,e.options.keyMap,n,e)}var Oc=new be;function On(e,t,n,r){var i=e.state.keySeq;if(i){if(Vl(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Oc.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ia(e,i+" "+t,n,r))return!0}return ia(e,t,n,r)}function ia(e,t,n,r){var i=Fc(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&st(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(gt(n),Bi(e)),!!i}function oa(e,t){var n=ta(t,!0);return n?t.shiftKey&&!e.state.keySeq?On(e,"Shift-"+n,t,function(r){return hi(e,r,!0)})||On(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return hi(e,r)}):On(e,n,t,function(r){return hi(e,r)}):!1}function Ic(e,t,n){return On(e,"'"+n+"'",t,function(r){return hi(e,r,!0)})}var lo=null;function la(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=w(),!nt(t,e))){g&&j<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=oa(t,e);h&&(lo=r?n:null,!r&&n==88&&!jn&&(_?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),A&&!_&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Pc(t)}}function Pc(e){var t=e.display.lineDiv;k(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(X(t,"CodeMirror-crosshair"),kt(document,"keyup",n),kt(document,"mouseover",n))}Ce(document,"keyup",n),Ce(document,"mouseover",n)}function aa(e){e.keyCode==16&&(this.doc.sel.shift=!1),nt(this,e)}function sa(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(nr(t.display,e)||nt(t,e)||e.ctrlKey&&!e.altKey||_&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(h&&n==lo){lo=null,gt(e);return}if(!(h&&(!e.which||e.which<10)&&oa(t,e))){var i=String.fromCharCode(r??n);i!="\b"&&(Ic(t,e,i)||t.display.input.onKeyPress(e))}}}var Nc=400,ao=function(e,t,n){this.time=e,this.pos=t,this.button=n};ao.prototype.compare=function(e,t,n){return this.time+Nc>e&&c(t,this.pos)==0&&n==this.button};var In,Pn;function qc(e,t){var n=+new Date;return Pn&&Pn.compare(n,e,t)?(In=Pn=null,"triple"):In&&In.compare(n,e,t)?(Pn=new ao(n,e,t),In=null,"double"):(In=new ao(n,e,t),Pn=null,"single")}function ua(e){var t=this,n=t.display;if(!(nt(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,nr(n,e)){T||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!so(t,e)){var r=kr(t,e),i=Rn(e),o=r?qc(r,i):"single";window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Rc(t,i,r,o,e))&&(i==1?r?Bc(t,r,o,e):ar(e)==n.scroller&&gt(e):i==2?(r&&si(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(ne?t.display.input.onContextMenu(e):ji(t)))}}}function Rc(e,t,n,r,i){var o="Click";return r=="double"?o="Double"+o:r=="triple"&&(o="Triple"+o),o=(t==1?"Left":t==2?"Middle":"Right")+o,On(e,ea(o,i),i,function(l){if(typeof l=="string"&&(l=Fn[l]),!l)return!1;var a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),a=l(e,n)!=Ee}finally{e.state.suppressEdits=!1}return a})}function Wc(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==nul
`)==t){if(r.ranges.length%Ut.text.length==0){u=[];for(var x=0;x<Ut.text.length;x++)u.push(o.splitLines(Ut.text[x]))}}else s.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(u=qe(s,function(pe){return[pe]}));for(var L=e.curOp.updateInput,B=r.ranges.length-1;B>=0;B--){var R=r.ranges[B],Y=R.from(),ie=R.to();R.empty()&&(n&&n>0?Y=se(Y.line,Y.ch-n):e.state.overwrite&&!a?ie=se(ie.line,Math.min(ke(o,ie.line).text.length,ie.ch+De(s).length)):a&&Ut&&Ut.lineWise&&Ut.text.join(`
`)==s.join(`
`)&&(Y=ie=se(Y.line,0)));var fe={from:Y,to:ie,text:u?u[B%u.length]:s,origin:i||(a?"paste":e.state.cutIncoming>l?"cut":"+input")};Gr(e.doc,fe),st(e,"inputRead",e,fe)}t&&!a&&ma(e,t),Hr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=L),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ga(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&zt(t,function(){return co(t,n,0,null,"paste")}),!0}function ma(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),l=!1;if(o.electricChars){for(var a=0;a<o.electricChars.length;a++)if(t.indexOf(o.electricChars.charAt(a))>-1){l=Nn(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(ke(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Nn(e,i.head.line,"smart"));l&&st(e,"electricInput",e,i.head.line)}}}function va(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,o={anchor:se(i,0),head:se(i+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function ya(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function ba(){var e=S("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=S("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return T?e.style.width="1000px":e.setAttribute("wrap","off"),C&&(e.style.border="1px solid black"),ya(e),t}function Yc(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var o=this.options,l=o[r];o[r]==i&&r!="mode"||(o[r]=i,t.hasOwnProperty(r)&&ut(this,t[r])(this,i,l),ze(this,"optionChange",this,r))},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](pi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,o=0;o<i.length;++o)if(i[o]==r||i[o].name==r)return i.splice(o,1),!0},addOverlay:xt(function(r,i){var o=r.token?r:e.getMode(this.options,r);if(o.startState)throw new Error("Overlays may not be stateful.");Ge(this.state.overlays,{mode:o,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(l){return l.priority}),this.state.modeGen++,St(this)}),removeOverlay:xt(function(r){for(var i=this.state.overlays,o=0;o<i.length;++o){var l=i[o].modeSpec;if(l==r||typeof r=="string"&&l.name==r){i.splice(o,1),this.state.modeGen++,St(this);return}}}),indentLine:xt(function(r,i,o){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),br(this.doc,r)&&Nn(this,r,i,o)}),indentSelection:xt(function(r){for(var i=this.doc.sel.ranges,o=-1,l=0;l<i.length;l++){var a=i[l];if(a.empty())a.head.line>o&&(Nn(this,a.head.line,r,!0),o=a.head.line,l==this.doc.sel.primIndex&&Hr(this));else{var s=a.from(),u=a.to(),x=Math.max(o,s.line);o=Math.min(this.lastLine(),u.line-(u.ch?0:1))+1;for(var L=x;L<o;++L)Nn(this,L,r);var B=this.doc.sel.ranges;s.ch==0&&i.length==B.length&&B[l].from().ch>0&&ro(this.doc,l,new Ue(s,B[l].to()),Me)}}}),getTokenAt:function(r,i){return Eo(this,r,i)},getLineTokens:function(r,i){return Eo(this,se(r),i,!0)},getTokenTypeAt:function(r){r=me(this.doc,r);var i=To(this,ke(this.doc,r.line)),o=0,l=(i.length-1)/2,a=r.ch,s;if(a==0)s=i[2];else for(;;){var u=o+l>>1;if((u?i[u*2-1]:0)>=a)l=u;else if(i[u*2+1]<a)o=u+1;else{s=i[u*2+2];break}}var x=s?s.indexOf("overlay "):-1;return x<0?s:x==0?null:s.slice(0,x-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var o=[];if(!n.hasOwnProperty(i))return o;var l=n[i],a=this.getModeAt(r);if(typeof a[i]=="string")l[a[i]]&&o.push(l[a
`,fe=U(ie,R)?"w":B&&ie==`
`?"n":!B||/\s/.test(ie)?null:"p";if(B&&!Y&&!fe&&(fe="s"),L&&L!=fe){n<0&&(n=1,x(),t.sticky="after");break}if(fe&&(L=fe),n>0&&!x(!Y))break}var pe=ci(e,t,o,l,!0);return z(o,pe)&&(pe.hitSide=!0),pe}function xa(e,t,n,r){var i=e.doc,o=t.left,l;if(r=="page"){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),s=Math.max(a-.5*Wr(e.display),3);l=(n>0?t.bottom:t.top)+n*s}else r=="line"&&(l=n>0?t.bottom+3:t.top-3);for(var u;u=Ii(e,o,l),!!u.outside;){if(n<0?l<=0:l>=i.height){u.hitSide=!0;break}l+=n*5}return u}var $e=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new be,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};$e.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable=!0,ya(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function o(a){for(var s=a.target;s;s=s.parentNode){if(s==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(s.className))break}return!1}Ce(i,"paste",function(a){!o(a)||nt(r,a)||ga(a,r)||j<=11&&setTimeout(ut(r,function(){return t.updateFromDOM()}),20)}),Ce(i,"compositionstart",function(a){t.composing={data:a.data,done:!1}}),Ce(i,"compositionupdate",function(a){t.composing||(t.composing={data:a.data,done:!1})}),Ce(i,"compositionend",function(a){t.composing&&(a.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ce(i,"touchstart",function(){return n.forceCompositionEnd()}),Ce(i,"input",function(){t.composing||t.readFromDOMSoon()});function l(a){if(!(!o(a)||nt(r,a))){if(r.somethingSelected())mi({lineWise:!1,text:r.getSelections()}),a.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var s=va(r);mi({lineWise:!0,text:s.text}),a.type=="cut"&&r.operation(function(){r.setSelections(s.ranges,0,Me),r.replaceSelection("",null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var u=Ut.text.join(`
`);if(a.clipboardData.setData("Text",u),a.clipboardData.getData("Text")==u){a.preventDefault();return}}var x=ba(),L=x.firstChild;r.display.lineSpace.insertBefore(x,r.display.lineSpace.firstChild),L.value=Ut.text.join(`
`);var B=w();$(L),setTimeout(function(){r.display.lineSpace.removeChild(x),B.focus(),B==i&&n.showPrimarySelection()},50)}}Ce(i,"copy",l),Ce(i,"cut",l)},$e.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},$e.prototype.prepareSelection=function(){var e=ul(this.cm,!1);return e.focus=w()==this.div,e},$e.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},$e.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},$e.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var o=vi(t,e.anchorNode,e.anchorOffset),l=vi(t,e.focusNode,e.focusOffset);if(!(o&&!o.bad&&l&&!l.bad&&c(Ae(o,l),r)==0&&c(ce(o,l),i)==0)){var a=t.display.view,s=r.line>=t.display.viewFrom&&_a(t,r)||{node:a[0].measure.map[2],offset:0},u=i.line<t.display.viewTo&&_a(t,i);if(!u){var x=a[a.length-1].measure,L=x.maps?x.maps[x.maps.length-1]:x.map;u={node:L[L.length-1],offset:L[L.length-2]-L[L.length-3]}}if(!s||!u){e.removeAllRanges();return}var B=e.rangeCount&&e.getRangeAt(0),R;try{R=I(s.node,s.offset,u.offset,u.node)}catch{}R&&(!A&&t.state.focused?(e.collapse(s.node,s.offset),R.collapsed||(e.removeAllRanges(),e.addRange(R))):(e.removeAllRanges(),e.addRange(R)),B&&e.anchorNode==null?e.addRange(B):A&&this.startGracePeriod()),this.rememberSelection()}},$e.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},$e.prototype.showMultipleSelections=function(e){F(this.cm.display.cursorDiv,e.cursors),F(this.cm.display.selectionDiv,e.selection)},$e.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},$e.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return W(this.div,t)},$e.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||w()!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},$e.prototype.blur=function(){this.div.blur()},$e.prototype.getField=function(){return this.div},$e.prototype.supportsTouch=function(){return!0},$e.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):zt(this.cm,function(){return t.cm.curOp.selectionChanged=!0});function n(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,n))}this.polling.set(this.cm.options.pollInterval,n)},$e.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},$e.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var e=this.getSelection(),t=this.cm;if(y&&E&&this.cm.display.gutterSpecs.length&&Qc(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var n=vi(t,e.anchorNode,e.anchorOffset),r=vi(t,e.focusNode,e.focusOffset);n&&r&&zt(t,function(){vt(t.doc,dr(n,r),Me),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},$e.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=se(r.line-1,ke(e.doc,r.line-1).length)),i.ch==ke(e.doc,i.line).text.length&&i.line<e.lastLine(
`),$(i))}else return;l.type=="cut"&&(r.state.cutIncoming=+new Date)}}Ce(i,"cut",o),Ce(i,"copy",o),Ce(e.scroller,"paste",function(l){if(!(nr(e,l)||nt(r,l))){if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var a=new Event("paste");a.clipboardData=l.clipboardData,i.dispatchEvent(a)}}),Ce(e.lineSpace,"selectstart",function(l){nr(e,l)||gt(l)}),Ce(i,"compositionstart",function(){var l=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:l,range:r.markText(l,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ce(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},rt.prototype.createField=function(e){this.wrapper=ba(),this.textarea=this.wrapper.firstChild},rt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},rt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=ul(e);if(e.options.moveInputWithCursor){var i=jt(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return r},rt.prototype.showSelection=function(e){var t=this.cm,n=t.display;F(n.cursorDiv,e.cursors),F(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},rt.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&&$(this.textarea),g&&j>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",g&&j>=9&&(this.hasSelection=null))}},rt.prototype.getField=function(){return this.textarea},rt.prototype.supportsTouch=function(){return!1},rt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!G||w()!=this.textarea))try{this.textarea.focus()}catch{}},rt.prototype.blur=function(){this.textarea.blur()},rt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},rt.prototype.receivedFocus=function(){this.slowPoll()},rt.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},rt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},rt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Bn(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(g&&j>=9&&this.hasSelection===i||_&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(o==8203&&!r&&(r="\u200B"),o==8666)return this.reset(),this.cm.execCommand("undo")}for(var l=0,a=Math.min(r.length,i.length);l<a&&r.charCodeAt(l)==i.charCodeAt(l);)++l;return zt(t,function(){co(t,i.slice(l),r.length-l,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
`)>-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},rt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},rt.prototype.onKeyPress=function(){g&&j>=9&&(this.hasSelection=null),this.fastPoll()},rt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=kr(n,e),l=r.scroller.scrollTop;if(!o||h)return;var a=n.options.resetSelectionOnContextMenu;a&&n.doc.sel.contains(o)==-1&&ut(n,vt)(n.doc,dr(o),Me);var s=i.style.cssText,u=t.wrapper.style.cssText,x=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-x.top-5)+"px; left: "+(e.clientX-x.left-5)+`px;
z-index: 1000; background: `+(g?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var L;T&&(L=window.scrollY),r.input.focus(),T&&window.scrollTo(null,L),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=R,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function B(){if(i.selectionStart!=null){var ie=n.somethingSelected(),fe="\u200B"+(ie?i.value:"");i.value="\u21DA",i.value=fe,t.prevInput=ie?"":"\u200B",i.selectionStart=1,i.selectionEnd=fe.length,r.selForContextMenu=n.doc.sel}}function R(){if(t.contextMenuPending==R&&(t.contextMenuPending=!1,t.wrapper.style.cssText=u,i.style.cssText=s,g&&j<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=l),i.selectionStart!=null)){(!g||g&&j<9)&&B();var ie=0,fe=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?ut(n,Rl)(n):ie++<10?r.detectingSelectAll=setTimeout(fe,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(fe,200)}}if(g&&j>=9&&B(),ne){yr(e);var Y=function(){kt(window,"mouseup",Y),setTimeout(R,20)};Ce(window,"mouseup",Y)}else setTimeout(R,50)},rt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},rt.prototype.setUneditable=function(){},rt.prototype.needsContentAttribute=!1;function ef(e,t){if(t=t?d(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=w();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=a.getValue()}var i;if(e.form&&(Ce(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=l}}catch{}}t.finishInit=function(s){s.save=r,s.getTextArea=function(){return e},s.toTextArea=function(){s.toTextArea=isNaN,r(),e.parentNode.removeChild(s.getWrapperElement()),e.style.display="",e.form&&(kt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var a=Ye(function(s){return e.parentNode.insertBefore(s,e.nextSibling)},t);return a}function tf(e){e.off=kt,e.on=Ce,e.wheelEventPixels=sc,e.Doc=Tt,e.splitLines=on,e.countColumn=ae,e.findColumn=xe,e.isWordChar=Re,e.Pass=Ee,e.signal=ze,e.Line=Nr,e.changeEnd=pr,e.scrollbarModel=gl,e.Pos=se,e.cmpPos=c,e.modes=qt,e.mimeModes=Ot,e.resolveMode=Or,e.getMode=Ir,e.modeExtensions=Rt,e.extendMode=Wt,e.copyState=It,e.startState=sn,e.innerMode=an,e.commands=Fn,e.keyMap=or,e.keyName=ta,e.isModifierKey=Vl,e.lookupKey=Yr,e.normalizeKeyMap=zc,e.StringStream=et,e.SharedTextMarker=zn,e.TextMarker=gr,e.LineWidget=Mn,e.e_preventDefault=gt,e.e_stopPropagation=Fr,e.e_stop=yr,e.addClass=k,e.contains=W,e.rmClass=X,e.keyNames=mr}$c(Ye),Yc(Ye);var rf="iter insert remove copy getEditor constructor".split(" ");for(var yi in Tt.prototype)Tt.prototype.hasOwnProperty(yi)&&le(rf,yi)<0&&(Ye.prototype[yi]=function(e){return function(){return e.apply(this.doc,arguments)}}(Tt.prototype[yi]));return Kt(Tt),Ye.inputStyles={textarea:rt,contenteditable:$e},Ye.defineMode=function(e){!Ye.defaults.mode&&e!="null"&&(Ye.defaults.mode=e),Hn.apply(this,arguments)},Ye.defineMIME=er,Ye.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ye.defineMIME("text/plain","null"),Ye.defineExtension=function(e,t){Ye.prototype[e]=t},Ye.defineDocExtension=function(e,t){Tt.prototype[e]=t},Ye.fromTextArea=ef,tf(Ye),Ye.version="5.65.2",Ye})});var ka=Be((qn,yo)=>{(function(f,q){typeof qn=="object"&&typeof yo=="object"?yo.exports=q():typeof define=="function"&&define.amd?define([],q):typeof qn=="object"?qn.ClipboardJS=q():f.ClipboardJS=q()})(qn,function(){return q={686:function(O,T,N){"use strict";N.d(T,{default:function(){return ee}});var T=N(279),g=N.n(T),T=N(370),j=N.n(T),T=N(817),D=N.n(T);function E(J){try{return document.execCommand(J)}catch{return}}var h=function(J){return J=D()(J),E("cut"),J},v=function(J){var ne,V,X,re=1<arguments.length&&arguments[1]
`)?(k.tokenize=F,k.tokenize(w,k)):!1}},modeProps:{fold:["brace","import"]}}),re("text/x-csharp",{name:"clike",keywords:g("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:g("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:g("catch class do else finally for foreach if struct switch try while"),defKeywords:g("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:g("true false null"),hooks:{"@":function(w,k){return w.eat('"')?(k.tokenize=V,V(w,k)):(w.eatWhile(/[\w\$_]/),"meta")}}});function F(w,k){for(var Z=!1;!w.eol();){if(!Z&&w.match('"""')){k.tokenize=null;break}Z=w.next()=="\\"&&!Z}return"string"}function S(w){return function(k,Z){for(var $;$=k.next();)if($=="*"&&k.eat("/"))if(w==1){Z.tokenize=null;break}else return Z.tokenize=S(w-1),Z.tokenize(k,Z);else if($=="/"&&k.eat("*"))return Z.tokenize=S(w+1),Z.tokenize(k,Z);return"comment"}}re("text/x-scala",{name:"clike",keywords:g("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:g("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:g("catch class enum do else finally for forSome if match switch try while"),defKeywords:g("class enum def object package trait type val var"),atoms:g("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(w){return w.eatWhile(/[\w\$_]/),"meta"},'"':function(w,k){return w.match('""')?(k.tokenize=F,k.tokenize(w,k)):!1},"'":function(w){return w.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(w,k){var Z=k.context;return Z.type=="}"&&Z.align&&w.eat(">")?(k.context=new q(Z.indented,Z.column,Z.type,Z.info,null,Z.prev),"operator"):!1},"/":function(w,k){return w.eat("*")?(k.tokenize=S(1),k.tokenize(w,k)):!1}},modeProps:{closeBrackets:{pairs:'()[]{}""',triples:'"'}}});function p(w){return function(k,Z){for(var $=!1,m,d=!1;!k.eol();){if(!w&&!$&&k.match('"')){d=!0;break}if(w&&k.match('"""')){d=!0;break}m=k.next(),!$&&m=="$"&&k.match("{")&&k.skipTo("}"),$=!$&&m=="\\"&&!w}return(d||!w)&&(Z.tokenize=null),"string"}}re("text/x-kotlin",{name:"clike",keywords:g("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constru
`);let A=f.textContent.trimEnd(),O="";if(q!==null){let N=q.className.replace("language-","");O=xi(N,A)}let P=(0,zr.default)(function(N){f.parentNode.replaceChild(N,f)},{value:A,mode:O,lineNumbers:!0,lineWrapping:!1,theme:_i(),readOnly:!0});ff(P)}function ff(f){let q='<svg viewBox="0 0 24 24" width="16" height="16" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>',A=document.createElement("div");A.classList.add("CodeMirror-copy"),A.innerHTML=q,f.display.wrapper.appendChild(A),new nu.default(A,{text:function(P){return f.getValue()}}).on("success",P=>{A.classList.add("success"),setTimeout(()=>{A.classList.remove("success")},240)})}function xi(f,q){f=f.trim().replace(/^\./g,"").toLowerCase();let A=typeof wo[f];return A==="undefined"?"":A==="function"?wo[f](q):wo[f]}function _i(){let f=document.documentElement.classList.contains("dark-mode");return window.codeTheme||(f?"darcula":"default")}function Kf(f,q,A){return(0,zr.default)(f,{value:q,mode:xi(A,q),lineNumbers:!0,lineWrapping:!1,theme:_i(),readOnly:!0})}function $f(f,q){let A=f.textContent;return(0,zr.default)(function(O){f.parentNode.insertBefore(O,f),f.style.display="none"},{value:A,mode:xi(q,A),lineNumbers:!0,lineWrapping:!1,theme:_i()})}function Gf(f,q,A){f.setOption("mode",xi(q,A))}function Xf(f,q){f.setValue(q),setTimeout(()=>{df(f)},10)}function df(f){f.refresh()}function Zf(f){let A={value:f.textContent,mode:"markdown",lineNumbers:!0,lineWrapping:!0,theme:_i(),scrollPastEnd:!0};return window.$events.emitPublic(f,"editor-markdown-cm::pre-init",{config:A}),(0,zr.default)(function(O){f.parentNode.insertBefore(O,f),f.style.display="none"},A)}function Yf(){return zr.default.keyMap.default==zr.default.keyMap.macDefault?"Cmd":"Ctrl"}export{Yf as getMetaKey,Hf as highlight,Uf as highlightWithin,Zf as markdownEditor,$f as popupEditor,Xf as setContent,Gf as setMode,df as updateLayout,Kf as wysiwygView};
/*!
* clipboard.js v2.0.10
* https://clipboardjs.com/
*
* Licensed MIT © Zeno Rocha
*/
//# sourceMappingURL=code.js.map