import{g as G}from"./index-B0EbEgFv.js";import{r as H}from"./codemirror-DpyRu-EA.js";function J(A,_){for(var v=0;v<_.length;v++){const C=_[v];if(typeof C!="string"&&!Array.isArray(C)){for(const s in C)if(s!=="default"&&!(s in A)){const a=Object.getOwnPropertyDescriptor(C,s);a&&Object.defineProperty(A,s,a.get?a:{enumerable:!0,get:()=>C[s]})}}}return Object.freeze(Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}))}var W={exports:{}},z;function K(){return z||(z=1,(function(A,_){(function(v){v(H())})(function(v){var C={},s=/[^\s\u00a0]/,a=v.Pos,F=v.cmpPos;function P(t){var l=t.search(s);return l==-1?0:l}v.commands.toggleComment=function(t){t.toggleComment()},v.defineExtension("toggleComment",function(t){t||(t=C);for(var l=this,n=1/0,e=this.listSelections(),g=null,m=e.length-1;m>=0;m--){var r=e[m].from(),i=e[m].to();r.line>=n||(i.line>=n&&(i=a(n,0)),n=r.line,g==null?l.uncomment(r,i,t)?g="un":(l.lineComment(r,i,t),g="line"):g=="un"?l.uncomment(r,i,t):l.lineComment(r,i,t))}});function w(t,l,n){return/\bstring\b/.test(t.getTokenTypeAt(a(l.line,0)))&&!/^[\'\"\`]/.test(n)}function q(t,l){var n=t.getMode();return n.useInnerComments===!1||!n.innerMode?n:t.getModeAt(l)}v.defineExtension("lineComment",function(t,l,n){n||(n=C);var e=this,g=q(e,t),m=e.getLine(t.line);if(!(m==null||w(e,t,m))){var r=n.lineComment||g.lineComment;if(!r){(n.blockCommentStart||g.blockCommentStart)&&(n.fullLines=!0,e.blockComment(t,l,n));return}var i=Math.min(l.ch!=0||l.line==t.line?l.line+1:l.line,e.lastLine()+1),k=n.padding==null?" ":n.padding,f=n.commentBlankLines||t.line==l.line;e.operation(function(){if(n.indent){for(var d=null,c=t.line;c<i;++c){var u=e.getLine(c),h=u.search(s)===-1?u:u.slice(0,P(u));(d==null||d.length>h.length)&&(d=h)}for(var c=t.line;c<i;++c){var u=e.getLine(c),o=d.length;!f&&!s.test(u)||(u.slice(0,o)!=d&&(o=P(u)),e.replaceRange(d+r+k,a(c,0),a(c,o)))}}else for(var c=t.line;c<i;++c)(f||s.test(e.getLine(c)))&&e.replaceRange(r+k,a(c,0))})}}),v.defineExtension("blockComment",function(t,l,n){n||(n=C);var e=this,g=q(e,t),m=n.blockCommentStart||g.blockCommentStart,r=n.blockCommentEnd||g.blockCommentEnd;if(!m||!r){(n.lineComment||g.lineComment)&&n.fullLines!=!1&&e.lineComment(t,l,n);return}if(!/\bcomment\b/.test(e.getTokenTypeAt(a(t.line,0)))){var i=Math.min(l.line,e.lastLine());i!=t.line&&l.ch==0&&s.test(e.getLine(i))&&--i;var k=n.padding==null?" ":n.padding;t.line>i||e.operation(function(){if(n.fullLines!=!1){var f=s.test(e.getLine(i));e.replaceRange(k+r,a(i)),e.replaceRange(m+k,a(t.line,0));var d=n.blockCommentLead||g.blockCommentLead;if(d!=null)for(var c=t.line+1;c<=i;++c)(c!=i||f)&&e.replaceRange(d+k,a(c,0))}else{var u=F(e.getCursor("to"),l)==0,h=!e.somethingSelected();e.replaceRange(r,l),u&&e.setSelection(h?l:e.getCursor("from"),l),e.replaceRange(m,t)}})}}),v.defineExtension("uncomment",function(t,l,n){n||(n=C);var e=this,g=q(e,t),m=Math.min(l.ch!=0||l.line==t.line?l.line:l.line-1,e.lastLine()),r=Math.min(t.line,m),i=n.lineComment||g.lineComment,k=[],f=n.padding==null?" ":n.padding,d;e:{if(!i)break e;for(var c=r;c<=m;++c){var u=e.getLine(c),h=u.indexOf(i);if(h>-1&&!/comment/.test(e.getTokenTypeAt(a(c,h+1)))&&(h=-1),h==-1&&s.test(u)||h>-1&&s.test(u.slice(0,h)))break e;k.push(u)}if(e.operation(function(){for(var b=r;b<=m;++b){var x=k[b-r],p=x.indexOf(i),L=p+i.length;p<0||(x.slice(L,L+f.length)==f&&(L+=f.length),d=!0,e.replaceRange("",a(b,p),a(b,L)))}}),d)return!0}var o=n.blockCommentStart||g.blockCommentStart,S=n.blockCommentEnd||g.blockCommentEnd;if(!o||!S)return!1;var M=n.blockCommentLead||g.blockCommentLead,T=e.getLine(r),E=T.indexOf(o);if(E==-1)return!1;var j=m==r?T:e.getLine(m),O=j.indexOf(S,m==r?E+o.length:0),$=a(r,E+1),D=a(m,O+1);if(O==-1||!/comment/.test(e.getTokenTypeAt($))||!/comment/.test(e.getTokenTypeAt(D))||e.getRange($,D,`
`).indexOf(S)>-1)return!1;var y=T.lastIndexOf(o,t.ch),R=y==-1?-1:T.slice(0,t.ch).indexOf(S,y+o.length);if(y!=-1&&R!=-1&&R+S.length!=t.ch)return!1;R=j.indexOf(S,l.ch);var N=j.slice(l.ch).lastIndexOf(o,R-l.ch);return y=R==-1||N==-1?-1:l.ch+N,R!=-1&&y!=-1&&y!=l.ch?!1:(e.operation(function(){e.replaceRange("",a(m,O-(f&&j.slice(O-f.length,O)==f?f.length:0)),a(m,O+S.length));var b=E+o.length;if(f&&T.slice(b,b+f.length)==f&&(b+=f.length),e.replaceRange("",a(r,E),a(r,b)),M)for(var x=r+1;x<=m;++x){var p=e.getLine(x),L=p.indexOf(M);if(!(L==-1||s.test(p.slice(0,L)))){var I=L+M.length;f&&p.slice(I,I+f.length)==f&&(I+=f.length),e.replaceRange("",a(x,L),a(x,I))}}}),!0)})})})()),W.exports}var B=K();const Q=G(B),X=J({__proto__:null,default:Q},[B]);export{X as c};
//# sourceMappingURL=comment-BfWSAMsK.js.map
