function method(g,p){return function(){g[p].apply(g,arguments)}}var StopIteration={toString:function(){return"StopIteration"}};function forEach(g,p){if(g.next)try{for(;;)p(g.next())}catch(k){if(k!=StopIteration)throw k;}else for(var m=0;m0)throw"End of stringstream reached without emptying buffer ('"+s+"').";else throw StopIteration;return k.charAt(m++)},get:function(){var n=s;s="";if(m>0){n+=k.slice(0,m);k=k.slice(m);m=0}return n},push:function(n){k=k.slice(0, m)+n+k.slice(m)},lookAhead:function(n,t,a,d){function c(j){return d?j.toLowerCase():j}n=c(n);var b=false,e=s,f=m;for(a&&this.nextWhileMatches(/[\s\u00a0]/);;){a=m+n.length;var h=k.length-m;if(a<=k.length){b=n==c(k.slice(m,a));m=a;break}else if(n.slice(0,h)==c(k.slice(m))){s+=k;k="";try{k=g.next()}catch(i){if(i!=StopIteration)throw i;break}m=0;n=n.slice(h)}else break}if(!(b&&t)){k=s.slice(e.length)+k;m=f;s=e}return b},lookAheadRegex:function(n,t){if(n.source.charAt(0)!="^")throw Error("Regexps passed to lookAheadRegex must start with ^"); for(;k.indexOf("\n",m)==-1;)try{k+=g.next()}catch(a){if(a!=StopIteration)throw a;break}var d=k.slice(m).match(n);if(d&&t)m+=d[0].length;return d},more:function(){return this.peek()!==null},applies:function(n){var t=this.peek();return t!==null&&n(t)},nextWhile:function(n){for(var t;(t=this.peek())!==null&&n(t);)this.next()},matches:function(n){var t=this.peek();return t!==null&&n.test(t)},nextWhileMatches:function(n){for(var t;(t=this.peek())!==null&&n.test(t);)this.next()},equals:function(n){return n=== this.peek()},endOfLine:function(){var n=this.peek();return n==null||n=="\n"}}};var select={}; (function(){function g(b,e){for(;b&&b.parentNode!=e;)b=b.parentNode;return b}function p(b,e){for(;!b.previousSibling&&b.parentNode!=e;)b=b.parentNode;return g(b.previousSibling,e)}function k(b){var e=b.nextSibling;if(e){for(;e.firstChild;)e=e.firstChild;return e.nodeType==3||isBR(e)?e:k(e)}else{for(b=b.parentNode;b&&!b.nextSibling;)b=b.parentNode;return b&&k(b)}}select.ie_selection=document.selection&&document.selection.createRangeCollection;select.scrollToNode=function(b,e){if(b){for(var f=b,h=document.body, i=document.documentElement,j=!f.nextSibling||!f.nextSibling.nextSibling||!f.nextSibling.nextSibling.nextSibling,q=0;f&&!f.offsetTop;){q++;f=f.previousSibling}if(q==0)j=false;if(!(webkit&&f&&f.offsetTop==5&&f.offsetLeft==5)){q=q*(f?f.offsetHeight:0);var l=0,r=b?b.offsetWidth:0;for(f=f;f&&f.offsetParent;){q+=f.offsetTop;isBR(f)||(l+=f.offsetLeft);f=f.offsetParent}f=h.scrollLeft||i.scrollLeft||0;h=h.scrollTop||i.scrollTop||0;var o=false,w=window.innerWidth||i.clientWidth||0;if(e||rw){f=l;o=true}}l=q-h;if(l<0||j||l>(window.innerHeight||i.clientHeight||0)-50){h=j?1E6:q;o=true}o&&window.scrollTo(f,h)}}};select.scrollToCursor=function(b){select.scrollToNode(select.selectionTopNode(b,true)||b.firstChild,true)};var m=null;select.snapshotChanged=function(){if(m)m.changed=true};select.snapshotReplaceNode=function(b,e,f,h){function i(j){if(b==j.node){m.changed=true;if(f&&j.offset>f)j.offset-=f;else{j.node=e;j.offset+=h||0}}else if(select.ie_selection&& j.offset==0&&j.node==k(b))m.changed=true}if(m){i(m.start);i(m.end)}};select.snapshotMove=function(b,e,f,h,i){function j(q){if(b==q.node&&(!i||q.offset==0)){m.changed=true;q.node=e;q.offset=h?Math.max(0,q.offset+f):f}}if(m){j(m.start);j(m.end)}};if(select.ie_selection){var s=function(){var b=document.selection;return b&&(b.createRange||b.createTextRange)()},n=function(b){function e(r){for(var o=null;!o&&r;){o=r.nextSibling;r=r.parentNode}return f(o)}function f(r){for(;r&&r.firstChild;)r=r.firstChild; return{node:r,offset:0}}var h=s();h.collapse(b);b=h.parentElement();if(!isAncestor(document.body,b))return null;if(!b.firstChild)return f(b);var i=h.duplicate();i.moveToElementText(b);i.collapse(true);for(var j=b.firstChild;j;j=j.nextSibling){if(j.nodeType==3){var q=j.nodeValue.length;i.move("character",q)}else{i.moveToElementText(j);i.collapse(false)}var l=h.compareEndPoints("StartToStart",i);if(l==0)return e(j);if(l!=1){if(j.nodeType!=3)return f(j);i.setEndPoint("StartToEnd",h);return{node:j,offset:q- i.text.length}}}return e(b)};select.markSelection=function(){m=null;if(document.selection){var b=n(true),e=n(false);if(b&&e)m={start:b,end:e,changed:false}}};select.selectMarked=function(){function b(h){var i=document.body.createTextRange(),j=h.node;if(j)if(j.nodeType==3){i.moveToElementText(j.parentNode);for(h=h.offset;j.previousSibling;){j=j.previousSibling;h+=(j.innerText||"").length}i.move("character",h)}else{i.moveToElementText(j);i.collapse(true)}else{i.moveToElementText(document.body);i.collapse(false)}return i} if(m&&m.changed){var e=b(m.start),f=b(m.end);e.setEndPoint("StartToEnd",f);e.select()}};select.offsetInNode=function(b){var e=s();if(!e)return 0;var f=e.duplicate();try{f.moveToElementText(b)}catch(h){return 0}e.setEndPoint("StartToStart",f);return e.text.length};select.selectionTopNode=function(b,e){function f(o,w){if(w.nodeType==3){for(var A=0,v=w.previousSibling;v&&v.nodeType==3;){A+=v.nodeValue.length;v=v.previousSibling}if(v){try{o.moveToElementText(v)}catch(x){return false}o.collapse(false)}else o.moveToElementText(w.parentNode); A&&o.move("character",A)}else try{o.moveToElementText(w)}catch(H){return false}return true}var h=s();if(!h)return false;var i=h.duplicate();h.collapse(e);var j=h.parentElement();if(j&&isAncestor(b,j)){i.moveToElementText(j);if(h.compareEndPoints("StartToStart",i)==1)return g(j,b)}e=0;for(j=b.childNodes.length-1;e")};select.insertTabAtCursor=function(){t("\u00a0\u00a0\u00a0\u00a0")};select.cursorPos=function(b,e){var f=s();if(!f)return null;for(var h= select.selectionTopNode(b,e);h&&!isBR(h);)h=h.previousSibling;var i=f.duplicate();f.collapse(e);if(h){i.moveToElementText(h);i.collapse(false)}else{try{i.moveToElementText(b)}catch(j){return null}i.collapse(true)}f.setEndPoint("StartToStart",i);return{node:h,offset:f.text.length}};select.setCursorPos=function(b,e,f){function h(j){var q=document.body.createTextRange();if(j.node){q.moveToElementText(j.node);q.collapse(false)}else{q.moveToElementText(b);q.collapse(true)}q.move("character",j.offset); return q}var i=h(e);f&&f!=e&&i.setEndPoint("EndToEnd",h(f));i.select()};select.getBookmark=function(b){var e=select.cursorPos(b,true);b=select.cursorPos(b,false);if(e&&b)return{from:e,to:b}};select.setBookmark=function(b,e){e&&select.setCursorPos(b,e.from,e.to)}}else{var a=function(b,e){for(;b.nodeType!=3&&!isBR(b);){var f=b.childNodes[e]||b.nextSibling;for(e=0;!f&&b.parentNode;){b=b.parentNode;f=b.nextSibling}b=f;if(!f)break}return{node:b,offset:e}};select.markSelection=function(){var b=window.getSelection(); if(!b||b.rangeCount==0)return m=null;b=b.getRangeAt(0);m={start:a(b.startContainer,b.startOffset),end:a(b.endContainer,b.endOffset),changed:false}};select.selectMarked=function(){function b(){if(f.start.node==f.end.node&&f.start.offset==f.end.offset){var i=window.getSelection();if(!i||i.rangeCount==0)return true;i=i.getRangeAt(0);i=a(i.startContainer,i.startOffset);return f.start.node!=i.node||f.start.offset!=i.offset}}function e(i,j){if(i.node)i.offset==0?h["set"+j+"Before"](i.node):h["set"+j](i.node, i.offset);else h.setStartAfter(document.body.lastChild||document.body)}var f=m;if(f&&(f.changed||webkit&&b())){var h=document.createRange();e(f.end,"End");e(f.start,"Start");d(h)}};var d=function(b){var e=window.getSelection();if(e){e.removeAllRanges();e.addRange(b)}},c=function(){var b=window.getSelection();return!b||b.rangeCount==0?false:b.getRangeAt(0)};select.selectionTopNode=function(b,e){var f=c();if(!f)return false;var h=e?f.startContainer:f.endContainer,i=e?f.startOffset:f.endOffset;window.opera&& !e&&f.endContainer==b&&f.endOffset==f.startOffset+1&&b.childNodes[f.startOffset]&&isBR(b.childNodes[f.startOffset])&&i--;return h.nodeType==3?i>0?g(h,b):p(h,b):h.nodeName.toUpperCase()=="HTML"?i==1?null:b.lastChild:h==b?i==0?null:h.childNodes[i-1]:i==h.childNodes.length?g(h,b):i==0?p(h,b):g(h.childNodes[i-1],b)};select.focusAfterNode=function(b,e){var f=document.createRange();f.setStartBefore(e.firstChild||e);if(b&&!b.firstChild)f.setEndAfter(b);else b?f.setEnd(b,b.childNodes.length):f.setEndBefore(e.firstChild|| e);f.collapse(false);d(f)};select.somethingSelected=function(){var b=c();return b&&!b.collapsed};select.offsetInNode=function(b){var e=c();if(!e)return 0;e=e.cloneRange();e.setStartBefore(b);return e.toString().length};select.insertNodeAtCursor=function(b){var e=c();if(e){e.deleteContents();e.insertNode(b);webkitLastLineHack(document.body);if(window.opera&&isBR(b)&&isSpan(b.parentNode)){e=b.nextSibling;var f=b.parentNode,h=f.parentNode;h.insertBefore(b,f.nextSibling);for(f="";e&&e.nodeType==3;e=e.nextSibling){f+= e.nodeValue;removeElement(e)}h.insertBefore(makePartSpan(f,document),b.nextSibling)}e=document.createRange();e.selectNode(b);e.collapse(false);d(e)}};select.insertNewlineAtCursor=function(){select.insertNodeAtCursor(document.createElement("BR"))};select.insertTabAtCursor=function(){select.insertNodeAtCursor(document.createTextNode("\u00a0\u00a0\u00a0\u00a0"))};select.cursorPos=function(b,e){var f=c();if(f){for(var h=select.selectionTopNode(b,e);h&&!isBR(h);)h=h.previousSibling;f=f.cloneRange();f.collapse(e); h?f.setStartAfter(h):f.setStartBefore(b);f=f.toString();return{node:h,offset:f.length}}};select.setCursorPos=function(b,e,f){function h(j,q,l){function r(v){v.nodeType==3?o.push(v):forEach(v.childNodes,r)}if(q==0&&j&&!j.nextSibling){i["set"+l+"After"](j);return true}if(j=j?j.nextSibling:b.firstChild){if(q==0){i["set"+l+"Before"](j);return true}for(var o=[];;){for(;j&&!o.length;){r(j);j=j.nextSibling}var w=o.shift();if(!w)return false;var A=w.nodeValue.length;if(A>=q){i["set"+l](w,q);return true}q-= A}}}var i=document.createRange();f=f||e;h(f.node,f.offset,"End")&&h(e.node,e.offset,"Start")&&d(i)}}})();function UndoHistory(g,p,k,m){this.container=g;this.maxDepth=p;this.commitDelay=k;this.editor=m;this.last=this.first=g={text:"",from:null,to:null};this.firstTouched=false;this.history=[];this.redoHistory=[];this.touched=[]} UndoHistory.prototype={scheduleCommit:function(){var g=this;parent.clearTimeout(this.commitTimeout);this.commitTimeout=parent.setTimeout(function(){g.tryCommit()},this.commitDelay)},touch:function(g){this.setTouched(g);this.scheduleCommit()},undo:function(){this.commit();if(this.history.length){var g=this.history.pop();this.redoHistory.push(this.updateTo(g,"applyChain"));this.notifyEnvironment();return this.chainNode(g)}},redo:function(){this.commit();if(this.redoHistory.length){var g=this.redoHistory.pop(); this.addUndoLevel(this.updateTo(g,"applyChain"));this.notifyEnvironment();return this.chainNode(g)}},clear:function(){this.history=[];this.redoHistory=[]},historySize:function(){return{undo:this.history.length,redo:this.redoHistory.length}},push:function(g,p,k){for(var m=[],s=0;sthis.maxDepth&&this.history.shift()},touchedChains:function(){function g(a,d){if(a)a.historyTemp=d;else s=d}function p(a){for(var d=[],c=a?a.nextSibling:m.container.firstChild;c&&(!isBR(c)||c.hackBR);c=c.nextSibling)!c.hackBR&&c.currentText&&d.push(c.currentText);return{from:a,to:c,text:cleanText(d.join(""))}}function k(a,d){for(var c=d+"Sibling",b=a[c];b&&!isBR(b);)b=b[c];return b}var m=this,s=null,n=[];m.firstTouched&&m.touched.push(null);forEach(m.touched,function(a){if(!(a&& (a.parentNode!=m.container||a.hackBR))){if(a)a.historyTouched=false;else m.firstTouched=false;var d=p(a),c=m.after(a);if(!c||c.text!=d.text||c.to!=d.to){n.push(d);g(a,d)}}});var t=[];m.touched=[];forEach(n,function(a){if(a.from?a.from.historyTemp:s){for(var d=[],c=a.from,b=true;;){var e=c?c.historyTemp:s;if(!e)if(b)break;else e=p(c);d.unshift(e);g(c,null);if(!c)break;b=m.after(c);c=k(c,"previous")}c=a.to;for(b=m.before(a.from);;){if(!c)break;e=c?c.historyTemp:s;if(!e)if(b)break;else e=p(c);d.push(e); g(c,null);b=m.before(c);c=k(c,"next")}t.push(d)}});return t},shadowChain:function(g){var p=[],k=this.after(g[0].from);for(g=g[g.length-1].to;;){p.push(k);k=k.to;if(!k||k==g)break;else k=k.historyAfter||this.before(g)}return p},applyChain:function(g){var p=select.cursorPos(this.container,false),k=this,m=g[0].from,s=g[g.length-1].to;(function(b,e){for(var f=b?b.nextSibling:k.container.firstChild;f!=e;){var h=f.nextSibling;removeElement(f);f=h}})(m,s);for(var n=0;n0&&k.container.insertBefore(t.from, s);var a=makePartSpan(fixSpaces(t.text));k.container.insertBefore(a,s);if(p&&p.node==t.from){a=0;var d=this.after(t.from);if(d&&n==g.length-1){for(var c=0;cc)a=t.text.length-d.text.length}select.setCursorPos(this.container,{node:t.from,offset:Math.max(0,p.offset+a)})}else p&&n==g.length-1&&p.node&&p.node.parentNode!=this.container&&select.setCursorPos(this.container,{node:t.from,offset:t.text.length})}this.linkChain(g);return m}};var internetExplorer=document.selection&&window.ActiveXObject&&/MSIE/.test(navigator.userAgent),webkit=/AppleWebKit/.test(navigator.userAgent),safari=/Apple Computer, Inc/.test(navigator.vendor),gecko=navigator.userAgent.match(/gecko\/(\d{8})/i);if(gecko)gecko=Number(gecko[1]);var mac=/Mac/.test(navigator.platform),brokenOpera=window.opera&&/Version\/10.[56]/.test(navigator.userAgent),slowWebkit=/AppleWebKit\/533/.test(navigator.userAgent); function makeWhiteSpace(g){for(var p=[],k=true;g>0;g--){p.push(k||g==1?nbsp:" ");k^=true}return p.join("")}function fixSpaces(g){if(g.charAt(0)==" ")g=nbsp+g.slice(1);return g.replace(/\t/g,function(){return makeWhiteSpace(indentUnit)}).replace(/[ \u00a0]{2,}/g,function(p){return makeWhiteSpace(p.length)})}function cleanText(g){return g.replace(/\u00a0/g," ").replace(/\u200b/g,"")} function makePartSpan(g){var p=g;if(g.nodeType==3)p=g.nodeValue;else g=document.createTextNode(p);var k=document.createElement("span");k.isPart=true;k.appendChild(g);k.currentText=p;return k}function alwaysZero(){return 0}var webkitLastLineHack=webkit?function(g){var p=g.lastChild;if(!p||!p.hackBR){p=document.createElement("br");p.hackBR=true;g.appendChild(p)}}:function(){}; function asEditorLines(g){var p=makeWhiteSpace(indentUnit);return map(g.replace(/\t/g,p).replace(/\u00a0/g," ").replace(/\r\n?/g,"\n").split("\n"),fixSpaces)} var Editor=function(){function g(a,d){function c(f,h){if(f.nodeType==3){if((f.nodeValue=fixSpaces(f.nodeValue.replace(/[\r\u200b]/g,"").replace(/\n/g," "))).length)e=false;b.push(f)}else if(isBR(f)&&f.childNodes.length==0){e=true;b.push(f)}else{for(var i=f.firstChild;i;i=i.nextSibling)c(i);if(!e&&t.hasOwnProperty(f.nodeName.toUpperCase())){e=true;if(!d||!h)b.push(document.createElement("br"))}}}var b=[],e=true;c(a,true);return b}function p(a){function d(f){var h=f.parentNode,i=f.nextSibling;return function(j){h.insertBefore(j, i)}}var c=[],b=null,e=true;return{next:function(){if(!a)throw StopIteration;var f=a;a=f.nextSibling;var h;if(f.isPart&&f.childNodes.length==1&&f.firstChild.nodeType==3){h=f.firstChild.nodeValue;f.dirty=f.dirty||h!=f.currentText;f.currentText=h;h=!/[\n\t\r]/.test(f.currentText)}else h=false;if(h){c.push(f);e=false;return f.currentText}else if(isBR(f)){e&&window.opera&&f.parentNode.insertBefore(makePartSpan(""),f);c.push(f);e=true;return"\n"}else{h=!f.nextSibling;b=d(f);removeElement(f);f=g(f,h);for(h= 0;h=o&&(w=r.lastIndexOf(d,l-o))!=-1:(w=r.indexOf(d,l))!=-1)return{from:{node:q,offset:w},to:{node:q,offset:w+o}}}:function(j, q,l){var r=j?i.length-1:0,o=i[r],w=e(q),A=j?w.indexOf(o)+o.length:w.lastIndexOf(o);if(!(j?A>=l||A!=o.length:A<=l||A!=w.length-o.length))for(l=q;;){if(j&&!l)break;l=j?this.history.nodeBefore(l):this.history.nodeAfter(l);if(!j&&!l)break;w=e(l);o=i[j?--r:++r];if(r>0&&rd){b=e.nextSibling;c=f.slice(0,d)+c+f.slice(d);removeElement(e);break}d-=f.length}d=asEditorLines(c);for(c=0;c0&&this.container.insertBefore(document.createElement("BR"),b);this.container.insertBefore(makePartSpan(d[c]),b)}this.addDirtyNode(a);this.scheduleHighlight()},selectedText:function(){var a=this.history;a.commit();var d=select.cursorPos(this.container,true),c=select.cursorPos(this.container, false);if(!d||!c)return"";if(d.node==c.node)return a.textAfter(d.node).slice(d.offset,c.offset);var b=[a.textAfter(d.node).slice(d.offset)];for(d=a.nodeAfter(d.node);d!=c.node;d=a.nodeAfter(d))b.push(a.textAfter(d));b.push(a.textAfter(c.node).slice(0,c.offset));return cleanText(b.join("\n"))},replaceSelection:function(a){this.history.commit();var d=select.cursorPos(this.container,true),c=select.cursorPos(this.container,false);if(d&&c){c=this.replaceRange(d,c,a);select.setCursorPos(this.container, c);webkitLastLineHack(this.container)}},cursorCoords:function(a,d){function c(j,q){var l=-(document.body.scrollTop||document.documentElement.scrollTop||0),r=-(document.body.scrollLeft||document.documentElement.scrollLeft||0)+q;forEach([j,d?null:window.frameElement],function(o){for(;o;){r+=o.offsetLeft;l+=o.offsetTop;o=o.offsetParent}});return{x:r,y:l,yBot:l+j.offsetHeight}}function b(j,q){var l=document.createElement("SPAN");l.appendChild(document.createTextNode(j));try{return q(l)}finally{l.parentNode&& l.parentNode.removeChild(l)}}var e=select.cursorPos(this.container,a);if(!e)return null;for(var f=e.offset,h=e.node,i=this;f;){h=h?h.nextSibling:this.container.firstChild;e=nodeText(h);if(f=20101026)){this.capturingPaste=true;var a=window.frameElement.CodeMirror.textareaHack,d=this.cursorCoords(true,true);a.style.top=d.y+"px";if(internetExplorer)if(d=select.getBookmark(this.container))this.selectionSnapshot=d;parent.focus();a.value="";a.focus();var c=this;parent.setTimeout(function(){c.capturingPaste= false;window.focus();c.selectionSnapshot&&window.select.setBookmark(c.container,c.selectionSnapshot);var b=a.value;if(b){c.replaceSelection(b);select.scrollToCursor(c.container)}},10)}},replaceRange:function(a,d,c){c=asEditorLines(c);c[0]=this.history.textAfter(a.node).slice(0,a.offset)+c[0];var b=c[c.length-1];c[c.length-1]=b+this.history.textAfter(d.node).slice(d.offset);d=this.history.nodeAfter(d.node);this.history.push(a.node,d,c);return{node:this.history.nodeBefore(d),offset:b.length}},getSearchCursor:function(a, d,c){return new s(this,a,d,c)},reindent:function(){this.container.firstChild&&this.indentRegion(null,this.container.lastChild)},reindentSelection:function(a){if(select.somethingSelected()){var d=select.selectionTopNode(this.container,true),c=select.selectionTopNode(this.container,false);d===false||c===false||this.indentRegion(d,c,a)}else this.indentAtCursor(a)},grabKeys:function(a,d){this.frozen=a;this.keyFilter=d},ungrabKeys:function(){this.frozen="leave"},setParser:function(a,d){n.Parser=window[a]; (d=d||this.options.parserConfig)&&n.Parser.configure&&n.Parser.configure(d);if(this.container.firstChild){forEach(this.container.childNodes,function(c){if(c.nodeType!=3)c.dirty=true});this.addDirtyNode(this.firstChild);this.scheduleHighlight()}},keyDown:function(a){if(this.frozen=="leave")this.keyFilter=this.frozen=null;if(this.frozen&&(!this.keyFilter||this.keyFilter(a.keyCode,a))){a.stop();this.frozen(a)}else{var d=a.keyCode;this.delayScanning();this.options.autoMatchParens&&this.scheduleParenHighlight(); if(d==13){if(a.ctrlKey&&!a.altKey)this.reparseBuffer();else{select.insertNewlineAtCursor();d=this.options.enterMode;if(d!="flat")this.indentAtCursor(d=="keep"?"keep":undefined);select.scrollToCursor(this.container)}a.stop()}else if(d==9&&this.options.tabMode!="default"&&!a.ctrlKey){this.handleTab(!a.shiftKey);a.stop()}else if(d==32&&a.shiftKey&&this.options.tabMode=="default"){this.handleTab(true);a.stop()}else if(d==36&&!a.shiftKey&&!a.ctrlKey)this.home()&&a.stop();else if(d==35&&!a.shiftKey&&!a.ctrlKey)this.end()&& a.stop();else if(d==33&&!a.shiftKey&&!a.ctrlKey&&!gecko)this.pageUp()&&a.stop();else if(d==34&&!a.shiftKey&&!a.ctrlKey&&!gecko)this.pageDown()&&a.stop();else if((d==219||d==221)&&a.ctrlKey&&!a.altKey){this.highlightParens(a.shiftKey,true);a.stop()}else if(a.metaKey&&!a.shiftKey&&(d==37||d==39)){var c=select.selectionTopNode(this.container);if(!(c===false||!this.container.firstChild)){if(d==37)select.focusAfterNode(k(c),this.container);else{d=m(c,this.container);select.focusAfterNode(d?d.previousSibling: this.container.lastChild,this.container)}a.stop()}}else if((a.ctrlKey||a.metaKey)&&!a.altKey)if(a.shiftKey&&d==90||d==89){select.scrollToNode(this.history.redo());a.stop()}else if(d==90||safari&&d==8){select.scrollToNode(this.history.undo());a.stop()}else if(d==83&&this.options.saveFunction){this.options.saveFunction();a.stop()}else d==86&&!mac&&this.reroutePasteEvent()}},keyPress:function(a){var d=this.options.electricChars&&n.Parser.electricChars,c=this;if(this.frozen&&(!this.keyFilter||this.keyFilter(a.keyCode|| a.code,a))||a.code==13||a.code==9&&this.options.tabMode!="default"||a.code==32&&a.shiftKey&&this.options.tabMode=="default")a.stop();else if(mac&&(a.ctrlKey||a.metaKey)&&a.character=="v")this.reroutePasteEvent();else if(d&&d.indexOf(a.character)!=-1)parent.setTimeout(function(){c.indentAtCursor(null)},0);else if(brokenOpera)if(a.code==8){var b=select.selectionTopNode(this.container);c=this;var e=b?b.nextSibling:this.container.firstChild;b!==false&&e&&isBR(e)&&parent.setTimeout(function(){select.selectionTopNode(c.container)== e&&select.focusAfterNode(e.previousSibling,c.container)},20)}else{if(a.code==46){b=select.selectionTopNode(this.container);c=this;b&&isBR(b)&&parent.setTimeout(function(){select.selectionTopNode(c.container)!=b&&select.focusAfterNode(b,c.container)},20)}}else if(slowWebkit){e=(b=select.selectionTopNode(this.container))?b.nextSibling:this.container.firstChild;if(b&&e&&isBR(e)&&!isBR(b)){var f=document.createTextNode("\u200b");this.container.insertBefore(f,e);parent.setTimeout(function(){if(f.nodeValue== "\u200b")removeElement(f);else f.nodeValue=f.nodeValue.replace("\u200b","")},20)}}webkit&&!this.options.textWrapping&&setTimeout(function(){var h=select.selectionTopNode(c.container,true);h&&h.nodeType==3&&h.previousSibling&&isBR(h.previousSibling)&&h.nextSibling&&isBR(h.nextSibling)&&h.parentNode.replaceChild(document.createElement("BR"),h.previousSibling)},50)},keyUp:function(a){this.cursorActivity(a.keyCode>=16&&a.keyCode<=18||a.keyCode>=33&&a.keyCode<=40)},indentLineAfter:function(a,d){function c(q){q= q?q.nextSibling:b.container.firstChild;if(!q||!hasClass(q,"whitespace"))return null;return q}var b=this,e=c(a),f=0,h=e?e.currentText.length:0,i=e?e.nextSibling:a?a.nextSibling:this.container.firstChild;if(d=="keep"){if(a){var j=c(k(a.previousSibling));if(j)f=j.currentText.length}}else{j=a&&i&&i.currentText?i.currentText:"";if(d!=null&&this.options.tabMode=="shift")f=d?h+indentUnit:Math.max(0,h-indentUnit);else if(a)f=a.indentation(j,h,d,i);else if(n.Parser.firstIndentation)f=n.Parser.firstIndentation(j, h,d,i)}h=f-h;if(h<0)if(f==0){if(i)select.snapshotMove(e.firstChild,i.firstChild||i,0);removeElement(e);e=null}else{select.snapshotMove(e.firstChild,e.firstChild,h,true);e.currentText=makeWhiteSpace(f);e.firstChild.nodeValue=e.currentText}else if(h>0)if(e){e.currentText=makeWhiteSpace(f);e.firstChild.nodeValue=e.currentText;select.snapshotMove(e.firstChild,e.firstChild,h,true)}else{e=makePartSpan(makeWhiteSpace(f));e.className="whitespace";a?insertAfter(e,a):this.container.insertBefore(e,this.container.firstChild); select.snapshotMove(i&&(i.firstChild||i),e.firstChild,f,false,true)}else e&&select.snapshotMove(e.firstChild,e.firstChild,f,false);h!=0&&this.addDirtyNode(a)},highlightAtCursor:function(){var a=select.selectionTopNode(this.container,true),d=select.selectionTopNode(this.container,false);if(a===false||d===false)return false;select.markSelection();if(this.highlight(a,m(d,this.container),true,20)===false)return false;select.selectMarked();return true},handleTab:function(a){this.options.tabMode=="spaces"? select.insertTabAtCursor():this.reindentSelection(a)},home:function(){var a=select.selectionTopNode(this.container,true),d=a;if(a===false||!(!a||a.isPart||isBR(a))||!this.container.firstChild)return false;for(;a&&!isBR(a);)a=a.previousSibling;var c=a?a.nextSibling:this.container.firstChild;c&&c!=d&&c.isPart&&hasClass(c,"whitespace")?select.focusAfterNode(c,this.container):select.focusAfterNode(a,this.container);select.scrollToCursor(this.container);return true},end:function(){var a=select.selectionTopNode(this.container, true);if(a===false)return false;a=m(a,this.container);if(!a)return false;select.focusAfterNode(a.previousSibling,this.container);select.scrollToCursor(this.container);return true},pageUp:function(){var a=this.cursorPosition().line,d=this.visibleLineCount();if(a===false||d===false)return false;d-=2;for(var c=0;c0;){var a=this.dirty.pop();try{for(;a&&a.parentNode!=this.container;)a=a.parentNode;if(a&&(a.dirty||a.nodeType==3))return a}catch(d){}}return null},highlightDirty:function(a){if(!window||!window.parent||!window.select)return false;this.options.readOnly||select.markSelection();for(var d,c=a?null:(new Date).getTime()+this.options.passTime;((new Date).getTime()=j||!o&&!w&&A>1&&!c)throw StopIteration;w=o;o=false;A=0;r.next()}else{if(!isSpan(x))throw"Parser out of sync. Expected SPAN.";if(x.dirty)o=true;A++;if(!x.reduced&&x.currentText==v.value&&x.className==v.style){i&&x.dirty&&i(x,v,h);x.dirty=false;r.next()}else{o=true;var H=makePartSpan(v.value);H.className=v.style;f.insertBefore(H,x);i&&i(H,v,h);v=v.value.length;for(var K=0;v>0;){x=r.get();var L=x.currentText.length;select.snapshotReplaceNode(x.firstChild, H.firstChild,v,K);if(L>v){x=x;x.currentText=x.currentText.substring(v);x.reduced=true;v=0}else{v-=L;K+=L;r.remove()}}}}});e(a);webkitLastLineHack(this.container);return{node:r.getNonEmpty(),dirty:o}}};return n}();addEventHandler(window,"load",function(){var g=window.frameElement.CodeMirror;g.editor=new Editor(g.options);parent.setTimeout(method(g,"init"),0)});function tokenizer(g,p){function k(s){return s!="\n"&&/^[\s\u00a0]*$/.test(s)}var m={state:p,take:function(s){if(typeof s=="string")s={style:s,type:s};s.content=(s.content||"")+g.get();/\n$/.test(s.content)||g.nextWhile(k);s.value=s.content+g.get();return s},next:function(){if(!g.more())throw StopIteration;var s;if(g.equals("\n")){g.next();return this.take("whitespace")}if(g.applies(k))s="whitespace";else for(;!s;)s=this.state(g,function(n){m.state=n});return this.take(s)}};return m};var tokenizeJavaScript=function(){function g(a,d){for(var c=false;!a.endOfLine();){var b=a.next();if(b==d&&!c)return false;c=!c&&b=="\\"}return c}function p(a,d){return function(c,b){var e=a,f=k(a,d,c,function(i){e=i}),h=f.type=="operator"||f.type=="keyword c"||f.type.match(/^[\[{}\(,;:]$/);if(h!=d||e!=a)b(p(e,h));return f}}function k(a,d,c,b){function e(){c.nextWhileMatches(t);var q=c.get(),l=m.hasOwnProperty(q)&&m.propertyIsEnumerable(q)&&m[q];return l?{type:l.type,style:l.style,content:q}:{type:"variable", style:"js-variable",content:q}}function f(q){var l="/*";for(q=q=="*";;){if(c.endOfLine())break;var r=c.next();if(r=="/"&&q){l=null;break}q=r=="*"}b(l);return{type:"comment",style:"js-comment"}}function h(){c.nextWhileMatches(s);return{type:"operator",style:"js-operator"}}function i(q){var l=g(c,q);b(l?q:null);return{type:"string",style:"js-string"}}if(a=='"'||a=="'")return i(a);var j=c.next();if(a=="/*")return f(j);else if(j=='"'||j=="'")return i(j);else if(/[\[\]{}\(\),;\:\.]/.test(j))return{type:j, style:"js-punctuation"};else if(j=="0"&&(c.equals("x")||c.equals("X"))){c.next();c.nextWhileMatches(n);return{type:"number",style:"js-atom"}}else if(/[0-9]/.test(j)){c.nextWhileMatches(/[0-9]/);if(c.equals(".")){c.next();c.nextWhileMatches(/[0-9]/)}if(c.equals("e")||c.equals("E")){c.next();c.equals("-")&&c.next();c.nextWhileMatches(/[0-9]/)}return{type:"number",style:"js-atom"}}else if(j=="/")if(c.equals("*")){c.next();return f(j)}else if(c.equals("/")){g(c,null);return{type:"comment",style:"js-comment"}}else{if(d){g(c, "/");c.nextWhileMatches(/[gimy]/);a={type:"regexp",style:"js-string"}}else a=h();return a}else return s.test(j)?h():e()}var m=function(){function a(h,i){return{type:h,style:"js-"+i}}var d=a("keyword a","keyword"),c=a("keyword b","keyword"),b=a("keyword c","keyword"),e=a("operator","keyword"),f=a("atom","atom");return{"if":d,"while":d,"with":d,"else":c,"do":c,"try":c,"finally":c,"return":b,"break":b,"continue":b,"new":b,"delete":b,"throw":b,"in":e,"typeof":e,"instanceof":e,"var":a("var","keyword"), "function":a("function","keyword"),"catch":a("catch","keyword"),"for":a("for","keyword"),"switch":a("switch","keyword"),"case":a("case","keyword"),"default":a("default","keyword"),"true":f,"false":f,"null":f,undefined:f,NaN:f,Infinity:f}}(),s=/[+\-*&%=<>!?|]/,n=/[0-9A-Fa-f]/,t=/[\w\$_]/;return function(a,d){return tokenizer(a,d||p(false,true))}}();var JSParser=Editor.Parser=function(){function g(s,n,t,a,d,c){this.indented=s;this.column=n;this.type=t;if(a!=null)this.align=a;this.prev=d;this.info=c}function p(s){return function(n){var t=n&&n.charAt(0),a=s.type,d=t==a;return a=="vardef"?s.indented+4:a=="form"&&t=="{"?s.indented:a=="stat"||a=="form"?s.indented+indentUnit:s.info=="switch"&&!d?s.indented+(/^(?:case|default)\b/.test(n)?indentUnit:2*indentUnit):s.align?s.column-(d?1:0):s.indented+(d?0:indentUnit)}}var k={atom:true,number:true,variable:true, string:true,regexp:true},m=false;return{make:function(s,n){function t(u){for(var B=u.length-1;B>=0;B--)y.push(u[B])}function a(){t(arguments);S=true}function d(){t(arguments);S=false}function c(){C={prev:C,vars:{"this":true,arguments:true}}}function b(){C=C.prev}function e(u){if(C){Q="js-variabledef";C.vars[u]=true}}function f(u,B){var P=function(){E=new g(O,I,u,null,E,B)};P.lex=true;return P}function h(){if(E.type==")")O=E.indented;E=E.prev}function i(u){return function(B){if(B==u)a();else u==";"? d():a(arguments.callee)}}function j(){return d(l,j)}function q(){return d(r,q)}function l(u){if(u=="var")a(f("vardef"),K,i(";"),h);else if(u=="keyword a")a(f("form"),r,l,h);else if(u=="keyword b")a(f("form"),l,h);else if(u=="{")a(f("}"),H,h);else if(u==";")a();else if(u=="function")a(z);else if(u=="for")a(f("form"),i("("),f(")"),F,i(")"),h,l,h);else if(u=="variable")a(f("stat"),w);else if(u=="switch")a(f("form"),r,f("}","switch"),i("{"),H,h,h);else if(u=="case")a(r,i(":"));else if(u=="default")a(i(":")); else u=="catch"?a(f("form"),c,i("("),M,i(")"),l,h,b):d(f("stat"),r,i(";"),h)}function r(u){if(k.hasOwnProperty(u))a(o);else if(u=="function")a(z);else if(u=="keyword c")a(r);else if(u=="(")a(f(")"),r,i(")"),h,o);else if(u=="operator")a(r);else if(u=="[")a(f("]"),x(r,"]"),h,o);else u=="{"?a(f("}"),x(v,"}"),h,o):a()}function o(u,B){if(u=="operator"&&/\+\+|--/.test(B))a(o);else if(u=="operator")a(r);else if(u==";")d();else if(u=="(")a(f(")"),x(r,")"),h,o);else if(u==".")a(A,o);else u=="["&&a(f("]"), r,i("]"),h,o)}function w(u){u==":"?a(h,l):d(o,i(";"),h)}function A(u){if(u=="variable"){Q="js-property";a()}}function v(u){if(u=="variable")Q="js-property";k.hasOwnProperty(u)&&a(i(":"),r)}function x(u,B){function P(R){if(R==",")a(u,P);else R==B?a():a(i(B))}return function(R){R==B?a():d(u,P)}}function H(u){u=="}"?a():d(l,H)}function K(u,B){if(u=="variable"){e(B);a(L)}else a()}function L(u,B){if(B=="=")a(r,L);else u==","&&a(K)}function F(u){if(u=="var")a(K,G);else if(u==";")d(G);else u=="variable"? a(N):d(G)}function N(u,B){B=="in"?a(r):a(o,G)}function G(u,B){if(u==";")a(D);else B=="in"?a(r):a(r,i(";"),D)}function D(u){u==")"?d():a(r)}function z(u,B){if(u=="variable"){e(B);a(z)}else u=="("&&a(c,x(M,")"),l,b)}function M(u,B){if(u=="variable"){e(B);a()}}var J=tokenizeJavaScript(s),y=[m?q:j],C=null,E=new g((n||0)-indentUnit,0,"block",false),I=0,O=0,S,Q,T={next:function(){for(;y[y.length-1].lex;)y.pop()();var u=J.next();if(u.type=="whitespace"&&I==0)O=u.value.length;I+=u.value.length;if(u.content== "\n"){O=I=0;if(!("align"in E))E.align=false;u.indentation=p(E)}if(u.type=="whitespace"||u.type=="comment")return u;if(!("align"in E))E.align=true;for(;;){S=Q=false;y.pop()(u.type,u.content);if(S){if(Q)u.style=Q;else{var B;if(B=u.type=="variable")a:{for(B=C;B;){if(B.vars[u.content]){B=true;break a}B=B.prev}B=false}if(B)u.style="js-localvariable"}return u}}},copy:function(){var u=C,B=E,P=y.concat([]),R=J.state;return function(U){C=u;E=B;y=P.concat([]);I=O=0;J=tokenizeJavaScript(U,R);return T}}};h.lex= true;return T},electricChars:"{}:",configure:function(s){if(s.json!=null)m=s.json}}}();var XMLParser=Editor.Parser=function(){var g={autoSelfClosers:{br:true,img:true,hr:true,link:true,input:true,meta:true,col:true,frame:true,base:true,area:true},doNotIndent:{pre:true,"!cdata":true}},p={autoSelfClosers:{},doNotIndent:{"!cdata":true}},k=g,m=false,s=function(){function n(c,b){var e=c.next();if(e=="<")if(c.equals("!")){c.next();if(c.equals("["))if(c.lookAhead("[CDATA[",true)){b(d("xml-cdata","]]\>"));return null}else return"xml-text";else if(c.lookAhead("--",true)){b(d("xml-comment","--\>")); return null}else if(c.lookAhead("DOCTYPE",true)){c.nextWhileMatches(/[\w\._\-]/);b(d("xml-doctype",">"));return"xml-doctype"}else return"xml-text"}else if(c.equals("?")){c.next();c.nextWhileMatches(/[\w\._\-]/);b(d("xml-processing","?>"));return"xml-processing"}else{c.equals("/")&&c.next();b(t);return"xml-punctuation"}else if(e=="&"){for(;!c.endOfLine();)if(c.next()==";")break;return"xml-entity"}else{c.nextWhileMatches(/[^&<\n]/);return"xml-text"}}function t(c,b){var e=c.next();if(e==">"){b(n);return"xml-punctuation"}else if(/[?\/]/.test(e)&& c.equals(">")){c.next();b(n);return"xml-punctuation"}else if(e=="=")return"xml-punctuation";else if(/[\'\"]/.test(e)){b(a(e));return null}else{c.nextWhileMatches(/[^\s\u00a0=<>\"\'\/?]/);return"xml-name"}}function a(c){return function(b,e){for(;!b.endOfLine();)if(b.next()==c){e(t);break}return"xml-attribute"}}function d(c,b){return function(e,f){for(;!e.endOfLine();){if(e.lookAhead(b,true)){f(n);break}e.next()}return c}}return function(c,b){return tokenizer(c,b||n)}}();return{make:function(n){function t(D){for(var z= D.length-1;z>=0;z--)x.push(D[z])}function a(){t(arguments);N=true}function d(){t(arguments);N=false}function c(){v.style+=" xml-error"}function b(D){return function(z,M){if(M==D)a();else{c();a(arguments.callee)}}}function e(D,z){var M=k.doNotIndent.hasOwnProperty(D)||F&&F.noIndent;F={prev:F,name:D,indent:K,startOfLine:z,noIndent:M}}function f(D){return function(z,M){var J=D;if(J&&J.noIndent)return M;if(m&&/"));else{if(D=="xml-cdata"){if(!F||F.name!="!cdata")e("!cdata");if(/\]\]>$/.test(z))F=F.prev}else G.hasOwnProperty(D)||c();a()}}function j(D,z){if(D=="xml-name"){L=z.toLowerCase();v.style="xml-tagname";a()}else{L=null;d()}}function q(D,z){if(D=="xml-name"){v.style="xml-tagname";if(F&&z.toLowerCase()==F.name)F=F.prev;else c()}a()}function l(D){return function(z,M){if(M=="/>"|| M==">"&&k.autoSelfClosers.hasOwnProperty(L))a();else if(M==">"){e(L,D);a()}else{c();a(arguments.callee)}}}function r(D){if(D=="xml-name"){v.style="xml-attname";a(o,r)}else d()}function o(D,z){if(z=="=")a(w);else z==">"||z=="/>"?d(l):d()}function w(D){D=="xml-attribute"?a(w):d()}var A=s(n),v,x=[h],H=0,K=0,L=null,F=null,N,G={"xml-text":true,"xml-entity":true,"xml-comment":true,"xml-processing":true,"xml-doctype":true};return{indentation:function(){return K},next:function(){v=A.next();if(v.style=="whitespace"&& H==0)K=v.value.length;else H++;if(v.content=="\n"){K=H=0;v.indentation=f(F)}if(v.style=="whitespace"||v.type=="xml-comment")return v;for(;;){N=false;x.pop()(v.style,v.content);if(N)return v}},copy:function(){var D=x.concat([]),z=A.state,M=F,J=this;return function(y){x=D.concat([]);H=K=0;F=M;A=s(y,z);return J}}}},electricChars:"/",configure:function(n){if(n.useHTMLKludges!=null)k=n.useHTMLKludges?g:p;if(n.alignCDATA)m=n.alignCDATA}}}();var CSSParser=Editor.Parser=function(){function g(k,m,s){return function(n){return!k||/^\}/.test(n)?s:m?s+indentUnit*2:s+indentUnit}}var p=function(){function k(t,a){var d=t.next();if(d=="@"){t.nextWhileMatches(/\w/);return"css-at"}else if(d=="/"&&t.equals("*")){a(m);return null}else if(d=="<"&&t.equals("!")){a(s);return null}else if(d=="=")return"css-compare";else if(t.equals("=")&&(d=="~"||d=="|")){t.next();return"css-compare"}else if(d=='"'||d=="'"){a(n(d));return null}else if(d=="#"){t.nextWhileMatches(/\w/); return"css-hash"}else if(d=="!"){t.nextWhileMatches(/[ \t]/);t.nextWhileMatches(/\w/);return"css-important"}else if(/\d/.test(d)){t.nextWhileMatches(/[\w.%]/);return"css-unit"}else if(/[,.+>*\/]/.test(d))return"css-select-op";else if(/[;{}:\[\]]/.test(d))return"css-punctuation";else{t.nextWhileMatches(/[\w\\\-_]/);return"css-identifier"}}function m(t,a){for(var d=false;!t.endOfLine();){var c=t.next();if(d&&c=="/"){a(k);break}d=c=="*"}return"css-comment"}function s(t,a){for(var d=0;!t.endOfLine();){var c= t.next();if(d>=2&&c==">"){a(k);break}d=c=="-"?d+1:0}return"css-comment"}function n(t){return function(a,d){for(var c=false;!a.endOfLine();){var b=a.next();if(b==t&&!c)break;c=!c&&b=="\\"}c||d(k);return"css-string"}}return function(t,a){return tokenizer(t,a||k)}}();return{make:function(k,m){m=m||0;var s=p(k),n=false,t=false,a=false,d={next:function(){var c=s.next(),b=c.style,e=c.content;if(b=="css-hash")b=c.style=t?"css-colorcode":"css-identifier";if(b=="css-identifier")if(t)c.style="css-value";else if(!n&& !a)c.style="css-selector";if(e=="\n")c.indentation=g(n,t,m);if(e=="{"&&a=="@media")a=false;else if(e=="{")n=true;else if(e=="}")n=t=a=false;else if(e==";")t=a=false;else if(n&&b!="css-comment"&&b!="whitespace")t=true;else if(!n&&b=="css-at")a=e;return c},copy:function(){var c=n,b=t,e=s.state;return function(f){s=p(f,e);n=c;t=b;return d}}};return d},electricChars:"}"}}();var HTMLMixedParser=Editor.Parser=function(){function g(){var k=["XMLParser"],m;for(m in p)k.push(p[m]);for(var s in k)if(!window[k[s]])throw Error(k[s]+" parser must be loaded for HTML mixed mode to work.");XMLParser.configure({useHTMLKludges:true})}var p={script:"JSParser",style:"CSSParser"};return{make:function(k){function m(){var c=n.next();if(c.content=="<")a=true;else if(c.style=="xml-tagname"&&a===true)a=c.content.toLowerCase();else if(c.content==">"){if(p[a])d.next=s(window[p[a]],"")); return null}else return"xml-text";else if(l.lookAhead("--",true)){r(q("xml-comment","--\>"));return null}else return"xml-text"}else if(l.equals("?")){l.next();l.nextWhileMatches(/[\w\._\-]/);r(q("xml-processing","?>"));return"xml-processing"}else{l.equals("/")&&l.next();r(b);return"xml-punctuation"}else if(o=="{"){if(l.equals("{")){l.next();r(e);return"liquid-punctuation"}if(l.equals("%")){l.next();r(f);return"liquid-punctuation"}else return"xml-text"}else if(o=="&"){for(;!l.endOfLine();)if(l.next()== ";")break;return"xml-entity"}else{l.nextWhileMatches(/[^{&<\n]/);return"xml-text"}}function b(l,r){var o=l.next();if(o==">"){r(c);return"xml-punctuation"}else if(/[?\/]/.test(o)&&l.equals(">")){l.next();r(c);return"xml-punctuation"}else if(o=="=")return"xml-punctuation";else if(/[\'\"]/.test(o)){r(j(o));return null}else{l.nextWhileMatches(/[^\s\u00a0=<>\"\'\/?]/);return"xml-name"}}function e(l,r){var o=l.next();if(o=="}")if(l.equals("}")){l.next();r(c);return"liquid-punctuation"}else{r(c);return"liquid-bad-punctuation"}else if(s.test(o)){r(i(o, e));return null}else if(t.test(o))return"liquid-punctuation";return"liquid-text"}function f(l,r){l.nextWhileMatches(n);r(h);return"liquid-tag-name"}function h(l,r){var o=l.next();if(o=="%")if(l.equals("}")){l.next();r(c);return"liquid-punctuation"}else{r(c);return"liquid-bad-punctuation"}else if(s.test(o)){r(i(o,h));return null}else{if(t.test(o))o="liquid-punctuation";else{o=a;l.nextWhileMatches(n);var w=l.get();o=o&&o.propertyIsEnumerable(w)?{type:"string",style:"liquid-keyword",content:w}:{type:"string", style:"liquid-text",content:w}}return o}}function i(l,r){return function(o,w){for(;!o.endOfLine();)if(o.next()==l){w(r);break}return"liquid-string"}}function j(l){return function(r,o){for(;!r.endOfLine();)if(r.next()==l){o(b);break}return"xml-attribute"}}function q(l,r){return function(o,w){for(;!o.endOfLine();){if(o.lookAhead(r,true)){w(c);break}o.next()}return l}}return function(l,r){return tokenizer(l,r||c)}}();return{make:function(c){function b(y){for(var C=y.length-1;C>=0;C--)K.push(y[C])}function e(){b(arguments); D=true}function f(){b(arguments);D=false}function h(y){return function(C,E){if(E==y)e();else{z="xml-error";e(arguments.callee)}}}function i(y,C){var E=k.doNotIndent.hasOwnProperty(y)||G&&G.noIndent;G={prev:G,name:y,indent:F,startOfLine:C,noIndent:E}}function j(y){return function(C,E){var I=y;if(I&&I.noIndent)return E;if(m&&/"));else{if(y=="xml-cdata"){if(!G||G.name!="!cdata")i("!cdata");if(/\]\]>$/.test(C))G=G.prev}else M.hasOwnProperty(y)||J.hasOwnProperty(y)||(z="xml-error");e()}}function r(y,C){if(y=="xml-name"){N=C.toLowerCase();z="xml-tagname";e()}else{N=null;f()}}function o(y,C){if(y=="xml-name"&&G&&C.toLowerCase()==G.name){G=G.prev;z="xml-tagname"}else z="xml-error";e()}function w(y){return function(C,E){if(E=="/>"||E==">"&&k.autoSelfClosers.hasOwnProperty(N))e();else if(E== ">")i(N,y)||e();else{z="xml-error";e(arguments.callee)}}}function A(y){if(y=="xml-name"){z="xml-attname";e(v,A)}else f()}function v(y,C){if(C=="=")e(x);else C==">"||C=="/>"?f(w):f()}function x(y){y=="xml-attribute"?e(x):f()}var H=d(c),K=[q],L=0,F=0,N=null,G=null,D,z,M={"xml-text":true,"xml-entity":true,"xml-comment":true,"xml-processing":true},J={"liquid-punctuation":true,"liquid-bad-punctuation":true,"liquid-keyword":true,"liquid-tag-name":true,"liquid-variable":true,"liquid-text":true,"liquid-string":true}; return{indentation:function(){return F},next:function(){var y=H.next();if(y.style=="whitespace"&&L==0)F=y.value.length;else L++;if(y.content=="\n"){F=L=0;y.indentation=j(G)}if(y.style=="whitespace"||y.type=="xml-comment")return y;for(;;){D=z=false;K.pop()(y.style,y.content);if(D){if(z)y.style=z;return y}}},copy:function(){var y=K.concat([]),C=H.state,E=G,I=this;return function(O){K=y.concat([]);L=F=0;G=E;H=d(O,C);return I}}}},electricChars:"/",configure:function(c){if(c.useHTMLKludges!=null)k=c.useHTMLKludges? g:p;if(c.alignCDATA)m=c.alignCDATA}}}();