import{bK as P}from"./vendor.8ed37afc.js";function A(c,h){return h.forEach(function(o){o&&typeof o!="string"&&!Array.isArray(o)&&Object.keys(o).forEach(function(f){if(f!=="default"&&!(f in c)){var u=Object.getOwnPropertyDescriptor(o,f);Object.defineProperty(c,f,u.get?u:{enumerable:!0,get:function(){return o[f]}})}})}),Object.freeze(c)}var x={exports:{}};(function(c,h){(function(o){o(P.exports)})(function(o){o.defineOption("styleSelectedText",!1,function(e,t,r){var n=r&&r!=o.Init;t&&!n?(e.state.markedSelection=[],e.state.markedSelectionStyle=typeof t=="string"?t:"CodeMirror-selectedtext",g(e),e.on("cursorActivity",f),e.on("change",u)):!t&&n&&(e.off("cursorActivity",f),e.off("change",u),v(e),e.state.markedSelection=e.state.markedSelectionStyle=null)});function f(e){e.state.markedSelection&&e.operation(function(){O(e)})}function u(e){e.state.markedSelection&&e.state.markedSelection.length&&e.operation(function(){v(e)})}var p=8,y=o.Pos,l=o.cmpPos;function s(e,t,r,n){if(l(t,r)!=0)for(var a=e.state.markedSelection,i=e.state.markedSelectionStyle,S=t.line;;){var j=S==t.line?t:y(S,0),d=S+p,k=d>=r.line,_=k?r:y(d,0),b=e.markText(j,_,{className:i});if(n==null?a.push(b):a.splice(n++,0,b),k)break;S=d}}function v(e){for(var t=e.state.markedSelection,r=0;r<t.length;++r)t[r].clear();t.length=0}function g(e){v(e);for(var t=e.listSelections(),r=0;r<t.length;r++)s(e,t[r].from(),t[r].to())}function O(e){if(!e.somethingSelected())return v(e);if(e.listSelections().length>1)return g(e);var t=e.getCursor("start"),r=e.getCursor("end"),n=e.state.markedSelection;if(!n.length)return s(e,t,r);var a=n[0].find(),i=n[n.length-1].find();if(!a||!i||r.line-t.line<=p||l(t,i.to)>=0||l(r,a.from)<=0)return g(e);for(;l(t,a.from)>0;)n.shift().clear(),a=n[0].find();for(l(t,a.from)<0&&(a.to.line-t.line<p?(n.shift().clear(),s(e,t,a.to,0)):s(e,t,a.from,0));l(r,i.to)<0;)n.pop().clear(),i=n[n.length-1].find();l(r,i.to)>0&&(r.line-i.from.line<p?(n.pop().clear(),s(e,i.from,r)):s(e,i.to,r))}})})();var w=x.exports,E=Object.freeze(A({__proto__:null,[Symbol.toStringTag]:"Module",default:w},[x.exports]));export{E as m};
