Liferay.Loader.define("fragment-web$codemirror@5.65.2/addon/mode/simple",["module","exports","require","../../lib/codemirror"],(function(e,t,n){var a,o=void 0;window;a=function(e){"use strict";function ensureState(e,t){if(!e.hasOwnProperty(t))throw new Error("Undefined state "+t+" in simple mode")}function toRegex(e,t){if(!e)return/(?:)/;var n="";return e instanceof RegExp?(e.ignoreCase&&(n="i"),e.unicode&&(n+="u"),e=e.source):e=String(e),new RegExp((!1===t?"":"^")+"(?:"+e+")",n)}function Rule(e,t){(e.next||e.push)&&ensureState(t,e.next||e.push),this.regex=toRegex(e.regex),this.token=function asToken(e){if(!e)return null;if(e.apply)return e;if("string"==typeof e)return e.replace(/\./g," ");for(var t=[],n=0;n<e.length;n++)t.push(e[n]&&e[n].replace(/\./g," "));return t}(e.token),this.data=e}function tokenFunction(e,t){return function(n,a){if(a.pending){var o=a.pending.shift();return 0==a.pending.length&&(a.pending=null),n.pos+=o.text.length,o.token}if(a.local){if(a.local.end&&n.match(a.local.end)){var r=a.local.endToken||null;return a.local=a.localState=null,r}var i;return r=a.local.mode.token(n,a.localState),a.local.endScan&&(i=a.local.endScan.exec(n.current()))&&(n.pos=n.start+i.index),r}for(var l=e[a.state],d=0;d<l.length;d++){var s=l[d],c=(!s.data.sol||n.sol())&&n.match(s.regex);if(c){s.data.next?a.state=s.data.next:s.data.push?((a.stack||(a.stack=[])).push(a.state),a.state=s.data.push):s.data.pop&&a.stack&&a.stack.length&&(a.state=a.stack.pop()),s.data.mode&&enterLocalMode(t,a,s.data.mode,s.token),s.data.indent&&a.indent.push(n.indentation()+t.indentUnit),s.data.dedent&&a.indent.pop();var u=s.token;if(u&&u.apply&&(u=u(c)),c.length>2&&s.token&&"string"!=typeof s.token){for(var p=2;p<c.length;p++)c[p]&&(a.pending||(a.pending=[])).push({text:c[p],token:s.token[p-1]});return n.backUp(c[0].length-(c[1]?c[1].length:0)),u[0]}return u&&u.join?u[0]:u}}return n.next(),null}}function cmp(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;var n=0;for(var a in e)if(e.hasOwnProperty(a)){if(!t.hasOwnProperty(a)||!cmp(e[a],t[a]))return!1;n++}for(var a in t)t.hasOwnProperty(a)&&n--;return 0==n}function enterLocalMode(t,n,a,o){var r;if(a.persistent)for(var i=n.persistentStates;i&&!r;i=i.next)(a.spec?cmp(a.spec,i.spec):a.mode==i.mode)&&(r=i);var l=r?r.mode:a.mode||e.getMode(t,a.spec),d=r?r.state:e.startState(l);a.persistent&&!r&&(n.persistentStates={mode:l,spec:a.spec,state:d,next:n.persistentStates}),n.localState=d,n.local={mode:l,end:a.end&&toRegex(a.end),endScan:a.end&&!1!==a.forceEnd&&toRegex(a.end,!1),endToken:o&&o.join?o[o.length-1]:o}}function indentFunction(t,n){return function(a,o,r){if(a.local&&a.local.mode.indent)return a.local.mode.indent(a.localState,o,r);if(null==a.indent||a.local||n.dontIndentStates&&function indexOf(e,t){for(var n=0;n<t.length;n++)if(t[n]===e)return!0}(a.state,n.dontIndentStates)>-1)return e.Pass;var i=a.indent.length-1,l=t[a.state];e:for(;;){for(var d=0;d<l.length;d++){var s=l[d];if(s.data.dedent&&!1!==s.data.dedentIfLineStart){var c=s.regex.exec(o);if(c&&c[0]){i--,(s.next||s.push)&&(l=t[s.next||s.push]),o=o.slice(c[0].length);continue e}}}break}return i<0?0:a.indent[i]}}e.defineSimpleMode=function(t,n){e.defineMode(t,(function(t){return e.simpleMode(t,n)}))},e.simpleMode=function(t,n){ensureState(n,"start");var a={},o=n.meta||{},r=!1;for(var i in n)if(i!=o&&n.hasOwnProperty(i))for(var l=a[i]=[],d=n[i],s=0;s<d.length;s++){var c=d[s];l.push(new Rule(c,n)),(c.indent||c.dedent)&&(r=!0)}var u={startState:function(){return{state:"start",pending:null,local:null,localState:null,indent:r?[]:null}},copyState:function(t){var n={state:t.state,pending:t.pending,local:t.local,localState:null,indent:t.indent&&t.indent.slice(0)};t.localState&&(n.localState=e.copyState(t.local.mode,t.localState)),t.stack&&(n.stack=t.stack.slice(0));for(var a=t.persistentStates;a;a=a.next)n.persistentStates={mode:a.mode,spec:a.spec,state:a.state==t.localState?n.localState:e.copyState(a.mode,a.state),next:n.persistentStates};return n},token:tokenFunction(a,t),innerMode:function(e){return e.local&&{mode:e.local.mode,state:e.localState}},indent:indentFunction(a,o)};if(o)for(var p in o)o.hasOwnProperty(p)&&(u[p]=o[p]);return u}},"object"==typeof t&&"object"==typeof e?a(n("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],a):a(CodeMirror)}));
//# sourceMappingURL=simple.js.map