Version Description
Download this release
Release Info
Developer | DvanKooten |
Plugin | MailChimp for WordPress |
Version | 4.0.2 |
Comparing to | |
See all releases |
Code changes from version 4.0.1 to 4.0.2
- CHANGELOG.md +12 -0
- assets/js/forms-admin.js +8 -8
- assets/js/forms-admin.min.js +1 -1
- assets/js/forms-admin.min.js.map +0 -1
CHANGELOG.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1 |
Changelog
|
2 |
=========
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
#### 4.0 & 4.0.1 - August 9, 2016
|
5 |
|
6 |
This release updates the plugin to version 3 of the MailChimp API. Please [read through the upgrade guide](https://mc4wp.com/kb/upgrading-to-4-0/) before updating to make sure things keep working as expected for you.
|
1 |
Changelog
|
2 |
=========
|
3 |
|
4 |
+
#### 4.0.2 - August 10, 2016
|
5 |
+
|
6 |
+
**Fixes**
|
7 |
+
|
8 |
+
- Hidden fields which referenced interest groups by name were not sent to MailChimp.
|
9 |
+
- Adding hidden field to form would reset value on every change.
|
10 |
+
|
11 |
+
**Improvements**
|
12 |
+
|
13 |
+
- Decrease file size of JavaScript for forms by about 30%.
|
14 |
+
|
15 |
+
|
16 |
#### 4.0 & 4.0.1 - August 9, 2016
|
17 |
|
18 |
This release updates the plugin to version 3 of the MailChimp API. Please [read through the upgrade guide](https://mc4wp.com/kb/upgrading-to-4-0/) before updating to make sure things keep working as expected for you.
|
assets/js/forms-admin.js
CHANGED
@@ -238,20 +238,12 @@ var forms = function(m, i18n) {
|
|
238 |
config.label('');
|
239 |
config.wrap(false);
|
240 |
|
241 |
-
// if this hidden field has choices (hidden goups), glue them together by their label.
|
242 |
-
if( config.choices().length > 0 ) {
|
243 |
-
config.value( config.choices().map(function(c) {
|
244 |
-
return c.label();
|
245 |
-
}).join('|'));
|
246 |
-
}
|
247 |
-
|
248 |
return [
|
249 |
rows.value(config)
|
250 |
]
|
251 |
};
|
252 |
|
253 |
forms.submit = function(config) {
|
254 |
-
|
255 |
config.label('');
|
256 |
config.placeholder('');
|
257 |
|
@@ -438,6 +430,14 @@ var FieldHelper = function(m, tabs, editor, fields, i18n) {
|
|
438 |
*/
|
439 |
function setActiveField(index) {
|
440 |
fieldConfig = fields.get(index);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
m.redraw();
|
442 |
}
|
443 |
|
238 |
config.label('');
|
239 |
config.wrap(false);
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
return [
|
242 |
rows.value(config)
|
243 |
]
|
244 |
};
|
245 |
|
246 |
forms.submit = function(config) {
|
|
|
247 |
config.label('');
|
248 |
config.placeholder('');
|
249 |
|
430 |
*/
|
431 |
function setActiveField(index) {
|
432 |
fieldConfig = fields.get(index);
|
433 |
+
|
434 |
+
// if this hidden field has choices (hidden groups), glue them together by their label.
|
435 |
+
if( fieldConfig.choices().length > 0 ) {
|
436 |
+
fieldConfig.value( fieldConfig.choices().map(function(c) {
|
437 |
+
return c.label();
|
438 |
+
}).join('|'));
|
439 |
+
}
|
440 |
+
|
441 |
m.redraw();
|
442 |
}
|
443 |
|
assets/js/forms-admin.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
!function(){var e=void 0,t=void 0;!function r(t,n,i){function o(l,s){if(!n[l]){if(!t[l]){var c="function"==typeof e&&e;if(!s&&c)return c(l,!0);if(a)return a(l,!0);var u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var d=n[l]={exports:{}};t[l][0].call(d.exports,function(e){var r=t[l][1][e];return o(r?r:e)},d,d.exports,r,t,n,i)}return n[l].exports}for(var a="function"==typeof e&&e,l=0;l<i.length;l++)o(i[l]);return o}({1:[function(e,t,r){"use strict";var n=function(e,t){var r={};return r.label=function(r){return e("div",[e("label",t.fieldLabel),e("input.widefat",{type:"text",value:r.label(),onchange:e.withAttr("value",r.label),placeholder:r.title()})])},r.value=function(r){return e("div",[e("label",[t.value," ","hidden"===r.type()?"":e("small",{style:"float: right; font-weight: normal;"},t.optional)]),e("input.widefat",{type:"text",value:r.value(),onchange:e.withAttr("value",r.value)}),e("p.help",t.valueHelp)])},r.numberMinMax=function(r){return e("div",[e("div.row",[e("div.col.col-3",[e("label",t.min),e("input",{type:"number",onchange:e.withAttr("value",r.min)})]),e("div.col.col-3",[e("label",t.max),e("input",{type:"number",onchange:e.withAttr("value",r.max)})])])])},r.isRequired=function(r){var n,i={type:"checkbox",checked:r.required(),onchange:e.withAttr("checked",r.required)};return r.forceRequired()&&(i.required=!0,i.disabled=!0,n=e("p.help",t.forceRequired)),e("div",[e("label.cb-wrap",[e("input",i),t.isFieldRequired]),n])},r.placeholder=function(r){return e("div",[e("label",[t.placeholder," ",e("small",{style:"float: right; font-weight: normal;"},t.optional)]),e("input.widefat",{type:"text",value:r.placeholder(),onchange:e.withAttr("value",r.placeholder),placeholder:""}),e("p.help",t.placeholderHelp)])},r.useParagraphs=function(r){return e("div",[e("label.cb-wrap",[e("input",{type:"checkbox",checked:r.wrap(),onchange:e.withAttr("checked",r.wrap)}),t.wrapInParagraphTags])])},r.choiceType=function(r){return e("div",[e("label",t.choiceType),e("select",{value:r.type(),onchange:e.withAttr("value",r.type)},[e("option",{value:"select",selected:"select"===r.type()&&"selected"},t.dropdown),e("option",{value:"radio",selected:"radio"===r.type()&&"selected"},t.radioButtons),e("option",{value:"checkbox",selected:"checkbox"===r.type()&&"selected"},t.checkboxes)])])},r.choices=function(r){var n=[];return n.push(e("div",[e("label",t.choices),e("div.limit-height",[e("table",[r.choices().map(function(n,i){return e("tr",{"data-id":i},[e("td.cb",e("input",{name:"selected",type:"checkbox"===r.type()?"checkbox":"radio",onchange:e.withAttr("value",r.selectChoice.bind(r)),checked:n.selected(),value:n.value(),title:t.preselect})),e("td.stretch",e("input.widefat",{type:"text",value:n.label(),placeholder:n.title(),onchange:e.withAttr("value",n.label)})),e("td",e("span",{title:t.remove,"class":"dashicons dashicons-no-alt hover-activated",onclick:function(e){this.choices().splice(e,1)}.bind(r,i)},""))])})])])])),n},r};t.exports=n},{}],2:[function(e,t,r){var n=function(t,r){var n={},i=e("./field-forms-rows.js")(t,r);return n.render=function(e){var t=e.type();if("function"==typeof n[t])return n[t](e);switch(t){case"select":case"radio":case"checkbox":return n.choice(e)}return n.text(e)},n.text=function(e){return[i.label(e),i.placeholder(e),i.value(e),i.isRequired(e),i.useParagraphs(e)]},n.choice=function(e){var t=[i.label(e),i.choiceType(e),i.choices(e)];return"select"===e.type()&&t.push(i.placeholder(e)),t.push(i.useParagraphs(e)),"select"!==e.type()&&"radio"!==e.type()||t.push(i.isRequired(e)),t},n.hidden=function(e){return e.placeholder(""),e.label(""),e.wrap(!1),e.choices().length>0&&e.value(e.choices().map(function(e){return e.label()}).join("|")),[i.value(e)]},n.submit=function(e){return e.label(""),e.placeholder(""),[i.value(e),i.useParagraphs(e)]},n.number=function(e){return[n.text(e),i.numberMinMax(e)]},n};t.exports=n},{"./field-forms-rows.js":1}],3:[function(e,t,r){"use strict";var n=e("../third-party/render.js"),i=e("../third-party/beautify-html.js"),o=function(e){function t(t){var o,a,l,s;return o=t.label().length?e("label",t.label()):"",a="function"==typeof r[t.type()]?r[t.type()](t):r["default"](t),l=t.wrap()?e("p",[o,a]):[o,a],s=n(l),s=i(s),s+"\n"}var r={};return r.select=function(t){var r={name:t.name(),required:t.required()},n=!1,i=t.choices().map(function(t){return t.selected()&&(n=!0),e("option",{value:t.value()!==t.label()?t.value():void 0,selected:t.selected()},t.label())}),o=t.placeholder();return o.length>0&&i.unshift(e("option",{disabled:!0,value:"",selected:!n},o)),e("select",r,i)},r.checkbox=function(t){var r=t.choices().map(function(r){var n=t.name()+("checkbox"===t.type()?"[]":""),i=t.required()&&"radio"===t.type();return e("label",[e("input",{name:n,type:t.type(),value:r.value(),checked:r.selected(),required:i})," ",e("span",r.label())])});return r},r.radio=r.checkbox,r["default"]=function(t){var r,n={type:t.type()};return t.name()&&(n.name=t.name()),t.min()&&(n.min=t.min()),t.max()&&(n.max=t.max()),t.value().length>0&&(n.value=t.value()),t.placeholder().length>0&&(n.placeholder=t.placeholder()),n.required=t.required(),r=e("input",n)},t};t.exports=o},{"../third-party/beautify-html.js":12,"../third-party/render.js":13}],4:[function(e,t,r){var n=function(t,r,n,i,o){"use strict";function a(e){u=i.get(e),t.redraw()}function l(){}function s(){var e=d(u);n.insert(e),a(""),t.redraw()}function c(){var e=i.getCategories(),r=i.getAll(),n=t("div.available-fields.small-margin",[t("h4",o.chooseField),e.map(function(e){var n=r.filter(function(t){return t.category===e});if(n.length)return t("div.tiny-margin",[t("strong",e),n.map(function(e){var r="button";e.forceRequired()&&(r+=" is-required");var n=e.inFormContent();return null!==n&&(r+=" "+(n?"in-form":"not-in-form")),t("button",{className:r,type:"button",onclick:t.withAttr("value",a),value:e.index},e.title())})])})]),l=null;return u&&(l=h(t("div.field-wizard",[t("h3",[u.title(),u.forceRequired()?t("span.red","*"):"",u.name().length?t("code",u.name()):""]),u.help().length?t("p",t.trust(u.help())):"",f.render(u),t("p",[t("button",{"class":"button-primary",type:"button",onkeydown:function(e){e=e||window.event,13==e.keyCode&&s()},onclick:s},o.addToForm)])]),a)),[n,l]}var u,d=e("./field-generator.js")(t),h=e("./overlay.js")(t,o),f=e("./field-forms.js")(t,o);return n.on("blur",t.redraw),{view:c,controller:l}};t.exports=n},{"./field-forms.js":2,"./field-generator.js":3,"./overlay.js":10}],5:[function(e,t,r){var n=function(e,t){"use strict";function r(){u.forEach(e.deregister)}function n(t,r,n){var i=e.register(t,r);n||u.push(i)}function i(e){var t={phone:"tel",dropdown:"select",checkboxes:"checkbox",birthday:"text"};return"undefined"!=typeof t[e]?t[e]:e}function o(e){var r=t.listFields,o={name:e.tag,title:e.name,required:e.required,forceRequired:e.required,type:i(e.field_type),choices:e.choices};return"address"!==o.type?n(r,o,!1):(n(r,{name:o.name+"[addr1]",type:"text",title:t.streetAddress}),n(r,{name:o.name+"[city]",type:"text",title:t.city}),n(r,{name:o.name+"[state]",type:"text",title:t.state}),n(r,{name:o.name+"[zip]",type:"text",title:t.zip}),n(r,{name:o.name+"[country]",type:"select",title:t.country,choices:mc4wp_vars.countries})),!0}function a(e){var r=t.interestCategories,o={title:e.name,name:"INTERESTS["+e.id+"]",type:i(e.field_type),choices:e.interests};n(r,o,!1)}function l(e){e.merge_fields=e.merge_fields.sort(function(e,t){return"EMAIL"===e.tag||e["public"]&&!t["public"]?-1:!e["public"]&&t["public"]?1:0}),e.merge_fields.forEach(o),e.interest_categories.forEach(a)}function s(e){r(),e.forEach(l)}function c(e){var r,i=t.formFields;n(i,{name:"",value:t.subscribe,type:"submit",title:t.submitButton},!0),r={};for(var o in e)r[e[o].id]=e[o].name;n(i,{name:"_mc4wp_lists",type:"checkbox",title:t.listChoice,choices:r,help:t.listChoiceDescription},!0),r={subscribe:"Subscribe",unsubscribe:"Unsubscribe"},n(i,{name:"_mc4wp_action",type:"radio",title:t.formAction,choices:r,value:"subscribe",help:t.formActionDescription},!0)}var u=[];return{registerCustomFields:c,registerListFields:l,registerListsFields:s}};t.exports=n},{}],6:[function(e,t,r){"use strict";t.exports=function(e,t){function r(e){var t=[];return t="function"==typeof e.map?e.map(function(e){return new f({label:e})}):Object.keys(e).map(function(t){var r=e[t];return new f({label:r,value:t})})}function n(n,i){var o,a=s("name",i.name).shift();return a?void(!a.required()&&i.required&&a.required(!0)):(i.choices&&(i.choices=r(i.choices),i.value&&(i.choices=i.choices.map(function(e){return e.value()===i.value&&e.selected(!0),e}))),d.indexOf(n)<0&&d.push(n),o=new h(i),o.category=n,u.push(o),c&&window.clearTimeout(c),c=window.setTimeout(e.redraw,100),t.trigger("fields.change"),o)}function i(t){var r=u.indexOf(t);r>-1&&(delete u[r],e.redraw())}function o(e){return u[e]}function a(){return u=u.map(function(e,t){return e.index=t,e})}function l(){return d}function s(e,t){return u.filter(function(r){return r[e]()===t})}var c,u=[],d=[],h=function(t){this.name=e.prop(t.name),this.title=e.prop(t.title||t.name),this.type=e.prop(t.type),this.label=e.prop(t.title||""),this.value=e.prop(t.value||""),this.placeholder=e.prop(t.placeholder||""),this.required=e.prop(t.required||!1),this.forceRequired=e.prop(t.forceRequired||!1),this.wrap=e.prop(t.wrap||!0),this.min=e.prop(t.min||null),this.max=e.prop(t.max||null),this.help=e.prop(t.help||""),this.choices=e.prop(t.choices||[]),this.inFormContent=e.prop(null),this.selectChoice=function(e){var t=this;this.choices(this.choices().map(function(r){return r.value()===e?r.selected(!0):"checkbox"!==t.type()&&r.selected(!1),r}))}},f=function(t){this.label=e.prop(t.label),this.title=e.prop(t.title||t.label),this.selected=e.prop(t.selected||!1),this.value=e.prop(t.value||t.label)};return{get:o,getAll:a,getCategories:l,deregister:i,register:n,getAllWhere:s}}},{}],7:[function(e,t,r){"use strict";var n=e("codemirror");e("codemirror/mode/xml/xml"),e("codemirror/mode/javascript/javascript"),e("codemirror/mode/css/css"),e("codemirror/mode/htmlmixed/htmlmixed"),e("codemirror/addon/fold/xml-fold"),e("codemirror/addon/edit/matchtags"),e("codemirror/addon/edit/closetag.js");var i=function(e){function t(){return o&&(i.innerHTML=a.getValue().toLowerCase(),o=!1),i}var r,i=document.createElement("form"),o=!1,a={};return i.innerHTML=e.value.toLowerCase(),n&&(r=n.fromTextArea(e,{selectionPointer:!0,matchTags:{bothTags:!0},mode:"htmlmixed",htmlMode:!0,autoCloseTags:!0,autoRefresh:!0}),window.dispatchEvent&&r.on("change",function(){if("function"==typeof Event){var t=new Event("change",{bubbles:!0});e.dispatchEvent(t)}})),window.addEventListener("load",function(){n.signal(r,"change")}),e.addEventListener("change",function(){o=!0}),a.getValue=function(){return r?r.getValue():e.value},a.query=function(e){return t().querySelectorAll(e)},a.containsField=function(e){return null!==t().elements.namedItem(e.toLowerCase())},a.insert=function(t){r?(r.replaceSelection(t),r.focus()):e.value+=t},a.on=function(t,n){return r?(t="input"===t?"changes":t,r.on(t,n)):e.addEventListener(t,n)},a.refresh=function(){r&&r.refresh()},a};t.exports=i},{codemirror:17,"codemirror/addon/edit/closetag.js":14,"codemirror/addon/edit/matchtags":15,"codemirror/addon/fold/xml-fold":16,"codemirror/mode/css/css":18,"codemirror/mode/htmlmixed/htmlmixed":19,"codemirror/mode/javascript/javascript":20,"codemirror/mode/xml/xml":21}],8:[function(e,t,r){var n=function(e,t,r,n,i,o){"use strict";function a(){n.getAll().forEach(function(e){if(!(e.name().length<=0)){var r=e.name();"checkbox"===e.type()&&(r+="[]");var n=t.containsField(r);e.inFormContent(n)}}),l(),e.redraw()}function l(){var e=n.getAllWhere("forceRequired",!0).map(function(e){return e.name().toUpperCase()}),r=t.query("[required]");Array.prototype.forEach.call(r,function(t){var r=t.name.toUpperCase();"_"!==r[0]&&(r=r.replace(/\[(\w+)\]/g,".$1"),e.indexOf(r)===-1&&e.push(r))}),s.value=e.join(",")}var s=document.getElementById("required-fields");t.on("change",o.debounce(a,500)),i.on("fields.change",o.debounce(a,500))};t.exports=n},{}],9:[function(e,t,r){"use strict";function n(e){var t=l.indexOf(e);t<0&&(l.push(e),o())}function i(e){var t=l.indexOf(e);t>-1&&(l.splice(t,1),o())}function o(){for(var e="",t=0;t<l.length;t++)e+='<div class="notice notice-warning"><p>'+l[t]+"</p></div>";var r=document.querySelector(".mc4wp-notices");if(!r){r=document.createElement("div"),r.className="mc4wp-notices";var n=document.querySelector("h1");n.parentNode.insertBefore(r,n.nextSibling)}r.innerHTML=e}function a(e){e.on("change",function(){var t="Your form contains old style <code>GROUPINGS</code> fields. <br /><br />Please remove these fields from your form and then re-add them through the available field buttons to make sure your data is getting through to MailChimp correctly.",r=e.getValue().toLowerCase();r.indexOf('name="groupings')>-1?n(t):i(t)})}var l=[];t.exports={init:a}},{}],10:[function(e,t,r){var n=function(e,t){"use strict";function r(){document.removeEventListener("keydown",n),window.removeEventListener("resize",i),a()}function n(e){e=e||window.event,27==e.keyCode&&r(),13==e.keyCode&&e.preventDefault()}function i(){if(o){var e=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,r=(e-o.clientWidth-40)/2,n=(t-o.clientHeight-40)/2;o.style.left=(r>0?r:0)+"px",o.style.top=(n>0?n:0)+"px"}}var o,a;return function(l,s){return a=s,document.addEventListener("keydown",n),window.addEventListener("resize",i),[e("div.overlay-wrap",e("div.overlay",{config:function(e){o=e,i()}},[e("span",{"class":"close dashicons dashicons-no",title:t.close,onclick:r}),l])),e("div.overlay-background",{title:t.close,onclick:r})]}};t.exports=n},{}],11:[function(e,t,r){"use strict";var n=window.mc4wp_forms_i18n,i=window.mc4wp.deps.mithril,o=mc4wp.events,a=mc4wp.settings,l=mc4wp.helpers,s=mc4wp.tabs,c=e("./admin/form-watcher.js"),u=e("./admin/form-editor.js"),d=e("./admin/field-helper.js"),h=e("./admin/fields-factory.js"),f=e("./admin/fields.js")(i,o),p=document.getElementById("mc4wp-form-content"),g=window.formEditor=new u(p),m=(new c(i,formEditor,a,f,o,l),new d(i,s,formEditor,f,n)),v=e("./admin/notices");i.mount(document.getElementById("mc4wp-field-wizard"),m);var y=new h(f,n);o.on("selectedLists.change",y.registerListsFields),y.registerListsFields(a.getSelectedLists()),y.registerCustomFields(mc4wp_vars.mailchimp.lists),window.setTimeout(function(){i.redraw()},2e3),v.init(g),window.mc4wp=window.mc4wp||{},window.mc4wp.forms=window.mc4wp.forms||{},window.mc4wp.forms.editor=g,window.mc4wp.forms.fields=f},{"./admin/field-helper.js":4,"./admin/fields-factory.js":5,"./admin/fields.js":6,"./admin/form-editor.js":7,"./admin/form-watcher.js":8,"./admin/notices":9}],12:[function(e,t,r){!function(){function e(e){return e.replace(/^\s+|\s+$/g,"")}function r(e){return e.replace(/^\s+/g,"")}function n(t,n,i,o){function a(){return this.pos=0,this.token="",this.current_mode="CONTENT",this.tags={parent:"parent1",parentcount:1,parent1:""},this.tag_type="",this.token_text=this.last_token=this.last_text=this.token_type="",this.newlines=0,this.indent_content=s,this.Utils={whitespace:"\n\r\t ".split(""),single_token:"br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?=".split(","),extra_liners:"head,body,/html".split(","),in_array:function(e,t){for(var r=0;r<t.length;r++)if(e===t[r])return!0;return!1}},this.traverse_whitespace=function(){var e="";if(e=this.input.charAt(this.pos),this.Utils.in_array(e,this.Utils.whitespace)){for(this.newlines=0;this.Utils.in_array(e,this.Utils.whitespace);)p&&"\n"===e&&this.newlines<=g&&(this.newlines+=1),this.pos++,e=this.input.charAt(this.pos);return!0}return!1},this.get_content=function(){for(var e="",t=[],r=!1;"<"!==this.input.charAt(this.pos);){if(this.pos>=this.input.length)return t.length?t.join(""):["","TK_EOF"];if(this.traverse_whitespace())t.length&&(r=!0);else{if(indent_handlebars){var n=this.input.substr(this.pos,3);if("{{#"===n||"{{/"===n)break;if("{{"===this.input.substr(this.pos,2)&&"{{else}}"===this.get_tag(!0))break}e=this.input.charAt(this.pos),this.pos++,r&&(this.line_char_count>=this.wrap_line_length?(this.print_newline(!1,t),this.print_indentation(t)):(this.line_char_count++,t.push(" ")),r=!1),this.line_char_count++,t.push(e)}}return t.length?t.join(""):""},this.get_contents_to=function(e){if(this.pos===this.input.length)return["","TK_EOF"];var t="",r=new RegExp("</"+e+"\\s*>","igm");r.lastIndex=this.pos;var n=r.exec(this.input),i=n?n.index:this.input.length;return this.pos<i&&(t=this.input.substring(this.pos,i),this.pos=i),t},this.record_tag=function(e){this.tags[e+"count"]?(this.tags[e+"count"]++,this.tags[e+this.tags[e+"count"]]=this.indent_level):(this.tags[e+"count"]=1,this.tags[e+this.tags[e+"count"]]=this.indent_level),this.tags[e+this.tags[e+"count"]+"parent"]=this.tags.parent,this.tags.parent=e+this.tags[e+"count"]},this.retrieve_tag=function(e){if(this.tags[e+"count"]){for(var t=this.tags.parent;t&&e+this.tags[e+"count"]!==t;)t=this.tags[t+"parent"];t&&(this.indent_level=this.tags[e+this.tags[e+"count"]],this.tags.parent=this.tags[t+"parent"]),delete this.tags[e+this.tags[e+"count"]+"parent"],delete this.tags[e+this.tags[e+"count"]],1===this.tags[e+"count"]?delete this.tags[e+"count"]:this.tags[e+"count"]--}},this.indent_to_tag=function(e){if(this.tags[e+"count"]){for(var t=this.tags.parent;t&&e+this.tags[e+"count"]!==t;)t=this.tags[t+"parent"];t&&(this.indent_level=this.tags[e+this.tags[e+"count"]])}},this.get_tag=function(e){var t,r,n,i="",o=[],a="",l=!1,s=this.pos,c=this.line_char_count;e=void 0!==e&&e;do{if(this.pos>=this.input.length)return e&&(this.pos=s,this.line_char_count=c),o.length?o.join(""):["","TK_EOF"];if(i=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(i,this.Utils.whitespace))l=!0;else{if("'"!==i&&'"'!==i||(i+=this.get_unformatted(i),l=!0),"="===i&&(l=!1),o.length&&"="!==o[o.length-1]&&">"!==i&&l&&(this.line_char_count>=this.wrap_line_length?(this.print_newline(!1,o),this.print_indentation(o)):(o.push(" "),this.line_char_count++),l=!1),indent_handlebars&&"<"===n&&i+this.input.charAt(this.pos)==="{{"&&(i+=this.get_unformatted("}}"),o.length&&" "!==o[o.length-1]&&"<"!==o[o.length-1]&&(i=" "+i),l=!0),"<"!==i||n||(t=this.pos-1,n="<"),indent_handlebars&&!n&&o.length>=2&&"{"===o[o.length-1]&&"{"==o[o.length-2]&&(t="#"===i||"/"===i?this.pos-3:this.pos-2,n="{"),this.line_char_count++,o.push(i),o[1]&&"!"===o[1]){o=[this.get_comment(t)];break}if(indent_handlebars&&"{"===n&&o.length>2&&"}"===o[o.length-2]&&"}"===o[o.length-1])break}}while(">"!==i);var u,d,h=o.join("");u=h.indexOf(" ")!==-1?h.indexOf(" "):"{"===h[0]?h.indexOf("}"):h.indexOf(">"),d="<"!==h[0]&&indent_handlebars?"#"===h[2]?3:2:1;var p=h.substring(d,u).toLowerCase();return"/"===h.charAt(h.length-2)||this.Utils.in_array(p,this.Utils.single_token)?e||(this.tag_type="SINGLE"):indent_handlebars&&"{"===h[0]&&"else"===p?e||(this.indent_to_tag("if"),this.tag_type="HANDLEBARS_ELSE",this.indent_content=!0,this.traverse_whitespace()):"script"===p?e||(this.record_tag(p),this.tag_type="SCRIPT"):"style"===p?e||(this.record_tag(p),this.tag_type="STYLE"):this.is_unformatted(p,f)?(a=this.get_unformatted("</"+p+">",h),o.push(a),t>0&&this.Utils.in_array(this.input.charAt(t-1),this.Utils.whitespace)&&o.splice(0,0,this.input.charAt(t-1)),r=this.pos-1,this.Utils.in_array(this.input.charAt(r+1),this.Utils.whitespace)&&o.push(this.input.charAt(r+1)),this.tag_type="SINGLE"):"!"===p.charAt(0)?e||(this.tag_type="SINGLE",this.traverse_whitespace()):e||("/"===p.charAt(0)?(this.retrieve_tag(p.substring(1)),this.tag_type="END",this.traverse_whitespace()):(this.record_tag(p),"html"!==p.toLowerCase()&&(this.indent_content=!0),this.tag_type="START",this.traverse_whitespace()),this.Utils.in_array(p,this.Utils.extra_liners)&&(this.print_newline(!1,this.output),this.output.length&&"\n"!==this.output[this.output.length-2]&&this.print_newline(!0,this.output))),e&&(this.pos=s,this.line_char_count=c),o.join("")},this.get_comment=function(e){var t="",r=">",n=!1;for(this.pos=e,input_char=this.input.charAt(this.pos),this.pos++;this.pos<=this.input.length&&(t+=input_char,t[t.length-1]!==r[r.length-1]||t.indexOf(r)===-1);)!n&&t.length<10&&(0===t.indexOf("<![if")?(r="<![endif]>",n=!0):0===t.indexOf("<![cdata[")?(r="]]>",n=!0):0===t.indexOf("<![")?(r="]>",n=!0):0===t.indexOf("<!--")&&(r="-->",n=!0)),input_char=this.input.charAt(this.pos),this.pos++;return t},this.get_unformatted=function(e,t){if(t&&t.toLowerCase().indexOf(e)!==-1)return"";var r="",n="",i=0,o=!0;do{if(this.pos>=this.input.length)return n;if(r=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(r,this.Utils.whitespace)){if(!o){this.line_char_count--;continue}if("\n"===r||"\r"===r){n+="\n",this.line_char_count=0;continue}}n+=r,this.line_char_count++,o=!0,indent_handlebars&&"{"===r&&n.length&&"{"===n[n.length-2]&&(n+=this.get_unformatted("}}"),i=n.length)}while(n.toLowerCase().indexOf(e,i)===-1);return n},this.get_token=function(){var e;if("TK_TAG_SCRIPT"===this.last_token||"TK_TAG_STYLE"===this.last_token){var t=this.last_token.substr(7);return e=this.get_contents_to(t),"string"!=typeof e?e:[e,"TK_"+t]}if("CONTENT"===this.current_mode)return e=this.get_content(),"string"!=typeof e?e:[e,"TK_CONTENT"];if("TAG"===this.current_mode){if(e=this.get_tag(),"string"!=typeof e)return e;var r="TK_TAG_"+this.tag_type;return[e,r]}},this.get_full_indent=function(e){return e=this.indent_level+e||0,e<1?"":Array(e+1).join(this.indent_string)},this.is_unformatted=function(e,t){if(!this.Utils.in_array(e,t))return!1;if("a"!==e.toLowerCase()||!this.Utils.in_array("a",t))return!0;var r=this.get_tag(!0),n=(r||"").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);return!(n&&!this.Utils.in_array(n,t))},this.printer=function(e,t,n,i,o){this.input=e||"",this.output=[],this.indent_character=t,this.indent_string="",this.indent_size=n,this.brace_style=o,this.indent_level=0,this.wrap_line_length=i,this.line_char_count=0;for(var a=0;a<this.indent_size;a++)this.indent_string+=this.indent_character;this.print_newline=function(e,t){this.line_char_count=0,t&&t.length&&(e||"\n"!==t[t.length-1])&&t.push("\n")},this.print_indentation=function(e){for(var t=0;t<this.indent_level;t++)e.push(this.indent_string),this.line_char_count+=this.indent_string.length},this.print_token=function(e){(e||""!==e)&&this.output.length&&"\n"===this.output[this.output.length-1]&&(this.print_indentation(this.output),e=r(e)),this.print_token_raw(e)},this.print_token_raw=function(e){e&&""!==e&&(e.length>1&&"\n"===e[e.length-1]?(this.output.push(e.slice(0,-1)),this.print_newline(!1,this.output)):this.output.push(e));for(var t=0;t<this.newlines;t++)this.print_newline(t>0,this.output);this.newlines=0},this.indent=function(){this.indent_level++},this.unindent=function(){this.indent_level>0&&this.indent_level--}},this}var l,s,c,u,d,h,f,p,g;for(n=n||{},void 0!==n.wrap_line_length&&0!==parseInt(n.wrap_line_length,10)||void 0!==n.max_char&&0!==parseInt(n.max_char,10)||(n.wrap_line_length=n.max_char),s=n.indent_inner_html||!1,c=parseInt(n.indent_size||4,10),u=n.indent_char||" ",h=n.brace_style||"collapse",d=0===parseInt(n.wrap_line_length,10)?32786:parseInt(n.wrap_line_length||250,10),f=n.unformatted||["a","span","bdo","em","strong","dfn","code","samp","kbd","var","cite","abbr","acronym","q","sub","sup","tt","i","b","big","small","u","s","strike","font","ins","del","pre","address","dt","h1","h2","h3","h4","h5","h6"],p=n.preserve_newlines||!0,g=p?parseInt(n.max_preserve_newlines||32786,10):0,indent_handlebars=n.indent_handlebars||!1,l=new a,l.printer(t,u,c,d,h);;){var m=l.get_token();if(l.token_text=m[0],l.token_type=m[1],"TK_EOF"===l.token_type)break;switch(l.token_type){case"TK_TAG_START":l.print_newline(!1,l.output),l.print_token(l.token_text),l.indent_content&&(l.indent(),l.indent_content=!1),l.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":l.print_newline(!1,l.output),l.print_token(l.token_text),l.current_mode="CONTENT";break;case"TK_TAG_END":if("TK_CONTENT"===l.last_token&&""===l.last_text){var v=l.token_text.match(/\w+/)[0],y=null;l.output.length&&(y=l.output[l.output.length-1].match(/(?:<|{{#)\s*(\w+)/)),null!==y&&y[1]===v||l.print_newline(!1,l.output)}l.print_token(l.token_text),l.current_mode="CONTENT";break;case"TK_TAG_SINGLE":var b=l.token_text.match(/^\s*<([a-z]+)/i);b&&l.Utils.in_array(b[1],f)||l.print_newline(!1,l.output),l.print_token(l.token_text),l.current_mode="CONTENT";break;case"TK_TAG_HANDLEBARS_ELSE":l.print_token(l.token_text),l.indent_content&&(l.indent(),l.indent_content=!1),l.current_mode="CONTENT";break;case"TK_CONTENT":l.print_token(l.token_text),l.current_mode="TAG";break;case"TK_STYLE":case"TK_SCRIPT":if(""!==l.token_text){l.print_newline(!1,l.output);var w,x=l.token_text,k=1;"TK_SCRIPT"===l.token_type?w="function"==typeof i&&i:"TK_STYLE"===l.token_type&&(w="function"==typeof o&&o),"keep"===n.indent_scripts?k=0:"separate"===n.indent_scripts&&(k=-l.indent_level);var C=l.get_full_indent(k);if(w)x=w(x.replace(/^\s*/,C),n);else{var S=x.match(/^\s*/)[0],T=S.match(/[^\n\r]*$/)[0].split(l.indent_string).length-1,L=l.get_full_indent(k-T);x=x.replace(/^\s*/,C).replace(/\r\n|\r|\n/g,"\n"+L).replace(/\s+$/,"")}x&&(l.print_token_raw(C+e(x)),l.print_newline(!1,l.output))}l.current_mode="TAG"}l.last_token=l.token_type,l.last_text=l.token_text}return l.output.join("")}"undefined"!=typeof t&&"undefined"!=typeof t.exports?t.exports=n:"undefined"!=typeof window&&(window.html_beautify=n)}()},{}],13:[function(e,t,r){"use strict";function n(e){return"[object Array]"===Object.prototype.toString.call(e)}function i(e){return e.replace(/\W+/g,"-").replace(/([a-z\d])([A-Z])/g,"$1-$2")}function o(e){return""!=e}function a(e,t){return"undefined"===e&&(e=""),"string"!=typeof e&&(e+=""),e=e.replace(/\&/g,"&").replace(/</g,"<").replace(/\>/g,">"),t?e.replace(/\"/g,"""):e}function l(e){return e&&Object.keys(e).length?Object.keys(e).map(function(t){var r=e[t];if("undefined"!=typeof r&&null!==r&&"function"!=typeof r){if("boolean"==typeof r)return r?" "+t:"";if("style"===t){if(!r)return;var n=e.style;return"object"==typeof n&&(n=Object.keys(n).map(function(e){return""!=n[e]?[i(e).toLowerCase(),n[e]].join(":"):""}).filter(o).join(";")),""!=n?' style="'+a(n,!0)+'"':""}return" "+a("className"===t?"class":t)+'="'+a(r,!0)+'"'}}).join(""):""}function s(e){return n(e.children)&&!e.children.length?"":c(e.children)}function c(e){var t=typeof e;if("string"===t)return a(e);if("number"===t||"boolean"===t)return e;if(!e)return"";if(n(e))return e.map(c).join("");if(e.view){var r=e.controller?new e.controller:{},i=c(e.view(r));return r.onunload&&r.onunload(),i}if(e.$trusted)return""+e;var o=s(e);return!o&&u.indexOf(e.tag.toLowerCase())>=0?"<"+e.tag+l(e.attrs)+">":["<",e.tag,l(e.attrs),">",o,"</",e.tag,">"].join("")}var u=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr","!doctype"];t.exports=c},{}],14:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof t&&t.amd?t(["../../lib/codemirror","../fold/xml-fold"],i):i(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var r=t.listSelections(),n=[],s=0;s<r.length;s++){if(!r[s].empty())return e.Pass;var c=r[s].head,u=t.getTokenAt(c),d=e.innerMode(t.getMode(),u.state),h=d.state;if("xml"!=d.mode.name||!h.tagName)return e.Pass;var f=t.getOption("autoCloseTags"),p="html"==d.mode.configuration,g="object"==typeof f&&f.dontCloseTags||p&&a,m="object"==typeof f&&f.indentTags||p&&l,v=h.tagName;u.end>c.ch&&(v=v.slice(0,v.length-u.end+c.ch));var y=v.toLowerCase();if(!v||"string"==u.type&&(u.end!=c.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||1==u.string.length)||"tag"==u.type&&"closeTag"==h.type||u.string.indexOf("/")==u.string.length-1||g&&i(g,y)>-1||o(t,v,c,h,!0))return e.Pass;var b=m&&i(m,y)>-1;n[s]={indent:b,text:">"+(b?"\n\n":"")+"</"+v+">",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var s=r.length-1;s>=0;s--){var w=n[s];t.replaceRange(w.text,r[s].head,r[s].anchor,"+insert");var x=t.listSelections().slice(0);x[s]={head:w.newPos,anchor:w.newPos},t.setSelections(x),w.indent&&(t.indentLine(w.newPos.line,null,!0),t.indentLine(w.newPos.line+1,null,!0))}}function r(t,r){for(var n=t.listSelections(),i=[],a=r?"/":"</",l=0;l<n.length;l++){if(!n[l].empty())return e.Pass;var s=n[l].head,c=t.getTokenAt(s),u=e.innerMode(t.getMode(),c.state),d=u.state;if(r&&("string"==c.type||"<"!=c.string.charAt(0)||c.start!=s.ch-1))return e.Pass;var h;if("xml"!=u.mode.name)if("htmlmixed"==t.getMode().name&&"javascript"==u.mode.name)h=a+"script";else{if("htmlmixed"!=t.getMode().name||"css"!=u.mode.name)return e.Pass;h=a+"style"}else{if(!d.context||!d.context.tagName||o(t,d.context.tagName,s,d))return e.Pass;h=a+d.context.tagName}">"!=t.getLine(s.line).charAt(c.end)&&(h+=">"),i[l]=h}t.replaceSelections(i),n=t.listSelections();for(var l=0;l<n.length;l++)(l==n.length-1||n[l].head.line<n[l+1].head.line)&&t.indentLine(n[l].head.line)}function n(t){return t.getOption("disableInput")?e.Pass:r(t,!0)}function i(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;++r)if(e[r]==t)return r;return-1}function o(t,r,n,i,o){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,n.line+500),l=e.scanForClosingTag(t,n,null,a);if(!l||l.tag!=r)return!1;for(var s=i.context,c=o?1:0;s&&s.tagName==r;s=s.prev)++c;n=l.to;for(var u=1;u<c;u++){var d=e.scanForClosingTag(t,n,null,a);if(!d||d.tag!=r)return!1;n=d.to}return!0}e.defineOption("autoCloseTags",!1,function(r,i,o){if(o!=e.Init&&o&&r.removeKeyMap("autoCloseTags"),i){var a={name:"autoCloseTags"};("object"!=typeof i||i.whenClosing)&&(a["'/'"]=function(e){return n(e)}),("object"!=typeof i||i.whenOpening)&&(a["'>'"]=function(e){return t(e)}),r.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],l=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return r(e)}})},{"../../lib/codemirror":17,"../fold/xml-fold":16}],15:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof t&&t.amd?t(["../../lib/codemirror","../fold/xml-fold"],i):i(CodeMirror)}(function(e){"use strict";function t(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function r(r){r.state.failedTagMatch=!1,r.operation(function(){if(t(r),!r.somethingSelected()){var n=r.getCursor(),i=r.getViewport();i.from=Math.min(i.from,n.line),i.to=Math.max(n.line+1,i.to);var o=e.findMatchingTag(r,n,i);if(o){if(r.state.matchBothTags){var a="open"==o.at?o.open:o.close;a&&(r.state.tagHit=r.markText(a.from,a.to,{className:"CodeMirror-matchingtag"}))}var l="close"==o.at?o.open:o.close;l?r.state.tagOther=r.markText(l.from,l.to,{className:"CodeMirror-matchingtag"}):r.state.failedTagMatch=!0}}})}function n(e){e.state.failedTagMatch&&r(e)}e.defineOption("matchTags",!1,function(i,o,a){a&&a!=e.Init&&(i.off("cursorActivity",r),i.off("viewportChange",n),t(i)),o&&(i.state.matchBothTags="object"==typeof o&&o.bothTags,i.on("cursorActivity",r),i.on("viewportChange",n),r(i))}),e.commands.toMatchingTag=function(t){var r=e.findMatchingTag(t,t.getCursor());if(r){var n="close"==r.at?r.open:r.close;n&&t.extendSelection(n.to,n.from)}}})},{"../../lib/codemirror":17,"../fold/xml-fold":16}],16:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";
|
2 |
function t(e,t){return e.line-t.line||e.ch-t.ch}function r(e,t,r,n){this.line=t,this.ch=r,this.cm=e,this.text=e.getLine(t),this.min=n?n.from:e.firstLine(),this.max=n?n.to-1:e.lastLine()}function n(e,t){var r=e.cm.getTokenTypeAt(h(e.line,t));return r&&/\btag\b/.test(r)}function i(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function o(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function a(e){for(;;){var t=e.text.indexOf(">",e.ch);if(t==-1){if(i(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),o=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,o?"selfClose":"regular"}e.ch=t+1}}}function l(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(t==-1){if(o(e))continue;return}if(n(e,t+1)){g.lastIndex=t,e.ch=t;var r=g.exec(e.text);if(r&&r.index==t)return r}else e.ch=t}}function s(e){for(;;){g.lastIndex=e.ch;var t=g.exec(e.text);if(!t){if(i(e))continue;return}{if(n(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(t==-1){if(o(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),i=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,i?"selfClose":"regular"}e.ch=t}}}function u(e,t){for(var r=[];;){var n,i=s(e),o=e.line,l=e.ch-(i?i[0].length:0);if(!i||!(n=a(e)))return;if("selfClose"!=n)if(i[1]){for(var c=r.length-1;c>=0;--c)if(r[c]==i[2]){r.length=c;break}if(c<0&&(!t||t==i[2]))return{tag:i[2],from:h(o,l),to:h(e.line,e.ch)}}else r.push(i[2])}}function d(e,t){for(var r=[];;){var n=c(e);if(!n)return;if("selfClose"!=n){var i=e.line,o=e.ch,a=l(e);if(!a)return;if(a[1])r.push(a[2]);else{for(var s=r.length-1;s>=0;--s)if(r[s]==a[2]){r.length=s;break}if(s<0&&(!t||t==a[2]))return{tag:a[2],from:h(e.line,e.ch),to:h(i,o)}}}else l(e)}}var h=e.Pos,f="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",p=f+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",g=new RegExp("<(/?)(["+f+"]["+p+"]*)","g");e.registerHelper("fold","xml",function(e,t){for(var n=new r(e,t.line,0);;){var i,o=s(n);if(!o||n.line!=t.line||!(i=a(n)))return;if(!o[1]&&"selfClose"!=i){var l=h(n.line,n.ch),c=u(n,o[2]);return c&&{from:l,to:c.from}}}}),e.findMatchingTag=function(e,n,i){var o=new r(e,n.line,n.ch,i);if(o.text.indexOf(">")!=-1||o.text.indexOf("<")!=-1){var s=a(o),c=s&&h(o.line,o.ch),f=s&&l(o);if(s&&f&&!(t(o,n)>0)){var p={from:h(o.line,o.ch),to:c,tag:f[2]};return"selfClose"==s?{open:p,close:null,at:"open"}:f[1]?{open:d(o,f[2]),close:p,at:"close"}:(o=new r(e,c.line,c.ch,i),{open:p,close:u(o,f[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,n){for(var i=new r(e,t.line,t.ch,n);;){var o=d(i);if(!o)break;var a=new r(e,t.line,t.ch,n),l=u(a,o.tag);if(l)return{open:o,close:l}}},e.scanForClosingTag=function(e,t,n,i){var o=new r(e,t.line,t.ch,i?{from:0,to:i}:null);return u(o,n)}})},{"../../lib/codemirror":17}],17:[function(e,r,n){!function(e){if("object"==typeof n&&"object"==typeof r)r.exports=e();else{if("function"==typeof t&&t.amd)return t([],e);(this||window).CodeMirror=e()}}(function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n?Hi(n):{},Hi(ta,n,!1),f(n);var i=n.value;"string"==typeof i&&(i=new Ta(i,n.mode,null,n.lineSeparator)),this.doc=i;var o=new e.inputStyles[n.inputStyle](this),a=this.display=new t(r,i,o);a.wrapper.CodeMirror=this,c(this),l(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!Oo&&a.input.focus(),v(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Ni,keySeq:null,specialChars:null};var s=this;wo&&xo<11&&setTimeout(function(){s.display.input.reset(!0)},20),qt(this),Xi(),xt(this),this.curOp.forceUpdate=!0,Zn(this,i),n.autofocus&&!Oo||s.hasFocus()?setTimeout(Fi(vr,this),20):yr(this);for(var u in ra)ra.hasOwnProperty(u)&&ra[u](this,n[u],na);k(this),n.finishInit&&n.finishInit(this);for(var d=0;d<la.length;++d)la[d](this);Ct(this),ko&&n.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function t(e,t,r){var n=this;this.input=r,n.scrollbarFiller=qi("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=qi("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=qi("div",null,"CodeMirror-code"),n.selectionDiv=qi("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=qi("div",null,"CodeMirror-cursors"),n.measure=qi("div",null,"CodeMirror-measure"),n.lineMeasure=qi("div",null,"CodeMirror-measure"),n.lineSpace=qi("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none"),n.mover=qi("div",[qi("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=qi("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=qi("div",null,null,"position: absolute; height: "+Da+"px; width: 1px;"),n.gutters=qi("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=qi("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=qi("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),wo&&xo<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),ko||vo&&Oo||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Fe(e,100),e.state.modeGen++,e.curOp&&Dt(e)}function i(e){e.options.lineWrapping?(Ja(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Qa(e.display.wrapper,"CodeMirror-wrap"),h(e)),a(e),Dt(e),st(e),setTimeout(function(){y(e)},100)}function o(e){var t=bt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/wt(e.display)-3);return function(i){if(Cn(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function a(e){var t=e.doc,r=o(e);t.iter(function(e){var t=r(e);t!=e.height&&ti(e,t)})}function l(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),st(e)}function s(e){c(e),Dt(e),setTimeout(function(){x(e)},20)}function c(e){var t=e.display.gutters,r=e.options.gutters;Ki(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(qi("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",u(e)}function u(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function d(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=mn(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=vn(n);){var i=t.find(0,!0);r-=n.text.length-i.from.ch,n=i.to.line,r+=n.text.length-i.to.ch}return r}function h(e){var t=e.display,r=e.doc;t.maxLine=Qn(r,r.first),t.maxLineLength=d(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=d(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function f(e){var t=zi(e.gutters,"CodeMirror-linenumbers");t==-1&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function p(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Ke(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Ge(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function g(e,t,r){this.cm=r;var n=this.vert=qi("div",[qi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=qi("div",[qi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),Na(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Na(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,wo&&xo<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function m(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Qa(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Na(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?or(t,e):ir(t,e)},t),t.display.scrollbars.addClass&&Ja(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=p(e));var r=e.display.barWidth,n=e.display.barHeight;b(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&N(e),b(e,p(e)),r=e.display.barWidth,n=e.display.barHeight}function b(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function w(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-qe(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=ni(t,n),a=ni(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;l<o?(o=l,a=ni(t,ii(Qn(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=ni(t,ii(Qn(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function x(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=S(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&r[a].gutter&&(r[a].gutter.style.left=o);var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function k(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=C(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(qi("div",[qi("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a)+1,n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",u(e),!0}return!1}function C(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function S(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function T(e,t,r){var n=e.display;this.viewport=t,this.visible=w(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Ve(e),this.force=r,this.dims=E(e),this.events=[]}function L(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ge(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ge(e)+"px",t.scrollbarsClipped=!0)}function M(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Ht(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Bt(e))return!1;k(e)&&(Ht(e),t.dims=E(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>a&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),Ho&&(o=xn(e.doc,o),a=kn(e.doc,a));var l=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Rt(e,o,a),r.viewOffset=ii(Qn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var s=Bt(e);if(!l&&0==s&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=Gi();return s>4&&(r.lineDiv.style.display="none"),z(e,r.updateLineNumbers,t.dims),s>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,c&&Gi()!=c&&c.offsetHeight&&c.focus(),Ki(r.cursorDiv),Ki(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,l&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Fe(e,400)),r.updateLineNumbers=null,!0}function _(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Ve(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Ke(e.display)-$e(e),r.top)}),t.visible=w(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&M(e,t);n=!1){N(e);var i=p(e);ze(e),y(e,i),O(e,i)}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var r=new T(e,t);if(M(e,r)){N(e),_(e,r);var n=p(e);ze(e),y(e,n),O(e,n),r.finish()}}function O(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ge(e)+"px"}function N(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i,o=t.view[n];if(!o.hidden){if(wo&&xo<8){var a=o.node.offsetTop+o.node.offsetHeight;i=a-r,r=a}else{var l=o.node.getBoundingClientRect();i=l.bottom-l.top}var s=o.line.height-i;if(i<2&&(i=bt(t)),(s>.001||s<-.001)&&(ti(o.line,i),W(o.line),o.rest))for(var c=0;c<o.rest.length;c++)W(o.rest[c])}}}function W(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.parentNode.offsetHeight}function E(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)r[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[a]]=o.clientWidth;return{fixedPos:S(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function z(e,t,r){function n(t){var r=t.nextSibling;return ko&&No&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var i=e.display,o=e.options.lineNumbers,a=i.lineDiv,l=a.firstChild,s=i.view,c=i.viewFrom,u=0;u<s.length;u++){var d=s[u];if(d.hidden);else if(d.node&&d.node.parentNode==a){for(;l!=d.node;)l=n(l);var h=o&&null!=t&&t<=c&&d.lineNumber;d.changes&&(zi(d.changes,"gutter")>-1&&(h=!1),P(e,d,c,r)),h&&(Ki(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(C(e.options,c)))),l=d.node.nextSibling}else{var f=q(e,d,c,r);a.insertBefore(f,l)}c+=d.size}for(;l;)l=n(l)}function P(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?F(e,t):"gutter"==o?R(e,t,r,n):"class"==o?j(t):"widget"==o&&B(e,t,n)}t.changes=null}function D(e){return e.node==e.text&&(e.node=qi("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),wo&&xo<8&&(e.node.style.zIndex=2)),e.node}function I(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=D(e);e.background=r.insertBefore(qi("div",null,t),r.firstChild)}}function H(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Fn(e,t)}function F(e,t){var r=t.text.className,n=H(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,j(t)):r&&(t.text.className=r)}function j(e){I(e),e.line.wrapClass?D(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function R(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=D(t);t.gutterBackground=qi("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var i=D(t),a=t.gutter=qi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),i.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(qi("div",C(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var l=0;l<e.options.gutters.length;++l){var s=e.options.gutters[l],c=o.hasOwnProperty(s)&&o[s];c&&a.appendChild(qi("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[s]+"px; width: "+n.gutterWidth[s]+"px"))}}}function B(e,t,r){t.alignable&&(t.alignable=null);for(var n,i=t.node.firstChild;i;i=n){var n=i.nextSibling;"CodeMirror-linewidget"==i.className&&t.node.removeChild(i)}K(e,t,r)}function q(e,t,r,n){var i=H(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),j(t),R(e,t,r,n),K(e,t,n),t.node}function K(e,t,r){if(U(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)U(e,t.rest[n],t,r,!1)}function U(e,t,r,n,i){if(t.widgets)for(var o=D(r),a=0,l=t.widgets;a<l.length;++a){var s=l[a],c=qi("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),G(s,c,r,n),e.display.input.setUneditable(c),i&&s.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),Ti(s,"redraw")}}function G(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function V(e){return Fo(e.line,e.ch)}function $(e,t){return jo(e,t)<0?t:e}function Y(e,t){return jo(e,t)<0?e:t}function X(e){e.state.focused||(e.display.input.focus(),vr(e))}function Z(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var a=e.state.pasteIncoming||"paste"==i,l=o.splitLines(t),s=null;if(a&&n.ranges.length>1)if(Ro&&Ro.text.join("\n")==t){if(n.ranges.length%Ro.text.length==0){s=[];for(var c=0;c<Ro.text.length;c++)s.push(o.splitLines(Ro.text[c]))}}else l.length==n.ranges.length&&(s=Pi(l,function(e){return[e]}));for(var c=n.ranges.length-1;c>=0;c--){var u=n.ranges[c],d=u.from(),h=u.to();u.empty()&&(r&&r>0?d=Fo(d.line,d.ch-r):e.state.overwrite&&!a?h=Fo(h.line,Math.min(Qn(o,h.line).text.length,h.ch+Ei(l).length)):Ro&&Ro.lineWise&&Ro.text.join("\n")==t&&(d=h=Fo(d.line,0)));var f=e.curOp.updateInput,p={from:d,to:h,text:s?s[c%s.length]:l,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Lr(e.doc,p),Ti(e,"inputRead",e,p)}t&&!a&&J(e,t),Hr(e),e.curOp.updateInput=f,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Q(e,t){var r=e.clipboardData&&e.clipboardData.getData("text/plain");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Ot(t,function(){Z(t,r,0,null,"paste")}),!0}function J(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){a=jr(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Qn(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=jr(e,i.head.line,"smart"));a&&Ti(e,"electricInput",e,i.head.line)}}}function ee(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:Fo(i,0),head:Fo(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function te(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function re(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Ni,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function ne(){var e=qi("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=qi("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return ko?e.style.width="1000px":e.setAttribute("wrap","off"),Ao&&(e.style.border="1px solid black"),te(e),t}function ie(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Ni,this.gracePeriod=!1}function oe(e,t){var r=Je(e,t.line);if(!r||r.hidden)return null;var n=Qn(e.doc,t.line),i=Xe(r,n,t.line),o=oi(n),a="left";if(o){var l=uo(o,t.ch);a=l%2?"right":"left"}var s=rt(i.map,t.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function ae(e,t){return t&&(e.bad=!0),e}function le(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return ae(e.clipPos(Fo(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return se(o,t,r)}}function se(e,t,r){function n(t,r,n){for(var i=-1;i<(u?u.length:0);i++)for(var o=i<0?c.map:u[i],a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==r){var s=ri(i<0?e.line:e.rest[i]),d=o[a]+n;return(n<0||l!=t)&&(d=o[a+(n?1:0)]),Fo(s,d)}}}var i=e.text.firstChild,o=!1;if(!t||!Ya(i,t))return ae(Fo(ri(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var a=e.rest?Ei(e.rest):e.line;return ae(Fo(ri(a),a.text.length),o)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,r&&(r=l.nodeValue.length));s.parentNode!=i;)s=s.parentNode;var c=e.measure,u=c.maps,d=n(l,s,r);if(d)return ae(d,o);for(var h=s.nextSibling,f=l?l.nodeValue.length-r:0;h;h=h.nextSibling){if(d=n(h,h.firstChild,0))return ae(Fo(d.line,d.ch-f),o);f+=h.textContent.length}for(var p=s.previousSibling,f=r;p;p=p.previousSibling){if(d=n(p,p.firstChild,-1))return ae(Fo(d.line,d.ch+f),o);f+=h.textContent.length}}function ce(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return""==r&&(r=t.textContent.replace(/\u200b/g,"")),void(l+=r);var u,d=t.getAttribute("cm-marker");if(d){var h=e.findMarks(Fo(n,0),Fo(i+1,0),o(+d));return void(h.length&&(u=h[0].find())&&(l+=Jn(e.doc,u.from,u.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;for(var f=0;f<t.childNodes.length;f++)a(t.childNodes[f]);/^(pre|div|p)$/i.test(t.nodeName)&&(s=!0)}else if(3==t.nodeType){var p=t.nodeValue;if(!p)return;s&&(l+=c,s=!1),l+=p}}for(var l="",s=!1,c=e.doc.lineSeparator();a(t),t!=r;)t=t.nextSibling;return l}function ue(e,t){this.ranges=e,this.primIndex=t}function de(e,t){this.anchor=e,this.head=t}function he(e,t){var r=e[t];e.sort(function(e,t){return jo(e.from(),t.from())}),t=zi(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(jo(o.to(),i.from())>=0){var a=Y(o.from(),i.from()),l=$(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;n<=t&&--t,e.splice(--n,2,new de(s?l:a,s?a:l))}}return new ue(e,t)}function fe(e,t){return new ue([new de(e,t||e)],0)}function pe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ge(e,t){if(t.line<e.first)return Fo(e.first,0);var r=e.first+e.size-1;return t.line>r?Fo(r,Qn(e,r).text.length):me(t,Qn(e,t.line).text.length)}function me(e,t){var r=e.ch;return null==r||r>t?Fo(e.line,t):r<0?Fo(e.line,0):e}function ve(e,t){return t>=e.first&&t<e.first+e.size}function ye(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=ge(e,t[n]);return r}function be(e,t,r,n){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(n){var o=jo(r,i)<0;o!=jo(n,i)<0?(i=r,r=n):o!=jo(r,n)<0&&(r=n)}return new de(i,r)}return new de(n||r,r)}function we(e,t,r,n){Le(e,new ue([be(e,e.sel.primary(),t,r)],0),n)}function xe(e,t,r){for(var n=[],i=0;i<e.sel.ranges.length;i++)n[i]=be(e,e.sel.ranges[i],t[i],null);var o=he(n,e.sel.primIndex);Le(e,o,r)}function ke(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Le(e,he(i,e.sel.primIndex),n)}function Ce(e,t,r,n){Le(e,fe(t,r),n)}function Se(e,t,r){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new de(ge(e,t[r].anchor),ge(e,t[r].head))},origin:r&&r.origin};return za(e,"beforeSelectionChange",e,n),e.cm&&za(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?he(n.ranges,n.ranges.length-1):t}function Te(e,t,r){var n=e.history.done,i=Ei(n);i&&i.ranges?(n[n.length-1]=t,Me(e,t,r)):Le(e,t,r)}function Le(e,t,r){Me(e,t,r),hi(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Me(e,t,r){(Ai(e,"beforeSelectionChange")||e.cm&&Ai(e.cm,"beforeSelectionChange"))&&(t=Se(e,t,r));var n=r&&r.bias||(jo(t.primary().head,e.sel.primary().head)<0?-1:1);_e(e,Oe(e,t,n,!0)),r&&r.scroll===!1||!e.cm||Hr(e.cm)}function _e(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,_i(e.cm)),Ti(e,"cursorActivity",e))}function Ae(e){_e(e,Oe(e,e.sel,null,!1),Ha)}function Oe(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=We(e,a.anchor,l&&l.anchor,r,n),c=We(e,a.head,l&&l.head,r,n);(i||s!=a.anchor||c!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new de(s,c))}return i?he(i,t.primIndex):t}function Ne(e,t,r,n,i){var o=Qn(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker;if((null==l.from||(s.inclusiveLeft?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(s.inclusiveRight?l.to>=t.ch:l.to>t.ch))){if(i&&(za(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(r){var c,u=s.find(n<0?1:-1);if((n<0?s.inclusiveRight:s.inclusiveLeft)&&(u=Ee(e,u,-n,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=jo(u,r))&&(n<0?c<0:c>0))return Ne(e,u,t,n,i)}var d=s.find(n<0?-1:1);return(n<0?s.inclusiveLeft:s.inclusiveRight)&&(d=Ee(e,d,n,d.line==t.line?o:null)),d?Ne(e,d,t,n,i):null}}return t}function We(e,t,r,n,i){var o=n||1,a=Ne(e,t,r,o,i)||!i&&Ne(e,t,r,o,!0)||Ne(e,t,r,-o,i)||!i&&Ne(e,t,r,-o,!0);return a?a:(e.cantEdit=!0,Fo(e.first,0))}function Ee(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?ge(e,Fo(t.line-1)):null:r>0&&t.ch==(n||Qn(e,t.line)).text.length?t.line<e.first+e.size-1?Fo(t.line+1,0):null:new Fo(t.line,t.ch+r)}function ze(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Pe(e,t){for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),a=0;a<r.sel.ranges.length;a++)if(t!==!1||a!=r.sel.primIndex){var l=r.sel.ranges[a];if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var s=l.empty();(s||e.options.showCursorWhenSelecting)&&De(e,l.head,i),s||Ie(e,l,o)}}return n}function De(e,t,r){var n=pt(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(qi("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(qi("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function Ie(e,t,r){function n(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),l.appendChild(qi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?u-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return ft(e,Fo(t,r),"div",d,n)}var l,s,d=Qn(a,t),h=d.text.length;return to(oi(d),r||0,null==i?h:i,function(e,t,a){var d,f,p,g=o(e,"left");if(e==t)d=g,f=p=g.left;else{if(d=o(t-1,"right"),"rtl"==a){var m=g;g=d,d=m}f=g.left,p=d.right}null==r&&0==e&&(f=c),d.top-g.top>3&&(n(f,g.top,null,g.bottom),f=c,g.bottom<d.top&&n(f,g.bottom,null,d.top)),null==i&&t==h&&(p=u),(!l||g.top<l.top||g.top==l.top&&g.left<l.left)&&(l=g),(!s||d.bottom>s.bottom||d.bottom==s.bottom&&d.right>s.right)&&(s=d),f<c+1&&(f=c),n(f,d.top,p-f,d.bottom)}),{start:l,end:s}}var o=e.display,a=e.doc,l=document.createDocumentFragment(),s=Ue(e.display),c=s.left,u=Math.max(o.sizerWidth,Ve(e)-o.sizer.offsetLeft)-s.right,d=t.from(),h=t.to();if(d.line==h.line)i(d.line,d.ch,h.ch);else{var f=Qn(a,d.line),p=Qn(a,h.line),g=bn(f)==bn(p),m=i(d.line,d.ch,g?f.text.length+1:null).end,v=i(h.line,g?0:null,h.ch).start;g&&(m.top<v.top-2?(n(m.right,m.top,null,m.bottom),n(c,v.top,v.left,v.bottom)):n(m.right,m.top,v.left-m.right,m.bottom)),m.bottom<v.top&&n(c,m.bottom,null,v.top)}r.appendChild(l)}function He(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Fe(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Fi(je,e))}function je(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=ca(t.mode,Be(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength,s=Pn(e,o,l?ca(t.mode,n):n,!0);o.styles=s.styles;var c=o.styleClasses,u=s.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),h=0;!d&&h<a.length;++h)d=a[h]!=o.styles[h];d&&i.push(t.frontier),o.stateAfter=l?n:ca(t.mode,n)}else o.text.length<=e.options.maxHighlightLength&&In(e,o.text,n),o.stateAfter=t.frontier%5==0?ca(t.mode,n):null;if(++t.frontier,
|
3 |
+new Date>r)return Fe(e,e.options.workDelay),!0}),i.length&&Ot(e,function(){for(var t=0;t<i.length;t++)It(e,i[t],"text")})}}function Re(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=Qn(o,l-1);if(s.stateAfter&&(!r||l<=o.frontier))return l;var c=Ra(s.text,null,e.options.tabSize);(null==i||n>c)&&(i=l-1,n=c)}return i}function Be(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=Re(e,t,r),a=o>n.first&&Qn(n,o-1).stateAfter;return a=a?ca(n.mode,a):ua(n.mode),n.iter(o,t,function(r){In(e,r.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;r.stateAfter=l?ca(n.mode,a):null,++o}),r&&(n.frontier=o),a}function qe(e){return e.lineSpace.offsetTop}function Ke(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ue(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Ui(e.measure,qi("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Ge(e){return Da-e.display.nativeBarWidth}function Ve(e){return e.display.scroller.clientWidth-Ge(e)-e.display.barWidth}function $e(e){return e.display.scroller.clientHeight-Ge(e)-e.display.barHeight}function Ye(e,t,r){var n=e.options.lineWrapping,i=n&&Ve(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],c=a[l+1];Math.abs(s.bottom-c.bottom)>2&&o.push((s.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Xe(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var n=0;n<e.rest.length;n++)if(ri(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Ze(e,t){t=bn(t);var r=ri(t),n=e.display.externalMeasured=new zt(e.doc,t,r);n.lineN=r;var i=n.built=Fn(e,n);return n.text=i.pre,Ui(e.display.lineMeasure,i.pre),n}function Qe(e,t,r,n){return tt(e,et(e,t),r,n)}function Je(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ft(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function et(e,t){var r=ri(t),n=Je(e,r);n&&!n.text?n=null:n&&n.changes&&(P(e,n,r,E(e)),e.curOp.forceUpdate=!0),n||(n=Ze(e,t));var i=Xe(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function tt(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ye(e,t.view,t.rect),t.hasHeights=!0),o=it(e,t,r,n),o.bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function rt(e,t,r){for(var n,i,o,a,l=0;l<e.length;l+=3){var s=e[l],c=e[l+1];if(t<s?(i=0,o=1,a="left"):t<c?(i=t-s,o=i+1):(l==e.length-3||t==c&&e[l+3]>t)&&(o=c-s,i=o-1,t>=c&&(a="right")),null!=i){if(n=e[l+2],s==c&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;l&&e[l-2]==e[l-3]&&e[l-1].insertLeft;)n=e[(l-=3)+2],a="left";if("right"==r&&i==c-s)for(;l<e.length-3&&e[l+3]==e[l+4]&&!e[l+5].insertLeft;)n=e[(l+=3)+2],a="right";break}}return{node:n,start:i,end:o,collapse:a,coverStart:s,coverEnd:c}}function nt(e,t){var r=Uo;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var n=e.length-1;n>=0&&(r=e[n]).left==r.right;n--);return r}function it(e,t,r,n){var i,o=rt(t.map,r,n),a=o.node,l=o.start,s=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;u<4;u++){for(;l&&Bi(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+s<o.coverEnd&&Bi(t.line.text.charAt(o.coverStart+s));)++s;if(i=wo&&xo<9&&0==l&&s==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():nt(Ua(a,l,s).getClientRects(),n),i.left||i.right||0==l)break;s=l,l-=1,c="right"}wo&&xo<11&&(i=ot(e.display.measure,i))}else{l>0&&(c=n="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(wo&&xo<9&&!l&&(!i||!i.left&&!i.right)){var h=a.parentNode.getClientRects()[0];i=h?{left:h.left,right:h.left+wt(e.display),top:h.top,bottom:h.bottom}:Uo}for(var f=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(f+p)/2,m=t.view.measure.heights,u=0;u<m.length-1&&!(g<m[u]);u++);var v=u?m[u-1]:0,y=m[u],b={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:v,bottom:y};return i.left||i.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=f,b.rbottom=p),b}function ot(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!eo(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function at(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function lt(e){e.display.externalMeasure=null,Ki(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)at(e.display.view[t])}function st(e){lt(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ct(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ut(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function dt(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=Ln(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=ii(t);if("local"==n?a+=qe(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:ut());var s=l.left+("window"==n?0:ct());r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function ht(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=ct(),i-=ut();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function ft(e,t,r,n,i){return n||(n=Qn(e.doc,t.line)),dt(e,n,Qe(e,n,t.ch,i),r)}function pt(e,t,r,n,i,o){function a(t,a){var l=tt(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,dt(e,n,l,r)}function l(e,t){var r=s[t],n=r.level%2;return e==ro(r)&&t&&r.level<s[t-1].level?(r=s[--t],e=no(r)-(r.level%2?0:1),n=!0):e==no(r)&&t<s.length-1&&r.level<s[t+1].level&&(r=s[++t],e=ro(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?a(e-1):a(e,n)}n=n||Qn(e.doc,t.line),i||(i=et(e,n));var s=oi(n),c=t.ch;if(!s)return a(c);var u=uo(s,c),d=l(c,u);return null!=ll&&(d.other=l(c,ll)),d}function gt(e,t){var r=0,t=ge(e.doc,t);e.options.lineWrapping||(r=wt(e.display)*t.ch);var n=Qn(e.doc,t.line),i=ii(n)+qe(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function mt(e,t,r,n){var i=Fo(e,t);return i.xRel=n,r&&(i.outside=!0),i}function vt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return mt(n.first,0,!0,-1);var i=ni(n,r),o=n.first+n.size-1;if(i>o)return mt(n.first+n.size-1,Qn(n,o).text.length,!0,1);t<0&&(t=0);for(var a=Qn(n,i);;){var l=yt(e,a,i,t,r),s=vn(a),c=s&&s.find(0,!0);if(!s||!(l.ch>c.from.ch||l.ch==c.from.ch&&l.xRel>0))return l;i=ri(a=c.to.line)}}function yt(e,t,r,n,i){function o(n){var i=pt(e,Fo(r,n),"line",t,c);return l=!0,a>i.bottom?i.left-s:a<i.top?i.left+s:(l=!1,i.left)}var a=i-ii(t),l=!1,s=2*e.display.wrapper.clientWidth,c=et(e,t),u=oi(t),d=t.text.length,h=io(t),f=oo(t),p=o(h),g=l,m=o(f),v=l;if(n>m)return mt(r,f,v,1);for(;;){if(u?f==h||f==fo(t,h,1):f-h<=1){var y=n<p||n-p<=m-n?h:f,b=y==h?g:v,w=n-(y==h?p:m);if(v&&!u&&!/\s/.test(t.text.charAt(y))&&w>0&&y<t.text.length&&c.view.measure.heights.length>1){var x=tt(e,c,y,"right");a<=x.bottom&&a>=x.top&&Math.abs(n-x.right)<w&&(b=!1,y++,w=n-x.right)}for(;Bi(t.text.charAt(y));)++y;var k=mt(r,y,b,w<-1?-1:w>1?1:0);return k}var C=Math.ceil(d/2),S=h+C;if(u){S=h;for(var T=0;T<C;++T)S=fo(t,S,1)}var L=o(S);L>n?(f=S,m=L,(v=l)&&(m+=1e3),d=C):(h=S,p=L,g=l,d-=C)}}function bt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Bo){Bo=qi("pre");for(var t=0;t<49;++t)Bo.appendChild(document.createTextNode("x")),Bo.appendChild(qi("br"));Bo.appendChild(document.createTextNode("x"))}Ui(e.measure,Bo);var r=Bo.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),Ki(e.measure),r||1}function wt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=qi("span","xxxxxxxxxx"),r=qi("pre",[t]);Ui(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function xt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Vo},Go?Go.ops.push(e.curOp):e.curOp.ownsGroup=Go={ops:[e.curOp],delayedCallbacks:[]}}function kt(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}function Ct(e){var t=e.curOp,r=t.ownsGroup;if(r)try{kt(r)}finally{Go=null;for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;St(r)}}function St(e){for(var t=e.ops,r=0;r<t.length;r++)Tt(t[r]);for(var r=0;r<t.length;r++)Lt(t[r]);for(var r=0;r<t.length;r++)Mt(t[r]);for(var r=0;r<t.length;r++)_t(t[r]);for(var r=0;r<t.length;r++)At(t[r])}function Tt(e){var t=e.cm,r=t.display;L(t),e.updateMaxLine&&h(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new T(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Lt(e){e.updatedDisplay=e.mustUpdate&&M(e.cm,e.update)}function Mt(e){var t=e.cm,r=t.display;e.updatedDisplay&&N(t),e.barMeasure=p(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Qe(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Ge(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ve(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection(e.focus))}function _t(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&or(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==Gi()&&(!document.hasFocus||document.hasFocus());e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.updatedDisplay&&O(t,e.barMeasure),e.selectionChanged&&He(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&X(e.cm)}function At(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&_(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null==e.scrollTop||r.scroller.scrollTop==e.scrollTop&&!e.forceScroll||(n.scrollTop=Math.max(0,Math.min(r.scroller.scrollHeight-r.scroller.clientHeight,e.scrollTop)),r.scrollbars.setScrollTop(n.scrollTop),r.scroller.scrollTop=n.scrollTop),null==e.scrollLeft||r.scroller.scrollLeft==e.scrollLeft&&!e.forceScroll||(n.scrollLeft=Math.max(0,Math.min(r.scroller.scrollWidth-r.scroller.clientWidth,e.scrollLeft)),r.scrollbars.setScrollLeft(n.scrollLeft),r.scroller.scrollLeft=n.scrollLeft,x(t)),e.scrollToPos){var i=zr(t,ge(n,e.scrollToPos.from),ge(n,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&Er(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var l=0;l<o.length;++l)o[l].lines.length||za(o[l],"hide");if(a)for(var l=0;l<a.length;++l)a[l].lines.length&&za(a[l],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&za(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ot(e,t){if(e.curOp)return t();xt(e);try{return t()}finally{Ct(e)}}function Nt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);xt(e);try{return t.apply(e,arguments)}finally{Ct(e)}}}function Wt(e){return function(){if(this.curOp)return e.apply(this,arguments);xt(this);try{return e.apply(this,arguments)}finally{Ct(this)}}}function Et(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);xt(t);try{return e.apply(this,arguments)}finally{Ct(t)}}}function zt(e,t,r){this.line=t,this.rest=wn(t),this.size=this.rest?ri(Ei(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Cn(e,t)}function Pt(e,t,r){for(var n,i=[],o=t;o<r;o=n){var a=new zt(e.doc,Qn(e.doc,o),o);n=o+a.size,i.push(a)}return i}function Dt(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ho&&xn(e.doc,t)<i.viewTo&&Ht(e);else if(r<=i.viewFrom)Ho&&kn(e.doc,r+n)>i.viewFrom?Ht(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Ht(e);else if(t<=i.viewFrom){var o=jt(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):Ht(e)}else if(r>=i.viewTo){var o=jt(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):Ht(e)}else{var a=jt(e,t,t,-1),l=jt(e,r,r+n,1);a&&l?(i.view=i.view.slice(0,a.index).concat(Pt(e,a.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=n):Ht(e)}var s=i.externalMeasured;s&&(r<s.lineN?s.lineN+=n:t<s.lineN+s.size&&(i.externalMeasured=null))}function It(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[Ft(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);zi(a,r)==-1&&a.push(r)}}}function Ht(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ft(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,t<0)return n}function jt(e,t,r,n){var i,o=Ft(e,t),a=e.display.view;if(!Ho||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var l=0,s=e.display.viewFrom;l<o;l++)s+=a[l].size;if(s!=t){if(n>0){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;xn(e.doc,r)!=r;){if(o==(n<0?0:a.length-1))return null;r+=n*a[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function Rt(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Pt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Pt(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Ft(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(Pt(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,Ft(e,r)))),n.viewTo=r}function Bt(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function qt(e){function t(){i.activeTouch&&(o=setTimeout(function(){i.activeTouch=null},1e3),a=i.activeTouch,a.end=+new Date)}function r(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function n(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}var i=e.display;Na(i.scroller,"mousedown",Nt(e,$t)),wo&&xo<11?Na(i.scroller,"dblclick",Nt(e,function(t){if(!Mi(e,t)){var r=Vt(e,t);if(r&&!Jt(e,t)&&!Gt(e.display,t)){_a(t);var n=e.findWordAt(r);we(e.doc,n.anchor,n.head)}}})):Na(i.scroller,"dblclick",function(t){Mi(e,t)||_a(t)}),Do||Na(i.scroller,"contextmenu",function(t){br(e,t)});var o,a={end:0};Na(i.scroller,"touchstart",function(t){if(!Mi(e,t)&&!r(t)){clearTimeout(o);var n=+new Date;i.activeTouch={start:n,moved:!1,prev:n-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),Na(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Na(i.scroller,"touchend",function(r){var o=i.activeTouch;if(o&&!Gt(i,r)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,l=e.coordsChar(i.activeTouch,"page");a=!o.prev||n(o,o.prev)?new de(l,l):!o.prev.prev||n(o,o.prev.prev)?e.findWordAt(l):new de(Fo(l.line,0),ge(e.doc,Fo(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),_a(r)}t()}),Na(i.scroller,"touchcancel",t),Na(i.scroller,"scroll",function(){i.scroller.clientHeight&&(ir(e,i.scroller.scrollTop),or(e,i.scroller.scrollLeft,!0),za(e,"scroll",e))}),Na(i.scroller,"mousewheel",function(t){ar(e,t)}),Na(i.scroller,"DOMMouseScroll",function(t){ar(e,t)}),Na(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Mi(e,t)||Oa(t)},over:function(t){Mi(e,t)||(rr(e,t),Oa(t))},start:function(t){tr(e,t)},drop:Nt(e,er),leave:function(t){Mi(e,t)||nr(e)}};var l=i.input.getField();Na(l,"keyup",function(t){pr.call(e,t)}),Na(l,"keydown",Nt(e,hr)),Na(l,"keypress",Nt(e,gr)),Na(l,"focus",Fi(vr,e)),Na(l,"blur",Fi(yr,e))}function Kt(t,r,n){var i=n&&n!=e.Init;if(!r!=!i){var o=t.display.dragFunctions,a=r?Na:Ea;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.enter),a(t.display.scroller,"dragover",o.over),a(t.display.scroller,"dragleave",o.leave),a(t.display.scroller,"drop",o.drop)}}function Ut(e){var t=e.display;t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth||(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Gt(e,t){for(var r=ki(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Vt(e,t,r,n){var i=e.display;if(!r&&"true"==ki(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,c=vt(e,o,a);if(n&&1==c.xRel&&(s=Qn(e.doc,c.line).text).length==c.ch){var u=Ra(s,s.length,e.options.tabSize)-s.length;c=Fo(c.line,Math.max(0,Math.round((o-Ue(e.display).left)/wt(e.display))-u))}return c}function $t(e){var t=this,r=t.display;if(!(Mi(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.shift=e.shiftKey,Gt(r,e))return void(ko||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!Jt(t,e)){var n=Vt(t,e);switch(window.focus(),Ci(e)){case 1:t.state.selectingText?t.state.selectingText(e):n?Yt(t,e,n):ki(e)==r.scroller&&_a(e);break;case 2:ko&&(t.state.lastMiddleDown=+new Date),n&&we(t.doc,n),setTimeout(function(){r.input.focus()},20),_a(e);break;case 3:Do?br(t,e):mr(t)}}}}function Yt(e,t,r){wo?setTimeout(Fi(X,e),0):e.curOp.focus=Gi();var n,i=+new Date;Ko&&Ko.time>i-400&&0==jo(Ko.pos,r)?n="triple":qo&&qo.time>i-400&&0==jo(qo.pos,r)?(n="double",Ko={time:i,pos:r}):(n="single",qo={time:i,pos:r});var o,a=e.doc.sel,l=No?t.metaKey:t.ctrlKey;e.options.dragDrop&&tl&&!e.isReadOnly()&&"single"==n&&(o=a.contains(r))>-1&&(jo((o=a.ranges[o]).from(),r)<0||r.xRel>0)&&(jo(o.to(),r)>0||r.xRel<0)?Xt(e,t,r,l):Zt(e,t,r,n,l)}function Xt(e,t,r,n){var i=e.display,o=+new Date,a=Nt(e,function(l){ko&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ea(document,"mouseup",a),Ea(i.scroller,"drop",a),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(_a(l),!n&&+new Date-200<o&&we(e.doc,r),ko||wo&&9==xo?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())});ko&&(i.scroller.draggable=!0),e.state.draggingText=a,a.copy=No?t.altKey:t.ctrlKey,i.scroller.dragDrop&&i.scroller.dragDrop(),Na(document,"mouseup",a),Na(i.scroller,"drop",a)}function Zt(e,t,r,n,i){function o(t){if(0!=jo(m,t))if(m=t,"rect"==n){for(var i=[],o=e.options.tabSize,a=Ra(Qn(c,r.line).text,r.ch,o),l=Ra(Qn(c,t.line).text,t.ch,o),s=Math.min(a,l),f=Math.max(a,l),p=Math.min(r.line,t.line),g=Math.min(e.lastLine(),Math.max(r.line,t.line));p<=g;p++){var v=Qn(c,p).text,y=Ba(v,s,o);s==f?i.push(new de(Fo(p,y),Fo(p,y))):v.length>y&&i.push(new de(Fo(p,y),Fo(p,Ba(v,f,o))))}i.length||i.push(new de(r,r)),Le(c,he(h.ranges.slice(0,d).concat(i),d),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,w=b.anchor,x=t;if("single"!=n){if("double"==n)var k=e.findWordAt(t);else var k=new de(Fo(t.line,0),ge(c,Fo(t.line+1,0)));jo(k.anchor,w)>0?(x=k.head,w=Y(b.from(),k.anchor)):(x=k.anchor,w=$(b.to(),k.head))}var i=h.ranges.slice(0);i[d]=new de(ge(c,w),x),Le(c,he(i,d),Fa)}}function a(t){var r=++y,i=Vt(e,t,!0,"rect"==n);if(i)if(0!=jo(i,m)){e.curOp.focus=Gi(),o(i);var l=w(s,c);(i.line>=l.to||i.line<l.from)&&setTimeout(Nt(e,function(){y==r&&a(t)}),150)}else{var u=t.clientY<v.top?-20:t.clientY>v.bottom?20:0;u&&setTimeout(Nt(e,function(){y==r&&(s.scroller.scrollTop+=u,a(t))}),50)}}function l(t){e.state.selectingText=!1,y=1/0,_a(t),s.input.focus(),Ea(document,"mousemove",b),Ea(document,"mouseup",x),c.history.lastSelOrigin=null}var s=e.display,c=e.doc;_a(t);var u,d,h=c.sel,f=h.ranges;if(i&&!t.shiftKey?(d=c.sel.contains(r),u=d>-1?f[d]:new de(r,r)):(u=c.sel.primary(),d=c.sel.primIndex),Wo?t.shiftKey&&t.metaKey:t.altKey)n="rect",i||(u=new de(r,r)),r=Vt(e,t,!0,!0),d=-1;else if("double"==n){var p=e.findWordAt(r);u=e.display.shift||c.extend?be(c,u,p.anchor,p.head):p}else if("triple"==n){var g=new de(Fo(r.line,0),ge(c,Fo(r.line+1,0)));u=e.display.shift||c.extend?be(c,u,g.anchor,g.head):g}else u=be(c,u,r);i?d==-1?(d=f.length,Le(c,he(f.concat([u]),d),{scroll:!1,origin:"*mouse"})):f.length>1&&f[d].empty()&&"single"==n&&!t.shiftKey?(Le(c,he(f.slice(0,d).concat(f.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),h=c.sel):ke(c,d,u,Fa):(d=0,Le(c,new ue([u],0),Fa),h=c.sel);var m=r,v=s.wrapper.getBoundingClientRect(),y=0,b=Nt(e,function(e){Ci(e)?a(e):l(e)}),x=Nt(e,l);e.state.selectingText=x,Na(document,"mousemove",b),Na(document,"mouseup",x)}function Qt(e,t,r,n){try{var i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&_a(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!Ai(e,r))return xi(t);o-=l.top-a.viewOffset;for(var s=0;s<e.options.gutters.length;++s){var c=a.gutters.childNodes[s];if(c&&c.getBoundingClientRect().right>=i){var u=ni(e.doc,o),d=e.options.gutters[s];return za(e,r,e,u,d,t),xi(t)}}}function Jt(e,t){return Qt(e,t,"gutterClick",!0)}function er(e){var t=this;if(nr(t),!Mi(t,e)&&!Gt(t.display,e)){_a(e),wo&&($o=+new Date);var r=Vt(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,l=function(e,n){if(!t.options.allowDropFileTypes||zi(t.options.allowDropFileTypes,e.type)!=-1){var l=new FileReader;l.onload=Nt(t,function(){var e=l.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++a==i){r=ge(t.doc,r);var s={from:r,to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Lr(t.doc,s),Te(t.doc,fe(r,ea(s)))}}),l.readAsText(e)}},s=0;s<i;++s)l(n[s],s);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!t.state.draggingText.copy)var c=t.listSelections();if(Me(t.doc,fe(r,r)),c)for(var s=0;s<c.length;++s)Wr(t.doc,"",c[s].anchor,c[s].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}}function tr(e,t){if(wo&&(!e.state.draggingText||+new Date-$o<100))return void Oa(t);if(!Mi(e,t)&&!Gt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!Lo)){var r=qi("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",To&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),To&&r.parentNode.removeChild(r)}}function rr(e,t){var r=Vt(e,t);if(r){var n=document.createDocumentFragment();De(e,r,n),e.display.dragCursor||(e.display.dragCursor=qi("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Ui(e.display.dragCursor,n)}}function nr(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ir(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,vo||A(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),vo&&A(e),Fe(e,100))}function or(e,t,r){(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,x(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function ar(e,t){var r=Zo(t),n=r.x,i=r.y,o=e.display,a=o.scroller,l=a.scrollWidth>a.clientWidth,s=a.scrollHeight>a.clientHeight;if(n&&l||i&&s){if(i&&No&&ko)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var d=0;d<u.length;d++)if(u[d].node==c){e.display.currentWheelTarget=c;break e}if(n&&!vo&&!To&&null!=Xo)return i&&s&&ir(e,Math.max(0,Math.min(a.scrollTop+i*Xo,a.scrollHeight-a.clientHeight))),or(e,Math.max(0,Math.min(a.scrollLeft+n*Xo,a.scrollWidth-a.clientWidth))),(!i||i&&s)&&_a(t),void(o.wheelStartX=null);if(i&&null!=Xo){var h=i*Xo,f=e.doc.scrollTop,p=f+o.wrapper.clientHeight;h<0?f=Math.max(0,f+h-50):p=Math.min(e.doc.height,p+h+50),A(e,{top:f,bottom:p})}Yo<20&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(Xo=(Xo*Yo+r)/(Yo+1),++Yo)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function lr(e,t,r){if("string"==typeof t&&(t=da[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=Ia}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function sr(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=fa(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&fa(t,e.options.extraKeys,r,e)||fa(t,e.options.keyMap,r,e)}function cr(e,t,r,n){var i=e.state.keySeq;if(i){if(pa(t))return"handled";Qo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var o=sr(e,t,n);return"multi"==o&&(e.state.keySeq=t),"handled"==o&&Ti(e,"keyHandled",e,t,r),"handled"!=o&&"multi"!=o||(_a(r),He(e)),i&&!o&&/\'$/.test(t)?(_a(r),!0):!!o}function ur(e,t){var r=ga(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?cr(e,"Shift-"+r,t,function(t){return lr(e,t,!0)})||cr(e,r,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return lr(e,t)}):cr(e,r,t,function(t){return lr(e,t)}))}function dr(e,t,r){return cr(e,"'"+r+"'",t,function(t){return lr(e,t,!0)})}function hr(e){var t=this;if(t.curOp.focus=Gi(),!Mi(t,e)){wo&&xo<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=ur(t,e);To&&(Jo=n?r:null,!n&&88==r&&!il&&(No?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||fr(t)}}function fr(e){function t(e){18!=e.keyCode&&e.altKey||(Qa(r,"CodeMirror-crosshair"),Ea(document,"keyup",t),Ea(document,"mouseover",t))}var r=e.display.lineDiv;Ja(r,"CodeMirror-crosshair"),Na(document,"keyup",t),Na(document,"mouseover",t)}function pr(e){16==e.keyCode&&(this.doc.sel.shift=!1),Mi(this,e)}function gr(e){var t=this;if(!(Gt(t.display,e)||Mi(t,e)||e.ctrlKey&&!e.altKey||No&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(To&&r==Jo)return Jo=null,void _a(e);if(!To||e.which&&!(e.which<10)||!ur(t,e)){var i=String.fromCharCode(null==n?r:n);dr(t,e,i)||t.display.input.onKeyPress(e)}}}function mr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,yr(e))},100)}function vr(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(za(e,"focus",e),e.state.focused=!0,Ja(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),ko&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),He(e))}function yr(e){e.state.delayingBlurEvent||(e.state.focused&&(za(e,"blur",e),e.state.focused=!1,Qa(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function br(e,t){Gt(e.display,t)||wr(e,t)||Mi(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function wr(e,t){return!!Ai(e,"gutterContextMenu")&&Qt(e,t,"gutterContextMenu",!1)}function xr(e,t){if(jo(e,t.from)<0)return e;if(jo(e,t.to)<=0)return ea(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=ea(t).ch-t.to.ch),Fo(r,n)}function kr(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new de(xr(i.anchor,t),xr(i.head,t)))}return he(r,e.sel.primIndex)}function Cr(e,t,r){return e.line==t.line?Fo(r.line,e.ch-t.ch+r.ch):Fo(r.line+(e.line-t.line),e.ch)}function Sr(e,t,r){for(var n=[],i=Fo(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=Cr(l.from,i,o),c=Cr(ea(l),i,o);if(i=l.to,o=c,"around"==r){var u=e.sel.ranges[a],d=jo(u.head,u.anchor)<0;n[a]=new de(d?c:s,d?s:c)}else n[a]=new de(s,s)}return new ue(n,e.sel.primIndex)}function Tr(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(t,r,n,i){t&&(this.from=ge(e,t)),r&&(this.to=ge(e,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),za(e,"beforeChange",e,n),e.cm&&za(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Lr(e,t,r){if(e.cm){if(!e.cm.curOp)return Nt(e.cm,Lr)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(Ai(e,"beforeChange")||e.cm&&Ai(e.cm,"beforeChange"))||(t=Tr(e,t,!0))){var n=Io&&!r&&cn(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)Mr(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else Mr(e,t)}}function Mr(e,t){if(1!=t.text.length||""!=t.text[0]||0!=jo(t.from,t.to)){var r=kr(e,t);ui(e,t,r,e.cm?e.cm.curOp.id:NaN),Or(e,t,r,an(e,t));var n=[];Xn(e,function(e,r){r||zi(n,e.history)!=-1||(wi(e.history,t),n.push(e.history)),Or(e,t,null,an(e,t))})}}function _r(e,t,r){if(!e.cm||!e.cm.state.suppressEdits||r){for(var n,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,l="undo"==t?i.undone:i.done,s=0;s<a.length&&(n=a[s],r?!n.ranges||n.equals(e.sel):n.ranges);s++);if(s!=a.length){for(i.lastOrigin=i.lastSelOrigin=null;n=a.pop(),n.ranges;){if(fi(n,l),r&&!n.equals(e.sel))return void Le(e,n,{clearRedo:!1});o=n}var c=[];fi(o,l),l.push({changes:c,generation:i.generation}),i.generation=n.generation||++i.maxGeneration;for(var u=Ai(e,"beforeChange")||e.cm&&Ai(e.cm,"beforeChange"),s=n.changes.length-1;s>=0;--s){var d=n.changes[s];if(d.origin=t,u&&!Tr(e,d,!1))return void(a.length=0);c.push(li(e,d));var h=s?kr(e,d):Ei(a);Or(e,d,h,sn(e,d)),!s&&e.cm&&e.cm.scrollIntoView({from:d.from,to:ea(d)});var f=[];Xn(e,function(e,t){t||zi(f,e.history)!=-1||(wi(e.history,d),f.push(e.history)),Or(e,d,null,sn(e,d))})}}}}function Ar(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(Pi(e.sel.ranges,function(e){return new de(Fo(e.anchor.line+t,e.anchor.ch),Fo(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Dt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)It(e.cm,n,"gutter")}}function Or(e,t,r,n){if(e.cm&&!e.cm.curOp)return Nt(e.cm,Or)(e,t,r,n);if(t.to.line<e.first)return void Ar(e,t.text.length-1-(t.to.line-t.from.line));
|
4 |
if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Ar(e,i),t={from:Fo(e.first,0),to:Fo(t.to.line+i,t.to.ch),text:[Ei(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:Fo(o,Qn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Jn(e,t.from,t.to),r||(r=kr(e,t)),e.cm?Nr(e.cm,t,n):Vn(e,t,n),Me(e,r,Ha)}}function Nr(e,t,r){var n=e.doc,i=e.display,a=t.from,l=t.to,s=!1,c=a.line;e.options.lineWrapping||(c=ri(bn(Qn(n,a.line))),n.iter(c,l.line+1,function(e){if(e==i.maxLine)return s=!0,!0})),n.sel.contains(t.from,t.to)>-1&&_i(e),Vn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(c,a.line+t.text.length,function(e){var t=d(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,a.line),Fe(e,400);var u=t.text.length-(l.line-a.line)-1;t.full?Dt(e):a.line!=l.line||1!=t.text.length||Gn(e.doc,t)?Dt(e,a.line,l.line+1,u):It(e,a.line,"text");var h=Ai(e,"changes"),f=Ai(e,"change");if(f||h){var p={from:a,to:l,text:t.text,removed:t.removed,origin:t.origin};f&&Ti(e,"change",e,p),h&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function Wr(e,t,r,n,i){if(n||(n=r),jo(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=e.splitLines(t)),Lr(e,{from:r,to:n,text:t,origin:i})}function Er(e,t){if(!Mi(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!_o){var o=qi("div","",null,"position: absolute; top: "+(t.top-r.viewOffset-qe(e.display))+"px; height: "+(t.bottom-t.top+Ge(e)+r.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function zr(e,t,r,n){null==n&&(n=0);for(var i=0;i<5;i++){var o=!1,a=pt(e,t),l=r&&r!=t?pt(e,r):a,s=Dr(e,Math.min(a.left,l.left),Math.min(a.top,l.top)-n,Math.max(a.left,l.left),Math.max(a.bottom,l.bottom)+n),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=s.scrollTop&&(ir(e,s.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=s.scrollLeft&&(or(e,s.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function Pr(e,t,r,n,i){var o=Dr(e,t,r,n,i);null!=o.scrollTop&&ir(e,o.scrollTop),null!=o.scrollLeft&&or(e,o.scrollLeft)}function Dr(e,t,r,n,i){var o=e.display,a=bt(e.display);r<0&&(r=0);var l=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,s=$e(e),c={};i-r>s&&(i=r+s);var u=e.doc.height+Ke(o),d=r<a,h=i>u-a;if(r<l)c.scrollTop=d?0:r;else if(i>l+s){var f=Math.min(r,(h?u:i)-s);f!=l&&(c.scrollTop=f)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,g=Ve(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),m=n-t>g;return m&&(n=t+g),t<10?c.scrollLeft=0:t<p?c.scrollLeft=Math.max(0,t-(m?0:10)):n>g+p-3&&(c.scrollLeft=n+(m?0:10)-g),c}function Ir(e,t,r){null==t&&null==r||Fr(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function Hr(e){Fr(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?Fo(t.line,t.ch-1):t,n=Fo(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function Fr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=gt(e,t.from),n=gt(e,t.to),i=Dr(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function jr(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Be(e,t):r="prev");var a=e.options.tabSize,l=Qn(o,t),s=Ra(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(n||/\S/.test(l.text)){if("smart"==r&&(c=o.mode.indent(i,l.text.slice(u.length),l.text),c==Ia||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?Ra(Qn(o,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var d="",h=0;if(e.options.indentWithTabs)for(var f=Math.floor(c/a);f;--f)h+=a,d+="\t";if(h<c&&(d+=Wi(c-h)),d!=u)return Wr(o,d,Fo(t,0),Fo(t,u.length),"+input"),l.stateAfter=null,!0;for(var f=0;f<o.sel.ranges.length;f++){var p=o.sel.ranges[f];if(p.head.line==t&&p.head.ch<u.length){var h=Fo(t,u.length);ke(o,f,new de(h,h));break}}}function Rr(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=Qn(e,pe(e,t)):i=ri(t),null==i?null:(n(o,i)&&e.cm&&It(e.cm,i,r),o)}function Br(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&jo(o.from,Ei(n).to)<=0;){var a=n.pop();if(jo(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}Ot(e,function(){for(var t=n.length-1;t>=0;t--)Wr(e.doc,"",n[t].from,n[t].to,"+delete");Hr(e)})}function qr(e,t,r,n,i){function o(){var t=l+r;return!(t<e.first||t>=e.first+e.size)&&(l=t,u=Qn(e,t))}function a(e){var t=(i?fo:po)(u,s,r,!0);if(null==t){if(e||!o())return!1;s=i?(r<0?oo:io)(u):r<0?u.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,c=r,u=Qn(e,l);if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var d=null,h="group"==n,f=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;!(r<0)||a(!p);p=!1){var g=u.text.charAt(s)||"\n",m=ji(g,f)?"w":h&&"\n"==g?"n":!h||/\s/.test(g)?null:"p";if(!h||p||m||(m="s"),d&&d!=m){r<0&&(r=1,a());break}if(m&&(d=m),r>0&&!a(!p))break}var v=We(e,Fo(l,s),t,c,!0);return jo(t,v)||(v.hitSide=!0),v}function Kr(e,t,r,n){var i,o=e.doc,a=t.left;if("page"==n){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(l-(r<0?1.5:.5)*bt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var s=vt(e,a,i);if(!s.outside)break;if(r<0?i<=0:i>=o.height){s.hitSide=!0;break}i+=5*r}return s}function Ur(t,r,n,i){e.defaults[t]=r,n&&(ra[t]=i?function(e,t,r){r!=na&&n(e,t,r)}:n)}function Gr(e){for(var t,r,n,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else{if(!/^s(hift)$/i.test(l))throw new Error("Unrecognized modifier name: "+l);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Vr(e){return"string"==typeof e?ha[e]:e}function $r(e,t,r,n,i){if(n&&n.shared)return Yr(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Nt(e.cm,$r)(e,t,r,n,i);var o=new ya(e,i),a=jo(t,r);if(n&&Hi(n,o,!1),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=qi("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(yn(e,t.line,t,r,o)||t.line!=r.line&&yn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ho=!0}o.addToHistory&&ui(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var l,s=t.line,c=e.cm;if(e.iter(s,r.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&bn(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&ti(e,0),rn(e,new Jr(o,s==t.line?t.ch:null,s==r.line?r.ch:null)),++s}),o.collapsed&&e.iter(t.line,r.line+1,function(t){Cn(e,t)&&ti(t,0)}),o.clearOnEnter&&Na(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Io=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++va,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)Dt(c,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=r.line;u++)It(c,u,"text");o.atomic&&Ae(c.doc),Ti(c,"markerAdded",c,o)}return o}function Yr(e,t,r,n,i){n=Hi(n),n.shared=!1;var o=[$r(e,t,r,n,i)],a=o[0],l=n.widgetNode;return Xn(e,function(e){l&&(n.widgetNode=l.cloneNode(!0)),o.push($r(e,ge(e,t),ge(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=Ei(o)}),new ba(o,a)}function Xr(e){return e.findMarks(Fo(e.first,0),e.clipPos(Fo(e.lastLine())),function(e){return e.parent})}function Zr(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(jo(o,a)){var l=$r(e,o,a,n.primary,n.primary.type);n.markers.push(l),l.parent=n}}}function Qr(e){for(var t=0;t<e.length;t++){var r=e[t],n=[r.primary.doc];Xn(r.primary.doc,function(e){n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];zi(n,o.doc)==-1&&(o.parent=null,r.markers.splice(i--,1))}}}function Jr(e,t,r){this.marker=e,this.from=t,this.to=r}function en(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function tn(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function rn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function nn(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Jr(a,o.from,s?null:o.to))}}return n}function on(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Jr(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}function an(e,t){if(t.full)return null;var r=ve(e,t.from.line)&&Qn(e,t.from.line).markedSpans,n=ve(e,t.to.line)&&Qn(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==jo(t.from,t.to),l=nn(r,i,a),s=on(n,o,a),c=1==t.text.length,u=Ei(t.text).length+(c?i:0);if(l)for(var d=0;d<l.length;++d){var h=l[d];if(null==h.to){var f=en(s,h.marker);f?c&&(h.to=null==f.to?null:f.to+u):h.to=i}}if(s)for(var d=0;d<s.length;++d){var h=s[d];if(null!=h.to&&(h.to+=u),null==h.from){var f=en(l,h.marker);f||(h.from=u,c&&(l||(l=[])).push(h))}else h.from+=u,c&&(l||(l=[])).push(h)}l&&(l=ln(l)),s&&s!=l&&(s=ln(s));var p=[l];if(!c){var g,m=t.text.length-2;if(m>0&&l)for(var d=0;d<l.length;++d)null==l[d].to&&(g||(g=[])).push(new Jr(l[d].marker,null,null));for(var d=0;d<m;++d)p.push(g);p.push(s)}return p}function ln(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function sn(e,t){var r=mi(e,t),n=an(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function cn(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&zi(n,r)!=-1||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var c=i[s];if(!(jo(c.to,l.from)<0||jo(c.from,l.to)>0)){var u=[s,1],d=jo(c.from,l.from),h=jo(c.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(h>0||!a.inclusiveRight&&!h)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-1}}return i}function un(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function dn(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function hn(e){return e.inclusiveLeft?-1:0}function fn(e){return e.inclusiveRight?1:0}function pn(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=jo(n.from,i.from)||hn(e)-hn(t);if(o)return-o;var a=jo(n.to,i.to)||fn(e)-fn(t);return a?a:t.id-e.id}function gn(e,t){var r,n=Ho&&e.markedSpans;if(n)for(var i,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!r||pn(r,i.marker)<0)&&(r=i.marker);return r}function mn(e){return gn(e,!0)}function vn(e){return gn(e,!1)}function yn(e,t,r,n,i){var o=Qn(e,t),a=Ho&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var c=s.marker.find(0),u=jo(c.from,r)||hn(s.marker)-hn(i),d=jo(c.to,n)||fn(s.marker)-fn(i);if(!(u>=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?jo(c.to,r)>=0:jo(c.to,r)>0)||u>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?jo(c.from,n)<=0:jo(c.from,n)<0)))return!0}}}function bn(e){for(var t;t=mn(e);)e=t.find(-1,!0).line;return e}function wn(e){for(var t,r;t=vn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function xn(e,t){var r=Qn(e,t),n=bn(r);return r==n?t:ri(n)}function kn(e,t){if(t>e.lastLine())return t;var r,n=Qn(e,t);if(!Cn(e,n))return t;for(;r=vn(n);)n=r.find(1,!0).line;return ri(n)+1}function Cn(e,t){var r=Ho&&t.markedSpans;if(r)for(var n,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Sn(e,t,n))return!0}}function Sn(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Sn(e,n.line,en(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Sn(e,t,i))return!0}function Tn(e,t,r){ii(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ir(e,null,r)}function Ln(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Ya(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),Ui(t.display.measure,qi("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Mn(e,t,r,n){var i=new wa(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),Rr(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!Cn(e,t)){var n=ii(t)<e.scrollTop;ti(t,t.height+Ln(i)),n&&Ir(o,null,i.height),o.curOp.forceUpdate=!0}return!0}),i}function _n(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),un(e),dn(e,r);var i=n?n(e):1;i!=e.height&&ti(e,i)}function An(e){e.parent=null,un(e)}function On(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Nn(t,r){if(t.blankLine)return t.blankLine(r);if(t.innerMode){var n=e.innerMode(t,r);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function Wn(t,r,n,i){for(var o=0;o<10;o++){i&&(i[0]=e.innerMode(t,n).mode);var a=t.token(r,n);if(r.pos>r.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function En(e,t,r,n){function i(e){return{start:d.start,end:d.pos,string:d.current(),type:o||null,state:e?ca(a.mode,u):u}}var o,a=e.doc,l=a.mode;t=ge(a,t);var s,c=Qn(a,t.line),u=Be(e,t.line,r),d=new ma(c.text,e.options.tabSize);for(n&&(s=[]);(n||d.pos<t.ch)&&!d.eol();)d.start=d.pos,o=Wn(l,d,u),n&&s.push(i(!0));return n?s:i()}function zn(e,t,r,n,i,o,a){var l=r.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,c=0,u=null,d=new ma(t,e.options.tabSize),h=e.options.addModeClass&&[null];for(""==t&&On(Nn(r,n),o);!d.eol();){if(d.pos>e.options.maxHighlightLength?(l=!1,a&&In(e,t,n,d.pos),d.pos=t.length,s=null):s=On(Wn(r,d,n,h),o),h){var f=h[0].name;f&&(s="m-"+(s?f+" "+s:f))}if(!l||u!=s){for(;c<d.start;)c=Math.min(d.start,c+5e4),i(c,u);u=s}d.start=d.pos}for(;c<d.pos;){var p=Math.min(d.pos,c+5e4);i(p,u),c=p}}function Pn(e,t,r,n){var i=[e.state.modeGen],o={};zn(e,t.text,e.doc.mode,r,function(e,t){i.push(e,t)},o,n);for(var a=0;a<e.state.overlays.length;++a){var l=e.state.overlays[a],s=1,c=0;zn(e,t.text,l.mode,!0,function(e,t){for(var r=s;c<e;){var n=i[s];n>e&&i.splice(s,1,e,i[s+1],n),s+=2,c=Math.min(e,n)}if(t)if(l.opaque)i.splice(r,s-r,e,"cm-overlay "+t),s=r+2;else for(;r<s;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Dn(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Be(e,ri(t)),i=Pn(e,t,t.text.length>e.options.maxHighlightLength?ca(e.doc.mode,n):n);t.stateAfter=n,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function In(e,t,r,n){var i=e.doc.mode,o=new ma(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&Nn(i,r);!o.eol();)Wn(i,o,r),o.start=o.pos}function Hn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Ca:ka;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Fn(e,t){var r=qi("span",null,null,ko?"padding-right: .1px":null),n={pre:qi("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:(wo||ko)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;n.pos=0,n.addToken=Rn,Ji(e.display.measure)&&(o=oi(a))&&(n.addToken=qn(n.addToken,o)),n.map=[];var l=t!=e.display.externalMeasured&&ri(a);Un(a,n,Dn(e,a,l)),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=$i(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=$i(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Qi(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(ko){var s=n.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return za(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=$i(n.pre.className,n.textClass||"")),n}function jn(e){var t=qi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Rn(e,t,r,n,i,o,a){if(t){var l=e.splitSpaces?Bn(t,e.trailingSpace):t,s=e.cm.state.specialChars,c=!1;if(s.test(t))for(var u=document.createDocumentFragment(),d=0;;){s.lastIndex=d;var h=s.exec(t),f=h?h.index-d:t.length-d;if(f){var p=document.createTextNode(l.slice(d,d+f));wo&&xo<9?u.appendChild(qi("span",[p])):u.appendChild(p),e.map.push(e.pos,e.pos+f,p),e.col+=f,e.pos+=f}if(!h)break;if(d+=f+1,"\t"==h[0]){var g=e.cm.options.tabSize,m=g-e.col%g,p=u.appendChild(qi("span",Wi(m),"cm-tab"));p.setAttribute("role","presentation"),p.setAttribute("cm-text","\t"),e.col+=m}else if("\r"==h[0]||"\n"==h[0]){var p=u.appendChild(qi("span","\r"==h[0]?"␍":"","cm-invalidchar"));p.setAttribute("cm-text",h[0]),e.col+=1}else{var p=e.cm.options.specialCharPlaceholder(h[0]);p.setAttribute("cm-text",h[0]),wo&&xo<9?u.appendChild(qi("span",[p])):u.appendChild(p),e.col+=1}e.map.push(e.pos,e.pos+1,p),e.pos++}else{e.col+=t.length;var u=document.createTextNode(l);e.map.push(e.pos,e.pos+t.length,u),wo&&xo<9&&(c=!0),e.pos+=t.length}if(e.trailingSpace=32==l.charCodeAt(t.length-1),r||n||i||c||a){var v=r||"";n&&(v+=n),i&&(v+=i);var y=qi("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Bn(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}function qn(e,t){return function(r,n,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var c=r.pos,u=c+n.length;;){for(var d=0;d<t.length;d++){var h=t[d];if(h.to>c&&h.from<=c)break}if(h.to>=u)return e(r,n,i,o,a,l,s);e(r,n.slice(0,h.to-c),i,o,null,l,s),o=null,n=n.slice(h.to-c),c=h.to}}}function Kn(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Un(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,l,s,c,u,d,h,f=i.length,p=0,g=1,m="",v=0;;){if(v==p){s=c=u=d=l="",h=null,v=1/0;for(var y,b=[],w=0;w<n.length;++w){var x=n[w],k=x.marker;"bookmark"==k.type&&x.from==p&&k.widgetNode?b.push(k):x.from<=p&&(null==x.to||x.to>p||k.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),k.className&&(s+=" "+k.className),k.css&&(l=(l?l+";":"")+k.css),k.startStyle&&x.from==p&&(u+=" "+k.startStyle),k.endStyle&&x.to==v&&(y||(y=[])).push(k.endStyle,x.to),k.title&&!d&&(d=k.title),k.collapsed&&(!h||pn(h.marker,k)<0)&&(h=x)):x.from>p&&v>x.from&&(v=x.from)}if(y)for(var w=0;w<y.length;w+=2)y[w+1]==v&&(c+=" "+y[w]);if(!h||h.from==p)for(var w=0;w<b.length;++w)Kn(t,0,b[w]);if(h&&(h.from||0)==p){if(Kn(t,(null==h.to?f+1:h.to)-p,h.marker,null==h.from),null==h.to)return;h.to==p&&(h=!1)}}if(p>=f)break;for(var C=Math.min(f,v);;){if(m){var S=p+m.length;if(!h){var T=S>C?m.slice(0,C-p):m;t.addToken(t,T,a?a+s:s,u,p+T.length==v?c:"",d,l)}if(S>=C){m=m.slice(C-p),p=C;break}p=S,u=""}m=i.slice(o,o=r[g++]),a=Hn(r[g++],t.cm.options)}}else for(var g=1;g<r.length;g+=2)t.addToken(t,i.slice(o,o=r[g]),Hn(r[g+1],t.cm.options))}function Gn(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Ei(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Vn(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){_n(e,r,i,n),Ti(e,"change",e,t)}function a(e,t){for(var r=e,o=[];r<t;++r)o.push(new xa(c[r],i(r),n));return o}var l=t.from,s=t.to,c=t.text,u=Qn(e,l.line),d=Qn(e,s.line),h=Ei(c),f=i(c.length-1),p=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Gn(e,t)){var g=a(0,c.length-1);o(d,d.text,f),p&&e.remove(l.line,p),g.length&&e.insert(l.line,g)}else if(u==d)if(1==c.length)o(u,u.text.slice(0,l.ch)+h+u.text.slice(s.ch),f);else{var g=a(1,c.length-1);g.push(new xa(h+u.text.slice(s.ch),f,n)),o(u,u.text.slice(0,l.ch)+c[0],i(0)),e.insert(l.line+1,g)}else if(1==c.length)o(u,u.text.slice(0,l.ch)+c[0]+d.text.slice(s.ch),i(0)),e.remove(l.line+1,p);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(d,h+d.text.slice(s.ch),f);var g=a(1,c.length-1);p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,g)}Ti(e,"change",e,t)}function $n(e){this.lines=e,this.parent=null;for(var t=0,r=0;t<e.length;++t)e[t].parent=this,r+=e[t].height;this.height=r}function Yn(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}function Xn(e,t,r){function n(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;r&&!s||(t(l.doc,s),n(l.doc,e,s))}}}n(e,null,!0)}function Zn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,a(e),r(e),e.options.lineWrapping||h(e),e.options.mode=t.modeOption,Dt(e)}function Qn(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function Jn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function ei(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function ti(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function ri(e){if(null==e.parent)return null;for(var t=e.parent,r=zi(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function ni(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;n<e.lines.length;++n){var a=e.lines[n],l=a.height;if(t<l)break;t-=l}return r+n}function ii(e){e=bn(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var n=0;n<o.children.length;++n){var a=o.children[n];if(a==r)break;t+=a.height}return t}function oi(e){var t=e.order;return null==t&&(t=e.order=sl(e.text)),t}function ai(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function li(e,t){var r={from:V(t.from),to:ea(t),text:Jn(e,t.from,t.to)};return pi(e,r,t.from.line,t.to.line+1),Xn(e,function(e){pi(e,r,t.from.line,t.to.line+1)},!0),r}function si(e){for(;e.length;){var t=Ei(e);if(!t.ranges)break;e.pop()}}function ci(e,t){return t?(si(e.done),Ei(e.done)):e.done.length&&!Ei(e.done).ranges?Ei(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Ei(e.done)):void 0}function ui(e,t,r,n){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ci(i,i.lastOp==n))){var l=Ei(o.changes);0==jo(t.from,t.to)&&0==jo(t.from,l.to)?l.to=ea(t):o.changes.push(li(e,t))}else{var s=Ei(i.done);for(s&&s.ranges||fi(e.sel,i.done),o={changes:[li(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||za(e,"historyAdded")}function di(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function hi(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||di(e,o,Ei(i.done),t))?i.done[i.done.length-1]=t:fi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&si(i.undone)}function fi(e,t){var r=Ei(t);r&&r.ranges&&r.equals(e)||t.push(e)}function pi(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function gi(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function mi(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(gi(r[n]));return i}function vi(e,t,r){for(var n=0,i=[];n<e.length;++n){var o=e[n];if(o.ranges)i.push(r?ue.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];i.push({changes:l});for(var s=0;s<a.length;++s){var c,u=a[s];if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&zi(t,Number(c[1]))>-1&&(Ei(l)[d]=u[d],delete u[d])}}}return i}function yi(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function bi(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var l=0;l<o.ranges.length;l++)yi(o.ranges[l].anchor,t,r,n),yi(o.ranges[l].head,t,r,n)}else{for(var l=0;l<o.changes.length;++l){var s=o.changes[l];if(r<s.from.line)s.from=Fo(s.from.line+n,s.from.ch),s.to=Fo(s.to.line+n,s.to.ch);else if(t<=s.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function wi(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;bi(e.done,r,n,i),bi(e.undone,r,n,i)}function xi(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ki(e){return e.target||e.srcElement}function Ci(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),No&&e.ctrlKey&&1==t&&(t=3),t}function Si(e,t,r){var n=e._handlers&&e._handlers[t];return r?n&&n.length>0?n.slice():Wa:n||Wa}function Ti(e,t){function r(e){return function(){e.apply(null,o)}}var n=Si(e,t,!1);if(n.length){var i,o=Array.prototype.slice.call(arguments,2);Go?i=Go.delayedCallbacks:Pa?i=Pa:(i=Pa=[],setTimeout(Li,0));for(var a=0;a<n.length;++a)i.push(r(n[a]))}}function Li(){var e=Pa;Pa=null;for(var t=0;t<e.length;++t)e[t]()}function Mi(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),za(e,r||t.type,e,t),xi(t)||t.codemirrorIgnore}function _i(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)zi(r,t[n])==-1&&r.push(t[n])}function Ai(e,t){return Si(e,t).length>0}function Oi(e){e.prototype.on=function(e,t){Na(this,e,t)},e.prototype.off=function(e,t){Ea(this,e,t)}}function Ni(){this.id=null}function Wi(e){for(;qa.length<=e;)qa.push(Ei(qa)+" ");return qa[e]}function Ei(e){return e[e.length-1]}function zi(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function Pi(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Di(){}function Ii(e,t){var r;return Object.create?r=Object.create(e):(Di.prototype=e,r=new Di),t&&Hi(t,r),r}function Hi(e,t,r){t||(t={});for(var n in e)!e.hasOwnProperty(n)||r===!1&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function Fi(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ji(e,t){return t?!!(t.source.indexOf("\\w")>-1&&Va(e))||t.test(e):Va(e)}function Ri(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Bi(e){return e.charCodeAt(0)>=768&&$a.test(e)}function qi(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function Ki(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Ui(e,t){return Ki(e).appendChild(t)}function Gi(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function Vi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function $i(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!Vi(r[n]).test(t)&&(t+=" "+r[n]);return t}function Yi(e){if(document.body.getElementsByClassName)for(var t=document.body.getElementsByClassName("CodeMirror"),r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&e(n)}}function Xi(){el||(Zi(),el=!0)}function Zi(){var e;Na(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Yi(Ut)},100))}),Na(window,"blur",function(){Yi(yr)})}function Qi(e){if(null==Xa){var t=qi("span","");Ui(e,qi("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Xa=t.offsetWidth<=1&&t.offsetHeight>2&&!(wo&&xo<8))}var r=Xa?qi("span",""):qi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Ji(e){if(null!=Za)return Za;var t=Ui(e,document.createTextNode("AخA")),r=Ua(t,0,1).getBoundingClientRect(),n=Ua(t,1,2).getBoundingClientRect();return Ki(e),!(!r||r.left==r.right)&&(Za=n.right-r.right<3)}function eo(e){if(null!=ol)return ol;var t=Ui(e,qi("span","x")),r=t.getBoundingClientRect(),n=Ua(t,0,1).getBoundingClientRect();return ol=Math.abs(r.left-n.left)>1}function to(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function ro(e){return e.level%2?e.to:e.from}function no(e){return e.level%2?e.from:e.to}function io(e){var t=oi(e);return t?ro(t[0]):0}function oo(e){var t=oi(e);return t?no(Ei(t)):e.text.length}function ao(e,t){var r=Qn(e.doc,t),n=bn(r);n!=r&&(t=ri(n));var i=oi(n),o=i?i[0].level%2?oo(n):io(n):0;return Fo(t,o)}function lo(e,t){for(var r,n=Qn(e.doc,t);r=vn(n);)n=r.find(1,!0).line,t=null;var i=oi(n),o=i?i[0].level%2?io(n):oo(n):n.text.length;return Fo(null==t?ri(n):t,o)}function so(e,t){
|
1 |
+
!function(){var e=void 0,t=void 0;!function r(t,n,i){function o(l,s){if(!n[l]){if(!t[l]){var c="function"==typeof e&&e;if(!s&&c)return c(l,!0);if(a)return a(l,!0);var u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var d=n[l]={exports:{}};t[l][0].call(d.exports,function(e){var r=t[l][1][e];return o(r?r:e)},d,d.exports,r,t,n,i)}return n[l].exports}for(var a="function"==typeof e&&e,l=0;l<i.length;l++)o(i[l]);return o}({1:[function(e,t,r){"use strict";var n=function(e,t){var r={};return r.label=function(r){return e("div",[e("label",t.fieldLabel),e("input.widefat",{type:"text",value:r.label(),onchange:e.withAttr("value",r.label),placeholder:r.title()})])},r.value=function(r){return e("div",[e("label",[t.value," ","hidden"===r.type()?"":e("small",{style:"float: right; font-weight: normal;"},t.optional)]),e("input.widefat",{type:"text",value:r.value(),onchange:e.withAttr("value",r.value)}),e("p.help",t.valueHelp)])},r.numberMinMax=function(r){return e("div",[e("div.row",[e("div.col.col-3",[e("label",t.min),e("input",{type:"number",onchange:e.withAttr("value",r.min)})]),e("div.col.col-3",[e("label",t.max),e("input",{type:"number",onchange:e.withAttr("value",r.max)})])])])},r.isRequired=function(r){var n,i={type:"checkbox",checked:r.required(),onchange:e.withAttr("checked",r.required)};return r.forceRequired()&&(i.required=!0,i.disabled=!0,n=e("p.help",t.forceRequired)),e("div",[e("label.cb-wrap",[e("input",i),t.isFieldRequired]),n])},r.placeholder=function(r){return e("div",[e("label",[t.placeholder," ",e("small",{style:"float: right; font-weight: normal;"},t.optional)]),e("input.widefat",{type:"text",value:r.placeholder(),onchange:e.withAttr("value",r.placeholder),placeholder:""}),e("p.help",t.placeholderHelp)])},r.useParagraphs=function(r){return e("div",[e("label.cb-wrap",[e("input",{type:"checkbox",checked:r.wrap(),onchange:e.withAttr("checked",r.wrap)}),t.wrapInParagraphTags])])},r.choiceType=function(r){return e("div",[e("label",t.choiceType),e("select",{value:r.type(),onchange:e.withAttr("value",r.type)},[e("option",{value:"select",selected:"select"===r.type()&&"selected"},t.dropdown),e("option",{value:"radio",selected:"radio"===r.type()&&"selected"},t.radioButtons),e("option",{value:"checkbox",selected:"checkbox"===r.type()&&"selected"},t.checkboxes)])])},r.choices=function(r){var n=[];return n.push(e("div",[e("label",t.choices),e("div.limit-height",[e("table",[r.choices().map(function(n,i){return e("tr",{"data-id":i},[e("td.cb",e("input",{name:"selected",type:"checkbox"===r.type()?"checkbox":"radio",onchange:e.withAttr("value",r.selectChoice.bind(r)),checked:n.selected(),value:n.value(),title:t.preselect})),e("td.stretch",e("input.widefat",{type:"text",value:n.label(),placeholder:n.title(),onchange:e.withAttr("value",n.label)})),e("td",e("span",{title:t.remove,"class":"dashicons dashicons-no-alt hover-activated",onclick:function(e){this.choices().splice(e,1)}.bind(r,i)},""))])})])])])),n},r};t.exports=n},{}],2:[function(e,t,r){var n=function(t,r){var n={},i=e("./field-forms-rows.js")(t,r);return n.render=function(e){var t=e.type();if("function"==typeof n[t])return n[t](e);switch(t){case"select":case"radio":case"checkbox":return n.choice(e)}return n.text(e)},n.text=function(e){return[i.label(e),i.placeholder(e),i.value(e),i.isRequired(e),i.useParagraphs(e)]},n.choice=function(e){var t=[i.label(e),i.choiceType(e),i.choices(e)];return"select"===e.type()&&t.push(i.placeholder(e)),t.push(i.useParagraphs(e)),"select"!==e.type()&&"radio"!==e.type()||t.push(i.isRequired(e)),t},n.hidden=function(e){return e.placeholder(""),e.label(""),e.wrap(!1),[i.value(e)]},n.submit=function(e){return e.label(""),e.placeholder(""),[i.value(e),i.useParagraphs(e)]},n.number=function(e){return[n.text(e),i.numberMinMax(e)]},n};t.exports=n},{"./field-forms-rows.js":1}],3:[function(e,t,r){"use strict";var n=e("../third-party/render.js"),i=e("../third-party/beautify-html.js"),o=function(e){function t(t){var o,a,l,s;return o=t.label().length?e("label",t.label()):"",a="function"==typeof r[t.type()]?r[t.type()](t):r["default"](t),l=t.wrap()?e("p",[o,a]):[o,a],s=n(l),s=i(s),s+"\n"}var r={};return r.select=function(t){var r={name:t.name(),required:t.required()},n=!1,i=t.choices().map(function(t){return t.selected()&&(n=!0),e("option",{value:t.value()!==t.label()?t.value():void 0,selected:t.selected()},t.label())}),o=t.placeholder();return o.length>0&&i.unshift(e("option",{disabled:!0,value:"",selected:!n},o)),e("select",r,i)},r.checkbox=function(t){var r=t.choices().map(function(r){var n=t.name()+("checkbox"===t.type()?"[]":""),i=t.required()&&"radio"===t.type();return e("label",[e("input",{name:n,type:t.type(),value:r.value(),checked:r.selected(),required:i})," ",e("span",r.label())])});return r},r.radio=r.checkbox,r["default"]=function(t){var r,n={type:t.type()};return t.name()&&(n.name=t.name()),t.min()&&(n.min=t.min()),t.max()&&(n.max=t.max()),t.value().length>0&&(n.value=t.value()),t.placeholder().length>0&&(n.placeholder=t.placeholder()),n.required=t.required(),r=e("input",n)},t};t.exports=o},{"../third-party/beautify-html.js":12,"../third-party/render.js":13}],4:[function(e,t,r){var n=function(t,r,n,i,o){"use strict";function a(e){u=i.get(e),u.choices().length>0&&u.value(u.choices().map(function(e){return e.label()}).join("|")),t.redraw()}function l(){}function s(){var e=d(u);n.insert(e),a(""),t.redraw()}function c(){var e=i.getCategories(),r=i.getAll(),n=t("div.available-fields.small-margin",[t("h4",o.chooseField),e.map(function(e){var n=r.filter(function(t){return t.category===e});if(n.length)return t("div.tiny-margin",[t("strong",e),n.map(function(e){var r="button";e.forceRequired()&&(r+=" is-required");var n=e.inFormContent();return null!==n&&(r+=" "+(n?"in-form":"not-in-form")),t("button",{className:r,type:"button",onclick:t.withAttr("value",a),value:e.index},e.title())})])})]),l=null;return u&&(l=h(t("div.field-wizard",[t("h3",[u.title(),u.forceRequired()?t("span.red","*"):"",u.name().length?t("code",u.name()):""]),u.help().length?t("p",t.trust(u.help())):"",f.render(u),t("p",[t("button",{"class":"button-primary",type:"button",onkeydown:function(e){e=e||window.event,13==e.keyCode&&s()},onclick:s},o.addToForm)])]),a)),[n,l]}var u,d=e("./field-generator.js")(t),h=e("./overlay.js")(t,o),f=e("./field-forms.js")(t,o);return n.on("blur",t.redraw),{view:c,controller:l}};t.exports=n},{"./field-forms.js":2,"./field-generator.js":3,"./overlay.js":10}],5:[function(e,t,r){var n=function(e,t){"use strict";function r(){u.forEach(e.deregister)}function n(t,r,n){var i=e.register(t,r);n||u.push(i)}function i(e){var t={phone:"tel",dropdown:"select",checkboxes:"checkbox",birthday:"text"};return"undefined"!=typeof t[e]?t[e]:e}function o(e){var r=t.listFields,o={name:e.tag,title:e.name,required:e.required,forceRequired:e.required,type:i(e.field_type),choices:e.choices};return"address"!==o.type?n(r,o,!1):(n(r,{name:o.name+"[addr1]",type:"text",title:t.streetAddress}),n(r,{name:o.name+"[city]",type:"text",title:t.city}),n(r,{name:o.name+"[state]",type:"text",title:t.state}),n(r,{name:o.name+"[zip]",type:"text",title:t.zip}),n(r,{name:o.name+"[country]",type:"select",title:t.country,choices:mc4wp_vars.countries})),!0}function a(e){var r=t.interestCategories,o={title:e.name,name:"INTERESTS["+e.id+"]",type:i(e.field_type),choices:e.interests};n(r,o,!1)}function l(e){e.merge_fields=e.merge_fields.sort(function(e,t){return"EMAIL"===e.tag||e["public"]&&!t["public"]?-1:!e["public"]&&t["public"]?1:0}),e.merge_fields.forEach(o),e.interest_categories.forEach(a)}function s(e){r(),e.forEach(l)}function c(e){var r,i=t.formFields;n(i,{name:"",value:t.subscribe,type:"submit",title:t.submitButton},!0),r={};for(var o in e)r[e[o].id]=e[o].name;n(i,{name:"_mc4wp_lists",type:"checkbox",title:t.listChoice,choices:r,help:t.listChoiceDescription},!0),r={subscribe:"Subscribe",unsubscribe:"Unsubscribe"},n(i,{name:"_mc4wp_action",type:"radio",title:t.formAction,choices:r,value:"subscribe",help:t.formActionDescription},!0)}var u=[];return{registerCustomFields:c,registerListFields:l,registerListsFields:s}};t.exports=n},{}],6:[function(e,t,r){"use strict";t.exports=function(e,t){function r(e){var t=[];return t="function"==typeof e.map?e.map(function(e){return new f({label:e})}):Object.keys(e).map(function(t){var r=e[t];return new f({label:r,value:t})})}function n(n,i){var o,a=s("name",i.name).shift();return a?void(!a.required()&&i.required&&a.required(!0)):(i.choices&&(i.choices=r(i.choices),i.value&&(i.choices=i.choices.map(function(e){return e.value()===i.value&&e.selected(!0),e}))),d.indexOf(n)<0&&d.push(n),o=new h(i),o.category=n,u.push(o),c&&window.clearTimeout(c),c=window.setTimeout(e.redraw,100),t.trigger("fields.change"),o)}function i(t){var r=u.indexOf(t);r>-1&&(delete u[r],e.redraw())}function o(e){return u[e]}function a(){return u=u.map(function(e,t){return e.index=t,e})}function l(){return d}function s(e,t){return u.filter(function(r){return r[e]()===t})}var c,u=[],d=[],h=function(t){this.name=e.prop(t.name),this.title=e.prop(t.title||t.name),this.type=e.prop(t.type),this.label=e.prop(t.title||""),this.value=e.prop(t.value||""),this.placeholder=e.prop(t.placeholder||""),this.required=e.prop(t.required||!1),this.forceRequired=e.prop(t.forceRequired||!1),this.wrap=e.prop(t.wrap||!0),this.min=e.prop(t.min||null),this.max=e.prop(t.max||null),this.help=e.prop(t.help||""),this.choices=e.prop(t.choices||[]),this.inFormContent=e.prop(null),this.selectChoice=function(e){var t=this;this.choices(this.choices().map(function(r){return r.value()===e?r.selected(!0):"checkbox"!==t.type()&&r.selected(!1),r}))}},f=function(t){this.label=e.prop(t.label),this.title=e.prop(t.title||t.label),this.selected=e.prop(t.selected||!1),this.value=e.prop(t.value||t.label)};return{get:o,getAll:a,getCategories:l,deregister:i,register:n,getAllWhere:s}}},{}],7:[function(e,t,r){"use strict";var n=e("codemirror");e("codemirror/mode/xml/xml"),e("codemirror/mode/javascript/javascript"),e("codemirror/mode/css/css"),e("codemirror/mode/htmlmixed/htmlmixed"),e("codemirror/addon/fold/xml-fold"),e("codemirror/addon/edit/matchtags"),e("codemirror/addon/edit/closetag.js");var i=function(e){function t(){return o&&(i.innerHTML=a.getValue().toLowerCase(),o=!1),i}var r,i=document.createElement("form"),o=!1,a={};return i.innerHTML=e.value.toLowerCase(),n&&(r=n.fromTextArea(e,{selectionPointer:!0,matchTags:{bothTags:!0},mode:"htmlmixed",htmlMode:!0,autoCloseTags:!0,autoRefresh:!0}),window.dispatchEvent&&r.on("change",function(){if("function"==typeof Event){var t=new Event("change",{bubbles:!0});e.dispatchEvent(t)}})),window.addEventListener("load",function(){n.signal(r,"change")}),e.addEventListener("change",function(){o=!0}),a.getValue=function(){return r?r.getValue():e.value},a.query=function(e){return t().querySelectorAll(e)},a.containsField=function(e){return null!==t().elements.namedItem(e.toLowerCase())},a.insert=function(t){r?(r.replaceSelection(t),r.focus()):e.value+=t},a.on=function(t,n){return r?(t="input"===t?"changes":t,r.on(t,n)):e.addEventListener(t,n)},a.refresh=function(){r&&r.refresh()},a};t.exports=i},{codemirror:17,"codemirror/addon/edit/closetag.js":14,"codemirror/addon/edit/matchtags":15,"codemirror/addon/fold/xml-fold":16,"codemirror/mode/css/css":18,"codemirror/mode/htmlmixed/htmlmixed":19,"codemirror/mode/javascript/javascript":20,"codemirror/mode/xml/xml":21}],8:[function(e,t,r){var n=function(e,t,r,n,i,o){"use strict";function a(){n.getAll().forEach(function(e){if(!(e.name().length<=0)){var r=e.name();"checkbox"===e.type()&&(r+="[]");var n=t.containsField(r);e.inFormContent(n)}}),l(),e.redraw()}function l(){var e=n.getAllWhere("forceRequired",!0).map(function(e){return e.name().toUpperCase()}),r=t.query("[required]");Array.prototype.forEach.call(r,function(t){var r=t.name.toUpperCase();"_"!==r[0]&&(r=r.replace(/\[(\w+)\]/g,".$1"),e.indexOf(r)===-1&&e.push(r))}),s.value=e.join(",")}var s=document.getElementById("required-fields");t.on("change",o.debounce(a,500)),i.on("fields.change",o.debounce(a,500))};t.exports=n},{}],9:[function(e,t,r){"use strict";function n(e){var t=l.indexOf(e);t<0&&(l.push(e),o())}function i(e){var t=l.indexOf(e);t>-1&&(l.splice(t,1),o())}function o(){for(var e="",t=0;t<l.length;t++)e+='<div class="notice notice-warning"><p>'+l[t]+"</p></div>";var r=document.querySelector(".mc4wp-notices");if(!r){r=document.createElement("div"),r.className="mc4wp-notices";var n=document.querySelector("h1");n.parentNode.insertBefore(r,n.nextSibling)}r.innerHTML=e}function a(e){e.on("change",function(){var t="Your form contains old style <code>GROUPINGS</code> fields. <br /><br />Please remove these fields from your form and then re-add them through the available field buttons to make sure your data is getting through to MailChimp correctly.",r=e.getValue().toLowerCase();r.indexOf('name="groupings')>-1?n(t):i(t)})}var l=[];t.exports={init:a}},{}],10:[function(e,t,r){var n=function(e,t){"use strict";function r(){document.removeEventListener("keydown",n),window.removeEventListener("resize",i),a()}function n(e){e=e||window.event,27==e.keyCode&&r(),13==e.keyCode&&e.preventDefault()}function i(){if(o){var e=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,r=(e-o.clientWidth-40)/2,n=(t-o.clientHeight-40)/2;o.style.left=(r>0?r:0)+"px",o.style.top=(n>0?n:0)+"px"}}var o,a;return function(l,s){return a=s,document.addEventListener("keydown",n),window.addEventListener("resize",i),[e("div.overlay-wrap",e("div.overlay",{config:function(e){o=e,i()}},[e("span",{"class":"close dashicons dashicons-no",title:t.close,onclick:r}),l])),e("div.overlay-background",{title:t.close,onclick:r})]}};t.exports=n},{}],11:[function(e,t,r){"use strict";var n=window.mc4wp_forms_i18n,i=window.mc4wp.deps.mithril,o=mc4wp.events,a=mc4wp.settings,l=mc4wp.helpers,s=mc4wp.tabs,c=e("./admin/form-watcher.js"),u=e("./admin/form-editor.js"),d=e("./admin/field-helper.js"),h=e("./admin/fields-factory.js"),f=e("./admin/fields.js")(i,o),p=document.getElementById("mc4wp-form-content"),g=window.formEditor=new u(p),m=(new c(i,formEditor,a,f,o,l),new d(i,s,formEditor,f,n)),v=e("./admin/notices");i.mount(document.getElementById("mc4wp-field-wizard"),m);var y=new h(f,n);o.on("selectedLists.change",y.registerListsFields),y.registerListsFields(a.getSelectedLists()),y.registerCustomFields(mc4wp_vars.mailchimp.lists),window.setTimeout(function(){i.redraw()},2e3),v.init(g),window.mc4wp=window.mc4wp||{},window.mc4wp.forms=window.mc4wp.forms||{},window.mc4wp.forms.editor=g,window.mc4wp.forms.fields=f},{"./admin/field-helper.js":4,"./admin/fields-factory.js":5,"./admin/fields.js":6,"./admin/form-editor.js":7,"./admin/form-watcher.js":8,"./admin/notices":9}],12:[function(e,t,r){!function(){function e(e){return e.replace(/^\s+|\s+$/g,"")}function r(e){return e.replace(/^\s+/g,"")}function n(t,n,i,o){function a(){return this.pos=0,this.token="",this.current_mode="CONTENT",this.tags={parent:"parent1",parentcount:1,parent1:""},this.tag_type="",this.token_text=this.last_token=this.last_text=this.token_type="",this.newlines=0,this.indent_content=s,this.Utils={whitespace:"\n\r\t ".split(""),single_token:"br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?=".split(","),extra_liners:"head,body,/html".split(","),in_array:function(e,t){for(var r=0;r<t.length;r++)if(e===t[r])return!0;return!1}},this.traverse_whitespace=function(){var e="";if(e=this.input.charAt(this.pos),this.Utils.in_array(e,this.Utils.whitespace)){for(this.newlines=0;this.Utils.in_array(e,this.Utils.whitespace);)p&&"\n"===e&&this.newlines<=g&&(this.newlines+=1),this.pos++,e=this.input.charAt(this.pos);return!0}return!1},this.get_content=function(){for(var e="",t=[],r=!1;"<"!==this.input.charAt(this.pos);){if(this.pos>=this.input.length)return t.length?t.join(""):["","TK_EOF"];if(this.traverse_whitespace())t.length&&(r=!0);else{if(indent_handlebars){var n=this.input.substr(this.pos,3);if("{{#"===n||"{{/"===n)break;if("{{"===this.input.substr(this.pos,2)&&"{{else}}"===this.get_tag(!0))break}e=this.input.charAt(this.pos),this.pos++,r&&(this.line_char_count>=this.wrap_line_length?(this.print_newline(!1,t),this.print_indentation(t)):(this.line_char_count++,t.push(" ")),r=!1),this.line_char_count++,t.push(e)}}return t.length?t.join(""):""},this.get_contents_to=function(e){if(this.pos===this.input.length)return["","TK_EOF"];var t="",r=new RegExp("</"+e+"\\s*>","igm");r.lastIndex=this.pos;var n=r.exec(this.input),i=n?n.index:this.input.length;return this.pos<i&&(t=this.input.substring(this.pos,i),this.pos=i),t},this.record_tag=function(e){this.tags[e+"count"]?(this.tags[e+"count"]++,this.tags[e+this.tags[e+"count"]]=this.indent_level):(this.tags[e+"count"]=1,this.tags[e+this.tags[e+"count"]]=this.indent_level),this.tags[e+this.tags[e+"count"]+"parent"]=this.tags.parent,this.tags.parent=e+this.tags[e+"count"]},this.retrieve_tag=function(e){if(this.tags[e+"count"]){for(var t=this.tags.parent;t&&e+this.tags[e+"count"]!==t;)t=this.tags[t+"parent"];t&&(this.indent_level=this.tags[e+this.tags[e+"count"]],this.tags.parent=this.tags[t+"parent"]),delete this.tags[e+this.tags[e+"count"]+"parent"],delete this.tags[e+this.tags[e+"count"]],1===this.tags[e+"count"]?delete this.tags[e+"count"]:this.tags[e+"count"]--}},this.indent_to_tag=function(e){if(this.tags[e+"count"]){for(var t=this.tags.parent;t&&e+this.tags[e+"count"]!==t;)t=this.tags[t+"parent"];t&&(this.indent_level=this.tags[e+this.tags[e+"count"]])}},this.get_tag=function(e){var t,r,n,i="",o=[],a="",l=!1,s=this.pos,c=this.line_char_count;e=void 0!==e&&e;do{if(this.pos>=this.input.length)return e&&(this.pos=s,this.line_char_count=c),o.length?o.join(""):["","TK_EOF"];if(i=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(i,this.Utils.whitespace))l=!0;else{if("'"!==i&&'"'!==i||(i+=this.get_unformatted(i),l=!0),"="===i&&(l=!1),o.length&&"="!==o[o.length-1]&&">"!==i&&l&&(this.line_char_count>=this.wrap_line_length?(this.print_newline(!1,o),this.print_indentation(o)):(o.push(" "),this.line_char_count++),l=!1),indent_handlebars&&"<"===n&&i+this.input.charAt(this.pos)==="{{"&&(i+=this.get_unformatted("}}"),o.length&&" "!==o[o.length-1]&&"<"!==o[o.length-1]&&(i=" "+i),l=!0),"<"!==i||n||(t=this.pos-1,n="<"),indent_handlebars&&!n&&o.length>=2&&"{"===o[o.length-1]&&"{"==o[o.length-2]&&(t="#"===i||"/"===i?this.pos-3:this.pos-2,n="{"),this.line_char_count++,o.push(i),o[1]&&"!"===o[1]){o=[this.get_comment(t)];break}if(indent_handlebars&&"{"===n&&o.length>2&&"}"===o[o.length-2]&&"}"===o[o.length-1])break}}while(">"!==i);var u,d,h=o.join("");u=h.indexOf(" ")!==-1?h.indexOf(" "):"{"===h[0]?h.indexOf("}"):h.indexOf(">"),d="<"!==h[0]&&indent_handlebars?"#"===h[2]?3:2:1;var p=h.substring(d,u).toLowerCase();return"/"===h.charAt(h.length-2)||this.Utils.in_array(p,this.Utils.single_token)?e||(this.tag_type="SINGLE"):indent_handlebars&&"{"===h[0]&&"else"===p?e||(this.indent_to_tag("if"),this.tag_type="HANDLEBARS_ELSE",this.indent_content=!0,this.traverse_whitespace()):"script"===p?e||(this.record_tag(p),this.tag_type="SCRIPT"):"style"===p?e||(this.record_tag(p),this.tag_type="STYLE"):this.is_unformatted(p,f)?(a=this.get_unformatted("</"+p+">",h),o.push(a),t>0&&this.Utils.in_array(this.input.charAt(t-1),this.Utils.whitespace)&&o.splice(0,0,this.input.charAt(t-1)),r=this.pos-1,this.Utils.in_array(this.input.charAt(r+1),this.Utils.whitespace)&&o.push(this.input.charAt(r+1)),this.tag_type="SINGLE"):"!"===p.charAt(0)?e||(this.tag_type="SINGLE",this.traverse_whitespace()):e||("/"===p.charAt(0)?(this.retrieve_tag(p.substring(1)),this.tag_type="END",this.traverse_whitespace()):(this.record_tag(p),"html"!==p.toLowerCase()&&(this.indent_content=!0),this.tag_type="START",this.traverse_whitespace()),this.Utils.in_array(p,this.Utils.extra_liners)&&(this.print_newline(!1,this.output),this.output.length&&"\n"!==this.output[this.output.length-2]&&this.print_newline(!0,this.output))),e&&(this.pos=s,this.line_char_count=c),o.join("")},this.get_comment=function(e){var t="",r=">",n=!1;for(this.pos=e,input_char=this.input.charAt(this.pos),this.pos++;this.pos<=this.input.length&&(t+=input_char,t[t.length-1]!==r[r.length-1]||t.indexOf(r)===-1);)!n&&t.length<10&&(0===t.indexOf("<![if")?(r="<![endif]>",n=!0):0===t.indexOf("<![cdata[")?(r="]]>",n=!0):0===t.indexOf("<![")?(r="]>",n=!0):0===t.indexOf("<!--")&&(r="-->",n=!0)),input_char=this.input.charAt(this.pos),this.pos++;return t},this.get_unformatted=function(e,t){if(t&&t.toLowerCase().indexOf(e)!==-1)return"";var r="",n="",i=0,o=!0;do{if(this.pos>=this.input.length)return n;if(r=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(r,this.Utils.whitespace)){if(!o){this.line_char_count--;continue}if("\n"===r||"\r"===r){n+="\n",this.line_char_count=0;continue}}n+=r,this.line_char_count++,o=!0,indent_handlebars&&"{"===r&&n.length&&"{"===n[n.length-2]&&(n+=this.get_unformatted("}}"),i=n.length)}while(n.toLowerCase().indexOf(e,i)===-1);return n},this.get_token=function(){var e;if("TK_TAG_SCRIPT"===this.last_token||"TK_TAG_STYLE"===this.last_token){var t=this.last_token.substr(7);return e=this.get_contents_to(t),"string"!=typeof e?e:[e,"TK_"+t]}if("CONTENT"===this.current_mode)return e=this.get_content(),"string"!=typeof e?e:[e,"TK_CONTENT"];if("TAG"===this.current_mode){if(e=this.get_tag(),"string"!=typeof e)return e;var r="TK_TAG_"+this.tag_type;return[e,r]}},this.get_full_indent=function(e){return e=this.indent_level+e||0,e<1?"":Array(e+1).join(this.indent_string)},this.is_unformatted=function(e,t){if(!this.Utils.in_array(e,t))return!1;if("a"!==e.toLowerCase()||!this.Utils.in_array("a",t))return!0;var r=this.get_tag(!0),n=(r||"").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);return!(n&&!this.Utils.in_array(n,t))},this.printer=function(e,t,n,i,o){this.input=e||"",this.output=[],this.indent_character=t,this.indent_string="",this.indent_size=n,this.brace_style=o,this.indent_level=0,this.wrap_line_length=i,this.line_char_count=0;for(var a=0;a<this.indent_size;a++)this.indent_string+=this.indent_character;this.print_newline=function(e,t){this.line_char_count=0,t&&t.length&&(e||"\n"!==t[t.length-1])&&t.push("\n")},this.print_indentation=function(e){for(var t=0;t<this.indent_level;t++)e.push(this.indent_string),this.line_char_count+=this.indent_string.length},this.print_token=function(e){(e||""!==e)&&this.output.length&&"\n"===this.output[this.output.length-1]&&(this.print_indentation(this.output),e=r(e)),this.print_token_raw(e)},this.print_token_raw=function(e){e&&""!==e&&(e.length>1&&"\n"===e[e.length-1]?(this.output.push(e.slice(0,-1)),this.print_newline(!1,this.output)):this.output.push(e));for(var t=0;t<this.newlines;t++)this.print_newline(t>0,this.output);this.newlines=0},this.indent=function(){this.indent_level++},this.unindent=function(){this.indent_level>0&&this.indent_level--}},this}var l,s,c,u,d,h,f,p,g;for(n=n||{},void 0!==n.wrap_line_length&&0!==parseInt(n.wrap_line_length,10)||void 0!==n.max_char&&0!==parseInt(n.max_char,10)||(n.wrap_line_length=n.max_char),s=n.indent_inner_html||!1,c=parseInt(n.indent_size||4,10),u=n.indent_char||" ",h=n.brace_style||"collapse",d=0===parseInt(n.wrap_line_length,10)?32786:parseInt(n.wrap_line_length||250,10),f=n.unformatted||["a","span","bdo","em","strong","dfn","code","samp","kbd","var","cite","abbr","acronym","q","sub","sup","tt","i","b","big","small","u","s","strike","font","ins","del","pre","address","dt","h1","h2","h3","h4","h5","h6"],p=n.preserve_newlines||!0,g=p?parseInt(n.max_preserve_newlines||32786,10):0,indent_handlebars=n.indent_handlebars||!1,l=new a,l.printer(t,u,c,d,h);;){var m=l.get_token();if(l.token_text=m[0],l.token_type=m[1],"TK_EOF"===l.token_type)break;switch(l.token_type){case"TK_TAG_START":l.print_newline(!1,l.output),l.print_token(l.token_text),l.indent_content&&(l.indent(),l.indent_content=!1),l.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":l.print_newline(!1,l.output),l.print_token(l.token_text),l.current_mode="CONTENT";break;case"TK_TAG_END":if("TK_CONTENT"===l.last_token&&""===l.last_text){var v=l.token_text.match(/\w+/)[0],y=null;l.output.length&&(y=l.output[l.output.length-1].match(/(?:<|{{#)\s*(\w+)/)),null!==y&&y[1]===v||l.print_newline(!1,l.output)}l.print_token(l.token_text),l.current_mode="CONTENT";break;case"TK_TAG_SINGLE":var b=l.token_text.match(/^\s*<([a-z]+)/i);b&&l.Utils.in_array(b[1],f)||l.print_newline(!1,l.output),l.print_token(l.token_text),l.current_mode="CONTENT";break;case"TK_TAG_HANDLEBARS_ELSE":l.print_token(l.token_text),l.indent_content&&(l.indent(),l.indent_content=!1),l.current_mode="CONTENT";break;case"TK_CONTENT":l.print_token(l.token_text),l.current_mode="TAG";break;case"TK_STYLE":case"TK_SCRIPT":if(""!==l.token_text){l.print_newline(!1,l.output);var w,x=l.token_text,k=1;"TK_SCRIPT"===l.token_type?w="function"==typeof i&&i:"TK_STYLE"===l.token_type&&(w="function"==typeof o&&o),"keep"===n.indent_scripts?k=0:"separate"===n.indent_scripts&&(k=-l.indent_level);var C=l.get_full_indent(k);if(w)x=w(x.replace(/^\s*/,C),n);else{var S=x.match(/^\s*/)[0],T=S.match(/[^\n\r]*$/)[0].split(l.indent_string).length-1,L=l.get_full_indent(k-T);x=x.replace(/^\s*/,C).replace(/\r\n|\r|\n/g,"\n"+L).replace(/\s+$/,"")}x&&(l.print_token_raw(C+e(x)),l.print_newline(!1,l.output))}l.current_mode="TAG"}l.last_token=l.token_type,l.last_text=l.token_text}return l.output.join("")}"undefined"!=typeof t&&"undefined"!=typeof t.exports?t.exports=n:"undefined"!=typeof window&&(window.html_beautify=n)}()},{}],13:[function(e,t,r){"use strict";function n(e){return"[object Array]"===Object.prototype.toString.call(e)}function i(e){return e.replace(/\W+/g,"-").replace(/([a-z\d])([A-Z])/g,"$1-$2")}function o(e){return""!=e}function a(e,t){return"undefined"===e&&(e=""),"string"!=typeof e&&(e+=""),e=e.replace(/\&/g,"&").replace(/</g,"<").replace(/\>/g,">"),t?e.replace(/\"/g,"""):e}function l(e){return e&&Object.keys(e).length?Object.keys(e).map(function(t){var r=e[t];if("undefined"!=typeof r&&null!==r&&"function"!=typeof r){if("boolean"==typeof r)return r?" "+t:"";if("style"===t){if(!r)return;var n=e.style;return"object"==typeof n&&(n=Object.keys(n).map(function(e){return""!=n[e]?[i(e).toLowerCase(),n[e]].join(":"):""}).filter(o).join(";")),""!=n?' style="'+a(n,!0)+'"':""}return" "+a("className"===t?"class":t)+'="'+a(r,!0)+'"'}}).join(""):""}function s(e){return n(e.children)&&!e.children.length?"":c(e.children)}function c(e){var t=typeof e;if("string"===t)return a(e);if("number"===t||"boolean"===t)return e;if(!e)return"";if(n(e))return e.map(c).join("");if(e.view){var r=e.controller?new e.controller:{},i=c(e.view(r));return r.onunload&&r.onunload(),i}if(e.$trusted)return""+e;var o=s(e);return!o&&u.indexOf(e.tag.toLowerCase())>=0?"<"+e.tag+l(e.attrs)+">":["<",e.tag,l(e.attrs),">",o,"</",e.tag,">"].join("")}var u=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr","!doctype"];t.exports=c},{}],14:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof t&&t.amd?t(["../../lib/codemirror","../fold/xml-fold"],i):i(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var r=t.listSelections(),n=[],s=0;s<r.length;s++){if(!r[s].empty())return e.Pass;var c=r[s].head,u=t.getTokenAt(c),d=e.innerMode(t.getMode(),u.state),h=d.state;if("xml"!=d.mode.name||!h.tagName)return e.Pass;var f=t.getOption("autoCloseTags"),p="html"==d.mode.configuration,g="object"==typeof f&&f.dontCloseTags||p&&a,m="object"==typeof f&&f.indentTags||p&&l,v=h.tagName;u.end>c.ch&&(v=v.slice(0,v.length-u.end+c.ch));var y=v.toLowerCase();if(!v||"string"==u.type&&(u.end!=c.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||1==u.string.length)||"tag"==u.type&&"closeTag"==h.type||u.string.indexOf("/")==u.string.length-1||g&&i(g,y)>-1||o(t,v,c,h,!0))return e.Pass;var b=m&&i(m,y)>-1;n[s]={indent:b,text:">"+(b?"\n\n":"")+"</"+v+">",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var s=r.length-1;s>=0;s--){var w=n[s];t.replaceRange(w.text,r[s].head,r[s].anchor,"+insert");var x=t.listSelections().slice(0);x[s]={head:w.newPos,anchor:w.newPos},t.setSelections(x),w.indent&&(t.indentLine(w.newPos.line,null,!0),t.indentLine(w.newPos.line+1,null,!0))}}function r(t,r){for(var n=t.listSelections(),i=[],a=r?"/":"</",l=0;l<n.length;l++){if(!n[l].empty())return e.Pass;var s=n[l].head,c=t.getTokenAt(s),u=e.innerMode(t.getMode(),c.state),d=u.state;if(r&&("string"==c.type||"<"!=c.string.charAt(0)||c.start!=s.ch-1))return e.Pass;var h;if("xml"!=u.mode.name)if("htmlmixed"==t.getMode().name&&"javascript"==u.mode.name)h=a+"script";else{if("htmlmixed"!=t.getMode().name||"css"!=u.mode.name)return e.Pass;h=a+"style"}else{if(!d.context||!d.context.tagName||o(t,d.context.tagName,s,d))return e.Pass;h=a+d.context.tagName}">"!=t.getLine(s.line).charAt(c.end)&&(h+=">"),i[l]=h}t.replaceSelections(i),n=t.listSelections();for(var l=0;l<n.length;l++)(l==n.length-1||n[l].head.line<n[l+1].head.line)&&t.indentLine(n[l].head.line)}function n(t){return t.getOption("disableInput")?e.Pass:r(t,!0)}function i(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;++r)if(e[r]==t)return r;return-1}function o(t,r,n,i,o){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,n.line+500),l=e.scanForClosingTag(t,n,null,a);if(!l||l.tag!=r)return!1;for(var s=i.context,c=o?1:0;s&&s.tagName==r;s=s.prev)++c;n=l.to;for(var u=1;u<c;u++){var d=e.scanForClosingTag(t,n,null,a);if(!d||d.tag!=r)return!1;n=d.to}return!0}e.defineOption("autoCloseTags",!1,function(r,i,o){if(o!=e.Init&&o&&r.removeKeyMap("autoCloseTags"),i){var a={name:"autoCloseTags"};("object"!=typeof i||i.whenClosing)&&(a["'/'"]=function(e){return n(e)}),("object"!=typeof i||i.whenOpening)&&(a["'>'"]=function(e){return t(e)}),r.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],l=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return r(e)}})},{"../../lib/codemirror":17,"../fold/xml-fold":16}],15:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror"),e("../fold/xml-fold")):"function"==typeof t&&t.amd?t(["../../lib/codemirror","../fold/xml-fold"],i):i(CodeMirror)}(function(e){"use strict";function t(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function r(r){r.state.failedTagMatch=!1,r.operation(function(){if(t(r),!r.somethingSelected()){var n=r.getCursor(),i=r.getViewport();i.from=Math.min(i.from,n.line),i.to=Math.max(n.line+1,i.to);var o=e.findMatchingTag(r,n,i);if(o){if(r.state.matchBothTags){var a="open"==o.at?o.open:o.close;a&&(r.state.tagHit=r.markText(a.from,a.to,{className:"CodeMirror-matchingtag"}))}var l="close"==o.at?o.open:o.close;l?r.state.tagOther=r.markText(l.from,l.to,{className:"CodeMirror-matchingtag"}):r.state.failedTagMatch=!0}}})}function n(e){e.state.failedTagMatch&&r(e)}e.defineOption("matchTags",!1,function(i,o,a){a&&a!=e.Init&&(i.off("cursorActivity",r),i.off("viewportChange",n),t(i)),o&&(i.state.matchBothTags="object"==typeof o&&o.bothTags,i.on("cursorActivity",r),i.on("viewportChange",n),r(i))}),e.commands.toMatchingTag=function(t){var r=e.findMatchingTag(t,t.getCursor());if(r){var n="close"==r.at?r.open:r.close;n&&t.extendSelection(n.to,n.from)}}})},{"../../lib/codemirror":17,"../fold/xml-fold":16}],16:[function(e,r,n){!function(i){"object"==typeof n&&"object"==typeof r?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)}(function(e){"use strict";
|
2 |
function t(e,t){return e.line-t.line||e.ch-t.ch}function r(e,t,r,n){this.line=t,this.ch=r,this.cm=e,this.text=e.getLine(t),this.min=n?n.from:e.firstLine(),this.max=n?n.to-1:e.lastLine()}function n(e,t){var r=e.cm.getTokenTypeAt(h(e.line,t));return r&&/\btag\b/.test(r)}function i(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function o(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function a(e){for(;;){var t=e.text.indexOf(">",e.ch);if(t==-1){if(i(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),o=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,o?"selfClose":"regular"}e.ch=t+1}}}function l(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(t==-1){if(o(e))continue;return}if(n(e,t+1)){g.lastIndex=t,e.ch=t;var r=g.exec(e.text);if(r&&r.index==t)return r}else e.ch=t}}function s(e){for(;;){g.lastIndex=e.ch;var t=g.exec(e.text);if(!t){if(i(e))continue;return}{if(n(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(t==-1){if(o(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),i=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,i?"selfClose":"regular"}e.ch=t}}}function u(e,t){for(var r=[];;){var n,i=s(e),o=e.line,l=e.ch-(i?i[0].length:0);if(!i||!(n=a(e)))return;if("selfClose"!=n)if(i[1]){for(var c=r.length-1;c>=0;--c)if(r[c]==i[2]){r.length=c;break}if(c<0&&(!t||t==i[2]))return{tag:i[2],from:h(o,l),to:h(e.line,e.ch)}}else r.push(i[2])}}function d(e,t){for(var r=[];;){var n=c(e);if(!n)return;if("selfClose"!=n){var i=e.line,o=e.ch,a=l(e);if(!a)return;if(a[1])r.push(a[2]);else{for(var s=r.length-1;s>=0;--s)if(r[s]==a[2]){r.length=s;break}if(s<0&&(!t||t==a[2]))return{tag:a[2],from:h(e.line,e.ch),to:h(i,o)}}}else l(e)}}var h=e.Pos,f="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",p=f+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",g=new RegExp("<(/?)(["+f+"]["+p+"]*)","g");e.registerHelper("fold","xml",function(e,t){for(var n=new r(e,t.line,0);;){var i,o=s(n);if(!o||n.line!=t.line||!(i=a(n)))return;if(!o[1]&&"selfClose"!=i){var l=h(n.line,n.ch),c=u(n,o[2]);return c&&{from:l,to:c.from}}}}),e.findMatchingTag=function(e,n,i){var o=new r(e,n.line,n.ch,i);if(o.text.indexOf(">")!=-1||o.text.indexOf("<")!=-1){var s=a(o),c=s&&h(o.line,o.ch),f=s&&l(o);if(s&&f&&!(t(o,n)>0)){var p={from:h(o.line,o.ch),to:c,tag:f[2]};return"selfClose"==s?{open:p,close:null,at:"open"}:f[1]?{open:d(o,f[2]),close:p,at:"close"}:(o=new r(e,c.line,c.ch,i),{open:p,close:u(o,f[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,n){for(var i=new r(e,t.line,t.ch,n);;){var o=d(i);if(!o)break;var a=new r(e,t.line,t.ch,n),l=u(a,o.tag);if(l)return{open:o,close:l}}},e.scanForClosingTag=function(e,t,n,i){var o=new r(e,t.line,t.ch,i?{from:0,to:i}:null);return u(o,n)}})},{"../../lib/codemirror":17}],17:[function(e,r,n){!function(e){if("object"==typeof n&&"object"==typeof r)r.exports=e();else{if("function"==typeof t&&t.amd)return t([],e);(this||window).CodeMirror=e()}}(function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n?Hi(n):{},Hi(ta,n,!1),f(n);var i=n.value;"string"==typeof i&&(i=new Ta(i,n.mode,null,n.lineSeparator)),this.doc=i;var o=new e.inputStyles[n.inputStyle](this),a=this.display=new t(r,i,o);a.wrapper.CodeMirror=this,c(this),l(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!Oo&&a.input.focus(),v(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Ni,keySeq:null,specialChars:null};var s=this;wo&&xo<11&&setTimeout(function(){s.display.input.reset(!0)},20),qt(this),Xi(),xt(this),this.curOp.forceUpdate=!0,Zn(this,i),n.autofocus&&!Oo||s.hasFocus()?setTimeout(Fi(vr,this),20):yr(this);for(var u in ra)ra.hasOwnProperty(u)&&ra[u](this,n[u],na);k(this),n.finishInit&&n.finishInit(this);for(var d=0;d<la.length;++d)la[d](this);Ct(this),ko&&n.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function t(e,t,r){var n=this;this.input=r,n.scrollbarFiller=qi("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=qi("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=qi("div",null,"CodeMirror-code"),n.selectionDiv=qi("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=qi("div",null,"CodeMirror-cursors"),n.measure=qi("div",null,"CodeMirror-measure"),n.lineMeasure=qi("div",null,"CodeMirror-measure"),n.lineSpace=qi("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none"),n.mover=qi("div",[qi("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative"),n.sizer=qi("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=qi("div",null,null,"position: absolute; height: "+Da+"px; width: 1px;"),n.gutters=qi("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=qi("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=qi("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),wo&&xo<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),ko||vo&&Oo||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Fe(e,100),e.state.modeGen++,e.curOp&&Dt(e)}function i(e){e.options.lineWrapping?(Ja(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Qa(e.display.wrapper,"CodeMirror-wrap"),h(e)),a(e),Dt(e),st(e),setTimeout(function(){y(e)},100)}function o(e){var t=bt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/wt(e.display)-3);return function(i){if(Cn(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function a(e){var t=e.doc,r=o(e);t.iter(function(e){var t=r(e);t!=e.height&&ti(e,t)})}function l(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),st(e)}function s(e){c(e),Dt(e),setTimeout(function(){x(e)},20)}function c(e){var t=e.display.gutters,r=e.options.gutters;Ki(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(qi("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",u(e)}function u(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function d(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=mn(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=vn(n);){var i=t.find(0,!0);r-=n.text.length-i.from.ch,n=i.to.line,r+=n.text.length-i.to.ch}return r}function h(e){var t=e.display,r=e.doc;t.maxLine=Qn(r,r.first),t.maxLineLength=d(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=d(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function f(e){var t=zi(e.gutters,"CodeMirror-linenumbers");t==-1&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function p(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Ke(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Ge(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function g(e,t,r){this.cm=r;var n=this.vert=qi("div",[qi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=qi("div",[qi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),Na(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Na(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,wo&&xo<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function m(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Qa(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Na(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?or(t,e):ir(t,e)},t),t.display.scrollbars.addClass&&Ja(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=p(e));var r=e.display.barWidth,n=e.display.barHeight;b(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&N(e),b(e,p(e)),r=e.display.barWidth,n=e.display.barHeight}function b(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function w(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-qe(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=ni(t,n),a=ni(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;l<o?(o=l,a=ni(t,ii(Qn(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=ni(t,ii(Qn(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function x(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=S(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&r[a].gutter&&(r[a].gutter.style.left=o);var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function k(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=C(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(qi("div",[qi("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a)+1,n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",u(e),!0}return!1}function C(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function S(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function T(e,t,r){var n=e.display;this.viewport=t,this.visible=w(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Ve(e),this.force=r,this.dims=E(e),this.events=[]}function L(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ge(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ge(e)+"px",t.scrollbarsClipped=!0)}function M(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Ht(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Bt(e))return!1;k(e)&&(Ht(e),t.dims=E(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>a&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),Ho&&(o=xn(e.doc,o),a=kn(e.doc,a));var l=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Rt(e,o,a),r.viewOffset=ii(Qn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var s=Bt(e);if(!l&&0==s&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=Gi();return s>4&&(r.lineDiv.style.display="none"),z(e,r.updateLineNumbers,t.dims),s>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,c&&Gi()!=c&&c.offsetHeight&&c.focus(),Ki(r.cursorDiv),Ki(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,l&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Fe(e,400)),r.updateLineNumbers=null,!0}function _(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Ve(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Ke(e.display)-$e(e),r.top)}),t.visible=w(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&M(e,t);n=!1){N(e);var i=p(e);ze(e),y(e,i),O(e,i)}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var r=new T(e,t);if(M(e,r)){N(e),_(e,r);var n=p(e);ze(e),y(e,n),O(e,n),r.finish()}}function O(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ge(e)+"px"}function N(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i,o=t.view[n];if(!o.hidden){if(wo&&xo<8){var a=o.node.offsetTop+o.node.offsetHeight;i=a-r,r=a}else{var l=o.node.getBoundingClientRect();i=l.bottom-l.top}var s=o.line.height-i;if(i<2&&(i=bt(t)),(s>.001||s<-.001)&&(ti(o.line,i),W(o.line),o.rest))for(var c=0;c<o.rest.length;c++)W(o.rest[c])}}}function W(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.parentNode.offsetHeight}function E(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a)r[e.options.gutters[a]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[a]]=o.clientWidth;return{fixedPos:S(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function z(e,t,r){function n(t){var r=t.nextSibling;return ko&&No&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var i=e.display,o=e.options.lineNumbers,a=i.lineDiv,l=a.firstChild,s=i.view,c=i.viewFrom,u=0;u<s.length;u++){var d=s[u];if(d.hidden);else if(d.node&&d.node.parentNode==a){for(;l!=d.node;)l=n(l);var h=o&&null!=t&&t<=c&&d.lineNumber;d.changes&&(zi(d.changes,"gutter")>-1&&(h=!1),P(e,d,c,r)),h&&(Ki(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(C(e.options,c)))),l=d.node.nextSibling}else{var f=q(e,d,c,r);a.insertBefore(f,l)}c+=d.size}for(;l;)l=n(l)}function P(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?F(e,t):"gutter"==o?R(e,t,r,n):"class"==o?j(t):"widget"==o&&B(e,t,n)}t.changes=null}function D(e){return e.node==e.text&&(e.node=qi("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),wo&&xo<8&&(e.node.style.zIndex=2)),e.node}function I(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=D(e);e.background=r.insertBefore(qi("div",null,t),r.firstChild)}}function H(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Fn(e,t)}function F(e,t){var r=t.text.className,n=H(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,j(t)):r&&(t.text.className=r)}function j(e){I(e),e.line.wrapClass?D(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function R(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=D(t);t.gutterBackground=qi("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var i=D(t),a=t.gutter=qi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),i.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(qi("div",C(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var l=0;l<e.options.gutters.length;++l){var s=e.options.gutters[l],c=o.hasOwnProperty(s)&&o[s];c&&a.appendChild(qi("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[s]+"px; width: "+n.gutterWidth[s]+"px"))}}}function B(e,t,r){t.alignable&&(t.alignable=null);for(var n,i=t.node.firstChild;i;i=n){var n=i.nextSibling;"CodeMirror-linewidget"==i.className&&t.node.removeChild(i)}K(e,t,r)}function q(e,t,r,n){var i=H(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),j(t),R(e,t,r,n),K(e,t,n),t.node}function K(e,t,r){if(U(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)U(e,t.rest[n],t,r,!1)}function U(e,t,r,n,i){if(t.widgets)for(var o=D(r),a=0,l=t.widgets;a<l.length;++a){var s=l[a],c=qi("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),G(s,c,r,n),e.display.input.setUneditable(c),i&&s.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),Ti(s,"redraw")}}function G(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function V(e){return Fo(e.line,e.ch)}function $(e,t){return jo(e,t)<0?t:e}function Y(e,t){return jo(e,t)<0?e:t}function X(e){e.state.focused||(e.display.input.focus(),vr(e))}function Z(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var a=e.state.pasteIncoming||"paste"==i,l=o.splitLines(t),s=null;if(a&&n.ranges.length>1)if(Ro&&Ro.text.join("\n")==t){if(n.ranges.length%Ro.text.length==0){s=[];for(var c=0;c<Ro.text.length;c++)s.push(o.splitLines(Ro.text[c]))}}else l.length==n.ranges.length&&(s=Pi(l,function(e){return[e]}));for(var c=n.ranges.length-1;c>=0;c--){var u=n.ranges[c],d=u.from(),h=u.to();u.empty()&&(r&&r>0?d=Fo(d.line,d.ch-r):e.state.overwrite&&!a?h=Fo(h.line,Math.min(Qn(o,h.line).text.length,h.ch+Ei(l).length)):Ro&&Ro.lineWise&&Ro.text.join("\n")==t&&(d=h=Fo(d.line,0)));var f=e.curOp.updateInput,p={from:d,to:h,text:s?s[c%s.length]:l,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Lr(e.doc,p),Ti(e,"inputRead",e,p)}t&&!a&&J(e,t),Hr(e),e.curOp.updateInput=f,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Q(e,t){var r=e.clipboardData&&e.clipboardData.getData("text/plain");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Ot(t,function(){Z(t,r,0,null,"paste")}),!0}function J(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){a=jr(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Qn(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=jr(e,i.head.line,"smart"));a&&Ti(e,"electricInput",e,i.head.line)}}}function ee(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:Fo(i,0),head:Fo(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function te(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function re(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Ni,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function ne(){var e=qi("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=qi("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return ko?e.style.width="1000px":e.setAttribute("wrap","off"),Ao&&(e.style.border="1px solid black"),te(e),t}function ie(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Ni,this.gracePeriod=!1}function oe(e,t){var r=Je(e,t.line);if(!r||r.hidden)return null;var n=Qn(e.doc,t.line),i=Xe(r,n,t.line),o=oi(n),a="left";if(o){var l=uo(o,t.ch);a=l%2?"right":"left"}var s=rt(i.map,t.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function ae(e,t){return t&&(e.bad=!0),e}function le(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return ae(e.clipPos(Fo(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return se(o,t,r)}}function se(e,t,r){function n(t,r,n){for(var i=-1;i<(u?u.length:0);i++)for(var o=i<0?c.map:u[i],a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==r){var s=ri(i<0?e.line:e.rest[i]),d=o[a]+n;return(n<0||l!=t)&&(d=o[a+(n?1:0)]),Fo(s,d)}}}var i=e.text.firstChild,o=!1;if(!t||!Ya(i,t))return ae(Fo(ri(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var a=e.rest?Ei(e.rest):e.line;return ae(Fo(ri(a),a.text.length),o)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,r&&(r=l.nodeValue.length));s.parentNode!=i;)s=s.parentNode;var c=e.measure,u=c.maps,d=n(l,s,r);if(d)return ae(d,o);for(var h=s.nextSibling,f=l?l.nodeValue.length-r:0;h;h=h.nextSibling){if(d=n(h,h.firstChild,0))return ae(Fo(d.line,d.ch-f),o);f+=h.textContent.length}for(var p=s.previousSibling,f=r;p;p=p.previousSibling){if(d=n(p,p.firstChild,-1))return ae(Fo(d.line,d.ch+f),o);f+=h.textContent.length}}function ce(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return""==r&&(r=t.textContent.replace(/\u200b/g,"")),void(l+=r);var u,d=t.getAttribute("cm-marker");if(d){var h=e.findMarks(Fo(n,0),Fo(i+1,0),o(+d));return void(h.length&&(u=h[0].find())&&(l+=Jn(e.doc,u.from,u.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;for(var f=0;f<t.childNodes.length;f++)a(t.childNodes[f]);/^(pre|div|p)$/i.test(t.nodeName)&&(s=!0)}else if(3==t.nodeType){var p=t.nodeValue;if(!p)return;s&&(l+=c,s=!1),l+=p}}for(var l="",s=!1,c=e.doc.lineSeparator();a(t),t!=r;)t=t.nextSibling;return l}function ue(e,t){this.ranges=e,this.primIndex=t}function de(e,t){this.anchor=e,this.head=t}function he(e,t){var r=e[t];e.sort(function(e,t){return jo(e.from(),t.from())}),t=zi(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(jo(o.to(),i.from())>=0){var a=Y(o.from(),i.from()),l=$(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;n<=t&&--t,e.splice(--n,2,new de(s?l:a,s?a:l))}}return new ue(e,t)}function fe(e,t){return new ue([new de(e,t||e)],0)}function pe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ge(e,t){if(t.line<e.first)return Fo(e.first,0);var r=e.first+e.size-1;return t.line>r?Fo(r,Qn(e,r).text.length):me(t,Qn(e,t.line).text.length)}function me(e,t){var r=e.ch;return null==r||r>t?Fo(e.line,t):r<0?Fo(e.line,0):e}function ve(e,t){return t>=e.first&&t<e.first+e.size}function ye(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=ge(e,t[n]);return r}function be(e,t,r,n){if(e.cm&&e.cm.display.shift||e.extend){var i=t.anchor;if(n){var o=jo(r,i)<0;o!=jo(n,i)<0?(i=r,r=n):o!=jo(r,n)<0&&(r=n)}return new de(i,r)}return new de(n||r,r)}function we(e,t,r,n){Le(e,new ue([be(e,e.sel.primary(),t,r)],0),n)}function xe(e,t,r){for(var n=[],i=0;i<e.sel.ranges.length;i++)n[i]=be(e,e.sel.ranges[i],t[i],null);var o=he(n,e.sel.primIndex);Le(e,o,r)}function ke(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Le(e,he(i,e.sel.primIndex),n)}function Ce(e,t,r,n){Le(e,fe(t,r),n)}function Se(e,t,r){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new de(ge(e,t[r].anchor),ge(e,t[r].head))},origin:r&&r.origin};return za(e,"beforeSelectionChange",e,n),e.cm&&za(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?he(n.ranges,n.ranges.length-1):t}function Te(e,t,r){var n=e.history.done,i=Ei(n);i&&i.ranges?(n[n.length-1]=t,Me(e,t,r)):Le(e,t,r)}function Le(e,t,r){Me(e,t,r),hi(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Me(e,t,r){(Ai(e,"beforeSelectionChange")||e.cm&&Ai(e.cm,"beforeSelectionChange"))&&(t=Se(e,t,r));var n=r&&r.bias||(jo(t.primary().head,e.sel.primary().head)<0?-1:1);_e(e,Oe(e,t,n,!0)),r&&r.scroll===!1||!e.cm||Hr(e.cm)}function _e(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,_i(e.cm)),Ti(e,"cursorActivity",e))}function Ae(e){_e(e,Oe(e,e.sel,null,!1),Ha)}function Oe(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=We(e,a.anchor,l&&l.anchor,r,n),c=We(e,a.head,l&&l.head,r,n);(i||s!=a.anchor||c!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new de(s,c))}return i?he(i,t.primIndex):t}function Ne(e,t,r,n,i){var o=Qn(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker;if((null==l.from||(s.inclusiveLeft?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(s.inclusiveRight?l.to>=t.ch:l.to>t.ch))){if(i&&(za(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(r){var c,u=s.find(n<0?1:-1);if((n<0?s.inclusiveRight:s.inclusiveLeft)&&(u=Ee(e,u,-n,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=jo(u,r))&&(n<0?c<0:c>0))return Ne(e,u,t,n,i)}var d=s.find(n<0?-1:1);return(n<0?s.inclusiveLeft:s.inclusiveRight)&&(d=Ee(e,d,n,d.line==t.line?o:null)),d?Ne(e,d,t,n,i):null}}return t}function We(e,t,r,n,i){var o=n||1,a=Ne(e,t,r,o,i)||!i&&Ne(e,t,r,o,!0)||Ne(e,t,r,-o,i)||!i&&Ne(e,t,r,-o,!0);return a?a:(e.cantEdit=!0,Fo(e.first,0))}function Ee(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?ge(e,Fo(t.line-1)):null:r>0&&t.ch==(n||Qn(e,t.line)).text.length?t.line<e.first+e.size-1?Fo(t.line+1,0):null:new Fo(t.line,t.ch+r)}function ze(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Pe(e,t){for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),a=0;a<r.sel.ranges.length;a++)if(t!==!1||a!=r.sel.primIndex){var l=r.sel.ranges[a];if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var s=l.empty();(s||e.options.showCursorWhenSelecting)&&De(e,l.head,i),s||Ie(e,l,o)}}return n}function De(e,t,r){var n=pt(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(qi("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(qi("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function Ie(e,t,r){function n(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),l.appendChild(qi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?u-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return ft(e,Fo(t,r),"div",d,n)}var l,s,d=Qn(a,t),h=d.text.length;return to(oi(d),r||0,null==i?h:i,function(e,t,a){var d,f,p,g=o(e,"left");if(e==t)d=g,f=p=g.left;else{if(d=o(t-1,"right"),"rtl"==a){var m=g;g=d,d=m}f=g.left,p=d.right}null==r&&0==e&&(f=c),d.top-g.top>3&&(n(f,g.top,null,g.bottom),f=c,g.bottom<d.top&&n(f,g.bottom,null,d.top)),null==i&&t==h&&(p=u),(!l||g.top<l.top||g.top==l.top&&g.left<l.left)&&(l=g),(!s||d.bottom>s.bottom||d.bottom==s.bottom&&d.right>s.right)&&(s=d),f<c+1&&(f=c),n(f,d.top,p-f,d.bottom)}),{start:l,end:s}}var o=e.display,a=e.doc,l=document.createDocumentFragment(),s=Ue(e.display),c=s.left,u=Math.max(o.sizerWidth,Ve(e)-o.sizer.offsetLeft)-s.right,d=t.from(),h=t.to();if(d.line==h.line)i(d.line,d.ch,h.ch);else{var f=Qn(a,d.line),p=Qn(a,h.line),g=bn(f)==bn(p),m=i(d.line,d.ch,g?f.text.length+1:null).end,v=i(h.line,g?0:null,h.ch).start;g&&(m.top<v.top-2?(n(m.right,m.top,null,m.bottom),n(c,v.top,v.left,v.bottom)):n(m.right,m.top,v.left-m.right,m.bottom)),m.bottom<v.top&&n(c,m.bottom,null,v.top)}r.appendChild(l)}function He(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Fe(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Fi(je,e))}function je(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=ca(t.mode,Be(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength,s=Pn(e,o,l?ca(t.mode,n):n,!0);o.styles=s.styles;var c=o.styleClasses,u=s.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),h=0;!d&&h<a.length;++h)d=a[h]!=o.styles[h];d&&i.push(t.frontier),o.stateAfter=l?n:ca(t.mode,n)}else o.text.length<=e.options.maxHighlightLength&&In(e,o.text,n),o.stateAfter=t.frontier%5==0?ca(t.mode,n):null;if(++t.frontier,
|
3 |
+new Date>r)return Fe(e,e.options.workDelay),!0}),i.length&&Ot(e,function(){for(var t=0;t<i.length;t++)It(e,i[t],"text")})}}function Re(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=Qn(o,l-1);if(s.stateAfter&&(!r||l<=o.frontier))return l;var c=Ra(s.text,null,e.options.tabSize);(null==i||n>c)&&(i=l-1,n=c)}return i}function Be(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=Re(e,t,r),a=o>n.first&&Qn(n,o-1).stateAfter;return a=a?ca(n.mode,a):ua(n.mode),n.iter(o,t,function(r){In(e,r.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;r.stateAfter=l?ca(n.mode,a):null,++o}),r&&(n.frontier=o),a}function qe(e){return e.lineSpace.offsetTop}function Ke(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ue(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Ui(e.measure,qi("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Ge(e){return Da-e.display.nativeBarWidth}function Ve(e){return e.display.scroller.clientWidth-Ge(e)-e.display.barWidth}function $e(e){return e.display.scroller.clientHeight-Ge(e)-e.display.barHeight}function Ye(e,t,r){var n=e.options.lineWrapping,i=n&&Ve(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],c=a[l+1];Math.abs(s.bottom-c.bottom)>2&&o.push((s.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Xe(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var n=0;n<e.rest.length;n++)if(ri(e.rest[n])>r)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Ze(e,t){t=bn(t);var r=ri(t),n=e.display.externalMeasured=new zt(e.doc,t,r);n.lineN=r;var i=n.built=Fn(e,n);return n.text=i.pre,Ui(e.display.lineMeasure,i.pre),n}function Qe(e,t,r,n){return tt(e,et(e,t),r,n)}function Je(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ft(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function et(e,t){var r=ri(t),n=Je(e,r);n&&!n.text?n=null:n&&n.changes&&(P(e,n,r,E(e)),e.curOp.forceUpdate=!0),n||(n=Ze(e,t));var i=Xe(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function tt(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ye(e,t.view,t.rect),t.hasHeights=!0),o=it(e,t,r,n),o.bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function rt(e,t,r){for(var n,i,o,a,l=0;l<e.length;l+=3){var s=e[l],c=e[l+1];if(t<s?(i=0,o=1,a="left"):t<c?(i=t-s,o=i+1):(l==e.length-3||t==c&&e[l+3]>t)&&(o=c-s,i=o-1,t>=c&&(a="right")),null!=i){if(n=e[l+2],s==c&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;l&&e[l-2]==e[l-3]&&e[l-1].insertLeft;)n=e[(l-=3)+2],a="left";if("right"==r&&i==c-s)for(;l<e.length-3&&e[l+3]==e[l+4]&&!e[l+5].insertLeft;)n=e[(l+=3)+2],a="right";break}}return{node:n,start:i,end:o,collapse:a,coverStart:s,coverEnd:c}}function nt(e,t){var r=Uo;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var n=e.length-1;n>=0&&(r=e[n]).left==r.right;n--);return r}function it(e,t,r,n){var i,o=rt(t.map,r,n),a=o.node,l=o.start,s=o.end,c=o.collapse;if(3==a.nodeType){for(var u=0;u<4;u++){for(;l&&Bi(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+s<o.coverEnd&&Bi(t.line.text.charAt(o.coverStart+s));)++s;if(i=wo&&xo<9&&0==l&&s==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():nt(Ua(a,l,s).getClientRects(),n),i.left||i.right||0==l)break;s=l,l-=1,c="right"}wo&&xo<11&&(i=ot(e.display.measure,i))}else{l>0&&(c=n="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(wo&&xo<9&&!l&&(!i||!i.left&&!i.right)){var h=a.parentNode.getClientRects()[0];i=h?{left:h.left,right:h.left+wt(e.display),top:h.top,bottom:h.bottom}:Uo}for(var f=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(f+p)/2,m=t.view.measure.heights,u=0;u<m.length-1&&!(g<m[u]);u++);var v=u?m[u-1]:0,y=m[u],b={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:v,bottom:y};return i.left||i.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=f,b.rbottom=p),b}function ot(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!eo(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function at(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function lt(e){e.display.externalMeasure=null,Ki(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)at(e.display.view[t])}function st(e){lt(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ct(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ut(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function dt(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=Ln(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=ii(t);if("local"==n?a+=qe(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:ut());var s=l.left+("window"==n?0:ct());r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function ht(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=ct(),i-=ut();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function ft(e,t,r,n,i){return n||(n=Qn(e.doc,t.line)),dt(e,n,Qe(e,n,t.ch,i),r)}function pt(e,t,r,n,i,o){function a(t,a){var l=tt(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,dt(e,n,l,r)}function l(e,t){var r=s[t],n=r.level%2;return e==ro(r)&&t&&r.level<s[t-1].level?(r=s[--t],e=no(r)-(r.level%2?0:1),n=!0):e==no(r)&&t<s.length-1&&r.level<s[t+1].level&&(r=s[++t],e=ro(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?a(e-1):a(e,n)}n=n||Qn(e.doc,t.line),i||(i=et(e,n));var s=oi(n),c=t.ch;if(!s)return a(c);var u=uo(s,c),d=l(c,u);return null!=ll&&(d.other=l(c,ll)),d}function gt(e,t){var r=0,t=ge(e.doc,t);e.options.lineWrapping||(r=wt(e.display)*t.ch);var n=Qn(e.doc,t.line),i=ii(n)+qe(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function mt(e,t,r,n){var i=Fo(e,t);return i.xRel=n,r&&(i.outside=!0),i}function vt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return mt(n.first,0,!0,-1);var i=ni(n,r),o=n.first+n.size-1;if(i>o)return mt(n.first+n.size-1,Qn(n,o).text.length,!0,1);t<0&&(t=0);for(var a=Qn(n,i);;){var l=yt(e,a,i,t,r),s=vn(a),c=s&&s.find(0,!0);if(!s||!(l.ch>c.from.ch||l.ch==c.from.ch&&l.xRel>0))return l;i=ri(a=c.to.line)}}function yt(e,t,r,n,i){function o(n){var i=pt(e,Fo(r,n),"line",t,c);return l=!0,a>i.bottom?i.left-s:a<i.top?i.left+s:(l=!1,i.left)}var a=i-ii(t),l=!1,s=2*e.display.wrapper.clientWidth,c=et(e,t),u=oi(t),d=t.text.length,h=io(t),f=oo(t),p=o(h),g=l,m=o(f),v=l;if(n>m)return mt(r,f,v,1);for(;;){if(u?f==h||f==fo(t,h,1):f-h<=1){var y=n<p||n-p<=m-n?h:f,b=y==h?g:v,w=n-(y==h?p:m);if(v&&!u&&!/\s/.test(t.text.charAt(y))&&w>0&&y<t.text.length&&c.view.measure.heights.length>1){var x=tt(e,c,y,"right");a<=x.bottom&&a>=x.top&&Math.abs(n-x.right)<w&&(b=!1,y++,w=n-x.right)}for(;Bi(t.text.charAt(y));)++y;var k=mt(r,y,b,w<-1?-1:w>1?1:0);return k}var C=Math.ceil(d/2),S=h+C;if(u){S=h;for(var T=0;T<C;++T)S=fo(t,S,1)}var L=o(S);L>n?(f=S,m=L,(v=l)&&(m+=1e3),d=C):(h=S,p=L,g=l,d-=C)}}function bt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Bo){Bo=qi("pre");for(var t=0;t<49;++t)Bo.appendChild(document.createTextNode("x")),Bo.appendChild(qi("br"));Bo.appendChild(document.createTextNode("x"))}Ui(e.measure,Bo);var r=Bo.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),Ki(e.measure),r||1}function wt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=qi("span","xxxxxxxxxx"),r=qi("pre",[t]);Ui(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function xt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Vo},Go?Go.ops.push(e.curOp):e.curOp.ownsGroup=Go={ops:[e.curOp],delayedCallbacks:[]}}function kt(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}function Ct(e){var t=e.curOp,r=t.ownsGroup;if(r)try{kt(r)}finally{Go=null;for(var n=0;n<r.ops.length;n++)r.ops[n].cm.curOp=null;St(r)}}function St(e){for(var t=e.ops,r=0;r<t.length;r++)Tt(t[r]);for(var r=0;r<t.length;r++)Lt(t[r]);for(var r=0;r<t.length;r++)Mt(t[r]);for(var r=0;r<t.length;r++)_t(t[r]);for(var r=0;r<t.length;r++)At(t[r])}function Tt(e){var t=e.cm,r=t.display;L(t),e.updateMaxLine&&h(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new T(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Lt(e){e.updatedDisplay=e.mustUpdate&&M(e.cm,e.update)}function Mt(e){var t=e.cm,r=t.display;e.updatedDisplay&&N(t),e.barMeasure=p(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Qe(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Ge(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ve(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection(e.focus))}function _t(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&or(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==Gi()&&(!document.hasFocus||document.hasFocus());e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.updatedDisplay&&O(t,e.barMeasure),e.selectionChanged&&He(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&X(e.cm)}function At(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&_(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null==e.scrollTop||r.scroller.scrollTop==e.scrollTop&&!e.forceScroll||(n.scrollTop=Math.max(0,Math.min(r.scroller.scrollHeight-r.scroller.clientHeight,e.scrollTop)),r.scrollbars.setScrollTop(n.scrollTop),r.scroller.scrollTop=n.scrollTop),null==e.scrollLeft||r.scroller.scrollLeft==e.scrollLeft&&!e.forceScroll||(n.scrollLeft=Math.max(0,Math.min(r.scroller.scrollWidth-r.scroller.clientWidth,e.scrollLeft)),r.scrollbars.setScrollLeft(n.scrollLeft),r.scroller.scrollLeft=n.scrollLeft,x(t)),e.scrollToPos){var i=zr(t,ge(n,e.scrollToPos.from),ge(n,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&Er(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var l=0;l<o.length;++l)o[l].lines.length||za(o[l],"hide");if(a)for(var l=0;l<a.length;++l)a[l].lines.length&&za(a[l],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&za(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ot(e,t){if(e.curOp)return t();xt(e);try{return t()}finally{Ct(e)}}function Nt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);xt(e);try{return t.apply(e,arguments)}finally{Ct(e)}}}function Wt(e){return function(){if(this.curOp)return e.apply(this,arguments);xt(this);try{return e.apply(this,arguments)}finally{Ct(this)}}}function Et(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);xt(t);try{return e.apply(this,arguments)}finally{Ct(t)}}}function zt(e,t,r){this.line=t,this.rest=wn(t),this.size=this.rest?ri(Ei(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Cn(e,t)}function Pt(e,t,r){for(var n,i=[],o=t;o<r;o=n){var a=new zt(e.doc,Qn(e.doc,o),o);n=o+a.size,i.push(a)}return i}function Dt(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ho&&xn(e.doc,t)<i.viewTo&&Ht(e);else if(r<=i.viewFrom)Ho&&kn(e.doc,r+n)>i.viewFrom?Ht(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Ht(e);else if(t<=i.viewFrom){var o=jt(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):Ht(e)}else if(r>=i.viewTo){var o=jt(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):Ht(e)}else{var a=jt(e,t,t,-1),l=jt(e,r,r+n,1);a&&l?(i.view=i.view.slice(0,a.index).concat(Pt(e,a.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=n):Ht(e)}var s=i.externalMeasured;s&&(r<s.lineN?s.lineN+=n:t<s.lineN+s.size&&(i.externalMeasured=null))}function It(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[Ft(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);zi(a,r)==-1&&a.push(r)}}}function Ht(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ft(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,t<0)return n}function jt(e,t,r,n){var i,o=Ft(e,t),a=e.display.view;if(!Ho||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var l=0,s=e.display.viewFrom;l<o;l++)s+=a[l].size;if(s!=t){if(n>0){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;xn(e.doc,r)!=r;){if(o==(n<0?0:a.length-1))return null;r+=n*a[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function Rt(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=Pt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=Pt(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Ft(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(Pt(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,Ft(e,r)))),n.viewTo=r}function Bt(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function qt(e){function t(){i.activeTouch&&(o=setTimeout(function(){i.activeTouch=null},1e3),a=i.activeTouch,a.end=+new Date)}function r(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function n(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}var i=e.display;Na(i.scroller,"mousedown",Nt(e,$t)),wo&&xo<11?Na(i.scroller,"dblclick",Nt(e,function(t){if(!Mi(e,t)){var r=Vt(e,t);if(r&&!Jt(e,t)&&!Gt(e.display,t)){_a(t);var n=e.findWordAt(r);we(e.doc,n.anchor,n.head)}}})):Na(i.scroller,"dblclick",function(t){Mi(e,t)||_a(t)}),Do||Na(i.scroller,"contextmenu",function(t){br(e,t)});var o,a={end:0};Na(i.scroller,"touchstart",function(t){if(!Mi(e,t)&&!r(t)){clearTimeout(o);var n=+new Date;i.activeTouch={start:n,moved:!1,prev:n-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),Na(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Na(i.scroller,"touchend",function(r){var o=i.activeTouch;if(o&&!Gt(i,r)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,l=e.coordsChar(i.activeTouch,"page");a=!o.prev||n(o,o.prev)?new de(l,l):!o.prev.prev||n(o,o.prev.prev)?e.findWordAt(l):new de(Fo(l.line,0),ge(e.doc,Fo(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),_a(r)}t()}),Na(i.scroller,"touchcancel",t),Na(i.scroller,"scroll",function(){i.scroller.clientHeight&&(ir(e,i.scroller.scrollTop),or(e,i.scroller.scrollLeft,!0),za(e,"scroll",e))}),Na(i.scroller,"mousewheel",function(t){ar(e,t)}),Na(i.scroller,"DOMMouseScroll",function(t){ar(e,t)}),Na(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Mi(e,t)||Oa(t)},over:function(t){Mi(e,t)||(rr(e,t),Oa(t))},start:function(t){tr(e,t)},drop:Nt(e,er),leave:function(t){Mi(e,t)||nr(e)}};var l=i.input.getField();Na(l,"keyup",function(t){pr.call(e,t)}),Na(l,"keydown",Nt(e,hr)),Na(l,"keypress",Nt(e,gr)),Na(l,"focus",Fi(vr,e)),Na(l,"blur",Fi(yr,e))}function Kt(t,r,n){var i=n&&n!=e.Init;if(!r!=!i){var o=t.display.dragFunctions,a=r?Na:Ea;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.enter),a(t.display.scroller,"dragover",o.over),a(t.display.scroller,"dragleave",o.leave),a(t.display.scroller,"drop",o.drop)}}function Ut(e){var t=e.display;t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth||(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Gt(e,t){for(var r=ki(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Vt(e,t,r,n){var i=e.display;if(!r&&"true"==ki(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,c=vt(e,o,a);if(n&&1==c.xRel&&(s=Qn(e.doc,c.line).text).length==c.ch){var u=Ra(s,s.length,e.options.tabSize)-s.length;c=Fo(c.line,Math.max(0,Math.round((o-Ue(e.display).left)/wt(e.display))-u))}return c}function $t(e){var t=this,r=t.display;if(!(Mi(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.shift=e.shiftKey,Gt(r,e))return void(ko||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!Jt(t,e)){var n=Vt(t,e);switch(window.focus(),Ci(e)){case 1:t.state.selectingText?t.state.selectingText(e):n?Yt(t,e,n):ki(e)==r.scroller&&_a(e);break;case 2:ko&&(t.state.lastMiddleDown=+new Date),n&&we(t.doc,n),setTimeout(function(){r.input.focus()},20),_a(e);break;case 3:Do?br(t,e):mr(t)}}}}function Yt(e,t,r){wo?setTimeout(Fi(X,e),0):e.curOp.focus=Gi();var n,i=+new Date;Ko&&Ko.time>i-400&&0==jo(Ko.pos,r)?n="triple":qo&&qo.time>i-400&&0==jo(qo.pos,r)?(n="double",Ko={time:i,pos:r}):(n="single",qo={time:i,pos:r});var o,a=e.doc.sel,l=No?t.metaKey:t.ctrlKey;e.options.dragDrop&&tl&&!e.isReadOnly()&&"single"==n&&(o=a.contains(r))>-1&&(jo((o=a.ranges[o]).from(),r)<0||r.xRel>0)&&(jo(o.to(),r)>0||r.xRel<0)?Xt(e,t,r,l):Zt(e,t,r,n,l)}function Xt(e,t,r,n){var i=e.display,o=+new Date,a=Nt(e,function(l){ko&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ea(document,"mouseup",a),Ea(i.scroller,"drop",a),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(_a(l),!n&&+new Date-200<o&&we(e.doc,r),ko||wo&&9==xo?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())});ko&&(i.scroller.draggable=!0),e.state.draggingText=a,a.copy=No?t.altKey:t.ctrlKey,i.scroller.dragDrop&&i.scroller.dragDrop(),Na(document,"mouseup",a),Na(i.scroller,"drop",a)}function Zt(e,t,r,n,i){function o(t){if(0!=jo(m,t))if(m=t,"rect"==n){for(var i=[],o=e.options.tabSize,a=Ra(Qn(c,r.line).text,r.ch,o),l=Ra(Qn(c,t.line).text,t.ch,o),s=Math.min(a,l),f=Math.max(a,l),p=Math.min(r.line,t.line),g=Math.min(e.lastLine(),Math.max(r.line,t.line));p<=g;p++){var v=Qn(c,p).text,y=Ba(v,s,o);s==f?i.push(new de(Fo(p,y),Fo(p,y))):v.length>y&&i.push(new de(Fo(p,y),Fo(p,Ba(v,f,o))))}i.length||i.push(new de(r,r)),Le(c,he(h.ranges.slice(0,d).concat(i),d),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,w=b.anchor,x=t;if("single"!=n){if("double"==n)var k=e.findWordAt(t);else var k=new de(Fo(t.line,0),ge(c,Fo(t.line+1,0)));jo(k.anchor,w)>0?(x=k.head,w=Y(b.from(),k.anchor)):(x=k.anchor,w=$(b.to(),k.head))}var i=h.ranges.slice(0);i[d]=new de(ge(c,w),x),Le(c,he(i,d),Fa)}}function a(t){var r=++y,i=Vt(e,t,!0,"rect"==n);if(i)if(0!=jo(i,m)){e.curOp.focus=Gi(),o(i);var l=w(s,c);(i.line>=l.to||i.line<l.from)&&setTimeout(Nt(e,function(){y==r&&a(t)}),150)}else{var u=t.clientY<v.top?-20:t.clientY>v.bottom?20:0;u&&setTimeout(Nt(e,function(){y==r&&(s.scroller.scrollTop+=u,a(t))}),50)}}function l(t){e.state.selectingText=!1,y=1/0,_a(t),s.input.focus(),Ea(document,"mousemove",b),Ea(document,"mouseup",x),c.history.lastSelOrigin=null}var s=e.display,c=e.doc;_a(t);var u,d,h=c.sel,f=h.ranges;if(i&&!t.shiftKey?(d=c.sel.contains(r),u=d>-1?f[d]:new de(r,r)):(u=c.sel.primary(),d=c.sel.primIndex),Wo?t.shiftKey&&t.metaKey:t.altKey)n="rect",i||(u=new de(r,r)),r=Vt(e,t,!0,!0),d=-1;else if("double"==n){var p=e.findWordAt(r);u=e.display.shift||c.extend?be(c,u,p.anchor,p.head):p}else if("triple"==n){var g=new de(Fo(r.line,0),ge(c,Fo(r.line+1,0)));u=e.display.shift||c.extend?be(c,u,g.anchor,g.head):g}else u=be(c,u,r);i?d==-1?(d=f.length,Le(c,he(f.concat([u]),d),{scroll:!1,origin:"*mouse"})):f.length>1&&f[d].empty()&&"single"==n&&!t.shiftKey?(Le(c,he(f.slice(0,d).concat(f.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),h=c.sel):ke(c,d,u,Fa):(d=0,Le(c,new ue([u],0),Fa),h=c.sel);var m=r,v=s.wrapper.getBoundingClientRect(),y=0,b=Nt(e,function(e){Ci(e)?a(e):l(e)}),x=Nt(e,l);e.state.selectingText=x,Na(document,"mousemove",b),Na(document,"mouseup",x)}function Qt(e,t,r,n){try{var i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&_a(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!Ai(e,r))return xi(t);o-=l.top-a.viewOffset;for(var s=0;s<e.options.gutters.length;++s){var c=a.gutters.childNodes[s];if(c&&c.getBoundingClientRect().right>=i){var u=ni(e.doc,o),d=e.options.gutters[s];return za(e,r,e,u,d,t),xi(t)}}}function Jt(e,t){return Qt(e,t,"gutterClick",!0)}function er(e){var t=this;if(nr(t),!Mi(t,e)&&!Gt(t.display,e)){_a(e),wo&&($o=+new Date);var r=Vt(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,l=function(e,n){if(!t.options.allowDropFileTypes||zi(t.options.allowDropFileTypes,e.type)!=-1){var l=new FileReader;l.onload=Nt(t,function(){var e=l.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++a==i){r=ge(t.doc,r);var s={from:r,to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Lr(t.doc,s),Te(t.doc,fe(r,ea(s)))}}),l.readAsText(e)}},s=0;s<i;++s)l(n[s],s);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!t.state.draggingText.copy)var c=t.listSelections();if(Me(t.doc,fe(r,r)),c)for(var s=0;s<c.length;++s)Wr(t.doc,"",c[s].anchor,c[s].head,"drag");t.replaceSelection(o,"around","paste"),t.display.input.focus()}}catch(e){}}}}function tr(e,t){if(wo&&(!e.state.draggingText||+new Date-$o<100))return void Oa(t);if(!Mi(e,t)&&!Gt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!Lo)){var r=qi("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",To&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),To&&r.parentNode.removeChild(r)}}function rr(e,t){var r=Vt(e,t);if(r){var n=document.createDocumentFragment();De(e,r,n),e.display.dragCursor||(e.display.dragCursor=qi("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Ui(e.display.dragCursor,n)}}function nr(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ir(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,vo||A(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),vo&&A(e),Fe(e,100))}function or(e,t,r){(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,x(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function ar(e,t){var r=Zo(t),n=r.x,i=r.y,o=e.display,a=o.scroller,l=a.scrollWidth>a.clientWidth,s=a.scrollHeight>a.clientHeight;if(n&&l||i&&s){if(i&&No&&ko)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var d=0;d<u.length;d++)if(u[d].node==c){e.display.currentWheelTarget=c;break e}if(n&&!vo&&!To&&null!=Xo)return i&&s&&ir(e,Math.max(0,Math.min(a.scrollTop+i*Xo,a.scrollHeight-a.clientHeight))),or(e,Math.max(0,Math.min(a.scrollLeft+n*Xo,a.scrollWidth-a.clientWidth))),(!i||i&&s)&&_a(t),void(o.wheelStartX=null);if(i&&null!=Xo){var h=i*Xo,f=e.doc.scrollTop,p=f+o.wrapper.clientHeight;h<0?f=Math.max(0,f+h-50):p=Math.min(e.doc.height,p+h+50),A(e,{top:f,bottom:p})}Yo<20&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(Xo=(Xo*Yo+r)/(Yo+1),++Yo)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function lr(e,t,r){if("string"==typeof t&&(t=da[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=Ia}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function sr(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=fa(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&fa(t,e.options.extraKeys,r,e)||fa(t,e.options.keyMap,r,e)}function cr(e,t,r,n){var i=e.state.keySeq;if(i){if(pa(t))return"handled";Qo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),t=i+" "+t}var o=sr(e,t,n);return"multi"==o&&(e.state.keySeq=t),"handled"==o&&Ti(e,"keyHandled",e,t,r),"handled"!=o&&"multi"!=o||(_a(r),He(e)),i&&!o&&/\'$/.test(t)?(_a(r),!0):!!o}function ur(e,t){var r=ga(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?cr(e,"Shift-"+r,t,function(t){return lr(e,t,!0)})||cr(e,r,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return lr(e,t)}):cr(e,r,t,function(t){return lr(e,t)}))}function dr(e,t,r){return cr(e,"'"+r+"'",t,function(t){return lr(e,t,!0)})}function hr(e){var t=this;if(t.curOp.focus=Gi(),!Mi(t,e)){wo&&xo<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=ur(t,e);To&&(Jo=n?r:null,!n&&88==r&&!il&&(No?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||fr(t)}}function fr(e){function t(e){18!=e.keyCode&&e.altKey||(Qa(r,"CodeMirror-crosshair"),Ea(document,"keyup",t),Ea(document,"mouseover",t))}var r=e.display.lineDiv;Ja(r,"CodeMirror-crosshair"),Na(document,"keyup",t),Na(document,"mouseover",t)}function pr(e){16==e.keyCode&&(this.doc.sel.shift=!1),Mi(this,e)}function gr(e){var t=this;if(!(Gt(t.display,e)||Mi(t,e)||e.ctrlKey&&!e.altKey||No&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(To&&r==Jo)return Jo=null,void _a(e);if(!To||e.which&&!(e.which<10)||!ur(t,e)){var i=String.fromCharCode(null==n?r:n);dr(t,e,i)||t.display.input.onKeyPress(e)}}}function mr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,yr(e))},100)}function vr(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(za(e,"focus",e),e.state.focused=!0,Ja(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),ko&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),He(e))}function yr(e){e.state.delayingBlurEvent||(e.state.focused&&(za(e,"blur",e),e.state.focused=!1,Qa(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function br(e,t){Gt(e.display,t)||wr(e,t)||Mi(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function wr(e,t){return!!Ai(e,"gutterContextMenu")&&Qt(e,t,"gutterContextMenu",!1)}function xr(e,t){if(jo(e,t.from)<0)return e;if(jo(e,t.to)<=0)return ea(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=ea(t).ch-t.to.ch),Fo(r,n)}function kr(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new de(xr(i.anchor,t),xr(i.head,t)))}return he(r,e.sel.primIndex)}function Cr(e,t,r){return e.line==t.line?Fo(r.line,e.ch-t.ch+r.ch):Fo(r.line+(e.line-t.line),e.ch)}function Sr(e,t,r){for(var n=[],i=Fo(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=Cr(l.from,i,o),c=Cr(ea(l),i,o);if(i=l.to,o=c,"around"==r){var u=e.sel.ranges[a],d=jo(u.head,u.anchor)<0;n[a]=new de(d?c:s,d?s:c)}else n[a]=new de(s,s)}return new ue(n,e.sel.primIndex)}function Tr(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(t,r,n,i){t&&(this.from=ge(e,t)),r&&(this.to=ge(e,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),za(e,"beforeChange",e,n),e.cm&&za(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Lr(e,t,r){if(e.cm){if(!e.cm.curOp)return Nt(e.cm,Lr)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(Ai(e,"beforeChange")||e.cm&&Ai(e.cm,"beforeChange"))||(t=Tr(e,t,!0))){var n=Io&&!r&&cn(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)Mr(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else Mr(e,t)}}function Mr(e,t){if(1!=t.text.length||""!=t.text[0]||0!=jo(t.from,t.to)){var r=kr(e,t);ui(e,t,r,e.cm?e.cm.curOp.id:NaN),Or(e,t,r,an(e,t));var n=[];Xn(e,function(e,r){r||zi(n,e.history)!=-1||(wi(e.history,t),n.push(e.history)),Or(e,t,null,an(e,t))})}}function _r(e,t,r){if(!e.cm||!e.cm.state.suppressEdits||r){for(var n,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,l="undo"==t?i.undone:i.done,s=0;s<a.length&&(n=a[s],r?!n.ranges||n.equals(e.sel):n.ranges);s++);if(s!=a.length){for(i.lastOrigin=i.lastSelOrigin=null;n=a.pop(),n.ranges;){if(fi(n,l),r&&!n.equals(e.sel))return void Le(e,n,{clearRedo:!1});o=n}var c=[];fi(o,l),l.push({changes:c,generation:i.generation}),i.generation=n.generation||++i.maxGeneration;for(var u=Ai(e,"beforeChange")||e.cm&&Ai(e.cm,"beforeChange"),s=n.changes.length-1;s>=0;--s){var d=n.changes[s];if(d.origin=t,u&&!Tr(e,d,!1))return void(a.length=0);c.push(li(e,d));var h=s?kr(e,d):Ei(a);Or(e,d,h,sn(e,d)),!s&&e.cm&&e.cm.scrollIntoView({from:d.from,to:ea(d)});var f=[];Xn(e,function(e,t){t||zi(f,e.history)!=-1||(wi(e.history,d),f.push(e.history)),Or(e,d,null,sn(e,d))})}}}}function Ar(e,t){if(0!=t&&(e.first+=t,e.sel=new ue(Pi(e.sel.ranges,function(e){return new de(Fo(e.anchor.line+t,e.anchor.ch),Fo(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Dt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)It(e.cm,n,"gutter")}}function Or(e,t,r,n){if(e.cm&&!e.cm.curOp)return Nt(e.cm,Or)(e,t,r,n);if(t.to.line<e.first)return void Ar(e,t.text.length-1-(t.to.line-t.from.line));
|
4 |
if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Ar(e,i),t={from:Fo(e.first,0),to:Fo(t.to.line+i,t.to.ch),text:[Ei(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:Fo(o,Qn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Jn(e,t.from,t.to),r||(r=kr(e,t)),e.cm?Nr(e.cm,t,n):Vn(e,t,n),Me(e,r,Ha)}}function Nr(e,t,r){var n=e.doc,i=e.display,a=t.from,l=t.to,s=!1,c=a.line;e.options.lineWrapping||(c=ri(bn(Qn(n,a.line))),n.iter(c,l.line+1,function(e){if(e==i.maxLine)return s=!0,!0})),n.sel.contains(t.from,t.to)>-1&&_i(e),Vn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(c,a.line+t.text.length,function(e){var t=d(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,a.line),Fe(e,400);var u=t.text.length-(l.line-a.line)-1;t.full?Dt(e):a.line!=l.line||1!=t.text.length||Gn(e.doc,t)?Dt(e,a.line,l.line+1,u):It(e,a.line,"text");var h=Ai(e,"changes"),f=Ai(e,"change");if(f||h){var p={from:a,to:l,text:t.text,removed:t.removed,origin:t.origin};f&&Ti(e,"change",e,p),h&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(p)}e.display.selForContextMenu=null}function Wr(e,t,r,n,i){if(n||(n=r),jo(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=e.splitLines(t)),Lr(e,{from:r,to:n,text:t,origin:i})}function Er(e,t){if(!Mi(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!_o){var o=qi("div","",null,"position: absolute; top: "+(t.top-r.viewOffset-qe(e.display))+"px; height: "+(t.bottom-t.top+Ge(e)+r.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function zr(e,t,r,n){null==n&&(n=0);for(var i=0;i<5;i++){var o=!1,a=pt(e,t),l=r&&r!=t?pt(e,r):a,s=Dr(e,Math.min(a.left,l.left),Math.min(a.top,l.top)-n,Math.max(a.left,l.left),Math.max(a.bottom,l.bottom)+n),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=s.scrollTop&&(ir(e,s.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=s.scrollLeft&&(or(e,s.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function Pr(e,t,r,n,i){var o=Dr(e,t,r,n,i);null!=o.scrollTop&&ir(e,o.scrollTop),null!=o.scrollLeft&&or(e,o.scrollLeft)}function Dr(e,t,r,n,i){var o=e.display,a=bt(e.display);r<0&&(r=0);var l=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,s=$e(e),c={};i-r>s&&(i=r+s);var u=e.doc.height+Ke(o),d=r<a,h=i>u-a;if(r<l)c.scrollTop=d?0:r;else if(i>l+s){var f=Math.min(r,(h?u:i)-s);f!=l&&(c.scrollTop=f)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,g=Ve(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),m=n-t>g;return m&&(n=t+g),t<10?c.scrollLeft=0:t<p?c.scrollLeft=Math.max(0,t-(m?0:10)):n>g+p-3&&(c.scrollLeft=n+(m?0:10)-g),c}function Ir(e,t,r){null==t&&null==r||Fr(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function Hr(e){Fr(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?Fo(t.line,t.ch-1):t,n=Fo(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function Fr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=gt(e,t.from),n=gt(e,t.to),i=Dr(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function jr(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Be(e,t):r="prev");var a=e.options.tabSize,l=Qn(o,t),s=Ra(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(n||/\S/.test(l.text)){if("smart"==r&&(c=o.mode.indent(i,l.text.slice(u.length),l.text),c==Ia||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?Ra(Qn(o,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var d="",h=0;if(e.options.indentWithTabs)for(var f=Math.floor(c/a);f;--f)h+=a,d+="\t";if(h<c&&(d+=Wi(c-h)),d!=u)return Wr(o,d,Fo(t,0),Fo(t,u.length),"+input"),l.stateAfter=null,!0;for(var f=0;f<o.sel.ranges.length;f++){var p=o.sel.ranges[f];if(p.head.line==t&&p.head.ch<u.length){var h=Fo(t,u.length);ke(o,f,new de(h,h));break}}}function Rr(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=Qn(e,pe(e,t)):i=ri(t),null==i?null:(n(o,i)&&e.cm&&It(e.cm,i,r),o)}function Br(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&jo(o.from,Ei(n).to)<=0;){var a=n.pop();if(jo(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}Ot(e,function(){for(var t=n.length-1;t>=0;t--)Wr(e.doc,"",n[t].from,n[t].to,"+delete");Hr(e)})}function qr(e,t,r,n,i){function o(){var t=l+r;return!(t<e.first||t>=e.first+e.size)&&(l=t,u=Qn(e,t))}function a(e){var t=(i?fo:po)(u,s,r,!0);if(null==t){if(e||!o())return!1;s=i?(r<0?oo:io)(u):r<0?u.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,c=r,u=Qn(e,l);if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var d=null,h="group"==n,f=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;!(r<0)||a(!p);p=!1){var g=u.text.charAt(s)||"\n",m=ji(g,f)?"w":h&&"\n"==g?"n":!h||/\s/.test(g)?null:"p";if(!h||p||m||(m="s"),d&&d!=m){r<0&&(r=1,a());break}if(m&&(d=m),r>0&&!a(!p))break}var v=We(e,Fo(l,s),t,c,!0);return jo(t,v)||(v.hitSide=!0),v}function Kr(e,t,r,n){var i,o=e.doc,a=t.left;if("page"==n){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(l-(r<0?1.5:.5)*bt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var s=vt(e,a,i);if(!s.outside)break;if(r<0?i<=0:i>=o.height){s.hitSide=!0;break}i+=5*r}return s}function Ur(t,r,n,i){e.defaults[t]=r,n&&(ra[t]=i?function(e,t,r){r!=na&&n(e,t,r)}:n)}function Gr(e){for(var t,r,n,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else{if(!/^s(hift)$/i.test(l))throw new Error("Unrecognized modifier name: "+l);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Vr(e){return"string"==typeof e?ha[e]:e}function $r(e,t,r,n,i){if(n&&n.shared)return Yr(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Nt(e.cm,$r)(e,t,r,n,i);var o=new ya(e,i),a=jo(t,r);if(n&&Hi(n,o,!1),a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=qi("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(yn(e,t.line,t,r,o)||t.line!=r.line&&yn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ho=!0}o.addToHistory&&ui(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var l,s=t.line,c=e.cm;if(e.iter(s,r.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&bn(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&ti(e,0),rn(e,new Jr(o,s==t.line?t.ch:null,s==r.line?r.ch:null)),++s}),o.collapsed&&e.iter(t.line,r.line+1,function(t){Cn(e,t)&&ti(t,0)}),o.clearOnEnter&&Na(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Io=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++va,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)Dt(c,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=r.line;u++)It(c,u,"text");o.atomic&&Ae(c.doc),Ti(c,"markerAdded",c,o)}return o}function Yr(e,t,r,n,i){n=Hi(n),n.shared=!1;var o=[$r(e,t,r,n,i)],a=o[0],l=n.widgetNode;return Xn(e,function(e){l&&(n.widgetNode=l.cloneNode(!0)),o.push($r(e,ge(e,t),ge(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=Ei(o)}),new ba(o,a)}function Xr(e){return e.findMarks(Fo(e.first,0),e.clipPos(Fo(e.lastLine())),function(e){return e.parent})}function Zr(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(jo(o,a)){var l=$r(e,o,a,n.primary,n.primary.type);n.markers.push(l),l.parent=n}}}function Qr(e){for(var t=0;t<e.length;t++){var r=e[t],n=[r.primary.doc];Xn(r.primary.doc,function(e){n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];zi(n,o.doc)==-1&&(o.parent=null,r.markers.splice(i--,1))}}}function Jr(e,t,r){this.marker=e,this.from=t,this.to=r}function en(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function tn(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function rn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function nn(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Jr(a,o.from,s?null:o.to))}}return n}function on(e,t,r){if(e)for(var n,i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Jr(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}function an(e,t){if(t.full)return null;var r=ve(e,t.from.line)&&Qn(e,t.from.line).markedSpans,n=ve(e,t.to.line)&&Qn(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==jo(t.from,t.to),l=nn(r,i,a),s=on(n,o,a),c=1==t.text.length,u=Ei(t.text).length+(c?i:0);if(l)for(var d=0;d<l.length;++d){var h=l[d];if(null==h.to){var f=en(s,h.marker);f?c&&(h.to=null==f.to?null:f.to+u):h.to=i}}if(s)for(var d=0;d<s.length;++d){var h=s[d];if(null!=h.to&&(h.to+=u),null==h.from){var f=en(l,h.marker);f||(h.from=u,c&&(l||(l=[])).push(h))}else h.from+=u,c&&(l||(l=[])).push(h)}l&&(l=ln(l)),s&&s!=l&&(s=ln(s));var p=[l];if(!c){var g,m=t.text.length-2;if(m>0&&l)for(var d=0;d<l.length;++d)null==l[d].to&&(g||(g=[])).push(new Jr(l[d].marker,null,null));for(var d=0;d<m;++d)p.push(g);p.push(s)}return p}function ln(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function sn(e,t){var r=mi(e,t),n=an(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],c=0;c<o.length;++c)if(o[c].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function cn(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&zi(n,r)!=-1||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var c=i[s];if(!(jo(c.to,l.from)<0||jo(c.from,l.to)>0)){var u=[s,1],d=jo(c.from,l.from),h=jo(c.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(h>0||!a.inclusiveRight&&!h)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-1}}return i}function un(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function dn(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function hn(e){return e.inclusiveLeft?-1:0}function fn(e){return e.inclusiveRight?1:0}function pn(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=jo(n.from,i.from)||hn(e)-hn(t);if(o)return-o;var a=jo(n.to,i.to)||fn(e)-fn(t);return a?a:t.id-e.id}function gn(e,t){var r,n=Ho&&e.markedSpans;if(n)for(var i,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!r||pn(r,i.marker)<0)&&(r=i.marker);return r}function mn(e){return gn(e,!0)}function vn(e){return gn(e,!1)}function yn(e,t,r,n,i){var o=Qn(e,t),a=Ho&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var c=s.marker.find(0),u=jo(c.from,r)||hn(s.marker)-hn(i),d=jo(c.to,n)||fn(s.marker)-fn(i);if(!(u>=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?jo(c.to,r)>=0:jo(c.to,r)>0)||u>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?jo(c.from,n)<=0:jo(c.from,n)<0)))return!0}}}function bn(e){for(var t;t=mn(e);)e=t.find(-1,!0).line;return e}function wn(e){for(var t,r;t=vn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function xn(e,t){var r=Qn(e,t),n=bn(r);return r==n?t:ri(n)}function kn(e,t){if(t>e.lastLine())return t;var r,n=Qn(e,t);if(!Cn(e,n))return t;for(;r=vn(n);)n=r.find(1,!0).line;return ri(n)+1}function Cn(e,t){var r=Ho&&t.markedSpans;if(r)for(var n,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Sn(e,t,n))return!0}}function Sn(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Sn(e,n.line,en(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Sn(e,t,i))return!0}function Tn(e,t,r){ii(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ir(e,null,r)}function Ln(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Ya(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),Ui(t.display.measure,qi("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Mn(e,t,r,n){var i=new wa(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),Rr(e,t,"widget",function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!Cn(e,t)){var n=ii(t)<e.scrollTop;ti(t,t.height+Ln(i)),n&&Ir(o,null,i.height),o.curOp.forceUpdate=!0}return!0}),i}function _n(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),un(e),dn(e,r);var i=n?n(e):1;i!=e.height&&ti(e,i)}function An(e){e.parent=null,un(e)}function On(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Nn(t,r){if(t.blankLine)return t.blankLine(r);if(t.innerMode){var n=e.innerMode(t,r);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function Wn(t,r,n,i){for(var o=0;o<10;o++){i&&(i[0]=e.innerMode(t,n).mode);var a=t.token(r,n);if(r.pos>r.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function En(e,t,r,n){function i(e){return{start:d.start,end:d.pos,string:d.current(),type:o||null,state:e?ca(a.mode,u):u}}var o,a=e.doc,l=a.mode;t=ge(a,t);var s,c=Qn(a,t.line),u=Be(e,t.line,r),d=new ma(c.text,e.options.tabSize);for(n&&(s=[]);(n||d.pos<t.ch)&&!d.eol();)d.start=d.pos,o=Wn(l,d,u),n&&s.push(i(!0));return n?s:i()}function zn(e,t,r,n,i,o,a){var l=r.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,c=0,u=null,d=new ma(t,e.options.tabSize),h=e.options.addModeClass&&[null];for(""==t&&On(Nn(r,n),o);!d.eol();){if(d.pos>e.options.maxHighlightLength?(l=!1,a&&In(e,t,n,d.pos),d.pos=t.length,s=null):s=On(Wn(r,d,n,h),o),h){var f=h[0].name;f&&(s="m-"+(s?f+" "+s:f))}if(!l||u!=s){for(;c<d.start;)c=Math.min(d.start,c+5e4),i(c,u);u=s}d.start=d.pos}for(;c<d.pos;){var p=Math.min(d.pos,c+5e4);i(p,u),c=p}}function Pn(e,t,r,n){var i=[e.state.modeGen],o={};zn(e,t.text,e.doc.mode,r,function(e,t){i.push(e,t)},o,n);for(var a=0;a<e.state.overlays.length;++a){var l=e.state.overlays[a],s=1,c=0;zn(e,t.text,l.mode,!0,function(e,t){for(var r=s;c<e;){var n=i[s];n>e&&i.splice(s,1,e,i[s+1],n),s+=2,c=Math.min(e,n)}if(t)if(l.opaque)i.splice(r,s-r,e,"cm-overlay "+t),s=r+2;else for(;r<s;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Dn(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Be(e,ri(t)),i=Pn(e,t,t.text.length>e.options.maxHighlightLength?ca(e.doc.mode,n):n);t.stateAfter=n,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function In(e,t,r,n){var i=e.doc.mode,o=new ma(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&Nn(i,r);!o.eol();)Wn(i,o,r),o.start=o.pos}function Hn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Ca:ka;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Fn(e,t){var r=qi("span",null,null,ko?"padding-right: .1px":null),n={pre:qi("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:(wo||ko)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;n.pos=0,n.addToken=Rn,Ji(e.display.measure)&&(o=oi(a))&&(n.addToken=qn(n.addToken,o)),n.map=[];var l=t!=e.display.externalMeasured&&ri(a);Un(a,n,Dn(e,a,l)),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=$i(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=$i(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Qi(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(ko){var s=n.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return za(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=$i(n.pre.className,n.textClass||"")),n}function jn(e){var t=qi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Rn(e,t,r,n,i,o,a){if(t){var l=e.splitSpaces?Bn(t,e.trailingSpace):t,s=e.cm.state.specialChars,c=!1;if(s.test(t))for(var u=document.createDocumentFragment(),d=0;;){s.lastIndex=d;var h=s.exec(t),f=h?h.index-d:t.length-d;if(f){var p=document.createTextNode(l.slice(d,d+f));wo&&xo<9?u.appendChild(qi("span",[p])):u.appendChild(p),e.map.push(e.pos,e.pos+f,p),e.col+=f,e.pos+=f}if(!h)break;if(d+=f+1,"\t"==h[0]){var g=e.cm.options.tabSize,m=g-e.col%g,p=u.appendChild(qi("span",Wi(m),"cm-tab"));p.setAttribute("role","presentation"),p.setAttribute("cm-text","\t"),e.col+=m}else if("\r"==h[0]||"\n"==h[0]){var p=u.appendChild(qi("span","\r"==h[0]?"␍":"","cm-invalidchar"));p.setAttribute("cm-text",h[0]),e.col+=1}else{var p=e.cm.options.specialCharPlaceholder(h[0]);p.setAttribute("cm-text",h[0]),wo&&xo<9?u.appendChild(qi("span",[p])):u.appendChild(p),e.col+=1}e.map.push(e.pos,e.pos+1,p),e.pos++}else{e.col+=t.length;var u=document.createTextNode(l);e.map.push(e.pos,e.pos+t.length,u),wo&&xo<9&&(c=!0),e.pos+=t.length}if(e.trailingSpace=32==l.charCodeAt(t.length-1),r||n||i||c||a){var v=r||"";n&&(v+=n),i&&(v+=i);var y=qi("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Bn(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}function qn(e,t){return function(r,n,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var c=r.pos,u=c+n.length;;){for(var d=0;d<t.length;d++){var h=t[d];if(h.to>c&&h.from<=c)break}if(h.to>=u)return e(r,n,i,o,a,l,s);e(r,n.slice(0,h.to-c),i,o,null,l,s),o=null,n=n.slice(h.to-c),c=h.to}}}function Kn(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Un(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,l,s,c,u,d,h,f=i.length,p=0,g=1,m="",v=0;;){if(v==p){s=c=u=d=l="",h=null,v=1/0;for(var y,b=[],w=0;w<n.length;++w){var x=n[w],k=x.marker;"bookmark"==k.type&&x.from==p&&k.widgetNode?b.push(k):x.from<=p&&(null==x.to||x.to>p||k.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),k.className&&(s+=" "+k.className),k.css&&(l=(l?l+";":"")+k.css),k.startStyle&&x.from==p&&(u+=" "+k.startStyle),k.endStyle&&x.to==v&&(y||(y=[])).push(k.endStyle,x.to),k.title&&!d&&(d=k.title),k.collapsed&&(!h||pn(h.marker,k)<0)&&(h=x)):x.from>p&&v>x.from&&(v=x.from)}if(y)for(var w=0;w<y.length;w+=2)y[w+1]==v&&(c+=" "+y[w]);if(!h||h.from==p)for(var w=0;w<b.length;++w)Kn(t,0,b[w]);if(h&&(h.from||0)==p){if(Kn(t,(null==h.to?f+1:h.to)-p,h.marker,null==h.from),null==h.to)return;h.to==p&&(h=!1)}}if(p>=f)break;for(var C=Math.min(f,v);;){if(m){var S=p+m.length;if(!h){var T=S>C?m.slice(0,C-p):m;t.addToken(t,T,a?a+s:s,u,p+T.length==v?c:"",d,l)}if(S>=C){m=m.slice(C-p),p=C;break}p=S,u=""}m=i.slice(o,o=r[g++]),a=Hn(r[g++],t.cm.options)}}else for(var g=1;g<r.length;g+=2)t.addToken(t,i.slice(o,o=r[g]),Hn(r[g+1],t.cm.options))}function Gn(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Ei(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Vn(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){_n(e,r,i,n),Ti(e,"change",e,t)}function a(e,t){for(var r=e,o=[];r<t;++r)o.push(new xa(c[r],i(r),n));return o}var l=t.from,s=t.to,c=t.text,u=Qn(e,l.line),d=Qn(e,s.line),h=Ei(c),f=i(c.length-1),p=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Gn(e,t)){var g=a(0,c.length-1);o(d,d.text,f),p&&e.remove(l.line,p),g.length&&e.insert(l.line,g)}else if(u==d)if(1==c.length)o(u,u.text.slice(0,l.ch)+h+u.text.slice(s.ch),f);else{var g=a(1,c.length-1);g.push(new xa(h+u.text.slice(s.ch),f,n)),o(u,u.text.slice(0,l.ch)+c[0],i(0)),e.insert(l.line+1,g)}else if(1==c.length)o(u,u.text.slice(0,l.ch)+c[0]+d.text.slice(s.ch),i(0)),e.remove(l.line+1,p);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(d,h+d.text.slice(s.ch),f);var g=a(1,c.length-1);p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,g)}Ti(e,"change",e,t)}function $n(e){this.lines=e,this.parent=null;for(var t=0,r=0;t<e.length;++t)e[t].parent=this,r+=e[t].height;this.height=r}function Yn(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}function Xn(e,t,r){function n(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;r&&!s||(t(l.doc,s),n(l.doc,e,s))}}}n(e,null,!0)}function Zn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,a(e),r(e),e.options.lineWrapping||h(e),e.options.mode=t.modeOption,Dt(e)}function Qn(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function Jn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function ei(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function ti(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function ri(e){if(null==e.parent)return null;for(var t=e.parent,r=zi(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function ni(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;n<e.lines.length;++n){var a=e.lines[n],l=a.height;if(t<l)break;t-=l}return r+n}function ii(e){e=bn(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var n=0;n<o.children.length;++n){var a=o.children[n];if(a==r)break;t+=a.height}return t}function oi(e){var t=e.order;return null==t&&(t=e.order=sl(e.text)),t}function ai(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function li(e,t){var r={from:V(t.from),to:ea(t),text:Jn(e,t.from,t.to)};return pi(e,r,t.from.line,t.to.line+1),Xn(e,function(e){pi(e,r,t.from.line,t.to.line+1)},!0),r}function si(e){for(;e.length;){var t=Ei(e);if(!t.ranges)break;e.pop()}}function ci(e,t){return t?(si(e.done),Ei(e.done)):e.done.length&&!Ei(e.done).ranges?Ei(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Ei(e.done)):void 0}function ui(e,t,r,n){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ci(i,i.lastOp==n))){var l=Ei(o.changes);0==jo(t.from,t.to)&&0==jo(t.from,l.to)?l.to=ea(t):o.changes.push(li(e,t))}else{var s=Ei(i.done);for(s&&s.ranges||fi(e.sel,i.done),o={changes:[li(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,l||za(e,"historyAdded")}function di(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function hi(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||di(e,o,Ei(i.done),t))?i.done[i.done.length-1]=t:fi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&si(i.undone)}function fi(e,t){var r=Ei(t);r&&r.ranges&&r.equals(e)||t.push(e)}function pi(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function gi(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function mi(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(gi(r[n]));return i}function vi(e,t,r){for(var n=0,i=[];n<e.length;++n){var o=e[n];if(o.ranges)i.push(r?ue.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];i.push({changes:l});for(var s=0;s<a.length;++s){var c,u=a[s];if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&zi(t,Number(c[1]))>-1&&(Ei(l)[d]=u[d],delete u[d])}}}return i}function yi(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function bi(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var l=0;l<o.ranges.length;l++)yi(o.ranges[l].anchor,t,r,n),yi(o.ranges[l].head,t,r,n)}else{for(var l=0;l<o.changes.length;++l){var s=o.changes[l];if(r<s.from.line)s.from=Fo(s.from.line+n,s.from.ch),s.to=Fo(s.to.line+n,s.to.ch);else if(t<=s.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function wi(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;bi(e.done,r,n,i),bi(e.undone,r,n,i)}function xi(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ki(e){return e.target||e.srcElement}function Ci(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),No&&e.ctrlKey&&1==t&&(t=3),t}function Si(e,t,r){var n=e._handlers&&e._handlers[t];return r?n&&n.length>0?n.slice():Wa:n||Wa}function Ti(e,t){function r(e){return function(){e.apply(null,o)}}var n=Si(e,t,!1);if(n.length){var i,o=Array.prototype.slice.call(arguments,2);Go?i=Go.delayedCallbacks:Pa?i=Pa:(i=Pa=[],setTimeout(Li,0));for(var a=0;a<n.length;++a)i.push(r(n[a]))}}function Li(){var e=Pa;Pa=null;for(var t=0;t<e.length;++t)e[t]()}function Mi(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),za(e,r||t.type,e,t),xi(t)||t.codemirrorIgnore}function _i(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)zi(r,t[n])==-1&&r.push(t[n])}function Ai(e,t){return Si(e,t).length>0}function Oi(e){e.prototype.on=function(e,t){Na(this,e,t)},e.prototype.off=function(e,t){Ea(this,e,t)}}function Ni(){this.id=null}function Wi(e){for(;qa.length<=e;)qa.push(Ei(qa)+" ");return qa[e]}function Ei(e){return e[e.length-1]}function zi(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}function Pi(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Di(){}function Ii(e,t){var r;return Object.create?r=Object.create(e):(Di.prototype=e,r=new Di),t&&Hi(t,r),r}function Hi(e,t,r){t||(t={});for(var n in e)!e.hasOwnProperty(n)||r===!1&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function Fi(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ji(e,t){return t?!!(t.source.indexOf("\\w")>-1&&Va(e))||t.test(e):Va(e)}function Ri(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Bi(e){return e.charCodeAt(0)>=768&&$a.test(e)}function qi(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function Ki(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Ui(e,t){return Ki(e).appendChild(t)}function Gi(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function Vi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function $i(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!Vi(r[n]).test(t)&&(t+=" "+r[n]);return t}function Yi(e){if(document.body.getElementsByClassName)for(var t=document.body.getElementsByClassName("CodeMirror"),r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&e(n)}}function Xi(){el||(Zi(),el=!0)}function Zi(){var e;Na(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Yi(Ut)},100))}),Na(window,"blur",function(){Yi(yr)})}function Qi(e){if(null==Xa){var t=qi("span","");Ui(e,qi("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Xa=t.offsetWidth<=1&&t.offsetHeight>2&&!(wo&&xo<8))}var r=Xa?qi("span",""):qi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Ji(e){if(null!=Za)return Za;var t=Ui(e,document.createTextNode("AخA")),r=Ua(t,0,1).getBoundingClientRect(),n=Ua(t,1,2).getBoundingClientRect();return Ki(e),!(!r||r.left==r.right)&&(Za=n.right-r.right<3)}function eo(e){if(null!=ol)return ol;var t=Ui(e,qi("span","x")),r=t.getBoundingClientRect(),n=Ua(t,0,1).getBoundingClientRect();return ol=Math.abs(r.left-n.left)>1}function to(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function ro(e){return e.level%2?e.to:e.from}function no(e){return e.level%2?e.from:e.to}function io(e){var t=oi(e);return t?ro(t[0]):0}function oo(e){var t=oi(e);return t?no(Ei(t)):e.text.length}function ao(e,t){var r=Qn(e.doc,t),n=bn(r);n!=r&&(t=ri(n));var i=oi(n),o=i?i[0].level%2?oo(n):io(n):0;return Fo(t,o)}function lo(e,t){for(var r,n=Qn(e.doc,t);r=vn(n);)n=r.find(1,!0).line,t=null;var i=oi(n),o=i?i[0].level%2?io(n):oo(n):n.text.length;return Fo(null==t?ri(n):t,o)}function so(e,t){
|
assets/js/forms-admin.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["forms-admin.js"],"names":["require","undefined","define","e","t","n","r","s","o","u","a","i","f","Error","code","l","exports","call","length","1","module","rows","m","i18n","label","config","fieldLabel","type","value","onchange","withAttr","placeholder","title","style","optional","valueHelp","numberMinMax","min","max","isRequired","desc","inputAtts","checked","required","forceRequired","disabled","isFieldRequired","placeholderHelp","useParagraphs","wrap","wrapInParagraphTags","choiceType","selected","dropdown","radioButtons","checkboxes","choices","html","push","map","choice","index","data-id","name","selectChoice","bind","preselect","remove","class","onclick","key","this","splice","2","forms","render","text","visibleRows","hidden","c","join","submit","number","./field-forms-rows.js","3","html_beautify","g","generate","field","htmlTemplate","generators","select","attributes","hasSelection","options","unshift","checkbox","radio","../third-party/beautify-html.js","../third-party/render.js","4","FieldHelper","tabs","editor","fields","setActiveField","fieldConfig","get","redraw","controller","createFieldHTMLAndAddToForm","insert","view","fieldCategories","getCategories","availableFields","getAll","fieldsChoice","chooseField","category","categoryFields","filter","className","inForm","inFormContent","form","overlay","help","trust","onkeydown","window","event","keyCode","addToForm","on","./field-forms.js","./field-generator.js","./overlay.js","5","FieldFactory","reset","registeredFields","forEach","deregister","register","data","sticky","getFieldType","phone","birthday","registerMergeField","mergeField","listFields","tag","field_type","streetAddress","city","state","zip","country","mc4wp_vars","countries","registerInterestCategory","interestCategory","interestCategories","id","interests","registerListFields","list","merge_fields","sort","b","interest_categories","registerListsFields","lists","registerCustomFields","formFields","subscribe","submitButton","listChoice","listChoiceDescription","unsubscribe","formAction","formActionDescription","6","events","createChoices","choiceLabel","FieldChoice","Object","keys","existingField","getAllWhere","shift","categories","indexOf","Field","timeout","clearTimeout","setTimeout","trigger","searchKey","searchValue","prop","7","CodeMirror","FormEditor","element","dom","domDirty","_dom","innerHTML","getValue","toLowerCase","document","createElement","fromTextArea","selectionPointer","matchTags","bothTags","mode","htmlMode","autoCloseTags","autoRefresh","dispatchEvent","Event","bubbles","addEventListener","signal","query","querySelectorAll","containsField","fieldName","elements","namedItem","replaceSelection","focus","callback","refresh","codemirror","codemirror/addon/edit/closetag.js","codemirror/addon/edit/matchtags","codemirror/addon/fold/xml-fold","codemirror/mode/css/css","codemirror/mode/htmlmixed/htmlmixed","codemirror/mode/javascript/javascript","codemirror/mode/xml/xml","8","FormWatcher","settings","helpers","updateFields","findRequiredFields","requiredFields","toUpperCase","requiredFieldElements","Array","prototype","el","replace","requiredFieldsInput","getElementById","debounce","9","show","txt","notices","hide","container","querySelector","heading","parentNode","insertBefore","nextSibling","init","formCode","10","close","removeEventListener","onKeyDown","position","_onCloseCallback","preventDefault","_element","windowWidth","innerWidth","documentElement","clientWidth","body","windowHeight","innerHeight","clientHeight","marginLeft","marginTop","left","top","content","onCloseCallback","11","mc4wp_forms_i18n","mc4wp","deps","mithril","FieldsFactory","textareaElement","formEditor","fieldHelper","mount","fieldsFactory","getSelectedLists","mailchimp","./admin/field-helper.js","./admin/fields-factory.js","./admin/fields.js","./admin/form-editor.js","./admin/form-watcher.js","./admin/notices","12","trim","ltrim","style_html","html_source","js_beautify","css_beautify","Parser","pos","token","current_mode","tags","parent","parentcount","parent1","tag_type","token_text","last_token","last_text","token_type","newlines","indent_content","indent_inner_html","Utils","whitespace","split","single_token","extra_liners","in_array","what","arr","traverse_whitespace","input_char","input","charAt","preserve_newlines","max_preserve_newlines","get_content","space","indent_handlebars","peek3","substr","get_tag","line_char_count","wrap_line_length","print_newline","print_indentation","get_contents_to","reg_match","RegExp","lastIndex","reg_array","exec","end_script","substring","record_tag","indent_level","retrieve_tag","temp_parent","indent_to_tag","peek","tag_start","tag_end","tag_start_char","comment","orig_pos","orig_line_char_count","get_unformatted","get_comment","tag_index","tag_offset","tag_complete","tag_check","is_unformatted","unformatted","output","start_pos","delimiter","matched","orig_tag","min_index","get_token","tag_name_type","get_full_indent","level","indent_string","next_tag","match","printer","js_source","indent_character","indent_size","brace_style","force","print_token","print_token_raw","slice","indent","unindent","multi_parser","parseInt","max_char","indent_char","tag_name","tag_extracted_from_last_output","_beautifier","script_indent_level","indent_scripts","indentation","white","_level","reindent","13","isArray","thing","toString","camelToDash","str","removeEmpties","escapeHtml","replaceDoubleQuote","createAttrString","attrs","styles","property","createChildrenContent","children","scope","result","onunload","$trusted","VOID_TAGS","14","mod","amd","autoCloseGT","cm","getOption","Pass","ranges","listSelections","replacements","empty","head","tok","getTokenAt","inner","innerMode","getMode","tagName","opt","configuration","dontCloseTags","htmlDontClose","indentTags","htmlIndent","end","ch","lowerTagName","test","string","closingTagExists","newPos","Pos","line","info","replaceRange","anchor","sel","setSelections","indentLine","autoCloseCurrent","typingSlash","start","replacement","context","getLine","replaceSelections","autoCloseSlash","collection","elt","newTag","scanForClosingTag","Math","lastLine","nextClose","cx","onCx","prev","to","next","defineOption","val","old","Init","removeKeyMap","whenClosing","whenOpening","addKeyMap","commands","closeTag","../../lib/codemirror","../fold/xml-fold","15","clear","tagHit","tagOther","doMatchTags","failedTagMatch","operation","somethingSelected","cur","getCursor","range","getViewport","from","findMatchingTag","matchBothTags","hit","at","open","markText","other","maybeUpdateMatch","off","toMatchingTag","found","extendSelection","16","cmp","Iter","firstLine","tagAt","iter","getTokenTypeAt","nextLine","prevLine","toTagEnd","gt","lastSlash","lastIndexOf","selfClose","toTagStart","lt","xmlTagStart","toNextTag","toPrevTag","findMatchingClose","stack","startLine","startCh","findMatchingOpen","endLine","endCh","nameStartChar","nameChar","registerHelper","openTag","startPos","endPos","here","findEnclosingTag","forward","17","place","copyObj","defaults","setGuttersForLineNumbers","doc","Doc","lineSeparator","inputStyles","inputStyle","display","Display","wrapper","updateGutters","themeChanged","lineWrapping","autofocus","mobile","initScrollbars","keyMaps","overlays","modeGen","overwrite","delayingBlurEvent","focused","suppressEdits","pasteIncoming","cutIncoming","selectingText","draggingText","highlight","Delayed","keySeq","specialChars","ie","ie_version","registerEventHandlers","ensureGlobalHandlers","startOperation","curOp","forceUpdate","attachDoc","hasFocus","onFocus","onBlur","optionHandlers","hasOwnProperty","maybeUpdateLineNumberWidth","finishInit","initHooks","endOperation","webkit","getComputedStyle","lineDiv","textRendering","d","scrollbarFiller","setAttribute","gutterFiller","selectionDiv","cursorDiv","measure","lineMeasure","lineSpace","mover","sizer","sizerWidth","heightForcer","scrollerGap","gutters","lineGutter","scroller","zIndex","paddingRight","gecko","draggable","appendChild","viewFrom","viewTo","first","reportedViewFrom","reportedViewTo","renderedView","externalMeasured","viewOffset","lastWrapHeight","lastWrapWidth","updateLineNumbers","nativeBarWidth","barHeight","barWidth","scrollbarsClipped","lineNumWidth","lineNumInnerWidth","lineNumChars","alignWidgets","cachedCharWidth","cachedTextHeight","cachedPaddingH","maxLine","maxLineLength","maxLineChanged","wheelDX","wheelDY","wheelStartX","wheelStartY","selForContextMenu","activeTouch","loadMode","modeOption","resetModeState","stateAfter","frontier","startWorker","regChange","wrappingChanged","addClass","minWidth","rmClass","findMaxLine","estimateLineHeights","clearCaches","updateScrollbars","estimateHeight","th","textHeight","wrapping","perLine","charWidth","lineIsHidden","widgetsHeight","widgets","height","ceil","est","estHeight","updateLineHeight","theme","guttersChanged","alignHorizontally","specs","removeChildren","gutterClass","gElt","width","updateGutterSpace","offsetWidth","lineLength","merged","len","collapsedSpanAtStart","find","collapsedSpanAtEnd","lineNumbers","concat","measureForScrollbars","gutterW","docH","round","paddingVert","viewHeight","scrollWidth","viewWidth","barLeft","fixedGutter","docHeight","scrollHeight","scrollGap","gutterWidth","NativeScrollbars","scroll","vert","horiz","scrollTop","scrollLeft","checkedZeroWidth","minHeight","NullScrollbars","scrollbars","scrollbarModel","scrollbarStyle","node","axis","setScrollLeft","setScrollTop","startWidth","startHeight","updateScrollbarsInner","updateHeightsInViewport","sizes","update","right","paddingBottom","bottom","borderBottom","coverGutterNextToScrollbar","visibleLines","viewport","floor","paddingTop","lineAtHeight","ensure","ensureFrom","ensureTo","heightAtLine","firstChild","comp","compensateForHScroll","gutter","align","alignable","j","last","lineNumberFor","size","innerW","padding","String","lineNumberFormatter","firstLineNumber","getBoundingClientRect","DisplayUpdate","visible","editorIsHidden","wrapperHeight","wrapperWidth","oldDisplayWidth","displayWidth","dims","getDimensions","maybeClipScrollbars","marginBottom","borderRightWidth","updateDisplayIfNeeded","resetView","countDirtyView","viewportMargin","sawCollapsedSpans","visualLineNo","visualLineEndNo","different","adjustView","toUpdate","activeElt","patchDisplay","offsetHeight","postUpdateDisplay","displayHeight","barMeasure","updateSelection","setDocumentHeight","updateDisplaySimple","finish","prevBottom","offsetTop","bot","box","diff","updateWidgetHeight","rest","gutterLeft","clientLeft","offsetLeft","fixedPos","gutterTotalWidth","updateNumbersFrom","rm","mac","currentWheelTarget","removeChild","lineN","lineView","updateNumber","lineNumber","changes","updateLineForChanges","createTextNode","buildLineElement","updateLineText","updateLineGutter","updateLineClasses","updateLineWidgets","ensureLineWrapped","replaceChild","updateLineBackground","cls","bgClass","background","getLineContent","ext","built","buildLineContent","pre","textClass","wrapClass","gutterBackground","markers","gutterMarkers","gutterWrap","setUneditable","k","insertLineWidgets","insertLineWidgetsFor","allowAbove","ws","widget","handleMouseEvents","positionLineWidget","above","signalLater","noHScroll","coverGutter","paddingLeft","copyPos","x","maxPos","minPos","ensureFocus","applyTextInput","inserted","deleted","origin","paste","textLines","splitLines","multiPaste","lastCopied","lst","lineWise","updateInput","changeEvent","makeChange","triggerElectric","ensureCursorVisible","typing","handlePaste","pasted","clipboardData","getData","isReadOnly","disableInput","runInOp","electricChars","smartIndent","getModeAt","indented","electricInput","copyableRanges","lineRange","getRange","disableBrowserMagic","TextareaInput","prevInput","pollingFast","polling","inaccurateSelection","composing","hiddenTextarea","te","div","ios","border","ContentEditableInput","lastAnchorNode","lastAnchorOffset","lastFocusNode","lastFocusOffset","gracePeriod","posToDOM","findViewForLine","mapFromLineView","order","getOrder","side","partPos","getBidiPartAt","nodeAndOffsetInLineMap","offset","collapse","badPos","bad","domToPos","lineNode","childNodes","clipPos","locateNodeInLineView","textNode","topNode","maps","curNode","lineNo","contains","nodeType","nodeValue","after","dist","textContent","before","previousSibling","domTextBetween","fromLine","toLine","recognizeMarker","marker","walk","cmText","getAttribute","markerID","findMarks","getBetween","lineSep","nodeName","closing","Selection","primIndex","Range","normalizeSelection","prim","inv","simpleSelection","clipLine","clipToLen","linelen","isLine","clipPosArray","array","out","extendRange","extend","posBefore","setSelection","primary","extendSelections","heads","newSel","replaceOneSelection","setSimpleSelection","filterSelectionChange","obj","setSelectionReplaceHistory","done","history","setSelectionNoUndo","addSelectionToHistory","NaN","hasHandler","bias","setSelectionInner","skipAtomicInSelection","equals","selectionChanged","signalCursorActivity","reCheckSelection","sel_dontScroll","mayClear","newAnchor","skipAtomic","newHead","skipAtomicInner","oldPos","dir","markedSpans","sp","inclusiveLeft","inclusiveRight","explicitlyCleared","atomic","near","movePos","far","cantEdit","showSelection","prepareSelection","curFragment","cursors","createDocumentFragment","selFragment","selection","collapsed","showCursorWhenSelecting","drawSelectionCursor","drawSelectionRange","cursorCoords","singleCursorHeightPerLine","cursor","cursorHeight","otherCursor","add","fragment","rightSide","drawForLine","fromArg","toArg","coords","charCoords","lineObj","lineLen","iterateBidiSections","rightPos","leftPos","tmp","leftSide","paddingH","sFrom","sTo","singleVLine","visualLine","leftEnd","rightStart","restartBlink","clearInterval","blinker","visibility","cursorBlinkRate","setInterval","time","startState","set","highlightWorker","Date","workTime","copyState","getStateBefore","changedLines","oldStyles","tooLong","maxHighlightLength","highlighted","highlightLine","oldCls","styleClasses","newCls","classes","ischange","processLine","workDelay","regLineChange","findStartLine","precise","minindent","minline","lim","search","countColumn","tabSize","save","removeChildrenAndAdd","currentStyle","isNaN","ensureLineHeights","rect","curWidth","heights","rects","getClientRects","abs","cache","caches","updateExternalMeasurement","LineView","measureChar","measureCharPrepared","prepareMeasureForLine","findViewIndex","hasHeights","prepared","varHeight","measureCharInner","bogus","rtop","rbottom","mStart","mEnd","insertLeft","coverStart","coverEnd","getUsefulRect","nullRect","isExtendingChar","maybeUpdateRectForZooming","rSpan","rbot","mid","screen","logicalXDPI","deviceXDPI","hasBadZoomedRects","scaleX","scaleY","logicalYDPI","deviceYDPI","clearLineMeasurementCacheFor","clearLineMeasurementCache","externalMeasure","pageScrollX","pageXOffset","pageScrollY","pageYOffset","intoCoordSystem","widgetHeight","yOff","lOff","xOff","fromCoordSystem","localBox","lineSpaceBox","preparedMeasure","getBidi","part","bidiLeft","bidiRight","bidiOther","estimateCoords","PosWithInfo","outside","xRel","coordsChar","y","coordsCharInner","mergedPos","getX","wrongLine","innerOff","adjust","bidi","lineLeft","lineRight","fromX","fromOutside","toX","toOutside","moveVisually","xDiff","charSize","step","middle","middleX","measureText","viewChanged","changeObjs","cursorActivityHandlers","cursorActivityCalled","updateMaxLine","scrollToPos","nextOpId","operationGroup","ops","ownsGroup","delayedCallbacks","fireCallbacksForOps","group","callbacks","op","endOperations","endOperation_R1","endOperation_W1","endOperation_R2","endOperation_W2","endOperation_finish","mustUpdate","updatedDisplay","adjustWidthTo","maxScrollLeft","preparedSelection","takeFocus","forceScroll","scrollPosIntoView","margin","isCursor","maybeScrollWindow","maybeHiddenMarkers","unhidden","maybeUnhiddenMarkers","lines","apply","arguments","methodOp","docMethodOp","visualLineContinued","buildViewArray","nextPos","lendiff","cut","viewCuttingPoint","cutTop","cutBot","oldN","newN","dirty","finishTouch","touchFinished","prevTouch","isMouseLikeTouchEvent","touches","touch","radiusX","radiusY","farAway","dx","dy","onMouseDown","signalDOMEvent","posFromMouse","clickInGutter","eventInWidget","e_preventDefault","word","findWordAt","captureRightClick","onContextMenu","now","moved","pageX","pageY","onScrollWheel","dragFunctions","enter","e_stop","over","onDragOver","onDragStart","drop","onDrop","leave","clearDragCursor","inp","getField","onKeyUp","onKeyPress","dragDropChanged","wasOn","funcs","toggle","onResize","setSize","e_target","liberal","forRect","clientX","clientY","colDiff","supportsTouch","shiftKey","e_button","leftButtonDown","lastMiddleDown","delayBlurEvent","lastDoubleClick","lastClick","contained","modifier","metaKey","ctrlKey","dragDrop","dragAndDrop","leftButtonStartDrag","leftButtonSelect","startTime","dragEnd","e2","copy","altKey","addNew","extendTo","lastPos","startCol","posCol","findColumn","startSel","ourIndex","scrollIntoView","oldRange","ourRange","sel_mouse","curCount","counter","editorSize","Infinity","move","up","lastSelOrigin","chromeOS","gutterEvent","prevent","mX","mY","lineBox","e_defaultPrevented","lastDrop","files","dataTransfer","FileReader","File","read","loadFile","file","allowDropFileTypes","reader","onload","change","changeEnd","readAsText","setData","getSelection","effectAllowed","setDragImage","safari","img","src","presto","_top","frag","dragCursor","isScroller","delta","wheelEventDelta","canScrollX","canScrollY","outer","target","wheelPixelsPerUnit","pixels","wheelSamples","movedX","movedY","sample","doHandleBinding","bound","dropShift","ensurePolled","prevShift","lookupKeyForEditor","handle","lookupKey","extraKeys","keyMap","dispatchKey","seq","isModifierKey","stopSeq","handleKeyBinding","keyName","motion","handleCharBinding","returnValue","handled","lastStoppedKey","hasCopyEvent","showCrossHair","charCode","which","fromCharCode","readOnly","receivedFocus","contextMenuInGutter","adjustForChange","computeSelAfterChange","offsetPos","nw","computeReplacedSel","hint","oldPrev","newPrev","filterChange","canceled","cancel","ignoreReadOnly","sawReadOnlySpans","removeReadOnlyRanges","makeChangeInner","selAfter","addChangeToHistory","makeChangeSingleDoc","stretchSpansOverChange","rebased","linkedDocs","sharedHist","rebaseHist","makeChangeFromHistory","allowSelectionOnly","hist","source","undone","dest","lastOrigin","pop","pushSelectionToHistory","clearRedo","antiChanges","generation","maxGeneration","historyChangeFromChange","mergeOldSpans","shiftDoc","distance","spans","removed","makeChangeSingleDocInEditor","updateDoc","recomputeMaxLength","checkWidthStart","full","isWholeLineUpdate","changesHandler","changeHandler","doScroll","phantom","scrollNode","limit","changed","endCoords","scrollPos","calculateScrollPos","startTop","startLeft","x1","y1","x2","y2","snapMargin","screentop","docBottom","atTop","atBottom","newTop","screenleft","screenw","tooWide","addToScrollPos","resolveScrollToPos","cursorScrollMargin","sPos","scrollTo","how","aggressive","curSpace","curSpaceString","indentUnit","indentString","indentWithTabs","spaceStr","changeLine","changeType","no","deleteNearSelection","compute","kill","toKill","replaced","findPosH","unit","visually","findNextLine","moveOnce","boundToLine","moveLogically","origDir","sawType","helper","getHelper","isWordChar","hitSide","findPosV","pageSize","option","deflt","notOnInit","normalizeKeyName","alt","ctrl","cmd","parts","getKeyMap","shared","markTextShared","TextMarker","clearWhenEmpty","replacedWith","widgetNode","conflictingCollapsedRange","addToHistory","curLine","addMarkedSpan","MarkedSpan","clearOnEnter","clearHistory","nextMarkerId","startStyle","endStyle","css","cloneNode","linked","isParent","SharedTextMarker","findSharedMarkers","copySharedMarkers","mFrom","mTo","subMark","detachSharedMarkers","subMarker","getMarkedSpanFor","span","removeMarkedSpan","attachLine","markedSpansBefore","isInsert","startsBefore","endsAfter","markedSpansAfter","oldFirst","oldLast","sameLine","clearEmptySpans","newMarkers","gapMarkers","gap","getOldSpans","stretched","oldCur","stretchCur","mark","mk","p","newParts","dfrom","dto","detachMarkedSpans","detachLine","attachMarkedSpans","extraLeft","extraRight","compareCollapsedMarkers","lenDiff","aPos","bPos","fromCmp","toCmp","collapsedSpanAtSide","sps","vis","lineIsHiddenInner","adjustScrollWhenAboveVisible","parentStyle","addLineWidget","LineWidget","insertAt","aboveVisible","updateLine","cleanUpLine","extractLineClasses","lineClass","callBlankLine","blankLine","readToken","stream","takeToken","asArray","getObj","current","tokens","StringStream","eol","runMode","lineClasses","forceToEnd","flattenSpans","curStart","curStyle","addModeClass","mName","st","i_end","opaque","getLineStyles","updateFrontier","startAt","interpretTokenStyle","styleToClassCacheWithMode","styleToClassCache","builder","col","trailingSpace","splitSpaces","addToken","buildToken","hasBadBidiRects","buildTokenBadBidi","allowFrontierUpdate","insertLineContent","joinClasses","zeroWidthElement","lastChild","defaultSpecialCharPlaceholder","charCodeAt","displayText","special","mustWrap","skipped","tabWidth","specialCharPlaceholder","fullStyle","trailingBefore","spaceBefore","buildCollapsedSpan","ignoreWidget","needsContentAttribute","allText","spanStyle","spanEndStyle","spanStartStyle","nextChange","endStyles","foundBookmarks","upto","tokenText","wholeLineUpdateBefore","spansFor","linesFor","Line","lastText","lastSpans","nlines","added","LeafChunk","BranchChunk","chunkSize","sharedHistOnly","propagate","skip","rel","chunk","child","sz","getLines","h","lh","bidiOrdering","History","startGen","undoDepth","lastModTime","lastSelTime","lastOp","lastSelOp","histChange","attachLocalSpans","clearSelectionEvents","lastChangeEvent","opId","historyEventDelay","selectionEventCanBeMerged","existing","removeClearedSpans","copyHistoryArray","newGroup","instantiateSel","deepCopy","newChanges","Number","rebaseHistSelSingle","rebaseHistArray","sub","ok","copied","defaultPrevented","srcElement","button","getHandlers","emitter","_handlers","noHandlers","bnd","args","orphanDelayedCallbacks","fireOrphanDelayed","delayed","override","codemirrorIgnore","cursorActivity","eventMixin","ctor","spaceStrs","nothing","createObj","base","props","inst","create","isWordCharBasic","isEmpty","extendingChars","cssText","count","activeElement","root","classTest","as","forEachCodeMirror","getElementsByClassName","byClass","globalsRegistered","registerGlobalHandlers","resizeTimer","zwspSupported","badBidiRects","r0","r1","badZoomedRects","normal","fromRange","lineStart","visual","lineEnd","lineStartSmart","firstNonWS","inWS","compareBidiLevel","linedir","moveInLine","byUnit","userAgent","navigator","platform","ie_upto10","ie_11up","documentMode","qtwebkit","chrome","vendor","mac_geMountainLion","windows","presto_version","flipCtrlCmd","needsH","needsV","sWidth","totalHeight","totalWidth","zeroWidthHack","disableHoriz","enableZeroWidthBar","disableVert","w","pointerEvents","bar","delay","maybeDisable","elementFromPoint","native","null","cmpPos","prepareCopyCut","getSelections","selectInput","lineWiseCopyCut","textarea","poll","fastPoll","moveInputWithCursor","headPos","wrapOff","lineOff","teTop","teLeft","drawn","contextMenuPending","minimal","blur","resetPosition","slowPoll","pollInterval","missed","execCommand","same","self","prepareSelectAllHack","selectionStart","extval","selectionEnd","rehide","oldWrapperCSS","oldCSS","selectAll","detectingSelectAll","resetSelectionOnContextMenu","wrapperBox","oldScrollY","scrollY","mouseup","readOnlyChanged","onCopyCut","clearData","kludge","hadFocus","startData","ours","applyComposition","forceCompositionEnd","pollContent","showPrimarySelection","showMultipleSelections","curAnchor","anchorNode","anchorOffset","curFocus","focusNode","focusOffset","rangeCount","getRangeAt","rng","addRange","removeAllRanges","startGracePeriod","rememberSelection","selectionInEditor","commonAncestorContainer","pollSelection","fromIndex","fromNode","toIndex","toNode","newText","oldText","cutFront","cutEnd","oldTop","maxCutFront","newBot","oldBot","maxCutEnd","chFrom","chTo","contentEditable","contenteditable","there","wheelDeltaX","wheelDeltaY","detail","HORIZONTAL_AXIS","VERTICAL_AXIS","wheelDelta","wheelEventPixels","constructor","setOption","getDoc","addOverlay","spec","modeSpec","removeOverlay","indentSelection","newRanges","getLineTokens","getHelpers","helperType","_global","pred","getStateAfter","defaultTextHeight","defaultCharWidth","setGutterMarker","gutterID","clearGutter","lineInfo","addWidget","vspace","hspace","triggerOnKeyDown","triggerOnKeyPress","triggerOnKeyUp","amount","moveH","extendSelectionsBy","rtlMoveVisually","sel_move","deleteH","goalColumn","moveV","goals","startChar","check","toggleOverwrite","getScrollInfo","interpret","oldHeight","swapDoc","getInputField","getWrapperElement","getScrollerElement","getGutterElement","setValue","newBreaks","detach","attach","integer","tabIndex","modes","mimeModes","defineMode","dependencies","defineMIME","mime","resolveMode","mfactory","modeObj","modeExtensions","exts","modeProps","skipToEnd","extendMode","properties","defineExtension","func","defineDocExtension","defineInitHook","registerGlobalHelper","predicate","nstate","a1","a2","singleSelection","killLine","deleteLine","delLineLeft","delWrappedLineLeft","delWrappedLineRight","undo","redo","undoSelection","redoSelection","goDocStart","goDocEnd","goLineStart","goLineStartSmart","goLineEnd","goLineRight","goLineLeft","goLineLeftSmart","goLineUp","goLineDown","goPageUp","goPageDown","goCharLeft","goCharRight","goColumnLeft","goColumnRight","goWordLeft","goGroupRight","goGroupLeft","goWordRight","delCharBefore","delCharAfter","delWordBefore","delWordAfter","delGroupBefore","delGroupAfter","indentAuto","indentMore","indentLess","insertTab","insertSoftTab","spaces","defaultTab","transposeChars","newlineAndIndent","openLine","basic","Left","Right","Up","Down","End","Home","PageUp","PageDown","Delete","Backspace","Shift-Backspace","Tab","Shift-Tab","Enter","Insert","Esc","pcDefault","Ctrl-A","Ctrl-D","Ctrl-Z","Shift-Ctrl-Z","Ctrl-Y","Ctrl-Home","Ctrl-End","Ctrl-Up","Ctrl-Down","Ctrl-Left","Ctrl-Right","Alt-Left","Alt-Right","Ctrl-Backspace","Ctrl-Delete","Ctrl-S","Ctrl-F","Ctrl-G","Shift-Ctrl-G","Shift-Ctrl-F","Shift-Ctrl-R","Ctrl-[","Ctrl-]","Ctrl-U","Shift-Ctrl-U","Alt-U","fallthrough","emacsy","Ctrl-B","Ctrl-P","Ctrl-N","Alt-F","Alt-B","Ctrl-E","Ctrl-V","Shift-Ctrl-V","Ctrl-H","Alt-D","Alt-Backspace","Ctrl-K","Ctrl-T","Ctrl-O","macDefault","Cmd-A","Cmd-D","Cmd-Z","Shift-Cmd-Z","Cmd-Y","Cmd-Home","Cmd-Up","Cmd-End","Cmd-Down","Cmd-Left","Cmd-Right","Ctrl-Alt-Backspace","Alt-Delete","Cmd-S","Cmd-F","Cmd-G","Shift-Cmd-G","Cmd-Alt-F","Shift-Cmd-Alt-F","Cmd-[","Cmd-]","Cmd-Backspace","Cmd-Delete","Cmd-U","Shift-Cmd-U","normalizeKeyMap","keymap","keyname","keyNames","noShift","altGraphKey","tabindex","leaveSubmitMethodAlone","realSubmit","wrappedSubmit","getTextArea","toTextArea","lastColumnPos","lastColumnValue","sol","eat","eatWhile","eatSpace","skipTo","backUp","column","pattern","consume","caseInsensitive","cased","hideFirstChars","withOp","dHeight","oldH","removeInner","insertInner","iterN","remaining","leaf","maybeSpill","me","spilled","sibling","myIndex","used","nextDocId","cleanGeneration","getLineHandle","getLineNumber","getLineHandleVisualStart","lineCount","setCursor","addSelection","dup","setExtending","getExtending","historySize","markClean","changeGeneration","forceSplit","isClean","gen","getHistory","setHistory","histData","addLineClass","where","removeLineClass","removeLineWidget","setBookmark","realOpts","findMarksAt","getAllMarks","posFromIndex","sepSize","indexFromPos","copyHistory","linkedDoc","unlinkDoc","link","splitIds","iterLinkedDocs","getEditor","splitLinesAuto","eachLine","dontDelegate","method","e_stopPropagation","stopPropagation","cancelBubble","attachEvent","detachEvent","handlers","ms","startIndex","startValue","nextTab","goal","_e","nonASCIISingleCaseWordChar","createRange","endNode","setEnd","setStart","createTextRange","moveToElementText","moveEnd","moveStart","host","nl","rt","ownerDocument","parentElement","compareEndPoints","oncopy","18","19","20","27","32","33","34","35","36","37","38","39","40","44","45","46","59","61","91","92","93","106","107","109","110","111","127","173","186","187","188","189","190","191","192","219","220","221","222","63232","63233","63234","63235","63272","63273","63275","63276","63277","63302","charType","lowTypes","arabicTypes","BidiSpan","bidiRE","isNeutral","isStrong","countsAsLeft","countsAsNum","outerType","types","nstart","version","keySet","tokenCComment","maybeEnd","tokenize","parserConfig","ret","tp","tokenBase","tokenHooks","tokenString","tokenParenthesized","quote","escaped","Context","pushContext","popContext","pass","states","popAndPass","wordAsValue","valueKeywords","colorKeywords","inline","propertyKeywords","documentTypes","mediaTypes","mediaFeatures","mediaValueKeywords","nonStandardPropertyKeywords","fontProperties","counterDescriptors","allowNested","supportsAtComponent","stateArg","block","maybeprop","propBlock","_stream","parens","pseudo","atBlock","atComponentBlock","atBlock_parens","restricted_atBlock_before","restricted_atBlock","keyframes","interpolation","textAfter","blockCommentStart","blockCommentEnd","fold","documentTypes_","mediaTypes_","mediaFeatures_","mediaValueKeywords_","propertyKeywords_","nonStandardPropertyKeywords_","fontProperties_","counterDescriptors_","colorKeywords_","valueKeywords_","allWords","/",":","$","#","@","&","maybeBackup","pat","getAttrRegexp","attr","regexp","attrRegexpCache","getAttrValue","getTagRegexp","anchored","addTags","findMatchingMode","tagInfo","tagText","defaultTags","script","htmlState","inTag","endTagA","endTag","localState","localMode","multilineTagIndentFactor","multilineTagIndentPastTag","configTags","configScript","scriptTypes","matches","local","../css/css","../javascript/javascript","../xml/xml","expressionAllowed","lastType","readRegexp","inSet","cont","tokenComment","isOperatorChar","tokenQuasi","wordRE","known","keywords","propertyIsEnumerable","jsonldMode","isJsonldKeyword","findFatArrow","fatArrowAt","arrow","depth","sawSomething","bracket","brackets","JSLexical","inScope","varname","v","localVars","vars","parseJS","cc","marked","lexical","combinator","jsonMode","expression","statement","lex","inList","globalVars","pushcontext","defaultVars","popcontext","pushlex","poplex","expect","wanted","exp","vardef","maybeelse","functiondef","forspec","maybelabel","funarg","afterExport","afterImport","expressionInner","expressionNoComma","noComma","arrowBodyNoComma","arrowBody","commasep","maybeop","maybeoperatorNoComma","maybeoperatorComma","atomicTypes","maybeexpressionNoComma","maybeexpression","arrayLiteral","contCommasep","objprop","quasi","maybeTarget","expr","continueQuasi","targetNoComma","_","getterSetter","afterprop","proceed","maybetype","isTS","typeexpr","maybedefault","afterType","maybeAssign","vardefCont","proppattern","_type","forspec1","forspec2","formaybeinof","forspec3","classNameAfter","classBody","classGetterSetter","maybeFrom","importSpec","maybeAs","isContinuedStatement","statementIndent","jsonld","json","typescript","wordCharacters","kw","A","B","C","operator","atom","jsKeywords","if","while","with","else","do","try","finally","return","break","continue","new","delete","throw","debugger","var","const","let","function","catch","for","switch","case","default","in","typeof","instanceof","true","false","super","yield","export","import","extends","await","async","tsKeywords","interface","implements","namespace","enum","public","private","protected","abstract","boolean","any","variable","jsonld-keyword","basecolumn","firstChar","doubleIndentSwitch","lineComment","closeBrackets","skipExpression","21","htmlConfig","autoSelfClosers","area","br","command","embed","frame","hr","keygen","meta","param","track","wbr","menuitem","implicitlyClosed","dd","li","optgroup","rp","tbody","td","tfoot","tr","contextGrabbers","dt","address","article","aside","blockquote","dl","fieldset","footer","h1","h2","h3","h4","h5","h6","header","hgroup","menu","nav","ol","section","table","ul","thead","doNotIndent","allowUnquoted","allowMissing","caseFold","xmlConfig","editorConf","config_","inText","chain","parser","inBlock","doctype","baseState","tagStart","inAttribute","stringStartCol","closure","isInAttribute","terminator","startOfLine","noIndent","maybePopContext","nextTagName","parentTagName","tagNameState","closeTagNameState","setStyle","attrState","matchClosing","closeState","closeStateErr","attrEqState","attrValueState","attrContinuedState","isInText","baseIndent","fullLine","alignCDATA","tagAfter","grabbers","skipAttribute"],"mappings":"CAAA,WAAe,GAAIA,GAAUC,OAAeC,EAASD,QAAW,QAAUE,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,GAAkB,kBAATV,IAAqBA,CAAQ,KAAIS,GAAGC,EAAE,MAAOA,GAAEF,GAAE,EAAI,IAAGG,EAAE,MAAOA,GAAEH,GAAE,EAAI,IAAII,GAAE,GAAIC,OAAM,uBAAuBL,EAAE,IAAK,MAAMI,GAAEE,KAAK,mBAAmBF,EAAE,GAAIG,GAAEV,EAAEG,IAAIQ,WAAYZ,GAAEI,GAAG,GAAGS,KAAKF,EAAEC,QAAQ,SAASb,GAAG,GAAIE,GAAED,EAAEI,GAAG,GAAGL,EAAG,OAAOI,GAAEF,EAAEA,EAAEF,IAAIY,EAAEA,EAAEC,QAAQb,EAAEC,EAAEC,EAAEC,GAAG,MAAOD,GAAEG,GAAGQ,QAAkD,IAAI,GAA1CL,GAAkB,kBAATX,IAAqBA,EAAgBQ,EAAE,EAAEA,EAAEF,EAAEY,OAAOV,IAAID,EAAED,EAAEE,GAAI,OAAOD,KAAKY,GAAG,SAASnB,EAAQoB,EAAOJ,G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1D,GAAY,MAAO,EAC/D,IAAI8S,GAAW9S,GAAa,sBAAsB97D,KAAK87D,EACvD,IAAI8S,GAAYA,EAAS,GACvB,KAAOjnE,GAAS,CACd,GAAIA,EAAQ1B,SAAW2oE,EAAS,GAAI,CAClCjnE,EAAUA,EAAQa,IAClB,OACK,IAAIhe,EAAO6/E,iBAAiBp6D,eAAetI,EAAQ1B,SAGxD,KAFA0B,GAAUA,EAAQa,SAKjB,IAAIomE,EACT,KAAOjnE,GAAS,CACd,GAAIknE,GAAWrkF,EAAOsgF,gBAAgBnjE,EAAQ1B,QAC9C,KAAI4oE,IAAYA,EAAS5+D,eAAe2+D,EAAS,IAG/C,KAFAjnE,GAAUA,EAAQa,KAKxB,KAAOb,GAAWA,EAAQa,OAASb,EAAQ8lE,aACzC9lE,EAAUA,EAAQa,IACpB,OAAIb,GAAgBA,EAAQ9E,OAAS+kC,EACzBh1C,EAAM67E,YAAc,GAGlC5rD,cAAe,gBACfk5C,kBAAmB,OACnBC,gBAAiB,MAEjB71D,cAAe3b,EAAOoM,SAAW,OAAS,MAC1CirD,WAAYr3D,EAAOoM,SAAW,OAAS,MAEvCk4E,cAAe,SAASl8E,GAClBA,EAAMA,OAAS07E,IACjB17E,EAAMA,MAAQq7E,OAKtBr4E,EAAW+uD,WAAW,WAAY,OAClC/uD,EAAW+uD,WAAW,kBAAmB,OACpC/uD,EAAW4uD,UAAUv0C,eAAe,cACvCra,EAAW+uD,WAAW,aAAc73D,KAAM,MAAO8J,UAAU,QAI1DyS,uBAAuB,UAAU","file":"forms-admin.min.js","sourcesContent":["(function () { var require = undefined; var define = undefined; (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){\n'use strict';\n\nvar rows = function(m, i18n) {\n\n\tvar r = {};\n\n\tr.label = function (config) {\n\t\t// label row\n\t\treturn m(\"div\", [\n\t\t\tm(\"label\", i18n.fieldLabel),\n\t\t\tm(\"input.widefat\", {\n\t\t\t\ttype : \"text\",\n\t\t\t\tvalue : config.label(),\n\t\t\t\tonchange : m.withAttr('value', config.label),\n\t\t\t\tplaceholder: config.title()\n\t\t\t})\n\t\t]);\n\t};\n\n\tr.value = function (config) {\n\t\treturn m(\"div\", [\n\t\t\tm(\"label\", [\n\t\t\t\ti18n.value,\n\t\t\t\t\" \",\n\t\t\t\tconfig.type() === 'hidden' ? '' : m('small', { \"style\": \"float: right; font-weight: normal;\" }, i18n.optional )\n\t\t\t]),\n\t\t\tm(\"input.widefat\", {\n\t\t\t\ttype : \"text\",\n\t\t\t\tvalue : config.value(),\n\t\t\t\tonchange: m.withAttr('value', config.value)\n\t\t\t}),\n\t\t\tm('p.help', i18n.valueHelp)\n\t\t]);\n\t};\n\n\tr.numberMinMax = function (config) {\n\t\treturn m('div', [\n\t\t\tm('div.row', [\n\t\t\t\tm('div.col.col-3', [\n\t\t\t\t\tm('label', i18n.min),\n\t\t\t\t\tm('input', {type: 'number', onchange: m.withAttr('value', config.min)})\n\t\t\t\t]),\n\t\t\t\tm('div.col.col-3', [\n\t\t\t\t\tm('label', i18n.max),\n\t\t\t\t\tm('input', {type: 'number', onchange: m.withAttr('value', config.max)})\n\t\t\t\t])\n\t\t\t])\n\t\t])\n\t};\n\n\n\tr.isRequired = function (config) {\n\t\tvar inputAtts = {\n\t\t\ttype : 'checkbox',\n\t\t\tchecked : config.required(),\n\t\t\tonchange: m.withAttr('checked', config.required)\n\t\t};\n\t\tvar desc;\n\n\t\tif( config.forceRequired() ) {\n\t\t\tinputAtts.required = true;\n\t\t\tinputAtts.disabled = true;\n\t\t\tdesc = m('p.help', i18n.forceRequired );\n\t\t}\n\n\t\treturn m('div', [\n\t\t\tm('label.cb-wrap', [\n\t\t\t\tm('input', inputAtts),\n\t\t\t\ti18n.isFieldRequired\n\t\t\t]),\n\t\t\tdesc\n\t\t]);\n\t};\n\n\tr.placeholder = function (config) {\n\n\t\treturn m(\"div\", [\n\t\t\tm(\"label\", [\n\t\t\t\ti18n.placeholder,\n\t\t\t\t\" \",\n\t\t\t\tm('small', { \"style\": \"float: right; font-weight: normal;\" }, i18n.optional )\n\t\t\t]),\n\t\t\tm(\"input.widefat\", {\n\t\t\t\ttype : \"text\",\n\t\t\t\tvalue : config.placeholder(),\n\t\t\t\tonchange: m.withAttr('value', config.placeholder),\n\t\t\t\tplaceholder: \"\"\n\t\t\t}),\n\t\t\tm(\"p.help\", i18n.placeholderHelp)\n\t\t]);\n\t};\n\n\tr.useParagraphs = function (config) {\n\t\treturn m('div', [\n\t\t\tm('label.cb-wrap', [\n\t\t\t\tm('input', {\n\t\t\t\t\ttype : 'checkbox',\n\t\t\t\t\tchecked : config.wrap(),\n\t\t\t\t\tonchange: m.withAttr('checked', config.wrap)\n\t\t\t\t}),\n\t\t\t\ti18n.wrapInParagraphTags\n\t\t\t])\n\t\t]);\n\t};\n\n\tr.choiceType = function (config) {\n\t\treturn m('div', [\n\t\t\tm('label', i18n.choiceType ),\n\t\t\tm('select', {\n\t\t\t\tvalue : config.type(),\n\t\t\t\tonchange: m.withAttr('value', config.type)\n\t\t\t}, [\n\t\t\t\tm('option', {\n\t\t\t\t\tvalue : 'select',\n\t\t\t\t\tselected: config.type() === 'select' ? 'selected' : false\n\t\t\t\t}, i18n.dropdown ),\n\t\t\t\tm('option', {\n\t\t\t\t\tvalue : 'radio',\n\t\t\t\t\tselected: config.type() === 'radio' ? 'selected' : false\n\t\t\t\t}, i18n.radioButtons ),\n\t\t\t\tm('option', {\n\t\t\t\t\tvalue : 'checkbox',\n\t\t\t\t\tselected: config.type() === 'checkbox' ? 'selected' : false\n\t\t\t\t}, i18n.checkboxes )\n\t\t\t])\n\t\t]);\n\t};\n\n\tr.choices = function (config) {\n\n\t\tvar html = [];\n\t\thtml.push(m('div', [\n\t\t\tm('label', i18n.choices),\n\t\t\tm('div.limit-height', [\n\t\t\t\tm(\"table\", [\n\n\t\t\t\t\t// table body\n\t\t\t\t\tconfig.choices().map(function (choice, index) {\n\t\t\t\t\t\treturn m('tr', {\n\t\t\t\t\t\t\t'data-id': index\n\t\t\t\t\t\t}, [\n\t\t\t\t\t\t\tm('td.cb', m('input', {\n\t\t\t\t\t\t\t\t\tname: 'selected',\n\t\t\t\t\t\t\t\t\ttype: (config.type() === 'checkbox' ) ? 'checkbox' : 'radio',\n\t\t\t\t\t\t\t\t\tonchange: m.withAttr('value', config.selectChoice.bind(config)),\n\t\t\t\t\t\t\t\t\tchecked: choice.selected(),\n\t\t\t\t\t\t\t\t\tvalue: choice.value(),\n\t\t\t\t\t\t\t\t\ttitle: i18n.preselect\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tm('td.stretch', m('input.widefat', {\n\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\tvalue: choice.label(),\n\t\t\t\t\t\t\t\tplaceholder: choice.title(),\n\t\t\t\t\t\t\t\tonchange: m.withAttr('value', choice.label)\n\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\tm('td', m('span', {\n\t\t\t\t\t\t\t\t\"title\": i18n.remove,\n\t\t\t\t\t\t\t\t\"class\": 'dashicons dashicons-no-alt hover-activated',\n\t\t\t\t\t\t\t\t\"onclick\": function (key) {\n\t\t\t\t\t\t\t\t\tthis.choices().splice(key, 1);\n\t\t\t\t\t\t\t\t}.bind(config, index)\n\t\t\t\t\t\t\t}, ''))\n\t\t\t\t\t\t])\n\t\t\t\t\t})\n\t\t\t\t]) // end of table\n\t\t\t]) // end of limit-height div\n\t\t]));\n\t\t\n\t\treturn html;\n\n\t};\n\n\treturn r;\n};\n\nmodule.exports = rows;\n},{}],2:[function(require,module,exports){\nvar forms = function(m, i18n) {\n\tvar forms = {};\n\tvar rows = require('./field-forms-rows.js')(m, i18n);\n\n\t// route to one of the other form configs, default to \"text\"\n\tforms.render = function(config) {\n\n\t\tvar type = config.type();\n\n\t\tif( typeof( forms[type] ) === \"function\" ) {\n\t\t\treturn forms[ type ](config);\n\t\t}\n\n\t\tswitch( type ) {\n\t\t\tcase 'select':\n\t\t\tcase 'radio':\n\t\t\tcase 'checkbox':\n\t\t\t\treturn forms.choice(config);\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// fallback to good old text field\n\t\treturn forms.text(config);\n\t};\n\n\n\tforms.text = function(config) {\n\t\treturn [\n\t\t\trows.label(config),\n\t\t\trows.placeholder(config),\n\t\t\trows.value(config),\n\t\t\trows.isRequired(config),\n\t\t\trows.useParagraphs(config)\n\t\t]\n\t};\n\n\tforms.choice = function(config) {\n\t\tvar visibleRows = [\n\t\t\trows.label(config),\n\t\t\trows.choiceType(config),\n\t\t\trows.choices(config),\n\t\t];\n\n\t\tif( config.type() === 'select' ) {\n\t\t\tvisibleRows.push(rows.placeholder(config));\n\t\t}\n\n\t\tvisibleRows.push(rows.useParagraphs(config));\n\n\t\tif( config.type() === 'select' || config.type() === 'radio' ) {\n\t\t\tvisibleRows.push(rows.isRequired(config));\n\t\t}\n\n\t\treturn visibleRows;\n\t};\n\n\tforms.hidden = function( config ) {\n\t\tconfig.placeholder('');\n\t\tconfig.label('');\n\t\tconfig.wrap(false);\n\n\t\t// if this hidden field has choices (hidden goups), glue them together by their label.\n\t\tif( config.choices().length > 0 ) {\n\t\t\tconfig.value( config.choices().map(function(c) {\n\t\t\t\treturn c.label();\n\t\t\t}).join('|'));\n\t\t}\n\n\t\treturn [\n\t\t\trows.value(config)\n\t\t]\n\t};\n\n\tforms.submit = function(config) {\n\n\t\tconfig.label('');\n\t\tconfig.placeholder('');\n\n\t\treturn [\n\t\t\trows.value(config),\n\t\t\trows.useParagraphs(config)\n\t\t]\n\t};\n\n\tforms.number = function(config) {\n\n\t\treturn [\n\t\t\tforms.text(config),\n\t\t\trows.numberMinMax(config)\n\t\t];\n\t};\n\n\treturn forms;\n};\n\n\n\nmodule.exports = forms;\n},{\"./field-forms-rows.js\":1}],3:[function(require,module,exports){\n'use strict';\n\nvar render = require('../third-party/render.js');\nvar html_beautify = require('../third-party/beautify-html.js');\n\nvar g = function(m) {\n\tvar generators = {};\n\n\t/**\n\t * Generates a <select> field\n\t * @param config\n\t * @returns {*}\n\t */\n\tgenerators.select = function (config) {\n\t\tvar attributes = {\n\t\t\tname: config.name(),\n\t\t\trequired: config.required()\n\t\t};\n\t\tvar hasSelection = false;\n\n\t\tvar options = config.choices().map(function (choice) {\n\n\t\t\tif( choice.selected() ) {\n\t\t\t\thasSelection = true;\n\t\t\t}\n\n\t\t\treturn m('option', {\n\t\t\t\tvalue : ( choice.value() !== choice.label() ) ? choice.value() : undefined,\n\t\t\t\t\"selected\": choice.selected()\n\t\t\t}, choice.label())\n\t\t});\n\n\t\tvar placeholder = config.placeholder();\n\t\tif(placeholder.length > 0 ) {\n\t\t\toptions.unshift(\n\t\t\t\tm('option', {\n\t\t\t\t\t'disabled': true,\n\t\t\t\t\t'value': '',\n\t\t\t\t\t'selected': ! hasSelection\n\t\t\t\t}, placeholder)\n\t\t\t);\n\t\t}\n\n\t\treturn m('select', attributes, options );\n\t};\n\n\t/**\n\t * Generates a checkbox or radio type input field.\n\t *\n\t * @param config\n\t * @returns {*}\n\t */\n\tgenerators.checkbox = function (config) {\n\t\tvar field = config.choices().map(function (choice) {\n\t\t\tvar name = config.name() + ( config.type() === 'checkbox' ? '[]' : '' );\n\t\t\tvar required = config.required() && config.type() === 'radio';\n\n\t\t\treturn m('label', [\n\t\t\t\t\tm('input', {\n\t\t\t\t\t\tname : name,\n\t\t\t\t\t\ttype : config.type(),\n\t\t\t\t\t\tvalue : choice.value(),\n\t\t\t\t\t\tchecked : choice.selected(),\n\t\t\t\t\t\trequired: required\n\t\t\t\t\t}),\n\t\t\t\t\t' ',\n\t\t\t\t\tm('span', choice.label())\n\t\t\t\t]\n\t\t\t)\n\t\t});\n\t\t\n\t\treturn field;\n\t};\n\tgenerators.radio = generators.checkbox;\n\n\t/**\n\t * Generates a default field\n\t *\n\t * - text, url, number, email, date\n\t *\n\t * @param config\n\t * @returns {*}\n\t */\n\tgenerators['default'] = function (config) {\n\n\t\tvar attributes = {\n\t\t\ttype: config.type()\n\t\t};\n\t\tvar field;\n\n\t\tif (config.name()) {\n\t\t\tattributes.name = config.name();\n\t\t}\n\n\t\tif (config.min()) {\n\t\t\tattributes.min = config.min();\n\t\t}\n\n\t\tif (config.max()) {\n\t\t\tattributes.max = config.max();\n\t\t}\n\n\t\tif (config.value().length > 0) {\n\t\t\tattributes.value = config.value();\n\t\t}\n\n\t\tif( config.placeholder().length > 0 ) {\n\t\t\tattributes.placeholder = config.placeholder();\n\t\t}\n\n\t\tattributes.required = config.required();\n\n\t\tfield = m('input', attributes);\n\t\treturn field;\n\t};\n\n\t/**\n\t * Generates an HTML string based on a field (config) object\n\t *\n\t * @param config\n\t * @returns {*}\n\t */\n\tfunction generate(config) {\n\t\tvar label, field, htmlTemplate, html;\n\n\t\tlabel = config.label().length ? m(\"label\", config.label()) : '';\n\t\tfield = typeof(generators[config.type()]) === \"function\" ? generators[config.type()](config) : generators['default'](config);\n\n\t\thtmlTemplate = config.wrap() ? m('p', [label, field]) : [label, field];\n\n\t\t// render HTML on memory node\n\t\thtml = render(htmlTemplate);\n\n\t\t// prettify html\n\t\thtml = html_beautify(html);\n\n\t\treturn html + \"\\n\";\n\t}\n\n\treturn generate;\n};\n\nmodule.exports = g;\n},{\"../third-party/beautify-html.js\":12,\"../third-party/render.js\":13}],4:[function(require,module,exports){\nvar FieldHelper = function(m, tabs, editor, fields, i18n) {\n\t'use strict';\n\n\tvar generate = require('./field-generator.js')(m);\n\tvar overlay = require('./overlay.js')(m,i18n);\n\tvar forms = require('./field-forms.js')(m, i18n);\n\tvar fieldConfig;\n\n\teditor.on('blur', m.redraw);\n\n\t/**\n\t * Choose a field to open the helper form for\n\t *\n\t * @param index\n\t * @returns {*}\n\t */\n\tfunction setActiveField(index) {\n\t\tfieldConfig = fields.get(index);\n\t\tm.redraw();\n\t}\n\n\n\t/**\n\t * Controller\n\t */\n\tfunction controller() {\n\n\t}\n\n\t/**\n\t * Create HTML based on current config object\n\t */\n\tfunction createFieldHTMLAndAddToForm() {\n\n\t\t// generate html\n\t\tvar html = generate(fieldConfig);\n\n\t\t// add to editor\n\t\teditor.insert( html );\n\n\t\t// reset field form\n\t\tsetActiveField('');\n\n\t\t// redraw\n\t\tm.redraw();\n\t}\n\n\t/**\n\t * View\n\t * @returns {*}\n\t */\n\tfunction view() {\n\n\t\t// build DOM for fields choice\n\t\tvar fieldCategories = fields.getCategories();\n\t\tvar availableFields = fields.getAll();\n\n\t\tvar fieldsChoice = m( \"div.available-fields.small-margin\", [\n\t\t\tm(\"h4\", i18n.chooseField),\n\n\t\t\tfieldCategories.map(function(category) {\n\t\t\t\tvar categoryFields = availableFields.filter(function(f) {\n\t\t\t\t\treturn f.category === category;\n\t\t\t\t});\n\n\t\t\t\tif( ! categoryFields.length ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\treturn m(\"div.tiny-margin\",[\n\t\t\t\t\tm(\"strong\", category),\n\n\t\t\t\t\t// render fields\n\t\t\t\t\tcategoryFields.map(function(field) {\n\t\t\t\t\t\tvar className = \"button\";\n\t\t\t\t\t\tif( field.forceRequired() ) {\n\t\t\t\t\t\t\tclassName += \" is-required\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar inForm = field.inFormContent();\n\t\t\t\t\t\tif( inForm !== null ) {\n\t\t\t\t\t\t\tclassName += \" \" + ( inForm ? 'in-form' : 'not-in-form' );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn m(\"button\", {\n\t\t\t\t\t\t\tclassName: className,\n\t\t\t\t\t\t\ttype : 'button',\n\t\t\t\t\t\t\tonclick: m.withAttr(\"value\", setActiveField),\n\t\t\t\t\t\t\tvalue : field.index\n\t\t\t\t\t\t}, field.title() );\n\t\t\t\t\t})\n\t\t\t\t]);\n\t\t\t})\n\t\t]);\n\n\t\t// build DOM for overlay\n\t\tvar form = null;\n\t\tif( fieldConfig ) {\n\t\t\tform = overlay(\n\t\t\t\t// field wizard\n\t\t\t\tm(\"div.field-wizard\", [\n\n\t\t\t\t\t//heading\n\t\t\t\t\tm(\"h3\", [\n\t\t\t\t\t\tfieldConfig.title(),\n\t\t\t\t\t\tfieldConfig.forceRequired() ? m('span.red', '*' ) : '',\n\t\t\t\t\t\tfieldConfig.name().length ? m(\"code\", fieldConfig.name()) : ''\n\t\t\t\t\t]),\n\n\t\t\t\t\t// help text\n\t\t\t\t\t( fieldConfig.help().length ) ? m('p', m.trust( fieldConfig.help() ) ) : '',\n\n\t\t\t\t\t// actual form\n\t\t\t\t\tforms.render(fieldConfig),\n\n\t\t\t\t\t// add to form button\n\t\t\t\t\tm(\"p\", [\n\t\t\t\t\t\tm(\"button\", {\n\t\t\t\t\t\t\t\"class\": \"button-primary\",\n\t\t\t\t\t\t\ttype: \"button\",\n\t\t\t\t\t\t\tonkeydown: function(e) {\n\t\t\t\t\t\t\t\te = e || window.event;\n\t\t\t\t\t\t\t\tif(e.keyCode == 13) {\n\t\t\t\t\t\t\t\t\tcreateFieldHTMLAndAddToForm();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonclick: createFieldHTMLAndAddToForm\n\t\t\t\t\t\t}, i18n.addToForm )\n\t\t\t\t\t])\n\t\t\t\t]), setActiveField);\n\t\t}\n\n\t\treturn [\n\t\t\tfieldsChoice,\n\t\t\tform\n\t\t];\n\t}\n\n\t// expose some variables\n\treturn {\n\t\tview: view,\n\t\tcontroller: controller\n\t}\n};\n\nmodule.exports = FieldHelper;\n},{\"./field-forms.js\":2,\"./field-generator.js\":3,\"./overlay.js\":10}],5:[function(require,module,exports){\nvar FieldFactory = function(fields, i18n) {\n\t'use strict';\n\n\t/**\n\t * Array of registered fields\n\t *\n\t * @type {Array}\n\t */\n\tvar registeredFields = [];\n\n\t/**\n\t * Reset all previously registered fields\n\t */\n\tfunction reset() {\n\t\t// clear all of our fields\n\t\tregisteredFields.forEach(fields.deregister);\n\t}\n\n\t/**\n\t * Helper function to quickly register a field and store it in local scope\n\t *\n\t * @param {object} data\n\t * @param {boolean} sticky\n\t */\n\tfunction register(category, data, sticky) {\n\t\tvar field = fields.register(category, data);\n\n\t\tif( ! sticky ) {\n\t\t\tregisteredFields.push(field);\n\t\t}\n\t}\n\n\t/**\n\t * Normalizes the field type which is passed by MailChimp\n\t *\n\t * @param type\n\t * @returns {*}\n\t */\n\tfunction getFieldType(type) {\n\n\t\tvar map = {\n\t\t\t'phone' : 'tel',\n\t\t\t'dropdown': 'select',\n\t\t\t'checkboxes': 'checkbox',\n\t\t\t'birthday': 'text'\n\t\t};\n\n\t\treturn typeof map[ type ] !== \"undefined\" ? map[type] : type;\n\t}\n\n\t/**\n\t * Register the various fields for a merge var\n\t *\n\t * @param mergeField\n\t * @returns {boolean}\n\t */\n\tfunction registerMergeField(mergeField) {\n\n\t\tvar category = i18n.listFields;\n\n\t\t// name, type, title, value, required, label, placeholder, choices, wrap\n\t\tvar data = {\n\t\t\tname: mergeField.tag,\n\t\t\ttitle: mergeField.name,\n\t\t\trequired: mergeField.required,\n\t\t\tforceRequired: mergeField.required,\n\t\t\ttype: getFieldType(mergeField.field_type),\n\t\t\tchoices: mergeField.choices\n\t\t};\n\n\t\tif( data.type !== 'address' ) {\n\t\t\tregister(category, data, false);\n\t\t} else {\n\t\t\tregister(category, { name: data.name + '[addr1]', type: 'text', title: i18n.streetAddress });\n\t\t\tregister(category, { name: data.name + '[city]', type: 'text', title: i18n.city });\n\t\t\tregister(category, { name: data.name + '[state]', type: 'text', title: i18n.state });\n\t\t\tregister(category, { name: data.name + '[zip]', type: 'text', title: i18n.zip });\n\t\t\tregister(category, { name: data.name + '[country]', type: 'select', title: i18n.country, choices: mc4wp_vars.countries });\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Register a field for a MailChimp grouping\n\t *\n\t * @param interestCategory\n\t */\n\tfunction registerInterestCategory(interestCategory){\n\t\tvar category = i18n.interestCategories;\n\n\t\tvar data = {\n\t\t\ttitle: interestCategory.name,\n\t\t\tname: 'INTERESTS[' + interestCategory.id + ']',\n\t\t\ttype: getFieldType(interestCategory.field_type),\n\t\t\tchoices: interestCategory.interests\n\t\t};\n\t\tregister(category, data, false);\n\t}\n\n\t/**\n\t * Register all fields belonging to a list\n\t *\n\t * @param list\n\t */\n\tfunction registerListFields(list) {\n\n\t\t// make sure EMAIL && public fields come first\n\t\tlist.merge_fields = list.merge_fields.sort(function(a, b) {\n\t\t\tif( a.tag === 'EMAIL' || ( a.public && ! b.public ) ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\tif( ! a.public && b.public ) {\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\treturn 0;\n\t\t});\n\n\t\t// loop through merge vars\n\t\tlist.merge_fields.forEach(registerMergeField);\n\n\t\t// loop through groupings\n\t\tlist.interest_categories.forEach(registerInterestCategory);\n\t}\n\n\t/**\n\t * Register all lists fields\n\t *\n\t * @param lists\n\t */\n\tfunction registerListsFields(lists) {\n\t\treset();\n\t\tlists.forEach(registerListFields);\n\t}\n\n\tfunction registerCustomFields(lists) {\n\n\t\tvar choices,\n\t\t\tcategory = i18n.formFields;\n\n\t\t// register submit button\n\t\tregister(category, {\n\t\t\tname: '',\n\t\t\tvalue: i18n.subscribe,\n\t\t\ttype: \"submit\",\n\t\t\ttitle: i18n.submitButton\n\t\t}, true);\n\n\t\t// register lists choice field\n\t\tchoices = {};\n\t\tfor(var key in lists) {\n\t\t\tchoices[lists[key].id] = lists[key].name;\n\t\t}\n\n\t\tregister(category, {\n\t\t\tname: '_mc4wp_lists',\n\t\t\ttype: 'checkbox',\n\t\t\ttitle: i18n.listChoice,\n\t\t\tchoices: choices,\n\t\t\thelp: i18n.listChoiceDescription\n\t\t}, true);\n\n\t\tchoices = {\n\t\t\t'subscribe': \"Subscribe\",\n\t\t\t'unsubscribe': \"Unsubscribe\"\n\t\t};\n\t\tregister(category, {\n\t\t\tname: '_mc4wp_action',\n\t\t\ttype: 'radio',\n\t\t\ttitle: i18n.formAction,\n\t\t\tchoices: choices,\n\t\t\tvalue: 'subscribe',\n\t\t\thelp: i18n.formActionDescription\n\t\t}, true);\n\t}\n\n\t/**\n\t * Expose some methods\n\t */\n\treturn {\n\t\t'registerCustomFields': registerCustomFields,\n\t\t'registerListFields': registerListFields,\n\t\t'registerListsFields': registerListsFields\n\t}\n\n};\n\nmodule.exports = FieldFactory;\n},{}],6:[function(require,module,exports){\n'use strict';\n\nmodule.exports = function(m, events) {\n var timeout;\n\tvar fields = [];\n\tvar categories = [];\n\n\n\t/**\n\t * @internal\n\t *\n\t *\n\t * @param data\n\t * @constructor\n\t */\n\tvar Field = function (data) {\n\t\tthis.name = m.prop(data.name);\n\t\tthis.title = m.prop(data.title || data.name);\n\t\tthis.type = m.prop(data.type);\n\t\tthis.label = m.prop(data.title || '');\n\t\tthis.value = m.prop(data.value || '');\n\t\tthis.placeholder = m.prop(data.placeholder || '');\n\t\tthis.required = m.prop(data.required || false);\n\t\tthis.forceRequired = m.prop( data.forceRequired || false );\n\t\tthis.wrap = m.prop(data.wrap || true);\n\t\tthis.min = m.prop(data.min || null);\n\t\tthis.max = m.prop(data.max || null);\n\t\tthis.help = m.prop(data.help || '');\n\t\tthis.choices = m.prop(data.choices || []);\n\t\tthis.inFormContent = m.prop(null);\n\n\t\tthis.selectChoice = function(value) {\n\t\t\tvar field = this;\n\n\t\t\tthis.choices(this.choices().map(function(choice) {\n\n\t\t\t\tif( choice.value() === value ) {\n\t\t\t\t\tchoice.selected(true);\n\t\t\t\t} else {\n\t\t\t\t\t// only checkboxes allow for multiple selections\n\t\t\t\t\tif( field.type() !== 'checkbox' ) {\n\t\t\t\t\t\tchoice.selected(false);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn choice;\n\n\t\t\t}));\n\t\t};\n\t};\n\n\t/**\n\t * @internal\n\t *\n\t * @param data\n\t * @constructor\n\t */\n\tvar FieldChoice = function (data) {\n\t\tthis.label = m.prop(data.label);\n\t\tthis.title = m.prop(data.title || data.label);\n\t\tthis.selected = m.prop(data.selected || false);\n\t\tthis.value = m.prop(data.value || data.label);\n\t};\n\n\t/**\n\t * Creates FieldChoice objects from an (associative) array of data objects\n\t *\n\t * @param data\n\t * @returns {Array}\n\t */\n\tfunction createChoices(data) {\n\t\tvar choices = [];\n\t\tif (typeof( data.map ) === \"function\") {\n\t\t\tchoices = data.map(function (choiceLabel) {\n\t\t\t\treturn new FieldChoice({label: choiceLabel});\n\t\t\t});\n\t\t} else {\n\t\t\tchoices = Object.keys(data).map(function (key) {\n\t\t\t\tvar choiceLabel = data[key];\n\t\t\t\treturn new FieldChoice({label: choiceLabel, value: key});\n\t\t\t});\n\t\t}\n\n\t\treturn choices;\n\t}\n\n\t/**\n\t * Factory method\n\t *\n\t * @api\n\t *\n\t * @param data\n\t * @returns {Field}\n\t */\n\tfunction register(category, data) {\n\n\t\tvar field;\n\t\tvar existingField = getAllWhere('name', data.name).shift();\n\n\t\t// a field with the same \"name\" already exists\n\t\tif(existingField) {\n\n\t\t\t// update \"required\" status\n\t\t\tif( ! existingField.required() && data.required ) {\n\t\t\t\texistingField.required(true);\n\t\t\t}\n\n\t\t\t// bail\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// array of choices given? convert to FieldChoice objects\n\t\tif (data.choices) {\n\t\t\tdata.choices = createChoices(data.choices);\n\n\t\t\tif( data.value) {\n\t\t\t\tdata.choices = data.choices.map(function(choice) {\n\t\t\t\t\tif(choice.value() === data.value) {\n\t\t\t\t\t\tchoice.selected(true);\n\t\t\t\t\t}\n\t\t\t\t\treturn choice;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// register category\n\t\tif( categories.indexOf(category) < 0 ) {\n\t\t\tcategories.push(category);\n\t\t}\n\n\t\t// create Field object\n\t\tfield = new Field(data);\n\t\tfield.category = category;\n\n\t\t// add to array\n\t\tfields.push(field);\n\n\t\t// redraw view\n timeout && window.clearTimeout(timeout);\n timeout = window.setTimeout(m.redraw, 100);\n\n\t\t// trigger event\n\t\tevents.trigger('fields.change');\n\n\t\treturn field;\n\t}\n\n\t/**\n\t * @api\n\t *\n\t * @param field\n\t */\n\tfunction deregister(field) {\n\t\tvar index = fields.indexOf(field);\n\t\tif (index > -1) {\n\t\t\tdelete fields[index];\n\t\t\tm.redraw();\n\t\t}\n\t}\n\n\t/**\n\t * Get a field config object\n\t *\n\t * @param name\n\t * @returns {*}\n\t */\n\tfunction get(name) {\n\t\treturn fields[name];\n\t}\n\n\t/**\n\t * Get all field config objects\n\t *\n\t * @returns {Array|*}\n\t */\n\tfunction getAll() {\n\t\t// rebuild index property on all fields\n\t\tfields = fields.map(function(f, i) {\n\t\t\tf.index = i;\n\t\t\treturn f;\n\t\t});\n\n\t\treturn fields;\n\t}\n\n\tfunction getCategories() {\n\t\treturn categories;\n\t}\n\n\t/**\n\t * Get all fields where a property matches the given value\n\t *\n\t * @param searchKey\n\t * @param searchValue\n\t * @returns {Array|*}\n\t */\n\tfunction getAllWhere(searchKey, searchValue) {\n\t\treturn fields.filter(function (field) {\n\t\t\treturn field[searchKey]() === searchValue;\n\t\t});\n\t}\n\n\n\t/**\n\t * Exposed methods\n\t */\n\treturn {\n\t\t'get' : get,\n\t\t'getAll' : getAll,\n\t\t'getCategories': getCategories,\n\t\t'deregister' : deregister,\n\t\t'register' : register,\n\t\t'getAllWhere': getAllWhere\n\t};\n};\n},{}],7:[function(require,module,exports){\n'use strict';\n\n// load CodeMirror & plugins\nvar CodeMirror = require('codemirror');\nrequire('codemirror/mode/xml/xml');\nrequire('codemirror/mode/javascript/javascript');\nrequire('codemirror/mode/css/css');\nrequire('codemirror/mode/htmlmixed/htmlmixed');\nrequire('codemirror/addon/fold/xml-fold');\nrequire('codemirror/addon/edit/matchtags');\nrequire('codemirror/addon/edit/closetag.js');\n\nvar FormEditor = function(element) {\n\n\t// create dom representation of form\n\tvar _dom = document.createElement('form'),\n\t\tdomDirty = false,\n\t\tr = {},\n\t\teditor;\n\n\t_dom.innerHTML = element.value.toLowerCase();\n\n\tif( CodeMirror ) {\n\t\teditor = CodeMirror.fromTextArea(element, {\n\t\t\tselectionPointer: true,\n\t\t\tmatchTags: { bothTags: true },\n\t\t\tmode: \"htmlmixed\",\n\t\t\thtmlMode: true,\n\t\t\tautoCloseTags: true,\n\t\t\tautoRefresh: true\n\t\t});\n\n\t\t// dispatch regular \"change\" on element event every time editor changes (IE9+ only)\n\t\twindow.dispatchEvent && editor.on('change',function() {\n\t\t\tif(typeof(Event) === \"function\") {\n\t\t\t\t// Create a new 'change' event\n\t\t\t\tvar event = new Event('change', { bubbles: true });\n\t\t\t\telement.dispatchEvent(event);\n\t\t\t}\n\t\t});\n\t}\n\n\twindow.addEventListener('load', function() {\n\t\tCodeMirror.signal(editor, \"change\");\n\t});\n\n\t// set domDirty to true everytime the \"change\" event fires (a lot..)\n\telement.addEventListener('change',function() {\n\t\tdomDirty = true;\n\t});\n\n\tfunction dom() {\n\t\tif( domDirty ) {\n\t\t\t_dom.innerHTML = r.getValue().toLowerCase();\n\t\t\tdomDirty = false;\n\t\t}\n\n\t\treturn _dom;\n\t}\n\n\tr.getValue = function() {\n\t\treturn editor ? editor.getValue() : element.value;\n\t};\n\n\tr.query = function(query) {\n\t\treturn dom().querySelectorAll(query);\n\t};\n\n\tr.containsField = function(fieldName){\n\t\treturn dom().elements.namedItem(fieldName.toLowerCase()) !== null;\n\t};\n\n\tr.insert = function( html ) {\n\t\tif( editor ) {\n\t\t\teditor.replaceSelection( html );\n\t\t\teditor.focus();\n\t\t} else {\n\t\t\telement.value += html;\n\t\t}\n\t};\n\n\tr.on = function(event,callback) {\n\t\tif( editor ) {\n\t\t\t// translate \"input\" event for CodeMirror\n\t\t\tevent = ( event === 'input' ) ? 'changes' : event;\n\t\t\treturn editor.on(event,callback);\n\t\t}\n\n\t\treturn element.addEventListener(event,callback);\n\t};\n\n\tr.refresh = function() {\n\t\teditor && editor.refresh();\n\t};\n\n\treturn r;\n};\n\nmodule.exports = FormEditor;\n},{\"codemirror\":17,\"codemirror/addon/edit/closetag.js\":14,\"codemirror/addon/edit/matchtags\":15,\"codemirror/addon/fold/xml-fold\":16,\"codemirror/mode/css/css\":18,\"codemirror/mode/htmlmixed/htmlmixed\":19,\"codemirror/mode/javascript/javascript\":20,\"codemirror/mode/xml/xml\":21}],8:[function(require,module,exports){\nvar FormWatcher = function(m, editor, settings, fields, events, helpers) {\n\t'use strict';\n\n\tvar requiredFieldsInput = document.getElementById('required-fields');\n\n\tfunction updateFields() {\n\n\t\tfields.getAll().forEach(function(field) {\n\t\t\t// don't run for empty field names\n\t\t\tif(field.name().length <= 0) return;\n\n\t\t\tvar fieldName = field.name();\n\t\t\tif( field.type() === 'checkbox' ) {\n\t\t\t\tfieldName += '[]';\n\t\t\t}\n\n\t\t\tvar inForm = editor.containsField( fieldName );\n\t\t\tfield.inFormContent( inForm );\n\t\t});\n\n\t\tfindRequiredFields();\n\t\tm.redraw();\n\t}\n\n\tfunction findRequiredFields() {\n\n\t\t// query fields required by MailChimp\n\t\tvar requiredFields = fields.getAllWhere('forceRequired', true).map(function(f) { return f.name().toUpperCase(); });\n\n\t\t// query fields in form with [required] attribute\n\t\tvar requiredFieldElements = editor.query('[required]');\n\t\tArray.prototype.forEach.call(requiredFieldElements, function(el) {\n\t\t\tvar name = el.name.toUpperCase();\n\n\t\t\t// bail if name attr starts with underscore\n\t\t\tif( name[0] === '_' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// replace array brackets with dot style notation\n\t\t\tname = name.replace(/\\[(\\w+)\\]/g, '.$1' );\n\n\t\t\t// only add field if it's not already in it\n\t\t\tif( requiredFields.indexOf(name) === -1 ) {\n\t\t\t\trequiredFields.push(name);\n\t\t\t}\n\t\t});\n\n\t\t// update meta\n\t\trequiredFieldsInput.value = requiredFields.join(',');\n\t}\n\n\t// events\n\teditor.on('change', helpers.debounce(updateFields, 500));\n\tevents.on('fields.change', helpers.debounce(updateFields, 500));\n\n};\n\nmodule.exports = FormWatcher;\n},{}],9:[function(require,module,exports){\n'use strict';\n\nvar notices = [];\n\nfunction show(txt) {\n var index = notices.indexOf(txt);\n if( index < 0 ) {\n notices.push(txt);\n render();\n }\n}\n\nfunction hide(txt) {\n var index = notices.indexOf(txt);\n if( index > -1 ) {\n notices.splice(index, 1);\n render();\n }\n}\n\nfunction render() {\n var html = '';\n for( var i=0; i<notices.length; i++) {\n html += '<div class=\"notice notice-warning\"><p>' + notices[i] + '</p></div>';\n }\n\n var container = document.querySelector('.mc4wp-notices');\n if( ! container ) {\n container = document.createElement('div');\n container.className = 'mc4wp-notices';\n var heading = document.querySelector('h1');\n heading.parentNode.insertBefore(container, heading.nextSibling);\n }\n \n container.innerHTML = html;\n}\n\nfunction init( editor ) {\n editor.on('change', function() {\n var text = \"Your form contains old style <code>GROUPINGS</code> fields. <br /><br />Please remove these fields from your form and then re-add them through the available field buttons to make sure your data is getting through to MailChimp correctly.\";\n var formCode = editor.getValue().toLowerCase();\n formCode.indexOf('name=\"groupings') > -1 ? show(text) : hide(text);\n });\n}\n\nmodule.exports = {\n \"init\": init\n};\n},{}],10:[function(require,module,exports){\nvar overlay = function(m, i18n) {\n\t'use strict';\n\n\tvar _element,\n\t\t_onCloseCallback;\n\n\tfunction close() {\n\t\tdocument.removeEventListener('keydown', onKeyDown);\n\t\twindow.removeEventListener('resize', position);\n\t\t_onCloseCallback();\n\t}\n\n\tfunction onKeyDown(e) {\n\t\te = e || window.event;\n\n\t\t// close overlay when pressing ESC\n\t\tif(e.keyCode == 27) {\n\t\t\tclose();\n\t\t}\n\n\t\t// prevent ENTER\n\t\tif(e.keyCode == 13 ) {\n\t\t\te.preventDefault();\n\t\t}\n\t}\n\n\tfunction position() {\n\t\tif( ! _element ) return;\n\n\t\t// fix for window width in IE8\n\t\tvar windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\n\t\tvar windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\n\n\t\tvar marginLeft = ( windowWidth - _element.clientWidth - 40 ) / 2;\n\t\tvar marginTop = ( windowHeight - _element.clientHeight - 40 ) / 2;\n\n\t\t_element.style.left = ( marginLeft > 0 ? marginLeft : 0 ) + \"px\";\n\t\t_element.style.top = ( marginTop > 0 ? marginTop : 0 ) + \"px\";\n\t}\n\n\treturn function (content, onCloseCallback) {\n\t\t_onCloseCallback = onCloseCallback;\n\n\t\tdocument.addEventListener('keydown', onKeyDown);\n\t\twindow.addEventListener('resize', position);\n\n\t\treturn [\n\t\t\tm('div.overlay-wrap',\n\t\t\t\tm(\"div.overlay\", {\n\t\t\t\t\tconfig: function (el) {\n\t\t\t\t\t\t_element = el;\n\t\t\t\t\t\tposition();\n\t\t\t\t\t}\n\t\t\t\t},[\n\n\t\t\t\t\t// close icon\n\t\t\t\t\tm('span', {\n\t\t\t\t\t\t\"class\": 'close dashicons dashicons-no',\n\t\t\t\t\t\ttitle : i18n.close,\n\t\t\t\t\t\tonclick: close\n\t\t\t\t\t}),\n\n\t\t\t\t\tcontent\n\t\t\t\t])\n\t\t\t)\n\t\t\t,\n\t\t\tm('div.overlay-background', {\n\t\t\t\ttitle: i18n.close,\n\t\t\t\tonclick: close\n\t\t\t})\n\t\t];\n\t};\n};\n\nmodule.exports = overlay;\n},{}],11:[function(require,module,exports){\n'use strict';\n\n// deps\nvar i18n = window.mc4wp_forms_i18n;\nvar m = window.mc4wp.deps.mithril;\nvar events = mc4wp.events;\nvar settings = mc4wp.settings;\nvar helpers = mc4wp.helpers;\n\nvar tabs = mc4wp.tabs;\nvar FormWatcher = require('./admin/form-watcher.js');\nvar FormEditor = require('./admin/form-editor.js');\nvar FieldHelper = require('./admin/field-helper.js');\nvar FieldsFactory = require('./admin/fields-factory.js');\nvar fields = require('./admin/fields.js')(m, events);\n\n// vars\nvar textareaElement = document.getElementById('mc4wp-form-content');\nvar editor = window.formEditor = new FormEditor( textareaElement );\nvar watcher = new FormWatcher( m, formEditor, settings, fields, events, helpers );\nvar fieldHelper = new FieldHelper( m, tabs, formEditor, fields, i18n );\nvar notices = require('./admin/notices');\n\n// mount field helper on element\nm.mount( document.getElementById( 'mc4wp-field-wizard'), fieldHelper );\n\n// register fields and redraw screen in 2 seconds (fixes IE8 bug)\nvar fieldsFactory = new FieldsFactory(fields, i18n);\nevents.on('selectedLists.change', fieldsFactory.registerListsFields);\nfieldsFactory.registerListsFields(settings.getSelectedLists());\nfieldsFactory.registerCustomFields(mc4wp_vars.mailchimp.lists);\n\nwindow.setTimeout( function() { m.redraw();}, 2000 );\n\n// init notices\nnotices.init(editor);\n\n// expose some methods\nwindow.mc4wp = window.mc4wp || {};\nwindow.mc4wp.forms = window.mc4wp.forms || {};\nwindow.mc4wp.forms.editor = editor;\nwindow.mc4wp.forms.fields = fields;\n\n},{\"./admin/field-helper.js\":4,\"./admin/fields-factory.js\":5,\"./admin/fields.js\":6,\"./admin/form-editor.js\":7,\"./admin/form-watcher.js\":8,\"./admin/notices\":9}],12:[function(require,module,exports){\n/*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */\n/*\n\n The MIT License (MIT)\n\n Copyright (c) 2007-2013 Einar Lielmanis and contributors.\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation files\n (the \"Software\"), to deal in the Software without restriction,\n including without limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of the Software,\n and to permit persons to whom the Software is furnished to do so,\n subject to the following conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n\n Style HTML\n---------------\n\n Written by Nochum Sossonko, (nsossonko@hotmail.com)\n\n Based on code initially developed by: Einar Lielmanis, <elfz@laacz.lv>\n http://jsbeautifier.org/\n\n Usage:\n style_html(html_source);\n\n style_html(html_source, options);\n\n The options are:\n indent_inner_html (default false) — indent <head> and <body> sections,\n indent_size (default 4) — indentation size,\n indent_char (default space) — character to indent with,\n wrap_line_length (default 250) - maximum amount of characters per line (0 = disable)\n brace_style (default \"collapse\") - \"collapse\" | \"expand\" | \"end-expand\"\n put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line.\n unformatted (defaults to inline tags) - list of tags, that shouldn't be reformatted\n indent_scripts (default normal) - \"keep\"|\"separate\"|\"normal\"\n preserve_newlines (default true) - whether existing line breaks before elements should be preserved\n Only works before elements, not inside tags or for text.\n max_preserve_newlines (default unlimited) - maximum number of line breaks to be preserved in one chunk\n indent_handlebars (default false) - format and indent {{#foo}} and {{/foo}}\n\n e.g.\n\n style_html(html_source, {\n 'indent_inner_html': false,\n 'indent_size': 2,\n 'indent_char': ' ',\n 'wrap_line_length': 78,\n 'brace_style': 'expand',\n 'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u'],\n 'preserve_newlines': true,\n 'max_preserve_newlines': 5,\n 'indent_handlebars': false\n });\n*/\n\n(function() {\n\n function trim(s) {\n return s.replace(/^\\s+|\\s+$/g, '');\n }\n\n function ltrim(s) {\n return s.replace(/^\\s+/g, '');\n }\n\n function style_html(html_source, options, js_beautify, css_beautify) {\n //Wrapper function to invoke all the necessary constructors and deal with the output.\n\n var multi_parser,\n indent_inner_html,\n indent_size,\n indent_character,\n wrap_line_length,\n brace_style,\n unformatted,\n preserve_newlines,\n max_preserve_newlines;\n\n options = options || {};\n\n // backwards compatibility to 1.3.4\n if ((options.wrap_line_length === undefined || parseInt(options.wrap_line_length, 10) === 0) &&\n (options.max_char === undefined || parseInt(options.max_char, 10) === 0)) {\n options.wrap_line_length = options.max_char;\n }\n\n indent_inner_html = options.indent_inner_html || false;\n indent_size = parseInt(options.indent_size || 4, 10);\n indent_character = options.indent_char || ' ';\n brace_style = options.brace_style || 'collapse';\n wrap_line_length = parseInt(options.wrap_line_length, 10) === 0 ? 32786 : parseInt(options.wrap_line_length || 250, 10);\n unformatted = options.unformatted || ['a', 'span', 'bdo', 'em', 'strong', 'dfn', 'code', 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym', 'q', 'sub', 'sup', 'tt', 'i', 'b', 'big', 'small', 'u', 's', 'strike', 'font', 'ins', 'del', 'pre', 'address', 'dt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];\n preserve_newlines = options.preserve_newlines || true;\n max_preserve_newlines = preserve_newlines ? parseInt(options.max_preserve_newlines || 32786, 10) : 0;\n indent_handlebars = options.indent_handlebars || false;\n\n function Parser() {\n\n this.pos = 0; //Parser position\n this.token = '';\n this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT\n this.tags = { //An object to hold tags, their position, and their parent-tags, initiated with default values\n parent: 'parent1',\n parentcount: 1,\n parent1: ''\n };\n this.tag_type = '';\n this.token_text = this.last_token = this.last_text = this.token_type = '';\n this.newlines = 0;\n this.indent_content = indent_inner_html;\n\n this.Utils = { //Uilities made available to the various functions\n whitespace: \"\\n\\r\\t \".split(''),\n single_token: 'br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?='.split(','), //all the single tags for HTML\n extra_liners: 'head,body,/html'.split(','), //for tags that need a line of whitespace before them\n in_array: function(what, arr) {\n for (var i = 0; i < arr.length; i++) {\n if (what === arr[i]) {\n return true;\n }\n }\n return false;\n }\n };\n\n this.traverse_whitespace = function() {\n var input_char = '';\n\n input_char = this.input.charAt(this.pos);\n if (this.Utils.in_array(input_char, this.Utils.whitespace)) {\n this.newlines = 0;\n while (this.Utils.in_array(input_char, this.Utils.whitespace)) {\n if (preserve_newlines && input_char === '\\n' && this.newlines <= max_preserve_newlines) {\n this.newlines += 1;\n }\n\n this.pos++;\n input_char = this.input.charAt(this.pos);\n }\n return true;\n }\n return false;\n };\n\n this.get_content = function() { //function to capture regular content between tags\n\n var input_char = '',\n content = [],\n space = false; //if a space is needed\n\n while (this.input.charAt(this.pos) !== '<') {\n if (this.pos >= this.input.length) {\n return content.length ? content.join('') : ['', 'TK_EOF'];\n }\n\n if (this.traverse_whitespace()) {\n if (content.length) {\n space = true;\n }\n continue; //don't want to insert unnecessary space\n }\n\n if (indent_handlebars) {\n // Handlebars parsing is complicated.\n // {{#foo}} and {{/foo}} are formatted tags.\n // {{something}} should get treated as content, except:\n // {{else}} specifically behaves like {{#if}} and {{/if}}\n var peek3 = this.input.substr(this.pos, 3);\n if (peek3 === '{{#' || peek3 === '{{/') {\n // These are tags and not content.\n break;\n } else if (this.input.substr(this.pos, 2) === '{{') {\n if (this.get_tag(true) === '{{else}}') {\n break;\n }\n }\n }\n\n input_char = this.input.charAt(this.pos);\n this.pos++;\n\n if (space) {\n if (this.line_char_count >= this.wrap_line_length) { //insert a line when the wrap_line_length is reached\n this.print_newline(false, content);\n this.print_indentation(content);\n } else {\n this.line_char_count++;\n content.push(' ');\n }\n space = false;\n }\n this.line_char_count++;\n content.push(input_char); //letter at-a-time (or string) inserted to an array\n }\n return content.length ? content.join('') : '';\n };\n\n this.get_contents_to = function(name) { //get the full content of a script or style to pass to js_beautify\n if (this.pos === this.input.length) {\n return ['', 'TK_EOF'];\n }\n var input_char = '';\n var content = '';\n var reg_match = new RegExp('</' + name + '\\\\s*>', 'igm');\n reg_match.lastIndex = this.pos;\n var reg_array = reg_match.exec(this.input);\n var end_script = reg_array ? reg_array.index : this.input.length; //absolute end of script\n if (this.pos < end_script) { //get everything in between the script tags\n content = this.input.substring(this.pos, end_script);\n this.pos = end_script;\n }\n return content;\n };\n\n this.record_tag = function(tag) { //function to record a tag and its parent in this.tags Object\n if (this.tags[tag + 'count']) { //check for the existence of this tag type\n this.tags[tag + 'count']++;\n this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level\n } else { //otherwise initialize this tag type\n this.tags[tag + 'count'] = 1;\n this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level\n }\n this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; //set the parent (i.e. in the case of a div this.tags.div1parent)\n this.tags.parent = tag + this.tags[tag + 'count']; //and make this the current parent (i.e. in the case of a div 'div1')\n };\n\n this.retrieve_tag = function(tag) { //function to retrieve the opening tag to the corresponding closer\n if (this.tags[tag + 'count']) { //if the openener is not in the Object we ignore it\n var temp_parent = this.tags.parent; //check to see if it's a closable tag.\n while (temp_parent) { //till we reach '' (the initial value);\n if (tag + this.tags[tag + 'count'] === temp_parent) { //if this is it use it\n break;\n }\n temp_parent = this.tags[temp_parent + 'parent']; //otherwise keep on climbing up the DOM Tree\n }\n if (temp_parent) { //if we caught something\n this.indent_level = this.tags[tag + this.tags[tag + 'count']]; //set the indent_level accordingly\n this.tags.parent = this.tags[temp_parent + 'parent']; //and set the current parent\n }\n delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; //delete the closed tags parent reference...\n delete this.tags[tag + this.tags[tag + 'count']]; //...and the tag itself\n if (this.tags[tag + 'count'] === 1) {\n delete this.tags[tag + 'count'];\n } else {\n this.tags[tag + 'count']--;\n }\n }\n };\n\n this.indent_to_tag = function(tag) {\n // Match the indentation level to the last use of this tag, but don't remove it.\n if (!this.tags[tag + 'count']) {\n return;\n }\n var temp_parent = this.tags.parent;\n while (temp_parent) {\n if (tag + this.tags[tag + 'count'] === temp_parent) {\n break;\n }\n temp_parent = this.tags[temp_parent + 'parent'];\n }\n if (temp_parent) {\n this.indent_level = this.tags[tag + this.tags[tag + 'count']];\n }\n };\n\n this.get_tag = function(peek) { //function to get a full tag and parse its type\n var input_char = '',\n content = [],\n comment = '',\n space = false,\n tag_start, tag_end,\n tag_start_char,\n orig_pos = this.pos,\n orig_line_char_count = this.line_char_count;\n\n peek = peek !== undefined ? peek : false;\n\n do {\n if (this.pos >= this.input.length) {\n if (peek) {\n this.pos = orig_pos;\n this.line_char_count = orig_line_char_count;\n }\n return content.length ? content.join('') : ['', 'TK_EOF'];\n }\n\n input_char = this.input.charAt(this.pos);\n this.pos++;\n\n if (this.Utils.in_array(input_char, this.Utils.whitespace)) { //don't want to insert unnecessary space\n space = true;\n continue;\n }\n\n if (input_char === \"'\" || input_char === '\"') {\n input_char += this.get_unformatted(input_char);\n space = true;\n\n }\n\n if (input_char === '=') { //no space before =\n space = false;\n }\n\n if (content.length && content[content.length - 1] !== '=' && input_char !== '>' && space) {\n //no space after = or before >\n if (this.line_char_count >= this.wrap_line_length) {\n this.print_newline(false, content);\n this.print_indentation(content);\n } else {\n content.push(' ');\n this.line_char_count++;\n }\n space = false;\n }\n\n if (indent_handlebars && tag_start_char === '<') {\n // When inside an angle-bracket tag, put spaces around\n // handlebars not inside of strings.\n if ((input_char + this.input.charAt(this.pos)) === '{{') {\n input_char += this.get_unformatted('}}');\n if (content.length && content[content.length - 1] !== ' ' && content[content.length - 1] !== '<') {\n input_char = ' ' + input_char;\n }\n space = true;\n }\n }\n\n if (input_char === '<' && !tag_start_char) {\n tag_start = this.pos - 1;\n tag_start_char = '<';\n }\n\n if (indent_handlebars && !tag_start_char) {\n if (content.length >= 2 && content[content.length - 1] === '{' && content[content.length - 2] == '{') {\n if (input_char === '#' || input_char === '/') {\n tag_start = this.pos - 3;\n } else {\n tag_start = this.pos - 2;\n }\n tag_start_char = '{';\n }\n }\n\n this.line_char_count++;\n content.push(input_char); //inserts character at-a-time (or string)\n\n if (content[1] && content[1] === '!') { //if we're in a comment, do something special\n // We treat all comments as literals, even more than preformatted tags\n // we just look for the appropriate close tag\n content = [this.get_comment(tag_start)];\n break;\n }\n\n if (indent_handlebars && tag_start_char === '{' && content.length > 2 && content[content.length - 2] === '}' && content[content.length - 1] === '}') {\n break;\n }\n } while (input_char !== '>');\n\n var tag_complete = content.join('');\n var tag_index;\n var tag_offset;\n\n if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends\n tag_index = tag_complete.indexOf(' ');\n } else if (tag_complete[0] === '{') {\n tag_index = tag_complete.indexOf('}');\n } else { //otherwise go with the tag ending\n tag_index = tag_complete.indexOf('>');\n }\n if (tag_complete[0] === '<' || !indent_handlebars) {\n tag_offset = 1;\n } else {\n tag_offset = tag_complete[2] === '#' ? 3 : 2;\n }\n var tag_check = tag_complete.substring(tag_offset, tag_index).toLowerCase();\n if (tag_complete.charAt(tag_complete.length - 2) === '/' ||\n this.Utils.in_array(tag_check, this.Utils.single_token)) { //if this tag name is a single tag type (either in the list or has a closing /)\n if (!peek) {\n this.tag_type = 'SINGLE';\n }\n } else if (indent_handlebars && tag_complete[0] === '{' && tag_check === 'else') {\n if (!peek) {\n this.indent_to_tag('if');\n this.tag_type = 'HANDLEBARS_ELSE';\n this.indent_content = true;\n this.traverse_whitespace();\n }\n } else if (tag_check === 'script') { //for later script handling\n if (!peek) {\n this.record_tag(tag_check);\n this.tag_type = 'SCRIPT';\n }\n } else if (tag_check === 'style') { //for future style handling (for now it justs uses get_content)\n if (!peek) {\n this.record_tag(tag_check);\n this.tag_type = 'STYLE';\n }\n } else if (this.is_unformatted(tag_check, unformatted)) { // do not reformat the \"unformatted\" tags\n comment = this.get_unformatted('</' + tag_check + '>', tag_complete); //...delegate to get_unformatted function\n content.push(comment);\n // Preserve collapsed whitespace either before or after this tag.\n if (tag_start > 0 && this.Utils.in_array(this.input.charAt(tag_start - 1), this.Utils.whitespace)) {\n content.splice(0, 0, this.input.charAt(tag_start - 1));\n }\n tag_end = this.pos - 1;\n if (this.Utils.in_array(this.input.charAt(tag_end + 1), this.Utils.whitespace)) {\n content.push(this.input.charAt(tag_end + 1));\n }\n this.tag_type = 'SINGLE';\n } else if (tag_check.charAt(0) === '!') { //peek for <! comment\n // for comments content is already correct.\n if (!peek) {\n this.tag_type = 'SINGLE';\n this.traverse_whitespace();\n }\n } else if (!peek) {\n if (tag_check.charAt(0) === '/') { //this tag is a double tag so check for tag-ending\n this.retrieve_tag(tag_check.substring(1)); //remove it and all ancestors\n this.tag_type = 'END';\n this.traverse_whitespace();\n } else { //otherwise it's a start-tag\n this.record_tag(tag_check); //push it on the tag stack\n if (tag_check.toLowerCase() !== 'html') {\n this.indent_content = true;\n }\n this.tag_type = 'START';\n\n // Allow preserving of newlines after a start tag\n this.traverse_whitespace();\n }\n if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) { //check if this double needs an extra line\n this.print_newline(false, this.output);\n if (this.output.length && this.output[this.output.length - 2] !== '\\n') {\n this.print_newline(true, this.output);\n }\n }\n }\n\n if (peek) {\n this.pos = orig_pos;\n this.line_char_count = orig_line_char_count;\n }\n\n return content.join(''); //returns fully formatted tag\n };\n\n this.get_comment = function(start_pos) { //function to return comment content in its entirety\n // this is will have very poor perf, but will work for now.\n var comment = '',\n delimiter = '>',\n matched = false;\n\n this.pos = start_pos;\n input_char = this.input.charAt(this.pos);\n this.pos++;\n\n while (this.pos <= this.input.length) {\n comment += input_char;\n\n // only need to check for the delimiter if the last chars match\n if (comment[comment.length - 1] === delimiter[delimiter.length - 1] &&\n comment.indexOf(delimiter) !== -1) {\n break;\n }\n\n // only need to search for custom delimiter for the first few characters\n if (!matched && comment.length < 10) {\n if (comment.indexOf('<![if') === 0) { //peek for <![if conditional comment\n delimiter = '<![endif]>';\n matched = true;\n } else if (comment.indexOf('<![cdata[') === 0) { //if it's a <[cdata[ comment...\n delimiter = ']]>';\n matched = true;\n } else if (comment.indexOf('<![') === 0) { // some other ![ comment? ...\n delimiter = ']>';\n matched = true;\n } else if (comment.indexOf('<!--') === 0) { // <!-- comment ...\n delimiter = '-->';\n matched = true;\n }\n }\n\n input_char = this.input.charAt(this.pos);\n this.pos++;\n }\n\n return comment;\n };\n\n this.get_unformatted = function(delimiter, orig_tag) { //function to return unformatted content in its entirety\n\n if (orig_tag && orig_tag.toLowerCase().indexOf(delimiter) !== -1) {\n return '';\n }\n var input_char = '';\n var content = '';\n var min_index = 0;\n var space = true;\n do {\n\n if (this.pos >= this.input.length) {\n return content;\n }\n\n input_char = this.input.charAt(this.pos);\n this.pos++;\n\n if (this.Utils.in_array(input_char, this.Utils.whitespace)) {\n if (!space) {\n this.line_char_count--;\n continue;\n }\n if (input_char === '\\n' || input_char === '\\r') {\n content += '\\n';\n /* Don't change tab indention for unformatted blocks. If using code for html editing, this will greatly affect <pre> tags if they are specified in the 'unformatted array'\n for (var i=0; i<this.indent_level; i++) {\n content += this.indent_string;\n }\n space = false; //...and make sure other indentation is erased\n */\n this.line_char_count = 0;\n continue;\n }\n }\n content += input_char;\n this.line_char_count++;\n space = true;\n\n if (indent_handlebars && input_char === '{' && content.length && content[content.length - 2] === '{') {\n // Handlebars expressions in strings should also be unformatted.\n content += this.get_unformatted('}}');\n // These expressions are opaque. Ignore delimiters found in them.\n min_index = content.length;\n }\n } while (content.toLowerCase().indexOf(delimiter, min_index) === -1);\n return content;\n };\n\n this.get_token = function() { //initial handler for token-retrieval\n var token;\n\n if (this.last_token === 'TK_TAG_SCRIPT' || this.last_token === 'TK_TAG_STYLE') { //check if we need to format javascript\n var type = this.last_token.substr(7);\n token = this.get_contents_to(type);\n if (typeof token !== 'string') {\n return token;\n }\n return [token, 'TK_' + type];\n }\n if (this.current_mode === 'CONTENT') {\n token = this.get_content();\n if (typeof token !== 'string') {\n return token;\n } else {\n return [token, 'TK_CONTENT'];\n }\n }\n\n if (this.current_mode === 'TAG') {\n token = this.get_tag();\n if (typeof token !== 'string') {\n return token;\n } else {\n var tag_name_type = 'TK_TAG_' + this.tag_type;\n return [token, tag_name_type];\n }\n }\n };\n\n this.get_full_indent = function(level) {\n level = this.indent_level + level || 0;\n if (level < 1) {\n return '';\n }\n\n return Array(level + 1).join(this.indent_string);\n };\n\n this.is_unformatted = function(tag_check, unformatted) {\n //is this an HTML5 block-level link?\n if (!this.Utils.in_array(tag_check, unformatted)) {\n return false;\n }\n\n if (tag_check.toLowerCase() !== 'a' || !this.Utils.in_array('a', unformatted)) {\n return true;\n }\n\n //at this point we have an tag; is its first child something we want to remain\n //unformatted?\n var next_tag = this.get_tag(true /* peek. */ );\n\n // test next_tag to see if it is just html tag (no external content)\n var tag = (next_tag || \"\").match(/^\\s*<\\s*\\/?([a-z]*)\\s*[^>]*>\\s*$/);\n\n // if next_tag comes back but is not an isolated tag, then\n // let's treat the 'a' tag as having content\n // and respect the unformatted option\n if (!tag || this.Utils.in_array(tag, unformatted)) {\n return true;\n } else {\n return false;\n }\n };\n\n this.printer = function(js_source, indent_character, indent_size, wrap_line_length, brace_style) { //handles input/output and some other printing functions\n\n this.input = js_source || ''; //gets the input for the Parser\n this.output = [];\n this.indent_character = indent_character;\n this.indent_string = '';\n this.indent_size = indent_size;\n this.brace_style = brace_style;\n this.indent_level = 0;\n this.wrap_line_length = wrap_line_length;\n this.line_char_count = 0; //count to see if wrap_line_length was exceeded\n\n for (var i = 0; i < this.indent_size; i++) {\n this.indent_string += this.indent_character;\n }\n\n this.print_newline = function(force, arr) {\n this.line_char_count = 0;\n if (!arr || !arr.length) {\n return;\n }\n if (force || (arr[arr.length - 1] !== '\\n')) { //we might want the extra line\n arr.push('\\n');\n }\n };\n\n this.print_indentation = function(arr) {\n for (var i = 0; i < this.indent_level; i++) {\n arr.push(this.indent_string);\n this.line_char_count += this.indent_string.length;\n }\n };\n\n this.print_token = function(text) {\n if (text || text !== '') {\n if (this.output.length && this.output[this.output.length - 1] === '\\n') {\n this.print_indentation(this.output);\n text = ltrim(text);\n }\n }\n this.print_token_raw(text);\n };\n\n this.print_token_raw = function(text) {\n if (text && text !== '') {\n if (text.length > 1 && text[text.length - 1] === '\\n') {\n // unformatted tags can grab newlines as their last character\n this.output.push(text.slice(0, -1));\n this.print_newline(false, this.output);\n } else {\n this.output.push(text);\n }\n }\n\n for (var n = 0; n < this.newlines; n++) {\n this.print_newline(n > 0, this.output);\n }\n this.newlines = 0;\n };\n\n this.indent = function() {\n this.indent_level++;\n };\n\n this.unindent = function() {\n if (this.indent_level > 0) {\n this.indent_level--;\n }\n };\n };\n return this;\n }\n\n /*_____________________--------------------_____________________*/\n\n multi_parser = new Parser(); //wrapping functions Parser\n multi_parser.printer(html_source, indent_character, indent_size, wrap_line_length, brace_style); //initialize starting values\n\n while (true) {\n var t = multi_parser.get_token();\n multi_parser.token_text = t[0];\n multi_parser.token_type = t[1];\n\n if (multi_parser.token_type === 'TK_EOF') {\n break;\n }\n\n switch (multi_parser.token_type) {\n case 'TK_TAG_START':\n multi_parser.print_newline(false, multi_parser.output);\n multi_parser.print_token(multi_parser.token_text);\n if (multi_parser.indent_content) {\n multi_parser.indent();\n multi_parser.indent_content = false;\n }\n multi_parser.current_mode = 'CONTENT';\n break;\n case 'TK_TAG_STYLE':\n case 'TK_TAG_SCRIPT':\n multi_parser.print_newline(false, multi_parser.output);\n multi_parser.print_token(multi_parser.token_text);\n multi_parser.current_mode = 'CONTENT';\n break;\n case 'TK_TAG_END':\n //Print new line only if the tag has no content and has child\n if (multi_parser.last_token === 'TK_CONTENT' && multi_parser.last_text === '') {\n var tag_name = multi_parser.token_text.match(/\\w+/)[0];\n var tag_extracted_from_last_output = null;\n if (multi_parser.output.length) {\n tag_extracted_from_last_output = multi_parser.output[multi_parser.output.length - 1].match(/(?:<|{{#)\\s*(\\w+)/);\n }\n if (tag_extracted_from_last_output === null ||\n tag_extracted_from_last_output[1] !== tag_name) {\n multi_parser.print_newline(false, multi_parser.output);\n }\n }\n multi_parser.print_token(multi_parser.token_text);\n multi_parser.current_mode = 'CONTENT';\n break;\n case 'TK_TAG_SINGLE':\n // Don't add a newline before elements that should remain unformatted.\n var tag_check = multi_parser.token_text.match(/^\\s*<([a-z]+)/i);\n if (!tag_check || !multi_parser.Utils.in_array(tag_check[1], unformatted)) {\n multi_parser.print_newline(false, multi_parser.output);\n }\n multi_parser.print_token(multi_parser.token_text);\n multi_parser.current_mode = 'CONTENT';\n break;\n case 'TK_TAG_HANDLEBARS_ELSE':\n multi_parser.print_token(multi_parser.token_text);\n if (multi_parser.indent_content) {\n multi_parser.indent();\n multi_parser.indent_content = false;\n }\n multi_parser.current_mode = 'CONTENT';\n break;\n case 'TK_CONTENT':\n multi_parser.print_token(multi_parser.token_text);\n multi_parser.current_mode = 'TAG';\n break;\n case 'TK_STYLE':\n case 'TK_SCRIPT':\n if (multi_parser.token_text !== '') {\n multi_parser.print_newline(false, multi_parser.output);\n var text = multi_parser.token_text,\n _beautifier,\n script_indent_level = 1;\n if (multi_parser.token_type === 'TK_SCRIPT') {\n _beautifier = typeof js_beautify === 'function' && js_beautify;\n } else if (multi_parser.token_type === 'TK_STYLE') {\n _beautifier = typeof css_beautify === 'function' && css_beautify;\n }\n\n if (options.indent_scripts === \"keep\") {\n script_indent_level = 0;\n } else if (options.indent_scripts === \"separate\") {\n script_indent_level = -multi_parser.indent_level;\n }\n\n var indentation = multi_parser.get_full_indent(script_indent_level);\n if (_beautifier) {\n // call the Beautifier if avaliable\n text = _beautifier(text.replace(/^\\s*/, indentation), options);\n } else {\n // simply indent the string otherwise\n var white = text.match(/^\\s*/)[0];\n var _level = white.match(/[^\\n\\r]*$/)[0].split(multi_parser.indent_string).length - 1;\n var reindent = multi_parser.get_full_indent(script_indent_level - _level);\n text = text.replace(/^\\s*/, indentation)\n .replace(/\\r\\n|\\r|\\n/g, '\\n' + reindent)\n .replace(/\\s+$/, '');\n }\n if (text) {\n multi_parser.print_token_raw(indentation + trim(text));\n multi_parser.print_newline(false, multi_parser.output);\n }\n }\n multi_parser.current_mode = 'TAG';\n break;\n }\n multi_parser.last_token = multi_parser.token_type;\n multi_parser.last_text = multi_parser.token_text;\n }\n return multi_parser.output.join('');\n }\n\n if (typeof module !== \"undefined\" && typeof( module.exports ) !== \"undefined\" ) {\n\t\tmodule.exports = style_html;\n } else if (typeof window !== \"undefined\") {\n\t\t// If we're running a web page and don't have either of the above, add our one global\n\t\twindow.html_beautify = style_html;\n\t}\n\n}());\n},{}],13:[function(require,module,exports){\n'use strict';\n\nvar VOID_TAGS = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr',\n\t'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track',\n\t'wbr', '!doctype'];\n\nfunction isArray(thing) {\n\treturn Object.prototype.toString.call(thing) === '[object Array]';\n}\n\nfunction camelToDash(str) {\n\treturn str.replace(/\\W+/g, '-')\n\t\t.replace(/([a-z\\d])([A-Z])/g, '$1-$2');\n}\n\nfunction removeEmpties(n) {\n\treturn n != '';\n}\n\n// shameless stolen from https://github.com/punkave/sanitize-html\nfunction escapeHtml(s, replaceDoubleQuote) {\n\tif (s === 'undefined') {\n\t\ts = '';\n\t}\n\tif (typeof(s) !== 'string') {\n\t\ts = s + '';\n\t}\n\ts = s.replace(/\\&/g, '&').replace(/</g, '<').replace(/\\>/g, '>');\n\tif (replaceDoubleQuote) {\n\t\treturn s.replace(/\\\"/g, '"');\n\t}\n\treturn s;\n}\n\nfunction createAttrString(attrs) {\n\tif (!attrs || !Object.keys(attrs).length) {\n\t\treturn '';\n\t}\n\n\treturn Object.keys(attrs).map(function(name) {\n\t\tvar value = attrs[name];\n\t\tif (typeof value === 'undefined' || value === null || typeof value === 'function') {\n\t\t\treturn;\n\t\t}\n\t\tif (typeof value === 'boolean') {\n\t\t\treturn value ? ' ' + name : '';\n\t\t}\n\t\tif (name === 'style') {\n\t\t\tif (!value) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar styles = attrs.style;\n\t\t\tif (typeof styles === 'object') {\n\t\t\t\tstyles = Object.keys(styles).map(function(property) {\n\t\t\t\t\treturn styles[property] != '' ? [camelToDash(property).toLowerCase(), styles[property]].join(':') : '';\n\t\t\t\t}).filter(removeEmpties).join(';');\n\t\t\t}\n\t\t\treturn styles != '' ? ' style=\"' + escapeHtml(styles, true) + '\"' : '';\n\t\t}\n\t\treturn ' ' + escapeHtml(name === 'className' ? 'class' : name) + '=\"' + escapeHtml(value, true) + '\"';\n\t}).join('');\n}\n\nfunction createChildrenContent(view) {\n\tif(isArray(view.children) && !view.children.length) {\n\t\treturn '';\n\t}\n\n\treturn render(view.children);\n}\n\nfunction render(view) {\n\tvar type = typeof view;\n\n\tif (type === 'string') {\n\t\treturn escapeHtml(view);\n\t}\n\n\tif(type === 'number' || type === 'boolean') {\n\t\treturn view;\n\t}\n\n\tif (!view) {\n\t\treturn '';\n\t}\n\n\tif (isArray(view)) {\n\t\treturn view.map(render).join('');\n\t}\n\n\t//compontent\n\tif (view.view) {\n\t\tvar scope = view.controller ? new view.controller : {};\n\t\tvar result = render(view.view(scope));\n\t\tif (scope.onunload) {\n\t\t\tscope.onunload();\n\t\t}\n\t\treturn result;\n\t}\n\n\tif (view.$trusted) {\n\t\treturn '' + view;\n\t}\n\tvar children = createChildrenContent(view);\n\tif (!children && VOID_TAGS.indexOf(view.tag.toLowerCase()) >= 0) {\n\t\treturn '<' + view.tag + createAttrString(view.attrs) + '>';\n\t}\n\treturn [\n\t\t'<', view.tag, createAttrString(view.attrs), '>',\n\t\tchildren,\n\t\t'</', view.tag, '>',\n\t].join('');\n}\n\nmodule.exports = render;\n},{}],14:[function(require,module,exports){\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n/**\n * Tag-closer extension for CodeMirror.\n *\n * This extension adds an \"autoCloseTags\" option that can be set to\n * either true to get the default behavior, or an object to further\n * configure its behavior.\n *\n * These are supported options:\n *\n * `whenClosing` (default true)\n * Whether to autoclose when the '/' of a closing tag is typed.\n * `whenOpening` (default true)\n * Whether to autoclose the tag when the final '>' of an opening\n * tag is typed.\n * `dontCloseTags` (default is empty tags for HTML, none for XML)\n * An array of tag names that should not be autoclosed.\n * `indentTags` (default is block tags for HTML, none for XML)\n * An array of tag names that should, when opened, cause a\n * blank line to be added inside the tag, and the blank line and\n * closing line to be indented.\n *\n * See demos/closetag.html for a usage example.\n */\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"), require(\"../fold/xml-fold\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\", \"../fold/xml-fold\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n CodeMirror.defineOption(\"autoCloseTags\", false, function(cm, val, old) {\n if (old != CodeMirror.Init && old)\n cm.removeKeyMap(\"autoCloseTags\");\n if (!val) return;\n var map = {name: \"autoCloseTags\"};\n if (typeof val != \"object\" || val.whenClosing)\n map[\"'/'\"] = function(cm) { return autoCloseSlash(cm); };\n if (typeof val != \"object\" || val.whenOpening)\n map[\"'>'\"] = function(cm) { return autoCloseGT(cm); };\n cm.addKeyMap(map);\n });\n\n var htmlDontClose = [\"area\", \"base\", \"br\", \"col\", \"command\", \"embed\", \"hr\", \"img\", \"input\", \"keygen\", \"link\", \"meta\", \"param\",\n \"source\", \"track\", \"wbr\"];\n var htmlIndent = [\"applet\", \"blockquote\", \"body\", \"button\", \"div\", \"dl\", \"fieldset\", \"form\", \"frameset\", \"h1\", \"h2\", \"h3\", \"h4\",\n \"h5\", \"h6\", \"head\", \"html\", \"iframe\", \"layer\", \"legend\", \"object\", \"ol\", \"p\", \"select\", \"table\", \"ul\"];\n\n function autoCloseGT(cm) {\n if (cm.getOption(\"disableInput\")) return CodeMirror.Pass;\n var ranges = cm.listSelections(), replacements = [];\n for (var i = 0; i < ranges.length; i++) {\n if (!ranges[i].empty()) return CodeMirror.Pass;\n var pos = ranges[i].head, tok = cm.getTokenAt(pos);\n var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;\n if (inner.mode.name != \"xml\" || !state.tagName) return CodeMirror.Pass;\n\n var opt = cm.getOption(\"autoCloseTags\"), html = inner.mode.configuration == \"html\";\n var dontCloseTags = (typeof opt == \"object\" && opt.dontCloseTags) || (html && htmlDontClose);\n var indentTags = (typeof opt == \"object\" && opt.indentTags) || (html && htmlIndent);\n\n var tagName = state.tagName;\n if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);\n var lowerTagName = tagName.toLowerCase();\n // Don't process the '>' at the end of an end-tag or self-closing tag\n if (!tagName ||\n tok.type == \"string\" && (tok.end != pos.ch || !/[\\\"\\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) ||\n tok.type == \"tag\" && state.type == \"closeTag\" ||\n tok.string.indexOf(\"/\") == (tok.string.length - 1) || // match something like <someTagName />\n dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||\n closingTagExists(cm, tagName, pos, state, true))\n return CodeMirror.Pass;\n\n var indent = indentTags && indexOf(indentTags, lowerTagName) > -1;\n replacements[i] = {indent: indent,\n text: \">\" + (indent ? \"\\n\\n\" : \"\") + \"</\" + tagName + \">\",\n newPos: indent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1)};\n }\n\n for (var i = ranges.length - 1; i >= 0; i--) {\n var info = replacements[i];\n cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, \"+insert\");\n var sel = cm.listSelections().slice(0);\n sel[i] = {head: info.newPos, anchor: info.newPos};\n cm.setSelections(sel);\n if (info.indent) {\n cm.indentLine(info.newPos.line, null, true);\n cm.indentLine(info.newPos.line + 1, null, true);\n }\n }\n }\n\n function autoCloseCurrent(cm, typingSlash) {\n var ranges = cm.listSelections(), replacements = [];\n var head = typingSlash ? \"/\" : \"</\";\n for (var i = 0; i < ranges.length; i++) {\n if (!ranges[i].empty()) return CodeMirror.Pass;\n var pos = ranges[i].head, tok = cm.getTokenAt(pos);\n var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;\n if (typingSlash && (tok.type == \"string\" || tok.string.charAt(0) != \"<\" ||\n tok.start != pos.ch - 1))\n return CodeMirror.Pass;\n // Kludge to get around the fact that we are not in XML mode\n // when completing in JS/CSS snippet in htmlmixed mode. Does not\n // work for other XML embedded languages (there is no general\n // way to go from a mixed mode to its current XML state).\n var replacement;\n if (inner.mode.name != \"xml\") {\n if (cm.getMode().name == \"htmlmixed\" && inner.mode.name == \"javascript\")\n replacement = head + \"script\";\n else if (cm.getMode().name == \"htmlmixed\" && inner.mode.name == \"css\")\n replacement = head + \"style\";\n else\n return CodeMirror.Pass;\n } else {\n if (!state.context || !state.context.tagName ||\n closingTagExists(cm, state.context.tagName, pos, state))\n return CodeMirror.Pass;\n replacement = head + state.context.tagName;\n }\n if (cm.getLine(pos.line).charAt(tok.end) != \">\") replacement += \">\";\n replacements[i] = replacement;\n }\n cm.replaceSelections(replacements);\n ranges = cm.listSelections();\n for (var i = 0; i < ranges.length; i++)\n if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line)\n cm.indentLine(ranges[i].head.line);\n }\n\n function autoCloseSlash(cm) {\n if (cm.getOption(\"disableInput\")) return CodeMirror.Pass;\n return autoCloseCurrent(cm, true);\n }\n\n CodeMirror.commands.closeTag = function(cm) { return autoCloseCurrent(cm); };\n\n function indexOf(collection, elt) {\n if (collection.indexOf) return collection.indexOf(elt);\n for (var i = 0, e = collection.length; i < e; ++i)\n if (collection[i] == elt) return i;\n return -1;\n }\n\n // If xml-fold is loaded, we use its functionality to try and verify\n // whether a given tag is actually unclosed.\n function closingTagExists(cm, tagName, pos, state, newTag) {\n if (!CodeMirror.scanForClosingTag) return false;\n var end = Math.min(cm.lastLine() + 1, pos.line + 500);\n var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end);\n if (!nextClose || nextClose.tag != tagName) return false;\n var cx = state.context;\n // If the immediate wrapping context contains onCx instances of\n // the same tag, a closing tag only exists if there are at least\n // that many closing tags of that type following.\n for (var onCx = newTag ? 1 : 0; cx && cx.tagName == tagName; cx = cx.prev) ++onCx;\n pos = nextClose.to;\n for (var i = 1; i < onCx; i++) {\n var next = CodeMirror.scanForClosingTag(cm, pos, null, end);\n if (!next || next.tag != tagName) return false;\n pos = next.to;\n }\n return true;\n }\n});\n\n},{\"../../lib/codemirror\":17,\"../fold/xml-fold\":16}],15:[function(require,module,exports){\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"), require(\"../fold/xml-fold\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\", \"../fold/xml-fold\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n CodeMirror.defineOption(\"matchTags\", false, function(cm, val, old) {\n if (old && old != CodeMirror.Init) {\n cm.off(\"cursorActivity\", doMatchTags);\n cm.off(\"viewportChange\", maybeUpdateMatch);\n clear(cm);\n }\n if (val) {\n cm.state.matchBothTags = typeof val == \"object\" && val.bothTags;\n cm.on(\"cursorActivity\", doMatchTags);\n cm.on(\"viewportChange\", maybeUpdateMatch);\n doMatchTags(cm);\n }\n });\n\n function clear(cm) {\n if (cm.state.tagHit) cm.state.tagHit.clear();\n if (cm.state.tagOther) cm.state.tagOther.clear();\n cm.state.tagHit = cm.state.tagOther = null;\n }\n\n function doMatchTags(cm) {\n cm.state.failedTagMatch = false;\n cm.operation(function() {\n clear(cm);\n if (cm.somethingSelected()) return;\n var cur = cm.getCursor(), range = cm.getViewport();\n range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to);\n var match = CodeMirror.findMatchingTag(cm, cur, range);\n if (!match) return;\n if (cm.state.matchBothTags) {\n var hit = match.at == \"open\" ? match.open : match.close;\n if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: \"CodeMirror-matchingtag\"});\n }\n var other = match.at == \"close\" ? match.open : match.close;\n if (other)\n cm.state.tagOther = cm.markText(other.from, other.to, {className: \"CodeMirror-matchingtag\"});\n else\n cm.state.failedTagMatch = true;\n });\n }\n\n function maybeUpdateMatch(cm) {\n if (cm.state.failedTagMatch) doMatchTags(cm);\n }\n\n CodeMirror.commands.toMatchingTag = function(cm) {\n var found = CodeMirror.findMatchingTag(cm, cm.getCursor());\n if (found) {\n var other = found.at == \"close\" ? found.open : found.close;\n if (other) cm.extendSelection(other.to, other.from);\n }\n };\n});\n\n},{\"../../lib/codemirror\":17,\"../fold/xml-fold\":16}],16:[function(require,module,exports){\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n var Pos = CodeMirror.Pos;\n function cmp(a, b) { return a.line - b.line || a.ch - b.ch; }\n\n var nameStartChar = \"A-Z_a-z\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD\";\n var nameChar = nameStartChar + \"\\-\\:\\.0-9\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040\";\n var xmlTagStart = new RegExp(\"<(/?)([\" + nameStartChar + \"][\" + nameChar + \"]*)\", \"g\");\n\n function Iter(cm, line, ch, range) {\n this.line = line; this.ch = ch;\n this.cm = cm; this.text = cm.getLine(line);\n this.min = range ? range.from : cm.firstLine();\n this.max = range ? range.to - 1 : cm.lastLine();\n }\n\n function tagAt(iter, ch) {\n var type = iter.cm.getTokenTypeAt(Pos(iter.line, ch));\n return type && /\\btag\\b/.test(type);\n }\n\n function nextLine(iter) {\n if (iter.line >= iter.max) return;\n iter.ch = 0;\n iter.text = iter.cm.getLine(++iter.line);\n return true;\n }\n function prevLine(iter) {\n if (iter.line <= iter.min) return;\n iter.text = iter.cm.getLine(--iter.line);\n iter.ch = iter.text.length;\n return true;\n }\n\n function toTagEnd(iter) {\n for (;;) {\n var gt = iter.text.indexOf(\">\", iter.ch);\n if (gt == -1) { if (nextLine(iter)) continue; else return; }\n if (!tagAt(iter, gt + 1)) { iter.ch = gt + 1; continue; }\n var lastSlash = iter.text.lastIndexOf(\"/\", gt);\n var selfClose = lastSlash > -1 && !/\\S/.test(iter.text.slice(lastSlash + 1, gt));\n iter.ch = gt + 1;\n return selfClose ? \"selfClose\" : \"regular\";\n }\n }\n function toTagStart(iter) {\n for (;;) {\n var lt = iter.ch ? iter.text.lastIndexOf(\"<\", iter.ch - 1) : -1;\n if (lt == -1) { if (prevLine(iter)) continue; else return; }\n if (!tagAt(iter, lt + 1)) { iter.ch = lt; continue; }\n xmlTagStart.lastIndex = lt;\n iter.ch = lt;\n var match = xmlTagStart.exec(iter.text);\n if (match && match.index == lt) return match;\n }\n }\n\n function toNextTag(iter) {\n for (;;) {\n xmlTagStart.lastIndex = iter.ch;\n var found = xmlTagStart.exec(iter.text);\n if (!found) { if (nextLine(iter)) continue; else return; }\n if (!tagAt(iter, found.index + 1)) { iter.ch = found.index + 1; continue; }\n iter.ch = found.index + found[0].length;\n return found;\n }\n }\n function toPrevTag(iter) {\n for (;;) {\n var gt = iter.ch ? iter.text.lastIndexOf(\">\", iter.ch - 1) : -1;\n if (gt == -1) { if (prevLine(iter)) continue; else return; }\n if (!tagAt(iter, gt + 1)) { iter.ch = gt; continue; }\n var lastSlash = iter.text.lastIndexOf(\"/\", gt);\n var selfClose = lastSlash > -1 && !/\\S/.test(iter.text.slice(lastSlash + 1, gt));\n iter.ch = gt + 1;\n return selfClose ? \"selfClose\" : \"regular\";\n }\n }\n\n function findMatchingClose(iter, tag) {\n var stack = [];\n for (;;) {\n var next = toNextTag(iter), end, startLine = iter.line, startCh = iter.ch - (next ? next[0].length : 0);\n if (!next || !(end = toTagEnd(iter))) return;\n if (end == \"selfClose\") continue;\n if (next[1]) { // closing tag\n for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == next[2]) {\n stack.length = i;\n break;\n }\n if (i < 0 && (!tag || tag == next[2])) return {\n tag: next[2],\n from: Pos(startLine, startCh),\n to: Pos(iter.line, iter.ch)\n };\n } else { // opening tag\n stack.push(next[2]);\n }\n }\n }\n function findMatchingOpen(iter, tag) {\n var stack = [];\n for (;;) {\n var prev = toPrevTag(iter);\n if (!prev) return;\n if (prev == \"selfClose\") { toTagStart(iter); continue; }\n var endLine = iter.line, endCh = iter.ch;\n var start = toTagStart(iter);\n if (!start) return;\n if (start[1]) { // closing tag\n stack.push(start[2]);\n } else { // opening tag\n for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == start[2]) {\n stack.length = i;\n break;\n }\n if (i < 0 && (!tag || tag == start[2])) return {\n tag: start[2],\n from: Pos(iter.line, iter.ch),\n to: Pos(endLine, endCh)\n };\n }\n }\n }\n\n CodeMirror.registerHelper(\"fold\", \"xml\", function(cm, start) {\n var iter = new Iter(cm, start.line, 0);\n for (;;) {\n var openTag = toNextTag(iter), end;\n if (!openTag || iter.line != start.line || !(end = toTagEnd(iter))) return;\n if (!openTag[1] && end != \"selfClose\") {\n var startPos = Pos(iter.line, iter.ch);\n var endPos = findMatchingClose(iter, openTag[2]);\n return endPos && {from: startPos, to: endPos.from};\n }\n }\n });\n CodeMirror.findMatchingTag = function(cm, pos, range) {\n var iter = new Iter(cm, pos.line, pos.ch, range);\n if (iter.text.indexOf(\">\") == -1 && iter.text.indexOf(\"<\") == -1) return;\n var end = toTagEnd(iter), to = end && Pos(iter.line, iter.ch);\n var start = end && toTagStart(iter);\n if (!end || !start || cmp(iter, pos) > 0) return;\n var here = {from: Pos(iter.line, iter.ch), to: to, tag: start[2]};\n if (end == \"selfClose\") return {open: here, close: null, at: \"open\"};\n\n if (start[1]) { // closing tag\n return {open: findMatchingOpen(iter, start[2]), close: here, at: \"close\"};\n } else { // opening tag\n iter = new Iter(cm, to.line, to.ch, range);\n return {open: here, close: findMatchingClose(iter, start[2]), at: \"open\"};\n }\n };\n\n CodeMirror.findEnclosingTag = function(cm, pos, range) {\n var iter = new Iter(cm, pos.line, pos.ch, range);\n for (;;) {\n var open = findMatchingOpen(iter);\n if (!open) break;\n var forward = new Iter(cm, pos.line, pos.ch, range);\n var close = findMatchingClose(forward, open.tag);\n if (close) return {open: open, close: close};\n }\n };\n\n // Used by addon/edit/closetag.js\n CodeMirror.scanForClosingTag = function(cm, pos, name, end) {\n var iter = new Iter(cm, pos.line, pos.ch, end ? {from: 0, to: end} : null);\n return findMatchingClose(iter, name);\n };\n});\n\n},{\"../../lib/codemirror\":17}],17:[function(require,module,exports){\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n// This is CodeMirror (http://codemirror.net), a code editor\n// implemented in JavaScript on top of the browser's DOM.\n//\n// You can find some technical background for some of the code below\n// at http://marijnhaverbeke.nl/blog/#cm-internals .\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n module.exports = mod();\n else if (typeof define == \"function\" && define.amd) // AMD\n return define([], mod);\n else // Plain browser env\n (this || window).CodeMirror = mod();\n})(function() {\n \"use strict\";\n\n // BROWSER SNIFFING\n\n // Kludges for bugs and behavior differences that can't be feature\n // detected are enabled based on userAgent etc sniffing.\n var userAgent = navigator.userAgent;\n var platform = navigator.platform;\n\n var gecko = /gecko\\/\\d/i.test(userAgent);\n var ie_upto10 = /MSIE \\d/.test(userAgent);\n var ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(userAgent);\n var ie = ie_upto10 || ie_11up;\n var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : ie_11up[1]);\n var webkit = /WebKit\\//.test(userAgent);\n var qtwebkit = webkit && /Qt\\/\\d+\\.\\d+/.test(userAgent);\n var chrome = /Chrome\\//.test(userAgent);\n var presto = /Opera\\//.test(userAgent);\n var safari = /Apple Computer/.test(navigator.vendor);\n var mac_geMountainLion = /Mac OS X 1\\d\\D([8-9]|\\d\\d)\\D/.test(userAgent);\n var phantom = /PhantomJS/.test(userAgent);\n\n var ios = /AppleWebKit/.test(userAgent) && /Mobile\\/\\w+/.test(userAgent);\n // This is woefully incomplete. Suggestions for alternative methods welcome.\n var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);\n var mac = ios || /Mac/.test(platform);\n var chromeOS = /\\bCrOS\\b/.test(userAgent);\n var windows = /win/i.test(platform);\n\n var presto_version = presto && userAgent.match(/Version\\/(\\d*\\.\\d*)/);\n if (presto_version) presto_version = Number(presto_version[1]);\n if (presto_version && presto_version >= 15) { presto = false; webkit = true; }\n // Some browsers use the wrong event properties to signal cmd/ctrl on OS X\n var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));\n var captureRightClick = gecko || (ie && ie_version >= 9);\n\n // Optimize some code when these features are not used.\n var sawReadOnlySpans = false, sawCollapsedSpans = false;\n\n // EDITOR CONSTRUCTOR\n\n // A CodeMirror instance represents an editor. This is the object\n // that user code is usually dealing with.\n\n function CodeMirror(place, options) {\n if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") doc = new Doc(doc, options.mode, null, options.lineSeparator);\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n this.display.wrapper.className += \" CodeMirror-wrap\";\n if (options.autofocus && !mobile) display.input.focus();\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n var cm = this;\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || cm.hasFocus())\n setTimeout(bind(onFocus, this), 20);\n else\n onBlur(this);\n\n for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))\n optionHandlers[opt](this, options[opt], Init);\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) options.finishInit(this);\n for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n display.lineDiv.style.textRendering = \"auto\";\n }\n\n // DISPLAY CONSTRUCTOR\n\n // The display handles the DOM integration, both for input reading\n // and content drawing. It holds references to DOM nodes and\n // display-related state.\n\n function Display(place, doc, input) {\n var d = this;\n this.input = input;\n\n // Covers bottom-right square when both scrollbars are present.\n d.scrollbarFiller = elt(\"div\", null, \"CodeMirror-scrollbar-filler\");\n d.scrollbarFiller.setAttribute(\"cm-not-content\", \"true\");\n // Covers bottom of gutter when coverGutterNextToScrollbar is on\n // and h scrollbar is present.\n d.gutterFiller = elt(\"div\", null, \"CodeMirror-gutter-filler\");\n d.gutterFiller.setAttribute(\"cm-not-content\", \"true\");\n // Will contain the actual code, positioned to cover the viewport.\n d.lineDiv = elt(\"div\", null, \"CodeMirror-code\");\n // Elements are added to these to represent selection and cursors.\n d.selectionDiv = elt(\"div\", null, null, \"position: relative; z-index: 1\");\n d.cursorDiv = elt(\"div\", null, \"CodeMirror-cursors\");\n // A visibility: hidden element used to find the size of things.\n d.measure = elt(\"div\", null, \"CodeMirror-measure\");\n // When lines outside of the viewport are measured, they are drawn in this.\n d.lineMeasure = elt(\"div\", null, \"CodeMirror-measure\");\n // Wraps everything that needs to exist inside the vertically-padded coordinate system\n d.lineSpace = elt(\"div\", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],\n null, \"position: relative; outline: none\");\n // Moved around its parent to cover visible view.\n d.mover = elt(\"div\", [elt(\"div\", [d.lineSpace], \"CodeMirror-lines\")], null, \"position: relative\");\n // Set to the height of the document, allowing scrolling.\n d.sizer = elt(\"div\", [d.mover], \"CodeMirror-sizer\");\n d.sizerWidth = null;\n // Behavior of elts with overflow: auto and padding is\n // inconsistent across browsers. This is used to ensure the\n // scrollable area is big enough.\n d.heightForcer = elt(\"div\", null, null, \"position: absolute; height: \" + scrollerGap + \"px; width: 1px;\");\n // Will contain the gutters, if any.\n d.gutters = elt(\"div\", null, \"CodeMirror-gutters\");\n d.lineGutter = null;\n // Actual scrollable element.\n d.scroller = elt(\"div\", [d.sizer, d.heightForcer, d.gutters], \"CodeMirror-scroll\");\n d.scroller.setAttribute(\"tabIndex\", \"-1\");\n // The element in which the editor lives.\n d.wrapper = elt(\"div\", [d.scrollbarFiller, d.gutterFiller, d.scroller], \"CodeMirror\");\n\n // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)\n if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }\n if (!webkit && !(gecko && mobile)) d.scroller.draggable = true;\n\n if (place) {\n if (place.appendChild) place.appendChild(d.wrapper);\n else place(d.wrapper);\n }\n\n // Current rendered range (may be bigger than the view window).\n d.viewFrom = d.viewTo = doc.first;\n d.reportedViewFrom = d.reportedViewTo = doc.first;\n // Information about the rendered lines.\n d.view = [];\n d.renderedView = null;\n // Holds info about a single rendered line when it was rendered\n // for measurement, while not in view.\n d.externalMeasured = null;\n // Empty space (in pixels) above the view\n d.viewOffset = 0;\n d.lastWrapHeight = d.lastWrapWidth = 0;\n d.updateLineNumbers = null;\n\n d.nativeBarWidth = d.barHeight = d.barWidth = 0;\n d.scrollbarsClipped = false;\n\n // Used to only resize the line number gutter when necessary (when\n // the amount of lines crosses a boundary that makes its width change)\n d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;\n // Set to true when a non-horizontal-scrolling line widget is\n // added. As an optimization, line widget aligning is skipped when\n // this is false.\n d.alignWidgets = false;\n\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n d.maxLine = null;\n d.maxLineLength = 0;\n d.maxLineChanged = false;\n\n // Used for measuring wheel scrolling granularity\n d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;\n\n // True when shift is held down.\n d.shift = false;\n\n // Used to track whether anything happened since the context menu\n // was opened.\n d.selForContextMenu = null;\n\n d.activeTouch = null;\n\n input.init(d);\n }\n\n // STATE UPDATES\n\n // Used to get the editor into a consistent state again when options change.\n\n function loadMode(cm) {\n cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption);\n resetModeState(cm);\n }\n\n function resetModeState(cm) {\n cm.doc.iter(function(line) {\n if (line.stateAfter) line.stateAfter = null;\n if (line.styles) line.styles = null;\n });\n cm.doc.frontier = cm.doc.first;\n startWorker(cm, 100);\n cm.state.modeGen++;\n if (cm.curOp) regChange(cm);\n }\n\n function wrappingChanged(cm) {\n if (cm.options.lineWrapping) {\n addClass(cm.display.wrapper, \"CodeMirror-wrap\");\n cm.display.sizer.style.minWidth = \"\";\n cm.display.sizerWidth = null;\n } else {\n rmClass(cm.display.wrapper, \"CodeMirror-wrap\");\n findMaxLine(cm);\n }\n estimateLineHeights(cm);\n regChange(cm);\n clearCaches(cm);\n setTimeout(function(){updateScrollbars(cm);}, 100);\n }\n\n // Returns a function that estimates the height of a line, to use as\n // first approximation until the line becomes visible (and is thus\n // properly measurable).\n function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) return 0;\n\n var widgetsHeight = 0;\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;\n }\n\n if (wrapping)\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;\n else\n return widgetsHeight + th;\n };\n }\n\n function estimateLineHeights(cm) {\n var doc = cm.doc, est = estimateHeight(cm);\n doc.iter(function(line) {\n var estHeight = est(line);\n if (estHeight != line.height) updateLineHeight(line, estHeight);\n });\n }\n\n function themeChanged(cm) {\n cm.display.wrapper.className = cm.display.wrapper.className.replace(/\\s*cm-s-\\S+/g, \"\") +\n cm.options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\");\n clearCaches(cm);\n }\n\n function guttersChanged(cm) {\n updateGutters(cm);\n regChange(cm);\n setTimeout(function(){alignHorizontally(cm);}, 20);\n }\n\n // Rebuild the gutter elements, ensure the margin to the left of the\n // code matches their width.\n function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n for (var i = 0; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }\n\n function updateGutterSpace(cm) {\n var width = cm.display.gutters.offsetWidth;\n cm.display.sizer.style.marginLeft = width + \"px\";\n }\n\n // Compute the character length of a line, taking into account\n // collapsed ranges (see markText) that might hide parts, and join\n // other lines onto it.\n function lineLength(line) {\n if (line.height == 0) return 0;\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found = merged.find(0, true);\n len -= cur.text.length - found.from.ch;\n cur = found.to.line;\n len += cur.text.length - found.to.ch;\n }\n return len;\n }\n\n // Find the longest line in the document.\n function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }\n\n // Make sure the gutters options contains the element\n // \"CodeMirror-linenumbers\" when the lineNumbers option is true.\n function setGuttersForLineNumbers(options) {\n var found = indexOf(options.gutters, \"CodeMirror-linenumbers\");\n if (found == -1 && options.lineNumbers) {\n options.gutters = options.gutters.concat([\"CodeMirror-linenumbers\"]);\n } else if (found > -1 && !options.lineNumbers) {\n options.gutters = options.gutters.slice(0);\n options.gutters.splice(found, 1);\n }\n }\n\n // SCROLLBARS\n\n // Prepare DOM reads needed to update the scrollbars. Done in one\n // shot to minimize update/measure roundtrips.\n function measureForScrollbars(cm) {\n var d = cm.display, gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n };\n }\n\n function NativeScrollbars(place, scroll, cm) {\n this.cm = cm;\n var vert = this.vert = elt(\"div\", [elt(\"div\", null, null, \"min-width: 1px\")], \"CodeMirror-vscrollbar\");\n var horiz = this.horiz = elt(\"div\", [elt(\"div\", null, null, \"height: 100%; min-height: 1px\")], \"CodeMirror-hscrollbar\");\n place(vert); place(horiz);\n\n on(vert, \"scroll\", function() {\n if (vert.clientHeight) scroll(vert.scrollTop, \"vertical\");\n });\n on(horiz, \"scroll\", function() {\n if (horiz.clientWidth) scroll(horiz.scrollLeft, \"horizontal\");\n });\n\n this.checkedZeroWidth = false;\n // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).\n if (ie && ie_version < 8) this.horiz.style.minHeight = this.vert.style.minWidth = \"18px\";\n }\n\n NativeScrollbars.prototype = copyObj({\n update: function(measure) {\n var needsH = measure.scrollWidth > measure.clientWidth + 1;\n var needsV = measure.scrollHeight > measure.clientHeight + 1;\n var sWidth = measure.nativeBarWidth;\n\n if (needsV) {\n this.vert.style.display = \"block\";\n this.vert.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);\n // A bug in IE8 can cause this value to be negative, so guard it.\n this.vert.firstChild.style.height =\n Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + \"px\";\n } else {\n this.vert.style.display = \"\";\n this.vert.firstChild.style.height = \"0\";\n }\n\n if (needsH) {\n this.horiz.style.display = \"block\";\n this.horiz.style.right = needsV ? sWidth + \"px\" : \"0\";\n this.horiz.style.left = measure.barLeft + \"px\";\n var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);\n this.horiz.firstChild.style.width =\n (measure.scrollWidth - measure.clientWidth + totalWidth) + \"px\";\n } else {\n this.horiz.style.display = \"\";\n this.horiz.firstChild.style.width = \"0\";\n }\n\n if (!this.checkedZeroWidth && measure.clientHeight > 0) {\n if (sWidth == 0) this.zeroWidthHack();\n this.checkedZeroWidth = true;\n }\n\n return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0};\n },\n setScrollLeft: function(pos) {\n if (this.horiz.scrollLeft != pos) this.horiz.scrollLeft = pos;\n if (this.disableHoriz) this.enableZeroWidthBar(this.horiz, this.disableHoriz);\n },\n setScrollTop: function(pos) {\n if (this.vert.scrollTop != pos) this.vert.scrollTop = pos;\n if (this.disableVert) this.enableZeroWidthBar(this.vert, this.disableVert);\n },\n zeroWidthHack: function() {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n this.horiz.style.height = this.vert.style.width = w;\n this.horiz.style.pointerEvents = this.vert.style.pointerEvents = \"none\";\n this.disableHoriz = new Delayed;\n this.disableVert = new Delayed;\n },\n enableZeroWidthBar: function(bar, delay) {\n bar.style.pointerEvents = \"auto\";\n function maybeDisable() {\n // To find out whether the scrollbar is still visible, we\n // check whether the element under the pixel in the bottom\n // left corner of the scrollbar box is the scrollbar box\n // itself (when the bar is still visible) or its filler child\n // (when the bar is hidden). If it is still visible, we keep\n // it enabled, if it's hidden, we disable pointer events.\n var box = bar.getBoundingClientRect();\n var elt = document.elementFromPoint(box.left + 1, box.bottom - 1);\n if (elt != bar) bar.style.pointerEvents = \"none\";\n else delay.set(1000, maybeDisable);\n }\n delay.set(1000, maybeDisable);\n },\n clear: function() {\n var parent = this.horiz.parentNode;\n parent.removeChild(this.horiz);\n parent.removeChild(this.vert);\n }\n }, NativeScrollbars.prototype);\n\n function NullScrollbars() {}\n\n NullScrollbars.prototype = copyObj({\n update: function() { return {bottom: 0, right: 0}; },\n setScrollLeft: function() {},\n setScrollTop: function() {},\n clear: function() {}\n }, NullScrollbars.prototype);\n\n CodeMirror.scrollbarModel = {\"native\": NativeScrollbars, \"null\": NullScrollbars};\n\n function initScrollbars(cm) {\n if (cm.display.scrollbars) {\n cm.display.scrollbars.clear();\n if (cm.display.scrollbars.addClass)\n rmClass(cm.display.wrapper, cm.display.scrollbars.addClass);\n }\n\n cm.display.scrollbars = new CodeMirror.scrollbarModel[cm.options.scrollbarStyle](function(node) {\n cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);\n // Prevent clicks in the scrollbars from killing focus\n on(node, \"mousedown\", function() {\n if (cm.state.focused) setTimeout(function() { cm.display.input.focus(); }, 0);\n });\n node.setAttribute(\"cm-not-content\", \"true\");\n }, function(pos, axis) {\n if (axis == \"horizontal\") setScrollLeft(cm, pos);\n else setScrollTop(cm, pos);\n }, cm);\n if (cm.display.scrollbars.addClass)\n addClass(cm.display.wrapper, cm.display.scrollbars.addClass);\n }\n\n function updateScrollbars(cm, measure) {\n if (!measure) measure = measureForScrollbars(cm);\n var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;\n updateScrollbarsInner(cm, measure);\n for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {\n if (startWidth != cm.display.barWidth && cm.options.lineWrapping)\n updateHeightsInViewport(cm);\n updateScrollbarsInner(cm, measureForScrollbars(cm));\n startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;\n }\n }\n\n // Re-synchronize the fake scrollbars with the actual size of the\n // content.\n function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else d.scrollbarFiller.style.display = \"\";\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else d.gutterFiller.style.display = \"\";\n }\n\n // Compute the lines that are visible in a given viewport (defaults\n // the the current scroll position). viewport may contain top,\n // height, and ensure (see op.scrollToPos) properties.\n function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)};\n }\n\n // LINE NUMBERS\n\n // Re-align line numbers and gutter marks to compensate for\n // horizontal scrolling.\n function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) if (!view[i].hidden) {\n if (cm.options.fixedGutter && view[i].gutter)\n view[i].gutter.style.left = left;\n var align = view[i].alignable;\n if (align) for (var j = 0; j < align.length; j++)\n align[j].style.left = left;\n }\n if (cm.options.fixedGutter)\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }\n\n // Used to ensure that the line number gutter is still the right\n // size for the current document size. Returns true when an update\n // is needed.\n function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) return false;\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true;\n }\n return false;\n }\n\n function lineNumberFor(options, i) {\n return String(options.lineNumberFormatter(i + options.firstLineNumber));\n }\n\n // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,\n // but using getBoundingClientRect to get a sub-pixel-accurate\n // result.\n function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;\n }\n\n // DISPLAY DRAWING\n\n function DisplayUpdate(cm, viewport, force) {\n var display = cm.display;\n\n this.viewport = viewport;\n // Store some values that we'll need later (but don't want to force a relayout for)\n this.visible = visibleLines(display, cm.doc, viewport);\n this.editorIsHidden = !display.wrapper.offsetWidth;\n this.wrapperHeight = display.wrapper.clientHeight;\n this.wrapperWidth = display.wrapper.clientWidth;\n this.oldDisplayWidth = displayWidth(cm);\n this.force = force;\n this.dims = getDimensions(cm);\n this.events = [];\n }\n\n DisplayUpdate.prototype.signal = function(emitter, type) {\n if (hasHandler(emitter, type))\n this.events.push(arguments);\n };\n DisplayUpdate.prototype.finish = function() {\n for (var i = 0; i < this.events.length; i++)\n signal.apply(null, this.events[i]);\n };\n\n function maybeClipScrollbars(cm) {\n var display = cm.display;\n if (!display.scrollbarsClipped && display.scroller.offsetWidth) {\n display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;\n display.heightForcer.style.height = scrollGap(cm) + \"px\";\n display.sizer.style.marginBottom = -display.nativeBarWidth + \"px\";\n display.sizer.style.borderRightWidth = scrollGap(cm) + \"px\";\n display.scrollbarsClipped = true;\n }\n }\n\n // Does the actual updating of the line display. Bails out\n // (returning false) when there is nothing to be done and forced is\n // false.\n function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false;\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n return false;\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);\n if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n return false;\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var focused = activeElt();\n if (toUpdate > 4) display.lineDiv.style.display = \"none\";\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) display.lineDiv.style.display = \"\";\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true;\n }\n\n function postUpdateDisplay(cm, update) {\n var viewport = update.viewport;\n\n for (var first = true;; first = false) {\n if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {\n // Clip forced viewport to actual scrollable area.\n if (viewport && viewport.top != null)\n viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)};\n // Updated line heights might result in the drawn area not\n // actually covering the viewport. Keep looping until it does.\n update.visible = visibleLines(cm.display, cm.doc, viewport);\n if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)\n break;\n }\n if (!updateDisplayIfNeeded(cm, update)) break;\n updateHeightsInViewport(cm);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n }\n\n update.signal(cm, \"update\", cm);\n if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {\n update.signal(cm, \"viewportChange\", cm, cm.display.viewFrom, cm.display.viewTo);\n cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;\n }\n }\n\n function updateDisplaySimple(cm, viewport) {\n var update = new DisplayUpdate(cm, viewport);\n if (updateDisplayIfNeeded(cm, update)) {\n updateHeightsInViewport(cm);\n postUpdateDisplay(cm, update);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.finish();\n }\n }\n\n function setDocumentHeight(cm, measure) {\n cm.display.sizer.style.minHeight = measure.docHeight + \"px\";\n cm.display.heightForcer.style.top = measure.docHeight + \"px\";\n cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + \"px\";\n }\n\n // Read the actual heights of the rendered lines, and update their\n // stored heights to match.\n function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], height;\n if (cur.hidden) continue;\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n }\n var diff = cur.line.height - height;\n if (height < 2) height = textHeight(display);\n if (diff > .001 || diff < -.001) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) for (var j = 0; j < cur.rest.length; j++)\n updateWidgetHeight(cur.rest[j]);\n }\n }\n }\n\n // Read and store the height of line widgets associated with the\n // given line.\n function updateWidgetHeight(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)\n line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight;\n }\n\n // Do a bulk-read of the DOM positions and sizes needed to draw the\n // view, so that we don't interleave reading and writing to the DOM.\n function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth};\n }\n\n // Sync the actual display DOM structure with display.view, removing\n // nodes for lines that are no longer in view, and creating the ones\n // that are not there yet, and updating the ones that are out of\n // date.\n function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n node.style.display = \"none\";\n else\n node.parentNode.removeChild(node);\n return next;\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) cur = rm(cur);\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) updateNumber = false;\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) cur = rm(cur);\n }\n\n // When an aspect of a line changes, a string is added to\n // lineView.changes. This updates the relevant part of the line's\n // DOM structure.\n function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") updateLineText(cm, lineView);\n else if (type == \"gutter\") updateLineGutter(cm, lineView, lineN, dims);\n else if (type == \"class\") updateLineClasses(lineView);\n else if (type == \"widget\") updateLineWidgets(cm, lineView, dims);\n }\n lineView.changes = null;\n }\n\n // Lines with gutter elements, widgets or a background class need to\n // be wrapped, and have the extra elements added to the wrapper div\n function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) lineView.node.style.zIndex = 2;\n }\n return lineView.node;\n }\n\n function updateLineBackground(lineView) {\n var cls = lineView.bgClass ? lineView.bgClass + \" \" + (lineView.line.bgClass || \"\") : lineView.line.bgClass;\n if (cls) cls += \" CodeMirror-linebackground\";\n if (lineView.background) {\n if (cls) lineView.background.className = cls;\n else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }\n } else if (cls) {\n var wrap = ensureLineWrapped(lineView);\n lineView.background = wrap.insertBefore(elt(\"div\", null, cls), wrap.firstChild);\n }\n }\n\n // Wrapper around buildLineContent which will reuse the structure\n // in display.externalMeasured when possible.\n function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built;\n }\n return buildLineContent(cm, lineView);\n }\n\n // Redraw the line's text. Interacts with the background and text\n // classes because the mode may output tokens that influence these\n // classes.\n function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) lineView.node = built.pre;\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }\n\n function updateLineClasses(lineView) {\n updateLineBackground(lineView);\n if (lineView.line.wrapClass)\n ensureLineWrapped(lineView).className = lineView.line.wrapClass;\n else if (lineView.node != lineView.text)\n lineView.node.className = \"\";\n var textClass = lineView.textClass ? lineView.textClass + \" \" + (lineView.line.textClass || \"\") : lineView.line.textClass;\n lineView.text.className = textClass || \"\";\n }\n\n function updateLineGutter(cm, lineView, lineN, dims) {\n if (lineView.gutter) {\n lineView.node.removeChild(lineView.gutter);\n lineView.gutter = null;\n }\n if (lineView.gutterBackground) {\n lineView.node.removeChild(lineView.gutterBackground);\n lineView.gutterBackground = null;\n }\n if (lineView.line.gutterClass) {\n var wrap = ensureLineWrapped(lineView);\n lineView.gutterBackground = elt(\"div\", null, \"CodeMirror-gutter-background \" + lineView.line.gutterClass,\n \"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) +\n \"px; width: \" + dims.gutterTotalWidth + \"px\");\n wrap.insertBefore(lineView.gutterBackground, lineView.text);\n }\n var markers = lineView.line.gutterMarkers;\n if (cm.options.lineNumbers || markers) {\n var wrap = ensureLineWrapped(lineView);\n var gutterWrap = lineView.gutter = elt(\"div\", null, \"CodeMirror-gutter-wrapper\", \"left: \" +\n (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px\");\n cm.display.input.setUneditable(gutterWrap);\n wrap.insertBefore(gutterWrap, lineView.text);\n if (lineView.line.gutterClass)\n gutterWrap.className += \" \" + lineView.line.gutterClass;\n if (cm.options.lineNumbers && (!markers || !markers[\"CodeMirror-linenumbers\"]))\n lineView.lineNumber = gutterWrap.appendChild(\n elt(\"div\", lineNumberFor(cm.options, lineN),\n \"CodeMirror-linenumber CodeMirror-gutter-elt\",\n \"left: \" + dims.gutterLeft[\"CodeMirror-linenumbers\"] + \"px; width: \"\n + cm.display.lineNumInnerWidth + \"px\"));\n if (markers) for (var k = 0; k < cm.options.gutters.length; ++k) {\n var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];\n if (found)\n gutterWrap.appendChild(elt(\"div\", [found], \"CodeMirror-gutter-elt\", \"left: \" +\n dims.gutterLeft[id] + \"px; width: \" + dims.gutterWidth[id] + \"px\"));\n }\n }\n }\n\n function updateLineWidgets(cm, lineView, dims) {\n if (lineView.alignable) lineView.alignable = null;\n for (var node = lineView.node.firstChild, next; node; node = next) {\n var next = node.nextSibling;\n if (node.className == \"CodeMirror-linewidget\")\n lineView.node.removeChild(node);\n }\n insertLineWidgets(cm, lineView, dims);\n }\n\n // Build a line's DOM representation from scratch\n function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) lineView.bgClass = built.bgClass;\n if (built.textClass) lineView.textClass = built.textClass;\n\n updateLineClasses(lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node;\n }\n\n // A lineView may contain multiple logical lines (when merged by\n // collapsed spans). The widgets for all of them need to be drawn.\n function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n }\n\n function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {\n if (!line.widgets) return;\n var wrap = ensureLineWrapped(lineView);\n for (var i = 0, ws = line.widgets; i < ws.length; ++i) {\n var widget = ws[i], node = elt(\"div\", [widget.node], \"CodeMirror-linewidget\");\n if (!widget.handleMouseEvents) node.setAttribute(\"cm-ignore-events\", \"true\");\n positionLineWidget(widget, node, lineView, dims);\n cm.display.input.setUneditable(node);\n if (allowAbove && widget.above)\n wrap.insertBefore(node, lineView.gutter || lineView.text);\n else\n wrap.appendChild(node);\n signalLater(widget, \"redraw\");\n }\n }\n\n function positionLineWidget(widget, node, lineView, dims) {\n if (widget.noHScroll) {\n (lineView.alignable || (lineView.alignable = [])).push(node);\n var width = dims.wrapperWidth;\n node.style.left = dims.fixedPos + \"px\";\n if (!widget.coverGutter) {\n width -= dims.gutterTotalWidth;\n node.style.paddingLeft = dims.gutterTotalWidth + \"px\";\n }\n node.style.width = width + \"px\";\n }\n if (widget.coverGutter) {\n node.style.zIndex = 5;\n node.style.position = \"relative\";\n if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + \"px\";\n }\n }\n\n // POSITION OBJECT\n\n // A Pos instance represents a position within the text.\n var Pos = CodeMirror.Pos = function(line, ch) {\n if (!(this instanceof Pos)) return new Pos(line, ch);\n this.line = line; this.ch = ch;\n };\n\n // Compare two positions, return 0 if they are the same, a negative\n // number when a is less, and a positive number otherwise.\n var cmp = CodeMirror.cmpPos = function(a, b) { return a.line - b.line || a.ch - b.ch; };\n\n function copyPos(x) {return Pos(x.line, x.ch);}\n function maxPos(a, b) { return cmp(a, b) < 0 ? b : a; }\n function minPos(a, b) { return cmp(a, b) < 0 ? a : b; }\n\n // INPUT HANDLING\n\n function ensureFocus(cm) {\n if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }\n }\n\n // This will be set to a {lineWise: bool, text: [string]} object, so\n // that, when pasting, we know what kind of selections the copied\n // text was made out of.\n var lastCopied = null;\n\n function applyTextInput(cm, inserted, deleted, sel, origin) {\n var doc = cm.doc;\n cm.display.shift = false;\n if (!sel) sel = doc.sel;\n\n var paste = cm.state.pasteIncoming || origin == \"paste\";\n var textLines = doc.splitLines(inserted), multiPaste = null\n // When pasing N lines into N selections, insert one line per selection\n if (paste && sel.ranges.length > 1) {\n if (lastCopied && lastCopied.text.join(\"\\n\") == inserted) {\n if (sel.ranges.length % lastCopied.text.length == 0) {\n multiPaste = [];\n for (var i = 0; i < lastCopied.text.length; i++)\n multiPaste.push(doc.splitLines(lastCopied.text[i]));\n }\n } else if (textLines.length == sel.ranges.length) {\n multiPaste = map(textLines, function(l) { return [l]; });\n }\n }\n\n // Normal behavior is to insert the new text into every selection\n for (var i = sel.ranges.length - 1; i >= 0; i--) {\n var range = sel.ranges[i];\n var from = range.from(), to = range.to();\n if (range.empty()) {\n if (deleted && deleted > 0) // Handle deletion\n from = Pos(from.line, from.ch - deleted);\n else if (cm.state.overwrite && !paste) // Handle overwrite\n to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length));\n else if (lastCopied && lastCopied.lineWise && lastCopied.text.join(\"\\n\") == inserted)\n from = to = Pos(from.line, 0)\n }\n var updateInput = cm.curOp.updateInput;\n var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines,\n origin: origin || (paste ? \"paste\" : cm.state.cutIncoming ? \"cut\" : \"+input\")};\n makeChange(cm.doc, changeEvent);\n signalLater(cm, \"inputRead\", cm, changeEvent);\n }\n if (inserted && !paste)\n triggerElectric(cm, inserted);\n\n ensureCursorVisible(cm);\n cm.curOp.updateInput = updateInput;\n cm.curOp.typing = true;\n cm.state.pasteIncoming = cm.state.cutIncoming = false;\n }\n\n function handlePaste(e, cm) {\n var pasted = e.clipboardData && e.clipboardData.getData(\"text/plain\");\n if (pasted) {\n e.preventDefault();\n if (!cm.isReadOnly() && !cm.options.disableInput)\n runInOp(cm, function() { applyTextInput(cm, pasted, 0, null, \"paste\"); });\n return true;\n }\n }\n\n function triggerElectric(cm, inserted) {\n // When an 'electric' character is inserted, immediately trigger a reindent\n if (!cm.options.electricChars || !cm.options.smartIndent) return;\n var sel = cm.doc.sel;\n\n for (var i = sel.ranges.length - 1; i >= 0; i--) {\n var range = sel.ranges[i];\n if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) continue;\n var mode = cm.getModeAt(range.head);\n var indented = false;\n if (mode.electricChars) {\n for (var j = 0; j < mode.electricChars.length; j++)\n if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {\n indented = indentLine(cm, range.head.line, \"smart\");\n break;\n }\n } else if (mode.electricInput) {\n if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))\n indented = indentLine(cm, range.head.line, \"smart\");\n }\n if (indented) signalLater(cm, \"electricInput\", cm, range.head.line);\n }\n }\n\n function copyableRanges(cm) {\n var text = [], ranges = [];\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n ranges.push(lineRange);\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\n }\n return {text: text, ranges: ranges};\n }\n\n function disableBrowserMagic(field) {\n field.setAttribute(\"autocorrect\", \"off\");\n field.setAttribute(\"autocapitalize\", \"off\");\n field.setAttribute(\"spellcheck\", \"false\");\n }\n\n // TEXTAREA INPUT STYLE\n\n function TextareaInput(cm) {\n this.cm = cm;\n // See input.poll and input.reset\n this.prevInput = \"\";\n\n // Flag that indicates whether we expect input to appear real soon\n // now (after some event like 'keypress' or 'input') and are\n // polling intensively.\n this.pollingFast = false;\n // Self-resetting timeout for the poller\n this.polling = new Delayed();\n // Tracks when input.reset has punted to just putting a short\n // string into the textarea instead of the full selection.\n this.inaccurateSelection = false;\n // Used to work around IE issue with selection being forgotten when focus moves away from textarea\n this.hasSelection = false;\n this.composing = null;\n };\n\n function hiddenTextarea() {\n var te = elt(\"textarea\", null, null, \"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none\");\n var div = elt(\"div\", [te], null, \"overflow: hidden; position: relative; width: 3px; height: 0px;\");\n // The textarea is kept positioned near the cursor to prevent the\n // fact that it'll be scrolled into view on input from scrolling\n // our fake cursor out of view. On webkit, when wrap=off, paste is\n // very slow. So make the area wide instead.\n if (webkit) te.style.width = \"1000px\";\n else te.setAttribute(\"wrap\", \"off\");\n // If border: 0; -- iOS fails to open keyboard (issue #1287)\n if (ios) te.style.border = \"1px solid black\";\n disableBrowserMagic(te);\n return div;\n }\n\n TextareaInput.prototype = copyObj({\n init: function(display) {\n var input = this, cm = this.cm;\n\n // Wraps and hides input textarea\n var div = this.wrapper = hiddenTextarea();\n // The semihidden textarea that is focused when the editor is\n // focused, and receives input.\n var te = this.textarea = div.firstChild;\n display.wrapper.insertBefore(div, display.wrapper.firstChild);\n\n // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)\n if (ios) te.style.width = \"0px\";\n\n on(te, \"input\", function() {\n if (ie && ie_version >= 9 && input.hasSelection) input.hasSelection = null;\n input.poll();\n });\n\n on(te, \"paste\", function(e) {\n if (signalDOMEvent(cm, e) || handlePaste(e, cm)) return\n\n cm.state.pasteIncoming = true;\n input.fastPoll();\n });\n\n function prepareCopyCut(e) {\n if (signalDOMEvent(cm, e)) return\n if (cm.somethingSelected()) {\n lastCopied = {lineWise: false, text: cm.getSelections()};\n if (input.inaccurateSelection) {\n input.prevInput = \"\";\n input.inaccurateSelection = false;\n te.value = lastCopied.text.join(\"\\n\");\n selectInput(te);\n }\n } else if (!cm.options.lineWiseCopyCut) {\n return;\n } else {\n var ranges = copyableRanges(cm);\n lastCopied = {lineWise: true, text: ranges.text};\n if (e.type == \"cut\") {\n cm.setSelections(ranges.ranges, null, sel_dontScroll);\n } else {\n input.prevInput = \"\";\n te.value = ranges.text.join(\"\\n\");\n selectInput(te);\n }\n }\n if (e.type == \"cut\") cm.state.cutIncoming = true;\n }\n on(te, \"cut\", prepareCopyCut);\n on(te, \"copy\", prepareCopyCut);\n\n on(display.scroller, \"paste\", function(e) {\n if (eventInWidget(display, e) || signalDOMEvent(cm, e)) return;\n cm.state.pasteIncoming = true;\n input.focus();\n });\n\n // Prevent normal selection in the editor (we handle our own)\n on(display.lineSpace, \"selectstart\", function(e) {\n if (!eventInWidget(display, e)) e_preventDefault(e);\n });\n\n on(te, \"compositionstart\", function() {\n var start = cm.getCursor(\"from\");\n if (input.composing) input.composing.range.clear()\n input.composing = {\n start: start,\n range: cm.markText(start, cm.getCursor(\"to\"), {className: \"CodeMirror-composing\"})\n };\n });\n on(te, \"compositionend\", function() {\n if (input.composing) {\n input.poll();\n input.composing.range.clear();\n input.composing = null;\n }\n });\n },\n\n prepareSelection: function() {\n // Redraw the selection and/or cursor\n var cm = this.cm, display = cm.display, doc = cm.doc;\n var result = prepareSelection(cm);\n\n // Move the hidden textarea near the cursor to prevent scrolling artifacts\n if (cm.options.moveInputWithCursor) {\n var headPos = cursorCoords(cm, doc.sel.primary().head, \"div\");\n var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();\n result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,\n headPos.top + lineOff.top - wrapOff.top));\n result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,\n headPos.left + lineOff.left - wrapOff.left));\n }\n\n return result;\n },\n\n showSelection: function(drawn) {\n var cm = this.cm, display = cm.display;\n removeChildrenAndAdd(display.cursorDiv, drawn.cursors);\n removeChildrenAndAdd(display.selectionDiv, drawn.selection);\n if (drawn.teTop != null) {\n this.wrapper.style.top = drawn.teTop + \"px\";\n this.wrapper.style.left = drawn.teLeft + \"px\";\n }\n },\n\n // Reset the input to correspond to the selection (or to be empty,\n // when not typing and nothing is selected)\n reset: function(typing) {\n if (this.contextMenuPending) return;\n var minimal, selected, cm = this.cm, doc = cm.doc;\n if (cm.somethingSelected()) {\n this.prevInput = \"\";\n var range = doc.sel.primary();\n minimal = hasCopyEvent &&\n (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000);\n var content = minimal ? \"-\" : selected || cm.getSelection();\n this.textarea.value = content;\n if (cm.state.focused) selectInput(this.textarea);\n if (ie && ie_version >= 9) this.hasSelection = content;\n } else if (!typing) {\n this.prevInput = this.textarea.value = \"\";\n if (ie && ie_version >= 9) this.hasSelection = null;\n }\n this.inaccurateSelection = minimal;\n },\n\n getField: function() { return this.textarea; },\n\n supportsTouch: function() { return false; },\n\n focus: function() {\n if (this.cm.options.readOnly != \"nocursor\" && (!mobile || activeElt() != this.textarea)) {\n try { this.textarea.focus(); }\n catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM\n }\n },\n\n blur: function() { this.textarea.blur(); },\n\n resetPosition: function() {\n this.wrapper.style.top = this.wrapper.style.left = 0;\n },\n\n receivedFocus: function() { this.slowPoll(); },\n\n // Poll for input changes, using the normal rate of polling. This\n // runs as long as the editor is focused.\n slowPoll: function() {\n var input = this;\n if (input.pollingFast) return;\n input.polling.set(this.cm.options.pollInterval, function() {\n input.poll();\n if (input.cm.state.focused) input.slowPoll();\n });\n },\n\n // When an event has just come in that is likely to add or change\n // something in the input textarea, we poll faster, to ensure that\n // the change appears on the screen quickly.\n fastPoll: function() {\n var missed = false, input = this;\n input.pollingFast = true;\n function p() {\n var changed = input.poll();\n if (!changed && !missed) {missed = true; input.polling.set(60, p);}\n else {input.pollingFast = false; input.slowPoll();}\n }\n input.polling.set(20, p);\n },\n\n // Read input from the textarea, and update the document to match.\n // When something is selected, it is present in the textarea, and\n // selected (unless it is huge, in which case a placeholder is\n // used). When nothing is selected, the cursor sits after previously\n // seen text (can be empty), which is stored in prevInput (we must\n // not reset the textarea when typing, because that breaks IME).\n poll: function() {\n var cm = this.cm, input = this.textarea, prevInput = this.prevInput;\n // Since this is called a *lot*, try to bail out as cheaply as\n // possible when it is clear that nothing happened. hasSelection\n // will be the case when there is a lot of text in the textarea,\n // in which case reading its value would be expensive.\n if (this.contextMenuPending || !cm.state.focused ||\n (hasSelection(input) && !prevInput && !this.composing) ||\n cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)\n return false;\n\n var text = input.value;\n // If nothing changed, bail.\n if (text == prevInput && !cm.somethingSelected()) return false;\n // Work around nonsensical selection resetting in IE9/10, and\n // inexplicable appearance of private area unicode characters on\n // some key combos in Mac (#2689).\n if (ie && ie_version >= 9 && this.hasSelection === text ||\n mac && /[\\uf700-\\uf7ff]/.test(text)) {\n cm.display.input.reset();\n return false;\n }\n\n if (cm.doc.sel == cm.display.selForContextMenu) {\n var first = text.charCodeAt(0);\n if (first == 0x200b && !prevInput) prevInput = \"\\u200b\";\n if (first == 0x21da) { this.reset(); return this.cm.execCommand(\"undo\"); }\n }\n // Find the part of the input that is actually new\n var same = 0, l = Math.min(prevInput.length, text.length);\n while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same;\n\n var self = this;\n runInOp(cm, function() {\n applyTextInput(cm, text.slice(same), prevInput.length - same,\n null, self.composing ? \"*compose\" : null);\n\n // Don't leave long text in the textarea, since it makes further polling slow\n if (text.length > 1000 || text.indexOf(\"\\n\") > -1) input.value = self.prevInput = \"\";\n else self.prevInput = text;\n\n if (self.composing) {\n self.composing.range.clear();\n self.composing.range = cm.markText(self.composing.start, cm.getCursor(\"to\"),\n {className: \"CodeMirror-composing\"});\n }\n });\n return true;\n },\n\n ensurePolled: function() {\n if (this.pollingFast && this.poll()) this.pollingFast = false;\n },\n\n onKeyPress: function() {\n if (ie && ie_version >= 9) this.hasSelection = null;\n this.fastPoll();\n },\n\n onContextMenu: function(e) {\n var input = this, cm = input.cm, display = cm.display, te = input.textarea;\n var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\n if (!pos || presto) return; // Opera is difficult.\n\n // Reset the current text selection only if the click is done outside of the selection\n // and 'resetSelectionOnContextMenu' option is true.\n var reset = cm.options.resetSelectionOnContextMenu;\n if (reset && cm.doc.sel.contains(pos) == -1)\n operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);\n\n var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;\n input.wrapper.style.cssText = \"position: absolute\"\n var wrapperBox = input.wrapper.getBoundingClientRect()\n te.style.cssText = \"position: absolute; width: 30px; height: 30px; top: \" + (e.clientY - wrapperBox.top - 5) +\n \"px; left: \" + (e.clientX - wrapperBox.left - 5) + \"px; z-index: 1000; background: \" +\n (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") +\n \"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712)\n display.input.focus();\n if (webkit) window.scrollTo(null, oldScrollY);\n display.input.reset();\n // Adds \"Select all\" to context menu in FF\n if (!cm.somethingSelected()) te.value = input.prevInput = \" \";\n input.contextMenuPending = true;\n display.selForContextMenu = cm.doc.sel;\n clearTimeout(display.detectingSelectAll);\n\n // Select-all will be greyed out if there's nothing to select, so\n // this adds a zero-width space so that we can later check whether\n // it got selected.\n function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }\n function rehide() {\n input.contextMenuPending = false;\n input.wrapper.style.cssText = oldWrapperCSS\n te.style.cssText = oldCSS;\n if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos);\n\n // Try to detect the user choosing select-all\n if (te.selectionStart != null) {\n if (!ie || (ie && ie_version < 9)) prepareSelectAllHack();\n var i = 0, poll = function() {\n if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&\n te.selectionEnd > 0 && input.prevInput == \"\\u200b\")\n operation(cm, commands.selectAll)(cm);\n else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500);\n else display.input.reset();\n };\n display.detectingSelectAll = setTimeout(poll, 200);\n }\n }\n\n if (ie && ie_version >= 9) prepareSelectAllHack();\n if (captureRightClick) {\n e_stop(e);\n var mouseup = function() {\n off(window, \"mouseup\", mouseup);\n setTimeout(rehide, 20);\n };\n on(window, \"mouseup\", mouseup);\n } else {\n setTimeout(rehide, 50);\n }\n },\n\n readOnlyChanged: function(val) {\n if (!val) this.reset();\n },\n\n setUneditable: nothing,\n\n needsContentAttribute: false\n }, TextareaInput.prototype);\n\n // CONTENTEDITABLE INPUT STYLE\n\n function ContentEditableInput(cm) {\n this.cm = cm;\n this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;\n this.polling = new Delayed();\n this.gracePeriod = false;\n }\n\n ContentEditableInput.prototype = copyObj({\n init: function(display) {\n var input = this, cm = input.cm;\n var div = input.div = display.lineDiv;\n disableBrowserMagic(div);\n\n on(div, \"paste\", function(e) {\n if (!signalDOMEvent(cm, e)) handlePaste(e, cm);\n })\n\n on(div, \"compositionstart\", function(e) {\n var data = e.data;\n input.composing = {sel: cm.doc.sel, data: data, startData: data};\n if (!data) return;\n var prim = cm.doc.sel.primary();\n var line = cm.getLine(prim.head.line);\n var found = line.indexOf(data, Math.max(0, prim.head.ch - data.length));\n if (found > -1 && found <= prim.head.ch)\n input.composing.sel = simpleSelection(Pos(prim.head.line, found),\n Pos(prim.head.line, found + data.length));\n });\n on(div, \"compositionupdate\", function(e) {\n input.composing.data = e.data;\n });\n on(div, \"compositionend\", function(e) {\n var ours = input.composing;\n if (!ours) return;\n if (e.data != ours.startData && !/\\u200b/.test(e.data))\n ours.data = e.data;\n // Need a small delay to prevent other code (input event,\n // selection polling) from doing damage when fired right after\n // compositionend.\n setTimeout(function() {\n if (!ours.handled)\n input.applyComposition(ours);\n if (input.composing == ours)\n input.composing = null;\n }, 50);\n });\n\n on(div, \"touchstart\", function() {\n input.forceCompositionEnd();\n });\n\n on(div, \"input\", function() {\n if (input.composing) return;\n if (cm.isReadOnly() || !input.pollContent())\n runInOp(input.cm, function() {regChange(cm);});\n });\n\n function onCopyCut(e) {\n if (signalDOMEvent(cm, e)) return\n if (cm.somethingSelected()) {\n lastCopied = {lineWise: false, text: cm.getSelections()};\n if (e.type == \"cut\") cm.replaceSelection(\"\", null, \"cut\");\n } else if (!cm.options.lineWiseCopyCut) {\n return;\n } else {\n var ranges = copyableRanges(cm);\n lastCopied = {lineWise: true, text: ranges.text};\n if (e.type == \"cut\") {\n cm.operation(function() {\n cm.setSelections(ranges.ranges, 0, sel_dontScroll);\n cm.replaceSelection(\"\", null, \"cut\");\n });\n }\n }\n // iOS exposes the clipboard API, but seems to discard content inserted into it\n if (e.clipboardData && !ios) {\n e.preventDefault();\n e.clipboardData.clearData();\n e.clipboardData.setData(\"text/plain\", lastCopied.text.join(\"\\n\"));\n } else {\n // Old-fashioned briefly-focus-a-textarea hack\n var kludge = hiddenTextarea(), te = kludge.firstChild;\n cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);\n te.value = lastCopied.text.join(\"\\n\");\n var hadFocus = document.activeElement;\n selectInput(te);\n setTimeout(function() {\n cm.display.lineSpace.removeChild(kludge);\n hadFocus.focus();\n }, 50);\n }\n }\n on(div, \"copy\", onCopyCut);\n on(div, \"cut\", onCopyCut);\n },\n\n prepareSelection: function() {\n var result = prepareSelection(this.cm, false);\n result.focus = this.cm.state.focused;\n return result;\n },\n\n showSelection: function(info, takeFocus) {\n if (!info || !this.cm.display.view.length) return;\n if (info.focus || takeFocus) this.showPrimarySelection();\n this.showMultipleSelections(info);\n },\n\n showPrimarySelection: function() {\n var sel = window.getSelection(), prim = this.cm.doc.sel.primary();\n var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset);\n var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset);\n if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&\n cmp(minPos(curAnchor, curFocus), prim.from()) == 0 &&\n cmp(maxPos(curAnchor, curFocus), prim.to()) == 0)\n return;\n\n var start = posToDOM(this.cm, prim.from());\n var end = posToDOM(this.cm, prim.to());\n if (!start && !end) return;\n\n var view = this.cm.display.view;\n var old = sel.rangeCount && sel.getRangeAt(0);\n if (!start) {\n start = {node: view[0].measure.map[2], offset: 0};\n } else if (!end) { // FIXME dangerously hacky\n var measure = view[view.length - 1].measure;\n var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;\n end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]};\n }\n\n try { var rng = range(start.node, start.offset, end.offset, end.node); }\n catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible\n if (rng) {\n if (!gecko && this.cm.state.focused) {\n sel.collapse(start.node, start.offset);\n if (!rng.collapsed) sel.addRange(rng);\n } else {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n if (old && sel.anchorNode == null) sel.addRange(old);\n else if (gecko) this.startGracePeriod();\n }\n this.rememberSelection();\n },\n\n startGracePeriod: function() {\n var input = this;\n clearTimeout(this.gracePeriod);\n this.gracePeriod = setTimeout(function() {\n input.gracePeriod = false;\n if (input.selectionChanged())\n input.cm.operation(function() { input.cm.curOp.selectionChanged = true; });\n }, 20);\n },\n\n showMultipleSelections: function(info) {\n removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);\n removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);\n },\n\n rememberSelection: function() {\n var sel = window.getSelection();\n this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;\n this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;\n },\n\n selectionInEditor: function() {\n var sel = window.getSelection();\n if (!sel.rangeCount) return false;\n var node = sel.getRangeAt(0).commonAncestorContainer;\n return contains(this.div, node);\n },\n\n focus: function() {\n if (this.cm.options.readOnly != \"nocursor\") this.div.focus();\n },\n blur: function() { this.div.blur(); },\n getField: function() { return this.div; },\n\n supportsTouch: function() { return true; },\n\n receivedFocus: function() {\n var input = this;\n if (this.selectionInEditor())\n this.pollSelection();\n else\n runInOp(this.cm, function() { input.cm.curOp.selectionChanged = true; });\n\n function poll() {\n if (input.cm.state.focused) {\n input.pollSelection();\n input.polling.set(input.cm.options.pollInterval, poll);\n }\n }\n this.polling.set(this.cm.options.pollInterval, poll);\n },\n\n selectionChanged: function() {\n var sel = window.getSelection();\n return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||\n sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset;\n },\n\n pollSelection: function() {\n if (!this.composing && !this.gracePeriod && this.selectionChanged()) {\n var sel = window.getSelection(), cm = this.cm;\n this.rememberSelection();\n var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var head = domToPos(cm, sel.focusNode, sel.focusOffset);\n if (anchor && head) runInOp(cm, function() {\n setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);\n if (anchor.bad || head.bad) cm.curOp.selectionChanged = true;\n });\n }\n },\n\n pollContent: function() {\n var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();\n var from = sel.from(), to = sel.to();\n if (from.line < display.viewFrom || to.line > display.viewTo - 1) return false;\n\n var fromIndex;\n if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {\n var fromLine = lineNo(display.view[0].line);\n var fromNode = display.view[0].node;\n } else {\n var fromLine = lineNo(display.view[fromIndex].line);\n var fromNode = display.view[fromIndex - 1].node.nextSibling;\n }\n var toIndex = findViewIndex(cm, to.line);\n if (toIndex == display.view.length - 1) {\n var toLine = display.viewTo - 1;\n var toNode = display.lineDiv.lastChild;\n } else {\n var toLine = lineNo(display.view[toIndex + 1].line) - 1;\n var toNode = display.view[toIndex + 1].node.previousSibling;\n }\n\n var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));\n var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));\n while (newText.length > 1 && oldText.length > 1) {\n if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }\n else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }\n else break;\n }\n\n var cutFront = 0, cutEnd = 0;\n var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);\n while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))\n ++cutFront;\n var newBot = lst(newText), oldBot = lst(oldText);\n var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),\n oldBot.length - (oldText.length == 1 ? cutFront : 0));\n while (cutEnd < maxCutEnd &&\n newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))\n ++cutEnd;\n\n newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd);\n newText[0] = newText[0].slice(cutFront);\n\n var chFrom = Pos(fromLine, cutFront);\n var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);\n if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {\n replaceRange(cm.doc, newText, chFrom, chTo, \"+input\");\n return true;\n }\n },\n\n ensurePolled: function() {\n this.forceCompositionEnd();\n },\n reset: function() {\n this.forceCompositionEnd();\n },\n forceCompositionEnd: function() {\n if (!this.composing || this.composing.handled) return;\n this.applyComposition(this.composing);\n this.composing.handled = true;\n this.div.blur();\n this.div.focus();\n },\n applyComposition: function(composing) {\n if (this.cm.isReadOnly())\n operation(this.cm, regChange)(this.cm)\n else if (composing.data && composing.data != composing.startData)\n operation(this.cm, applyTextInput)(this.cm, composing.data, 0, composing.sel);\n },\n\n setUneditable: function(node) {\n node.contentEditable = \"false\"\n },\n\n onKeyPress: function(e) {\n e.preventDefault();\n if (!this.cm.isReadOnly())\n operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0);\n },\n\n readOnlyChanged: function(val) {\n this.div.contentEditable = String(val != \"nocursor\")\n },\n\n onContextMenu: nothing,\n resetPosition: nothing,\n\n needsContentAttribute: true\n }, ContentEditableInput.prototype);\n\n function posToDOM(cm, pos) {\n var view = findViewForLine(cm, pos.line);\n if (!view || view.hidden) return null;\n var line = getLine(cm.doc, pos.line);\n var info = mapFromLineView(view, line, pos.line);\n\n var order = getOrder(line), side = \"left\";\n if (order) {\n var partPos = getBidiPartAt(order, pos.ch);\n side = partPos % 2 ? \"right\" : \"left\";\n }\n var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);\n result.offset = result.collapse == \"right\" ? result.end : result.start;\n return result;\n }\n\n function badPos(pos, bad) { if (bad) pos.bad = true; return pos; }\n\n function domToPos(cm, node, offset) {\n var lineNode;\n if (node == cm.display.lineDiv) {\n lineNode = cm.display.lineDiv.childNodes[offset];\n if (!lineNode) return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true);\n node = null; offset = 0;\n } else {\n for (lineNode = node;; lineNode = lineNode.parentNode) {\n if (!lineNode || lineNode == cm.display.lineDiv) return null;\n if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) break;\n }\n }\n for (var i = 0; i < cm.display.view.length; i++) {\n var lineView = cm.display.view[i];\n if (lineView.node == lineNode)\n return locateNodeInLineView(lineView, node, offset);\n }\n }\n\n function locateNodeInLineView(lineView, node, offset) {\n var wrapper = lineView.text.firstChild, bad = false;\n if (!node || !contains(wrapper, node)) return badPos(Pos(lineNo(lineView.line), 0), true);\n if (node == wrapper) {\n bad = true;\n node = wrapper.childNodes[offset];\n offset = 0;\n if (!node) {\n var line = lineView.rest ? lst(lineView.rest) : lineView.line;\n return badPos(Pos(lineNo(line), line.text.length), bad);\n }\n }\n\n var textNode = node.nodeType == 3 ? node : null, topNode = node;\n if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {\n textNode = node.firstChild;\n if (offset) offset = textNode.nodeValue.length;\n }\n while (topNode.parentNode != wrapper) topNode = topNode.parentNode;\n var measure = lineView.measure, maps = measure.maps;\n\n function find(textNode, topNode, offset) {\n for (var i = -1; i < (maps ? maps.length : 0); i++) {\n var map = i < 0 ? measure.map : maps[i];\n for (var j = 0; j < map.length; j += 3) {\n var curNode = map[j + 2];\n if (curNode == textNode || curNode == topNode) {\n var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);\n var ch = map[j] + offset;\n if (offset < 0 || curNode != textNode) ch = map[j + (offset ? 1 : 0)];\n return Pos(line, ch);\n }\n }\n }\n }\n var found = find(textNode, topNode, offset);\n if (found) return badPos(found, bad);\n\n // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems\n for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {\n found = find(after, after.firstChild, 0);\n if (found)\n return badPos(Pos(found.line, found.ch - dist), bad);\n else\n dist += after.textContent.length;\n }\n for (var before = topNode.previousSibling, dist = offset; before; before = before.previousSibling) {\n found = find(before, before.firstChild, -1);\n if (found)\n return badPos(Pos(found.line, found.ch + dist), bad);\n else\n dist += after.textContent.length;\n }\n }\n\n function domTextBetween(cm, from, to, fromLine, toLine) {\n var text = \"\", closing = false, lineSep = cm.doc.lineSeparator();\n function recognizeMarker(id) { return function(marker) { return marker.id == id; }; }\n function walk(node) {\n if (node.nodeType == 1) {\n var cmText = node.getAttribute(\"cm-text\");\n if (cmText != null) {\n if (cmText == \"\") cmText = node.textContent.replace(/\\u200b/g, \"\");\n text += cmText;\n return;\n }\n var markerID = node.getAttribute(\"cm-marker\"), range;\n if (markerID) {\n var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));\n if (found.length && (range = found[0].find()))\n text += getBetween(cm.doc, range.from, range.to).join(lineSep);\n return;\n }\n if (node.getAttribute(\"contenteditable\") == \"false\") return;\n for (var i = 0; i < node.childNodes.length; i++)\n walk(node.childNodes[i]);\n if (/^(pre|div|p)$/i.test(node.nodeName))\n closing = true;\n } else if (node.nodeType == 3) {\n var val = node.nodeValue;\n if (!val) return;\n if (closing) {\n text += lineSep;\n closing = false;\n }\n text += val;\n }\n }\n for (;;) {\n walk(from);\n if (from == to) break;\n from = from.nextSibling;\n }\n return text;\n }\n\n CodeMirror.inputStyles = {\"textarea\": TextareaInput, \"contenteditable\": ContentEditableInput};\n\n // SELECTION / CURSOR\n\n // Selection objects are immutable. A new one is created every time\n // the selection changes. A selection is one or more non-overlapping\n // (and non-touching) ranges, sorted, and an integer that indicates\n // which one is the primary selection (the one that's scrolled into\n // view, that getCursor returns, etc).\n function Selection(ranges, primIndex) {\n this.ranges = ranges;\n this.primIndex = primIndex;\n }\n\n Selection.prototype = {\n primary: function() { return this.ranges[this.primIndex]; },\n equals: function(other) {\n if (other == this) return true;\n if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) return false;\n for (var i = 0; i < this.ranges.length; i++) {\n var here = this.ranges[i], there = other.ranges[i];\n if (cmp(here.anchor, there.anchor) != 0 || cmp(here.head, there.head) != 0) return false;\n }\n return true;\n },\n deepCopy: function() {\n for (var out = [], i = 0; i < this.ranges.length; i++)\n out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head));\n return new Selection(out, this.primIndex);\n },\n somethingSelected: function() {\n for (var i = 0; i < this.ranges.length; i++)\n if (!this.ranges[i].empty()) return true;\n return false;\n },\n contains: function(pos, end) {\n if (!end) end = pos;\n for (var i = 0; i < this.ranges.length; i++) {\n var range = this.ranges[i];\n if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)\n return i;\n }\n return -1;\n }\n };\n\n function Range(anchor, head) {\n this.anchor = anchor; this.head = head;\n }\n\n Range.prototype = {\n from: function() { return minPos(this.anchor, this.head); },\n to: function() { return maxPos(this.anchor, this.head); },\n empty: function() {\n return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch;\n }\n };\n\n // Take an unsorted, potentially overlapping set of ranges, and\n // build a selection out of it. 'Consumes' ranges array (modifying\n // it).\n function normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) --primIndex;\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex);\n }\n\n function simpleSelection(anchor, head) {\n return new Selection([new Range(anchor, head || anchor)], 0);\n }\n\n // Most of the external API clips given positions to make sure they\n // actually exist within the document.\n function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1));}\n function clipPos(doc, pos) {\n if (pos.line < doc.first) return Pos(doc.first, 0);\n var last = doc.first + doc.size - 1;\n if (pos.line > last) return Pos(last, getLine(doc, last).text.length);\n return clipToLen(pos, getLine(doc, pos.line).text.length);\n }\n function clipToLen(pos, linelen) {\n var ch = pos.ch;\n if (ch == null || ch > linelen) return Pos(pos.line, linelen);\n else if (ch < 0) return Pos(pos.line, 0);\n else return pos;\n }\n function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;}\n function clipPosArray(doc, array) {\n for (var out = [], i = 0; i < array.length; i++) out[i] = clipPos(doc, array[i]);\n return out;\n }\n\n // SELECTION UPDATES\n\n // The 'scroll' parameter given to many of these indicated whether\n // the new cursor position should be scrolled into view after\n // modifying the selection.\n\n // If shift is held or the extend flag is set, extends a range to\n // include a given position (and optionally a second position).\n // Otherwise, simply returns the range between the given positions.\n // Used for cursor motion and such.\n function extendRange(doc, range, head, other) {\n if (doc.cm && doc.cm.display.shift || doc.extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head);\n } else {\n return new Range(other || head, head);\n }\n }\n\n // Extend the primary selection range, discard the rest.\n function extendSelection(doc, head, other, options) {\n setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);\n }\n\n // Extend all selections (pos is an array of selections with length\n // equal the number of selections)\n function extendSelections(doc, heads, options) {\n for (var out = [], i = 0; i < doc.sel.ranges.length; i++)\n out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }\n\n // Updates a single range in the selection.\n function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n }\n\n // Reset the selection to a single range.\n function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }\n\n // Give beforeSelectionChange handlers a change to influence a\n // selection update.\n function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head));\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);\n else return sel;\n }\n\n function setSelectionReplaceHistory(doc, sel, options) {\n var done = doc.history.done, last = lst(done);\n if (last && last.ranges) {\n done[done.length - 1] = sel;\n setSelectionNoUndo(doc, sel, options);\n } else {\n setSelection(doc, sel, options);\n }\n }\n\n // Set a new selection.\n function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n }\n\n function setSelectionNoUndo(doc, sel, options) {\n if (hasHandler(doc, \"beforeSelectionChange\") || doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\"))\n sel = filterSelectionChange(doc, sel, options);\n\n var bias = options && options.bias ||\n (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);\n setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));\n\n if (!(options && options.scroll === false) && doc.cm)\n ensureCursorVisible(doc.cm);\n }\n\n function setSelectionInner(doc, sel) {\n if (sel.equals(doc.sel)) return;\n\n doc.sel = sel;\n\n if (doc.cm) {\n doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;\n signalCursorActivity(doc.cm);\n }\n signalLater(doc, \"cursorActivity\", doc);\n }\n\n // Verify that the selection does not partially select any atomic\n // marked ranges.\n function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);\n }\n\n // Return a selection that does not partially select any atomic\n // ranges.\n function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) out = sel.ranges.slice(0, i);\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel;\n }\n\n function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {\n var line = getLine(doc, pos.line);\n if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {\n var sp = line.markedSpans[i], m = sp.marker;\n if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&\n (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {\n if (mayClear) {\n signal(m, \"beforeCursorEnter\");\n if (m.explicitlyCleared) {\n if (!line.markedSpans) break;\n else {--i; continue;}\n }\n }\n if (!m.atomic) continue;\n\n if (oldPos) {\n var near = m.find(dir < 0 ? 1 : -1), diff;\n if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)\n near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null);\n if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))\n return skipAtomicInner(doc, near, pos, dir, mayClear);\n }\n\n var far = m.find(dir < 0 ? -1 : 1);\n if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)\n far = movePos(doc, far, dir, far.line == pos.line ? line : null);\n return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null;\n }\n }\n return pos;\n }\n\n // Ensure a given position is not inside an atomic range.\n function skipAtomic(doc, pos, oldPos, bias, mayClear) {\n var dir = bias || 1;\n var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||\n skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));\n if (!found) {\n doc.cantEdit = true;\n return Pos(doc.first, 0);\n }\n return found;\n }\n\n function movePos(doc, pos, dir, line) {\n if (dir < 0 && pos.ch == 0) {\n if (pos.line > doc.first) return clipPos(doc, Pos(pos.line - 1));\n else return null;\n } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {\n if (pos.line < doc.first + doc.size - 1) return Pos(pos.line + 1, 0);\n else return null;\n } else {\n return new Pos(pos.line, pos.ch + dir);\n }\n }\n\n // SELECTION DRAWING\n\n function updateSelection(cm) {\n cm.display.input.showSelection(cm.display.input.prepareSelection());\n }\n\n function prepareSelection(cm, primary) {\n var doc = cm.doc, result = {};\n var curFragment = result.cursors = document.createDocumentFragment();\n var selFragment = result.selection = document.createDocumentFragment();\n\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n if (primary === false && i == doc.sel.primIndex) continue;\n var range = doc.sel.ranges[i];\n if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) continue;\n var collapsed = range.empty();\n if (collapsed || cm.options.showCursorWhenSelecting)\n drawSelectionCursor(cm, range.head, curFragment);\n if (!collapsed)\n drawSelectionRange(cm, range, selFragment);\n }\n return result;\n }\n\n // Draws a cursor for the given range\n function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }\n\n // Draws the given range as a highlighted selection\n function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n\n function add(left, top, width, bottom) {\n if (top < 0) top = 0;\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", \"position: absolute; left: \" + left +\n \"px; top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) +\n \"px; height: \" + (bottom - top) + \"px\"));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias);\n }\n\n iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {\n var leftPos = coords(from, \"left\"), rightPos, left, right;\n if (from == to) {\n rightPos = leftPos;\n left = right = leftPos.left;\n } else {\n rightPos = coords(to - 1, \"right\");\n if (dir == \"rtl\") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }\n left = leftPos.left;\n right = rightPos.right;\n }\n if (fromArg == null && from == 0) left = leftSide;\n if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part\n add(left, leftPos.top, null, leftPos.bottom);\n left = leftSide;\n if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);\n }\n if (toArg == null && to == lineLen) right = rightSide;\n if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)\n start = leftPos;\n if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)\n end = rightPos;\n if (left < leftSide + 1) left = leftSide;\n add(left, rightPos.top, right - left, rightPos.bottom);\n });\n return {start: start, end: end};\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n\n output.appendChild(fragment);\n }\n\n // Cursor-blinking\n function restartBlink(cm) {\n if (!cm.state.focused) return;\n var display = cm.display;\n clearInterval(display.blinker);\n var on = true;\n display.cursorDiv.style.visibility = \"\";\n if (cm.options.cursorBlinkRate > 0)\n display.blinker = setInterval(function() {\n display.cursorDiv.style.visibility = (on = !on) ? \"\" : \"hidden\";\n }, cm.options.cursorBlinkRate);\n else if (cm.options.cursorBlinkRate < 0)\n display.cursorDiv.style.visibility = \"hidden\";\n }\n\n // HIGHLIGHT WORKER\n\n function startWorker(cm, time) {\n if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)\n cm.state.highlight.set(time, bind(highlightWorker, cm));\n }\n\n function highlightWorker(cm) {\n var doc = cm.doc;\n if (doc.frontier < doc.first) doc.frontier = doc.first;\n if (doc.frontier >= cm.display.viewTo) return;\n var end = +new Date + cm.options.workTime;\n var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));\n var changedLines = [];\n\n doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function(line) {\n if (doc.frontier >= cm.display.viewFrom) { // Visible\n var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength;\n var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true);\n line.styles = highlighted.styles;\n var oldCls = line.styleClasses, newCls = highlighted.classes;\n if (newCls) line.styleClasses = newCls;\n else if (oldCls) line.styleClasses = null;\n var ischange = !oldStyles || oldStyles.length != line.styles.length ||\n oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);\n for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i];\n if (ischange) changedLines.push(doc.frontier);\n line.stateAfter = tooLong ? state : copyState(doc.mode, state);\n } else {\n if (line.text.length <= cm.options.maxHighlightLength)\n processLine(cm, line.text, state);\n line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;\n }\n ++doc.frontier;\n if (+new Date > end) {\n startWorker(cm, cm.options.workDelay);\n return true;\n }\n });\n if (changedLines.length) runInOp(cm, function() {\n for (var i = 0; i < changedLines.length; i++)\n regLineChange(cm, changedLines[i], \"text\");\n });\n }\n\n // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) return doc.first;\n var line = getLine(doc, search - 1);\n if (line.stateAfter && (!precise || search <= doc.frontier)) return search;\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline;\n }\n\n function getStateBefore(cm, n, precise) {\n var doc = cm.doc, display = cm.display;\n if (!doc.mode.startState) return true;\n var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;\n if (!state) state = startState(doc.mode);\n else state = copyState(doc.mode, state);\n doc.iter(pos, n, function(line) {\n processLine(cm, line.text, state);\n var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;\n line.stateAfter = save ? copyState(doc.mode, state) : null;\n ++pos;\n });\n if (precise) doc.frontier = pos;\n return state;\n }\n\n // POSITION MEASUREMENT\n\n function paddingTop(display) {return display.lineSpace.offsetTop;}\n function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight;}\n function paddingH(display) {\n if (display.cachedPaddingH) return display.cachedPaddingH;\n var e = removeChildrenAndAdd(display.measure, elt(\"pre\", \"x\"));\n var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;\n var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};\n if (!isNaN(data.left) && !isNaN(data.right)) display.cachedPaddingH = data;\n return data;\n }\n\n function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth; }\n function displayWidth(cm) {\n return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth;\n }\n function displayHeight(cm) {\n return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight;\n }\n\n // Ensure the lineView.wrapping.heights array is populated. This is\n // an array of bottom offsets for the lines that make up a drawn\n // line. When lineWrapping is on, there might be more than one\n // height.\n function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n heights.push((cur.bottom + next.top) / 2 - rect.top);\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }\n\n // Find a line map (mapping character offsets to text nodes) and a\n // measurement cache for the given line number. (A line view might\n // contain multiple lines when collapsed ranges are present.)\n function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n return {map: lineView.measure.map, cache: lineView.measure.cache};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineView.rest[i] == line)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};\n for (var i = 0; i < lineView.rest.length; i++)\n if (lineNo(lineView.rest[i]) > lineN)\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};\n }\n\n // Render a line into the hidden node display.externalMeasured. Used\n // when measurement is needed for a line that's not in the viewport.\n function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view;\n }\n\n // Get a {top, bottom, left, right} box (in line-local coordinates)\n // for a given character.\n function measureChar(cm, line, ch, bias) {\n return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias);\n }\n\n // Find a line view that corresponds to the given line number.\n function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n return cm.display.view[findViewIndex(cm, lineN)];\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n return ext;\n }\n\n // Measurement can be split in two steps, the set-up work that\n // applies to the whole line, and the measurement of the actual\n // character. Functions like coordsChar, that need to do a lot of\n // measurements in a row, can thus ensure that the set-up work is\n // only done once.\n function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n view = updateExternalMeasurement(cm, line);\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n };\n }\n\n // Given a prepared measurement object, measures the position of an\n // actual character (or fetches it from the cache).\n function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) ch = -1;\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n prepared.rect = prepared.view.text.getBoundingClientRect();\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) prepared.cache[key] = found;\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom};\n }\n\n var nullRect = {left: 0, right: 0, top: 0, bottom: 0};\n\n function nodeAndOffsetInLineMap(map, ch, bias) {\n var node, start, end, collapse;\n // First, search the line map for the text node corresponding to,\n // or closest to, the target character.\n for (var i = 0; i < map.length; i += 3) {\n var mStart = map[i], mEnd = map[i + 1];\n if (ch < mStart) {\n start = 0; end = 1;\n collapse = \"left\";\n } else if (ch < mEnd) {\n start = ch - mStart;\n end = start + 1;\n } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {\n end = mEnd - mStart;\n start = end - 1;\n if (ch >= mEnd) collapse = \"right\";\n }\n if (start != null) {\n node = map[i + 2];\n if (mStart == mEnd && bias == (node.insertLeft ? \"left\" : \"right\"))\n collapse = bias;\n if (bias == \"left\" && start == 0)\n while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {\n node = map[(i -= 3) + 2];\n collapse = \"left\";\n }\n if (bias == \"right\" && start == mEnd - mStart)\n while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {\n node = map[(i += 3) + 2];\n collapse = \"right\";\n }\n break;\n }\n }\n return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd};\n }\n\n function getUsefulRect(rects, bias) {\n var rect = nullRect\n if (bias == \"left\") for (var i = 0; i < rects.length; i++) {\n if ((rect = rects[i]).left != rect.right) break\n } else for (var i = rects.length - 1; i >= 0; i--) {\n if ((rect = rects[i]).left != rect.right) break\n }\n return rect\n }\n\n function measureCharInner(cm, prepared, ch, bias) {\n var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);\n var node = place.node, start = place.start, end = place.end, collapse = place.collapse;\n\n var rect;\n if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.\n for (var i = 0; i < 4; i++) { // Retry a maximum of 4 times when nonsense rectangles are returned\n while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) --start;\n while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) ++end;\n if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)\n rect = node.parentNode.getBoundingClientRect();\n else\n rect = getUsefulRect(range(node, start, end).getClientRects(), bias)\n if (rect.left || rect.right || start == 0) break;\n end = start;\n start = start - 1;\n collapse = \"right\";\n }\n if (ie && ie_version < 11) rect = maybeUpdateRectForZooming(cm.display.measure, rect);\n } else { // If it is a widget, simply get the box for the whole widget.\n if (start > 0) collapse = bias = \"right\";\n var rects;\n if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)\n rect = rects[bias == \"right\" ? rects.length - 1 : 0];\n else\n rect = node.getBoundingClientRect();\n }\n if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {\n var rSpan = node.parentNode.getClientRects()[0];\n if (rSpan)\n rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom};\n else\n rect = nullRect;\n }\n\n var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;\n var mid = (rtop + rbot) / 2;\n var heights = prepared.view.measure.heights;\n for (var i = 0; i < heights.length - 1; i++)\n if (mid < heights[i]) break;\n var top = i ? heights[i - 1] : 0, bot = heights[i];\n var result = {left: (collapse == \"right\" ? rect.right : rect.left) - prepared.rect.left,\n right: (collapse == \"left\" ? rect.left : rect.right) - prepared.rect.left,\n top: top, bottom: bot};\n if (!rect.left && !rect.right) result.bogus = true;\n if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }\n\n return result;\n }\n\n // Work around problem with bounding client rects on ranges being\n // returned incorrectly when zoomed on IE10 and below.\n function maybeUpdateRectForZooming(measure, rect) {\n if (!window.screen || screen.logicalXDPI == null ||\n screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))\n return rect;\n var scaleX = screen.logicalXDPI / screen.deviceXDPI;\n var scaleY = screen.logicalYDPI / screen.deviceYDPI;\n return {left: rect.left * scaleX, right: rect.right * scaleX,\n top: rect.top * scaleY, bottom: rect.bottom * scaleY};\n }\n\n function clearLineMeasurementCacheFor(lineView) {\n if (lineView.measure) {\n lineView.measure.cache = {};\n lineView.measure.heights = null;\n if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)\n lineView.measure.caches[i] = {};\n }\n }\n\n function clearLineMeasurementCache(cm) {\n cm.display.externalMeasure = null;\n removeChildren(cm.display.lineMeasure);\n for (var i = 0; i < cm.display.view.length; i++)\n clearLineMeasurementCacheFor(cm.display.view[i]);\n }\n\n function clearCaches(cm) {\n clearLineMeasurementCache(cm);\n cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;\n if (!cm.options.lineWrapping) cm.display.maxLineChanged = true;\n cm.display.lineNumChars = null;\n }\n\n function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft; }\n function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop; }\n\n // Converts a {top, bottom, left, right} box from line-local\n // coordinates into another coordinate system. Context may be one of\n // \"line\", \"div\" (display.lineDiv), \"local\"/null (editor), \"window\",\n // or \"page\".\n function intoCoordSystem(cm, lineObj, rect, context) {\n if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {\n var size = widgetHeight(lineObj.widgets[i]);\n rect.top += size; rect.bottom += size;\n }\n if (context == \"line\") return rect;\n if (!context) context = \"local\";\n var yOff = heightAtLine(lineObj);\n if (context == \"local\") yOff += paddingTop(cm.display);\n else yOff -= cm.display.viewOffset;\n if (context == \"page\" || context == \"window\") {\n var lOff = cm.display.lineSpace.getBoundingClientRect();\n yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY());\n var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX());\n rect.left += xOff; rect.right += xOff;\n }\n rect.top += yOff; rect.bottom += yOff;\n return rect;\n }\n\n // Coverts a box from \"div\" coords to another coordinate system.\n // Context may be \"window\", \"page\", \"div\", or \"local\"/null.\n function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") return coords;\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};\n }\n\n function charCoords(cm, pos, context, lineObj, bias) {\n if (!lineObj) lineObj = getLine(cm.doc, pos.line);\n return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context);\n }\n\n // Returns a box for a given cursor position, which may have an\n // 'other' property containing the position of the secondary cursor\n // on a bidi boundary.\n function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) m.left = m.right; else m.right = m.left;\n return intoCoordSystem(cm, lineObj, m, context);\n }\n function getBidi(ch, partPos) {\n var part = order[partPos], right = part.level % 2;\n if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {\n part = order[--partPos];\n ch = bidiRight(part) - (part.level % 2 ? 0 : 1);\n right = true;\n } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {\n part = order[++partPos];\n ch = bidiLeft(part) - part.level % 2;\n right = false;\n }\n if (right && ch == part.to && ch > part.from) return get(ch - 1);\n return get(ch, right);\n }\n var order = getOrder(lineObj), ch = pos.ch;\n if (!order) return get(ch);\n var partPos = getBidiPartAt(order, ch);\n var val = getBidi(ch, partPos);\n if (bidiOther != null) val.other = getBidi(ch, bidiOther);\n return val;\n }\n\n // Used to cheaply estimate the coordinates for a position. Used for\n // intermediate scroll updates.\n function estimateCoords(cm, pos) {\n var left = 0, pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height};\n }\n\n // Positions returned by coordsChar contain some extra information.\n // xRel is the relative x position of the input coordinates compared\n // to the found position (so xRel > 0 means the coordinates are to\n // the right of the character position, for example). When outside\n // is true, that means the coordinates lie outside the line's\n // vertical range.\n function PosWithInfo(line, ch, outside, xRel) {\n var pos = Pos(line, ch);\n pos.xRel = xRel;\n if (outside) pos.outside = true;\n return pos;\n }\n\n // Compute the character position closest to the given coordinates.\n // Input must be lineSpace-local (\"div\" coordinate system).\n function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) return PosWithInfo(doc.first, 0, true, -1);\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);\n if (x < 0) x = 0;\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n lineN = lineNo(lineObj = mergedPos.to.line);\n else\n return found;\n }\n }\n\n function coordsCharInner(cm, lineObj, lineNo, x, y) {\n var innerOff = y - heightAtLine(lineObj);\n var wrongLine = false, adjust = 2 * cm.display.wrapper.clientWidth;\n var preparedMeasure = prepareMeasureForLine(cm, lineObj);\n\n function getX(ch) {\n var sp = cursorCoords(cm, Pos(lineNo, ch), \"line\", lineObj, preparedMeasure);\n wrongLine = true;\n if (innerOff > sp.bottom) return sp.left - adjust;\n else if (innerOff < sp.top) return sp.left + adjust;\n else wrongLine = false;\n return sp.left;\n }\n\n var bidi = getOrder(lineObj), dist = lineObj.text.length;\n var from = lineLeft(lineObj), to = lineRight(lineObj);\n var fromX = getX(from), fromOutside = wrongLine, toX = getX(to), toOutside = wrongLine;\n\n if (x > toX) return PosWithInfo(lineNo, to, toOutside, 1);\n // Do a binary search between these bounds.\n for (;;) {\n if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) {\n var ch = x < fromX || x - fromX <= toX - x ? from : to;\n var outside = ch == from ? fromOutside : toOutside\n var xDiff = x - (ch == from ? fromX : toX);\n // This is a kludge to handle the case where the coordinates\n // are after a line-wrapped line. We should replace it with a\n // more general handling of cursor positions around line\n // breaks. (Issue #4078)\n if (toOutside && !bidi && !/\\s/.test(lineObj.text.charAt(ch)) && xDiff > 0 &&\n ch < lineObj.text.length && preparedMeasure.view.measure.heights.length > 1) {\n var charSize = measureCharPrepared(cm, preparedMeasure, ch, \"right\");\n if (innerOff <= charSize.bottom && innerOff >= charSize.top && Math.abs(x - charSize.right) < xDiff) {\n outside = false\n ch++\n xDiff = x - charSize.right\n }\n }\n while (isExtendingChar(lineObj.text.charAt(ch))) ++ch;\n var pos = PosWithInfo(lineNo, ch, outside, xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0);\n return pos;\n }\n var step = Math.ceil(dist / 2), middle = from + step;\n if (bidi) {\n middle = from;\n for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1);\n }\n var middleX = getX(middle);\n if (middleX > x) {to = middle; toX = middleX; if (toOutside = wrongLine) toX += 1000; dist = step;}\n else {from = middle; fromX = middleX; fromOutside = wrongLine; dist -= step;}\n }\n }\n\n var measureText;\n // Compute the default text height.\n function textHeight(display) {\n if (display.cachedTextHeight != null) return display.cachedTextHeight;\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) display.cachedTextHeight = height;\n removeChildren(display.measure);\n return height || 1;\n }\n\n // Compute the default character width.\n function charWidth(display) {\n if (display.cachedCharWidth != null) return display.cachedCharWidth;\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) display.cachedCharWidth = width;\n return width || 10;\n }\n\n // OPERATIONS\n\n // Operations are used to wrap a series of changes to the editor\n // state in such a way that each change won't have to update the\n // cursor and display (which would be awkward, slow, and\n // error-prone). Instead, display updates are batched and then all\n // combined and executed at once.\n\n var operationGroup = null;\n\n var nextOpId = 0;\n // Start a new operation.\n function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n if (operationGroup) {\n operationGroup.ops.push(cm.curOp);\n } else {\n cm.curOp.ownsGroup = operationGroup = {\n ops: [cm.curOp],\n delayedCallbacks: []\n };\n }\n }\n\n function fireCallbacksForOps(group) {\n // Calls delayed callbacks and cursorActivity handlers until no\n // new ones appear\n var callbacks = group.delayedCallbacks, i = 0;\n do {\n for (; i < callbacks.length; i++)\n callbacks[i].call(null);\n for (var j = 0; j < group.ops.length; j++) {\n var op = group.ops[j];\n if (op.cursorActivityHandlers)\n while (op.cursorActivityCalled < op.cursorActivityHandlers.length)\n op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm);\n }\n } while (i < callbacks.length);\n }\n\n // Finish an operation, updating the display and signalling delayed events\n function endOperation(cm) {\n var op = cm.curOp, group = op.ownsGroup;\n if (!group) return;\n\n try { fireCallbacksForOps(group); }\n finally {\n operationGroup = null;\n for (var i = 0; i < group.ops.length; i++)\n group.ops[i].cm.curOp = null;\n endOperations(group);\n }\n }\n\n // The DOM updates done when an operation finishes are batched so\n // that the minimum number of relayouts are required.\n function endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W1(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_R2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Write DOM (maybe)\n endOperation_W2(ops[i]);\n for (var i = 0; i < ops.length; i++) // Read DOM\n endOperation_finish(ops[i]);\n }\n\n function endOperation_R1(op) {\n var cm = op.cm, display = cm.display;\n maybeClipScrollbars(cm);\n if (op.updateMaxLine) findMaxLine(cm);\n\n op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||\n op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||\n op.scrollToPos.to.line >= display.viewTo) ||\n display.maxLineChanged && cm.options.lineWrapping;\n op.update = op.mustUpdate &&\n new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);\n }\n\n function endOperation_W1(op) {\n op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);\n }\n\n function endOperation_R2(op) {\n var cm = op.cm, display = cm.display;\n if (op.updatedDisplay) updateHeightsInViewport(cm);\n\n op.barMeasure = measureForScrollbars(cm);\n\n // If the max line changed since it was last measured, measure it,\n // and ensure the document's width matches it.\n // updateDisplay_W2 will use these properties to do the actual resizing\n if (display.maxLineChanged && !cm.options.lineWrapping) {\n op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;\n cm.display.sizerWidth = op.adjustWidthTo;\n op.barMeasure.scrollWidth =\n Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);\n op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));\n }\n\n if (op.updatedDisplay || op.selectionChanged)\n op.preparedSelection = display.input.prepareSelection(op.focus);\n }\n\n function endOperation_W2(op) {\n var cm = op.cm;\n\n if (op.adjustWidthTo != null) {\n cm.display.sizer.style.minWidth = op.adjustWidthTo + \"px\";\n if (op.maxScrollLeft < cm.doc.scrollLeft)\n setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true);\n cm.display.maxLineChanged = false;\n }\n\n var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus())\n if (op.preparedSelection)\n cm.display.input.showSelection(op.preparedSelection, takeFocus);\n if (op.updatedDisplay || op.startHeight != cm.doc.height)\n updateScrollbars(cm, op.barMeasure);\n if (op.updatedDisplay)\n setDocumentHeight(cm, op.barMeasure);\n\n if (op.selectionChanged) restartBlink(cm);\n\n if (cm.state.focused && op.updateInput)\n cm.display.input.reset(op.typing);\n if (takeFocus) ensureFocus(op.cm);\n }\n\n function endOperation_finish(op) {\n var cm = op.cm, display = cm.display, doc = cm.doc;\n\n if (op.updatedDisplay) postUpdateDisplay(cm, op.update);\n\n // Abort mouse wheel delta measurement, when scrolling explicitly\n if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))\n display.wheelStartX = display.wheelStartY = null;\n\n // Propagate the scroll position to the actual DOM scroller\n if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) {\n doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));\n display.scrollbars.setScrollTop(doc.scrollTop);\n display.scroller.scrollTop = doc.scrollTop;\n }\n if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {\n doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));\n display.scrollbars.setScrollLeft(doc.scrollLeft);\n display.scroller.scrollLeft = doc.scrollLeft;\n alignHorizontally(cm);\n }\n // If we need to scroll a specific position into view, do so.\n if (op.scrollToPos) {\n var coords = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),\n clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);\n if (op.scrollToPos.isCursor && cm.state.focused) maybeScrollWindow(cm, coords);\n }\n\n // Fire events for markers that are hidden/unidden by editing or\n // undoing\n var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;\n if (hidden) for (var i = 0; i < hidden.length; ++i)\n if (!hidden[i].lines.length) signal(hidden[i], \"hide\");\n if (unhidden) for (var i = 0; i < unhidden.length; ++i)\n if (unhidden[i].lines.length) signal(unhidden[i], \"unhide\");\n\n if (display.wrapper.offsetHeight)\n doc.scrollTop = cm.display.scroller.scrollTop;\n\n // Fire change events, and delayed event handlers\n if (op.changeObjs)\n signal(cm, \"changes\", cm, op.changeObjs);\n if (op.update)\n op.update.finish();\n }\n\n // Run the given function in an operation\n function runInOp(cm, f) {\n if (cm.curOp) return f();\n startOperation(cm);\n try { return f(); }\n finally { endOperation(cm); }\n }\n // Wraps a function in an operation. Returns the wrapped function.\n function operation(cm, f) {\n return function() {\n if (cm.curOp) return f.apply(cm, arguments);\n startOperation(cm);\n try { return f.apply(cm, arguments); }\n finally { endOperation(cm); }\n };\n }\n // Used to add methods to editor and doc instances, wrapping them in\n // operations.\n function methodOp(f) {\n return function() {\n if (this.curOp) return f.apply(this, arguments);\n startOperation(this);\n try { return f.apply(this, arguments); }\n finally { endOperation(this); }\n };\n }\n function docMethodOp(f) {\n return function() {\n var cm = this.cm;\n if (!cm || cm.curOp) return f.apply(this, arguments);\n startOperation(cm);\n try { return f.apply(this, arguments); }\n finally { endOperation(cm); }\n };\n }\n\n // VIEW TRACKING\n\n // These objects are used to represent the visible (currently drawn)\n // part of the document. A LineView may correspond to multiple\n // logical lines, if those are connected by collapsed ranges.\n function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }\n\n // Create a range of LineView objects for the given lines.\n function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array;\n }\n\n // Updates the display.view data structure for a given change to the\n // document. From and to are in pre-change coordinates. Lendiff is\n // the amount of lines added or subtracted by the change. This is\n // used for changes that span multiple lines, or change the way\n // lines are divided into visual lines. regLineChange (below)\n // registers single-line changes.\n function regChange(cm, from, to, lendiff) {\n if (from == null) from = cm.doc.first;\n if (to == null) to = cm.doc.first + cm.doc.size;\n if (!lendiff) lendiff = 0;\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n display.updateLineNumbers = from;\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n resetView(cm);\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut = viewCuttingPoint(cm, from, from, -1);\n if (cut) {\n display.view = display.view.slice(0, cut.index);\n display.viewTo = cut.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n ext.lineN += lendiff;\n else if (from < ext.lineN + ext.size)\n display.externalMeasured = null;\n }\n }\n\n // Register a change to a single line. Type must be one of \"text\",\n // \"gutter\", \"class\", \"widget\"\n function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n display.externalMeasured = null;\n\n if (line < display.viewFrom || line >= display.viewTo) return;\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) return;\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) arr.push(type);\n }\n\n // Clear the view.\n function resetView(cm) {\n cm.display.viewFrom = cm.display.viewTo = cm.doc.first;\n cm.display.view = [];\n cm.display.viewOffset = 0;\n }\n\n // Find the view element corresponding to a given line. Return null\n // when the line isn't visible.\n function findViewIndex(cm, n) {\n if (n >= cm.display.viewTo) return null;\n n -= cm.display.viewFrom;\n if (n < 0) return null;\n var view = cm.display.view;\n for (var i = 0; i < view.length; i++) {\n n -= view[i].size;\n if (n < 0) return i;\n }\n }\n\n function viewCuttingPoint(cm, oldN, newN, dir) {\n var index = findViewIndex(cm, oldN), diff, view = cm.display.view;\n if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)\n return {index: index, lineN: newN};\n for (var i = 0, n = cm.display.viewFrom; i < index; i++)\n n += view[i].size;\n if (n != oldN) {\n if (dir > 0) {\n if (index == view.length - 1) return null;\n diff = (n + view[index].size) - oldN;\n index++;\n } else {\n diff = n - oldN;\n }\n oldN += diff; newN += diff;\n }\n while (visualLineNo(cm.doc, newN) != newN) {\n if (index == (dir < 0 ? 0 : view.length - 1)) return null;\n newN += dir * view[index - (dir < 0 ? 1 : 0)].size;\n index += dir;\n }\n return {index: index, lineN: newN};\n }\n\n // Force the view to cover a given range, adding empty view element\n // or clipping off existing ones as needed.\n function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);\n else if (display.viewFrom < from)\n display.view = display.view.slice(findViewIndex(cm, from));\n display.viewFrom = from;\n if (display.viewTo < to)\n display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));\n else if (display.viewTo > to)\n display.view = display.view.slice(0, findViewIndex(cm, to));\n }\n display.viewTo = to;\n }\n\n // Count the number of lines in the view whose DOM representation is\n // out of date (or nonexistent).\n function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;\n }\n return dirty;\n }\n\n // EVENT HANDLERS\n\n // Attach the necessary event handlers when initializing the editor\n function registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n // Older IE's will not fire a second mousedown for a double click\n if (ie && ie_version < 11)\n on(d.scroller, \"dblclick\", operation(cm, function(e) {\n if (signalDOMEvent(cm, e)) return;\n var pos = posFromMouse(cm, e);\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;\n e_preventDefault(e);\n var word = cm.findWordAt(pos);\n extendSelection(cm.doc, word.anchor, word.head);\n }));\n else\n on(d.scroller, \"dblclick\", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });\n // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n if (!captureRightClick) on(d.scroller, \"contextmenu\", function(e) {onContextMenu(cm, e);});\n\n // Used to suppress mouse event handling when a touch happens\n var touchFinished, prevTouch = {end: 0};\n function finishTouch() {\n if (d.activeTouch) {\n touchFinished = setTimeout(function() {d.activeTouch = null;}, 1000);\n prevTouch = d.activeTouch;\n prevTouch.end = +new Date;\n }\n };\n function isMouseLikeTouchEvent(e) {\n if (e.touches.length != 1) return false;\n var touch = e.touches[0];\n return touch.radiusX <= 1 && touch.radiusY <= 1;\n }\n function farAway(touch, other) {\n if (other.left == null) return true;\n var dx = other.left - touch.left, dy = other.top - touch.top;\n return dx * dx + dy * dy > 20 * 20;\n }\n on(d.scroller, \"touchstart\", function(e) {\n if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) {\n clearTimeout(touchFinished);\n var now = +new Date;\n d.activeTouch = {start: now, moved: false,\n prev: now - prevTouch.end <= 300 ? prevTouch : null};\n if (e.touches.length == 1) {\n d.activeTouch.left = e.touches[0].pageX;\n d.activeTouch.top = e.touches[0].pageY;\n }\n }\n });\n on(d.scroller, \"touchmove\", function() {\n if (d.activeTouch) d.activeTouch.moved = true;\n });\n on(d.scroller, \"touchend\", function(e) {\n var touch = d.activeTouch;\n if (touch && !eventInWidget(d, e) && touch.left != null &&\n !touch.moved && new Date - touch.start < 300) {\n var pos = cm.coordsChar(d.activeTouch, \"page\"), range;\n if (!touch.prev || farAway(touch, touch.prev)) // Single tap\n range = new Range(pos, pos);\n else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap\n range = cm.findWordAt(pos);\n else // Triple tap\n range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0)));\n cm.setSelection(range.anchor, range.head);\n cm.focus();\n e_preventDefault(e);\n }\n finishTouch();\n });\n on(d.scroller, \"touchcancel\", finishTouch);\n\n // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n on(d.scroller, \"scroll\", function() {\n if (d.scroller.clientHeight) {\n setScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n });\n\n // Listen to wheel events in order to try and update the viewport on time.\n on(d.scroller, \"mousewheel\", function(e){onScrollWheel(cm, e);});\n on(d.scroller, \"DOMMouseScroll\", function(e){onScrollWheel(cm, e);});\n\n // Prevent wrapper from ever scrolling\n on(d.wrapper, \"scroll\", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\n\n d.dragFunctions = {\n enter: function(e) {if (!signalDOMEvent(cm, e)) e_stop(e);},\n over: function(e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},\n start: function(e){onDragStart(cm, e);},\n drop: operation(cm, onDrop),\n leave: function(e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}\n };\n\n var inp = d.input.getField();\n on(inp, \"keyup\", function(e) { onKeyUp.call(cm, e); });\n on(inp, \"keydown\", operation(cm, onKeyDown));\n on(inp, \"keypress\", operation(cm, onKeyPress));\n on(inp, \"focus\", bind(onFocus, cm));\n on(inp, \"blur\", bind(onBlur, cm));\n }\n\n function dragDropChanged(cm, value, old) {\n var wasOn = old && old != CodeMirror.Init;\n if (!value != !wasOn) {\n var funcs = cm.display.dragFunctions;\n var toggle = value ? on : off;\n toggle(cm.display.scroller, \"dragstart\", funcs.start);\n toggle(cm.display.scroller, \"dragenter\", funcs.enter);\n toggle(cm.display.scroller, \"dragover\", funcs.over);\n toggle(cm.display.scroller, \"dragleave\", funcs.leave);\n toggle(cm.display.scroller, \"drop\", funcs.drop);\n }\n }\n\n // Called when the window resizes\n function onResize(cm) {\n var d = cm.display;\n if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)\n return;\n // Might be a text scaling operation, clear size caches.\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n d.scrollbarsClipped = false;\n cm.setSize();\n }\n\n // MOUSE EVENTS\n\n // Return true when the given mouse event happened in a widget\n function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n return true;\n }\n }\n\n // Given a mouse event, find the corresponding position. If liberal\n // is false, it checks whether a gutter or scrollbar was clicked,\n // and returns null if it was. forRect is used by rectangular\n // selections, and tries to estimate a character position even for\n // coordinates beyond the right of the text.\n function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") return null;\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null; }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords;\n }\n\n // A mouse down can be a single click, double click, triple click,\n // start of selection drag, start of text drag, new cursor\n // (ctrl-click), rectangle drag (alt-drag), or xwin\n // middle-click-paste. Or it might be a click on something we should\n // not interfere with, such as a scrollbar or widget.\n function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return;\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function(){display.scroller.draggable = true;}, 100);\n }\n return;\n }\n if (clickInGutter(cm, e)) return;\n var start = posFromMouse(cm, e);\n window.focus();\n\n switch (e_button(e)) {\n case 1:\n // #3261: make sure, that we're not starting a second selection\n if (cm.state.selectingText)\n cm.state.selectingText(e);\n else if (start)\n leftButtonDown(cm, e, start);\n else if (e_target(e) == display.scroller)\n e_preventDefault(e);\n break;\n case 2:\n if (webkit) cm.state.lastMiddleDown = +new Date;\n if (start) extendSelection(cm.doc, start);\n setTimeout(function() {display.input.focus();}, 20);\n e_preventDefault(e);\n break;\n case 3:\n if (captureRightClick) onContextMenu(cm, e);\n else delayBlurEvent(cm);\n break;\n }\n }\n\n var lastClick, lastDoubleClick;\n function leftButtonDown(cm, e, start) {\n if (ie) setTimeout(bind(ensureFocus, cm), 0);\n else cm.curOp.focus = activeElt();\n\n var now = +new Date, type;\n if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {\n type = \"triple\";\n } else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {\n type = \"double\";\n lastDoubleClick = {time: now, pos: start};\n } else {\n type = \"single\";\n lastClick = {time: now, pos: start};\n }\n\n var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;\n if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&\n type == \"single\" && (contained = sel.contains(start)) > -1 &&\n (cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&\n (cmp(contained.to(), start) > 0 || start.xRel < 0))\n leftButtonStartDrag(cm, e, start, modifier);\n else\n leftButtonSelect(cm, e, start, type, modifier);\n }\n\n // Start a text drag. When it ends, see if any dragging actually\n // happen, and treat as a click if it didn't.\n function leftButtonStartDrag(cm, e, start, modifier) {\n var display = cm.display, startTime = +new Date;\n var dragEnd = operation(cm, function(e2) {\n if (webkit) display.scroller.draggable = false;\n cm.state.draggingText = false;\n off(document, \"mouseup\", dragEnd);\n off(display.scroller, \"drop\", dragEnd);\n if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {\n e_preventDefault(e2);\n if (!modifier && +new Date - 200 < startTime)\n extendSelection(cm.doc, start);\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if (webkit || ie && ie_version == 9)\n setTimeout(function() {document.body.focus(); display.input.focus();}, 20);\n else\n display.input.focus();\n }\n });\n // Let the drag handler handle this.\n if (webkit) display.scroller.draggable = true;\n cm.state.draggingText = dragEnd;\n dragEnd.copy = mac ? e.altKey : e.ctrlKey\n // IE's approach to draggable\n if (display.scroller.dragDrop) display.scroller.dragDrop();\n on(document, \"mouseup\", dragEnd);\n on(display.scroller, \"drop\", dragEnd);\n }\n\n // Normal selection, as opposed to text dragging.\n function leftButtonSelect(cm, e, start, type, addNew) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(e);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (addNew && !e.shiftKey) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n ourRange = ranges[ourIndex];\n else\n ourRange = new Range(start, start);\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {\n type = \"rect\";\n if (!addNew) ourRange = new Range(start, start);\n start = posFromMouse(cm, e, true, true);\n ourIndex = -1;\n } else if (type == \"double\") {\n var word = cm.findWordAt(start);\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, word.anchor, word.head);\n else\n ourRange = word;\n } else if (type == \"triple\") {\n var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));\n if (cm.display.shift || doc.extend)\n ourRange = extendRange(doc, ourRange, line.anchor, line.head);\n else\n ourRange = line;\n } else {\n ourRange = extendRange(doc, ourRange, start);\n }\n\n if (!addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && type == \"single\" && !e.shiftKey) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) return;\n lastPos = pos;\n\n if (type == \"rect\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n else if (text.length > leftPos)\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n if (!ranges.length) ranges.push(new Range(start, start));\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var anchor = oldRange.anchor, head = pos;\n if (type != \"single\") {\n if (type == \"double\")\n var range = cm.findWordAt(pos);\n else\n var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n }\n var ranges = startSel.ranges.slice(0);\n ranges[ourIndex] = new Range(clipPos(doc, anchor), head);\n setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, type == \"rect\");\n if (!cur) return;\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) setTimeout(operation(cm, function() {\n if (counter != curCount) return;\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (!e_button(e)) done(e);\n else extend(e);\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n }\n\n // Determines whether an event happened in the gutter, and fires the\n // handlers for the corresponding event.\n function gutterEvent(cm, e, type, prevent) {\n try { var mX = e.clientX, mY = e.clientY; }\n catch(e) { return false; }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;\n if (prevent) e_preventDefault(e);\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e);\n }\n }\n }\n\n function clickInGutter(cm, e) {\n return gutterEvent(cm, e, \"gutterClick\", true);\n }\n\n // Kludge to work around strange IE behavior where it'll sometimes\n // re-fire a series of drag-related events right after the drop (#1551)\n var lastDrop = 0;\n\n function onDrop(e) {\n var cm = this;\n clearDragCursor(cm);\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))\n return;\n e_preventDefault(e);\n if (ie) lastDrop = +new Date;\n var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;\n if (!pos || cm.isReadOnly()) return;\n // Might be a file drop, in which case we simply extract the text\n // and insert it.\n if (files && files.length && window.FileReader && window.File) {\n var n = files.length, text = Array(n), read = 0;\n var loadFile = function(file, i) {\n if (cm.options.allowDropFileTypes &&\n indexOf(cm.options.allowDropFileTypes, file.type) == -1)\n return;\n\n var reader = new FileReader;\n reader.onload = operation(cm, function() {\n var content = reader.result;\n if (/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(content)) content = \"\";\n text[i] = content;\n if (++read == n) {\n pos = clipPos(cm.doc, pos);\n var change = {from: pos, to: pos,\n text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),\n origin: \"paste\"};\n makeChange(cm.doc, change);\n setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));\n }\n });\n reader.readAsText(file);\n };\n for (var i = 0; i < n; ++i) loadFile(files[i], i);\n } else { // Normal drop\n // Don't do a replace if the drop happened inside of the selected text.\n if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {\n cm.state.draggingText(e);\n // Ensure the editor is re-focused\n setTimeout(function() {cm.display.input.focus();}, 20);\n return;\n }\n try {\n var text = e.dataTransfer.getData(\"Text\");\n if (text) {\n if (cm.state.draggingText && !cm.state.draggingText.copy)\n var selected = cm.listSelections();\n setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));\n if (selected) for (var i = 0; i < selected.length; ++i)\n replaceRange(cm.doc, \"\", selected[i].anchor, selected[i].head, \"drag\");\n cm.replaceSelection(text, \"around\", \"paste\");\n cm.display.input.focus();\n }\n }\n catch(e){}\n }\n }\n\n function onDragStart(cm, e) {\n if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return; }\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return;\n\n e.dataTransfer.setData(\"Text\", cm.getSelection());\n e.dataTransfer.effectAllowed = \"copyMove\"\n\n // Use dummy image instead of default browsers image.\n // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.\n if (e.dataTransfer.setDragImage && !safari) {\n var img = elt(\"img\", null, null, \"position: fixed; left: 0; top: 0;\");\n img.src = \"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\";\n if (presto) {\n img.width = img.height = 1;\n cm.display.wrapper.appendChild(img);\n // Force a relayout, or Opera won't use our image for some obscure reason\n img._top = img.offsetTop;\n }\n e.dataTransfer.setDragImage(img, 0, 0);\n if (presto) img.parentNode.removeChild(img);\n }\n }\n\n function onDragOver(cm, e) {\n var pos = posFromMouse(cm, e);\n if (!pos) return;\n var frag = document.createDocumentFragment();\n drawSelectionCursor(cm, pos, frag);\n if (!cm.display.dragCursor) {\n cm.display.dragCursor = elt(\"div\", null, \"CodeMirror-cursors CodeMirror-dragcursors\");\n cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);\n }\n removeChildrenAndAdd(cm.display.dragCursor, frag);\n }\n\n function clearDragCursor(cm) {\n if (cm.display.dragCursor) {\n cm.display.lineSpace.removeChild(cm.display.dragCursor);\n cm.display.dragCursor = null;\n }\n }\n\n // SCROLL EVENTS\n\n // Sync the scrollable area and scrollbars, ensure the viewport\n // covers the visible area.\n function setScrollTop(cm, val) {\n if (Math.abs(cm.doc.scrollTop - val) < 2) return;\n cm.doc.scrollTop = val;\n if (!gecko) updateDisplaySimple(cm, {top: val});\n if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val;\n cm.display.scrollbars.setScrollTop(val);\n if (gecko) updateDisplaySimple(cm);\n startWorker(cm, 100);\n }\n // Sync scroller and scrollbar, ensure the gutter elements are\n // aligned.\n function setScrollLeft(cm, val, isScroller) {\n if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) return;\n val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);\n cm.doc.scrollLeft = val;\n alignHorizontally(cm);\n if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val;\n cm.display.scrollbars.setScrollLeft(val);\n }\n\n // Since the delta values reported on mouse wheel events are\n // unstandardized between browsers and even browser versions, and\n // generally horribly unpredictable, this code starts by measuring\n // the scroll effect that the first few mouse wheel events have,\n // and, from that, detects the way it can convert deltas to pixel\n // offsets afterwards.\n //\n // The reason we want to know the amount a wheel event will scroll\n // is that it gives us a chance to update the display before the\n // actual scrolling happens, reducing flickering.\n\n var wheelSamples = 0, wheelPixelsPerUnit = null;\n // Fill in a browser-detected starting value on browsers where we\n // know one. These don't have to be accurate -- the result of them\n // being wrong would just be a slight flicker on the first wheel\n // scroll (if it is large enough).\n if (ie) wheelPixelsPerUnit = -.53;\n else if (gecko) wheelPixelsPerUnit = 15;\n else if (chrome) wheelPixelsPerUnit = -.7;\n else if (safari) wheelPixelsPerUnit = -1/3;\n\n var wheelEventDelta = function(e) {\n var dx = e.wheelDeltaX, dy = e.wheelDeltaY;\n if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail;\n if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail;\n else if (dy == null) dy = e.wheelDelta;\n return {x: dx, y: dy};\n };\n CodeMirror.wheelEventPixels = function(e) {\n var delta = wheelEventDelta(e);\n delta.x *= wheelPixelsPerUnit;\n delta.y *= wheelPixelsPerUnit;\n return delta;\n };\n\n function onScrollWheel(cm, e) {\n var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;\n\n var display = cm.display, scroll = display.scroller;\n // Quit if there's nothing to scroll here\n var canScrollX = scroll.scrollWidth > scroll.clientWidth;\n var canScrollY = scroll.scrollHeight > scroll.clientHeight;\n if (!(dx && canScrollX || dy && canScrollY)) return;\n\n // Webkit browsers on OS X abort momentum scrolls when the target\n // of the scroll event is removed from the scrollable element.\n // This hack (see related code in patchDisplay) makes sure the\n // element is kept around.\n if (dy && mac && webkit) {\n outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {\n for (var i = 0; i < view.length; i++) {\n if (view[i].node == cur) {\n cm.display.currentWheelTarget = cur;\n break outer;\n }\n }\n }\n }\n\n // On some browsers, horizontal scrolling will cause redraws to\n // happen before the gutter has been realigned, causing it to\n // wriggle around in a most unseemly way. When we have an\n // estimated pixels/delta value, we just handle horizontal\n // scrolling entirely here. It'll be slightly off from native, but\n // better than glitching out.\n if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {\n if (dy && canScrollY)\n setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight)));\n setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));\n // Only prevent default scrolling if vertical scrolling is\n // actually possible. Otherwise, it causes vertical scroll\n // jitter on OSX trackpads when deltaX is small and deltaY\n // is large (issue #3579)\n if (!dy || (dy && canScrollY))\n e_preventDefault(e);\n display.wheelStartX = null; // Abort measurement, if in progress\n return;\n }\n\n // 'Project' the visible viewport to cover the area that is being\n // scrolled into view (if we know enough to estimate it).\n if (dy && wheelPixelsPerUnit != null) {\n var pixels = dy * wheelPixelsPerUnit;\n var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;\n if (pixels < 0) top = Math.max(0, top + pixels - 50);\n else bot = Math.min(cm.doc.height, bot + pixels + 50);\n updateDisplaySimple(cm, {top: top, bottom: bot});\n }\n\n if (wheelSamples < 20) {\n if (display.wheelStartX == null) {\n display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;\n display.wheelDX = dx; display.wheelDY = dy;\n setTimeout(function() {\n if (display.wheelStartX == null) return;\n var movedX = scroll.scrollLeft - display.wheelStartX;\n var movedY = scroll.scrollTop - display.wheelStartY;\n var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||\n (movedX && display.wheelDX && movedX / display.wheelDX);\n display.wheelStartX = display.wheelStartY = null;\n if (!sample) return;\n wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);\n ++wheelSamples;\n }, 200);\n } else {\n display.wheelDX += dx; display.wheelDY += dy;\n }\n }\n }\n\n // KEY EVENTS\n\n // Run a handler that was bound to a key.\n function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) return false;\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) cm.state.suppressEdits = true;\n if (dropShift) cm.display.shift = false;\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done;\n }\n\n function lookupKeyForEditor(cm, name, handle) {\n for (var i = 0; i < cm.state.keyMaps.length; i++) {\n var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);\n if (result) return result;\n }\n return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))\n || lookupKey(name, cm.options.keyMap, handle, cm);\n }\n\n var stopSeq = new Delayed;\n function dispatchKey(cm, name, e, handle) {\n var seq = cm.state.keySeq;\n if (seq) {\n if (isModifierKey(name)) return \"handled\";\n stopSeq.set(50, function() {\n if (cm.state.keySeq == seq) {\n cm.state.keySeq = null;\n cm.display.input.reset();\n }\n });\n name = seq + \" \" + name;\n }\n var result = lookupKeyForEditor(cm, name, handle);\n\n if (result == \"multi\")\n cm.state.keySeq = name;\n if (result == \"handled\")\n signalLater(cm, \"keyHandled\", cm, name, e);\n\n if (result == \"handled\" || result == \"multi\") {\n e_preventDefault(e);\n restartBlink(cm);\n }\n\n if (seq && !result && /\\'$/.test(name)) {\n e_preventDefault(e);\n return true;\n }\n return !!result;\n }\n\n // Handle a key from the keydown event.\n function handleKeyBinding(cm, e) {\n var name = keyName(e, true);\n if (!name) return false;\n\n if (e.shiftKey && !cm.state.keySeq) {\n // First try to resolve full name (including 'Shift-'). Failing\n // that, see if there is a cursor-motion command (starting with\n // 'go') bound to the keyname without 'Shift-'.\n return dispatchKey(cm, \"Shift-\" + name, e, function(b) {return doHandleBinding(cm, b, true);})\n || dispatchKey(cm, name, e, function(b) {\n if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion)\n return doHandleBinding(cm, b);\n });\n } else {\n return dispatchKey(cm, name, e, function(b) { return doHandleBinding(cm, b); });\n }\n }\n\n // Handle a key from the keypress event\n function handleCharBinding(cm, e, ch) {\n return dispatchKey(cm, \"'\" + ch + \"'\", e,\n function(b) { return doHandleBinding(cm, b, true); });\n }\n\n var lastStoppedKey = null;\n function onKeyDown(e) {\n var cm = this;\n cm.curOp.focus = activeElt();\n if (signalDOMEvent(cm, e)) return;\n // IE does strange things with escape.\n if (ie && ie_version < 11 && e.keyCode == 27) e.returnValue = false;\n var code = e.keyCode;\n cm.display.shift = code == 16 || e.shiftKey;\n var handled = handleKeyBinding(cm, e);\n if (presto) {\n lastStoppedKey = handled ? code : null;\n // Opera has no cut event... we try to at least catch the key combo\n if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))\n cm.replaceSelection(\"\", null, \"cut\");\n }\n\n // Turn mouse into crosshair when Alt is held on Mac.\n if (code == 18 && !/\\bCodeMirror-crosshair\\b/.test(cm.display.lineDiv.className))\n showCrossHair(cm);\n }\n\n function showCrossHair(cm) {\n var lineDiv = cm.display.lineDiv;\n addClass(lineDiv, \"CodeMirror-crosshair\");\n\n function up(e) {\n if (e.keyCode == 18 || !e.altKey) {\n rmClass(lineDiv, \"CodeMirror-crosshair\");\n off(document, \"keyup\", up);\n off(document, \"mouseover\", up);\n }\n }\n on(document, \"keyup\", up);\n on(document, \"mouseover\", up);\n }\n\n function onKeyUp(e) {\n if (e.keyCode == 16) this.doc.sel.shift = false;\n signalDOMEvent(this, e);\n }\n\n function onKeyPress(e) {\n var cm = this;\n if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) return;\n var keyCode = e.keyCode, charCode = e.charCode;\n if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}\n if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) return;\n var ch = String.fromCharCode(charCode == null ? keyCode : charCode);\n if (handleCharBinding(cm, e, ch)) return;\n cm.display.input.onKeyPress(e);\n }\n\n // FOCUS/BLUR EVENTS\n\n function delayBlurEvent(cm) {\n cm.state.delayingBlurEvent = true;\n setTimeout(function() {\n if (cm.state.delayingBlurEvent) {\n cm.state.delayingBlurEvent = false;\n onBlur(cm);\n }\n }, 100);\n }\n\n function onFocus(cm) {\n if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false;\n\n if (cm.options.readOnly == \"nocursor\") return;\n if (!cm.state.focused) {\n signal(cm, \"focus\", cm);\n cm.state.focused = true;\n addClass(cm.display.wrapper, \"CodeMirror-focused\");\n // This test prevents this from firing when a context\n // menu is closed (since the input reset would kill the\n // select-all detection hack)\n if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {\n cm.display.input.reset();\n if (webkit) setTimeout(function() { cm.display.input.reset(true); }, 20); // Issue #1730\n }\n cm.display.input.receivedFocus();\n }\n restartBlink(cm);\n }\n function onBlur(cm) {\n if (cm.state.delayingBlurEvent) return;\n\n if (cm.state.focused) {\n signal(cm, \"blur\", cm);\n cm.state.focused = false;\n rmClass(cm.display.wrapper, \"CodeMirror-focused\");\n }\n clearInterval(cm.display.blinker);\n setTimeout(function() {if (!cm.state.focused) cm.display.shift = false;}, 150);\n }\n\n // CONTEXT MENU HANDLING\n\n // To make the context menu work, we need to briefly unhide the\n // textarea (making it as unobtrusive as possible) to let the\n // right-click take effect on it.\n function onContextMenu(cm, e) {\n if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) return;\n if (signalDOMEvent(cm, e, \"contextmenu\")) return;\n cm.display.input.onContextMenu(e);\n }\n\n function contextMenuInGutter(cm, e) {\n if (!hasHandler(cm, \"gutterContextMenu\")) return false;\n return gutterEvent(cm, e, \"gutterContextMenu\", false);\n }\n\n // UPDATING\n\n // Compute the position of the end of a change (its 'to' property\n // refers to the pre-change end).\n var changeEnd = CodeMirror.changeEnd = function(change) {\n if (!change.text) return change.to;\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0));\n };\n\n // Adjust a position to refer to the post-change position of the\n // same text, or the end of the change if the change covers it.\n function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) return pos;\n if (cmp(pos, change.to) <= 0) return changeEnd(change);\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;\n return Pos(line, ch);\n }\n\n function computeSelAfterChange(doc, change) {\n var out = [];\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n out.push(new Range(adjustForChange(range.anchor, change),\n adjustForChange(range.head, change)));\n }\n return normalizeSelection(out, doc.sel.primIndex);\n }\n\n function offsetPos(pos, old, nw) {\n if (pos.line == old.line)\n return Pos(nw.line, pos.ch - old.ch + nw.ch);\n else\n return Pos(nw.line + (pos.line - old.line), pos.ch);\n }\n\n // Used by replaceSelections to allow moving the selection to the\n // start or around the replaced test. Hint may be \"start\" or \"around\".\n function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex);\n }\n\n // Allow \"beforeChange\" event handlers to influence a change\n function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() { this.canceled = true; }\n };\n if (update) obj.update = function(from, to, text, origin) {\n if (from) this.from = clipPos(doc, from);\n if (to) this.to = clipPos(doc, to);\n if (text) this.text = text;\n if (origin !== undefined) this.origin = origin;\n };\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) signal(doc.cm, \"beforeChange\", doc.cm, obj);\n\n if (obj.canceled) return null;\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};\n }\n\n // Apply a change to a document, and add it to the document's\n // history, and propagating it to all linked documents.\n function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);\n if (doc.cm.state.suppressEdits) return;\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) return;\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text});\n } else {\n makeChangeInner(doc, change);\n }\n }\n\n function makeChangeInner(doc, change) {\n if (change.text.length == 1 && change.text[0] == \"\" && cmp(change.from, change.to) == 0) return;\n var selAfter = computeSelAfterChange(doc, change);\n addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);\n\n makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));\n var rebased = [];\n\n linkedDocs(doc, function(doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));\n });\n }\n\n // Revert a change stored in a document's history.\n function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) return;\n\n var hist = doc.history, event, selAfter = doc.sel;\n var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\n\n // Verify that there is a useable event (so that ctrl-z won't\n // needlessly clear selection events)\n for (var i = 0; i < source.length; i++) {\n event = source[i];\n if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n break;\n }\n if (i == source.length) return;\n hist.lastOrigin = hist.lastSelOrigin = null;\n\n for (;;) {\n event = source.pop();\n if (event.ranges) {\n pushSelectionToHistory(event, dest);\n if (allowSelectionOnly && !event.equals(doc.sel)) {\n setSelection(doc, event, {clearRedo: false});\n return;\n }\n selAfter = event;\n }\n else break;\n }\n\n // Build up a reverse change object to add to the opposite history\n // stack (redo when undoing, and vice versa).\n var antiChanges = [];\n pushSelectionToHistory(selAfter, dest);\n dest.push({changes: antiChanges, generation: hist.generation});\n hist.generation = event.generation || ++hist.maxGeneration;\n\n var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\n for (var i = event.changes.length - 1; i >= 0; --i) {\n var change = event.changes[i];\n change.origin = type;\n if (filter && !filterChange(doc, change, false)) {\n source.length = 0;\n return;\n }\n\n antiChanges.push(historyChangeFromChange(doc, change));\n\n var after = i ? computeSelAfterChange(doc, change) : lst(source);\n makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n if (!i && doc.cm) doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)});\n var rebased = [];\n\n // Propagate to the linked documents\n linkedDocs(doc, function(doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n });\n }\n }\n\n // Sub-views need their line numbers shifted when text is added\n // above or below them in the parent document.\n function shiftDoc(doc, distance) {\n if (distance == 0) return;\n doc.first += distance;\n doc.sel = new Selection(map(doc.sel.ranges, function(range) {\n return new Range(Pos(range.anchor.line + distance, range.anchor.ch),\n Pos(range.head.line + distance, range.head.ch));\n }), doc.sel.primIndex);\n if (doc.cm) {\n regChange(doc.cm, doc.first, doc.first - distance, distance);\n for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)\n regLineChange(doc.cm, l, \"gutter\");\n }\n }\n\n // More lower-level change function, handling only a single document\n // (not linked ones).\n function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return;\n }\n if (change.from.line > doc.lastLine()) return;\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) selAfter = computeSelAfterChange(doc, change);\n if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);\n else updateDoc(doc, change, spans);\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n }\n\n // Handle the interaction of a change to a document with the editor\n // that this document is part of.\n function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function(line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true;\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n signalCursorActivity(cm);\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) cm.curOp.updateMaxLine = true;\n }\n\n // Adjust frontier, schedule worker\n doc.frontier = Math.min(doc.frontier, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n regChange(cm);\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n regLineChange(cm, from.line, \"text\");\n else\n regChange(cm, from.line, to.line + 1, lendiff);\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) signalLater(cm, \"change\", cm, obj);\n if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n }\n cm.display.selForContextMenu = null;\n }\n\n function replaceRange(doc, code, from, to, origin) {\n if (!to) to = from;\n if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; }\n if (typeof code == \"string\") code = doc.splitLines(code);\n makeChange(doc, {from: from, to: to, text: code, origin: origin});\n }\n\n // SCROLLING THINGS INTO VIEW\n\n // If an editor sits on the top or bottom of the window, partially\n // scrolled out of view, this ensures that the cursor is visible.\n function maybeScrollWindow(cm, coords) {\n if (signalDOMEvent(cm, \"scrollCursorIntoView\")) return;\n\n var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;\n if (coords.top + box.top < 0) doScroll = true;\n else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false;\n if (doScroll != null && !phantom) {\n var scrollNode = elt(\"div\", \"\\u200b\", null, \"position: absolute; top: \" +\n (coords.top - display.viewOffset - paddingTop(cm.display)) + \"px; height: \" +\n (coords.bottom - coords.top + scrollGap(cm) + display.barHeight) + \"px; left: \" +\n coords.left + \"px; width: 2px;\");\n cm.display.lineSpace.appendChild(scrollNode);\n scrollNode.scrollIntoView(doScroll);\n cm.display.lineSpace.removeChild(scrollNode);\n }\n }\n\n // Scroll a given position into view (immediately), verifying that\n // it actually became visible (as line heights are accurately\n // measured, the position of something may 'drift' during drawing).\n function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) margin = 0;\n for (var limit = 0; limit < 5; limit++) {\n var changed = false, coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),\n Math.min(coords.top, endCoords.top) - margin,\n Math.max(coords.left, endCoords.left),\n Math.max(coords.bottom, endCoords.bottom) + margin);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n setScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;\n }\n if (!changed) break;\n }\n return coords;\n }\n\n // Scroll a given set of coordinates into view (immediately).\n function scrollIntoView(cm, x1, y1, x2, y2) {\n var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);\n if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);\n if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);\n }\n\n // Calculate a new scroll position needed to scroll the given\n // rectangle into view. Returns an object with scrollTop and\n // scrollLeft properties. When these are undefined, the\n // vertical/horizontal position does not need to be adjusted.\n function calculateScrollPos(cm, x1, y1, x2, y2) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (y1 < 0) y1 = 0;\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (y2 - y1 > screen) y2 = y1 + screen;\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;\n if (y1 < screentop) {\n result.scrollTop = atTop ? 0 : y1;\n } else if (y2 > screentop + screen) {\n var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);\n if (newTop != screentop) result.scrollTop = newTop;\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = x2 - x1 > screenw;\n if (tooWide) x2 = x1 + screenw;\n if (x1 < 10)\n result.scrollLeft = 0;\n else if (x1 < screenleft)\n result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));\n else if (x2 > screenw + screenleft - 3)\n result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;\n return result;\n }\n\n // Store a relative adjustment to the scroll position in the current\n // operation (to be applied when the operation finishes).\n function addToScrollPos(cm, left, top) {\n if (left != null || top != null) resolveScrollToPos(cm);\n if (left != null)\n cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;\n if (top != null)\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }\n\n // Make sure that at the end of the operation the current cursor is\n // shown.\n function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor(), from = cur, to = cur;\n if (!cm.options.lineWrapping) {\n from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;\n to = Pos(cur.line, cur.ch + 1);\n }\n cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};\n }\n\n // When an operation has its scrollToPos property set, and another\n // scroll action is applied before the end of the operation, this\n // 'simulates' scrolling that position into view in a cheap way, so\n // that the effect of intermediate scroll commands is not ignored.\n function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),\n Math.min(from.top, to.top) - range.margin,\n Math.max(from.right, to.right),\n Math.max(from.bottom, to.bottom) + range.margin);\n cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n }\n }\n\n // API UTILITIES\n\n // Indent the given line. The how parameter can be \"smart\",\n // \"add\"/null, \"subtract\", or \"prev\". When aggressive is false\n // (typically set to true for forced single-line indents), empty\n // lines are not indented, and places where the mode returns Pass\n // are left alone.\n function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) how = \"add\";\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) how = \"prev\";\n else state = getStateBefore(cm, n);\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) line.stateAfter = null;\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) return;\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);\n else indentation = 0;\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";}\n if (pos < indentation) indentString += spaceStr(indentation - pos);\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true;\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i, new Range(pos, pos));\n break;\n }\n }\n }\n }\n\n // Utility for applying a change to a line by handle or number,\n // returning the number and optionally registering the line as\n // changed.\n function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") line = getLine(doc, clipLine(doc, handle));\n else no = lineNo(handle);\n if (no == null) return null;\n if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);\n return line;\n }\n\n // Helper for deleting text near the selection(s), used to implement\n // backspace, delete, and similar functionality.\n function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break;\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function() {\n for (var i = kill.length - 1; i >= 0; i--)\n replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\");\n ensureCursorVisible(cm);\n });\n }\n\n // Used for horizontal relative motion. Dir is -1 or 1 (left or\n // right), unit can be \"char\", \"column\" (like char, but doesn't\n // cross line boundaries), \"word\" (across next word), or \"group\" (to\n // the start of next group of word or non-word-non-whitespace\n // chars). The visually param controls whether, in right-to-left\n // text, direction 1 means to move towards the next index in the\n // string, or towards the character to the right of the current\n // position. The resulting position will have a hitSide=true\n // property if it reached the end of the document.\n function findPosH(doc, pos, dir, unit, visually) {\n var line = pos.line, ch = pos.ch, origDir = dir;\n var lineObj = getLine(doc, line);\n function findNextLine() {\n var l = line + dir;\n if (l < doc.first || l >= doc.first + doc.size) return false\n line = l;\n return lineObj = getLine(doc, l);\n }\n function moveOnce(boundToLine) {\n var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);\n else ch = dir < 0 ? lineObj.text.length : 0;\n } else return false\n } else ch = next;\n return true;\n }\n\n if (unit == \"char\") {\n moveOnce()\n } else if (unit == \"column\") {\n moveOnce(true)\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) break;\n var cur = lineObj.text.charAt(ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) type = \"s\";\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce();}\n break;\n }\n\n if (type) sawType = type;\n if (dir > 0 && !moveOnce(!first)) break;\n }\n }\n var result = skipAtomic(doc, Pos(line, ch), pos, origDir, true);\n if (!cmp(pos, result)) result.hitSide = true;\n return result;\n }\n\n // For relative vertical movement. Dir may be -1 or 1. Unit can be\n // \"page\" or \"line\". The resulting position will have a hitSide=true\n // property if it reached the end of the document.\n function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n for (;;) {\n var target = coordsChar(cm, x, y);\n if (!target.outside) break;\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }\n y += dir * 5;\n }\n return target;\n }\n\n // EDITOR METHODS\n\n // The publicly visible API. Note that methodOp(f) means\n // 'wrap f in an operation, performed on its `this` parameter'.\n\n // This is not the complete set of editor methods. Most of the\n // methods defined on the Doc type are also injected into\n // CodeMirror.prototype, for backwards compatibility and\n // convenience.\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") return;\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n operation(this, optionHandlers[option])(this, value, old);\n },\n\n getOption: function(option) {return this.options[option];},\n getDoc: function() {return this.doc;},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true;\n }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) throw new Error(\"Overlays may not be stateful.\");\n this.state.overlays.push({mode: mode, modeSpec: spec, opaque: options && options.opaque});\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return;\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) dir = this.options.smartIndent ? \"smart\" : \"prev\";\n else dir = dir ? \"add\" : \"subtract\";\n }\n if (isLine(this.doc, n)) indentLine(this, n, dir, aggressive);\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n indentLine(this, j, how);\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll);\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) ensureCursorVisible(this);\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise);\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true);\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) type = styles[2];\n else for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) after = mid;\n else if (styles[mid * 2 + 1] < ch) before = mid + 1;\n else { type = styles[mid * 2 + 2]; break; }\n }\n var cut = type ? type.indexOf(\"cm-overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1);\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) return mode;\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode;\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0];\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) return found;\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) found.push(help[mode[type]]);\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) found.push(val);\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i = 0; i < help._global.length; i++) {\n var cur = help._global[i];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n found.push(cur.val);\n }\n return found;\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getStateBefore(this, line + 1, precise);\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) pos = range.head;\n else if (typeof start == \"object\") pos = clipPos(this.doc, start);\n else pos = start ? range.from() : range.to();\n return cursorCoords(this, pos, mode || \"page\");\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\");\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top);\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset);\n },\n heightAtLine: function(line, mode) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) line = this.doc.first;\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\").top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0);\n },\n\n defaultTextHeight: function() { return textHeight(this.display); },\n defaultCharWidth: function() { return charWidth(this.display); },\n\n setGutterMarker: methodOp(function(line, gutterID, value) {\n return changeLine(this.doc, line, \"gutter\", function(line) {\n var markers = line.gutterMarkers || (line.gutterMarkers = {});\n markers[gutterID] = value;\n if (!value && isEmpty(markers)) line.gutterMarkers = null;\n return true;\n });\n }),\n\n clearGutter: methodOp(function(gutterID) {\n var cm = this, doc = cm.doc, i = doc.first;\n doc.iter(function(line) {\n if (line.gutterMarkers && line.gutterMarkers[gutterID]) {\n line.gutterMarkers[gutterID] = null;\n regLineChange(cm, i, \"gutter\");\n if (isEmpty(line.gutterMarkers)) line.gutterMarkers = null;\n }\n ++i;\n });\n }),\n\n lineInfo: function(line) {\n if (typeof line == \"number\") {\n if (!isLine(this.doc, line)) return null;\n var n = line;\n line = getLine(this.doc, line);\n if (!line) return null;\n } else {\n var n = lineNo(line);\n if (n == null) return null;\n }\n return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,\n textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,\n widgets: line.widgets};\n },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo};},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n top = pos.top - node.offsetHeight;\n else if (pos.bottom + node.offsetHeight <= vspace)\n top = pos.bottom;\n if (left + node.offsetWidth > hspace)\n left = hspace - node.offsetWidth;\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") left = 0;\n else if (horiz == \"middle\") left = (display.sizer.clientWidth - node.offsetWidth) / 2;\n node.style.left = left + \"px\";\n }\n if (scroll)\n scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight);\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n return commands[cmd].call(null, this);\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) break;\n }\n return cur;\n },\n\n moveH: methodOp(function(dir, unit) {\n var cm = this;\n cm.extendSelectionsBy(function(range) {\n if (cm.display.shift || cm.doc.extend || range.empty())\n return findPosH(cm.doc, range.head, dir, unit, cm.options.rtlMoveVisually);\n else\n return dir < 0 ? range.from() : range.to();\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n doc.replaceSelection(\"\", null, \"+delete\");\n else\n deleteNearSelection(this, function(range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other};\n });\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) x = coords.left;\n else coords.left = x;\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) break;\n }\n return cur;\n },\n\n moveV: methodOp(function(dir, unit) {\n var cm = this, doc = this.doc, goals = [];\n var collapse = !cm.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function(range) {\n if (collapse)\n return dir < 0 ? range.from() : range.to();\n var headPos = cursorCoords(cm, range.head, \"div\");\n if (range.goalColumn != null) headPos.left = range.goalColumn;\n goals.push(headPos.left);\n var pos = findPosV(cm, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n addToScrollPos(cm, null, charCoords(cm, pos, \"div\").top - headPos.top);\n return pos;\n }, sel_move);\n if (goals.length) for (var i = 0; i < doc.sel.ranges.length; i++)\n doc.sel.ranges[i].goalColumn = goals[i];\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end;\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function(ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function(ch) {return /\\s/.test(ch);}\n : function(ch) {return !/\\s/.test(ch) && !isWordChar(ch);};\n while (start > 0 && check(line.charAt(start - 1))) --start;\n while (end < line.length && check(line.charAt(end))) ++end;\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end));\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) return;\n if (this.state.overwrite = !this.state.overwrite)\n addClass(this.display.cursorDiv, \"CodeMirror-overwrite\");\n else\n rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\");\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt(); },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit); },\n\n scrollTo: methodOp(function(x, y) {\n if (x != null || y != null) resolveScrollToPos(this);\n if (x != null) this.curOp.scrollLeft = x;\n if (y != null) this.curOp.scrollTop = y;\n }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)};\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) margin = this.options.cursorScrollMargin;\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) range.to = range.from;\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n resolveScrollToPos(this);\n this.curOp.scrollToPos = range;\n } else {\n var sPos = calculateScrollPos(this, Math.min(range.from.left, range.to.left),\n Math.min(range.from.top, range.to.top) - range.margin,\n Math.max(range.from.right, range.to.right),\n Math.max(range.from.bottom, range.to.bottom) + range.margin);\n this.scrollTo(sPos.scrollLeft, sPos.scrollTop);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var cm = this;\n function interpret(val) {\n return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val;\n }\n if (width != null) cm.display.wrapper.style.width = interpret(width);\n if (height != null) cm.display.wrapper.style.height = interpret(height);\n if (cm.options.lineWrapping) clearLineMeasurementCache(this);\n var lineNo = cm.display.viewFrom;\n cm.doc.iter(lineNo, cm.display.viewTo, function(line) {\n if (line.widgets) for (var i = 0; i < line.widgets.length; i++)\n if (line.widgets[i].noHScroll) { regLineChange(cm, lineNo, \"widget\"); break; }\n ++lineNo;\n });\n cm.curOp.forceUpdate = true;\n signal(cm, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f);},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n estimateLineHeights(this);\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n this.scrollTo(doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old;\n }),\n\n getInputField: function(){return this.display.input.getField();},\n getWrapperElement: function(){return this.display.wrapper;},\n getScrollerElement: function(){return this.display.scroller;},\n getGutterElement: function(){return this.display.gutters;}\n };\n eventMixin(CodeMirror);\n\n // OPTION DEFAULTS\n\n // The default configuration options.\n var defaults = CodeMirror.defaults = {};\n // Functions to run when options are changed.\n var optionHandlers = CodeMirror.optionHandlers = {};\n\n function option(name, deflt, handle, notOnInit) {\n CodeMirror.defaults[name] = deflt;\n if (handle) optionHandlers[name] =\n notOnInit ? function(cm, val, old) {if (old != Init) handle(cm, val, old);} : handle;\n }\n\n // Passed to option handlers when there is no old value.\n var Init = CodeMirror.Init = {toString: function(){return \"CodeMirror.Init\";}};\n\n // These two are, on init, called from the constructor because they\n // have to be initialized before the editor can start at all.\n option(\"value\", \"\", function(cm, val) {\n cm.setValue(val);\n }, true);\n option(\"mode\", null, function(cm, val) {\n cm.doc.modeOption = val;\n loadMode(cm);\n }, true);\n\n option(\"indentUnit\", 2, loadMode, true);\n option(\"indentWithTabs\", false);\n option(\"smartIndent\", true);\n option(\"tabSize\", 4, function(cm) {\n resetModeState(cm);\n clearCaches(cm);\n regChange(cm);\n }, true);\n option(\"lineSeparator\", null, function(cm, val) {\n cm.doc.lineSep = val;\n if (!val) return;\n var newBreaks = [], lineNo = cm.doc.first;\n cm.doc.iter(function(line) {\n for (var pos = 0;;) {\n var found = line.text.indexOf(val, pos);\n if (found == -1) break;\n pos = found + val.length;\n newBreaks.push(Pos(lineNo, found));\n }\n lineNo++;\n });\n for (var i = newBreaks.length - 1; i >= 0; i--)\n replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length))\n });\n option(\"specialChars\", /[\\u0000-\\u001f\\u007f\\u00ad\\u200b-\\u200f\\u2028\\u2029\\ufeff]/g, function(cm, val, old) {\n cm.state.specialChars = new RegExp(val.source + (val.test(\"\\t\") ? \"\" : \"|\\t\"), \"g\");\n if (old != CodeMirror.Init) cm.refresh();\n });\n option(\"specialCharPlaceholder\", defaultSpecialCharPlaceholder, function(cm) {cm.refresh();}, true);\n option(\"electricChars\", true);\n option(\"inputStyle\", mobile ? \"contenteditable\" : \"textarea\", function() {\n throw new Error(\"inputStyle can not (yet) be changed in a running editor\"); // FIXME\n }, true);\n option(\"rtlMoveVisually\", !windows);\n option(\"wholeLineUpdateBefore\", true);\n\n option(\"theme\", \"default\", function(cm) {\n themeChanged(cm);\n guttersChanged(cm);\n }, true);\n option(\"keyMap\", \"default\", function(cm, val, old) {\n var next = getKeyMap(val);\n var prev = old != CodeMirror.Init && getKeyMap(old);\n if (prev && prev.detach) prev.detach(cm, next);\n if (next.attach) next.attach(cm, prev || null);\n });\n option(\"extraKeys\", null);\n\n option(\"lineWrapping\", false, wrappingChanged, true);\n option(\"gutters\", [], function(cm) {\n setGuttersForLineNumbers(cm.options);\n guttersChanged(cm);\n }, true);\n option(\"fixedGutter\", true, function(cm, val) {\n cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + \"px\" : \"0\";\n cm.refresh();\n }, true);\n option(\"coverGutterNextToScrollbar\", false, function(cm) {updateScrollbars(cm);}, true);\n option(\"scrollbarStyle\", \"native\", function(cm) {\n initScrollbars(cm);\n updateScrollbars(cm);\n cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);\n cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);\n }, true);\n option(\"lineNumbers\", false, function(cm) {\n setGuttersForLineNumbers(cm.options);\n guttersChanged(cm);\n }, true);\n option(\"firstLineNumber\", 1, guttersChanged, true);\n option(\"lineNumberFormatter\", function(integer) {return integer;}, guttersChanged, true);\n option(\"showCursorWhenSelecting\", false, updateSelection, true);\n\n option(\"resetSelectionOnContextMenu\", true);\n option(\"lineWiseCopyCut\", true);\n\n option(\"readOnly\", false, function(cm, val) {\n if (val == \"nocursor\") {\n onBlur(cm);\n cm.display.input.blur();\n cm.display.disabled = true;\n } else {\n cm.display.disabled = false;\n }\n cm.display.input.readOnlyChanged(val)\n });\n option(\"disableInput\", false, function(cm, val) {if (!val) cm.display.input.reset();}, true);\n option(\"dragDrop\", true, dragDropChanged);\n option(\"allowDropFileTypes\", null);\n\n option(\"cursorBlinkRate\", 530);\n option(\"cursorScrollMargin\", 0);\n option(\"cursorHeight\", 1, updateSelection, true);\n option(\"singleCursorHeightPerLine\", true, updateSelection, true);\n option(\"workTime\", 100);\n option(\"workDelay\", 100);\n option(\"flattenSpans\", true, resetModeState, true);\n option(\"addModeClass\", false, resetModeState, true);\n option(\"pollInterval\", 100);\n option(\"undoDepth\", 200, function(cm, val){cm.doc.history.undoDepth = val;});\n option(\"historyEventDelay\", 1250);\n option(\"viewportMargin\", 10, function(cm){cm.refresh();}, true);\n option(\"maxHighlightLength\", 10000, resetModeState, true);\n option(\"moveInputWithCursor\", true, function(cm, val) {\n if (!val) cm.display.input.resetPosition();\n });\n\n option(\"tabindex\", null, function(cm, val) {\n cm.display.input.getField().tabIndex = val || \"\";\n });\n option(\"autofocus\", null);\n\n // MODE DEFINITION AND QUERYING\n\n // Known modes, by name and by MIME\n var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};\n\n // Extra arguments are stored as the mode's dependencies, which is\n // used by (legacy) mechanisms like loadmode.js to automatically\n // load a mode. (Preferred mechanism is the require/define calls.)\n CodeMirror.defineMode = function(name, mode) {\n if (!CodeMirror.defaults.mode && name != \"null\") CodeMirror.defaults.mode = name;\n if (arguments.length > 2)\n mode.dependencies = Array.prototype.slice.call(arguments, 2);\n modes[name] = mode;\n };\n\n CodeMirror.defineMIME = function(mime, spec) {\n mimeModes[mime] = spec;\n };\n\n // Given a MIME type, a {name, ...options} config object, or a name\n // string, return a mode config object.\n CodeMirror.resolveMode = function(spec) {\n if (typeof spec == \"string\" && mimeModes.hasOwnProperty(spec)) {\n spec = mimeModes[spec];\n } else if (spec && typeof spec.name == \"string\" && mimeModes.hasOwnProperty(spec.name)) {\n var found = mimeModes[spec.name];\n if (typeof found == \"string\") found = {name: found};\n spec = createObj(found, spec);\n spec.name = found.name;\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+xml$/.test(spec)) {\n return CodeMirror.resolveMode(\"application/xml\");\n }\n if (typeof spec == \"string\") return {name: spec};\n else return spec || {name: \"null\"};\n };\n\n // Given a mode spec (anything that resolveMode accepts), find and\n // initialize an actual mode object.\n CodeMirror.getMode = function(options, spec) {\n var spec = CodeMirror.resolveMode(spec);\n var mfactory = modes[spec.name];\n if (!mfactory) return CodeMirror.getMode(options, \"text/plain\");\n var modeObj = mfactory(options, spec);\n if (modeExtensions.hasOwnProperty(spec.name)) {\n var exts = modeExtensions[spec.name];\n for (var prop in exts) {\n if (!exts.hasOwnProperty(prop)) continue;\n if (modeObj.hasOwnProperty(prop)) modeObj[\"_\" + prop] = modeObj[prop];\n modeObj[prop] = exts[prop];\n }\n }\n modeObj.name = spec.name;\n if (spec.helperType) modeObj.helperType = spec.helperType;\n if (spec.modeProps) for (var prop in spec.modeProps)\n modeObj[prop] = spec.modeProps[prop];\n\n return modeObj;\n };\n\n // Minimal default mode.\n CodeMirror.defineMode(\"null\", function() {\n return {token: function(stream) {stream.skipToEnd();}};\n });\n CodeMirror.defineMIME(\"text/plain\", \"null\");\n\n // This can be used to attach properties to mode objects from\n // outside the actual mode definition.\n var modeExtensions = CodeMirror.modeExtensions = {};\n CodeMirror.extendMode = function(mode, properties) {\n var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});\n copyObj(properties, exts);\n };\n\n // EXTENSIONS\n\n CodeMirror.defineExtension = function(name, func) {\n CodeMirror.prototype[name] = func;\n };\n CodeMirror.defineDocExtension = function(name, func) {\n Doc.prototype[name] = func;\n };\n CodeMirror.defineOption = option;\n\n var initHooks = [];\n CodeMirror.defineInitHook = function(f) {initHooks.push(f);};\n\n var helpers = CodeMirror.helpers = {};\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) helpers[type] = CodeMirror[type] = {_global: []};\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n\n // MODE STATE HANDLING\n\n // Utility functions for working with state. Exported because nested\n // modes need to do this for their inner modes.\n\n var copyState = CodeMirror.copyState = function(mode, state) {\n if (state === true) return state;\n if (mode.copyState) return mode.copyState(state);\n var nstate = {};\n for (var n in state) {\n var val = state[n];\n if (val instanceof Array) val = val.concat([]);\n nstate[n] = val;\n }\n return nstate;\n };\n\n var startState = CodeMirror.startState = function(mode, a1, a2) {\n return mode.startState ? mode.startState(a1, a2) : true;\n };\n\n // Given a mode and a state (for that mode), find the inner mode and\n // state at the position that the state refers to.\n CodeMirror.innerMode = function(mode, state) {\n while (mode.innerMode) {\n var info = mode.innerMode(state);\n if (!info || info.mode == mode) break;\n state = info.state;\n mode = info.mode;\n }\n return info || {mode: mode, state: state};\n };\n\n // STANDARD COMMANDS\n\n // Commands are parameter-less actions that can be performed on an\n // editor, mostly used for keybindings.\n var commands = CodeMirror.commands = {\n selectAll: function(cm) {cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);},\n singleSelection: function(cm) {\n cm.setSelection(cm.getCursor(\"anchor\"), cm.getCursor(\"head\"), sel_dontScroll);\n },\n killLine: function(cm) {\n deleteNearSelection(cm, function(range) {\n if (range.empty()) {\n var len = getLine(cm.doc, range.head.line).text.length;\n if (range.head.ch == len && range.head.line < cm.lastLine())\n return {from: range.head, to: Pos(range.head.line + 1, 0)};\n else\n return {from: range.head, to: Pos(range.head.line, len)};\n } else {\n return {from: range.from(), to: range.to()};\n }\n });\n },\n deleteLine: function(cm) {\n deleteNearSelection(cm, function(range) {\n return {from: Pos(range.from().line, 0),\n to: clipPos(cm.doc, Pos(range.to().line + 1, 0))};\n });\n },\n delLineLeft: function(cm) {\n deleteNearSelection(cm, function(range) {\n return {from: Pos(range.from().line, 0), to: range.from()};\n });\n },\n delWrappedLineLeft: function(cm) {\n deleteNearSelection(cm, function(range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var leftPos = cm.coordsChar({left: 0, top: top}, \"div\");\n return {from: leftPos, to: range.from()};\n });\n },\n delWrappedLineRight: function(cm) {\n deleteNearSelection(cm, function(range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\");\n return {from: range.from(), to: rightPos };\n });\n },\n undo: function(cm) {cm.undo();},\n redo: function(cm) {cm.redo();},\n undoSelection: function(cm) {cm.undoSelection();},\n redoSelection: function(cm) {cm.redoSelection();},\n goDocStart: function(cm) {cm.extendSelection(Pos(cm.firstLine(), 0));},\n goDocEnd: function(cm) {cm.extendSelection(Pos(cm.lastLine()));},\n goLineStart: function(cm) {\n cm.extendSelectionsBy(function(range) { return lineStart(cm, range.head.line); },\n {origin: \"+move\", bias: 1});\n },\n goLineStartSmart: function(cm) {\n cm.extendSelectionsBy(function(range) {\n return lineStartSmart(cm, range.head);\n }, {origin: \"+move\", bias: 1});\n },\n goLineEnd: function(cm) {\n cm.extendSelectionsBy(function(range) { return lineEnd(cm, range.head.line); },\n {origin: \"+move\", bias: -1});\n },\n goLineRight: function(cm) {\n cm.extendSelectionsBy(function(range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\");\n }, sel_move);\n },\n goLineLeft: function(cm) {\n cm.extendSelectionsBy(function(range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: 0, top: top}, \"div\");\n }, sel_move);\n },\n goLineLeftSmart: function(cm) {\n cm.extendSelectionsBy(function(range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var pos = cm.coordsChar({left: 0, top: top}, \"div\");\n if (pos.ch < cm.getLine(pos.line).search(/\\S/)) return lineStartSmart(cm, range.head);\n return pos;\n }, sel_move);\n },\n goLineUp: function(cm) {cm.moveV(-1, \"line\");},\n goLineDown: function(cm) {cm.moveV(1, \"line\");},\n goPageUp: function(cm) {cm.moveV(-1, \"page\");},\n goPageDown: function(cm) {cm.moveV(1, \"page\");},\n goCharLeft: function(cm) {cm.moveH(-1, \"char\");},\n goCharRight: function(cm) {cm.moveH(1, \"char\");},\n goColumnLeft: function(cm) {cm.moveH(-1, \"column\");},\n goColumnRight: function(cm) {cm.moveH(1, \"column\");},\n goWordLeft: function(cm) {cm.moveH(-1, \"word\");},\n goGroupRight: function(cm) {cm.moveH(1, \"group\");},\n goGroupLeft: function(cm) {cm.moveH(-1, \"group\");},\n goWordRight: function(cm) {cm.moveH(1, \"word\");},\n delCharBefore: function(cm) {cm.deleteH(-1, \"char\");},\n delCharAfter: function(cm) {cm.deleteH(1, \"char\");},\n delWordBefore: function(cm) {cm.deleteH(-1, \"word\");},\n delWordAfter: function(cm) {cm.deleteH(1, \"word\");},\n delGroupBefore: function(cm) {cm.deleteH(-1, \"group\");},\n delGroupAfter: function(cm) {cm.deleteH(1, \"group\");},\n indentAuto: function(cm) {cm.indentSelection(\"smart\");},\n indentMore: function(cm) {cm.indentSelection(\"add\");},\n indentLess: function(cm) {cm.indentSelection(\"subtract\");},\n insertTab: function(cm) {cm.replaceSelection(\"\\t\");},\n insertSoftTab: function(cm) {\n var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;\n for (var i = 0; i < ranges.length; i++) {\n var pos = ranges[i].from();\n var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);\n spaces.push(spaceStr(tabSize - col % tabSize));\n }\n cm.replaceSelections(spaces);\n },\n defaultTab: function(cm) {\n if (cm.somethingSelected()) cm.indentSelection(\"add\");\n else cm.execCommand(\"insertTab\");\n },\n transposeChars: function(cm) {\n runInOp(cm, function() {\n var ranges = cm.listSelections(), newSel = [];\n for (var i = 0; i < ranges.length; i++) {\n var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;\n if (line) {\n if (cur.ch == line.length) cur = new Pos(cur.line, cur.ch - 1);\n if (cur.ch > 0) {\n cur = new Pos(cur.line, cur.ch + 1);\n cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),\n Pos(cur.line, cur.ch - 2), cur, \"+transpose\");\n } else if (cur.line > cm.doc.first) {\n var prev = getLine(cm.doc, cur.line - 1).text;\n if (prev)\n cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +\n prev.charAt(prev.length - 1),\n Pos(cur.line - 1, prev.length - 1), Pos(cur.line, 1), \"+transpose\");\n }\n }\n newSel.push(new Range(cur, cur));\n }\n cm.setSelections(newSel);\n });\n },\n newlineAndIndent: function(cm) {\n runInOp(cm, function() {\n var len = cm.listSelections().length;\n for (var i = 0; i < len; i++) {\n var range = cm.listSelections()[i];\n cm.replaceRange(cm.doc.lineSeparator(), range.anchor, range.head, \"+input\");\n cm.indentLine(range.from().line + 1, null, true);\n }\n ensureCursorVisible(cm);\n });\n },\n openLine: function(cm) {cm.replaceSelection(\"\\n\", \"start\")},\n toggleOverwrite: function(cm) {cm.toggleOverwrite();}\n };\n\n\n // STANDARD KEYMAPS\n\n var keyMap = CodeMirror.keyMap = {};\n\n keyMap.basic = {\n \"Left\": \"goCharLeft\", \"Right\": \"goCharRight\", \"Up\": \"goLineUp\", \"Down\": \"goLineDown\",\n \"End\": \"goLineEnd\", \"Home\": \"goLineStartSmart\", \"PageUp\": \"goPageUp\", \"PageDown\": \"goPageDown\",\n \"Delete\": \"delCharAfter\", \"Backspace\": \"delCharBefore\", \"Shift-Backspace\": \"delCharBefore\",\n \"Tab\": \"defaultTab\", \"Shift-Tab\": \"indentAuto\",\n \"Enter\": \"newlineAndIndent\", \"Insert\": \"toggleOverwrite\",\n \"Esc\": \"singleSelection\"\n };\n // Note that the save and find-related commands aren't defined by\n // default. User code or addons can define them. Unknown commands\n // are simply ignored.\n keyMap.pcDefault = {\n \"Ctrl-A\": \"selectAll\", \"Ctrl-D\": \"deleteLine\", \"Ctrl-Z\": \"undo\", \"Shift-Ctrl-Z\": \"redo\", \"Ctrl-Y\": \"redo\",\n \"Ctrl-Home\": \"goDocStart\", \"Ctrl-End\": \"goDocEnd\", \"Ctrl-Up\": \"goLineUp\", \"Ctrl-Down\": \"goLineDown\",\n \"Ctrl-Left\": \"goGroupLeft\", \"Ctrl-Right\": \"goGroupRight\", \"Alt-Left\": \"goLineStart\", \"Alt-Right\": \"goLineEnd\",\n \"Ctrl-Backspace\": \"delGroupBefore\", \"Ctrl-Delete\": \"delGroupAfter\", \"Ctrl-S\": \"save\", \"Ctrl-F\": \"find\",\n \"Ctrl-G\": \"findNext\", \"Shift-Ctrl-G\": \"findPrev\", \"Shift-Ctrl-F\": \"replace\", \"Shift-Ctrl-R\": \"replaceAll\",\n \"Ctrl-[\": \"indentLess\", \"Ctrl-]\": \"indentMore\",\n \"Ctrl-U\": \"undoSelection\", \"Shift-Ctrl-U\": \"redoSelection\", \"Alt-U\": \"redoSelection\",\n fallthrough: \"basic\"\n };\n // Very basic readline/emacs-style bindings, which are standard on Mac.\n keyMap.emacsy = {\n \"Ctrl-F\": \"goCharRight\", \"Ctrl-B\": \"goCharLeft\", \"Ctrl-P\": \"goLineUp\", \"Ctrl-N\": \"goLineDown\",\n \"Alt-F\": \"goWordRight\", \"Alt-B\": \"goWordLeft\", \"Ctrl-A\": \"goLineStart\", \"Ctrl-E\": \"goLineEnd\",\n \"Ctrl-V\": \"goPageDown\", \"Shift-Ctrl-V\": \"goPageUp\", \"Ctrl-D\": \"delCharAfter\", \"Ctrl-H\": \"delCharBefore\",\n \"Alt-D\": \"delWordAfter\", \"Alt-Backspace\": \"delWordBefore\", \"Ctrl-K\": \"killLine\", \"Ctrl-T\": \"transposeChars\",\n \"Ctrl-O\": \"openLine\"\n };\n keyMap.macDefault = {\n \"Cmd-A\": \"selectAll\", \"Cmd-D\": \"deleteLine\", \"Cmd-Z\": \"undo\", \"Shift-Cmd-Z\": \"redo\", \"Cmd-Y\": \"redo\",\n \"Cmd-Home\": \"goDocStart\", \"Cmd-Up\": \"goDocStart\", \"Cmd-End\": \"goDocEnd\", \"Cmd-Down\": \"goDocEnd\", \"Alt-Left\": \"goGroupLeft\",\n \"Alt-Right\": \"goGroupRight\", \"Cmd-Left\": \"goLineLeft\", \"Cmd-Right\": \"goLineRight\", \"Alt-Backspace\": \"delGroupBefore\",\n \"Ctrl-Alt-Backspace\": \"delGroupAfter\", \"Alt-Delete\": \"delGroupAfter\", \"Cmd-S\": \"save\", \"Cmd-F\": \"find\",\n \"Cmd-G\": \"findNext\", \"Shift-Cmd-G\": \"findPrev\", \"Cmd-Alt-F\": \"replace\", \"Shift-Cmd-Alt-F\": \"replaceAll\",\n \"Cmd-[\": \"indentLess\", \"Cmd-]\": \"indentMore\", \"Cmd-Backspace\": \"delWrappedLineLeft\", \"Cmd-Delete\": \"delWrappedLineRight\",\n \"Cmd-U\": \"undoSelection\", \"Shift-Cmd-U\": \"redoSelection\", \"Ctrl-Up\": \"goDocStart\", \"Ctrl-Down\": \"goDocEnd\",\n fallthrough: [\"basic\", \"emacsy\"]\n };\n keyMap[\"default\"] = mac ? keyMap.macDefault : keyMap.pcDefault;\n\n // KEYMAP DISPATCH\n\n function normalizeKeyName(name) {\n var parts = name.split(/-(?!$)/), name = parts[parts.length - 1];\n var alt, ctrl, shift, cmd;\n for (var i = 0; i < parts.length - 1; i++) {\n var mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) cmd = true;\n else if (/^a(lt)?$/i.test(mod)) alt = true;\n else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true;\n else if (/^s(hift)$/i.test(mod)) shift = true;\n else throw new Error(\"Unrecognized modifier name: \" + mod);\n }\n if (alt) name = \"Alt-\" + name;\n if (ctrl) name = \"Ctrl-\" + name;\n if (cmd) name = \"Cmd-\" + name;\n if (shift) name = \"Shift-\" + name;\n return name;\n }\n\n // This is a kludge to keep keymaps mostly working as raw objects\n // (backwards compatibility) while at the same time support features\n // like normalization and multi-stroke key bindings. It compiles a\n // new normalized keymap, and then updates the old object to reflect\n // this.\n CodeMirror.normalizeKeyMap = function(keymap) {\n var copy = {};\n for (var keyname in keymap) if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) continue;\n if (value == \"...\") { delete keymap[keyname]; continue; }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val, name;\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) copy[name] = val;\n else if (prev != val) throw new Error(\"Inconsistent bindings for \" + name);\n }\n delete keymap[keyname];\n }\n for (var prop in copy) keymap[prop] = copy[prop];\n return keymap;\n };\n\n var lookupKey = CodeMirror.lookupKey = function(key, map, handle, context) {\n map = getKeyMap(map);\n var found = map.call ? map.call(key, context) : map[key];\n if (found === false) return \"nothing\";\n if (found === \"...\") return \"multi\";\n if (found != null && handle(found)) return \"handled\";\n\n if (map.fallthrough) {\n if (Object.prototype.toString.call(map.fallthrough) != \"[object Array]\")\n return lookupKey(key, map.fallthrough, handle, context);\n for (var i = 0; i < map.fallthrough.length; i++) {\n var result = lookupKey(key, map.fallthrough[i], handle, context);\n if (result) return result;\n }\n }\n };\n\n // Modifier key presses don't count as 'real' key presses for the\n // purpose of keymap fallthrough.\n var isModifierKey = CodeMirror.isModifierKey = function(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\";\n };\n\n // Look up the name of a key as indicated by an event object.\n var keyName = CodeMirror.keyName = function(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) return false;\n var base = keyNames[event.keyCode], name = base;\n if (name == null || event.altGraphKey) return false;\n if (event.altKey && base != \"Alt\") name = \"Alt-\" + name;\n if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != \"Ctrl\") name = \"Ctrl-\" + name;\n if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != \"Cmd\") name = \"Cmd-\" + name;\n if (!noShift && event.shiftKey && base != \"Shift\") name = \"Shift-\" + name;\n return name;\n };\n\n function getKeyMap(val) {\n return typeof val == \"string\" ? keyMap[val] : val;\n }\n\n // FROMTEXTAREA\n\n CodeMirror.fromTextArea = function(textarea, options) {\n options = options ? copyObj(options) : {};\n options.value = textarea.value;\n if (!options.tabindex && textarea.tabIndex)\n options.tabindex = textarea.tabIndex;\n if (!options.placeholder && textarea.placeholder)\n options.placeholder = textarea.placeholder;\n // Set autofocus to true if this textarea is focused, or if it has\n // autofocus and no other element is focused.\n if (options.autofocus == null) {\n var hasFocus = activeElt();\n options.autofocus = hasFocus == textarea ||\n textarea.getAttribute(\"autofocus\") != null && hasFocus == document.body;\n }\n\n function save() {textarea.value = cm.getValue();}\n if (textarea.form) {\n on(textarea.form, \"submit\", save);\n // Deplorable hack to make the submit method do the right thing.\n if (!options.leaveSubmitMethodAlone) {\n var form = textarea.form, realSubmit = form.submit;\n try {\n var wrappedSubmit = form.submit = function() {\n save();\n form.submit = realSubmit;\n form.submit();\n form.submit = wrappedSubmit;\n };\n } catch(e) {}\n }\n }\n\n options.finishInit = function(cm) {\n cm.save = save;\n cm.getTextArea = function() { return textarea; };\n cm.toTextArea = function() {\n cm.toTextArea = isNaN; // Prevent this from being ran twice\n save();\n textarea.parentNode.removeChild(cm.getWrapperElement());\n textarea.style.display = \"\";\n if (textarea.form) {\n off(textarea.form, \"submit\", save);\n if (typeof textarea.form.submit == \"function\")\n textarea.form.submit = realSubmit;\n }\n };\n };\n\n textarea.style.display = \"none\";\n var cm = CodeMirror(function(node) {\n textarea.parentNode.insertBefore(node, textarea.nextSibling);\n }, options);\n return cm;\n };\n\n // STRING STREAM\n\n // Fed to the mode parsers, provides helper functions to make\n // parsers more succinct.\n\n var StringStream = CodeMirror.StringStream = function(string, tabSize) {\n this.pos = this.start = 0;\n this.string = string;\n this.tabSize = tabSize || 8;\n this.lastColumnPos = this.lastColumnValue = 0;\n this.lineStart = 0;\n };\n\n StringStream.prototype = {\n eol: function() {return this.pos >= this.string.length;},\n sol: function() {return this.pos == this.lineStart;},\n peek: function() {return this.string.charAt(this.pos) || undefined;},\n next: function() {\n if (this.pos < this.string.length)\n return this.string.charAt(this.pos++);\n },\n eat: function(match) {\n var ch = this.string.charAt(this.pos);\n if (typeof match == \"string\") var ok = ch == match;\n else var ok = ch && (match.test ? match.test(ch) : match(ch));\n if (ok) {++this.pos; return ch;}\n },\n eatWhile: function(match) {\n var start = this.pos;\n while (this.eat(match)){}\n return this.pos > start;\n },\n eatSpace: function() {\n var start = this.pos;\n while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;\n return this.pos > start;\n },\n skipToEnd: function() {this.pos = this.string.length;},\n skipTo: function(ch) {\n var found = this.string.indexOf(ch, this.pos);\n if (found > -1) {this.pos = found; return true;}\n },\n backUp: function(n) {this.pos -= n;},\n column: function() {\n if (this.lastColumnPos < this.start) {\n this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);\n this.lastColumnPos = this.start;\n }\n return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);\n },\n indentation: function() {\n return countColumn(this.string, null, this.tabSize) -\n (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);\n },\n match: function(pattern, consume, caseInsensitive) {\n if (typeof pattern == \"string\") {\n var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};\n var substr = this.string.substr(this.pos, pattern.length);\n if (cased(substr) == cased(pattern)) {\n if (consume !== false) this.pos += pattern.length;\n return true;\n }\n } else {\n var match = this.string.slice(this.pos).match(pattern);\n if (match && match.index > 0) return null;\n if (match && consume !== false) this.pos += match[0].length;\n return match;\n }\n },\n current: function(){return this.string.slice(this.start, this.pos);},\n hideFirstChars: function(n, inner) {\n this.lineStart += n;\n try { return inner(); }\n finally { this.lineStart -= n; }\n }\n };\n\n // TEXTMARKERS\n\n // Created with markText and setBookmark methods. A TextMarker is a\n // handle that can be used to clear or find a marked position in the\n // document. Line objects hold arrays (markedSpans) containing\n // {from, to, marker} object pointing to such marker objects, and\n // indicating that such a marker is present on that line. Multiple\n // lines may point to the same marker when it spans across lines.\n // The spans will have null for their from/to properties when the\n // marker continues beyond the start/end of the line. Markers have\n // links back to the lines they currently touch.\n\n var nextMarkerId = 0;\n\n var TextMarker = CodeMirror.TextMarker = function(doc, type) {\n this.lines = [];\n this.type = type;\n this.doc = doc;\n this.id = ++nextMarkerId;\n };\n eventMixin(TextMarker);\n\n // Clear the marker.\n TextMarker.prototype.clear = function() {\n if (this.explicitlyCleared) return;\n var cm = this.doc.cm, withOp = cm && !cm.curOp;\n if (withOp) startOperation(cm);\n if (hasHandler(this, \"clear\")) {\n var found = this.find();\n if (found) signalLater(this, \"clear\", found.from, found.to);\n }\n var min = null, max = null;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n if (cm && !this.collapsed) regLineChange(cm, lineNo(line), \"text\");\n else if (cm) {\n if (span.to != null) max = lineNo(line);\n if (span.from != null) min = lineNo(line);\n }\n line.markedSpans = removeMarkedSpan(line.markedSpans, span);\n if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)\n updateLineHeight(line, textHeight(cm.display));\n }\n if (cm && this.collapsed && !cm.options.lineWrapping) for (var i = 0; i < this.lines.length; ++i) {\n var visual = visualLine(this.lines[i]), len = lineLength(visual);\n if (len > cm.display.maxLineLength) {\n cm.display.maxLine = visual;\n cm.display.maxLineLength = len;\n cm.display.maxLineChanged = true;\n }\n }\n\n if (min != null && cm && this.collapsed) regChange(cm, min, max + 1);\n this.lines.length = 0;\n this.explicitlyCleared = true;\n if (this.atomic && this.doc.cantEdit) {\n this.doc.cantEdit = false;\n if (cm) reCheckSelection(cm.doc);\n }\n if (cm) signalLater(cm, \"markerCleared\", cm, this);\n if (withOp) endOperation(cm);\n if (this.parent) this.parent.clear();\n };\n\n // Find the position of the marker in the document. Returns a {from,\n // to} object by default. Side can be passed to get a specific side\n // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the\n // Pos objects returned contain a line object, rather than a line\n // number (used to prevent looking up the same line twice).\n TextMarker.prototype.find = function(side, lineObj) {\n if (side == null && this.type == \"bookmark\") side = 1;\n var from, to;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n if (span.from != null) {\n from = Pos(lineObj ? line : lineNo(line), span.from);\n if (side == -1) return from;\n }\n if (span.to != null) {\n to = Pos(lineObj ? line : lineNo(line), span.to);\n if (side == 1) return to;\n }\n }\n return from && {from: from, to: to};\n };\n\n // Signals that the marker's widget changed, and surrounding layout\n // should be recomputed.\n TextMarker.prototype.changed = function() {\n var pos = this.find(-1, true), widget = this, cm = this.doc.cm;\n if (!pos || !cm) return;\n runInOp(cm, function() {\n var line = pos.line, lineN = lineNo(pos.line);\n var view = findViewForLine(cm, lineN);\n if (view) {\n clearLineMeasurementCacheFor(view);\n cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;\n }\n cm.curOp.updateMaxLine = true;\n if (!lineIsHidden(widget.doc, line) && widget.height != null) {\n var oldHeight = widget.height;\n widget.height = null;\n var dHeight = widgetHeight(widget) - oldHeight;\n if (dHeight)\n updateLineHeight(line, line.height + dHeight);\n }\n });\n };\n\n TextMarker.prototype.attachLine = function(line) {\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp;\n if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)\n (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this);\n }\n this.lines.push(line);\n };\n TextMarker.prototype.detachLine = function(line) {\n this.lines.splice(indexOf(this.lines, line), 1);\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp;\n (op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);\n }\n };\n\n // Collapsed markers have unique ids, in order to be able to order\n // them, which is needed for uniquely determining an outer marker\n // when they overlap (they may nest, but not partially overlap).\n var nextMarkerId = 0;\n\n // Create a marker, wire it up to the right lines, and\n function markText(doc, from, to, options, type) {\n // Shared markers (across linked documents) are handled separately\n // (markTextShared will call out to this again, once per\n // document).\n if (options && options.shared) return markTextShared(doc, from, to, options, type);\n // Ensure we are in an operation.\n if (doc.cm && !doc.cm.curOp) return operation(doc.cm, markText)(doc, from, to, options, type);\n\n var marker = new TextMarker(doc, type), diff = cmp(from, to);\n if (options) copyObj(options, marker, false);\n // Don't connect empty markers unless clearWhenEmpty is false\n if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)\n return marker;\n if (marker.replacedWith) {\n // Showing up as a widget implies collapsed (widget replaces text)\n marker.collapsed = true;\n marker.widgetNode = elt(\"span\", [marker.replacedWith], \"CodeMirror-widget\");\n if (!options.handleMouseEvents) marker.widgetNode.setAttribute(\"cm-ignore-events\", \"true\");\n if (options.insertLeft) marker.widgetNode.insertLeft = true;\n }\n if (marker.collapsed) {\n if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||\n from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))\n throw new Error(\"Inserting collapsed marker partially overlapping an existing one\");\n sawCollapsedSpans = true;\n }\n\n if (marker.addToHistory)\n addChangeToHistory(doc, {from: from, to: to, origin: \"markText\"}, doc.sel, NaN);\n\n var curLine = from.line, cm = doc.cm, updateMaxLine;\n doc.iter(curLine, to.line + 1, function(line) {\n if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)\n updateMaxLine = true;\n if (marker.collapsed && curLine != from.line) updateLineHeight(line, 0);\n addMarkedSpan(line, new MarkedSpan(marker,\n curLine == from.line ? from.ch : null,\n curLine == to.line ? to.ch : null));\n ++curLine;\n });\n // lineIsHidden depends on the presence of the spans, so needs a second pass\n if (marker.collapsed) doc.iter(from.line, to.line + 1, function(line) {\n if (lineIsHidden(doc, line)) updateLineHeight(line, 0);\n });\n\n if (marker.clearOnEnter) on(marker, \"beforeCursorEnter\", function() { marker.clear(); });\n\n if (marker.readOnly) {\n sawReadOnlySpans = true;\n if (doc.history.done.length || doc.history.undone.length)\n doc.clearHistory();\n }\n if (marker.collapsed) {\n marker.id = ++nextMarkerId;\n marker.atomic = true;\n }\n if (cm) {\n // Sync editor state\n if (updateMaxLine) cm.curOp.updateMaxLine = true;\n if (marker.collapsed)\n regChange(cm, from.line, to.line + 1);\n else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)\n for (var i = from.line; i <= to.line; i++) regLineChange(cm, i, \"text\");\n if (marker.atomic) reCheckSelection(cm.doc);\n signalLater(cm, \"markerAdded\", cm, marker);\n }\n return marker;\n }\n\n // SHARED TEXTMARKERS\n\n // A shared marker spans multiple linked documents. It is\n // implemented as a meta-marker-object controlling multiple normal\n // markers.\n var SharedTextMarker = CodeMirror.SharedTextMarker = function(markers, primary) {\n this.markers = markers;\n this.primary = primary;\n for (var i = 0; i < markers.length; ++i)\n markers[i].parent = this;\n };\n eventMixin(SharedTextMarker);\n\n SharedTextMarker.prototype.clear = function() {\n if (this.explicitlyCleared) return;\n this.explicitlyCleared = true;\n for (var i = 0; i < this.markers.length; ++i)\n this.markers[i].clear();\n signalLater(this, \"clear\");\n };\n SharedTextMarker.prototype.find = function(side, lineObj) {\n return this.primary.find(side, lineObj);\n };\n\n function markTextShared(doc, from, to, options, type) {\n options = copyObj(options);\n options.shared = false;\n var markers = [markText(doc, from, to, options, type)], primary = markers[0];\n var widget = options.widgetNode;\n linkedDocs(doc, function(doc) {\n if (widget) options.widgetNode = widget.cloneNode(true);\n markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));\n for (var i = 0; i < doc.linked.length; ++i)\n if (doc.linked[i].isParent) return;\n primary = lst(markers);\n });\n return new SharedTextMarker(markers, primary);\n }\n\n function findSharedMarkers(doc) {\n return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())),\n function(m) { return m.parent; });\n }\n\n function copySharedMarkers(doc, markers) {\n for (var i = 0; i < markers.length; i++) {\n var marker = markers[i], pos = marker.find();\n var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);\n if (cmp(mFrom, mTo)) {\n var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);\n marker.markers.push(subMark);\n subMark.parent = marker;\n }\n }\n }\n\n function detachSharedMarkers(markers) {\n for (var i = 0; i < markers.length; i++) {\n var marker = markers[i], linked = [marker.primary.doc];;\n linkedDocs(marker.primary.doc, function(d) { linked.push(d); });\n for (var j = 0; j < marker.markers.length; j++) {\n var subMarker = marker.markers[j];\n if (indexOf(linked, subMarker.doc) == -1) {\n subMarker.parent = null;\n marker.markers.splice(j--, 1);\n }\n }\n }\n }\n\n // TEXTMARKER SPANS\n\n function MarkedSpan(marker, from, to) {\n this.marker = marker;\n this.from = from; this.to = to;\n }\n\n // Search an array of spans for a span matching the given marker.\n function getMarkedSpanFor(spans, marker) {\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) return span;\n }\n }\n // Remove a span from an array, returning undefined if no spans are\n // left (we don't store arrays for lines without spans).\n function removeMarkedSpan(spans, span) {\n for (var r, i = 0; i < spans.length; ++i)\n if (spans[i] != span) (r || (r = [])).push(spans[i]);\n return r;\n }\n // Add a span to a line.\n function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }\n\n // Used for the algorithm that adjusts markers for a change in the\n // document. These functions cut an array of spans at a given\n // character position, returning an array of remaining chunks (or\n // undefined if nothing remains).\n function markedSpansBefore(old, startCh, isInsert) {\n if (old) for (var i = 0, nw; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);\n if (startsBefore || span.from == startCh && marker.type == \"bookmark\" && (!isInsert || !span.marker.insertLeft)) {\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);\n (nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));\n }\n }\n return nw;\n }\n function markedSpansAfter(old, endCh, isInsert) {\n if (old) for (var i = 0, nw; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);\n if (endsAfter || span.from == endCh && marker.type == \"bookmark\" && (!isInsert || span.marker.insertLeft)) {\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);\n (nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,\n span.to == null ? null : span.to - endCh));\n }\n }\n return nw;\n }\n\n // Given a change object, compute the new set of marker spans that\n // cover the line in which the change took place. Removes spans\n // entirely within the change, reconnects spans belonging to the\n // same marker that appear on both sides of the change, and cuts off\n // spans partially within the change. Returns an array of span\n // arrays with one element for each line in (after) the change.\n function stretchSpansOverChange(doc, change) {\n if (change.full) return null;\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) return null;\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) span.to = startCh;\n else if (sameLine) span.to = found.to == null ? null : found.to + offset;\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i = 0; i < last.length; ++i) {\n var span = last[i];\n if (span.to != null) span.to += offset;\n if (span.from == null) {\n var found = getMarkedSpanFor(first, span.marker);\n if (!found) {\n span.from = offset;\n if (sameLine) (first || (first = [])).push(span);\n }\n } else {\n span.from += offset;\n if (sameLine) (first || (first = [])).push(span);\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) first = clearEmptySpans(first);\n if (last && last != first) last = clearEmptySpans(last);\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n for (var i = 0; i < first.length; ++i)\n if (first[i].to == null)\n (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i].marker, null, null));\n for (var i = 0; i < gap; ++i)\n newMarkers.push(gapMarkers);\n newMarkers.push(last);\n }\n return newMarkers;\n }\n\n // Remove spans that are empty and don't have a clearWhenEmpty\n // option of false.\n function clearEmptySpans(spans) {\n for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)\n spans.splice(i--, 1);\n }\n if (!spans.length) return null;\n return spans;\n }\n\n // Used for un/re-doing changes from the history. Combines the\n // result of computing the existing spans with the set of spans that\n // existed in the history (so that deleting around a span and then\n // undoing brings back the span).\n function mergeOldSpans(doc, change) {\n var old = getOldSpans(doc, change);\n var stretched = stretchSpansOverChange(doc, change);\n if (!old) return stretched;\n if (!stretched) return old;\n\n for (var i = 0; i < old.length; ++i) {\n var oldCur = old[i], stretchCur = stretched[i];\n if (oldCur && stretchCur) {\n spans: for (var j = 0; j < stretchCur.length; ++j) {\n var span = stretchCur[j];\n for (var k = 0; k < oldCur.length; ++k)\n if (oldCur[k].marker == span.marker) continue spans;\n oldCur.push(span);\n }\n } else if (stretchCur) {\n old[i] = stretchCur;\n }\n }\n return old;\n }\n\n // Used to 'clip' out readOnly ranges when making a change.\n function removeReadOnlyRanges(doc, from, to) {\n var markers = null;\n doc.iter(from.line, to.line + 1, function(line) {\n if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {\n var mark = line.markedSpans[i].marker;\n if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))\n (markers || (markers = [])).push(mark);\n }\n });\n if (!markers) return null;\n var parts = [{from: from, to: to}];\n for (var i = 0; i < markers.length; ++i) {\n var mk = markers[i], m = mk.find(0);\n for (var j = 0; j < parts.length; ++j) {\n var p = parts[j];\n if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) continue;\n var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);\n if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)\n newParts.push({from: p.from, to: m.from});\n if (dto > 0 || !mk.inclusiveRight && !dto)\n newParts.push({from: m.to, to: p.to});\n parts.splice.apply(parts, newParts);\n j += newParts.length - 1;\n }\n }\n return parts;\n }\n\n // Connect or disconnect spans from a line.\n function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.detachLine(line);\n line.markedSpans = null;\n }\n function attachMarkedSpans(line, spans) {\n if (!spans) return;\n for (var i = 0; i < spans.length; ++i)\n spans[i].marker.attachLine(line);\n line.markedSpans = spans;\n }\n\n // Helpers used when computing which overlapping collapsed span\n // counts as the larger one.\n function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0; }\n function extraRight(marker) { return marker.inclusiveRight ? 1 : 0; }\n\n // Returns a number indicating which of two overlapping collapsed\n // spans is larger (and thus includes the other). Falls back to\n // comparing ids when the spans cover exactly the same range.\n function compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n if (lenDiff != 0) return lenDiff;\n var aPos = a.find(), bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n if (fromCmp) return -fromCmp;\n var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);\n if (toCmp) return toCmp;\n return b.id - a.id;\n }\n\n // Find out whether a line ends or starts in a collapsed span. If\n // so, return the marker for that span.\n function collapsedSpanAtSide(line, start) {\n var sps = sawCollapsedSpans && line.markedSpans, found;\n if (sps) for (var sp, i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&\n (!found || compareCollapsedMarkers(found, sp.marker) < 0))\n found = sp.marker;\n }\n return found;\n }\n function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true); }\n function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false); }\n\n // Test whether there exists a collapsed span that partially\n // overlaps (covers the start or end, but not both) of a new span.\n // Such overlap is not allowed.\n function conflictingCollapsedRange(doc, lineNo, from, to, marker) {\n var line = getLine(doc, lineNo);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) continue;\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) continue;\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n return true;\n }\n }\n\n // A visual line is a line as drawn on the screen. Folding, for\n // example, can cause multiple logical lines to appear on the same\n // visual line. This finds the start of the visual line that the\n // given line is part of (usually that is the line itself).\n function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n line = merged.find(-1, true).line;\n return line;\n }\n\n // Returns an array of logical lines that continue the visual line\n // started by the argument, or undefined if there are no such lines.\n function visualLineContinued(line) {\n var merged, lines;\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line;\n (lines || (lines = [])).push(line);\n }\n return lines;\n }\n\n // Get the line number of the start of the visual line that the\n // given line number is part of.\n function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) return lineN;\n return lineNo(vis);\n }\n // Get the line number of the start of the next visual line after\n // the given line.\n function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) return lineN;\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) return lineN;\n while (merged = collapsedSpanAtEnd(line))\n line = merged.find(1, true).line;\n return lineNo(line) + 1;\n }\n\n // Compute whether a line is hidden. Lines count as hidden when they\n // are part of a visual line that starts with another line, or when\n // they are entirely covered by collapsed, non-widget span.\n function lineIsHidden(doc, line) {\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) for (var sp, i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (!sp.marker.collapsed) continue;\n if (sp.from == null) return true;\n if (sp.marker.widgetNode) continue;\n if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))\n return true;\n }\n }\n function lineIsHiddenInner(doc, line, span) {\n if (span.to == null) {\n var end = span.marker.find(1, true);\n return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker));\n }\n if (span.marker.inclusiveRight && span.to == line.text.length)\n return true;\n for (var sp, i = 0; i < line.markedSpans.length; ++i) {\n sp = line.markedSpans[i];\n if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&\n (sp.to == null || sp.to != span.from) &&\n (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&\n lineIsHiddenInner(doc, line, sp)) return true;\n }\n }\n\n // LINE WIDGETS\n\n // Line widgets are block elements displayed above or below a line.\n\n var LineWidget = CodeMirror.LineWidget = function(doc, node, options) {\n if (options) for (var opt in options) if (options.hasOwnProperty(opt))\n this[opt] = options[opt];\n this.doc = doc;\n this.node = node;\n };\n eventMixin(LineWidget);\n\n function adjustScrollWhenAboveVisible(cm, line, diff) {\n if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))\n addToScrollPos(cm, null, diff);\n }\n\n LineWidget.prototype.clear = function() {\n var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);\n if (no == null || !ws) return;\n for (var i = 0; i < ws.length; ++i) if (ws[i] == this) ws.splice(i--, 1);\n if (!ws.length) line.widgets = null;\n var height = widgetHeight(this);\n updateLineHeight(line, Math.max(0, line.height - height));\n if (cm) runInOp(cm, function() {\n adjustScrollWhenAboveVisible(cm, line, -height);\n regLineChange(cm, no, \"widget\");\n });\n };\n LineWidget.prototype.changed = function() {\n var oldH = this.height, cm = this.doc.cm, line = this.line;\n this.height = null;\n var diff = widgetHeight(this) - oldH;\n if (!diff) return;\n updateLineHeight(line, line.height + diff);\n if (cm) runInOp(cm, function() {\n cm.curOp.forceUpdate = true;\n adjustScrollWhenAboveVisible(cm, line, diff);\n });\n };\n\n function widgetHeight(widget) {\n if (widget.height != null) return widget.height;\n var cm = widget.doc.cm;\n if (!cm) return 0;\n if (!contains(document.body, widget.node)) {\n var parentStyle = \"position: relative;\";\n if (widget.coverGutter)\n parentStyle += \"margin-left: -\" + cm.display.gutters.offsetWidth + \"px;\";\n if (widget.noHScroll)\n parentStyle += \"width: \" + cm.display.wrapper.clientWidth + \"px;\";\n removeChildrenAndAdd(cm.display.measure, elt(\"div\", [widget.node], null, parentStyle));\n }\n return widget.height = widget.node.parentNode.offsetHeight;\n }\n\n function addLineWidget(doc, handle, node, options) {\n var widget = new LineWidget(doc, node, options);\n var cm = doc.cm;\n if (cm && widget.noHScroll) cm.display.alignWidgets = true;\n changeLine(doc, handle, \"widget\", function(line) {\n var widgets = line.widgets || (line.widgets = []);\n if (widget.insertAt == null) widgets.push(widget);\n else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget);\n widget.line = line;\n if (cm && !lineIsHidden(doc, line)) {\n var aboveVisible = heightAtLine(line) < doc.scrollTop;\n updateLineHeight(line, line.height + widgetHeight(widget));\n if (aboveVisible) addToScrollPos(cm, null, widget.height);\n cm.curOp.forceUpdate = true;\n }\n return true;\n });\n return widget;\n }\n\n // LINE DATA STRUCTURE\n\n // Line objects. These hold state related to a line, including\n // highlighting info (the styles array).\n var Line = CodeMirror.Line = function(text, markedSpans, estimateHeight) {\n this.text = text;\n attachMarkedSpans(this, markedSpans);\n this.height = estimateHeight ? estimateHeight(this) : 1;\n };\n eventMixin(Line);\n Line.prototype.lineNo = function() { return lineNo(this); };\n\n // Change the content (text, markers) of a line. Automatically\n // invalidates cached information and tries to re-estimate the\n // line's height.\n function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) line.stateAfter = null;\n if (line.styles) line.styles = null;\n if (line.order != null) line.order = null;\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) updateLineHeight(line, estHeight);\n }\n\n // Detach a line from the document tree and its markers.\n function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }\n\n function extractLineClasses(type, output) {\n if (type) for (;;) {\n var lineClass = type.match(/(?:^|\\s+)line-(background-)?(\\S+)/);\n if (!lineClass) break;\n type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);\n var prop = lineClass[1] ? \"bgClass\" : \"textClass\";\n if (output[prop] == null)\n output[prop] = lineClass[2];\n else if (!(new RegExp(\"(?:^|\\s)\" + lineClass[2] + \"(?:$|\\s)\")).test(output[prop]))\n output[prop] += \" \" + lineClass[2];\n }\n return type;\n }\n\n function callBlankLine(mode, state) {\n if (mode.blankLine) return mode.blankLine(state);\n if (!mode.innerMode) return;\n var inner = CodeMirror.innerMode(mode, state);\n if (inner.mode.blankLine) return inner.mode.blankLine(inner.state);\n }\n\n function readToken(mode, stream, state, inner) {\n for (var i = 0; i < 10; i++) {\n if (inner) inner[0] = CodeMirror.innerMode(mode, state).mode;\n var style = mode.token(stream, state);\n if (stream.pos > stream.start) return style;\n }\n throw new Error(\"Mode \" + mode.name + \" failed to advance stream.\");\n }\n\n // Utility for getTokenAt and getLineTokens\n function takeToken(cm, pos, precise, asArray) {\n function getObj(copy) {\n return {start: stream.start, end: stream.pos,\n string: stream.current(),\n type: style || null,\n state: copy ? copyState(doc.mode, state) : state};\n }\n\n var doc = cm.doc, mode = doc.mode, style;\n pos = clipPos(doc, pos);\n var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise);\n var stream = new StringStream(line.text, cm.options.tabSize), tokens;\n if (asArray) tokens = [];\n while ((asArray || stream.pos < pos.ch) && !stream.eol()) {\n stream.start = stream.pos;\n style = readToken(mode, stream, state);\n if (asArray) tokens.push(getObj(true));\n }\n return asArray ? tokens : getObj();\n }\n\n // Run the given mode's parser over a line, calling f for each token.\n function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) {\n var flattenSpans = mode.flattenSpans;\n if (flattenSpans == null) flattenSpans = cm.options.flattenSpans;\n var curStart = 0, curStyle = null;\n var stream = new StringStream(text, cm.options.tabSize), style;\n var inner = cm.options.addModeClass && [null];\n if (text == \"\") extractLineClasses(callBlankLine(mode, state), lineClasses);\n while (!stream.eol()) {\n if (stream.pos > cm.options.maxHighlightLength) {\n flattenSpans = false;\n if (forceToEnd) processLine(cm, text, state, stream.pos);\n stream.pos = text.length;\n style = null;\n } else {\n style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses);\n }\n if (inner) {\n var mName = inner[0].name;\n if (mName) style = \"m-\" + (style ? mName + \" \" + style : mName);\n }\n if (!flattenSpans || curStyle != style) {\n while (curStart < stream.start) {\n curStart = Math.min(stream.start, curStart + 50000);\n f(curStart, curStyle);\n }\n curStyle = style;\n }\n stream.start = stream.pos;\n }\n while (curStart < stream.pos) {\n // Webkit seems to refuse to render text nodes longer than 57444 characters\n var pos = Math.min(stream.pos, curStart + 50000);\n f(pos, curStyle);\n curStart = pos;\n }\n }\n\n // Compute a style array (an array starting with a mode generation\n // -- for invalidation -- followed by pairs of end positions and\n // style strings), which is used to highlight the tokens on the\n // line.\n function highlightLine(cm, line, state, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, state, function(end, style) {\n st.push(end, style);\n }, lineClasses, forceToEnd);\n\n // Run overlays, adjust style array.\n for (var o = 0; o < cm.state.overlays.length; ++o) {\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n runMode(cm, line.text, overlay.mode, true, function(end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n st.splice(i, 1, end, st[i+1], i_end);\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) return;\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"cm-overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"cm-overlay \" + style;\n }\n }\n }, lineClasses);\n }\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};\n }\n\n function getLineStyles(cm, line, updateFrontier) {\n if (!line.styles || line.styles[0] != cm.state.modeGen) {\n var state = getStateBefore(cm, lineNo(line));\n var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state);\n line.stateAfter = state;\n line.styles = result.styles;\n if (result.classes) line.styleClasses = result.classes;\n else if (line.styleClasses) line.styleClasses = null;\n if (updateFrontier === cm.doc.frontier) cm.doc.frontier++;\n }\n return line.styles;\n }\n\n // Lightweight form of highlight -- proceed over this line and\n // update state, but don't save a style array. Used for lines that\n // aren't currently visible.\n function processLine(cm, text, state, startAt) {\n var mode = cm.doc.mode;\n var stream = new StringStream(text, cm.options.tabSize);\n stream.start = stream.pos = startAt || 0;\n if (text == \"\") callBlankLine(mode, state);\n while (!stream.eol()) {\n readToken(mode, stream, state);\n stream.start = stream.pos;\n }\n }\n\n // Convert a style as returned by a mode (either null, or a string\n // containing one or more styles) to a CSS style. This is cached,\n // and also looks for line-wide styles.\n var styleToClassCache = {}, styleToClassCacheWithMode = {};\n function interpretTokenStyle(style, options) {\n if (!style || /^\\s*$/.test(style)) return null;\n var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;\n return cache[style] ||\n (cache[style] = style.replace(/\\S+/g, \"cm-$&\"));\n }\n\n // Render the DOM representation of the text of a line. Also builds\n // up a 'line map', which points at the DOM nodes that represent\n // specific stretches of text, and is used by the measuring code.\n // The returned object contains the DOM node, this map, and\n // information about line-wide styles that were set by the mode.\n function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = elt(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: elt(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order;\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n if (line.styleClasses.textClass)\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);\n (lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n builder.content.className = \"cm-tab-wrap-hack\";\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n\n return builder;\n }\n\n function defaultSpecialCharPlaceholder(ch) {\n var token = elt(\"span\", \"\\u2022\", \"cm-invalidchar\");\n token.title = \"\\\\u\" + ch.charCodeAt(0).toString(16);\n token.setAttribute(\"aria-label\", token.title);\n return token;\n }\n\n // Build up the DOM representation for a single token, and add it to\n // the line map. Takes care to render special characters separately.\n function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) return;\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n var special = builder.cm.state.specialChars, mustWrap = false;\n if (!special.test(text)) {\n builder.col += text.length;\n var content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) mustWrap = true;\n builder.pos += text.length;\n } else {\n var content = document.createDocumentFragment(), pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) break;\n pos += skipped + 1;\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n var txt = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt.setAttribute(\"role\", \"presentation\");\n txt.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n var txt = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n var txt = builder.cm.options.specialCharPlaceholder(m[0]);\n txt.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) content.appendChild(elt(\"span\", [txt]));\n else content.appendChild(txt);\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) fullStyle += startStyle;\n if (endStyle) fullStyle += endStyle;\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) token.title = title;\n return builder.content.appendChild(token);\n }\n builder.content.appendChild(content);\n }\n\n function splitSpaces(text, trailingBefore) {\n if (text.length > 1 && !/ /.test(text)) return text\n var spaceBefore = trailingBefore, result = \"\"\n for (var i = 0; i < text.length; i++) {\n var ch = text.charAt(i)\n if (ch == \" \" && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))\n ch = \"\\u00a0\"\n result += ch\n spaceBefore = ch == \" \"\n }\n return result\n }\n\n // Work around nonsense dimensions being reported for stretches of\n // right-to-left text.\n function buildTokenBadBidi(inner, order) {\n return function(builder, text, style, startStyle, endStyle, title, css) {\n style = style ? style + \" cm-force-border\" : \"cm-force-border\";\n var start = builder.pos, end = start + text.length;\n for (;;) {\n // Find the part that overlaps with the start of this text\n for (var i = 0; i < order.length; i++) {\n var part = order[i];\n if (part.to > start && part.from <= start) break;\n }\n if (part.to >= end) return inner(builder, text, style, startStyle, endStyle, title, css);\n inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css);\n startStyle = null;\n text = text.slice(part.to - start);\n start = part.to;\n }\n };\n }\n\n function buildCollapsedSpan(builder, size, marker, ignoreWidget) {\n var widget = !ignoreWidget && marker.widgetNode;\n if (widget) builder.map.push(builder.pos, builder.pos + size, widget);\n if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {\n if (!widget)\n widget = builder.content.appendChild(document.createElement(\"span\"));\n widget.setAttribute(\"cm-marker\", marker.id);\n }\n if (widget) {\n builder.cm.display.input.setUneditable(widget);\n builder.content.appendChild(widget);\n }\n builder.pos += size;\n builder.trailingSpace = false\n }\n\n // Outputs a number of spans to make up a line, taking highlighting\n // and marked text into account.\n function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i = 1; i < styles.length; i+=2)\n builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));\n return;\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) spanStyle += \" \" + m.className;\n if (m.css) css = (css ? css + \";\" : \"\") + m.css;\n if (m.startStyle && sp.from == pos) spanStartStyle += \" \" + m.startStyle;\n if (m.endStyle && sp.to == nextChange) (endStyles || (endStyles = [])).push(m.endStyle, sp.to)\n if (m.title && !title) title = m.title;\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n collapsed = sp;\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) for (var j = 0; j < endStyles.length; j += 2)\n if (endStyles[j + 1] == nextChange) spanEndStyle += \" \" + endStyles[j]\n\n if (!collapsed || collapsed.from == pos) for (var j = 0; j < foundBookmarks.length; ++j)\n buildCollapsedSpan(builder, 0, foundBookmarks[j]);\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) return;\n if (collapsed.to == pos) collapsed = false;\n }\n }\n if (pos >= len) break;\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }\n\n // DOCUMENT DATA STRUCTURE\n\n // By default, updates that start and end at the beginning of a line\n // are treated specially, in order to make the association of line\n // widgets and marker elements with the text behave more intuitive.\n function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore);\n }\n\n // Perform a change on the document data structure.\n function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null;}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n for (var i = start, result = []; i < end; ++i)\n result.push(new Line(text[i], spansFor(i), estimateHeight));\n return result;\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) doc.remove(from.line, nlines);\n if (added.length) doc.insert(from.line, added);\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added = linesFor(1, text.length - 1);\n added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added = linesFor(1, text.length - 1);\n if (nlines > 1) doc.remove(from.line + 1, nlines - 1);\n doc.insert(from.line + 1, added);\n }\n\n signalLater(doc, \"change\", doc, change);\n }\n\n // The document is represented as a BTree consisting of leaves, with\n // chunk of lines in them, and branches, with up to ten leaves or\n // other branch nodes below them. The top node is always a branch\n // node, and is the document object itself (meaning it has\n // additional methods and properties).\n //\n // All nodes have parent links. The tree is used both to go from\n // line numbers to line objects, and to go from objects to numbers.\n // It also indexes by height, and is used to convert between height\n // and line object, and to find the total height of the document.\n //\n // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html\n\n function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n for (var i = 0, height = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }\n\n LeafChunk.prototype = {\n chunkSize: function() { return this.lines.length; },\n // Remove the n lines at offset 'at'.\n removeInner: function(at, n) {\n for (var i = at, e = at + n; i < e; ++i) {\n var line = this.lines[i];\n this.height -= line.height;\n cleanUpLine(line);\n signalLater(line, \"delete\");\n }\n this.lines.splice(at, n);\n },\n // Helper used to collapse a small branch into a single leaf.\n collapse: function(lines) {\n lines.push.apply(lines, this.lines);\n },\n // Insert the given array of lines at offset 'at', count them as\n // having the given height.\n insertInner: function(at, lines, height) {\n this.height += height;\n this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));\n for (var i = 0; i < lines.length; ++i) lines[i].parent = this;\n },\n // Used to iterate over a part of the tree.\n iterN: function(at, n, op) {\n for (var e = at + n; at < e; ++at)\n if (op(this.lines[at])) return true;\n }\n };\n\n function BranchChunk(children) {\n this.children = children;\n var size = 0, height = 0;\n for (var i = 0; i < children.length; ++i) {\n var ch = children[i];\n size += ch.chunkSize(); height += ch.height;\n ch.parent = this;\n }\n this.size = size;\n this.height = height;\n this.parent = null;\n }\n\n BranchChunk.prototype = {\n chunkSize: function() { return this.size; },\n removeInner: function(at, n) {\n this.size -= n;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at < sz) {\n var rm = Math.min(n, sz - at), oldHeight = child.height;\n child.removeInner(at, rm);\n this.height -= oldHeight - child.height;\n if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }\n if ((n -= rm) == 0) break;\n at = 0;\n } else at -= sz;\n }\n // If the result is smaller than 25 lines, ensure that it is a\n // single leaf node.\n if (this.size - n < 25 &&\n (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {\n var lines = [];\n this.collapse(lines);\n this.children = [new LeafChunk(lines)];\n this.children[0].parent = this;\n }\n },\n collapse: function(lines) {\n for (var i = 0; i < this.children.length; ++i) this.children[i].collapse(lines);\n },\n insertInner: function(at, lines, height) {\n this.size += lines.length;\n this.height += height;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at <= sz) {\n child.insertInner(at, lines, height);\n if (child.lines && child.lines.length > 50) {\n // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.\n // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.\n var remaining = child.lines.length % 25 + 25\n for (var pos = remaining; pos < child.lines.length;) {\n var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));\n child.height -= leaf.height;\n this.children.splice(++i, 0, leaf);\n leaf.parent = this;\n }\n child.lines = child.lines.slice(0, remaining);\n this.maybeSpill();\n }\n break;\n }\n at -= sz;\n }\n },\n // When a node has grown, check whether it should be split.\n maybeSpill: function() {\n if (this.children.length <= 10) return;\n var me = this;\n do {\n var spilled = me.children.splice(me.children.length - 5, 5);\n var sibling = new BranchChunk(spilled);\n if (!me.parent) { // Become the parent node\n var copy = new BranchChunk(me.children);\n copy.parent = me;\n me.children = [copy, sibling];\n me = copy;\n } else {\n me.size -= sibling.size;\n me.height -= sibling.height;\n var myIndex = indexOf(me.parent.children, me);\n me.parent.children.splice(myIndex + 1, 0, sibling);\n }\n sibling.parent = me.parent;\n } while (me.children.length > 10);\n me.parent.maybeSpill();\n },\n iterN: function(at, n, op) {\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at < sz) {\n var used = Math.min(n, sz - at);\n if (child.iterN(at, used, op)) return true;\n if ((n -= used) == 0) break;\n at = 0;\n } else at -= sz;\n }\n }\n };\n\n var nextDocId = 0;\n var Doc = CodeMirror.Doc = function(text, mode, firstLine, lineSep) {\n if (!(this instanceof Doc)) return new Doc(text, mode, firstLine, lineSep);\n if (firstLine == null) firstLine = 0;\n\n BranchChunk.call(this, [new LeafChunk([new Line(\"\", null)])]);\n this.first = firstLine;\n this.scrollTop = this.scrollLeft = 0;\n this.cantEdit = false;\n this.cleanGeneration = 1;\n this.frontier = firstLine;\n var start = Pos(firstLine, 0);\n this.sel = simpleSelection(start);\n this.history = new History(null);\n this.id = ++nextDocId;\n this.modeOption = mode;\n this.lineSep = lineSep;\n this.extend = false;\n\n if (typeof text == \"string\") text = this.splitLines(text);\n updateDoc(this, {from: start, to: start, text: text});\n setSelection(this, simpleSelection(start), sel_dontScroll);\n };\n\n Doc.prototype = createObj(BranchChunk.prototype, {\n constructor: Doc,\n // Iterate over the document. Supports two forms -- with only one\n // argument, it calls that for each line in the document. With\n // three, it iterates over the range given by the first two (with\n // the second being non-inclusive).\n iter: function(from, to, op) {\n if (op) this.iterN(from - this.first, to - from, op);\n else this.iterN(this.first, this.first + this.size, from);\n },\n\n // Non-public interface for adding and removing lines.\n insert: function(at, lines) {\n var height = 0;\n for (var i = 0; i < lines.length; ++i) height += lines[i].height;\n this.insertInner(at - this.first, lines, height);\n },\n remove: function(at, n) { this.removeInner(at - this.first, n); },\n\n // From here, the methods are part of the public interface. Most\n // are also available from CodeMirror (editor) instances.\n\n getValue: function(lineSep) {\n var lines = getLines(this, this.first, this.first + this.size);\n if (lineSep === false) return lines;\n return lines.join(lineSep || this.lineSeparator());\n },\n setValue: docMethodOp(function(code) {\n var top = Pos(this.first, 0), last = this.first + this.size - 1;\n makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),\n text: this.splitLines(code), origin: \"setValue\", full: true}, true);\n setSelection(this, simpleSelection(top));\n }),\n replaceRange: function(code, from, to, origin) {\n from = clipPos(this, from);\n to = to ? clipPos(this, to) : from;\n replaceRange(this, code, from, to, origin);\n },\n getRange: function(from, to, lineSep) {\n var lines = getBetween(this, clipPos(this, from), clipPos(this, to));\n if (lineSep === false) return lines;\n return lines.join(lineSep || this.lineSeparator());\n },\n\n getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;},\n\n getLineHandle: function(line) {if (isLine(this, line)) return getLine(this, line);},\n getLineNumber: function(line) {return lineNo(line);},\n\n getLineHandleVisualStart: function(line) {\n if (typeof line == \"number\") line = getLine(this, line);\n return visualLine(line);\n },\n\n lineCount: function() {return this.size;},\n firstLine: function() {return this.first;},\n lastLine: function() {return this.first + this.size - 1;},\n\n clipPos: function(pos) {return clipPos(this, pos);},\n\n getCursor: function(start) {\n var range = this.sel.primary(), pos;\n if (start == null || start == \"head\") pos = range.head;\n else if (start == \"anchor\") pos = range.anchor;\n else if (start == \"end\" || start == \"to\" || start === false) pos = range.to();\n else pos = range.from();\n return pos;\n },\n listSelections: function() { return this.sel.ranges; },\n somethingSelected: function() {return this.sel.somethingSelected();},\n\n setCursor: docMethodOp(function(line, ch, options) {\n setSimpleSelection(this, clipPos(this, typeof line == \"number\" ? Pos(line, ch || 0) : line), null, options);\n }),\n setSelection: docMethodOp(function(anchor, head, options) {\n setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);\n }),\n extendSelection: docMethodOp(function(head, other, options) {\n extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);\n }),\n extendSelections: docMethodOp(function(heads, options) {\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n extendSelectionsBy: docMethodOp(function(f, options) {\n var heads = map(this.sel.ranges, f);\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n setSelections: docMethodOp(function(ranges, primary, options) {\n if (!ranges.length) return;\n for (var i = 0, out = []; i < ranges.length; i++)\n out[i] = new Range(clipPos(this, ranges[i].anchor),\n clipPos(this, ranges[i].head));\n if (primary == null) primary = Math.min(ranges.length - 1, this.sel.primIndex);\n setSelection(this, normalizeSelection(out, primary), options);\n }),\n addSelection: docMethodOp(function(anchor, head, options) {\n var ranges = this.sel.ranges.slice(0);\n ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));\n setSelection(this, normalizeSelection(ranges, ranges.length - 1), options);\n }),\n\n getSelection: function(lineSep) {\n var ranges = this.sel.ranges, lines;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n lines = lines ? lines.concat(sel) : sel;\n }\n if (lineSep === false) return lines;\n else return lines.join(lineSep || this.lineSeparator());\n },\n getSelections: function(lineSep) {\n var parts = [], ranges = this.sel.ranges;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n if (lineSep !== false) sel = sel.join(lineSep || this.lineSeparator());\n parts[i] = sel;\n }\n return parts;\n },\n replaceSelection: function(code, collapse, origin) {\n var dup = [];\n for (var i = 0; i < this.sel.ranges.length; i++)\n dup[i] = code;\n this.replaceSelections(dup, collapse, origin || \"+input\");\n },\n replaceSelections: docMethodOp(function(code, collapse, origin) {\n var changes = [], sel = this.sel;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin};\n }\n var newSel = collapse && collapse != \"end\" && computeReplacedSel(this, changes, collapse);\n for (var i = changes.length - 1; i >= 0; i--)\n makeChange(this, changes[i]);\n if (newSel) setSelectionReplaceHistory(this, newSel);\n else if (this.cm) ensureCursorVisible(this.cm);\n }),\n undo: docMethodOp(function() {makeChangeFromHistory(this, \"undo\");}),\n redo: docMethodOp(function() {makeChangeFromHistory(this, \"redo\");}),\n undoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"undo\", true);}),\n redoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"redo\", true);}),\n\n setExtending: function(val) {this.extend = val;},\n getExtending: function() {return this.extend;},\n\n historySize: function() {\n var hist = this.history, done = 0, undone = 0;\n for (var i = 0; i < hist.done.length; i++) if (!hist.done[i].ranges) ++done;\n for (var i = 0; i < hist.undone.length; i++) if (!hist.undone[i].ranges) ++undone;\n return {undo: done, redo: undone};\n },\n clearHistory: function() {this.history = new History(this.history.maxGeneration);},\n\n markClean: function() {\n this.cleanGeneration = this.changeGeneration(true);\n },\n changeGeneration: function(forceSplit) {\n if (forceSplit)\n this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null;\n return this.history.generation;\n },\n isClean: function (gen) {\n return this.history.generation == (gen || this.cleanGeneration);\n },\n\n getHistory: function() {\n return {done: copyHistoryArray(this.history.done),\n undone: copyHistoryArray(this.history.undone)};\n },\n setHistory: function(histData) {\n var hist = this.history = new History(this.history.maxGeneration);\n hist.done = copyHistoryArray(histData.done.slice(0), null, true);\n hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);\n },\n\n addLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function(line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n if (!line[prop]) line[prop] = cls;\n else if (classTest(cls).test(line[prop])) return false;\n else line[prop] += \" \" + cls;\n return true;\n });\n }),\n removeLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function(line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n var cur = line[prop];\n if (!cur) return false;\n else if (cls == null) line[prop] = null;\n else {\n var found = cur.match(classTest(cls));\n if (!found) return false;\n var end = found.index + found[0].length;\n line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? \"\" : \" \") + cur.slice(end) || null;\n }\n return true;\n });\n }),\n\n addLineWidget: docMethodOp(function(handle, node, options) {\n return addLineWidget(this, handle, node, options);\n }),\n removeLineWidget: function(widget) { widget.clear(); },\n\n markText: function(from, to, options) {\n return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || \"range\");\n },\n setBookmark: function(pos, options) {\n var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),\n insertLeft: options && options.insertLeft,\n clearWhenEmpty: false, shared: options && options.shared,\n handleMouseEvents: options && options.handleMouseEvents};\n pos = clipPos(this, pos);\n return markText(this, pos, pos, realOpts, \"bookmark\");\n },\n findMarksAt: function(pos) {\n pos = clipPos(this, pos);\n var markers = [], spans = getLine(this, pos.line).markedSpans;\n if (spans) for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if ((span.from == null || span.from <= pos.ch) &&\n (span.to == null || span.to >= pos.ch))\n markers.push(span.marker.parent || span.marker);\n }\n return markers;\n },\n findMarks: function(from, to, filter) {\n from = clipPos(this, from); to = clipPos(this, to);\n var found = [], lineNo = from.line;\n this.iter(from.line, to.line + 1, function(line) {\n var spans = line.markedSpans;\n if (spans) for (var i = 0; i < spans.length; i++) {\n var span = spans[i];\n if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||\n span.from == null && lineNo != from.line ||\n span.from != null && lineNo == to.line && span.from >= to.ch) &&\n (!filter || filter(span.marker)))\n found.push(span.marker.parent || span.marker);\n }\n ++lineNo;\n });\n return found;\n },\n getAllMarks: function() {\n var markers = [];\n this.iter(function(line) {\n var sps = line.markedSpans;\n if (sps) for (var i = 0; i < sps.length; ++i)\n if (sps[i].from != null) markers.push(sps[i].marker);\n });\n return markers;\n },\n\n posFromIndex: function(off) {\n var ch, lineNo = this.first, sepSize = this.lineSeparator().length;\n this.iter(function(line) {\n var sz = line.text.length + sepSize;\n if (sz > off) { ch = off; return true; }\n off -= sz;\n ++lineNo;\n });\n return clipPos(this, Pos(lineNo, ch));\n },\n indexFromPos: function (coords) {\n coords = clipPos(this, coords);\n var index = coords.ch;\n if (coords.line < this.first || coords.ch < 0) return 0;\n var sepSize = this.lineSeparator().length;\n this.iter(this.first, coords.line, function (line) {\n index += line.text.length + sepSize;\n });\n return index;\n },\n\n copy: function(copyHistory) {\n var doc = new Doc(getLines(this, this.first, this.first + this.size),\n this.modeOption, this.first, this.lineSep);\n doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;\n doc.sel = this.sel;\n doc.extend = false;\n if (copyHistory) {\n doc.history.undoDepth = this.history.undoDepth;\n doc.setHistory(this.getHistory());\n }\n return doc;\n },\n\n linkedDoc: function(options) {\n if (!options) options = {};\n var from = this.first, to = this.first + this.size;\n if (options.from != null && options.from > from) from = options.from;\n if (options.to != null && options.to < to) to = options.to;\n var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep);\n if (options.sharedHist) copy.history = this.history;\n (this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});\n copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];\n copySharedMarkers(copy, findSharedMarkers(this));\n return copy;\n },\n unlinkDoc: function(other) {\n if (other instanceof CodeMirror) other = other.doc;\n if (this.linked) for (var i = 0; i < this.linked.length; ++i) {\n var link = this.linked[i];\n if (link.doc != other) continue;\n this.linked.splice(i, 1);\n other.unlinkDoc(this);\n detachSharedMarkers(findSharedMarkers(this));\n break;\n }\n // If the histories were shared, split them again\n if (other.history == this.history) {\n var splitIds = [other.id];\n linkedDocs(other, function(doc) {splitIds.push(doc.id);}, true);\n other.history = new History(null);\n other.history.done = copyHistoryArray(this.history.done, splitIds);\n other.history.undone = copyHistoryArray(this.history.undone, splitIds);\n }\n },\n iterLinkedDocs: function(f) {linkedDocs(this, f);},\n\n getMode: function() {return this.mode;},\n getEditor: function() {return this.cm;},\n\n splitLines: function(str) {\n if (this.lineSep) return str.split(this.lineSep);\n return splitLinesAuto(str);\n },\n lineSeparator: function() { return this.lineSep || \"\\n\"; }\n });\n\n // Public alias.\n Doc.prototype.eachLine = Doc.prototype.iter;\n\n // Set up methods on CodeMirror's prototype to redirect to the editor's document.\n var dontDelegate = \"iter insert remove copy getEditor constructor\".split(\" \");\n for (var prop in Doc.prototype) if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)\n CodeMirror.prototype[prop] = (function(method) {\n return function() {return method.apply(this.doc, arguments);};\n })(Doc.prototype[prop]);\n\n eventMixin(Doc);\n\n // Call f for all linked documents.\n function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) continue;\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) continue;\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n }\n }\n propagate(doc, null, true);\n }\n\n // Attach a document to an editor.\n function attachDoc(cm, doc) {\n if (doc.cm) throw new Error(\"This document is already in use.\");\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n if (!cm.options.lineWrapping) findMaxLine(cm);\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }\n\n // LINE UTILITIES\n\n // Find the line object corresponding to the given line number.\n function getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\");\n for (var chunk = doc; !chunk.lines;) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) { chunk = child; break; }\n n -= sz;\n }\n }\n return chunk.lines[n];\n }\n\n // Get the part of a document between two positions, as an array of\n // strings.\n function getBetween(doc, start, end) {\n var out = [], n = start.line;\n doc.iter(start.line, end.line + 1, function(line) {\n var text = line.text;\n if (n == end.line) text = text.slice(0, end.ch);\n if (n == start.line) text = text.slice(start.ch);\n out.push(text);\n ++n;\n });\n return out;\n }\n // Get the lines between from and to, as array of strings.\n function getLines(doc, from, to) {\n var out = [];\n doc.iter(from, to, function(line) { out.push(line.text); });\n return out;\n }\n\n // Update the height of a line, propagating the height change\n // upwards to parent nodes.\n function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) for (var n = line; n; n = n.parent) n.height += diff;\n }\n\n // Given a line object, find its line number by walking up through\n // its parent links.\n function lineNo(line) {\n if (line.parent == null) return null;\n var cur = line.parent, no = indexOf(cur.lines, line);\n for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {\n for (var i = 0;; ++i) {\n if (chunk.children[i] == cur) break;\n no += chunk.children[i].chunkSize();\n }\n }\n return no + cur.first;\n }\n\n // Find the line at the given vertical position, using the height\n // information in the document tree.\n function lineAtHeight(chunk, h) {\n var n = chunk.first;\n outer: do {\n for (var i = 0; i < chunk.children.length; ++i) {\n var child = chunk.children[i], ch = child.height;\n if (h < ch) { chunk = child; continue outer; }\n h -= ch;\n n += child.chunkSize();\n }\n return n;\n } while (!chunk.lines);\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i], lh = line.height;\n if (h < lh) break;\n h -= lh;\n }\n return n + i;\n }\n\n\n // Find the height above the given line.\n function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) break;\n else h += line.height;\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i = 0; i < p.children.length; ++i) {\n var cur = p.children[i];\n if (cur == chunk) break;\n else h += cur.height;\n }\n }\n return h;\n }\n\n // Get the bidi ordering for the given line (and cache it). Returns\n // false for lines that are fully left-to-right, and an array of\n // BidiSpan objects otherwise.\n function getOrder(line) {\n var order = line.order;\n if (order == null) order = line.order = bidiOrdering(line.text);\n return order;\n }\n\n // HISTORY\n\n function History(startGen) {\n // Arrays of change events and selections. Doing something adds an\n // event to done and clears undo. Undoing moves events from done\n // to undone, redoing moves them in the other direction.\n this.done = []; this.undone = [];\n this.undoDepth = Infinity;\n // Used to track when changes can be merged into a single undo\n // event\n this.lastModTime = this.lastSelTime = 0;\n this.lastOp = this.lastSelOp = null;\n this.lastOrigin = this.lastSelOrigin = null;\n // Used by the isClean() method\n this.generation = this.maxGeneration = startGen || 1;\n }\n\n // Create a history change event from an updateDoc-style change\n // object.\n function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);\n return histChange;\n }\n\n // Pop all selection events off the end of a history array. Stop at\n // a change event.\n function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) array.pop();\n else break;\n }\n }\n\n // Find the top change event in the history. Pop off selection\n // events that are in the way.\n function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done);\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done);\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done);\n }\n }\n\n // Register a change in the history. Merges changes that are within\n // a single operation, ore are close together with an origin that\n // allows merging (starting with \"+\") into a single event.\n function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n var last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n pushSelectionToHistory(doc.sel, hist.done);\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) hist.done.shift();\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) signal(doc, \"historyAdded\");\n }\n\n function selectionEventCanBeMerged(doc, origin, prev, sel) {\n var ch = origin.charAt(0);\n return ch == \"*\" ||\n ch == \"+\" &&\n prev.ranges.length == sel.ranges.length &&\n prev.somethingSelected() == sel.somethingSelected() &&\n new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500);\n }\n\n // Called whenever the selection changes, sets the new selection as\n // the pending selection in the history, and pushes the old pending\n // selection into the 'done' array when it was significantly\n // different (in number of selected ranges, emptiness, or time).\n function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n hist.done[hist.done.length - 1] = sel;\n else\n pushSelectionToHistory(sel, hist.done);\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n clearSelectionEvents(hist.undone);\n }\n\n function pushSelectionToHistory(sel, dest) {\n var top = lst(dest);\n if (!(top && top.ranges && top.equals(sel)))\n dest.push(sel);\n }\n\n // Used to store marked span information in the history.\n function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans)\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n ++n;\n });\n }\n\n // When un/re-doing restores text containing marked spans, those\n // that have been explicitly cleared should not be restored.\n function removeClearedSpans(spans) {\n if (!spans) return null;\n for (var i = 0, out; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }\n else if (out) out.push(spans[i]);\n }\n return !out ? spans : out.length ? out : null;\n }\n\n // Retrieve and filter the old marked spans stored in a change event.\n function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) return null;\n for (var i = 0, nw = []; i < change.text.length; ++i)\n nw.push(removeClearedSpans(found[i]));\n return nw;\n }\n\n // Used both to provide a JSON-safe object in .getHistory, and, when\n // detaching a document, to split the history in two\n function copyHistoryArray(events, newGroup, instantiateSel) {\n for (var i = 0, copy = []; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue;\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m;\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n }\n }\n }\n return copy;\n }\n\n // Rebasing/resetting history to deal with externally-sourced changes\n\n function rebaseHistSelSingle(pos, from, to, diff) {\n if (to < pos.line) {\n pos.line += diff;\n } else if (from < pos.line) {\n pos.line = from;\n pos.ch = 0;\n }\n }\n\n // Tries to rebase an array of history events given a change in the\n // document. If the change touches the same lines as the event, the\n // event, and everything 'behind' it, is discarded. If the change is\n // before the event, the event's positions are updated. Uses a\n // copy-on-write scheme for the positions, to avoid having to\n // reallocate them all on every rebase, but also avoid problems with\n // shared position objects being unsafely updated.\n function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue;\n }\n for (var j = 0; j < sub.changes.length; ++j) {\n var cur = sub.changes[j];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break;\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }\n\n function rebaseHist(hist, change) {\n var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;\n rebaseHistArray(hist.done, from, to, diff);\n rebaseHistArray(hist.undone, from, to, diff);\n }\n\n // EVENT UTILITIES\n\n // Due to the fact that we still support jurassic IE versions, some\n // compatibility wrappers are needed.\n\n var e_preventDefault = CodeMirror.e_preventDefault = function(e) {\n if (e.preventDefault) e.preventDefault();\n else e.returnValue = false;\n };\n var e_stopPropagation = CodeMirror.e_stopPropagation = function(e) {\n if (e.stopPropagation) e.stopPropagation();\n else e.cancelBubble = true;\n };\n function e_defaultPrevented(e) {\n return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false;\n }\n var e_stop = CodeMirror.e_stop = function(e) {e_preventDefault(e); e_stopPropagation(e);};\n\n function e_target(e) {return e.target || e.srcElement;}\n function e_button(e) {\n var b = e.which;\n if (b == null) {\n if (e.button & 1) b = 1;\n else if (e.button & 2) b = 3;\n else if (e.button & 4) b = 2;\n }\n if (mac && e.ctrlKey && b == 1) b = 3;\n return b;\n }\n\n // EVENT HANDLING\n\n // Lightweight event framework. on/off also work on DOM nodes,\n // registering native DOM handlers.\n\n var on = CodeMirror.on = function(emitter, type, f) {\n if (emitter.addEventListener)\n emitter.addEventListener(type, f, false);\n else if (emitter.attachEvent)\n emitter.attachEvent(\"on\" + type, f);\n else {\n var map = emitter._handlers || (emitter._handlers = {});\n var arr = map[type] || (map[type] = []);\n arr.push(f);\n }\n };\n\n var noHandlers = []\n function getHandlers(emitter, type, copy) {\n var arr = emitter._handlers && emitter._handlers[type]\n if (copy) return arr && arr.length > 0 ? arr.slice() : noHandlers\n else return arr || noHandlers\n }\n\n var off = CodeMirror.off = function(emitter, type, f) {\n if (emitter.removeEventListener)\n emitter.removeEventListener(type, f, false);\n else if (emitter.detachEvent)\n emitter.detachEvent(\"on\" + type, f);\n else {\n var handlers = getHandlers(emitter, type, false)\n for (var i = 0; i < handlers.length; ++i)\n if (handlers[i] == f) { handlers.splice(i, 1); break; }\n }\n };\n\n var signal = CodeMirror.signal = function(emitter, type /*, values...*/) {\n var handlers = getHandlers(emitter, type, true)\n if (!handlers.length) return;\n var args = Array.prototype.slice.call(arguments, 2);\n for (var i = 0; i < handlers.length; ++i) handlers[i].apply(null, args);\n };\n\n var orphanDelayedCallbacks = null;\n\n // Often, we want to signal events at a point where we are in the\n // middle of some work, but don't want the handler to start calling\n // other methods on the editor, which might be in an inconsistent\n // state or simply not expect any other events to happen.\n // signalLater looks whether there are any handlers, and schedules\n // them to be executed when the last operation ends, or, if no\n // operation is active, when a timeout fires.\n function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type, false)\n if (!arr.length) return;\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n function bnd(f) {return function(){f.apply(null, args);};};\n for (var i = 0; i < arr.length; ++i)\n list.push(bnd(arr[i]));\n }\n\n function fireOrphanDelayed() {\n var delayed = orphanDelayedCallbacks;\n orphanDelayedCallbacks = null;\n for (var i = 0; i < delayed.length; ++i) delayed[i]();\n }\n\n // The DOM events that CodeMirror handles can be overridden by\n // registering a (non-DOM) handler on the editor for the event name,\n // and preventDefault-ing the event in that handler.\n function signalDOMEvent(cm, e, override) {\n if (typeof e == \"string\")\n e = {type: e, preventDefault: function() { this.defaultPrevented = true; }};\n signal(cm, override || e.type, cm, e);\n return e_defaultPrevented(e) || e.codemirrorIgnore;\n }\n\n function signalCursorActivity(cm) {\n var arr = cm._handlers && cm._handlers.cursorActivity;\n if (!arr) return;\n var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);\n for (var i = 0; i < arr.length; ++i) if (indexOf(set, arr[i]) == -1)\n set.push(arr[i]);\n }\n\n function hasHandler(emitter, type) {\n return getHandlers(emitter, type).length > 0\n }\n\n // Add on and off methods to a constructor's prototype, to make\n // registering events on such objects more convenient.\n function eventMixin(ctor) {\n ctor.prototype.on = function(type, f) {on(this, type, f);};\n ctor.prototype.off = function(type, f) {off(this, type, f);};\n }\n\n // MISC UTILITIES\n\n // Number of pixels added to scroller and sizer to hide scrollbar\n var scrollerGap = 30;\n\n // Returned or thrown by various protocols to signal 'I'm not\n // handling this'.\n var Pass = CodeMirror.Pass = {toString: function(){return \"CodeMirror.Pass\";}};\n\n // Reused option objects for setSelection & friends\n var sel_dontScroll = {scroll: false}, sel_mouse = {origin: \"*mouse\"}, sel_move = {origin: \"+move\"};\n\n function Delayed() {this.id = null;}\n Delayed.prototype.set = function(ms, f) {\n clearTimeout(this.id);\n this.id = setTimeout(f, ms);\n };\n\n // Counts the column offset in a string, taking tabs into account.\n // Used mostly to find indentation.\n var countColumn = CodeMirror.countColumn = function(string, end, tabSize, startIndex, startValue) {\n if (end == null) {\n end = string.search(/[^\\s\\u00a0]/);\n if (end == -1) end = string.length;\n }\n for (var i = startIndex || 0, n = startValue || 0;;) {\n var nextTab = string.indexOf(\"\\t\", i);\n if (nextTab < 0 || nextTab >= end)\n return n + (end - i);\n n += nextTab - i;\n n += tabSize - (n % tabSize);\n i = nextTab + 1;\n }\n };\n\n // The inverse of countColumn -- find the offset that corresponds to\n // a particular column.\n var findColumn = CodeMirror.findColumn = function(string, goal, tabSize) {\n for (var pos = 0, col = 0;;) {\n var nextTab = string.indexOf(\"\\t\", pos);\n if (nextTab == -1) nextTab = string.length;\n var skipped = nextTab - pos;\n if (nextTab == string.length || col + skipped >= goal)\n return pos + Math.min(skipped, goal - col);\n col += nextTab - pos;\n col += tabSize - (col % tabSize);\n pos = nextTab + 1;\n if (col >= goal) return pos;\n }\n }\n\n var spaceStrs = [\"\"];\n function spaceStr(n) {\n while (spaceStrs.length <= n)\n spaceStrs.push(lst(spaceStrs) + \" \");\n return spaceStrs[n];\n }\n\n function lst(arr) { return arr[arr.length-1]; }\n\n var selectInput = function(node) { node.select(); };\n if (ios) // Mobile Safari apparently has a bug where select() is broken.\n selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; };\n else if (ie) // Suppress mysterious IE10 errors\n selectInput = function(node) { try { node.select(); } catch(_e) {} };\n\n function indexOf(array, elt) {\n for (var i = 0; i < array.length; ++i)\n if (array[i] == elt) return i;\n return -1;\n }\n function map(array, f) {\n var out = [];\n for (var i = 0; i < array.length; i++) out[i] = f(array[i], i);\n return out;\n }\n\n function nothing() {}\n\n function createObj(base, props) {\n var inst;\n if (Object.create) {\n inst = Object.create(base);\n } else {\n nothing.prototype = base;\n inst = new nothing();\n }\n if (props) copyObj(props, inst);\n return inst;\n };\n\n function copyObj(obj, target, overwrite) {\n if (!target) target = {};\n for (var prop in obj)\n if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))\n target[prop] = obj[prop];\n return target;\n }\n\n function bind(f) {\n var args = Array.prototype.slice.call(arguments, 1);\n return function(){return f.apply(null, args);};\n }\n\n var nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;\n var isWordCharBasic = CodeMirror.isWordChar = function(ch) {\n return /\\w/.test(ch) || ch > \"\\x80\" &&\n (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch));\n };\n function isWordChar(ch, helper) {\n if (!helper) return isWordCharBasic(ch);\n if (helper.source.indexOf(\"\\\\w\") > -1 && isWordCharBasic(ch)) return true;\n return helper.test(ch);\n }\n\n function isEmpty(obj) {\n for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) return false;\n return true;\n }\n\n // Extending unicode characters. A series of a non-extending char +\n // any number of extending chars is treated as a single unit as far\n // as editing and measuring is concerned. This is not fully correct,\n // since some scripts/fonts/browsers also treat other configurations\n // of code points as a group.\n var extendingChars = /[\\u0300-\\u036f\\u0483-\\u0489\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u065e\\u0670\\u06d6-\\u06dc\\u06de-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07eb-\\u07f3\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0900-\\u0902\\u093c\\u0941-\\u0948\\u094d\\u0951-\\u0955\\u0962\\u0963\\u0981\\u09bc\\u09be\\u09c1-\\u09c4\\u09cd\\u09d7\\u09e2\\u09e3\\u0a01\\u0a02\\u0a3c\\u0a41\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a70\\u0a71\\u0a75\\u0a81\\u0a82\\u0abc\\u0ac1-\\u0ac5\\u0ac7\\u0ac8\\u0acd\\u0ae2\\u0ae3\\u0b01\\u0b3c\\u0b3e\\u0b3f\\u0b41-\\u0b44\\u0b4d\\u0b56\\u0b57\\u0b62\\u0b63\\u0b82\\u0bbe\\u0bc0\\u0bcd\\u0bd7\\u0c3e-\\u0c40\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0cbc\\u0cbf\\u0cc2\\u0cc6\\u0ccc\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0d3e\\u0d41-\\u0d44\\u0d4d\\u0d57\\u0d62\\u0d63\\u0dca\\u0dcf\\u0dd2-\\u0dd4\\u0dd6\\u0ddf\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0eb1\\u0eb4-\\u0eb9\\u0ebb\\u0ebc\\u0ec8-\\u0ecd\\u0f18\\u0f19\\u0f35\\u0f37\\u0f39\\u0f71-\\u0f7e\\u0f80-\\u0f84\\u0f86\\u0f87\\u0f90-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102d-\\u1030\\u1032-\\u1037\\u1039\\u103a\\u103d\\u103e\\u1058\\u1059\\u105e-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108d\\u109d\\u135f\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b7-\\u17bd\\u17c6\\u17c9-\\u17d3\\u17dd\\u180b-\\u180d\\u18a9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193b\\u1a17\\u1a18\\u1a56\\u1a58-\\u1a5e\\u1a60\\u1a62\\u1a65-\\u1a6c\\u1a73-\\u1a7c\\u1a7f\\u1b00-\\u1b03\\u1b34\\u1b36-\\u1b3a\\u1b3c\\u1b42\\u1b6b-\\u1b73\\u1b80\\u1b81\\u1ba2-\\u1ba5\\u1ba8\\u1ba9\\u1c2c-\\u1c33\\u1c36\\u1c37\\u1cd0-\\u1cd2\\u1cd4-\\u1ce0\\u1ce2-\\u1ce8\\u1ced\\u1dc0-\\u1de6\\u1dfd-\\u1dff\\u200c\\u200d\\u20d0-\\u20f0\\u2cef-\\u2cf1\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\ua66f-\\ua672\\ua67c\\ua67d\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua825\\ua826\\ua8c4\\ua8e0-\\ua8f1\\ua926-\\ua92d\\ua947-\\ua951\\ua980-\\ua982\\ua9b3\\ua9b6-\\ua9b9\\ua9bc\\uaa29-\\uaa2e\\uaa31\\uaa32\\uaa35\\uaa36\\uaa43\\uaa4c\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uabe5\\uabe8\\uabed\\udc00-\\udfff\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe26\\uff9e\\uff9f]/;\n function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch); }\n\n // DOM UTILITIES\n\n function elt(tag, content, className, style) {\n var e = document.createElement(tag);\n if (className) e.className = className;\n if (style) e.style.cssText = style;\n if (typeof content == \"string\") e.appendChild(document.createTextNode(content));\n else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]);\n return e;\n }\n\n var range;\n if (document.createRange) range = function(node, start, end, endNode) {\n var r = document.createRange();\n r.setEnd(endNode || node, end);\n r.setStart(node, start);\n return r;\n };\n else range = function(node, start, end) {\n var r = document.body.createTextRange();\n try { r.moveToElementText(node.parentNode); }\n catch(e) { return r; }\n r.collapse(true);\n r.moveEnd(\"character\", end);\n r.moveStart(\"character\", start);\n return r;\n };\n\n function removeChildren(e) {\n for (var count = e.childNodes.length; count > 0; --count)\n e.removeChild(e.firstChild);\n return e;\n }\n\n function removeChildrenAndAdd(parent, e) {\n return removeChildren(parent).appendChild(e);\n }\n\n var contains = CodeMirror.contains = function(parent, child) {\n if (child.nodeType == 3) // Android browser always returns false when child is a textnode\n child = child.parentNode;\n if (parent.contains)\n return parent.contains(child);\n do {\n if (child.nodeType == 11) child = child.host;\n if (child == parent) return true;\n } while (child = child.parentNode);\n };\n\n function activeElt() {\n var activeElement = document.activeElement;\n while (activeElement && activeElement.root && activeElement.root.activeElement)\n activeElement = activeElement.root.activeElement;\n return activeElement;\n }\n // Older versions of IE throws unspecified error when touching\n // document.activeElement in some cases (during loading, in iframe)\n if (ie && ie_version < 11) activeElt = function() {\n try { return document.activeElement; }\n catch(e) { return document.body; }\n };\n\n function classTest(cls) { return new RegExp(\"(^|\\\\s)\" + cls + \"(?:$|\\\\s)\\\\s*\"); }\n var rmClass = CodeMirror.rmClass = function(node, cls) {\n var current = node.className;\n var match = classTest(cls).exec(current);\n if (match) {\n var after = current.slice(match.index + match[0].length);\n node.className = current.slice(0, match.index) + (after ? match[1] + after : \"\");\n }\n };\n var addClass = CodeMirror.addClass = function(node, cls) {\n var current = node.className;\n if (!classTest(cls).test(current)) node.className += (current ? \" \" : \"\") + cls;\n };\n function joinClasses(a, b) {\n var as = a.split(\" \");\n for (var i = 0; i < as.length; i++)\n if (as[i] && !classTest(as[i]).test(b)) b += \" \" + as[i];\n return b;\n }\n\n // WINDOW-WIDE EVENTS\n\n // These must be handled carefully, because naively registering a\n // handler for each editor will cause the editors to never be\n // garbage collected.\n\n function forEachCodeMirror(f) {\n if (!document.body.getElementsByClassName) return;\n var byClass = document.body.getElementsByClassName(\"CodeMirror\");\n for (var i = 0; i < byClass.length; i++) {\n var cm = byClass[i].CodeMirror;\n if (cm) f(cm);\n }\n }\n\n var globalsRegistered = false;\n function ensureGlobalHandlers() {\n if (globalsRegistered) return;\n registerGlobalHandlers();\n globalsRegistered = true;\n }\n function registerGlobalHandlers() {\n // When the window resizes, we need to refresh active editors.\n var resizeTimer;\n on(window, \"resize\", function() {\n if (resizeTimer == null) resizeTimer = setTimeout(function() {\n resizeTimer = null;\n forEachCodeMirror(onResize);\n }, 100);\n });\n // When the window loses focus, we want to show the editor as blurred\n on(window, \"blur\", function() {\n forEachCodeMirror(onBlur);\n });\n }\n\n // FEATURE DETECTION\n\n // Detect drag-and-drop\n var dragAndDrop = function() {\n // There is *some* kind of drag-and-drop support in IE6-8, but I\n // couldn't get it to work yet.\n if (ie && ie_version < 9) return false;\n var div = elt('div');\n return \"draggable\" in div || \"dragDrop\" in div;\n }();\n\n var zwspSupported;\n function zeroWidthElement(measure) {\n if (zwspSupported == null) {\n var test = elt(\"span\", \"\\u200b\");\n removeChildrenAndAdd(measure, elt(\"span\", [test, document.createTextNode(\"x\")]));\n if (measure.firstChild.offsetHeight != 0)\n zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8);\n }\n var node = zwspSupported ? elt(\"span\", \"\\u200b\") :\n elt(\"span\", \"\\u00a0\", null, \"display: inline-block; width: 1px; margin-right: -1px\");\n node.setAttribute(\"cm-text\", \"\");\n return node;\n }\n\n // Feature-detect IE's crummy client rect reporting for bidi text\n var badBidiRects;\n function hasBadBidiRects(measure) {\n if (badBidiRects != null) return badBidiRects;\n var txt = removeChildrenAndAdd(measure, document.createTextNode(\"A\\u062eA\"));\n var r0 = range(txt, 0, 1).getBoundingClientRect();\n var r1 = range(txt, 1, 2).getBoundingClientRect();\n removeChildren(measure);\n if (!r0 || r0.left == r0.right) return false; // Safari returns null in some cases (#2780)\n return badBidiRects = (r1.right - r0.right < 3);\n }\n\n // See if \"\".split is the broken IE version, if so, provide an\n // alternative way to split lines.\n var splitLinesAuto = CodeMirror.splitLines = \"\\n\\nb\".split(/\\n/).length != 3 ? function(string) {\n var pos = 0, result = [], l = string.length;\n while (pos <= l) {\n var nl = string.indexOf(\"\\n\", pos);\n if (nl == -1) nl = string.length;\n var line = string.slice(pos, string.charAt(nl - 1) == \"\\r\" ? nl - 1 : nl);\n var rt = line.indexOf(\"\\r\");\n if (rt != -1) {\n result.push(line.slice(0, rt));\n pos += rt + 1;\n } else {\n result.push(line);\n pos = nl + 1;\n }\n }\n return result;\n } : function(string){return string.split(/\\r\\n?|\\n/);};\n\n var hasSelection = window.getSelection ? function(te) {\n try { return te.selectionStart != te.selectionEnd; }\n catch(e) { return false; }\n } : function(te) {\n try {var range = te.ownerDocument.selection.createRange();}\n catch(e) {}\n if (!range || range.parentElement() != te) return false;\n return range.compareEndPoints(\"StartToEnd\", range) != 0;\n };\n\n var hasCopyEvent = (function() {\n var e = elt(\"div\");\n if (\"oncopy\" in e) return true;\n e.setAttribute(\"oncopy\", \"return;\");\n return typeof e.oncopy == \"function\";\n })();\n\n var badZoomedRects = null;\n function hasBadZoomedRects(measure) {\n if (badZoomedRects != null) return badZoomedRects;\n var node = removeChildrenAndAdd(measure, elt(\"span\", \"x\"));\n var normal = node.getBoundingClientRect();\n var fromRange = range(node, 0, 1).getBoundingClientRect();\n return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1;\n }\n\n // KEY NAMES\n\n var keyNames = CodeMirror.keyNames = {\n 3: \"Enter\", 8: \"Backspace\", 9: \"Tab\", 13: \"Enter\", 16: \"Shift\", 17: \"Ctrl\", 18: \"Alt\",\n 19: \"Pause\", 20: \"CapsLock\", 27: \"Esc\", 32: \"Space\", 33: \"PageUp\", 34: \"PageDown\", 35: \"End\",\n 36: \"Home\", 37: \"Left\", 38: \"Up\", 39: \"Right\", 40: \"Down\", 44: \"PrintScrn\", 45: \"Insert\",\n 46: \"Delete\", 59: \";\", 61: \"=\", 91: \"Mod\", 92: \"Mod\", 93: \"Mod\",\n 106: \"*\", 107: \"=\", 109: \"-\", 110: \".\", 111: \"/\", 127: \"Delete\",\n 173: \"-\", 186: \";\", 187: \"=\", 188: \",\", 189: \"-\", 190: \".\", 191: \"/\", 192: \"`\", 219: \"[\", 220: \"\\\\\",\n 221: \"]\", 222: \"'\", 63232: \"Up\", 63233: \"Down\", 63234: \"Left\", 63235: \"Right\", 63272: \"Delete\",\n 63273: \"Home\", 63275: \"End\", 63276: \"PageUp\", 63277: \"PageDown\", 63302: \"Insert\"\n };\n (function() {\n // Number keys\n for (var i = 0; i < 10; i++) keyNames[i + 48] = keyNames[i + 96] = String(i);\n // Alphabetic keys\n for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i);\n // Function keys\n for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = \"F\" + i;\n })();\n\n // BIDI HELPERS\n\n function iterateBidiSections(order, from, to, f) {\n if (!order) return f(from, to, \"ltr\");\n var found = false;\n for (var i = 0; i < order.length; ++i) {\n var part = order[i];\n if (part.from < to && part.to > from || from == to && part.to == from) {\n f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? \"rtl\" : \"ltr\");\n found = true;\n }\n }\n if (!found) f(from, to, \"ltr\");\n }\n\n function bidiLeft(part) { return part.level % 2 ? part.to : part.from; }\n function bidiRight(part) { return part.level % 2 ? part.from : part.to; }\n\n function lineLeft(line) { var order = getOrder(line); return order ? bidiLeft(order[0]) : 0; }\n function lineRight(line) {\n var order = getOrder(line);\n if (!order) return line.text.length;\n return bidiRight(lst(order));\n }\n\n function lineStart(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLine(line);\n if (visual != line) lineN = lineNo(visual);\n var order = getOrder(visual);\n var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual);\n return Pos(lineN, ch);\n }\n function lineEnd(cm, lineN) {\n var merged, line = getLine(cm.doc, lineN);\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line;\n lineN = null;\n }\n var order = getOrder(line);\n var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line);\n return Pos(lineN == null ? lineNo(line) : lineN, ch);\n }\n function lineStartSmart(cm, pos) {\n var start = lineStart(cm, pos.line);\n var line = getLine(cm.doc, start.line);\n var order = getOrder(line);\n if (!order || order[0].level == 0) {\n var firstNonWS = Math.max(0, line.text.search(/\\S/));\n var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;\n return Pos(start.line, inWS ? 0 : firstNonWS);\n }\n return start;\n }\n\n function compareBidiLevel(order, a, b) {\n var linedir = order[0].level;\n if (a == linedir) return true;\n if (b == linedir) return false;\n return a < b;\n }\n var bidiOther;\n function getBidiPartAt(order, pos) {\n bidiOther = null;\n for (var i = 0, found; i < order.length; ++i) {\n var cur = order[i];\n if (cur.from < pos && cur.to > pos) return i;\n if ((cur.from == pos || cur.to == pos)) {\n if (found == null) {\n found = i;\n } else if (compareBidiLevel(order, cur.level, order[found].level)) {\n if (cur.from != cur.to) bidiOther = found;\n return i;\n } else {\n if (cur.from != cur.to) bidiOther = i;\n return found;\n }\n }\n }\n return found;\n }\n\n function moveInLine(line, pos, dir, byUnit) {\n if (!byUnit) return pos + dir;\n do pos += dir;\n while (pos > 0 && isExtendingChar(line.text.charAt(pos)));\n return pos;\n }\n\n // This is needed in order to move 'visually' through bi-directional\n // text -- i.e., pressing left should make the cursor go left, even\n // when in RTL text. The tricky part is the 'jumps', where RTL and\n // LTR text touch each other. This often requires the cursor offset\n // to move more than one unit, in order to visually move one unit.\n function moveVisually(line, start, dir, byUnit) {\n var bidi = getOrder(line);\n if (!bidi) return moveLogically(line, start, dir, byUnit);\n var pos = getBidiPartAt(bidi, start), part = bidi[pos];\n var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);\n\n for (;;) {\n if (target > part.from && target < part.to) return target;\n if (target == part.from || target == part.to) {\n if (getBidiPartAt(bidi, target) == pos) return target;\n part = bidi[pos += dir];\n return (dir > 0) == part.level % 2 ? part.to : part.from;\n } else {\n part = bidi[pos += dir];\n if (!part) return null;\n if ((dir > 0) == part.level % 2)\n target = moveInLine(line, part.to, -1, byUnit);\n else\n target = moveInLine(line, part.from, 1, byUnit);\n }\n }\n }\n\n function moveLogically(line, start, dir, byUnit) {\n var target = start + dir;\n if (byUnit) while (target > 0 && isExtendingChar(line.text.charAt(target))) target += dir;\n return target < 0 || target > line.text.length ? null : target;\n }\n\n // Bidirectional ordering algorithm\n // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm\n // that this (partially) implements.\n\n // One-char codes used for character types:\n // L (L): Left-to-Right\n // R (R): Right-to-Left\n // r (AL): Right-to-Left Arabic\n // 1 (EN): European Number\n // + (ES): European Number Separator\n // % (ET): European Number Terminator\n // n (AN): Arabic Number\n // , (CS): Common Number Separator\n // m (NSM): Non-Spacing Mark\n // b (BN): Boundary Neutral\n // s (B): Paragraph Separator\n // t (S): Segment Separator\n // w (WS): Whitespace\n // N (ON): Other Neutrals\n\n // Returns null if characters are ordered as they appear\n // (left-to-right), or an array of sections ({from, to, level}\n // objects) in the order in which they occur visually.\n var bidiOrdering = (function() {\n // Character types for codepoints 0 to 0xff\n var lowTypes = \"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN\";\n // Character types for codepoints 0x600 to 0x6ff\n var arabicTypes = \"rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm\";\n function charType(code) {\n if (code <= 0xf7) return lowTypes.charAt(code);\n else if (0x590 <= code && code <= 0x5f4) return \"R\";\n else if (0x600 <= code && code <= 0x6ed) return arabicTypes.charAt(code - 0x600);\n else if (0x6ee <= code && code <= 0x8ac) return \"r\";\n else if (0x2000 <= code && code <= 0x200b) return \"w\";\n else if (code == 0x200c) return \"b\";\n else return \"L\";\n }\n\n var bidiRE = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;\n // Browsers seem to always treat the boundaries of block elements as being L.\n var outerType = \"L\";\n\n function BidiSpan(level, from, to) {\n this.level = level;\n this.from = from; this.to = to;\n }\n\n return function(str) {\n if (!bidiRE.test(str)) return false;\n var len = str.length, types = [];\n for (var i = 0, type; i < len; ++i)\n types.push(type = charType(str.charCodeAt(i)));\n\n // W1. Examine each non-spacing mark (NSM) in the level run, and\n // change the type of the NSM to the type of the previous\n // character. If the NSM is at the start of the level run, it will\n // get the type of sor.\n for (var i = 0, prev = outerType; i < len; ++i) {\n var type = types[i];\n if (type == \"m\") types[i] = prev;\n else prev = type;\n }\n\n // W2. Search backwards from each instance of a European number\n // until the first strong type (R, L, AL, or sor) is found. If an\n // AL is found, change the type of the European number to Arabic\n // number.\n // W3. Change all ALs to R.\n for (var i = 0, cur = outerType; i < len; ++i) {\n var type = types[i];\n if (type == \"1\" && cur == \"r\") types[i] = \"n\";\n else if (isStrong.test(type)) { cur = type; if (type == \"r\") types[i] = \"R\"; }\n }\n\n // W4. A single European separator between two European numbers\n // changes to a European number. A single common separator between\n // two numbers of the same type changes to that type.\n for (var i = 1, prev = types[0]; i < len - 1; ++i) {\n var type = types[i];\n if (type == \"+\" && prev == \"1\" && types[i+1] == \"1\") types[i] = \"1\";\n else if (type == \",\" && prev == types[i+1] &&\n (prev == \"1\" || prev == \"n\")) types[i] = prev;\n prev = type;\n }\n\n // W5. A sequence of European terminators adjacent to European\n // numbers changes to all European numbers.\n // W6. Otherwise, separators and terminators change to Other\n // Neutral.\n for (var i = 0; i < len; ++i) {\n var type = types[i];\n if (type == \",\") types[i] = \"N\";\n else if (type == \"%\") {\n for (var end = i + 1; end < len && types[end] == \"%\"; ++end) {}\n var replace = (i && types[i-1] == \"!\") || (end < len && types[end] == \"1\") ? \"1\" : \"N\";\n for (var j = i; j < end; ++j) types[j] = replace;\n i = end - 1;\n }\n }\n\n // W7. Search backwards from each instance of a European number\n // until the first strong type (R, L, or sor) is found. If an L is\n // found, then change the type of the European number to L.\n for (var i = 0, cur = outerType; i < len; ++i) {\n var type = types[i];\n if (cur == \"L\" && type == \"1\") types[i] = \"L\";\n else if (isStrong.test(type)) cur = type;\n }\n\n // N1. A sequence of neutrals takes the direction of the\n // surrounding strong text if the text on both sides has the same\n // direction. European and Arabic numbers act as if they were R in\n // terms of their influence on neutrals. Start-of-level-run (sor)\n // and end-of-level-run (eor) are used at level run boundaries.\n // N2. Any remaining neutrals take the embedding direction.\n for (var i = 0; i < len; ++i) {\n if (isNeutral.test(types[i])) {\n for (var end = i + 1; end < len && isNeutral.test(types[end]); ++end) {}\n var before = (i ? types[i-1] : outerType) == \"L\";\n var after = (end < len ? types[end] : outerType) == \"L\";\n var replace = before || after ? \"L\" : \"R\";\n for (var j = i; j < end; ++j) types[j] = replace;\n i = end - 1;\n }\n }\n\n // Here we depart from the documented algorithm, in order to avoid\n // building up an actual levels array. Since there are only three\n // levels (0, 1, 2) in an implementation that doesn't take\n // explicit embedding into account, we can build up the order on\n // the fly, without following the level-based algorithm.\n var order = [], m;\n for (var i = 0; i < len;) {\n if (countsAsLeft.test(types[i])) {\n var start = i;\n for (++i; i < len && countsAsLeft.test(types[i]); ++i) {}\n order.push(new BidiSpan(0, start, i));\n } else {\n var pos = i, at = order.length;\n for (++i; i < len && types[i] != \"L\"; ++i) {}\n for (var j = pos; j < i;) {\n if (countsAsNum.test(types[j])) {\n if (pos < j) order.splice(at, 0, new BidiSpan(1, pos, j));\n var nstart = j;\n for (++j; j < i && countsAsNum.test(types[j]); ++j) {}\n order.splice(at, 0, new BidiSpan(2, nstart, j));\n pos = j;\n } else ++j;\n }\n if (pos < i) order.splice(at, 0, new BidiSpan(1, pos, i));\n }\n }\n if (order[0].level == 1 && (m = str.match(/^\\s+/))) {\n order[0].from = m[0].length;\n order.unshift(new BidiSpan(0, 0, m[0].length));\n }\n if (lst(order).level == 1 && (m = str.match(/\\s+$/))) {\n lst(order).to -= m[0].length;\n order.push(new BidiSpan(0, len - m[0].length, len));\n }\n if (order[0].level == 2)\n order.unshift(new BidiSpan(1, order[0].to, order[0].to));\n if (order[0].level != lst(order).level)\n order.push(new BidiSpan(order[0].level, len, len));\n\n return order;\n };\n })();\n\n // THE END\n\n CodeMirror.version = \"5.17.0\";\n\n return CodeMirror;\n});\n\n},{}],18:[function(require,module,exports){\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nCodeMirror.defineMode(\"css\", function(config, parserConfig) {\n var inline = parserConfig.inline\n if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode(\"text/css\");\n\n var indentUnit = config.indentUnit,\n tokenHooks = parserConfig.tokenHooks,\n documentTypes = parserConfig.documentTypes || {},\n mediaTypes = parserConfig.mediaTypes || {},\n mediaFeatures = parserConfig.mediaFeatures || {},\n mediaValueKeywords = parserConfig.mediaValueKeywords || {},\n propertyKeywords = parserConfig.propertyKeywords || {},\n nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},\n fontProperties = parserConfig.fontProperties || {},\n counterDescriptors = parserConfig.counterDescriptors || {},\n colorKeywords = parserConfig.colorKeywords || {},\n valueKeywords = parserConfig.valueKeywords || {},\n allowNested = parserConfig.allowNested,\n supportsAtComponent = parserConfig.supportsAtComponent === true;\n\n var type, override;\n function ret(style, tp) { type = tp; return style; }\n\n // Tokenizers\n\n function tokenBase(stream, state) {\n var ch = stream.next();\n if (tokenHooks[ch]) {\n var result = tokenHooks[ch](stream, state);\n if (result !== false) return result;\n }\n if (ch == \"@\") {\n stream.eatWhile(/[\\w\\\\\\-]/);\n return ret(\"def\", stream.current());\n } else if (ch == \"=\" || (ch == \"~\" || ch == \"|\") && stream.eat(\"=\")) {\n return ret(null, \"compare\");\n } else if (ch == \"\\\"\" || ch == \"'\") {\n state.tokenize = tokenString(ch);\n return state.tokenize(stream, state);\n } else if (ch == \"#\") {\n stream.eatWhile(/[\\w\\\\\\-]/);\n return ret(\"atom\", \"hash\");\n } else if (ch == \"!\") {\n stream.match(/^\\s*\\w*/);\n return ret(\"keyword\", \"important\");\n } else if (/\\d/.test(ch) || ch == \".\" && stream.eat(/\\d/)) {\n stream.eatWhile(/[\\w.%]/);\n return ret(\"number\", \"unit\");\n } else if (ch === \"-\") {\n if (/[\\d.]/.test(stream.peek())) {\n stream.eatWhile(/[\\w.%]/);\n return ret(\"number\", \"unit\");\n } else if (stream.match(/^-[\\w\\\\\\-]+/)) {\n stream.eatWhile(/[\\w\\\\\\-]/);\n if (stream.match(/^\\s*:/, false))\n return ret(\"variable-2\", \"variable-definition\");\n return ret(\"variable-2\", \"variable\");\n } else if (stream.match(/^\\w+-/)) {\n return ret(\"meta\", \"meta\");\n }\n } else if (/[,+>*\\/]/.test(ch)) {\n return ret(null, \"select-op\");\n } else if (ch == \".\" && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {\n return ret(\"qualifier\", \"qualifier\");\n } else if (/[:;{}\\[\\]\\(\\)]/.test(ch)) {\n return ret(null, ch);\n } else if ((ch == \"u\" && stream.match(/rl(-prefix)?\\(/)) ||\n (ch == \"d\" && stream.match(\"omain(\")) ||\n (ch == \"r\" && stream.match(\"egexp(\"))) {\n stream.backUp(1);\n state.tokenize = tokenParenthesized;\n return ret(\"property\", \"word\");\n } else if (/[\\w\\\\\\-]/.test(ch)) {\n stream.eatWhile(/[\\w\\\\\\-]/);\n return ret(\"property\", \"word\");\n } else {\n return ret(null, null);\n }\n }\n\n function tokenString(quote) {\n return function(stream, state) {\n var escaped = false, ch;\n while ((ch = stream.next()) != null) {\n if (ch == quote && !escaped) {\n if (quote == \")\") stream.backUp(1);\n break;\n }\n escaped = !escaped && ch == \"\\\\\";\n }\n if (ch == quote || !escaped && quote != \")\") state.tokenize = null;\n return ret(\"string\", \"string\");\n };\n }\n\n function tokenParenthesized(stream, state) {\n stream.next(); // Must be '('\n if (!stream.match(/\\s*[\\\"\\')]/, false))\n state.tokenize = tokenString(\")\");\n else\n state.tokenize = null;\n return ret(null, \"(\");\n }\n\n // Context management\n\n function Context(type, indent, prev) {\n this.type = type;\n this.indent = indent;\n this.prev = prev;\n }\n\n function pushContext(state, stream, type, indent) {\n state.context = new Context(type, stream.indentation() + (indent === false ? 0 : indentUnit), state.context);\n return type;\n }\n\n function popContext(state) {\n if (state.context.prev)\n state.context = state.context.prev;\n return state.context.type;\n }\n\n function pass(type, stream, state) {\n return states[state.context.type](type, stream, state);\n }\n function popAndPass(type, stream, state, n) {\n for (var i = n || 1; i > 0; i--)\n state.context = state.context.prev;\n return pass(type, stream, state);\n }\n\n // Parser\n\n function wordAsValue(stream) {\n var word = stream.current().toLowerCase();\n if (valueKeywords.hasOwnProperty(word))\n override = \"atom\";\n else if (colorKeywords.hasOwnProperty(word))\n override = \"keyword\";\n else\n override = \"variable\";\n }\n\n var states = {};\n\n states.top = function(type, stream, state) {\n if (type == \"{\") {\n return pushContext(state, stream, \"block\");\n } else if (type == \"}\" && state.context.prev) {\n return popContext(state);\n } else if (supportsAtComponent && /@component/.test(type)) {\n return pushContext(state, stream, \"atComponentBlock\");\n } else if (/^@(-moz-)?document$/.test(type)) {\n return pushContext(state, stream, \"documentTypes\");\n } else if (/^@(media|supports|(-moz-)?document|import)$/.test(type)) {\n return pushContext(state, stream, \"atBlock\");\n } else if (/^@(font-face|counter-style)/.test(type)) {\n state.stateArg = type;\n return \"restricted_atBlock_before\";\n } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {\n return \"keyframes\";\n } else if (type && type.charAt(0) == \"@\") {\n return pushContext(state, stream, \"at\");\n } else if (type == \"hash\") {\n override = \"builtin\";\n } else if (type == \"word\") {\n override = \"tag\";\n } else if (type == \"variable-definition\") {\n return \"maybeprop\";\n } else if (type == \"interpolation\") {\n return pushContext(state, stream, \"interpolation\");\n } else if (type == \":\") {\n return \"pseudo\";\n } else if (allowNested && type == \"(\") {\n return pushContext(state, stream, \"parens\");\n }\n return state.context.type;\n };\n\n states.block = function(type, stream, state) {\n if (type == \"word\") {\n var word = stream.current().toLowerCase();\n if (propertyKeywords.hasOwnProperty(word)) {\n override = \"property\";\n return \"maybeprop\";\n } else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {\n override = \"string-2\";\n return \"maybeprop\";\n } else if (allowNested) {\n override = stream.match(/^\\s*:(?:\\s|$)/, false) ? \"property\" : \"tag\";\n return \"block\";\n } else {\n override += \" error\";\n return \"maybeprop\";\n }\n } else if (type == \"meta\") {\n return \"block\";\n } else if (!allowNested && (type == \"hash\" || type == \"qualifier\")) {\n override = \"error\";\n return \"block\";\n } else {\n return states.top(type, stream, state);\n }\n };\n\n states.maybeprop = function(type, stream, state) {\n if (type == \":\") return pushContext(state, stream, \"prop\");\n return pass(type, stream, state);\n };\n\n states.prop = function(type, stream, state) {\n if (type == \";\") return popContext(state);\n if (type == \"{\" && allowNested) return pushContext(state, stream, \"propBlock\");\n if (type == \"}\" || type == \"{\") return popAndPass(type, stream, state);\n if (type == \"(\") return pushContext(state, stream, \"parens\");\n\n if (type == \"hash\" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) {\n override += \" error\";\n } else if (type == \"word\") {\n wordAsValue(stream);\n } else if (type == \"interpolation\") {\n return pushContext(state, stream, \"interpolation\");\n }\n return \"prop\";\n };\n\n states.propBlock = function(type, _stream, state) {\n if (type == \"}\") return popContext(state);\n if (type == \"word\") { override = \"property\"; return \"maybeprop\"; }\n return state.context.type;\n };\n\n states.parens = function(type, stream, state) {\n if (type == \"{\" || type == \"}\") return popAndPass(type, stream, state);\n if (type == \")\") return popContext(state);\n if (type == \"(\") return pushContext(state, stream, \"parens\");\n if (type == \"interpolation\") return pushContext(state, stream, \"interpolation\");\n if (type == \"word\") wordAsValue(stream);\n return \"parens\";\n };\n\n states.pseudo = function(type, stream, state) {\n if (type == \"word\") {\n override = \"variable-3\";\n return state.context.type;\n }\n return pass(type, stream, state);\n };\n\n states.documentTypes = function(type, stream, state) {\n if (type == \"word\" && documentTypes.hasOwnProperty(stream.current())) {\n override = \"tag\";\n return state.context.type;\n } else {\n return states.atBlock(type, stream, state);\n }\n };\n\n states.atBlock = function(type, stream, state) {\n if (type == \"(\") return pushContext(state, stream, \"atBlock_parens\");\n if (type == \"}\" || type == \";\") return popAndPass(type, stream, state);\n if (type == \"{\") return popContext(state) && pushContext(state, stream, allowNested ? \"block\" : \"top\");\n\n if (type == \"interpolation\") return pushContext(state, stream, \"interpolation\");\n\n if (type == \"word\") {\n var word = stream.current().toLowerCase();\n if (word == \"only\" || word == \"not\" || word == \"and\" || word == \"or\")\n override = \"keyword\";\n else if (mediaTypes.hasOwnProperty(word))\n override = \"attribute\";\n else if (mediaFeatures.hasOwnProperty(word))\n override = \"property\";\n else if (mediaValueKeywords.hasOwnProperty(word))\n override = \"keyword\";\n else if (propertyKeywords.hasOwnProperty(word))\n override = \"property\";\n else if (nonStandardPropertyKeywords.hasOwnProperty(word))\n override = \"string-2\";\n else if (valueKeywords.hasOwnProperty(word))\n override = \"atom\";\n else if (colorKeywords.hasOwnProperty(word))\n override = \"keyword\";\n else\n override = \"error\";\n }\n return state.context.type;\n };\n\n states.atComponentBlock = function(type, stream, state) {\n if (type == \"}\")\n return popAndPass(type, stream, state);\n if (type == \"{\")\n return popContext(state) && pushContext(state, stream, allowNested ? \"block\" : \"top\", false);\n if (type == \"word\")\n override = \"error\";\n return state.context.type;\n };\n\n states.atBlock_parens = function(type, stream, state) {\n if (type == \")\") return popContext(state);\n if (type == \"{\" || type == \"}\") return popAndPass(type, stream, state, 2);\n return states.atBlock(type, stream, state);\n };\n\n states.restricted_atBlock_before = function(type, stream, state) {\n if (type == \"{\")\n return pushContext(state, stream, \"restricted_atBlock\");\n if (type == \"word\" && state.stateArg == \"@counter-style\") {\n override = \"variable\";\n return \"restricted_atBlock_before\";\n }\n return pass(type, stream, state);\n };\n\n states.restricted_atBlock = function(type, stream, state) {\n if (type == \"}\") {\n state.stateArg = null;\n return popContext(state);\n }\n if (type == \"word\") {\n if ((state.stateArg == \"@font-face\" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) ||\n (state.stateArg == \"@counter-style\" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase())))\n override = \"error\";\n else\n override = \"property\";\n return \"maybeprop\";\n }\n return \"restricted_atBlock\";\n };\n\n states.keyframes = function(type, stream, state) {\n if (type == \"word\") { override = \"variable\"; return \"keyframes\"; }\n if (type == \"{\") return pushContext(state, stream, \"top\");\n return pass(type, stream, state);\n };\n\n states.at = function(type, stream, state) {\n if (type == \";\") return popContext(state);\n if (type == \"{\" || type == \"}\") return popAndPass(type, stream, state);\n if (type == \"word\") override = \"tag\";\n else if (type == \"hash\") override = \"builtin\";\n return \"at\";\n };\n\n states.interpolation = function(type, stream, state) {\n if (type == \"}\") return popContext(state);\n if (type == \"{\" || type == \";\") return popAndPass(type, stream, state);\n if (type == \"word\") override = \"variable\";\n else if (type != \"variable\" && type != \"(\" && type != \")\") override = \"error\";\n return \"interpolation\";\n };\n\n return {\n startState: function(base) {\n return {tokenize: null,\n state: inline ? \"block\" : \"top\",\n stateArg: null,\n context: new Context(inline ? \"block\" : \"top\", base || 0, null)};\n },\n\n token: function(stream, state) {\n if (!state.tokenize && stream.eatSpace()) return null;\n var style = (state.tokenize || tokenBase)(stream, state);\n if (style && typeof style == \"object\") {\n type = style[1];\n style = style[0];\n }\n override = style;\n state.state = states[state.state](type, stream, state);\n return override;\n },\n\n indent: function(state, textAfter) {\n var cx = state.context, ch = textAfter && textAfter.charAt(0);\n var indent = cx.indent;\n if (cx.type == \"prop\" && (ch == \"}\" || ch == \")\")) cx = cx.prev;\n if (cx.prev) {\n if (ch == \"}\" && (cx.type == \"block\" || cx.type == \"top\" ||\n cx.type == \"interpolation\" || cx.type == \"restricted_atBlock\")) {\n // Resume indentation from parent context.\n cx = cx.prev;\n indent = cx.indent;\n } else if (ch == \")\" && (cx.type == \"parens\" || cx.type == \"atBlock_parens\") ||\n ch == \"{\" && (cx.type == \"at\" || cx.type == \"atBlock\")) {\n // Dedent relative to current context.\n indent = Math.max(0, cx.indent - indentUnit);\n cx = cx.prev;\n }\n }\n return indent;\n },\n\n electricChars: \"}\",\n blockCommentStart: \"/*\",\n blockCommentEnd: \"*/\",\n fold: \"brace\"\n };\n});\n\n function keySet(array) {\n var keys = {};\n for (var i = 0; i < array.length; ++i) {\n keys[array[i]] = true;\n }\n return keys;\n }\n\n var documentTypes_ = [\n \"domain\", \"regexp\", \"url\", \"url-prefix\"\n ], documentTypes = keySet(documentTypes_);\n\n var mediaTypes_ = [\n \"all\", \"aural\", \"braille\", \"handheld\", \"print\", \"projection\", \"screen\",\n \"tty\", \"tv\", \"embossed\"\n ], mediaTypes = keySet(mediaTypes_);\n\n var mediaFeatures_ = [\n \"width\", \"min-width\", \"max-width\", \"height\", \"min-height\", \"max-height\",\n \"device-width\", \"min-device-width\", \"max-device-width\", \"device-height\",\n \"min-device-height\", \"max-device-height\", \"aspect-ratio\",\n \"min-aspect-ratio\", \"max-aspect-ratio\", \"device-aspect-ratio\",\n \"min-device-aspect-ratio\", \"max-device-aspect-ratio\", \"color\", \"min-color\",\n \"max-color\", \"color-index\", \"min-color-index\", \"max-color-index\",\n \"monochrome\", \"min-monochrome\", \"max-monochrome\", \"resolution\",\n \"min-resolution\", \"max-resolution\", \"scan\", \"grid\", \"orientation\",\n \"device-pixel-ratio\", \"min-device-pixel-ratio\", \"max-device-pixel-ratio\",\n \"pointer\", \"any-pointer\", \"hover\", \"any-hover\"\n ], mediaFeatures = keySet(mediaFeatures_);\n\n var mediaValueKeywords_ = [\n \"landscape\", \"portrait\", \"none\", \"coarse\", \"fine\", \"on-demand\", \"hover\",\n \"interlace\", \"progressive\"\n ], mediaValueKeywords = keySet(mediaValueKeywords_);\n\n var propertyKeywords_ = [\n \"align-content\", \"align-items\", \"align-self\", \"alignment-adjust\",\n \"alignment-baseline\", \"anchor-point\", \"animation\", \"animation-delay\",\n \"animation-direction\", \"animation-duration\", \"animation-fill-mode\",\n \"animation-iteration-count\", \"animation-name\", \"animation-play-state\",\n \"animation-timing-function\", \"appearance\", \"azimuth\", \"backface-visibility\",\n \"background\", \"background-attachment\", \"background-blend-mode\", \"background-clip\",\n \"background-color\", \"background-image\", \"background-origin\", \"background-position\",\n \"background-repeat\", \"background-size\", \"baseline-shift\", \"binding\",\n \"bleed\", \"bookmark-label\", \"bookmark-level\", \"bookmark-state\",\n \"bookmark-target\", \"border\", \"border-bottom\", \"border-bottom-color\",\n \"border-bottom-left-radius\", \"border-bottom-right-radius\",\n \"border-bottom-style\", \"border-bottom-width\", \"border-collapse\",\n \"border-color\", \"border-image\", \"border-image-outset\",\n \"border-image-repeat\", \"border-image-slice\", \"border-image-source\",\n \"border-image-width\", \"border-left\", \"border-left-color\",\n \"border-left-style\", \"border-left-width\", \"border-radius\", \"border-right\",\n \"border-right-color\", \"border-right-style\", \"border-right-width\",\n \"border-spacing\", \"border-style\", \"border-top\", \"border-top-color\",\n \"border-top-left-radius\", \"border-top-right-radius\", \"border-top-style\",\n \"border-top-width\", \"border-width\", \"bottom\", \"box-decoration-break\",\n \"box-shadow\", \"box-sizing\", \"break-after\", \"break-before\", \"break-inside\",\n \"caption-side\", \"clear\", \"clip\", \"color\", \"color-profile\", \"column-count\",\n \"column-fill\", \"column-gap\", \"column-rule\", \"column-rule-color\",\n \"column-rule-style\", \"column-rule-width\", \"column-span\", \"column-width\",\n \"columns\", \"content\", \"counter-increment\", \"counter-reset\", \"crop\", \"cue\",\n \"cue-after\", \"cue-before\", \"cursor\", \"direction\", \"display\",\n \"dominant-baseline\", \"drop-initial-after-adjust\",\n \"drop-initial-after-align\", \"drop-initial-before-adjust\",\n \"drop-initial-before-align\", \"drop-initial-size\", \"drop-initial-value\",\n \"elevation\", \"empty-cells\", \"fit\", \"fit-position\", \"flex\", \"flex-basis\",\n \"flex-direction\", \"flex-flow\", \"flex-grow\", \"flex-shrink\", \"flex-wrap\",\n \"float\", \"float-offset\", \"flow-from\", \"flow-into\", \"font\", \"font-feature-settings\",\n \"font-family\", \"font-kerning\", \"font-language-override\", \"font-size\", \"font-size-adjust\",\n \"font-stretch\", \"font-style\", \"font-synthesis\", \"font-variant\",\n \"font-variant-alternates\", \"font-variant-caps\", \"font-variant-east-asian\",\n \"font-variant-ligatures\", \"font-variant-numeric\", \"font-variant-position\",\n \"font-weight\", \"grid\", \"grid-area\", \"grid-auto-columns\", \"grid-auto-flow\",\n \"grid-auto-rows\", \"grid-column\", \"grid-column-end\", \"grid-column-gap\",\n \"grid-column-start\", \"grid-gap\", \"grid-row\", \"grid-row-end\", \"grid-row-gap\",\n \"grid-row-start\", \"grid-template\", \"grid-template-areas\", \"grid-template-columns\",\n \"grid-template-rows\", \"hanging-punctuation\", \"height\", \"hyphens\",\n \"icon\", \"image-orientation\", \"image-rendering\", \"image-resolution\",\n \"inline-box-align\", \"justify-content\", \"left\", \"letter-spacing\",\n \"line-break\", \"line-height\", \"line-stacking\", \"line-stacking-ruby\",\n \"line-stacking-shift\", \"line-stacking-strategy\", \"list-style\",\n \"list-style-image\", \"list-style-position\", \"list-style-type\", \"margin\",\n \"margin-bottom\", \"margin-left\", \"margin-right\", \"margin-top\",\n \"marker-offset\", \"marks\", \"marquee-direction\", \"marquee-loop\",\n \"marquee-play-count\", \"marquee-speed\", \"marquee-style\", \"max-height\",\n \"max-width\", \"min-height\", \"min-width\", \"move-to\", \"nav-down\", \"nav-index\",\n \"nav-left\", \"nav-right\", \"nav-up\", \"object-fit\", \"object-position\",\n \"opacity\", \"order\", \"orphans\", \"outline\",\n \"outline-color\", \"outline-offset\", \"outline-style\", \"outline-width\",\n \"overflow\", \"overflow-style\", \"overflow-wrap\", \"overflow-x\", \"overflow-y\",\n \"padding\", \"padding-bottom\", \"padding-left\", \"padding-right\", \"padding-top\",\n \"page\", \"page-break-after\", \"page-break-before\", \"page-break-inside\",\n \"page-policy\", \"pause\", \"pause-after\", \"pause-before\", \"perspective\",\n \"perspective-origin\", \"pitch\", \"pitch-range\", \"play-during\", \"position\",\n \"presentation-level\", \"punctuation-trim\", \"quotes\", \"region-break-after\",\n \"region-break-before\", \"region-break-inside\", \"region-fragment\",\n \"rendering-intent\", \"resize\", \"rest\", \"rest-after\", \"rest-before\", \"richness\",\n \"right\", \"rotation\", \"rotation-point\", \"ruby-align\", \"ruby-overhang\",\n \"ruby-position\", \"ruby-span\", \"shape-image-threshold\", \"shape-inside\", \"shape-margin\",\n \"shape-outside\", \"size\", \"speak\", \"speak-as\", \"speak-header\",\n \"speak-numeral\", \"speak-punctuation\", \"speech-rate\", \"stress\", \"string-set\",\n \"tab-size\", \"table-layout\", \"target\", \"target-name\", \"target-new\",\n \"target-position\", \"text-align\", \"text-align-last\", \"text-decoration\",\n \"text-decoration-color\", \"text-decoration-line\", \"text-decoration-skip\",\n \"text-decoration-style\", \"text-emphasis\", \"text-emphasis-color\",\n \"text-emphasis-position\", \"text-emphasis-style\", \"text-height\",\n \"text-indent\", \"text-justify\", \"text-outline\", \"text-overflow\", \"text-shadow\",\n \"text-size-adjust\", \"text-space-collapse\", \"text-transform\", \"text-underline-position\",\n \"text-wrap\", \"top\", \"transform\", \"transform-origin\", \"transform-style\",\n \"transition\", \"transition-delay\", \"transition-duration\",\n \"transition-property\", \"transition-timing-function\", \"unicode-bidi\",\n \"vertical-align\", \"visibility\", \"voice-balance\", \"voice-duration\",\n \"voice-family\", \"voice-pitch\", \"voice-range\", \"voice-rate\", \"voice-stress\",\n \"voice-volume\", \"volume\", \"white-space\", \"widows\", \"width\", \"word-break\",\n \"word-spacing\", \"word-wrap\", \"z-index\",\n // SVG-specific\n \"clip-path\", \"clip-rule\", \"mask\", \"enable-background\", \"filter\", \"flood-color\",\n \"flood-opacity\", \"lighting-color\", \"stop-color\", \"stop-opacity\", \"pointer-events\",\n \"color-interpolation\", \"color-interpolation-filters\",\n \"color-rendering\", \"fill\", \"fill-opacity\", \"fill-rule\", \"image-rendering\",\n \"marker\", \"marker-end\", \"marker-mid\", \"marker-start\", \"shape-rendering\", \"stroke\",\n \"stroke-dasharray\", \"stroke-dashoffset\", \"stroke-linecap\", \"stroke-linejoin\",\n \"stroke-miterlimit\", \"stroke-opacity\", \"stroke-width\", \"text-rendering\",\n \"baseline-shift\", \"dominant-baseline\", \"glyph-orientation-horizontal\",\n \"glyph-orientation-vertical\", \"text-anchor\", \"writing-mode\"\n ], propertyKeywords = keySet(propertyKeywords_);\n\n var nonStandardPropertyKeywords_ = [\n \"scrollbar-arrow-color\", \"scrollbar-base-color\", \"scrollbar-dark-shadow-color\",\n \"scrollbar-face-color\", \"scrollbar-highlight-color\", \"scrollbar-shadow-color\",\n \"scrollbar-3d-light-color\", \"scrollbar-track-color\", \"shape-inside\",\n \"searchfield-cancel-button\", \"searchfield-decoration\", \"searchfield-results-button\",\n \"searchfield-results-decoration\", \"zoom\"\n ], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);\n\n var fontProperties_ = [\n \"font-family\", \"src\", \"unicode-range\", \"font-variant\", \"font-feature-settings\",\n \"font-stretch\", \"font-weight\", \"font-style\"\n ], fontProperties = keySet(fontProperties_);\n\n var counterDescriptors_ = [\n \"additive-symbols\", \"fallback\", \"negative\", \"pad\", \"prefix\", \"range\",\n \"speak-as\", \"suffix\", \"symbols\", \"system\"\n ], counterDescriptors = keySet(counterDescriptors_);\n\n var colorKeywords_ = [\n \"aliceblue\", \"antiquewhite\", \"aqua\", \"aquamarine\", \"azure\", \"beige\",\n \"bisque\", \"black\", \"blanchedalmond\", \"blue\", \"blueviolet\", \"brown\",\n \"burlywood\", \"cadetblue\", \"chartreuse\", \"chocolate\", \"coral\", \"cornflowerblue\",\n \"cornsilk\", \"crimson\", \"cyan\", \"darkblue\", \"darkcyan\", \"darkgoldenrod\",\n \"darkgray\", \"darkgreen\", \"darkkhaki\", \"darkmagenta\", \"darkolivegreen\",\n \"darkorange\", \"darkorchid\", \"darkred\", \"darksalmon\", \"darkseagreen\",\n \"darkslateblue\", \"darkslategray\", \"darkturquoise\", \"darkviolet\",\n \"deeppink\", \"deepskyblue\", \"dimgray\", \"dodgerblue\", \"firebrick\",\n \"floralwhite\", \"forestgreen\", \"fuchsia\", \"gainsboro\", \"ghostwhite\",\n \"gold\", \"goldenrod\", \"gray\", \"grey\", \"green\", \"greenyellow\", \"honeydew\",\n \"hotpink\", \"indianred\", \"indigo\", \"ivory\", \"khaki\", \"lavender\",\n \"lavenderblush\", \"lawngreen\", \"lemonchiffon\", \"lightblue\", \"lightcoral\",\n \"lightcyan\", \"lightgoldenrodyellow\", \"lightgray\", \"lightgreen\", \"lightpink\",\n \"lightsalmon\", \"lightseagreen\", \"lightskyblue\", \"lightslategray\",\n \"lightsteelblue\", \"lightyellow\", \"lime\", \"limegreen\", \"linen\", \"magenta\",\n \"maroon\", \"mediumaquamarine\", \"mediumblue\", \"mediumorchid\", \"mediumpurple\",\n \"mediumseagreen\", \"mediumslateblue\", \"mediumspringgreen\", \"mediumturquoise\",\n \"mediumvioletred\", \"midnightblue\", \"mintcream\", \"mistyrose\", \"moccasin\",\n \"navajowhite\", \"navy\", \"oldlace\", \"olive\", \"olivedrab\", \"orange\", \"orangered\",\n \"orchid\", \"palegoldenrod\", \"palegreen\", \"paleturquoise\", \"palevioletred\",\n \"papayawhip\", \"peachpuff\", \"peru\", \"pink\", \"plum\", \"powderblue\",\n \"purple\", \"rebeccapurple\", \"red\", \"rosybrown\", \"royalblue\", \"saddlebrown\",\n \"salmon\", \"sandybrown\", \"seagreen\", \"seashell\", \"sienna\", \"silver\", \"skyblue\",\n \"slateblue\", \"slategray\", \"snow\", \"springgreen\", \"steelblue\", \"tan\",\n \"teal\", \"thistle\", \"tomato\", \"turquoise\", \"violet\", \"wheat\", \"white\",\n \"whitesmoke\", \"yellow\", \"yellowgreen\"\n ], colorKeywords = keySet(colorKeywords_);\n\n var valueKeywords_ = [\n \"above\", \"absolute\", \"activeborder\", \"additive\", \"activecaption\", \"afar\",\n \"after-white-space\", \"ahead\", \"alias\", \"all\", \"all-scroll\", \"alphabetic\", \"alternate\",\n \"always\", \"amharic\", \"amharic-abegede\", \"antialiased\", \"appworkspace\",\n \"arabic-indic\", \"armenian\", \"asterisks\", \"attr\", \"auto\", \"avoid\", \"avoid-column\", \"avoid-page\",\n \"avoid-region\", \"background\", \"backwards\", \"baseline\", \"below\", \"bidi-override\", \"binary\",\n \"bengali\", \"blink\", \"block\", \"block-axis\", \"bold\", \"bolder\", \"border\", \"border-box\",\n \"both\", \"bottom\", \"break\", \"break-all\", \"break-word\", \"bullets\", \"button\", \"button-bevel\",\n \"buttonface\", \"buttonhighlight\", \"buttonshadow\", \"buttontext\", \"calc\", \"cambodian\",\n \"capitalize\", \"caps-lock-indicator\", \"caption\", \"captiontext\", \"caret\",\n \"cell\", \"center\", \"checkbox\", \"circle\", \"cjk-decimal\", \"cjk-earthly-branch\",\n \"cjk-heavenly-stem\", \"cjk-ideographic\", \"clear\", \"clip\", \"close-quote\",\n \"col-resize\", \"collapse\", \"color\", \"color-burn\", \"color-dodge\", \"column\", \"column-reverse\",\n \"compact\", \"condensed\", \"contain\", \"content\",\n \"content-box\", \"context-menu\", \"continuous\", \"copy\", \"counter\", \"counters\", \"cover\", \"crop\",\n \"cross\", \"crosshair\", \"currentcolor\", \"cursive\", \"cyclic\", \"darken\", \"dashed\", \"decimal\",\n \"decimal-leading-zero\", \"default\", \"default-button\", \"dense\", \"destination-atop\",\n \"destination-in\", \"destination-out\", \"destination-over\", \"devanagari\", \"difference\",\n \"disc\", \"discard\", \"disclosure-closed\", \"disclosure-open\", \"document\",\n \"dot-dash\", \"dot-dot-dash\",\n \"dotted\", \"double\", \"down\", \"e-resize\", \"ease\", \"ease-in\", \"ease-in-out\", \"ease-out\",\n \"element\", \"ellipse\", \"ellipsis\", \"embed\", \"end\", \"ethiopic\", \"ethiopic-abegede\",\n \"ethiopic-abegede-am-et\", \"ethiopic-abegede-gez\", \"ethiopic-abegede-ti-er\",\n \"ethiopic-abegede-ti-et\", \"ethiopic-halehame-aa-er\",\n \"ethiopic-halehame-aa-et\", \"ethiopic-halehame-am-et\",\n \"ethiopic-halehame-gez\", \"ethiopic-halehame-om-et\",\n \"ethiopic-halehame-sid-et\", \"ethiopic-halehame-so-et\",\n \"ethiopic-halehame-ti-er\", \"ethiopic-halehame-ti-et\", \"ethiopic-halehame-tig\",\n \"ethiopic-numeric\", \"ew-resize\", \"exclusion\", \"expanded\", \"extends\", \"extra-condensed\",\n \"extra-expanded\", \"fantasy\", \"fast\", \"fill\", \"fixed\", \"flat\", \"flex\", \"flex-end\", \"flex-start\", \"footnotes\",\n \"forwards\", \"from\", \"geometricPrecision\", \"georgian\", \"graytext\", \"grid\", \"groove\",\n \"gujarati\", \"gurmukhi\", \"hand\", \"hangul\", \"hangul-consonant\", \"hard-light\", \"hebrew\",\n \"help\", \"hidden\", \"hide\", \"higher\", \"highlight\", \"highlighttext\",\n \"hiragana\", \"hiragana-iroha\", \"horizontal\", \"hsl\", \"hsla\", \"hue\", \"icon\", \"ignore\",\n \"inactiveborder\", \"inactivecaption\", \"inactivecaptiontext\", \"infinite\",\n \"infobackground\", \"infotext\", \"inherit\", \"initial\", \"inline\", \"inline-axis\",\n \"inline-block\", \"inline-flex\", \"inline-grid\", \"inline-table\", \"inset\", \"inside\", \"intrinsic\", \"invert\",\n \"italic\", \"japanese-formal\", \"japanese-informal\", \"justify\", \"kannada\",\n \"katakana\", \"katakana-iroha\", \"keep-all\", \"khmer\",\n \"korean-hangul-formal\", \"korean-hanja-formal\", \"korean-hanja-informal\",\n \"landscape\", \"lao\", \"large\", \"larger\", \"left\", \"level\", \"lighter\", \"lighten\",\n \"line-through\", \"linear\", \"linear-gradient\", \"lines\", \"list-item\", \"listbox\", \"listitem\",\n \"local\", \"logical\", \"loud\", \"lower\", \"lower-alpha\", \"lower-armenian\",\n \"lower-greek\", \"lower-hexadecimal\", \"lower-latin\", \"lower-norwegian\",\n \"lower-roman\", \"lowercase\", \"ltr\", \"luminosity\", \"malayalam\", \"match\", \"matrix\", \"matrix3d\",\n \"media-controls-background\", \"media-current-time-display\",\n \"media-fullscreen-button\", \"media-mute-button\", \"media-play-button\",\n \"media-return-to-realtime-button\", \"media-rewind-button\",\n \"media-seek-back-button\", \"media-seek-forward-button\", \"media-slider\",\n \"media-sliderthumb\", \"media-time-remaining-display\", \"media-volume-slider\",\n \"media-volume-slider-container\", \"media-volume-sliderthumb\", \"medium\",\n \"menu\", \"menulist\", \"menulist-button\", \"menulist-text\",\n \"menulist-textfield\", \"menutext\", \"message-box\", \"middle\", \"min-intrinsic\",\n \"mix\", \"mongolian\", \"monospace\", \"move\", \"multiple\", \"multiply\", \"myanmar\", \"n-resize\",\n \"narrower\", \"ne-resize\", \"nesw-resize\", \"no-close-quote\", \"no-drop\",\n \"no-open-quote\", \"no-repeat\", \"none\", \"normal\", \"not-allowed\", \"nowrap\",\n \"ns-resize\", \"numbers\", \"numeric\", \"nw-resize\", \"nwse-resize\", \"oblique\", \"octal\", \"open-quote\",\n \"optimizeLegibility\", \"optimizeSpeed\", \"oriya\", \"oromo\", \"outset\",\n \"outside\", \"outside-shape\", \"overlay\", \"overline\", \"padding\", \"padding-box\",\n \"painted\", \"page\", \"paused\", \"persian\", \"perspective\", \"plus-darker\", \"plus-lighter\",\n \"pointer\", \"polygon\", \"portrait\", \"pre\", \"pre-line\", \"pre-wrap\", \"preserve-3d\",\n \"progress\", \"push-button\", \"radial-gradient\", \"radio\", \"read-only\",\n \"read-write\", \"read-write-plaintext-only\", \"rectangle\", \"region\",\n \"relative\", \"repeat\", \"repeating-linear-gradient\",\n \"repeating-radial-gradient\", \"repeat-x\", \"repeat-y\", \"reset\", \"reverse\",\n \"rgb\", \"rgba\", \"ridge\", \"right\", \"rotate\", \"rotate3d\", \"rotateX\", \"rotateY\",\n \"rotateZ\", \"round\", \"row\", \"row-resize\", \"row-reverse\", \"rtl\", \"run-in\", \"running\",\n \"s-resize\", \"sans-serif\", \"saturation\", \"scale\", \"scale3d\", \"scaleX\", \"scaleY\", \"scaleZ\", \"screen\",\n \"scroll\", \"scrollbar\", \"se-resize\", \"searchfield\",\n \"searchfield-cancel-button\", \"searchfield-decoration\",\n \"searchfield-results-button\", \"searchfield-results-decoration\",\n \"semi-condensed\", \"semi-expanded\", \"separate\", \"serif\", \"show\", \"sidama\",\n \"simp-chinese-formal\", \"simp-chinese-informal\", \"single\",\n \"skew\", \"skewX\", \"skewY\", \"skip-white-space\", \"slide\", \"slider-horizontal\",\n \"slider-vertical\", \"sliderthumb-horizontal\", \"sliderthumb-vertical\", \"slow\",\n \"small\", \"small-caps\", \"small-caption\", \"smaller\", \"soft-light\", \"solid\", \"somali\",\n \"source-atop\", \"source-in\", \"source-out\", \"source-over\", \"space\", \"space-around\", \"space-between\", \"spell-out\", \"square\",\n \"square-button\", \"start\", \"static\", \"status-bar\", \"stretch\", \"stroke\", \"sub\",\n \"subpixel-antialiased\", \"super\", \"sw-resize\", \"symbolic\", \"symbols\", \"table\",\n \"table-caption\", \"table-cell\", \"table-column\", \"table-column-group\",\n \"table-footer-group\", \"table-header-group\", \"table-row\", \"table-row-group\",\n \"tamil\",\n \"telugu\", \"text\", \"text-bottom\", \"text-top\", \"textarea\", \"textfield\", \"thai\",\n \"thick\", \"thin\", \"threeddarkshadow\", \"threedface\", \"threedhighlight\",\n \"threedlightshadow\", \"threedshadow\", \"tibetan\", \"tigre\", \"tigrinya-er\",\n \"tigrinya-er-abegede\", \"tigrinya-et\", \"tigrinya-et-abegede\", \"to\", \"top\",\n \"trad-chinese-formal\", \"trad-chinese-informal\",\n \"translate\", \"translate3d\", \"translateX\", \"translateY\", \"translateZ\",\n \"transparent\", \"ultra-condensed\", \"ultra-expanded\", \"underline\", \"up\",\n \"upper-alpha\", \"upper-armenian\", \"upper-greek\", \"upper-hexadecimal\",\n \"upper-latin\", \"upper-norwegian\", \"upper-roman\", \"uppercase\", \"urdu\", \"url\",\n \"var\", \"vertical\", \"vertical-text\", \"visible\", \"visibleFill\", \"visiblePainted\",\n \"visibleStroke\", \"visual\", \"w-resize\", \"wait\", \"wave\", \"wider\",\n \"window\", \"windowframe\", \"windowtext\", \"words\", \"wrap\", \"wrap-reverse\", \"x-large\", \"x-small\", \"xor\",\n \"xx-large\", \"xx-small\"\n ], valueKeywords = keySet(valueKeywords_);\n\n var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_)\n .concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_)\n .concat(valueKeywords_);\n CodeMirror.registerHelper(\"hintWords\", \"css\", allWords);\n\n function tokenCComment(stream, state) {\n var maybeEnd = false, ch;\n while ((ch = stream.next()) != null) {\n if (maybeEnd && ch == \"/\") {\n state.tokenize = null;\n break;\n }\n maybeEnd = (ch == \"*\");\n }\n return [\"comment\", \"comment\"];\n }\n\n CodeMirror.defineMIME(\"text/css\", {\n documentTypes: documentTypes,\n mediaTypes: mediaTypes,\n mediaFeatures: mediaFeatures,\n mediaValueKeywords: mediaValueKeywords,\n propertyKeywords: propertyKeywords,\n nonStandardPropertyKeywords: nonStandardPropertyKeywords,\n fontProperties: fontProperties,\n counterDescriptors: counterDescriptors,\n colorKeywords: colorKeywords,\n valueKeywords: valueKeywords,\n tokenHooks: {\n \"/\": function(stream, state) {\n if (!stream.eat(\"*\")) return false;\n state.tokenize = tokenCComment;\n return tokenCComment(stream, state);\n }\n },\n name: \"css\"\n });\n\n CodeMirror.defineMIME(\"text/x-scss\", {\n mediaTypes: mediaTypes,\n mediaFeatures: mediaFeatures,\n mediaValueKeywords: mediaValueKeywords,\n propertyKeywords: propertyKeywords,\n nonStandardPropertyKeywords: nonStandardPropertyKeywords,\n colorKeywords: colorKeywords,\n valueKeywords: valueKeywords,\n fontProperties: fontProperties,\n allowNested: true,\n tokenHooks: {\n \"/\": function(stream, state) {\n if (stream.eat(\"/\")) {\n stream.skipToEnd();\n return [\"comment\", \"comment\"];\n } else if (stream.eat(\"*\")) {\n state.tokenize = tokenCComment;\n return tokenCComment(stream, state);\n } else {\n return [\"operator\", \"operator\"];\n }\n },\n \":\": function(stream) {\n if (stream.match(/\\s*\\{/))\n return [null, \"{\"];\n return false;\n },\n \"$\": function(stream) {\n stream.match(/^[\\w-]+/);\n if (stream.match(/^\\s*:/, false))\n return [\"variable-2\", \"variable-definition\"];\n return [\"variable-2\", \"variable\"];\n },\n \"#\": function(stream) {\n if (!stream.eat(\"{\")) return false;\n return [null, \"interpolation\"];\n }\n },\n name: \"css\",\n helperType: \"scss\"\n });\n\n CodeMirror.defineMIME(\"text/x-less\", {\n mediaTypes: mediaTypes,\n mediaFeatures: mediaFeatures,\n mediaValueKeywords: mediaValueKeywords,\n propertyKeywords: propertyKeywords,\n nonStandardPropertyKeywords: nonStandardPropertyKeywords,\n colorKeywords: colorKeywords,\n valueKeywords: valueKeywords,\n fontProperties: fontProperties,\n allowNested: true,\n tokenHooks: {\n \"/\": function(stream, state) {\n if (stream.eat(\"/\")) {\n stream.skipToEnd();\n return [\"comment\", \"comment\"];\n } else if (stream.eat(\"*\")) {\n state.tokenize = tokenCComment;\n return tokenCComment(stream, state);\n } else {\n return [\"operator\", \"operator\"];\n }\n },\n \"@\": function(stream) {\n if (stream.eat(\"{\")) return [null, \"interpolation\"];\n if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\\b/, false)) return false;\n stream.eatWhile(/[\\w\\\\\\-]/);\n if (stream.match(/^\\s*:/, false))\n return [\"variable-2\", \"variable-definition\"];\n return [\"variable-2\", \"variable\"];\n },\n \"&\": function() {\n return [\"atom\", \"atom\"];\n }\n },\n name: \"css\",\n helperType: \"less\"\n });\n\n CodeMirror.defineMIME(\"text/x-gss\", {\n documentTypes: documentTypes,\n mediaTypes: mediaTypes,\n mediaFeatures: mediaFeatures,\n propertyKeywords: propertyKeywords,\n nonStandardPropertyKeywords: nonStandardPropertyKeywords,\n fontProperties: fontProperties,\n counterDescriptors: counterDescriptors,\n colorKeywords: colorKeywords,\n valueKeywords: valueKeywords,\n supportsAtComponent: true,\n tokenHooks: {\n \"/\": function(stream, state) {\n if (!stream.eat(\"*\")) return false;\n state.tokenize = tokenCComment;\n return tokenCComment(stream, state);\n }\n },\n name: \"css\",\n helperType: \"gss\"\n });\n\n});\n\n},{\"../../lib/codemirror\":17}],19:[function(require,module,exports){\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"), require(\"../xml/xml\"), require(\"../javascript/javascript\"), require(\"../css/css\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\", \"../xml/xml\", \"../javascript/javascript\", \"../css/css\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n var defaultTags = {\n script: [\n [\"lang\", /(javascript|babel)/i, \"javascript\"],\n [\"type\", /^(?:text|application)\\/(?:x-)?(?:java|ecma)script$|^$/i, \"javascript\"],\n [\"type\", /./, \"text/plain\"],\n [null, null, \"javascript\"]\n ],\n style: [\n [\"lang\", /^css$/i, \"css\"],\n [\"type\", /^(text\\/)?(x-)?(stylesheet|css)$/i, \"css\"],\n [\"type\", /./, \"text/plain\"],\n [null, null, \"css\"]\n ]\n };\n\n function maybeBackup(stream, pat, style) {\n var cur = stream.current(), close = cur.search(pat);\n if (close > -1) {\n stream.backUp(cur.length - close);\n } else if (cur.match(/<\\/?$/)) {\n stream.backUp(cur.length);\n if (!stream.match(pat, false)) stream.match(cur);\n }\n return style;\n }\n\n var attrRegexpCache = {};\n function getAttrRegexp(attr) {\n var regexp = attrRegexpCache[attr];\n if (regexp) return regexp;\n return attrRegexpCache[attr] = new RegExp(\"\\\\s+\" + attr + \"\\\\s*=\\\\s*('|\\\")?([^'\\\"]+)('|\\\")?\\\\s*\");\n }\n\n function getAttrValue(text, attr) {\n var match = text.match(getAttrRegexp(attr))\n return match ? match[2] : \"\"\n }\n\n function getTagRegexp(tagName, anchored) {\n return new RegExp((anchored ? \"^\" : \"\") + \"<\\/\\s*\" + tagName + \"\\s*>\", \"i\");\n }\n\n function addTags(from, to) {\n for (var tag in from) {\n var dest = to[tag] || (to[tag] = []);\n var source = from[tag];\n for (var i = source.length - 1; i >= 0; i--)\n dest.unshift(source[i])\n }\n }\n\n function findMatchingMode(tagInfo, tagText) {\n for (var i = 0; i < tagInfo.length; i++) {\n var spec = tagInfo[i];\n if (!spec[0] || spec[1].test(getAttrValue(tagText, spec[0]))) return spec[2];\n }\n }\n\n CodeMirror.defineMode(\"htmlmixed\", function (config, parserConfig) {\n var htmlMode = CodeMirror.getMode(config, {\n name: \"xml\",\n htmlMode: true,\n multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,\n multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag\n });\n\n var tags = {};\n var configTags = parserConfig && parserConfig.tags, configScript = parserConfig && parserConfig.scriptTypes;\n addTags(defaultTags, tags);\n if (configTags) addTags(configTags, tags);\n if (configScript) for (var i = configScript.length - 1; i >= 0; i--)\n tags.script.unshift([\"type\", configScript[i].matches, configScript[i].mode])\n\n function html(stream, state) {\n var style = htmlMode.token(stream, state.htmlState), tag = /\\btag\\b/.test(style), tagName\n if (tag && !/[<>\\s\\/]/.test(stream.current()) &&\n (tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase()) &&\n tags.hasOwnProperty(tagName)) {\n state.inTag = tagName + \" \"\n } else if (state.inTag && tag && />$/.test(stream.current())) {\n var inTag = /^([\\S]+) (.*)/.exec(state.inTag)\n state.inTag = null\n var modeSpec = stream.current() == \">\" && findMatchingMode(tags[inTag[1]], inTag[2])\n var mode = CodeMirror.getMode(config, modeSpec)\n var endTagA = getTagRegexp(inTag[1], true), endTag = getTagRegexp(inTag[1], false);\n state.token = function (stream, state) {\n if (stream.match(endTagA, false)) {\n state.token = html;\n state.localState = state.localMode = null;\n return null;\n }\n return maybeBackup(stream, endTag, state.localMode.token(stream, state.localState));\n };\n state.localMode = mode;\n state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, \"\"));\n } else if (state.inTag) {\n state.inTag += stream.current()\n if (stream.eol()) state.inTag += \" \"\n }\n return style;\n };\n\n return {\n startState: function () {\n var state = CodeMirror.startState(htmlMode);\n return {token: html, inTag: null, localMode: null, localState: null, htmlState: state};\n },\n\n copyState: function (state) {\n var local;\n if (state.localState) {\n local = CodeMirror.copyState(state.localMode, state.localState);\n }\n return {token: state.token, inTag: state.inTag,\n localMode: state.localMode, localState: local,\n htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};\n },\n\n token: function (stream, state) {\n return state.token(stream, state);\n },\n\n indent: function (state, textAfter) {\n if (!state.localMode || /^\\s*<\\//.test(textAfter))\n return htmlMode.indent(state.htmlState, textAfter);\n else if (state.localMode.indent)\n return state.localMode.indent(state.localState, textAfter);\n else\n return CodeMirror.Pass;\n },\n\n innerMode: function (state) {\n return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode};\n }\n };\n }, \"xml\", \"javascript\", \"css\");\n\n CodeMirror.defineMIME(\"text/html\", \"htmlmixed\");\n});\n\n},{\"../../lib/codemirror\":17,\"../css/css\":18,\"../javascript/javascript\":20,\"../xml/xml\":21}],20:[function(require,module,exports){\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n// TODO actually recognize syntax of TypeScript constructs\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nfunction expressionAllowed(stream, state, backUp) {\n return /^(?:operator|sof|keyword c|case|new|[\\[{}\\(,;:]|=>)$/.test(state.lastType) ||\n (state.lastType == \"quasi\" && /\\{\\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))\n}\n\nCodeMirror.defineMode(\"javascript\", function(config, parserConfig) {\n var indentUnit = config.indentUnit;\n var statementIndent = parserConfig.statementIndent;\n var jsonldMode = parserConfig.jsonld;\n var jsonMode = parserConfig.json || jsonldMode;\n var isTS = parserConfig.typescript;\n var wordRE = parserConfig.wordCharacters || /[\\w$\\xa1-\\uffff]/;\n\n // Tokenizer\n\n var keywords = function(){\n function kw(type) {return {type: type, style: \"keyword\"};}\n var A = kw(\"keyword a\"), B = kw(\"keyword b\"), C = kw(\"keyword c\");\n var operator = kw(\"operator\"), atom = {type: \"atom\", style: \"atom\"};\n\n var jsKeywords = {\n \"if\": kw(\"if\"), \"while\": A, \"with\": A, \"else\": B, \"do\": B, \"try\": B, \"finally\": B,\n \"return\": C, \"break\": C, \"continue\": C, \"new\": kw(\"new\"), \"delete\": C, \"throw\": C, \"debugger\": C,\n \"var\": kw(\"var\"), \"const\": kw(\"var\"), \"let\": kw(\"var\"),\n \"function\": kw(\"function\"), \"catch\": kw(\"catch\"),\n \"for\": kw(\"for\"), \"switch\": kw(\"switch\"), \"case\": kw(\"case\"), \"default\": kw(\"default\"),\n \"in\": operator, \"typeof\": operator, \"instanceof\": operator,\n \"true\": atom, \"false\": atom, \"null\": atom, \"undefined\": atom, \"NaN\": atom, \"Infinity\": atom,\n \"this\": kw(\"this\"), \"class\": kw(\"class\"), \"super\": kw(\"atom\"),\n \"yield\": C, \"export\": kw(\"export\"), \"import\": kw(\"import\"), \"extends\": C,\n \"await\": C, \"async\": kw(\"async\")\n };\n\n // Extend the 'normal' keywords with the TypeScript language extensions\n if (isTS) {\n var type = {type: \"variable\", style: \"variable-3\"};\n var tsKeywords = {\n // object-like things\n \"interface\": kw(\"class\"),\n \"implements\": C,\n \"namespace\": C,\n \"module\": kw(\"module\"),\n \"enum\": kw(\"module\"),\n\n // scope modifiers\n \"public\": kw(\"modifier\"),\n \"private\": kw(\"modifier\"),\n \"protected\": kw(\"modifier\"),\n \"abstract\": kw(\"modifier\"),\n\n // operators\n \"as\": operator,\n\n // types\n \"string\": type, \"number\": type, \"boolean\": type, \"any\": type\n };\n\n for (var attr in tsKeywords) {\n jsKeywords[attr] = tsKeywords[attr];\n }\n }\n\n return jsKeywords;\n }();\n\n var isOperatorChar = /[+\\-*&%=<>!?|~^]/;\n var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)\"/;\n\n function readRegexp(stream) {\n var escaped = false, next, inSet = false;\n while ((next = stream.next()) != null) {\n if (!escaped) {\n if (next == \"/\" && !inSet) return;\n if (next == \"[\") inSet = true;\n else if (inSet && next == \"]\") inSet = false;\n }\n escaped = !escaped && next == \"\\\\\";\n }\n }\n\n // Used as scratch variables to communicate multiple values without\n // consing up tons of objects.\n var type, content;\n function ret(tp, style, cont) {\n type = tp; content = cont;\n return style;\n }\n function tokenBase(stream, state) {\n var ch = stream.next();\n if (ch == '\"' || ch == \"'\") {\n state.tokenize = tokenString(ch);\n return state.tokenize(stream, state);\n } else if (ch == \".\" && stream.match(/^\\d+(?:[eE][+\\-]?\\d+)?/)) {\n return ret(\"number\", \"number\");\n } else if (ch == \".\" && stream.match(\"..\")) {\n return ret(\"spread\", \"meta\");\n } else if (/[\\[\\]{}\\(\\),;\\:\\.]/.test(ch)) {\n return ret(ch);\n } else if (ch == \"=\" && stream.eat(\">\")) {\n return ret(\"=>\", \"operator\");\n } else if (ch == \"0\" && stream.eat(/x/i)) {\n stream.eatWhile(/[\\da-f]/i);\n return ret(\"number\", \"number\");\n } else if (ch == \"0\" && stream.eat(/o/i)) {\n stream.eatWhile(/[0-7]/i);\n return ret(\"number\", \"number\");\n } else if (ch == \"0\" && stream.eat(/b/i)) {\n stream.eatWhile(/[01]/i);\n return ret(\"number\", \"number\");\n } else if (/\\d/.test(ch)) {\n stream.match(/^\\d*(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/);\n return ret(\"number\", \"number\");\n } else if (ch == \"/\") {\n if (stream.eat(\"*\")) {\n state.tokenize = tokenComment;\n return tokenComment(stream, state);\n } else if (stream.eat(\"/\")) {\n stream.skipToEnd();\n return ret(\"comment\", \"comment\");\n } else if (expressionAllowed(stream, state, 1)) {\n readRegexp(stream);\n stream.match(/^\\b(([gimyu])(?![gimyu]*\\2))+\\b/);\n return ret(\"regexp\", \"string-2\");\n } else {\n stream.eatWhile(isOperatorChar);\n return ret(\"operator\", \"operator\", stream.current());\n }\n } else if (ch == \"`\") {\n state.tokenize = tokenQuasi;\n return tokenQuasi(stream, state);\n } else if (ch == \"#\") {\n stream.skipToEnd();\n return ret(\"error\", \"error\");\n } else if (isOperatorChar.test(ch)) {\n stream.eatWhile(isOperatorChar);\n return ret(\"operator\", \"operator\", stream.current());\n } else if (wordRE.test(ch)) {\n stream.eatWhile(wordRE);\n var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];\n return (known && state.lastType != \".\") ? ret(known.type, known.style, word) :\n ret(\"variable\", \"variable\", word);\n }\n }\n\n function tokenString(quote) {\n return function(stream, state) {\n var escaped = false, next;\n if (jsonldMode && stream.peek() == \"@\" && stream.match(isJsonldKeyword)){\n state.tokenize = tokenBase;\n return ret(\"jsonld-keyword\", \"meta\");\n }\n while ((next = stream.next()) != null) {\n if (next == quote && !escaped) break;\n escaped = !escaped && next == \"\\\\\";\n }\n if (!escaped) state.tokenize = tokenBase;\n return ret(\"string\", \"string\");\n };\n }\n\n function tokenComment(stream, state) {\n var maybeEnd = false, ch;\n while (ch = stream.next()) {\n if (ch == \"/\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"*\");\n }\n return ret(\"comment\", \"comment\");\n }\n\n function tokenQuasi(stream, state) {\n var escaped = false, next;\n while ((next = stream.next()) != null) {\n if (!escaped && (next == \"`\" || next == \"$\" && stream.eat(\"{\"))) {\n state.tokenize = tokenBase;\n break;\n }\n escaped = !escaped && next == \"\\\\\";\n }\n return ret(\"quasi\", \"string-2\", stream.current());\n }\n\n var brackets = \"([{}])\";\n // This is a crude lookahead trick to try and notice that we're\n // parsing the argument patterns for a fat-arrow function before we\n // actually hit the arrow token. It only works if the arrow is on\n // the same line as the arguments and there's no strange noise\n // (comments) in between. Fallback is to only notice when we hit the\n // arrow, and not declare the arguments as locals for the arrow\n // body.\n function findFatArrow(stream, state) {\n if (state.fatArrowAt) state.fatArrowAt = null;\n var arrow = stream.string.indexOf(\"=>\", stream.start);\n if (arrow < 0) return;\n\n var depth = 0, sawSomething = false;\n for (var pos = arrow - 1; pos >= 0; --pos) {\n var ch = stream.string.charAt(pos);\n var bracket = brackets.indexOf(ch);\n if (bracket >= 0 && bracket < 3) {\n if (!depth) { ++pos; break; }\n if (--depth == 0) break;\n } else if (bracket >= 3 && bracket < 6) {\n ++depth;\n } else if (wordRE.test(ch)) {\n sawSomething = true;\n } else if (/[\"'\\/]/.test(ch)) {\n return;\n } else if (sawSomething && !depth) {\n ++pos;\n break;\n }\n }\n if (sawSomething && !depth) state.fatArrowAt = pos;\n }\n\n // Parser\n\n var atomicTypes = {\"atom\": true, \"number\": true, \"variable\": true, \"string\": true, \"regexp\": true, \"this\": true, \"jsonld-keyword\": true};\n\n function JSLexical(indented, column, type, align, prev, info) {\n this.indented = indented;\n this.column = column;\n this.type = type;\n this.prev = prev;\n this.info = info;\n if (align != null) this.align = align;\n }\n\n function inScope(state, varname) {\n for (var v = state.localVars; v; v = v.next)\n if (v.name == varname) return true;\n for (var cx = state.context; cx; cx = cx.prev) {\n for (var v = cx.vars; v; v = v.next)\n if (v.name == varname) return true;\n }\n }\n\n function parseJS(state, style, type, content, stream) {\n var cc = state.cc;\n // Communicate our context to the combinators.\n // (Less wasteful than consing up a hundred closures on every call.)\n cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;\n\n if (!state.lexical.hasOwnProperty(\"align\"))\n state.lexical.align = true;\n\n while(true) {\n var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;\n if (combinator(type, content)) {\n while(cc.length && cc[cc.length - 1].lex)\n cc.pop()();\n if (cx.marked) return cx.marked;\n if (type == \"variable\" && inScope(state, content)) return \"variable-2\";\n return style;\n }\n }\n }\n\n // Combinator utils\n\n var cx = {state: null, column: null, marked: null, cc: null};\n function pass() {\n for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);\n }\n function cont() {\n pass.apply(null, arguments);\n return true;\n }\n function register(varname) {\n function inList(list) {\n for (var v = list; v; v = v.next)\n if (v.name == varname) return true;\n return false;\n }\n var state = cx.state;\n cx.marked = \"def\";\n if (state.context) {\n if (inList(state.localVars)) return;\n state.localVars = {name: varname, next: state.localVars};\n } else {\n if (inList(state.globalVars)) return;\n if (parserConfig.globalVars)\n state.globalVars = {name: varname, next: state.globalVars};\n }\n }\n\n // Combinators\n\n var defaultVars = {name: \"this\", next: {name: \"arguments\"}};\n function pushcontext() {\n cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};\n cx.state.localVars = defaultVars;\n }\n function popcontext() {\n cx.state.localVars = cx.state.context.vars;\n cx.state.context = cx.state.context.prev;\n }\n function pushlex(type, info) {\n var result = function() {\n var state = cx.state, indent = state.indented;\n if (state.lexical.type == \"stat\") indent = state.lexical.indented;\n else for (var outer = state.lexical; outer && outer.type == \")\" && outer.align; outer = outer.prev)\n indent = outer.indented;\n state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);\n };\n result.lex = true;\n return result;\n }\n function poplex() {\n var state = cx.state;\n if (state.lexical.prev) {\n if (state.lexical.type == \")\")\n state.indented = state.lexical.indented;\n state.lexical = state.lexical.prev;\n }\n }\n poplex.lex = true;\n\n function expect(wanted) {\n function exp(type) {\n if (type == wanted) return cont();\n else if (wanted == \";\") return pass();\n else return cont(exp);\n };\n return exp;\n }\n\n function statement(type, value) {\n if (type == \"var\") return cont(pushlex(\"vardef\", value.length), vardef, expect(\";\"), poplex);\n if (type == \"keyword a\") return cont(pushlex(\"form\"), expression, statement, poplex);\n if (type == \"keyword b\") return cont(pushlex(\"form\"), statement, poplex);\n if (type == \"{\") return cont(pushlex(\"}\"), block, poplex);\n if (type == \";\") return cont();\n if (type == \"if\") {\n if (cx.state.lexical.info == \"else\" && cx.state.cc[cx.state.cc.length - 1] == poplex)\n cx.state.cc.pop()();\n return cont(pushlex(\"form\"), expression, statement, poplex, maybeelse);\n }\n if (type == \"function\") return cont(functiondef);\n if (type == \"for\") return cont(pushlex(\"form\"), forspec, statement, poplex);\n if (type == \"variable\") return cont(pushlex(\"stat\"), maybelabel);\n if (type == \"switch\") return cont(pushlex(\"form\"), expression, pushlex(\"}\", \"switch\"), expect(\"{\"),\n block, poplex, poplex);\n if (type == \"case\") return cont(expression, expect(\":\"));\n if (type == \"default\") return cont(expect(\":\"));\n if (type == \"catch\") return cont(pushlex(\"form\"), pushcontext, expect(\"(\"), funarg, expect(\")\"),\n statement, poplex, popcontext);\n if (type == \"class\") return cont(pushlex(\"form\"), className, poplex);\n if (type == \"export\") return cont(pushlex(\"stat\"), afterExport, poplex);\n if (type == \"import\") return cont(pushlex(\"stat\"), afterImport, poplex);\n if (type == \"module\") return cont(pushlex(\"form\"), pattern, pushlex(\"}\"), expect(\"{\"), block, poplex, poplex)\n if (type == \"async\") return cont(statement)\n return pass(pushlex(\"stat\"), expression, expect(\";\"), poplex);\n }\n function expression(type) {\n return expressionInner(type, false);\n }\n function expressionNoComma(type) {\n return expressionInner(type, true);\n }\n function expressionInner(type, noComma) {\n if (cx.state.fatArrowAt == cx.stream.start) {\n var body = noComma ? arrowBodyNoComma : arrowBody;\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(pattern, \")\"), poplex, expect(\"=>\"), body, popcontext);\n else if (type == \"variable\") return pass(pushcontext, pattern, expect(\"=>\"), body, popcontext);\n }\n\n var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;\n if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);\n if (type == \"function\") return cont(functiondef, maybeop);\n if (type == \"keyword c\" || type == \"async\") return cont(noComma ? maybeexpressionNoComma : maybeexpression);\n if (type == \"(\") return cont(pushlex(\")\"), maybeexpression, expect(\")\"), poplex, maybeop);\n if (type == \"operator\" || type == \"spread\") return cont(noComma ? expressionNoComma : expression);\n if (type == \"[\") return cont(pushlex(\"]\"), arrayLiteral, poplex, maybeop);\n if (type == \"{\") return contCommasep(objprop, \"}\", null, maybeop);\n if (type == \"quasi\") return pass(quasi, maybeop);\n if (type == \"new\") return cont(maybeTarget(noComma));\n return cont();\n }\n function maybeexpression(type) {\n if (type.match(/[;\\}\\)\\],]/)) return pass();\n return pass(expression);\n }\n function maybeexpressionNoComma(type) {\n if (type.match(/[;\\}\\)\\],]/)) return pass();\n return pass(expressionNoComma);\n }\n\n function maybeoperatorComma(type, value) {\n if (type == \",\") return cont(expression);\n return maybeoperatorNoComma(type, value, false);\n }\n function maybeoperatorNoComma(type, value, noComma) {\n var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;\n var expr = noComma == false ? expression : expressionNoComma;\n if (type == \"=>\") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);\n if (type == \"operator\") {\n if (/\\+\\+|--/.test(value)) return cont(me);\n if (value == \"?\") return cont(expression, expect(\":\"), expr);\n return cont(expr);\n }\n if (type == \"quasi\") { return pass(quasi, me); }\n if (type == \";\") return;\n if (type == \"(\") return contCommasep(expressionNoComma, \")\", \"call\", me);\n if (type == \".\") return cont(property, me);\n if (type == \"[\") return cont(pushlex(\"]\"), maybeexpression, expect(\"]\"), poplex, me);\n }\n function quasi(type, value) {\n if (type != \"quasi\") return pass();\n if (value.slice(value.length - 2) != \"${\") return cont(quasi);\n return cont(expression, continueQuasi);\n }\n function continueQuasi(type) {\n if (type == \"}\") {\n cx.marked = \"string-2\";\n cx.state.tokenize = tokenQuasi;\n return cont(quasi);\n }\n }\n function arrowBody(type) {\n findFatArrow(cx.stream, cx.state);\n return pass(type == \"{\" ? statement : expression);\n }\n function arrowBodyNoComma(type) {\n findFatArrow(cx.stream, cx.state);\n return pass(type == \"{\" ? statement : expressionNoComma);\n }\n function maybeTarget(noComma) {\n return function(type) {\n if (type == \".\") return cont(noComma ? targetNoComma : target);\n else return pass(noComma ? expressionNoComma : expression);\n };\n }\n function target(_, value) {\n if (value == \"target\") { cx.marked = \"keyword\"; return cont(maybeoperatorComma); }\n }\n function targetNoComma(_, value) {\n if (value == \"target\") { cx.marked = \"keyword\"; return cont(maybeoperatorNoComma); }\n }\n function maybelabel(type) {\n if (type == \":\") return cont(poplex, statement);\n return pass(maybeoperatorComma, expect(\";\"), poplex);\n }\n function property(type) {\n if (type == \"variable\") {cx.marked = \"property\"; return cont();}\n }\n function objprop(type, value) {\n if (type == \"async\") return cont(objprop);\n if (type == \"variable\" || cx.style == \"keyword\") {\n cx.marked = \"property\";\n if (value == \"get\" || value == \"set\") return cont(getterSetter);\n return cont(afterprop);\n } else if (type == \"number\" || type == \"string\") {\n cx.marked = jsonldMode ? \"property\" : (cx.style + \" property\");\n return cont(afterprop);\n } else if (type == \"jsonld-keyword\") {\n return cont(afterprop);\n } else if (type == \"modifier\") {\n return cont(objprop)\n } else if (type == \"[\") {\n return cont(expression, expect(\"]\"), afterprop);\n } else if (type == \"spread\") {\n return cont(expression);\n }\n }\n function getterSetter(type) {\n if (type != \"variable\") return pass(afterprop);\n cx.marked = \"property\";\n return cont(functiondef);\n }\n function afterprop(type) {\n if (type == \":\") return cont(expressionNoComma);\n if (type == \"(\") return pass(functiondef);\n }\n function commasep(what, end) {\n function proceed(type, value) {\n if (type == \",\") {\n var lex = cx.state.lexical;\n if (lex.info == \"call\") lex.pos = (lex.pos || 0) + 1;\n return cont(function(type, value) {\n if (type == end || value == end) return pass()\n return pass(what)\n }, proceed);\n }\n if (type == end || value == end) return cont();\n return cont(expect(end));\n }\n return function(type, value) {\n if (type == end || value == end) return cont();\n return pass(what, proceed);\n };\n }\n function contCommasep(what, end, info) {\n for (var i = 3; i < arguments.length; i++)\n cx.cc.push(arguments[i]);\n return cont(pushlex(end, info), commasep(what, end), poplex);\n }\n function block(type) {\n if (type == \"}\") return cont();\n return pass(statement, block);\n }\n function maybetype(type) {\n if (isTS && type == \":\") return cont(typeexpr);\n }\n function maybedefault(_, value) {\n if (value == \"=\") return cont(expressionNoComma);\n }\n function typeexpr(type) {\n if (type == \"variable\") {cx.marked = \"variable-3\"; return cont(afterType);}\n }\n function afterType(type, value) {\n if (value == \"<\") return cont(commasep(typeexpr, \">\"), afterType)\n if (type == \"[\") return cont(expect(\"]\"), afterType)\n }\n function vardef() {\n return pass(pattern, maybetype, maybeAssign, vardefCont);\n }\n function pattern(type, value) {\n if (type == \"modifier\") return cont(pattern)\n if (type == \"variable\") { register(value); return cont(); }\n if (type == \"spread\") return cont(pattern);\n if (type == \"[\") return contCommasep(pattern, \"]\");\n if (type == \"{\") return contCommasep(proppattern, \"}\");\n }\n function proppattern(type, value) {\n if (type == \"variable\" && !cx.stream.match(/^\\s*:/, false)) {\n register(value);\n return cont(maybeAssign);\n }\n if (type == \"variable\") cx.marked = \"property\";\n if (type == \"spread\") return cont(pattern);\n if (type == \"}\") return pass();\n return cont(expect(\":\"), pattern, maybeAssign);\n }\n function maybeAssign(_type, value) {\n if (value == \"=\") return cont(expressionNoComma);\n }\n function vardefCont(type) {\n if (type == \",\") return cont(vardef);\n }\n function maybeelse(type, value) {\n if (type == \"keyword b\" && value == \"else\") return cont(pushlex(\"form\", \"else\"), statement, poplex);\n }\n function forspec(type) {\n if (type == \"(\") return cont(pushlex(\")\"), forspec1, expect(\")\"), poplex);\n }\n function forspec1(type) {\n if (type == \"var\") return cont(vardef, expect(\";\"), forspec2);\n if (type == \";\") return cont(forspec2);\n if (type == \"variable\") return cont(formaybeinof);\n return pass(expression, expect(\";\"), forspec2);\n }\n function formaybeinof(_type, value) {\n if (value == \"in\" || value == \"of\") { cx.marked = \"keyword\"; return cont(expression); }\n return cont(maybeoperatorComma, forspec2);\n }\n function forspec2(type, value) {\n if (type == \";\") return cont(forspec3);\n if (value == \"in\" || value == \"of\") { cx.marked = \"keyword\"; return cont(expression); }\n return pass(expression, expect(\";\"), forspec3);\n }\n function forspec3(type) {\n if (type != \")\") cont(expression);\n }\n function functiondef(type, value) {\n if (value == \"*\") {cx.marked = \"keyword\"; return cont(functiondef);}\n if (type == \"variable\") {register(value); return cont(functiondef);}\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(funarg, \")\"), poplex, maybetype, statement, popcontext);\n }\n function funarg(type) {\n if (type == \"spread\") return cont(funarg);\n return pass(pattern, maybetype, maybedefault);\n }\n function className(type, value) {\n if (type == \"variable\") {register(value); return cont(classNameAfter);}\n }\n function classNameAfter(type, value) {\n if (value == \"extends\") return cont(expression, classNameAfter);\n if (type == \"{\") return cont(pushlex(\"}\"), classBody, poplex);\n }\n function classBody(type, value) {\n if (type == \"variable\" || cx.style == \"keyword\") {\n if (value == \"static\") {\n cx.marked = \"keyword\";\n return cont(classBody);\n }\n cx.marked = \"property\";\n if (value == \"get\" || value == \"set\") return cont(classGetterSetter, functiondef, classBody);\n return cont(functiondef, classBody);\n }\n if (value == \"*\") {\n cx.marked = \"keyword\";\n return cont(classBody);\n }\n if (type == \";\") return cont(classBody);\n if (type == \"}\") return cont();\n }\n function classGetterSetter(type) {\n if (type != \"variable\") return pass();\n cx.marked = \"property\";\n return cont();\n }\n function afterExport(_type, value) {\n if (value == \"*\") { cx.marked = \"keyword\"; return cont(maybeFrom, expect(\";\")); }\n if (value == \"default\") { cx.marked = \"keyword\"; return cont(expression, expect(\";\")); }\n return pass(statement);\n }\n function afterImport(type) {\n if (type == \"string\") return cont();\n return pass(importSpec, maybeFrom);\n }\n function importSpec(type, value) {\n if (type == \"{\") return contCommasep(importSpec, \"}\");\n if (type == \"variable\") register(value);\n if (value == \"*\") cx.marked = \"keyword\";\n return cont(maybeAs);\n }\n function maybeAs(_type, value) {\n if (value == \"as\") { cx.marked = \"keyword\"; return cont(importSpec); }\n }\n function maybeFrom(_type, value) {\n if (value == \"from\") { cx.marked = \"keyword\"; return cont(expression); }\n }\n function arrayLiteral(type) {\n if (type == \"]\") return cont();\n return pass(expressionNoComma, commasep(expressionNoComma, \"]\"));\n }\n\n function isContinuedStatement(state, textAfter) {\n return state.lastType == \"operator\" || state.lastType == \",\" ||\n isOperatorChar.test(textAfter.charAt(0)) ||\n /[,.]/.test(textAfter.charAt(0));\n }\n\n // Interface\n\n return {\n startState: function(basecolumn) {\n var state = {\n tokenize: tokenBase,\n lastType: \"sof\",\n cc: [],\n lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, \"block\", false),\n localVars: parserConfig.localVars,\n context: parserConfig.localVars && {vars: parserConfig.localVars},\n indented: basecolumn || 0\n };\n if (parserConfig.globalVars && typeof parserConfig.globalVars == \"object\")\n state.globalVars = parserConfig.globalVars;\n return state;\n },\n\n token: function(stream, state) {\n if (stream.sol()) {\n if (!state.lexical.hasOwnProperty(\"align\"))\n state.lexical.align = false;\n state.indented = stream.indentation();\n findFatArrow(stream, state);\n }\n if (state.tokenize != tokenComment && stream.eatSpace()) return null;\n var style = state.tokenize(stream, state);\n if (type == \"comment\") return style;\n state.lastType = type == \"operator\" && (content == \"++\" || content == \"--\") ? \"incdec\" : type;\n return parseJS(state, style, type, content, stream);\n },\n\n indent: function(state, textAfter) {\n if (state.tokenize == tokenComment) return CodeMirror.Pass;\n if (state.tokenize != tokenBase) return 0;\n var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;\n // Kludge to prevent 'maybelse' from blocking lexical scope pops\n if (!/^\\s*else\\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {\n var c = state.cc[i];\n if (c == poplex) lexical = lexical.prev;\n else if (c != maybeelse) break;\n }\n if (lexical.type == \"stat\" && firstChar == \"}\") lexical = lexical.prev;\n if (statementIndent && lexical.type == \")\" && lexical.prev.type == \"stat\")\n lexical = lexical.prev;\n var type = lexical.type, closing = firstChar == type;\n\n if (type == \"vardef\") return lexical.indented + (state.lastType == \"operator\" || state.lastType == \",\" ? lexical.info + 1 : 0);\n else if (type == \"form\" && firstChar == \"{\") return lexical.indented;\n else if (type == \"form\") return lexical.indented + indentUnit;\n else if (type == \"stat\")\n return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);\n else if (lexical.info == \"switch\" && !closing && parserConfig.doubleIndentSwitch != false)\n return lexical.indented + (/^(?:case|default)\\b/.test(textAfter) ? indentUnit : 2 * indentUnit);\n else if (lexical.align) return lexical.column + (closing ? 0 : 1);\n else return lexical.indented + (closing ? 0 : indentUnit);\n },\n\n electricInput: /^\\s*(?:case .*?:|default:|\\{|\\})$/,\n blockCommentStart: jsonMode ? null : \"/*\",\n blockCommentEnd: jsonMode ? null : \"*/\",\n lineComment: jsonMode ? null : \"//\",\n fold: \"brace\",\n closeBrackets: \"()[]{}''\\\"\\\"``\",\n\n helperType: jsonMode ? \"json\" : \"javascript\",\n jsonldMode: jsonldMode,\n jsonMode: jsonMode,\n\n expressionAllowed: expressionAllowed,\n skipExpression: function(state) {\n var top = state.cc[state.cc.length - 1]\n if (top == expression || top == expressionNoComma) state.cc.pop()\n }\n };\n});\n\nCodeMirror.registerHelper(\"wordChars\", \"javascript\", /[\\w$]/);\n\nCodeMirror.defineMIME(\"text/javascript\", \"javascript\");\nCodeMirror.defineMIME(\"text/ecmascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/javascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/x-javascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/ecmascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/json\", {name: \"javascript\", json: true});\nCodeMirror.defineMIME(\"application/x-json\", {name: \"javascript\", json: true});\nCodeMirror.defineMIME(\"application/ld+json\", {name: \"javascript\", jsonld: true});\nCodeMirror.defineMIME(\"text/typescript\", { name: \"javascript\", typescript: true });\nCodeMirror.defineMIME(\"application/typescript\", { name: \"javascript\", typescript: true });\n\n});\n\n},{\"../../lib/codemirror\":17}],21:[function(require,module,exports){\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nvar htmlConfig = {\n autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,\n 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,\n 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,\n 'track': true, 'wbr': true, 'menuitem': true},\n implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,\n 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,\n 'th': true, 'tr': true},\n contextGrabbers: {\n 'dd': {'dd': true, 'dt': true},\n 'dt': {'dd': true, 'dt': true},\n 'li': {'li': true},\n 'option': {'option': true, 'optgroup': true},\n 'optgroup': {'optgroup': true},\n 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,\n 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,\n 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,\n 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,\n 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},\n 'rp': {'rp': true, 'rt': true},\n 'rt': {'rp': true, 'rt': true},\n 'tbody': {'tbody': true, 'tfoot': true},\n 'td': {'td': true, 'th': true},\n 'tfoot': {'tbody': true},\n 'th': {'td': true, 'th': true},\n 'thead': {'tbody': true, 'tfoot': true},\n 'tr': {'tr': true}\n },\n doNotIndent: {\"pre\": true},\n allowUnquoted: true,\n allowMissing: true,\n caseFold: true\n}\n\nvar xmlConfig = {\n autoSelfClosers: {},\n implicitlyClosed: {},\n contextGrabbers: {},\n doNotIndent: {},\n allowUnquoted: false,\n allowMissing: false,\n caseFold: false\n}\n\nCodeMirror.defineMode(\"xml\", function(editorConf, config_) {\n var indentUnit = editorConf.indentUnit\n var config = {}\n var defaults = config_.htmlMode ? htmlConfig : xmlConfig\n for (var prop in defaults) config[prop] = defaults[prop]\n for (var prop in config_) config[prop] = config_[prop]\n\n // Return variables for tokenizers\n var type, setStyle;\n\n function inText(stream, state) {\n function chain(parser) {\n state.tokenize = parser;\n return parser(stream, state);\n }\n\n var ch = stream.next();\n if (ch == \"<\") {\n if (stream.eat(\"!\")) {\n if (stream.eat(\"[\")) {\n if (stream.match(\"CDATA[\")) return chain(inBlock(\"atom\", \"]]>\"));\n else return null;\n } else if (stream.match(\"--\")) {\n return chain(inBlock(\"comment\", \"-->\"));\n } else if (stream.match(\"DOCTYPE\", true, true)) {\n stream.eatWhile(/[\\w\\._\\-]/);\n return chain(doctype(1));\n } else {\n return null;\n }\n } else if (stream.eat(\"?\")) {\n stream.eatWhile(/[\\w\\._\\-]/);\n state.tokenize = inBlock(\"meta\", \"?>\");\n return \"meta\";\n } else {\n type = stream.eat(\"/\") ? \"closeTag\" : \"openTag\";\n state.tokenize = inTag;\n return \"tag bracket\";\n }\n } else if (ch == \"&\") {\n var ok;\n if (stream.eat(\"#\")) {\n if (stream.eat(\"x\")) {\n ok = stream.eatWhile(/[a-fA-F\\d]/) && stream.eat(\";\");\n } else {\n ok = stream.eatWhile(/[\\d]/) && stream.eat(\";\");\n }\n } else {\n ok = stream.eatWhile(/[\\w\\.\\-:]/) && stream.eat(\";\");\n }\n return ok ? \"atom\" : \"error\";\n } else {\n stream.eatWhile(/[^&<]/);\n return null;\n }\n }\n inText.isInText = true;\n\n function inTag(stream, state) {\n var ch = stream.next();\n if (ch == \">\" || (ch == \"/\" && stream.eat(\">\"))) {\n state.tokenize = inText;\n type = ch == \">\" ? \"endTag\" : \"selfcloseTag\";\n return \"tag bracket\";\n } else if (ch == \"=\") {\n type = \"equals\";\n return null;\n } else if (ch == \"<\") {\n state.tokenize = inText;\n state.state = baseState;\n state.tagName = state.tagStart = null;\n var next = state.tokenize(stream, state);\n return next ? next + \" tag error\" : \"tag error\";\n } else if (/[\\'\\\"]/.test(ch)) {\n state.tokenize = inAttribute(ch);\n state.stringStartCol = stream.column();\n return state.tokenize(stream, state);\n } else {\n stream.match(/^[^\\s\\u00a0=<>\\\"\\']*[^\\s\\u00a0=<>\\\"\\'\\/]/);\n return \"word\";\n }\n }\n\n function inAttribute(quote) {\n var closure = function(stream, state) {\n while (!stream.eol()) {\n if (stream.next() == quote) {\n state.tokenize = inTag;\n break;\n }\n }\n return \"string\";\n };\n closure.isInAttribute = true;\n return closure;\n }\n\n function inBlock(style, terminator) {\n return function(stream, state) {\n while (!stream.eol()) {\n if (stream.match(terminator)) {\n state.tokenize = inText;\n break;\n }\n stream.next();\n }\n return style;\n };\n }\n function doctype(depth) {\n return function(stream, state) {\n var ch;\n while ((ch = stream.next()) != null) {\n if (ch == \"<\") {\n state.tokenize = doctype(depth + 1);\n return state.tokenize(stream, state);\n } else if (ch == \">\") {\n if (depth == 1) {\n state.tokenize = inText;\n break;\n } else {\n state.tokenize = doctype(depth - 1);\n return state.tokenize(stream, state);\n }\n }\n }\n return \"meta\";\n };\n }\n\n function Context(state, tagName, startOfLine) {\n this.prev = state.context;\n this.tagName = tagName;\n this.indent = state.indented;\n this.startOfLine = startOfLine;\n if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))\n this.noIndent = true;\n }\n function popContext(state) {\n if (state.context) state.context = state.context.prev;\n }\n function maybePopContext(state, nextTagName) {\n var parentTagName;\n while (true) {\n if (!state.context) {\n return;\n }\n parentTagName = state.context.tagName;\n if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||\n !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {\n return;\n }\n popContext(state);\n }\n }\n\n function baseState(type, stream, state) {\n if (type == \"openTag\") {\n state.tagStart = stream.column();\n return tagNameState;\n } else if (type == \"closeTag\") {\n return closeTagNameState;\n } else {\n return baseState;\n }\n }\n function tagNameState(type, stream, state) {\n if (type == \"word\") {\n state.tagName = stream.current();\n setStyle = \"tag\";\n return attrState;\n } else {\n setStyle = \"error\";\n return tagNameState;\n }\n }\n function closeTagNameState(type, stream, state) {\n if (type == \"word\") {\n var tagName = stream.current();\n if (state.context && state.context.tagName != tagName &&\n config.implicitlyClosed.hasOwnProperty(state.context.tagName))\n popContext(state);\n if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {\n setStyle = \"tag\";\n return closeState;\n } else {\n setStyle = \"tag error\";\n return closeStateErr;\n }\n } else {\n setStyle = \"error\";\n return closeStateErr;\n }\n }\n\n function closeState(type, _stream, state) {\n if (type != \"endTag\") {\n setStyle = \"error\";\n return closeState;\n }\n popContext(state);\n return baseState;\n }\n function closeStateErr(type, stream, state) {\n setStyle = \"error\";\n return closeState(type, stream, state);\n }\n\n function attrState(type, _stream, state) {\n if (type == \"word\") {\n setStyle = \"attribute\";\n return attrEqState;\n } else if (type == \"endTag\" || type == \"selfcloseTag\") {\n var tagName = state.tagName, tagStart = state.tagStart;\n state.tagName = state.tagStart = null;\n if (type == \"selfcloseTag\" ||\n config.autoSelfClosers.hasOwnProperty(tagName)) {\n maybePopContext(state, tagName);\n } else {\n maybePopContext(state, tagName);\n state.context = new Context(state, tagName, tagStart == state.indented);\n }\n return baseState;\n }\n setStyle = \"error\";\n return attrState;\n }\n function attrEqState(type, stream, state) {\n if (type == \"equals\") return attrValueState;\n if (!config.allowMissing) setStyle = \"error\";\n return attrState(type, stream, state);\n }\n function attrValueState(type, stream, state) {\n if (type == \"string\") return attrContinuedState;\n if (type ==
|
|