!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}((function(e){"use strict";var r=["From","Sender","Reply-To","To","Cc","Bcc","Message-ID","In-Reply-To","References","Resent-From","Resent-Sender","Resent-To","Resent-Cc","Resent-Bcc","Resent-Message-ID","Return-Path","Received"],n=["Date","Subject","Comments","Keywords","Resent-Date"];e.registerHelper("hintWords","mbox",r.concat(n));var t=/^[ \t]/,i=/^From /,a=new RegExp("^("+r.join("|")+"): "),o=new RegExp("^("+n.join("|")+"): "),d=/^[^:]+:/,c=/^[^ ]+@[^ ]+/,m=/^.*?(?=[^ ]+?@[^ ]+)/,s=/^<.*?>/,u=/^.*?(?=<.*>)/;function f(e,r){if(e.sol()){if(r.inSeparator=!1,r.inHeader&&e.match(t))return null;if(r.inHeader=!1,r.header=null,e.match(i))return r.inHeaders=!0,r.inSeparator=!0,"atom";var n,f=!1;return(n=e.match(o))||(f=!0)&&(n=e.match(a))?(r.inHeaders=!0,r.inHeader=!0,r.emailPermitted=f,r.header=n[1],"atom"):r.inHeaders&&(n=e.match(d))?(r.inHeader=!0,r.emailPermitted=!0,r.header=n[1],"atom"):(r.inHeaders=!1,e.skipToEnd(),null)}if(r.inSeparator)return e.match(c)?"link":(e.match(m)||e.skipToEnd(),"atom");if(r.inHeader){var l=function(e){return"Subject"===e?"header":"string"}(r.header);if(r.emailPermitted){if(e.match(s))return l+" link";if(e.match(u))return l}return e.skipToEnd(),l}return e.skipToEnd(),null}e.defineMode("mbox",(function(){return{startState:function(){return{inSeparator:!1,inHeader:!1,emailPermitted:!1,header:null,inHeaders:!1}},token:f,blankLine:function(e){e.inHeaders=e.inSeparator=e.inHeader=!1}}})),e.defineMIME("application/mbox","mbox")}));