2022-06-24 18:50:56 +08:00
|
|
|
var sf=Object.create;var _a=Object.defineProperty;var uf=Object.getOwnPropertyDescriptor;var cf=Object.getOwnPropertyNames;var ff=Object.getPrototypeOf,df=Object.prototype.hasOwnProperty;var Re=(d,R)=>()=>(R||d((R={exports:{}}).exports,R),R.exports);var pf=(d,R,z,F)=>{if(R&&typeof R=="object"||typeof R=="function")for(let I of cf(R))!df.call(d,I)&&I!==z&&_a(d,I,{get:()=>R[I],enumerable:!(F=uf(R,I))||F.enumerable});return d};var Ue=(d,R,z)=>(z=d!=null?sf(ff(d)):{},pf(R||!d||!d.__esModule?_a(z,"default",{value:d,enumerable:!0}):z,d));var We=Re((go,vo)=>{(function(d,R){typeof go=="object"&&typeof vo<"u"?vo.exports=R():typeof define=="function"&&define.amd?define(R):(d=d||self,d.CodeMirror=R())})(go,function(){"use strict";var d=navigator.userAgent,R=navigator.platform,z=/gecko\/\d/i.test(d),F=/MSIE \d/.test(d),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(d),P=/Edge\/(\d+)/.exec(d),m=F||I||P,B=m&&(F?document.documentMode||6:+(P||I)[1]),C=!P&&/WebKit\//.test(d),A=C&&/Qt\/\d+\.\d+/.test(d),E=!P&&/Chrome\/(\d+)/.exec(d),h=E&&+E[1],b=/Opera\//.test(d),g=/Apple Computer/.test(navigator.vendor),S=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(d),T=/PhantomJS/.test(d),y=g&&(/Mobile\/\w+/.test(d)||navigator.maxTouchPoints>2),$=/Android/.test(d),_=y||$||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(d),j=y||/Mac/.test(R),U=/\bCrOS\b/.test(d),re=/win/i.test(R),oe=b&&d.match(/Version\/(\d*\.\d*)/);oe&&(oe=Number(oe[1])),oe&&oe>=15&&(b=!1,C=!0);var te=j&&(A||b&&(oe==null||oe<12.11)),V=z||m&&B>=9;function X(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var Y=function(e,t){var n=e.className,r=X(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 N(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function D(e,t){return N(e).appendChild(t)}function c(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 O(e,t,n,r){var i=c(e,t,n,r);return i.setAttribute("role","presentation"),i}var q;document.createRange?q=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:q=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 L(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 k(){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 Z(e,t){var n=e.className;X(t).test(n)||(e.className+=(n?" ":"")+t)}function G(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!X(n[r]).test(t)&&(t+=" "+n[r]);return t}var v=function(e){e.select()};y?v=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:m&&(v=function(e){try{e.select()}catch{}});function p(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ae(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 ge(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 se=function(){this.id=null,this.f=null,this.time=0,this.handler=p(this.onTimeout,this)};se.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},se.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 de(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var Le=50,ze={toString:function(){return"CodeMirror.Pass"}},ne={scroll:!1},fe={origin:"*mouse"},ye={origin:"+move"};function De(e,t,n){for(var r=0,i=0;;){var o=e.indexOf(" ",r);o==-1
|
2022-02-26 20:01:44 +08:00
|
|
|
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
2022-06-24 18:50:56 +08:00
|
|
|
`,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/)},Rn=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},ki=function(){var e=c("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),jt=null;function Ht(e){if(jt!=null)return jt;var t=D(e,c("span","x")),n=t.getBoundingClientRect(),r=q(t,0,1).getBoundingClientRect();return jt=Math.abs(n.left-r.left)>1}var Ut={},Zt={};function Yt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ut[e]=t}function _i(e,t){Zt[e]=t}function xr(e){if(typeof e=="string"&&Zt.hasOwnProperty(e))e=Zt[e];else if(e&&typeof e.name=="string"&&Zt.hasOwnProperty(e.name)){var t=Zt[e.name];typeof t=="string"&&(t={name:t}),e=Ge(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return xr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return xr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function ur(e,t){t=xr(t);var n=Ut[t.name];if(!n)return ur(e,"text/plain");var r=n(e,t);if(kt.hasOwnProperty(t.name)){var i=kt[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 kt={};function kr(e,t){var n=kt.hasOwnProperty(e)?kt[e]:kt[e]={};ae(t,n)}function Qt(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 Nr(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 Wn(e,t,n){return e.startState?e.startState(t,n):!0}var Ze=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};Ze.prototype.eol=function(){return this.pos>=this.string.length},Ze.prototype.sol=function(){return this.pos==this.lineStart},Ze.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ze.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ze.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},Ze.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ze.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ze.prototype.skipToEnd=function(){this.pos=this.string.length},Ze.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ze.prototype.backUp=function(e){this.pos-=e},Ze.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ge(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?ge(this.string,this.lineStart,this.tabSize):0)},Ze.prototype.indentation=function(){return ge(this.string,null,this.tabSize)-(this.lineStart?ge(this.string,this.lineStart,this.tabSize):0)},Ze.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)}},Ze.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ze.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ze.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ze.
|
|
|
|
`?(ie=w.appendChild(c("span",H[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ie.setAttribute("cm-text",H[0]),e.col+=1):(ie=e.cm.options.specialCharPlaceholder(H[0]),ie.setAttribute("cm-text",H[0]),m&&B<9?w.appendChild(c("span",[ie])):w.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||f||o||l){var me=n||"";r&&(me+=r),i&&(me+=i);var he=c("span",[w],me,o);if(l)for(var ve in l)l.hasOwnProperty(ve)&&ve!="style"&&ve!="class"&&he.setAttribute(ve,l[ve]);return e.content.appendChild(he)}e.content.appendChild(w)}}function Lu(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 Eu(e,t){return function(n,r,i,o,l,a,s){i=i?i+" cm-force-border":"cm-force-border";for(var f=n.pos,w=f+r.length;;){for(var M=void 0,H=0;H<t.length&&(M=t[H],!(M.to>f&&M.from<=f));H++);if(M.to>=w)return e(n,r,i,o,l,a,s);e(n,r.slice(0,M.to-f),i,o,null,a,s),o=null,r=r.slice(M.to-f),f=M.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 Mu(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,f=1,w="",M,H,W=0,Q,ie,ce,pe,me;;){if(W==s){Q=ie=ce=H="",me=null,pe=null,W=1/0;for(var he=[],ve=void 0,Te=0;Te<r.length;++Te){var Se=r[Te],Ie=Se.marker;if(Ie.type=="bookmark"&&Se.from==s&&Ie.widgetNode)he.push(Ie);else if(Se.from<=s&&(Se.to==null||Se.to>s||Ie.collapsed&&Se.to==s&&Se.from==s)){if(Se.to!=null&&Se.to!=s&&W>Se.to&&(W=Se.to,ie=""),Ie.className&&(Q+=" "+Ie.className),Ie.css&&(H=(H?H+";":"")+Ie.css),Ie.startStyle&&Se.from==s&&(ce+=" "+Ie.startStyle),Ie.endStyle&&Se.to==W&&(ve||(ve=[])).push(Ie.endStyle,Se.to),Ie.title&&((me||(me={})).title=Ie.title),Ie.attributes)for(var Xe in Ie.attributes)(me||(me={}))[Xe]=Ie.attributes[Xe];Ie.collapsed&&(!pe||Ci(pe.marker,Ie)<0)&&(pe=Se)}else Se.from>s&&W>Se.from&&(W=Se.from)}if(ve)for(var dt=0;dt<ve.length;dt+=2)ve[dt+1]==W&&(ie+=" "+ve[dt]);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 zt=Math.min(a,W);;){if(w){var Ct=s+w.length;if(!pe){var it=Ct>zt?w.slice(0,zt-s):w;t.addToken(t,it,M?M+Q:Q,ce,s+it.length==W?ie:"",H,me)}if(Ct>=zt){w=w.slice(zt-s),s=zt;break}s=Ct,ce=""}w=i.slice(o,o=n[f++]),M=Ro(n[f++],t.cm.options)}}}function jo(e,t,n){this.line=t,this.rest=xu(t),this.size=this.rest?Be(xe(this.rest))-n+1:1,this.node=this.text=null,this.hidden=cr(e,t)}function Xn(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 Wr=null;function zu(e){Wr?Wr.ops.push(e):e.ownsGroup=Wr={ops:[e],delayedCallbacks:[]}}function Au(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 Du(e,t){var n=e.ownsGroup;if(!!n)try{Au(n)}finally{Wr=null,t(n)}}var cn=null;function ut(e,t){var n=on(e,t);if(!!n.length){var r=Array.prototype.slice.call(arguments,2),i;Wr?i=Wr.delayedCallbacks:cn?i=cn:(i=cn=[],setTimeout(Fu,0));for(var o=function(a){i.push(function(){return n[a].apply(null,r)})},l=0;l<n.length;++l)o(l)}}function Fu(){var e=cn;cn=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"?Ou(e,t):o=="gutter"?Ko(e,t,n,r):o=="class"?zi(e,t):o=="widget"&&Pu(e,t,r)}t.changes=null}function fn(e){return e.node==e.text&&(e.node=c("div",null,null,"position: relat
|
|
|
|
top: `+ve+"px; width: "+(Te??s-he)+`px;
|
|
|
|
height: `+(Se-ve)+"px"))}function M(he,ve,Te){var Se=ke(i,he),Ie=Se.text.length,Xe,dt;function Je(it,Lt){return Qn(e,u(he,it),"div",Se,Lt)}function zt(it,Lt,ht){var at=ll(e,Se,null,it),ot=Lt=="ltr"==(ht=="after")?"left":"right",tt=ht=="after"?at.begin:at.end-(/\s/.test(Se.text.charAt(at.end-1))?2:1);return Je(tt,ot)[ot]}var Ct=bt(Se,i.direction);return Pe(Ct,ve||0,Te??Ie,function(it,Lt,ht,at){var ot=ht=="ltr",tt=Je(it,ot?"left":"right"),Et=Je(Lt-1,ot?"right":"left"),rn=ve==null&&it==0,yr=Te==null&&Lt==Ie,yt=at==0,Xt=!Ct||at==Ct.length-1;if(Et.top-tt.top<=3){var pt=(f?rn:yr)&&yt,ho=(f?yr:rn)&&Xt,or=pt?a:(ot?tt:Et).left,Dr=ho?s:(ot?Et:tt).right;w(or,tt.top,Dr-or,tt.bottom)}else{var Fr,wt,nn,mo;ot?(Fr=f&&rn&&yt?a:tt.left,wt=f?s:zt(it,ht,"before"),nn=f?a:zt(Lt,ht,"after"),mo=f&&yr&&Xt?s:Et.right):(Fr=f?zt(it,ht,"before"):a,wt=!f&&rn&&yt?s:tt.right,nn=!f&&yr&&Xt?a:Et.left,mo=f?zt(Lt,ht,"after"):s),w(Fr,tt.top,wt-Fr,tt.bottom),tt.bottom<Et.top&&w(a,tt.bottom,null,Et.top),w(nn,Et.top,mo-nn,Et.bottom)}(!Xe||Vn(tt,Xe)<0)&&(Xe=tt),Vn(Et,Xe)<0&&(Xe=Et),(!dt||Vn(tt,dt)<0)&&(dt=tt),Vn(Et,dt)<0&&(dt=Et)}),{start:Xe,end:dt}}var H=t.from(),W=t.to();if(H.line==W.line)M(H.line,H.ch,W.ch);else{var Q=ke(i,H.line),ie=ke(i,W.line),ce=Nt(Q)==Nt(ie),pe=M(H.line,H.ch,ce?Q.text.length+1:null).end,me=M(W.line,ce?0:null,W.ch).start;ce&&(pe.top<me.top-2?(w(pe.right,pe.top,null,pe.bottom),w(a,me.top,me.left,me.bottom)):w(pe.right,pe.top,me.left-pe.right,pe.bottom)),pe.bottom<me.top&&w(a,pe.bottom,null,me.top)}n.appendChild(o)}function ji(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()||Ur(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||Ui(e))}function Hi(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Ur(e))},100)}function Ui(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Ve(e,"focus",e,t),e.state.focused=!0,Z(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),C&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),ji(e))}function Ur(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Ve(e,"blur",e,t),e.state.focused=!1,Y(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function ei(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,f=void 0,w=0;if(!a.hidden){if(i+=a.line.height,m&&B<8){var M=a.node.offsetTop+a.node.offsetHeight;f=M-n,n=M}else{var H=a.node.getBoundingClientRect();f=H.bottom-H.top,!s&&a.text.firstChild&&(w=a.text.firstChild.getBoundingClientRect().right-H.left-1)}var W=a.line.height-f;if((W>.005||W<-.005)&&(i<r&&(o-=W),Ot(a.line,f),fl(a.line),a.rest))for(var Q=0;Q<a.rest.length;Q++)fl(a.rest[Q]);if(w>e.display.sizerWidth){var ie=Math.ceil(w/Hr(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 ti(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Zn(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,o=Vt(t,r),l=Vt(t,i);if(n&&n.ensure){var a=n.ensure.from.line,s=n.ensure.to.line;a<o?(o=a,l=Vt(t,tr(ke(t,a))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=l&&(o=Vt(t,tr(ke(t,s))-e.wrapper.clientHeight),
|
|
|
|
top: `+(t.top-n.viewOffset-Zn(e.display))+`px;
|
|
|
|
height: `+(t.bottom-t.top+$t(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 Yu(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?u(t.line,t.ch+1,"before"):t,t=t.ch?u(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var l=!1,a=qt(e,t),s=!n||n==t?a:qt(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 f=Ki(e,i),w=e.doc.scrollTop,M=e.doc.scrollLeft;if(f.scrollTop!=null&&(gn(e,f.scrollTop),Math.abs(e.doc.scrollTop-w)>1&&(l=!0)),f.scrollLeft!=null&&(Er(e,f.scrollLeft),Math.abs(e.doc.scrollLeft-M)>1&&(l=!0)),!l)break}return i}function Qu(e,t){var n=Ki(e,t);n.scrollTop!=null&&gn(e,n.scrollTop),n.scrollLeft!=null&&Er(e,n.scrollLeft)}function Ki(e,t){var n=e.display,r=jr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,o=Di(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var a=e.doc.height+Ai(n),s=t.top<r,f=t.bottom>a-r;if(t.top<i)l.scrollTop=s?0:t.top;else if(t.bottom>i+o){var w=Math.min(t.top,(f?a:t.bottom)-o);w!=i&&(l.scrollTop=w)}var M=e.options.fixedGutter?0:n.gutters.offsetWidth,H=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-M,W=Sr(e)-n.gutters.offsetWidth,Q=t.right-t.left>W;return Q&&(t.right=t.left+W),t.left<10?l.scrollLeft=0:t.left<H?l.scrollLeft=Math.max(0,t.left+M-(Q?0:10)):t.right>W+H-3&&(l.scrollLeft=t.right+(Q?0:10)-W),l}function $i(e,t){t!=null&&(ri(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Kr(e){ri(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function mn(e,t,n){(t!=null||n!=null)&&ri(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Ju(e,t){ri(e),e.curOp.scrollToPos=t}function ri(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=Ki(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});mn(e,i.scrollLeft,i.scrollTop)}function gn(e,t){Math.abs(e.doc.scrollTop-t)<2||(z||Xi(e,{top:t}),pl(e,t,!0),z&&Xi(e),bn(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 Er(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 vn(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Ai(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+$t(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Mr=function(e,t,n){this.cm=n;var r=this.vert=c("div",[c("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=c("div",[c("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,m&&B<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Mr.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.h
|
|
|
|
`},setDirection:ft(function(e){e!="rtl"&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&hc(this.cm))})}),Tt.prototype.eachLine=Tt.prototype.iter;var Zl=0;function Lc(e){var t=this;if(Yl(t),!(et(t,e)||rr(t.display,e))){st(e),m&&(Zl=+new Date);var n=Cr(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&&ct(t,function(){n=we(t.doc,n);var W={from:n,to:n,text:t.doc.splitLines(o.filter(function(Q){return Q!=null}).join(t.doc.lineSeparator())),origin:"paste"};Zr(t.doc,W),Il(t.doc,pr(we(t.doc,n),we(t.doc,hr(W))))})()},s=function(W,Q){if(t.options.allowDropFileTypes&&de(t.options.allowDropFileTypes,W.type)==-1){a();return}var ie=new FileReader;ie.onerror=function(){return a()},ie.onload=function(){var ce=ie.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(ce)){a();return}o[Q]=ce,a()},ie.readAsText(W)},f=0;f<r.length;f++)s(r[f],f);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 w=e.dataTransfer.getData("Text");if(w){var M;if(t.state.draggingText&&!t.state.draggingText.copy&&(M=t.listSelections()),si(t.doc,pr(n,n)),M)for(var H=0;H<M.length;++H)Yr(t.doc,"",M[H].anchor,M[H].head,"drag");t.replaceSelection(w,"around","paste"),t.display.input.focus()}}catch{}}}}function Ec(e,t){if(m&&(!e.state.draggingText||+new Date-Zl<100)){Bt(t);return}if(!(et(e,t)||rr(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!g)){var n=c("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",b&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),b&&n.parentNode.removeChild(n)}}function Mc(e,t){var n=Cr(e,t);if(!!n){var r=document.createDocumentFragment();Bi(e,n,r),e.display.dragCursor||(e.display.dragCursor=c("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),D(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 zc(){Jl||(Ac(),Jl=!0)}function Ac(){var e;Ce(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Ql(Dc)},100))}),Ce(window,"blur",function(){return Ql(Ur)})}function Dc(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var vr={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"},En=0;En<10;En++)vr[En+48]=vr[En+96]=String(En);for(var fi=65;fi<=90;fi++)vr[fi]=String.fromCharCode(fi);for(var Mn=1;Mn<=12;Mn++)vr[Mn+111]=vr[Mn+63235]="F"+Mn;var ir={};ir.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"},ir.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=Nt(n);return r!=n&&(t=Be(r)),lo(!0,e,r,t,1)}function Pc(e,t){var n=ke(e.doc,t),r=bu(n);return r!=n&&(t=Be(r)),lo(!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 u(n.line,l?0:o,n.sticky)}return n}function pi(e,t,n){if(typeof t=="string"&&(t=zn[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)!=ze}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Nc(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Jr(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Jr(t,e.options.extraKeys,n,e)||Jr(t,e.options.keyMap,n,e)}var qc=new se;function An(e,t,n,r){var i=e.state.keySeq;if(i){if(Vl(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:qc.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=Nc(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&ut(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(st(n),ji(e)),!!i}function oa(e,t){var n=ta(t,!0);return n?t.shiftKey&&!e.state.keySeq?An(e,"Shift-"+n,t,function(r){return pi(e,r,!0)})||An(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return pi(e,r)}):An(e,n,t,function(r){return pi(e,r)}):!1}function Rc(e,t,n){return An(e,"'"+n+"'",t,function(r){return pi(e,r,!0)})}var ao=null;function la(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=k(),!et(t,e))){m&&B<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=oa(t,e);b&&(ao=r?n:null,!r&&n==88&&!ki&&(j?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),z&&!j&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Wc(t)}}function Wc(e){var t=e.display.lineDiv;Z(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(Y(t,"CodeMirror-crosshair"),Fe(document,"keyup",n),Fe(document,"mouseover",n))}Ce(document,"keyup",n),Ce(document,"mouseover",n)}function aa(e){e.keyCode==16&&(this.doc.sel.shift=!1),et(this,e)}function sa(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(rr(t.display,e)||et(t,e)||e.ctrlKey&&!e.altKey||j&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(b&&n==ao){ao=null,st(e);return}if(!(b&&(!e.which||e.which<10)&&oa(t,e))){var i=String.fromCharCode(r??n);i!="\b"&&(Rc(t,e,i)||t.display.input.onKeyPress(e))}}}var Bc=400,so=function(e,t,n){this.time=e,this.pos=t,this.button=n};so.prototype.compare=function(e,t,n){return this.time+Bc>e&&x(t,this.pos)==0&&n==this.button};var Dn,Fn;function jc(e,t){var n=+new Date;return Fn&&Fn.compare(n,e,t)?(Dn=Fn=null,"triple"):Dn&&Dn.compare(n,e,t)?(Fn=new so(n,e,t),Dn=null,"double"):(Dn=new so(n,e,t),Fn=null,"single")}function ua(e){var t=this,n=t.display;if(!(et(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,rr(n,e)){C||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!uo(t,e)){var r=Cr(t,e),i=Ir(e),o=r?jc(r,i):"single";window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Hc(t,i,r,o,e))&&(i==1?r?Kc(t,r,o,e):an(e)==n.scroller&&st(e):i==2?(r&&ai(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(V?t.display.input.onContextMenu(e):Hi(t)))}}}function Hc(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,An(e,ea(o,i),i,function(l){if(typeof l=="string"&&(l=zn[l]),!l)return!1;var a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),a=l(e,n)!=ze}finally{e.state.suppressEdits=!1}return a})}function Uc(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null)
|
|
|
|
`)==t){if(r.ranges.length%Wt.text.length==0){f=[];for(var w=0;w<Wt.text.length;w++)f.push(o.splitLines(Wt.text[w]))}}else s.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(f=je(s,function(pe){return[pe]}));for(var M=e.curOp.updateInput,H=r.ranges.length-1;H>=0;H--){var W=r.ranges[H],Q=W.from(),ie=W.to();W.empty()&&(n&&n>0?Q=u(Q.line,Q.ch-n):e.state.overwrite&&!a?ie=u(ie.line,Math.min(ke(o,ie.line).text.length,ie.ch+xe(s).length)):a&&Wt&&Wt.lineWise&&Wt.text.join(`
|
2022-02-26 20:01:44 +08:00
|
|
|
`)==s.join(`
|
2022-06-24 18:50:56 +08:00
|
|
|
`)&&(Q=ie=u(Q.line,0)));var ce={from:Q,to:ie,text:f?f[H%f.length]:s,origin:i||(a?"paste":e.state.cutIncoming>l?"cut":"+input")};Zr(e.doc,ce),ut(e,"inputRead",e,ce)}t&&!a&&ga(e,t),Kr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=M),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ma(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&Mt(t,function(){return fo(t,n,0,null,"paste")}),!0}function ga(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=In(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=In(e,i.head.line,"smart"));l&&ut(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:u(i,0),head:u(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=c("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=c("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return C?e.style.width="1000px":e.setAttribute("wrap","off"),y&&(e.style.border="1px solid black"),ya(e),t}function ef(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)&&ct(this,t[r])(this,i,l),Ve(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"](di(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:_t(function(r,i){var o=r.token?r:e.getMode(this.options,r);if(o.startState)throw new Error("Overlays may not be stateful.");rt(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:_t(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:_t(function(r,i,o){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),wr(this.doc,r)&&In(this,r,i,o)}),indentSelection:_t(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&&(In(this,a.head.line,r,!0),o=a.head.line,l==this.doc.sel.primIndex&&Kr(this));else{var s=a.from(),f=a.to(),w=Math.max(o,s.line);o=Math.min(this.lastLine(),f.line-(f.ch?0:1))+1;for(var M=w;M<o;++M)In(this,M,r);var H=this.doc.sel.ranges;s.ch==0&&i.length==H.length&&H[l].from().ch>0&&no(this.doc,l,new He(s,H[l].to()),ne)}}}),getTokenAt:function(r,i){return Eo(this,r,i)},getLineTokens:function(r,i){return Eo(this,u(r),i,!0)},getTokenTypeAt:function(r){r=we(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 f=o+l>>1;if((f?i[f*2-1]:0)>=a)l=f;else if(i[f*2+1]<a)o=f+1;else{s=i[f*2+2];break}}var w=s?s.indexOf("overlay "):-1;return w<0?s:w==0?null:s.slice(0,w-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]]&&
|
|
|
|
`,ce=le(ie,W)?"w":H&&ie==`
|
|
|
|
`?"n":!H||/\s/.test(ie)?null:"p";if(H&&!Q&&!ce&&(ce="s"),M&&M!=ce){n<0&&(n=1,w(),t.sticky="after");break}if(ce&&(M=ce),n>0&&!w(!Q))break}var pe=ui(e,t,o,l,!0);return ee(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*jr(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 f;f=Pi(e,o,l),!!f.outside;){if(n<0?l<=0:l>=i.height){f.hitSide=!0;break}l+=n*5}return f}var $e=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new se,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)||et(r,a)||ma(a,r)||B<=11&&setTimeout(ct(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)||et(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,ne),r.replaceSelection("",null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var f=Wt.text.join(`
|
|
|
|
`);if(a.clipboardData.setData("Text",f),a.clipboardData.getData("Text")==f){a.preventDefault();return}}var w=ba(),M=w.firstChild;r.display.lineSpace.insertBefore(w,r.display.lineSpace.firstChild),M.value=Wt.text.join(`
|
|
|
|
`);var H=k();v(M),setTimeout(function(){r.display.lineSpace.removeChild(w),H.focus(),H==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=k()==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=gi(t,e.anchorNode,e.anchorOffset),l=gi(t,e.focusNode,e.focusOffset);if(!(o&&!o.bad&&l&&!l.bad&&x(Ne(o,l),r)==0&&x(Me(o,l),i)==0)){var a=t.display.view,s=r.line>=t.display.viewFrom&&ka(t,r)||{node:a[0].measure.map[2],offset:0},f=i.line<t.display.viewTo&&ka(t,i);if(!f){var w=a[a.length-1].measure,M=w.maps?w.maps[w.maps.length-1]:w.map;f={node:M[M.length-1],offset:M[M.length-2]-M[M.length-3]}}if(!s||!f){e.removeAllRanges();return}var H=e.rangeCount&&e.getRangeAt(0),W;try{W=q(s.node,s.offset,f.offset,f.node)}catch{}W&&(!z&&t.state.focused?(e.collapse(s.node,s.offset),W.collapsed||(e.removeAllRanges(),e.addRange(W))):(e.removeAllRanges(),e.addRange(W)),H&&e.anchorNode==null?e.addRange(H):z&&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){D(this.cm.display.cursorDiv,e.cursors),D(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 L(this.div,t)},$e.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||k()!=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):Mt(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($&&E&&this.cm.display.gutterSpecs.length&&tf(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var n=gi(t,e.anchorNode,e.anchorOffset),r=gi(t,e.focusNode,e.focusOffset);n&&r&&Mt(t,function(){vt(t.doc,pr(n,r),ne),(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=u(r.line-1,ke(e.doc,r.line-1).length)),i.ch==ke(e.doc,i.line).text.length&&i.line<e.lastLine()
|
|
|
|
`),v(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(!(rr(e,l)||et(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){rr(e,l)||st(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)})},nt.prototype.createField=function(e){this.wrapper=ba(),this.textarea=this.wrapper.firstChild},nt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},nt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=ul(e);if(e.options.moveInputWithCursor){var i=qt(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},nt.prototype.showSelection=function(e){var t=this.cm,n=t.display;D(n.cursorDiv,e.cursors),D(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},nt.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&&v(this.textarea),m&&B>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",m&&B>=9&&(this.hasSelection=null))}},nt.prototype.getField=function(){return this.textarea},nt.prototype.supportsTouch=function(){return!1},nt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!_||k()!=this.textarea))try{this.textarea.focus()}catch{}},nt.prototype.blur=function(){this.textarea.blur()},nt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},nt.prototype.receivedFocus=function(){this.slowPoll()},nt.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},nt.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)},nt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Rn(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(m&&B>=9&&this.hasSelection===i||j&&/[\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 Mt(t,function(){fo(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},nt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},nt.prototype.onKeyPress=function(){m&&B>=9&&(this.hasSelection=null),this.fastPoll()},nt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=Cr(n,e),l=r.scroller.scrollTop;if(!o||b)return;var a=n.options.resetSelectionOnContextMenu;a&&n.doc.sel.contains(o)==-1&&ct(n,vt)(n.doc,pr(o),ne);var s=i.style.cssText,f=t.wrapper.style.cssText,w=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
|
|
top: `+(e.clientY-w.top-5)+"px; left: "+(e.clientX-w.left-5)+`px;
|
|
|
|
z-index: 1000; background: `+(m?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var M;C&&(M=window.scrollY),r.input.focus(),C&&window.scrollTo(null,M),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=W,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function H(){if(i.selectionStart!=null){var ie=n.somethingSelected(),ce="\u200B"+(ie?i.value:"");i.value="\u21DA",i.value=ce,t.prevInput=ie?"":"\u200B",i.selectionStart=1,i.selectionEnd=ce.length,r.selForContextMenu=n.doc.sel}}function W(){if(t.contextMenuPending==W&&(t.contextMenuPending=!1,t.wrapper.style.cssText=f,i.style.cssText=s,m&&B<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=l),i.selectionStart!=null)){(!m||m&&B<9)&&H();var ie=0,ce=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?ct(n,Rl)(n):ie++<10?r.detectingSelectAll=setTimeout(ce,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(ce,200)}}if(m&&B>=9&&H(),V){Bt(e);var Q=function(){Fe(window,"mouseup",Q),setTimeout(W,20)};Ce(window,"mouseup",Q)}else setTimeout(W,50)},nt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},nt.prototype.setUneditable=function(){},nt.prototype.needsContentAttribute=!1;function of(e,t){if(t=t?ae(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=k();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&&(Fe(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var a=Qe(function(s){return e.parentNode.insertBefore(s,e.nextSibling)},t);return a}function lf(e){e.off=Fe,e.on=Ce,e.wheelEventPixels=dc,e.Doc=Tt,e.splitLines=Pr,e.countColumn=ge,e.findColumn=De,e.isWordChar=K,e.Pass=ze,e.signal=Ve,e.Line=Rr,e.changeEnd=hr,e.scrollbarModel=ml,e.Pos=u,e.cmpPos=x,e.modes=Ut,e.mimeModes=Zt,e.resolveMode=xr,e.getMode=ur,e.modeExtensions=kt,e.extendMode=kr,e.copyState=Qt,e.startState=Wn,e.innerMode=Nr,e.commands=zn,e.keyMap=ir,e.keyName=ta,e.isModifierKey=Vl,e.lookupKey=Jr,e.normalizeKeyMap=Ic,e.StringStream=Ze,e.SharedTextMarker=Ln,e.TextMarker=gr,e.LineWidget=Cn,e.e_preventDefault=st,e.e_stopPropagation=Ft,e.e_stop=Bt,e.addClass=Z,e.contains=L,e.rmClass=Y,e.keyNames=vr}Yc(Qe),ef(Qe);var af="iter insert remove copy getEditor constructor".split(" ");for(var vi in Tt.prototype)Tt.prototype.hasOwnProperty(vi)&&de(af,vi)<0&&(Qe.prototype[vi]=function(e){return function(){return e.apply(this.doc,arguments)}}(Tt.prototype[vi]));return sr(Tt),Qe.inputStyles={textarea:nt,contenteditable:$e},Qe.defineMode=function(e){!Qe.defaults.mode&&e!="null"&&(Qe.defaults.mode=e),Yt.apply(this,arguments)},Qe.defineMIME=_i,Qe.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Qe.defineMIME("text/plain","null"),Qe.defineExtension=function(e,t){Qe.prototype[e]=t},Qe.defineDocExtension=function(e,t){Tt.prototype[e]=t},Qe.fromTextArea=of,lf(Qe),Qe.version="5.65.5",Qe})});var wa=Re((On,yo)=>{(function(d,R){typeof On=="object"&&typeof yo=="object"?yo.exports=R():typeof define=="function"&&define.amd?define([],R):typeof On=="object"?On.ClipboardJS=R():d.ClipboardJS=R()})(On,function(){return R={686:function(F,C,P){"use strict";P.d(C,{default:function(){return oe}});var C=P(279),m=P.n(C),C=P(370),B=P.n(C),C=P(817),A=P.n(C);function E(te){try{return document.execCommand(te)}catch{return}}var h=function(te){return te=A()(te),E("cut"),te};function b(N,V){var X,Y,N=(X=N,Y=document.documentElemen
|
|
|
|
`);let z=d.textContent.trimEnd(),F="";if(R!==null){let P=R.className.replace("language-","");F=Pn(P,z)}let I=(0,br.default)(function(P){d.parentNode.replaceChild(P,d)},{value:z,mode:F,lineNumbers:!0,lineWrapping:!1,theme:Nn(),readOnly:!0});hf(I)}function hf(d){let R='<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>',z=document.createElement("div");z.classList.add("CodeMirror-copy"),z.innerHTML=R,d.display.wrapper.appendChild(z),new au.default(z,{text:function(I){return d.getValue()}}).on("success",I=>{z.classList.add("success"),setTimeout(()=>{z.classList.remove("success")},240)})}function Pn(d,R){d=d.trim().replace(/^\./g,"").toLowerCase();let z=typeof wo[d];return z==="undefined"?"":z==="function"?wo[d](R):wo[d]}function Nn(){let d=document.documentElement.classList.contains("dark-mode");return window.codeTheme||(d?"darcula":"default")}function Zf(d,R,z){return(0,br.default)(d,{value:R,mode:Pn(z,R),lineNumbers:!0,lineWrapping:!1,theme:Nn(),readOnly:!0})}function Yf(d,R){let z=d.textContent;return(0,br.default)(function(F){d.parentNode.insertBefore(F,d),d.style.display="none"},{value:z,mode:Pn(R,z),lineNumbers:!0,lineWrapping:!1,theme:Nn()})}function Qf(d,R){return br.default.fromTextArea(d,{mode:Pn(R,d.value),lineNumbers:!0,lineWrapping:!1,theme:Nn()})}function Jf(d,R,z){d.setOption("mode",Pn(R,z))}function Vf(d,R){d.setValue(R),setTimeout(()=>{mf(d)},10)}function mf(d){d.refresh()}function ed(d){let z={value:d.textContent,mode:"markdown",lineNumbers:!0,lineWrapping:!0,theme:Nn(),scrollPastEnd:!0};return window.$events.emitPublic(d,"editor-markdown-cm::pre-init",{config:z}),(0,br.default)(function(F){d.parentNode.insertBefore(F,d),d.style.display="none"},z)}function td(){return br.default.keyMap.default==br.default.keyMap.macDefault?"Cmd":"Ctrl"}export{td as getMetaKey,Gf as highlight,Xf as highlightWithin,Qf as inlineEditor,ed as markdownEditor,Yf as popupEditor,Vf as setContent,Jf as setMode,mf as updateLayout,Zf as wysiwygView};
|
2022-02-26 20:01:44 +08:00
|
|
|
/*!
|
2022-06-24 18:50:56 +08:00
|
|
|
* clipboard.js v2.0.11
|
2022-02-26 20:01:44 +08:00
|
|
|
* https://clipboardjs.com/
|
|
|
|
*
|
|
|
|
* Licensed MIT © Zeno Rocha
|
|
|
|
*/
|
|
|
|
//# sourceMappingURL=code.js.map
|