2 lines
4.3 KiB
JavaScript
2 lines
4.3 KiB
JavaScript
import{a as j}from"./codemirror.211cff92.js";function I(v,y){return y.forEach(function(l){l&&typeof l!="string"&&!Array.isArray(l)&&Object.keys(l).forEach(function(s){if(s!=="default"&&!(s in v)){var h=Object.getOwnPropertyDescriptor(l,s);Object.defineProperty(v,s,h.get?h:{enumerable:!0,get:function(){return l[s]}})}})}),Object.freeze(Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}))}var O={exports:{}};(function(v,y){(function(l){l(j.exports)})(function(l){l.defineSimpleMode=function(t,o){l.defineMode(t,function(n){return l.simpleMode(n,o)})},l.simpleMode=function(t,o){s(o,"start");var n={},e=o.meta||{},c=!1;for(var f in o)if(f!=e&&o.hasOwnProperty(f))for(var u=n[f]=[],p=o[f],d=0;d<p.length;d++){var i=p[d];u.push(new w(i,o)),(i.indent||i.dedent)&&(c=!0)}var g={startState:function(){return{state:"start",pending:null,local:null,localState:null,indent:c?[]:null}},copyState:function(r){var x={state:r.state,pending:r.pending,local:r.local,localState:null,indent:r.indent&&r.indent.slice(0)};r.localState&&(x.localState=l.copyState(r.local.mode,r.localState)),r.stack&&(x.stack=r.stack.slice(0));for(var S=r.persistentStates;S;S=S.next)x.persistentStates={mode:S.mode,spec:S.spec,state:S.state==r.localState?x.localState:l.copyState(S.mode,S.state),next:x.persistentStates};return x},token:P(n,t),innerMode:function(r){return r.local&&{mode:r.local.mode,state:r.localState}},indent:b(n,e)};if(e)for(var a in e)e.hasOwnProperty(a)&&(g[a]=e[a]);return g};function s(t,o){if(!t.hasOwnProperty(o))throw new Error("Undefined state "+o+" in simple mode")}function h(t,o){if(!t)return/(?:)/;var n="";return t instanceof RegExp?(t.ignoreCase&&(n="i"),t.unicode&&(n+="u"),t=t.source):t=String(t),new RegExp((o===!1?"":"^")+"(?:"+t+")",n)}function k(t){if(!t)return null;if(t.apply)return t;if(typeof t=="string")return t.replace(/\./g," ");for(var o=[],n=0;n<t.length;n++)o.push(t[n]&&t[n].replace(/\./g," "));return o}function w(t,o){(t.next||t.push)&&s(o,t.next||t.push),this.regex=h(t.regex),this.token=k(t.token),this.data=t}function P(t,o){return function(n,e){if(e.pending){var c=e.pending.shift();return e.pending.length==0&&(e.pending=null),n.pos+=c.text.length,c.token}if(e.local)if(e.local.end&&n.match(e.local.end)){var f=e.local.endToken||null;return e.local=e.localState=null,f}else{var f=e.local.mode.token(n,e.localState),u;return e.local.endScan&&(u=e.local.endScan.exec(n.current()))&&(n.pos=n.start+u.index),f}for(var p=t[e.state],d=0;d<p.length;d++){var i=p[d],g=(!i.data.sol||n.sol())&&n.match(i.regex);if(g){i.data.next?e.state=i.data.next:i.data.push?((e.stack||(e.stack=[])).push(e.state),e.state=i.data.push):i.data.pop&&e.stack&&e.stack.length&&(e.state=e.stack.pop()),i.data.mode&&E(o,e,i.data.mode,i.token),i.data.indent&&e.indent.push(n.indentation()+o.indentUnit),i.data.dedent&&e.indent.pop();var a=i.token;if(a&&a.apply&&(a=a(g)),g.length>2&&i.token&&typeof i.token!="string"){for(var r=2;r<g.length;r++)g[r]&&(e.pending||(e.pending=[])).push({text:g[r],token:i.token[r-1]});return n.backUp(g[0].length-(g[1]?g[1].length:0)),a[0]}else return a&&a.join?a[0]:a}}return n.next(),null}}function m(t,o){if(t===o)return!0;if(!t||typeof t!="object"||!o||typeof o!="object")return!1;var n=0;for(var e in t)if(t.hasOwnProperty(e)){if(!o.hasOwnProperty(e)||!m(t[e],o[e]))return!1;n++}for(var e in o)o.hasOwnProperty(e)&&n--;return n==0}function E(t,o,n,e){var c;if(n.persistent)for(var f=o.persistentStates;f&&!c;f=f.next)(n.spec?m(n.spec,f.spec):n.mode==f.mode)&&(c=f);var u=c?c.mode:n.mode||l.getMode(t,n.spec),p=c?c.state:l.startState(u);n.persistent&&!c&&(o.persistentStates={mode:u,spec:n.spec,state:p,next:o.persistentStates}),o.localState=p,o.local={mode:u,end:n.end&&h(n.end),endScan:n.end&&n.forceEnd!==!1&&h(n.end,!1),endToken:e&&e.join?e[e.length-1]:e}}function _(t,o){for(var n=0;n<o.length;n++)if(o[n]===t)return!0}function b(t,o){return function(n,e,c){if(n.local&&n.local.mode.indent)return n.local.mode.indent(n.localState,e,c);if(n.indent==null||n.local||o.dontIndentStates&&_(n.state,o.dontIndentStates)>-1)return l.Pass;var f=n.indent.length-1,u=t[n.state];n:for(;;){for(var p=0;p<u.length;p++){var d=u[p];if(d.data.dedent&&d.data.dedentIfLineStart!==!1){var i=d.regex.exec(e);if(i&&i[0]){f--,(d.next||d.push)&&(u=t[d.next||d.push]),e=e.slice(i[0].length);continue n}}}break}return f<0?0:n.indent[f]}}})})();var R=O.exports,U=I({__proto__:null,default:R},[O.exports]);export{U as s};
|