(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(h){var c=n[h];return c?c:n[h]=new RegExp("\\s+"+h+"\\s*\x3d\\s*('|\")?([^'\"]+)('|\")?\\s*")}function r(h,c){var d=h.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]=[]),k=d[g],e=k.length-1;0<=e;e--)f.unshift(k[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$|^$/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(h,c){function g(a,b){var c=f.token(a,b.htmlState),e=/\btag\b/.test(c),l;if(e&&!/[<>\s\/]/.test(a.current())&&(l=b.htmlState.tagName&&b.htmlState.tagName.toLowerCase())&&k.hasOwnProperty(l))b.inTag=l+" ";else if(b.inTag&&e&&/>$/.test(a.current())){e=/^([\S]+) (.*)/.exec(b.inTag);b.inTag=null;l="\x3e"==a.current()&&t(k[e[1]],e[2]);l=d.getMode(h,l);var m=new RegExp("^\x3c/s*"+e[1]+"s*\x3e","i"),n=new RegExp("\x3c/s*"+e[1]+"s*\x3e","i");b.token=
function(a,b){if(a.match(m,!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=l;b.localState=d.startState(l,f.indent(b.htmlState,""))}else b.inTag&&(b.inTag+=a.current(),a.eol()&&(b.inTag+=" "));return c}var f=d.getMode(h,{name:"xml",htmlMode:!0,multilineTagIndentFactor:c.multilineTagIndentFactor,multilineTagIndentPastTag:c.multilineTagIndentPastTag}),
k={},e=c&&c.tags,m=c&&c.scriptTypes;p(u,k);e&&p(e,k);if(m)for(e=m.length-1;0<=e;e--)k.script.unshift(["type",m[e].matches,m[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){return!a.localMode||/^\s*<\//.test(b)?f.indent(a.htmlState,b):a.localMode.indent?a.localMode.indent(a.localState,b):d.Pass},innerMode:function(a){return{state:a.localState||a.htmlState,mode:a.localMode||f}}}},"xml","javascript","css");d.defineMIME("text/html","htmlmixed")});