!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=/^[^:]+:/,m=/^[^ ]+@[^ ]+/,c=/^.*?(?=[^ ]+?@[^ ]+)/,s=/^<.*?>/,u=/^.*?(?=<.*>)/;function l(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,l=!1;return(n=e.match(o))||(l=!0)&&(n=e.match(a))?(r.inHeaders=!0,r.inHeader=!0,r.emailPermitted=l,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(m)?"link":e.match(c)?"atom":(e.skipToEnd(),"atom");if(r.inHeader){var f="Subject"===r.header?"header":"string";if(r.emailPermitted){if(e.match(s))return f+" link";if(e.match(u))return f}return e.skipToEnd(),f}return e.skipToEnd(),null}e.defineMode("mbox",function(){return{startState:function(){return{inSeparator:!1,inHeader:!1,emailPermitted:!1,header:null,inHeaders:!1}},token:l,blankLine:function(e){e.inHeaders=e.inSeparator=e.inHeader=!1}}}),e.defineMIME("application/mbox","mbox")});