'use strict';(function(d){"object"==typeof exports&&"object"==typeof module?d(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],d):d(CodeMirror)})(function(d){function q(m){var c=n[m];return c?c:n[m]=new RegExp("\\s+"+m+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function r(m,c){var d=m.match(q(c));return d?/^\s*(.*?)\s*$/.exec(d[2])[1]:
""}function p(d,c){for(var g in d)for(var f=c[g]||(c[g]=[]),h=d[g],e=h.length-1;0<=e;e--)f.unshift(h[e])}function t(d,c){for(var g=0;g<d.length;g++){var f=d[g];if(!f[0]||f[1].test(r(c,f[0])))return f[2]}}var u={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],
[null,null,"css"]]},n={};d.defineMode("htmlmixed",function(m,c){function g(a,b){var c=f.token(a,b.htmlState),e=/\btag\b/.test(c),k;if(e&&!/[<>\s\/]/.test(a.current())&&(k=b.htmlState.tagName&&b.htmlState.tagName.toLowerCase())&&h.hasOwnProperty(k))b.inTag=k+" ";else if(b.inTag&&e&&/>$/.test(a.current())){e=/^([\S]+) (.*)/.exec(b.inTag);b.inTag=null;k=">"==a.current()&&t(h[e[1]],e[2]);k=d.getMode(m,k);var l=new RegExp("^</s*"+e[1]+"s*>","i"),n=new RegExp("</s*"+e[1]+"s*>","i");b.token=function(a,b){if(a.match(l,
!1))return b.token=g,b.localState=b.localMode=null;var d=b.localMode.token(a,b.localState),c=a.current(),e=c.search(n);-1<e?a.backUp(c.length-e):c.match(/<\/?$/)&&(a.backUp(c.length),a.match(n,!1)||a.match(c));return d};b.localMode=k;b.localState=d.startState(k,f.indent(b.htmlState,""))}else b.inTag&&(b.inTag+=a.current(),a.eol()&&(b.inTag+=" "));return c}var f=d.getMode(m,{name:"xml",htmlMode:!0,multilineTagIndentFactor:c.multilineTagIndentFactor,multilineTagIndentPastTag:c.multilineTagIndentPastTag}),
h={},e=c&&c.tags,l=c&&c.scriptTypes;p(u,h);e&&p(e,h);if(l)for(e=l.length-1;0<=e;e--)h.script.unshift(["type",l[e].matches,l[e].mode]);return{startState:function(){var a=d.startState(f);return{token:g,inTag:null,localMode:null,localState:null,htmlState:a}},copyState:function(a){var b;a.localState&&(b=d.copyState(a.localMode,a.localState));return{token:a.token,inTag:a.inTag,localMode:a.localMode,localState:b,htmlState:d.copyState(f,a.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(a,
b,c){return!a.localMode||/^\s*<\//.test(b)?f.indent(a.htmlState,b):a.localMode.indent?a.localMode.indent(a.localState,b,c):d.Pass},innerMode:function(a){return{state:a.localState||a.htmlState,mode:a.localMode||f}}}},"xml","javascript","css");d.defineMIME("text/html","htmlmixed")});
(function(d){"object"==typeof exports&&"object"==typeof module?d(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],d):d(CodeMirror)})(function(d){function q(d){var c=n[d];return c?c:n[d]=new RegExp("\\s+"+d+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function r(d,c){var g=d.match(q(c));return g?/^\s*(.*?)\s*$/.exec(g[2])[1]:
""}function p(d,c){for(var g in d)for(var f=c[g]||(c[g]=[]),h=d[g],e=h.length-1;0<=e;e--)f.unshift(h[e])}function t(d,c){for(var g=0;g<d.length;g++){var f=d[g];if(!f[0]||f[1].test(r(c,f[0])))return f[2]}}var u={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],
[null,null,"css"]]},n={};d.defineMode("htmlmixed",function(m,c){function g(a,b){var c=f.token(a,b.htmlState),e=/\btag\b/.test(c),k;if(e&&!/[<>\s\/]/.test(a.current())&&(k=b.htmlState.tagName&&b.htmlState.tagName.toLowerCase())&&h.hasOwnProperty(k))b.inTag=k+" ";else if(b.inTag&&e&&/>$/.test(a.current())){e=/^([\S]+) (.*)/.exec(b.inTag);b.inTag=null;k=">"==a.current()&&t(h[e[1]],e[2]);k=d.getMode(m,k);var l=new RegExp("^</s*"+e[1]+"s*>","i"),n=new RegExp("</s*"+e[1]+"s*>","i");b.token=function(a,b){if(a.match(l,
!1))return b.token=g,b.localState=b.localMode=null;var d=b.localMode.token(a,b.localState),c=a.current(),e=c.search(n);-1<e?a.backUp(c.length-e):c.match(/<\/?$/)&&(a.backUp(c.length),a.match(n,!1)||a.match(c));return d};b.localMode=k;b.localState=d.startState(k,f.indent(b.htmlState,""))}else b.inTag&&(b.inTag+=a.current(),a.eol()&&(b.inTag+=" "));return c}var f=d.getMode(m,{name:"xml",htmlMode:!0,multilineTagIndentFactor:c.multilineTagIndentFactor,multilineTagIndentPastTag:c.multilineTagIndentPastTag}),
h={},e=c&&c.tags,l=c&&c.scriptTypes;p(u,h);e&&p(e,h);if(l)for(e=l.length-1;0<=e;e--)h.script.unshift(["type",l[e].matches,l[e].mode]);return{startState:function(){var a=d.startState(f);return{token:g,inTag:null,localMode:null,localState:null,htmlState:a}},copyState:function(a){var b;a.localState&&(b=d.copyState(a.localMode,a.localState));return{token:a.token,inTag:a.inTag,localMode:a.localMode,localState:b,htmlState:d.copyState(f,a.htmlState)}},token:function(a,b){return b.token(a,b)},indent:function(a,
b,c){return!a.localMode||/^\s*<\//.test(b)?f.indent(a.htmlState,b):a.localMode.indent?a.localMode.indent(a.localState,b,c):d.Pass},innerMode:function(a){return{state:a.localState||a.htmlState,mode:a.localMode||f}}}},"xml","javascript","css");d.defineMIME("text/html","htmlmixed")});
