diff --git a/plugins/scl-wizarding/ace/ext-searchbox.js b/plugins/scl-wizarding/ace/ext-searchbox.js new file mode 100644 index 0000000..fda92f1 --- /dev/null +++ b/plugins/scl-wizarding/ace/ext-searchbox.js @@ -0,0 +1,8 @@ +ace.define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"],function(e,t,n){"use strict";var r=e("../lib/dom"),i=e("../lib/lang"),s=e("../lib/event"),o='.ace_search {background-color: #ddd;color: #666;border: 1px solid #cbcbcb;border-top: 0 none;overflow: hidden;margin: 0;padding: 4px 6px 0 4px;position: absolute;top: 0;z-index: 99;white-space: normal;}.ace_search.left {border-left: 0 none;border-radius: 0px 0px 5px 0px;left: 0;}.ace_search.right {border-radius: 0px 0px 0px 5px;border-right: 0 none;right: 0;}.ace_search_form, .ace_replace_form {margin: 0 20px 4px 0;overflow: hidden;line-height: 1.9;}.ace_replace_form {margin-right: 0;}.ace_search_form.ace_nomatch {outline: 1px solid red;}.ace_search_field {border-radius: 3px 0 0 3px;background-color: white;color: black;border: 1px solid #cbcbcb;border-right: 0 none;outline: 0;padding: 0;font-size: inherit;margin: 0;line-height: inherit;padding: 0 6px;min-width: 17em;vertical-align: top;min-height: 1.8em;box-sizing: content-box;}.ace_searchbtn {border: 1px solid #cbcbcb;line-height: inherit;display: inline-block;padding: 0 6px;background: #fff;border-right: 0 none;border-left: 1px solid #dcdcdc;cursor: pointer;margin: 0;position: relative;color: #666;}.ace_searchbtn:last-child {border-radius: 0 3px 3px 0;border-right: 1px solid #cbcbcb;}.ace_searchbtn:disabled {background: none;cursor: default;}.ace_searchbtn:hover {background-color: #eef1f6;}.ace_searchbtn.prev, .ace_searchbtn.next {padding: 0px 0.7em}.ace_searchbtn.prev:after, .ace_searchbtn.next:after {content: "";border: solid 2px #888;width: 0.5em;height: 0.5em;border-width: 2px 0 0 2px;display:inline-block;transform: rotate(-45deg);}.ace_searchbtn.next:after {border-width: 0 2px 2px 0 ;}.ace_searchbtn_close {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;border-radius: 50%;border: 0 none;color: #656565;cursor: pointer;font: 16px/16px Arial;padding: 0;height: 14px;width: 14px;top: 9px;right: 7px;position: absolute;}.ace_searchbtn_close:hover {background-color: #656565;background-position: 50% 100%;color: white;}.ace_button {margin-left: 2px;cursor: pointer;-webkit-user-select: none;-moz-user-select: none;-o-user-select: none;-ms-user-select: none;user-select: none;overflow: hidden;opacity: 0.7;border: 1px solid rgba(100,100,100,0.23);padding: 1px;box-sizing: border-box!important;color: black;}.ace_button:hover {background-color: #eee;opacity:1;}.ace_button:active {background-color: #ddd;}.ace_button.checked {border-color: #3399ff;opacity:1;}.ace_search_options{margin-bottom: 3px;text-align: right;-webkit-user-select: none;-moz-user-select: none;-o-user-select: none;-ms-user-select: none;user-select: none;clear: both;}.ace_search_counter {float: left;font-family: arial;padding: 0 8px;}',u=e("../keyboard/hash_handler").HashHandler,a=e("../lib/keys"),f=999;r.importCssString(o,"ace_searchbox");var l=function(e,t,n){var i=r.createElement("div");r.buildDom(["div",{"class":"ace_search right"},["span",{action:"hide","class":"ace_searchbtn_close"}],["div",{"class":"ace_search_form"},["input",{"class":"ace_search_field",placeholder:"Search for",spellcheck:"false"}],["span",{action:"findPrev","class":"ace_searchbtn prev"},"\u200b"],["span",{action:"findNext","class":"ace_searchbtn next"},"\u200b"],["span",{action:"findAll","class":"ace_searchbtn",title:"Alt-Enter"},"All"]],["div",{"class":"ace_replace_form"},["input",{"class":"ace_search_field",placeholder:"Replace with",spellcheck:"false"}],["span",{action:"replaceAndFindNext","class":"ace_searchbtn"},"Replace"],["span",{action:"replaceAll","class":"ace_searchbtn"},"All"]],["div",{"class":"ace_search_options"},["span",{action:"toggleReplace","class":"ace_button",title:"Toggle Replace mode",style:"float:left;margin-top:-2px;padding:0 5px;"},"+"],["span",{"class":"ace_search_counter"}],["span",{action:"toggleRegexpMode","class":"ace_button",title:"RegExp Search"},".*"],["span",{action:"toggleCaseSensitive","class":"ace_button",title:"CaseSensitive Search"},"Aa"],["span",{action:"toggleWholeWords","class":"ace_button",title:"Whole Word Search"},"\\b"],["span",{action:"searchInSelection","class":"ace_button",title:"Search In Selection"},"S"]]],i),this.element=i.firstChild,this.setSession=this.setSession.bind(this),this.$init(),this.setEditor(e),r.importCssString(o,"ace_searchbox",e.container)};(function(){this.setEditor=function(e){e.searchBox=this,e.renderer.scroller.appendChild(this.element),this.editor=e},this.setSession=function(e){this.searchRange=null,this.$syncOptions(!0)},this.$initElements=function(e){this.searchBox=e.querySelector(".ace_search_form"),this.replaceBox=e.querySelector(".ace_replace_form"),this.searchOption=e.querySelector("[action=searchInSelection]"),this.replaceOption=e.querySelector("[action=toggleReplace]"),this.regExpOption=e.querySelector("[action=toggleRegexpMode]"),this.caseSensitiveOption=e.querySelector("[action=toggleCaseSensitive]"),this.wholeWordOption=e.querySelector("[action=toggleWholeWords]"),this.searchInput=this.searchBox.querySelector(".ace_search_field"),this.replaceInput=this.replaceBox.querySelector(".ace_search_field"),this.searchCounter=e.querySelector(".ace_search_counter")},this.$init=function(){var e=this.element;this.$initElements(e);var t=this;s.addListener(e,"mousedown",function(e){setTimeout(function(){t.activeInput.focus()},0),s.stopPropagation(e)}),s.addListener(e,"click",function(e){var n=e.target||e.srcElement,r=n.getAttribute("action");r&&t[r]?t[r]():t.$searchBarKb.commands[r]&&t.$searchBarKb.commands[r].exec(t),s.stopPropagation(e)}),s.addCommandKeyListener(e,function(e,n,r){var i=a.keyCodeToString(r),o=t.$searchBarKb.findKeyCommand(n,i);o&&o.exec&&(o.exec(t),s.stopEvent(e))}),this.$onChange=i.delayedCall(function(){t.find(!1,!1)}),s.addListener(this.searchInput,"input",function(){t.$onChange.schedule(20)}),s.addListener(this.searchInput,"focus",function(){t.activeInput=t.searchInput,t.searchInput.value&&t.highlight()}),s.addListener(this.replaceInput,"focus",function(){t.activeInput=t.replaceInput,t.searchInput.value&&t.highlight()})},this.$closeSearchBarKb=new u([{bindKey:"Esc",name:"closeSearchBar",exec:function(e){e.searchBox.hide()}}]),this.$searchBarKb=new u,this.$searchBarKb.bindKeys({"Ctrl-f|Command-f":function(e){var t=e.isReplace=!e.isReplace;e.replaceBox.style.display=t?"":"none",e.replaceOption.checked=!1,e.$syncOptions(),e.searchInput.focus()},"Ctrl-H|Command-Option-F":function(e){if(e.editor.getReadOnly())return;e.replaceOption.checked=!0,e.$syncOptions(),e.replaceInput.focus()},"Ctrl-G|Command-G":function(e){e.findNext()},"Ctrl-Shift-G|Command-Shift-G":function(e){e.findPrev()},esc:function(e){setTimeout(function(){e.hide()})},Return:function(e){e.activeInput==e.replaceInput&&e.replace(),e.findNext()},"Shift-Return":function(e){e.activeInput==e.replaceInput&&e.replace(),e.findPrev()},"Alt-Return":function(e){e.activeInput==e.replaceInput&&e.replaceAll(),e.findAll()},Tab:function(e){(e.activeInput==e.replaceInput?e.searchInput:e.replaceInput).focus()}}),this.$searchBarKb.addCommands([{name:"toggleRegexpMode",bindKey:{win:"Alt-R|Alt-/",mac:"Ctrl-Alt-R|Ctrl-Alt-/"},exec:function(e){e.regExpOption.checked=!e.regExpOption.checked,e.$syncOptions()}},{name:"toggleCaseSensitive",bindKey:{win:"Alt-C|Alt-I",mac:"Ctrl-Alt-R|Ctrl-Alt-I"},exec:function(e){e.caseSensitiveOption.checked=!e.caseSensitiveOption.checked,e.$syncOptions()}},{name:"toggleWholeWords",bindKey:{win:"Alt-B|Alt-W",mac:"Ctrl-Alt-B|Ctrl-Alt-W"},exec:function(e){e.wholeWordOption.checked=!e.wholeWordOption.checked,e.$syncOptions()}},{name:"toggleReplace",exec:function(e){e.replaceOption.checked=!e.replaceOption.checked,e.$syncOptions()}},{name:"searchInSelection",exec:function(e){e.searchOption.checked=!e.searchRange,e.setSearchRange(e.searchOption.checked&&e.editor.getSelectionRange()),e.$syncOptions()}}]),this.setSearchRange=function(e){this.searchRange=e,e?this.searchRangeMarker=this.editor.session.addMarker(e,"ace_active-line"):this.searchRangeMarker&&(this.editor.session.removeMarker(this.searchRangeMarker),this.searchRangeMarker=null)},this.$syncOptions=function(e){r.setCssClass(this.replaceOption,"checked",this.searchRange),r.setCssClass(this.searchOption,"checked",this.searchOption.checked),this.replaceOption.textContent=this.replaceOption.checked?"-":"+",r.setCssClass(this.regExpOption,"checked",this.regExpOption.checked),r.setCssClass(this.wholeWordOption,"checked",this.wholeWordOption.checked),r.setCssClass(this.caseSensitiveOption,"checked",this.caseSensitiveOption.checked);var t=this.editor.getReadOnly();this.replaceOption.style.display=t?"none":"",this.replaceBox.style.display=this.replaceOption.checked&&!t?"":"none",this.find(!1,!1,e)},this.highlight=function(e){this.editor.session.highlight(e||this.editor.$search.$options.re),this.editor.renderer.updateBackMarkers()},this.find=function(e,t,n){var i=this.editor.find(this.searchInput.value,{skipCurrent:e,backwards:t,wrap:!0,regExp:this.regExpOption.checked,caseSensitive:this.caseSensitiveOption.checked,wholeWord:this.wholeWordOption.checked,preventScroll:n,range:this.searchRange}),s=!i&&this.searchInput.value;r.setCssClass(this.searchBox,"ace_nomatch",s),this.editor._emit("findSearchBox",{match:!s}),this.highlight(),this.updateCounter()},this.updateCounter=function(){var e=this.editor,t=e.$search.$options.re,n=0,r=0;if(t){var i=this.searchRange?e.session.getTextRange(this.searchRange):e.getValue(),s=e.session.doc.positionToIndex(e.selection.anchor);this.searchRange&&(s-=e.session.doc.positionToIndex(this.searchRange.start));var o=t.lastIndex=0,u;while(u=t.exec(i)){n++,o=u.index,o<=s&&r++;if(n>f)break;if(!u[0]){t.lastIndex=o+=1;if(o>=i.length)break}}}this.searchCounter.textContent=r+" of "+(n>f?f+"+":n)},this.findNext=function(){this.find(!0,!1)},this.findPrev=function(){this.find(!0,!0)},this.findAll=function(){var e=this.editor.findAll(this.searchInput.value,{regExp:this.regExpOption.checked,caseSensitive:this.caseSensitiveOption.checked,wholeWord:this.wholeWordOption.checked}),t=!e&&this.searchInput.value;r.setCssClass(this.searchBox,"ace_nomatch",t),this.editor._emit("findSearchBox",{match:!t}),this.highlight(),this.hide()},this.replace=function(){this.editor.getReadOnly()||this.editor.replace(this.replaceInput.value)},this.replaceAndFindNext=function(){this.editor.getReadOnly()||(this.editor.replace(this.replaceInput.value),this.findNext())},this.replaceAll=function(){this.editor.getReadOnly()||this.editor.replaceAll(this.replaceInput.value)},this.hide=function(){this.active=!1,this.setSearchRange(null),this.editor.off("changeSession",this.setSession),this.element.style.display="none",this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb),this.editor.focus()},this.show=function(e,t){this.active=!0,this.editor.on("changeSession",this.setSession),this.element.style.display="",this.replaceOption.checked=t,e&&(this.searchInput.value=e),this.searchInput.focus(),this.searchInput.select(),this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb),this.$syncOptions(!0)},this.isFocused=function(){var e=document.activeElement;return e==this.searchInput||e==this.replaceInput}}).call(l.prototype),t.SearchBox=l,t.Search=function(e,t){var n=e.searchBox||new l(e);n.show(e.session.getTextRange(),t)}}); (function() { + ace.require(["ace/ext/searchbox"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/plugins/scl-wizarding/ace/mode-xml.js b/plugins/scl-wizarding/ace/mode-xml.js new file mode 100644 index 0000000..709c38b --- /dev/null +++ b/plugins/scl-wizarding/ace/mode-xml.js @@ -0,0 +1,8 @@ +ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(e){var t="[_:a-zA-Z\u00c0-\uffff][-_:.a-zA-Z0-9\u00c0-\uffff]*";this.$rules={start:[{token:"string.cdata.xml",regex:"<\\!\\[CDATA\\[",next:"cdata"},{token:["punctuation.instruction.xml","keyword.instruction.xml"],regex:"(<\\?)("+t+")",next:"processing_instruction"},{token:"comment.start.xml",regex:"<\\!--",next:"comment"},{token:["xml-pe.doctype.xml","xml-pe.doctype.xml"],regex:"(<\\!)(DOCTYPE)(?=[\\s])",next:"doctype",caseInsensitive:!0},{include:"tag"},{token:"text.end-tag-open.xml",regex:"",next:"start"}],doctype:[{include:"whitespace"},{include:"string"},{token:"xml-pe.doctype.xml",regex:">",next:"start"},{token:"xml-pe.xml",regex:"[-_a-zA-Z0-9:]+"},{token:"punctuation.int-subset",regex:"\\[",push:"int_subset"}],int_subset:[{token:"text.xml",regex:"\\s+"},{token:"punctuation.int-subset.xml",regex:"]",next:"pop"},{token:["punctuation.markup-decl.xml","keyword.markup-decl.xml"],regex:"(<\\!)("+t+")",push:[{token:"text",regex:"\\s+"},{token:"punctuation.markup-decl.xml",regex:">",next:"pop"},{include:"string"}]}],cdata:[{token:"string.cdata.xml",regex:"\\]\\]>",next:"start"},{token:"text.xml",regex:"\\s+"},{token:"text.xml",regex:"(?:[^\\]]|\\](?!\\]>))+"}],comment:[{token:"comment.end.xml",regex:"-->",next:"start"},{defaultToken:"comment.xml"}],reference:[{token:"constant.language.escape.reference.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}],attr_reference:[{token:"constant.language.escape.reference.attribute-value.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}],tag:[{token:["meta.tag.punctuation.tag-open.xml","meta.tag.punctuation.end-tag-open.xml","meta.tag.tag-name.xml"],regex:"(?:(<)|(",next:"start"}]}],tag_whitespace:[{token:"text.tag-whitespace.xml",regex:"\\s+"}],whitespace:[{token:"text.whitespace.xml",regex:"\\s+"}],string:[{token:"string.xml",regex:"'",push:[{token:"string.xml",regex:"'",next:"pop"},{defaultToken:"string.xml"}]},{token:"string.xml",regex:'"',push:[{token:"string.xml",regex:'"',next:"pop"},{defaultToken:"string.xml"}]}],attributes:[{token:"entity.other.attribute-name.xml",regex:t},{token:"keyword.operator.attribute-equals.xml",regex:"="},{include:"tag_whitespace"},{include:"attribute_value"}],attribute_value:[{token:"string.attribute-value.xml",regex:"'",push:[{token:"string.attribute-value.xml",regex:"'",next:"pop"},{include:"attr_reference"},{defaultToken:"string.attribute-value.xml"}]},{token:"string.attribute-value.xml",regex:'"',push:[{token:"string.attribute-value.xml",regex:'"',next:"pop"},{include:"attr_reference"},{defaultToken:"string.attribute-value.xml"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:["meta.tag.punctuation.tag-open.xml","meta.tag."+n+".tag-name.xml"],regex:"(<)("+n+"(?=\\s|>|$))",next:[{include:"attributes"},{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",next:t+"start"}]}),this.$rules[n+"-end"]=[{include:"attributes"},{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",next:"start",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:["meta.tag.punctuation.end-tag-open.xml","meta.tag."+n+".tag-name.xml"],regex:"(|$))",next:n+"-end"},{token:"string.cdata.xml",regex:"<\\!\\[CDATA\\["},{token:"string.cdata.xml",regex:"\\]\\]>"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e,t,n){"use strict";function u(e,t){return e&&e.type.lastIndexOf(t+".xml")>-1}var r=e("../../lib/oop"),i=e("../behaviour").Behaviour,s=e("../../token_iterator").TokenIterator,o=e("../../lib/lang"),a=function(){this.add("string_dquotes","insertion",function(e,t,n,r,i){if(i=='"'||i=="'"){var o=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==""&&a!=="'"&&a!='"'&&n.getWrapBehavioursEnabled())return{text:o+a+o,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==o&&(u(p,"attribute-value")||u(p,"string")))return{text:"",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(u(p,"tag-whitespace")||u(p,"whitespace"))p=h.stepBackward();var d=!c||c.match(/\s/);if(u(p,"attribute-equals")&&(d||c==">")||u(p,"decl-attribute-equals")&&(d||c=="?"))return{text:o+o,selection:[1,1]}}}),this.add("string_dquotes","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='"'||s=="'")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add("autoclosing","insertion",function(e,t,n,r,i){if(i==">"){var o=n.getSelectionRange().start,a=new s(r,o.row,o.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(u(f,"tag-name")||u(f,"tag-whitespace")||u(f,"attribute-name")||u(f,"attribute-equals")||u(f,"attribute-value")))return;if(u(f,"reference.attribute-value"))return;if(u(f,"attribute-value")){var l=a.getCurrentTokenColumn()+f.value.length;if(o.column/.test(r.getLine(o.row).slice(o.column)))return;while(!u(f,"tag-name")){f=a.stepBackward();if(f.value=="<"){f=a.stepForward();break}}var h=a.getCurrentTokenRow(),p=a.getCurrentTokenColumn();if(u(a.stepBackward(),"end-tag-open"))return;var d=f.value;h==o.row&&(d=d.substring(0,o.column-p));if(this.voidElements.hasOwnProperty(d.toLowerCase()))return;return{text:">",selection:[1,1]}}}),this.add("autoindent","insertion",function(e,t,n,r,i){if(i=="\n"){var o=n.getCursorPosition(),u=r.getLine(o.row),a=new s(r,o.row,o.column),f=a.getCurrentToken();if(f&&f.type.indexOf("tag-close")!==-1){if(f.value=="/>")return;while(f&&f.type.indexOf("tag-name")===-1)f=a.stepBackward();if(!f)return;var l=f.value,c=a.getCurrentTokenRow();f=a.stepBackward();if(!f||f.type.indexOf("end-tag")!==-1)return;if(this.voidElements&&!this.voidElements[l]){var h=r.getTokenAt(o.row,o.column+1),u=r.getLine(c),p=this.$getIndent(u),d=p+r.getTabString();return h&&h.value==="-1}var r=e("../../lib/oop"),i=e("../../lib/lang"),s=e("../../range").Range,o=e("./fold_mode").FoldMode,u=e("../../token_iterator").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=e||{},this.optionalEndTags=r.mixin({},this.voidElements),t&&r.mixin(this.optionalEndTags,t)};r.inherits(a,o);var f=function(){this.tagName="",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t=="markbeginend"?"end":"":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?"":this._findEndTagInLine(e,n,r.tagName,r.end.column)?"":"start":this.getCommentFoldWidget(e,n)},this.getCommentFoldWidget=function(e,t){return/comment/.test(e.getState(t))&&/";break}}return r}if(l(s,"tag-close"))return r.selfClosing=s.value=="/>",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,"tag-open"))return n.closing=l(t,"end-tag-open"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,"tag-name")?n.tagName=t.value:l(t,"tag-close")&&(n.selfClosing=t.value=="/>",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.optionalEndTags.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return this.getCommentFoldWidget(e,n)&&e.getCommentFoldRange(n,e.getLine(n).length);var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};r.start.row==r.end.row&&(l.column=r.end.column);while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,a.start.row==a.end.row&&a.start.column"},this.createWorker=function(e){var t=new f(["ace"],"ace/mode/xml_worker","Worker");return t.attachToDocument(e.getDocument()),t.on("error",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/xml"}.call(l.prototype),t.Mode=l}); (function() { + ace.require(["ace/mode/xml"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/plugins/scl-wizarding/ace/theme-solarized_dark.js b/plugins/scl-wizarding/ace/theme-solarized_dark.js new file mode 100644 index 0000000..ee1ac31 --- /dev/null +++ b/plugins/scl-wizarding/ace/theme-solarized_dark.js @@ -0,0 +1,8 @@ +ace.define("ace/theme/solarized_dark",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!0,t.cssClass="ace-solarized-dark",t.cssText=".ace-solarized-dark .ace_gutter {background: #01313f;color: #d0edf7}.ace-solarized-dark .ace_print-margin {width: 1px;background: #33555E}.ace-solarized-dark {background-color: #002B36;color: #93A1A1}.ace-solarized-dark .ace_entity.ace_other.ace_attribute-name,.ace-solarized-dark .ace_storage {color: #93A1A1}.ace-solarized-dark .ace_cursor,.ace-solarized-dark .ace_string.ace_regexp {color: #D30102}.ace-solarized-dark .ace_marker-layer .ace_active-line,.ace-solarized-dark .ace_marker-layer .ace_selection {background: rgba(255, 255, 255, 0.1)}.ace-solarized-dark.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #002B36;}.ace-solarized-dark .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-solarized-dark .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(147, 161, 161, 0.50)}.ace-solarized-dark .ace_gutter-active-line {background-color: #0d3440}.ace-solarized-dark .ace_marker-layer .ace_selected-word {border: 1px solid #073642}.ace-solarized-dark .ace_invisible {color: rgba(147, 161, 161, 0.50)}.ace-solarized-dark .ace_keyword,.ace-solarized-dark .ace_meta,.ace-solarized-dark .ace_support.ace_class,.ace-solarized-dark .ace_support.ace_type {color: #859900}.ace-solarized-dark .ace_constant.ace_character,.ace-solarized-dark .ace_constant.ace_other {color: #CB4B16}.ace-solarized-dark .ace_constant.ace_language {color: #B58900}.ace-solarized-dark .ace_constant.ace_numeric {color: #D33682}.ace-solarized-dark .ace_fold {background-color: #268BD2;border-color: #93A1A1}.ace-solarized-dark .ace_entity.ace_name.ace_function,.ace-solarized-dark .ace_entity.ace_name.ace_tag,.ace-solarized-dark .ace_support.ace_function,.ace-solarized-dark .ace_variable,.ace-solarized-dark .ace_variable.ace_language {color: #268BD2}.ace-solarized-dark .ace_string {color: #2AA198}.ace-solarized-dark .ace_comment {font-style: italic;color: #657B83}.ace-solarized-dark .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNg0Db1ZVCxc/sPAAd4AlUHlLenAAAAAElFTkSuQmCC) right repeat-y}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}); (function() { + ace.require(["ace/theme/solarized_dark"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/plugins/scl-wizarding/ace/theme-solarized_light.js b/plugins/scl-wizarding/ace/theme-solarized_light.js new file mode 100644 index 0000000..a66ca4c --- /dev/null +++ b/plugins/scl-wizarding/ace/theme-solarized_light.js @@ -0,0 +1,8 @@ +ace.define("ace/theme/solarized_light",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!1,t.cssClass="ace-solarized-light",t.cssText=".ace-solarized-light .ace_gutter {background: #fbf1d3;color: #333}.ace-solarized-light .ace_print-margin {width: 1px;background: #e8e8e8}.ace-solarized-light {background-color: #FDF6E3;color: #586E75}.ace-solarized-light .ace_cursor {color: #000000}.ace-solarized-light .ace_marker-layer .ace_selection {background: rgba(7, 54, 67, 0.09)}.ace-solarized-light.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #FDF6E3;}.ace-solarized-light .ace_marker-layer .ace_step {background: rgb(255, 255, 0)}.ace-solarized-light .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(147, 161, 161, 0.50)}.ace-solarized-light .ace_marker-layer .ace_active-line {background: #EEE8D5}.ace-solarized-light .ace_gutter-active-line {background-color : #EDE5C1}.ace-solarized-light .ace_marker-layer .ace_selected-word {border: 1px solid #7f9390}.ace-solarized-light .ace_invisible {color: rgba(147, 161, 161, 0.50)}.ace-solarized-light .ace_keyword,.ace-solarized-light .ace_meta,.ace-solarized-light .ace_support.ace_class,.ace-solarized-light .ace_support.ace_type {color: #859900}.ace-solarized-light .ace_constant.ace_character,.ace-solarized-light .ace_constant.ace_other {color: #CB4B16}.ace-solarized-light .ace_constant.ace_language {color: #B58900}.ace-solarized-light .ace_constant.ace_numeric {color: #D33682}.ace-solarized-light .ace_fold {background-color: #268BD2;border-color: #586E75}.ace-solarized-light .ace_entity.ace_name.ace_function,.ace-solarized-light .ace_entity.ace_name.ace_tag,.ace-solarized-light .ace_support.ace_function,.ace-solarized-light .ace_variable,.ace-solarized-light .ace_variable.ace_language {color: #268BD2}.ace-solarized-light .ace_storage {color: #073642}.ace-solarized-light .ace_string {color: #2AA198}.ace-solarized-light .ace_string.ace_regexp {color: #D30102}.ace-solarized-light .ace_comment,.ace-solarized-light .ace_entity.ace_other.ace_attribute-name {color: #93A1A1}.ace-solarized-light .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHjy8NJ/AAjgA5fzQUmBAAAAAElFTkSuQmCC) right repeat-y}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}); (function() { + ace.require(["ace/theme/solarized_light"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); + \ No newline at end of file diff --git a/plugins/scl-wizarding/ace/worker-xml.js b/plugins/scl-wizarding/ace/worker-xml.js new file mode 100644 index 0000000..e3ad301 --- /dev/null +++ b/plugins/scl-wizarding/ace/worker-xml.js @@ -0,0 +1 @@ +"no use strict";!function(e){function t(e,t){var n=e,r="";while(n){var i=t[n];if(typeof i=="string")return i+r;if(i)return i.location.replace(/\/*$/,"/")+(r||i.main||i.name);if(i===!1)return"";var s=n.lastIndexOf("/");if(s===-1)break;r=n.substr(s)+r,n=n.slice(0,s)}return e}if(typeof e.window!="undefined"&&e.document)return;if(e.require&&e.define)return;e.console||(e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console),e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){postMessage({type:"error",data:{message:e,data:i.data,file:t,line:n,col:r,stack:i.stack}})},e.normalizeModule=function(t,n){if(n.indexOf("!")!==-1){var r=n.split("!");return e.normalizeModule(t,r[0])+"!"+e.normalizeModule(t,r[1])}if(n.charAt(0)=="."){var i=t.split("/").slice(0,-1).join("/");n=(i?i+"/":"")+n;while(n.indexOf(".")!==-1&&s!=n){var s=n;n=n.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return n},e.require=function(r,i){i||(i=r,r=null);if(!i.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");i=e.normalizeModule(r,i);var s=e.require.modules[i];if(s)return s.initialized||(s.initialized=!0,s.exports=s.factory().exports),s.exports;if(!e.require.tlns)return console.log("unable to load "+i);var o=t(i,e.require.tlns);return o.slice(-3)!=".js"&&(o+=".js"),e.require.id=i,e.require.modules[i]={},importScripts(o),e.require(r,i)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!="string"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id);if(typeof r!="function"){e.require.modules[t]={exports:r,initialized:!0};return}n.length||(n=["require","exports","module"]);var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.slice(0,r.length).map(function(t){switch(t){case"require":return i;case"exports":return e.exports;case"module":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},require.tlns={},e.initBaseUrls=function(t){for(var n in t)require.tlns[n]=t[n]},e.initSender=function(){var n=e.require("ace/lib/event_emitter").EventEmitter,r=e.require("ace/lib/oop"),i=function(){};return function(){r.implement(this,n),this.callback=function(e,t){postMessage({type:"call",id:t,data:e})},this.emit=function(e,t){postMessage({type:"event",name:e,data:t})}}.call(i.prototype),new i};var n=e.main=null,r=e.sender=null;e.onmessage=function(t){var i=t.data;if(i.event&&r)r._signal(i.event,i.data);else if(i.command)if(n[i.command])n[i.command].apply(n,i.args);else{if(!e[i.command])throw new Error("Unknown command:"+i.command);e[i.command].apply(e,i.args)}else if(i.init){e.initBaseUrls(i.tlns),r=e.sender=e.initSender();var s=require(i.module)[i.classname];n=e.main=new s(r)}}}(this),ace.define("ace/lib/oop",[],function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),ace.define("ace/lib/lang",[],function(e,t,n){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){var n="";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e=="object"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e=="object"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?tthis.end.column?1:0:ethis.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.rowt)var r={row:t+1,column:0};else if(this.start.row=0&&t.row=0&&t.column<=e[t.row].length}function s(e,t){t.action!="insert"&&t.action!="remove"&&r(t,"delta.action must be 'insert' or 'remove'"),t.lines instanceof Array||r(t,"delta.lines must be an Array"),(!t.start||!t.end)&&r(t,"delta.start/end must be an present");var n=t.start;i(e,t.start)||r(t,"delta.start must be contained in document");var s=t.end;t.action=="remove"&&!i(e,s)&&r(t,"delta.end must contained in document for 'remove' actions");var o=s.row-n.row,u=s.column-(o==0?n.column:0);(o!=t.lines.length-1||t.lines[o].length!=u)&&r(t,"delta.range must match delta lines")}t.applyDelta=function(e,t,n){var r=t.start.row,i=t.start.column,s=e[r]||"";switch(t.action){case"insert":var o=t.lines;if(o.length===1)e[r]=s.substring(0,i)+t.lines[0]+s.substring(i);else{var u=[r,1].concat(t.lines);e.splice.apply(e,u),e[r]=s.substring(0,i)+e[r],e[r+t.lines.length-1]+=s.substring(i)}break;case"remove":var a=t.end.column,f=t.end.row;r===f?e[r]=s.substring(0,i)+s.substring(a):e.splice(r,f-r+1,s.substring(0,i)+e[f].substring(a))}}}),ace.define("ace/lib/event_emitter",[],function(e,t,n){"use strict";var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!="object"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;othis.row)return;var n=t(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:i,value:r})},this.detach=function(){this.document.off("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),ace.define("ace/document",[],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./apply_delta").applyDelta,s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=e("./anchor").Anchor,a=function(e){this.$lines=[""],e.length===0?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){r.implement(this,s),this.setValue=function(e){var t=this.getLength()-1;this.remove(new o(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new u(this,e,t)},"aaa".split(/a/).length===0?this.$split=function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal("changeNewLineMode")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e=="\r\n"||e=="\r"||e=="\n"},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},this.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{t=this.getLines(e.start.row,e.end.row),t[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column))}return t},this.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},this.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},this.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},this.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},this.insertInLine=function(e,t){var n=this.clippedPos(e.row,e.column),r=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:r,action:"insert",lines:[t]},!0),this.clonePos(r)},this.clippedPos=function(e,t){var n=this.getLength();e===undefined?e=n:e<0?e=0:e>=n&&(e=n-1,t=undefined);var r=this.getLine(e);return t==undefined&&(t=r.length),t=Math.min(Math.max(t,0),r.length),{row:e,column:t}},this.clonePos=function(e){return{row:e.row,column:e.column}},this.pos=function(e,t){return{row:e,column:t}},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},this.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var n=0;e0,r=t=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},this.replace=function(e,t){e instanceof o||(e=o.fromPoints(e.start,e.end));if(t.length===0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);var n;return t?n=this.insert(e.start,t):n=e.start,n},this.applyDeltas=function(e){for(var t=0;t=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var n=e.action=="insert";if(n?e.lines.length<=1&&!e.lines[0]:!o.comparePoints(e.start,e.end))return;n&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(i(this.$lines,e,t),this._signal("change",e))},this.$safeApplyDelta=function(e){var t=this.$lines.length;(e.action=="remove"&&e.start.row65535){e-=65536;var t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function o(e){var t=e.slice(1,-1);return t in n?n[t]:t.charAt(0)==="#"?s(parseInt(t.substr(1).replace("x","0x"))):(i.error("entity not found:"+e),e)}function u(t){var n=e.substring(v,t).replace(/&#?\w+;/g,o);h&&a(v),r.characters(n,0,t-v),v=t}function a(t,n){while(t>=l&&(n=c.exec(e)))f=n.index,l=f+n[0].length,h.lineNumber++;h.columnNumber=t-f+1}var f=0,l=0,c=/.+(?:\r\n?|\n)|.*$/g,h=r.locator,p=[{currentNSMap:t}],d={},v=0;for(;;){var E=e.indexOf("<",v);if(E<0){if(!e.substr(v).match(/^\s*$/)){var N=r.document,C=N.createTextNode(e.substr(v));N.appendChild(C),r.currentElement=C}return}E>v&&u(E);switch(e.charAt(E+1)){case"/":var k=e.indexOf(">",E+3),L=e.substring(E+2,k),A;if(!(p.length>1)){i.fatalError("end tag name not found for: "+L);break}A=p.pop();var O=A.localNSMap;A.tagName!=L&&i.fatalError("end tag name: "+L+" does not match the current start tagName: "+A.tagName),r.endElement(A.uri,A.localName,L);if(O)for(var M in O)r.endPrefixMapping(M);k++;break;case"?":h&&a(E),k=x(e,E,r);break;case"!":h&&a(E),k=S(e,E,r,i);break;default:try{h&&a(E);var _=new T,k=g(e,E,_,o,i),D=_.length;if(D&&h){var P=m(h,{});for(var E=0;E0))throw new Error("attribute value no end '"+g+"' match");d=e.slice(t,v).replace(/&#?\w+;/g,r),n.add(s,d,t-1),m=c}else{if(m!=l)throw new Error('attribute value must after "="');d=e.slice(t,v).replace(/&#?\w+;/g,r),n.add(s,d,t),i.warning('attribute "'+s+'" missed start quot('+g+")!!"),t=v+1,m=c}break;case"/":switch(m){case o:n.setTagName(e.slice(t,v));case c:case h:case p:m=p,n.closed=!0;case l:case u:case a:break;default:throw new Error("attribute invalid close char('/')")}break;case"":i.error("unexpected end of input");case">":switch(m){case o:n.setTagName(e.slice(t,v));case c:case h:case p:break;case l:case u:d=e.slice(t,v),d.slice(-1)==="/"&&(n.closed=!0,d=d.slice(0,-1));case a:m===a&&(d=s),m==l?(i.warning('attribute "'+d+'" missed quot(")!!'),n.add(s,d.replace(/&#?\w+;/g,r),t)):(i.warning('attribute "'+d+'" missed value!! "'+d+'" instead!!'),n.add(d,d,t));break;case f:throw new Error("attribute value missed!!")}return v;case"\u0080":g=" ";default:if(g<=" ")switch(m){case o:n.setTagName(e.slice(t,v)),m=h;break;case u:s=e.slice(t,v),m=a;break;case l:var d=e.slice(t,v).replace(/&#?\w+;/g,r);i.warning('attribute "'+d+'" missed quot(")!!'),n.add(s,d,t);case c:m=h}else switch(m){case a:i.warning('attribute "'+s+'" missed value!! "'+s+'" instead!!'),n.add(s,s,t),t=v,m=u;break;case c:i.warning('attribute space is required"'+s+'"!!');case h:m=u,t=v;break;case f:m=l,t=v;break;case p:throw new Error("elements closed character '/' and '>' must be connected to")}}v++}}function y(e,t,n){var r=e.tagName,i=null,s=n[n.length-1].currentNSMap,o=e.length;while(o--){var u=e[o],a=u.qName,f=u.value,l=a.indexOf(":");if(l>0)var c=u.prefix=a.slice(0,l),h=a.slice(l+1),p=c==="xmlns"&&h;else h=a,c=null,p=a==="xmlns"&&"";u.localName=h,p!==!1&&(i==null&&(i={},E(s,s={})),s[p]=i[p]=f,u.uri="http://www.w3.org/2000/xmlns/",t.startPrefixMapping(p,f))}var o=e.length;while(o--){u=e[o];var c=u.prefix;c&&(c==="xml"&&(u.uri="http://www.w3.org/XML/1998/namespace"),c!=="xmlns"&&(u.uri=s[c]))}var l=r.indexOf(":");l>0?(c=e.prefix=r.slice(0,l),h=e.localName=r.slice(l+1)):(c=null,h=e.localName=r);var d=e.uri=s[c||""];t.startElement(d,h,r,e);if(e.closed){t.endElement(d,h,r);if(i)for(c in i)t.endPrefixMapping(c)}else e.currentNSMap=s,e.localNSMap=i,n.push(e)}function b(e,t,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var s=e.indexOf("",t),o=e.substring(t+1,s);if(/[&<]/.test(o))return/^script$/i.test(n)?(i.characters(o,0,o.length),s):(o=o.replace(/&#?\w+;/g,r),i.characters(o,0,o.length),s)}return t+1}function w(e,t,n,r){var i=r[n];return i==null&&(i=r[n]=e.lastIndexOf("")),i",t+4);return s>t?(n.comment(e,t+4,s-t-4),s+3):(r.error("Unclosed comment"),-1)}return-1;default:if(e.substr(t+3,6)=="CDATA["){var s=e.indexOf("]]>",t+9);return s>t?(n.startCDATA(),n.characters(e,t+9,s-t-9),n.endCDATA(),s+3):(r.error("Unclosed CDATA"),-1)}var o=C(e,t),u=o.length;if(u>1&&/!doctype/i.test(o[0][0])){var a=o[1][0],f=u>3&&/^public$/i.test(o[2][0])&&o[3][0],l=u>4&&o[4][0],c=o[u-1];return n.startDTD(a,f&&f.replace(/^(['"])(.*?)\1$/,"$2"),l&&l.replace(/^(['"])(.*?)\1$/,"$2")),n.endDTD(),c.index+c[0].length}}return-1}function x(e,t,n){var r=e.indexOf("?>",t);if(r){var i=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(i){var s=i[0].length;return n.processingInstruction(i[1],i[2]),r+2}return-1}return-1}function T(e){}function N(e,t){return e.__proto__=t,e}function C(e,t){var n,r=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;i.lastIndex=t,i.exec(e);while(n=i.exec(e)){r.push(n);if(n[1])return r}}var r=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,i=new RegExp("[\\-\\.0-9"+r.source.slice(1,-1)+"\u00b7\u0300-\u036f\\ux203F-\u2040]"),s=new RegExp("^"+r.source+i.source+"*(?::"+r.source+i.source+"*)?$"),o=0,u=1,a=2,f=3,l=4,c=5,h=6,p=7;return d.prototype={parse:function(e,t,n){var r=this.domBuilder;r.startDocument(),E(t,t={}),v(e,t,n,r,this.errorHandler),r.endDocument()}},T.prototype={setTagName:function(e){if(!s.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},add:function(e,t,n){if(!s.test(e))throw new Error("invalid attribute:"+e);this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getOffset:function(e){return this[e].offset},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},N({},N.prototype)instanceof N||(N=function(e,t){function n(){}n.prototype=t,n=new n;for(t in e)n[t]=e[t];return n}),d}),ace.define("ace/mode/xml/dom",[],function(e,t,n){function r(e,t){for(var n in e)t[n]=e[n]}function i(e,t){var n=function(){},i=e.prototype;if(Object.create){var s=Object.create(t.prototype);i.__proto__=s}i instanceof t||(n.prototype=t.prototype,n=new n,r(i,n),e.prototype=i=n),i.constructor!=e&&(typeof e!="function"&&console.error("unknown Class:"+e),i.constructor=e)}function B(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,w[e]),this.message=w[e],Error.captureStackTrace&&Error.captureStackTrace(this,B);return n.code=e,t&&(this.message=this.message+": "+t),n}function j(){}function F(e,t){this._node=e,this._refresh=t,I(this)}function I(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var n=e._refresh(e._node);gt(e,"length",n.length),r(n,e),e._inc=t}}function q(){}function R(e,t){var n=e.length;while(n--)if(e[n]===t)return n}function U(e,t,n,r){r?t[R(t,r)]=n:t[t.length++]=n;if(e){n.ownerElement=e;var i=e.ownerDocument;i&&(r&&Q(i,e,r),K(i,e,n))}}function z(e,t,n){var r=R(t,n);if(!(r>=0))throw new B(L,new Error);var i=t.length-1;while(r"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}function $(e,t){if(t(e))return!0;if(e=e.firstChild)do if($(e,t))return!0;while(e=e.nextSibling)}function J(){}function K(e,t,n){e&&e._inc++;var r=n.namespaceURI;r=="http://www.w3.org/2000/xmlns/"&&(t._nsMap[n.prefix?n.localName:""]=n.value)}function Q(e,t,n,r){e&&e._inc++;var i=n.namespaceURI;i=="http://www.w3.org/2000/xmlns/"&&delete t._nsMap[n.prefix?n.localName:""]}function G(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n)r[r.length++]=n;else{var i=t.firstChild,s=0;while(i)r[s++]=i,i=i.nextSibling;r.length=s}}}function Y(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,G(e.ownerDocument,e),t}function Z(e,t,n){var r=t.parentNode;r&&r.removeChild(t);if(t.nodeType===g){var i=t.firstChild;if(i==null)return t;var s=t.lastChild}else i=s=t;var o=n?n.previousSibling:e.lastChild;i.previousSibling=o,s.nextSibling=n,o?o.nextSibling=i:e.firstChild=i,n==null?e.lastChild=s:n.previousSibling=s;do i.parentNode=e;while(i!==s&&(i=i.nextSibling));return G(e.ownerDocument||e,e),t.nodeType==g&&(t.firstChild=t.lastChild=null),t}function et(e,t){var n=t.parentNode;if(n){var r=e.lastChild;n.removeChild(t);var r=e.lastChild}var r=e.lastChild;return t.parentNode=e,t.previousSibling=r,t.nextSibling=null,r?r.nextSibling=t:e.firstChild=t,e.lastChild=t,G(e.ownerDocument,e,t),t}function tt(){this._nsMap={}}function nt(){}function rt(){}function it(){}function st(){}function ot(){}function ut(){}function at(){}function ft(){}function lt(){}function ct(){}function ht(){}function pt(){}function dt(e,t){switch(e.nodeType){case u:var n=e.attributes,r=n.length,i=e.firstChild,o=e.tagName,h=s===e.namespaceURI;t.push("<",o);for(var y=0;y");if(h&&/^script$/i.test(o))i&&t.push(i.data);else while(i)dt(i,t),i=i.nextSibling;t.push("")}else t.push("/>");return;case v:case g:var i=e.firstChild;while(i)dt(i,t),i=i.nextSibling;return;case a:return t.push(" ",e.name,'="',e.value.replace(/[<&"]/g,V),'"');case f:return t.push(e.data.replace(/[<&]/g,V));case l:return t.push("");case d:return t.push("");case m:var b=e.publicId,w=e.systemId;t.push("');else if(w&&w!=".")t.push(' SYSTEM "',w,'">');else{var E=e.internalSubset;E&&t.push(" [",E,"]"),t.push(">")}return;case p:return t.push("");case c:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function vt(e,t,n){var r;switch(t.nodeType){case u:r=t.cloneNode(!1),r.ownerDocument=e;case g:break;case a:n=!0}r||(r=t.cloneNode(!1)),r.ownerDocument=e,r.parentNode=null;if(n){var i=t.firstChild;while(i)r.appendChild(vt(e,i,n)),i=i.nextSibling}return r}function mt(e,t,n){var r=new t.constructor;for(var i in t){var s=t[i];typeof s!="object"&&s!=r[i]&&(r[i]=s)}t.childNodes&&(r.childNodes=new j),r.ownerDocument=e;switch(r.nodeType){case u:var o=t.attributes,f=r.attributes=new q,l=o.length;f._ownerElement=r;for(var c=0;c0},lookupPrefix:function(e){var t=this;while(t){var n=t._nsMap;if(n)for(var r in n)if(n[r]==e)return r;t=t.nodeType==2?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){var t=this;while(t){var n=t._nsMap;if(n&&e in n)return n[e];t=t.nodeType==2?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){var t=this.lookupPrefix(e);return t==null}},r(o,X),r(o,X.prototype),J.prototype={nodeName:"#document",nodeType:v,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==g){var n=e.firstChild;while(n){var r=n.nextSibling;this.insertBefore(n,t),n=r}return e}return this.documentElement==null&&e.nodeType==1&&(this.documentElement=e),Z(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),Y(this,e)},importNode:function(e,t){return vt(this,e,t)},getElementById:function(e){var t=null;return $(this.documentElement,function(n){if(n.nodeType==1&&n.getAttribute("id")==e)return t=n,!0}),t},createElement:function(e){var t=new tt;t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.childNodes=new j;var n=t.attributes=new q;return n._ownerElement=t,t},createDocumentFragment:function(){var e=new ct;return e.ownerDocument=this,e.childNodes=new j,e},createTextNode:function(e){var t=new it;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new st;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new ot;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new ht;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new nt;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new lt;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new tt,r=t.split(":"),i=n.attributes=new q;return n.childNodes=new j,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,r.length==2?(n.prefix=r[0],n.localName=r[1]):n.localName=t,i._ownerElement=n,n},createAttributeNS:function(e,t){var n=new nt,r=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,r.length==2?(n.prefix=r[0],n.localName=r[1]):n.localName=t,n}},i(J,X),tt.prototype={nodeType:u,hasAttribute:function(e){return this.getAttributeNode(e)!=null},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===g?this.insertBefore(e,null):et(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return this.getAttributeNodeNS(e,t)!=null},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||""},setAttributeNS:function(e,t,n){var r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new F(this,function(t){var n=[];return $(t,function(r){r!==t&&r.nodeType==u&&(e==="*"||r.tagName==e)&&n.push(r)}),n})},getElementsByTagNameNS:function(e,t){return new F(this,function(n){var r=[];return $(n,function(i){i!==n&&i.nodeType===u&&(e==="*"||i.namespaceURI===e)&&(t==="*"||i.localName==t)&&r.push(i)}),r})}},J.prototype.getElementsByTagName=tt.prototype.getElementsByTagName,J.prototype.getElementsByTagNameNS=tt.prototype.getElementsByTagNameNS,i(tt,X),nt.prototype.nodeType=a,i(nt,X),rt.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(w[3])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,n){var r=this.data.substring(0,e),i=this.data.substring(e+t);n=r+n+i,this.nodeValue=this.data=n,this.length=n.length}},i(rt,X),it.prototype={nodeName:"#text",nodeType:f,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},i(it,rt),st.prototype={nodeName:"#comment",nodeType:d},i(st,rt),ot.prototype={nodeName:"#cdata-section",nodeType:l},i(ot,rt),ut.prototype.nodeType=m,i(ut,X),at.prototype.nodeType=y,i(at,X),ft.prototype.nodeType=h,i(ft,X),lt.prototype.nodeType=c,i(lt,X),ct.prototype.nodeName="#document-fragment",ct.prototype.nodeType=g,i(ct,X),ht.prototype.nodeType=p,i(ht,X),pt.prototype.serializeToString=function(e){var t=[];return dt(e,t),t.join("")},X.prototype.toString=function(){return pt.prototype.serializeToString(this)};try{Object.defineProperty&&(Object.defineProperty(F.prototype,"length",{get:function(){return I(this),this.$$length}}),Object.defineProperty(X.prototype,"textContent",{get:function(){return yt(this)},set:function(e){switch(this.nodeType){case 1:case 11:while(this.firstChild)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=value,this.nodeValue=e}}}),gt=function(e,t,n){e["$$"+t]=n})}catch(bt){}return W}),ace.define("ace/mode/xml/dom-parser",[],function(e,t,n){"use strict";function s(e){this.options=e||{locator:{}}}function o(e,t,n){function s(t){var s=e[t];if(!s)if(i)s=e.length==2?function(n){e(t,n)}:e;else{var o=arguments.length;while(--o)if(s=e[arguments[o]])break}r[t]=s&&function(e){s(e+f(n),e,n)}||function(){}}if(!e){if(t instanceof u)return t;e=t}var r={},i=e instanceof Function;return n=n||{},s("warning","warn"),s("error","warn","warning"),s("fatalError","warn","warning","error"),r}function u(){this.cdata=!1}function a(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function f(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function l(e,t,n){return typeof e=="string"?e.substr(t,n):e.length>=t+n||t?new java.lang.String(e,t,n)+"":e}function c(e,t){e.currentElement?e.currentElement.appendChild(t):e.document.appendChild(t)}var r=e("./sax"),i=e("./dom");return s.prototype.parseFromString=function(e,t){var n=this.options,i=new r,s=n.domBuilder||new u,a=n.errorHandler,f=n.locator,l=n.xmlns||{},c={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return f&&s.setDocumentLocator(f),i.errorHandler=o(a,s,f),i.domBuilder=n.domBuilder||s,/\/x?html?$/.test(t)&&(c.nbsp="\u00a0",c.copy="\u00a9",l[""]="http://www.w3.org/1999/xhtml"),e?i.parse(e,l,c):i.errorHandler.error("invalid document source"),s.document},u.prototype={startDocument:function(){this.document=(new i).createDocument(null,null,null),this.locator&&(this.document.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var i=this.document,s=i.createElementNS(e,n||t),o=r.length;c(this,s),this.currentElement=s,this.locator&&a(this.locator,s);for(var u=0;u; diff --git a/plugins/scl-wizarding/scl-wizarding.js b/plugins/scl-wizarding/scl-wizarding.js index dd25d60..7c7bb81 100644 --- a/plugins/scl-wizarding/scl-wizarding.js +++ b/plugins/scl-wizarding/scl-wizarding.js @@ -26014,9 +26014,6 @@ __decorate$1([ __decorate$1([ e$6({ attribute: false }) ], SclWizardDialog.prototype, "wizardRequest", void 0); -__decorate$1([ - e$6({ attribute: false }) -], SclWizardDialog.prototype, "element", void 0); __decorate$1([ t$1() ], SclWizardDialog.prototype, "pageIndex", void 0); @@ -46472,7 +46469,7 @@ let WizardCodeForm = class WizardCodeForm extends s$1 { >` : x ``} `; - return x `= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport default {\r\n __extends,\r\n __assign,\r\n __rest,\r\n __decorate,\r\n __param,\r\n __metadata,\r\n __awaiter,\r\n __generator,\r\n __createBinding,\r\n __exportStar,\r\n __values,\r\n __read,\r\n __spread,\r\n __spreadArrays,\r\n __spreadArray,\r\n __await,\r\n __asyncGenerator,\r\n __asyncDelegator,\r\n __asyncValues,\r\n __makeTemplateObject,\r\n __importStar,\r\n __importDefault,\r\n __classPrivateFieldGet,\r\n __classPrivateFieldSet,\r\n __classPrivateFieldIn,\r\n};\r\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=window,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&\"adoptedStyleSheets\"in Document.prototype&&\"replace\"in CSSStyleSheet.prototype,s=Symbol(),n=new WeakMap;class o{constructor(t,e,n){if(this._$cssResult$=!0,n!==s)throw Error(\"CSSResult is not constructable. Use `unsafeCSS` or `css` instead.\");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=n.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(s,t))}return t}toString(){return this.cssText}}const r=t=>new o(\"string\"==typeof t?t:t+\"\",void 0,s),i=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,s,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if(\"number\"==typeof t)return t;throw Error(\"Value passed to 'css' function must be a 'css' function result: \"+t+\". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.\")})(s)+t[n+1]),t[0]);return new o(n,t,s)},S=(s,n)=>{e?s.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((e=>{const n=document.createElement(\"style\"),o=t.litNonce;void 0!==o&&n.setAttribute(\"nonce\",o),n.textContent=e.cssText,s.appendChild(n)}))},c=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e=\"\";for(const s of t.cssRules)e+=s.cssText;return r(e)})(t):t;export{o as CSSResult,S as adoptStyles,i as css,c as getCompatibleStyle,e as supportsAdoptingStyleSheets,r as unsafeCSS};\n//# sourceMappingURL=css-tag.js.map\n","import{getCompatibleStyle as t,adoptStyles as i}from\"./css-tag.js\";export{CSSResult,adoptStyles,css,getCompatibleStyle,supportsAdoptingStyleSheets,unsafeCSS}from\"./css-tag.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */var s;const e=window,r=e.trustedTypes,h=r?r.emptyScript:\"\",o=e.reactiveElementPolyfillSupport,n={toAttribute(t,i){switch(i){case Boolean:t=t?h:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let s=t;switch(i){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},a=(t,i)=>i!==t&&(i==i||t==t),l={attribute:!0,type:String,converter:n,reflect:!1,hasChanged:a};class d extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var i;this.finalize(),(null!==(i=this.h)&&void 0!==i?i:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((i,s)=>{const e=this._$Ep(s,i);void 0!==e&&(this._$Ev.set(e,s),t.push(e))})),t}static createProperty(t,i=l){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){const s=\"symbol\"==typeof t?Symbol():\"__\"+t,e=this.getPropertyDescriptor(t,s,i);void 0!==e&&Object.defineProperty(this.prototype,t,e)}}static getPropertyDescriptor(t,i,s){return{get(){return this[i]},set(e){const r=this[t];this[i]=e,this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||l}static finalize(){if(this.hasOwnProperty(\"finalized\"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty(\"properties\")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const s of i)this.createProperty(s,t[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(i){const s=[];if(Array.isArray(i)){const e=new Set(i.flat(1/0).reverse());for(const i of e)s.unshift(t(i))}else void 0!==i&&s.push(t(i));return s}static _$Ep(t,i){const s=i.attribute;return!1===s?void 0:\"string\"==typeof s?s:\"string\"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var i,s;(null!==(i=this._$ES)&&void 0!==i?i:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(s=t.hostConnected)||void 0===s||s.call(t))}removeController(t){var i;null===(i=this._$ES)||void 0===i||i.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])}))}createRenderRoot(){var t;const s=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return i(s,this.constructor.elementStyles),s}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostConnected)||void 0===i?void 0:i.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostDisconnected)||void 0===i?void 0:i.call(t)}))}attributeChangedCallback(t,i,s){this._$AK(t,s)}_$EO(t,i,s=l){var e;const r=this.constructor._$Ep(t,s);if(void 0!==r&&!0===s.reflect){const h=(void 0!==(null===(e=s.converter)||void 0===e?void 0:e.toAttribute)?s.converter:n).toAttribute(i,s.type);this._$El=t,null==h?this.removeAttribute(r):this.setAttribute(r,h),this._$El=null}}_$AK(t,i){var s;const e=this.constructor,r=e._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=e.getPropertyOptions(r),h=\"function\"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(s=t.converter)||void 0===s?void 0:s.fromAttribute)?t.converter:n;this._$El=r,this[r]=h.fromAttribute(i,t.type),this._$El=null}}requestUpdate(t,i,s){let e=!0;void 0!==t&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||a)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===s.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,s))):e=!1),!this.isUpdatePending&&e&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,i)=>this[i]=t)),this._$Ei=void 0);let i=!1;const s=this._$AL;try{i=this.shouldUpdate(s),i?(this.willUpdate(s),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostUpdate)||void 0===i?void 0:i.call(t)})),this.update(s)):this._$Ek()}catch(t){throw i=!1,this._$Ek(),t}i&&this._$AE(s)}willUpdate(t){}_$AE(t){var i;null===(i=this._$ES)||void 0===i||i.forEach((t=>{var i;return null===(i=t.hostUpdated)||void 0===i?void 0:i.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,i)=>this._$EO(i,this[i],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}d.finalized=!0,d.elementProperties=new Map,d.elementStyles=[],d.shadowRootOptions={mode:\"open\"},null==o||o({ReactiveElement:d}),(null!==(s=e.reactiveElementVersions)&&void 0!==s?s:e.reactiveElementVersions=[]).push(\"1.6.1\");export{d as ReactiveElement,n as defaultConverter,a as notEqual};\n//# sourceMappingURL=reactive-element.js.map\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nvar t;const i=window,s=i.trustedTypes,e=s?s.createPolicy(\"lit-html\",{createHTML:t=>t}):void 0,o=\"$lit$\",n=`lit$${(Math.random()+\"\").slice(9)}$`,l=\"?\"+n,h=`<${l}>`,r=document,d=()=>r.createComment(\"\"),u=t=>null===t||\"object\"!=typeof t&&\"function\"!=typeof t,c=Array.isArray,v=t=>c(t)||\"function\"==typeof(null==t?void 0:t[Symbol.iterator]),a=\"[ \\t\\n\\f\\r]\",f=/<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g,_=/-->/g,m=/>/g,p=RegExp(`>|${a}(?:([^\\\\s\"'>=/]+)(${a}*=${a}*(?:[^ \\t\\n\\f\\r\"'\\`<>=]|(\"|')|))|$)`,\"g\"),g=/'/g,$=/\"/g,y=/^(?:script|style|textarea|title)$/i,w=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=w(1),b=w(2),T=Symbol.for(\"lit-noChange\"),A=Symbol.for(\"lit-nothing\"),E=new WeakMap,C=r.createTreeWalker(r,129,null,!1),P=(t,i)=>{const s=t.length-1,l=[];let r,d=2===i?\"\":\"\",u=f;for(let i=0;i\"===c[0]?(u=null!=r?r:f,v=-1):void 0===c[1]?v=-2:(v=u.lastIndex-c[2].length,e=c[1],u=void 0===c[3]?p:'\"'===c[3]?$:g):u===$||u===g?u=p:u===_||u===m?u=f:(u=p,r=void 0);const w=u===p&&t[i+1].startsWith(\"/>\")?\" \":\"\";d+=u===f?s+h:v>=0?(l.push(e),s.slice(0,v)+o+s.slice(v)+n+w):s+n+(-2===v?(l.push(void 0),i):w)}const c=d+(t[s]||\"\")+(2===i?\"\":\"\");if(!Array.isArray(t)||!t.hasOwnProperty(\"raw\"))throw Error(\"invalid template strings array\");return[void 0!==e?e.createHTML(c):c,l]};class V{constructor({strings:t,_$litType$:i},e){let h;this.parts=[];let r=0,u=0;const c=t.length-1,v=this.parts,[a,f]=P(t,i);if(this.el=V.createElement(a,e),C.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(h=C.nextNode())&&v.length0){h.textContent=s?s.emptyScript:\"\";for(let s=0;s2||\"\"!==s[0]||\"\"!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=N(this,t,i,0),n=!u(t)||t!==this._$AH&&t!==T,n&&(this._$AH=t);else{const e=t;let l,h;for(t=o[0],l=0;l{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new M(i.insertBefore(d(),t),t,void 0,null!=s?s:{})}return l._$AI(t),l};export{Z as _$LH,x as html,T as noChange,A as nothing,B as render,b as svg};\n//# sourceMappingURL=lit-html.js.map\n","import{ReactiveElement as t}from\"@lit/reactive-element\";export*from\"@lit/reactive-element\";import{render as e,noChange as i}from\"lit-html\";export*from\"lit-html\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */var l,o;const r=t;class s extends t{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=e(i,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return i}}s.finalized=!0,s._$litElement$=!0,null===(l=globalThis.litElementHydrateSupport)||void 0===l||l.call(globalThis,{LitElement:s});const n=globalThis.litElementPolyfillSupport;null==n||n({LitElement:s});const h={_$AK:(t,e,i)=>{t._$AK(e,i)},_$AL:t=>t._$AL};(null!==(o=globalThis.litElementVersions)&&void 0!==o?o:globalThis.litElementVersions=[]).push(\"3.3.2\");export{s as LitElement,r as UpdatingElement,h as _$LE};\n//# sourceMappingURL=lit-element.js.map\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst e=e=>n=>\"function\"==typeof n?((e,n)=>(customElements.define(e,n),n))(e,n):((e,n)=>{const{kind:t,elements:s}=n;return{kind:t,elements:s,finisher(n){customElements.define(e,n)}}})(e,n);export{e as customElement};\n//# sourceMappingURL=custom-element.js.map\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst i=(i,e)=>\"method\"===e.kind&&e.descriptor&&!(\"value\"in e.descriptor)?{...e,finisher(n){n.createProperty(e.key,i)}}:{kind:\"field\",key:Symbol(),placement:\"own\",descriptor:{},originalKey:e.key,initializer(){\"function\"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(n){n.createProperty(e.key,i)}};function e(e){return(n,t)=>void 0!==t?((i,e,n)=>{e.constructor.createProperty(n,i)})(e,n,t):i(e,n)}export{e as property};\n//# sourceMappingURL=property.js.map\n","import{property as r}from\"./property.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function t(t){return r({...t,state:!0})}export{t as state};\n//# sourceMappingURL=state.js.map\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst e=(e,t,o)=>{Object.defineProperty(t,o,e)},t=(e,t)=>({kind:\"method\",placement:\"prototype\",key:t.key,descriptor:e}),o=({finisher:e,descriptor:t})=>(o,n)=>{var r;if(void 0===n){const n=null!==(r=o.originalKey)&&void 0!==r?r:o.key,i=null!=t?{kind:\"method\",placement:\"prototype\",key:n,descriptor:t(o.key)}:{...o,key:n};return null!=e&&(i.finisher=function(t){e(t,n)}),i}{const r=o.constructor;void 0!==t&&Object.defineProperty(o,n,t(n)),null==e||e(r,n)}};export{o as decorateProperty,e as legacyPrototypeMethod,t as standardPrototypeMethod};\n//# sourceMappingURL=base.js.map\n","import{decorateProperty as r}from\"./base.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function e(e){return r({finisher:(r,t)=>{Object.assign(r.prototype[t],e)}})}export{e as eventOptions};\n//# sourceMappingURL=event-options.js.map\n","import{decorateProperty as o}from\"./base.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function i(i,n){return o({descriptor:o=>{const t={get(){var o,n;return null!==(n=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(i))&&void 0!==n?n:null},enumerable:!0,configurable:!0};if(n){const n=\"symbol\"==typeof o?Symbol():\"__\"+o;t.get=function(){var o,t;return void 0===this[n]&&(this[n]=null!==(t=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(i))&&void 0!==t?t:null),this[n]}}return t}})}export{i as query};\n//# sourceMappingURL=query.js.map\n","import{decorateProperty as r}from\"./base.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function e(e){return r({descriptor:r=>({get(){var r,o;return null!==(o=null===(r=this.renderRoot)||void 0===r?void 0:r.querySelectorAll(e))&&void 0!==o?o:[]},enumerable:!0,configurable:!0})})}export{e as queryAll};\n//# sourceMappingURL=query-all.js.map\n","import{decorateProperty as r}from\"./base.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nfunction e(e){return r({descriptor:r=>({async get(){var r;return await this.updateComplete,null===(r=this.renderRoot)||void 0===r?void 0:r.querySelector(e)},enumerable:!0,configurable:!0})})}export{e as queryAsync};\n//# sourceMappingURL=query-async.js.map\n","import{decorateProperty as o}from\"./base.js\";\n/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */var n;const e=null!=(null===(n=window.HTMLSlotElement)||void 0===n?void 0:n.prototype.assignedElements)?(o,n)=>o.assignedElements(n):(o,n)=>o.assignedNodes(n).filter((o=>o.nodeType===Node.ELEMENT_NODE));function l(n){const{slot:l,selector:t}=null!=n?n:{};return o({descriptor:o=>({get(){var o;const r=\"slot\"+(l?`[name=${l}]`:\":not([name])\"),i=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(r),s=null!=i?e(i,n):[];return t?s.filter((o=>o.matches(t))):s},enumerable:!0,configurable:!0})})}export{l as queryAssignedElements};\n//# sourceMappingURL=query-assigned-elements.js.map\n","import{decorateProperty as e}from\"./base.js\";import{queryAssignedElements as t}from\"./query-assigned-elements.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function o(o,n,r){let l,s=o;return\"object\"==typeof o?(s=o.slot,l=o):l={flatten:n},r?t({slot:s,flatten:n,selector:r}):e({descriptor:e=>({get(){var e,t;const o=\"slot\"+(s?`[name=${s}]`:\":not([name])\"),n=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(o);return null!==(t=null==n?void 0:n.assignedNodes(l))&&void 0!==t?t:[]},enumerable:!0,configurable:!0})})}export{o as queryAssignedNodes};\n//# sourceMappingURL=query-assigned-nodes.js.map\n","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * @fileoverview A \"ponyfill\" is a polyfill that doesn't modify the global prototype chain.\n * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.\n */\nexport function closest(element, selector) {\n if (element.closest) {\n return element.closest(selector);\n }\n var el = element;\n while (el) {\n if (matches(el, selector)) {\n return el;\n }\n el = el.parentElement;\n }\n return null;\n}\nexport function matches(element, selector) {\n var nativeMatches = element.matches\n || element.webkitMatchesSelector\n || element.msMatchesSelector;\n return nativeMatches.call(element, selector);\n}\n/**\n * Used to compute the estimated scroll width of elements. When an element is\n * hidden due to display: none; being applied to a parent element, the width is\n * returned as 0. However, the element will have a true width once no longer\n * inside a display: none context. This method computes an estimated width when\n * the element is hidden or returns the true width when the element is visble.\n * @param {Element} element the element whose width to estimate\n */\nexport function estimateScrollWidth(element) {\n // Check the offsetParent. If the element inherits display: none from any\n // parent, the offsetParent property will be null (see\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).\n // This check ensures we only clone the node when necessary.\n var htmlEl = element;\n if (htmlEl.offsetParent !== null) {\n return htmlEl.scrollWidth;\n }\n var clone = htmlEl.cloneNode(true);\n clone.style.setProperty('position', 'absolute');\n clone.style.setProperty('transform', 'translate(-9999px, -9999px)');\n document.documentElement.appendChild(clone);\n var scrollWidth = clone.scrollWidth;\n document.documentElement.removeChild(clone);\n return scrollWidth;\n}\n//# sourceMappingURL=ponyfill.js.map","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\n/**\n * Determines whether a node is an element.\n *\n * @param node Node to check\n */\nexport const isNodeElement = (node) => {\n return node.nodeType === Node.ELEMENT_NODE;\n};\nexport function addHasRemoveClass(element) {\n return {\n addClass: (className) => {\n element.classList.add(className);\n },\n removeClass: (className) => {\n element.classList.remove(className);\n },\n hasClass: (className) => element.classList.contains(className),\n };\n}\nlet supportsPassive = false;\nconst fn = () => { };\nconst optionsBlock = {\n get passive() {\n supportsPassive = true;\n return false;\n }\n};\ndocument.addEventListener('x', fn, optionsBlock);\ndocument.removeEventListener('x', fn);\n/**\n * Do event listeners suport the `passive` option?\n */\nexport const supportsPassiveEventListener = supportsPassive;\nexport const deepActiveElementPath = (doc = window.document) => {\n let activeElement = doc.activeElement;\n const path = [];\n if (!activeElement) {\n return path;\n }\n while (activeElement) {\n path.push(activeElement);\n if (activeElement.shadowRoot) {\n activeElement = activeElement.shadowRoot.activeElement;\n }\n else {\n break;\n }\n }\n return path;\n};\nexport const doesElementContainFocus = (element) => {\n const activePath = deepActiveElementPath();\n if (!activePath.length) {\n return false;\n }\n const deepActiveElement = activePath[activePath.length - 1];\n const focusEv = new Event('check-if-focused', { bubbles: true, composed: true });\n let composedPath = [];\n const listener = (ev) => {\n composedPath = ev.composedPath();\n };\n document.body.addEventListener('check-if-focused', listener);\n deepActiveElement.dispatchEvent(focusEv);\n document.body.removeEventListener('check-if-focused', listener);\n return composedPath.indexOf(element) !== -1;\n};\n//# sourceMappingURL=utils.js.map","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { LitElement } from 'lit';\nexport { addHasRemoveClass } from './utils.js';\n/** @soyCompatible */\nexport class BaseElement extends LitElement {\n click() {\n if (this.mdcRoot) {\n this.mdcRoot.focus();\n this.mdcRoot.click();\n return;\n }\n super.click();\n }\n /**\n * Create and attach the MDC Foundation to the instance\n */\n createFoundation() {\n if (this.mdcFoundation !== undefined) {\n this.mdcFoundation.destroy();\n }\n if (this.mdcFoundationClass) {\n this.mdcFoundation = new this.mdcFoundationClass(this.createAdapter());\n this.mdcFoundation.init();\n }\n }\n firstUpdated() {\n this.createFoundation();\n }\n}\n//# sourceMappingURL=base-element.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar MDCFoundation = /** @class */ (function () {\n function MDCFoundation(adapter) {\n if (adapter === void 0) { adapter = {}; }\n this.adapter = adapter;\n }\n Object.defineProperty(MDCFoundation, \"cssClasses\", {\n get: function () {\n // Classes extending MDCFoundation should implement this method to return an object which exports every\n // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}\n return {};\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCFoundation, \"strings\", {\n get: function () {\n // Classes extending MDCFoundation should implement this method to return an object which exports all\n // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}\n return {};\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCFoundation, \"numbers\", {\n get: function () {\n // Classes extending MDCFoundation should implement this method to return an object which exports all\n // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}\n return {};\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCFoundation, \"defaultAdapter\", {\n get: function () {\n // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient\n // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter\n // validation.\n return {};\n },\n enumerable: false,\n configurable: true\n });\n MDCFoundation.prototype.init = function () {\n // Subclasses should override this method to perform initialization routines (registering events, etc.)\n };\n MDCFoundation.prototype.destroy = function () {\n // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)\n };\n return MDCFoundation;\n}());\nexport { MDCFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nexport var cssClasses = {\n // Ripple is a special case where the \"root\" component is really a \"mixin\" of sorts,\n // given that it's an 'upgrade' to an existing component. That being said it is the root\n // CSS class that all other CSS classes derive from.\n BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',\n FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',\n FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',\n ROOT: 'mdc-ripple-upgraded',\n UNBOUNDED: 'mdc-ripple-upgraded--unbounded',\n};\nexport var strings = {\n VAR_FG_SCALE: '--mdc-ripple-fg-scale',\n VAR_FG_SIZE: '--mdc-ripple-fg-size',\n VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',\n VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',\n VAR_LEFT: '--mdc-ripple-left',\n VAR_TOP: '--mdc-ripple-top',\n};\nexport var numbers = {\n DEACTIVATION_TIMEOUT_MS: 225,\n FG_DEACTIVATION_MS: 150,\n INITIAL_ORIGIN_SCALE: 0.6,\n PADDING: 10,\n TAP_DELAY_MS: 300, // Delay between touch and simulated mouse events on touch devices\n};\n//# sourceMappingURL=constants.js.map","/**\n * Stores result from supportsCssVariables to avoid redundant processing to\n * detect CSS custom variable support.\n */\nvar supportsCssVariables_;\nexport function supportsCssVariables(windowObj, forceRefresh) {\n if (forceRefresh === void 0) { forceRefresh = false; }\n var CSS = windowObj.CSS;\n var supportsCssVars = supportsCssVariables_;\n if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {\n return supportsCssVariables_;\n }\n var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';\n if (!supportsFunctionPresent) {\n return false;\n }\n var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');\n // See: https://bugs.webkit.org/show_bug.cgi?id=154669\n // See: README section on Safari\n var weAreFeatureDetectingSafari10plus = (CSS.supports('(--css-vars: yes)') &&\n CSS.supports('color', '#00000000'));\n supportsCssVars =\n explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;\n if (!forceRefresh) {\n supportsCssVariables_ = supportsCssVars;\n }\n return supportsCssVars;\n}\nexport function getNormalizedEventCoords(evt, pageOffset, clientRect) {\n if (!evt) {\n return { x: 0, y: 0 };\n }\n var x = pageOffset.x, y = pageOffset.y;\n var documentX = x + clientRect.left;\n var documentY = y + clientRect.top;\n var normalizedX;\n var normalizedY;\n // Determine touch point relative to the ripple container.\n if (evt.type === 'touchstart') {\n var touchEvent = evt;\n normalizedX = touchEvent.changedTouches[0].pageX - documentX;\n normalizedY = touchEvent.changedTouches[0].pageY - documentY;\n }\n else {\n var mouseEvent = evt;\n normalizedX = mouseEvent.pageX - documentX;\n normalizedY = mouseEvent.pageY - documentY;\n }\n return { x: normalizedX, y: normalizedY };\n}\n//# sourceMappingURL=util.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends, __values } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, numbers, strings } from './constants';\nimport { getNormalizedEventCoords } from './util';\n// Activation events registered on the root element of each instance for activation\nvar ACTIVATION_EVENT_TYPES = [\n 'touchstart', 'pointerdown', 'mousedown', 'keydown',\n];\n// Deactivation events registered on documentElement when a pointer-related down event occurs\nvar POINTER_DEACTIVATION_EVENT_TYPES = [\n 'touchend', 'pointerup', 'mouseup', 'contextmenu',\n];\n// simultaneous nested activations\nvar activatedTargets = [];\nvar MDCRippleFoundation = /** @class */ (function (_super) {\n __extends(MDCRippleFoundation, _super);\n function MDCRippleFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;\n _this.activationAnimationHasEnded = false;\n _this.activationTimer = 0;\n _this.fgDeactivationRemovalTimer = 0;\n _this.fgScale = '0';\n _this.frame = { width: 0, height: 0 };\n _this.initialSize = 0;\n _this.layoutFrame = 0;\n _this.maxRadius = 0;\n _this.unboundedCoords = { left: 0, top: 0 };\n _this.activationState = _this.defaultActivationState();\n _this.activationTimerCallback = function () {\n _this.activationAnimationHasEnded = true;\n _this.runDeactivationUXLogicIfReady();\n };\n _this.activateHandler = function (e) {\n _this.activateImpl(e);\n };\n _this.deactivateHandler = function () {\n _this.deactivateImpl();\n };\n _this.focusHandler = function () {\n _this.handleFocus();\n };\n _this.blurHandler = function () {\n _this.handleBlur();\n };\n _this.resizeHandler = function () {\n _this.layout();\n };\n return _this;\n }\n Object.defineProperty(MDCRippleFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCRippleFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCRippleFoundation, \"numbers\", {\n get: function () {\n return numbers;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCRippleFoundation, \"defaultAdapter\", {\n get: function () {\n return {\n addClass: function () { return undefined; },\n browserSupportsCssVars: function () { return true; },\n computeBoundingRect: function () {\n return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });\n },\n containsEventTarget: function () { return true; },\n deregisterDocumentInteractionHandler: function () { return undefined; },\n deregisterInteractionHandler: function () { return undefined; },\n deregisterResizeHandler: function () { return undefined; },\n getWindowPageOffset: function () { return ({ x: 0, y: 0 }); },\n isSurfaceActive: function () { return true; },\n isSurfaceDisabled: function () { return true; },\n isUnbounded: function () { return true; },\n registerDocumentInteractionHandler: function () { return undefined; },\n registerInteractionHandler: function () { return undefined; },\n registerResizeHandler: function () { return undefined; },\n removeClass: function () { return undefined; },\n updateCssVariable: function () { return undefined; },\n };\n },\n enumerable: false,\n configurable: true\n });\n MDCRippleFoundation.prototype.init = function () {\n var _this = this;\n var supportsPressRipple = this.supportsPressRipple();\n this.registerRootHandlers(supportsPressRipple);\n if (supportsPressRipple) {\n var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED;\n requestAnimationFrame(function () {\n _this.adapter.addClass(ROOT_1);\n if (_this.adapter.isUnbounded()) {\n _this.adapter.addClass(UNBOUNDED_1);\n // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple\n _this.layoutInternal();\n }\n });\n }\n };\n MDCRippleFoundation.prototype.destroy = function () {\n var _this = this;\n if (this.supportsPressRipple()) {\n if (this.activationTimer) {\n clearTimeout(this.activationTimer);\n this.activationTimer = 0;\n this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);\n }\n if (this.fgDeactivationRemovalTimer) {\n clearTimeout(this.fgDeactivationRemovalTimer);\n this.fgDeactivationRemovalTimer = 0;\n this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);\n }\n var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED;\n requestAnimationFrame(function () {\n _this.adapter.removeClass(ROOT_2);\n _this.adapter.removeClass(UNBOUNDED_2);\n _this.removeCssVars();\n });\n }\n this.deregisterRootHandlers();\n this.deregisterDeactivationHandlers();\n };\n /**\n * @param evt Optional event containing position information.\n */\n MDCRippleFoundation.prototype.activate = function (evt) {\n this.activateImpl(evt);\n };\n MDCRippleFoundation.prototype.deactivate = function () {\n this.deactivateImpl();\n };\n MDCRippleFoundation.prototype.layout = function () {\n var _this = this;\n if (this.layoutFrame) {\n cancelAnimationFrame(this.layoutFrame);\n }\n this.layoutFrame = requestAnimationFrame(function () {\n _this.layoutInternal();\n _this.layoutFrame = 0;\n });\n };\n MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {\n var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;\n if (unbounded) {\n this.adapter.addClass(UNBOUNDED);\n }\n else {\n this.adapter.removeClass(UNBOUNDED);\n }\n };\n MDCRippleFoundation.prototype.handleFocus = function () {\n var _this = this;\n requestAnimationFrame(function () { return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); });\n };\n MDCRippleFoundation.prototype.handleBlur = function () {\n var _this = this;\n requestAnimationFrame(function () { return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); });\n };\n /**\n * We compute this property so that we are not querying information about the client\n * until the point in time where the foundation requests it. This prevents scenarios where\n * client-side feature-detection may happen too early, such as when components are rendered on the server\n * and then initialized at mount time on the client.\n */\n MDCRippleFoundation.prototype.supportsPressRipple = function () {\n return this.adapter.browserSupportsCssVars();\n };\n MDCRippleFoundation.prototype.defaultActivationState = function () {\n return {\n activationEvent: undefined,\n hasDeactivationUXRun: false,\n isActivated: false,\n isProgrammatic: false,\n wasActivatedByPointer: false,\n wasElementMadeActive: false,\n };\n };\n /**\n * supportsPressRipple Passed from init to save a redundant function call\n */\n MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {\n var e_1, _a;\n if (supportsPressRipple) {\n try {\n for (var ACTIVATION_EVENT_TYPES_1 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next(); !ACTIVATION_EVENT_TYPES_1_1.done; ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next()) {\n var evtType = ACTIVATION_EVENT_TYPES_1_1.value;\n this.adapter.registerInteractionHandler(evtType, this.activateHandler);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n if (this.adapter.isUnbounded()) {\n this.adapter.registerResizeHandler(this.resizeHandler);\n }\n }\n this.adapter.registerInteractionHandler('focus', this.focusHandler);\n this.adapter.registerInteractionHandler('blur', this.blurHandler);\n };\n MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {\n var e_2, _a;\n if (evt.type === 'keydown') {\n this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);\n }\n else {\n try {\n for (var POINTER_DEACTIVATION_EVENT_TYPES_1 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next(); !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done; POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next()) {\n var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;\n this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (POINTER_DEACTIVATION_EVENT_TYPES_1_1 && !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_1.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_1);\n }\n finally { if (e_2) throw e_2.error; }\n }\n }\n };\n MDCRippleFoundation.prototype.deregisterRootHandlers = function () {\n var e_3, _a;\n try {\n for (var ACTIVATION_EVENT_TYPES_2 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next(); !ACTIVATION_EVENT_TYPES_2_1.done; ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next()) {\n var evtType = ACTIVATION_EVENT_TYPES_2_1.value;\n this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2);\n }\n finally { if (e_3) throw e_3.error; }\n }\n this.adapter.deregisterInteractionHandler('focus', this.focusHandler);\n this.adapter.deregisterInteractionHandler('blur', this.blurHandler);\n if (this.adapter.isUnbounded()) {\n this.adapter.deregisterResizeHandler(this.resizeHandler);\n }\n };\n MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {\n var e_4, _a;\n this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);\n try {\n for (var POINTER_DEACTIVATION_EVENT_TYPES_2 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next(); !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done; POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next()) {\n var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;\n this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (POINTER_DEACTIVATION_EVENT_TYPES_2_1 && !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_2.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_2);\n }\n finally { if (e_4) throw e_4.error; }\n }\n };\n MDCRippleFoundation.prototype.removeCssVars = function () {\n var _this = this;\n var rippleStrings = MDCRippleFoundation.strings;\n var keys = Object.keys(rippleStrings);\n keys.forEach(function (key) {\n if (key.indexOf('VAR_') === 0) {\n _this.adapter.updateCssVariable(rippleStrings[key], null);\n }\n });\n };\n MDCRippleFoundation.prototype.activateImpl = function (evt) {\n var _this = this;\n if (this.adapter.isSurfaceDisabled()) {\n return;\n }\n var activationState = this.activationState;\n if (activationState.isActivated) {\n return;\n }\n // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction\n var previousActivationEvent = this.previousActivationEvent;\n var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;\n if (isSameInteraction) {\n return;\n }\n activationState.isActivated = true;\n activationState.isProgrammatic = evt === undefined;\n activationState.activationEvent = evt;\n activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');\n var hasActivatedChild = evt !== undefined &&\n activatedTargets.length > 0 &&\n activatedTargets.some(function (target) { return _this.adapter.containsEventTarget(target); });\n if (hasActivatedChild) {\n // Immediately reset activation state, while preserving logic that prevents touch follow-on events\n this.resetActivationState();\n return;\n }\n if (evt !== undefined) {\n activatedTargets.push(evt.target);\n this.registerDeactivationHandlers(evt);\n }\n activationState.wasElementMadeActive = this.checkElementMadeActive(evt);\n if (activationState.wasElementMadeActive) {\n this.animateActivation();\n }\n requestAnimationFrame(function () {\n // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples\n activatedTargets = [];\n if (!activationState.wasElementMadeActive\n && evt !== undefined\n && (evt.key === ' ' || evt.keyCode === 32)) {\n // If space was pressed, try again within an rAF call to detect :active, because different UAs report\n // active states inconsistently when they're called within event handling code:\n // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971\n // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741\n // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS\n // variable is set within a rAF callback for a submit button interaction (#2241).\n activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);\n if (activationState.wasElementMadeActive) {\n _this.animateActivation();\n }\n }\n if (!activationState.wasElementMadeActive) {\n // Reset activation state immediately if element was not made active.\n _this.activationState = _this.defaultActivationState();\n }\n });\n };\n MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {\n return (evt !== undefined && evt.type === 'keydown') ?\n this.adapter.isSurfaceActive() :\n true;\n };\n MDCRippleFoundation.prototype.animateActivation = function () {\n var _this = this;\n var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;\n var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION;\n var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;\n this.layoutInternal();\n var translateStart = '';\n var translateEnd = '';\n if (!this.adapter.isUnbounded()) {\n var _c = this.getFgTranslationCoordinates(), startPoint = _c.startPoint, endPoint = _c.endPoint;\n translateStart = startPoint.x + \"px, \" + startPoint.y + \"px\";\n translateEnd = endPoint.x + \"px, \" + endPoint.y + \"px\";\n }\n this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);\n this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);\n // Cancel any ongoing activation/deactivation animations\n clearTimeout(this.activationTimer);\n clearTimeout(this.fgDeactivationRemovalTimer);\n this.rmBoundedActivationClasses();\n this.adapter.removeClass(FG_DEACTIVATION);\n // Force layout in order to re-trigger the animation.\n this.adapter.computeBoundingRect();\n this.adapter.addClass(FG_ACTIVATION);\n this.activationTimer = setTimeout(function () {\n _this.activationTimerCallback();\n }, DEACTIVATION_TIMEOUT_MS);\n };\n MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {\n var _a = this.activationState, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer;\n var startPoint;\n if (wasActivatedByPointer) {\n startPoint = getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());\n }\n else {\n startPoint = {\n x: this.frame.width / 2,\n y: this.frame.height / 2,\n };\n }\n // Center the element around the start point.\n startPoint = {\n x: startPoint.x - (this.initialSize / 2),\n y: startPoint.y - (this.initialSize / 2),\n };\n var endPoint = {\n x: (this.frame.width / 2) - (this.initialSize / 2),\n y: (this.frame.height / 2) - (this.initialSize / 2),\n };\n return { startPoint: startPoint, endPoint: endPoint };\n };\n MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {\n var _this = this;\n // This method is called both when a pointing device is released, and when the activation animation ends.\n // The deactivation animation should only run after both of those occur.\n var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;\n var _a = this.activationState, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated;\n var activationHasEnded = hasDeactivationUXRun || !isActivated;\n if (activationHasEnded && this.activationAnimationHasEnded) {\n this.rmBoundedActivationClasses();\n this.adapter.addClass(FG_DEACTIVATION);\n this.fgDeactivationRemovalTimer = setTimeout(function () {\n _this.adapter.removeClass(FG_DEACTIVATION);\n }, numbers.FG_DEACTIVATION_MS);\n }\n };\n MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {\n var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;\n this.adapter.removeClass(FG_ACTIVATION);\n this.activationAnimationHasEnded = false;\n this.adapter.computeBoundingRect();\n };\n MDCRippleFoundation.prototype.resetActivationState = function () {\n var _this = this;\n this.previousActivationEvent = this.activationState.activationEvent;\n this.activationState = this.defaultActivationState();\n // Touch devices may fire additional events for the same interaction within a short time.\n // Store the previous event until it's safe to assume that subsequent events are for new interactions.\n setTimeout(function () { return _this.previousActivationEvent = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS);\n };\n MDCRippleFoundation.prototype.deactivateImpl = function () {\n var _this = this;\n var activationState = this.activationState;\n // This can happen in scenarios such as when you have a keyup event that blurs the element.\n if (!activationState.isActivated) {\n return;\n }\n var state = __assign({}, activationState);\n if (activationState.isProgrammatic) {\n requestAnimationFrame(function () {\n _this.animateDeactivation(state);\n });\n this.resetActivationState();\n }\n else {\n this.deregisterDeactivationHandlers();\n requestAnimationFrame(function () {\n _this.activationState.hasDeactivationUXRun = true;\n _this.animateDeactivation(state);\n _this.resetActivationState();\n });\n }\n };\n MDCRippleFoundation.prototype.animateDeactivation = function (_a) {\n var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive;\n if (wasActivatedByPointer || wasElementMadeActive) {\n this.runDeactivationUXLogicIfReady();\n }\n };\n MDCRippleFoundation.prototype.layoutInternal = function () {\n var _this = this;\n this.frame = this.adapter.computeBoundingRect();\n var maxDim = Math.max(this.frame.height, this.frame.width);\n // Surface diameter is treated differently for unbounded vs. bounded ripples.\n // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately\n // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically\n // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter\n // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via\n // `overflow: hidden`.\n var getBoundedRadius = function () {\n var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));\n return hypotenuse + MDCRippleFoundation.numbers.PADDING;\n };\n this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();\n // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform\n var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);\n // Unbounded ripple size should always be even number to equally center align.\n if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {\n this.initialSize = initialSize - 1;\n }\n else {\n this.initialSize = initialSize;\n }\n this.fgScale = \"\" + this.maxRadius / this.initialSize;\n this.updateLayoutCssVars();\n };\n MDCRippleFoundation.prototype.updateLayoutCssVars = function () {\n var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE;\n this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + \"px\");\n this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);\n if (this.adapter.isUnbounded()) {\n this.unboundedCoords = {\n left: Math.round((this.frame.width / 2) - (this.initialSize / 2)),\n top: Math.round((this.frame.height / 2) - (this.initialSize / 2)),\n };\n this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + \"px\");\n this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + \"px\");\n }\n };\n return MDCRippleFoundation;\n}(MDCFoundation));\nexport { MDCRippleFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCRippleFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}export{i as Directive,t as PartType,e as directive};\n//# sourceMappingURL=directive.js.map\n","import{noChange as t}from\"../lit-html.js\";import{directive as i,Directive as s,PartType as r}from\"../directive.js\";\n/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const o=i(class extends s{constructor(t){var i;if(super(t),t.type!==r.ATTRIBUTE||\"class\"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.length)>2)throw Error(\"`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.\")}render(t){return\" \"+Object.keys(t).filter((i=>t[i])).join(\" \")+\" \"}update(i,[s]){var r,o;if(void 0===this.it){this.it=new Set,void 0!==i.strings&&(this.nt=new Set(i.strings.join(\" \").split(/\\s/).filter((t=>\"\"!==t))));for(const t in s)s[t]&&!(null===(r=this.nt)||void 0===r?void 0:r.has(t))&&this.it.add(t);return this.render(s)}const e=i.element.classList;this.it.forEach((t=>{t in s||(e.remove(t),this.it.delete(t))}));for(const t in s){const i=!!s[t];i===this.it.has(t)||(null===(o=this.nt)||void 0===o?void 0:o.has(t))||(i?(e.add(t),this.it.add(t)):(e.remove(t),this.it.delete(t)))}return t}});export{o as classMap};\n//# sourceMappingURL=class-map.js.map\n","import{noChange as t}from\"../lit-html.js\";import{directive as e,Directive as r,PartType as s}from\"../directive.js\";\n/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const i=\"important\",n=\" !\"+i,o=e(class extends r{constructor(t){var e;if(super(t),t.type!==s.ATTRIBUTE||\"style\"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error(\"The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.\")}render(t){return Object.keys(t).reduce(((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.includes(\"-\")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,\"-$&\").toLowerCase()}:${s};`}),\"\")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ut){this.ut=new Set;for(const t in r)this.ut.add(t);return this.render(r)}this.ut.forEach((t=>{null==r[t]&&(this.ut.delete(t),t.includes(\"-\")?s.removeProperty(t):s[t]=\"\")}));for(const t in r){const e=r[t];if(null!=e){this.ut.add(t);const r=\"string\"==typeof e&&e.endsWith(n);t.includes(\"-\")||r?s.setProperty(t,r?e.slice(0,-11):e,r?i:\"\"):s[t]=e}}return t}});export{o as styleMap};\n//# sourceMappingURL=style-map.js.map\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { matches } from '@material/dom/ponyfill.js';\nimport { BaseElement } from '@material/mwc-base/base-element.js';\nimport MDCRippleFoundation from '@material/ripple/foundation.js';\nimport { html } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styleMap } from 'lit/directives/style-map.js';\n/** @soyCompatible */\nexport class RippleBase extends BaseElement {\n constructor() {\n super(...arguments);\n this.primary = false;\n this.accent = false;\n this.unbounded = false;\n this.disabled = false;\n this.activated = false;\n this.selected = false;\n this.internalUseStateLayerCustomProperties = false;\n this.hovering = false;\n this.bgFocused = false;\n this.fgActivation = false;\n this.fgDeactivation = false;\n this.fgScale = '';\n this.fgSize = '';\n this.translateStart = '';\n this.translateEnd = '';\n this.leftPos = '';\n this.topPos = '';\n this.mdcFoundationClass = MDCRippleFoundation;\n }\n get isActive() {\n return matches(this.parentElement || this, ':active');\n }\n createAdapter() {\n return {\n browserSupportsCssVars: () => true,\n isUnbounded: () => this.unbounded,\n isSurfaceActive: () => this.isActive,\n isSurfaceDisabled: () => this.disabled,\n addClass: (className) => {\n switch (className) {\n case 'mdc-ripple-upgraded--background-focused':\n this.bgFocused = true;\n break;\n case 'mdc-ripple-upgraded--foreground-activation':\n this.fgActivation = true;\n break;\n case 'mdc-ripple-upgraded--foreground-deactivation':\n this.fgDeactivation = true;\n break;\n default:\n break;\n }\n },\n removeClass: (className) => {\n switch (className) {\n case 'mdc-ripple-upgraded--background-focused':\n this.bgFocused = false;\n break;\n case 'mdc-ripple-upgraded--foreground-activation':\n this.fgActivation = false;\n break;\n case 'mdc-ripple-upgraded--foreground-deactivation':\n this.fgDeactivation = false;\n break;\n default:\n break;\n }\n },\n containsEventTarget: () => true,\n registerInteractionHandler: () => undefined,\n deregisterInteractionHandler: () => undefined,\n registerDocumentInteractionHandler: () => undefined,\n deregisterDocumentInteractionHandler: () => undefined,\n registerResizeHandler: () => undefined,\n deregisterResizeHandler: () => undefined,\n updateCssVariable: (varName, value) => {\n switch (varName) {\n case '--mdc-ripple-fg-scale':\n this.fgScale = value;\n break;\n case '--mdc-ripple-fg-size':\n this.fgSize = value;\n break;\n case '--mdc-ripple-fg-translate-end':\n this.translateEnd = value;\n break;\n case '--mdc-ripple-fg-translate-start':\n this.translateStart = value;\n break;\n case '--mdc-ripple-left':\n this.leftPos = value;\n break;\n case '--mdc-ripple-top':\n this.topPos = value;\n break;\n default:\n break;\n }\n },\n computeBoundingRect: () => (this.parentElement || this).getBoundingClientRect(),\n getWindowPageOffset: () => ({ x: window.pageXOffset, y: window.pageYOffset }),\n };\n }\n startPress(ev) {\n this.waitForFoundation(() => {\n this.mdcFoundation.activate(ev);\n });\n }\n endPress() {\n this.waitForFoundation(() => {\n this.mdcFoundation.deactivate();\n });\n }\n startFocus() {\n this.waitForFoundation(() => {\n this.mdcFoundation.handleFocus();\n });\n }\n endFocus() {\n this.waitForFoundation(() => {\n this.mdcFoundation.handleBlur();\n });\n }\n startHover() {\n this.hovering = true;\n }\n endHover() {\n this.hovering = false;\n }\n /**\n * Wait for the MDCFoundation to be created by `firstUpdated`\n */\n waitForFoundation(fn) {\n if (this.mdcFoundation) {\n fn();\n }\n else {\n this.updateComplete.then(fn);\n }\n }\n update(changedProperties) {\n if (changedProperties.has('disabled')) {\n // stop hovering when ripple is disabled to prevent a stuck \"hover\" state\n // When re-enabled, the outer component will get a `mouseenter` event on\n // the first movement, which will call `startHover()`\n if (this.disabled) {\n this.endHover();\n }\n }\n super.update(changedProperties);\n }\n /** @soyTemplate */\n render() {\n const shouldActivateInPrimary = this.activated && (this.primary || !this.accent);\n const shouldSelectInPrimary = this.selected && (this.primary || !this.accent);\n /** @classMap */\n const classes = {\n 'mdc-ripple-surface--accent': this.accent,\n 'mdc-ripple-surface--primary--activated': shouldActivateInPrimary,\n 'mdc-ripple-surface--accent--activated': this.accent && this.activated,\n 'mdc-ripple-surface--primary--selected': shouldSelectInPrimary,\n 'mdc-ripple-surface--accent--selected': this.accent && this.selected,\n 'mdc-ripple-surface--disabled': this.disabled,\n 'mdc-ripple-surface--hover': this.hovering,\n 'mdc-ripple-surface--primary': this.primary,\n 'mdc-ripple-surface--selected': this.selected,\n 'mdc-ripple-upgraded--background-focused': this.bgFocused,\n 'mdc-ripple-upgraded--foreground-activation': this.fgActivation,\n 'mdc-ripple-upgraded--foreground-deactivation': this.fgDeactivation,\n 'mdc-ripple-upgraded--unbounded': this.unbounded,\n 'mdc-ripple-surface--internal-use-state-layer-custom-properties': this.internalUseStateLayerCustomProperties,\n };\n return html `\n
`;\n }\n}\n__decorate([\n query('.mdc-ripple-surface')\n], RippleBase.prototype, \"mdcRoot\", void 0);\n__decorate([\n property({ type: Boolean })\n], RippleBase.prototype, \"primary\", void 0);\n__decorate([\n property({ type: Boolean })\n], RippleBase.prototype, \"accent\", void 0);\n__decorate([\n property({ type: Boolean })\n], RippleBase.prototype, \"unbounded\", void 0);\n__decorate([\n property({ type: Boolean })\n], RippleBase.prototype, \"disabled\", void 0);\n__decorate([\n property({ type: Boolean })\n], RippleBase.prototype, \"activated\", void 0);\n__decorate([\n property({ type: Boolean })\n], RippleBase.prototype, \"selected\", void 0);\n__decorate([\n property({ type: Boolean })\n], RippleBase.prototype, \"internalUseStateLayerCustomProperties\", void 0);\n__decorate([\n state()\n], RippleBase.prototype, \"hovering\", void 0);\n__decorate([\n state()\n], RippleBase.prototype, \"bgFocused\", void 0);\n__decorate([\n state()\n], RippleBase.prototype, \"fgActivation\", void 0);\n__decorate([\n state()\n], RippleBase.prototype, \"fgDeactivation\", void 0);\n__decorate([\n state()\n], RippleBase.prototype, \"fgScale\", void 0);\n__decorate([\n state()\n], RippleBase.prototype, \"fgSize\", void 0);\n__decorate([\n state()\n], RippleBase.prototype, \"translateStart\", void 0);\n__decorate([\n state()\n], RippleBase.prototype, \"translateEnd\", void 0);\n__decorate([\n state()\n], RippleBase.prototype, \"leftPos\", void 0);\n__decorate([\n state()\n], RippleBase.prototype, \"topPos\", void 0);\n//# sourceMappingURL=mwc-ripple-base.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-LIcense-Identifier: Apache-2.0\n */\nimport { css } from 'lit';\nexport const styles = css `.mdc-ripple-surface{--mdc-ripple-fg-size: 0;--mdc-ripple-left: 0;--mdc-ripple-top: 0;--mdc-ripple-fg-scale: 1;--mdc-ripple-fg-translate-end: 0;--mdc-ripple-fg-translate-start: 0;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:transform,opacity;position:relative;outline:none;overflow:hidden}.mdc-ripple-surface::before,.mdc-ripple-surface::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:\"\"}.mdc-ripple-surface::before{transition:opacity 15ms linear,background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-ripple-surface::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-ripple-surface.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-ripple-surface.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface::before,.mdc-ripple-surface::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-ripple-surface.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded],.mdc-ripple-upgraded--unbounded{overflow:visible}.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::after,.mdc-ripple-upgraded--unbounded::before,.mdc-ripple-upgraded--unbounded::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::before,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface::before,.mdc-ripple-surface::after{background-color:#000;background-color:var(--mdc-ripple-color, #000)}.mdc-ripple-surface:hover::before,.mdc-ripple-surface.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}:host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;display:block}:host .mdc-ripple-surface{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;will-change:unset}.mdc-ripple-surface--primary::before,.mdc-ripple-surface--primary::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary:hover::before,.mdc-ripple-surface--primary.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface--primary.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--primary.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--primary--activated::before{opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12)}.mdc-ripple-surface--primary--activated::before,.mdc-ripple-surface--primary--activated::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary--activated:hover::before,.mdc-ripple-surface--primary--activated.mdc-ripple-surface--hover::before{opacity:0.16;opacity:var(--mdc-ripple-hover-opacity, 0.16)}.mdc-ripple-surface--primary--activated.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-focus-opacity, 0.24)}.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--primary--activated.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--primary--selected::before{opacity:0.08;opacity:var(--mdc-ripple-selected-opacity, 0.08)}.mdc-ripple-surface--primary--selected::before,.mdc-ripple-surface--primary--selected::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary--selected:hover::before,.mdc-ripple-surface--primary--selected.mdc-ripple-surface--hover::before{opacity:0.12;opacity:var(--mdc-ripple-hover-opacity, 0.12)}.mdc-ripple-surface--primary--selected.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--primary--selected.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--accent::before,.mdc-ripple-surface--accent::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent:hover::before,.mdc-ripple-surface--accent.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface--accent.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--accent.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--accent--activated::before{opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12)}.mdc-ripple-surface--accent--activated::before,.mdc-ripple-surface--accent--activated::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent--activated:hover::before,.mdc-ripple-surface--accent--activated.mdc-ripple-surface--hover::before{opacity:0.16;opacity:var(--mdc-ripple-hover-opacity, 0.16)}.mdc-ripple-surface--accent--activated.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-focus-opacity, 0.24)}.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--accent--activated.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--accent--selected::before{opacity:0.08;opacity:var(--mdc-ripple-selected-opacity, 0.08)}.mdc-ripple-surface--accent--selected::before,.mdc-ripple-surface--accent--selected::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent--selected:hover::before,.mdc-ripple-surface--accent--selected.mdc-ripple-surface--hover::before{opacity:0.12;opacity:var(--mdc-ripple-hover-opacity, 0.12)}.mdc-ripple-surface--accent--selected.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--accent--selected.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--disabled{opacity:0}.mdc-ripple-surface--internal-use-state-layer-custom-properties::before,.mdc-ripple-surface--internal-use-state-layer-custom-properties::after{background-color:#000;background-color:var(--mdc-ripple-hover-state-layer-color, #000)}.mdc-ripple-surface--internal-use-state-layer-custom-properties:hover::before,.mdc-ripple-surface--internal-use-state-layer-custom-properties.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-state-layer-opacity, 0.04)}.mdc-ripple-surface--internal-use-state-layer-custom-properties.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--internal-use-state-layer-custom-properties:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-state-layer-opacity, 0.12)}.mdc-ripple-surface--internal-use-state-layer-custom-properties:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--internal-use-state-layer-custom-properties:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-pressed-state-layer-opacity, 0.12)}.mdc-ripple-surface--internal-use-state-layer-custom-properties.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-pressed-state-layer-opacity, 0.12)}`;\n//# sourceMappingURL=mwc-ripple.css.js.map","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { customElement } from 'lit/decorators.js';\nimport { RippleBase } from './mwc-ripple-base.js';\nimport { styles } from './mwc-ripple.css.js';\n/** @soyCompatible */\nlet Ripple = class Ripple extends RippleBase {\n};\nRipple.styles = [styles];\nRipple = __decorate([\n customElement('mwc-ripple')\n], Ripple);\nexport { Ripple };\n//# sourceMappingURL=mwc-ripple.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * TypeScript version of the decorator\n * @see https://www.typescriptlang.org/docs/handbook/decorators.html#property-decorators\n */\nfunction tsDecorator(prototype, name, descriptor) {\n const constructor = prototype.constructor;\n if (!descriptor) {\n /**\n * lit uses internal properties with two leading underscores to\n * provide storage for accessors\n */\n const litInternalPropertyKey = `__${name}`;\n descriptor =\n constructor.getPropertyDescriptor(name, litInternalPropertyKey);\n if (!descriptor) {\n throw new Error('@ariaProperty must be used after a @property decorator');\n }\n }\n // descriptor must exist at this point, reassign so typescript understands\n const propDescriptor = descriptor;\n let attribute = '';\n if (!propDescriptor.set) {\n throw new Error(`@ariaProperty requires a setter for ${name}`);\n }\n // TODO(b/202853219): Remove this check when internal tooling is\n // compatible\n // tslint:disable-next-line:no-any bail if applied to internal generated class\n if (prototype.dispatchWizEvent) {\n return descriptor;\n }\n const wrappedDescriptor = {\n configurable: true,\n enumerable: true,\n set(value) {\n if (attribute === '') {\n const options = constructor.getPropertyOptions(name);\n // if attribute is not a string, use `name` instead\n attribute =\n typeof options.attribute === 'string' ? options.attribute : name;\n }\n if (this.hasAttribute(attribute)) {\n this.removeAttribute(attribute);\n }\n propDescriptor.set.call(this, value);\n }\n };\n if (propDescriptor.get) {\n wrappedDescriptor.get = function () {\n return propDescriptor.get.call(this);\n };\n }\n return wrappedDescriptor;\n}\n/**\n * A property decorator proxies an aria attribute to an internal node\n *\n * This decorator is only intended for use with ARIA attributes, such as `role`\n * and `aria-label` due to screenreader needs.\n *\n * Upon first render, `@ariaProperty` will remove the attribute from the host\n * element to prevent screenreaders from reading the host instead of the\n * internal node.\n *\n * This decorator should only be used for non-Symbol public fields decorated\n * with `@property`, or on a setter with an optional getter.\n *\n * @example\n * ```ts\n * class MyElement {\n * @ariaProperty\n * @property({ type: String, attribute: 'aria-label' })\n * ariaLabel!: string;\n * }\n * ```\n * @category Decorator\n * @ExportDecoratedItems\n */\nexport function ariaProperty(protoOrDescriptor, name, \n// tslint:disable-next-line:no-any any is required as a return type from decorators\ndescriptor) {\n if (name !== undefined) {\n return tsDecorator(protoOrDescriptor, name, descriptor);\n }\n else {\n throw new Error('@ariaProperty only supports TypeScript Decorators');\n }\n}\n//# sourceMappingURL=aria-property.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Class that encapsulates the events handlers for `mwc-ripple`\n *\n *\n * Example:\n * ```\n * class XFoo extends LitElement {\n * async getRipple() {\n * this.renderRipple = true;\n * await this.updateComplete;\n * return this.renderRoot.querySelector('mwc-ripple');\n * }\n * rippleHandlers = new RippleHandlers(() => this.getRipple());\n *\n * render() {\n * return html`\n *
\n * ${this.renderRipple ? html`` : ''}\n * `;\n * }\n * }\n * ```\n */\nexport class RippleHandlers {\n constructor(\n /** Function that returns a `mwc-ripple` */\n rippleFn) {\n this.startPress = (ev) => {\n rippleFn().then((r) => {\n r && r.startPress(ev);\n });\n };\n this.endPress = () => {\n rippleFn().then((r) => {\n r && r.endPress();\n });\n };\n this.startFocus = () => {\n rippleFn().then((r) => {\n r && r.startFocus();\n });\n };\n this.endFocus = () => {\n rippleFn().then((r) => {\n r && r.endFocus();\n });\n };\n this.startHover = () => {\n rippleFn().then((r) => {\n r && r.startHover();\n });\n };\n this.endHover = () => {\n rippleFn().then((r) => {\n r && r.endHover();\n });\n };\n }\n}\n//# sourceMappingURL=ripple-handlers.js.map","import{nothing as t}from\"../lit-html.js\";\n/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const l=l=>null!=l?l:t;export{l as ifDefined};\n//# sourceMappingURL=if-defined.js.map\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport '@material/mwc-ripple/mwc-ripple.js';\nimport { ariaProperty } from '@material/mwc-base/aria-property.js';\nimport { RippleHandlers } from '@material/mwc-ripple/ripple-handlers.js';\nimport { html, LitElement } from 'lit';\nimport { eventOptions, property, query, queryAsync, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n/** @soyCompatible */\nexport class IconButtonBase extends LitElement {\n constructor() {\n super(...arguments);\n this.disabled = false;\n this.icon = '';\n this.shouldRenderRipple = false;\n this.rippleHandlers = new RippleHandlers(() => {\n this.shouldRenderRipple = true;\n return this.ripple;\n });\n }\n /** @soyTemplate */\n renderRipple() {\n return this.shouldRenderRipple ? html `\n \n ` :\n '';\n }\n focus() {\n const buttonElement = this.buttonElement;\n if (buttonElement) {\n this.rippleHandlers.startFocus();\n buttonElement.focus();\n }\n }\n blur() {\n const buttonElement = this.buttonElement;\n if (buttonElement) {\n this.rippleHandlers.endFocus();\n buttonElement.blur();\n }\n }\n /** @soyTemplate */\n render() {\n return html `${this.renderRipple()}\n ${this.icon ? html `${this.icon}` : ''}\n \n `;\n }\n handleRippleMouseDown(event) {\n const onUp = () => {\n window.removeEventListener('mouseup', onUp);\n this.handleRippleDeactivate();\n };\n window.addEventListener('mouseup', onUp);\n this.rippleHandlers.startPress(event);\n }\n handleRippleTouchStart(event) {\n this.rippleHandlers.startPress(event);\n }\n handleRippleDeactivate() {\n this.rippleHandlers.endPress();\n }\n handleRippleMouseEnter() {\n this.rippleHandlers.startHover();\n }\n handleRippleMouseLeave() {\n this.rippleHandlers.endHover();\n }\n handleRippleFocus() {\n this.rippleHandlers.startFocus();\n }\n handleRippleBlur() {\n this.rippleHandlers.endFocus();\n }\n}\n__decorate([\n property({ type: Boolean, reflect: true })\n], IconButtonBase.prototype, \"disabled\", void 0);\n__decorate([\n property({ type: String })\n], IconButtonBase.prototype, \"icon\", void 0);\n__decorate([\n ariaProperty,\n property({ type: String, attribute: 'aria-label' })\n], IconButtonBase.prototype, \"ariaLabel\", void 0);\n__decorate([\n ariaProperty,\n property({ type: String, attribute: 'aria-haspopup' })\n], IconButtonBase.prototype, \"ariaHasPopup\", void 0);\n__decorate([\n query('button')\n], IconButtonBase.prototype, \"buttonElement\", void 0);\n__decorate([\n queryAsync('mwc-ripple')\n], IconButtonBase.prototype, \"ripple\", void 0);\n__decorate([\n state()\n], IconButtonBase.prototype, \"shouldRenderRipple\", void 0);\n__decorate([\n eventOptions({ passive: true })\n], IconButtonBase.prototype, \"handleRippleMouseDown\", null);\n__decorate([\n eventOptions({ passive: true })\n], IconButtonBase.prototype, \"handleRippleTouchStart\", null);\n//# sourceMappingURL=mwc-icon-button-base.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-LIcense-Identifier: Apache-2.0\n */\nimport { css } from 'lit';\nexport const styles = css `.material-icons{font-family:var(--mdc-icon-font, \"Material Icons\");font-weight:normal;font-style:normal;font-size:var(--mdc-icon-size, 24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}.mdc-icon-button{font-size:24px;width:48px;height:48px;padding:12px}.mdc-icon-button .mdc-icon-button__focus-ring{display:none}.mdc-icon-button.mdc-ripple-upgraded--background-focused .mdc-icon-button__focus-ring,.mdc-icon-button:not(.mdc-ripple-upgraded):focus .mdc-icon-button__focus-ring{display:block;max-height:48px;max-width:48px}@media screen and (forced-colors: active){.mdc-icon-button.mdc-ripple-upgraded--background-focused .mdc-icon-button__focus-ring,.mdc-icon-button:not(.mdc-ripple-upgraded):focus .mdc-icon-button__focus-ring{pointer-events:none;border:2px solid transparent;border-radius:6px;box-sizing:content-box;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);height:100%;width:100%}}@media screen and (forced-colors: active)and (forced-colors: active){.mdc-icon-button.mdc-ripple-upgraded--background-focused .mdc-icon-button__focus-ring,.mdc-icon-button:not(.mdc-ripple-upgraded):focus .mdc-icon-button__focus-ring{border-color:CanvasText}}@media screen and (forced-colors: active){.mdc-icon-button.mdc-ripple-upgraded--background-focused .mdc-icon-button__focus-ring::after,.mdc-icon-button:not(.mdc-ripple-upgraded):focus .mdc-icon-button__focus-ring::after{content:\"\";border:2px solid transparent;border-radius:8px;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);height:calc(100% + 4px);width:calc(100% + 4px)}}@media screen and (forced-colors: active)and (forced-colors: active){.mdc-icon-button.mdc-ripple-upgraded--background-focused .mdc-icon-button__focus-ring::after,.mdc-icon-button:not(.mdc-ripple-upgraded):focus .mdc-icon-button__focus-ring::after{border-color:CanvasText}}.mdc-icon-button.mdc-icon-button--reduced-size .mdc-icon-button__ripple{width:40px;height:40px;margin-top:4px;margin-bottom:4px;margin-right:4px;margin-left:4px}.mdc-icon-button.mdc-icon-button--reduced-size.mdc-ripple-upgraded--background-focused .mdc-icon-button__focus-ring,.mdc-icon-button.mdc-icon-button--reduced-size:not(.mdc-ripple-upgraded):focus .mdc-icon-button__focus-ring{max-height:40px;max-width:40px}.mdc-icon-button .mdc-icon-button__touch{position:absolute;top:50%;height:48px;left:50%;width:48px;transform:translate(-50%, -50%)}.mdc-icon-button:disabled{color:rgba(0, 0, 0, 0.38);color:var(--mdc-theme-text-disabled-on-light, rgba(0, 0, 0, 0.38))}.mdc-icon-button svg,.mdc-icon-button img{width:24px;height:24px}.mdc-icon-button{display:inline-block;position:relative;box-sizing:border-box;border:none;outline:none;background-color:transparent;fill:currentColor;color:inherit;text-decoration:none;cursor:pointer;user-select:none;z-index:0;overflow:visible}.mdc-icon-button .mdc-icon-button__touch{position:absolute;top:50%;height:48px;left:50%;width:48px;transform:translate(-50%, -50%)}.mdc-icon-button:disabled{cursor:default;pointer-events:none}.mdc-icon-button--display-flex{align-items:center;display:inline-flex;justify-content:center}.mdc-icon-button__icon{display:inline-block}.mdc-icon-button__icon.mdc-icon-button__icon--on{display:none}.mdc-icon-button--on .mdc-icon-button__icon{display:none}.mdc-icon-button--on .mdc-icon-button__icon.mdc-icon-button__icon--on{display:inline-block}.mdc-icon-button__link{height:100%;left:0;outline:none;position:absolute;top:0;width:100%}.mdc-icon-button{display:inline-block;position:relative;box-sizing:border-box;border:none;outline:none;background-color:transparent;fill:currentColor;color:inherit;text-decoration:none;cursor:pointer;user-select:none;z-index:0;overflow:visible}.mdc-icon-button .mdc-icon-button__touch{position:absolute;top:50%;height:48px;left:50%;width:48px;transform:translate(-50%, -50%)}.mdc-icon-button:disabled{cursor:default;pointer-events:none}.mdc-icon-button--display-flex{align-items:center;display:inline-flex;justify-content:center}.mdc-icon-button__icon{display:inline-block}.mdc-icon-button__icon.mdc-icon-button__icon--on{display:none}.mdc-icon-button--on .mdc-icon-button__icon{display:none}.mdc-icon-button--on .mdc-icon-button__icon.mdc-icon-button__icon--on{display:inline-block}.mdc-icon-button__link{height:100%;left:0;outline:none;position:absolute;top:0;width:100%}:host{display:inline-block;outline:none}:host([disabled]){pointer-events:none}.mdc-icon-button i,.mdc-icon-button svg,.mdc-icon-button img,.mdc-icon-button ::slotted(*){display:block}:host{--mdc-ripple-color: currentcolor;-webkit-tap-highlight-color:transparent}:host,.mdc-icon-button{vertical-align:top}.mdc-icon-button{width:var(--mdc-icon-button-size, 48px);height:var(--mdc-icon-button-size, 48px);padding:calc( (var(--mdc-icon-button-size, 48px) - var(--mdc-icon-size, 24px)) / 2 )}.mdc-icon-button i,.mdc-icon-button svg,.mdc-icon-button img,.mdc-icon-button ::slotted(*){display:block;width:var(--mdc-icon-size, 24px);height:var(--mdc-icon-size, 24px)}`;\n//# sourceMappingURL=mwc-icon-button.css.js.map","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { customElement } from 'lit/decorators.js';\nimport { IconButtonBase } from './mwc-icon-button-base.js';\nimport { styles } from './mwc-icon-button.css.js';\n/** @soyCompatible */\nlet IconButton = class IconButton extends IconButtonBase {\n};\nIconButton.styles = [styles];\nIconButton = __decorate([\n customElement('mwc-icon-button')\n], IconButton);\nexport { IconButton };\n//# sourceMappingURL=mwc-icon-button.js.map","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n\r\nfunction __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\n\n/* ***** BEGIN LICENSE BLOCK *****\n * Distributed under the BSD license:\n *\n * Copyright (c) 2010, Ajax.org B.V.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * * Neither the name of Ajax.org B.V. nor the\n * names of its contributors may be used to endorse or promote products\n * derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * ***** END LICENSE BLOCK ***** */\n\n/**\n * Define a module along with a payload\n * @param module a name for the payload\n * @param payload a function to call with (require, exports, module) params\n */\n\n(function() {\n\nvar ACE_NAMESPACE = \"ace\";\n\nvar global = (function() { return this; })();\nif (!global && typeof window != \"undefined\") global = window; // strict mode\n\n\nvar define = function(module, deps, payload) {\n if (typeof module !== \"string\") {\n if (define.original)\n define.original.apply(this, arguments);\n else {\n console.error(\"dropping module because define wasn\\'t a string.\");\n console.trace();\n }\n return;\n }\n if (arguments.length == 2)\n payload = deps;\n if (!define.modules[module]) {\n define.payloads[module] = payload;\n define.modules[module] = null;\n }\n};\n\ndefine.modules = {};\ndefine.payloads = {};\n\n/**\n * Get at functionality define()ed using the function above\n */\nvar _require = function(parentId, module, callback) {\n if (typeof module === \"string\") {\n var payload = lookup(parentId, module);\n if (payload != undefined) {\n callback && callback();\n return payload;\n }\n } else if (Object.prototype.toString.call(module) === \"[object Array]\") {\n var params = [];\n for (var i = 0, l = module.length; i < l; ++i) {\n var dep = lookup(parentId, module[i]);\n if (dep == undefined && require.original)\n return;\n params.push(dep);\n }\n return callback && callback.apply(null, params) || true;\n }\n};\n\nvar require = function(module, callback) {\n var packagedModule = _require(\"\", module, callback);\n if (packagedModule == undefined && require.original)\n return require.original.apply(this, arguments);\n return packagedModule;\n};\n\nvar normalizeModule = function(parentId, moduleName) {\n // normalize plugin requires\n if (moduleName.indexOf(\"!\") !== -1) {\n var chunks = moduleName.split(\"!\");\n return normalizeModule(parentId, chunks[0]) + \"!\" + normalizeModule(parentId, chunks[1]);\n }\n // normalize relative requires\n if (moduleName.charAt(0) == \".\") {\n var base = parentId.split(\"/\").slice(0, -1).join(\"/\");\n moduleName = base + \"/\" + moduleName;\n\n while(moduleName.indexOf(\".\") !== -1 && previous != moduleName) {\n var previous = moduleName;\n moduleName = moduleName.replace(/\\/\\.\\//, \"/\").replace(/[^\\/]+\\/\\.\\.\\//, \"\");\n }\n }\n return moduleName;\n};\n\n/**\n * Internal function to lookup moduleNames and resolve them by calling the\n * definition function if needed.\n */\nvar lookup = function(parentId, moduleName) {\n moduleName = normalizeModule(parentId, moduleName);\n\n var module = define.modules[moduleName];\n if (!module) {\n module = define.payloads[moduleName];\n if (typeof module === 'function') {\n var exports = {};\n var mod = {\n id: moduleName,\n uri: '',\n exports: exports,\n packaged: true\n };\n\n var req = function(module, callback) {\n return _require(moduleName, module, callback);\n };\n\n var returnValue = module(req, exports, mod);\n exports = returnValue || mod.exports;\n define.modules[moduleName] = exports;\n delete define.payloads[moduleName];\n }\n module = define.modules[moduleName] = exports || module;\n }\n return module;\n};\n\nfunction exportAce(ns) {\n var root = global;\n if (ns) {\n if (!global[ns])\n global[ns] = {};\n root = global[ns];\n }\n\n if (!root.define || !root.define.packaged) {\n define.original = root.define;\n root.define = define;\n root.define.packaged = true;\n }\n\n if (!root.require || !root.require.packaged) {\n require.original = root.require;\n root.require = require;\n root.require.packaged = true;\n }\n}\n\nexportAce(ACE_NAMESPACE);\n\n})();\n\nace.define(\"ace/lib/fixoldbrowsers\",[\"require\",\"exports\",\"module\"], function(require, exports, module) {\nif (typeof Element != \"undefined\" && !Element.prototype.remove) {\n Object.defineProperty(Element.prototype, \"remove\", {\n enumerable: false,\n writable: true,\n configurable: true,\n value: function() { this.parentNode && this.parentNode.removeChild(this); }\n });\n}\n\n\n});\n\nace.define(\"ace/lib/useragent\",[\"require\",\"exports\",\"module\"], function(require, exports, module) {\nexports.OS = {\n LINUX: \"LINUX\",\n MAC: \"MAC\",\n WINDOWS: \"WINDOWS\"\n};\nexports.getOS = function() {\n if (exports.isMac) {\n return exports.OS.MAC;\n } else if (exports.isLinux) {\n return exports.OS.LINUX;\n } else {\n return exports.OS.WINDOWS;\n }\n};\nvar _navigator = typeof navigator == \"object\" ? navigator : {};\n\nvar os = (/mac|win|linux/i.exec(_navigator.platform) || [\"other\"])[0].toLowerCase();\nvar ua = _navigator.userAgent || \"\";\nvar appName = _navigator.appName || \"\";\nexports.isWin = (os == \"win\");\nexports.isMac = (os == \"mac\");\nexports.isLinux = (os == \"linux\");\nexports.isIE = \n (appName == \"Microsoft Internet Explorer\" || appName.indexOf(\"MSAppHost\") >= 0)\n ? parseFloat((ua.match(/(?:MSIE |Trident\\/[0-9]+[\\.0-9]+;.*rv:)([0-9]+[\\.0-9]+)/)||[])[1])\n : parseFloat((ua.match(/(?:Trident\\/[0-9]+[\\.0-9]+;.*rv:)([0-9]+[\\.0-9]+)/)||[])[1]); // for ie\n \nexports.isOldIE = exports.isIE && exports.isIE < 9;\nexports.isGecko = exports.isMozilla = ua.match(/ Gecko\\/\\d+/);\nexports.isOpera = typeof opera == \"object\" && Object.prototype.toString.call(window.opera) == \"[object Opera]\";\nexports.isWebKit = parseFloat(ua.split(\"WebKit/\")[1]) || undefined;\n\nexports.isChrome = parseFloat(ua.split(\" Chrome/\")[1]) || undefined;\n\nexports.isEdge = parseFloat(ua.split(\" Edge/\")[1]) || undefined;\n\nexports.isAIR = ua.indexOf(\"AdobeAIR\") >= 0;\n\nexports.isAndroid = ua.indexOf(\"Android\") >= 0;\n\nexports.isChromeOS = ua.indexOf(\" CrOS \") >= 0;\n\nexports.isIOS = /iPad|iPhone|iPod/.test(ua) && !window.MSStream;\n\nif (exports.isIOS) exports.isMac = true;\n\nexports.isMobile = exports.isIOS || exports.isAndroid;\n\n});\n\nace.define(\"ace/lib/dom\",[\"require\",\"exports\",\"module\",\"ace/lib/useragent\"], function(require, exports, module) {\n\nvar useragent = require(\"./useragent\"); \nvar XHTML_NS = \"http://www.w3.org/1999/xhtml\";\n\nexports.buildDom = function buildDom(arr, parent, refs) {\n if (typeof arr == \"string\" && arr) {\n var txt = document.createTextNode(arr);\n if (parent)\n parent.appendChild(txt);\n return txt;\n }\n \n if (!Array.isArray(arr)) {\n if (arr && arr.appendChild && parent)\n parent.appendChild(arr);\n return arr;\n }\n if (typeof arr[0] != \"string\" || !arr[0]) {\n var els = [];\n for (var i = 0; i < arr.length; i++) {\n var ch = buildDom(arr[i], parent, refs);\n ch && els.push(ch);\n }\n return els;\n }\n \n var el = document.createElement(arr[0]);\n var options = arr[1];\n var childIndex = 1;\n if (options && typeof options == \"object\" && !Array.isArray(options))\n childIndex = 2;\n for (var i = childIndex; i < arr.length; i++)\n buildDom(arr[i], el, refs);\n if (childIndex == 2) {\n Object.keys(options).forEach(function(n) {\n var val = options[n];\n if (n === \"class\") {\n el.className = Array.isArray(val) ? val.join(\" \") : val;\n } else if (typeof val == \"function\" || n == \"value\" || n[0] == \"$\") {\n el[n] = val;\n } else if (n === \"ref\") {\n if (refs) refs[val] = el;\n } else if (val != null) {\n el.setAttribute(n, val);\n }\n });\n }\n if (parent)\n parent.appendChild(el);\n return el;\n};\n\nexports.getDocumentHead = function(doc) {\n if (!doc)\n doc = document;\n return doc.head || doc.getElementsByTagName(\"head\")[0] || doc.documentElement;\n};\n\nexports.createElement = function(tag, ns) {\n return document.createElementNS ?\n document.createElementNS(ns || XHTML_NS, tag) :\n document.createElement(tag);\n};\n\nexports.removeChildren = function(element) {\n element.innerHTML = \"\";\n};\n\nexports.createTextNode = function(textContent, element) {\n var doc = element ? element.ownerDocument : document;\n return doc.createTextNode(textContent);\n};\n\nexports.createFragment = function(element) {\n var doc = element ? element.ownerDocument : document;\n return doc.createDocumentFragment();\n};\n\nexports.hasCssClass = function(el, name) {\n var classes = (el.className + \"\").split(/\\s+/g);\n return classes.indexOf(name) !== -1;\n};\nexports.addCssClass = function(el, name) {\n if (!exports.hasCssClass(el, name)) {\n el.className += \" \" + name;\n }\n};\nexports.removeCssClass = function(el, name) {\n var classes = el.className.split(/\\s+/g);\n while (true) {\n var index = classes.indexOf(name);\n if (index == -1) {\n break;\n }\n classes.splice(index, 1);\n }\n el.className = classes.join(\" \");\n};\n\nexports.toggleCssClass = function(el, name) {\n var classes = el.className.split(/\\s+/g), add = true;\n while (true) {\n var index = classes.indexOf(name);\n if (index == -1) {\n break;\n }\n add = false;\n classes.splice(index, 1);\n }\n if (add)\n classes.push(name);\n\n el.className = classes.join(\" \");\n return add;\n};\nexports.setCssClass = function(node, className, include) {\n if (include) {\n exports.addCssClass(node, className);\n } else {\n exports.removeCssClass(node, className);\n }\n};\n\nexports.hasCssString = function(id, doc) {\n var index = 0, sheets;\n doc = doc || document;\n if ((sheets = doc.querySelectorAll(\"style\"))) {\n while (index < sheets.length)\n if (sheets[index++].id === id)\n return true;\n }\n};\n\nexports.importCssString = function importCssString(cssText, id, target) {\n var container = target;\n if (!target || !target.getRootNode) {\n container = document;\n } else {\n container = target.getRootNode();\n if (!container || container == target)\n container = document;\n }\n \n var doc = container.ownerDocument || container;\n if (id && exports.hasCssString(id, container))\n return null;\n \n if (id)\n cssText += \"\\n/*# sourceURL=ace/css/\" + id + \" */\";\n \n var style = exports.createElement(\"style\");\n style.appendChild(doc.createTextNode(cssText));\n if (id)\n style.id = id;\n\n if (container == doc)\n container = exports.getDocumentHead(doc);\n container.insertBefore(style, container.firstChild);\n};\n\nexports.importCssStylsheet = function(uri, doc) {\n exports.buildDom([\"link\", {rel: \"stylesheet\", href: uri}], exports.getDocumentHead(doc));\n};\nexports.scrollbarWidth = function(document) {\n var inner = exports.createElement(\"ace_inner\");\n inner.style.width = \"100%\";\n inner.style.minWidth = \"0px\";\n inner.style.height = \"200px\";\n inner.style.display = \"block\";\n\n var outer = exports.createElement(\"ace_outer\");\n var style = outer.style;\n\n style.position = \"absolute\";\n style.left = \"-10000px\";\n style.overflow = \"hidden\";\n style.width = \"200px\";\n style.minWidth = \"0px\";\n style.height = \"150px\";\n style.display = \"block\";\n\n outer.appendChild(inner);\n\n var body = document.documentElement;\n body.appendChild(outer);\n\n var noScrollbar = inner.offsetWidth;\n\n style.overflow = \"scroll\";\n var withScrollbar = inner.offsetWidth;\n\n if (noScrollbar == withScrollbar) {\n withScrollbar = outer.clientWidth;\n }\n\n body.removeChild(outer);\n\n return noScrollbar-withScrollbar;\n};\n\nif (typeof document == \"undefined\") {\n exports.importCssString = function() {};\n}\n\nexports.computedStyle = function(element, style) {\n return window.getComputedStyle(element, \"\") || {};\n};\n\nexports.setStyle = function(styles, property, value) {\n if (styles[property] !== value) {\n styles[property] = value;\n }\n};\n\nexports.HAS_CSS_ANIMATION = false;\nexports.HAS_CSS_TRANSFORMS = false;\nexports.HI_DPI = useragent.isWin\n ? typeof window !== \"undefined\" && window.devicePixelRatio >= 1.5\n : true;\n\nif (typeof document !== \"undefined\") {\n var div = document.createElement(\"div\");\n if (exports.HI_DPI && div.style.transform !== undefined)\n exports.HAS_CSS_TRANSFORMS = true;\n if (!useragent.isEdge && typeof div.style.animationName !== \"undefined\")\n exports.HAS_CSS_ANIMATION = true;\n div = null;\n}\n\nif (exports.HAS_CSS_TRANSFORMS) {\n exports.translate = function(element, tx, ty) {\n element.style.transform = \"translate(\" + Math.round(tx) + \"px, \" + Math.round(ty) +\"px)\";\n };\n} else {\n exports.translate = function(element, tx, ty) {\n element.style.top = Math.round(ty) + \"px\";\n element.style.left = Math.round(tx) + \"px\";\n };\n}\n\n});\n\nace.define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"], function(require, exports, module) {\n\nexports.inherits = function(ctor, superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n};\n\nexports.mixin = function(obj, mixin) {\n for (var key in mixin) {\n obj[key] = mixin[key];\n }\n return obj;\n};\n\nexports.implement = function(proto, mixin) {\n exports.mixin(proto, mixin);\n};\n\n});\n\nace.define(\"ace/lib/keys\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\"], function(require, exports, module) {\n\nvar oop = require(\"./oop\");\nvar Keys = (function() {\n var ret = {\n MODIFIER_KEYS: {\n 16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta',\n 91: 'MetaLeft', 92: 'MetaRight', 93: 'ContextMenu'\n },\n\n KEY_MODS: {\n \"ctrl\": 1, \"alt\": 2, \"option\" : 2, \"shift\": 4,\n \"super\": 8, \"meta\": 8, \"command\": 8, \"cmd\": 8, \n \"control\": 1\n },\n\n FUNCTION_KEYS : {\n 8 : \"Backspace\",\n 9 : \"Tab\",\n 13 : \"Return\",\n 19 : \"Pause\",\n 27 : \"Esc\",\n 32 : \"Space\",\n 33 : \"PageUp\",\n 34 : \"PageDown\",\n 35 : \"End\",\n 36 : \"Home\",\n 37 : \"Left\",\n 38 : \"Up\",\n 39 : \"Right\",\n 40 : \"Down\",\n 44 : \"Print\",\n 45 : \"Insert\",\n 46 : \"Delete\",\n 96 : \"Numpad0\",\n 97 : \"Numpad1\",\n 98 : \"Numpad2\",\n 99 : \"Numpad3\",\n 100: \"Numpad4\",\n 101: \"Numpad5\",\n 102: \"Numpad6\",\n 103: \"Numpad7\",\n 104: \"Numpad8\",\n 105: \"Numpad9\",\n '-13': \"NumpadEnter\",\n 112: \"F1\",\n 113: \"F2\",\n 114: \"F3\",\n 115: \"F4\",\n 116: \"F5\",\n 117: \"F6\",\n 118: \"F7\",\n 119: \"F8\",\n 120: \"F9\",\n 121: \"F10\",\n 122: \"F11\",\n 123: \"F12\",\n 144: \"Numlock\",\n 145: \"Scrolllock\"\n },\n\n PRINTABLE_KEYS: {\n 32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5',\n 54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a',\n 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h',\n 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o',\n 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',\n 87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',\n 186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`',\n 219: '[', 220: '\\\\',221: ']', 222: \"'\", 111: '/', 106: '*'\n }\n };\n var name, i;\n for (i in ret.FUNCTION_KEYS) {\n name = ret.FUNCTION_KEYS[i].toLowerCase();\n ret[name] = parseInt(i, 10);\n }\n for (i in ret.PRINTABLE_KEYS) {\n name = ret.PRINTABLE_KEYS[i].toLowerCase();\n ret[name] = parseInt(i, 10);\n }\n oop.mixin(ret, ret.MODIFIER_KEYS);\n oop.mixin(ret, ret.PRINTABLE_KEYS);\n oop.mixin(ret, ret.FUNCTION_KEYS);\n ret.enter = ret[\"return\"];\n ret.escape = ret.esc;\n ret.del = ret[\"delete\"];\n ret[173] = '-';\n \n (function() {\n var mods = [\"cmd\", \"ctrl\", \"alt\", \"shift\"];\n for (var i = Math.pow(2, mods.length); i--;) { \n ret.KEY_MODS[i] = mods.filter(function(x) {\n return i & ret.KEY_MODS[x];\n }).join(\"-\") + \"-\";\n }\n })();\n\n ret.KEY_MODS[0] = \"\";\n ret.KEY_MODS[-1] = \"input-\";\n\n return ret;\n})();\noop.mixin(exports, Keys);\n\nexports.keyCodeToString = function(keyCode) {\n var keyString = Keys[keyCode];\n if (typeof keyString != \"string\")\n keyString = String.fromCharCode(keyCode);\n return keyString.toLowerCase();\n};\n\n});\n\nace.define(\"ace/lib/event\",[\"require\",\"exports\",\"module\",\"ace/lib/keys\",\"ace/lib/useragent\"], function(require, exports, module) {\n\nvar keys = require(\"./keys\");\nvar useragent = require(\"./useragent\");\n\nvar pressedKeys = null;\nvar ts = 0;\n\nvar activeListenerOptions;\nfunction detectListenerOptionsSupport() {\n activeListenerOptions = false;\n try {\n document.createComment(\"\").addEventListener(\"test\", function() {}, { \n get passive() { \n activeListenerOptions = {passive: false};\n }\n });\n } catch(e) {}\n}\n\nfunction getListenerOptions() {\n if (activeListenerOptions == undefined)\n detectListenerOptionsSupport();\n return activeListenerOptions;\n}\n\nfunction EventListener(elem, type, callback) {\n this.elem = elem;\n this.type = type;\n this.callback = callback;\n}\nEventListener.prototype.destroy = function() {\n removeListener(this.elem, this.type, this.callback);\n this.elem = this.type = this.callback = undefined;\n};\n\nvar addListener = exports.addListener = function(elem, type, callback, destroyer) {\n elem.addEventListener(type, callback, getListenerOptions());\n if (destroyer)\n destroyer.$toDestroy.push(new EventListener(elem, type, callback));\n};\n\nvar removeListener = exports.removeListener = function(elem, type, callback) {\n elem.removeEventListener(type, callback, getListenerOptions());\n};\nexports.stopEvent = function(e) {\n exports.stopPropagation(e);\n exports.preventDefault(e);\n return false;\n};\n\nexports.stopPropagation = function(e) {\n if (e.stopPropagation)\n e.stopPropagation();\n};\n\nexports.preventDefault = function(e) {\n if (e.preventDefault)\n e.preventDefault();\n};\nexports.getButton = function(e) {\n if (e.type == \"dblclick\")\n return 0;\n if (e.type == \"contextmenu\" || (useragent.isMac && (e.ctrlKey && !e.altKey && !e.shiftKey)))\n return 2;\n return e.button;\n};\n\nexports.capture = function(el, eventHandler, releaseCaptureHandler) {\n var ownerDocument = el && el.ownerDocument || document;\n function onMouseUp(e) {\n eventHandler && eventHandler(e);\n releaseCaptureHandler && releaseCaptureHandler(e);\n\n removeListener(ownerDocument, \"mousemove\", eventHandler);\n removeListener(ownerDocument, \"mouseup\", onMouseUp);\n removeListener(ownerDocument, \"dragstart\", onMouseUp);\n }\n\n addListener(ownerDocument, \"mousemove\", eventHandler);\n addListener(ownerDocument, \"mouseup\", onMouseUp);\n addListener(ownerDocument, \"dragstart\", onMouseUp);\n \n return onMouseUp;\n};\n\nexports.addMouseWheelListener = function(el, callback, destroyer) {\n if (\"onmousewheel\" in el) {\n addListener(el, \"mousewheel\", function(e) {\n var factor = 8;\n if (e.wheelDeltaX !== undefined) {\n e.wheelX = -e.wheelDeltaX / factor;\n e.wheelY = -e.wheelDeltaY / factor;\n } else {\n e.wheelX = 0;\n e.wheelY = -e.wheelDelta / factor;\n }\n callback(e);\n }, destroyer);\n } else if (\"onwheel\" in el) {\n addListener(el, \"wheel\", function(e) {\n var factor = 0.35;\n switch (e.deltaMode) {\n case e.DOM_DELTA_PIXEL:\n e.wheelX = e.deltaX * factor || 0;\n e.wheelY = e.deltaY * factor || 0;\n break;\n case e.DOM_DELTA_LINE:\n case e.DOM_DELTA_PAGE:\n e.wheelX = (e.deltaX || 0) * 5;\n e.wheelY = (e.deltaY || 0) * 5;\n break;\n }\n \n callback(e);\n }, destroyer);\n } else {\n addListener(el, \"DOMMouseScroll\", function(e) {\n if (e.axis && e.axis == e.HORIZONTAL_AXIS) {\n e.wheelX = (e.detail || 0) * 5;\n e.wheelY = 0;\n } else {\n e.wheelX = 0;\n e.wheelY = (e.detail || 0) * 5;\n }\n callback(e);\n }, destroyer);\n }\n};\n\nexports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName, destroyer) {\n var clicks = 0;\n var startX, startY, timer; \n var eventNames = {\n 2: \"dblclick\",\n 3: \"tripleclick\",\n 4: \"quadclick\"\n };\n\n function onMousedown(e) {\n if (exports.getButton(e) !== 0) {\n clicks = 0;\n } else if (e.detail > 1) {\n clicks++;\n if (clicks > 4)\n clicks = 1;\n } else {\n clicks = 1;\n }\n if (useragent.isIE) {\n var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5;\n if (!timer || isNewClick)\n clicks = 1;\n if (timer)\n clearTimeout(timer);\n timer = setTimeout(function() {timer = null;}, timeouts[clicks - 1] || 600);\n\n if (clicks == 1) {\n startX = e.clientX;\n startY = e.clientY;\n }\n }\n \n e._clicks = clicks;\n\n eventHandler[callbackName](\"mousedown\", e);\n\n if (clicks > 4)\n clicks = 0;\n else if (clicks > 1)\n return eventHandler[callbackName](eventNames[clicks], e);\n }\n if (!Array.isArray(elements))\n elements = [elements];\n elements.forEach(function(el) {\n addListener(el, \"mousedown\", onMousedown, destroyer);\n });\n};\n\nvar getModifierHash = function(e) {\n return 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);\n};\n\nexports.getModifierString = function(e) {\n return keys.KEY_MODS[getModifierHash(e)];\n};\n\nfunction normalizeCommandKeys(callback, e, keyCode) {\n var hashId = getModifierHash(e);\n\n if (!useragent.isMac && pressedKeys) {\n if (e.getModifierState && (e.getModifierState(\"OS\") || e.getModifierState(\"Win\")))\n hashId |= 8;\n if (pressedKeys.altGr) {\n if ((3 & hashId) != 3)\n pressedKeys.altGr = 0;\n else\n return;\n }\n if (keyCode === 18 || keyCode === 17) {\n var location = \"location\" in e ? e.location : e.keyLocation;\n if (keyCode === 17 && location === 1) {\n if (pressedKeys[keyCode] == 1)\n ts = e.timeStamp;\n } else if (keyCode === 18 && hashId === 3 && location === 2) {\n var dt = e.timeStamp - ts;\n if (dt < 50)\n pressedKeys.altGr = true;\n }\n }\n }\n \n if (keyCode in keys.MODIFIER_KEYS) {\n keyCode = -1;\n }\n \n if (!hashId && keyCode === 13) {\n var location = \"location\" in e ? e.location : e.keyLocation;\n if (location === 3) {\n callback(e, hashId, -keyCode);\n if (e.defaultPrevented)\n return;\n }\n }\n \n if (useragent.isChromeOS && hashId & 8) {\n callback(e, hashId, keyCode);\n if (e.defaultPrevented)\n return;\n else\n hashId &= ~8;\n }\n if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) {\n return false;\n }\n \n return callback(e, hashId, keyCode);\n}\n\n\nexports.addCommandKeyListener = function(el, callback, destroyer) {\n if (useragent.isOldGecko || (useragent.isOpera && !(\"KeyboardEvent\" in window))) {\n var lastKeyDownKeyCode = null;\n addListener(el, \"keydown\", function(e) {\n lastKeyDownKeyCode = e.keyCode;\n }, destroyer);\n addListener(el, \"keypress\", function(e) {\n return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);\n }, destroyer);\n } else {\n var lastDefaultPrevented = null;\n\n addListener(el, \"keydown\", function(e) {\n pressedKeys[e.keyCode] = (pressedKeys[e.keyCode] || 0) + 1;\n var result = normalizeCommandKeys(callback, e, e.keyCode);\n lastDefaultPrevented = e.defaultPrevented;\n return result;\n }, destroyer);\n\n addListener(el, \"keypress\", function(e) {\n if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) {\n exports.stopEvent(e);\n lastDefaultPrevented = null;\n }\n }, destroyer);\n\n addListener(el, \"keyup\", function(e) {\n pressedKeys[e.keyCode] = null;\n }, destroyer);\n\n if (!pressedKeys) {\n resetPressedKeys();\n addListener(window, \"focus\", resetPressedKeys);\n }\n }\n};\nfunction resetPressedKeys() {\n pressedKeys = Object.create(null);\n}\n\nif (typeof window == \"object\" && window.postMessage && !useragent.isOldIE) {\n var postMessageId = 1;\n exports.nextTick = function(callback, win) {\n win = win || window;\n var messageName = \"zero-timeout-message-\" + (postMessageId++);\n \n var listener = function(e) {\n if (e.data == messageName) {\n exports.stopPropagation(e);\n removeListener(win, \"message\", listener);\n callback();\n }\n };\n \n addListener(win, \"message\", listener);\n win.postMessage(messageName, \"*\");\n };\n}\n\nexports.$idleBlocked = false;\nexports.onIdle = function(cb, timeout) {\n return setTimeout(function handler() {\n if (!exports.$idleBlocked) {\n cb();\n } else {\n setTimeout(handler, 100);\n }\n }, timeout);\n};\n\nexports.$idleBlockId = null;\nexports.blockIdle = function(delay) {\n if (exports.$idleBlockId)\n clearTimeout(exports.$idleBlockId);\n \n exports.$idleBlocked = true;\n exports.$idleBlockId = setTimeout(function() {\n exports.$idleBlocked = false;\n }, delay || 100);\n};\n\nexports.nextFrame = typeof window == \"object\" && (window.requestAnimationFrame\n || window.mozRequestAnimationFrame\n || window.webkitRequestAnimationFrame\n || window.msRequestAnimationFrame\n || window.oRequestAnimationFrame);\n\nif (exports.nextFrame)\n exports.nextFrame = exports.nextFrame.bind(window);\nelse\n exports.nextFrame = function(callback) {\n setTimeout(callback, 17);\n };\n});\n\nace.define(\"ace/range\",[\"require\",\"exports\",\"module\"], function(require, exports, module) {\nvar comparePoints = function(p1, p2) {\n return p1.row - p2.row || p1.column - p2.column;\n};\nvar Range = function(startRow, startColumn, endRow, endColumn) {\n this.start = {\n row: startRow,\n column: startColumn\n };\n\n this.end = {\n row: endRow,\n column: endColumn\n };\n};\n\n(function() {\n this.isEqual = function(range) {\n return this.start.row === range.start.row &&\n this.end.row === range.end.row &&\n this.start.column === range.start.column &&\n this.end.column === range.end.column;\n };\n this.toString = function() {\n return (\"Range: [\" + this.start.row + \"/\" + this.start.column +\n \"] -> [\" + this.end.row + \"/\" + this.end.column + \"]\");\n };\n\n this.contains = function(row, column) {\n return this.compare(row, column) == 0;\n };\n this.compareRange = function(range) {\n var cmp,\n end = range.end,\n start = range.start;\n\n cmp = this.compare(end.row, end.column);\n if (cmp == 1) {\n cmp = this.compare(start.row, start.column);\n if (cmp == 1) {\n return 2;\n } else if (cmp == 0) {\n return 1;\n } else {\n return 0;\n }\n } else if (cmp == -1) {\n return -2;\n } else {\n cmp = this.compare(start.row, start.column);\n if (cmp == -1) {\n return -1;\n } else if (cmp == 1) {\n return 42;\n } else {\n return 0;\n }\n }\n };\n this.comparePoint = function(p) {\n return this.compare(p.row, p.column);\n };\n this.containsRange = function(range) {\n return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;\n };\n this.intersects = function(range) {\n var cmp = this.compareRange(range);\n return (cmp == -1 || cmp == 0 || cmp == 1);\n };\n this.isEnd = function(row, column) {\n return this.end.row == row && this.end.column == column;\n };\n this.isStart = function(row, column) {\n return this.start.row == row && this.start.column == column;\n };\n this.setStart = function(row, column) {\n if (typeof row == \"object\") {\n this.start.column = row.column;\n this.start.row = row.row;\n } else {\n this.start.row = row;\n this.start.column = column;\n }\n };\n this.setEnd = function(row, column) {\n if (typeof row == \"object\") {\n this.end.column = row.column;\n this.end.row = row.row;\n } else {\n this.end.row = row;\n this.end.column = column;\n }\n };\n this.inside = function(row, column) {\n if (this.compare(row, column) == 0) {\n if (this.isEnd(row, column) || this.isStart(row, column)) {\n return false;\n } else {\n return true;\n }\n }\n return false;\n };\n this.insideStart = function(row, column) {\n if (this.compare(row, column) == 0) {\n if (this.isEnd(row, column)) {\n return false;\n } else {\n return true;\n }\n }\n return false;\n };\n this.insideEnd = function(row, column) {\n if (this.compare(row, column) == 0) {\n if (this.isStart(row, column)) {\n return false;\n } else {\n return true;\n }\n }\n return false;\n };\n this.compare = function(row, column) {\n if (!this.isMultiLine()) {\n if (row === this.start.row) {\n return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);\n }\n }\n\n if (row < this.start.row)\n return -1;\n\n if (row > this.end.row)\n return 1;\n\n if (this.start.row === row)\n return column >= this.start.column ? 0 : -1;\n\n if (this.end.row === row)\n return column <= this.end.column ? 0 : 1;\n\n return 0;\n };\n this.compareStart = function(row, column) {\n if (this.start.row == row && this.start.column == column) {\n return -1;\n } else {\n return this.compare(row, column);\n }\n };\n this.compareEnd = function(row, column) {\n if (this.end.row == row && this.end.column == column) {\n return 1;\n } else {\n return this.compare(row, column);\n }\n };\n this.compareInside = function(row, column) {\n if (this.end.row == row && this.end.column == column) {\n return 1;\n } else if (this.start.row == row && this.start.column == column) {\n return -1;\n } else {\n return this.compare(row, column);\n }\n };\n this.clipRows = function(firstRow, lastRow) {\n if (this.end.row > lastRow)\n var end = {row: lastRow + 1, column: 0};\n else if (this.end.row < firstRow)\n var end = {row: firstRow, column: 0};\n\n if (this.start.row > lastRow)\n var start = {row: lastRow + 1, column: 0};\n else if (this.start.row < firstRow)\n var start = {row: firstRow, column: 0};\n\n return Range.fromPoints(start || this.start, end || this.end);\n };\n this.extend = function(row, column) {\n var cmp = this.compare(row, column);\n\n if (cmp == 0)\n return this;\n else if (cmp == -1)\n var start = {row: row, column: column};\n else\n var end = {row: row, column: column};\n\n return Range.fromPoints(start || this.start, end || this.end);\n };\n\n this.isEmpty = function() {\n return (this.start.row === this.end.row && this.start.column === this.end.column);\n };\n this.isMultiLine = function() {\n return (this.start.row !== this.end.row);\n };\n this.clone = function() {\n return Range.fromPoints(this.start, this.end);\n };\n this.collapseRows = function() {\n if (this.end.column == 0)\n return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0);\n else\n return new Range(this.start.row, 0, this.end.row, 0);\n };\n this.toScreenRange = function(session) {\n var screenPosStart = session.documentToScreenPosition(this.start);\n var screenPosEnd = session.documentToScreenPosition(this.end);\n\n return new Range(\n screenPosStart.row, screenPosStart.column,\n screenPosEnd.row, screenPosEnd.column\n );\n };\n this.moveBy = function(row, column) {\n this.start.row += row;\n this.start.column += column;\n this.end.row += row;\n this.end.column += column;\n };\n\n}).call(Range.prototype);\nRange.fromPoints = function(start, end) {\n return new Range(start.row, start.column, end.row, end.column);\n};\nRange.comparePoints = comparePoints;\n\nRange.comparePoints = function(p1, p2) {\n return p1.row - p2.row || p1.column - p2.column;\n};\n\n\nexports.Range = Range;\n});\n\nace.define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"], function(require, exports, module) {\n\nexports.last = function(a) {\n return a[a.length - 1];\n};\n\nexports.stringReverse = function(string) {\n return string.split(\"\").reverse().join(\"\");\n};\n\nexports.stringRepeat = function (string, count) {\n var result = '';\n while (count > 0) {\n if (count & 1)\n result += string;\n\n if (count >>= 1)\n string += string;\n }\n return result;\n};\n\nvar trimBeginRegexp = /^\\s\\s*/;\nvar trimEndRegexp = /\\s\\s*$/;\n\nexports.stringTrimLeft = function (string) {\n return string.replace(trimBeginRegexp, '');\n};\n\nexports.stringTrimRight = function (string) {\n return string.replace(trimEndRegexp, '');\n};\n\nexports.copyObject = function(obj) {\n var copy = {};\n for (var key in obj) {\n copy[key] = obj[key];\n }\n return copy;\n};\n\nexports.copyArray = function(array){\n var copy = [];\n for (var i=0, l=array.length; i Date.now() - 50)\n return true;\n return $cancelT = false;\n },\n cancel: function() {\n $cancelT = Date.now();\n }\n};\n\n});\n\nace.define(\"ace/keyboard/textinput\",[\"require\",\"exports\",\"module\",\"ace/lib/event\",\"ace/lib/useragent\",\"ace/lib/dom\",\"ace/lib/lang\",\"ace/clipboard\",\"ace/lib/keys\"], function(require, exports, module) {\n\nvar event = require(\"../lib/event\");\nvar useragent = require(\"../lib/useragent\");\nvar dom = require(\"../lib/dom\");\nvar lang = require(\"../lib/lang\");\nvar clipboard = require(\"../clipboard\");\nvar BROKEN_SETDATA = useragent.isChrome < 18;\nvar USE_IE_MIME_TYPE = useragent.isIE;\nvar HAS_FOCUS_ARGS = useragent.isChrome > 63;\nvar MAX_LINE_LENGTH = 400;\n\nvar KEYS = require(\"../lib/keys\");\nvar MODS = KEYS.KEY_MODS;\nvar isIOS = useragent.isIOS;\nvar valueResetRegex = isIOS ? /\\s/ : /\\n/;\nvar isMobile = useragent.isMobile;\n\nvar TextInput = function(parentNode, host) {\n var text = dom.createElement(\"textarea\");\n text.className = \"ace_text-input\";\n\n text.setAttribute(\"wrap\", \"off\");\n text.setAttribute(\"autocorrect\", \"off\");\n text.setAttribute(\"autocapitalize\", \"off\");\n text.setAttribute(\"spellcheck\", false);\n\n text.style.opacity = \"0\";\n parentNode.insertBefore(text, parentNode.firstChild);\n\n var copied = false;\n var pasted = false;\n var inComposition = false;\n var sendingText = false;\n var tempStyle = '';\n \n if (!isMobile)\n text.style.fontSize = \"1px\";\n\n var commandMode = false;\n var ignoreFocusEvents = false;\n \n var lastValue = \"\";\n var lastSelectionStart = 0;\n var lastSelectionEnd = 0;\n var lastRestoreEnd = 0;\n try { var isFocused = document.activeElement === text; } catch(e) {}\n \n event.addListener(text, \"blur\", function(e) {\n if (ignoreFocusEvents) return;\n host.onBlur(e);\n isFocused = false;\n }, host);\n event.addListener(text, \"focus\", function(e) {\n if (ignoreFocusEvents) return;\n isFocused = true;\n if (useragent.isEdge) {\n try {\n if (!document.hasFocus())\n return;\n } catch(e) {}\n }\n host.onFocus(e);\n if (useragent.isEdge)\n setTimeout(resetSelection);\n else\n resetSelection();\n }, host);\n this.$focusScroll = false;\n this.focus = function() {\n if (tempStyle || HAS_FOCUS_ARGS || this.$focusScroll == \"browser\")\n return text.focus({ preventScroll: true });\n\n var top = text.style.top;\n text.style.position = \"fixed\";\n text.style.top = \"0px\";\n try {\n var isTransformed = text.getBoundingClientRect().top != 0;\n } catch(e) {\n return;\n }\n var ancestors = [];\n if (isTransformed) {\n var t = text.parentElement;\n while (t && t.nodeType == 1) {\n ancestors.push(t);\n t.setAttribute(\"ace_nocontext\", true);\n if (!t.parentElement && t.getRootNode)\n t = t.getRootNode().host;\n else\n t = t.parentElement;\n }\n }\n text.focus({ preventScroll: true });\n if (isTransformed) {\n ancestors.forEach(function(p) {\n p.removeAttribute(\"ace_nocontext\");\n });\n }\n setTimeout(function() {\n text.style.position = \"\";\n if (text.style.top == \"0px\")\n text.style.top = top;\n }, 0);\n };\n this.blur = function() {\n text.blur();\n };\n this.isFocused = function() {\n return isFocused;\n };\n \n host.on(\"beforeEndOperation\", function() {\n var curOp = host.curOp;\n var commandName = curOp && curOp.command && curOp.command.name;\n if (commandName == \"insertstring\")\n return;\n var isUserAction = commandName && (curOp.docChanged || curOp.selectionChanged);\n if (inComposition && isUserAction) {\n lastValue = text.value = \"\";\n onCompositionEnd();\n }\n resetSelection();\n });\n \n var resetSelection = isIOS\n ? function(value) {\n if (!isFocused || (copied && !value) || sendingText) return;\n if (!value) \n value = \"\";\n var newValue = \"\\n ab\" + value + \"cde fg\\n\";\n if (newValue != text.value)\n text.value = lastValue = newValue;\n \n var selectionStart = 4;\n var selectionEnd = 4 + (value.length || (host.selection.isEmpty() ? 0 : 1));\n\n if (lastSelectionStart != selectionStart || lastSelectionEnd != selectionEnd) {\n text.setSelectionRange(selectionStart, selectionEnd);\n }\n lastSelectionStart = selectionStart;\n lastSelectionEnd = selectionEnd;\n }\n : function() {\n if (inComposition || sendingText)\n return;\n if (!isFocused && !afterContextMenu)\n return;\n inComposition = true;\n \n var selectionStart = 0;\n var selectionEnd = 0;\n var line = \"\";\n\n if (host.session) {\n var selection = host.selection;\n var range = selection.getRange();\n var row = selection.cursor.row;\n selectionStart = range.start.column;\n selectionEnd = range.end.column;\n line = host.session.getLine(row);\n\n if (range.start.row != row) {\n var prevLine = host.session.getLine(row - 1);\n selectionStart = range.start.row < row - 1 ? 0 : selectionStart;\n selectionEnd += prevLine.length + 1;\n line = prevLine + \"\\n\" + line;\n }\n else if (range.end.row != row) {\n var nextLine = host.session.getLine(row + 1);\n selectionEnd = range.end.row > row + 1 ? nextLine.length : selectionEnd;\n selectionEnd += line.length + 1;\n line = line + \"\\n\" + nextLine;\n }\n else if (isMobile && row > 0) {\n line = \"\\n\" + line;\n selectionEnd += 1;\n selectionStart += 1;\n }\n\n if (line.length > MAX_LINE_LENGTH) {\n if (selectionStart < MAX_LINE_LENGTH && selectionEnd < MAX_LINE_LENGTH) {\n line = line.slice(0, MAX_LINE_LENGTH);\n } else {\n line = \"\\n\";\n if (selectionStart == selectionEnd) {\n selectionStart = selectionEnd = 0;\n }\n else {\n selectionStart = 0;\n selectionEnd = 1;\n }\n }\n }\n }\n\n var newValue = line + \"\\n\\n\";\n if (newValue != lastValue) {\n text.value = lastValue = newValue;\n lastSelectionStart = lastSelectionEnd = newValue.length;\n }\n if (afterContextMenu) {\n lastSelectionStart = text.selectionStart;\n lastSelectionEnd = text.selectionEnd;\n }\n if (\n lastSelectionEnd != selectionEnd \n || lastSelectionStart != selectionStart \n || text.selectionEnd != lastSelectionEnd // on ie edge selectionEnd changes silently after the initialization\n ) {\n try {\n text.setSelectionRange(selectionStart, selectionEnd);\n lastSelectionStart = selectionStart;\n lastSelectionEnd = selectionEnd;\n } catch(e){}\n }\n inComposition = false;\n };\n this.resetSelection = resetSelection;\n\n if (isFocused)\n host.onFocus();\n\n\n var isAllSelected = function(text) {\n return text.selectionStart === 0 && text.selectionEnd >= lastValue.length\n && text.value === lastValue && lastValue\n && text.selectionEnd !== lastSelectionEnd;\n };\n\n var onSelect = function(e) {\n if (inComposition)\n return;\n if (copied) {\n copied = false;\n } else if (isAllSelected(text)) {\n host.selectAll();\n resetSelection();\n } else if (isMobile && text.selectionStart != lastSelectionStart) {\n resetSelection();\n }\n };\n\n var inputHandler = null;\n this.setInputHandler = function(cb) {inputHandler = cb;};\n this.getInputHandler = function() {return inputHandler;};\n var afterContextMenu = false;\n \n var sendText = function(value, fromInput) {\n if (afterContextMenu)\n afterContextMenu = false;\n if (pasted) {\n resetSelection();\n if (value)\n host.onPaste(value);\n pasted = false;\n return \"\";\n } else {\n var selectionStart = text.selectionStart;\n var selectionEnd = text.selectionEnd;\n \n var extendLeft = lastSelectionStart;\n var extendRight = lastValue.length - lastSelectionEnd;\n \n var inserted = value;\n var restoreStart = value.length - selectionStart;\n var restoreEnd = value.length - selectionEnd;\n \n var i = 0;\n while (extendLeft > 0 && lastValue[i] == value[i]) {\n i++;\n extendLeft--;\n }\n inserted = inserted.slice(i);\n i = 1;\n while (extendRight > 0 && lastValue.length - i > lastSelectionStart - 1 && lastValue[lastValue.length - i] == value[value.length - i]) {\n i++;\n extendRight--;\n }\n restoreStart -= i-1;\n restoreEnd -= i-1;\n var endIndex = inserted.length - i + 1;\n if (endIndex < 0) {\n extendLeft = -endIndex;\n endIndex = 0;\n } \n inserted = inserted.slice(0, endIndex);\n if (!fromInput && !inserted && !restoreStart && !extendLeft && !extendRight && !restoreEnd)\n return \"\";\n sendingText = true;\n var shouldReset = false;\n if (useragent.isAndroid && inserted == \". \") {\n inserted = \" \";\n shouldReset = true;\n }\n \n if (inserted && !extendLeft && !extendRight && !restoreStart && !restoreEnd || commandMode) {\n host.onTextInput(inserted);\n } else {\n host.onTextInput(inserted, {\n extendLeft: extendLeft,\n extendRight: extendRight,\n restoreStart: restoreStart,\n restoreEnd: restoreEnd\n });\n }\n sendingText = false;\n \n lastValue = value;\n lastSelectionStart = selectionStart;\n lastSelectionEnd = selectionEnd;\n lastRestoreEnd = restoreEnd;\n return shouldReset ? \"\\n\" : inserted;\n }\n };\n var onInput = function(e) {\n if (inComposition)\n return onCompositionUpdate();\n if (e && e.inputType) {\n if (e.inputType == \"historyUndo\") return host.execCommand(\"undo\");\n if (e.inputType == \"historyRedo\") return host.execCommand(\"redo\");\n }\n var data = text.value;\n var inserted = sendText(data, true);\n if (\n data.length > MAX_LINE_LENGTH + 100 \n || valueResetRegex.test(inserted)\n || isMobile && lastSelectionStart < 1 && lastSelectionStart == lastSelectionEnd\n ) {\n resetSelection();\n }\n };\n \n var handleClipboardData = function(e, data, forceIEMime) {\n var clipboardData = e.clipboardData || window.clipboardData;\n if (!clipboardData || BROKEN_SETDATA)\n return;\n var mime = USE_IE_MIME_TYPE || forceIEMime ? \"Text\" : \"text/plain\";\n try {\n if (data) {\n return clipboardData.setData(mime, data) !== false;\n } else {\n return clipboardData.getData(mime);\n }\n } catch(e) {\n if (!forceIEMime)\n return handleClipboardData(e, data, true);\n }\n };\n\n var doCopy = function(e, isCut) {\n var data = host.getCopyText();\n if (!data)\n return event.preventDefault(e);\n\n if (handleClipboardData(e, data)) {\n if (isIOS) {\n resetSelection(data);\n copied = data;\n setTimeout(function () {\n copied = false;\n }, 10);\n }\n isCut ? host.onCut() : host.onCopy();\n event.preventDefault(e);\n } else {\n copied = true;\n text.value = data;\n text.select();\n setTimeout(function(){\n copied = false;\n resetSelection();\n isCut ? host.onCut() : host.onCopy();\n });\n }\n };\n \n var onCut = function(e) {\n doCopy(e, true);\n };\n \n var onCopy = function(e) {\n doCopy(e, false);\n };\n \n var onPaste = function(e) {\n var data = handleClipboardData(e);\n if (clipboard.pasteCancelled())\n return;\n if (typeof data == \"string\") {\n if (data)\n host.onPaste(data, e);\n if (useragent.isIE)\n setTimeout(resetSelection);\n event.preventDefault(e);\n }\n else {\n text.value = \"\";\n pasted = true;\n }\n };\n\n event.addCommandKeyListener(text, host.onCommandKey.bind(host), host);\n\n event.addListener(text, \"select\", onSelect, host);\n event.addListener(text, \"input\", onInput, host);\n\n event.addListener(text, \"cut\", onCut, host);\n event.addListener(text, \"copy\", onCopy, host);\n event.addListener(text, \"paste\", onPaste, host);\n if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)) {\n event.addListener(parentNode, \"keydown\", function(e) {\n if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)\n return;\n\n switch (e.keyCode) {\n case 67:\n onCopy(e);\n break;\n case 86:\n onPaste(e);\n break;\n case 88:\n onCut(e);\n break;\n }\n }, host);\n }\n var onCompositionStart = function(e) {\n if (inComposition || !host.onCompositionStart || host.$readOnly) \n return;\n \n inComposition = {};\n\n if (commandMode)\n return;\n \n if (e.data)\n inComposition.useTextareaForIME = false;\n \n setTimeout(onCompositionUpdate, 0);\n host._signal(\"compositionStart\");\n host.on(\"mousedown\", cancelComposition);\n \n var range = host.getSelectionRange();\n range.end.row = range.start.row;\n range.end.column = range.start.column;\n inComposition.markerRange = range;\n inComposition.selectionStart = lastSelectionStart;\n host.onCompositionStart(inComposition);\n \n if (inComposition.useTextareaForIME) {\n lastValue = text.value = \"\";\n lastSelectionStart = 0;\n lastSelectionEnd = 0;\n }\n else {\n if (text.msGetInputContext)\n inComposition.context = text.msGetInputContext();\n if (text.getInputContext)\n inComposition.context = text.getInputContext();\n }\n };\n\n var onCompositionUpdate = function() {\n if (!inComposition || !host.onCompositionUpdate || host.$readOnly)\n return;\n if (commandMode)\n return cancelComposition();\n \n if (inComposition.useTextareaForIME) {\n host.onCompositionUpdate(text.value);\n }\n else {\n var data = text.value;\n sendText(data);\n if (inComposition.markerRange) {\n if (inComposition.context) {\n inComposition.markerRange.start.column = inComposition.selectionStart\n = inComposition.context.compositionStartOffset;\n }\n inComposition.markerRange.end.column = inComposition.markerRange.start.column\n + lastSelectionEnd - inComposition.selectionStart + lastRestoreEnd;\n }\n }\n };\n\n var onCompositionEnd = function(e) {\n if (!host.onCompositionEnd || host.$readOnly) return;\n inComposition = false;\n host.onCompositionEnd();\n host.off(\"mousedown\", cancelComposition);\n if (e) onInput();\n };\n \n\n function cancelComposition() {\n ignoreFocusEvents = true;\n text.blur();\n text.focus();\n ignoreFocusEvents = false;\n }\n\n var syncComposition = lang.delayedCall(onCompositionUpdate, 50).schedule.bind(null, null);\n \n function onKeyup(e) {\n if (e.keyCode == 27 && text.value.length < text.selectionStart) {\n if (!inComposition)\n lastValue = text.value;\n lastSelectionStart = lastSelectionEnd = -1;\n resetSelection();\n }\n syncComposition();\n }\n\n event.addListener(text, \"compositionstart\", onCompositionStart, host);\n event.addListener(text, \"compositionupdate\", onCompositionUpdate, host);\n event.addListener(text, \"keyup\", onKeyup, host);\n event.addListener(text, \"keydown\", syncComposition, host);\n event.addListener(text, \"compositionend\", onCompositionEnd, host);\n\n this.getElement = function() {\n return text;\n };\n this.setCommandMode = function(value) {\n commandMode = value;\n text.readOnly = false;\n };\n \n this.setReadOnly = function(readOnly) {\n if (!commandMode)\n text.readOnly = readOnly;\n };\n\n this.setCopyWithEmptySelection = function(value) {\n };\n\n this.onContextMenu = function(e) {\n afterContextMenu = true;\n resetSelection();\n host._emit(\"nativecontextmenu\", {target: host, domEvent: e});\n this.moveToMouse(e, true);\n };\n \n this.moveToMouse = function(e, bringToFront) {\n if (!tempStyle)\n tempStyle = text.style.cssText;\n text.style.cssText = (bringToFront ? \"z-index:100000;\" : \"\")\n + (useragent.isIE ? \"opacity:0.1;\" : \"\")\n + \"text-indent: -\" + (lastSelectionStart + lastSelectionEnd) * host.renderer.characterWidth * 0.5 + \"px;\";\n\n var rect = host.container.getBoundingClientRect();\n var style = dom.computedStyle(host.container);\n var top = rect.top + (parseInt(style.borderTopWidth) || 0);\n var left = rect.left + (parseInt(rect.borderLeftWidth) || 0);\n var maxTop = rect.bottom - top - text.clientHeight -2;\n var move = function(e) {\n dom.translate(text, e.clientX - left - 2, Math.min(e.clientY - top - 2, maxTop));\n }; \n move(e);\n\n if (e.type != \"mousedown\")\n return;\n\n host.renderer.$isMousePressed = true;\n\n clearTimeout(closeTimeout);\n if (useragent.isWin)\n event.capture(host.container, move, onContextMenuClose);\n };\n\n this.onContextMenuClose = onContextMenuClose;\n var closeTimeout;\n function onContextMenuClose() {\n clearTimeout(closeTimeout);\n closeTimeout = setTimeout(function () {\n if (tempStyle) {\n text.style.cssText = tempStyle;\n tempStyle = '';\n }\n host.renderer.$isMousePressed = false;\n if (host.renderer.$keepTextAreaAtCursor)\n host.renderer.$moveTextAreaToCursor();\n }, 0);\n }\n\n var onContextMenu = function(e) {\n host.textInput.onContextMenu(e);\n onContextMenuClose();\n };\n event.addListener(text, \"mouseup\", onContextMenu, host);\n event.addListener(text, \"mousedown\", function(e) {\n e.preventDefault();\n onContextMenuClose();\n }, host);\n event.addListener(host.renderer.scroller, \"contextmenu\", onContextMenu, host);\n event.addListener(text, \"contextmenu\", onContextMenu, host);\n \n if (isIOS)\n addIosSelectionHandler(parentNode, host, text);\n\n function addIosSelectionHandler(parentNode, host, text) {\n var typingResetTimeout = null;\n var typing = false;\n \n text.addEventListener(\"keydown\", function (e) {\n if (typingResetTimeout) clearTimeout(typingResetTimeout);\n typing = true;\n }, true);\n\n text.addEventListener(\"keyup\", function (e) {\n typingResetTimeout = setTimeout(function () {\n typing = false;\n }, 100);\n }, true);\n var detectArrowKeys = function(e) {\n if (document.activeElement !== text) return;\n if (typing || inComposition || host.$mouseHandler.isMousePressed) return;\n\n if (copied) {\n return;\n }\n var selectionStart = text.selectionStart;\n var selectionEnd = text.selectionEnd;\n \n var key = null;\n var modifier = 0;\n if (selectionStart == 0) {\n key = KEYS.up;\n } else if (selectionStart == 1) {\n key = KEYS.home;\n } else if (selectionEnd > lastSelectionEnd && lastValue[selectionEnd] == \"\\n\") {\n key = KEYS.end;\n } else if (selectionStart < lastSelectionStart && lastValue[selectionStart - 1] == \" \") {\n key = KEYS.left;\n modifier = MODS.option;\n } else if (\n selectionStart < lastSelectionStart\n || (\n selectionStart == lastSelectionStart \n && lastSelectionEnd != lastSelectionStart\n && selectionStart == selectionEnd\n )\n ) {\n key = KEYS.left;\n } else if (selectionEnd > lastSelectionEnd && lastValue.slice(0, selectionEnd).split(\"\\n\").length > 2) {\n key = KEYS.down;\n } else if (selectionEnd > lastSelectionEnd && lastValue[selectionEnd - 1] == \" \") {\n key = KEYS.right;\n modifier = MODS.option;\n } else if (\n selectionEnd > lastSelectionEnd\n || (\n selectionEnd == lastSelectionEnd \n && lastSelectionEnd != lastSelectionStart\n && selectionStart == selectionEnd\n )\n ) {\n key = KEYS.right;\n }\n \n if (selectionStart !== selectionEnd)\n modifier |= MODS.shift;\n\n if (key) {\n var result = host.onCommandKey({}, modifier, key);\n if (!result && host.commands) {\n key = KEYS.keyCodeToString(key);\n var command = host.commands.findKeyCommand(modifier, key);\n if (command)\n host.execCommand(command);\n }\n lastSelectionStart = selectionStart;\n lastSelectionEnd = selectionEnd;\n resetSelection(\"\");\n }\n };\n document.addEventListener(\"selectionchange\", detectArrowKeys);\n host.on(\"destroy\", function() {\n document.removeEventListener(\"selectionchange\", detectArrowKeys);\n });\n }\n};\n\nexports.TextInput = TextInput;\nexports.$setUserAgentForTests = function(_isMobile, _isIOS) {\n isMobile = _isMobile;\n isIOS = _isIOS;\n};\n});\n\nace.define(\"ace/mouse/default_handlers\",[\"require\",\"exports\",\"module\",\"ace/lib/useragent\"], function(require, exports, module) {\n\nvar useragent = require(\"../lib/useragent\");\n\nvar DRAG_OFFSET = 0; // pixels\nvar SCROLL_COOLDOWN_T = 550; // milliseconds\n\nfunction DefaultHandlers(mouseHandler) {\n mouseHandler.$clickSelection = null;\n\n var editor = mouseHandler.editor;\n editor.setDefaultHandler(\"mousedown\", this.onMouseDown.bind(mouseHandler));\n editor.setDefaultHandler(\"dblclick\", this.onDoubleClick.bind(mouseHandler));\n editor.setDefaultHandler(\"tripleclick\", this.onTripleClick.bind(mouseHandler));\n editor.setDefaultHandler(\"quadclick\", this.onQuadClick.bind(mouseHandler));\n editor.setDefaultHandler(\"mousewheel\", this.onMouseWheel.bind(mouseHandler));\n\n var exports = [\"select\", \"startSelect\", \"selectEnd\", \"selectAllEnd\", \"selectByWordsEnd\",\n \"selectByLinesEnd\", \"dragWait\", \"dragWaitEnd\", \"focusWait\"];\n\n exports.forEach(function(x) {\n mouseHandler[x] = this[x];\n }, this);\n\n mouseHandler.selectByLines = this.extendSelectionBy.bind(mouseHandler, \"getLineRange\");\n mouseHandler.selectByWords = this.extendSelectionBy.bind(mouseHandler, \"getWordRange\");\n}\n\n(function() {\n\n this.onMouseDown = function(ev) {\n var inSelection = ev.inSelection();\n var pos = ev.getDocumentPosition();\n this.mousedownEvent = ev;\n var editor = this.editor;\n\n var button = ev.getButton();\n if (button !== 0) {\n var selectionRange = editor.getSelectionRange();\n var selectionEmpty = selectionRange.isEmpty();\n if (selectionEmpty || button == 1)\n editor.selection.moveToPosition(pos);\n if (button == 2) {\n editor.textInput.onContextMenu(ev.domEvent);\n if (!useragent.isMozilla)\n ev.preventDefault();\n }\n return;\n }\n\n this.mousedownEvent.time = Date.now();\n if (inSelection && !editor.isFocused()) {\n editor.focus();\n if (this.$focusTimeout && !this.$clickSelection && !editor.inMultiSelectMode) {\n this.setState(\"focusWait\");\n this.captureMouse(ev);\n return;\n }\n }\n\n this.captureMouse(ev);\n this.startSelect(pos, ev.domEvent._clicks > 1);\n return ev.preventDefault();\n };\n\n this.startSelect = function(pos, waitForClickSelection) {\n pos = pos || this.editor.renderer.screenToTextCoordinates(this.x, this.y);\n var editor = this.editor;\n if (!this.mousedownEvent) return;\n if (this.mousedownEvent.getShiftKey())\n editor.selection.selectToPosition(pos);\n else if (!waitForClickSelection)\n editor.selection.moveToPosition(pos);\n if (!waitForClickSelection)\n this.select();\n if (editor.renderer.scroller.setCapture) {\n editor.renderer.scroller.setCapture();\n }\n editor.setStyle(\"ace_selecting\");\n this.setState(\"select\");\n };\n\n this.select = function() {\n var anchor, editor = this.editor;\n var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);\n if (this.$clickSelection) {\n var cmp = this.$clickSelection.comparePoint(cursor);\n\n if (cmp == -1) {\n anchor = this.$clickSelection.end;\n } else if (cmp == 1) {\n anchor = this.$clickSelection.start;\n } else {\n var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);\n cursor = orientedRange.cursor;\n anchor = orientedRange.anchor;\n }\n editor.selection.setSelectionAnchor(anchor.row, anchor.column);\n }\n editor.selection.selectToPosition(cursor);\n editor.renderer.scrollCursorIntoView();\n };\n\n this.extendSelectionBy = function(unitName) {\n var anchor, editor = this.editor;\n var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);\n var range = editor.selection[unitName](cursor.row, cursor.column);\n if (this.$clickSelection) {\n var cmpStart = this.$clickSelection.comparePoint(range.start);\n var cmpEnd = this.$clickSelection.comparePoint(range.end);\n\n if (cmpStart == -1 && cmpEnd <= 0) {\n anchor = this.$clickSelection.end;\n if (range.end.row != cursor.row || range.end.column != cursor.column)\n cursor = range.start;\n } else if (cmpEnd == 1 && cmpStart >= 0) {\n anchor = this.$clickSelection.start;\n if (range.start.row != cursor.row || range.start.column != cursor.column)\n cursor = range.end;\n } else if (cmpStart == -1 && cmpEnd == 1) {\n cursor = range.end;\n anchor = range.start;\n } else {\n var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);\n cursor = orientedRange.cursor;\n anchor = orientedRange.anchor;\n }\n editor.selection.setSelectionAnchor(anchor.row, anchor.column);\n }\n editor.selection.selectToPosition(cursor);\n editor.renderer.scrollCursorIntoView();\n };\n\n this.selectEnd =\n this.selectAllEnd =\n this.selectByWordsEnd =\n this.selectByLinesEnd = function() {\n this.$clickSelection = null;\n this.editor.unsetStyle(\"ace_selecting\");\n if (this.editor.renderer.scroller.releaseCapture) {\n this.editor.renderer.scroller.releaseCapture();\n }\n };\n\n this.focusWait = function() {\n var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);\n var time = Date.now();\n\n if (distance > DRAG_OFFSET || time - this.mousedownEvent.time > this.$focusTimeout)\n this.startSelect(this.mousedownEvent.getDocumentPosition());\n };\n\n this.onDoubleClick = function(ev) {\n var pos = ev.getDocumentPosition();\n var editor = this.editor;\n var session = editor.session;\n\n var range = session.getBracketRange(pos);\n if (range) {\n if (range.isEmpty()) {\n range.start.column--;\n range.end.column++;\n }\n this.setState(\"select\");\n } else {\n range = editor.selection.getWordRange(pos.row, pos.column);\n this.setState(\"selectByWords\");\n }\n this.$clickSelection = range;\n this.select();\n };\n\n this.onTripleClick = function(ev) {\n var pos = ev.getDocumentPosition();\n var editor = this.editor;\n\n this.setState(\"selectByLines\");\n var range = editor.getSelectionRange();\n if (range.isMultiLine() && range.contains(pos.row, pos.column)) {\n this.$clickSelection = editor.selection.getLineRange(range.start.row);\n this.$clickSelection.end = editor.selection.getLineRange(range.end.row).end;\n } else {\n this.$clickSelection = editor.selection.getLineRange(pos.row);\n }\n this.select();\n };\n\n this.onQuadClick = function(ev) {\n var editor = this.editor;\n\n editor.selectAll();\n this.$clickSelection = editor.getSelectionRange();\n this.setState(\"selectAll\");\n };\n\n this.onMouseWheel = function(ev) {\n if (ev.getAccelKey())\n return;\n if (ev.getShiftKey() && ev.wheelY && !ev.wheelX) {\n ev.wheelX = ev.wheelY;\n ev.wheelY = 0;\n }\n \n var editor = this.editor;\n \n if (!this.$lastScroll)\n this.$lastScroll = { t: 0, vx: 0, vy: 0, allowed: 0 };\n \n var prevScroll = this.$lastScroll;\n var t = ev.domEvent.timeStamp;\n var dt = t - prevScroll.t;\n var vx = dt ? ev.wheelX / dt : prevScroll.vx;\n var vy = dt ? ev.wheelY / dt : prevScroll.vy;\n if (dt < SCROLL_COOLDOWN_T) {\n vx = (vx + prevScroll.vx) / 2;\n vy = (vy + prevScroll.vy) / 2;\n }\n \n var direction = Math.abs(vx / vy);\n \n var canScroll = false;\n if (direction >= 1 && editor.renderer.isScrollableBy(ev.wheelX * ev.speed, 0))\n canScroll = true;\n if (direction <= 1 && editor.renderer.isScrollableBy(0, ev.wheelY * ev.speed))\n canScroll = true;\n \n if (canScroll) {\n prevScroll.allowed = t;\n } else if (t - prevScroll.allowed < SCROLL_COOLDOWN_T) {\n var isSlower = Math.abs(vx) <= 1.5 * Math.abs(prevScroll.vx)\n && Math.abs(vy) <= 1.5 * Math.abs(prevScroll.vy);\n if (isSlower) {\n canScroll = true;\n prevScroll.allowed = t;\n }\n else {\n prevScroll.allowed = 0;\n }\n }\n \n prevScroll.t = t;\n prevScroll.vx = vx;\n prevScroll.vy = vy;\n\n if (canScroll) {\n editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);\n return ev.stop();\n }\n };\n\n}).call(DefaultHandlers.prototype);\n\nexports.DefaultHandlers = DefaultHandlers;\n\nfunction calcDistance(ax, ay, bx, by) {\n return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));\n}\n\nfunction calcRangeOrientation(range, cursor) {\n if (range.start.row == range.end.row)\n var cmp = 2 * cursor.column - range.start.column - range.end.column;\n else if (range.start.row == range.end.row - 1 && !range.start.column && !range.end.column)\n var cmp = cursor.column - 4;\n else\n var cmp = 2 * cursor.row - range.start.row - range.end.row;\n\n if (cmp < 0)\n return {cursor: range.start, anchor: range.end};\n else\n return {cursor: range.end, anchor: range.start};\n}\n\n});\n\nace.define(\"ace/tooltip\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\"], function(require, exports, module) {\n\nvar oop = require(\"./lib/oop\");\nvar dom = require(\"./lib/dom\");\nfunction Tooltip (parentNode) {\n this.isOpen = false;\n this.$element = null;\n this.$parentNode = parentNode;\n}\n\n(function() {\n this.$init = function() {\n this.$element = dom.createElement(\"div\");\n this.$element.className = \"ace_tooltip\";\n this.$element.style.display = \"none\";\n this.$parentNode.appendChild(this.$element);\n return this.$element;\n };\n this.getElement = function() {\n return this.$element || this.$init();\n };\n this.setText = function(text) {\n this.getElement().textContent = text;\n };\n this.setHtml = function(html) {\n this.getElement().innerHTML = html;\n };\n this.setPosition = function(x, y) {\n this.getElement().style.left = x + \"px\";\n this.getElement().style.top = y + \"px\";\n };\n this.setClassName = function(className) {\n dom.addCssClass(this.getElement(), className);\n };\n this.show = function(text, x, y) {\n if (text != null)\n this.setText(text);\n if (x != null && y != null)\n this.setPosition(x, y);\n if (!this.isOpen) {\n this.getElement().style.display = \"block\";\n this.isOpen = true;\n }\n };\n\n this.hide = function() {\n if (this.isOpen) {\n this.getElement().style.display = \"none\";\n this.isOpen = false;\n }\n };\n this.getHeight = function() {\n return this.getElement().offsetHeight;\n };\n this.getWidth = function() {\n return this.getElement().offsetWidth;\n };\n \n this.destroy = function() {\n this.isOpen = false;\n if (this.$element && this.$element.parentNode) {\n this.$element.parentNode.removeChild(this.$element);\n }\n };\n\n}).call(Tooltip.prototype);\n\nexports.Tooltip = Tooltip;\n});\n\nace.define(\"ace/mouse/default_gutter_handler\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/lib/oop\",\"ace/lib/event\",\"ace/tooltip\"], function(require, exports, module) {\nvar dom = require(\"../lib/dom\");\nvar oop = require(\"../lib/oop\");\nvar event = require(\"../lib/event\");\nvar Tooltip = require(\"../tooltip\").Tooltip;\n\nfunction GutterHandler(mouseHandler) {\n var editor = mouseHandler.editor;\n var gutter = editor.renderer.$gutterLayer;\n var tooltip = new GutterTooltip(editor.container);\n\n mouseHandler.editor.setDefaultHandler(\"guttermousedown\", function(e) {\n if (!editor.isFocused() || e.getButton() != 0)\n return;\n var gutterRegion = gutter.getRegion(e);\n\n if (gutterRegion == \"foldWidgets\")\n return;\n\n var row = e.getDocumentPosition().row;\n var selection = editor.session.selection;\n\n if (e.getShiftKey())\n selection.selectTo(row, 0);\n else {\n if (e.domEvent.detail == 2) {\n editor.selectAll();\n return e.preventDefault();\n }\n mouseHandler.$clickSelection = editor.selection.getLineRange(row);\n }\n mouseHandler.setState(\"selectByLines\");\n mouseHandler.captureMouse(e);\n return e.preventDefault();\n });\n\n\n var tooltipTimeout, mouseEvent, tooltipAnnotation;\n\n function showTooltip() {\n var row = mouseEvent.getDocumentPosition().row;\n var annotation = gutter.$annotations[row];\n if (!annotation)\n return hideTooltip();\n\n var maxRow = editor.session.getLength();\n if (row == maxRow) {\n var screenRow = editor.renderer.pixelToScreenCoordinates(0, mouseEvent.y).row;\n var pos = mouseEvent.$pos;\n if (screenRow > editor.session.documentToScreenRow(pos.row, pos.column))\n return hideTooltip();\n }\n\n if (tooltipAnnotation == annotation)\n return;\n tooltipAnnotation = annotation.text.join(\"
\");\n\n tooltip.setHtml(tooltipAnnotation);\n tooltip.show();\n editor._signal(\"showGutterTooltip\", tooltip);\n editor.on(\"mousewheel\", hideTooltip);\n\n if (mouseHandler.$tooltipFollowsMouse) {\n moveTooltip(mouseEvent);\n } else {\n var gutterElement = mouseEvent.domEvent.target;\n var rect = gutterElement.getBoundingClientRect();\n var style = tooltip.getElement().style;\n style.left = rect.right + \"px\";\n style.top = rect.bottom + \"px\";\n }\n }\n\n function hideTooltip() {\n if (tooltipTimeout)\n tooltipTimeout = clearTimeout(tooltipTimeout);\n if (tooltipAnnotation) {\n tooltip.hide();\n tooltipAnnotation = null;\n editor._signal(\"hideGutterTooltip\", tooltip);\n editor.off(\"mousewheel\", hideTooltip);\n }\n }\n\n function moveTooltip(e) {\n tooltip.setPosition(e.x, e.y);\n }\n\n mouseHandler.editor.setDefaultHandler(\"guttermousemove\", function(e) {\n var target = e.domEvent.target || e.domEvent.srcElement;\n if (dom.hasCssClass(target, \"ace_fold-widget\"))\n return hideTooltip();\n\n if (tooltipAnnotation && mouseHandler.$tooltipFollowsMouse)\n moveTooltip(e);\n\n mouseEvent = e;\n if (tooltipTimeout)\n return;\n tooltipTimeout = setTimeout(function() {\n tooltipTimeout = null;\n if (mouseEvent && !mouseHandler.isMousePressed)\n showTooltip();\n else\n hideTooltip();\n }, 50);\n });\n\n event.addListener(editor.renderer.$gutter, \"mouseout\", function(e) {\n mouseEvent = null;\n if (!tooltipAnnotation || tooltipTimeout)\n return;\n\n tooltipTimeout = setTimeout(function() {\n tooltipTimeout = null;\n hideTooltip();\n }, 50);\n }, editor);\n \n editor.on(\"changeSession\", hideTooltip);\n}\n\nfunction GutterTooltip(parentNode) {\n Tooltip.call(this, parentNode);\n}\n\noop.inherits(GutterTooltip, Tooltip);\n\n(function(){\n this.setPosition = function(x, y) {\n var windowWidth = window.innerWidth || document.documentElement.clientWidth;\n var windowHeight = window.innerHeight || document.documentElement.clientHeight;\n var width = this.getWidth();\n var height = this.getHeight();\n x += 15;\n y += 15;\n if (x + width > windowWidth) {\n x -= (x + width) - windowWidth;\n }\n if (y + height > windowHeight) {\n y -= 20 + height;\n }\n Tooltip.prototype.setPosition.call(this, x, y);\n };\n\n}).call(GutterTooltip.prototype);\n\n\n\nexports.GutterHandler = GutterHandler;\n\n});\n\nace.define(\"ace/mouse/mouse_event\",[\"require\",\"exports\",\"module\",\"ace/lib/event\",\"ace/lib/useragent\"], function(require, exports, module) {\n\nvar event = require(\"../lib/event\");\nvar useragent = require(\"../lib/useragent\");\nvar MouseEvent = exports.MouseEvent = function(domEvent, editor) {\n this.domEvent = domEvent;\n this.editor = editor;\n \n this.x = this.clientX = domEvent.clientX;\n this.y = this.clientY = domEvent.clientY;\n\n this.$pos = null;\n this.$inSelection = null;\n \n this.propagationStopped = false;\n this.defaultPrevented = false;\n};\n\n(function() { \n \n this.stopPropagation = function() {\n event.stopPropagation(this.domEvent);\n this.propagationStopped = true;\n };\n \n this.preventDefault = function() {\n event.preventDefault(this.domEvent);\n this.defaultPrevented = true;\n };\n \n this.stop = function() {\n this.stopPropagation();\n this.preventDefault();\n };\n this.getDocumentPosition = function() {\n if (this.$pos)\n return this.$pos;\n \n this.$pos = this.editor.renderer.screenToTextCoordinates(this.clientX, this.clientY);\n return this.$pos;\n };\n this.inSelection = function() {\n if (this.$inSelection !== null)\n return this.$inSelection;\n \n var editor = this.editor;\n \n\n var selectionRange = editor.getSelectionRange();\n if (selectionRange.isEmpty())\n this.$inSelection = false;\n else {\n var pos = this.getDocumentPosition();\n this.$inSelection = selectionRange.contains(pos.row, pos.column);\n }\n\n return this.$inSelection;\n };\n this.getButton = function() {\n return event.getButton(this.domEvent);\n };\n this.getShiftKey = function() {\n return this.domEvent.shiftKey;\n };\n \n this.getAccelKey = useragent.isMac\n ? function() { return this.domEvent.metaKey; }\n : function() { return this.domEvent.ctrlKey; };\n \n}).call(MouseEvent.prototype);\n\n});\n\nace.define(\"ace/mouse/dragdrop_handler\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/lib/event\",\"ace/lib/useragent\"], function(require, exports, module) {\n\nvar dom = require(\"../lib/dom\");\nvar event = require(\"../lib/event\");\nvar useragent = require(\"../lib/useragent\");\n\nvar AUTOSCROLL_DELAY = 200;\nvar SCROLL_CURSOR_DELAY = 200;\nvar SCROLL_CURSOR_HYSTERESIS = 5;\n\nfunction DragdropHandler(mouseHandler) {\n\n var editor = mouseHandler.editor;\n\n var blankImage = dom.createElement(\"img\");\n blankImage.src = \"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\";\n if (useragent.isOpera)\n blankImage.style.cssText = \"width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;\";\n\n var exports = [\"dragWait\", \"dragWaitEnd\", \"startDrag\", \"dragReadyEnd\", \"onMouseDrag\"];\n\n exports.forEach(function(x) {\n mouseHandler[x] = this[x];\n }, this);\n editor.on(\"mousedown\", this.onMouseDown.bind(mouseHandler));\n\n\n var mouseTarget = editor.container;\n var dragSelectionMarker, x, y;\n var timerId, range;\n var dragCursor, counter = 0;\n var dragOperation;\n var isInternal;\n var autoScrollStartTime;\n var cursorMovedTime;\n var cursorPointOnCaretMoved;\n\n this.onDragStart = function(e) {\n if (this.cancelDrag || !mouseTarget.draggable) {\n var self = this;\n setTimeout(function(){\n self.startSelect();\n self.captureMouse(e);\n }, 0);\n return e.preventDefault();\n }\n range = editor.getSelectionRange();\n\n var dataTransfer = e.dataTransfer;\n dataTransfer.effectAllowed = editor.getReadOnly() ? \"copy\" : \"copyMove\";\n if (useragent.isOpera) {\n editor.container.appendChild(blankImage);\n blankImage.scrollTop = 0;\n }\n dataTransfer.setDragImage && dataTransfer.setDragImage(blankImage, 0, 0);\n if (useragent.isOpera) {\n editor.container.removeChild(blankImage);\n }\n dataTransfer.clearData();\n dataTransfer.setData(\"Text\", editor.session.getTextRange());\n\n isInternal = true;\n this.setState(\"drag\");\n };\n\n this.onDragEnd = function(e) {\n mouseTarget.draggable = false;\n isInternal = false;\n this.setState(null);\n if (!editor.getReadOnly()) {\n var dropEffect = e.dataTransfer.dropEffect;\n if (!dragOperation && dropEffect == \"move\")\n editor.session.remove(editor.getSelectionRange());\n editor.$resetCursorStyle();\n }\n this.editor.unsetStyle(\"ace_dragging\");\n this.editor.renderer.setCursorStyle(\"\");\n };\n\n this.onDragEnter = function(e) {\n if (editor.getReadOnly() || !canAccept(e.dataTransfer))\n return;\n x = e.clientX;\n y = e.clientY;\n if (!dragSelectionMarker)\n addDragMarker();\n counter++;\n e.dataTransfer.dropEffect = dragOperation = getDropEffect(e);\n return event.preventDefault(e);\n };\n\n this.onDragOver = function(e) {\n if (editor.getReadOnly() || !canAccept(e.dataTransfer))\n return;\n x = e.clientX;\n y = e.clientY;\n if (!dragSelectionMarker) {\n addDragMarker();\n counter++;\n }\n if (onMouseMoveTimer !== null)\n onMouseMoveTimer = null;\n\n e.dataTransfer.dropEffect = dragOperation = getDropEffect(e);\n return event.preventDefault(e);\n };\n\n this.onDragLeave = function(e) {\n counter--;\n if (counter <= 0 && dragSelectionMarker) {\n clearDragMarker();\n dragOperation = null;\n return event.preventDefault(e);\n }\n };\n\n this.onDrop = function(e) {\n if (!dragCursor)\n return;\n var dataTransfer = e.dataTransfer;\n if (isInternal) {\n switch (dragOperation) {\n case \"move\":\n if (range.contains(dragCursor.row, dragCursor.column)) {\n range = {\n start: dragCursor,\n end: dragCursor\n };\n } else {\n range = editor.moveText(range, dragCursor);\n }\n break;\n case \"copy\":\n range = editor.moveText(range, dragCursor, true);\n break;\n }\n } else {\n var dropData = dataTransfer.getData('Text');\n range = {\n start: dragCursor,\n end: editor.session.insert(dragCursor, dropData)\n };\n editor.focus();\n dragOperation = null;\n }\n clearDragMarker();\n return event.preventDefault(e);\n };\n\n event.addListener(mouseTarget, \"dragstart\", this.onDragStart.bind(mouseHandler), editor);\n event.addListener(mouseTarget, \"dragend\", this.onDragEnd.bind(mouseHandler), editor);\n event.addListener(mouseTarget, \"dragenter\", this.onDragEnter.bind(mouseHandler), editor);\n event.addListener(mouseTarget, \"dragover\", this.onDragOver.bind(mouseHandler), editor);\n event.addListener(mouseTarget, \"dragleave\", this.onDragLeave.bind(mouseHandler), editor);\n event.addListener(mouseTarget, \"drop\", this.onDrop.bind(mouseHandler), editor);\n\n function scrollCursorIntoView(cursor, prevCursor) {\n var now = Date.now();\n var vMovement = !prevCursor || cursor.row != prevCursor.row;\n var hMovement = !prevCursor || cursor.column != prevCursor.column;\n if (!cursorMovedTime || vMovement || hMovement) {\n editor.moveCursorToPosition(cursor);\n cursorMovedTime = now;\n cursorPointOnCaretMoved = {x: x, y: y};\n } else {\n var distance = calcDistance(cursorPointOnCaretMoved.x, cursorPointOnCaretMoved.y, x, y);\n if (distance > SCROLL_CURSOR_HYSTERESIS) {\n cursorMovedTime = null;\n } else if (now - cursorMovedTime >= SCROLL_CURSOR_DELAY) {\n editor.renderer.scrollCursorIntoView();\n cursorMovedTime = null;\n }\n }\n }\n\n function autoScroll(cursor, prevCursor) {\n var now = Date.now();\n var lineHeight = editor.renderer.layerConfig.lineHeight;\n var characterWidth = editor.renderer.layerConfig.characterWidth;\n var editorRect = editor.renderer.scroller.getBoundingClientRect();\n var offsets = {\n x: {\n left: x - editorRect.left,\n right: editorRect.right - x\n },\n y: {\n top: y - editorRect.top,\n bottom: editorRect.bottom - y\n }\n };\n var nearestXOffset = Math.min(offsets.x.left, offsets.x.right);\n var nearestYOffset = Math.min(offsets.y.top, offsets.y.bottom);\n var scrollCursor = {row: cursor.row, column: cursor.column};\n if (nearestXOffset / characterWidth <= 2) {\n scrollCursor.column += (offsets.x.left < offsets.x.right ? -3 : +2);\n }\n if (nearestYOffset / lineHeight <= 1) {\n scrollCursor.row += (offsets.y.top < offsets.y.bottom ? -1 : +1);\n }\n var vScroll = cursor.row != scrollCursor.row;\n var hScroll = cursor.column != scrollCursor.column;\n var vMovement = !prevCursor || cursor.row != prevCursor.row;\n if (vScroll || (hScroll && !vMovement)) {\n if (!autoScrollStartTime)\n autoScrollStartTime = now;\n else if (now - autoScrollStartTime >= AUTOSCROLL_DELAY)\n editor.renderer.scrollCursorIntoView(scrollCursor);\n } else {\n autoScrollStartTime = null;\n }\n }\n\n function onDragInterval() {\n var prevCursor = dragCursor;\n dragCursor = editor.renderer.screenToTextCoordinates(x, y);\n scrollCursorIntoView(dragCursor, prevCursor);\n autoScroll(dragCursor, prevCursor);\n }\n\n function addDragMarker() {\n range = editor.selection.toOrientedRange();\n dragSelectionMarker = editor.session.addMarker(range, \"ace_selection\", editor.getSelectionStyle());\n editor.clearSelection();\n if (editor.isFocused())\n editor.renderer.$cursorLayer.setBlinking(false);\n clearInterval(timerId);\n onDragInterval();\n timerId = setInterval(onDragInterval, 20);\n counter = 0;\n event.addListener(document, \"mousemove\", onMouseMove);\n }\n\n function clearDragMarker() {\n clearInterval(timerId);\n editor.session.removeMarker(dragSelectionMarker);\n dragSelectionMarker = null;\n editor.selection.fromOrientedRange(range);\n if (editor.isFocused() && !isInternal)\n editor.$resetCursorStyle();\n range = null;\n dragCursor = null;\n counter = 0;\n autoScrollStartTime = null;\n cursorMovedTime = null;\n event.removeListener(document, \"mousemove\", onMouseMove);\n }\n var onMouseMoveTimer = null;\n function onMouseMove() {\n if (onMouseMoveTimer == null) {\n onMouseMoveTimer = setTimeout(function() {\n if (onMouseMoveTimer != null && dragSelectionMarker)\n clearDragMarker();\n }, 20);\n }\n }\n\n function canAccept(dataTransfer) {\n var types = dataTransfer.types;\n return !types || Array.prototype.some.call(types, function(type) {\n return type == 'text/plain' || type == 'Text';\n });\n }\n\n function getDropEffect(e) {\n var copyAllowed = ['copy', 'copymove', 'all', 'uninitialized'];\n var moveAllowed = ['move', 'copymove', 'linkmove', 'all', 'uninitialized'];\n\n var copyModifierState = useragent.isMac ? e.altKey : e.ctrlKey;\n var effectAllowed = \"uninitialized\";\n try {\n effectAllowed = e.dataTransfer.effectAllowed.toLowerCase();\n } catch (e) {}\n var dropEffect = \"none\";\n\n if (copyModifierState && copyAllowed.indexOf(effectAllowed) >= 0)\n dropEffect = \"copy\";\n else if (moveAllowed.indexOf(effectAllowed) >= 0)\n dropEffect = \"move\";\n else if (copyAllowed.indexOf(effectAllowed) >= 0)\n dropEffect = \"copy\";\n\n return dropEffect;\n }\n}\n\n(function() {\n\n this.dragWait = function() {\n var interval = Date.now() - this.mousedownEvent.time;\n if (interval > this.editor.getDragDelay())\n this.startDrag();\n };\n\n this.dragWaitEnd = function() {\n var target = this.editor.container;\n target.draggable = false;\n this.startSelect(this.mousedownEvent.getDocumentPosition());\n this.selectEnd();\n };\n\n this.dragReadyEnd = function(e) {\n this.editor.$resetCursorStyle();\n this.editor.unsetStyle(\"ace_dragging\");\n this.editor.renderer.setCursorStyle(\"\");\n this.dragWaitEnd();\n };\n\n this.startDrag = function(){\n this.cancelDrag = false;\n var editor = this.editor;\n var target = editor.container;\n target.draggable = true;\n editor.renderer.$cursorLayer.setBlinking(false);\n editor.setStyle(\"ace_dragging\");\n var cursorStyle = useragent.isWin ? \"default\" : \"move\";\n editor.renderer.setCursorStyle(cursorStyle);\n this.setState(\"dragReady\");\n };\n\n this.onMouseDrag = function(e) {\n var target = this.editor.container;\n if (useragent.isIE && this.state == \"dragReady\") {\n var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);\n if (distance > 3)\n target.dragDrop();\n }\n if (this.state === \"dragWait\") {\n var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);\n if (distance > 0) {\n target.draggable = false;\n this.startSelect(this.mousedownEvent.getDocumentPosition());\n }\n }\n };\n\n this.onMouseDown = function(e) {\n if (!this.$dragEnabled)\n return;\n this.mousedownEvent = e;\n var editor = this.editor;\n\n var inSelection = e.inSelection();\n var button = e.getButton();\n var clickCount = e.domEvent.detail || 1;\n if (clickCount === 1 && button === 0 && inSelection) {\n if (e.editor.inMultiSelectMode && (e.getAccelKey() || e.getShiftKey()))\n return;\n this.mousedownEvent.time = Date.now();\n var eventTarget = e.domEvent.target || e.domEvent.srcElement;\n if (\"unselectable\" in eventTarget)\n eventTarget.unselectable = \"on\";\n if (editor.getDragDelay()) {\n if (useragent.isWebKit) {\n this.cancelDrag = true;\n var mouseTarget = editor.container;\n mouseTarget.draggable = true;\n }\n this.setState(\"dragWait\");\n } else {\n this.startDrag();\n }\n this.captureMouse(e, this.onMouseDrag.bind(this));\n e.defaultPrevented = true;\n }\n };\n\n}).call(DragdropHandler.prototype);\n\n\nfunction calcDistance(ax, ay, bx, by) {\n return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));\n}\n\nexports.DragdropHandler = DragdropHandler;\n\n});\n\nace.define(\"ace/mouse/touch_handler\",[\"require\",\"exports\",\"module\",\"ace/mouse/mouse_event\",\"ace/lib/event\",\"ace/lib/dom\"], function(require, exports, module) {\n\nvar MouseEvent = require(\"./mouse_event\").MouseEvent;\nvar event = require(\"../lib/event\");\nvar dom = require(\"../lib/dom\");\n\nexports.addTouchListeners = function(el, editor) {\n var mode = \"scroll\";\n var startX;\n var startY;\n var touchStartT;\n var lastT;\n var longTouchTimer;\n var animationTimer;\n var animationSteps = 0;\n var pos;\n var clickCount = 0;\n var vX = 0;\n var vY = 0;\n var pressed;\n var contextMenu;\n \n function createContextMenu() {\n var clipboard = window.navigator && window.navigator.clipboard;\n var isOpen = false;\n var updateMenu = function() {\n var selected = editor.getCopyText();\n var hasUndo = editor.session.getUndoManager().hasUndo();\n contextMenu.replaceChild(\n dom.buildDom(isOpen ? [\"span\",\n !selected && [\"span\", { class: \"ace_mobile-button\", action: \"selectall\" }, \"Select All\"],\n selected && [\"span\", { class: \"ace_mobile-button\", action: \"copy\" }, \"Copy\"],\n selected && [\"span\", { class: \"ace_mobile-button\", action: \"cut\" }, \"Cut\"],\n clipboard && [\"span\", { class: \"ace_mobile-button\", action: \"paste\" }, \"Paste\"],\n hasUndo && [\"span\", { class: \"ace_mobile-button\", action: \"undo\" }, \"Undo\"],\n [\"span\", { class: \"ace_mobile-button\", action: \"find\" }, \"Find\"],\n [\"span\", { class: \"ace_mobile-button\", action: \"openCommandPallete\" }, \"Pallete\"]\n ] : [\"span\"]),\n contextMenu.firstChild\n );\n };\n var handleClick = function(e) {\n var action = e.target.getAttribute(\"action\");\n\n if (action == \"more\" || !isOpen) {\n isOpen = !isOpen;\n return updateMenu();\n }\n if (action == \"paste\") {\n clipboard.readText().then(function (text) {\n editor.execCommand(action, text);\n });\n }\n else if (action) {\n if (action == \"cut\" || action == \"copy\") {\n if (clipboard)\n clipboard.writeText(editor.getCopyText());\n else\n document.execCommand(\"copy\");\n }\n editor.execCommand(action);\n }\n contextMenu.firstChild.style.display = \"none\";\n isOpen = false;\n if (action != \"openCommandPallete\")\n editor.focus();\n };\n contextMenu = dom.buildDom([\"div\",\n {\n class: \"ace_mobile-menu\",\n ontouchstart: function(e) {\n mode = \"menu\";\n e.stopPropagation();\n e.preventDefault();\n editor.textInput.focus();\n },\n ontouchend: function(e) {\n e.stopPropagation();\n e.preventDefault();\n handleClick(e);\n },\n onclick: handleClick\n },\n [\"span\"],\n [\"span\", { class: \"ace_mobile-button\", action: \"more\" }, \"...\"]\n ], editor.container);\n }\n function showContextMenu() {\n if (!contextMenu) createContextMenu();\n var cursor = editor.selection.cursor;\n var pagePos = editor.renderer.textToScreenCoordinates(cursor.row, cursor.column);\n var leftOffset = editor.renderer.textToScreenCoordinates(0, 0).pageX;\n var scrollLeft = editor.renderer.scrollLeft;\n var rect = editor.container.getBoundingClientRect();\n contextMenu.style.top = pagePos.pageY - rect.top - 3 + \"px\";\n if (pagePos.pageX - rect.left < rect.width - 70) {\n contextMenu.style.left = \"\";\n contextMenu.style.right = \"10px\";\n } else {\n contextMenu.style.right = \"\";\n contextMenu.style.left = leftOffset + scrollLeft - rect.left + \"px\";\n }\n contextMenu.style.display = \"\";\n contextMenu.firstChild.style.display = \"none\";\n editor.on(\"input\", hideContextMenu);\n }\n function hideContextMenu(e) {\n if (contextMenu)\n contextMenu.style.display = \"none\";\n editor.off(\"input\", hideContextMenu);\n }\n\n function handleLongTap() {\n longTouchTimer = null;\n clearTimeout(longTouchTimer);\n var range = editor.selection.getRange();\n var inSelection = range.contains(pos.row, pos.column);\n if (range.isEmpty() || !inSelection) {\n editor.selection.moveToPosition(pos);\n editor.selection.selectWord();\n }\n mode = \"wait\";\n showContextMenu();\n }\n function switchToSelectionMode() {\n longTouchTimer = null;\n clearTimeout(longTouchTimer);\n editor.selection.moveToPosition(pos);\n var range = clickCount >= 2\n ? editor.selection.getLineRange(pos.row)\n : editor.session.getBracketRange(pos);\n if (range && !range.isEmpty()) {\n editor.selection.setRange(range);\n } else {\n editor.selection.selectWord();\n }\n mode = \"wait\";\n }\n event.addListener(el, \"contextmenu\", function(e) {\n if (!pressed) return;\n var textarea = editor.textInput.getElement();\n textarea.focus();\n }, editor);\n event.addListener(el, \"touchstart\", function (e) {\n var touches = e.touches;\n if (longTouchTimer || touches.length > 1) {\n clearTimeout(longTouchTimer);\n longTouchTimer = null;\n touchStartT = -1;\n mode = \"zoom\";\n return;\n }\n \n pressed = editor.$mouseHandler.isMousePressed = true;\n var h = editor.renderer.layerConfig.lineHeight;\n var w = editor.renderer.layerConfig.lineHeight;\n var t = e.timeStamp;\n lastT = t;\n var touchObj = touches[0];\n var x = touchObj.clientX;\n var y = touchObj.clientY;\n if (Math.abs(startX - x) + Math.abs(startY - y) > h)\n touchStartT = -1;\n \n startX = e.clientX = x;\n startY = e.clientY = y;\n vX = vY = 0;\n \n var ev = new MouseEvent(e, editor);\n pos = ev.getDocumentPosition();\n\n if (t - touchStartT < 500 && touches.length == 1 && !animationSteps) {\n clickCount++;\n e.preventDefault();\n e.button = 0;\n switchToSelectionMode();\n } else {\n clickCount = 0;\n var cursor = editor.selection.cursor;\n var anchor = editor.selection.isEmpty() ? cursor : editor.selection.anchor;\n \n var cursorPos = editor.renderer.$cursorLayer.getPixelPosition(cursor, true);\n var anchorPos = editor.renderer.$cursorLayer.getPixelPosition(anchor, true);\n var rect = editor.renderer.scroller.getBoundingClientRect();\n var offsetTop = editor.renderer.layerConfig.offset;\n var offsetLeft = editor.renderer.scrollLeft;\n var weightedDistance = function(x, y) {\n x = x / w;\n y = y / h - 0.75;\n return x * x + y * y;\n };\n \n if (e.clientX < rect.left) {\n mode = \"zoom\";\n return;\n }\n \n var diff1 = weightedDistance(\n e.clientX - rect.left - cursorPos.left + offsetLeft,\n e.clientY - rect.top - cursorPos.top + offsetTop\n );\n var diff2 = weightedDistance(\n e.clientX - rect.left - anchorPos.left + offsetLeft,\n e.clientY - rect.top - anchorPos.top + offsetTop\n );\n if (diff1 < 3.5 && diff2 < 3.5)\n mode = diff1 > diff2 ? \"cursor\" : \"anchor\";\n \n if (diff2 < 3.5)\n mode = \"anchor\";\n else if (diff1 < 3.5)\n mode = \"cursor\";\n else\n mode = \"scroll\";\n longTouchTimer = setTimeout(handleLongTap, 450);\n }\n touchStartT = t;\n }, editor);\n\n event.addListener(el, \"touchend\", function (e) {\n pressed = editor.$mouseHandler.isMousePressed = false;\n if (animationTimer) clearInterval(animationTimer);\n if (mode == \"zoom\") {\n mode = \"\";\n animationSteps = 0;\n } else if (longTouchTimer) {\n editor.selection.moveToPosition(pos);\n animationSteps = 0;\n showContextMenu();\n } else if (mode == \"scroll\") {\n animate();\n hideContextMenu();\n } else {\n showContextMenu();\n }\n clearTimeout(longTouchTimer);\n longTouchTimer = null;\n }, editor);\n event.addListener(el, \"touchmove\", function (e) {\n if (longTouchTimer) {\n clearTimeout(longTouchTimer);\n longTouchTimer = null;\n }\n var touches = e.touches;\n if (touches.length > 1 || mode == \"zoom\") return;\n\n var touchObj = touches[0];\n\n var wheelX = startX - touchObj.clientX;\n var wheelY = startY - touchObj.clientY;\n\n if (mode == \"wait\") {\n if (wheelX * wheelX + wheelY * wheelY > 4)\n mode = \"cursor\";\n else\n return e.preventDefault();\n }\n\n startX = touchObj.clientX;\n startY = touchObj.clientY;\n\n e.clientX = touchObj.clientX;\n e.clientY = touchObj.clientY;\n\n var t = e.timeStamp;\n var dt = t - lastT;\n lastT = t;\n if (mode == \"scroll\") {\n var mouseEvent = new MouseEvent(e, editor);\n mouseEvent.speed = 1;\n mouseEvent.wheelX = wheelX;\n mouseEvent.wheelY = wheelY;\n if (10 * Math.abs(wheelX) < Math.abs(wheelY)) wheelX = 0;\n if (10 * Math.abs(wheelY) < Math.abs(wheelX)) wheelY = 0;\n if (dt != 0) {\n vX = wheelX / dt;\n vY = wheelY / dt;\n }\n editor._emit(\"mousewheel\", mouseEvent);\n if (!mouseEvent.propagationStopped) {\n vX = vY = 0;\n }\n }\n else {\n var ev = new MouseEvent(e, editor);\n var pos = ev.getDocumentPosition();\n if (mode == \"cursor\")\n editor.selection.moveCursorToPosition(pos);\n else if (mode == \"anchor\")\n editor.selection.setSelectionAnchor(pos.row, pos.column);\n editor.renderer.scrollCursorIntoView(pos);\n e.preventDefault();\n }\n }, editor);\n\n function animate() {\n animationSteps += 60;\n animationTimer = setInterval(function() {\n if (animationSteps-- <= 0) {\n clearInterval(animationTimer);\n animationTimer = null;\n }\n if (Math.abs(vX) < 0.01) vX = 0;\n if (Math.abs(vY) < 0.01) vY = 0;\n if (animationSteps < 20) vX = 0.9 * vX;\n if (animationSteps < 20) vY = 0.9 * vY;\n var oldScrollTop = editor.session.getScrollTop();\n editor.renderer.scrollBy(10 * vX, 10 * vY);\n if (oldScrollTop == editor.session.getScrollTop())\n animationSteps = 0;\n }, 10);\n }\n};\n\n});\n\nace.define(\"ace/lib/net\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(require, exports, module) {\nvar dom = require(\"./dom\");\n\nexports.get = function (url, callback) {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, true);\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n callback(xhr.responseText);\n }\n };\n xhr.send(null);\n};\n\nexports.loadScript = function(path, callback) {\n var head = dom.getDocumentHead();\n var s = document.createElement('script');\n\n s.src = path;\n head.appendChild(s);\n\n s.onload = s.onreadystatechange = function(_, isAbort) {\n if (isAbort || !s.readyState || s.readyState == \"loaded\" || s.readyState == \"complete\") {\n s = s.onload = s.onreadystatechange = null;\n if (!isAbort)\n callback();\n }\n };\n};\nexports.qualifyURL = function(url) {\n var a = document.createElement('a');\n a.href = url;\n return a.href;\n};\n\n});\n\nace.define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"], function(require, exports, module) {\n\nvar EventEmitter = {};\nvar stopPropagation = function() { this.propagationStopped = true; };\nvar preventDefault = function() { this.defaultPrevented = true; };\n\nEventEmitter._emit =\nEventEmitter._dispatchEvent = function(eventName, e) {\n this._eventRegistry || (this._eventRegistry = {});\n this._defaultHandlers || (this._defaultHandlers = {});\n\n var listeners = this._eventRegistry[eventName] || [];\n var defaultHandler = this._defaultHandlers[eventName];\n if (!listeners.length && !defaultHandler)\n return;\n\n if (typeof e != \"object\" || !e)\n e = {};\n\n if (!e.type)\n e.type = eventName;\n if (!e.stopPropagation)\n e.stopPropagation = stopPropagation;\n if (!e.preventDefault)\n e.preventDefault = preventDefault;\n\n listeners = listeners.slice();\n for (var i=0; i 1)\n base = parts[parts.length - 2];\n var path = options[component + \"Path\"];\n if (path == null) {\n path = options.basePath;\n } else if (sep == \"/\") {\n component = sep = \"\";\n }\n if (path && path.slice(-1) != \"/\")\n path += \"/\";\n return path + component + sep + base + this.get(\"suffix\");\n};\n\nexports.setModuleUrl = function(name, subst) {\n return options.$moduleUrls[name] = subst;\n};\n\nexports.$loading = {};\nexports.loadModule = function(moduleName, onLoad) {\n var module, moduleType;\n if (Array.isArray(moduleName)) {\n moduleType = moduleName[0];\n moduleName = moduleName[1];\n }\n\n try {\n module = require(moduleName);\n } catch (e) {}\n if (module && !exports.$loading[moduleName])\n return onLoad && onLoad(module);\n\n if (!exports.$loading[moduleName])\n exports.$loading[moduleName] = [];\n\n exports.$loading[moduleName].push(onLoad);\n\n if (exports.$loading[moduleName].length > 1)\n return;\n\n var afterLoad = function() {\n require([moduleName], function(module) {\n exports._emit(\"load.module\", {name: moduleName, module: module});\n var listeners = exports.$loading[moduleName];\n exports.$loading[moduleName] = null;\n listeners.forEach(function(onLoad) {\n onLoad && onLoad(module);\n });\n });\n };\n\n if (!exports.get(\"packaged\"))\n return afterLoad();\n \n net.loadScript(exports.moduleUrl(moduleName, moduleType), afterLoad);\n reportErrorIfPathIsNotConfigured();\n};\n\nvar reportErrorIfPathIsNotConfigured = function() {\n if (\n !options.basePath && !options.workerPath \n && !options.modePath && !options.themePath\n && !Object.keys(options.$moduleUrls).length\n ) {\n console.error(\n \"Unable to infer path to ace from script src,\",\n \"use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes\",\n \"or with webpack use ace/webpack-resolver\"\n );\n reportErrorIfPathIsNotConfigured = function() {};\n }\n};\ninit(true);function init(packaged) {\n\n if (!global || !global.document)\n return;\n \n options.packaged = packaged || require.packaged || module.packaged || (global.define && define.packaged);\n\n var scriptOptions = {};\n var scriptUrl = \"\";\n var currentScript = (document.currentScript || document._currentScript ); // native or polyfill\n var currentDocument = currentScript && currentScript.ownerDocument || document;\n \n var scripts = currentDocument.getElementsByTagName(\"script\");\n for (var i=0; i 0){\n\t\t\tif (action == 0x10){\n\t\t\t\tfor(i = condPos; i < ix; i++){\n\t\t\t\t\tlevels[i] = 1;\n\t\t\t\t}\n\t\t\t\tcondPos = -1;\n\t\t\t} else {\n\t\t\t\tcondPos = -1;\n\t\t\t}\n\t\t}\n\t\tcond = impTab[newState][6];\n\t\tif (cond){\n\t\t\tif(condPos == -1){\n\t\t\t\tcondPos = ix;\n\t\t\t}\n\t\t}else {\n\t\t\tif (condPos > -1){\n\t\t\t\tfor(i = condPos; i < ix; i++){\n\t\t\t\t\tlevels[i] = newLevel;\n\t\t\t\t}\n\t\t\t\tcondPos = -1;\n\t\t\t}\n\t\t}\n\t\tif (charTypes[ix] == B){\n\t\t\tlevels[ix] = 0;\n\t\t}\n\t\thiLevel |= newLevel;\n\t}\n\tif (hasUBAT_S){\n\t\tfor(i = 0; i < len; i++){\n\t\t\tif(charTypes[i] == S){\n\t\t\t\tlevels[i] = dir;\n\t\t\t\tfor(var j = i - 1; j >= 0; j--){\n\t\t\t\t\tif(charTypes[j] == WS){\n\t\t\t\t\t\tlevels[j] = dir;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction _invertLevel(lev, levels, _array) {\n\tif (hiLevel < lev){\n\t\treturn;\n\t}\n\tif (lev == 1 && dir == RTL && !hasUBAT_B){\n\t\t_array.reverse();\n\t\treturn;\n\t}\n\tvar len = _array.length, start = 0, end, lo, hi, tmp;\n\twhile(start < len){\n\t\tif (levels[start] >= lev){\n\t\t\tend = start + 1;\n\t\twhile(end < len && levels[end] >= lev){\n\t\t\tend++;\n\t\t}\n\t\tfor(lo = start, hi = end - 1 ; lo < hi; lo++, hi--){\n\t\t\ttmp = _array[lo];\n\t\t\t_array[lo] = _array[hi];\n\t\t\t_array[hi] = tmp;\n\t\t}\n\t\tstart = end;\n\t}\n\tstart++;\n\t}\n}\n\nfunction _getCharClass(chars, types, classes, ix) {\t\t\t\n\tvar cType = types[ix], wType, nType, len, i;\n\tswitch(cType){\n\t\tcase L:\n\t\tcase R:\n\t\t\tlastArabic = false;\n\t\tcase ON:\n\t\tcase AN:\n\t\t\treturn cType;\n\t\tcase EN:\n\t\t\treturn lastArabic ? AN : EN;\n\t\tcase AL:\n\t\t\tlastArabic = true;\n\t\t\treturn R;\n\t\tcase WS:\n\t\t\treturn ON;\n\t\tcase CS:\n\t\t\tif (ix < 1 || (ix + 1) >= types.length ||\n\t\t\t\t((wType = classes[ix - 1]) != EN && wType != AN) ||\n\t\t\t\t((nType = types[ix + 1]) != EN && nType != AN)){\n\t\t\t\treturn ON;\n\t\t\t}\n\t\t\tif (lastArabic){nType = AN;}\n\t\t\treturn nType == wType ? nType : ON;\n\t\tcase ES:\n\t\t\twType = ix > 0 ? classes[ix - 1] : B;\n\t\t\tif (wType == EN && (ix + 1) < types.length && types[ix + 1] == EN){\n\t\t\t\treturn EN;\n\t\t\t}\n\t\t\treturn ON;\n\t\tcase ET:\n\t\t\tif (ix > 0 && classes[ix - 1] == EN){\n\t\t\t\treturn EN;\n\t\t\t}\n\t\t\tif (lastArabic){\n\t\t\t\treturn ON;\n\t\t\t}\n\t\t\ti = ix + 1;\n\t\t\tlen = types.length;\n\t\t\twhile (i < len && types[i] == ET){\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (i < len && types[i] == EN){\n\t\t\t\treturn EN;\n\t\t\t}\n\t\t\treturn ON;\n\t\tcase NSM:\n\t\t\tlen = types.length;\n\t\t\ti = ix + 1;\n\t\t\twhile (i < len && types[i] == NSM){\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (i < len){\n\t\t\t\tvar c = chars[ix], rtlCandidate = (c >= 0x0591 && c <= 0x08FF) || c == 0xFB1E;\n\t\t\t\t\n\t\t\t\twType = types[i];\n\t\t\t\tif (rtlCandidate && (wType == R || wType == AL)){\n\t\t\t\t\treturn R;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (ix < 1 || (wType = types[ix - 1]) == B){\n\t\t\t\treturn ON;\n\t\t\t}\n\t\t\treturn classes[ix - 1];\n\t\tcase B:\n\t\t\tlastArabic = false;\n\t\t\thasUBAT_B = true;\n\t\t\treturn dir;\n\t\tcase S:\n\t\t\thasUBAT_S = true;\n\t\t\treturn ON;\n\t\tcase LRE:\n\t\tcase RLE:\n\t\tcase LRO:\n\t\tcase RLO:\n\t\tcase PDF:\n\t\t\tlastArabic = false;\n\t\tcase BN:\n\t\t\treturn ON;\n\t}\n}\n\nfunction _getCharacterType( ch ) {\t\t\n\tvar uc = ch.charCodeAt(0), hi = uc >> 8;\n\t\n\tif (hi == 0) {\t\t\n\t\treturn ((uc > 0x00BF) ? L : UnicodeTBL00[uc]);\n\t} else if (hi == 5) {\n\t\treturn (/[\\u0591-\\u05f4]/.test(ch) ? R : L);\n\t} else if (hi == 6) {\n\t\tif (/[\\u0610-\\u061a\\u064b-\\u065f\\u06d6-\\u06e4\\u06e7-\\u06ed]/.test(ch))\n\t\t\treturn NSM;\n\t\telse if (/[\\u0660-\\u0669\\u066b-\\u066c]/.test(ch))\n\t\t\treturn AN;\n\t\telse if (uc == 0x066A)\n\t\t\treturn ET;\n\t\telse if (/[\\u06f0-\\u06f9]/.test(ch))\n\t\t\treturn EN;\t\t\t\n\t\telse\n\t\t\treturn AL;\n\t} else if (hi == 0x20 && uc <= 0x205F) {\n\t\treturn UnicodeTBL20[uc & 0xFF];\n\t} else if (hi == 0xFE) {\n\t\treturn (uc >= 0xFE70 ? AL : ON);\n\t}\t\t\n\treturn ON;\t\n}\nexports.L = L;\nexports.R = R;\nexports.EN = EN;\nexports.ON_R = 3;\nexports.AN = 4;\nexports.R_H = 5;\nexports.B = 6;\nexports.RLE = 7;\n\nexports.DOT = \"\\xB7\";\nexports.doBidiReorder = function(text, textCharTypes, isRtl) {\n\tif (text.length < 2)\n\t\treturn {};\n\t\t\n\tvar chars = text.split(\"\"), logicalFromVisual = new Array(chars.length),\n\t\tbidiLevels = new Array(chars.length), levels = []; \n\n\tdir = isRtl ? RTL : LTR;\n\n\t_computeLevels(chars, levels, chars.length, textCharTypes);\n\n\tfor (var i = 0; i < logicalFromVisual.length; logicalFromVisual[i] = i, i++);\n\n\t_invertLevel(2, levels, logicalFromVisual);\n\t_invertLevel(1, levels, logicalFromVisual);\n\n\tfor (var i = 0; i < logicalFromVisual.length - 1; i++) { //fix levels to reflect character width\n\t\tif (textCharTypes[i] === AN) {\n\t\t\tlevels[i] = exports.AN;\n\t\t} else if (levels[i] === R && ((textCharTypes[i] > AL && textCharTypes[i] < LRE) \n\t\t\t|| textCharTypes[i] === ON || textCharTypes[i] === BN)) {\n\t\t\tlevels[i] = exports.ON_R;\n\t\t} else if ((i > 0 && chars[i - 1] === '\\u0644') && /\\u0622|\\u0623|\\u0625|\\u0627/.test(chars[i])) {\n\t\t\tlevels[i - 1] = levels[i] = exports.R_H;\n\t\t\ti++;\n\t\t}\n\t}\n\tif (chars[chars.length - 1] === exports.DOT)\n\t\tlevels[chars.length - 1] = exports.B;\n\t\t\t\t\n\tif (chars[0] === '\\u202B')\n\t\tlevels[0] = exports.RLE;\n\t\t\t\t\n\tfor (var i = 0; i < logicalFromVisual.length; i++) {\n\t\tbidiLevels[i] = levels[logicalFromVisual[i]];\n\t}\n\n\treturn {'logicalFromVisual': logicalFromVisual, 'bidiLevels': bidiLevels};\n};\nexports.hasBidiCharacters = function(text, textCharTypes){\n\tvar ret = false;\n\tfor (var i = 0; i < text.length; i++){\n\t\ttextCharTypes[i] = _getCharacterType(text.charAt(i));\n\t\tif (!ret && (textCharTypes[i] == R || textCharTypes[i] == AL || textCharTypes[i] == AN))\n\t\t\tret = true;\n\t}\n\treturn ret;\n};\t\nexports.getVisualFromLogicalIdx = function(logIdx, rowMap) {\n\tfor (var i = 0; i < rowMap.logicalFromVisual.length; i++) {\n\t\tif (rowMap.logicalFromVisual[i] == logIdx)\n\t\t\treturn i;\n\t}\n\treturn 0;\n};\n\n});\n\nace.define(\"ace/bidihandler\",[\"require\",\"exports\",\"module\",\"ace/lib/bidiutil\",\"ace/lib/lang\"], function(require, exports, module) {\n\nvar bidiUtil = require(\"./lib/bidiutil\");\nvar lang = require(\"./lib/lang\");\nvar bidiRE = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac\\u202B]/;\nvar BidiHandler = function(session) {\n this.session = session;\n this.bidiMap = {};\n this.currentRow = null;\n this.bidiUtil = bidiUtil;\n this.charWidths = [];\n this.EOL = \"\\xAC\";\n this.showInvisibles = true;\n this.isRtlDir = false;\n this.$isRtl = false;\n this.line = \"\";\n this.wrapIndent = 0;\n this.EOF = \"\\xB6\";\n this.RLE = \"\\u202B\";\n this.contentWidth = 0;\n this.fontMetrics = null;\n this.rtlLineOffset = 0;\n this.wrapOffset = 0;\n this.isMoveLeftOperation = false;\n this.seenBidi = bidiRE.test(session.getValue());\n};\n\n(function() {\n this.isBidiRow = function(screenRow, docRow, splitIndex) {\n if (!this.seenBidi)\n return false;\n if (screenRow !== this.currentRow) {\n this.currentRow = screenRow;\n this.updateRowLine(docRow, splitIndex);\n this.updateBidiMap();\n }\n return this.bidiMap.bidiLevels;\n };\n\n this.onChange = function(delta) {\n if (!this.seenBidi) {\n if (delta.action == \"insert\" && bidiRE.test(delta.lines.join(\"\\n\"))) {\n this.seenBidi = true;\n this.currentRow = null;\n }\n } \n else {\n this.currentRow = null;\n }\n };\n\n this.getDocumentRow = function() {\n var docRow = 0;\n var rowCache = this.session.$screenRowCache;\n if (rowCache.length) {\n var index = this.session.$getRowCacheIndex(rowCache, this.currentRow);\n if (index >= 0)\n docRow = this.session.$docRowCache[index];\n }\n\n return docRow;\n };\n\n this.getSplitIndex = function() {\n var splitIndex = 0;\n var rowCache = this.session.$screenRowCache;\n if (rowCache.length) {\n var currentIndex, prevIndex = this.session.$getRowCacheIndex(rowCache, this.currentRow);\n while (this.currentRow - splitIndex > 0) {\n currentIndex = this.session.$getRowCacheIndex(rowCache, this.currentRow - splitIndex - 1);\n if (currentIndex !== prevIndex)\n break;\n\n prevIndex = currentIndex;\n splitIndex++;\n }\n } else {\n splitIndex = this.currentRow;\n }\n\n return splitIndex;\n };\n\n this.updateRowLine = function(docRow, splitIndex) {\n if (docRow === undefined)\n docRow = this.getDocumentRow();\n \n var isLastRow = (docRow === this.session.getLength() - 1),\n endOfLine = isLastRow ? this.EOF : this.EOL;\n\n this.wrapIndent = 0;\n this.line = this.session.getLine(docRow);\n this.isRtlDir = this.$isRtl || this.line.charAt(0) === this.RLE;\n if (this.session.$useWrapMode) {\n var splits = this.session.$wrapData[docRow];\n if (splits) {\n if (splitIndex === undefined)\n splitIndex = this.getSplitIndex();\n\n if(splitIndex > 0 && splits.length) {\n this.wrapIndent = splits.indent;\n this.wrapOffset = this.wrapIndent * this.charWidths[bidiUtil.L];\n this.line = (splitIndex < splits.length) ?\n this.line.substring(splits[splitIndex - 1], splits[splitIndex]) :\n this.line.substring(splits[splits.length - 1]);\n } else {\n this.line = this.line.substring(0, splits[splitIndex]);\n }\n }\n if (splitIndex == splits.length)\n this.line += (this.showInvisibles) ? endOfLine : bidiUtil.DOT;\n } else {\n this.line += this.showInvisibles ? endOfLine : bidiUtil.DOT;\n }\n var session = this.session, shift = 0, size;\n this.line = this.line.replace(/\\t|[\\u1100-\\u2029, \\u202F-\\uFFE6]/g, function(ch, i){\n if (ch === '\\t' || session.isFullWidth(ch.charCodeAt(0))) {\n size = (ch === '\\t') ? session.getScreenTabSize(i + shift) : 2;\n shift += size - 1;\n return lang.stringRepeat(bidiUtil.DOT, size);\n }\n return ch;\n });\n\n if (this.isRtlDir) {\n this.fontMetrics.$main.textContent = (this.line.charAt(this.line.length - 1) == bidiUtil.DOT) ? this.line.substr(0, this.line.length - 1) : this.line;\n this.rtlLineOffset = this.contentWidth - this.fontMetrics.$main.getBoundingClientRect().width;\n }\n };\n \n this.updateBidiMap = function() {\n var textCharTypes = [];\n if (bidiUtil.hasBidiCharacters(this.line, textCharTypes) || this.isRtlDir) {\n this.bidiMap = bidiUtil.doBidiReorder(this.line, textCharTypes, this.isRtlDir);\n } else {\n this.bidiMap = {};\n }\n };\n this.markAsDirty = function() {\n this.currentRow = null;\n };\n this.updateCharacterWidths = function(fontMetrics) {\n if (this.characterWidth === fontMetrics.$characterSize.width)\n return;\n\n this.fontMetrics = fontMetrics;\n var characterWidth = this.characterWidth = fontMetrics.$characterSize.width;\n var bidiCharWidth = fontMetrics.$measureCharWidth(\"\\u05d4\");\n\n this.charWidths[bidiUtil.L] = this.charWidths[bidiUtil.EN] = this.charWidths[bidiUtil.ON_R] = characterWidth;\n this.charWidths[bidiUtil.R] = this.charWidths[bidiUtil.AN] = bidiCharWidth;\n this.charWidths[bidiUtil.R_H] = bidiCharWidth * 0.45;\n this.charWidths[bidiUtil.B] = this.charWidths[bidiUtil.RLE] = 0;\n\n this.currentRow = null;\n };\n\n this.setShowInvisibles = function(showInvisibles) {\n this.showInvisibles = showInvisibles;\n this.currentRow = null;\n };\n\n this.setEolChar = function(eolChar) {\n this.EOL = eolChar; \n };\n\n this.setContentWidth = function(width) {\n this.contentWidth = width;\n };\n\n this.isRtlLine = function(row) {\n if (this.$isRtl) return true;\n if (row != undefined)\n return (this.session.getLine(row).charAt(0) == this.RLE);\n else\n return this.isRtlDir; \n };\n\n this.setRtlDirection = function(editor, isRtlDir) {\n var cursor = editor.getCursorPosition(); \n for (var row = editor.selection.getSelectionAnchor().row; row <= cursor.row; row++) {\n if (!isRtlDir && editor.session.getLine(row).charAt(0) === editor.session.$bidiHandler.RLE)\n editor.session.doc.removeInLine(row, 0, 1);\n else if (isRtlDir && editor.session.getLine(row).charAt(0) !== editor.session.$bidiHandler.RLE)\n editor.session.doc.insert({column: 0, row: row}, editor.session.$bidiHandler.RLE);\n }\n };\n this.getPosLeft = function(col) {\n col -= this.wrapIndent;\n var leftBoundary = (this.line.charAt(0) === this.RLE) ? 1 : 0;\n var logicalIdx = (col > leftBoundary) ? (this.session.getOverwrite() ? col : col - 1) : leftBoundary;\n var visualIdx = bidiUtil.getVisualFromLogicalIdx(logicalIdx, this.bidiMap),\n levels = this.bidiMap.bidiLevels, left = 0;\n\n if (!this.session.getOverwrite() && col <= leftBoundary && levels[visualIdx] % 2 !== 0)\n visualIdx++;\n \n for (var i = 0; i < visualIdx; i++) {\n left += this.charWidths[levels[i]];\n }\n\n if (!this.session.getOverwrite() && (col > leftBoundary) && (levels[visualIdx] % 2 === 0))\n left += this.charWidths[levels[visualIdx]];\n\n if (this.wrapIndent)\n left += this.isRtlDir ? (-1 * this.wrapOffset) : this.wrapOffset;\n\n if (this.isRtlDir)\n left += this.rtlLineOffset;\n\n return left;\n };\n this.getSelections = function(startCol, endCol) {\n var map = this.bidiMap, levels = map.bidiLevels, level, selections = [], offset = 0,\n selColMin = Math.min(startCol, endCol) - this.wrapIndent, selColMax = Math.max(startCol, endCol) - this.wrapIndent,\n isSelected = false, isSelectedPrev = false, selectionStart = 0;\n \n if (this.wrapIndent)\n offset += this.isRtlDir ? (-1 * this.wrapOffset) : this.wrapOffset;\n\n for (var logIdx, visIdx = 0; visIdx < levels.length; visIdx++) {\n logIdx = map.logicalFromVisual[visIdx];\n level = levels[visIdx];\n isSelected = (logIdx >= selColMin) && (logIdx < selColMax);\n if (isSelected && !isSelectedPrev) {\n selectionStart = offset;\n } else if (!isSelected && isSelectedPrev) {\n selections.push({left: selectionStart, width: offset - selectionStart});\n }\n offset += this.charWidths[level];\n isSelectedPrev = isSelected;\n }\n\n if (isSelected && (visIdx === levels.length)) {\n selections.push({left: selectionStart, width: offset - selectionStart});\n }\n\n if(this.isRtlDir) {\n for (var i = 0; i < selections.length; i++) {\n selections[i].left += this.rtlLineOffset;\n }\n }\n return selections;\n };\n this.offsetToCol = function(posX) {\n if(this.isRtlDir)\n posX -= this.rtlLineOffset;\n\n var logicalIdx = 0, posX = Math.max(posX, 0),\n offset = 0, visualIdx = 0, levels = this.bidiMap.bidiLevels,\n charWidth = this.charWidths[levels[visualIdx]];\n\n if (this.wrapIndent)\n posX -= this.isRtlDir ? (-1 * this.wrapOffset) : this.wrapOffset;\n \n while(posX > offset + charWidth/2) {\n offset += charWidth;\n if(visualIdx === levels.length - 1) {\n charWidth = 0;\n break;\n }\n charWidth = this.charWidths[levels[++visualIdx]];\n }\n \n if (visualIdx > 0 && (levels[visualIdx - 1] % 2 !== 0) && (levels[visualIdx] % 2 === 0)){\n if(posX < offset)\n visualIdx--;\n logicalIdx = this.bidiMap.logicalFromVisual[visualIdx];\n\n } else if (visualIdx > 0 && (levels[visualIdx - 1] % 2 === 0) && (levels[visualIdx] % 2 !== 0)){\n logicalIdx = 1 + ((posX > offset) ? this.bidiMap.logicalFromVisual[visualIdx]\n : this.bidiMap.logicalFromVisual[visualIdx - 1]);\n\n } else if ((this.isRtlDir && visualIdx === levels.length - 1 && charWidth === 0 && (levels[visualIdx - 1] % 2 === 0))\n || (!this.isRtlDir && visualIdx === 0 && (levels[visualIdx] % 2 !== 0))){\n logicalIdx = 1 + this.bidiMap.logicalFromVisual[visualIdx];\n } else {\n if (visualIdx > 0 && (levels[visualIdx - 1] % 2 !== 0) && charWidth !== 0)\n visualIdx--;\n logicalIdx = this.bidiMap.logicalFromVisual[visualIdx];\n }\n\n if (logicalIdx === 0 && this.isRtlDir)\n logicalIdx++;\n\n return (logicalIdx + this.wrapIndent);\n };\n\n}).call(BidiHandler.prototype);\n\nexports.BidiHandler = BidiHandler;\n});\n\nace.define(\"ace/selection\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/lib/event_emitter\",\"ace/range\"], function(require, exports, module) {\n\nvar oop = require(\"./lib/oop\");\nvar lang = require(\"./lib/lang\");\nvar EventEmitter = require(\"./lib/event_emitter\").EventEmitter;\nvar Range = require(\"./range\").Range;\nvar Selection = function(session) {\n this.session = session;\n this.doc = session.getDocument();\n\n this.clearSelection();\n this.cursor = this.lead = this.doc.createAnchor(0, 0);\n this.anchor = this.doc.createAnchor(0, 0);\n this.$silent = false;\n\n var self = this;\n this.cursor.on(\"change\", function(e) {\n self.$cursorChanged = true;\n if (!self.$silent)\n self._emit(\"changeCursor\");\n if (!self.$isEmpty && !self.$silent)\n self._emit(\"changeSelection\");\n if (!self.$keepDesiredColumnOnChange && e.old.column != e.value.column)\n self.$desiredColumn = null;\n });\n\n this.anchor.on(\"change\", function() {\n self.$anchorChanged = true;\n if (!self.$isEmpty && !self.$silent)\n self._emit(\"changeSelection\");\n });\n};\n\n(function() {\n\n oop.implement(this, EventEmitter);\n this.isEmpty = function() {\n return this.$isEmpty || (\n this.anchor.row == this.lead.row &&\n this.anchor.column == this.lead.column\n );\n };\n this.isMultiLine = function() {\n return !this.$isEmpty && this.anchor.row != this.cursor.row;\n };\n this.getCursor = function() {\n return this.lead.getPosition();\n };\n this.setSelectionAnchor = function(row, column) {\n this.$isEmpty = false;\n this.anchor.setPosition(row, column);\n };\n this.getAnchor = \n this.getSelectionAnchor = function() {\n if (this.$isEmpty)\n return this.getSelectionLead();\n \n return this.anchor.getPosition();\n };\n this.getSelectionLead = function() {\n return this.lead.getPosition();\n };\n this.isBackwards = function() {\n var anchor = this.anchor;\n var lead = this.lead;\n return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column));\n };\n this.getRange = function() {\n var anchor = this.anchor;\n var lead = this.lead;\n\n if (this.$isEmpty)\n return Range.fromPoints(lead, lead);\n\n return this.isBackwards()\n ? Range.fromPoints(lead, anchor)\n : Range.fromPoints(anchor, lead);\n };\n this.clearSelection = function() {\n if (!this.$isEmpty) {\n this.$isEmpty = true;\n this._emit(\"changeSelection\");\n }\n };\n this.selectAll = function() {\n this.$setSelection(0, 0, Number.MAX_VALUE, Number.MAX_VALUE);\n };\n this.setRange =\n this.setSelectionRange = function(range, reverse) {\n var start = reverse ? range.end : range.start;\n var end = reverse ? range.start : range.end;\n this.$setSelection(start.row, start.column, end.row, end.column);\n };\n\n this.$setSelection = function(anchorRow, anchorColumn, cursorRow, cursorColumn) {\n if (this.$silent)\n return;\n var wasEmpty = this.$isEmpty;\n var wasMultiselect = this.inMultiSelectMode;\n this.$silent = true;\n this.$cursorChanged = this.$anchorChanged = false;\n this.anchor.setPosition(anchorRow, anchorColumn);\n this.cursor.setPosition(cursorRow, cursorColumn);\n this.$isEmpty = !Range.comparePoints(this.anchor, this.cursor);\n this.$silent = false;\n if (this.$cursorChanged)\n this._emit(\"changeCursor\");\n if (this.$cursorChanged || this.$anchorChanged || wasEmpty != this.$isEmpty || wasMultiselect)\n this._emit(\"changeSelection\");\n };\n\n this.$moveSelection = function(mover) {\n var lead = this.lead;\n if (this.$isEmpty)\n this.setSelectionAnchor(lead.row, lead.column);\n\n mover.call(this);\n };\n this.selectTo = function(row, column) {\n this.$moveSelection(function() {\n this.moveCursorTo(row, column);\n });\n };\n this.selectToPosition = function(pos) {\n this.$moveSelection(function() {\n this.moveCursorToPosition(pos);\n });\n };\n this.moveTo = function(row, column) {\n this.clearSelection();\n this.moveCursorTo(row, column);\n };\n this.moveToPosition = function(pos) {\n this.clearSelection();\n this.moveCursorToPosition(pos);\n };\n this.selectUp = function() {\n this.$moveSelection(this.moveCursorUp);\n };\n this.selectDown = function() {\n this.$moveSelection(this.moveCursorDown);\n };\n this.selectRight = function() {\n this.$moveSelection(this.moveCursorRight);\n };\n this.selectLeft = function() {\n this.$moveSelection(this.moveCursorLeft);\n };\n this.selectLineStart = function() {\n this.$moveSelection(this.moveCursorLineStart);\n };\n this.selectLineEnd = function() {\n this.$moveSelection(this.moveCursorLineEnd);\n };\n this.selectFileEnd = function() {\n this.$moveSelection(this.moveCursorFileEnd);\n };\n this.selectFileStart = function() {\n this.$moveSelection(this.moveCursorFileStart);\n };\n this.selectWordRight = function() {\n this.$moveSelection(this.moveCursorWordRight);\n };\n this.selectWordLeft = function() {\n this.$moveSelection(this.moveCursorWordLeft);\n };\n this.getWordRange = function(row, column) {\n if (typeof column == \"undefined\") {\n var cursor = row || this.lead;\n row = cursor.row;\n column = cursor.column;\n }\n return this.session.getWordRange(row, column);\n };\n this.selectWord = function() {\n this.setSelectionRange(this.getWordRange());\n };\n this.selectAWord = function() {\n var cursor = this.getCursor();\n var range = this.session.getAWordRange(cursor.row, cursor.column);\n this.setSelectionRange(range);\n };\n\n this.getLineRange = function(row, excludeLastChar) {\n var rowStart = typeof row == \"number\" ? row : this.lead.row;\n var rowEnd;\n\n var foldLine = this.session.getFoldLine(rowStart);\n if (foldLine) {\n rowStart = foldLine.start.row;\n rowEnd = foldLine.end.row;\n } else {\n rowEnd = rowStart;\n }\n if (excludeLastChar === true)\n return new Range(rowStart, 0, rowEnd, this.session.getLine(rowEnd).length);\n else\n return new Range(rowStart, 0, rowEnd + 1, 0);\n };\n this.selectLine = function() {\n this.setSelectionRange(this.getLineRange());\n };\n this.moveCursorUp = function() {\n this.moveCursorBy(-1, 0);\n };\n this.moveCursorDown = function() {\n this.moveCursorBy(1, 0);\n };\n this.wouldMoveIntoSoftTab = function(cursor, tabSize, direction) {\n var start = cursor.column;\n var end = cursor.column + tabSize;\n\n if (direction < 0) {\n start = cursor.column - tabSize;\n end = cursor.column;\n }\n return this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(start, end).split(\" \").length-1 == tabSize;\n };\n this.moveCursorLeft = function() {\n var cursor = this.lead.getPosition(),\n fold;\n\n if (fold = this.session.getFoldAt(cursor.row, cursor.column, -1)) {\n this.moveCursorTo(fold.start.row, fold.start.column);\n } else if (cursor.column === 0) {\n if (cursor.row > 0) {\n this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length);\n }\n }\n else {\n var tabSize = this.session.getTabSize();\n if (this.wouldMoveIntoSoftTab(cursor, tabSize, -1) && !this.session.getNavigateWithinSoftTabs()) {\n this.moveCursorBy(0, -tabSize);\n } else {\n this.moveCursorBy(0, -1);\n }\n }\n };\n this.moveCursorRight = function() {\n var cursor = this.lead.getPosition(),\n fold;\n if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) {\n this.moveCursorTo(fold.end.row, fold.end.column);\n }\n else if (this.lead.column == this.doc.getLine(this.lead.row).length) {\n if (this.lead.row < this.doc.getLength() - 1) {\n this.moveCursorTo(this.lead.row + 1, 0);\n }\n }\n else {\n var tabSize = this.session.getTabSize();\n var cursor = this.lead;\n if (this.wouldMoveIntoSoftTab(cursor, tabSize, 1) && !this.session.getNavigateWithinSoftTabs()) {\n this.moveCursorBy(0, tabSize);\n } else {\n this.moveCursorBy(0, 1);\n }\n }\n };\n this.moveCursorLineStart = function() {\n var row = this.lead.row;\n var column = this.lead.column;\n var screenRow = this.session.documentToScreenRow(row, column);\n var firstColumnPosition = this.session.screenToDocumentPosition(screenRow, 0);\n var beforeCursor = this.session.getDisplayLine(\n row, null, firstColumnPosition.row,\n firstColumnPosition.column\n );\n\n var leadingSpace = beforeCursor.match(/^\\s*/);\n if (leadingSpace[0].length != column && !this.session.$useEmacsStyleLineStart)\n firstColumnPosition.column += leadingSpace[0].length;\n this.moveCursorToPosition(firstColumnPosition);\n };\n this.moveCursorLineEnd = function() {\n var lead = this.lead;\n var lineEnd = this.session.getDocumentLastRowColumnPosition(lead.row, lead.column);\n if (this.lead.column == lineEnd.column) {\n var line = this.session.getLine(lineEnd.row);\n if (lineEnd.column == line.length) {\n var textEnd = line.search(/\\s+$/);\n if (textEnd > 0)\n lineEnd.column = textEnd;\n }\n }\n\n this.moveCursorTo(lineEnd.row, lineEnd.column);\n };\n this.moveCursorFileEnd = function() {\n var row = this.doc.getLength() - 1;\n var column = this.doc.getLine(row).length;\n this.moveCursorTo(row, column);\n };\n this.moveCursorFileStart = function() {\n this.moveCursorTo(0, 0);\n };\n this.moveCursorLongWordRight = function() {\n var row = this.lead.row;\n var column = this.lead.column;\n var line = this.doc.getLine(row);\n var rightOfCursor = line.substring(column);\n\n this.session.nonTokenRe.lastIndex = 0;\n this.session.tokenRe.lastIndex = 0;\n var fold = this.session.getFoldAt(row, column, 1);\n if (fold) {\n this.moveCursorTo(fold.end.row, fold.end.column);\n return;\n }\n if (this.session.nonTokenRe.exec(rightOfCursor)) {\n column += this.session.nonTokenRe.lastIndex;\n this.session.nonTokenRe.lastIndex = 0;\n rightOfCursor = line.substring(column);\n }\n if (column >= line.length) {\n this.moveCursorTo(row, line.length);\n this.moveCursorRight();\n if (row < this.doc.getLength() - 1)\n this.moveCursorWordRight();\n return;\n }\n if (this.session.tokenRe.exec(rightOfCursor)) {\n column += this.session.tokenRe.lastIndex;\n this.session.tokenRe.lastIndex = 0;\n }\n\n this.moveCursorTo(row, column);\n };\n this.moveCursorLongWordLeft = function() {\n var row = this.lead.row;\n var column = this.lead.column;\n var fold;\n if (fold = this.session.getFoldAt(row, column, -1)) {\n this.moveCursorTo(fold.start.row, fold.start.column);\n return;\n }\n\n var str = this.session.getFoldStringAt(row, column, -1);\n if (str == null) {\n str = this.doc.getLine(row).substring(0, column);\n }\n\n var leftOfCursor = lang.stringReverse(str);\n this.session.nonTokenRe.lastIndex = 0;\n this.session.tokenRe.lastIndex = 0;\n if (this.session.nonTokenRe.exec(leftOfCursor)) {\n column -= this.session.nonTokenRe.lastIndex;\n leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex);\n this.session.nonTokenRe.lastIndex = 0;\n }\n if (column <= 0) {\n this.moveCursorTo(row, 0);\n this.moveCursorLeft();\n if (row > 0)\n this.moveCursorWordLeft();\n return;\n }\n if (this.session.tokenRe.exec(leftOfCursor)) {\n column -= this.session.tokenRe.lastIndex;\n this.session.tokenRe.lastIndex = 0;\n }\n\n this.moveCursorTo(row, column);\n };\n\n this.$shortWordEndIndex = function(rightOfCursor) {\n var index = 0, ch;\n var whitespaceRe = /\\s/;\n var tokenRe = this.session.tokenRe;\n\n tokenRe.lastIndex = 0;\n if (this.session.tokenRe.exec(rightOfCursor)) {\n index = this.session.tokenRe.lastIndex;\n } else {\n while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch))\n index ++;\n\n if (index < 1) {\n tokenRe.lastIndex = 0;\n while ((ch = rightOfCursor[index]) && !tokenRe.test(ch)) {\n tokenRe.lastIndex = 0;\n index ++;\n if (whitespaceRe.test(ch)) {\n if (index > 2) {\n index--;\n break;\n } else {\n while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch))\n index ++;\n if (index > 2)\n break;\n }\n }\n }\n }\n }\n tokenRe.lastIndex = 0;\n\n return index;\n };\n\n this.moveCursorShortWordRight = function() {\n var row = this.lead.row;\n var column = this.lead.column;\n var line = this.doc.getLine(row);\n var rightOfCursor = line.substring(column);\n\n var fold = this.session.getFoldAt(row, column, 1);\n if (fold)\n return this.moveCursorTo(fold.end.row, fold.end.column);\n\n if (column == line.length) {\n var l = this.doc.getLength();\n do {\n row++;\n rightOfCursor = this.doc.getLine(row);\n } while (row < l && /^\\s*$/.test(rightOfCursor));\n\n if (!/^\\s+/.test(rightOfCursor))\n rightOfCursor = \"\";\n column = 0;\n }\n\n var index = this.$shortWordEndIndex(rightOfCursor);\n\n this.moveCursorTo(row, column + index);\n };\n\n this.moveCursorShortWordLeft = function() {\n var row = this.lead.row;\n var column = this.lead.column;\n\n var fold;\n if (fold = this.session.getFoldAt(row, column, -1))\n return this.moveCursorTo(fold.start.row, fold.start.column);\n\n var line = this.session.getLine(row).substring(0, column);\n if (column === 0) {\n do {\n row--;\n line = this.doc.getLine(row);\n } while (row > 0 && /^\\s*$/.test(line));\n\n column = line.length;\n if (!/\\s+$/.test(line))\n line = \"\";\n }\n\n var leftOfCursor = lang.stringReverse(line);\n var index = this.$shortWordEndIndex(leftOfCursor);\n\n return this.moveCursorTo(row, column - index);\n };\n\n this.moveCursorWordRight = function() {\n if (this.session.$selectLongWords)\n this.moveCursorLongWordRight();\n else\n this.moveCursorShortWordRight();\n };\n\n this.moveCursorWordLeft = function() {\n if (this.session.$selectLongWords)\n this.moveCursorLongWordLeft();\n else\n this.moveCursorShortWordLeft();\n };\n this.moveCursorBy = function(rows, chars) {\n var screenPos = this.session.documentToScreenPosition(\n this.lead.row,\n this.lead.column\n );\n\n var offsetX;\n\n if (chars === 0) {\n if (rows !== 0) {\n if (this.session.$bidiHandler.isBidiRow(screenPos.row, this.lead.row)) {\n offsetX = this.session.$bidiHandler.getPosLeft(screenPos.column);\n screenPos.column = Math.round(offsetX / this.session.$bidiHandler.charWidths[0]);\n } else {\n offsetX = screenPos.column * this.session.$bidiHandler.charWidths[0];\n }\n }\n\n if (this.$desiredColumn)\n screenPos.column = this.$desiredColumn;\n else\n this.$desiredColumn = screenPos.column;\n }\n \n if (rows != 0 && this.session.lineWidgets && this.session.lineWidgets[this.lead.row]) {\n var widget = this.session.lineWidgets[this.lead.row];\n if (rows < 0)\n rows -= widget.rowsAbove || 0;\n else if (rows > 0)\n rows += widget.rowCount - (widget.rowsAbove || 0);\n }\n \n var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column, offsetX);\n \n if (rows !== 0 && chars === 0 && docPos.row === this.lead.row && docPos.column === this.lead.column) ;\n this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);\n };\n this.moveCursorToPosition = function(position) {\n this.moveCursorTo(position.row, position.column);\n };\n this.moveCursorTo = function(row, column, keepDesiredColumn) {\n var fold = this.session.getFoldAt(row, column, 1);\n if (fold) {\n row = fold.start.row;\n column = fold.start.column;\n }\n\n this.$keepDesiredColumnOnChange = true;\n var line = this.session.getLine(row);\n if (/[\\uDC00-\\uDFFF]/.test(line.charAt(column)) && line.charAt(column - 1)) {\n if (this.lead.row == row && this.lead.column == column + 1)\n column = column - 1;\n else\n column = column + 1;\n }\n this.lead.setPosition(row, column);\n this.$keepDesiredColumnOnChange = false;\n\n if (!keepDesiredColumn)\n this.$desiredColumn = null;\n };\n this.moveCursorToScreen = function(row, column, keepDesiredColumn) {\n var pos = this.session.screenToDocumentPosition(row, column);\n this.moveCursorTo(pos.row, pos.column, keepDesiredColumn);\n };\n this.detach = function() {\n this.lead.detach();\n this.anchor.detach();\n this.session = this.doc = null;\n };\n\n this.fromOrientedRange = function(range) {\n this.setSelectionRange(range, range.cursor == range.start);\n this.$desiredColumn = range.desiredColumn || this.$desiredColumn;\n };\n\n this.toOrientedRange = function(range) {\n var r = this.getRange();\n if (range) {\n range.start.column = r.start.column;\n range.start.row = r.start.row;\n range.end.column = r.end.column;\n range.end.row = r.end.row;\n } else {\n range = r;\n }\n\n range.cursor = this.isBackwards() ? range.start : range.end;\n range.desiredColumn = this.$desiredColumn;\n return range;\n };\n this.getRangeOfMovements = function(func) {\n var start = this.getCursor();\n try {\n func(this);\n var end = this.getCursor();\n return Range.fromPoints(start, end);\n } catch(e) {\n return Range.fromPoints(start, start);\n } finally {\n this.moveCursorToPosition(start);\n }\n };\n\n this.toJSON = function() {\n if (this.rangeCount) {\n var data = this.ranges.map(function(r) {\n var r1 = r.clone();\n r1.isBackwards = r.cursor == r.start;\n return r1;\n });\n } else {\n var data = this.getRange();\n data.isBackwards = this.isBackwards();\n }\n return data;\n };\n\n this.fromJSON = function(data) {\n if (data.start == undefined) {\n if (this.rangeList && data.length > 1) {\n this.toSingleRange(data[0]);\n for (var i = data.length; i--; ) {\n var r = Range.fromPoints(data[i].start, data[i].end);\n if (data[i].isBackwards)\n r.cursor = r.start;\n this.addRange(r, true);\n }\n return;\n } else {\n data = data[0];\n }\n }\n if (this.rangeList)\n this.toSingleRange(data);\n this.setSelectionRange(data, data.isBackwards);\n };\n\n this.isEqual = function(data) {\n if ((data.length || this.rangeCount) && data.length != this.rangeCount)\n return false;\n if (!data.length || !this.ranges)\n return this.getRange().isEqual(data);\n\n for (var i = this.ranges.length; i--; ) {\n if (!this.ranges[i].isEqual(data[i]))\n return false;\n }\n return true;\n };\n\n}).call(Selection.prototype);\n\nexports.Selection = Selection;\n});\n\nace.define(\"ace/tokenizer\",[\"require\",\"exports\",\"module\",\"ace/config\"], function(require, exports, module) {\n\nvar config = require(\"./config\");\nvar MAX_TOKEN_COUNT = 2000;\nvar Tokenizer = function(rules) {\n this.states = rules;\n\n this.regExps = {};\n this.matchMappings = {};\n for (var key in this.states) {\n var state = this.states[key];\n var ruleRegExps = [];\n var matchTotal = 0;\n var mapping = this.matchMappings[key] = {defaultToken: \"text\"};\n var flag = \"g\";\n\n var splitterRurles = [];\n for (var i = 0; i < state.length; i++) {\n var rule = state[i];\n if (rule.defaultToken)\n mapping.defaultToken = rule.defaultToken;\n if (rule.caseInsensitive)\n flag = \"gi\";\n if (rule.regex == null)\n continue;\n\n if (rule.regex instanceof RegExp)\n rule.regex = rule.regex.toString().slice(1, -1);\n var adjustedregex = rule.regex;\n var matchcount = new RegExp(\"(?:(\" + adjustedregex + \")|(.))\").exec(\"a\").length - 2;\n if (Array.isArray(rule.token)) {\n if (rule.token.length == 1 || matchcount == 1) {\n rule.token = rule.token[0];\n } else if (matchcount - 1 != rule.token.length) {\n this.reportError(\"number of classes and regexp groups doesn't match\", { \n rule: rule,\n groupCount: matchcount - 1\n });\n rule.token = rule.token[0];\n } else {\n rule.tokenArray = rule.token;\n rule.token = null;\n rule.onMatch = this.$arrayTokens;\n }\n } else if (typeof rule.token == \"function\" && !rule.onMatch) {\n if (matchcount > 1)\n rule.onMatch = this.$applyToken;\n else\n rule.onMatch = rule.token;\n }\n\n if (matchcount > 1) {\n if (/\\\\\\d/.test(rule.regex)) {\n adjustedregex = rule.regex.replace(/\\\\([0-9]+)/g, function(match, digit) {\n return \"\\\\\" + (parseInt(digit, 10) + matchTotal + 1);\n });\n } else {\n matchcount = 1;\n adjustedregex = this.removeCapturingGroups(rule.regex);\n }\n if (!rule.splitRegex && typeof rule.token != \"string\")\n splitterRurles.push(rule); // flag will be known only at the very end\n }\n\n mapping[matchTotal] = i;\n matchTotal += matchcount;\n\n ruleRegExps.push(adjustedregex);\n if (!rule.onMatch)\n rule.onMatch = null;\n }\n \n if (!ruleRegExps.length) {\n mapping[0] = 0;\n ruleRegExps.push(\"$\");\n }\n \n splitterRurles.forEach(function(rule) {\n rule.splitRegex = this.createSplitterRegexp(rule.regex, flag);\n }, this);\n\n this.regExps[key] = new RegExp(\"(\" + ruleRegExps.join(\")|(\") + \")|($)\", flag);\n }\n};\n\n(function() {\n this.$setMaxTokenCount = function(m) {\n MAX_TOKEN_COUNT = m | 0;\n };\n \n this.$applyToken = function(str) {\n var values = this.splitRegex.exec(str).slice(1);\n var types = this.token.apply(this, values);\n if (typeof types === \"string\")\n return [{type: types, value: str}];\n\n var tokens = [];\n for (var i = 0, l = types.length; i < l; i++) {\n if (values[i])\n tokens[tokens.length] = {\n type: types[i],\n value: values[i]\n };\n }\n return tokens;\n };\n\n this.$arrayTokens = function(str) {\n if (!str)\n return [];\n var values = this.splitRegex.exec(str);\n if (!values)\n return \"text\";\n var tokens = [];\n var types = this.tokenArray;\n for (var i = 0, l = types.length; i < l; i++) {\n if (values[i + 1])\n tokens[tokens.length] = {\n type: types[i],\n value: values[i + 1]\n };\n }\n return tokens;\n };\n\n this.removeCapturingGroups = function(src) {\n var r = src.replace(\n /\\\\.|\\[(?:\\\\.|[^\\\\\\]])*|\\(\\?[:=!]|(\\()/g,\n function(x, y) {return y ? \"(?:\" : x;}\n );\n return r;\n };\n\n this.createSplitterRegexp = function(src, flag) {\n if (src.indexOf(\"(?=\") != -1) {\n var stack = 0;\n var inChClass = false;\n var lastCapture = {};\n src.replace(/(\\\\.)|(\\((?:\\?[=!])?)|(\\))|([\\[\\]])/g, function(\n m, esc, parenOpen, parenClose, square, index\n ) {\n if (inChClass) {\n inChClass = square != \"]\";\n } else if (square) {\n inChClass = true;\n } else if (parenClose) {\n if (stack == lastCapture.stack) {\n lastCapture.end = index+1;\n lastCapture.stack = -1;\n }\n stack--;\n } else if (parenOpen) {\n stack++;\n if (parenOpen.length != 1) {\n lastCapture.stack = stack;\n lastCapture.start = index;\n }\n }\n return m;\n });\n\n if (lastCapture.end != null && /^\\)*$/.test(src.substr(lastCapture.end)))\n src = src.substring(0, lastCapture.start) + src.substr(lastCapture.end);\n }\n if (src.charAt(0) != \"^\") src = \"^\" + src;\n if (src.charAt(src.length - 1) != \"$\") src += \"$\";\n \n return new RegExp(src, (flag||\"\").replace(\"g\", \"\"));\n };\n this.getLineTokens = function(line, startState) {\n if (startState && typeof startState != \"string\") {\n var stack = startState.slice(0);\n startState = stack[0];\n if (startState === \"#tmp\") {\n stack.shift();\n startState = stack.shift();\n }\n } else\n var stack = [];\n\n var currentState = startState || \"start\";\n var state = this.states[currentState];\n if (!state) {\n currentState = \"start\";\n state = this.states[currentState];\n }\n var mapping = this.matchMappings[currentState];\n var re = this.regExps[currentState];\n re.lastIndex = 0;\n\n var match, tokens = [];\n var lastIndex = 0;\n var matchAttempts = 0;\n\n var token = {type: null, value: \"\"};\n\n while (match = re.exec(line)) {\n var type = mapping.defaultToken;\n var rule = null;\n var value = match[0];\n var index = re.lastIndex;\n\n if (index - value.length > lastIndex) {\n var skipped = line.substring(lastIndex, index - value.length);\n if (token.type == type) {\n token.value += skipped;\n } else {\n if (token.type)\n tokens.push(token);\n token = {type: type, value: skipped};\n }\n }\n\n for (var i = 0; i < match.length-2; i++) {\n if (match[i + 1] === undefined)\n continue;\n\n rule = state[mapping[i]];\n\n if (rule.onMatch)\n type = rule.onMatch(value, currentState, stack, line);\n else\n type = rule.token;\n\n if (rule.next) {\n if (typeof rule.next == \"string\") {\n currentState = rule.next;\n } else {\n currentState = rule.next(currentState, stack);\n }\n \n state = this.states[currentState];\n if (!state) {\n this.reportError(\"state doesn't exist\", currentState);\n currentState = \"start\";\n state = this.states[currentState];\n }\n mapping = this.matchMappings[currentState];\n lastIndex = index;\n re = this.regExps[currentState];\n re.lastIndex = index;\n }\n if (rule.consumeLineEnd)\n lastIndex = index;\n break;\n }\n\n if (value) {\n if (typeof type === \"string\") {\n if ((!rule || rule.merge !== false) && token.type === type) {\n token.value += value;\n } else {\n if (token.type)\n tokens.push(token);\n token = {type: type, value: value};\n }\n } else if (type) {\n if (token.type)\n tokens.push(token);\n token = {type: null, value: \"\"};\n for (var i = 0; i < type.length; i++)\n tokens.push(type[i]);\n }\n }\n\n if (lastIndex == line.length)\n break;\n\n lastIndex = index;\n\n if (matchAttempts++ > MAX_TOKEN_COUNT) {\n if (matchAttempts > 2 * line.length) {\n this.reportError(\"infinite loop with in ace tokenizer\", {\n startState: startState,\n line: line\n });\n }\n while (lastIndex < line.length) {\n if (token.type)\n tokens.push(token);\n token = {\n value: line.substring(lastIndex, lastIndex += 500),\n type: \"overflow\"\n };\n }\n currentState = \"start\";\n stack = [];\n break;\n }\n }\n\n if (token.type)\n tokens.push(token);\n \n if (stack.length > 1) {\n if (stack[0] !== currentState)\n stack.unshift(\"#tmp\", currentState);\n }\n return {\n tokens : tokens,\n state : stack.length ? stack : currentState\n };\n };\n \n this.reportError = config.reportError;\n \n}).call(Tokenizer.prototype);\n\nexports.Tokenizer = Tokenizer;\n});\n\nace.define(\"ace/mode/text_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\"], function(require, exports, module) {\n\nvar lang = require(\"../lib/lang\");\n\nvar TextHighlightRules = function() {\n\n this.$rules = {\n \"start\" : [{\n token : \"empty_line\",\n regex : '^$'\n }, {\n defaultToken : \"text\"\n }]\n };\n};\n\n(function() {\n\n this.addRules = function(rules, prefix) {\n if (!prefix) {\n for (var key in rules)\n this.$rules[key] = rules[key];\n return;\n }\n for (var key in rules) {\n var state = rules[key];\n for (var i = 0; i < state.length; i++) {\n var rule = state[i];\n if (rule.next || rule.onMatch) {\n if (typeof rule.next == \"string\") {\n if (rule.next.indexOf(prefix) !== 0)\n rule.next = prefix + rule.next;\n }\n if (rule.nextState && rule.nextState.indexOf(prefix) !== 0)\n rule.nextState = prefix + rule.nextState;\n }\n }\n this.$rules[prefix + key] = state;\n }\n };\n\n this.getRules = function() {\n return this.$rules;\n };\n\n this.embedRules = function (HighlightRules, prefix, escapeRules, states, append) {\n var embedRules = typeof HighlightRules == \"function\"\n ? new HighlightRules().getRules()\n : HighlightRules;\n if (states) {\n for (var i = 0; i < states.length; i++)\n states[i] = prefix + states[i];\n } else {\n states = [];\n for (var key in embedRules)\n states.push(prefix + key);\n }\n\n this.addRules(embedRules, prefix);\n\n if (escapeRules) {\n var addRules = Array.prototype[append ? \"push\" : \"unshift\"];\n for (var i = 0; i < states.length; i++)\n addRules.apply(this.$rules[states[i]], lang.deepCopy(escapeRules));\n }\n\n if (!this.$embeds)\n this.$embeds = [];\n this.$embeds.push(prefix);\n };\n\n this.getEmbeds = function() {\n return this.$embeds;\n };\n\n var pushState = function(currentState, stack) {\n if (currentState != \"start\" || stack.length)\n stack.unshift(this.nextState, currentState);\n return this.nextState;\n };\n var popState = function(currentState, stack) {\n stack.shift();\n return stack.shift() || \"start\";\n };\n\n this.normalizeRules = function() {\n var id = 0;\n var rules = this.$rules;\n function processState(key) {\n var state = rules[key];\n state.processed = true;\n for (var i = 0; i < state.length; i++) {\n var rule = state[i];\n var toInsert = null;\n if (Array.isArray(rule)) {\n toInsert = rule;\n rule = {};\n }\n if (!rule.regex && rule.start) {\n rule.regex = rule.start;\n if (!rule.next)\n rule.next = [];\n rule.next.push({\n defaultToken: rule.token\n }, {\n token: rule.token + \".end\",\n regex: rule.end || rule.start,\n next: \"pop\"\n });\n rule.token = rule.token + \".start\";\n rule.push = true;\n }\n var next = rule.next || rule.push;\n if (next && Array.isArray(next)) {\n var stateName = rule.stateName;\n if (!stateName) {\n stateName = rule.token;\n if (typeof stateName != \"string\")\n stateName = stateName[0] || \"\";\n if (rules[stateName])\n stateName += id++;\n }\n rules[stateName] = next;\n rule.next = stateName;\n processState(stateName);\n } else if (next == \"pop\") {\n rule.next = popState;\n }\n\n if (rule.push) {\n rule.nextState = rule.next || rule.push;\n rule.next = pushState;\n delete rule.push;\n }\n\n if (rule.rules) {\n for (var r in rule.rules) {\n if (rules[r]) {\n if (rules[r].push)\n rules[r].push.apply(rules[r], rule.rules[r]);\n } else {\n rules[r] = rule.rules[r];\n }\n }\n }\n var includeName = typeof rule == \"string\" ? rule : rule.include;\n if (includeName) {\n if (Array.isArray(includeName))\n toInsert = includeName.map(function(x) { return rules[x]; });\n else\n toInsert = rules[includeName];\n }\n\n if (toInsert) {\n var args = [i, 1].concat(toInsert);\n if (rule.noEscape)\n args = args.filter(function(x) {return !x.next;});\n state.splice.apply(state, args);\n i--;\n }\n \n if (rule.keywordMap) {\n rule.token = this.createKeywordMapper(\n rule.keywordMap, rule.defaultToken || \"text\", rule.caseInsensitive\n );\n delete rule.defaultToken;\n }\n }\n }\n Object.keys(rules).forEach(processState, this);\n };\n\n this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) {\n var keywords = Object.create(null);\n this.$keywordList = [];\n Object.keys(map).forEach(function(className) {\n var a = map[className];\n var list = a.split(splitChar || \"|\");\n for (var i = list.length; i--; ) {\n var word = list[i];\n this.$keywordList.push(word);\n if (ignoreCase)\n word = word.toLowerCase(); \n keywords[word] = className;\n }\n }, this);\n map = null;\n return ignoreCase\n ? function(value) {return keywords[value.toLowerCase()] || defaultToken; }\n : function(value) {return keywords[value] || defaultToken; };\n };\n\n this.getKeywords = function() {\n return this.$keywords;\n };\n\n}).call(TextHighlightRules.prototype);\n\nexports.TextHighlightRules = TextHighlightRules;\n});\n\nace.define(\"ace/mode/behaviour\",[\"require\",\"exports\",\"module\"], function(require, exports, module) {\n\nvar Behaviour = function() {\n this.$behaviours = {};\n};\n\n(function () {\n\n this.add = function (name, action, callback) {\n switch (undefined) {\n case this.$behaviours:\n this.$behaviours = {};\n case this.$behaviours[name]:\n this.$behaviours[name] = {};\n }\n this.$behaviours[name][action] = callback;\n };\n \n this.addBehaviours = function (behaviours) {\n for (var key in behaviours) {\n for (var action in behaviours[key]) {\n this.add(key, action, behaviours[key][action]);\n }\n }\n };\n \n this.remove = function (name) {\n if (this.$behaviours && this.$behaviours[name]) {\n delete this.$behaviours[name];\n }\n };\n \n this.inherit = function (mode, filter) {\n if (typeof mode === \"function\") {\n var behaviours = new mode().getBehaviours(filter);\n } else {\n var behaviours = mode.getBehaviours(filter);\n }\n this.addBehaviours(behaviours);\n };\n \n this.getBehaviours = function (filter) {\n if (!filter) {\n return this.$behaviours;\n } else {\n var ret = {};\n for (var i = 0; i < filter.length; i++) {\n if (this.$behaviours[filter[i]]) {\n ret[filter[i]] = this.$behaviours[filter[i]];\n }\n }\n return ret;\n }\n };\n\n}).call(Behaviour.prototype);\n\nexports.Behaviour = Behaviour;\n});\n\nace.define(\"ace/token_iterator\",[\"require\",\"exports\",\"module\",\"ace/range\"], function(require, exports, module) {\n\nvar Range = require(\"./range\").Range;\nvar TokenIterator = function(session, initialRow, initialColumn) {\n this.$session = session;\n this.$row = initialRow;\n this.$rowTokens = session.getTokens(initialRow);\n\n var token = session.getTokenAt(initialRow, initialColumn);\n this.$tokenIndex = token ? token.index : -1;\n};\n\n(function() { \n this.stepBackward = function() {\n this.$tokenIndex -= 1;\n \n while (this.$tokenIndex < 0) {\n this.$row -= 1;\n if (this.$row < 0) {\n this.$row = 0;\n return null;\n }\n \n this.$rowTokens = this.$session.getTokens(this.$row);\n this.$tokenIndex = this.$rowTokens.length - 1;\n }\n \n return this.$rowTokens[this.$tokenIndex];\n }; \n this.stepForward = function() {\n this.$tokenIndex += 1;\n var rowCount;\n while (this.$tokenIndex >= this.$rowTokens.length) {\n this.$row += 1;\n if (!rowCount)\n rowCount = this.$session.getLength();\n if (this.$row >= rowCount) {\n this.$row = rowCount - 1;\n return null;\n }\n\n this.$rowTokens = this.$session.getTokens(this.$row);\n this.$tokenIndex = 0;\n }\n \n return this.$rowTokens[this.$tokenIndex];\n }; \n this.getCurrentToken = function () {\n return this.$rowTokens[this.$tokenIndex];\n }; \n this.getCurrentTokenRow = function () {\n return this.$row;\n }; \n this.getCurrentTokenColumn = function() {\n var rowTokens = this.$rowTokens;\n var tokenIndex = this.$tokenIndex;\n var column = rowTokens[tokenIndex].start;\n if (column !== undefined)\n return column;\n \n column = 0;\n while (tokenIndex > 0) {\n tokenIndex -= 1;\n column += rowTokens[tokenIndex].value.length;\n }\n \n return column; \n };\n this.getCurrentTokenPosition = function() {\n return {row: this.$row, column: this.getCurrentTokenColumn()};\n };\n this.getCurrentTokenRange = function() {\n var token = this.$rowTokens[this.$tokenIndex];\n var column = this.getCurrentTokenColumn();\n return new Range(this.$row, column, this.$row, column + token.value.length);\n };\n \n}).call(TokenIterator.prototype);\n\nexports.TokenIterator = TokenIterator;\n});\n\nace.define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"], function(require, exports, module) {\n\nvar oop = require(\"../../lib/oop\");\nvar Behaviour = require(\"../behaviour\").Behaviour;\nvar TokenIterator = require(\"../../token_iterator\").TokenIterator;\nvar lang = require(\"../../lib/lang\");\n\nvar SAFE_INSERT_IN_TOKENS =\n [\"text\", \"paren.rparen\", \"rparen\", \"paren\", \"punctuation.operator\"];\nvar SAFE_INSERT_BEFORE_TOKENS =\n [\"text\", \"paren.rparen\", \"rparen\", \"paren\", \"punctuation.operator\", \"comment\"];\n\nvar context;\nvar contextCache = {};\nvar defaultQuotes = {'\"' : '\"', \"'\" : \"'\"};\n\nvar initContext = function(editor) {\n var id = -1;\n if (editor.multiSelect) {\n id = editor.selection.index;\n if (contextCache.rangeCount != editor.multiSelect.rangeCount)\n contextCache = {rangeCount: editor.multiSelect.rangeCount};\n }\n if (contextCache[id])\n return context = contextCache[id];\n context = contextCache[id] = {\n autoInsertedBrackets: 0,\n autoInsertedRow: -1,\n autoInsertedLineEnd: \"\",\n maybeInsertedBrackets: 0,\n maybeInsertedRow: -1,\n maybeInsertedLineStart: \"\",\n maybeInsertedLineEnd: \"\"\n };\n};\n\nvar getWrapped = function(selection, selected, opening, closing) {\n var rowDiff = selection.end.row - selection.start.row;\n return {\n text: opening + selected + closing,\n selection: [\n 0,\n selection.start.column + 1,\n rowDiff,\n selection.end.column + (rowDiff ? 0 : 1)\n ]\n };\n};\n\nvar CstyleBehaviour = function(options) {\n this.add(\"braces\", \"insertion\", function(state, action, editor, session, text) {\n var cursor = editor.getCursorPosition();\n var line = session.doc.getLine(cursor.row);\n if (text == '{') {\n initContext(editor);\n var selection = editor.getSelectionRange();\n var selected = session.doc.getTextRange(selection);\n if (selected !== \"\" && selected !== \"{\" && editor.getWrapBehavioursEnabled()) {\n return getWrapped(selection, selected, '{', '}');\n } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {\n if (/[\\]\\}\\)]/.test(line[cursor.column]) || editor.inMultiSelectMode || options && options.braces) {\n CstyleBehaviour.recordAutoInsert(editor, session, \"}\");\n return {\n text: '{}',\n selection: [1, 1]\n };\n } else {\n CstyleBehaviour.recordMaybeInsert(editor, session, \"{\");\n return {\n text: '{',\n selection: [1, 1]\n };\n }\n }\n } else if (text == '}') {\n initContext(editor);\n var rightChar = line.substring(cursor.column, cursor.column + 1);\n if (rightChar == '}') {\n var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});\n if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {\n CstyleBehaviour.popAutoInsertedClosing();\n return {\n text: '',\n selection: [1, 1]\n };\n }\n }\n } else if (text == \"\\n\" || text == \"\\r\\n\") {\n initContext(editor);\n var closing = \"\";\n if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {\n closing = lang.stringRepeat(\"}\", context.maybeInsertedBrackets);\n CstyleBehaviour.clearMaybeInsertedClosing();\n }\n var rightChar = line.substring(cursor.column, cursor.column + 1);\n if (rightChar === '}') {\n var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');\n if (!openBracePos)\n return null;\n var next_indent = this.$getIndent(session.getLine(openBracePos.row));\n } else if (closing) {\n var next_indent = this.$getIndent(line);\n } else {\n CstyleBehaviour.clearMaybeInsertedClosing();\n return;\n }\n var indent = next_indent + session.getTabString();\n\n return {\n text: '\\n' + indent + '\\n' + next_indent + closing,\n selection: [1, indent.length, 1, indent.length]\n };\n } else {\n CstyleBehaviour.clearMaybeInsertedClosing();\n }\n });\n\n this.add(\"braces\", \"deletion\", function(state, action, editor, session, range) {\n var selected = session.doc.getTextRange(range);\n if (!range.isMultiLine() && selected == '{') {\n initContext(editor);\n var line = session.doc.getLine(range.start.row);\n var rightChar = line.substring(range.end.column, range.end.column + 1);\n if (rightChar == '}') {\n range.end.column++;\n return range;\n } else {\n context.maybeInsertedBrackets--;\n }\n }\n });\n\n this.add(\"parens\", \"insertion\", function(state, action, editor, session, text) {\n if (text == '(') {\n initContext(editor);\n var selection = editor.getSelectionRange();\n var selected = session.doc.getTextRange(selection);\n if (selected !== \"\" && editor.getWrapBehavioursEnabled()) {\n return getWrapped(selection, selected, '(', ')');\n } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {\n CstyleBehaviour.recordAutoInsert(editor, session, \")\");\n return {\n text: '()',\n selection: [1, 1]\n };\n }\n } else if (text == ')') {\n initContext(editor);\n var cursor = editor.getCursorPosition();\n var line = session.doc.getLine(cursor.row);\n var rightChar = line.substring(cursor.column, cursor.column + 1);\n if (rightChar == ')') {\n var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});\n if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {\n CstyleBehaviour.popAutoInsertedClosing();\n return {\n text: '',\n selection: [1, 1]\n };\n }\n }\n }\n });\n\n this.add(\"parens\", \"deletion\", function(state, action, editor, session, range) {\n var selected = session.doc.getTextRange(range);\n if (!range.isMultiLine() && selected == '(') {\n initContext(editor);\n var line = session.doc.getLine(range.start.row);\n var rightChar = line.substring(range.start.column + 1, range.start.column + 2);\n if (rightChar == ')') {\n range.end.column++;\n return range;\n }\n }\n });\n\n this.add(\"brackets\", \"insertion\", function(state, action, editor, session, text) {\n if (text == '[') {\n initContext(editor);\n var selection = editor.getSelectionRange();\n var selected = session.doc.getTextRange(selection);\n if (selected !== \"\" && editor.getWrapBehavioursEnabled()) {\n return getWrapped(selection, selected, '[', ']');\n } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {\n CstyleBehaviour.recordAutoInsert(editor, session, \"]\");\n return {\n text: '[]',\n selection: [1, 1]\n };\n }\n } else if (text == ']') {\n initContext(editor);\n var cursor = editor.getCursorPosition();\n var line = session.doc.getLine(cursor.row);\n var rightChar = line.substring(cursor.column, cursor.column + 1);\n if (rightChar == ']') {\n var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});\n if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {\n CstyleBehaviour.popAutoInsertedClosing();\n return {\n text: '',\n selection: [1, 1]\n };\n }\n }\n }\n });\n\n this.add(\"brackets\", \"deletion\", function(state, action, editor, session, range) {\n var selected = session.doc.getTextRange(range);\n if (!range.isMultiLine() && selected == '[') {\n initContext(editor);\n var line = session.doc.getLine(range.start.row);\n var rightChar = line.substring(range.start.column + 1, range.start.column + 2);\n if (rightChar == ']') {\n range.end.column++;\n return range;\n }\n }\n });\n\n this.add(\"string_dquotes\", \"insertion\", function(state, action, editor, session, text) {\n var quotes = session.$mode.$quotes || defaultQuotes;\n if (text.length == 1 && quotes[text]) {\n if (this.lineCommentStart && this.lineCommentStart.indexOf(text) != -1) \n return;\n initContext(editor);\n var quote = text;\n var selection = editor.getSelectionRange();\n var selected = session.doc.getTextRange(selection);\n if (selected !== \"\" && (selected.length != 1 || !quotes[selected]) && editor.getWrapBehavioursEnabled()) {\n return getWrapped(selection, selected, quote, quote);\n } else if (!selected) {\n var cursor = editor.getCursorPosition();\n var line = session.doc.getLine(cursor.row);\n var leftChar = line.substring(cursor.column-1, cursor.column);\n var rightChar = line.substring(cursor.column, cursor.column + 1);\n \n var token = session.getTokenAt(cursor.row, cursor.column);\n var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);\n if (leftChar == \"\\\\\" && token && /escape/.test(token.type))\n return null;\n \n var stringBefore = token && /string|escape/.test(token.type);\n var stringAfter = !rightToken || /string|escape/.test(rightToken.type);\n \n var pair;\n if (rightChar == quote) {\n pair = stringBefore !== stringAfter;\n if (pair && /string\\.end/.test(rightToken.type))\n pair = false;\n } else {\n if (stringBefore && !stringAfter)\n return null; // wrap string with different quote\n if (stringBefore && stringAfter)\n return null; // do not pair quotes inside strings\n var wordRe = session.$mode.tokenRe;\n wordRe.lastIndex = 0;\n var isWordBefore = wordRe.test(leftChar);\n wordRe.lastIndex = 0;\n var isWordAfter = wordRe.test(leftChar);\n if (isWordBefore || isWordAfter)\n return null; // before or after alphanumeric\n if (rightChar && !/[\\s;,.})\\]\\\\]/.test(rightChar))\n return null; // there is rightChar and it isn't closing\n var charBefore = line[cursor.column - 2];\n if (leftChar == quote && (charBefore == quote || wordRe.test(charBefore)))\n return null;\n pair = true;\n }\n return {\n text: pair ? quote + quote : \"\",\n selection: [1,1]\n };\n }\n }\n });\n\n this.add(\"string_dquotes\", \"deletion\", function(state, action, editor, session, range) {\n var quotes = session.$mode.$quotes || defaultQuotes;\n\n var selected = session.doc.getTextRange(range);\n if (!range.isMultiLine() && quotes.hasOwnProperty(selected)) {\n initContext(editor);\n var line = session.doc.getLine(range.start.row);\n var rightChar = line.substring(range.start.column + 1, range.start.column + 2);\n if (rightChar == selected) {\n range.end.column++;\n return range;\n }\n }\n });\n\n};\n\n \nCstyleBehaviour.isSaneInsertion = function(editor, session) {\n var cursor = editor.getCursorPosition();\n var iterator = new TokenIterator(session, cursor.row, cursor.column);\n if (!this.$matchTokenType(iterator.getCurrentToken() || \"text\", SAFE_INSERT_IN_TOKENS)) {\n if (/[)}\\]]/.test(editor.session.getLine(cursor.row)[cursor.column]))\n return true;\n var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);\n if (!this.$matchTokenType(iterator2.getCurrentToken() || \"text\", SAFE_INSERT_IN_TOKENS))\n return false;\n }\n iterator.stepForward();\n return iterator.getCurrentTokenRow() !== cursor.row ||\n this.$matchTokenType(iterator.getCurrentToken() || \"text\", SAFE_INSERT_BEFORE_TOKENS);\n};\n\nCstyleBehaviour.$matchTokenType = function(token, types) {\n return types.indexOf(token.type || token) > -1;\n};\n\nCstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {\n var cursor = editor.getCursorPosition();\n var line = session.doc.getLine(cursor.row);\n if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))\n context.autoInsertedBrackets = 0;\n context.autoInsertedRow = cursor.row;\n context.autoInsertedLineEnd = bracket + line.substr(cursor.column);\n context.autoInsertedBrackets++;\n};\n\nCstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {\n var cursor = editor.getCursorPosition();\n var line = session.doc.getLine(cursor.row);\n if (!this.isMaybeInsertedClosing(cursor, line))\n context.maybeInsertedBrackets = 0;\n context.maybeInsertedRow = cursor.row;\n context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;\n context.maybeInsertedLineEnd = line.substr(cursor.column);\n context.maybeInsertedBrackets++;\n};\n\nCstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {\n return context.autoInsertedBrackets > 0 &&\n cursor.row === context.autoInsertedRow &&\n bracket === context.autoInsertedLineEnd[0] &&\n line.substr(cursor.column) === context.autoInsertedLineEnd;\n};\n\nCstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {\n return context.maybeInsertedBrackets > 0 &&\n cursor.row === context.maybeInsertedRow &&\n line.substr(cursor.column) === context.maybeInsertedLineEnd &&\n line.substr(0, cursor.column) == context.maybeInsertedLineStart;\n};\n\nCstyleBehaviour.popAutoInsertedClosing = function() {\n context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);\n context.autoInsertedBrackets--;\n};\n\nCstyleBehaviour.clearMaybeInsertedClosing = function() {\n if (context) {\n context.maybeInsertedBrackets = 0;\n context.maybeInsertedRow = -1;\n }\n};\n\n\n\noop.inherits(CstyleBehaviour, Behaviour);\n\nexports.CstyleBehaviour = CstyleBehaviour;\n});\n\nace.define(\"ace/unicode\",[\"require\",\"exports\",\"module\"], function(require, exports, module) {\nvar wordChars = [48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2];\n\nvar code = 0;\nvar str = [];\nfor (var i = 0; i < wordChars.length; i += 2) {\n str.push(code += wordChars[i]);\n if (wordChars[i + 1])\n str.push(45, code += wordChars[i + 1]);\n}\n\nexports.wordChars = String.fromCharCode.apply(null, str);\n\n});\n\nace.define(\"ace/mode/text\",[\"require\",\"exports\",\"module\",\"ace/config\",\"ace/tokenizer\",\"ace/mode/text_highlight_rules\",\"ace/mode/behaviour/cstyle\",\"ace/unicode\",\"ace/lib/lang\",\"ace/token_iterator\",\"ace/range\"], function(require, exports, module) {\nvar config = require(\"../config\");\n\nvar Tokenizer = require(\"../tokenizer\").Tokenizer;\nvar TextHighlightRules = require(\"./text_highlight_rules\").TextHighlightRules;\nvar CstyleBehaviour = require(\"./behaviour/cstyle\").CstyleBehaviour;\nvar unicode = require(\"../unicode\");\nvar lang = require(\"../lib/lang\");\nvar TokenIterator = require(\"../token_iterator\").TokenIterator;\nvar Range = require(\"../range\").Range;\n\nvar Mode = function() {\n this.HighlightRules = TextHighlightRules;\n};\n\n(function() {\n this.$defaultBehaviour = new CstyleBehaviour();\n\n this.tokenRe = new RegExp(\"^[\" + unicode.wordChars + \"\\\\$_]+\", \"g\");\n\n this.nonTokenRe = new RegExp(\"^(?:[^\" + unicode.wordChars + \"\\\\$_]|\\\\s])+\", \"g\");\n\n this.getTokenizer = function() {\n if (!this.$tokenizer) {\n this.$highlightRules = this.$highlightRules || new this.HighlightRules(this.$highlightRuleConfig);\n this.$tokenizer = new Tokenizer(this.$highlightRules.getRules());\n }\n return this.$tokenizer;\n };\n\n this.lineCommentStart = \"\";\n this.blockComment = \"\";\n\n this.toggleCommentLines = function(state, session, startRow, endRow) {\n var doc = session.doc;\n\n var ignoreBlankLines = true;\n var shouldRemove = true;\n var minIndent = Infinity;\n var tabSize = session.getTabSize();\n var insertAtTabStop = false;\n\n if (!this.lineCommentStart) {\n if (!this.blockComment)\n return false;\n var lineCommentStart = this.blockComment.start;\n var lineCommentEnd = this.blockComment.end;\n var regexpStart = new RegExp(\"^(\\\\s*)(?:\" + lang.escapeRegExp(lineCommentStart) + \")\");\n var regexpEnd = new RegExp(\"(?:\" + lang.escapeRegExp(lineCommentEnd) + \")\\\\s*$\");\n\n var comment = function(line, i) {\n if (testRemove(line, i))\n return;\n if (!ignoreBlankLines || /\\S/.test(line)) {\n doc.insertInLine({row: i, column: line.length}, lineCommentEnd);\n doc.insertInLine({row: i, column: minIndent}, lineCommentStart);\n }\n };\n\n var uncomment = function(line, i) {\n var m;\n if (m = line.match(regexpEnd))\n doc.removeInLine(i, line.length - m[0].length, line.length);\n if (m = line.match(regexpStart))\n doc.removeInLine(i, m[1].length, m[0].length);\n };\n\n var testRemove = function(line, row) {\n if (regexpStart.test(line))\n return true;\n var tokens = session.getTokens(row);\n for (var i = 0; i < tokens.length; i++) {\n if (tokens[i].type === \"comment\")\n return true;\n }\n };\n } else {\n if (Array.isArray(this.lineCommentStart)) {\n var regexpStart = this.lineCommentStart.map(lang.escapeRegExp).join(\"|\");\n var lineCommentStart = this.lineCommentStart[0];\n } else {\n var regexpStart = lang.escapeRegExp(this.lineCommentStart);\n var lineCommentStart = this.lineCommentStart;\n }\n regexpStart = new RegExp(\"^(\\\\s*)(?:\" + regexpStart + \") ?\");\n \n insertAtTabStop = session.getUseSoftTabs();\n\n var uncomment = function(line, i) {\n var m = line.match(regexpStart);\n if (!m) return;\n var start = m[1].length, end = m[0].length;\n if (!shouldInsertSpace(line, start, end) && m[0][end - 1] == \" \")\n end--;\n doc.removeInLine(i, start, end);\n };\n var commentWithSpace = lineCommentStart + \" \";\n var comment = function(line, i) {\n if (!ignoreBlankLines || /\\S/.test(line)) {\n if (shouldInsertSpace(line, minIndent, minIndent))\n doc.insertInLine({row: i, column: minIndent}, commentWithSpace);\n else\n doc.insertInLine({row: i, column: minIndent}, lineCommentStart);\n }\n };\n var testRemove = function(line, i) {\n return regexpStart.test(line);\n };\n \n var shouldInsertSpace = function(line, before, after) {\n var spaces = 0;\n while (before-- && line.charAt(before) == \" \")\n spaces++;\n if (spaces % tabSize != 0)\n return false;\n var spaces = 0;\n while (line.charAt(after++) == \" \")\n spaces++;\n if (tabSize > 2)\n return spaces % tabSize != tabSize - 1;\n else\n return spaces % tabSize == 0;\n };\n }\n\n function iter(fun) {\n for (var i = startRow; i <= endRow; i++)\n fun(doc.getLine(i), i);\n }\n\n\n var minEmptyLength = Infinity;\n iter(function(line, i) {\n var indent = line.search(/\\S/);\n if (indent !== -1) {\n if (indent < minIndent)\n minIndent = indent;\n if (shouldRemove && !testRemove(line, i))\n shouldRemove = false;\n } else if (minEmptyLength > line.length) {\n minEmptyLength = line.length;\n }\n });\n\n if (minIndent == Infinity) {\n minIndent = minEmptyLength;\n ignoreBlankLines = false;\n shouldRemove = false;\n }\n\n if (insertAtTabStop && minIndent % tabSize != 0)\n minIndent = Math.floor(minIndent / tabSize) * tabSize;\n\n iter(shouldRemove ? uncomment : comment);\n };\n\n this.toggleBlockComment = function(state, session, range, cursor) {\n var comment = this.blockComment;\n if (!comment)\n return;\n if (!comment.start && comment[0])\n comment = comment[0];\n\n var iterator = new TokenIterator(session, cursor.row, cursor.column);\n var token = iterator.getCurrentToken();\n\n var sel = session.selection;\n var initialRange = session.selection.toOrientedRange();\n var startRow, colDiff;\n\n if (token && /comment/.test(token.type)) {\n var startRange, endRange;\n while (token && /comment/.test(token.type)) {\n var i = token.value.indexOf(comment.start);\n if (i != -1) {\n var row = iterator.getCurrentTokenRow();\n var column = iterator.getCurrentTokenColumn() + i;\n startRange = new Range(row, column, row, column + comment.start.length);\n break;\n }\n token = iterator.stepBackward();\n }\n\n var iterator = new TokenIterator(session, cursor.row, cursor.column);\n var token = iterator.getCurrentToken();\n while (token && /comment/.test(token.type)) {\n var i = token.value.indexOf(comment.end);\n if (i != -1) {\n var row = iterator.getCurrentTokenRow();\n var column = iterator.getCurrentTokenColumn() + i;\n endRange = new Range(row, column, row, column + comment.end.length);\n break;\n }\n token = iterator.stepForward();\n }\n if (endRange)\n session.remove(endRange);\n if (startRange) {\n session.remove(startRange);\n startRow = startRange.start.row;\n colDiff = -comment.start.length;\n }\n } else {\n colDiff = comment.start.length;\n startRow = range.start.row;\n session.insert(range.end, comment.end);\n session.insert(range.start, comment.start);\n }\n if (initialRange.start.row == startRow)\n initialRange.start.column += colDiff;\n if (initialRange.end.row == startRow)\n initialRange.end.column += colDiff;\n session.selection.fromOrientedRange(initialRange);\n };\n\n this.getNextLineIndent = function(state, line, tab) {\n return this.$getIndent(line);\n };\n\n this.checkOutdent = function(state, line, input) {\n return false;\n };\n\n this.autoOutdent = function(state, doc, row) {\n };\n\n this.$getIndent = function(line) {\n return line.match(/^\\s*/)[0];\n };\n\n this.createWorker = function(session) {\n return null;\n };\n\n this.createModeDelegates = function (mapping) {\n this.$embeds = [];\n this.$modes = {};\n for (var i in mapping) {\n if (mapping[i]) {\n var Mode = mapping[i];\n var id = Mode.prototype.$id;\n var mode = config.$modes[id];\n if (!mode)\n config.$modes[id] = mode = new Mode();\n if (!config.$modes[i])\n config.$modes[i] = mode;\n this.$embeds.push(i);\n this.$modes[i] = mode;\n }\n }\n\n var delegations = [\"toggleBlockComment\", \"toggleCommentLines\", \"getNextLineIndent\", \n \"checkOutdent\", \"autoOutdent\", \"transformAction\", \"getCompletions\"];\n\n for (var i = 0; i < delegations.length; i++) {\n (function(scope) {\n var functionName = delegations[i];\n var defaultHandler = scope[functionName];\n scope[delegations[i]] = function() {\n return this.$delegator(functionName, arguments, defaultHandler);\n };\n }(this));\n }\n };\n\n this.$delegator = function(method, args, defaultHandler) {\n var state = args[0] || \"start\";\n if (typeof state != \"string\") {\n if (Array.isArray(state[2])) {\n var language = state[2][state[2].length - 1];\n var mode = this.$modes[language];\n if (mode)\n return mode[method].apply(mode, [state[1]].concat([].slice.call(args, 1)));\n }\n state = state[0] || \"start\";\n }\n \n for (var i = 0; i < this.$embeds.length; i++) {\n if (!this.$modes[this.$embeds[i]]) continue;\n\n var split = state.split(this.$embeds[i]);\n if (!split[0] && split[1]) {\n args[0] = split[1];\n var mode = this.$modes[this.$embeds[i]];\n return mode[method].apply(mode, args);\n }\n }\n var ret = defaultHandler.apply(this, args);\n return defaultHandler ? ret : undefined;\n };\n\n this.transformAction = function(state, action, editor, session, param) {\n if (this.$behaviour) {\n var behaviours = this.$behaviour.getBehaviours();\n for (var key in behaviours) {\n if (behaviours[key][action]) {\n var ret = behaviours[key][action].apply(this, arguments);\n if (ret) {\n return ret;\n }\n }\n }\n }\n };\n \n this.getKeywords = function(append) {\n if (!this.completionKeywords) {\n var rules = this.$tokenizer.rules;\n var completionKeywords = [];\n for (var rule in rules) {\n var ruleItr = rules[rule];\n for (var r = 0, l = ruleItr.length; r < l; r++) {\n if (typeof ruleItr[r].token === \"string\") {\n if (/keyword|support|storage/.test(ruleItr[r].token))\n completionKeywords.push(ruleItr[r].regex);\n }\n else if (typeof ruleItr[r].token === \"object\") {\n for (var a = 0, aLength = ruleItr[r].token.length; a < aLength; a++) { \n if (/keyword|support|storage/.test(ruleItr[r].token[a])) {\n var rule = ruleItr[r].regex.match(/\\(.+?\\)/g)[a];\n completionKeywords.push(rule.substr(1, rule.length - 2));\n }\n }\n }\n }\n }\n this.completionKeywords = completionKeywords;\n }\n if (!append)\n return this.$keywordList;\n return completionKeywords.concat(this.$keywordList || []);\n };\n \n this.$createKeywordList = function() {\n if (!this.$highlightRules)\n this.getTokenizer();\n return this.$keywordList = this.$highlightRules.$keywordList || [];\n };\n\n this.getCompletions = function(state, session, pos, prefix) {\n var keywords = this.$keywordList || this.$createKeywordList();\n return keywords.map(function(word) {\n return {\n name: word,\n value: word,\n score: 0,\n meta: \"keyword\"\n };\n });\n };\n\n this.$id = \"ace/mode/text\";\n}).call(Mode.prototype);\n\nexports.Mode = Mode;\n});\n\nace.define(\"ace/apply_delta\",[\"require\",\"exports\",\"module\"], function(require, exports, module) {\n\nexports.applyDelta = function(docLines, delta, doNotValidate) {\n \n var row = delta.start.row;\n var startColumn = delta.start.column;\n var line = docLines[row] || \"\";\n switch (delta.action) {\n case \"insert\":\n var lines = delta.lines;\n if (lines.length === 1) {\n docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);\n } else {\n var args = [row, 1].concat(delta.lines);\n docLines.splice.apply(docLines, args);\n docLines[row] = line.substring(0, startColumn) + docLines[row];\n docLines[row + delta.lines.length - 1] += line.substring(startColumn);\n }\n break;\n case \"remove\":\n var endColumn = delta.end.column;\n var endRow = delta.end.row;\n if (row === endRow) {\n docLines[row] = line.substring(0, startColumn) + line.substring(endColumn);\n } else {\n docLines.splice(\n row, endRow - row + 1,\n line.substring(0, startColumn) + docLines[endRow].substring(endColumn)\n );\n }\n break;\n }\n};\n});\n\nace.define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"], function(require, exports, module) {\n\nvar oop = require(\"./lib/oop\");\nvar EventEmitter = require(\"./lib/event_emitter\").EventEmitter;\n\nvar Anchor = exports.Anchor = function(doc, row, column) {\n this.$onChange = this.onChange.bind(this);\n this.attach(doc);\n \n if (typeof column == \"undefined\")\n this.setPosition(row.row, row.column);\n else\n this.setPosition(row, column);\n};\n\n(function() {\n\n oop.implement(this, EventEmitter);\n this.getPosition = function() {\n return this.$clipPositionToDocument(this.row, this.column);\n };\n this.getDocument = function() {\n return this.document;\n };\n this.$insertRight = false;\n this.onChange = function(delta) {\n if (delta.start.row == delta.end.row && delta.start.row != this.row)\n return;\n\n if (delta.start.row > this.row)\n return;\n \n var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight);\n this.setPosition(point.row, point.column, true);\n };\n \n function $pointsInOrder(point1, point2, equalPointsInOrder) {\n var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;\n return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);\n }\n \n function $getTransformedPoint(delta, point, moveIfEqual) {\n var deltaIsInsert = delta.action == \"insert\";\n var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);\n var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);\n var deltaStart = delta.start;\n var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.\n if ($pointsInOrder(point, deltaStart, moveIfEqual)) {\n return {\n row: point.row,\n column: point.column\n };\n }\n if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {\n return {\n row: point.row + deltaRowShift,\n column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)\n };\n }\n \n return {\n row: deltaStart.row,\n column: deltaStart.column\n };\n }\n this.setPosition = function(row, column, noClip) {\n var pos;\n if (noClip) {\n pos = {\n row: row,\n column: column\n };\n } else {\n pos = this.$clipPositionToDocument(row, column);\n }\n\n if (this.row == pos.row && this.column == pos.column)\n return;\n\n var old = {\n row: this.row,\n column: this.column\n };\n\n this.row = pos.row;\n this.column = pos.column;\n this._signal(\"change\", {\n old: old,\n value: pos\n });\n };\n this.detach = function() {\n this.document.off(\"change\", this.$onChange);\n };\n this.attach = function(doc) {\n this.document = doc || this.document;\n this.document.on(\"change\", this.$onChange);\n };\n this.$clipPositionToDocument = function(row, column) {\n var pos = {};\n\n if (row >= this.document.getLength()) {\n pos.row = Math.max(0, this.document.getLength() - 1);\n pos.column = this.document.getLine(pos.row).length;\n }\n else if (row < 0) {\n pos.row = 0;\n pos.column = 0;\n }\n else {\n pos.row = row;\n pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));\n }\n\n if (column < 0)\n pos.column = 0;\n\n return pos;\n };\n\n}).call(Anchor.prototype);\n\n});\n\nace.define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/apply_delta\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"], function(require, exports, module) {\n\nvar oop = require(\"./lib/oop\");\nvar applyDelta = require(\"./apply_delta\").applyDelta;\nvar EventEmitter = require(\"./lib/event_emitter\").EventEmitter;\nvar Range = require(\"./range\").Range;\nvar Anchor = require(\"./anchor\").Anchor;\n\nvar Document = function(textOrLines) {\n this.$lines = [\"\"];\n if (textOrLines.length === 0) {\n this.$lines = [\"\"];\n } else if (Array.isArray(textOrLines)) {\n this.insertMergedLines({row: 0, column: 0}, textOrLines);\n } else {\n this.insert({row: 0, column:0}, textOrLines);\n }\n};\n\n(function() {\n\n oop.implement(this, EventEmitter);\n this.setValue = function(text) {\n var len = this.getLength() - 1;\n this.remove(new Range(0, 0, len, this.getLine(len).length));\n this.insert({row: 0, column: 0}, text);\n };\n this.getValue = function() {\n return this.getAllLines().join(this.getNewLineCharacter());\n };\n this.createAnchor = function(row, column) {\n return new Anchor(this, row, column);\n };\n if (\"aaa\".split(/a/).length === 0) {\n this.$split = function(text) {\n return text.replace(/\\r\\n|\\r/g, \"\\n\").split(\"\\n\");\n };\n } else {\n this.$split = function(text) {\n return text.split(/\\r\\n|\\r|\\n/);\n };\n }\n\n\n this.$detectNewLine = function(text) {\n var match = text.match(/^.*?(\\r\\n|\\r|\\n)/m);\n this.$autoNewLine = match ? match[1] : \"\\n\";\n this._signal(\"changeNewLineMode\");\n };\n this.getNewLineCharacter = function() {\n switch (this.$newLineMode) {\n case \"windows\":\n return \"\\r\\n\";\n case \"unix\":\n return \"\\n\";\n default:\n return this.$autoNewLine || \"\\n\";\n }\n };\n\n this.$autoNewLine = \"\";\n this.$newLineMode = \"auto\";\n this.setNewLineMode = function(newLineMode) {\n if (this.$newLineMode === newLineMode)\n return;\n\n this.$newLineMode = newLineMode;\n this._signal(\"changeNewLineMode\");\n };\n this.getNewLineMode = function() {\n return this.$newLineMode;\n };\n this.isNewLine = function(text) {\n return (text == \"\\r\\n\" || text == \"\\r\" || text == \"\\n\");\n };\n this.getLine = function(row) {\n return this.$lines[row] || \"\";\n };\n this.getLines = function(firstRow, lastRow) {\n return this.$lines.slice(firstRow, lastRow + 1);\n };\n this.getAllLines = function() {\n return this.getLines(0, this.getLength());\n };\n this.getLength = function() {\n return this.$lines.length;\n };\n this.getTextRange = function(range) {\n return this.getLinesForRange(range).join(this.getNewLineCharacter());\n };\n this.getLinesForRange = function(range) {\n var lines;\n if (range.start.row === range.end.row) {\n lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];\n } else {\n lines = this.getLines(range.start.row, range.end.row);\n lines[0] = (lines[0] || \"\").substring(range.start.column);\n var l = lines.length - 1;\n if (range.end.row - range.start.row == l)\n lines[l] = lines[l].substring(0, range.end.column);\n }\n return lines;\n };\n this.insertLines = function(row, lines) {\n console.warn(\"Use of document.insertLines is deprecated. Use the insertFullLines method instead.\");\n return this.insertFullLines(row, lines);\n };\n this.removeLines = function(firstRow, lastRow) {\n console.warn(\"Use of document.removeLines is deprecated. Use the removeFullLines method instead.\");\n return this.removeFullLines(firstRow, lastRow);\n };\n this.insertNewLine = function(position) {\n console.warn(\"Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.\");\n return this.insertMergedLines(position, [\"\", \"\"]);\n };\n this.insert = function(position, text) {\n if (this.getLength() <= 1)\n this.$detectNewLine(text);\n \n return this.insertMergedLines(position, this.$split(text));\n };\n this.insertInLine = function(position, text) {\n var start = this.clippedPos(position.row, position.column);\n var end = this.pos(position.row, position.column + text.length);\n \n this.applyDelta({\n start: start,\n end: end,\n action: \"insert\",\n lines: [text]\n }, true);\n \n return this.clonePos(end);\n };\n \n this.clippedPos = function(row, column) {\n var length = this.getLength();\n if (row === undefined) {\n row = length;\n } else if (row < 0) {\n row = 0;\n } else if (row >= length) {\n row = length - 1;\n column = undefined;\n }\n var line = this.getLine(row);\n if (column == undefined)\n column = line.length;\n column = Math.min(Math.max(column, 0), line.length);\n return {row: row, column: column};\n };\n \n this.clonePos = function(pos) {\n return {row: pos.row, column: pos.column};\n };\n \n this.pos = function(row, column) {\n return {row: row, column: column};\n };\n \n this.$clipPosition = function(position) {\n var length = this.getLength();\n if (position.row >= length) {\n position.row = Math.max(0, length - 1);\n position.column = this.getLine(length - 1).length;\n } else {\n position.row = Math.max(0, position.row);\n position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);\n }\n return position;\n };\n this.insertFullLines = function(row, lines) {\n row = Math.min(Math.max(row, 0), this.getLength());\n var column = 0;\n if (row < this.getLength()) {\n lines = lines.concat([\"\"]);\n column = 0;\n } else {\n lines = [\"\"].concat(lines);\n row--;\n column = this.$lines[row].length;\n }\n this.insertMergedLines({row: row, column: column}, lines);\n }; \n this.insertMergedLines = function(position, lines) {\n var start = this.clippedPos(position.row, position.column);\n var end = {\n row: start.row + lines.length - 1,\n column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length\n };\n \n this.applyDelta({\n start: start,\n end: end,\n action: \"insert\",\n lines: lines\n });\n \n return this.clonePos(end);\n };\n this.remove = function(range) {\n var start = this.clippedPos(range.start.row, range.start.column);\n var end = this.clippedPos(range.end.row, range.end.column);\n this.applyDelta({\n start: start,\n end: end,\n action: \"remove\",\n lines: this.getLinesForRange({start: start, end: end})\n });\n return this.clonePos(start);\n };\n this.removeInLine = function(row, startColumn, endColumn) {\n var start = this.clippedPos(row, startColumn);\n var end = this.clippedPos(row, endColumn);\n \n this.applyDelta({\n start: start,\n end: end,\n action: \"remove\",\n lines: this.getLinesForRange({start: start, end: end})\n }, true);\n \n return this.clonePos(start);\n };\n this.removeFullLines = function(firstRow, lastRow) {\n firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);\n lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1);\n var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;\n var deleteLastNewLine = lastRow < this.getLength() - 1;\n var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow );\n var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 );\n var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow );\n var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length ); \n var range = new Range(startRow, startCol, endRow, endCol);\n var deletedLines = this.$lines.slice(firstRow, lastRow + 1);\n \n this.applyDelta({\n start: range.start,\n end: range.end,\n action: \"remove\",\n lines: this.getLinesForRange(range)\n });\n return deletedLines;\n };\n this.removeNewLine = function(row) {\n if (row < this.getLength() - 1 && row >= 0) {\n this.applyDelta({\n start: this.pos(row, this.getLine(row).length),\n end: this.pos(row + 1, 0),\n action: \"remove\",\n lines: [\"\", \"\"]\n });\n }\n };\n this.replace = function(range, text) {\n if (!(range instanceof Range))\n range = Range.fromPoints(range.start, range.end);\n if (text.length === 0 && range.isEmpty())\n return range.start;\n if (text == this.getTextRange(range))\n return range.end;\n\n this.remove(range);\n var end;\n if (text) {\n end = this.insert(range.start, text);\n }\n else {\n end = range.start;\n }\n \n return end;\n };\n this.applyDeltas = function(deltas) {\n for (var i=0; i=0; i--) {\n this.revertDelta(deltas[i]);\n }\n };\n this.applyDelta = function(delta, doNotValidate) {\n var isInsert = delta.action == \"insert\";\n if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]\n : !Range.comparePoints(delta.start, delta.end)) {\n return;\n }\n \n if (isInsert && delta.lines.length > 20000) {\n this.$splitAndapplyLargeDelta(delta, 20000);\n }\n else {\n applyDelta(this.$lines, delta, doNotValidate);\n this._signal(\"change\", delta);\n }\n };\n \n this.$safeApplyDelta = function(delta) {\n var docLength = this.$lines.length;\n if (\n delta.action == \"remove\" && delta.start.row < docLength && delta.end.row < docLength\n || delta.action == \"insert\" && delta.start.row <= docLength\n ) {\n this.applyDelta(delta);\n }\n };\n \n this.$splitAndapplyLargeDelta = function(delta, MAX) {\n var lines = delta.lines;\n var l = lines.length - MAX + 1;\n var row = delta.start.row; \n var column = delta.start.column;\n for (var from = 0, to = 0; from < l; from = to) {\n to += MAX - 1;\n var chunk = lines.slice(from, to);\n chunk.push(\"\");\n this.applyDelta({\n start: this.pos(row + from, column),\n end: this.pos(row + to, column = 0),\n action: delta.action,\n lines: chunk\n }, true);\n }\n delta.lines = lines.slice(from);\n delta.start.row = row + from;\n delta.start.column = column;\n this.applyDelta(delta, true);\n };\n this.revertDelta = function(delta) {\n this.$safeApplyDelta({\n start: this.clonePos(delta.start),\n end: this.clonePos(delta.end),\n action: (delta.action == \"insert\" ? \"remove\" : \"insert\"),\n lines: delta.lines.slice()\n });\n };\n this.indexToPosition = function(index, startRow) {\n var lines = this.$lines || this.getAllLines();\n var newlineLength = this.getNewLineCharacter().length;\n for (var i = startRow || 0, l = lines.length; i < l; i++) {\n index -= lines[i].length + newlineLength;\n if (index < 0)\n return {row: i, column: index + lines[i].length + newlineLength};\n }\n return {row: l-1, column: index + lines[l-1].length + newlineLength};\n };\n this.positionToIndex = function(pos, startRow) {\n var lines = this.$lines || this.getAllLines();\n var newlineLength = this.getNewLineCharacter().length;\n var index = 0;\n var row = Math.min(pos.row, lines.length);\n for (var i = startRow || 0; i < row; ++i)\n index += lines[i].length + newlineLength;\n\n return index + pos.column;\n };\n\n}).call(Document.prototype);\n\nexports.Document = Document;\n});\n\nace.define(\"ace/background_tokenizer\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"], function(require, exports, module) {\n\nvar oop = require(\"./lib/oop\");\nvar EventEmitter = require(\"./lib/event_emitter\").EventEmitter;\n\nvar BackgroundTokenizer = function(tokenizer, editor) {\n this.running = false;\n this.lines = [];\n this.states = [];\n this.currentLine = 0;\n this.tokenizer = tokenizer;\n\n var self = this;\n\n this.$worker = function() {\n if (!self.running) { return; }\n\n var workerStart = new Date();\n var currentLine = self.currentLine;\n var endLine = -1;\n var doc = self.doc;\n\n var startLine = currentLine;\n while (self.lines[currentLine])\n currentLine++;\n \n var len = doc.getLength();\n var processedLines = 0;\n self.running = false;\n while (currentLine < len) {\n self.$tokenizeRow(currentLine);\n endLine = currentLine;\n do {\n currentLine++;\n } while (self.lines[currentLine]);\n processedLines ++;\n if ((processedLines % 5 === 0) && (new Date() - workerStart) > 20) {\n self.running = setTimeout(self.$worker, 20);\n break;\n }\n }\n self.currentLine = currentLine;\n \n if (endLine == -1)\n endLine = currentLine;\n \n if (startLine <= endLine)\n self.fireUpdateEvent(startLine, endLine);\n };\n};\n\n(function(){\n\n oop.implement(this, EventEmitter);\n this.setTokenizer = function(tokenizer) {\n this.tokenizer = tokenizer;\n this.lines = [];\n this.states = [];\n\n this.start(0);\n };\n this.setDocument = function(doc) {\n this.doc = doc;\n this.lines = [];\n this.states = [];\n\n this.stop();\n };\n this.fireUpdateEvent = function(firstRow, lastRow) {\n var data = {\n first: firstRow,\n last: lastRow\n };\n this._signal(\"update\", {data: data});\n };\n this.start = function(startRow) {\n this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());\n this.lines.splice(this.currentLine, this.lines.length);\n this.states.splice(this.currentLine, this.states.length);\n\n this.stop();\n this.running = setTimeout(this.$worker, 700);\n };\n \n this.scheduleStart = function() {\n if (!this.running)\n this.running = setTimeout(this.$worker, 700);\n };\n\n this.$updateOnChange = function(delta) {\n var startRow = delta.start.row;\n var len = delta.end.row - startRow;\n\n if (len === 0) {\n this.lines[startRow] = null;\n } else if (delta.action == \"remove\") {\n this.lines.splice(startRow, len + 1, null);\n this.states.splice(startRow, len + 1, null);\n } else {\n var args = Array(len + 1);\n args.unshift(startRow, 1);\n this.lines.splice.apply(this.lines, args);\n this.states.splice.apply(this.states, args);\n }\n\n this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength());\n\n this.stop();\n };\n this.stop = function() {\n if (this.running)\n clearTimeout(this.running);\n this.running = false;\n };\n this.getTokens = function(row) {\n return this.lines[row] || this.$tokenizeRow(row);\n };\n this.getState = function(row) {\n if (this.currentLine == row)\n this.$tokenizeRow(row);\n return this.states[row] || \"start\";\n };\n\n this.$tokenizeRow = function(row) {\n var line = this.doc.getLine(row);\n var state = this.states[row - 1];\n\n var data = this.tokenizer.getLineTokens(line, state, row);\n\n if (this.states[row] + \"\" !== data.state + \"\") {\n this.states[row] = data.state;\n this.lines[row + 1] = null;\n if (this.currentLine > row + 1)\n this.currentLine = row + 1;\n } else if (this.currentLine == row) {\n this.currentLine = row + 1;\n }\n\n return this.lines[row] = data.tokens;\n };\n\n}).call(BackgroundTokenizer.prototype);\n\nexports.BackgroundTokenizer = BackgroundTokenizer;\n});\n\nace.define(\"ace/search_highlight\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\",\"ace/lib/oop\",\"ace/range\"], function(require, exports, module) {\n\nvar lang = require(\"./lib/lang\");\nvar oop = require(\"./lib/oop\");\nvar Range = require(\"./range\").Range;\n\nvar SearchHighlight = function(regExp, clazz, type) {\n this.setRegexp(regExp);\n this.clazz = clazz;\n this.type = type || \"text\";\n};\n\n(function() {\n this.MAX_RANGES = 500;\n \n this.setRegexp = function(regExp) {\n if (this.regExp+\"\" == regExp+\"\")\n return;\n this.regExp = regExp;\n this.cache = [];\n };\n\n this.update = function(html, markerLayer, session, config) {\n if (!this.regExp)\n return;\n var start = config.firstRow, end = config.lastRow;\n\n for (var i = start; i <= end; i++) {\n var ranges = this.cache[i];\n if (ranges == null) {\n ranges = lang.getMatchOffsets(session.getLine(i), this.regExp);\n if (ranges.length > this.MAX_RANGES)\n ranges = ranges.slice(0, this.MAX_RANGES);\n ranges = ranges.map(function(match) {\n return new Range(i, match.offset, i, match.offset + match.length);\n });\n this.cache[i] = ranges.length ? ranges : \"\";\n }\n\n for (var j = ranges.length; j --; ) {\n markerLayer.drawSingleLineMarker(\n html, ranges[j].toScreenRange(session), this.clazz, config);\n }\n }\n };\n\n}).call(SearchHighlight.prototype);\n\nexports.SearchHighlight = SearchHighlight;\n});\n\nace.define(\"ace/edit_session/fold_line\",[\"require\",\"exports\",\"module\",\"ace/range\"], function(require, exports, module) {\n\nvar Range = require(\"../range\").Range;\nfunction FoldLine(foldData, folds) {\n this.foldData = foldData;\n if (Array.isArray(folds)) {\n this.folds = folds;\n } else {\n folds = this.folds = [ folds ];\n }\n\n var last = folds[folds.length - 1];\n this.range = new Range(folds[0].start.row, folds[0].start.column,\n last.end.row, last.end.column);\n this.start = this.range.start;\n this.end = this.range.end;\n\n this.folds.forEach(function(fold) {\n fold.setFoldLine(this);\n }, this);\n}\n\n(function() {\n this.shiftRow = function(shift) {\n this.start.row += shift;\n this.end.row += shift;\n this.folds.forEach(function(fold) {\n fold.start.row += shift;\n fold.end.row += shift;\n });\n };\n\n this.addFold = function(fold) {\n if (fold.sameRow) {\n if (fold.start.row < this.startRow || fold.endRow > this.endRow) {\n throw new Error(\"Can't add a fold to this FoldLine as it has no connection\");\n }\n this.folds.push(fold);\n this.folds.sort(function(a, b) {\n return -a.range.compareEnd(b.start.row, b.start.column);\n });\n if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) {\n this.end.row = fold.end.row;\n this.end.column = fold.end.column;\n } else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) {\n this.start.row = fold.start.row;\n this.start.column = fold.start.column;\n }\n } else if (fold.start.row == this.end.row) {\n this.folds.push(fold);\n this.end.row = fold.end.row;\n this.end.column = fold.end.column;\n } else if (fold.end.row == this.start.row) {\n this.folds.unshift(fold);\n this.start.row = fold.start.row;\n this.start.column = fold.start.column;\n } else {\n throw new Error(\"Trying to add fold to FoldRow that doesn't have a matching row\");\n }\n fold.foldLine = this;\n };\n\n this.containsRow = function(row) {\n return row >= this.start.row && row <= this.end.row;\n };\n\n this.walk = function(callback, endRow, endColumn) {\n var lastEnd = 0,\n folds = this.folds,\n fold,\n cmp, stop, isNewRow = true;\n\n if (endRow == null) {\n endRow = this.end.row;\n endColumn = this.end.column;\n }\n\n for (var i = 0; i < folds.length; i++) {\n fold = folds[i];\n\n cmp = fold.range.compareStart(endRow, endColumn);\n if (cmp == -1) {\n callback(null, endRow, endColumn, lastEnd, isNewRow);\n return;\n }\n\n stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow);\n stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd);\n if (stop || cmp === 0) {\n return;\n }\n isNewRow = !fold.sameRow;\n lastEnd = fold.end.column;\n }\n callback(null, endRow, endColumn, lastEnd, isNewRow);\n };\n\n this.getNextFoldTo = function(row, column) {\n var fold, cmp;\n for (var i = 0; i < this.folds.length; i++) {\n fold = this.folds[i];\n cmp = fold.range.compareEnd(row, column);\n if (cmp == -1) {\n return {\n fold: fold,\n kind: \"after\"\n };\n } else if (cmp === 0) {\n return {\n fold: fold,\n kind: \"inside\"\n };\n }\n }\n return null;\n };\n\n this.addRemoveChars = function(row, column, len) {\n var ret = this.getNextFoldTo(row, column),\n fold, folds;\n if (ret) {\n fold = ret.fold;\n if (ret.kind == \"inside\"\n && fold.start.column != column\n && fold.start.row != row)\n {\n window.console && window.console.log(row, column, fold);\n } else if (fold.start.row == row) {\n folds = this.folds;\n var i = folds.indexOf(fold);\n if (i === 0) {\n this.start.column += len;\n }\n for (i; i < folds.length; i++) {\n fold = folds[i];\n fold.start.column += len;\n if (!fold.sameRow) {\n return;\n }\n fold.end.column += len;\n }\n this.end.column += len;\n }\n }\n };\n\n this.split = function(row, column) {\n var pos = this.getNextFoldTo(row, column);\n \n if (!pos || pos.kind == \"inside\")\n return null;\n \n var fold = pos.fold;\n var folds = this.folds;\n var foldData = this.foldData;\n \n var i = folds.indexOf(fold);\n var foldBefore = folds[i - 1];\n this.end.row = foldBefore.end.row;\n this.end.column = foldBefore.end.column;\n folds = folds.splice(i, folds.length - i);\n\n var newFoldLine = new FoldLine(foldData, folds);\n foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine);\n return newFoldLine;\n };\n\n this.merge = function(foldLineNext) {\n var folds = foldLineNext.folds;\n for (var i = 0; i < folds.length; i++) {\n this.addFold(folds[i]);\n }\n var foldData = this.foldData;\n foldData.splice(foldData.indexOf(foldLineNext), 1);\n };\n\n this.toString = function() {\n var ret = [this.range.toString() + \": [\" ];\n\n this.folds.forEach(function(fold) {\n ret.push(\" \" + fold.toString());\n });\n ret.push(\"]\");\n return ret.join(\"\\n\");\n };\n\n this.idxToPosition = function(idx) {\n var lastFoldEndColumn = 0;\n\n for (var i = 0; i < this.folds.length; i++) {\n var fold = this.folds[i];\n\n idx -= fold.start.column - lastFoldEndColumn;\n if (idx < 0) {\n return {\n row: fold.start.row,\n column: fold.start.column + idx\n };\n }\n\n idx -= fold.placeholder.length;\n if (idx < 0) {\n return fold.start;\n }\n\n lastFoldEndColumn = fold.end.column;\n }\n\n return {\n row: this.end.row,\n column: this.end.column + idx\n };\n };\n}).call(FoldLine.prototype);\n\nexports.FoldLine = FoldLine;\n});\n\nace.define(\"ace/range_list\",[\"require\",\"exports\",\"module\",\"ace/range\"], function(require, exports, module) {\nvar Range = require(\"./range\").Range;\nvar comparePoints = Range.comparePoints;\n\nvar RangeList = function() {\n this.ranges = [];\n this.$bias = 1;\n};\n\n(function() {\n this.comparePoints = comparePoints;\n\n this.pointIndex = function(pos, excludeEdges, startIndex) {\n var list = this.ranges;\n\n for (var i = startIndex || 0; i < list.length; i++) {\n var range = list[i];\n var cmpEnd = comparePoints(pos, range.end);\n if (cmpEnd > 0)\n continue;\n var cmpStart = comparePoints(pos, range.start);\n if (cmpEnd === 0)\n return excludeEdges && cmpStart !== 0 ? -i-2 : i;\n if (cmpStart > 0 || (cmpStart === 0 && !excludeEdges))\n return i;\n\n return -i-1;\n }\n return -i - 1;\n };\n\n this.add = function(range) {\n var excludeEdges = !range.isEmpty();\n var startIndex = this.pointIndex(range.start, excludeEdges);\n if (startIndex < 0)\n startIndex = -startIndex - 1;\n\n var endIndex = this.pointIndex(range.end, excludeEdges, startIndex);\n\n if (endIndex < 0)\n endIndex = -endIndex - 1;\n else\n endIndex++;\n return this.ranges.splice(startIndex, endIndex - startIndex, range);\n };\n\n this.addList = function(list) {\n var removed = [];\n for (var i = list.length; i--; ) {\n removed.push.apply(removed, this.add(list[i]));\n }\n return removed;\n };\n\n this.substractPoint = function(pos) {\n var i = this.pointIndex(pos);\n\n if (i >= 0)\n return this.ranges.splice(i, 1);\n };\n this.merge = function() {\n var removed = [];\n var list = this.ranges;\n \n list = list.sort(function(a, b) {\n return comparePoints(a.start, b.start);\n });\n \n var next = list[0], range;\n for (var i = 1; i < list.length; i++) {\n range = next;\n next = list[i];\n var cmp = comparePoints(range.end, next.start);\n if (cmp < 0)\n continue;\n\n if (cmp == 0 && !range.isEmpty() && !next.isEmpty())\n continue;\n\n if (comparePoints(range.end, next.end) < 0) {\n range.end.row = next.end.row;\n range.end.column = next.end.column;\n }\n\n list.splice(i, 1);\n removed.push(next);\n next = range;\n i--;\n }\n \n this.ranges = list;\n\n return removed;\n };\n\n this.contains = function(row, column) {\n return this.pointIndex({row: row, column: column}) >= 0;\n };\n\n this.containsPoint = function(pos) {\n return this.pointIndex(pos) >= 0;\n };\n\n this.rangeAtPoint = function(pos) {\n var i = this.pointIndex(pos);\n if (i >= 0)\n return this.ranges[i];\n };\n\n\n this.clipRows = function(startRow, endRow) {\n var list = this.ranges;\n if (list[0].start.row > endRow || list[list.length - 1].start.row < startRow)\n return [];\n\n var startIndex = this.pointIndex({row: startRow, column: 0});\n if (startIndex < 0)\n startIndex = -startIndex - 1;\n var endIndex = this.pointIndex({row: endRow, column: 0}, startIndex);\n if (endIndex < 0)\n endIndex = -endIndex - 1;\n\n var clipped = [];\n for (var i = startIndex; i < endIndex; i++) {\n clipped.push(list[i]);\n }\n return clipped;\n };\n\n this.removeAll = function() {\n return this.ranges.splice(0, this.ranges.length);\n };\n\n this.attach = function(session) {\n if (this.session)\n this.detach();\n\n this.session = session;\n this.onChange = this.$onChange.bind(this);\n\n this.session.on('change', this.onChange);\n };\n\n this.detach = function() {\n if (!this.session)\n return;\n this.session.removeListener('change', this.onChange);\n this.session = null;\n };\n\n this.$onChange = function(delta) {\n var start = delta.start;\n var end = delta.end;\n var startRow = start.row;\n var endRow = end.row;\n var ranges = this.ranges;\n for (var i = 0, n = ranges.length; i < n; i++) {\n var r = ranges[i];\n if (r.end.row >= startRow)\n break;\n }\n \n if (delta.action == \"insert\") {\n var lineDif = endRow - startRow;\n var colDiff = -start.column + end.column;\n for (; i < n; i++) {\n var r = ranges[i];\n if (r.start.row > startRow)\n break;\n \n if (r.start.row == startRow && r.start.column >= start.column) {\n if (r.start.column == start.column && this.$bias <= 0) ; else {\n r.start.column += colDiff;\n r.start.row += lineDif;\n }\n }\n if (r.end.row == startRow && r.end.column >= start.column) {\n if (r.end.column == start.column && this.$bias < 0) {\n continue;\n }\n if (r.end.column == start.column && colDiff > 0 && i < n - 1) {\n if (r.end.column > r.start.column && r.end.column == ranges[i+1].start.column)\n r.end.column -= colDiff;\n }\n r.end.column += colDiff;\n r.end.row += lineDif;\n }\n }\n } else {\n var lineDif = startRow - endRow;\n var colDiff = start.column - end.column;\n for (; i < n; i++) {\n var r = ranges[i];\n \n if (r.start.row > endRow)\n break;\n \n if (r.end.row < endRow\n && (\n startRow < r.end.row \n || startRow == r.end.row && start.column < r.end.column\n )\n ) {\n r.end.row = startRow;\n r.end.column = start.column;\n }\n else if (r.end.row == endRow) {\n if (r.end.column <= end.column) {\n if (lineDif || r.end.column > start.column) {\n r.end.column = start.column;\n r.end.row = start.row;\n }\n }\n else {\n r.end.column += colDiff;\n r.end.row += lineDif;\n }\n }\n else if (r.end.row > endRow) {\n r.end.row += lineDif;\n }\n \n if (r.start.row < endRow\n && (\n startRow < r.start.row \n || startRow == r.start.row && start.column < r.start.column\n )\n ) {\n r.start.row = startRow;\n r.start.column = start.column;\n }\n else if (r.start.row == endRow) {\n if (r.start.column <= end.column) {\n if (lineDif || r.start.column > start.column) {\n r.start.column = start.column;\n r.start.row = start.row;\n }\n }\n else {\n r.start.column += colDiff;\n r.start.row += lineDif;\n }\n }\n else if (r.start.row > endRow) {\n r.start.row += lineDif;\n }\n }\n }\n\n if (lineDif != 0 && i < n) {\n for (; i < n; i++) {\n var r = ranges[i];\n r.start.row += lineDif;\n r.end.row += lineDif;\n }\n }\n };\n\n}).call(RangeList.prototype);\n\nexports.RangeList = RangeList;\n});\n\nace.define(\"ace/edit_session/fold\",[\"require\",\"exports\",\"module\",\"ace/range_list\",\"ace/lib/oop\"], function(require, exports, module) {\n\nvar RangeList = require(\"../range_list\").RangeList;\nvar oop = require(\"../lib/oop\");\nvar Fold = exports.Fold = function(range, placeholder) {\n this.foldLine = null;\n this.placeholder = placeholder;\n this.range = range;\n this.start = range.start;\n this.end = range.end;\n\n this.sameRow = range.start.row == range.end.row;\n this.subFolds = this.ranges = [];\n};\n\noop.inherits(Fold, RangeList);\n\n(function() {\n\n this.toString = function() {\n return '\"' + this.placeholder + '\" ' + this.range.toString();\n };\n\n this.setFoldLine = function(foldLine) {\n this.foldLine = foldLine;\n this.subFolds.forEach(function(fold) {\n fold.setFoldLine(foldLine);\n });\n };\n\n this.clone = function() {\n var range = this.range.clone();\n var fold = new Fold(range, this.placeholder);\n this.subFolds.forEach(function(subFold) {\n fold.subFolds.push(subFold.clone());\n });\n fold.collapseChildren = this.collapseChildren;\n return fold;\n };\n\n this.addSubFold = function(fold) {\n if (this.range.isEqual(fold))\n return;\n consumeRange(fold, this.start);\n\n var row = fold.start.row, column = fold.start.column;\n for (var i = 0, cmp = -1; i < this.subFolds.length; i++) {\n cmp = this.subFolds[i].range.compare(row, column);\n if (cmp != 1)\n break;\n }\n var afterStart = this.subFolds[i];\n var firstConsumed = 0;\n\n if (cmp == 0) {\n if (afterStart.range.containsRange(fold))\n return afterStart.addSubFold(fold);\n else\n firstConsumed = 1;\n }\n var row = fold.range.end.row, column = fold.range.end.column;\n for (var j = i, cmp = -1; j < this.subFolds.length; j++) {\n cmp = this.subFolds[j].range.compare(row, column);\n if (cmp != 1)\n break;\n }\n if (cmp == 0) j++;\n var consumedFolds = this.subFolds.splice(i, j - i, fold);\n var last = cmp == 0 ? consumedFolds.length - 1 : consumedFolds.length;\n for (var k = firstConsumed; k < last; k++) {\n fold.addSubFold(consumedFolds[k]);\n }\n fold.setFoldLine(this.foldLine);\n\n return fold;\n };\n \n this.restoreRange = function(range) {\n return restoreRange(range, this.start);\n };\n\n}).call(Fold.prototype);\n\nfunction consumePoint(point, anchor) {\n point.row -= anchor.row;\n if (point.row == 0)\n point.column -= anchor.column;\n}\nfunction consumeRange(range, anchor) {\n consumePoint(range.start, anchor);\n consumePoint(range.end, anchor);\n}\nfunction restorePoint(point, anchor) {\n if (point.row == 0)\n point.column += anchor.column;\n point.row += anchor.row;\n}\nfunction restoreRange(range, anchor) {\n restorePoint(range.start, anchor);\n restorePoint(range.end, anchor);\n}\n\n});\n\nace.define(\"ace/edit_session/folding\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/edit_session/fold_line\",\"ace/edit_session/fold\",\"ace/token_iterator\"], function(require, exports, module) {\n\nvar Range = require(\"../range\").Range;\nvar FoldLine = require(\"./fold_line\").FoldLine;\nvar Fold = require(\"./fold\").Fold;\nvar TokenIterator = require(\"../token_iterator\").TokenIterator;\n\nfunction Folding() {\n this.getFoldAt = function(row, column, side) {\n var foldLine = this.getFoldLine(row);\n if (!foldLine)\n return null;\n\n var folds = foldLine.folds;\n for (var i = 0; i < folds.length; i++) {\n var range = folds[i].range;\n if (range.contains(row, column)) {\n if (side == 1 && range.isEnd(row, column) && !range.isEmpty()) {\n continue;\n } else if (side == -1 && range.isStart(row, column) && !range.isEmpty()) {\n continue;\n }\n return folds[i];\n }\n }\n };\n this.getFoldsInRange = function(range) {\n var start = range.start;\n var end = range.end;\n var foldLines = this.$foldData;\n var foundFolds = [];\n\n start.column += 1;\n end.column -= 1;\n\n for (var i = 0; i < foldLines.length; i++) {\n var cmp = foldLines[i].range.compareRange(range);\n if (cmp == 2) {\n continue;\n }\n else if (cmp == -2) {\n break;\n }\n\n var folds = foldLines[i].folds;\n for (var j = 0; j < folds.length; j++) {\n var fold = folds[j];\n cmp = fold.range.compareRange(range);\n if (cmp == -2) {\n break;\n } else if (cmp == 2) {\n continue;\n } else\n if (cmp == 42) {\n break;\n }\n foundFolds.push(fold);\n }\n }\n start.column -= 1;\n end.column += 1;\n\n return foundFolds;\n };\n\n this.getFoldsInRangeList = function(ranges) {\n if (Array.isArray(ranges)) {\n var folds = [];\n ranges.forEach(function(range) {\n folds = folds.concat(this.getFoldsInRange(range));\n }, this);\n } else {\n var folds = this.getFoldsInRange(ranges);\n }\n return folds;\n };\n this.getAllFolds = function() {\n var folds = [];\n var foldLines = this.$foldData;\n \n for (var i = 0; i < foldLines.length; i++)\n for (var j = 0; j < foldLines[i].folds.length; j++)\n folds.push(foldLines[i].folds[j]);\n\n return folds;\n };\n this.getFoldStringAt = function(row, column, trim, foldLine) {\n foldLine = foldLine || this.getFoldLine(row);\n if (!foldLine)\n return null;\n\n var lastFold = {\n end: { column: 0 }\n };\n var str, fold;\n for (var i = 0; i < foldLine.folds.length; i++) {\n fold = foldLine.folds[i];\n var cmp = fold.range.compareEnd(row, column);\n if (cmp == -1) {\n str = this\n .getLine(fold.start.row)\n .substring(lastFold.end.column, fold.start.column);\n break;\n }\n else if (cmp === 0) {\n return null;\n }\n lastFold = fold;\n }\n if (!str)\n str = this.getLine(fold.start.row).substring(lastFold.end.column);\n\n if (trim == -1)\n return str.substring(0, column - lastFold.end.column);\n else if (trim == 1)\n return str.substring(column - lastFold.end.column);\n else\n return str;\n };\n\n this.getFoldLine = function(docRow, startFoldLine) {\n var foldData = this.$foldData;\n var i = 0;\n if (startFoldLine)\n i = foldData.indexOf(startFoldLine);\n if (i == -1)\n i = 0;\n for (i; i < foldData.length; i++) {\n var foldLine = foldData[i];\n if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) {\n return foldLine;\n } else if (foldLine.end.row > docRow) {\n return null;\n }\n }\n return null;\n };\n this.getNextFoldLine = function(docRow, startFoldLine) {\n var foldData = this.$foldData;\n var i = 0;\n if (startFoldLine)\n i = foldData.indexOf(startFoldLine);\n if (i == -1)\n i = 0;\n for (i; i < foldData.length; i++) {\n var foldLine = foldData[i];\n if (foldLine.end.row >= docRow) {\n return foldLine;\n }\n }\n return null;\n };\n\n this.getFoldedRowCount = function(first, last) {\n var foldData = this.$foldData, rowCount = last-first+1;\n for (var i = 0; i < foldData.length; i++) {\n var foldLine = foldData[i],\n end = foldLine.end.row,\n start = foldLine.start.row;\n if (end >= last) {\n if (start < last) {\n if (start >= first)\n rowCount -= last-start;\n else\n rowCount = 0; // in one fold\n }\n break;\n } else if (end >= first){\n if (start >= first) // fold inside range\n rowCount -= end-start;\n else\n rowCount -= end-first+1;\n }\n }\n return rowCount;\n };\n\n this.$addFoldLine = function(foldLine) {\n this.$foldData.push(foldLine);\n this.$foldData.sort(function(a, b) {\n return a.start.row - b.start.row;\n });\n return foldLine;\n };\n this.addFold = function(placeholder, range) {\n var foldData = this.$foldData;\n var added = false;\n var fold;\n \n if (placeholder instanceof Fold)\n fold = placeholder;\n else {\n fold = new Fold(range, placeholder);\n fold.collapseChildren = range.collapseChildren;\n }\n this.$clipRangeToDocument(fold.range);\n\n var startRow = fold.start.row;\n var startColumn = fold.start.column;\n var endRow = fold.end.row;\n var endColumn = fold.end.column;\n\n var startFold = this.getFoldAt(startRow, startColumn, 1);\n var endFold = this.getFoldAt(endRow, endColumn, -1);\n if (startFold && endFold == startFold)\n return startFold.addSubFold(fold);\n\n if (startFold && !startFold.range.isStart(startRow, startColumn))\n this.removeFold(startFold);\n \n if (endFold && !endFold.range.isEnd(endRow, endColumn))\n this.removeFold(endFold);\n var folds = this.getFoldsInRange(fold.range);\n if (folds.length > 0) {\n this.removeFolds(folds);\n if (!fold.collapseChildren) {\n folds.forEach(function(subFold) {\n fold.addSubFold(subFold);\n });\n }\n }\n\n for (var i = 0; i < foldData.length; i++) {\n var foldLine = foldData[i];\n if (endRow == foldLine.start.row) {\n foldLine.addFold(fold);\n added = true;\n break;\n } else if (startRow == foldLine.end.row) {\n foldLine.addFold(fold);\n added = true;\n if (!fold.sameRow) {\n var foldLineNext = foldData[i + 1];\n if (foldLineNext && foldLineNext.start.row == endRow) {\n foldLine.merge(foldLineNext);\n break;\n }\n }\n break;\n } else if (endRow <= foldLine.start.row) {\n break;\n }\n }\n\n if (!added)\n foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold));\n\n if (this.$useWrapMode)\n this.$updateWrapData(foldLine.start.row, foldLine.start.row);\n else\n this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row);\n this.$modified = true;\n this._signal(\"changeFold\", { data: fold, action: \"add\" });\n\n return fold;\n };\n\n this.addFolds = function(folds) {\n folds.forEach(function(fold) {\n this.addFold(fold);\n }, this);\n };\n\n this.removeFold = function(fold) {\n var foldLine = fold.foldLine;\n var startRow = foldLine.start.row;\n var endRow = foldLine.end.row;\n\n var foldLines = this.$foldData;\n var folds = foldLine.folds;\n if (folds.length == 1) {\n foldLines.splice(foldLines.indexOf(foldLine), 1);\n } else\n if (foldLine.range.isEnd(fold.end.row, fold.end.column)) {\n folds.pop();\n foldLine.end.row = folds[folds.length - 1].end.row;\n foldLine.end.column = folds[folds.length - 1].end.column;\n } else\n if (foldLine.range.isStart(fold.start.row, fold.start.column)) {\n folds.shift();\n foldLine.start.row = folds[0].start.row;\n foldLine.start.column = folds[0].start.column;\n } else\n if (fold.sameRow) {\n folds.splice(folds.indexOf(fold), 1);\n } else\n {\n var newFoldLine = foldLine.split(fold.start.row, fold.start.column);\n folds = newFoldLine.folds;\n folds.shift();\n newFoldLine.start.row = folds[0].start.row;\n newFoldLine.start.column = folds[0].start.column;\n }\n\n if (!this.$updating) {\n if (this.$useWrapMode)\n this.$updateWrapData(startRow, endRow);\n else\n this.$updateRowLengthCache(startRow, endRow);\n }\n this.$modified = true;\n this._signal(\"changeFold\", { data: fold, action: \"remove\" });\n };\n\n this.removeFolds = function(folds) {\n var cloneFolds = [];\n for (var i = 0; i < folds.length; i++) {\n cloneFolds.push(folds[i]);\n }\n\n cloneFolds.forEach(function(fold) {\n this.removeFold(fold);\n }, this);\n this.$modified = true;\n };\n\n this.expandFold = function(fold) {\n this.removeFold(fold);\n fold.subFolds.forEach(function(subFold) {\n fold.restoreRange(subFold);\n this.addFold(subFold);\n }, this);\n if (fold.collapseChildren > 0) {\n this.foldAll(fold.start.row+1, fold.end.row, fold.collapseChildren-1);\n }\n fold.subFolds = [];\n };\n\n this.expandFolds = function(folds) {\n folds.forEach(function(fold) {\n this.expandFold(fold);\n }, this);\n };\n\n this.unfold = function(location, expandInner) {\n var range, folds;\n if (location == null) {\n range = new Range(0, 0, this.getLength(), 0);\n if (expandInner == null) expandInner = true;\n } else if (typeof location == \"number\")\n range = new Range(location, 0, location, this.getLine(location).length);\n else if (\"row\" in location)\n range = Range.fromPoints(location, location);\n else\n range = location;\n \n folds = this.getFoldsInRangeList(range);\n if (expandInner != false) {\n this.removeFolds(folds);\n } else {\n this.expandFolds(folds);\n }\n if (folds.length)\n return folds;\n };\n this.isRowFolded = function(docRow, startFoldRow) {\n return !!this.getFoldLine(docRow, startFoldRow);\n };\n\n this.getRowFoldEnd = function(docRow, startFoldRow) {\n var foldLine = this.getFoldLine(docRow, startFoldRow);\n return foldLine ? foldLine.end.row : docRow;\n };\n\n this.getRowFoldStart = function(docRow, startFoldRow) {\n var foldLine = this.getFoldLine(docRow, startFoldRow);\n return foldLine ? foldLine.start.row : docRow;\n };\n\n this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {\n if (startRow == null)\n startRow = foldLine.start.row;\n if (startColumn == null)\n startColumn = 0;\n if (endRow == null)\n endRow = foldLine.end.row;\n if (endColumn == null)\n endColumn = this.getLine(endRow).length;\n var doc = this.doc;\n var textLine = \"\";\n\n foldLine.walk(function(placeholder, row, column, lastColumn) {\n if (row < startRow)\n return;\n if (row == startRow) {\n if (column < startColumn)\n return;\n lastColumn = Math.max(startColumn, lastColumn);\n }\n\n if (placeholder != null) {\n textLine += placeholder;\n } else {\n textLine += doc.getLine(row).substring(lastColumn, column);\n }\n }, endRow, endColumn);\n return textLine;\n };\n\n this.getDisplayLine = function(row, endColumn, startRow, startColumn) {\n var foldLine = this.getFoldLine(row);\n\n if (!foldLine) {\n var line;\n line = this.doc.getLine(row);\n return line.substring(startColumn || 0, endColumn || line.length);\n } else {\n return this.getFoldDisplayLine(\n foldLine, row, endColumn, startRow, startColumn);\n }\n };\n\n this.$cloneFoldData = function() {\n var fd = [];\n fd = this.$foldData.map(function(foldLine) {\n var folds = foldLine.folds.map(function(fold) {\n return fold.clone();\n });\n return new FoldLine(fd, folds);\n });\n\n return fd;\n };\n\n this.toggleFold = function(tryToUnfold) {\n var selection = this.selection;\n var range = selection.getRange();\n var fold;\n var bracketPos;\n\n if (range.isEmpty()) {\n var cursor = range.start;\n fold = this.getFoldAt(cursor.row, cursor.column);\n\n if (fold) {\n this.expandFold(fold);\n return;\n } else if (bracketPos = this.findMatchingBracket(cursor)) {\n if (range.comparePoint(bracketPos) == 1) {\n range.end = bracketPos;\n } else {\n range.start = bracketPos;\n range.start.column++;\n range.end.column--;\n }\n } else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {\n if (range.comparePoint(bracketPos) == 1)\n range.end = bracketPos;\n else\n range.start = bracketPos;\n\n range.start.column++;\n } else {\n range = this.getCommentFoldRange(cursor.row, cursor.column) || range;\n }\n } else {\n var folds = this.getFoldsInRange(range);\n if (tryToUnfold && folds.length) {\n this.expandFolds(folds);\n return;\n } else if (folds.length == 1 ) {\n fold = folds[0];\n }\n }\n\n if (!fold)\n fold = this.getFoldAt(range.start.row, range.start.column);\n\n if (fold && fold.range.toString() == range.toString()) {\n this.expandFold(fold);\n return;\n }\n\n var placeholder = \"...\";\n if (!range.isMultiLine()) {\n placeholder = this.getTextRange(range);\n if (placeholder.length < 4)\n return;\n placeholder = placeholder.trim().substring(0, 2) + \"..\";\n }\n\n this.addFold(placeholder, range);\n };\n\n this.getCommentFoldRange = function(row, column, dir) {\n var iterator = new TokenIterator(this, row, column);\n var token = iterator.getCurrentToken();\n var type = token && token.type;\n if (token && /^comment|string/.test(type)) {\n type = type.match(/comment|string/)[0];\n if (type == \"comment\")\n type += \"|doc-start\";\n var re = new RegExp(type);\n var range = new Range();\n if (dir != 1) {\n do {\n token = iterator.stepBackward();\n } while (token && re.test(token.type));\n iterator.stepForward();\n }\n \n range.start.row = iterator.getCurrentTokenRow();\n range.start.column = iterator.getCurrentTokenColumn() + 2;\n\n iterator = new TokenIterator(this, row, column);\n \n if (dir != -1) {\n var lastRow = -1;\n do {\n token = iterator.stepForward();\n if (lastRow == -1) {\n var state = this.getState(iterator.$row);\n if (!re.test(state))\n lastRow = iterator.$row;\n } else if (iterator.$row > lastRow) {\n break;\n }\n } while (token && re.test(token.type));\n token = iterator.stepBackward();\n } else\n token = iterator.getCurrentToken();\n\n range.end.row = iterator.getCurrentTokenRow();\n range.end.column = iterator.getCurrentTokenColumn() + token.value.length - 2;\n return range;\n }\n };\n\n this.foldAll = function(startRow, endRow, depth, test) {\n if (depth == undefined)\n depth = 100000; // JSON.stringify doesn't hanle Infinity\n var foldWidgets = this.foldWidgets;\n if (!foldWidgets)\n return; // mode doesn't support folding\n endRow = endRow || this.getLength();\n startRow = startRow || 0;\n for (var row = startRow; row < endRow; row++) {\n if (foldWidgets[row] == null)\n foldWidgets[row] = this.getFoldWidget(row);\n if (foldWidgets[row] != \"start\")\n continue;\n \n if (test && !test(row)) continue;\n\n var range = this.getFoldWidgetRange(row);\n if (range && range.isMultiLine()\n && range.end.row <= endRow\n && range.start.row >= startRow\n ) {\n row = range.end.row;\n range.collapseChildren = depth;\n this.addFold(\"...\", range);\n }\n }\n };\n \n this.foldToLevel = function(level) {\n this.foldAll();\n while (level-- > 0)\n this.unfold(null, false);\n };\n \n this.foldAllComments = function() {\n var session = this;\n this.foldAll(null, null, null, function(row) {\n var tokens = session.getTokens(row);\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n if (token.type == \"text\" && /^\\s+$/.test(token.value))\n continue;\n if (/comment/.test(token.type))\n return true;\n return false;\n }\n });\n };\n this.$foldStyles = {\n \"manual\": 1,\n \"markbegin\": 1,\n \"markbeginend\": 1\n };\n this.$foldStyle = \"markbegin\";\n this.setFoldStyle = function(style) {\n if (!this.$foldStyles[style])\n throw new Error(\"invalid fold style: \" + style + \"[\" + Object.keys(this.$foldStyles).join(\", \") + \"]\");\n \n if (this.$foldStyle == style)\n return;\n\n this.$foldStyle = style;\n \n if (style == \"manual\")\n this.unfold();\n var mode = this.$foldMode;\n this.$setFolding(null);\n this.$setFolding(mode);\n };\n\n this.$setFolding = function(foldMode) {\n if (this.$foldMode == foldMode)\n return;\n \n this.$foldMode = foldMode;\n \n this.off('change', this.$updateFoldWidgets);\n this.off('tokenizerUpdate', this.$tokenizerUpdateFoldWidgets);\n this._signal(\"changeAnnotation\");\n \n if (!foldMode || this.$foldStyle == \"manual\") {\n this.foldWidgets = null;\n return;\n }\n \n this.foldWidgets = [];\n this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle);\n this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);\n \n this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);\n this.$tokenizerUpdateFoldWidgets = this.tokenizerUpdateFoldWidgets.bind(this);\n this.on('change', this.$updateFoldWidgets);\n this.on('tokenizerUpdate', this.$tokenizerUpdateFoldWidgets);\n };\n\n this.getParentFoldRangeData = function (row, ignoreCurrent) {\n var fw = this.foldWidgets;\n if (!fw || (ignoreCurrent && fw[row]))\n return {};\n\n var i = row - 1, firstRange;\n while (i >= 0) {\n var c = fw[i];\n if (c == null)\n c = fw[i] = this.getFoldWidget(i);\n\n if (c == \"start\") {\n var range = this.getFoldWidgetRange(i);\n if (!firstRange)\n firstRange = range;\n if (range && range.end.row >= row)\n break;\n }\n i--;\n }\n\n return {\n range: i !== -1 && range,\n firstRange: firstRange\n };\n };\n\n this.onFoldWidgetClick = function(row, e) {\n e = e.domEvent;\n var options = {\n children: e.shiftKey,\n all: e.ctrlKey || e.metaKey,\n siblings: e.altKey\n };\n \n var range = this.$toggleFoldWidget(row, options);\n if (!range) {\n var el = (e.target || e.srcElement);\n if (el && /ace_fold-widget/.test(el.className))\n el.className += \" ace_invalid\";\n }\n };\n \n this.$toggleFoldWidget = function(row, options) {\n if (!this.getFoldWidget)\n return;\n var type = this.getFoldWidget(row);\n var line = this.getLine(row);\n\n var dir = type === \"end\" ? -1 : 1;\n var fold = this.getFoldAt(row, dir === -1 ? 0 : line.length, dir);\n\n if (fold) {\n if (options.children || options.all)\n this.removeFold(fold);\n else\n this.expandFold(fold);\n return fold;\n }\n\n var range = this.getFoldWidgetRange(row, true);\n if (range && !range.isMultiLine()) {\n fold = this.getFoldAt(range.start.row, range.start.column, 1);\n if (fold && range.isEqual(fold.range)) {\n this.removeFold(fold);\n return fold;\n }\n }\n \n if (options.siblings) {\n var data = this.getParentFoldRangeData(row);\n if (data.range) {\n var startRow = data.range.start.row + 1;\n var endRow = data.range.end.row;\n }\n this.foldAll(startRow, endRow, options.all ? 10000 : 0);\n } else if (options.children) {\n endRow = range ? range.end.row : this.getLength();\n this.foldAll(row + 1, endRow, options.all ? 10000 : 0);\n } else if (range) {\n if (options.all) \n range.collapseChildren = 10000;\n this.addFold(\"...\", range);\n }\n \n return range;\n };\n \n \n \n this.toggleFoldWidget = function(toggleParent) {\n var row = this.selection.getCursor().row;\n row = this.getRowFoldStart(row);\n var range = this.$toggleFoldWidget(row, {});\n \n if (range)\n return;\n var data = this.getParentFoldRangeData(row, true);\n range = data.range || data.firstRange;\n \n if (range) {\n row = range.start.row;\n var fold = this.getFoldAt(row, this.getLine(row).length, 1);\n\n if (fold) {\n this.removeFold(fold);\n } else {\n this.addFold(\"...\", range);\n }\n }\n };\n\n this.updateFoldWidgets = function(delta) {\n var firstRow = delta.start.row;\n var len = delta.end.row - firstRow;\n\n if (len === 0) {\n this.foldWidgets[firstRow] = null;\n } else if (delta.action == 'remove') {\n this.foldWidgets.splice(firstRow, len + 1, null);\n } else {\n var args = Array(len + 1);\n args.unshift(firstRow, 1);\n this.foldWidgets.splice.apply(this.foldWidgets, args);\n }\n };\n this.tokenizerUpdateFoldWidgets = function(e) {\n var rows = e.data;\n if (rows.first != rows.last) {\n if (this.foldWidgets.length > rows.first)\n this.foldWidgets.splice(rows.first, this.foldWidgets.length);\n }\n };\n}\n\nexports.Folding = Folding;\n\n});\n\nace.define(\"ace/edit_session/bracket_match\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\",\"ace/range\"], function(require, exports, module) {\n\nvar TokenIterator = require(\"../token_iterator\").TokenIterator;\nvar Range = require(\"../range\").Range;\n\n\nfunction BracketMatch() {\n\n this.findMatchingBracket = function(position, chr) {\n if (position.column == 0) return null;\n\n var charBeforeCursor = chr || this.getLine(position.row).charAt(position.column-1);\n if (charBeforeCursor == \"\") return null;\n\n var match = charBeforeCursor.match(/([\\(\\[\\{])|([\\)\\]\\}])/);\n if (!match)\n return null;\n\n if (match[1])\n return this.$findClosingBracket(match[1], position);\n else\n return this.$findOpeningBracket(match[2], position);\n };\n \n this.getBracketRange = function(pos) {\n var line = this.getLine(pos.row);\n var before = true, range;\n\n var chr = line.charAt(pos.column - 1);\n var match = chr && chr.match(/([\\(\\[\\{])|([\\)\\]\\}])/);\n if (!match) {\n chr = line.charAt(pos.column);\n pos = {row: pos.row, column: pos.column + 1};\n match = chr && chr.match(/([\\(\\[\\{])|([\\)\\]\\}])/);\n before = false;\n }\n if (!match)\n return null;\n\n if (match[1]) {\n var bracketPos = this.$findClosingBracket(match[1], pos);\n if (!bracketPos)\n return null;\n range = Range.fromPoints(pos, bracketPos);\n if (!before) {\n range.end.column++;\n range.start.column--;\n }\n range.cursor = range.end;\n } else {\n var bracketPos = this.$findOpeningBracket(match[2], pos);\n if (!bracketPos)\n return null;\n range = Range.fromPoints(bracketPos, pos);\n if (!before) {\n range.start.column++;\n range.end.column--;\n }\n range.cursor = range.start;\n }\n \n return range;\n };\n this.getMatchingBracketRanges = function(pos) {\n var line = this.getLine(pos.row);\n\n var chr = line.charAt(pos.column - 1);\n var match = chr && chr.match(/([\\(\\[\\{])|([\\)\\]\\}])/);\n if (!match) {\n chr = line.charAt(pos.column);\n pos = {row: pos.row, column: pos.column + 1};\n match = chr && chr.match(/([\\(\\[\\{])|([\\)\\]\\}])/);\n }\n\n if (!match)\n return null;\n\n var startRange = new Range(pos.row, pos.column - 1, pos.row, pos.column);\n var bracketPos = match[1] ? this.$findClosingBracket(match[1], pos)\n : this.$findOpeningBracket(match[2], pos);\n if (!bracketPos)\n return [startRange];\n var endRange = new Range(bracketPos.row, bracketPos.column, bracketPos.row, bracketPos.column + 1);\n\n return [startRange, endRange];\n };\n\n this.$brackets = {\n \")\": \"(\",\n \"(\": \")\",\n \"]\": \"[\",\n \"[\": \"]\",\n \"{\": \"}\",\n \"}\": \"{\",\n \"<\": \">\",\n \">\": \"<\"\n };\n\n this.$findOpeningBracket = function(bracket, position, typeRe) {\n var openBracket = this.$brackets[bracket];\n var depth = 1;\n\n var iterator = new TokenIterator(this, position.row, position.column);\n var token = iterator.getCurrentToken();\n if (!token)\n token = iterator.stepForward();\n if (!token)\n return;\n \n if (!typeRe){\n typeRe = new RegExp(\n \"(\\\\.?\" +\n token.type.replace(\".\", \"\\\\.\").replace(\"rparen\", \".paren\")\n .replace(/\\b(?:end)\\b/, \"(?:start|begin|end)\")\n + \")+\"\n );\n }\n var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2;\n var value = token.value;\n \n while (true) {\n \n while (valueIndex >= 0) {\n var chr = value.charAt(valueIndex);\n if (chr == openBracket) {\n depth -= 1;\n if (depth == 0) {\n return {row: iterator.getCurrentTokenRow(),\n column: valueIndex + iterator.getCurrentTokenColumn()};\n }\n }\n else if (chr == bracket) {\n depth += 1;\n }\n valueIndex -= 1;\n }\n do {\n token = iterator.stepBackward();\n } while (token && !typeRe.test(token.type));\n\n if (token == null)\n break;\n \n value = token.value;\n valueIndex = value.length - 1;\n }\n \n return null;\n };\n\n this.$findClosingBracket = function(bracket, position, typeRe) {\n var closingBracket = this.$brackets[bracket];\n var depth = 1;\n\n var iterator = new TokenIterator(this, position.row, position.column);\n var token = iterator.getCurrentToken();\n if (!token)\n token = iterator.stepForward();\n if (!token)\n return;\n\n if (!typeRe){\n typeRe = new RegExp(\n \"(\\\\.?\" +\n token.type.replace(\".\", \"\\\\.\").replace(\"lparen\", \".paren\")\n .replace(/\\b(?:start|begin)\\b/, \"(?:start|begin|end)\")\n + \")+\"\n );\n }\n var valueIndex = position.column - iterator.getCurrentTokenColumn();\n\n while (true) {\n\n var value = token.value;\n var valueLength = value.length;\n while (valueIndex < valueLength) {\n var chr = value.charAt(valueIndex);\n if (chr == closingBracket) {\n depth -= 1;\n if (depth == 0) {\n return {row: iterator.getCurrentTokenRow(),\n column: valueIndex + iterator.getCurrentTokenColumn()};\n }\n }\n else if (chr == bracket) {\n depth += 1;\n }\n valueIndex += 1;\n }\n do {\n token = iterator.stepForward();\n } while (token && !typeRe.test(token.type));\n\n if (token == null)\n break;\n\n valueIndex = 0;\n }\n \n return null;\n };\n}\nexports.BracketMatch = BracketMatch;\n\n});\n\nace.define(\"ace/edit_session\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/bidihandler\",\"ace/config\",\"ace/lib/event_emitter\",\"ace/selection\",\"ace/mode/text\",\"ace/range\",\"ace/document\",\"ace/background_tokenizer\",\"ace/search_highlight\",\"ace/edit_session/folding\",\"ace/edit_session/bracket_match\"], function(require, exports, module) {\n\nvar oop = require(\"./lib/oop\");\nvar lang = require(\"./lib/lang\");\nvar BidiHandler = require(\"./bidihandler\").BidiHandler;\nvar config = require(\"./config\");\nvar EventEmitter = require(\"./lib/event_emitter\").EventEmitter;\nvar Selection = require(\"./selection\").Selection;\nvar TextMode = require(\"./mode/text\").Mode;\nvar Range = require(\"./range\").Range;\nvar Document = require(\"./document\").Document;\nvar BackgroundTokenizer = require(\"./background_tokenizer\").BackgroundTokenizer;\nvar SearchHighlight = require(\"./search_highlight\").SearchHighlight;\n\nvar EditSession = function(text, mode) {\n this.$breakpoints = [];\n this.$decorations = [];\n this.$frontMarkers = {};\n this.$backMarkers = {};\n this.$markerId = 1;\n this.$undoSelect = true;\n\n this.$foldData = [];\n this.id = \"session\" + (++EditSession.$uid);\n this.$foldData.toString = function() {\n return this.join(\"\\n\");\n };\n this.on(\"changeFold\", this.onChangeFold.bind(this));\n this.$onChange = this.onChange.bind(this);\n\n if (typeof text != \"object\" || !text.getLine)\n text = new Document(text);\n\n this.setDocument(text);\n this.selection = new Selection(this);\n this.$bidiHandler = new BidiHandler(this);\n\n config.resetOptions(this);\n this.setMode(mode);\n config._signal(\"session\", this);\n};\n\n\nEditSession.$uid = 0;\n\n(function() {\n\n oop.implement(this, EventEmitter);\n this.setDocument = function(doc) {\n if (this.doc)\n this.doc.removeListener(\"change\", this.$onChange);\n\n this.doc = doc;\n doc.on(\"change\", this.$onChange);\n\n if (this.bgTokenizer)\n this.bgTokenizer.setDocument(this.getDocument());\n\n this.resetCaches();\n };\n this.getDocument = function() {\n return this.doc;\n };\n this.$resetRowCache = function(docRow) {\n if (!docRow) {\n this.$docRowCache = [];\n this.$screenRowCache = [];\n return;\n }\n var l = this.$docRowCache.length;\n var i = this.$getRowCacheIndex(this.$docRowCache, docRow) + 1;\n if (l > i) {\n this.$docRowCache.splice(i, l);\n this.$screenRowCache.splice(i, l);\n }\n };\n\n this.$getRowCacheIndex = function(cacheArray, val) {\n var low = 0;\n var hi = cacheArray.length - 1;\n\n while (low <= hi) {\n var mid = (low + hi) >> 1;\n var c = cacheArray[mid];\n\n if (val > c)\n low = mid + 1;\n else if (val < c)\n hi = mid - 1;\n else\n return mid;\n }\n\n return low -1;\n };\n\n this.resetCaches = function() {\n this.$modified = true;\n this.$wrapData = [];\n this.$rowLengthCache = [];\n this.$resetRowCache(0);\n if (this.bgTokenizer)\n this.bgTokenizer.start(0);\n };\n\n this.onChangeFold = function(e) {\n var fold = e.data;\n this.$resetRowCache(fold.start.row);\n };\n\n this.onChange = function(delta) {\n this.$modified = true;\n this.$bidiHandler.onChange(delta);\n this.$resetRowCache(delta.start.row);\n\n var removedFolds = this.$updateInternalDataOnChange(delta);\n if (!this.$fromUndo && this.$undoManager) {\n if (removedFolds && removedFolds.length) {\n this.$undoManager.add({\n action: \"removeFolds\",\n folds: removedFolds\n }, this.mergeUndoDeltas);\n this.mergeUndoDeltas = true;\n }\n this.$undoManager.add(delta, this.mergeUndoDeltas);\n this.mergeUndoDeltas = true;\n \n this.$informUndoManager.schedule();\n }\n\n this.bgTokenizer && this.bgTokenizer.$updateOnChange(delta);\n this._signal(\"change\", delta);\n };\n this.setValue = function(text) {\n this.doc.setValue(text);\n this.selection.moveTo(0, 0);\n\n this.$resetRowCache(0);\n this.setUndoManager(this.$undoManager);\n this.getUndoManager().reset();\n };\n this.getValue =\n this.toString = function() {\n return this.doc.getValue();\n };\n this.getSelection = function() {\n return this.selection;\n };\n this.getState = function(row) {\n return this.bgTokenizer.getState(row);\n };\n this.getTokens = function(row) {\n return this.bgTokenizer.getTokens(row);\n };\n this.getTokenAt = function(row, column) {\n var tokens = this.bgTokenizer.getTokens(row);\n var token, c = 0;\n if (column == null) {\n var i = tokens.length - 1;\n c = this.getLine(row).length;\n } else {\n for (var i = 0; i < tokens.length; i++) {\n c += tokens[i].value.length;\n if (c >= column)\n break;\n }\n }\n token = tokens[i];\n if (!token)\n return null;\n token.index = i;\n token.start = c - token.value.length;\n return token;\n };\n this.setUndoManager = function(undoManager) {\n this.$undoManager = undoManager;\n \n if (this.$informUndoManager)\n this.$informUndoManager.cancel();\n \n if (undoManager) {\n var self = this;\n undoManager.addSession(this);\n this.$syncInformUndoManager = function() {\n self.$informUndoManager.cancel();\n self.mergeUndoDeltas = false;\n };\n this.$informUndoManager = lang.delayedCall(this.$syncInformUndoManager);\n } else {\n this.$syncInformUndoManager = function() {};\n }\n };\n this.markUndoGroup = function() {\n if (this.$syncInformUndoManager)\n this.$syncInformUndoManager();\n };\n \n this.$defaultUndoManager = {\n undo: function() {},\n redo: function() {},\n hasUndo: function() {},\n hasRedo: function() {},\n reset: function() {},\n add: function() {},\n addSelection: function() {},\n startNewGroup: function() {},\n addSession: function() {}\n };\n this.getUndoManager = function() {\n return this.$undoManager || this.$defaultUndoManager;\n };\n this.getTabString = function() {\n if (this.getUseSoftTabs()) {\n return lang.stringRepeat(\" \", this.getTabSize());\n } else {\n return \"\\t\";\n }\n };\n this.setUseSoftTabs = function(val) {\n this.setOption(\"useSoftTabs\", val);\n };\n this.getUseSoftTabs = function() {\n return this.$useSoftTabs && !this.$mode.$indentWithTabs;\n };\n this.setTabSize = function(tabSize) {\n this.setOption(\"tabSize\", tabSize);\n };\n this.getTabSize = function() {\n return this.$tabSize;\n };\n this.isTabStop = function(position) {\n return this.$useSoftTabs && (position.column % this.$tabSize === 0);\n };\n this.setNavigateWithinSoftTabs = function (navigateWithinSoftTabs) {\n this.setOption(\"navigateWithinSoftTabs\", navigateWithinSoftTabs);\n };\n this.getNavigateWithinSoftTabs = function() {\n return this.$navigateWithinSoftTabs;\n };\n\n this.$overwrite = false;\n this.setOverwrite = function(overwrite) {\n this.setOption(\"overwrite\", overwrite);\n };\n this.getOverwrite = function() {\n return this.$overwrite;\n };\n this.toggleOverwrite = function() {\n this.setOverwrite(!this.$overwrite);\n };\n this.addGutterDecoration = function(row, className) {\n if (!this.$decorations[row])\n this.$decorations[row] = \"\";\n this.$decorations[row] += \" \" + className;\n this._signal(\"changeBreakpoint\", {});\n };\n this.removeGutterDecoration = function(row, className) {\n this.$decorations[row] = (this.$decorations[row] || \"\").replace(\" \" + className, \"\");\n this._signal(\"changeBreakpoint\", {});\n };\n this.getBreakpoints = function() {\n return this.$breakpoints;\n };\n this.setBreakpoints = function(rows) {\n this.$breakpoints = [];\n for (var i=0; i 0)\n inToken = !!line.charAt(column - 1).match(this.tokenRe);\n\n if (!inToken)\n inToken = !!line.charAt(column).match(this.tokenRe);\n\n if (inToken)\n var re = this.tokenRe;\n else if (/^\\s+$/.test(line.slice(column-1, column+1)))\n var re = /\\s/;\n else\n var re = this.nonTokenRe;\n\n var start = column;\n if (start > 0) {\n do {\n start--;\n }\n while (start >= 0 && line.charAt(start).match(re));\n start++;\n }\n\n var end = column;\n while (end < line.length && line.charAt(end).match(re)) {\n end++;\n }\n\n return new Range(row, start, row, end);\n };\n this.getAWordRange = function(row, column) {\n var wordRange = this.getWordRange(row, column);\n var line = this.getLine(wordRange.end.row);\n\n while (line.charAt(wordRange.end.column).match(/[ \\t]/)) {\n wordRange.end.column += 1;\n }\n return wordRange;\n };\n this.setNewLineMode = function(newLineMode) {\n this.doc.setNewLineMode(newLineMode);\n };\n this.getNewLineMode = function() {\n return this.doc.getNewLineMode();\n };\n this.setUseWorker = function(useWorker) { this.setOption(\"useWorker\", useWorker); };\n this.getUseWorker = function() { return this.$useWorker; };\n this.onReloadTokenizer = function(e) {\n var rows = e.data;\n this.bgTokenizer.start(rows.first);\n this._signal(\"tokenizerUpdate\", e);\n };\n\n this.$modes = config.$modes;\n this.$mode = null;\n this.$modeId = null;\n this.setMode = function(mode, cb) {\n if (mode && typeof mode === \"object\") {\n if (mode.getTokenizer)\n return this.$onChangeMode(mode);\n var options = mode;\n var path = options.path;\n } else {\n path = mode || \"ace/mode/text\";\n }\n if (!this.$modes[\"ace/mode/text\"])\n this.$modes[\"ace/mode/text\"] = new TextMode();\n\n if (this.$modes[path] && !options) {\n this.$onChangeMode(this.$modes[path]);\n cb && cb();\n return;\n }\n this.$modeId = path;\n config.loadModule([\"mode\", path], function(m) {\n if (this.$modeId !== path)\n return cb && cb();\n if (this.$modes[path] && !options) {\n this.$onChangeMode(this.$modes[path]);\n } else if (m && m.Mode) {\n m = new m.Mode(options);\n if (!options) {\n this.$modes[path] = m;\n m.$id = path;\n }\n this.$onChangeMode(m);\n }\n cb && cb();\n }.bind(this));\n if (!this.$mode)\n this.$onChangeMode(this.$modes[\"ace/mode/text\"], true);\n };\n\n this.$onChangeMode = function(mode, $isPlaceholder) {\n if (!$isPlaceholder)\n this.$modeId = mode.$id;\n if (this.$mode === mode) \n return;\n \n var oldMode = this.$mode;\n this.$mode = mode;\n\n this.$stopWorker();\n\n if (this.$useWorker)\n this.$startWorker();\n\n var tokenizer = mode.getTokenizer();\n\n if(tokenizer.on !== undefined) {\n var onReloadTokenizer = this.onReloadTokenizer.bind(this);\n tokenizer.on(\"update\", onReloadTokenizer);\n }\n\n if (!this.bgTokenizer) {\n this.bgTokenizer = new BackgroundTokenizer(tokenizer);\n var _self = this;\n this.bgTokenizer.on(\"update\", function(e) {\n _self._signal(\"tokenizerUpdate\", e);\n });\n } else {\n this.bgTokenizer.setTokenizer(tokenizer);\n }\n\n this.bgTokenizer.setDocument(this.getDocument());\n\n this.tokenRe = mode.tokenRe;\n this.nonTokenRe = mode.nonTokenRe;\n\n \n if (!$isPlaceholder) {\n if (mode.attachToSession)\n mode.attachToSession(this);\n this.$options.wrapMethod.set.call(this, this.$wrapMethod);\n this.$setFolding(mode.foldingRules);\n this.bgTokenizer.start(0);\n this._emit(\"changeMode\", {oldMode: oldMode, mode: mode});\n }\n };\n\n this.$stopWorker = function() {\n if (this.$worker) {\n this.$worker.terminate();\n this.$worker = null;\n }\n };\n\n this.$startWorker = function() {\n try {\n this.$worker = this.$mode.createWorker(this);\n } catch (e) {\n config.warn(\"Could not load worker\", e);\n this.$worker = null;\n }\n };\n this.getMode = function() {\n return this.$mode;\n };\n\n this.$scrollTop = 0;\n this.setScrollTop = function(scrollTop) {\n if (this.$scrollTop === scrollTop || isNaN(scrollTop))\n return;\n\n this.$scrollTop = scrollTop;\n this._signal(\"changeScrollTop\", scrollTop);\n };\n this.getScrollTop = function() {\n return this.$scrollTop;\n };\n\n this.$scrollLeft = 0;\n this.setScrollLeft = function(scrollLeft) {\n if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft))\n return;\n\n this.$scrollLeft = scrollLeft;\n this._signal(\"changeScrollLeft\", scrollLeft);\n };\n this.getScrollLeft = function() {\n return this.$scrollLeft;\n };\n this.getScreenWidth = function() {\n this.$computeWidth();\n if (this.lineWidgets) \n return Math.max(this.getLineWidgetMaxWidth(), this.screenWidth);\n return this.screenWidth;\n };\n \n this.getLineWidgetMaxWidth = function() {\n if (this.lineWidgetsWidth != null) return this.lineWidgetsWidth;\n var width = 0;\n this.lineWidgets.forEach(function(w) {\n if (w && w.screenWidth > width)\n width = w.screenWidth;\n });\n return this.lineWidgetWidth = width;\n };\n\n this.$computeWidth = function(force) {\n if (this.$modified || force) {\n this.$modified = false;\n\n if (this.$useWrapMode)\n return this.screenWidth = this.$wrapLimit;\n\n var lines = this.doc.getAllLines();\n var cache = this.$rowLengthCache;\n var longestScreenLine = 0;\n var foldIndex = 0;\n var foldLine = this.$foldData[foldIndex];\n var foldStart = foldLine ? foldLine.start.row : Infinity;\n var len = lines.length;\n\n for (var i = 0; i < len; i++) {\n if (i > foldStart) {\n i = foldLine.end.row + 1;\n if (i >= len)\n break;\n foldLine = this.$foldData[foldIndex++];\n foldStart = foldLine ? foldLine.start.row : Infinity;\n }\n\n if (cache[i] == null)\n cache[i] = this.$getStringScreenWidth(lines[i])[0];\n\n if (cache[i] > longestScreenLine)\n longestScreenLine = cache[i];\n }\n this.screenWidth = longestScreenLine;\n }\n };\n this.getLine = function(row) {\n return this.doc.getLine(row);\n };\n this.getLines = function(firstRow, lastRow) {\n return this.doc.getLines(firstRow, lastRow);\n };\n this.getLength = function() {\n return this.doc.getLength();\n };\n this.getTextRange = function(range) {\n return this.doc.getTextRange(range || this.selection.getRange());\n };\n this.insert = function(position, text) {\n return this.doc.insert(position, text);\n };\n this.remove = function(range) {\n return this.doc.remove(range);\n };\n this.removeFullLines = function(firstRow, lastRow){\n return this.doc.removeFullLines(firstRow, lastRow);\n };\n this.undoChanges = function(deltas, dontSelect) {\n if (!deltas.length)\n return;\n\n this.$fromUndo = true;\n for (var i = deltas.length - 1; i != -1; i--) {\n var delta = deltas[i];\n if (delta.action == \"insert\" || delta.action == \"remove\") {\n this.doc.revertDelta(delta);\n } else if (delta.folds) {\n this.addFolds(delta.folds);\n }\n }\n if (!dontSelect && this.$undoSelect) {\n if (deltas.selectionBefore)\n this.selection.fromJSON(deltas.selectionBefore);\n else\n this.selection.setRange(this.$getUndoSelection(deltas, true));\n }\n this.$fromUndo = false;\n };\n this.redoChanges = function(deltas, dontSelect) {\n if (!deltas.length)\n return;\n\n this.$fromUndo = true;\n for (var i = 0; i < deltas.length; i++) {\n var delta = deltas[i];\n if (delta.action == \"insert\" || delta.action == \"remove\") {\n this.doc.$safeApplyDelta(delta);\n }\n }\n\n if (!dontSelect && this.$undoSelect) {\n if (deltas.selectionAfter)\n this.selection.fromJSON(deltas.selectionAfter);\n else\n this.selection.setRange(this.$getUndoSelection(deltas, false));\n }\n this.$fromUndo = false;\n };\n this.setUndoSelect = function(enable) {\n this.$undoSelect = enable;\n };\n\n this.$getUndoSelection = function(deltas, isUndo) {\n function isInsert(delta) {\n return isUndo ? delta.action !== \"insert\" : delta.action === \"insert\";\n }\n\n var range, point;\n\n for (var i = 0; i < deltas.length; i++) {\n var delta = deltas[i];\n if (!delta.start) continue; // skip folds\n if (!range) {\n if (isInsert(delta)) {\n range = Range.fromPoints(delta.start, delta.end);\n } else {\n range = Range.fromPoints(delta.start, delta.start);\n }\n continue;\n }\n \n if (isInsert(delta)) {\n point = delta.start;\n if (range.compare(point.row, point.column) == -1) {\n range.setStart(point);\n }\n point = delta.end;\n if (range.compare(point.row, point.column) == 1) {\n range.setEnd(point);\n }\n } else {\n point = delta.start;\n if (range.compare(point.row, point.column) == -1) {\n range = Range.fromPoints(delta.start, delta.start);\n }\n }\n }\n return range;\n };\n this.replace = function(range, text) {\n return this.doc.replace(range, text);\n };\n this.moveText = function(fromRange, toPosition, copy) {\n var text = this.getTextRange(fromRange);\n var folds = this.getFoldsInRange(fromRange);\n\n var toRange = Range.fromPoints(toPosition, toPosition);\n if (!copy) {\n this.remove(fromRange);\n var rowDiff = fromRange.start.row - fromRange.end.row;\n var collDiff = rowDiff ? -fromRange.end.column : fromRange.start.column - fromRange.end.column;\n if (collDiff) {\n if (toRange.start.row == fromRange.end.row && toRange.start.column > fromRange.end.column)\n toRange.start.column += collDiff;\n if (toRange.end.row == fromRange.end.row && toRange.end.column > fromRange.end.column)\n toRange.end.column += collDiff;\n }\n if (rowDiff && toRange.start.row >= fromRange.end.row) {\n toRange.start.row += rowDiff;\n toRange.end.row += rowDiff;\n }\n }\n\n toRange.end = this.insert(toRange.start, text);\n if (folds.length) {\n var oldStart = fromRange.start;\n var newStart = toRange.start;\n var rowDiff = newStart.row - oldStart.row;\n var collDiff = newStart.column - oldStart.column;\n this.addFolds(folds.map(function(x) {\n x = x.clone();\n if (x.start.row == oldStart.row)\n x.start.column += collDiff;\n if (x.end.row == oldStart.row)\n x.end.column += collDiff;\n x.start.row += rowDiff;\n x.end.row += rowDiff;\n return x;\n }));\n }\n\n return toRange;\n };\n this.indentRows = function(startRow, endRow, indentString) {\n indentString = indentString.replace(/\\t/g, this.getTabString());\n for (var row=startRow; row<=endRow; row++)\n this.doc.insertInLine({row: row, column: 0}, indentString);\n };\n this.outdentRows = function (range) {\n var rowRange = range.collapseRows();\n var deleteRange = new Range(0, 0, 0, 0);\n var size = this.getTabSize();\n\n for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) {\n var line = this.getLine(i);\n\n deleteRange.start.row = i;\n deleteRange.end.row = i;\n for (var j = 0; j < size; ++j)\n if (line.charAt(j) != ' ')\n break;\n if (j < size && line.charAt(j) == '\\t') {\n deleteRange.start.column = j;\n deleteRange.end.column = j + 1;\n } else {\n deleteRange.start.column = 0;\n deleteRange.end.column = j;\n }\n this.remove(deleteRange);\n }\n };\n\n this.$moveLines = function(firstRow, lastRow, dir) {\n firstRow = this.getRowFoldStart(firstRow);\n lastRow = this.getRowFoldEnd(lastRow);\n if (dir < 0) {\n var row = this.getRowFoldStart(firstRow + dir);\n if (row < 0) return 0;\n var diff = row-firstRow;\n } else if (dir > 0) {\n var row = this.getRowFoldEnd(lastRow + dir);\n if (row > this.doc.getLength()-1) return 0;\n var diff = row-lastRow;\n } else {\n firstRow = this.$clipRowToDocument(firstRow);\n lastRow = this.$clipRowToDocument(lastRow);\n var diff = lastRow - firstRow + 1;\n }\n\n var range = new Range(firstRow, 0, lastRow, Number.MAX_VALUE);\n var folds = this.getFoldsInRange(range).map(function(x){\n x = x.clone();\n x.start.row += diff;\n x.end.row += diff;\n return x;\n });\n \n var lines = dir == 0\n ? this.doc.getLines(firstRow, lastRow)\n : this.doc.removeFullLines(firstRow, lastRow);\n this.doc.insertFullLines(firstRow+diff, lines);\n folds.length && this.addFolds(folds);\n return diff;\n };\n this.moveLinesUp = function(firstRow, lastRow) {\n return this.$moveLines(firstRow, lastRow, -1);\n };\n this.moveLinesDown = function(firstRow, lastRow) {\n return this.$moveLines(firstRow, lastRow, 1);\n };\n this.duplicateLines = function(firstRow, lastRow) {\n return this.$moveLines(firstRow, lastRow, 0);\n };\n\n\n this.$clipRowToDocument = function(row) {\n return Math.max(0, Math.min(row, this.doc.getLength()-1));\n };\n\n this.$clipColumnToRow = function(row, column) {\n if (column < 0)\n return 0;\n return Math.min(this.doc.getLine(row).length, column);\n };\n\n\n this.$clipPositionToDocument = function(row, column) {\n column = Math.max(0, column);\n\n if (row < 0) {\n row = 0;\n column = 0;\n } else {\n var len = this.doc.getLength();\n if (row >= len) {\n row = len - 1;\n column = this.doc.getLine(len-1).length;\n } else {\n column = Math.min(this.doc.getLine(row).length, column);\n }\n }\n\n return {\n row: row,\n column: column\n };\n };\n\n this.$clipRangeToDocument = function(range) {\n if (range.start.row < 0) {\n range.start.row = 0;\n range.start.column = 0;\n } else {\n range.start.column = this.$clipColumnToRow(\n range.start.row,\n range.start.column\n );\n }\n\n var len = this.doc.getLength() - 1;\n if (range.end.row > len) {\n range.end.row = len;\n range.end.column = this.doc.getLine(len).length;\n } else {\n range.end.column = this.$clipColumnToRow(\n range.end.row,\n range.end.column\n );\n }\n return range;\n };\n this.$wrapLimit = 80;\n this.$useWrapMode = false;\n this.$wrapLimitRange = {\n min : null,\n max : null\n };\n this.setUseWrapMode = function(useWrapMode) {\n if (useWrapMode != this.$useWrapMode) {\n this.$useWrapMode = useWrapMode;\n this.$modified = true;\n this.$resetRowCache(0);\n if (useWrapMode) {\n var len = this.getLength();\n this.$wrapData = Array(len);\n this.$updateWrapData(0, len - 1);\n }\n\n this._signal(\"changeWrapMode\");\n }\n };\n this.getUseWrapMode = function() {\n return this.$useWrapMode;\n };\n this.setWrapLimitRange = function(min, max) {\n if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {\n this.$wrapLimitRange = { min: min, max: max };\n this.$modified = true;\n this.$bidiHandler.markAsDirty();\n if (this.$useWrapMode)\n this._signal(\"changeWrapMode\");\n }\n };\n this.adjustWrapLimit = function(desiredLimit, $printMargin) {\n var limits = this.$wrapLimitRange;\n if (limits.max < 0)\n limits = {min: $printMargin, max: $printMargin};\n var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max);\n if (wrapLimit != this.$wrapLimit && wrapLimit > 1) {\n this.$wrapLimit = wrapLimit;\n this.$modified = true;\n if (this.$useWrapMode) {\n this.$updateWrapData(0, this.getLength() - 1);\n this.$resetRowCache(0);\n this._signal(\"changeWrapLimit\");\n }\n return true;\n }\n return false;\n };\n\n this.$constrainWrapLimit = function(wrapLimit, min, max) {\n if (min)\n wrapLimit = Math.max(min, wrapLimit);\n\n if (max)\n wrapLimit = Math.min(max, wrapLimit);\n\n return wrapLimit;\n };\n this.getWrapLimit = function() {\n return this.$wrapLimit;\n };\n this.setWrapLimit = function (limit) {\n this.setWrapLimitRange(limit, limit);\n };\n this.getWrapLimitRange = function() {\n return {\n min : this.$wrapLimitRange.min,\n max : this.$wrapLimitRange.max\n };\n };\n\n this.$updateInternalDataOnChange = function(delta) {\n var useWrapMode = this.$useWrapMode;\n var action = delta.action;\n var start = delta.start;\n var end = delta.end;\n var firstRow = start.row;\n var lastRow = end.row;\n var len = lastRow - firstRow;\n var removedFolds = null;\n \n this.$updating = true;\n if (len != 0) {\n if (action === \"remove\") {\n this[useWrapMode ? \"$wrapData\" : \"$rowLengthCache\"].splice(firstRow, len);\n\n var foldLines = this.$foldData;\n removedFolds = this.getFoldsInRange(delta);\n this.removeFolds(removedFolds);\n\n var foldLine = this.getFoldLine(end.row);\n var idx = 0;\n if (foldLine) {\n foldLine.addRemoveChars(end.row, end.column, start.column - end.column);\n foldLine.shiftRow(-len);\n\n var foldLineBefore = this.getFoldLine(firstRow);\n if (foldLineBefore && foldLineBefore !== foldLine) {\n foldLineBefore.merge(foldLine);\n foldLine = foldLineBefore;\n }\n idx = foldLines.indexOf(foldLine) + 1;\n }\n\n for (idx; idx < foldLines.length; idx++) {\n var foldLine = foldLines[idx];\n if (foldLine.start.row >= end.row) {\n foldLine.shiftRow(-len);\n }\n }\n\n lastRow = firstRow;\n } else {\n var args = Array(len);\n args.unshift(firstRow, 0);\n var arr = useWrapMode ? this.$wrapData : this.$rowLengthCache;\n arr.splice.apply(arr, args);\n var foldLines = this.$foldData;\n var foldLine = this.getFoldLine(firstRow);\n var idx = 0;\n if (foldLine) {\n var cmp = foldLine.range.compareInside(start.row, start.column);\n if (cmp == 0) {\n foldLine = foldLine.split(start.row, start.column);\n if (foldLine) {\n foldLine.shiftRow(len);\n foldLine.addRemoveChars(lastRow, 0, end.column - start.column);\n }\n } else\n if (cmp == -1) {\n foldLine.addRemoveChars(firstRow, 0, end.column - start.column);\n foldLine.shiftRow(len);\n }\n idx = foldLines.indexOf(foldLine) + 1;\n }\n\n for (idx; idx < foldLines.length; idx++) {\n var foldLine = foldLines[idx];\n if (foldLine.start.row >= firstRow) {\n foldLine.shiftRow(len);\n }\n }\n }\n } else {\n len = Math.abs(delta.start.column - delta.end.column);\n if (action === \"remove\") {\n removedFolds = this.getFoldsInRange(delta);\n this.removeFolds(removedFolds);\n\n len = -len;\n }\n var foldLine = this.getFoldLine(firstRow);\n if (foldLine) {\n foldLine.addRemoveChars(firstRow, start.column, len);\n }\n }\n\n if (useWrapMode && this.$wrapData.length != this.doc.getLength()) {\n console.error(\"doc.getLength() and $wrapData.length have to be the same!\");\n }\n this.$updating = false;\n\n if (useWrapMode)\n this.$updateWrapData(firstRow, lastRow);\n else\n this.$updateRowLengthCache(firstRow, lastRow);\n\n return removedFolds;\n };\n\n this.$updateRowLengthCache = function(firstRow, lastRow, b) {\n this.$rowLengthCache[firstRow] = null;\n this.$rowLengthCache[lastRow] = null;\n };\n\n this.$updateWrapData = function(firstRow, lastRow) {\n var lines = this.doc.getAllLines();\n var tabSize = this.getTabSize();\n var wrapData = this.$wrapData;\n var wrapLimit = this.$wrapLimit;\n var tokens;\n var foldLine;\n\n var row = firstRow;\n lastRow = Math.min(lastRow, lines.length - 1);\n while (row <= lastRow) {\n foldLine = this.getFoldLine(row, foldLine);\n if (!foldLine) {\n tokens = this.$getDisplayTokens(lines[row]);\n wrapData[row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);\n row ++;\n } else {\n tokens = [];\n foldLine.walk(function(placeholder, row, column, lastColumn) {\n var walkTokens;\n if (placeholder != null) {\n walkTokens = this.$getDisplayTokens(\n placeholder, tokens.length);\n walkTokens[0] = PLACEHOLDER_START;\n for (var i = 1; i < walkTokens.length; i++) {\n walkTokens[i] = PLACEHOLDER_BODY;\n }\n } else {\n walkTokens = this.$getDisplayTokens(\n lines[row].substring(lastColumn, column),\n tokens.length);\n }\n tokens = tokens.concat(walkTokens);\n }.bind(this),\n foldLine.end.row,\n lines[foldLine.end.row].length + 1\n );\n\n wrapData[foldLine.start.row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);\n row = foldLine.end.row + 1;\n }\n }\n };\n var CHAR = 1,\n CHAR_EXT = 2,\n PLACEHOLDER_START = 3,\n PLACEHOLDER_BODY = 4,\n PUNCTUATION = 9,\n SPACE = 10,\n TAB = 11,\n TAB_SPACE = 12;\n\n\n this.$computeWrapSplits = function(tokens, wrapLimit, tabSize) {\n if (tokens.length == 0) {\n return [];\n }\n\n var splits = [];\n var displayLength = tokens.length;\n var lastSplit = 0, lastDocSplit = 0;\n\n var isCode = this.$wrapAsCode;\n\n var indentedSoftWrap = this.$indentedSoftWrap;\n var maxIndent = wrapLimit <= Math.max(2 * tabSize, 8)\n || indentedSoftWrap === false ? 0 : Math.floor(wrapLimit / 2);\n\n function getWrapIndent() {\n var indentation = 0;\n if (maxIndent === 0)\n return indentation;\n if (indentedSoftWrap) {\n for (var i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n if (token == SPACE)\n indentation += 1;\n else if (token == TAB)\n indentation += tabSize;\n else if (token == TAB_SPACE)\n continue;\n else\n break;\n }\n }\n if (isCode && indentedSoftWrap !== false)\n indentation += tabSize;\n return Math.min(indentation, maxIndent);\n }\n function addSplit(screenPos) {\n var len = screenPos - lastSplit;\n for (var i = lastSplit; i < screenPos; i++) {\n var ch = tokens[i];\n if (ch === 12 || ch === 2) len -= 1;\n }\n\n if (!splits.length) {\n indent = getWrapIndent();\n splits.indent = indent;\n }\n lastDocSplit += len;\n splits.push(lastDocSplit);\n lastSplit = screenPos;\n }\n var indent = 0;\n while (displayLength - lastSplit > wrapLimit - indent) {\n var split = lastSplit + wrapLimit - indent;\n if (tokens[split - 1] >= SPACE && tokens[split] >= SPACE) {\n addSplit(split);\n continue;\n }\n if (tokens[split] == PLACEHOLDER_START || tokens[split] == PLACEHOLDER_BODY) {\n for (split; split != lastSplit - 1; split--) {\n if (tokens[split] == PLACEHOLDER_START) {\n break;\n }\n }\n if (split > lastSplit) {\n addSplit(split);\n continue;\n }\n split = lastSplit + wrapLimit;\n for (split; split < tokens.length; split++) {\n if (tokens[split] != PLACEHOLDER_BODY) {\n break;\n }\n }\n if (split == tokens.length) {\n break; // Breaks the while-loop.\n }\n addSplit(split);\n continue;\n }\n var minSplit = Math.max(split - (wrapLimit -(wrapLimit>>2)), lastSplit - 1);\n while (split > minSplit && tokens[split] < PLACEHOLDER_START) {\n split --;\n }\n if (isCode) {\n while (split > minSplit && tokens[split] < PLACEHOLDER_START) {\n split --;\n }\n while (split > minSplit && tokens[split] == PUNCTUATION) {\n split --;\n }\n } else {\n while (split > minSplit && tokens[split] < SPACE) {\n split --;\n }\n }\n if (split > minSplit) {\n addSplit(++split);\n continue;\n }\n split = lastSplit + wrapLimit;\n if (tokens[split] == CHAR_EXT)\n split--;\n addSplit(split - indent);\n }\n return splits;\n };\n this.$getDisplayTokens = function(str, offset) {\n var arr = [];\n var tabSize;\n offset = offset || 0;\n\n for (var i = 0; i < str.length; i++) {\n var c = str.charCodeAt(i);\n if (c == 9) {\n tabSize = this.getScreenTabSize(arr.length + offset);\n arr.push(TAB);\n for (var n = 1; n < tabSize; n++) {\n arr.push(TAB_SPACE);\n }\n }\n else if (c == 32) {\n arr.push(SPACE);\n } else if((c > 39 && c < 48) || (c > 57 && c < 64)) {\n arr.push(PUNCTUATION);\n }\n else if (c >= 0x1100 && isFullWidth(c)) {\n arr.push(CHAR, CHAR_EXT);\n } else {\n arr.push(CHAR);\n }\n }\n return arr;\n };\n this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {\n if (maxScreenColumn == 0)\n return [0, 0];\n if (maxScreenColumn == null)\n maxScreenColumn = Infinity;\n screenColumn = screenColumn || 0;\n\n var c, column;\n for (column = 0; column < str.length; column++) {\n c = str.charCodeAt(column);\n if (c == 9) {\n screenColumn += this.getScreenTabSize(screenColumn);\n }\n else if (c >= 0x1100 && isFullWidth(c)) {\n screenColumn += 2;\n } else {\n screenColumn += 1;\n }\n if (screenColumn > maxScreenColumn) {\n break;\n }\n }\n\n return [screenColumn, column];\n };\n\n this.lineWidgets = null;\n this.getRowLength = function(row) {\n var h = 1;\n if (this.lineWidgets)\n h += this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;\n \n if (!this.$useWrapMode || !this.$wrapData[row])\n return h;\n else\n return this.$wrapData[row].length + h;\n };\n this.getRowLineCount = function(row) {\n if (!this.$useWrapMode || !this.$wrapData[row]) {\n return 1;\n } else {\n return this.$wrapData[row].length + 1;\n }\n };\n\n this.getRowWrapIndent = function(screenRow) {\n if (this.$useWrapMode) {\n var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);\n var splits = this.$wrapData[pos.row];\n return splits.length && splits[0] < pos.column ? splits.indent : 0;\n } else {\n return 0;\n }\n };\n this.getScreenLastRowColumn = function(screenRow) {\n var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);\n return this.documentToScreenColumn(pos.row, pos.column);\n };\n this.getDocumentLastRowColumn = function(docRow, docColumn) {\n var screenRow = this.documentToScreenRow(docRow, docColumn);\n return this.getScreenLastRowColumn(screenRow);\n };\n this.getDocumentLastRowColumnPosition = function(docRow, docColumn) {\n var screenRow = this.documentToScreenRow(docRow, docColumn);\n return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10);\n };\n this.getRowSplitData = function(row) {\n if (!this.$useWrapMode) {\n return undefined;\n } else {\n return this.$wrapData[row];\n }\n };\n this.getScreenTabSize = function(screenColumn) {\n return this.$tabSize - (screenColumn % this.$tabSize | 0);\n };\n\n\n this.screenToDocumentRow = function(screenRow, screenColumn) {\n return this.screenToDocumentPosition(screenRow, screenColumn).row;\n };\n\n\n this.screenToDocumentColumn = function(screenRow, screenColumn) {\n return this.screenToDocumentPosition(screenRow, screenColumn).column;\n };\n this.screenToDocumentPosition = function(screenRow, screenColumn, offsetX) {\n if (screenRow < 0)\n return {row: 0, column: 0};\n\n var line;\n var docRow = 0;\n var docColumn = 0;\n var column;\n var row = 0;\n var rowLength = 0;\n\n var rowCache = this.$screenRowCache;\n var i = this.$getRowCacheIndex(rowCache, screenRow);\n var l = rowCache.length;\n if (l && i >= 0) {\n var row = rowCache[i];\n var docRow = this.$docRowCache[i];\n var doCache = screenRow > rowCache[l - 1];\n } else {\n var doCache = !l;\n }\n\n var maxRow = this.getLength() - 1;\n var foldLine = this.getNextFoldLine(docRow);\n var foldStart = foldLine ? foldLine.start.row : Infinity;\n\n while (row <= screenRow) {\n rowLength = this.getRowLength(docRow);\n if (row + rowLength > screenRow || docRow >= maxRow) {\n break;\n } else {\n row += rowLength;\n docRow++;\n if (docRow > foldStart) {\n docRow = foldLine.end.row+1;\n foldLine = this.getNextFoldLine(docRow, foldLine);\n foldStart = foldLine ? foldLine.start.row : Infinity;\n }\n }\n\n if (doCache) {\n this.$docRowCache.push(docRow);\n this.$screenRowCache.push(row);\n }\n }\n\n if (foldLine && foldLine.start.row <= docRow) {\n line = this.getFoldDisplayLine(foldLine);\n docRow = foldLine.start.row;\n } else if (row + rowLength <= screenRow || docRow > maxRow) {\n return {\n row: maxRow,\n column: this.getLine(maxRow).length\n };\n } else {\n line = this.getLine(docRow);\n foldLine = null;\n }\n var wrapIndent = 0, splitIndex = Math.floor(screenRow - row);\n if (this.$useWrapMode) {\n var splits = this.$wrapData[docRow];\n if (splits) {\n column = splits[splitIndex];\n if(splitIndex > 0 && splits.length) {\n wrapIndent = splits.indent;\n docColumn = splits[splitIndex - 1] || splits[splits.length - 1];\n line = line.substring(docColumn);\n }\n }\n }\n\n if (offsetX !== undefined && this.$bidiHandler.isBidiRow(row + splitIndex, docRow, splitIndex))\n screenColumn = this.$bidiHandler.offsetToCol(offsetX);\n\n docColumn += this.$getStringScreenWidth(line, screenColumn - wrapIndent)[1];\n if (this.$useWrapMode && docColumn >= column)\n docColumn = column - 1;\n\n if (foldLine)\n return foldLine.idxToPosition(docColumn);\n\n return {row: docRow, column: docColumn};\n };\n this.documentToScreenPosition = function(docRow, docColumn) {\n if (typeof docColumn === \"undefined\")\n var pos = this.$clipPositionToDocument(docRow.row, docRow.column);\n else\n pos = this.$clipPositionToDocument(docRow, docColumn);\n\n docRow = pos.row;\n docColumn = pos.column;\n\n var screenRow = 0;\n var foldStartRow = null;\n var fold = null;\n fold = this.getFoldAt(docRow, docColumn, 1);\n if (fold) {\n docRow = fold.start.row;\n docColumn = fold.start.column;\n }\n\n var rowEnd, row = 0;\n\n\n var rowCache = this.$docRowCache;\n var i = this.$getRowCacheIndex(rowCache, docRow);\n var l = rowCache.length;\n if (l && i >= 0) {\n var row = rowCache[i];\n var screenRow = this.$screenRowCache[i];\n var doCache = docRow > rowCache[l - 1];\n } else {\n var doCache = !l;\n }\n\n var foldLine = this.getNextFoldLine(row);\n var foldStart = foldLine ?foldLine.start.row :Infinity;\n\n while (row < docRow) {\n if (row >= foldStart) {\n rowEnd = foldLine.end.row + 1;\n if (rowEnd > docRow)\n break;\n foldLine = this.getNextFoldLine(rowEnd, foldLine);\n foldStart = foldLine ?foldLine.start.row :Infinity;\n }\n else {\n rowEnd = row + 1;\n }\n\n screenRow += this.getRowLength(row);\n row = rowEnd;\n\n if (doCache) {\n this.$docRowCache.push(row);\n this.$screenRowCache.push(screenRow);\n }\n }\n var textLine = \"\";\n if (foldLine && row >= foldStart) {\n textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn);\n foldStartRow = foldLine.start.row;\n } else {\n textLine = this.getLine(docRow).substring(0, docColumn);\n foldStartRow = docRow;\n }\n var wrapIndent = 0;\n if (this.$useWrapMode) {\n var wrapRow = this.$wrapData[foldStartRow];\n if (wrapRow) {\n var screenRowOffset = 0;\n while (textLine.length >= wrapRow[screenRowOffset]) {\n screenRow ++;\n screenRowOffset++;\n }\n textLine = textLine.substring(\n wrapRow[screenRowOffset - 1] || 0, textLine.length\n );\n wrapIndent = screenRowOffset > 0 ? wrapRow.indent : 0;\n }\n }\n \n if (this.lineWidgets && this.lineWidgets[row] && this.lineWidgets[row].rowsAbove)\n screenRow += this.lineWidgets[row].rowsAbove;\n\n return {\n row: screenRow,\n column: wrapIndent + this.$getStringScreenWidth(textLine)[0]\n };\n };\n this.documentToScreenColumn = function(row, docColumn) {\n return this.documentToScreenPosition(row, docColumn).column;\n };\n this.documentToScreenRow = function(docRow, docColumn) {\n return this.documentToScreenPosition(docRow, docColumn).row;\n };\n this.getScreenLength = function() {\n var screenRows = 0;\n var fold = null;\n if (!this.$useWrapMode) {\n screenRows = this.getLength();\n var foldData = this.$foldData;\n for (var i = 0; i < foldData.length; i++) {\n fold = foldData[i];\n screenRows -= fold.end.row - fold.start.row;\n }\n } else {\n var lastRow = this.$wrapData.length;\n var row = 0, i = 0;\n var fold = this.$foldData[i++];\n var foldStart = fold ? fold.start.row :Infinity;\n\n while (row < lastRow) {\n var splits = this.$wrapData[row];\n screenRows += splits ? splits.length + 1 : 1;\n row ++;\n if (row > foldStart) {\n row = fold.end.row+1;\n fold = this.$foldData[i++];\n foldStart = fold ?fold.start.row :Infinity;\n }\n }\n }\n if (this.lineWidgets)\n screenRows += this.$getWidgetScreenLength();\n\n return screenRows;\n };\n this.$setFontMetrics = function(fm) {\n if (!this.$enableVarChar) return;\n this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {\n if (maxScreenColumn === 0)\n return [0, 0];\n if (!maxScreenColumn)\n maxScreenColumn = Infinity;\n screenColumn = screenColumn || 0;\n \n var c, column;\n for (column = 0; column < str.length; column++) {\n c = str.charAt(column);\n if (c === \"\\t\") {\n screenColumn += this.getScreenTabSize(screenColumn);\n } else {\n screenColumn += fm.getCharacterWidth(c);\n }\n if (screenColumn > maxScreenColumn) {\n break;\n }\n }\n \n return [screenColumn, column];\n };\n };\n \n this.destroy = function() {\n if (this.bgTokenizer) {\n this.bgTokenizer.setDocument(null);\n this.bgTokenizer = null;\n }\n this.$stopWorker();\n this.removeAllListeners();\n this.selection.detach();\n };\n\n this.isFullWidth = isFullWidth;\n function isFullWidth(c) {\n if (c < 0x1100)\n return false;\n return c >= 0x1100 && c <= 0x115F ||\n c >= 0x11A3 && c <= 0x11A7 ||\n c >= 0x11FA && c <= 0x11FF ||\n c >= 0x2329 && c <= 0x232A ||\n c >= 0x2E80 && c <= 0x2E99 ||\n c >= 0x2E9B && c <= 0x2EF3 ||\n c >= 0x2F00 && c <= 0x2FD5 ||\n c >= 0x2FF0 && c <= 0x2FFB ||\n c >= 0x3000 && c <= 0x303E ||\n c >= 0x3041 && c <= 0x3096 ||\n c >= 0x3099 && c <= 0x30FF ||\n c >= 0x3105 && c <= 0x312D ||\n c >= 0x3131 && c <= 0x318E ||\n c >= 0x3190 && c <= 0x31BA ||\n c >= 0x31C0 && c <= 0x31E3 ||\n c >= 0x31F0 && c <= 0x321E ||\n c >= 0x3220 && c <= 0x3247 ||\n c >= 0x3250 && c <= 0x32FE ||\n c >= 0x3300 && c <= 0x4DBF ||\n c >= 0x4E00 && c <= 0xA48C ||\n c >= 0xA490 && c <= 0xA4C6 ||\n c >= 0xA960 && c <= 0xA97C ||\n c >= 0xAC00 && c <= 0xD7A3 ||\n c >= 0xD7B0 && c <= 0xD7C6 ||\n c >= 0xD7CB && c <= 0xD7FB ||\n c >= 0xF900 && c <= 0xFAFF ||\n c >= 0xFE10 && c <= 0xFE19 ||\n c >= 0xFE30 && c <= 0xFE52 ||\n c >= 0xFE54 && c <= 0xFE66 ||\n c >= 0xFE68 && c <= 0xFE6B ||\n c >= 0xFF01 && c <= 0xFF60 ||\n c >= 0xFFE0 && c <= 0xFFE6;\n }\n\n}).call(EditSession.prototype);\n\nrequire(\"./edit_session/folding\").Folding.call(EditSession.prototype);\nrequire(\"./edit_session/bracket_match\").BracketMatch.call(EditSession.prototype);\n\n\nconfig.defineOptions(EditSession.prototype, \"session\", {\n wrap: {\n set: function(value) {\n if (!value || value == \"off\")\n value = false;\n else if (value == \"free\")\n value = true;\n else if (value == \"printMargin\")\n value = -1;\n else if (typeof value == \"string\")\n value = parseInt(value, 10) || false;\n\n if (this.$wrap == value)\n return;\n this.$wrap = value;\n if (!value) {\n this.setUseWrapMode(false);\n } else {\n var col = typeof value == \"number\" ? value : null;\n this.setWrapLimitRange(col, col);\n this.setUseWrapMode(true);\n }\n },\n get: function() {\n if (this.getUseWrapMode()) {\n if (this.$wrap == -1)\n return \"printMargin\";\n if (!this.getWrapLimitRange().min)\n return \"free\";\n return this.$wrap;\n }\n return \"off\";\n },\n handlesSet: true\n }, \n wrapMethod: {\n set: function(val) {\n val = val == \"auto\"\n ? this.$mode.type != \"text\"\n : val != \"text\";\n if (val != this.$wrapAsCode) {\n this.$wrapAsCode = val;\n if (this.$useWrapMode) {\n this.$useWrapMode = false;\n this.setUseWrapMode(true);\n }\n }\n },\n initialValue: \"auto\"\n },\n indentedSoftWrap: {\n set: function() {\n if (this.$useWrapMode) {\n this.$useWrapMode = false;\n this.setUseWrapMode(true);\n }\n },\n initialValue: true \n },\n firstLineNumber: {\n set: function() {this._signal(\"changeBreakpoint\");},\n initialValue: 1\n },\n useWorker: {\n set: function(useWorker) {\n this.$useWorker = useWorker;\n\n this.$stopWorker();\n if (useWorker)\n this.$startWorker();\n },\n initialValue: true\n },\n useSoftTabs: {initialValue: true},\n tabSize: {\n set: function(tabSize) {\n tabSize = parseInt(tabSize);\n if (tabSize > 0 && this.$tabSize !== tabSize) {\n this.$modified = true;\n this.$rowLengthCache = [];\n this.$tabSize = tabSize;\n this._signal(\"changeTabSize\");\n }\n },\n initialValue: 4,\n handlesSet: true\n },\n navigateWithinSoftTabs: {initialValue: false},\n foldStyle: {\n set: function(val) {this.setFoldStyle(val);},\n handlesSet: true\n },\n overwrite: {\n set: function(val) {this._signal(\"changeOverwrite\");},\n initialValue: false\n },\n newLineMode: {\n set: function(val) {this.doc.setNewLineMode(val);},\n get: function() {return this.doc.getNewLineMode();},\n handlesSet: true\n },\n mode: {\n set: function(val) { this.setMode(val); },\n get: function() { return this.$modeId; },\n handlesSet: true\n }\n});\n\nexports.EditSession = EditSession;\n});\n\nace.define(\"ace/search\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\",\"ace/lib/oop\",\"ace/range\"], function(require, exports, module) {\n\nvar lang = require(\"./lib/lang\");\nvar oop = require(\"./lib/oop\");\nvar Range = require(\"./range\").Range;\n\nvar Search = function() {\n this.$options = {};\n};\n\n(function() {\n this.set = function(options) {\n oop.mixin(this.$options, options);\n return this;\n };\n this.getOptions = function() {\n return lang.copyObject(this.$options);\n };\n this.setOptions = function(options) {\n this.$options = options;\n };\n this.find = function(session) {\n var options = this.$options;\n var iterator = this.$matchIterator(session, options);\n if (!iterator)\n return false;\n\n var firstRange = null;\n iterator.forEach(function(sr, sc, er, ec) {\n firstRange = new Range(sr, sc, er, ec);\n if (sc == ec && options.start && options.start.start\n && options.skipCurrent != false && firstRange.isEqual(options.start)\n ) {\n firstRange = null;\n return false;\n }\n \n return true;\n });\n\n return firstRange;\n };\n this.findAll = function(session) {\n var options = this.$options;\n if (!options.needle)\n return [];\n this.$assembleRegExp(options);\n\n var range = options.range;\n var lines = range\n ? session.getLines(range.start.row, range.end.row)\n : session.doc.getAllLines();\n\n var ranges = [];\n var re = options.re;\n if (options.$isMultiLine) {\n var len = re.length;\n var maxRow = lines.length - len;\n var prevRange;\n outer: for (var row = re.offset || 0; row <= maxRow; row++) {\n for (var j = 0; j < len; j++)\n if (lines[row + j].search(re[j]) == -1)\n continue outer;\n \n var startLine = lines[row];\n var line = lines[row + len - 1];\n var startIndex = startLine.length - startLine.match(re[0])[0].length;\n var endIndex = line.match(re[len - 1])[0].length;\n \n if (prevRange && prevRange.end.row === row &&\n prevRange.end.column > startIndex\n ) {\n continue;\n }\n ranges.push(prevRange = new Range(\n row, startIndex, row + len - 1, endIndex\n ));\n if (len > 2)\n row = row + len - 2;\n }\n } else {\n for (var i = 0; i < lines.length; i++) {\n var matches = lang.getMatchOffsets(lines[i], re);\n for (var j = 0; j < matches.length; j++) {\n var match = matches[j];\n ranges.push(new Range(i, match.offset, i, match.offset + match.length));\n }\n }\n }\n\n if (range) {\n var startColumn = range.start.column;\n var endColumn = range.start.column;\n var i = 0, j = ranges.length - 1;\n while (i < j && ranges[i].start.column < startColumn && ranges[i].start.row == range.start.row)\n i++;\n\n while (i < j && ranges[j].end.column > endColumn && ranges[j].end.row == range.end.row)\n j--;\n \n ranges = ranges.slice(i, j + 1);\n for (i = 0, j = ranges.length; i < j; i++) {\n ranges[i].start.row += range.start.row;\n ranges[i].end.row += range.start.row;\n }\n }\n\n return ranges;\n };\n this.replace = function(input, replacement) {\n var options = this.$options;\n\n var re = this.$assembleRegExp(options);\n if (options.$isMultiLine)\n return replacement;\n\n if (!re)\n return;\n\n var match = re.exec(input);\n if (!match || match[0].length != input.length)\n return null;\n \n replacement = input.replace(re, replacement);\n if (options.preserveCase) {\n replacement = replacement.split(\"\");\n for (var i = Math.min(input.length, input.length); i--; ) {\n var ch = input[i];\n if (ch && ch.toLowerCase() != ch)\n replacement[i] = replacement[i].toUpperCase();\n else\n replacement[i] = replacement[i].toLowerCase();\n }\n replacement = replacement.join(\"\");\n }\n \n return replacement;\n };\n\n this.$assembleRegExp = function(options, $disableFakeMultiline) {\n if (options.needle instanceof RegExp)\n return options.re = options.needle;\n\n var needle = options.needle;\n\n if (!options.needle)\n return options.re = false;\n\n if (!options.regExp)\n needle = lang.escapeRegExp(needle);\n\n if (options.wholeWord)\n needle = addWordBoundary(needle, options);\n\n var modifier = options.caseSensitive ? \"gm\" : \"gmi\";\n\n options.$isMultiLine = !$disableFakeMultiline && /[\\n\\r]/.test(needle);\n if (options.$isMultiLine)\n return options.re = this.$assembleMultilineRegExp(needle, modifier);\n\n try {\n var re = new RegExp(needle, modifier);\n } catch(e) {\n re = false;\n }\n return options.re = re;\n };\n\n this.$assembleMultilineRegExp = function(needle, modifier) {\n var parts = needle.replace(/\\r\\n|\\r|\\n/g, \"$\\n^\").split(\"\\n\");\n var re = [];\n for (var i = 0; i < parts.length; i++) try {\n re.push(new RegExp(parts[i], modifier));\n } catch(e) {\n return false;\n }\n return re;\n };\n\n this.$matchIterator = function(session, options) {\n var re = this.$assembleRegExp(options);\n if (!re)\n return false;\n var backwards = options.backwards == true;\n var skipCurrent = options.skipCurrent != false;\n\n var range = options.range;\n var start = options.start;\n if (!start)\n start = range ? range[backwards ? \"end\" : \"start\"] : session.selection.getRange();\n \n if (start.start)\n start = start[skipCurrent != backwards ? \"end\" : \"start\"];\n\n var firstRow = range ? range.start.row : 0;\n var lastRow = range ? range.end.row : session.getLength() - 1;\n \n if (backwards) {\n var forEach = function(callback) {\n var row = start.row;\n if (forEachInLine(row, start.column, callback))\n return;\n for (row--; row >= firstRow; row--)\n if (forEachInLine(row, Number.MAX_VALUE, callback))\n return;\n if (options.wrap == false)\n return;\n for (row = lastRow, firstRow = start.row; row >= firstRow; row--)\n if (forEachInLine(row, Number.MAX_VALUE, callback))\n return;\n };\n }\n else {\n var forEach = function(callback) {\n var row = start.row;\n if (forEachInLine(row, start.column, callback))\n return;\n for (row = row + 1; row <= lastRow; row++)\n if (forEachInLine(row, 0, callback))\n return;\n if (options.wrap == false)\n return;\n for (row = firstRow, lastRow = start.row; row <= lastRow; row++)\n if (forEachInLine(row, 0, callback))\n return;\n };\n }\n \n if (options.$isMultiLine) {\n var len = re.length;\n var forEachInLine = function(row, offset, callback) {\n var startRow = backwards ? row - len + 1 : row;\n if (startRow < 0) return;\n var line = session.getLine(startRow);\n var startIndex = line.search(re[0]);\n if (!backwards && startIndex < offset || startIndex === -1) return;\n for (var i = 1; i < len; i++) {\n line = session.getLine(startRow + i);\n if (line.search(re[i]) == -1)\n return;\n }\n var endIndex = line.match(re[len - 1])[0].length;\n if (backwards && endIndex > offset) return;\n if (callback(startRow, startIndex, startRow + len - 1, endIndex))\n return true;\n };\n }\n else if (backwards) {\n var forEachInLine = function(row, endIndex, callback) {\n var line = session.getLine(row);\n var matches = [];\n var m, last = 0;\n re.lastIndex = 0;\n while((m = re.exec(line))) {\n var length = m[0].length;\n last = m.index;\n if (!length) {\n if (last >= line.length) break;\n re.lastIndex = last += 1;\n }\n if (m.index + length > endIndex)\n break;\n matches.push(m.index, length);\n }\n for (var i = matches.length - 1; i >= 0; i -= 2) {\n var column = matches[i - 1];\n var length = matches[i];\n if (callback(row, column, row, column + length))\n return true;\n }\n };\n }\n else {\n var forEachInLine = function(row, startIndex, callback) {\n var line = session.getLine(row);\n var last;\n var m;\n re.lastIndex = startIndex;\n while((m = re.exec(line))) {\n var length = m[0].length;\n last = m.index;\n if (callback(row, last, row,last + length))\n return true;\n if (!length) {\n re.lastIndex = last += 1;\n if (last >= line.length) return false;\n }\n }\n };\n }\n return {forEach: forEach};\n };\n\n}).call(Search.prototype);\n\nfunction addWordBoundary(needle, options) {\n function wordBoundary(c) {\n if (/\\w/.test(c) || options.regExp) return \"\\\\b\";\n return \"\";\n }\n return wordBoundary(needle[0]) + needle\n + wordBoundary(needle[needle.length - 1]);\n}\n\nexports.Search = Search;\n});\n\nace.define(\"ace/keyboard/hash_handler\",[\"require\",\"exports\",\"module\",\"ace/lib/keys\",\"ace/lib/useragent\"], function(require, exports, module) {\n\nvar keyUtil = require(\"../lib/keys\");\nvar useragent = require(\"../lib/useragent\");\nvar KEY_MODS = keyUtil.KEY_MODS;\n\nfunction HashHandler(config, platform) {\n this.platform = platform || (useragent.isMac ? \"mac\" : \"win\");\n this.commands = {};\n this.commandKeyBinding = {};\n this.addCommands(config);\n this.$singleCommand = true;\n}\n\nfunction MultiHashHandler(config, platform) {\n HashHandler.call(this, config, platform);\n this.$singleCommand = false;\n}\n\nMultiHashHandler.prototype = HashHandler.prototype;\n\n(function() {\n \n\n this.addCommand = function(command) {\n if (this.commands[command.name])\n this.removeCommand(command);\n\n this.commands[command.name] = command;\n\n if (command.bindKey)\n this._buildKeyHash(command);\n };\n\n this.removeCommand = function(command, keepCommand) {\n var name = command && (typeof command === 'string' ? command : command.name);\n command = this.commands[name];\n if (!keepCommand)\n delete this.commands[name];\n var ckb = this.commandKeyBinding;\n for (var keyId in ckb) {\n var cmdGroup = ckb[keyId];\n if (cmdGroup == command) {\n delete ckb[keyId];\n } else if (Array.isArray(cmdGroup)) {\n var i = cmdGroup.indexOf(command);\n if (i != -1) {\n cmdGroup.splice(i, 1);\n if (cmdGroup.length == 1)\n ckb[keyId] = cmdGroup[0];\n }\n }\n }\n };\n\n this.bindKey = function(key, command, position) {\n if (typeof key == \"object\" && key) {\n if (position == undefined)\n position = key.position;\n key = key[this.platform];\n }\n if (!key)\n return;\n if (typeof command == \"function\")\n return this.addCommand({exec: command, bindKey: key, name: command.name || key});\n \n key.split(\"|\").forEach(function(keyPart) {\n var chain = \"\";\n if (keyPart.indexOf(\" \") != -1) {\n var parts = keyPart.split(/\\s+/);\n keyPart = parts.pop();\n parts.forEach(function(keyPart) {\n var binding = this.parseKeys(keyPart);\n var id = KEY_MODS[binding.hashId] + binding.key;\n chain += (chain ? \" \" : \"\") + id;\n this._addCommandToBinding(chain, \"chainKeys\");\n }, this);\n chain += \" \";\n }\n var binding = this.parseKeys(keyPart);\n var id = KEY_MODS[binding.hashId] + binding.key;\n this._addCommandToBinding(chain + id, command, position);\n }, this);\n };\n \n function getPosition(command) {\n return typeof command == \"object\" && command.bindKey\n && command.bindKey.position \n || (command.isDefault ? -100 : 0);\n }\n this._addCommandToBinding = function(keyId, command, position) {\n var ckb = this.commandKeyBinding, i;\n if (!command) {\n delete ckb[keyId];\n } else if (!ckb[keyId] || this.$singleCommand) {\n ckb[keyId] = command;\n } else {\n if (!Array.isArray(ckb[keyId])) {\n ckb[keyId] = [ckb[keyId]];\n } else if ((i = ckb[keyId].indexOf(command)) != -1) {\n ckb[keyId].splice(i, 1);\n }\n \n if (typeof position != \"number\") {\n position = getPosition(command);\n }\n\n var commands = ckb[keyId];\n for (i = 0; i < commands.length; i++) {\n var other = commands[i];\n var otherPos = getPosition(other);\n if (otherPos > position)\n break;\n }\n commands.splice(i, 0, command);\n }\n };\n\n this.addCommands = function(commands) {\n commands && Object.keys(commands).forEach(function(name) {\n var command = commands[name];\n if (!command)\n return;\n \n if (typeof command === \"string\")\n return this.bindKey(command, name);\n\n if (typeof command === \"function\")\n command = { exec: command };\n\n if (typeof command !== \"object\")\n return;\n\n if (!command.name)\n command.name = name;\n\n this.addCommand(command);\n }, this);\n };\n\n this.removeCommands = function(commands) {\n Object.keys(commands).forEach(function(name) {\n this.removeCommand(commands[name]);\n }, this);\n };\n\n this.bindKeys = function(keyList) {\n Object.keys(keyList).forEach(function(key) {\n this.bindKey(key, keyList[key]);\n }, this);\n };\n\n this._buildKeyHash = function(command) {\n this.bindKey(command.bindKey, command);\n };\n this.parseKeys = function(keys) {\n var parts = keys.toLowerCase().split(/[\\-\\+]([\\-\\+])?/).filter(function(x){return x;});\n var key = parts.pop();\n\n var keyCode = keyUtil[key];\n if (keyUtil.FUNCTION_KEYS[keyCode])\n key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase();\n else if (!parts.length)\n return {key: key, hashId: -1};\n else if (parts.length == 1 && parts[0] == \"shift\")\n return {key: key.toUpperCase(), hashId: -1};\n\n var hashId = 0;\n for (var i = parts.length; i--;) {\n var modifier = keyUtil.KEY_MODS[parts[i]];\n if (modifier == null) {\n if (typeof console != \"undefined\")\n console.error(\"invalid modifier \" + parts[i] + \" in \" + keys);\n return false;\n }\n hashId |= modifier;\n }\n return {key: key, hashId: hashId};\n };\n\n this.findKeyCommand = function findKeyCommand(hashId, keyString) {\n var key = KEY_MODS[hashId] + keyString;\n return this.commandKeyBinding[key];\n };\n\n this.handleKeyboard = function(data, hashId, keyString, keyCode) {\n if (keyCode < 0) return;\n var key = KEY_MODS[hashId] + keyString;\n var command = this.commandKeyBinding[key];\n if (data.$keyChain) {\n data.$keyChain += \" \" + key;\n command = this.commandKeyBinding[data.$keyChain] || command;\n }\n \n if (command) {\n if (command == \"chainKeys\" || command[command.length - 1] == \"chainKeys\") {\n data.$keyChain = data.$keyChain || key;\n return {command: \"null\"};\n }\n }\n \n if (data.$keyChain) {\n if ((!hashId || hashId == 4) && keyString.length == 1)\n data.$keyChain = data.$keyChain.slice(0, -key.length - 1); // wait for input\n else if (hashId == -1 || keyCode > 0)\n data.$keyChain = \"\"; // reset keyChain\n }\n return {command: command};\n };\n \n this.getStatusText = function(editor, data) {\n return data.$keyChain || \"\";\n };\n\n}).call(HashHandler.prototype);\n\nexports.HashHandler = HashHandler;\nexports.MultiHashHandler = MultiHashHandler;\n});\n\nace.define(\"ace/commands/command_manager\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/keyboard/hash_handler\",\"ace/lib/event_emitter\"], function(require, exports, module) {\n\nvar oop = require(\"../lib/oop\");\nvar MultiHashHandler = require(\"../keyboard/hash_handler\").MultiHashHandler;\nvar EventEmitter = require(\"../lib/event_emitter\").EventEmitter;\n\nvar CommandManager = function(platform, commands) {\n MultiHashHandler.call(this, commands, platform);\n this.byName = this.commands;\n this.setDefaultHandler(\"exec\", function(e) {\n return e.command.exec(e.editor, e.args || {});\n });\n};\n\noop.inherits(CommandManager, MultiHashHandler);\n\n(function() {\n\n oop.implement(this, EventEmitter);\n\n this.exec = function(command, editor, args) {\n if (Array.isArray(command)) {\n for (var i = command.length; i--; ) {\n if (this.exec(command[i], editor, args)) return true;\n }\n return false;\n }\n\n if (typeof command === \"string\")\n command = this.commands[command];\n\n if (!command)\n return false;\n\n if (editor && editor.$readOnly && !command.readOnly)\n return false;\n\n if (this.$checkCommandState != false && command.isAvailable && !command.isAvailable(editor))\n return false;\n\n var e = {editor: editor, command: command, args: args};\n e.returnValue = this._emit(\"exec\", e);\n this._signal(\"afterExec\", e);\n\n return e.returnValue === false ? false : true;\n };\n\n this.toggleRecording = function(editor) {\n if (this.$inReplay)\n return;\n\n editor && editor._emit(\"changeStatus\");\n if (this.recording) {\n this.macro.pop();\n this.off(\"exec\", this.$addCommandToMacro);\n\n if (!this.macro.length)\n this.macro = this.oldMacro;\n\n return this.recording = false;\n }\n if (!this.$addCommandToMacro) {\n this.$addCommandToMacro = function(e) {\n this.macro.push([e.command, e.args]);\n }.bind(this);\n }\n\n this.oldMacro = this.macro;\n this.macro = [];\n this.on(\"exec\", this.$addCommandToMacro);\n return this.recording = true;\n };\n\n this.replay = function(editor) {\n if (this.$inReplay || !this.macro)\n return;\n\n if (this.recording)\n return this.toggleRecording(editor);\n\n try {\n this.$inReplay = true;\n this.macro.forEach(function(x) {\n if (typeof x == \"string\")\n this.exec(x, editor);\n else\n this.exec(x[0], editor, x[1]);\n }, this);\n } finally {\n this.$inReplay = false;\n }\n };\n\n this.trimMacro = function(m) {\n return m.map(function(x){\n if (typeof x[0] != \"string\")\n x[0] = x[0].name;\n if (!x[1])\n x = x[0];\n return x;\n });\n };\n\n}).call(CommandManager.prototype);\n\nexports.CommandManager = CommandManager;\n\n});\n\nace.define(\"ace/commands/default_commands\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\",\"ace/config\",\"ace/range\"], function(require, exports, module) {\n\nvar lang = require(\"../lib/lang\");\nvar config = require(\"../config\");\nvar Range = require(\"../range\").Range;\n\nfunction bindKey(win, mac) {\n return {win: win, mac: mac};\n}\nexports.commands = [{\n name: \"showSettingsMenu\",\n bindKey: bindKey(\"Ctrl-,\", \"Command-,\"),\n exec: function(editor) {\n config.loadModule(\"ace/ext/settings_menu\", function(module) {\n module.init(editor);\n editor.showSettingsMenu();\n });\n },\n readOnly: true\n}, {\n name: \"goToNextError\",\n bindKey: bindKey(\"Alt-E\", \"F4\"),\n exec: function(editor) {\n config.loadModule(\"./ext/error_marker\", function(module) {\n module.showErrorMarker(editor, 1);\n });\n },\n scrollIntoView: \"animate\",\n readOnly: true\n}, {\n name: \"goToPreviousError\",\n bindKey: bindKey(\"Alt-Shift-E\", \"Shift-F4\"),\n exec: function(editor) {\n config.loadModule(\"./ext/error_marker\", function(module) {\n module.showErrorMarker(editor, -1);\n });\n },\n scrollIntoView: \"animate\",\n readOnly: true\n}, {\n name: \"selectall\",\n description: \"Select all\",\n bindKey: bindKey(\"Ctrl-A\", \"Command-A\"),\n exec: function(editor) { editor.selectAll(); },\n readOnly: true\n}, {\n name: \"centerselection\",\n description: \"Center selection\",\n bindKey: bindKey(null, \"Ctrl-L\"),\n exec: function(editor) { editor.centerSelection(); },\n readOnly: true\n}, {\n name: \"gotoline\",\n description: \"Go to line...\",\n bindKey: bindKey(\"Ctrl-L\", \"Command-L\"),\n exec: function(editor, line) {\n if (typeof line === \"number\" && !isNaN(line))\n editor.gotoLine(line);\n editor.prompt({ $type: \"gotoLine\" });\n },\n readOnly: true\n}, {\n name: \"fold\",\n bindKey: bindKey(\"Alt-L|Ctrl-F1\", \"Command-Alt-L|Command-F1\"),\n exec: function(editor) { editor.session.toggleFold(false); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"unfold\",\n bindKey: bindKey(\"Alt-Shift-L|Ctrl-Shift-F1\", \"Command-Alt-Shift-L|Command-Shift-F1\"),\n exec: function(editor) { editor.session.toggleFold(true); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"toggleFoldWidget\",\n bindKey: bindKey(\"F2\", \"F2\"),\n exec: function(editor) { editor.session.toggleFoldWidget(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"toggleParentFoldWidget\",\n bindKey: bindKey(\"Alt-F2\", \"Alt-F2\"),\n exec: function(editor) { editor.session.toggleFoldWidget(true); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"foldall\",\n description: \"Fold all\",\n bindKey: bindKey(null, \"Ctrl-Command-Option-0\"),\n exec: function(editor) { editor.session.foldAll(); },\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"foldAllComments\",\n description: \"Fold all comments\",\n bindKey: bindKey(null, \"Ctrl-Command-Option-0\"),\n exec: function(editor) { editor.session.foldAllComments(); },\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"foldOther\",\n description: \"Fold other\",\n bindKey: bindKey(\"Alt-0\", \"Command-Option-0\"),\n exec: function(editor) { \n editor.session.foldAll();\n editor.session.unfold(editor.selection.getAllRanges());\n },\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"unfoldall\",\n description: \"Unfold all\",\n bindKey: bindKey(\"Alt-Shift-0\", \"Command-Option-Shift-0\"),\n exec: function(editor) { editor.session.unfold(); },\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"findnext\",\n description: \"Find next\",\n bindKey: bindKey(\"Ctrl-K\", \"Command-G\"),\n exec: function(editor) { editor.findNext(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"findprevious\",\n description: \"Find previous\",\n bindKey: bindKey(\"Ctrl-Shift-K\", \"Command-Shift-G\"),\n exec: function(editor) { editor.findPrevious(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"center\",\n readOnly: true\n}, {\n name: \"selectOrFindNext\",\n description: \"Select or find next\",\n bindKey: bindKey(\"Alt-K\", \"Ctrl-G\"),\n exec: function(editor) {\n if (editor.selection.isEmpty())\n editor.selection.selectWord();\n else\n editor.findNext(); \n },\n readOnly: true\n}, {\n name: \"selectOrFindPrevious\",\n description: \"Select or find previous\",\n bindKey: bindKey(\"Alt-Shift-K\", \"Ctrl-Shift-G\"),\n exec: function(editor) { \n if (editor.selection.isEmpty())\n editor.selection.selectWord();\n else\n editor.findPrevious();\n },\n readOnly: true\n}, {\n name: \"find\",\n description: \"Find\",\n bindKey: bindKey(\"Ctrl-F\", \"Command-F\"),\n exec: function(editor) {\n config.loadModule(\"ace/ext/searchbox\", function(e) {e.Search(editor);});\n },\n readOnly: true\n}, {\n name: \"overwrite\",\n description: \"Overwrite\",\n bindKey: \"Insert\",\n exec: function(editor) { editor.toggleOverwrite(); },\n readOnly: true\n}, {\n name: \"selecttostart\",\n description: \"Select to start\",\n bindKey: bindKey(\"Ctrl-Shift-Home\", \"Command-Shift-Home|Command-Shift-Up\"),\n exec: function(editor) { editor.getSelection().selectFileStart(); },\n multiSelectAction: \"forEach\",\n readOnly: true,\n scrollIntoView: \"animate\",\n aceCommandGroup: \"fileJump\"\n}, {\n name: \"gotostart\",\n description: \"Go to start\",\n bindKey: bindKey(\"Ctrl-Home\", \"Command-Home|Command-Up\"),\n exec: function(editor) { editor.navigateFileStart(); },\n multiSelectAction: \"forEach\",\n readOnly: true,\n scrollIntoView: \"animate\",\n aceCommandGroup: \"fileJump\"\n}, {\n name: \"selectup\",\n description: \"Select up\",\n bindKey: bindKey(\"Shift-Up\", \"Shift-Up|Ctrl-Shift-P\"),\n exec: function(editor) { editor.getSelection().selectUp(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"golineup\",\n description: \"Go line up\",\n bindKey: bindKey(\"Up\", \"Up|Ctrl-P\"),\n exec: function(editor, args) { editor.navigateUp(args.times); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selecttoend\",\n description: \"Select to end\",\n bindKey: bindKey(\"Ctrl-Shift-End\", \"Command-Shift-End|Command-Shift-Down\"),\n exec: function(editor) { editor.getSelection().selectFileEnd(); },\n multiSelectAction: \"forEach\",\n readOnly: true,\n scrollIntoView: \"animate\",\n aceCommandGroup: \"fileJump\"\n}, {\n name: \"gotoend\",\n description: \"Go to end\",\n bindKey: bindKey(\"Ctrl-End\", \"Command-End|Command-Down\"),\n exec: function(editor) { editor.navigateFileEnd(); },\n multiSelectAction: \"forEach\",\n readOnly: true,\n scrollIntoView: \"animate\",\n aceCommandGroup: \"fileJump\"\n}, {\n name: \"selectdown\",\n description: \"Select down\",\n bindKey: bindKey(\"Shift-Down\", \"Shift-Down|Ctrl-Shift-N\"),\n exec: function(editor) { editor.getSelection().selectDown(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"golinedown\",\n description: \"Go line down\",\n bindKey: bindKey(\"Down\", \"Down|Ctrl-N\"),\n exec: function(editor, args) { editor.navigateDown(args.times); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectwordleft\",\n description: \"Select word left\",\n bindKey: bindKey(\"Ctrl-Shift-Left\", \"Option-Shift-Left\"),\n exec: function(editor) { editor.getSelection().selectWordLeft(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"gotowordleft\",\n description: \"Go to word left\",\n bindKey: bindKey(\"Ctrl-Left\", \"Option-Left\"),\n exec: function(editor) { editor.navigateWordLeft(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selecttolinestart\",\n description: \"Select to line start\",\n bindKey: bindKey(\"Alt-Shift-Left\", \"Command-Shift-Left|Ctrl-Shift-A\"),\n exec: function(editor) { editor.getSelection().selectLineStart(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"gotolinestart\",\n description: \"Go to line start\",\n bindKey: bindKey(\"Alt-Left|Home\", \"Command-Left|Home|Ctrl-A\"),\n exec: function(editor) { editor.navigateLineStart(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectleft\",\n description: \"Select left\",\n bindKey: bindKey(\"Shift-Left\", \"Shift-Left|Ctrl-Shift-B\"),\n exec: function(editor) { editor.getSelection().selectLeft(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"gotoleft\",\n description: \"Go to left\",\n bindKey: bindKey(\"Left\", \"Left|Ctrl-B\"),\n exec: function(editor, args) { editor.navigateLeft(args.times); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectwordright\",\n description: \"Select word right\",\n bindKey: bindKey(\"Ctrl-Shift-Right\", \"Option-Shift-Right\"),\n exec: function(editor) { editor.getSelection().selectWordRight(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"gotowordright\",\n description: \"Go to word right\",\n bindKey: bindKey(\"Ctrl-Right\", \"Option-Right\"),\n exec: function(editor) { editor.navigateWordRight(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selecttolineend\",\n description: \"Select to line end\",\n bindKey: bindKey(\"Alt-Shift-Right\", \"Command-Shift-Right|Shift-End|Ctrl-Shift-E\"),\n exec: function(editor) { editor.getSelection().selectLineEnd(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"gotolineend\",\n description: \"Go to line end\",\n bindKey: bindKey(\"Alt-Right|End\", \"Command-Right|End|Ctrl-E\"),\n exec: function(editor) { editor.navigateLineEnd(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectright\",\n description: \"Select right\",\n bindKey: bindKey(\"Shift-Right\", \"Shift-Right\"),\n exec: function(editor) { editor.getSelection().selectRight(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"gotoright\",\n description: \"Go to right\",\n bindKey: bindKey(\"Right\", \"Right|Ctrl-F\"),\n exec: function(editor, args) { editor.navigateRight(args.times); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectpagedown\",\n description: \"Select page down\",\n bindKey: \"Shift-PageDown\",\n exec: function(editor) { editor.selectPageDown(); },\n readOnly: true\n}, {\n name: \"pagedown\",\n description: \"Page down\",\n bindKey: bindKey(null, \"Option-PageDown\"),\n exec: function(editor) { editor.scrollPageDown(); },\n readOnly: true\n}, {\n name: \"gotopagedown\",\n description: \"Go to page down\",\n bindKey: bindKey(\"PageDown\", \"PageDown|Ctrl-V\"),\n exec: function(editor) { editor.gotoPageDown(); },\n readOnly: true\n}, {\n name: \"selectpageup\",\n description: \"Select page up\",\n bindKey: \"Shift-PageUp\",\n exec: function(editor) { editor.selectPageUp(); },\n readOnly: true\n}, {\n name: \"pageup\",\n description: \"Page up\",\n bindKey: bindKey(null, \"Option-PageUp\"),\n exec: function(editor) { editor.scrollPageUp(); },\n readOnly: true\n}, {\n name: \"gotopageup\",\n description: \"Go to page up\",\n bindKey: \"PageUp\",\n exec: function(editor) { editor.gotoPageUp(); },\n readOnly: true\n}, {\n name: \"scrollup\",\n description: \"Scroll up\",\n bindKey: bindKey(\"Ctrl-Up\", null),\n exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); },\n readOnly: true\n}, {\n name: \"scrolldown\",\n description: \"Scroll down\",\n bindKey: bindKey(\"Ctrl-Down\", null),\n exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); },\n readOnly: true\n}, {\n name: \"selectlinestart\",\n description: \"Select line start\",\n bindKey: \"Shift-Home\",\n exec: function(editor) { editor.getSelection().selectLineStart(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectlineend\",\n description: \"Select line end\",\n bindKey: \"Shift-End\",\n exec: function(editor) { editor.getSelection().selectLineEnd(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"togglerecording\",\n description: \"Toggle recording\",\n bindKey: bindKey(\"Ctrl-Alt-E\", \"Command-Option-E\"),\n exec: function(editor) { editor.commands.toggleRecording(editor); },\n readOnly: true\n}, {\n name: \"replaymacro\",\n description: \"Replay macro\",\n bindKey: bindKey(\"Ctrl-Shift-E\", \"Command-Shift-E\"),\n exec: function(editor) { editor.commands.replay(editor); },\n readOnly: true\n}, {\n name: \"jumptomatching\",\n description: \"Jump to matching\",\n bindKey: bindKey(\"Ctrl-\\\\|Ctrl-P\", \"Command-\\\\\"),\n exec: function(editor) { editor.jumpToMatching(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"animate\",\n readOnly: true\n}, {\n name: \"selecttomatching\",\n description: \"Select to matching\",\n bindKey: bindKey(\"Ctrl-Shift-\\\\|Ctrl-Shift-P\", \"Command-Shift-\\\\\"),\n exec: function(editor) { editor.jumpToMatching(true); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"animate\",\n readOnly: true\n}, {\n name: \"expandToMatching\",\n description: \"Expand to matching\",\n bindKey: bindKey(\"Ctrl-Shift-M\", \"Ctrl-Shift-M\"),\n exec: function(editor) { editor.jumpToMatching(true, true); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"animate\",\n readOnly: true\n}, {\n name: \"passKeysToBrowser\",\n description: \"Pass keys to browser\",\n bindKey: bindKey(null, null),\n exec: function() {},\n passEvent: true,\n readOnly: true\n}, {\n name: \"copy\",\n description: \"Copy\",\n exec: function(editor) {\n },\n readOnly: true\n},\n{\n name: \"cut\",\n description: \"Cut\",\n exec: function(editor) {\n var cutLine = editor.$copyWithEmptySelection && editor.selection.isEmpty();\n var range = cutLine ? editor.selection.getLineRange() : editor.selection.getRange();\n editor._emit(\"cut\", range);\n\n if (!range.isEmpty())\n editor.session.remove(range);\n editor.clearSelection();\n },\n scrollIntoView: \"cursor\",\n multiSelectAction: \"forEach\"\n}, {\n name: \"paste\",\n description: \"Paste\",\n exec: function(editor, args) {\n editor.$handlePaste(args);\n },\n scrollIntoView: \"cursor\"\n}, {\n name: \"removeline\",\n description: \"Remove line\",\n bindKey: bindKey(\"Ctrl-D\", \"Command-D\"),\n exec: function(editor) { editor.removeLines(); },\n scrollIntoView: \"cursor\",\n multiSelectAction: \"forEachLine\"\n}, {\n name: \"duplicateSelection\",\n description: \"Duplicate selection\",\n bindKey: bindKey(\"Ctrl-Shift-D\", \"Command-Shift-D\"),\n exec: function(editor) { editor.duplicateSelection(); },\n scrollIntoView: \"cursor\",\n multiSelectAction: \"forEach\"\n}, {\n name: \"sortlines\",\n description: \"Sort lines\",\n bindKey: bindKey(\"Ctrl-Alt-S\", \"Command-Alt-S\"),\n exec: function(editor) { editor.sortLines(); },\n scrollIntoView: \"selection\",\n multiSelectAction: \"forEachLine\"\n}, {\n name: \"togglecomment\",\n description: \"Toggle comment\",\n bindKey: bindKey(\"Ctrl-/\", \"Command-/\"),\n exec: function(editor) { editor.toggleCommentLines(); },\n multiSelectAction: \"forEachLine\",\n scrollIntoView: \"selectionPart\"\n}, {\n name: \"toggleBlockComment\",\n description: \"Toggle block comment\",\n bindKey: bindKey(\"Ctrl-Shift-/\", \"Command-Shift-/\"),\n exec: function(editor) { editor.toggleBlockComment(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"selectionPart\"\n}, {\n name: \"modifyNumberUp\",\n description: \"Modify number up\",\n bindKey: bindKey(\"Ctrl-Shift-Up\", \"Alt-Shift-Up\"),\n exec: function(editor) { editor.modifyNumber(1); },\n scrollIntoView: \"cursor\",\n multiSelectAction: \"forEach\"\n}, {\n name: \"modifyNumberDown\",\n description: \"Modify number down\",\n bindKey: bindKey(\"Ctrl-Shift-Down\", \"Alt-Shift-Down\"),\n exec: function(editor) { editor.modifyNumber(-1); },\n scrollIntoView: \"cursor\",\n multiSelectAction: \"forEach\"\n}, {\n name: \"replace\",\n description: \"Replace\",\n bindKey: bindKey(\"Ctrl-H\", \"Command-Option-F\"),\n exec: function(editor) {\n config.loadModule(\"ace/ext/searchbox\", function(e) {e.Search(editor, true);});\n }\n}, {\n name: \"undo\",\n description: \"Undo\",\n bindKey: bindKey(\"Ctrl-Z\", \"Command-Z\"),\n exec: function(editor) { editor.undo(); }\n}, {\n name: \"redo\",\n description: \"Redo\",\n bindKey: bindKey(\"Ctrl-Shift-Z|Ctrl-Y\", \"Command-Shift-Z|Command-Y\"),\n exec: function(editor) { editor.redo(); }\n}, {\n name: \"copylinesup\",\n description: \"Copy lines up\",\n bindKey: bindKey(\"Alt-Shift-Up\", \"Command-Option-Up\"),\n exec: function(editor) { editor.copyLinesUp(); },\n scrollIntoView: \"cursor\"\n}, {\n name: \"movelinesup\",\n description: \"Move lines up\",\n bindKey: bindKey(\"Alt-Up\", \"Option-Up\"),\n exec: function(editor) { editor.moveLinesUp(); },\n scrollIntoView: \"cursor\"\n}, {\n name: \"copylinesdown\",\n description: \"Copy lines down\",\n bindKey: bindKey(\"Alt-Shift-Down\", \"Command-Option-Down\"),\n exec: function(editor) { editor.copyLinesDown(); },\n scrollIntoView: \"cursor\"\n}, {\n name: \"movelinesdown\",\n description: \"Move lines down\",\n bindKey: bindKey(\"Alt-Down\", \"Option-Down\"),\n exec: function(editor) { editor.moveLinesDown(); },\n scrollIntoView: \"cursor\"\n}, {\n name: \"del\",\n description: \"Delete\",\n bindKey: bindKey(\"Delete\", \"Delete|Ctrl-D|Shift-Delete\"),\n exec: function(editor) { editor.remove(\"right\"); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"backspace\",\n description: \"Backspace\",\n bindKey: bindKey(\n \"Shift-Backspace|Backspace\",\n \"Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H\"\n ),\n exec: function(editor) { editor.remove(\"left\"); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"cut_or_delete\",\n description: \"Cut or delete\",\n bindKey: bindKey(\"Shift-Delete\", null),\n exec: function(editor) { \n if (editor.selection.isEmpty()) {\n editor.remove(\"left\");\n } else {\n return false;\n }\n },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"removetolinestart\",\n description: \"Remove to line start\",\n bindKey: bindKey(\"Alt-Backspace\", \"Command-Backspace\"),\n exec: function(editor) { editor.removeToLineStart(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"removetolineend\",\n description: \"Remove to line end\",\n bindKey: bindKey(\"Alt-Delete\", \"Ctrl-K|Command-Delete\"),\n exec: function(editor) { editor.removeToLineEnd(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"removetolinestarthard\",\n description: \"Remove to line start hard\",\n bindKey: bindKey(\"Ctrl-Shift-Backspace\", null),\n exec: function(editor) {\n var range = editor.selection.getRange();\n range.start.column = 0;\n editor.session.remove(range);\n },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"removetolineendhard\",\n description: \"Remove to line end hard\",\n bindKey: bindKey(\"Ctrl-Shift-Delete\", null),\n exec: function(editor) {\n var range = editor.selection.getRange();\n range.end.column = Number.MAX_VALUE;\n editor.session.remove(range);\n },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"removewordleft\",\n description: \"Remove word left\",\n bindKey: bindKey(\"Ctrl-Backspace\", \"Alt-Backspace|Ctrl-Alt-Backspace\"),\n exec: function(editor) { editor.removeWordLeft(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"removewordright\",\n description: \"Remove word right\",\n bindKey: bindKey(\"Ctrl-Delete\", \"Alt-Delete\"),\n exec: function(editor) { editor.removeWordRight(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"outdent\",\n description: \"Outdent\",\n bindKey: bindKey(\"Shift-Tab\", \"Shift-Tab\"),\n exec: function(editor) { editor.blockOutdent(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"selectionPart\"\n}, {\n name: \"indent\",\n description: \"Indent\",\n bindKey: bindKey(\"Tab\", \"Tab\"),\n exec: function(editor) { editor.indent(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"selectionPart\"\n}, {\n name: \"blockoutdent\",\n description: \"Block outdent\",\n bindKey: bindKey(\"Ctrl-[\", \"Ctrl-[\"),\n exec: function(editor) { editor.blockOutdent(); },\n multiSelectAction: \"forEachLine\",\n scrollIntoView: \"selectionPart\"\n}, {\n name: \"blockindent\",\n description: \"Block indent\",\n bindKey: bindKey(\"Ctrl-]\", \"Ctrl-]\"),\n exec: function(editor) { editor.blockIndent(); },\n multiSelectAction: \"forEachLine\",\n scrollIntoView: \"selectionPart\"\n}, {\n name: \"insertstring\",\n description: \"Insert string\",\n exec: function(editor, str) { editor.insert(str); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"inserttext\",\n description: \"Insert text\",\n exec: function(editor, args) {\n editor.insert(lang.stringRepeat(args.text || \"\", args.times || 1));\n },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"splitline\",\n description: \"Split line\",\n bindKey: bindKey(null, \"Ctrl-O\"),\n exec: function(editor) { editor.splitLine(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"transposeletters\",\n description: \"Transpose letters\",\n bindKey: bindKey(\"Alt-Shift-X\", \"Ctrl-T\"),\n exec: function(editor) { editor.transposeLetters(); },\n multiSelectAction: function(editor) {editor.transposeSelections(1); },\n scrollIntoView: \"cursor\"\n}, {\n name: \"touppercase\",\n description: \"To uppercase\",\n bindKey: bindKey(\"Ctrl-U\", \"Ctrl-U\"),\n exec: function(editor) { editor.toUpperCase(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"tolowercase\",\n description: \"To lowercase\",\n bindKey: bindKey(\"Ctrl-Shift-U\", \"Ctrl-Shift-U\"),\n exec: function(editor) { editor.toLowerCase(); },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"autoindent\",\n description: \"Auto Indent\",\n bindKey: bindKey(null, null),\n exec: function(editor) { editor.autoIndent(); },\n multiSelectAction: \"forEachLine\",\n scrollIntoView: \"animate\"\n}, {\n name: \"expandtoline\",\n description: \"Expand to line\",\n bindKey: bindKey(\"Ctrl-Shift-L\", \"Command-Shift-L\"),\n exec: function(editor) {\n var range = editor.selection.getRange();\n\n range.start.column = range.end.column = 0;\n range.end.row++;\n editor.selection.setRange(range, false);\n },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"joinlines\",\n description: \"Join lines\",\n bindKey: bindKey(null, null),\n exec: function(editor) {\n var isBackwards = editor.selection.isBackwards();\n var selectionStart = isBackwards ? editor.selection.getSelectionLead() : editor.selection.getSelectionAnchor();\n var selectionEnd = isBackwards ? editor.selection.getSelectionAnchor() : editor.selection.getSelectionLead();\n var firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length;\n var selectedText = editor.session.doc.getTextRange(editor.selection.getRange());\n var selectedCount = selectedText.replace(/\\n\\s*/, \" \").length;\n var insertLine = editor.session.doc.getLine(selectionStart.row);\n\n for (var i = selectionStart.row + 1; i <= selectionEnd.row + 1; i++) {\n var curLine = lang.stringTrimLeft(lang.stringTrimRight(editor.session.doc.getLine(i)));\n if (curLine.length !== 0) {\n curLine = \" \" + curLine;\n }\n insertLine += curLine;\n }\n\n if (selectionEnd.row + 1 < (editor.session.doc.getLength() - 1)) {\n insertLine += editor.session.doc.getNewLineCharacter();\n }\n\n editor.clearSelection();\n editor.session.doc.replace(new Range(selectionStart.row, 0, selectionEnd.row + 2, 0), insertLine);\n\n if (selectedCount > 0) {\n editor.selection.moveCursorTo(selectionStart.row, selectionStart.column);\n editor.selection.selectTo(selectionStart.row, selectionStart.column + selectedCount);\n } else {\n firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length > firstLineEndCol ? (firstLineEndCol + 1) : firstLineEndCol;\n editor.selection.moveCursorTo(selectionStart.row, firstLineEndCol);\n }\n },\n multiSelectAction: \"forEach\",\n readOnly: true\n}, {\n name: \"invertSelection\",\n description: \"Invert selection\",\n bindKey: bindKey(null, null),\n exec: function(editor) {\n var endRow = editor.session.doc.getLength() - 1;\n var endCol = editor.session.doc.getLine(endRow).length;\n var ranges = editor.selection.rangeList.ranges;\n var newRanges = [];\n if (ranges.length < 1) {\n ranges = [editor.selection.getRange()];\n }\n\n for (var i = 0; i < ranges.length; i++) {\n if (i == (ranges.length - 1)) {\n if (!(ranges[i].end.row === endRow && ranges[i].end.column === endCol)) {\n newRanges.push(new Range(ranges[i].end.row, ranges[i].end.column, endRow, endCol));\n }\n }\n\n if (i === 0) {\n if (!(ranges[i].start.row === 0 && ranges[i].start.column === 0)) {\n newRanges.push(new Range(0, 0, ranges[i].start.row, ranges[i].start.column));\n }\n } else {\n newRanges.push(new Range(ranges[i-1].end.row, ranges[i-1].end.column, ranges[i].start.row, ranges[i].start.column));\n }\n }\n\n editor.exitMultiSelectMode();\n editor.clearSelection();\n\n for(var i = 0; i < newRanges.length; i++) {\n editor.selection.addRange(newRanges[i], false);\n }\n },\n readOnly: true,\n scrollIntoView: \"none\"\n}, {\n name: \"addLineAfter\",\n exec: function(editor) {\n editor.selection.clearSelection();\n editor.navigateLineEnd();\n editor.insert(\"\\n\");\n },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"addLineBefore\",\n exec: function(editor) {\n editor.selection.clearSelection();\n var cursor = editor.getCursorPosition();\n editor.selection.moveTo(cursor.row - 1, Number.MAX_VALUE);\n editor.insert(\"\\n\");\n if (cursor.row === 0) editor.navigateUp();\n },\n multiSelectAction: \"forEach\",\n scrollIntoView: \"cursor\"\n}, {\n name: \"openCommandPallete\",\n description: \"Open command pallete\",\n bindKey: bindKey(\"F1\", \"F1\"),\n exec: function(editor) {\n editor.prompt({ $type: \"commands\" });\n },\n readOnly: true\n}, {\n name: \"modeSelect\",\n description: \"Change language mode...\",\n bindKey: bindKey(null, null),\n exec: function(editor) {\n editor.prompt({ $type: \"modes\" });\n },\n readOnly: true\n}];\n\nfor (var i = 1; i < 9; i++) {\n exports.commands.push({\n name: \"foldToLevel\" + i,\n description: \"Fold To Level \" + i,\n level: i,\n exec: function(editor) { editor.session.foldToLevel(this.level); },\n scrollIntoView: \"center\",\n readOnly: true\n });\n}\n\n});\n\nace.define(\"ace/editor\",[\"require\",\"exports\",\"module\",\"ace/lib/fixoldbrowsers\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/lib/lang\",\"ace/lib/useragent\",\"ace/keyboard/textinput\",\"ace/mouse/mouse_handler\",\"ace/mouse/fold_handler\",\"ace/keyboard/keybinding\",\"ace/edit_session\",\"ace/search\",\"ace/range\",\"ace/lib/event_emitter\",\"ace/commands/command_manager\",\"ace/commands/default_commands\",\"ace/config\",\"ace/token_iterator\",\"ace/clipboard\"], function(require, exports, module) {\n\nrequire(\"./lib/fixoldbrowsers\");\n\nvar oop = require(\"./lib/oop\");\nvar dom = require(\"./lib/dom\");\nvar lang = require(\"./lib/lang\");\nvar useragent = require(\"./lib/useragent\");\nvar TextInput = require(\"./keyboard/textinput\").TextInput;\nvar MouseHandler = require(\"./mouse/mouse_handler\").MouseHandler;\nvar FoldHandler = require(\"./mouse/fold_handler\").FoldHandler;\nvar KeyBinding = require(\"./keyboard/keybinding\").KeyBinding;\nvar EditSession = require(\"./edit_session\").EditSession;\nvar Search = require(\"./search\").Search;\nvar Range = require(\"./range\").Range;\nvar EventEmitter = require(\"./lib/event_emitter\").EventEmitter;\nvar CommandManager = require(\"./commands/command_manager\").CommandManager;\nvar defaultCommands = require(\"./commands/default_commands\").commands;\nvar config = require(\"./config\");\nvar TokenIterator = require(\"./token_iterator\").TokenIterator;\n\nvar clipboard = require(\"./clipboard\");\nvar Editor = function(renderer, session, options) {\n this.$toDestroy = [];\n var container = renderer.getContainerElement();\n this.container = container;\n this.renderer = renderer;\n this.id = \"editor\" + (++Editor.$uid);\n\n this.commands = new CommandManager(useragent.isMac ? \"mac\" : \"win\", defaultCommands);\n if (typeof document == \"object\") {\n this.textInput = new TextInput(renderer.getTextAreaContainer(), this);\n this.renderer.textarea = this.textInput.getElement();\n this.$mouseHandler = new MouseHandler(this);\n new FoldHandler(this);\n }\n\n this.keyBinding = new KeyBinding(this);\n\n this.$search = new Search().set({\n wrap: true\n });\n\n this.$historyTracker = this.$historyTracker.bind(this);\n this.commands.on(\"exec\", this.$historyTracker);\n\n this.$initOperationListeners();\n \n this._$emitInputEvent = lang.delayedCall(function() {\n this._signal(\"input\", {});\n if (this.session && this.session.bgTokenizer)\n this.session.bgTokenizer.scheduleStart();\n }.bind(this));\n \n this.on(\"change\", function(_, _self) {\n _self._$emitInputEvent.schedule(31);\n });\n\n this.setSession(session || options && options.session || new EditSession(\"\"));\n config.resetOptions(this);\n if (options)\n this.setOptions(options);\n config._signal(\"editor\", this);\n};\n\nEditor.$uid = 0;\n\n(function(){\n\n oop.implement(this, EventEmitter);\n\n this.$initOperationListeners = function() {\n this.commands.on(\"exec\", this.startOperation.bind(this), true);\n this.commands.on(\"afterExec\", this.endOperation.bind(this), true);\n\n this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this, true));\n this.on(\"change\", function() {\n if (!this.curOp) {\n this.startOperation();\n this.curOp.selectionBefore = this.$lastSel;\n }\n this.curOp.docChanged = true;\n }.bind(this), true);\n \n this.on(\"changeSelection\", function() {\n if (!this.curOp) {\n this.startOperation();\n this.curOp.selectionBefore = this.$lastSel;\n }\n this.curOp.selectionChanged = true;\n }.bind(this), true);\n };\n\n this.curOp = null;\n this.prevOp = {};\n this.startOperation = function(commandEvent) {\n if (this.curOp) {\n if (!commandEvent || this.curOp.command)\n return;\n this.prevOp = this.curOp;\n }\n if (!commandEvent) {\n this.previousCommand = null;\n commandEvent = {};\n }\n\n this.$opResetTimer.schedule();\n this.curOp = this.session.curOp = {\n command: commandEvent.command || {},\n args: commandEvent.args,\n scrollTop: this.renderer.scrollTop\n };\n this.curOp.selectionBefore = this.selection.toJSON();\n };\n\n this.endOperation = function(e) {\n if (this.curOp && this.session) {\n if (e && e.returnValue === false || !this.session)\n return (this.curOp = null);\n if (e == true && this.curOp.command && this.curOp.command.name == \"mouse\")\n return;\n this._signal(\"beforeEndOperation\");\n if (!this.curOp) return;\n var command = this.curOp.command;\n var scrollIntoView = command && command.scrollIntoView;\n if (scrollIntoView) {\n switch (scrollIntoView) {\n case \"center-animate\":\n scrollIntoView = \"animate\";\n case \"center\":\n this.renderer.scrollCursorIntoView(null, 0.5);\n break;\n case \"animate\":\n case \"cursor\":\n this.renderer.scrollCursorIntoView();\n break;\n case \"selectionPart\":\n var range = this.selection.getRange();\n var config = this.renderer.layerConfig;\n if (range.start.row >= config.lastRow || range.end.row <= config.firstRow) {\n this.renderer.scrollSelectionIntoView(this.selection.anchor, this.selection.lead);\n }\n break;\n }\n if (scrollIntoView == \"animate\")\n this.renderer.animateScrolling(this.curOp.scrollTop);\n }\n var sel = this.selection.toJSON();\n this.curOp.selectionAfter = sel;\n this.$lastSel = this.selection.toJSON();\n this.session.getUndoManager().addSelection(sel);\n this.prevOp = this.curOp;\n this.curOp = null;\n }\n };\n this.$mergeableCommands = [\"backspace\", \"del\", \"insertstring\"];\n this.$historyTracker = function(e) {\n if (!this.$mergeUndoDeltas)\n return;\n\n var prev = this.prevOp;\n var mergeableCommands = this.$mergeableCommands;\n var shouldMerge = prev.command && (e.command.name == prev.command.name);\n if (e.command.name == \"insertstring\") {\n var text = e.args;\n if (this.mergeNextCommand === undefined)\n this.mergeNextCommand = true;\n\n shouldMerge = shouldMerge\n && this.mergeNextCommand // previous command allows to coalesce with\n && (!/\\s/.test(text) || /\\s/.test(prev.args)); // previous insertion was of same type\n\n this.mergeNextCommand = true;\n } else {\n shouldMerge = shouldMerge\n && mergeableCommands.indexOf(e.command.name) !== -1; // the command is mergeable\n }\n\n if (\n this.$mergeUndoDeltas != \"always\"\n && Date.now() - this.sequenceStartTime > 2000\n ) {\n shouldMerge = false; // the sequence is too long\n }\n\n if (shouldMerge)\n this.session.mergeUndoDeltas = true;\n else if (mergeableCommands.indexOf(e.command.name) !== -1)\n this.sequenceStartTime = Date.now();\n };\n this.setKeyboardHandler = function(keyboardHandler, cb) {\n if (keyboardHandler && typeof keyboardHandler === \"string\" && keyboardHandler != \"ace\") {\n this.$keybindingId = keyboardHandler;\n var _self = this;\n config.loadModule([\"keybinding\", keyboardHandler], function(module) {\n if (_self.$keybindingId == keyboardHandler)\n _self.keyBinding.setKeyboardHandler(module && module.handler);\n cb && cb();\n });\n } else {\n this.$keybindingId = null;\n this.keyBinding.setKeyboardHandler(keyboardHandler);\n cb && cb();\n }\n };\n this.getKeyboardHandler = function() {\n return this.keyBinding.getKeyboardHandler();\n };\n this.setSession = function(session) {\n if (this.session == session)\n return;\n if (this.curOp) this.endOperation();\n this.curOp = {};\n\n var oldSession = this.session;\n if (oldSession) {\n this.session.off(\"change\", this.$onDocumentChange);\n this.session.off(\"changeMode\", this.$onChangeMode);\n this.session.off(\"tokenizerUpdate\", this.$onTokenizerUpdate);\n this.session.off(\"changeTabSize\", this.$onChangeTabSize);\n this.session.off(\"changeWrapLimit\", this.$onChangeWrapLimit);\n this.session.off(\"changeWrapMode\", this.$onChangeWrapMode);\n this.session.off(\"changeFold\", this.$onChangeFold);\n this.session.off(\"changeFrontMarker\", this.$onChangeFrontMarker);\n this.session.off(\"changeBackMarker\", this.$onChangeBackMarker);\n this.session.off(\"changeBreakpoint\", this.$onChangeBreakpoint);\n this.session.off(\"changeAnnotation\", this.$onChangeAnnotation);\n this.session.off(\"changeOverwrite\", this.$onCursorChange);\n this.session.off(\"changeScrollTop\", this.$onScrollTopChange);\n this.session.off(\"changeScrollLeft\", this.$onScrollLeftChange);\n\n var selection = this.session.getSelection();\n selection.off(\"changeCursor\", this.$onCursorChange);\n selection.off(\"changeSelection\", this.$onSelectionChange);\n }\n\n this.session = session;\n if (session) {\n this.$onDocumentChange = this.onDocumentChange.bind(this);\n session.on(\"change\", this.$onDocumentChange);\n this.renderer.setSession(session);\n \n this.$onChangeMode = this.onChangeMode.bind(this);\n session.on(\"changeMode\", this.$onChangeMode);\n \n this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);\n session.on(\"tokenizerUpdate\", this.$onTokenizerUpdate);\n \n this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer);\n session.on(\"changeTabSize\", this.$onChangeTabSize);\n \n this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);\n session.on(\"changeWrapLimit\", this.$onChangeWrapLimit);\n \n this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);\n session.on(\"changeWrapMode\", this.$onChangeWrapMode);\n \n this.$onChangeFold = this.onChangeFold.bind(this);\n session.on(\"changeFold\", this.$onChangeFold);\n \n this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);\n this.session.on(\"changeFrontMarker\", this.$onChangeFrontMarker);\n \n this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);\n this.session.on(\"changeBackMarker\", this.$onChangeBackMarker);\n \n this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);\n this.session.on(\"changeBreakpoint\", this.$onChangeBreakpoint);\n \n this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);\n this.session.on(\"changeAnnotation\", this.$onChangeAnnotation);\n \n this.$onCursorChange = this.onCursorChange.bind(this);\n this.session.on(\"changeOverwrite\", this.$onCursorChange);\n \n this.$onScrollTopChange = this.onScrollTopChange.bind(this);\n this.session.on(\"changeScrollTop\", this.$onScrollTopChange);\n \n this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);\n this.session.on(\"changeScrollLeft\", this.$onScrollLeftChange);\n \n this.selection = session.getSelection();\n this.selection.on(\"changeCursor\", this.$onCursorChange);\n \n this.$onSelectionChange = this.onSelectionChange.bind(this);\n this.selection.on(\"changeSelection\", this.$onSelectionChange);\n \n this.onChangeMode();\n \n this.onCursorChange();\n \n this.onScrollTopChange();\n this.onScrollLeftChange();\n this.onSelectionChange();\n this.onChangeFrontMarker();\n this.onChangeBackMarker();\n this.onChangeBreakpoint();\n this.onChangeAnnotation();\n this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();\n this.renderer.updateFull();\n } else {\n this.selection = null;\n this.renderer.setSession(session);\n }\n\n this._signal(\"changeSession\", {\n session: session,\n oldSession: oldSession\n });\n \n this.curOp = null;\n \n oldSession && oldSession._signal(\"changeEditor\", {oldEditor: this});\n session && session._signal(\"changeEditor\", {editor: this});\n \n if (session && session.bgTokenizer)\n session.bgTokenizer.scheduleStart();\n };\n this.getSession = function() {\n return this.session;\n };\n this.setValue = function(val, cursorPos) {\n this.session.doc.setValue(val);\n\n if (!cursorPos)\n this.selectAll();\n else if (cursorPos == 1)\n this.navigateFileEnd();\n else if (cursorPos == -1)\n this.navigateFileStart();\n\n return val;\n };\n this.getValue = function() {\n return this.session.getValue();\n };\n this.getSelection = function() {\n return this.selection;\n };\n this.resize = function(force) {\n this.renderer.onResize(force);\n };\n this.setTheme = function(theme, cb) {\n this.renderer.setTheme(theme, cb);\n };\n this.getTheme = function() {\n return this.renderer.getTheme();\n };\n this.setStyle = function(style) {\n this.renderer.setStyle(style);\n };\n this.unsetStyle = function(style) {\n this.renderer.unsetStyle(style);\n };\n this.getFontSize = function () {\n return this.getOption(\"fontSize\") ||\n dom.computedStyle(this.container).fontSize;\n };\n this.setFontSize = function(size) {\n this.setOption(\"fontSize\", size);\n };\n\n this.$highlightBrackets = function() {\n if (this.$highlightPending) {\n return;\n }\n var self = this;\n this.$highlightPending = true;\n setTimeout(function () {\n self.$highlightPending = false;\n var session = self.session;\n if (!session || !session.bgTokenizer) return;\n if (session.$bracketHighlight) {\n session.$bracketHighlight.markerIds.forEach(function(id) {\n session.removeMarker(id);\n });\n session.$bracketHighlight = null;\n }\n var ranges = session.getMatchingBracketRanges(self.getCursorPosition());\n if (!ranges && session.$mode.getMatching) \n ranges = session.$mode.getMatching(self.session);\n if (!ranges)\n return;\n\n var markerType = \"ace_bracket\";\n if (!Array.isArray(ranges)) {\n ranges = [ranges];\n } else if (ranges.length == 1) {\n markerType = \"ace_error_bracket\";\n }\n if (ranges.length == 2) {\n if (Range.comparePoints(ranges[0].end, ranges[1].start) == 0)\n ranges = [Range.fromPoints(ranges[0].start, ranges[1].end)];\n else if (Range.comparePoints(ranges[0].start, ranges[1].end) == 0)\n ranges = [Range.fromPoints(ranges[1].start, ranges[0].end)];\n }\n\n session.$bracketHighlight = {\n ranges: ranges,\n markerIds: ranges.map(function(range) {\n return session.addMarker(range, markerType, \"text\");\n })\n };\n }, 50);\n };\n this.$highlightTags = function() {\n if (this.$highlightTagPending)\n return;\n var self = this;\n this.$highlightTagPending = true;\n setTimeout(function() {\n self.$highlightTagPending = false;\n \n var session = self.session;\n if (!session || !session.bgTokenizer) return;\n \n var pos = self.getCursorPosition();\n var iterator = new TokenIterator(self.session, pos.row, pos.column);\n var token = iterator.getCurrentToken();\n \n if (!token || !/\\b(?:tag-open|tag-name)/.test(token.type)) {\n session.removeMarker(session.$tagHighlight);\n session.$tagHighlight = null;\n return;\n }\n \n if (token.type.indexOf(\"tag-open\") !== -1) {\n token = iterator.stepForward();\n if (!token)\n return;\n }\n \n var tag = token.value;\n var currentTag = token.value;\n var depth = 0;\n var prevToken = iterator.stepBackward();\n \n if (prevToken.value === '<'){\n do {\n prevToken = token;\n token = iterator.stepForward();\n\n if (token) {\n if (token.type.indexOf('tag-name') !== -1) {\n currentTag = token.value;\n if (tag === currentTag) {\n if (prevToken.value === '<') {\n depth++;\n } else if (prevToken.value === '') { // self closing tag\n depth--;\n }\n }\n \n } while (token && depth >= 0);\n } else {\n do {\n token = prevToken;\n prevToken = iterator.stepBackward();\n\n if (token) {\n if (token.type.indexOf('tag-name') !== -1) {\n if (tag === token.value) {\n if (prevToken.value === '<') {\n depth++;\n } else if (prevToken.value === '') { // self closing tag\n var stepCount = 0;\n var tmpToken = prevToken;\n while (tmpToken) {\n if (tmpToken.type.indexOf('tag-name') !== -1 && tmpToken.value === tag) {\n depth--;\n break;\n } else if (tmpToken.value === '<') {\n break;\n }\n tmpToken = iterator.stepBackward();\n stepCount++;\n }\n for (var i = 0; i < stepCount; i++) {\n iterator.stepForward();\n }\n }\n }\n } while (prevToken && depth <= 0);\n iterator.stepForward();\n }\n \n if (!token) {\n session.removeMarker(session.$tagHighlight);\n session.$tagHighlight = null;\n return;\n }\n \n var row = iterator.getCurrentTokenRow();\n var column = iterator.getCurrentTokenColumn();\n var range = new Range(row, column, row, column+token.value.length);\n var sbm = session.$backMarkers[session.$tagHighlight];\n if (session.$tagHighlight && sbm != undefined && range.compareRange(sbm.range) !== 0) {\n session.removeMarker(session.$tagHighlight);\n session.$tagHighlight = null;\n }\n \n if (!session.$tagHighlight)\n session.$tagHighlight = session.addMarker(range, \"ace_bracket\", \"text\");\n }, 50);\n };\n this.focus = function() {\n var _self = this;\n setTimeout(function() {\n if (!_self.isFocused())\n _self.textInput.focus();\n });\n this.textInput.focus();\n };\n this.isFocused = function() {\n return this.textInput.isFocused();\n };\n this.blur = function() {\n this.textInput.blur();\n };\n this.onFocus = function(e) {\n if (this.$isFocused)\n return;\n this.$isFocused = true;\n this.renderer.showCursor();\n this.renderer.visualizeFocus();\n this._emit(\"focus\", e);\n };\n this.onBlur = function(e) {\n if (!this.$isFocused)\n return;\n this.$isFocused = false;\n this.renderer.hideCursor();\n this.renderer.visualizeBlur();\n this._emit(\"blur\", e);\n };\n\n this.$cursorChange = function() {\n this.renderer.updateCursor();\n this.$highlightBrackets();\n this.$highlightTags();\n this.$updateHighlightActiveLine();\n };\n this.onDocumentChange = function(delta) {\n var wrap = this.session.$useWrapMode;\n var lastRow = (delta.start.row == delta.end.row ? delta.end.row : Infinity);\n this.renderer.updateLines(delta.start.row, lastRow, wrap);\n\n this._signal(\"change\", delta);\n this.$cursorChange();\n };\n\n this.onTokenizerUpdate = function(e) {\n var rows = e.data;\n this.renderer.updateLines(rows.first, rows.last);\n };\n\n\n this.onScrollTopChange = function() {\n this.renderer.scrollToY(this.session.getScrollTop());\n };\n\n this.onScrollLeftChange = function() {\n this.renderer.scrollToX(this.session.getScrollLeft());\n };\n this.onCursorChange = function() {\n this.$cursorChange();\n this._signal(\"changeSelection\");\n };\n\n this.$updateHighlightActiveLine = function() {\n var session = this.getSession();\n\n var highlight;\n if (this.$highlightActiveLine) {\n if (this.$selectionStyle != \"line\" || !this.selection.isMultiLine())\n highlight = this.getCursorPosition();\n if (this.renderer.theme && this.renderer.theme.$selectionColorConflict && !this.selection.isEmpty())\n highlight = false;\n if (this.renderer.$maxLines && this.session.getLength() === 1 && !(this.renderer.$minLines > 1))\n highlight = false;\n }\n\n if (session.$highlightLineMarker && !highlight) {\n session.removeMarker(session.$highlightLineMarker.id);\n session.$highlightLineMarker = null;\n } else if (!session.$highlightLineMarker && highlight) {\n var range = new Range(highlight.row, highlight.column, highlight.row, Infinity);\n range.id = session.addMarker(range, \"ace_active-line\", \"screenLine\");\n session.$highlightLineMarker = range;\n } else if (highlight) {\n session.$highlightLineMarker.start.row = highlight.row;\n session.$highlightLineMarker.end.row = highlight.row;\n session.$highlightLineMarker.start.column = highlight.column;\n session._signal(\"changeBackMarker\");\n }\n };\n\n this.onSelectionChange = function(e) {\n var session = this.session;\n\n if (session.$selectionMarker) {\n session.removeMarker(session.$selectionMarker);\n }\n session.$selectionMarker = null;\n\n if (!this.selection.isEmpty()) {\n var range = this.selection.getRange();\n var style = this.getSelectionStyle();\n session.$selectionMarker = session.addMarker(range, \"ace_selection\", style);\n } else {\n this.$updateHighlightActiveLine();\n }\n\n var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp();\n this.session.highlight(re);\n\n this._signal(\"changeSelection\");\n };\n\n this.$getSelectionHighLightRegexp = function() {\n var session = this.session;\n\n var selection = this.getSelectionRange();\n if (selection.isEmpty() || selection.isMultiLine())\n return;\n\n var startColumn = selection.start.column;\n var endColumn = selection.end.column;\n var line = session.getLine(selection.start.row);\n \n var needle = line.substring(startColumn, endColumn);\n if (needle.length > 5000 || !/[\\w\\d]/.test(needle))\n return;\n\n var re = this.$search.$assembleRegExp({\n wholeWord: true,\n caseSensitive: true,\n needle: needle\n });\n \n var wordWithBoundary = line.substring(startColumn - 1, endColumn + 1);\n if (!re.test(wordWithBoundary))\n return;\n \n return re;\n };\n\n\n this.onChangeFrontMarker = function() {\n this.renderer.updateFrontMarkers();\n };\n\n this.onChangeBackMarker = function() {\n this.renderer.updateBackMarkers();\n };\n\n\n this.onChangeBreakpoint = function() {\n this.renderer.updateBreakpoints();\n };\n\n this.onChangeAnnotation = function() {\n this.renderer.setAnnotations(this.session.getAnnotations());\n };\n\n\n this.onChangeMode = function(e) {\n this.renderer.updateText();\n this._emit(\"changeMode\", e);\n };\n\n\n this.onChangeWrapLimit = function() {\n this.renderer.updateFull();\n };\n\n this.onChangeWrapMode = function() {\n this.renderer.onResize(true);\n };\n\n\n this.onChangeFold = function() {\n this.$updateHighlightActiveLine();\n this.renderer.updateFull();\n };\n this.getSelectedText = function() {\n return this.session.getTextRange(this.getSelectionRange());\n };\n this.getCopyText = function() {\n var text = this.getSelectedText();\n var nl = this.session.doc.getNewLineCharacter();\n var copyLine= false;\n if (!text && this.$copyWithEmptySelection) {\n copyLine = true;\n var ranges = this.selection.getAllRanges();\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (i && ranges[i - 1].start.row == range.start.row)\n continue;\n text += this.session.getLine(range.start.row) + nl;\n }\n }\n var e = {text: text};\n this._signal(\"copy\", e);\n clipboard.lineMode = copyLine ? e.text : \"\";\n return e.text;\n };\n this.onCopy = function() {\n this.commands.exec(\"copy\", this);\n };\n this.onCut = function() {\n this.commands.exec(\"cut\", this);\n };\n this.onPaste = function(text, event) {\n var e = {text: text, event: event};\n this.commands.exec(\"paste\", this, e);\n };\n \n this.$handlePaste = function(e) {\n if (typeof e == \"string\") \n e = {text: e};\n this._signal(\"paste\", e);\n var text = e.text;\n\n var lineMode = text == clipboard.lineMode;\n var session = this.session;\n if (!this.inMultiSelectMode || this.inVirtualSelectionMode) {\n if (lineMode)\n session.insert({ row: this.selection.lead.row, column: 0 }, text);\n else\n this.insert(text);\n } else if (lineMode) {\n this.selection.rangeList.ranges.forEach(function(range) {\n session.insert({ row: range.start.row, column: 0 }, text);\n });\n } else {\n var lines = text.split(/\\r\\n|\\r|\\n/);\n var ranges = this.selection.rangeList.ranges;\n \n var isFullLine = lines.length == 2 && (!lines[0] || !lines[1]);\n if (lines.length != ranges.length || isFullLine)\n return this.commands.exec(\"insertstring\", this, text);\n \n for (var i = ranges.length; i--;) {\n var range = ranges[i];\n if (!range.isEmpty())\n session.remove(range);\n \n session.insert(range.start, lines[i]);\n }\n }\n };\n\n this.execCommand = function(command, args) {\n return this.commands.exec(command, this, args);\n };\n this.insert = function(text, pasted) {\n var session = this.session;\n var mode = session.getMode();\n var cursor = this.getCursorPosition();\n\n if (this.getBehavioursEnabled() && !pasted) {\n var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text);\n if (transform) {\n if (text !== transform.text) {\n if (!this.inVirtualSelectionMode) {\n this.session.mergeUndoDeltas = false;\n this.mergeNextCommand = false;\n }\n }\n text = transform.text;\n\n }\n }\n \n if (text == \"\\t\")\n text = this.session.getTabString();\n if (!this.selection.isEmpty()) {\n var range = this.getSelectionRange();\n cursor = this.session.remove(range);\n this.clearSelection();\n }\n else if (this.session.getOverwrite() && text.indexOf(\"\\n\") == -1) {\n var range = new Range.fromPoints(cursor, cursor);\n range.end.column += text.length;\n this.session.remove(range);\n }\n\n if (text == \"\\n\" || text == \"\\r\\n\") {\n var line = session.getLine(cursor.row);\n if (cursor.column > line.search(/\\S|$/)) {\n var d = line.substr(cursor.column).search(/\\S|$/);\n session.doc.removeInLine(cursor.row, cursor.column, cursor.column + d);\n }\n }\n this.clearSelection();\n\n var start = cursor.column;\n var lineState = session.getState(cursor.row);\n var line = session.getLine(cursor.row);\n var shouldOutdent = mode.checkOutdent(lineState, line, text);\n session.insert(cursor, text);\n\n if (transform && transform.selection) {\n if (transform.selection.length == 2) { // Transform relative to the current column\n this.selection.setSelectionRange(\n new Range(cursor.row, start + transform.selection[0],\n cursor.row, start + transform.selection[1]));\n } else { // Transform relative to the current row.\n this.selection.setSelectionRange(\n new Range(cursor.row + transform.selection[0],\n transform.selection[1],\n cursor.row + transform.selection[2],\n transform.selection[3]));\n }\n }\n if (this.$enableAutoIndent) {\n if (session.getDocument().isNewLine(text)) {\n var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());\n\n session.insert({row: cursor.row+1, column: 0}, lineIndent);\n }\n if (shouldOutdent)\n mode.autoOutdent(lineState, session, cursor.row);\n }\n };\n\n this.autoIndent = function () {\n var session = this.session;\n var mode = session.getMode();\n\n var startRow, endRow;\n if (this.selection.isEmpty()) {\n startRow = 0;\n endRow = session.doc.getLength() - 1;\n } else {\n var selectedRange = this.getSelectionRange();\n\n startRow = selectedRange.start.row;\n endRow = selectedRange.end.row;\n }\n\n var prevLineState = \"\";\n var prevLine = \"\";\n var lineIndent = \"\";\n var line, currIndent, range;\n var tab = session.getTabString();\n\n for (var row = startRow; row <= endRow; row++) {\n if (row > 0) {\n prevLineState = session.getState(row - 1);\n prevLine = session.getLine(row - 1);\n lineIndent = mode.getNextLineIndent(prevLineState, prevLine, tab);\n }\n\n line = session.getLine(row);\n currIndent = mode.$getIndent(line);\n if (lineIndent !== currIndent) {\n if (currIndent.length > 0) {\n range = new Range(row, 0, row, currIndent.length);\n session.remove(range);\n }\n if (lineIndent.length > 0) {\n session.insert({row: row, column: 0}, lineIndent);\n }\n }\n\n mode.autoOutdent(prevLineState, session, row);\n }\n };\n\n\n this.onTextInput = function(text, composition) {\n if (!composition)\n return this.keyBinding.onTextInput(text);\n \n this.startOperation({command: { name: \"insertstring\" }});\n var applyComposition = this.applyComposition.bind(this, text, composition);\n if (this.selection.rangeCount)\n this.forEachSelection(applyComposition);\n else\n applyComposition();\n this.endOperation();\n };\n \n this.applyComposition = function(text, composition) {\n if (composition.extendLeft || composition.extendRight) {\n var r = this.selection.getRange();\n r.start.column -= composition.extendLeft;\n r.end.column += composition.extendRight;\n if (r.start.column < 0) {\n r.start.row--;\n r.start.column += this.session.getLine(r.start.row).length + 1;\n }\n this.selection.setRange(r);\n if (!text && !r.isEmpty())\n this.remove();\n }\n if (text || !this.selection.isEmpty())\n this.insert(text, true);\n if (composition.restoreStart || composition.restoreEnd) {\n var r = this.selection.getRange();\n r.start.column -= composition.restoreStart;\n r.end.column -= composition.restoreEnd;\n this.selection.setRange(r);\n }\n };\n\n this.onCommandKey = function(e, hashId, keyCode) {\n return this.keyBinding.onCommandKey(e, hashId, keyCode);\n };\n this.setOverwrite = function(overwrite) {\n this.session.setOverwrite(overwrite);\n };\n this.getOverwrite = function() {\n return this.session.getOverwrite();\n };\n this.toggleOverwrite = function() {\n this.session.toggleOverwrite();\n };\n this.setScrollSpeed = function(speed) {\n this.setOption(\"scrollSpeed\", speed);\n };\n this.getScrollSpeed = function() {\n return this.getOption(\"scrollSpeed\");\n };\n this.setDragDelay = function(dragDelay) {\n this.setOption(\"dragDelay\", dragDelay);\n };\n this.getDragDelay = function() {\n return this.getOption(\"dragDelay\");\n };\n this.setSelectionStyle = function(val) {\n this.setOption(\"selectionStyle\", val);\n };\n this.getSelectionStyle = function() {\n return this.getOption(\"selectionStyle\");\n };\n this.setHighlightActiveLine = function(shouldHighlight) {\n this.setOption(\"highlightActiveLine\", shouldHighlight);\n };\n this.getHighlightActiveLine = function() {\n return this.getOption(\"highlightActiveLine\");\n };\n this.setHighlightGutterLine = function(shouldHighlight) {\n this.setOption(\"highlightGutterLine\", shouldHighlight);\n };\n\n this.getHighlightGutterLine = function() {\n return this.getOption(\"highlightGutterLine\");\n };\n this.setHighlightSelectedWord = function(shouldHighlight) {\n this.setOption(\"highlightSelectedWord\", shouldHighlight);\n };\n this.getHighlightSelectedWord = function() {\n return this.$highlightSelectedWord;\n };\n\n this.setAnimatedScroll = function(shouldAnimate){\n this.renderer.setAnimatedScroll(shouldAnimate);\n };\n\n this.getAnimatedScroll = function(){\n return this.renderer.getAnimatedScroll();\n };\n this.setShowInvisibles = function(showInvisibles) {\n this.renderer.setShowInvisibles(showInvisibles);\n };\n this.getShowInvisibles = function() {\n return this.renderer.getShowInvisibles();\n };\n\n this.setDisplayIndentGuides = function(display) {\n this.renderer.setDisplayIndentGuides(display);\n };\n\n this.getDisplayIndentGuides = function() {\n return this.renderer.getDisplayIndentGuides();\n };\n this.setShowPrintMargin = function(showPrintMargin) {\n this.renderer.setShowPrintMargin(showPrintMargin);\n };\n this.getShowPrintMargin = function() {\n return this.renderer.getShowPrintMargin();\n };\n this.setPrintMarginColumn = function(showPrintMargin) {\n this.renderer.setPrintMarginColumn(showPrintMargin);\n };\n this.getPrintMarginColumn = function() {\n return this.renderer.getPrintMarginColumn();\n };\n this.setReadOnly = function(readOnly) {\n this.setOption(\"readOnly\", readOnly);\n };\n this.getReadOnly = function() {\n return this.getOption(\"readOnly\");\n };\n this.setBehavioursEnabled = function (enabled) {\n this.setOption(\"behavioursEnabled\", enabled);\n };\n this.getBehavioursEnabled = function () {\n return this.getOption(\"behavioursEnabled\");\n };\n this.setWrapBehavioursEnabled = function (enabled) {\n this.setOption(\"wrapBehavioursEnabled\", enabled);\n };\n this.getWrapBehavioursEnabled = function () {\n return this.getOption(\"wrapBehavioursEnabled\");\n };\n this.setShowFoldWidgets = function(show) {\n this.setOption(\"showFoldWidgets\", show);\n\n };\n this.getShowFoldWidgets = function() {\n return this.getOption(\"showFoldWidgets\");\n };\n\n this.setFadeFoldWidgets = function(fade) {\n this.setOption(\"fadeFoldWidgets\", fade);\n };\n\n this.getFadeFoldWidgets = function() {\n return this.getOption(\"fadeFoldWidgets\");\n };\n this.remove = function(dir) {\n if (this.selection.isEmpty()){\n if (dir == \"left\")\n this.selection.selectLeft();\n else\n this.selection.selectRight();\n }\n\n var range = this.getSelectionRange();\n if (this.getBehavioursEnabled()) {\n var session = this.session;\n var state = session.getState(range.start.row);\n var new_range = session.getMode().transformAction(state, 'deletion', this, session, range);\n\n if (range.end.column === 0) {\n var text = session.getTextRange(range);\n if (text[text.length - 1] == \"\\n\") {\n var line = session.getLine(range.end.row);\n if (/^\\s+$/.test(line)) {\n range.end.column = line.length;\n }\n }\n }\n if (new_range)\n range = new_range;\n }\n\n this.session.remove(range);\n this.clearSelection();\n };\n this.removeWordRight = function() {\n if (this.selection.isEmpty())\n this.selection.selectWordRight();\n\n this.session.remove(this.getSelectionRange());\n this.clearSelection();\n };\n this.removeWordLeft = function() {\n if (this.selection.isEmpty())\n this.selection.selectWordLeft();\n\n this.session.remove(this.getSelectionRange());\n this.clearSelection();\n };\n this.removeToLineStart = function() {\n if (this.selection.isEmpty())\n this.selection.selectLineStart();\n if (this.selection.isEmpty())\n this.selection.selectLeft();\n this.session.remove(this.getSelectionRange());\n this.clearSelection();\n };\n this.removeToLineEnd = function() {\n if (this.selection.isEmpty())\n this.selection.selectLineEnd();\n\n var range = this.getSelectionRange();\n if (range.start.column == range.end.column && range.start.row == range.end.row) {\n range.end.column = 0;\n range.end.row++;\n }\n\n this.session.remove(range);\n this.clearSelection();\n };\n this.splitLine = function() {\n if (!this.selection.isEmpty()) {\n this.session.remove(this.getSelectionRange());\n this.clearSelection();\n }\n\n var cursor = this.getCursorPosition();\n this.insert(\"\\n\");\n this.moveCursorToPosition(cursor);\n };\n this.transposeLetters = function() {\n if (!this.selection.isEmpty()) {\n return;\n }\n\n var cursor = this.getCursorPosition();\n var column = cursor.column;\n if (column === 0)\n return;\n\n var line = this.session.getLine(cursor.row);\n var swap, range;\n if (column < line.length) {\n swap = line.charAt(column) + line.charAt(column-1);\n range = new Range(cursor.row, column-1, cursor.row, column+1);\n }\n else {\n swap = line.charAt(column-1) + line.charAt(column-2);\n range = new Range(cursor.row, column-2, cursor.row, column);\n }\n this.session.replace(range, swap);\n this.session.selection.moveToPosition(range.end);\n };\n this.toLowerCase = function() {\n var originalRange = this.getSelectionRange();\n if (this.selection.isEmpty()) {\n this.selection.selectWord();\n }\n\n var range = this.getSelectionRange();\n var text = this.session.getTextRange(range);\n this.session.replace(range, text.toLowerCase());\n this.selection.setSelectionRange(originalRange);\n };\n this.toUpperCase = function() {\n var originalRange = this.getSelectionRange();\n if (this.selection.isEmpty()) {\n this.selection.selectWord();\n }\n\n var range = this.getSelectionRange();\n var text = this.session.getTextRange(range);\n this.session.replace(range, text.toUpperCase());\n this.selection.setSelectionRange(originalRange);\n };\n this.indent = function() {\n var session = this.session;\n var range = this.getSelectionRange();\n\n if (range.start.row < range.end.row) {\n var rows = this.$getSelectedRows();\n session.indentRows(rows.first, rows.last, \"\\t\");\n return;\n } else if (range.start.column < range.end.column) {\n var text = session.getTextRange(range);\n if (!/^\\s+$/.test(text)) {\n var rows = this.$getSelectedRows();\n session.indentRows(rows.first, rows.last, \"\\t\");\n return;\n }\n }\n \n var line = session.getLine(range.start.row);\n var position = range.start;\n var size = session.getTabSize();\n var column = session.documentToScreenColumn(position.row, position.column);\n\n if (this.session.getUseSoftTabs()) {\n var count = (size - column % size);\n var indentString = lang.stringRepeat(\" \", count);\n } else {\n var count = column % size;\n while (line[range.start.column - 1] == \" \" && count) {\n range.start.column--;\n count--;\n }\n this.selection.setSelectionRange(range);\n indentString = \"\\t\";\n }\n return this.insert(indentString);\n };\n this.blockIndent = function() {\n var rows = this.$getSelectedRows();\n this.session.indentRows(rows.first, rows.last, \"\\t\");\n };\n this.blockOutdent = function() {\n var selection = this.session.getSelection();\n this.session.outdentRows(selection.getRange());\n };\n this.sortLines = function() {\n var rows = this.$getSelectedRows();\n var session = this.session;\n\n var lines = [];\n for (var i = rows.first; i <= rows.last; i++)\n lines.push(session.getLine(i));\n\n lines.sort(function(a, b) {\n if (a.toLowerCase() < b.toLowerCase()) return -1;\n if (a.toLowerCase() > b.toLowerCase()) return 1;\n return 0;\n });\n\n var deleteRange = new Range(0, 0, 0, 0);\n for (var i = rows.first; i <= rows.last; i++) {\n var line = session.getLine(i);\n deleteRange.start.row = i;\n deleteRange.end.row = i;\n deleteRange.end.column = line.length;\n session.replace(deleteRange, lines[i-rows.first]);\n }\n };\n this.toggleCommentLines = function() {\n var state = this.session.getState(this.getCursorPosition().row);\n var rows = this.$getSelectedRows();\n this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);\n };\n\n this.toggleBlockComment = function() {\n var cursor = this.getCursorPosition();\n var state = this.session.getState(cursor.row);\n var range = this.getSelectionRange();\n this.session.getMode().toggleBlockComment(state, this.session, range, cursor);\n };\n this.getNumberAt = function(row, column) {\n var _numberRx = /[\\-]?[0-9]+(?:\\.[0-9]+)?/g;\n _numberRx.lastIndex = 0;\n\n var s = this.session.getLine(row);\n while (_numberRx.lastIndex < column) {\n var m = _numberRx.exec(s);\n if(m.index <= column && m.index+m[0].length >= column){\n var number = {\n value: m[0],\n start: m.index,\n end: m.index+m[0].length\n };\n return number;\n }\n }\n return null;\n };\n this.modifyNumber = function(amount) {\n var row = this.selection.getCursor().row;\n var column = this.selection.getCursor().column;\n var charRange = new Range(row, column-1, row, column);\n\n var c = this.session.getTextRange(charRange);\n if (!isNaN(parseFloat(c)) && isFinite(c)) {\n var nr = this.getNumberAt(row, column);\n if (nr) {\n var fp = nr.value.indexOf(\".\") >= 0 ? nr.start + nr.value.indexOf(\".\") + 1 : nr.end;\n var decimals = nr.start + nr.value.length - fp;\n\n var t = parseFloat(nr.value);\n t *= Math.pow(10, decimals);\n\n\n if(fp !== nr.end && column < fp){\n amount *= Math.pow(10, nr.end - column - 1);\n } else {\n amount *= Math.pow(10, nr.end - column);\n }\n\n t += amount;\n t /= Math.pow(10, decimals);\n var nnr = t.toFixed(decimals);\n var replaceRange = new Range(row, nr.start, row, nr.end);\n this.session.replace(replaceRange, nnr);\n this.moveCursorTo(row, Math.max(nr.start +1, column + nnr.length - nr.value.length));\n\n }\n } else {\n this.toggleWord();\n }\n };\n\n this.$toggleWordPairs = [\n [\"first\", \"last\"],\n [\"true\", \"false\"],\n [\"yes\", \"no\"],\n [\"width\", \"height\"],\n [\"top\", \"bottom\"],\n [\"right\", \"left\"],\n [\"on\", \"off\"],\n [\"x\", \"y\"],\n [\"get\", \"set\"],\n [\"max\", \"min\"],\n [\"horizontal\", \"vertical\"],\n [\"show\", \"hide\"],\n [\"add\", \"remove\"],\n [\"up\", \"down\"],\n [\"before\", \"after\"],\n [\"even\", \"odd\"],\n [\"in\", \"out\"],\n [\"inside\", \"outside\"],\n [\"next\", \"previous\"],\n [\"increase\", \"decrease\"],\n [\"attach\", \"detach\"],\n [\"&&\", \"||\"],\n [\"==\", \"!=\"]\n ];\n\n this.toggleWord = function () {\n var row = this.selection.getCursor().row;\n var column = this.selection.getCursor().column;\n this.selection.selectWord();\n var currentState = this.getSelectedText();\n var currWordStart = this.selection.getWordRange().start.column;\n var wordParts = currentState.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g, '$1 ').split(/\\s/);\n var delta = column - currWordStart - 1;\n if (delta < 0) delta = 0;\n var curLength = 0, itLength = 0;\n var that = this;\n if (currentState.match(/[A-Za-z0-9_]+/)) {\n wordParts.forEach(function (item, i) {\n itLength = curLength + item.length;\n if (delta >= curLength && delta <= itLength) {\n currentState = item;\n that.selection.clearSelection();\n that.moveCursorTo(row, curLength + currWordStart);\n that.selection.selectTo(row, itLength + currWordStart);\n }\n curLength = itLength;\n });\n }\n\n var wordPairs = this.$toggleWordPairs;\n var reg;\n for (var i = 0; i < wordPairs.length; i++) {\n var item = wordPairs[i];\n for (var j = 0; j <= 1; j++) {\n var negate = +!j;\n var firstCondition = currentState.match(new RegExp('^\\\\s?_?(' + lang.escapeRegExp(item[j]) + ')\\\\s?$', 'i'));\n if (firstCondition) {\n var secondCondition = currentState.match(new RegExp('([_]|^|\\\\s)(' + lang.escapeRegExp(firstCondition[1]) + ')($|\\\\s)', 'g'));\n if (secondCondition) {\n reg = currentState.replace(new RegExp(lang.escapeRegExp(item[j]), 'i'), function (result) {\n var res = item[negate];\n if (result.toUpperCase() == result) {\n res = res.toUpperCase();\n } else if (result.charAt(0).toUpperCase() == result.charAt(0)) {\n res = res.substr(0, 0) + item[negate].charAt(0).toUpperCase() + res.substr(1);\n }\n return res;\n });\n this.insert(reg);\n reg = \"\";\n }\n }\n }\n }\n };\n this.removeLines = function() {\n var rows = this.$getSelectedRows();\n this.session.removeFullLines(rows.first, rows.last);\n this.clearSelection();\n };\n\n this.duplicateSelection = function() {\n var sel = this.selection;\n var doc = this.session;\n var range = sel.getRange();\n var reverse = sel.isBackwards();\n if (range.isEmpty()) {\n var row = range.start.row;\n doc.duplicateLines(row, row);\n } else {\n var point = reverse ? range.start : range.end;\n var endPoint = doc.insert(point, doc.getTextRange(range), false);\n range.start = point;\n range.end = endPoint;\n\n sel.setSelectionRange(range, reverse);\n }\n };\n this.moveLinesDown = function() {\n this.$moveLines(1, false);\n };\n this.moveLinesUp = function() {\n this.$moveLines(-1, false);\n };\n this.moveText = function(range, toPosition, copy) {\n return this.session.moveText(range, toPosition, copy);\n };\n this.copyLinesUp = function() {\n this.$moveLines(-1, true);\n };\n this.copyLinesDown = function() {\n this.$moveLines(1, true);\n };\n this.$moveLines = function(dir, copy) {\n var rows, moved;\n var selection = this.selection;\n if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) {\n var range = selection.toOrientedRange();\n rows = this.$getSelectedRows(range);\n moved = this.session.$moveLines(rows.first, rows.last, copy ? 0 : dir);\n if (copy && dir == -1) moved = 0;\n range.moveBy(moved, 0);\n selection.fromOrientedRange(range);\n } else {\n var ranges = selection.rangeList.ranges;\n selection.rangeList.detach(this.session);\n this.inVirtualSelectionMode = true;\n \n var diff = 0;\n var totalDiff = 0;\n var l = ranges.length;\n for (var i = 0; i < l; i++) {\n var rangeIndex = i;\n ranges[i].moveBy(diff, 0);\n rows = this.$getSelectedRows(ranges[i]);\n var first = rows.first;\n var last = rows.last;\n while (++i < l) {\n if (totalDiff) ranges[i].moveBy(totalDiff, 0);\n var subRows = this.$getSelectedRows(ranges[i]);\n if (copy && subRows.first != last)\n break;\n else if (!copy && subRows.first > last + 1)\n break;\n last = subRows.last;\n }\n i--;\n diff = this.session.$moveLines(first, last, copy ? 0 : dir);\n if (copy && dir == -1) rangeIndex = i + 1;\n while (rangeIndex <= i) {\n ranges[rangeIndex].moveBy(diff, 0);\n rangeIndex++;\n }\n if (!copy) diff = 0;\n totalDiff += diff;\n }\n \n selection.fromOrientedRange(selection.ranges[0]);\n selection.rangeList.attach(this.session);\n this.inVirtualSelectionMode = false;\n }\n };\n this.$getSelectedRows = function(range) {\n range = (range || this.getSelectionRange()).collapseRows();\n\n return {\n first: this.session.getRowFoldStart(range.start.row),\n last: this.session.getRowFoldEnd(range.end.row)\n };\n };\n\n this.onCompositionStart = function(compositionState) {\n this.renderer.showComposition(compositionState);\n };\n\n this.onCompositionUpdate = function(text) {\n this.renderer.setCompositionText(text);\n };\n\n this.onCompositionEnd = function() {\n this.renderer.hideComposition();\n };\n this.getFirstVisibleRow = function() {\n return this.renderer.getFirstVisibleRow();\n };\n this.getLastVisibleRow = function() {\n return this.renderer.getLastVisibleRow();\n };\n this.isRowVisible = function(row) {\n return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());\n };\n this.isRowFullyVisible = function(row) {\n return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow());\n };\n this.$getVisibleRowCount = function() {\n return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;\n };\n\n this.$moveByPage = function(dir, select) {\n var renderer = this.renderer;\n var config = this.renderer.layerConfig;\n var rows = dir * Math.floor(config.height / config.lineHeight);\n\n if (select === true) {\n this.selection.$moveSelection(function(){\n this.moveCursorBy(rows, 0);\n });\n } else if (select === false) {\n this.selection.moveCursorBy(rows, 0);\n this.selection.clearSelection();\n }\n\n var scrollTop = renderer.scrollTop;\n\n renderer.scrollBy(0, rows * config.lineHeight);\n if (select != null)\n renderer.scrollCursorIntoView(null, 0.5);\n\n renderer.animateScrolling(scrollTop);\n };\n this.selectPageDown = function() {\n this.$moveByPage(1, true);\n };\n this.selectPageUp = function() {\n this.$moveByPage(-1, true);\n };\n this.gotoPageDown = function() {\n this.$moveByPage(1, false);\n };\n this.gotoPageUp = function() {\n this.$moveByPage(-1, false);\n };\n this.scrollPageDown = function() {\n this.$moveByPage(1);\n };\n this.scrollPageUp = function() {\n this.$moveByPage(-1);\n };\n this.scrollToRow = function(row) {\n this.renderer.scrollToRow(row);\n };\n this.scrollToLine = function(line, center, animate, callback) {\n this.renderer.scrollToLine(line, center, animate, callback);\n };\n this.centerSelection = function() {\n var range = this.getSelectionRange();\n var pos = {\n row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),\n column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)\n };\n this.renderer.alignCursor(pos, 0.5);\n };\n this.getCursorPosition = function() {\n return this.selection.getCursor();\n };\n this.getCursorPositionScreen = function() {\n return this.session.documentToScreenPosition(this.getCursorPosition());\n };\n this.getSelectionRange = function() {\n return this.selection.getRange();\n };\n this.selectAll = function() {\n this.selection.selectAll();\n };\n this.clearSelection = function() {\n this.selection.clearSelection();\n };\n this.moveCursorTo = function(row, column) {\n this.selection.moveCursorTo(row, column);\n };\n this.moveCursorToPosition = function(pos) {\n this.selection.moveCursorToPosition(pos);\n };\n this.jumpToMatching = function(select, expand) {\n var cursor = this.getCursorPosition();\n var iterator = new TokenIterator(this.session, cursor.row, cursor.column);\n var prevToken = iterator.getCurrentToken();\n var token = prevToken || iterator.stepForward();\n\n if (!token) return;\n var matchType;\n var found = false;\n var depth = {};\n var i = cursor.column - token.start;\n var bracketType;\n var brackets = {\n \")\": \"(\",\n \"(\": \"(\",\n \"]\": \"[\",\n \"[\": \"[\",\n \"{\": \"{\",\n \"}\": \"{\"\n };\n \n do {\n if (token.value.match(/[{}()\\[\\]]/g)) {\n for (; i < token.value.length && !found; i++) {\n if (!brackets[token.value[i]]) {\n continue;\n }\n\n bracketType = brackets[token.value[i]] + '.' + token.type.replace(\"rparen\", \"lparen\");\n\n if (isNaN(depth[bracketType])) {\n depth[bracketType] = 0;\n }\n\n switch (token.value[i]) {\n case '(':\n case '[':\n case '{':\n depth[bracketType]++;\n break;\n case ')':\n case ']':\n case '}':\n depth[bracketType]--;\n\n if (depth[bracketType] === -1) {\n matchType = 'bracket';\n found = true;\n }\n break;\n }\n }\n }\n else if (token.type.indexOf('tag-name') !== -1) {\n if (isNaN(depth[token.value])) {\n depth[token.value] = 0;\n }\n \n if (prevToken.value === '<') {\n depth[token.value]++;\n }\n else if (prevToken.value === '= 0; --i) {\n if(this.$tryReplace(ranges[i], replacement)) {\n replaced++;\n }\n }\n\n this.selection.setSelectionRange(selection);\n\n return replaced;\n };\n\n this.$tryReplace = function(range, replacement) {\n var input = this.session.getTextRange(range);\n replacement = this.$search.replace(input, replacement);\n if (replacement !== null) {\n range.end = this.session.replace(range, replacement);\n return range;\n } else {\n return null;\n }\n };\n this.getLastSearchOptions = function() {\n return this.$search.getOptions();\n };\n this.find = function(needle, options, animate) {\n if (!options)\n options = {};\n\n if (typeof needle == \"string\" || needle instanceof RegExp)\n options.needle = needle;\n else if (typeof needle == \"object\")\n oop.mixin(options, needle);\n\n var range = this.selection.getRange();\n if (options.needle == null) {\n needle = this.session.getTextRange(range)\n || this.$search.$options.needle;\n if (!needle) {\n range = this.session.getWordRange(range.start.row, range.start.column);\n needle = this.session.getTextRange(range);\n }\n this.$search.set({needle: needle});\n }\n\n this.$search.set(options);\n if (!options.start)\n this.$search.set({start: range});\n\n var newRange = this.$search.find(this.session);\n if (options.preventScroll)\n return newRange;\n if (newRange) {\n this.revealRange(newRange, animate);\n return newRange;\n }\n if (options.backwards)\n range.start = range.end;\n else\n range.end = range.start;\n this.selection.setRange(range);\n };\n this.findNext = function(options, animate) {\n this.find({skipCurrent: true, backwards: false}, options, animate);\n };\n this.findPrevious = function(options, animate) {\n this.find(options, {skipCurrent: true, backwards: true}, animate);\n };\n\n this.revealRange = function(range, animate) {\n this.session.unfold(range);\n this.selection.setSelectionRange(range);\n\n var scrollTop = this.renderer.scrollTop;\n this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5);\n if (animate !== false)\n this.renderer.animateScrolling(scrollTop);\n };\n this.undo = function() {\n this.session.getUndoManager().undo(this.session);\n this.renderer.scrollCursorIntoView(null, 0.5);\n };\n this.redo = function() {\n this.session.getUndoManager().redo(this.session);\n this.renderer.scrollCursorIntoView(null, 0.5);\n };\n this.destroy = function() {\n if (this.$toDestroy) {\n this.$toDestroy.forEach(function(el) {\n el.destroy();\n });\n this.$toDestroy = null;\n }\n if (this.$mouseHandler)\n this.$mouseHandler.destroy();\n this.renderer.destroy();\n this._signal(\"destroy\", this);\n if (this.session)\n this.session.destroy();\n if (this._$emitInputEvent)\n this._$emitInputEvent.cancel();\n this.removeAllListeners();\n };\n this.setAutoScrollEditorIntoView = function(enable) {\n if (!enable)\n return;\n var rect;\n var self = this;\n var shouldScroll = false;\n if (!this.$scrollAnchor)\n this.$scrollAnchor = document.createElement(\"div\");\n var scrollAnchor = this.$scrollAnchor;\n scrollAnchor.style.cssText = \"position:absolute\";\n this.container.insertBefore(scrollAnchor, this.container.firstChild);\n var onChangeSelection = this.on(\"changeSelection\", function() {\n shouldScroll = true;\n });\n var onBeforeRender = this.renderer.on(\"beforeRender\", function() {\n if (shouldScroll)\n rect = self.renderer.container.getBoundingClientRect();\n });\n var onAfterRender = this.renderer.on(\"afterRender\", function() {\n if (shouldScroll && rect && (self.isFocused()\n || self.searchBox && self.searchBox.isFocused())\n ) {\n var renderer = self.renderer;\n var pos = renderer.$cursorLayer.$pixelPos;\n var config = renderer.layerConfig;\n var top = pos.top - config.offset;\n if (pos.top >= 0 && top + rect.top < 0) {\n shouldScroll = true;\n } else if (pos.top < config.height &&\n pos.top + rect.top + config.lineHeight > window.innerHeight) {\n shouldScroll = false;\n } else {\n shouldScroll = null;\n }\n if (shouldScroll != null) {\n scrollAnchor.style.top = top + \"px\";\n scrollAnchor.style.left = pos.left + \"px\";\n scrollAnchor.style.height = config.lineHeight + \"px\";\n scrollAnchor.scrollIntoView(shouldScroll);\n }\n shouldScroll = rect = null;\n }\n });\n this.setAutoScrollEditorIntoView = function(enable) {\n if (enable)\n return;\n delete this.setAutoScrollEditorIntoView;\n this.off(\"changeSelection\", onChangeSelection);\n this.renderer.off(\"afterRender\", onAfterRender);\n this.renderer.off(\"beforeRender\", onBeforeRender);\n };\n };\n\n\n this.$resetCursorStyle = function() {\n var style = this.$cursorStyle || \"ace\";\n var cursorLayer = this.renderer.$cursorLayer;\n if (!cursorLayer)\n return;\n cursorLayer.setSmoothBlinking(/smooth/.test(style));\n cursorLayer.isBlinking = !this.$readOnly && style != \"wide\";\n dom.setCssClass(cursorLayer.element, \"ace_slim-cursors\", /slim/.test(style));\n };\n this.prompt = function(message, options, callback) {\n var editor = this;\n config.loadModule(\"./ext/prompt\", function (module) {\n module.prompt(editor, message, options, callback);\n });\n };\n\n}).call(Editor.prototype);\n\n\n\nconfig.defineOptions(Editor.prototype, \"editor\", {\n selectionStyle: {\n set: function(style) {\n this.onSelectionChange();\n this._signal(\"changeSelectionStyle\", {data: style});\n },\n initialValue: \"line\"\n },\n highlightActiveLine: {\n set: function() {this.$updateHighlightActiveLine();},\n initialValue: true\n },\n highlightSelectedWord: {\n set: function(shouldHighlight) {this.$onSelectionChange();},\n initialValue: true\n },\n readOnly: {\n set: function(readOnly) {\n this.textInput.setReadOnly(readOnly);\n this.$resetCursorStyle(); \n },\n initialValue: false\n },\n copyWithEmptySelection: {\n set: function(value) {\n this.textInput.setCopyWithEmptySelection(value);\n },\n initialValue: false\n },\n cursorStyle: {\n set: function(val) { this.$resetCursorStyle(); },\n values: [\"ace\", \"slim\", \"smooth\", \"wide\"],\n initialValue: \"ace\"\n },\n mergeUndoDeltas: {\n values: [false, true, \"always\"],\n initialValue: true\n },\n behavioursEnabled: {initialValue: true},\n wrapBehavioursEnabled: {initialValue: true},\n enableAutoIndent: {initialValue: true},\n autoScrollEditorIntoView: {\n set: function(val) {this.setAutoScrollEditorIntoView(val);}\n },\n keyboardHandler: {\n set: function(val) { this.setKeyboardHandler(val); },\n get: function() { return this.$keybindingId; },\n handlesSet: true\n },\n value: {\n set: function(val) { this.session.setValue(val); },\n get: function() { return this.getValue(); },\n handlesSet: true,\n hidden: true\n },\n session: {\n set: function(val) { this.setSession(val); },\n get: function() { return this.session; },\n handlesSet: true,\n hidden: true\n },\n \n showLineNumbers: {\n set: function(show) {\n this.renderer.$gutterLayer.setShowLineNumbers(show);\n this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER);\n if (show && this.$relativeLineNumbers)\n relativeNumberRenderer.attach(this);\n else\n relativeNumberRenderer.detach(this);\n },\n initialValue: true\n },\n relativeLineNumbers: {\n set: function(value) {\n if (this.$showLineNumbers && value)\n relativeNumberRenderer.attach(this);\n else\n relativeNumberRenderer.detach(this);\n }\n },\n placeholder: {\n set: function(message) {\n if (!this.$updatePlaceholder) {\n this.$updatePlaceholder = function() {\n var value = this.session && (this.renderer.$composition || this.getValue());\n if (value && this.renderer.placeholderNode) {\n this.renderer.off(\"afterRender\", this.$updatePlaceholder);\n dom.removeCssClass(this.container, \"ace_hasPlaceholder\");\n this.renderer.placeholderNode.remove();\n this.renderer.placeholderNode = null;\n } else if (!value && !this.renderer.placeholderNode) {\n this.renderer.on(\"afterRender\", this.$updatePlaceholder);\n dom.addCssClass(this.container, \"ace_hasPlaceholder\");\n var el = dom.createElement(\"div\");\n el.className = \"ace_placeholder\";\n el.textContent = this.$placeholder || \"\";\n this.renderer.placeholderNode = el;\n this.renderer.content.appendChild(this.renderer.placeholderNode);\n } else if (!value && this.renderer.placeholderNode) {\n this.renderer.placeholderNode.textContent = this.$placeholder || \"\";\n }\n }.bind(this);\n this.on(\"input\", this.$updatePlaceholder);\n }\n this.$updatePlaceholder();\n }\n },\n\n hScrollBarAlwaysVisible: \"renderer\",\n vScrollBarAlwaysVisible: \"renderer\",\n highlightGutterLine: \"renderer\",\n animatedScroll: \"renderer\",\n showInvisibles: \"renderer\",\n showPrintMargin: \"renderer\",\n printMarginColumn: \"renderer\",\n printMargin: \"renderer\",\n fadeFoldWidgets: \"renderer\",\n showFoldWidgets: \"renderer\",\n displayIndentGuides: \"renderer\",\n showGutter: \"renderer\",\n fontSize: \"renderer\",\n fontFamily: \"renderer\",\n maxLines: \"renderer\",\n minLines: \"renderer\",\n scrollPastEnd: \"renderer\",\n fixedWidthGutter: \"renderer\",\n theme: \"renderer\",\n hasCssTransforms: \"renderer\",\n maxPixelHeight: \"renderer\",\n useTextareaForIME: \"renderer\",\n\n scrollSpeed: \"$mouseHandler\",\n dragDelay: \"$mouseHandler\",\n dragEnabled: \"$mouseHandler\",\n focusTimeout: \"$mouseHandler\",\n tooltipFollowsMouse: \"$mouseHandler\",\n\n firstLineNumber: \"session\",\n overwrite: \"session\",\n newLineMode: \"session\",\n useWorker: \"session\",\n useSoftTabs: \"session\",\n navigateWithinSoftTabs: \"session\",\n tabSize: \"session\",\n wrap: \"session\",\n indentedSoftWrap: \"session\",\n foldStyle: \"session\",\n mode: \"session\"\n});\n\n\nvar relativeNumberRenderer = {\n getText: function(session, row) {\n return (Math.abs(session.selection.lead.row - row) || (row + 1 + (row < 9 ? \"\\xb7\" : \"\"))) + \"\";\n },\n getWidth: function(session, lastLineNumber, config) {\n return Math.max(\n lastLineNumber.toString().length,\n (config.lastRow + 1).toString().length,\n 2\n ) * config.characterWidth;\n },\n update: function(e, editor) {\n editor.renderer.$loop.schedule(editor.renderer.CHANGE_GUTTER);\n },\n attach: function(editor) {\n editor.renderer.$gutterLayer.$renderer = this;\n editor.on(\"changeSelection\", this.update);\n this.update(null, editor);\n },\n detach: function(editor) {\n if (editor.renderer.$gutterLayer.$renderer == this)\n editor.renderer.$gutterLayer.$renderer = null;\n editor.off(\"changeSelection\", this.update);\n this.update(null, editor);\n }\n};\n\nexports.Editor = Editor;\n});\n\nace.define(\"ace/undomanager\",[\"require\",\"exports\",\"module\",\"ace/range\"], function(require, exports, module) {\nvar UndoManager = function() {\n this.$maxRev = 0;\n this.$fromUndo = false;\n this.reset();\n};\n\n(function() {\n \n this.addSession = function(session) {\n this.$session = session;\n };\n this.add = function(delta, allowMerge, session) {\n if (this.$fromUndo) return;\n if (delta == this.$lastDelta) return;\n if (!this.$keepRedoStack) this.$redoStack.length = 0;\n if (allowMerge === false || !this.lastDeltas) {\n this.lastDeltas = [];\n this.$undoStack.push(this.lastDeltas);\n delta.id = this.$rev = ++this.$maxRev;\n }\n if (delta.action == \"remove\" || delta.action == \"insert\")\n this.$lastDelta = delta;\n this.lastDeltas.push(delta);\n };\n \n this.addSelection = function(selection, rev) {\n this.selections.push({\n value: selection,\n rev: rev || this.$rev\n });\n };\n \n this.startNewGroup = function() {\n this.lastDeltas = null;\n return this.$rev;\n };\n \n this.markIgnored = function(from, to) {\n if (to == null) to = this.$rev + 1;\n var stack = this.$undoStack;\n for (var i = stack.length; i--;) {\n var delta = stack[i][0];\n if (delta.id <= from)\n break;\n if (delta.id < to)\n delta.ignore = true;\n }\n this.lastDeltas = null;\n };\n \n this.getSelection = function(rev, after) {\n var stack = this.selections;\n for (var i = stack.length; i--;) {\n var selection = stack[i];\n if (selection.rev < rev) {\n if (after)\n selection = stack[i + 1];\n return selection;\n }\n }\n };\n \n this.getRevision = function() {\n return this.$rev;\n };\n \n this.getDeltas = function(from, to) {\n if (to == null) to = this.$rev + 1;\n var stack = this.$undoStack;\n var end = null, start = 0;\n for (var i = stack.length; i--;) {\n var delta = stack[i][0];\n if (delta.id < to && !end)\n end = i+1;\n if (delta.id <= from) {\n start = i + 1;\n break;\n }\n }\n return stack.slice(start, end);\n };\n \n this.getChangedRanges = function(from, to) {\n if (to == null) to = this.$rev + 1;\n \n };\n \n this.getChangedLines = function(from, to) {\n if (to == null) to = this.$rev + 1;\n \n };\n this.undo = function(session, dontSelect) {\n this.lastDeltas = null;\n var stack = this.$undoStack;\n \n if (!rearrangeUndoStack(stack, stack.length))\n return;\n \n if (!session)\n session = this.$session;\n \n if (this.$redoStackBaseRev !== this.$rev && this.$redoStack.length)\n this.$redoStack = [];\n \n this.$fromUndo = true;\n \n var deltaSet = stack.pop();\n var undoSelectionRange = null;\n if (deltaSet) {\n undoSelectionRange = session.undoChanges(deltaSet, dontSelect);\n this.$redoStack.push(deltaSet);\n this.$syncRev();\n }\n \n this.$fromUndo = false;\n\n return undoSelectionRange;\n };\n this.redo = function(session, dontSelect) {\n this.lastDeltas = null;\n \n if (!session)\n session = this.$session;\n \n this.$fromUndo = true;\n if (this.$redoStackBaseRev != this.$rev) {\n var diff = this.getDeltas(this.$redoStackBaseRev, this.$rev + 1);\n rebaseRedoStack(this.$redoStack, diff);\n this.$redoStackBaseRev = this.$rev;\n this.$redoStack.forEach(function(x) {\n x[0].id = ++this.$maxRev;\n }, this);\n }\n var deltaSet = this.$redoStack.pop();\n var redoSelectionRange = null;\n \n if (deltaSet) {\n redoSelectionRange = session.redoChanges(deltaSet, dontSelect);\n this.$undoStack.push(deltaSet);\n this.$syncRev();\n }\n this.$fromUndo = false;\n \n return redoSelectionRange;\n };\n \n this.$syncRev = function() {\n var stack = this.$undoStack;\n var nextDelta = stack[stack.length - 1];\n var id = nextDelta && nextDelta[0].id || 0;\n this.$redoStackBaseRev = id;\n this.$rev = id;\n };\n this.reset = function() {\n this.lastDeltas = null;\n this.$lastDelta = null;\n this.$undoStack = [];\n this.$redoStack = [];\n this.$rev = 0;\n this.mark = 0;\n this.$redoStackBaseRev = this.$rev;\n this.selections = [];\n };\n this.canUndo = function() {\n return this.$undoStack.length > 0;\n };\n this.canRedo = function() {\n return this.$redoStack.length > 0;\n };\n this.bookmark = function(rev) {\n if (rev == undefined)\n rev = this.$rev;\n this.mark = rev;\n };\n this.isAtBookmark = function() {\n return this.$rev === this.mark;\n };\n \n this.toJSON = function() {\n \n };\n \n this.fromJSON = function() {\n \n };\n \n this.hasUndo = this.canUndo;\n this.hasRedo = this.canRedo;\n this.isClean = this.isAtBookmark;\n this.markClean = this.bookmark;\n \n this.$prettyPrint = function(delta) {\n if (delta) return stringifyDelta(delta);\n return stringifyDelta(this.$undoStack) + \"\\n---\\n\" + stringifyDelta(this.$redoStack);\n };\n}).call(UndoManager.prototype);\n\nfunction rearrangeUndoStack(stack, pos) {\n for (var i = pos; i--; ) {\n var deltaSet = stack[i];\n if (deltaSet && !deltaSet[0].ignore) {\n while(i < pos - 1) {\n var swapped = swapGroups(stack[i], stack[i + 1]);\n stack[i] = swapped[0];\n stack[i + 1] = swapped[1];\n i++;\n }\n return true;\n }\n }\n}\n\nvar Range = require(\"./range\").Range;\nvar cmp = Range.comparePoints;\nvar comparePoints = Range.comparePoints;\n\n\n\nfunction clonePos(pos) {\n return {row: pos.row,column: pos.column};\n}\nfunction cloneDelta(d) {\n return {\n start: clonePos(d.start),\n end: clonePos(d.end),\n action: d.action,\n lines: d.lines.slice()\n };\n}\nfunction stringifyDelta(d) {\n d = d || this;\n if (Array.isArray(d)) {\n return d.map(stringifyDelta).join(\"\\n\");\n }\n var type = \"\";\n if (d.action) {\n type = d.action == \"insert\" ? \"+\" : \"-\";\n type += \"[\" + d.lines + \"]\";\n } else if (d.value) {\n if (Array.isArray(d.value)) {\n type = d.value.map(stringifyRange).join(\"\\n\");\n } else {\n type = stringifyRange(d.value);\n }\n }\n if (d.start) {\n type += stringifyRange(d);\n }\n if (d.id || d.rev) {\n type += \"\\t(\" + (d.id || d.rev) + \")\";\n }\n return type;\n}\nfunction stringifyRange(r) {\n return r.start.row + \":\" + r.start.column \n + \"=>\" + r.end.row + \":\" + r.end.column;\n}\n\nfunction swap(d1, d2) {\n var i1 = d1.action == \"insert\";\n var i2 = d2.action == \"insert\";\n \n if (i1 && i2) {\n if (cmp(d2.start, d1.end) >= 0) {\n shift(d2, d1, -1);\n } else if (cmp(d2.start, d1.start) <= 0) {\n shift(d1, d2, +1);\n } else {\n return null;\n }\n } else if (i1 && !i2) {\n if (cmp(d2.start, d1.end) >= 0) {\n shift(d2, d1, -1);\n } else if (cmp(d2.end, d1.start) <= 0) {\n shift(d1, d2, -1);\n } else {\n return null;\n }\n } else if (!i1 && i2) {\n if (cmp(d2.start, d1.start) >= 0) {\n shift(d2, d1, +1);\n } else if (cmp(d2.start, d1.start) <= 0) {\n shift(d1, d2, +1);\n } else {\n return null;\n }\n } else if (!i1 && !i2) {\n if (cmp(d2.start, d1.start) >= 0) {\n shift(d2, d1, +1);\n } else if (cmp(d2.end, d1.start) <= 0) {\n shift(d1, d2, -1);\n } else {\n return null;\n }\n }\n return [d2, d1];\n}\nfunction swapGroups(ds1, ds2) {\n for (var i = ds1.length; i--; ) {\n for (var j = 0; j < ds2.length; j++) {\n if (!swap(ds1[i], ds2[j])) {\n while (i < ds1.length) {\n while (j--) {\n swap(ds2[j], ds1[i]);\n }\n j = ds2.length;\n i++;\n } \n return [ds1, ds2];\n }\n }\n }\n ds1.selectionBefore = ds2.selectionBefore = \n ds1.selectionAfter = ds2.selectionAfter = null;\n return [ds2, ds1];\n}\nfunction xform(d1, c1) {\n var i1 = d1.action == \"insert\";\n var i2 = c1.action == \"insert\";\n \n if (i1 && i2) {\n if (cmp(d1.start, c1.start) < 0) {\n shift(c1, d1, 1);\n } else {\n shift(d1, c1, 1);\n }\n } else if (i1 && !i2) {\n if (cmp(d1.start, c1.end) >= 0) {\n shift(d1, c1, -1);\n } else if (cmp(d1.start, c1.start) <= 0) {\n shift(c1, d1, +1);\n } else {\n shift(d1, Range.fromPoints(c1.start, d1.start), -1);\n shift(c1, d1, +1);\n }\n } else if (!i1 && i2) {\n if (cmp(c1.start, d1.end) >= 0) {\n shift(c1, d1, -1);\n } else if (cmp(c1.start, d1.start) <= 0) {\n shift(d1, c1, +1);\n } else {\n shift(c1, Range.fromPoints(d1.start, c1.start), -1);\n shift(d1, c1, +1);\n }\n } else if (!i1 && !i2) {\n if (cmp(c1.start, d1.end) >= 0) {\n shift(c1, d1, -1);\n } else if (cmp(c1.end, d1.start) <= 0) {\n shift(d1, c1, -1);\n } else {\n var before, after;\n if (cmp(d1.start, c1.start) < 0) {\n before = d1;\n d1 = splitDelta(d1, c1.start);\n }\n if (cmp(d1.end, c1.end) > 0) {\n after = splitDelta(d1, c1.end);\n }\n\n shiftPos(c1.end, d1.start, d1.end, -1);\n if (after && !before) {\n d1.lines = after.lines;\n d1.start = after.start;\n d1.end = after.end;\n after = d1;\n }\n\n return [c1, before, after].filter(Boolean);\n }\n }\n return [c1, d1];\n}\n \nfunction shift(d1, d2, dir) {\n shiftPos(d1.start, d2.start, d2.end, dir);\n shiftPos(d1.end, d2.start, d2.end, dir);\n}\nfunction shiftPos(pos, start, end, dir) {\n if (pos.row == (dir == 1 ? start : end).row) {\n pos.column += dir * (end.column - start.column);\n }\n pos.row += dir * (end.row - start.row);\n}\nfunction splitDelta(c, pos) {\n var lines = c.lines;\n var end = c.end;\n c.end = clonePos(pos); \n var rowsBefore = c.end.row - c.start.row;\n var otherLines = lines.splice(rowsBefore, lines.length);\n \n var col = rowsBefore ? pos.column : pos.column - c.start.column;\n lines.push(otherLines[0].substring(0, col));\n otherLines[0] = otherLines[0].substr(col) ; \n var rest = {\n start: clonePos(pos),\n end: end,\n lines: otherLines,\n action: c.action\n };\n return rest;\n}\n\nfunction moveDeltasByOne(redoStack, d) {\n d = cloneDelta(d);\n for (var j = redoStack.length; j--;) {\n var deltaSet = redoStack[j];\n for (var i = 0; i < deltaSet.length; i++) {\n var x = deltaSet[i];\n var xformed = xform(x, d);\n d = xformed[0];\n if (xformed.length != 2) {\n if (xformed[2]) {\n deltaSet.splice(i + 1, 1, xformed[1], xformed[2]);\n i++;\n } else if (!xformed[1]) {\n deltaSet.splice(i, 1);\n i--;\n }\n }\n }\n if (!deltaSet.length) {\n redoStack.splice(j, 1); \n }\n }\n return redoStack;\n}\nfunction rebaseRedoStack(redoStack, deltaSets) {\n for (var i = 0; i < deltaSets.length; i++) {\n var deltas = deltaSets[i];\n for (var j = 0; j < deltas.length; j++) {\n moveDeltasByOne(redoStack, deltas[j]);\n }\n }\n}\n\nexports.UndoManager = UndoManager;\n\n});\n\nace.define(\"ace/layer/lines\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(require, exports, module) {\n\nvar dom = require(\"../lib/dom\");\n\nvar Lines = function(element, canvasHeight) {\n this.element = element;\n this.canvasHeight = canvasHeight || 500000;\n this.element.style.height = (this.canvasHeight * 2) + \"px\";\n \n this.cells = [];\n this.cellCache = [];\n this.$offsetCoefficient = 0;\n};\n\n(function() {\n \n this.moveContainer = function(config) {\n dom.translate(this.element, 0, -((config.firstRowScreen * config.lineHeight) % this.canvasHeight) - config.offset * this.$offsetCoefficient);\n }; \n \n this.pageChanged = function(oldConfig, newConfig) {\n return (\n Math.floor((oldConfig.firstRowScreen * oldConfig.lineHeight) / this.canvasHeight) !==\n Math.floor((newConfig.firstRowScreen * newConfig.lineHeight) / this.canvasHeight)\n );\n };\n \n this.computeLineTop = function(row, config, session) {\n var screenTop = config.firstRowScreen * config.lineHeight;\n var screenPage = Math.floor(screenTop / this.canvasHeight);\n var lineTop = session.documentToScreenRow(row, 0) * config.lineHeight;\n return lineTop - (screenPage * this.canvasHeight);\n };\n \n this.computeLineHeight = function(row, config, session) {\n return config.lineHeight * session.getRowLineCount(row);\n };\n \n this.getLength = function() {\n return this.cells.length;\n };\n \n this.get = function(index) {\n return this.cells[index];\n };\n \n this.shift = function() {\n this.$cacheCell(this.cells.shift());\n };\n \n this.pop = function() {\n this.$cacheCell(this.cells.pop());\n };\n \n this.push = function(cell) {\n if (Array.isArray(cell)) {\n this.cells.push.apply(this.cells, cell);\n var fragment = dom.createFragment(this.element);\n for (var i=0; i foldStart) {\n row = fold.end.row + 1;\n fold = session.getNextFoldLine(row, fold);\n foldStart = fold ? fold.start.row : Infinity;\n }\n if (row > lastRow) {\n while (this.$lines.getLength() > index + 1)\n this.$lines.pop();\n \n break;\n }\n\n cell = this.$lines.get(++index);\n if (cell) {\n cell.row = row;\n } else {\n cell = this.$lines.createCell(row, config, this.session, onCreateCell);\n this.$lines.push(cell);\n }\n\n this.$renderCell(cell, config, fold, row);\n row++;\n }\n \n this._signal(\"afterRender\");\n this.$updateGutterWidth(config);\n };\n\n this.$updateGutterWidth = function(config) {\n var session = this.session;\n \n var gutterRenderer = session.gutterRenderer || this.$renderer;\n \n var firstLineNumber = session.$firstLineNumber;\n var lastLineText = this.$lines.last() ? this.$lines.last().text : \"\";\n \n if (this.$fixedWidth || session.$useWrapMode)\n lastLineText = session.getLength() + firstLineNumber - 1;\n\n var gutterWidth = gutterRenderer \n ? gutterRenderer.getWidth(session, lastLineText, config)\n : lastLineText.toString().length * config.characterWidth;\n \n var padding = this.$padding || this.$computePadding();\n gutterWidth += padding.left + padding.right;\n if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) {\n this.gutterWidth = gutterWidth;\n this.element.parentNode.style.width = \n this.element.style.width = Math.ceil(this.gutterWidth) + \"px\";\n this._signal(\"changeGutterWidth\", gutterWidth);\n }\n };\n \n this.$updateCursorRow = function() {\n if (!this.$highlightGutterLine)\n return;\n \n var position = this.session.selection.getCursor();\n if (this.$cursorRow === position.row)\n return;\n \n this.$cursorRow = position.row;\n };\n \n this.updateLineHighlight = function() {\n if (!this.$highlightGutterLine)\n return;\n var row = this.session.selection.cursor.row;\n this.$cursorRow = row;\n\n if (this.$cursorCell && this.$cursorCell.row == row)\n return;\n if (this.$cursorCell)\n this.$cursorCell.element.className = this.$cursorCell.element.className.replace(\"ace_gutter-active-line \", \"\");\n var cells = this.$lines.cells;\n this.$cursorCell = null;\n for (var i = 0; i < cells.length; i++) {\n var cell = cells[i];\n if (cell.row >= this.$cursorRow) {\n if (cell.row > this.$cursorRow) {\n var fold = this.session.getFoldLine(this.$cursorRow);\n if (i > 0 && fold && fold.start.row == cells[i - 1].row)\n cell = cells[i - 1];\n else\n break;\n }\n cell.element.className = \"ace_gutter-active-line \" + cell.element.className;\n this.$cursorCell = cell;\n break;\n }\n }\n };\n \n this.scrollLines = function(config) {\n var oldConfig = this.config;\n this.config = config;\n \n this.$updateCursorRow();\n if (this.$lines.pageChanged(oldConfig, config))\n return this.update(config);\n \n this.$lines.moveContainer(config);\n\n var lastRow = Math.min(config.lastRow + config.gutterOffset, // needed to compensate for hor scollbar\n this.session.getLength() - 1);\n var oldLastRow = this.oldLastRow;\n this.oldLastRow = lastRow;\n \n if (!oldConfig || oldLastRow < config.firstRow)\n return this.update(config);\n\n if (lastRow < oldConfig.firstRow)\n return this.update(config);\n\n if (oldConfig.firstRow < config.firstRow)\n for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--)\n this.$lines.shift();\n\n if (oldLastRow > lastRow)\n for (var row=this.session.getFoldedRowCount(lastRow + 1, oldLastRow); row>0; row--)\n this.$lines.pop();\n\n if (config.firstRow < oldConfig.firstRow) {\n this.$lines.unshift(this.$renderLines(config, config.firstRow, oldConfig.firstRow - 1));\n }\n\n if (lastRow > oldLastRow) {\n this.$lines.push(this.$renderLines(config, oldLastRow + 1, lastRow));\n }\n \n this.updateLineHighlight();\n \n this._signal(\"afterRender\");\n this.$updateGutterWidth(config);\n };\n\n this.$renderLines = function(config, firstRow, lastRow) {\n var fragment = [];\n var row = firstRow;\n var foldLine = this.session.getNextFoldLine(row);\n var foldStart = foldLine ? foldLine.start.row : Infinity;\n\n while (true) {\n if (row > foldStart) {\n row = foldLine.end.row+1;\n foldLine = this.session.getNextFoldLine(row, foldLine);\n foldStart = foldLine ? foldLine.start.row : Infinity;\n }\n if (row > lastRow)\n break;\n\n var cell = this.$lines.createCell(row, config, this.session, onCreateCell);\n this.$renderCell(cell, config, foldLine, row);\n fragment.push(cell);\n\n row++;\n }\n return fragment;\n };\n \n this.$renderCell = function(cell, config, fold, row) {\n var element = cell.element;\n \n var session = this.session;\n \n var textNode = element.childNodes[0];\n var foldWidget = element.childNodes[1];\n\n var firstLineNumber = session.$firstLineNumber;\n \n var breakpoints = session.$breakpoints;\n var decorations = session.$decorations;\n var gutterRenderer = session.gutterRenderer || this.$renderer;\n var foldWidgets = this.$showFoldWidgets && session.foldWidgets;\n var foldStart = fold ? fold.start.row : Number.MAX_VALUE;\n \n var className = \"ace_gutter-cell \";\n if (this.$highlightGutterLine) {\n if (row == this.$cursorRow || (fold && row < this.$cursorRow && row >= foldStart && this.$cursorRow <= fold.end.row)) {\n className += \"ace_gutter-active-line \";\n if (this.$cursorCell != cell) {\n if (this.$cursorCell)\n this.$cursorCell.element.className = this.$cursorCell.element.className.replace(\"ace_gutter-active-line \", \"\");\n this.$cursorCell = cell;\n }\n }\n }\n \n if (breakpoints[row])\n className += breakpoints[row];\n if (decorations[row])\n className += decorations[row];\n if (this.$annotations[row])\n className += this.$annotations[row].className;\n if (element.className != className)\n element.className = className;\n\n if (foldWidgets) {\n var c = foldWidgets[row];\n if (c == null)\n c = foldWidgets[row] = session.getFoldWidget(row);\n }\n\n if (c) {\n var className = \"ace_fold-widget ace_\" + c;\n if (c == \"start\" && row == foldStart && row < fold.end.row)\n className += \" ace_closed\";\n else\n className += \" ace_open\";\n if (foldWidget.className != className)\n foldWidget.className = className;\n\n var foldHeight = config.lineHeight + \"px\";\n dom.setStyle(foldWidget.style, \"height\", foldHeight);\n dom.setStyle(foldWidget.style, \"display\", \"inline-block\");\n } else {\n if (foldWidget) {\n dom.setStyle(foldWidget.style, \"display\", \"none\");\n }\n }\n \n var text = (gutterRenderer\n ? gutterRenderer.getText(session, row)\n : row + firstLineNumber).toString();\n \n if (text !== textNode.data) {\n textNode.data = text;\n }\n \n dom.setStyle(cell.element.style, \"height\", this.$lines.computeLineHeight(row, config, session) + \"px\");\n dom.setStyle(cell.element.style, \"top\", this.$lines.computeLineTop(row, config, session) + \"px\");\n \n cell.text = text;\n return cell;\n };\n\n this.$fixedWidth = false;\n \n this.$highlightGutterLine = true;\n this.$renderer = \"\";\n this.setHighlightGutterLine = function(highlightGutterLine) {\n this.$highlightGutterLine = highlightGutterLine;\n };\n \n this.$showLineNumbers = true;\n this.$renderer = \"\";\n this.setShowLineNumbers = function(show) {\n this.$renderer = !show && {\n getWidth: function() {return 0;},\n getText: function() {return \"\";}\n };\n };\n \n this.getShowLineNumbers = function() {\n return this.$showLineNumbers;\n };\n \n this.$showFoldWidgets = true;\n this.setShowFoldWidgets = function(show) {\n if (show)\n dom.addCssClass(this.element, \"ace_folding-enabled\");\n else\n dom.removeCssClass(this.element, \"ace_folding-enabled\");\n\n this.$showFoldWidgets = show;\n this.$padding = null;\n };\n \n this.getShowFoldWidgets = function() {\n return this.$showFoldWidgets;\n };\n\n this.$computePadding = function() {\n if (!this.element.firstChild)\n return {left: 0, right: 0};\n var style = dom.computedStyle(this.element.firstChild);\n this.$padding = {};\n this.$padding.left = (parseInt(style.borderLeftWidth) || 0)\n + (parseInt(style.paddingLeft) || 0) + 1;\n this.$padding.right = (parseInt(style.borderRightWidth) || 0)\n + (parseInt(style.paddingRight) || 0);\n return this.$padding;\n };\n\n this.getRegion = function(point) {\n var padding = this.$padding || this.$computePadding();\n var rect = this.element.getBoundingClientRect();\n if (point.x < padding.left + rect.left)\n return \"markers\";\n if (this.$showFoldWidgets && point.x > rect.right - padding.right)\n return \"foldWidgets\";\n };\n\n}).call(Gutter.prototype);\n\nfunction onCreateCell(element) {\n var textNode = document.createTextNode('');\n element.appendChild(textNode);\n \n var foldWidget = dom.createElement(\"span\");\n element.appendChild(foldWidget);\n \n return element;\n}\n\nexports.Gutter = Gutter;\n\n});\n\nace.define(\"ace/layer/marker\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/lib/dom\"], function(require, exports, module) {\n\nvar Range = require(\"../range\").Range;\nvar dom = require(\"../lib/dom\");\n\nvar Marker = function(parentEl) {\n this.element = dom.createElement(\"div\");\n this.element.className = \"ace_layer ace_marker-layer\";\n parentEl.appendChild(this.element);\n};\n\n(function() {\n\n this.$padding = 0;\n\n this.setPadding = function(padding) {\n this.$padding = padding;\n };\n this.setSession = function(session) {\n this.session = session;\n };\n \n this.setMarkers = function(markers) {\n this.markers = markers;\n };\n \n this.elt = function(className, css) {\n var x = this.i != -1 && this.element.childNodes[this.i];\n if (!x) {\n x = document.createElement(\"div\");\n this.element.appendChild(x);\n this.i = -1;\n } else {\n this.i++;\n }\n x.style.cssText = css;\n x.className = className;\n };\n\n this.update = function(config) {\n if (!config) return;\n\n this.config = config;\n\n this.i = 0;\n var html;\n for (var key in this.markers) {\n var marker = this.markers[key];\n\n if (!marker.range) {\n marker.update(html, this, this.session, config);\n continue;\n }\n\n var range = marker.range.clipRows(config.firstRow, config.lastRow);\n if (range.isEmpty()) continue;\n\n range = range.toScreenRange(this.session);\n if (marker.renderer) {\n var top = this.$getTop(range.start.row, config);\n var left = this.$padding + range.start.column * config.characterWidth;\n marker.renderer(html, range, left, top, config);\n } else if (marker.type == \"fullLine\") {\n this.drawFullLineMarker(html, range, marker.clazz, config);\n } else if (marker.type == \"screenLine\") {\n this.drawScreenLineMarker(html, range, marker.clazz, config);\n } else if (range.isMultiLine()) {\n if (marker.type == \"text\")\n this.drawTextMarker(html, range, marker.clazz, config);\n else\n this.drawMultiLineMarker(html, range, marker.clazz, config);\n } else {\n this.drawSingleLineMarker(html, range, marker.clazz + \" ace_start\" + \" ace_br15\", config);\n }\n }\n if (this.i !=-1) {\n while (this.i < this.element.childElementCount)\n this.element.removeChild(this.element.lastChild);\n }\n };\n\n this.$getTop = function(row, layerConfig) {\n return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;\n };\n\n function getBorderClass(tl, tr, br, bl) {\n return (tl ? 1 : 0) | (tr ? 2 : 0) | (br ? 4 : 0) | (bl ? 8 : 0);\n }\n this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig, extraStyle) {\n var session = this.session;\n var start = range.start.row;\n var end = range.end.row;\n var row = start;\n var prev = 0; \n var curr = 0;\n var next = session.getScreenLastRowColumn(row);\n var lineRange = new Range(row, range.start.column, row, curr);\n for (; row <= end; row++) {\n lineRange.start.row = lineRange.end.row = row;\n lineRange.start.column = row == start ? range.start.column : session.getRowWrapIndent(row);\n lineRange.end.column = next;\n prev = curr;\n curr = next;\n next = row + 1 < end ? session.getScreenLastRowColumn(row + 1) : row == end ? 0 : range.end.column;\n this.drawSingleLineMarker(stringBuilder, lineRange, \n clazz + (row == start ? \" ace_start\" : \"\") + \" ace_br\"\n + getBorderClass(row == start || row == start + 1 && range.start.column, prev < curr, curr > next, row == end),\n layerConfig, row == end ? 0 : 1, extraStyle);\n }\n };\n this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {\n var padding = this.$padding;\n var height = config.lineHeight;\n var top = this.$getTop(range.start.row, config);\n var left = padding + range.start.column * config.characterWidth;\n extraStyle = extraStyle || \"\";\n\n if (this.session.$bidiHandler.isBidiRow(range.start.row)) {\n var range1 = range.clone();\n range1.end.row = range1.start.row;\n range1.end.column = this.session.getLine(range1.start.row).length;\n this.drawBidiSingleLineMarker(stringBuilder, range1, clazz + \" ace_br1 ace_start\", config, null, extraStyle);\n } else {\n this.elt(\n clazz + \" ace_br1 ace_start\",\n \"height:\"+ height+ \"px;\"+ \"right:0;\"+ \"top:\"+top+ \"px;left:\"+ left+ \"px;\" + (extraStyle || \"\")\n );\n }\n if (this.session.$bidiHandler.isBidiRow(range.end.row)) {\n var range1 = range.clone();\n range1.start.row = range1.end.row;\n range1.start.column = 0;\n this.drawBidiSingleLineMarker(stringBuilder, range1, clazz + \" ace_br12\", config, null, extraStyle);\n } else {\n top = this.$getTop(range.end.row, config);\n var width = range.end.column * config.characterWidth;\n\n this.elt(\n clazz + \" ace_br12\",\n \"height:\"+ height+ \"px;\"+\n \"width:\"+ width+ \"px;\"+\n \"top:\"+ top+ \"px;\"+\n \"left:\"+ padding+ \"px;\"+ (extraStyle || \"\")\n );\n }\n height = (range.end.row - range.start.row - 1) * config.lineHeight;\n if (height <= 0)\n return;\n top = this.$getTop(range.start.row + 1, config);\n \n var radiusClass = (range.start.column ? 1 : 0) | (range.end.column ? 0 : 8);\n\n this.elt(\n clazz + (radiusClass ? \" ace_br\" + radiusClass : \"\"),\n \"height:\"+ height+ \"px;\"+\n \"right:0;\"+\n \"top:\"+ top+ \"px;\"+\n \"left:\"+ padding+ \"px;\"+ (extraStyle || \"\")\n );\n };\n this.drawSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) {\n if (this.session.$bidiHandler.isBidiRow(range.start.row))\n return this.drawBidiSingleLineMarker(stringBuilder, range, clazz, config, extraLength, extraStyle);\n var height = config.lineHeight;\n var width = (range.end.column + (extraLength || 0) - range.start.column) * config.characterWidth;\n\n var top = this.$getTop(range.start.row, config);\n var left = this.$padding + range.start.column * config.characterWidth;\n\n this.elt(\n clazz,\n \"height:\"+ height+ \"px;\"+\n \"width:\"+ width+ \"px;\"+\n \"top:\"+ top+ \"px;\"+\n \"left:\"+ left+ \"px;\"+ (extraStyle || \"\")\n );\n };\n this.drawBidiSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) {\n var height = config.lineHeight, top = this.$getTop(range.start.row, config), padding = this.$padding;\n var selections = this.session.$bidiHandler.getSelections(range.start.column, range.end.column);\n\n selections.forEach(function(selection) {\n this.elt(\n clazz,\n \"height:\" + height + \"px;\" +\n \"width:\" + selection.width + (extraLength || 0) + \"px;\" +\n \"top:\" + top + \"px;\" +\n \"left:\" + (padding + selection.left) + \"px;\" + (extraStyle || \"\")\n );\n }, this);\n };\n\n this.drawFullLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {\n var top = this.$getTop(range.start.row, config);\n var height = config.lineHeight;\n if (range.start.row != range.end.row)\n height += this.$getTop(range.end.row, config) - top;\n\n this.elt(\n clazz,\n \"height:\"+ height+ \"px;\"+\n \"top:\"+ top+ \"px;\"+\n \"left:0;right:0;\"+ (extraStyle || \"\")\n );\n };\n \n this.drawScreenLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {\n var top = this.$getTop(range.start.row, config);\n var height = config.lineHeight;\n\n this.elt(\n clazz,\n \"height:\"+ height+ \"px;\"+\n \"top:\"+ top+ \"px;\"+\n \"left:0;right:0;\"+ (extraStyle || \"\")\n );\n };\n\n}).call(Marker.prototype);\n\nexports.Marker = Marker;\n\n});\n\nace.define(\"ace/layer/text\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/lib/lang\",\"ace/layer/lines\",\"ace/lib/event_emitter\"], function(require, exports, module) {\n\nvar oop = require(\"../lib/oop\");\nvar dom = require(\"../lib/dom\");\nvar lang = require(\"../lib/lang\");\nvar Lines = require(\"./lines\").Lines;\nvar EventEmitter = require(\"../lib/event_emitter\").EventEmitter;\n\nvar Text = function(parentEl) {\n this.dom = dom; \n this.element = this.dom.createElement(\"div\");\n this.element.className = \"ace_layer ace_text-layer\";\n parentEl.appendChild(this.element);\n this.$updateEolChar = this.$updateEolChar.bind(this);\n this.$lines = new Lines(this.element);\n};\n\n(function() {\n\n oop.implement(this, EventEmitter);\n\n this.EOF_CHAR = \"\\xB6\";\n this.EOL_CHAR_LF = \"\\xAC\";\n this.EOL_CHAR_CRLF = \"\\xa4\";\n this.EOL_CHAR = this.EOL_CHAR_LF;\n this.TAB_CHAR = \"\\u2014\"; //\"\\u21E5\";\n this.SPACE_CHAR = \"\\xB7\";\n this.$padding = 0;\n this.MAX_LINE_LENGTH = 10000;\n\n this.$updateEolChar = function() {\n var doc = this.session.doc;\n var unixMode = doc.getNewLineCharacter() == \"\\n\" && doc.getNewLineMode() != \"windows\";\n var EOL_CHAR = unixMode ? this.EOL_CHAR_LF : this.EOL_CHAR_CRLF;\n if (this.EOL_CHAR != EOL_CHAR) {\n this.EOL_CHAR = EOL_CHAR;\n return true;\n }\n };\n\n this.setPadding = function(padding) {\n this.$padding = padding;\n this.element.style.margin = \"0 \" + padding + \"px\";\n };\n\n this.getLineHeight = function() {\n return this.$fontMetrics.$characterSize.height || 0;\n };\n\n this.getCharacterWidth = function() {\n return this.$fontMetrics.$characterSize.width || 0;\n };\n \n this.$setFontMetrics = function(measure) {\n this.$fontMetrics = measure;\n this.$fontMetrics.on(\"changeCharacterSize\", function(e) {\n this._signal(\"changeCharacterSize\", e);\n }.bind(this));\n this.$pollSizeChanges();\n };\n\n this.checkForSizeChanges = function() {\n this.$fontMetrics.checkForSizeChanges();\n };\n this.$pollSizeChanges = function() {\n return this.$pollSizeChangesTimer = this.$fontMetrics.$pollSizeChanges();\n };\n this.setSession = function(session) {\n this.session = session;\n if (session)\n this.$computeTabString();\n };\n\n this.showInvisibles = false;\n this.showSpaces = false;\n this.showTabs = false;\n this.showEOL = false;\n this.setShowInvisibles = function(showInvisibles) {\n if (this.showInvisibles == showInvisibles)\n return false;\n\n this.showInvisibles = showInvisibles;\n if (typeof showInvisibles == \"string\") {\n this.showSpaces = /tab/i.test(showInvisibles);\n this.showTabs = /space/i.test(showInvisibles);\n this.showEOL = /eol/i.test(showInvisibles);\n } else {\n this.showSpaces = this.showTabs = this.showEOL = showInvisibles;\n }\n this.$computeTabString();\n return true;\n };\n\n this.displayIndentGuides = true;\n this.setDisplayIndentGuides = function(display) {\n if (this.displayIndentGuides == display)\n return false;\n\n this.displayIndentGuides = display;\n this.$computeTabString();\n return true;\n };\n\n this.$tabStrings = [];\n this.onChangeTabSize =\n this.$computeTabString = function() {\n var tabSize = this.session.getTabSize();\n this.tabSize = tabSize;\n var tabStr = this.$tabStrings = [0];\n for (var i = 1; i < tabSize + 1; i++) {\n if (this.showTabs) {\n var span = this.dom.createElement(\"span\");\n span.className = \"ace_invisible ace_invisible_tab\";\n span.textContent = lang.stringRepeat(this.TAB_CHAR, i);\n tabStr.push(span);\n } else {\n tabStr.push(this.dom.createTextNode(lang.stringRepeat(\" \", i), this.element));\n }\n }\n if (this.displayIndentGuides) {\n this.$indentGuideRe = /\\s\\S| \\t|\\t |\\s$/;\n var className = \"ace_indent-guide\";\n var spaceClass = this.showSpaces ? \" ace_invisible ace_invisible_space\" : \"\";\n var spaceContent = this.showSpaces\n ? lang.stringRepeat(this.SPACE_CHAR, this.tabSize)\n : lang.stringRepeat(\" \", this.tabSize);\n\n var tabClass = this.showTabs ? \" ace_invisible ace_invisible_tab\" : \"\";\n var tabContent = this.showTabs \n ? lang.stringRepeat(this.TAB_CHAR, this.tabSize)\n : spaceContent;\n\n var span = this.dom.createElement(\"span\");\n span.className = className + spaceClass;\n span.textContent = spaceContent;\n this.$tabStrings[\" \"] = span;\n \n var span = this.dom.createElement(\"span\");\n span.className = className + tabClass;\n span.textContent = tabContent;\n this.$tabStrings[\"\\t\"] = span;\n }\n };\n\n this.updateLines = function(config, firstRow, lastRow) {\n if (this.config.lastRow != config.lastRow ||\n this.config.firstRow != config.firstRow) {\n return this.update(config);\n }\n \n this.config = config;\n\n var first = Math.max(firstRow, config.firstRow);\n var last = Math.min(lastRow, config.lastRow);\n\n var lineElements = this.element.childNodes;\n var lineElementsIdx = 0;\n\n for (var row = config.firstRow; row < first; row++) {\n var foldLine = this.session.getFoldLine(row);\n if (foldLine) {\n if (foldLine.containsRow(first)) {\n first = foldLine.start.row;\n break;\n } else {\n row = foldLine.end.row;\n }\n }\n lineElementsIdx ++;\n }\n\n var heightChanged = false;\n var row = first;\n var foldLine = this.session.getNextFoldLine(row);\n var foldStart = foldLine ? foldLine.start.row : Infinity;\n\n while (true) {\n if (row > foldStart) {\n row = foldLine.end.row+1;\n foldLine = this.session.getNextFoldLine(row, foldLine);\n foldStart = foldLine ? foldLine.start.row :Infinity;\n }\n if (row > last)\n break;\n\n var lineElement = lineElements[lineElementsIdx++];\n if (lineElement) {\n this.dom.removeChildren(lineElement);\n this.$renderLine(\n lineElement, row, row == foldStart ? foldLine : false\n );\n\n if (heightChanged)\n lineElement.style.top = this.$lines.computeLineTop(row, config, this.session) + \"px\";\n\n var height = (config.lineHeight * this.session.getRowLength(row)) + \"px\";\n if (lineElement.style.height != height) {\n heightChanged = true;\n lineElement.style.height = height;\n }\n }\n row++;\n }\n if (heightChanged) {\n while (lineElementsIdx < this.$lines.cells.length) {\n var cell = this.$lines.cells[lineElementsIdx++];\n cell.element.style.top = this.$lines.computeLineTop(cell.row, config, this.session) + \"px\";\n }\n }\n };\n\n this.scrollLines = function(config) {\n var oldConfig = this.config;\n this.config = config;\n\n if (this.$lines.pageChanged(oldConfig, config))\n return this.update(config);\n \n this.$lines.moveContainer(config);\n \n var lastRow = config.lastRow;\n var oldLastRow = oldConfig ? oldConfig.lastRow : -1;\n\n if (!oldConfig || oldLastRow < config.firstRow)\n return this.update(config);\n\n if (lastRow < oldConfig.firstRow)\n return this.update(config);\n\n if (!oldConfig || oldConfig.lastRow < config.firstRow)\n return this.update(config);\n\n if (config.lastRow < oldConfig.firstRow)\n return this.update(config);\n\n if (oldConfig.firstRow < config.firstRow)\n for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--)\n this.$lines.shift();\n\n if (oldConfig.lastRow > config.lastRow)\n for (var row=this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row>0; row--)\n this.$lines.pop();\n\n if (config.firstRow < oldConfig.firstRow) {\n this.$lines.unshift(this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1));\n }\n\n if (config.lastRow > oldConfig.lastRow) {\n this.$lines.push(this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow));\n }\n };\n\n this.$renderLinesFragment = function(config, firstRow, lastRow) {\n var fragment = [];\n var row = firstRow;\n var foldLine = this.session.getNextFoldLine(row);\n var foldStart = foldLine ? foldLine.start.row : Infinity;\n\n while (true) {\n if (row > foldStart) {\n row = foldLine.end.row+1;\n foldLine = this.session.getNextFoldLine(row, foldLine);\n foldStart = foldLine ? foldLine.start.row : Infinity;\n }\n if (row > lastRow)\n break;\n\n var line = this.$lines.createCell(row, config, this.session);\n \n var lineEl = line.element;\n this.dom.removeChildren(lineEl);\n dom.setStyle(lineEl.style, \"height\", this.$lines.computeLineHeight(row, config, this.session) + \"px\");\n dom.setStyle(lineEl.style, \"top\", this.$lines.computeLineTop(row, config, this.session) + \"px\");\n this.$renderLine(lineEl, row, row == foldStart ? foldLine : false);\n\n if (this.$useLineGroups()) {\n lineEl.className = \"ace_line_group\";\n } else {\n lineEl.className = \"ace_line\";\n }\n fragment.push(line);\n\n row++;\n }\n return fragment;\n };\n\n this.update = function(config) {\n this.$lines.moveContainer(config);\n \n this.config = config;\n\n var firstRow = config.firstRow;\n var lastRow = config.lastRow;\n\n var lines = this.$lines;\n while (lines.getLength())\n lines.pop();\n \n lines.push(this.$renderLinesFragment(config, firstRow, lastRow));\n };\n\n this.$textToken = {\n \"text\": true,\n \"rparen\": true,\n \"lparen\": true\n };\n\n this.$renderToken = function(parent, screenColumn, token, value) {\n var self = this;\n var re = /(\\t)|( +)|([\\x00-\\x1f\\x80-\\xa0\\xad\\u1680\\u180E\\u2000-\\u200f\\u2028\\u2029\\u202F\\u205F\\uFEFF\\uFFF9-\\uFFFC]+)|(\\u3000)|([\\u1100-\\u115F\\u11A3-\\u11A7\\u11FA-\\u11FF\\u2329-\\u232A\\u2E80-\\u2E99\\u2E9B-\\u2EF3\\u2F00-\\u2FD5\\u2FF0-\\u2FFB\\u3001-\\u303E\\u3041-\\u3096\\u3099-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u3190-\\u31BA\\u31C0-\\u31E3\\u31F0-\\u321E\\u3220-\\u3247\\u3250-\\u32FE\\u3300-\\u4DBF\\u4E00-\\uA48C\\uA490-\\uA4C6\\uA960-\\uA97C\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFAFF\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE66\\uFE68-\\uFE6B\\uFF01-\\uFF60\\uFFE0-\\uFFE6]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\n \n var valueFragment = this.dom.createFragment(this.element);\n\n var m;\n var i = 0;\n while (m = re.exec(value)) {\n var tab = m[1];\n var simpleSpace = m[2];\n var controlCharacter = m[3];\n var cjkSpace = m[4];\n var cjk = m[5];\n \n if (!self.showSpaces && simpleSpace)\n continue;\n\n var before = i != m.index ? value.slice(i, m.index) : \"\";\n\n i = m.index + m[0].length;\n \n if (before) {\n valueFragment.appendChild(this.dom.createTextNode(before, this.element));\n }\n \n if (tab) {\n var tabSize = self.session.getScreenTabSize(screenColumn + m.index);\n valueFragment.appendChild(self.$tabStrings[tabSize].cloneNode(true));\n screenColumn += tabSize - 1;\n } else if (simpleSpace) {\n if (self.showSpaces) {\n var span = this.dom.createElement(\"span\");\n span.className = \"ace_invisible ace_invisible_space\";\n span.textContent = lang.stringRepeat(self.SPACE_CHAR, simpleSpace.length);\n valueFragment.appendChild(span);\n } else {\n valueFragment.appendChild(this.com.createTextNode(simpleSpace, this.element));\n }\n } else if (controlCharacter) {\n var span = this.dom.createElement(\"span\");\n span.className = \"ace_invisible ace_invisible_space ace_invalid\";\n span.textContent = lang.stringRepeat(self.SPACE_CHAR, controlCharacter.length);\n valueFragment.appendChild(span);\n } else if (cjkSpace) {\n screenColumn += 1;\n \n var span = this.dom.createElement(\"span\");\n span.style.width = (self.config.characterWidth * 2) + \"px\";\n span.className = self.showSpaces ? \"ace_cjk ace_invisible ace_invisible_space\" : \"ace_cjk\";\n span.textContent = self.showSpaces ? self.SPACE_CHAR : cjkSpace;\n valueFragment.appendChild(span);\n } else if (cjk) {\n screenColumn += 1;\n var span = this.dom.createElement(\"span\");\n span.style.width = (self.config.characterWidth * 2) + \"px\";\n span.className = \"ace_cjk\";\n span.textContent = cjk;\n valueFragment.appendChild(span);\n }\n }\n \n valueFragment.appendChild(this.dom.createTextNode(i ? value.slice(i) : value, this.element));\n\n if (!this.$textToken[token.type]) {\n var classes = \"ace_\" + token.type.replace(/\\./g, \" ace_\");\n var span = this.dom.createElement(\"span\");\n if (token.type == \"fold\")\n span.style.width = (token.value.length * this.config.characterWidth) + \"px\";\n \n span.className = classes;\n span.appendChild(valueFragment);\n \n parent.appendChild(span);\n }\n else {\n parent.appendChild(valueFragment);\n }\n \n return screenColumn + value.length;\n };\n\n this.renderIndentGuide = function(parent, value, max) {\n var cols = value.search(this.$indentGuideRe);\n if (cols <= 0 || cols >= max)\n return value;\n if (value[0] == \" \") {\n cols -= cols % this.tabSize;\n var count = cols/this.tabSize;\n for (var i=0; i= splitChars) {\n screenColumn = this.$renderToken(\n lineEl, screenColumn,\n token, value.substring(0, splitChars - chars)\n );\n value = value.substring(splitChars - chars);\n chars = splitChars;\n\n lineEl = this.$createLineElement();\n parent.appendChild(lineEl);\n\n lineEl.appendChild(this.dom.createTextNode(lang.stringRepeat(\"\\xa0\", splits.indent), this.element));\n\n split ++;\n screenColumn = 0;\n splitChars = splits[split] || Number.MAX_VALUE;\n }\n if (value.length != 0) {\n chars += value.length;\n screenColumn = this.$renderToken(\n lineEl, screenColumn, token, value\n );\n }\n }\n }\n \n if (splits[splits.length - 1] > this.MAX_LINE_LENGTH)\n this.$renderOverflowMessage(lineEl, screenColumn, null, \"\", true);\n };\n\n this.$renderSimpleLine = function(parent, tokens) {\n var screenColumn = 0;\n var token = tokens[0];\n var value = token.value;\n if (this.displayIndentGuides)\n value = this.renderIndentGuide(parent, value);\n if (value)\n screenColumn = this.$renderToken(parent, screenColumn, token, value);\n for (var i = 1; i < tokens.length; i++) {\n token = tokens[i];\n value = token.value;\n if (screenColumn + value.length > this.MAX_LINE_LENGTH)\n return this.$renderOverflowMessage(parent, screenColumn, token, value);\n screenColumn = this.$renderToken(parent, screenColumn, token, value);\n }\n };\n \n this.$renderOverflowMessage = function(parent, screenColumn, token, value, hide) {\n token && this.$renderToken(parent, screenColumn, token,\n value.slice(0, this.MAX_LINE_LENGTH - screenColumn));\n \n var overflowEl = this.dom.createElement(\"span\");\n overflowEl.className = \"ace_inline_button ace_keyword ace_toggle_wrap\";\n overflowEl.textContent = hide ? \"\" : \"\";\n \n parent.appendChild(overflowEl); \n };\n this.$renderLine = function(parent, row, foldLine) {\n if (!foldLine && foldLine != false)\n foldLine = this.session.getFoldLine(row);\n\n if (foldLine)\n var tokens = this.$getFoldLineTokens(row, foldLine);\n else\n var tokens = this.session.getTokens(row);\n\n var lastLineEl = parent;\n if (tokens.length) {\n var splits = this.session.getRowSplitData(row);\n if (splits && splits.length) {\n this.$renderWrappedLine(parent, tokens, splits);\n var lastLineEl = parent.lastChild;\n } else {\n var lastLineEl = parent;\n if (this.$useLineGroups()) {\n lastLineEl = this.$createLineElement();\n parent.appendChild(lastLineEl);\n }\n this.$renderSimpleLine(lastLineEl, tokens);\n }\n } else if (this.$useLineGroups()) {\n lastLineEl = this.$createLineElement();\n parent.appendChild(lastLineEl);\n }\n\n if (this.showEOL && lastLineEl) {\n if (foldLine)\n row = foldLine.end.row;\n\n var invisibleEl = this.dom.createElement(\"span\");\n invisibleEl.className = \"ace_invisible ace_invisible_eol\";\n invisibleEl.textContent = row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR;\n \n lastLineEl.appendChild(invisibleEl);\n }\n };\n\n this.$getFoldLineTokens = function(row, foldLine) {\n var session = this.session;\n var renderTokens = [];\n\n function addTokens(tokens, from, to) {\n var idx = 0, col = 0;\n while ((col + tokens[idx].value.length) < from) {\n col += tokens[idx].value.length;\n idx++;\n\n if (idx == tokens.length)\n return;\n }\n if (col != from) {\n var value = tokens[idx].value.substring(from - col);\n if (value.length > (to - from))\n value = value.substring(0, to - from);\n\n renderTokens.push({\n type: tokens[idx].type,\n value: value\n });\n\n col = from + value.length;\n idx += 1;\n }\n\n while (col < to && idx < tokens.length) {\n var value = tokens[idx].value;\n if (value.length + col > to) {\n renderTokens.push({\n type: tokens[idx].type,\n value: value.substring(0, to - col)\n });\n } else\n renderTokens.push(tokens[idx]);\n col += value.length;\n idx += 1;\n }\n }\n\n var tokens = session.getTokens(row);\n foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {\n if (placeholder != null) {\n renderTokens.push({\n type: \"fold\",\n value: placeholder\n });\n } else {\n if (isNewRow)\n tokens = session.getTokens(row);\n\n if (tokens.length)\n addTokens(tokens, lastColumn, column);\n }\n }, foldLine.end.row, this.session.getLine(foldLine.end.row).length);\n\n return renderTokens;\n };\n\n this.$useLineGroups = function() {\n return this.session.getUseWrapMode();\n };\n\n this.destroy = function() {};\n}).call(Text.prototype);\n\nexports.Text = Text;\n\n});\n\nace.define(\"ace/layer/cursor\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(require, exports, module) {\n\nvar dom = require(\"../lib/dom\");\n\nvar Cursor = function(parentEl) {\n this.element = dom.createElement(\"div\");\n this.element.className = \"ace_layer ace_cursor-layer\";\n parentEl.appendChild(this.element);\n \n this.isVisible = false;\n this.isBlinking = true;\n this.blinkInterval = 1000;\n this.smoothBlinking = false;\n\n this.cursors = [];\n this.cursor = this.addCursor();\n dom.addCssClass(this.element, \"ace_hidden-cursors\");\n this.$updateCursors = this.$updateOpacity.bind(this);\n};\n\n(function() {\n \n this.$updateOpacity = function(val) {\n var cursors = this.cursors;\n for (var i = cursors.length; i--; )\n dom.setStyle(cursors[i].style, \"opacity\", val ? \"\" : \"0\");\n };\n\n this.$startCssAnimation = function() {\n var cursors = this.cursors;\n for (var i = cursors.length; i--; )\n cursors[i].style.animationDuration = this.blinkInterval + \"ms\";\n\n setTimeout(function() {\n dom.addCssClass(this.element, \"ace_animate-blinking\");\n }.bind(this));\n };\n \n this.$stopCssAnimation = function() {\n dom.removeCssClass(this.element, \"ace_animate-blinking\");\n };\n\n this.$padding = 0;\n this.setPadding = function(padding) {\n this.$padding = padding;\n };\n\n this.setSession = function(session) {\n this.session = session;\n };\n\n this.setBlinking = function(blinking) {\n if (blinking != this.isBlinking) {\n this.isBlinking = blinking;\n this.restartTimer();\n }\n };\n\n this.setBlinkInterval = function(blinkInterval) {\n if (blinkInterval != this.blinkInterval) {\n this.blinkInterval = blinkInterval;\n this.restartTimer();\n }\n };\n\n this.setSmoothBlinking = function(smoothBlinking) {\n if (smoothBlinking != this.smoothBlinking) {\n this.smoothBlinking = smoothBlinking;\n dom.setCssClass(this.element, \"ace_smooth-blinking\", smoothBlinking);\n this.$updateCursors(true);\n this.restartTimer();\n }\n };\n\n this.addCursor = function() {\n var el = dom.createElement(\"div\");\n el.className = \"ace_cursor\";\n this.element.appendChild(el);\n this.cursors.push(el);\n return el;\n };\n\n this.removeCursor = function() {\n if (this.cursors.length > 1) {\n var el = this.cursors.pop();\n el.parentNode.removeChild(el);\n return el;\n }\n };\n\n this.hideCursor = function() {\n this.isVisible = false;\n dom.addCssClass(this.element, \"ace_hidden-cursors\");\n this.restartTimer();\n };\n\n this.showCursor = function() {\n this.isVisible = true;\n dom.removeCssClass(this.element, \"ace_hidden-cursors\");\n this.restartTimer();\n };\n\n this.restartTimer = function() {\n var update = this.$updateCursors;\n clearInterval(this.intervalId);\n clearTimeout(this.timeoutId);\n this.$stopCssAnimation();\n\n if (this.smoothBlinking) {\n dom.removeCssClass(this.element, \"ace_smooth-blinking\");\n }\n \n update(true);\n\n if (!this.isBlinking || !this.blinkInterval || !this.isVisible) {\n this.$stopCssAnimation();\n return;\n }\n\n if (this.smoothBlinking) {\n setTimeout(function(){\n dom.addCssClass(this.element, \"ace_smooth-blinking\");\n }.bind(this));\n }\n \n if (dom.HAS_CSS_ANIMATION) {\n this.$startCssAnimation();\n } else {\n var blink = function(){\n this.timeoutId = setTimeout(function() {\n update(false);\n }, 0.6 * this.blinkInterval);\n }.bind(this);\n \n this.intervalId = setInterval(function() {\n update(true);\n blink();\n }, this.blinkInterval);\n blink();\n }\n };\n\n this.getPixelPosition = function(position, onScreen) {\n if (!this.config || !this.session)\n return {left : 0, top : 0};\n\n if (!position)\n position = this.session.selection.getCursor();\n var pos = this.session.documentToScreenPosition(position);\n var cursorLeft = this.$padding + (this.session.$bidiHandler.isBidiRow(pos.row, position.row)\n ? this.session.$bidiHandler.getPosLeft(pos.column)\n : pos.column * this.config.characterWidth);\n\n var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) *\n this.config.lineHeight;\n\n return {left : cursorLeft, top : cursorTop};\n };\n\n this.isCursorInView = function(pixelPos, config) {\n return pixelPos.top >= 0 && pixelPos.top < config.maxHeight;\n };\n\n this.update = function(config) {\n this.config = config;\n\n var selections = this.session.$selectionMarkers;\n var i = 0, cursorIndex = 0;\n\n if (selections === undefined || selections.length === 0){\n selections = [{cursor: null}];\n }\n\n for (var i = 0, n = selections.length; i < n; i++) {\n var pixelPos = this.getPixelPosition(selections[i].cursor, true);\n if ((pixelPos.top > config.height + config.offset ||\n pixelPos.top < 0) && i > 1) {\n continue;\n }\n\n var element = this.cursors[cursorIndex++] || this.addCursor();\n var style = element.style;\n \n if (!this.drawCursor) {\n if (!this.isCursorInView(pixelPos, config)) {\n dom.setStyle(style, \"display\", \"none\");\n } else {\n dom.setStyle(style, \"display\", \"block\");\n dom.translate(element, pixelPos.left, pixelPos.top);\n dom.setStyle(style, \"width\", Math.round(config.characterWidth) + \"px\");\n dom.setStyle(style, \"height\", config.lineHeight + \"px\");\n }\n } else {\n this.drawCursor(element, pixelPos, config, selections[i], this.session);\n }\n }\n while (this.cursors.length > cursorIndex)\n this.removeCursor();\n\n var overwrite = this.session.getOverwrite();\n this.$setOverwrite(overwrite);\n this.$pixelPos = pixelPos;\n this.restartTimer();\n };\n \n this.drawCursor = null;\n\n this.$setOverwrite = function(overwrite) {\n if (overwrite != this.overwrite) {\n this.overwrite = overwrite;\n if (overwrite)\n dom.addCssClass(this.element, \"ace_overwrite-cursors\");\n else\n dom.removeCssClass(this.element, \"ace_overwrite-cursors\");\n }\n };\n\n this.destroy = function() {\n clearInterval(this.intervalId);\n clearTimeout(this.timeoutId);\n };\n\n}).call(Cursor.prototype);\n\nexports.Cursor = Cursor;\n\n});\n\nace.define(\"ace/scrollbar\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/lib/event\",\"ace/lib/event_emitter\"], function(require, exports, module) {\n\nvar oop = require(\"./lib/oop\");\nvar dom = require(\"./lib/dom\");\nvar event = require(\"./lib/event\");\nvar EventEmitter = require(\"./lib/event_emitter\").EventEmitter;\nvar MAX_SCROLL_H = 0x8000;\nvar ScrollBar = function(parent) {\n this.element = dom.createElement(\"div\");\n this.element.className = \"ace_scrollbar ace_scrollbar\" + this.classSuffix;\n\n this.inner = dom.createElement(\"div\");\n this.inner.className = \"ace_scrollbar-inner\";\n this.inner.textContent = \"\\xa0\";\n this.element.appendChild(this.inner);\n\n parent.appendChild(this.element);\n\n this.setVisible(false);\n this.skipEvent = false;\n\n event.addListener(this.element, \"scroll\", this.onScroll.bind(this));\n event.addListener(this.element, \"mousedown\", event.preventDefault);\n};\n\n(function() {\n oop.implement(this, EventEmitter);\n\n this.setVisible = function(isVisible) {\n this.element.style.display = isVisible ? \"\" : \"none\";\n this.isVisible = isVisible;\n this.coeff = 1;\n };\n}).call(ScrollBar.prototype);\nvar VScrollBar = function(parent, renderer) {\n ScrollBar.call(this, parent);\n this.scrollTop = 0;\n this.scrollHeight = 0;\n renderer.$scrollbarWidth = \n this.width = dom.scrollbarWidth(parent.ownerDocument);\n this.inner.style.width =\n this.element.style.width = (this.width || 15) + 5 + \"px\";\n this.$minWidth = 0;\n};\n\noop.inherits(VScrollBar, ScrollBar);\n\n(function() {\n\n this.classSuffix = '-v';\n this.onScroll = function() {\n if (!this.skipEvent) {\n this.scrollTop = this.element.scrollTop;\n if (this.coeff != 1) {\n var h = this.element.clientHeight / this.scrollHeight;\n this.scrollTop = this.scrollTop * (1 - h) / (this.coeff - h);\n }\n this._emit(\"scroll\", {data: this.scrollTop});\n }\n this.skipEvent = false;\n };\n this.getWidth = function() {\n return Math.max(this.isVisible ? this.width : 0, this.$minWidth || 0);\n };\n this.setHeight = function(height) {\n this.element.style.height = height + \"px\";\n };\n this.setInnerHeight = \n this.setScrollHeight = function(height) {\n this.scrollHeight = height;\n if (height > MAX_SCROLL_H) {\n this.coeff = MAX_SCROLL_H / height;\n height = MAX_SCROLL_H;\n } else if (this.coeff != 1) {\n this.coeff = 1;\n }\n this.inner.style.height = height + \"px\";\n };\n this.setScrollTop = function(scrollTop) {\n if (this.scrollTop != scrollTop) {\n this.skipEvent = true;\n this.scrollTop = scrollTop;\n this.element.scrollTop = scrollTop * this.coeff;\n }\n };\n\n}).call(VScrollBar.prototype);\nvar HScrollBar = function(parent, renderer) {\n ScrollBar.call(this, parent);\n this.scrollLeft = 0;\n this.height = renderer.$scrollbarWidth;\n this.inner.style.height =\n this.element.style.height = (this.height || 15) + 5 + \"px\";\n};\n\noop.inherits(HScrollBar, ScrollBar);\n\n(function() {\n\n this.classSuffix = '-h';\n this.onScroll = function() {\n if (!this.skipEvent) {\n this.scrollLeft = this.element.scrollLeft;\n this._emit(\"scroll\", {data: this.scrollLeft});\n }\n this.skipEvent = false;\n };\n this.getHeight = function() {\n return this.isVisible ? this.height : 0;\n };\n this.setWidth = function(width) {\n this.element.style.width = width + \"px\";\n };\n this.setInnerWidth = function(width) {\n this.inner.style.width = width + \"px\";\n };\n this.setScrollWidth = function(width) {\n this.inner.style.width = width + \"px\";\n };\n this.setScrollLeft = function(scrollLeft) {\n if (this.scrollLeft != scrollLeft) {\n this.skipEvent = true;\n this.scrollLeft = this.element.scrollLeft = scrollLeft;\n }\n };\n\n}).call(HScrollBar.prototype);\n\n\nexports.ScrollBar = VScrollBar; // backward compatibility\nexports.ScrollBarV = VScrollBar; // backward compatibility\nexports.ScrollBarH = HScrollBar; // backward compatibility\n\nexports.VScrollBar = VScrollBar;\nexports.HScrollBar = HScrollBar;\n});\n\nace.define(\"ace/renderloop\",[\"require\",\"exports\",\"module\",\"ace/lib/event\"], function(require, exports, module) {\n\nvar event = require(\"./lib/event\");\n\n\nvar RenderLoop = function(onRender, win) {\n this.onRender = onRender;\n this.pending = false;\n this.changes = 0;\n this.$recursionLimit = 2;\n this.window = win || window;\n var _self = this;\n this._flush = function(ts) {\n _self.pending = false;\n var changes = _self.changes;\n\n if (changes) {\n event.blockIdle(100);\n _self.changes = 0;\n _self.onRender(changes);\n }\n \n if (_self.changes) {\n if (_self.$recursionLimit-- < 0) return;\n _self.schedule();\n } else {\n _self.$recursionLimit = 2;\n }\n };\n};\n\n(function() {\n\n this.schedule = function(change) {\n this.changes = this.changes | change;\n if (this.changes && !this.pending) {\n event.nextFrame(this._flush);\n this.pending = true;\n }\n };\n\n this.clear = function(change) {\n var changes = this.changes;\n this.changes = 0;\n return changes;\n };\n\n}).call(RenderLoop.prototype);\n\nexports.RenderLoop = RenderLoop;\n});\n\nace.define(\"ace/layer/font_metrics\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/lib/lang\",\"ace/lib/event\",\"ace/lib/useragent\",\"ace/lib/event_emitter\"], function(require, exports, module) {\n\nvar oop = require(\"../lib/oop\");\nvar dom = require(\"../lib/dom\");\nvar lang = require(\"../lib/lang\");\nvar event = require(\"../lib/event\");\nvar useragent = require(\"../lib/useragent\");\nvar EventEmitter = require(\"../lib/event_emitter\").EventEmitter;\n\nvar CHAR_COUNT = 256;\nvar USE_OBSERVER = typeof ResizeObserver == \"function\";\nvar L = 200;\n\nvar FontMetrics = exports.FontMetrics = function(parentEl) {\n this.el = dom.createElement(\"div\");\n this.$setMeasureNodeStyles(this.el.style, true);\n \n this.$main = dom.createElement(\"div\");\n this.$setMeasureNodeStyles(this.$main.style);\n \n this.$measureNode = dom.createElement(\"div\");\n this.$setMeasureNodeStyles(this.$measureNode.style);\n \n \n this.el.appendChild(this.$main);\n this.el.appendChild(this.$measureNode);\n parentEl.appendChild(this.el);\n \n this.$measureNode.textContent = lang.stringRepeat(\"X\", CHAR_COUNT);\n \n this.$characterSize = {width: 0, height: 0};\n \n \n if (USE_OBSERVER)\n this.$addObserver();\n else\n this.checkForSizeChanges();\n};\n\n(function() {\n\n oop.implement(this, EventEmitter);\n \n this.$characterSize = {width: 0, height: 0};\n \n this.$setMeasureNodeStyles = function(style, isRoot) {\n style.width = style.height = \"auto\";\n style.left = style.top = \"0px\";\n style.visibility = \"hidden\";\n style.position = \"absolute\";\n style.whiteSpace = \"pre\";\n\n if (useragent.isIE < 8) {\n style[\"font-family\"] = \"inherit\";\n } else {\n style.font = \"inherit\";\n }\n style.overflow = isRoot ? \"hidden\" : \"visible\";\n };\n\n this.checkForSizeChanges = function(size) {\n if (size === undefined)\n size = this.$measureSizes();\n if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {\n this.$measureNode.style.fontWeight = \"bold\";\n var boldSize = this.$measureSizes();\n this.$measureNode.style.fontWeight = \"\";\n this.$characterSize = size;\n this.charSizes = Object.create(null);\n this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height;\n this._emit(\"changeCharacterSize\", {data: size});\n }\n };\n \n this.$addObserver = function() {\n var self = this;\n this.$observer = new window.ResizeObserver(function(e) {\n self.checkForSizeChanges();\n });\n this.$observer.observe(this.$measureNode);\n };\n\n this.$pollSizeChanges = function() {\n if (this.$pollSizeChangesTimer || this.$observer)\n return this.$pollSizeChangesTimer;\n var self = this;\n \n return this.$pollSizeChangesTimer = event.onIdle(function cb() {\n self.checkForSizeChanges();\n event.onIdle(cb, 500);\n }, 500);\n };\n \n this.setPolling = function(val) {\n if (val) {\n this.$pollSizeChanges();\n } else if (this.$pollSizeChangesTimer) {\n clearInterval(this.$pollSizeChangesTimer);\n this.$pollSizeChangesTimer = 0;\n }\n };\n\n this.$measureSizes = function(node) {\n var size = {\n height: (node || this.$measureNode).clientHeight,\n width: (node || this.$measureNode).clientWidth / CHAR_COUNT\n };\n if (size.width === 0 || size.height === 0)\n return null;\n return size;\n };\n\n this.$measureCharWidth = function(ch) {\n this.$main.textContent = lang.stringRepeat(ch, CHAR_COUNT);\n var rect = this.$main.getBoundingClientRect();\n return rect.width / CHAR_COUNT;\n };\n \n this.getCharacterWidth = function(ch) {\n var w = this.charSizes[ch];\n if (w === undefined) {\n w = this.charSizes[ch] = this.$measureCharWidth(ch) / this.$characterSize.width;\n }\n return w;\n };\n\n this.destroy = function() {\n clearInterval(this.$pollSizeChangesTimer);\n if (this.$observer)\n this.$observer.disconnect();\n if (this.el && this.el.parentNode)\n this.el.parentNode.removeChild(this.el);\n };\n\n \n this.$getZoom = function getZoom(element) {\n if (!element || !element.parentElement) return 1;\n return (window.getComputedStyle(element).zoom || 1) * getZoom(element.parentElement);\n };\n this.$initTransformMeasureNodes = function() {\n var t = function(t, l) {\n return [\"div\", {\n style: \"position: absolute;top:\" + t + \"px;left:\" + l + \"px;\"\n }];\n };\n this.els = dom.buildDom([t(0, 0), t(L, 0), t(0, L), t(L, L)], this.el);\n };\n this.transformCoordinates = function(clientPos, elPos) {\n if (clientPos) {\n var zoom = this.$getZoom(this.el);\n clientPos = mul(1 / zoom, clientPos);\n }\n function solve(l1, l2, r) {\n var det = l1[1] * l2[0] - l1[0] * l2[1];\n return [\n (-l2[1] * r[0] + l2[0] * r[1]) / det,\n (+l1[1] * r[0] - l1[0] * r[1]) / det\n ];\n }\n function sub(a, b) { return [a[0] - b[0], a[1] - b[1]]; }\n function add(a, b) { return [a[0] + b[0], a[1] + b[1]]; }\n function mul(a, b) { return [a * b[0], a * b[1]]; }\n\n if (!this.els)\n this.$initTransformMeasureNodes();\n \n function p(el) {\n var r = el.getBoundingClientRect();\n return [r.left, r.top];\n }\n\n var a = p(this.els[0]);\n var b = p(this.els[1]);\n var c = p(this.els[2]);\n var d = p(this.els[3]);\n\n var h = solve(sub(d, b), sub(d, c), sub(add(b, c), add(d, a)));\n\n var m1 = mul(1 + h[0], sub(b, a));\n var m2 = mul(1 + h[1], sub(c, a));\n \n if (elPos) {\n var x = elPos;\n var k = h[0] * x[0] / L + h[1] * x[1] / L + 1;\n var ut = add(mul(x[0], m1), mul(x[1], m2));\n return add(mul(1 / k / L, ut), a);\n }\n var u = sub(clientPos, a);\n var f = solve(sub(m1, mul(h[0], u)), sub(m2, mul(h[1], u)), u);\n return mul(L, f);\n };\n \n}).call(FontMetrics.prototype);\n\n});\n\nace.define(\"ace/virtual_renderer\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/config\",\"ace/layer/gutter\",\"ace/layer/marker\",\"ace/layer/text\",\"ace/layer/cursor\",\"ace/scrollbar\",\"ace/scrollbar\",\"ace/renderloop\",\"ace/layer/font_metrics\",\"ace/lib/event_emitter\",\"ace/lib/useragent\"], function(require, exports, module) {\n\nvar oop = require(\"./lib/oop\");\nvar dom = require(\"./lib/dom\");\nvar config = require(\"./config\");\nvar GutterLayer = require(\"./layer/gutter\").Gutter;\nvar MarkerLayer = require(\"./layer/marker\").Marker;\nvar TextLayer = require(\"./layer/text\").Text;\nvar CursorLayer = require(\"./layer/cursor\").Cursor;\nvar HScrollBar = require(\"./scrollbar\").HScrollBar;\nvar VScrollBar = require(\"./scrollbar\").VScrollBar;\nvar RenderLoop = require(\"./renderloop\").RenderLoop;\nvar FontMetrics = require(\"./layer/font_metrics\").FontMetrics;\nvar EventEmitter = require(\"./lib/event_emitter\").EventEmitter;\nvar editorCss = \"\\\n.ace_br1 {border-top-left-radius : 3px;}\\\n.ace_br2 {border-top-right-radius : 3px;}\\\n.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}\\\n.ace_br4 {border-bottom-right-radius: 3px;}\\\n.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}\\\n.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}\\\n.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}\\\n.ace_br8 {border-bottom-left-radius : 3px;}\\\n.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}\\\n.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}\\\n.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}\\\n.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\\\n.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\\\n.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\\\n.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\\\n.ace_editor {\\\nposition: relative;\\\noverflow: hidden;\\\npadding: 0;\\\nfont: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;\\\ndirection: ltr;\\\ntext-align: left;\\\n-webkit-tap-highlight-color: rgba(0, 0, 0, 0);\\\n}\\\n.ace_scroller {\\\nposition: absolute;\\\noverflow: hidden;\\\ntop: 0;\\\nbottom: 0;\\\nbackground-color: inherit;\\\n-ms-user-select: none;\\\n-moz-user-select: none;\\\n-webkit-user-select: none;\\\nuser-select: none;\\\ncursor: text;\\\n}\\\n.ace_content {\\\nposition: absolute;\\\nbox-sizing: border-box;\\\nmin-width: 100%;\\\ncontain: style size layout;\\\nfont-variant-ligatures: no-common-ligatures;\\\n}\\\n.ace_dragging .ace_scroller:before{\\\nposition: absolute;\\\ntop: 0;\\\nleft: 0;\\\nright: 0;\\\nbottom: 0;\\\ncontent: '';\\\nbackground: rgba(250, 250, 250, 0.01);\\\nz-index: 1000;\\\n}\\\n.ace_dragging.ace_dark .ace_scroller:before{\\\nbackground: rgba(0, 0, 0, 0.01);\\\n}\\\n.ace_selecting, .ace_selecting * {\\\ncursor: text !important;\\\n}\\\n.ace_gutter {\\\nposition: absolute;\\\noverflow : hidden;\\\nwidth: auto;\\\ntop: 0;\\\nbottom: 0;\\\nleft: 0;\\\ncursor: default;\\\nz-index: 4;\\\n-ms-user-select: none;\\\n-moz-user-select: none;\\\n-webkit-user-select: none;\\\nuser-select: none;\\\ncontain: style size layout;\\\n}\\\n.ace_gutter-active-line {\\\nposition: absolute;\\\nleft: 0;\\\nright: 0;\\\n}\\\n.ace_scroller.ace_scroll-left {\\\nbox-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\\\n}\\\n.ace_gutter-cell {\\\nposition: absolute;\\\ntop: 0;\\\nleft: 0;\\\nright: 0;\\\npadding-left: 19px;\\\npadding-right: 6px;\\\nbackground-repeat: no-repeat;\\\n}\\\n.ace_gutter-cell.ace_error {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==\\\");\\\nbackground-repeat: no-repeat;\\\nbackground-position: 2px center;\\\n}\\\n.ace_gutter-cell.ace_warning {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==\\\");\\\nbackground-position: 2px center;\\\n}\\\n.ace_gutter-cell.ace_info {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=\\\");\\\nbackground-position: 2px center;\\\n}\\\n.ace_dark .ace_gutter-cell.ace_info {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC\\\");\\\n}\\\n.ace_scrollbar {\\\ncontain: strict;\\\nposition: absolute;\\\nright: 0;\\\nbottom: 0;\\\nz-index: 6;\\\n}\\\n.ace_scrollbar-inner {\\\nposition: absolute;\\\ncursor: text;\\\nleft: 0;\\\ntop: 0;\\\n}\\\n.ace_scrollbar-v{\\\noverflow-x: hidden;\\\noverflow-y: scroll;\\\ntop: 0;\\\n}\\\n.ace_scrollbar-h {\\\noverflow-x: scroll;\\\noverflow-y: hidden;\\\nleft: 0;\\\n}\\\n.ace_print-margin {\\\nposition: absolute;\\\nheight: 100%;\\\n}\\\n.ace_text-input {\\\nposition: absolute;\\\nz-index: 0;\\\nwidth: 0.5em;\\\nheight: 1em;\\\nopacity: 0;\\\nbackground: transparent;\\\n-moz-appearance: none;\\\nappearance: none;\\\nborder: none;\\\nresize: none;\\\noutline: none;\\\noverflow: hidden;\\\nfont: inherit;\\\npadding: 0 1px;\\\nmargin: 0 -1px;\\\ncontain: strict;\\\n-ms-user-select: text;\\\n-moz-user-select: text;\\\n-webkit-user-select: text;\\\nuser-select: text;\\\nwhite-space: pre!important;\\\n}\\\n.ace_text-input.ace_composition {\\\nbackground: transparent;\\\ncolor: inherit;\\\nz-index: 1000;\\\nopacity: 1;\\\n}\\\n.ace_composition_placeholder { color: transparent }\\\n.ace_composition_marker { \\\nborder-bottom: 1px solid;\\\nposition: absolute;\\\nborder-radius: 0;\\\nmargin-top: 1px;\\\n}\\\n[ace_nocontext=true] {\\\ntransform: none!important;\\\nfilter: none!important;\\\nclip-path: none!important;\\\nmask : none!important;\\\ncontain: none!important;\\\nperspective: none!important;\\\nmix-blend-mode: initial!important;\\\nz-index: auto;\\\n}\\\n.ace_layer {\\\nz-index: 1;\\\nposition: absolute;\\\noverflow: hidden;\\\nword-wrap: normal;\\\nwhite-space: pre;\\\nheight: 100%;\\\nwidth: 100%;\\\nbox-sizing: border-box;\\\npointer-events: none;\\\n}\\\n.ace_gutter-layer {\\\nposition: relative;\\\nwidth: auto;\\\ntext-align: right;\\\npointer-events: auto;\\\nheight: 1000000px;\\\ncontain: style size layout;\\\n}\\\n.ace_text-layer {\\\nfont: inherit !important;\\\nposition: absolute;\\\nheight: 1000000px;\\\nwidth: 1000000px;\\\ncontain: style size layout;\\\n}\\\n.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {\\\ncontain: style size layout;\\\nposition: absolute;\\\ntop: 0;\\\nleft: 0;\\\nright: 0;\\\n}\\\n.ace_hidpi .ace_text-layer,\\\n.ace_hidpi .ace_gutter-layer,\\\n.ace_hidpi .ace_content,\\\n.ace_hidpi .ace_gutter {\\\ncontain: strict;\\\nwill-change: transform;\\\n}\\\n.ace_hidpi .ace_text-layer > .ace_line, \\\n.ace_hidpi .ace_text-layer > .ace_line_group {\\\ncontain: strict;\\\n}\\\n.ace_cjk {\\\ndisplay: inline-block;\\\ntext-align: center;\\\n}\\\n.ace_cursor-layer {\\\nz-index: 4;\\\n}\\\n.ace_cursor {\\\nz-index: 4;\\\nposition: absolute;\\\nbox-sizing: border-box;\\\nborder-left: 2px solid;\\\ntransform: translatez(0);\\\n}\\\n.ace_multiselect .ace_cursor {\\\nborder-left-width: 1px;\\\n}\\\n.ace_slim-cursors .ace_cursor {\\\nborder-left-width: 1px;\\\n}\\\n.ace_overwrite-cursors .ace_cursor {\\\nborder-left-width: 0;\\\nborder-bottom: 1px solid;\\\n}\\\n.ace_hidden-cursors .ace_cursor {\\\nopacity: 0.2;\\\n}\\\n.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {\\\nopacity: 0;\\\n}\\\n.ace_smooth-blinking .ace_cursor {\\\ntransition: opacity 0.18s;\\\n}\\\n.ace_animate-blinking .ace_cursor {\\\nanimation-duration: 1000ms;\\\nanimation-timing-function: step-end;\\\nanimation-name: blink-ace-animate;\\\nanimation-iteration-count: infinite;\\\n}\\\n.ace_animate-blinking.ace_smooth-blinking .ace_cursor {\\\nanimation-duration: 1000ms;\\\nanimation-timing-function: ease-in-out;\\\nanimation-name: blink-ace-animate-smooth;\\\n}\\\n@keyframes blink-ace-animate {\\\nfrom, to { opacity: 1; }\\\n60% { opacity: 0; }\\\n}\\\n@keyframes blink-ace-animate-smooth {\\\nfrom, to { opacity: 1; }\\\n45% { opacity: 1; }\\\n60% { opacity: 0; }\\\n85% { opacity: 0; }\\\n}\\\n.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {\\\nposition: absolute;\\\nz-index: 3;\\\n}\\\n.ace_marker-layer .ace_selection {\\\nposition: absolute;\\\nz-index: 5;\\\n}\\\n.ace_marker-layer .ace_bracket {\\\nposition: absolute;\\\nz-index: 6;\\\n}\\\n.ace_marker-layer .ace_error_bracket {\\\nposition: absolute;\\\nborder-bottom: 1px solid #DE5555;\\\nborder-radius: 0;\\\n}\\\n.ace_marker-layer .ace_active-line {\\\nposition: absolute;\\\nz-index: 2;\\\n}\\\n.ace_marker-layer .ace_selected-word {\\\nposition: absolute;\\\nz-index: 4;\\\nbox-sizing: border-box;\\\n}\\\n.ace_line .ace_fold {\\\nbox-sizing: border-box;\\\ndisplay: inline-block;\\\nheight: 11px;\\\nmargin-top: -2px;\\\nvertical-align: middle;\\\nbackground-image:\\\nurl(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII=\\\"),\\\nurl(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=\\\");\\\nbackground-repeat: no-repeat, repeat-x;\\\nbackground-position: center center, top left;\\\ncolor: transparent;\\\nborder: 1px solid black;\\\nborder-radius: 2px;\\\ncursor: pointer;\\\npointer-events: auto;\\\n}\\\n.ace_dark .ace_fold {\\\n}\\\n.ace_fold:hover{\\\nbackground-image:\\\nurl(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII=\\\"),\\\nurl(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC\\\");\\\n}\\\n.ace_tooltip {\\\nbackground-color: #FFF;\\\nbackground-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));\\\nborder: 1px solid gray;\\\nborder-radius: 1px;\\\nbox-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\\\ncolor: black;\\\nmax-width: 100%;\\\npadding: 3px 4px;\\\nposition: fixed;\\\nz-index: 999999;\\\nbox-sizing: border-box;\\\ncursor: default;\\\nwhite-space: pre;\\\nword-wrap: break-word;\\\nline-height: normal;\\\nfont-style: normal;\\\nfont-weight: normal;\\\nletter-spacing: normal;\\\npointer-events: none;\\\n}\\\n.ace_folding-enabled > .ace_gutter-cell {\\\npadding-right: 13px;\\\n}\\\n.ace_fold-widget {\\\nbox-sizing: border-box;\\\nmargin: 0 -12px 0 1px;\\\ndisplay: none;\\\nwidth: 11px;\\\nvertical-align: top;\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==\\\");\\\nbackground-repeat: no-repeat;\\\nbackground-position: center;\\\nborder-radius: 3px;\\\nborder: 1px solid transparent;\\\ncursor: pointer;\\\n}\\\n.ace_folding-enabled .ace_fold-widget {\\\ndisplay: inline-block; \\\n}\\\n.ace_fold-widget.ace_end {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==\\\");\\\n}\\\n.ace_fold-widget.ace_closed {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==\\\");\\\n}\\\n.ace_fold-widget:hover {\\\nborder: 1px solid rgba(0, 0, 0, 0.3);\\\nbackground-color: rgba(255, 255, 255, 0.2);\\\nbox-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\\\n}\\\n.ace_fold-widget:active {\\\nborder: 1px solid rgba(0, 0, 0, 0.4);\\\nbackground-color: rgba(0, 0, 0, 0.05);\\\nbox-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\\\n}\\\n.ace_dark .ace_fold-widget {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC\\\");\\\n}\\\n.ace_dark .ace_fold-widget.ace_end {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==\\\");\\\n}\\\n.ace_dark .ace_fold-widget.ace_closed {\\\nbackground-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==\\\");\\\n}\\\n.ace_dark .ace_fold-widget:hover {\\\nbox-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\\\nbackground-color: rgba(255, 255, 255, 0.1);\\\n}\\\n.ace_dark .ace_fold-widget:active {\\\nbox-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\\\n}\\\n.ace_inline_button {\\\nborder: 1px solid lightgray;\\\ndisplay: inline-block;\\\nmargin: -1px 8px;\\\npadding: 0 5px;\\\npointer-events: auto;\\\ncursor: pointer;\\\n}\\\n.ace_inline_button:hover {\\\nborder-color: gray;\\\nbackground: rgba(200,200,200,0.2);\\\ndisplay: inline-block;\\\npointer-events: auto;\\\n}\\\n.ace_fold-widget.ace_invalid {\\\nbackground-color: #FFB4B4;\\\nborder-color: #DE5555;\\\n}\\\n.ace_fade-fold-widgets .ace_fold-widget {\\\ntransition: opacity 0.4s ease 0.05s;\\\nopacity: 0;\\\n}\\\n.ace_fade-fold-widgets:hover .ace_fold-widget {\\\ntransition: opacity 0.05s ease 0.05s;\\\nopacity:1;\\\n}\\\n.ace_underline {\\\ntext-decoration: underline;\\\n}\\\n.ace_bold {\\\nfont-weight: bold;\\\n}\\\n.ace_nobold .ace_bold {\\\nfont-weight: normal;\\\n}\\\n.ace_italic {\\\nfont-style: italic;\\\n}\\\n.ace_error-marker {\\\nbackground-color: rgba(255, 0, 0,0.2);\\\nposition: absolute;\\\nz-index: 9;\\\n}\\\n.ace_highlight-marker {\\\nbackground-color: rgba(255, 255, 0,0.2);\\\nposition: absolute;\\\nz-index: 8;\\\n}\\\n.ace_mobile-menu {\\\nposition: absolute;\\\nline-height: 1.5;\\\nborder-radius: 4px;\\\n-ms-user-select: none;\\\n-moz-user-select: none;\\\n-webkit-user-select: none;\\\nuser-select: none;\\\nbackground: white;\\\nbox-shadow: 1px 3px 2px grey;\\\nborder: 1px solid #dcdcdc;\\\ncolor: black;\\\n}\\\n.ace_dark > .ace_mobile-menu {\\\nbackground: #333;\\\ncolor: #ccc;\\\nbox-shadow: 1px 3px 2px grey;\\\nborder: 1px solid #444;\\\n}\\\n.ace_mobile-button {\\\npadding: 2px;\\\ncursor: pointer;\\\noverflow: hidden;\\\n}\\\n.ace_mobile-button:hover {\\\nbackground-color: #eee;\\\nopacity:1;\\\n}\\\n.ace_mobile-button:active {\\\nbackground-color: #ddd;\\\n}\\\n.ace_placeholder {\\\nfont-family: arial;\\\ntransform: scale(0.9);\\\ntransform-origin: left;\\\nwhite-space: pre;\\\nopacity: 0.7;\\\nmargin: 0 10px;\\\n}\";\n\nvar useragent = require(\"./lib/useragent\");\nvar HIDE_TEXTAREA = useragent.isIE;\n\ndom.importCssString(editorCss, \"ace_editor.css\");\n\nvar VirtualRenderer = function(container, theme) {\n var _self = this;\n\n this.container = container || dom.createElement(\"div\");\n\n dom.addCssClass(this.container, \"ace_editor\");\n if (dom.HI_DPI) dom.addCssClass(this.container, \"ace_hidpi\");\n\n this.setTheme(theme);\n\n this.$gutter = dom.createElement(\"div\");\n this.$gutter.className = \"ace_gutter\";\n this.container.appendChild(this.$gutter);\n this.$gutter.setAttribute(\"aria-hidden\", true);\n\n this.scroller = dom.createElement(\"div\");\n this.scroller.className = \"ace_scroller\";\n \n this.container.appendChild(this.scroller);\n\n this.content = dom.createElement(\"div\");\n this.content.className = \"ace_content\";\n this.scroller.appendChild(this.content);\n\n this.$gutterLayer = new GutterLayer(this.$gutter);\n this.$gutterLayer.on(\"changeGutterWidth\", this.onGutterResize.bind(this));\n\n this.$markerBack = new MarkerLayer(this.content);\n\n var textLayer = this.$textLayer = new TextLayer(this.content);\n this.canvas = textLayer.element;\n\n this.$markerFront = new MarkerLayer(this.content);\n\n this.$cursorLayer = new CursorLayer(this.content);\n this.$horizScroll = false;\n this.$vScroll = false;\n\n this.scrollBar = \n this.scrollBarV = new VScrollBar(this.container, this);\n this.scrollBarH = new HScrollBar(this.container, this);\n this.scrollBarV.on(\"scroll\", function(e) {\n if (!_self.$scrollAnimation)\n _self.session.setScrollTop(e.data - _self.scrollMargin.top);\n });\n this.scrollBarH.on(\"scroll\", function(e) {\n if (!_self.$scrollAnimation)\n _self.session.setScrollLeft(e.data - _self.scrollMargin.left);\n });\n\n this.scrollTop = 0;\n this.scrollLeft = 0;\n\n this.cursorPos = {\n row : 0,\n column : 0\n };\n\n this.$fontMetrics = new FontMetrics(this.container);\n this.$textLayer.$setFontMetrics(this.$fontMetrics);\n this.$textLayer.on(\"changeCharacterSize\", function(e) {\n _self.updateCharacterSize();\n _self.onResize(true, _self.gutterWidth, _self.$size.width, _self.$size.height);\n _self._signal(\"changeCharacterSize\", e);\n });\n\n this.$size = {\n width: 0,\n height: 0,\n scrollerHeight: 0,\n scrollerWidth: 0,\n $dirty: true\n };\n\n this.layerConfig = {\n width : 1,\n padding : 0,\n firstRow : 0,\n firstRowScreen: 0,\n lastRow : 0,\n lineHeight : 0,\n characterWidth : 0,\n minHeight : 1,\n maxHeight : 1,\n offset : 0,\n height : 1,\n gutterOffset: 1\n };\n \n this.scrollMargin = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n v: 0,\n h: 0\n };\n \n this.margin = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n v: 0,\n h: 0\n };\n \n this.$keepTextAreaAtCursor = !useragent.isIOS;\n\n this.$loop = new RenderLoop(\n this.$renderChanges.bind(this),\n this.container.ownerDocument.defaultView\n );\n this.$loop.schedule(this.CHANGE_FULL);\n\n this.updateCharacterSize();\n this.setPadding(4);\n config.resetOptions(this);\n config._signal(\"renderer\", this);\n};\n\n(function() {\n\n this.CHANGE_CURSOR = 1;\n this.CHANGE_MARKER = 2;\n this.CHANGE_GUTTER = 4;\n this.CHANGE_SCROLL = 8;\n this.CHANGE_LINES = 16;\n this.CHANGE_TEXT = 32;\n this.CHANGE_SIZE = 64;\n this.CHANGE_MARKER_BACK = 128;\n this.CHANGE_MARKER_FRONT = 256;\n this.CHANGE_FULL = 512;\n this.CHANGE_H_SCROLL = 1024;\n\n oop.implement(this, EventEmitter);\n\n this.updateCharacterSize = function() {\n if (this.$textLayer.allowBoldFonts != this.$allowBoldFonts) {\n this.$allowBoldFonts = this.$textLayer.allowBoldFonts;\n this.setStyle(\"ace_nobold\", !this.$allowBoldFonts);\n }\n\n this.layerConfig.characterWidth =\n this.characterWidth = this.$textLayer.getCharacterWidth();\n this.layerConfig.lineHeight =\n this.lineHeight = this.$textLayer.getLineHeight();\n this.$updatePrintMargin();\n dom.setStyle(this.scroller.style, \"line-height\", this.lineHeight + \"px\");\n };\n this.setSession = function(session) {\n if (this.session)\n this.session.doc.off(\"changeNewLineMode\", this.onChangeNewLineMode);\n \n this.session = session;\n if (session && this.scrollMargin.top && session.getScrollTop() <= 0)\n session.setScrollTop(-this.scrollMargin.top);\n\n this.$cursorLayer.setSession(session);\n this.$markerBack.setSession(session);\n this.$markerFront.setSession(session);\n this.$gutterLayer.setSession(session);\n this.$textLayer.setSession(session);\n if (!session)\n return;\n \n this.$loop.schedule(this.CHANGE_FULL);\n this.session.$setFontMetrics(this.$fontMetrics);\n this.scrollBarH.scrollLeft = this.scrollBarV.scrollTop = null;\n \n this.onChangeNewLineMode = this.onChangeNewLineMode.bind(this);\n this.onChangeNewLineMode();\n this.session.doc.on(\"changeNewLineMode\", this.onChangeNewLineMode);\n };\n this.updateLines = function(firstRow, lastRow, force) {\n if (lastRow === undefined)\n lastRow = Infinity;\n\n if (!this.$changedLines) {\n this.$changedLines = {\n firstRow: firstRow,\n lastRow: lastRow\n };\n }\n else {\n if (this.$changedLines.firstRow > firstRow)\n this.$changedLines.firstRow = firstRow;\n\n if (this.$changedLines.lastRow < lastRow)\n this.$changedLines.lastRow = lastRow;\n }\n if (this.$changedLines.lastRow < this.layerConfig.firstRow) {\n if (force)\n this.$changedLines.lastRow = this.layerConfig.lastRow;\n else\n return;\n }\n if (this.$changedLines.firstRow > this.layerConfig.lastRow)\n return;\n this.$loop.schedule(this.CHANGE_LINES);\n };\n\n this.onChangeNewLineMode = function() {\n this.$loop.schedule(this.CHANGE_TEXT);\n this.$textLayer.$updateEolChar();\n this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR);\n };\n \n this.onChangeTabSize = function() {\n this.$loop.schedule(this.CHANGE_TEXT | this.CHANGE_MARKER);\n this.$textLayer.onChangeTabSize();\n };\n this.updateText = function() {\n this.$loop.schedule(this.CHANGE_TEXT);\n };\n this.updateFull = function(force) {\n if (force)\n this.$renderChanges(this.CHANGE_FULL, true);\n else\n this.$loop.schedule(this.CHANGE_FULL);\n };\n this.updateFontSize = function() {\n this.$textLayer.checkForSizeChanges();\n };\n\n this.$changes = 0;\n this.$updateSizeAsync = function() {\n if (this.$loop.pending)\n this.$size.$dirty = true;\n else\n this.onResize();\n };\n this.onResize = function(force, gutterWidth, width, height) {\n if (this.resizing > 2)\n return;\n else if (this.resizing > 0)\n this.resizing++;\n else\n this.resizing = force ? 1 : 0;\n var el = this.container;\n if (!height)\n height = el.clientHeight || el.scrollHeight;\n if (!width)\n width = el.clientWidth || el.scrollWidth;\n var changes = this.$updateCachedSize(force, gutterWidth, width, height);\n\n \n if (!this.$size.scrollerHeight || (!width && !height))\n return this.resizing = 0;\n\n if (force)\n this.$gutterLayer.$padding = null;\n\n if (force)\n this.$renderChanges(changes | this.$changes, true);\n else\n this.$loop.schedule(changes | this.$changes);\n\n if (this.resizing)\n this.resizing = 0;\n this.scrollBarV.scrollLeft = this.scrollBarV.scrollTop = null;\n };\n \n this.$updateCachedSize = function(force, gutterWidth, width, height) {\n height -= (this.$extraHeight || 0);\n var changes = 0;\n var size = this.$size;\n var oldSize = {\n width: size.width,\n height: size.height,\n scrollerHeight: size.scrollerHeight,\n scrollerWidth: size.scrollerWidth\n };\n if (height && (force || size.height != height)) {\n size.height = height;\n changes |= this.CHANGE_SIZE;\n\n size.scrollerHeight = size.height;\n if (this.$horizScroll)\n size.scrollerHeight -= this.scrollBarH.getHeight();\n this.scrollBarV.element.style.bottom = this.scrollBarH.getHeight() + \"px\";\n\n changes = changes | this.CHANGE_SCROLL;\n }\n\n if (width && (force || size.width != width)) {\n changes |= this.CHANGE_SIZE;\n size.width = width;\n \n if (gutterWidth == null)\n gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;\n \n this.gutterWidth = gutterWidth;\n \n dom.setStyle(this.scrollBarH.element.style, \"left\", gutterWidth + \"px\");\n dom.setStyle(this.scroller.style, \"left\", gutterWidth + this.margin.left + \"px\");\n size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBarV.getWidth() - this.margin.h);\n dom.setStyle(this.$gutter.style, \"left\", this.margin.left + \"px\");\n \n var right = this.scrollBarV.getWidth() + \"px\";\n dom.setStyle(this.scrollBarH.element.style, \"right\", right);\n dom.setStyle(this.scroller.style, \"right\", right);\n dom.setStyle(this.scroller.style, \"bottom\", this.scrollBarH.getHeight());\n\n if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || force) {\n changes |= this.CHANGE_FULL;\n }\n }\n \n size.$dirty = !width || !height;\n\n if (changes)\n this._signal(\"resize\", oldSize);\n\n return changes;\n };\n\n this.onGutterResize = function(width) {\n var gutterWidth = this.$showGutter ? width : 0;\n if (gutterWidth != this.gutterWidth)\n this.$changes |= this.$updateCachedSize(true, gutterWidth, this.$size.width, this.$size.height);\n\n if (this.session.getUseWrapMode() && this.adjustWrapLimit()) {\n this.$loop.schedule(this.CHANGE_FULL);\n } else if (this.$size.$dirty) {\n this.$loop.schedule(this.CHANGE_FULL);\n } else {\n this.$computeLayerConfig();\n }\n };\n this.adjustWrapLimit = function() {\n var availableWidth = this.$size.scrollerWidth - this.$padding * 2;\n var limit = Math.floor(availableWidth / this.characterWidth);\n return this.session.adjustWrapLimit(limit, this.$showPrintMargin && this.$printMarginColumn);\n };\n this.setAnimatedScroll = function(shouldAnimate){\n this.setOption(\"animatedScroll\", shouldAnimate);\n };\n this.getAnimatedScroll = function() {\n return this.$animatedScroll;\n };\n this.setShowInvisibles = function(showInvisibles) {\n this.setOption(\"showInvisibles\", showInvisibles);\n this.session.$bidiHandler.setShowInvisibles(showInvisibles);\n };\n this.getShowInvisibles = function() {\n return this.getOption(\"showInvisibles\");\n };\n this.getDisplayIndentGuides = function() {\n return this.getOption(\"displayIndentGuides\");\n };\n\n this.setDisplayIndentGuides = function(display) {\n this.setOption(\"displayIndentGuides\", display);\n };\n this.setShowPrintMargin = function(showPrintMargin) {\n this.setOption(\"showPrintMargin\", showPrintMargin);\n };\n this.getShowPrintMargin = function() {\n return this.getOption(\"showPrintMargin\");\n };\n this.setPrintMarginColumn = function(showPrintMargin) {\n this.setOption(\"printMarginColumn\", showPrintMargin);\n };\n this.getPrintMarginColumn = function() {\n return this.getOption(\"printMarginColumn\");\n };\n this.getShowGutter = function(){\n return this.getOption(\"showGutter\");\n };\n this.setShowGutter = function(show){\n return this.setOption(\"showGutter\", show);\n };\n\n this.getFadeFoldWidgets = function(){\n return this.getOption(\"fadeFoldWidgets\");\n };\n\n this.setFadeFoldWidgets = function(show) {\n this.setOption(\"fadeFoldWidgets\", show);\n };\n\n this.setHighlightGutterLine = function(shouldHighlight) {\n this.setOption(\"highlightGutterLine\", shouldHighlight);\n };\n\n this.getHighlightGutterLine = function() {\n return this.getOption(\"highlightGutterLine\");\n };\n\n this.$updatePrintMargin = function() {\n if (!this.$showPrintMargin && !this.$printMarginEl)\n return;\n\n if (!this.$printMarginEl) {\n var containerEl = dom.createElement(\"div\");\n containerEl.className = \"ace_layer ace_print-margin-layer\";\n this.$printMarginEl = dom.createElement(\"div\");\n this.$printMarginEl.className = \"ace_print-margin\";\n containerEl.appendChild(this.$printMarginEl);\n this.content.insertBefore(containerEl, this.content.firstChild);\n }\n\n var style = this.$printMarginEl.style;\n style.left = Math.round(this.characterWidth * this.$printMarginColumn + this.$padding) + \"px\";\n style.visibility = this.$showPrintMargin ? \"visible\" : \"hidden\";\n \n if (this.session && this.session.$wrap == -1)\n this.adjustWrapLimit();\n };\n this.getContainerElement = function() {\n return this.container;\n };\n this.getMouseEventTarget = function() {\n return this.scroller;\n };\n this.getTextAreaContainer = function() {\n return this.container;\n };\n this.$moveTextAreaToCursor = function() {\n if (this.$isMousePressed) return;\n var style = this.textarea.style;\n var composition = this.$composition;\n if (!this.$keepTextAreaAtCursor && !composition) {\n dom.translate(this.textarea, -100, 0);\n return;\n }\n var pixelPos = this.$cursorLayer.$pixelPos;\n if (!pixelPos)\n return;\n if (composition && composition.markerRange)\n pixelPos = this.$cursorLayer.getPixelPosition(composition.markerRange.start, true);\n \n var config = this.layerConfig;\n var posTop = pixelPos.top;\n var posLeft = pixelPos.left;\n posTop -= config.offset;\n\n var h = composition && composition.useTextareaForIME ? this.lineHeight : HIDE_TEXTAREA ? 0 : 1;\n if (posTop < 0 || posTop > config.height - h) {\n dom.translate(this.textarea, 0, 0);\n return;\n }\n\n var w = 1;\n var maxTop = this.$size.height - h;\n if (!composition) {\n posTop += this.lineHeight;\n }\n else {\n if (composition.useTextareaForIME) {\n var val = this.textarea.value;\n w = this.characterWidth * (this.session.$getStringScreenWidth(val)[0]);\n }\n else {\n posTop += this.lineHeight + 2;\n }\n }\n \n posLeft -= this.scrollLeft;\n if (posLeft > this.$size.scrollerWidth - w)\n posLeft = this.$size.scrollerWidth - w;\n\n posLeft += this.gutterWidth + this.margin.left;\n\n dom.setStyle(style, \"height\", h + \"px\");\n dom.setStyle(style, \"width\", w + \"px\");\n dom.translate(this.textarea, Math.min(posLeft, this.$size.scrollerWidth - w), Math.min(posTop, maxTop));\n };\n this.getFirstVisibleRow = function() {\n return this.layerConfig.firstRow;\n };\n this.getFirstFullyVisibleRow = function() {\n return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);\n };\n this.getLastFullyVisibleRow = function() {\n var config = this.layerConfig;\n var lastRow = config.lastRow;\n var top = this.session.documentToScreenRow(lastRow, 0) * config.lineHeight;\n if (top - this.session.getScrollTop() > config.height - config.lineHeight)\n return lastRow - 1;\n return lastRow;\n };\n this.getLastVisibleRow = function() {\n return this.layerConfig.lastRow;\n };\n\n this.$padding = null;\n this.setPadding = function(padding) {\n this.$padding = padding;\n this.$textLayer.setPadding(padding);\n this.$cursorLayer.setPadding(padding);\n this.$markerFront.setPadding(padding);\n this.$markerBack.setPadding(padding);\n this.$loop.schedule(this.CHANGE_FULL);\n this.$updatePrintMargin();\n };\n \n this.setScrollMargin = function(top, bottom, left, right) {\n var sm = this.scrollMargin;\n sm.top = top|0;\n sm.bottom = bottom|0;\n sm.right = right|0;\n sm.left = left|0;\n sm.v = sm.top + sm.bottom;\n sm.h = sm.left + sm.right;\n if (sm.top && this.scrollTop <= 0 && this.session)\n this.session.setScrollTop(-sm.top);\n this.updateFull();\n };\n \n this.setMargin = function(top, bottom, left, right) {\n var sm = this.margin;\n sm.top = top|0;\n sm.bottom = bottom|0;\n sm.right = right|0;\n sm.left = left|0;\n sm.v = sm.top + sm.bottom;\n sm.h = sm.left + sm.right;\n this.$updateCachedSize(true, this.gutterWidth, this.$size.width, this.$size.height);\n this.updateFull();\n };\n this.getHScrollBarAlwaysVisible = function() {\n return this.$hScrollBarAlwaysVisible;\n };\n this.setHScrollBarAlwaysVisible = function(alwaysVisible) {\n this.setOption(\"hScrollBarAlwaysVisible\", alwaysVisible);\n };\n this.getVScrollBarAlwaysVisible = function() {\n return this.$vScrollBarAlwaysVisible;\n };\n this.setVScrollBarAlwaysVisible = function(alwaysVisible) {\n this.setOption(\"vScrollBarAlwaysVisible\", alwaysVisible);\n };\n\n this.$updateScrollBarV = function() {\n var scrollHeight = this.layerConfig.maxHeight;\n var scrollerHeight = this.$size.scrollerHeight;\n if (!this.$maxLines && this.$scrollPastEnd) {\n scrollHeight -= (scrollerHeight - this.lineHeight) * this.$scrollPastEnd;\n if (this.scrollTop > scrollHeight - scrollerHeight) {\n scrollHeight = this.scrollTop + scrollerHeight;\n this.scrollBarV.scrollTop = null;\n }\n }\n this.scrollBarV.setScrollHeight(scrollHeight + this.scrollMargin.v);\n this.scrollBarV.setScrollTop(this.scrollTop + this.scrollMargin.top);\n };\n this.$updateScrollBarH = function() {\n this.scrollBarH.setScrollWidth(this.layerConfig.width + 2 * this.$padding + this.scrollMargin.h);\n this.scrollBarH.setScrollLeft(this.scrollLeft + this.scrollMargin.left);\n };\n \n this.$frozen = false;\n this.freeze = function() {\n this.$frozen = true;\n };\n \n this.unfreeze = function() {\n this.$frozen = false;\n };\n\n this.$renderChanges = function(changes, force) {\n if (this.$changes) {\n changes |= this.$changes;\n this.$changes = 0;\n }\n if ((!this.session || !this.container.offsetWidth || this.$frozen) || (!changes && !force)) {\n this.$changes |= changes;\n return; \n } \n if (this.$size.$dirty) {\n this.$changes |= changes;\n return this.onResize(true);\n }\n if (!this.lineHeight) {\n this.$textLayer.checkForSizeChanges();\n }\n \n this._signal(\"beforeRender\", changes);\n \n if (this.session && this.session.$bidiHandler)\n this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);\n\n var config = this.layerConfig;\n if (changes & this.CHANGE_FULL ||\n changes & this.CHANGE_SIZE ||\n changes & this.CHANGE_TEXT ||\n changes & this.CHANGE_LINES ||\n changes & this.CHANGE_SCROLL ||\n changes & this.CHANGE_H_SCROLL\n ) {\n changes |= this.$computeLayerConfig() | this.$loop.clear();\n if (config.firstRow != this.layerConfig.firstRow && config.firstRowScreen == this.layerConfig.firstRowScreen) {\n var st = this.scrollTop + (config.firstRow - this.layerConfig.firstRow) * this.lineHeight;\n if (st > 0) {\n this.scrollTop = st;\n changes = changes | this.CHANGE_SCROLL;\n changes |= this.$computeLayerConfig() | this.$loop.clear();\n }\n }\n config = this.layerConfig;\n this.$updateScrollBarV();\n if (changes & this.CHANGE_H_SCROLL)\n this.$updateScrollBarH();\n \n dom.translate(this.content, -this.scrollLeft, -config.offset);\n \n var width = config.width + 2 * this.$padding + \"px\";\n var height = config.minHeight + \"px\";\n \n dom.setStyle(this.content.style, \"width\", width);\n dom.setStyle(this.content.style, \"height\", height);\n }\n if (changes & this.CHANGE_H_SCROLL) {\n dom.translate(this.content, -this.scrollLeft, -config.offset);\n this.scroller.className = this.scrollLeft <= 0 ? \"ace_scroller\" : \"ace_scroller ace_scroll-left\";\n }\n if (changes & this.CHANGE_FULL) {\n this.$changedLines = null;\n this.$textLayer.update(config);\n if (this.$showGutter)\n this.$gutterLayer.update(config);\n this.$markerBack.update(config);\n this.$markerFront.update(config);\n this.$cursorLayer.update(config);\n this.$moveTextAreaToCursor();\n this._signal(\"afterRender\", changes);\n return;\n }\n if (changes & this.CHANGE_SCROLL) {\n this.$changedLines = null;\n if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)\n this.$textLayer.update(config);\n else\n this.$textLayer.scrollLines(config);\n\n if (this.$showGutter) {\n if (changes & this.CHANGE_GUTTER || changes & this.CHANGE_LINES)\n this.$gutterLayer.update(config);\n else\n this.$gutterLayer.scrollLines(config);\n }\n this.$markerBack.update(config);\n this.$markerFront.update(config);\n this.$cursorLayer.update(config);\n this.$moveTextAreaToCursor();\n this._signal(\"afterRender\", changes);\n return;\n }\n\n if (changes & this.CHANGE_TEXT) {\n this.$changedLines = null;\n this.$textLayer.update(config);\n if (this.$showGutter)\n this.$gutterLayer.update(config);\n }\n else if (changes & this.CHANGE_LINES) {\n if (this.$updateLines() || (changes & this.CHANGE_GUTTER) && this.$showGutter)\n this.$gutterLayer.update(config);\n }\n else if (changes & this.CHANGE_TEXT || changes & this.CHANGE_GUTTER) {\n if (this.$showGutter)\n this.$gutterLayer.update(config);\n }\n else if (changes & this.CHANGE_CURSOR) {\n if (this.$highlightGutterLine)\n this.$gutterLayer.updateLineHighlight(config);\n }\n\n if (changes & this.CHANGE_CURSOR) {\n this.$cursorLayer.update(config);\n this.$moveTextAreaToCursor();\n }\n\n if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {\n this.$markerFront.update(config);\n }\n\n if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) {\n this.$markerBack.update(config);\n }\n\n this._signal(\"afterRender\", changes);\n };\n\n \n this.$autosize = function() {\n var height = this.session.getScreenLength() * this.lineHeight;\n var maxHeight = this.$maxLines * this.lineHeight;\n var desiredHeight = Math.min(maxHeight, \n Math.max((this.$minLines || 1) * this.lineHeight, height)\n ) + this.scrollMargin.v + (this.$extraHeight || 0);\n if (this.$horizScroll)\n desiredHeight += this.scrollBarH.getHeight();\n if (this.$maxPixelHeight && desiredHeight > this.$maxPixelHeight)\n desiredHeight = this.$maxPixelHeight;\n \n var hideScrollbars = desiredHeight <= 2 * this.lineHeight;\n var vScroll = !hideScrollbars && height > maxHeight;\n \n if (desiredHeight != this.desiredHeight ||\n this.$size.height != this.desiredHeight || vScroll != this.$vScroll) {\n if (vScroll != this.$vScroll) {\n this.$vScroll = vScroll;\n this.scrollBarV.setVisible(vScroll);\n }\n \n var w = this.container.clientWidth;\n this.container.style.height = desiredHeight + \"px\";\n this.$updateCachedSize(true, this.$gutterWidth, w, desiredHeight);\n this.desiredHeight = desiredHeight;\n \n this._signal(\"autosize\");\n }\n };\n \n this.$computeLayerConfig = function() {\n var session = this.session;\n var size = this.$size;\n \n var hideScrollbars = size.height <= 2 * this.lineHeight;\n var screenLines = this.session.getScreenLength();\n var maxHeight = screenLines * this.lineHeight;\n\n var longestLine = this.$getLongestLine();\n \n var horizScroll = !hideScrollbars && (this.$hScrollBarAlwaysVisible ||\n size.scrollerWidth - longestLine - 2 * this.$padding < 0);\n\n var hScrollChanged = this.$horizScroll !== horizScroll;\n if (hScrollChanged) {\n this.$horizScroll = horizScroll;\n this.scrollBarH.setVisible(horizScroll);\n }\n var vScrollBefore = this.$vScroll; // autosize can change vscroll value in which case we need to update longestLine\n if (this.$maxLines && this.lineHeight > 1)\n this.$autosize();\n\n var minHeight = size.scrollerHeight + this.lineHeight;\n \n var scrollPastEnd = !this.$maxLines && this.$scrollPastEnd\n ? (size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd\n : 0;\n maxHeight += scrollPastEnd;\n \n var sm = this.scrollMargin;\n this.session.setScrollTop(Math.max(-sm.top,\n Math.min(this.scrollTop, maxHeight - size.scrollerHeight + sm.bottom)));\n\n this.session.setScrollLeft(Math.max(-sm.left, Math.min(this.scrollLeft, \n longestLine + 2 * this.$padding - size.scrollerWidth + sm.right)));\n \n var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible ||\n size.scrollerHeight - maxHeight + scrollPastEnd < 0 || this.scrollTop > sm.top);\n var vScrollChanged = vScrollBefore !== vScroll;\n if (vScrollChanged) {\n this.$vScroll = vScroll;\n this.scrollBarV.setVisible(vScroll);\n }\n\n var offset = this.scrollTop % this.lineHeight;\n var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;\n var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));\n var lastRow = firstRow + lineCount;\n var firstRowScreen, firstRowHeight;\n var lineHeight = this.lineHeight;\n firstRow = session.screenToDocumentRow(firstRow, 0);\n var foldLine = session.getFoldLine(firstRow);\n if (foldLine) {\n firstRow = foldLine.start.row;\n }\n\n firstRowScreen = session.documentToScreenRow(firstRow, 0);\n firstRowHeight = session.getRowLength(firstRow) * lineHeight;\n\n lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);\n minHeight = size.scrollerHeight + session.getRowLength(lastRow) * lineHeight +\n firstRowHeight;\n\n offset = this.scrollTop - firstRowScreen * lineHeight;\n\n var changes = 0;\n if (this.layerConfig.width != longestLine || hScrollChanged) \n changes = this.CHANGE_H_SCROLL;\n if (hScrollChanged || vScrollChanged) {\n changes |= this.$updateCachedSize(true, this.gutterWidth, size.width, size.height);\n this._signal(\"scrollbarVisibilityChanged\");\n if (vScrollChanged)\n longestLine = this.$getLongestLine();\n }\n \n this.layerConfig = {\n width : longestLine,\n padding : this.$padding,\n firstRow : firstRow,\n firstRowScreen: firstRowScreen,\n lastRow : lastRow,\n lineHeight : lineHeight,\n characterWidth : this.characterWidth,\n minHeight : minHeight,\n maxHeight : maxHeight,\n offset : offset,\n gutterOffset : lineHeight ? Math.max(0, Math.ceil((offset + size.height - size.scrollerHeight) / lineHeight)) : 0,\n height : this.$size.scrollerHeight\n };\n\n if (this.session.$bidiHandler)\n this.session.$bidiHandler.setContentWidth(longestLine - this.$padding);\n\n return changes;\n };\n\n this.$updateLines = function() {\n if (!this.$changedLines) return;\n var firstRow = this.$changedLines.firstRow;\n var lastRow = this.$changedLines.lastRow;\n this.$changedLines = null;\n\n var layerConfig = this.layerConfig;\n\n if (firstRow > layerConfig.lastRow + 1) { return; }\n if (lastRow < layerConfig.firstRow) { return; }\n if (lastRow === Infinity) {\n if (this.$showGutter)\n this.$gutterLayer.update(layerConfig);\n this.$textLayer.update(layerConfig);\n return;\n }\n this.$textLayer.updateLines(layerConfig, firstRow, lastRow);\n return true;\n };\n\n this.$getLongestLine = function() {\n var charCount = this.session.getScreenWidth();\n if (this.showInvisibles && !this.session.$useWrapMode)\n charCount += 1;\n \n if (this.$textLayer && charCount > this.$textLayer.MAX_LINE_LENGTH)\n charCount = this.$textLayer.MAX_LINE_LENGTH + 30;\n\n return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth));\n };\n this.updateFrontMarkers = function() {\n this.$markerFront.setMarkers(this.session.getMarkers(true));\n this.$loop.schedule(this.CHANGE_MARKER_FRONT);\n };\n this.updateBackMarkers = function() {\n this.$markerBack.setMarkers(this.session.getMarkers());\n this.$loop.schedule(this.CHANGE_MARKER_BACK);\n };\n this.addGutterDecoration = function(row, className){\n this.$gutterLayer.addGutterDecoration(row, className);\n };\n this.removeGutterDecoration = function(row, className){\n this.$gutterLayer.removeGutterDecoration(row, className);\n };\n this.updateBreakpoints = function(rows) {\n this.$loop.schedule(this.CHANGE_GUTTER);\n };\n this.setAnnotations = function(annotations) {\n this.$gutterLayer.setAnnotations(annotations);\n this.$loop.schedule(this.CHANGE_GUTTER);\n };\n this.updateCursor = function() {\n this.$loop.schedule(this.CHANGE_CURSOR);\n };\n this.hideCursor = function() {\n this.$cursorLayer.hideCursor();\n };\n this.showCursor = function() {\n this.$cursorLayer.showCursor();\n };\n\n this.scrollSelectionIntoView = function(anchor, lead, offset) {\n this.scrollCursorIntoView(anchor, offset);\n this.scrollCursorIntoView(lead, offset);\n };\n this.scrollCursorIntoView = function(cursor, offset, $viewMargin) {\n if (this.$size.scrollerHeight === 0)\n return;\n\n var pos = this.$cursorLayer.getPixelPosition(cursor);\n\n var left = pos.left;\n var top = pos.top;\n \n var topMargin = $viewMargin && $viewMargin.top || 0;\n var bottomMargin = $viewMargin && $viewMargin.bottom || 0;\n \n var scrollTop = this.$scrollAnimation ? this.session.getScrollTop() : this.scrollTop;\n \n if (scrollTop + topMargin > top) {\n if (offset && scrollTop + topMargin > top + this.lineHeight)\n top -= offset * this.$size.scrollerHeight;\n if (top === 0)\n top = -this.scrollMargin.top;\n this.session.setScrollTop(top);\n } else if (scrollTop + this.$size.scrollerHeight - bottomMargin < top + this.lineHeight) {\n if (offset && scrollTop + this.$size.scrollerHeight - bottomMargin < top - this.lineHeight)\n top += offset * this.$size.scrollerHeight;\n this.session.setScrollTop(top + this.lineHeight + bottomMargin - this.$size.scrollerHeight);\n }\n\n var scrollLeft = this.scrollLeft;\n\n if (scrollLeft > left) {\n if (left < this.$padding + 2 * this.layerConfig.characterWidth)\n left = -this.scrollMargin.left;\n this.session.setScrollLeft(left);\n } else if (scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) {\n this.session.setScrollLeft(Math.round(left + this.characterWidth - this.$size.scrollerWidth));\n } else if (scrollLeft <= this.$padding && left - scrollLeft < this.characterWidth) {\n this.session.setScrollLeft(0);\n }\n };\n this.getScrollTop = function() {\n return this.session.getScrollTop();\n };\n this.getScrollLeft = function() {\n return this.session.getScrollLeft();\n };\n this.getScrollTopRow = function() {\n return this.scrollTop / this.lineHeight;\n };\n this.getScrollBottomRow = function() {\n return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);\n };\n this.scrollToRow = function(row) {\n this.session.setScrollTop(row * this.lineHeight);\n };\n\n this.alignCursor = function(cursor, alignment) {\n if (typeof cursor == \"number\")\n cursor = {row: cursor, column: 0};\n\n var pos = this.$cursorLayer.getPixelPosition(cursor);\n var h = this.$size.scrollerHeight - this.lineHeight;\n var offset = pos.top - h * (alignment || 0);\n\n this.session.setScrollTop(offset);\n return offset;\n };\n\n this.STEPS = 8;\n this.$calcSteps = function(fromValue, toValue){\n var i = 0;\n var l = this.STEPS;\n var steps = [];\n\n var func = function(t, x_min, dx) {\n return dx * (Math.pow(t - 1, 3) + 1) + x_min;\n };\n\n for (i = 0; i < l; ++i)\n steps.push(func(i / this.STEPS, fromValue, toValue - fromValue));\n\n return steps;\n };\n this.scrollToLine = function(line, center, animate, callback) {\n var pos = this.$cursorLayer.getPixelPosition({row: line, column: 0});\n var offset = pos.top;\n if (center)\n offset -= this.$size.scrollerHeight / 2;\n\n var initialScroll = this.scrollTop;\n this.session.setScrollTop(offset);\n if (animate !== false)\n this.animateScrolling(initialScroll, callback);\n };\n\n this.animateScrolling = function(fromValue, callback) {\n var toValue = this.scrollTop;\n if (!this.$animatedScroll)\n return;\n var _self = this;\n \n if (fromValue == toValue)\n return;\n \n if (this.$scrollAnimation) {\n var oldSteps = this.$scrollAnimation.steps;\n if (oldSteps.length) {\n fromValue = oldSteps[0];\n if (fromValue == toValue)\n return;\n }\n }\n \n var steps = _self.$calcSteps(fromValue, toValue);\n this.$scrollAnimation = {from: fromValue, to: toValue, steps: steps};\n\n clearInterval(this.$timer);\n\n _self.session.setScrollTop(steps.shift());\n _self.session.$scrollTop = toValue;\n this.$timer = setInterval(function() {\n if (!_self.session) \n return clearInterval(_self.$timer);\n if (steps.length) {\n _self.session.setScrollTop(steps.shift());\n _self.session.$scrollTop = toValue;\n } else if (toValue != null) {\n _self.session.$scrollTop = -1;\n _self.session.setScrollTop(toValue);\n toValue = null;\n } else {\n _self.$timer = clearInterval(_self.$timer);\n _self.$scrollAnimation = null;\n callback && callback();\n }\n }, 10);\n };\n this.scrollToY = function(scrollTop) {\n if (this.scrollTop !== scrollTop) {\n this.$loop.schedule(this.CHANGE_SCROLL);\n this.scrollTop = scrollTop;\n }\n };\n this.scrollToX = function(scrollLeft) {\n if (this.scrollLeft !== scrollLeft)\n this.scrollLeft = scrollLeft;\n this.$loop.schedule(this.CHANGE_H_SCROLL);\n };\n this.scrollTo = function(x, y) {\n this.session.setScrollTop(y);\n this.session.setScrollLeft(y);\n };\n this.scrollBy = function(deltaX, deltaY) {\n deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);\n deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);\n };\n this.isScrollableBy = function(deltaX, deltaY) {\n if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top)\n return true;\n if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight\n - this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom)\n return true;\n if (deltaX < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left)\n return true;\n if (deltaX > 0 && this.session.getScrollLeft() + this.$size.scrollerWidth\n - this.layerConfig.width < -1 + this.scrollMargin.right)\n return true;\n };\n\n this.pixelToScreenCoordinates = function(x, y) {\n var canvasPos;\n if (this.$hasCssTransforms) {\n canvasPos = {top:0, left: 0};\n var p = this.$fontMetrics.transformCoordinates([x, y]);\n x = p[1] - this.gutterWidth - this.margin.left;\n y = p[0];\n } else {\n canvasPos = this.scroller.getBoundingClientRect();\n }\n \n var offsetX = x + this.scrollLeft - canvasPos.left - this.$padding;\n var offset = offsetX / this.characterWidth;\n var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight);\n var col = this.$blockCursor ? Math.floor(offset) : Math.round(offset);\n\n return {row: row, column: col, side: offset - col > 0 ? 1 : -1, offsetX: offsetX};\n };\n\n this.screenToTextCoordinates = function(x, y) {\n var canvasPos;\n if (this.$hasCssTransforms) {\n canvasPos = {top:0, left: 0};\n var p = this.$fontMetrics.transformCoordinates([x, y]);\n x = p[1] - this.gutterWidth - this.margin.left;\n y = p[0];\n } else {\n canvasPos = this.scroller.getBoundingClientRect();\n }\n\n var offsetX = x + this.scrollLeft - canvasPos.left - this.$padding;\n var offset = offsetX / this.characterWidth;\n var col = this.$blockCursor ? Math.floor(offset) : Math.round(offset);\n\n var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight);\n\n return this.session.screenToDocumentPosition(row, Math.max(col, 0), offsetX);\n };\n this.textToScreenCoordinates = function(row, column) {\n var canvasPos = this.scroller.getBoundingClientRect();\n var pos = this.session.documentToScreenPosition(row, column);\n\n var x = this.$padding + (this.session.$bidiHandler.isBidiRow(pos.row, row)\n ? this.session.$bidiHandler.getPosLeft(pos.column)\n : Math.round(pos.column * this.characterWidth));\n \n var y = pos.row * this.lineHeight;\n\n return {\n pageX: canvasPos.left + x - this.scrollLeft,\n pageY: canvasPos.top + y - this.scrollTop\n };\n };\n this.visualizeFocus = function() {\n dom.addCssClass(this.container, \"ace_focus\");\n };\n this.visualizeBlur = function() {\n dom.removeCssClass(this.container, \"ace_focus\");\n };\n this.showComposition = function(composition) {\n this.$composition = composition;\n if (!composition.cssText) {\n composition.cssText = this.textarea.style.cssText;\n }\n if (composition.useTextareaForIME == undefined)\n composition.useTextareaForIME = this.$useTextareaForIME;\n \n if (this.$useTextareaForIME) {\n dom.addCssClass(this.textarea, \"ace_composition\");\n this.textarea.style.cssText = \"\";\n this.$moveTextAreaToCursor();\n this.$cursorLayer.element.style.display = \"none\";\n }\n else {\n composition.markerId = this.session.addMarker(composition.markerRange, \"ace_composition_marker\", \"text\");\n }\n };\n this.setCompositionText = function(text) {\n var cursor = this.session.selection.cursor;\n this.addToken(text, \"composition_placeholder\", cursor.row, cursor.column);\n this.$moveTextAreaToCursor();\n };\n this.hideComposition = function() {\n if (!this.$composition)\n return;\n \n if (this.$composition.markerId)\n this.session.removeMarker(this.$composition.markerId);\n\n dom.removeCssClass(this.textarea, \"ace_composition\");\n this.textarea.style.cssText = this.$composition.cssText;\n var cursor = this.session.selection.cursor;\n this.removeExtraToken(cursor.row, cursor.column);\n this.$composition = null;\n this.$cursorLayer.element.style.display = \"\";\n };\n \n this.addToken = function(text, type, row, column) {\n var session = this.session;\n session.bgTokenizer.lines[row] = null;\n var newToken = {type: type, value: text};\n var tokens = session.getTokens(row);\n if (column == null) {\n tokens.push(newToken);\n } else {\n var l = 0;\n for (var i =0; i < tokens.length; i++) {\n var token = tokens[i];\n l += token.value.length;\n if (column <= l) {\n var diff = token.value.length - (l - column);\n var before = token.value.slice(0, diff);\n var after = token.value.slice(diff);\n \n tokens.splice(i, 1, {type: token.type, value: before}, newToken, {type: token.type, value: after});\n break;\n }\n }\n }\n this.updateLines(row, row);\n };\n\n this.removeExtraToken = function(row, column) {\n this.updateLines(row, row);\n };\n this.setTheme = function(theme, cb) {\n var _self = this;\n this.$themeId = theme;\n _self._dispatchEvent('themeChange',{theme:theme});\n\n if (!theme || typeof theme == \"string\") {\n var moduleName = theme || this.$options.theme.initialValue;\n config.loadModule([\"theme\", moduleName], afterLoad);\n } else {\n afterLoad(theme);\n }\n\n function afterLoad(module) {\n if (_self.$themeId != theme)\n return cb && cb();\n if (!module || !module.cssClass)\n throw new Error(\"couldn't load module \" + theme + \" or it didn't call define\");\n if (module.$id)\n _self.$themeId = module.$id;\n dom.importCssString(\n module.cssText,\n module.cssClass,\n _self.container\n );\n\n if (_self.theme)\n dom.removeCssClass(_self.container, _self.theme.cssClass);\n\n var padding = \"padding\" in module ? module.padding \n : \"padding\" in (_self.theme || {}) ? 4 : _self.$padding;\n if (_self.$padding && padding != _self.$padding)\n _self.setPadding(padding);\n _self.$theme = module.cssClass;\n\n _self.theme = module;\n dom.addCssClass(_self.container, module.cssClass);\n dom.setCssClass(_self.container, \"ace_dark\", module.isDark);\n if (_self.$size) {\n _self.$size.width = 0;\n _self.$updateSizeAsync();\n }\n\n _self._dispatchEvent('themeLoaded', {theme:module});\n cb && cb();\n }\n };\n this.getTheme = function() {\n return this.$themeId;\n };\n this.setStyle = function(style, include) {\n dom.setCssClass(this.container, style, include !== false);\n };\n this.unsetStyle = function(style) {\n dom.removeCssClass(this.container, style);\n };\n \n this.setCursorStyle = function(style) {\n dom.setStyle(this.scroller.style, \"cursor\", style);\n };\n this.setMouseCursor = function(cursorStyle) {\n dom.setStyle(this.scroller.style, \"cursor\", cursorStyle);\n };\n \n this.attachToShadowRoot = function() {\n dom.importCssString(editorCss, \"ace_editor.css\", this.container);\n };\n this.destroy = function() {\n this.freeze();\n this.$fontMetrics.destroy();\n this.$cursorLayer.destroy();\n this.removeAllListeners();\n this.container.textContent = \"\";\n };\n\n}).call(VirtualRenderer.prototype);\n\n\nconfig.defineOptions(VirtualRenderer.prototype, \"renderer\", {\n animatedScroll: {initialValue: false},\n showInvisibles: {\n set: function(value) {\n if (this.$textLayer.setShowInvisibles(value))\n this.$loop.schedule(this.CHANGE_TEXT);\n },\n initialValue: false\n },\n showPrintMargin: {\n set: function() { this.$updatePrintMargin(); },\n initialValue: true\n },\n printMarginColumn: {\n set: function() { this.$updatePrintMargin(); },\n initialValue: 80\n },\n printMargin: {\n set: function(val) {\n if (typeof val == \"number\")\n this.$printMarginColumn = val;\n this.$showPrintMargin = !!val;\n this.$updatePrintMargin();\n },\n get: function() {\n return this.$showPrintMargin && this.$printMarginColumn; \n }\n },\n showGutter: {\n set: function(show){\n this.$gutter.style.display = show ? \"block\" : \"none\";\n this.$loop.schedule(this.CHANGE_FULL);\n this.onGutterResize();\n },\n initialValue: true\n },\n fadeFoldWidgets: {\n set: function(show) {\n dom.setCssClass(this.$gutter, \"ace_fade-fold-widgets\", show);\n },\n initialValue: false\n },\n showFoldWidgets: {\n set: function(show) {\n this.$gutterLayer.setShowFoldWidgets(show);\n this.$loop.schedule(this.CHANGE_GUTTER);\n },\n initialValue: true\n },\n displayIndentGuides: {\n set: function(show) {\n if (this.$textLayer.setDisplayIndentGuides(show))\n this.$loop.schedule(this.CHANGE_TEXT);\n },\n initialValue: true\n },\n highlightGutterLine: {\n set: function(shouldHighlight) {\n this.$gutterLayer.setHighlightGutterLine(shouldHighlight);\n this.$loop.schedule(this.CHANGE_GUTTER);\n },\n initialValue: true\n },\n hScrollBarAlwaysVisible: {\n set: function(val) {\n if (!this.$hScrollBarAlwaysVisible || !this.$horizScroll)\n this.$loop.schedule(this.CHANGE_SCROLL);\n },\n initialValue: false\n },\n vScrollBarAlwaysVisible: {\n set: function(val) {\n if (!this.$vScrollBarAlwaysVisible || !this.$vScroll)\n this.$loop.schedule(this.CHANGE_SCROLL);\n },\n initialValue: false\n },\n fontSize: {\n set: function(size) {\n if (typeof size == \"number\")\n size = size + \"px\";\n this.container.style.fontSize = size;\n this.updateFontSize();\n },\n initialValue: 12\n },\n fontFamily: {\n set: function(name) {\n this.container.style.fontFamily = name;\n this.updateFontSize();\n }\n },\n maxLines: {\n set: function(val) {\n this.updateFull();\n }\n },\n minLines: {\n set: function(val) {\n if (!(this.$minLines < 0x1ffffffffffff))\n this.$minLines = 0;\n this.updateFull();\n }\n },\n maxPixelHeight: {\n set: function(val) {\n this.updateFull();\n },\n initialValue: 0\n },\n scrollPastEnd: {\n set: function(val) {\n val = +val || 0;\n if (this.$scrollPastEnd == val)\n return;\n this.$scrollPastEnd = val;\n this.$loop.schedule(this.CHANGE_SCROLL);\n },\n initialValue: 0,\n handlesSet: true\n },\n fixedWidthGutter: {\n set: function(val) {\n this.$gutterLayer.$fixedWidth = !!val;\n this.$loop.schedule(this.CHANGE_GUTTER);\n }\n },\n theme: {\n set: function(val) { this.setTheme(val); },\n get: function() { return this.$themeId || this.theme; },\n initialValue: \"./theme/textmate\",\n handlesSet: true\n },\n hasCssTransforms: {\n },\n useTextareaForIME: {\n initialValue: !useragent.isMobile && !useragent.isIE\n }\n});\n\nexports.VirtualRenderer = VirtualRenderer;\n});\n\nace.define(\"ace/worker/worker_client\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/net\",\"ace/lib/event_emitter\",\"ace/config\"], function(require, exports, module) {\n\nvar oop = require(\"../lib/oop\");\nvar net = require(\"../lib/net\");\nvar EventEmitter = require(\"../lib/event_emitter\").EventEmitter;\nvar config = require(\"../config\");\n\nfunction $workerBlob(workerUrl) {\n var script = \"importScripts('\" + net.qualifyURL(workerUrl) + \"');\";\n try {\n return new Blob([script], {\"type\": \"application/javascript\"});\n } catch (e) { // Backwards-compatibility\n var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;\n var blobBuilder = new BlobBuilder();\n blobBuilder.append(script);\n return blobBuilder.getBlob(\"application/javascript\");\n }\n}\n\nfunction createWorker(workerUrl) {\n if (typeof Worker == \"undefined\")\n return { postMessage: function() {}, terminate: function() {} };\n if (config.get(\"loadWorkerFromBlob\")) {\n var blob = $workerBlob(workerUrl);\n var URL = window.URL || window.webkitURL;\n var blobURL = URL.createObjectURL(blob);\n return new Worker(blobURL);\n }\n return new Worker(workerUrl);\n}\n\nvar WorkerClient = function(worker) {\n if (!worker.postMessage)\n worker = this.$createWorkerFromOldConfig.apply(this, arguments);\n\n this.$worker = worker;\n this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);\n this.changeListener = this.changeListener.bind(this);\n this.onMessage = this.onMessage.bind(this);\n\n this.callbackId = 1;\n this.callbacks = {};\n\n this.$worker.onmessage = this.onMessage;\n};\n\n(function(){\n\n oop.implement(this, EventEmitter);\n\n this.$createWorkerFromOldConfig = function(topLevelNamespaces, mod, classname, workerUrl, importScripts) {\n if (require.nameToUrl && !require.toUrl)\n require.toUrl = require.nameToUrl;\n\n if (config.get(\"packaged\") || !require.toUrl) {\n workerUrl = workerUrl || config.moduleUrl(mod, \"worker\");\n } else {\n var normalizePath = this.$normalizePath;\n workerUrl = workerUrl || normalizePath(require.toUrl(\"ace/worker/worker.js\", null, \"_\"));\n\n var tlns = {};\n topLevelNamespaces.forEach(function(ns) {\n tlns[ns] = normalizePath(require.toUrl(ns, null, \"_\").replace(/(\\.js)?(\\?.*)?$/, \"\"));\n });\n }\n\n this.$worker = createWorker(workerUrl);\n if (importScripts) {\n this.send(\"importScripts\", importScripts);\n }\n this.$worker.postMessage({\n init : true,\n tlns : tlns,\n module : mod,\n classname : classname\n });\n return this.$worker;\n };\n\n this.onMessage = function(e) {\n var msg = e.data;\n switch (msg.type) {\n case \"event\":\n this._signal(msg.name, {data: msg.data});\n break;\n case \"call\":\n var callback = this.callbacks[msg.id];\n if (callback) {\n callback(msg.data);\n delete this.callbacks[msg.id];\n }\n break;\n case \"error\":\n this.reportError(msg.data);\n break;\n case \"log\":\n window.console && console.log && console.log.apply(console, msg.data);\n break;\n }\n };\n \n this.reportError = function(err) {\n window.console && console.error && console.error(err);\n };\n\n this.$normalizePath = function(path) {\n return net.qualifyURL(path);\n };\n\n this.terminate = function() {\n this._signal(\"terminate\", {});\n this.deltaQueue = null;\n this.$worker.terminate();\n this.$worker = null;\n if (this.$doc)\n this.$doc.off(\"change\", this.changeListener);\n this.$doc = null;\n };\n\n this.send = function(cmd, args) {\n this.$worker.postMessage({command: cmd, args: args});\n };\n\n this.call = function(cmd, args, callback) {\n if (callback) {\n var id = this.callbackId++;\n this.callbacks[id] = callback;\n args.push(id);\n }\n this.send(cmd, args);\n };\n\n this.emit = function(event, data) {\n try {\n if (data.data && data.data.err)\n data.data.err = {message: data.data.err.message, stack: data.data.err.stack, code: data.data.err.code};\n this.$worker.postMessage({event: event, data: {data: data.data}});\n }\n catch(ex) {\n console.error(ex.stack);\n }\n };\n\n this.attachToDocument = function(doc) {\n if (this.$doc)\n this.terminate();\n\n this.$doc = doc;\n this.call(\"setValue\", [doc.getValue()]);\n doc.on(\"change\", this.changeListener);\n };\n\n this.changeListener = function(delta) {\n if (!this.deltaQueue) {\n this.deltaQueue = [];\n setTimeout(this.$sendDeltaQueue, 0);\n }\n if (delta.action == \"insert\")\n this.deltaQueue.push(delta.start, delta.lines);\n else\n this.deltaQueue.push(delta.start, delta.end);\n };\n\n this.$sendDeltaQueue = function() {\n var q = this.deltaQueue;\n if (!q) return;\n this.deltaQueue = null;\n if (q.length > 50 && q.length > this.$doc.getLength() >> 1) {\n this.call(\"setValue\", [this.$doc.getValue()]);\n } else\n this.emit(\"change\", {data: q});\n };\n\n}).call(WorkerClient.prototype);\n\n\nvar UIWorkerClient = function(topLevelNamespaces, mod, classname) {\n var main = null;\n var emitSync = false;\n var sender = Object.create(EventEmitter);\n\n var messageBuffer = [];\n var workerClient = new WorkerClient({\n messageBuffer: messageBuffer,\n terminate: function() {},\n postMessage: function(e) {\n messageBuffer.push(e);\n if (!main) return;\n if (emitSync)\n setTimeout(processNext);\n else\n processNext();\n }\n });\n\n workerClient.setEmitSync = function(val) { emitSync = val; };\n\n var processNext = function() {\n var msg = messageBuffer.shift();\n if (msg.command)\n main[msg.command].apply(main, msg.args);\n else if (msg.event)\n sender._signal(msg.event, msg.data);\n };\n\n sender.postMessage = function(msg) {\n workerClient.onMessage({data: msg});\n };\n sender.callback = function(data, callbackId) {\n this.postMessage({type: \"call\", id: callbackId, data: data});\n };\n sender.emit = function(name, data) {\n this.postMessage({type: \"event\", name: name, data: data});\n };\n\n config.loadModule([\"worker\", mod], function(Main) {\n main = new Main[classname](sender);\n while (messageBuffer.length)\n processNext();\n });\n\n return workerClient;\n};\n\nexports.UIWorkerClient = UIWorkerClient;\nexports.WorkerClient = WorkerClient;\nexports.createWorker = createWorker;\n\n\n});\n\nace.define(\"ace/placeholder\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/lib/event_emitter\",\"ace/lib/oop\"], function(require, exports, module) {\n\nvar Range = require(\"./range\").Range;\nvar EventEmitter = require(\"./lib/event_emitter\").EventEmitter;\nvar oop = require(\"./lib/oop\");\n\nvar PlaceHolder = function(session, length, pos, others, mainClass, othersClass) {\n var _self = this;\n this.length = length;\n this.session = session;\n this.doc = session.getDocument();\n this.mainClass = mainClass;\n this.othersClass = othersClass;\n this.$onUpdate = this.onUpdate.bind(this);\n this.doc.on(\"change\", this.$onUpdate);\n this.$others = others;\n \n this.$onCursorChange = function() {\n setTimeout(function() {\n _self.onCursorChange();\n });\n };\n \n this.$pos = pos;\n var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || {length: -1};\n this.$undoStackDepth = undoStack.length;\n this.setup();\n\n session.selection.on(\"changeCursor\", this.$onCursorChange);\n};\n\n(function() {\n\n oop.implement(this, EventEmitter);\n this.setup = function() {\n var _self = this;\n var doc = this.doc;\n var session = this.session;\n \n this.selectionBefore = session.selection.toJSON();\n if (session.selection.inMultiSelectMode)\n session.selection.toSingleRange();\n\n this.pos = doc.createAnchor(this.$pos.row, this.$pos.column);\n var pos = this.pos;\n pos.$insertRight = true;\n pos.detach();\n pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false);\n this.others = [];\n this.$others.forEach(function(other) {\n var anchor = doc.createAnchor(other.row, other.column);\n anchor.$insertRight = true;\n anchor.detach();\n _self.others.push(anchor);\n });\n session.setUndoSelect(false);\n };\n this.showOtherMarkers = function() {\n if (this.othersActive) return;\n var session = this.session;\n var _self = this;\n this.othersActive = true;\n this.others.forEach(function(anchor) {\n anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column+_self.length), _self.othersClass, null, false);\n });\n };\n this.hideOtherMarkers = function() {\n if (!this.othersActive) return;\n this.othersActive = false;\n for (var i = 0; i < this.others.length; i++) {\n this.session.removeMarker(this.others[i].markerId);\n }\n };\n this.onUpdate = function(delta) {\n if (this.$updating)\n return this.updateAnchors(delta);\n \n var range = delta;\n if (range.start.row !== range.end.row) return;\n if (range.start.row !== this.pos.row) return;\n this.$updating = true;\n var lengthDiff = delta.action === \"insert\" ? range.end.column - range.start.column : range.start.column - range.end.column;\n var inMainRange = range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1;\n var distanceFromStart = range.start.column - this.pos.column;\n \n this.updateAnchors(delta);\n \n if (inMainRange)\n this.length += lengthDiff;\n\n if (inMainRange && !this.session.$fromUndo) {\n if (delta.action === 'insert') {\n for (var i = this.others.length - 1; i >= 0; i--) {\n var otherPos = this.others[i];\n var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};\n this.doc.insertMergedLines(newPos, delta.lines);\n }\n } else if (delta.action === 'remove') {\n for (var i = this.others.length - 1; i >= 0; i--) {\n var otherPos = this.others[i];\n var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};\n this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff));\n }\n }\n }\n \n this.$updating = false;\n this.updateMarkers();\n };\n \n this.updateAnchors = function(delta) {\n this.pos.onChange(delta);\n for (var i = this.others.length; i--;)\n this.others[i].onChange(delta);\n this.updateMarkers();\n };\n \n this.updateMarkers = function() {\n if (this.$updating)\n return;\n var _self = this;\n var session = this.session;\n var updateMarker = function(pos, className) {\n session.removeMarker(pos.markerId);\n pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column+_self.length), className, null, false);\n };\n updateMarker(this.pos, this.mainClass);\n for (var i = this.others.length; i--;)\n updateMarker(this.others[i], this.othersClass);\n };\n\n this.onCursorChange = function(event) {\n if (this.$updating || !this.session) return;\n var pos = this.session.selection.getCursor();\n if (pos.row === this.pos.row && pos.column >= this.pos.column && pos.column <= this.pos.column + this.length) {\n this.showOtherMarkers();\n this._emit(\"cursorEnter\", event);\n } else {\n this.hideOtherMarkers();\n this._emit(\"cursorLeave\", event);\n }\n }; \n this.detach = function() {\n this.session.removeMarker(this.pos && this.pos.markerId);\n this.hideOtherMarkers();\n this.doc.off(\"change\", this.$onUpdate);\n this.session.selection.off(\"changeCursor\", this.$onCursorChange);\n this.session.setUndoSelect(true);\n this.session = null;\n };\n this.cancel = function() {\n if (this.$undoStackDepth === -1)\n return;\n var undoManager = this.session.getUndoManager();\n var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth;\n for (var i = 0; i < undosRequired; i++) {\n undoManager.undo(this.session, true);\n }\n if (this.selectionBefore)\n this.session.selection.fromJSON(this.selectionBefore);\n };\n}).call(PlaceHolder.prototype);\n\n\nexports.PlaceHolder = PlaceHolder;\n});\n\nace.define(\"ace/mouse/multi_select_handler\",[\"require\",\"exports\",\"module\",\"ace/lib/event\",\"ace/lib/useragent\"], function(require, exports, module) {\n\nvar event = require(\"../lib/event\");\nvar useragent = require(\"../lib/useragent\");\nfunction isSamePoint(p1, p2) {\n return p1.row == p2.row && p1.column == p2.column;\n}\n\nfunction onMouseDown(e) {\n var ev = e.domEvent;\n var alt = ev.altKey;\n var shift = ev.shiftKey;\n var ctrl = ev.ctrlKey;\n var accel = e.getAccelKey();\n var button = e.getButton();\n \n if (ctrl && useragent.isMac)\n button = ev.button;\n\n if (e.editor.inMultiSelectMode && button == 2) {\n e.editor.textInput.onContextMenu(e.domEvent);\n return;\n }\n \n if (!ctrl && !alt && !accel) {\n if (button === 0 && e.editor.inMultiSelectMode)\n e.editor.exitMultiSelectMode();\n return;\n }\n \n if (button !== 0)\n return;\n\n var editor = e.editor;\n var selection = editor.selection;\n var isMultiSelect = editor.inMultiSelectMode;\n var pos = e.getDocumentPosition();\n var cursor = selection.getCursor();\n var inSelection = e.inSelection() || (selection.isEmpty() && isSamePoint(pos, cursor));\n\n var mouseX = e.x, mouseY = e.y;\n var onMouseSelection = function(e) {\n mouseX = e.clientX;\n mouseY = e.clientY;\n };\n \n var session = editor.session;\n var screenAnchor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);\n var screenCursor = screenAnchor;\n \n var selectionMode;\n if (editor.$mouseHandler.$enableJumpToDef) {\n if (ctrl && alt || accel && alt)\n selectionMode = shift ? \"block\" : \"add\";\n else if (alt && editor.$blockSelectEnabled)\n selectionMode = \"block\";\n } else {\n if (accel && !alt) {\n selectionMode = \"add\";\n if (!isMultiSelect && shift)\n return;\n } else if (alt && editor.$blockSelectEnabled) {\n selectionMode = \"block\";\n }\n }\n \n if (selectionMode && useragent.isMac && ev.ctrlKey) {\n editor.$mouseHandler.cancelContextMenu();\n }\n\n if (selectionMode == \"add\") {\n if (!isMultiSelect && inSelection)\n return; // dragging\n\n if (!isMultiSelect) {\n var range = selection.toOrientedRange();\n editor.addSelectionMarker(range);\n }\n\n var oldRange = selection.rangeList.rangeAtPoint(pos);\n \n editor.inVirtualSelectionMode = true;\n \n if (shift) {\n oldRange = null;\n range = selection.ranges[0] || range;\n editor.removeSelectionMarker(range);\n }\n editor.once(\"mouseup\", function() {\n var tmpSel = selection.toOrientedRange();\n\n if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))\n selection.substractPoint(tmpSel.cursor);\n else {\n if (shift) {\n selection.substractPoint(range.cursor);\n } else if (range) {\n editor.removeSelectionMarker(range);\n selection.addRange(range);\n }\n selection.addRange(tmpSel);\n }\n editor.inVirtualSelectionMode = false;\n });\n\n } else if (selectionMode == \"block\") {\n e.stop();\n editor.inVirtualSelectionMode = true; \n var initialRange;\n var rectSel = [];\n var blockSelect = function() {\n var newCursor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);\n var cursor = session.screenToDocumentPosition(newCursor.row, newCursor.column, newCursor.offsetX);\n\n if (isSamePoint(screenCursor, newCursor) && isSamePoint(cursor, selection.lead))\n return;\n screenCursor = newCursor;\n \n editor.selection.moveToPosition(cursor);\n editor.renderer.scrollCursorIntoView();\n\n editor.removeSelectionMarkers(rectSel);\n rectSel = selection.rectangularRangeBlock(screenCursor, screenAnchor);\n if (editor.$mouseHandler.$clickSelection && rectSel.length == 1 && rectSel[0].isEmpty())\n rectSel[0] = editor.$mouseHandler.$clickSelection.clone();\n rectSel.forEach(editor.addSelectionMarker, editor);\n editor.updateSelectionMarkers();\n };\n if (isMultiSelect && !accel) {\n selection.toSingleRange();\n } else if (!isMultiSelect && accel) {\n initialRange = selection.toOrientedRange();\n editor.addSelectionMarker(initialRange);\n }\n \n if (shift)\n screenAnchor = session.documentToScreenPosition(selection.lead); \n else\n selection.moveToPosition(pos);\n \n screenCursor = {row: -1, column: -1};\n\n var onMouseSelectionEnd = function(e) {\n blockSelect();\n clearInterval(timerId);\n editor.removeSelectionMarkers(rectSel);\n if (!rectSel.length)\n rectSel = [selection.toOrientedRange()];\n if (initialRange) {\n editor.removeSelectionMarker(initialRange);\n selection.toSingleRange(initialRange);\n }\n for (var i = 0; i < rectSel.length; i++)\n selection.addRange(rectSel[i]);\n editor.inVirtualSelectionMode = false;\n editor.$mouseHandler.$clickSelection = null;\n };\n\n var onSelectionInterval = blockSelect;\n\n event.capture(editor.container, onMouseSelection, onMouseSelectionEnd);\n var timerId = setInterval(function() {onSelectionInterval();}, 20);\n\n return e.preventDefault();\n }\n}\n\n\nexports.onMouseDown = onMouseDown;\n\n});\n\nace.define(\"ace/commands/multi_select_commands\",[\"require\",\"exports\",\"module\",\"ace/keyboard/hash_handler\"], function(require, exports, module) {\nexports.defaultCommands = [{\n name: \"addCursorAbove\",\n description: \"Add cursor above\",\n exec: function(editor) { editor.selectMoreLines(-1); },\n bindKey: {win: \"Ctrl-Alt-Up\", mac: \"Ctrl-Alt-Up\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"addCursorBelow\",\n description: \"Add cursor below\",\n exec: function(editor) { editor.selectMoreLines(1); },\n bindKey: {win: \"Ctrl-Alt-Down\", mac: \"Ctrl-Alt-Down\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"addCursorAboveSkipCurrent\",\n description: \"Add cursor above (skip current)\",\n exec: function(editor) { editor.selectMoreLines(-1, true); },\n bindKey: {win: \"Ctrl-Alt-Shift-Up\", mac: \"Ctrl-Alt-Shift-Up\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"addCursorBelowSkipCurrent\",\n description: \"Add cursor below (skip current)\",\n exec: function(editor) { editor.selectMoreLines(1, true); },\n bindKey: {win: \"Ctrl-Alt-Shift-Down\", mac: \"Ctrl-Alt-Shift-Down\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectMoreBefore\",\n description: \"Select more before\",\n exec: function(editor) { editor.selectMore(-1); },\n bindKey: {win: \"Ctrl-Alt-Left\", mac: \"Ctrl-Alt-Left\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectMoreAfter\",\n description: \"Select more after\",\n exec: function(editor) { editor.selectMore(1); },\n bindKey: {win: \"Ctrl-Alt-Right\", mac: \"Ctrl-Alt-Right\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectNextBefore\",\n description: \"Select next before\",\n exec: function(editor) { editor.selectMore(-1, true); },\n bindKey: {win: \"Ctrl-Alt-Shift-Left\", mac: \"Ctrl-Alt-Shift-Left\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"selectNextAfter\",\n description: \"Select next after\",\n exec: function(editor) { editor.selectMore(1, true); },\n bindKey: {win: \"Ctrl-Alt-Shift-Right\", mac: \"Ctrl-Alt-Shift-Right\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}, {\n name: \"toggleSplitSelectionIntoLines\",\n description: \"Split into lines\",\n exec: function(editor) {\n if (editor.multiSelect.rangeCount > 1)\n editor.multiSelect.joinSelections();\n else\n editor.multiSelect.splitIntoLines();\n },\n bindKey: {win: \"Ctrl-Alt-L\", mac: \"Ctrl-Alt-L\"},\n readOnly: true\n}, {\n name: \"splitSelectionIntoLines\",\n description: \"Split into lines\",\n exec: function(editor) { editor.multiSelect.splitIntoLines(); },\n readOnly: true\n}, {\n name: \"alignCursors\",\n description: \"Align cursors\",\n exec: function(editor) { editor.alignCursors(); },\n bindKey: {win: \"Ctrl-Alt-A\", mac: \"Ctrl-Alt-A\"},\n scrollIntoView: \"cursor\"\n}, {\n name: \"findAll\",\n description: \"Find all\",\n exec: function(editor) { editor.findAll(); },\n bindKey: {win: \"Ctrl-Alt-K\", mac: \"Ctrl-Alt-G\"},\n scrollIntoView: \"cursor\",\n readOnly: true\n}];\nexports.multiSelectCommands = [{\n name: \"singleSelection\",\n description: \"Single selection\",\n bindKey: \"esc\",\n exec: function(editor) { editor.exitMultiSelectMode(); },\n scrollIntoView: \"cursor\",\n readOnly: true,\n isAvailable: function(editor) {return editor && editor.inMultiSelectMode;}\n}];\n\nvar HashHandler = require(\"../keyboard/hash_handler\").HashHandler;\nexports.keyboardHandler = new HashHandler(exports.multiSelectCommands);\n\n});\n\nace.define(\"ace/multi_select\",[\"require\",\"exports\",\"module\",\"ace/range_list\",\"ace/range\",\"ace/selection\",\"ace/mouse/multi_select_handler\",\"ace/lib/event\",\"ace/lib/lang\",\"ace/commands/multi_select_commands\",\"ace/search\",\"ace/edit_session\",\"ace/editor\",\"ace/config\"], function(require, exports, module) {\n\nvar RangeList = require(\"./range_list\").RangeList;\nvar Range = require(\"./range\").Range;\nvar Selection = require(\"./selection\").Selection;\nvar onMouseDown = require(\"./mouse/multi_select_handler\").onMouseDown;\nvar event = require(\"./lib/event\");\nvar lang = require(\"./lib/lang\");\nvar commands = require(\"./commands/multi_select_commands\");\nexports.commands = commands.defaultCommands.concat(commands.multiSelectCommands);\nvar Search = require(\"./search\").Search;\nvar search = new Search();\n\nfunction find(session, needle, dir) {\n search.$options.wrap = true;\n search.$options.needle = needle;\n search.$options.backwards = dir == -1;\n return search.find(session);\n}\nvar EditSession = require(\"./edit_session\").EditSession;\n(function() {\n this.getSelectionMarkers = function() {\n return this.$selectionMarkers;\n };\n}).call(EditSession.prototype);\n(function() {\n this.ranges = null;\n this.rangeList = null;\n this.addRange = function(range, $blockChangeEvents) {\n if (!range)\n return;\n\n if (!this.inMultiSelectMode && this.rangeCount === 0) {\n var oldRange = this.toOrientedRange();\n this.rangeList.add(oldRange);\n this.rangeList.add(range);\n if (this.rangeList.ranges.length != 2) {\n this.rangeList.removeAll();\n return $blockChangeEvents || this.fromOrientedRange(range);\n }\n this.rangeList.removeAll();\n this.rangeList.add(oldRange);\n this.$onAddRange(oldRange);\n }\n\n if (!range.cursor)\n range.cursor = range.end;\n\n var removed = this.rangeList.add(range);\n\n this.$onAddRange(range);\n\n if (removed.length)\n this.$onRemoveRange(removed);\n\n if (this.rangeCount > 1 && !this.inMultiSelectMode) {\n this._signal(\"multiSelect\");\n this.inMultiSelectMode = true;\n this.session.$undoSelect = false;\n this.rangeList.attach(this.session);\n }\n\n return $blockChangeEvents || this.fromOrientedRange(range);\n };\n this.toSingleRange = function(range) {\n range = range || this.ranges[0];\n var removed = this.rangeList.removeAll();\n if (removed.length)\n this.$onRemoveRange(removed);\n\n range && this.fromOrientedRange(range);\n };\n this.substractPoint = function(pos) {\n var removed = this.rangeList.substractPoint(pos);\n if (removed) {\n this.$onRemoveRange(removed);\n return removed[0];\n }\n };\n this.mergeOverlappingRanges = function() {\n var removed = this.rangeList.merge();\n if (removed.length)\n this.$onRemoveRange(removed);\n };\n\n this.$onAddRange = function(range) {\n this.rangeCount = this.rangeList.ranges.length;\n this.ranges.unshift(range);\n this._signal(\"addRange\", {range: range});\n };\n\n this.$onRemoveRange = function(removed) {\n this.rangeCount = this.rangeList.ranges.length;\n if (this.rangeCount == 1 && this.inMultiSelectMode) {\n var lastRange = this.rangeList.ranges.pop();\n removed.push(lastRange);\n this.rangeCount = 0;\n }\n\n for (var i = removed.length; i--; ) {\n var index = this.ranges.indexOf(removed[i]);\n this.ranges.splice(index, 1);\n }\n\n this._signal(\"removeRange\", {ranges: removed});\n\n if (this.rangeCount === 0 && this.inMultiSelectMode) {\n this.inMultiSelectMode = false;\n this._signal(\"singleSelect\");\n this.session.$undoSelect = true;\n this.rangeList.detach(this.session);\n }\n\n lastRange = lastRange || this.ranges[0];\n if (lastRange && !lastRange.isEqual(this.getRange()))\n this.fromOrientedRange(lastRange);\n };\n this.$initRangeList = function() {\n if (this.rangeList)\n return;\n\n this.rangeList = new RangeList();\n this.ranges = [];\n this.rangeCount = 0;\n };\n this.getAllRanges = function() {\n return this.rangeCount ? this.rangeList.ranges.concat() : [this.getRange()];\n };\n this.splitIntoLines = function () {\n var ranges = this.ranges.length ? this.ranges : [this.getRange()];\n var newRanges = [];\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n var row = range.start.row;\n var endRow = range.end.row;\n if (row === endRow) {\n newRanges.push(range.clone());\n } else {\n newRanges.push(new Range(row, range.start.column, row, this.session.getLine(row).length));\n while (++row < endRow)\n newRanges.push(this.getLineRange(row, true));\n newRanges.push(new Range(endRow, 0, endRow, range.end.column));\n }\n if (i == 0 && !this.isBackwards())\n newRanges = newRanges.reverse();\n }\n this.toSingleRange();\n for (var i = newRanges.length; i--;)\n this.addRange(newRanges[i]);\n };\n \n this.joinSelections = function () {\n var ranges = this.rangeList.ranges;\n var lastRange = ranges[ranges.length - 1];\n var range = Range.fromPoints(ranges[0].start, lastRange.end);\n\n this.toSingleRange();\n this.setSelectionRange(range, lastRange.cursor == lastRange.start);\n };\n this.toggleBlockSelection = function () {\n if (this.rangeCount > 1) {\n var ranges = this.rangeList.ranges;\n var lastRange = ranges[ranges.length - 1];\n var range = Range.fromPoints(ranges[0].start, lastRange.end);\n\n this.toSingleRange();\n this.setSelectionRange(range, lastRange.cursor == lastRange.start);\n } else {\n var cursor = this.session.documentToScreenPosition(this.cursor);\n var anchor = this.session.documentToScreenPosition(this.anchor);\n\n var rectSel = this.rectangularRangeBlock(cursor, anchor);\n rectSel.forEach(this.addRange, this);\n }\n };\n this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) {\n var rectSel = [];\n\n var xBackwards = screenCursor.column < screenAnchor.column;\n if (xBackwards) {\n var startColumn = screenCursor.column;\n var endColumn = screenAnchor.column;\n var startOffsetX = screenCursor.offsetX;\n var endOffsetX = screenAnchor.offsetX;\n } else {\n var startColumn = screenAnchor.column;\n var endColumn = screenCursor.column;\n var startOffsetX = screenAnchor.offsetX;\n var endOffsetX = screenCursor.offsetX;\n }\n\n var yBackwards = screenCursor.row < screenAnchor.row;\n if (yBackwards) {\n var startRow = screenCursor.row;\n var endRow = screenAnchor.row;\n } else {\n var startRow = screenAnchor.row;\n var endRow = screenCursor.row;\n }\n\n if (startColumn < 0)\n startColumn = 0;\n if (startRow < 0)\n startRow = 0;\n\n if (startRow == endRow)\n includeEmptyLines = true;\n\n var docEnd;\n for (var row = startRow; row <= endRow; row++) {\n var range = Range.fromPoints(\n this.session.screenToDocumentPosition(row, startColumn, startOffsetX),\n this.session.screenToDocumentPosition(row, endColumn, endOffsetX)\n );\n if (range.isEmpty()) {\n if (docEnd && isSamePoint(range.end, docEnd))\n break;\n docEnd = range.end;\n }\n range.cursor = xBackwards ? range.start : range.end;\n rectSel.push(range);\n }\n\n if (yBackwards)\n rectSel.reverse();\n\n if (!includeEmptyLines) {\n var end = rectSel.length - 1;\n while (rectSel[end].isEmpty() && end > 0)\n end--;\n if (end > 0) {\n var start = 0;\n while (rectSel[start].isEmpty())\n start++;\n }\n for (var i = end; i >= start; i--) {\n if (rectSel[i].isEmpty())\n rectSel.splice(i, 1);\n }\n }\n\n return rectSel;\n };\n}).call(Selection.prototype);\nvar Editor = require(\"./editor\").Editor;\n(function() {\n this.updateSelectionMarkers = function() {\n this.renderer.updateCursor();\n this.renderer.updateBackMarkers();\n };\n this.addSelectionMarker = function(orientedRange) {\n if (!orientedRange.cursor)\n orientedRange.cursor = orientedRange.end;\n\n var style = this.getSelectionStyle();\n orientedRange.marker = this.session.addMarker(orientedRange, \"ace_selection\", style);\n\n this.session.$selectionMarkers.push(orientedRange);\n this.session.selectionMarkerCount = this.session.$selectionMarkers.length;\n return orientedRange;\n };\n this.removeSelectionMarker = function(range) {\n if (!range.marker)\n return;\n this.session.removeMarker(range.marker);\n var index = this.session.$selectionMarkers.indexOf(range);\n if (index != -1)\n this.session.$selectionMarkers.splice(index, 1);\n this.session.selectionMarkerCount = this.session.$selectionMarkers.length;\n };\n\n this.removeSelectionMarkers = function(ranges) {\n var markerList = this.session.$selectionMarkers;\n for (var i = ranges.length; i--; ) {\n var range = ranges[i];\n if (!range.marker)\n continue;\n this.session.removeMarker(range.marker);\n var index = markerList.indexOf(range);\n if (index != -1)\n markerList.splice(index, 1);\n }\n this.session.selectionMarkerCount = markerList.length;\n };\n\n this.$onAddRange = function(e) {\n this.addSelectionMarker(e.range);\n this.renderer.updateCursor();\n this.renderer.updateBackMarkers();\n };\n\n this.$onRemoveRange = function(e) {\n this.removeSelectionMarkers(e.ranges);\n this.renderer.updateCursor();\n this.renderer.updateBackMarkers();\n };\n\n this.$onMultiSelect = function(e) {\n if (this.inMultiSelectMode)\n return;\n this.inMultiSelectMode = true;\n\n this.setStyle(\"ace_multiselect\");\n this.keyBinding.addKeyboardHandler(commands.keyboardHandler);\n this.commands.setDefaultHandler(\"exec\", this.$onMultiSelectExec);\n\n this.renderer.updateCursor();\n this.renderer.updateBackMarkers();\n };\n\n this.$onSingleSelect = function(e) {\n if (this.session.multiSelect.inVirtualMode)\n return;\n this.inMultiSelectMode = false;\n\n this.unsetStyle(\"ace_multiselect\");\n this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);\n\n this.commands.removeDefaultHandler(\"exec\", this.$onMultiSelectExec);\n this.renderer.updateCursor();\n this.renderer.updateBackMarkers();\n this._emit(\"changeSelection\");\n };\n\n this.$onMultiSelectExec = function(e) {\n var command = e.command;\n var editor = e.editor;\n if (!editor.multiSelect)\n return;\n if (!command.multiSelectAction) {\n var result = command.exec(editor, e.args || {});\n editor.multiSelect.addRange(editor.multiSelect.toOrientedRange());\n editor.multiSelect.mergeOverlappingRanges();\n } else if (command.multiSelectAction == \"forEach\") {\n result = editor.forEachSelection(command, e.args);\n } else if (command.multiSelectAction == \"forEachLine\") {\n result = editor.forEachSelection(command, e.args, true);\n } else if (command.multiSelectAction == \"single\") {\n editor.exitMultiSelectMode();\n result = command.exec(editor, e.args || {});\n } else {\n result = command.multiSelectAction(editor, e.args || {});\n }\n return result;\n }; \n this.forEachSelection = function(cmd, args, options) {\n if (this.inVirtualSelectionMode)\n return;\n var keepOrder = options && options.keepOrder;\n var $byLines = options == true || options && options.$byLines;\n var session = this.session;\n var selection = this.selection;\n var rangeList = selection.rangeList;\n var ranges = (keepOrder ? selection : rangeList).ranges;\n var result;\n \n if (!ranges.length)\n return cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});\n \n var reg = selection._eventRegistry;\n selection._eventRegistry = {};\n\n var tmpSel = new Selection(session);\n this.inVirtualSelectionMode = true;\n for (var i = ranges.length; i--;) {\n if ($byLines) {\n while (i > 0 && ranges[i].start.row == ranges[i - 1].end.row)\n i--;\n }\n tmpSel.fromOrientedRange(ranges[i]);\n tmpSel.index = i;\n this.selection = session.selection = tmpSel;\n var cmdResult = cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});\n if (!result && cmdResult !== undefined)\n result = cmdResult;\n tmpSel.toOrientedRange(ranges[i]);\n }\n tmpSel.detach();\n\n this.selection = session.selection = selection;\n this.inVirtualSelectionMode = false;\n selection._eventRegistry = reg;\n selection.mergeOverlappingRanges();\n if (selection.ranges[0])\n selection.fromOrientedRange(selection.ranges[0]);\n \n var anim = this.renderer.$scrollAnimation;\n this.onCursorChange();\n this.onSelectionChange();\n if (anim && anim.from == anim.to)\n this.renderer.animateScrolling(anim.from);\n \n return result;\n };\n this.exitMultiSelectMode = function() {\n if (!this.inMultiSelectMode || this.inVirtualSelectionMode)\n return;\n this.multiSelect.toSingleRange();\n };\n\n this.getSelectedText = function() {\n var text = \"\";\n if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {\n var ranges = this.multiSelect.rangeList.ranges;\n var buf = [];\n for (var i = 0; i < ranges.length; i++) {\n buf.push(this.session.getTextRange(ranges[i]));\n }\n var nl = this.session.getDocument().getNewLineCharacter();\n text = buf.join(nl);\n if (text.length == (buf.length - 1) * nl.length)\n text = \"\";\n } else if (!this.selection.isEmpty()) {\n text = this.session.getTextRange(this.getSelectionRange());\n }\n return text;\n };\n \n this.$checkMultiselectChange = function(e, anchor) {\n if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {\n var range = this.multiSelect.ranges[0];\n if (this.multiSelect.isEmpty() && anchor == this.multiSelect.anchor)\n return;\n var pos = anchor == this.multiSelect.anchor\n ? range.cursor == range.start ? range.end : range.start\n : range.cursor;\n if (pos.row != anchor.row \n || this.session.$clipPositionToDocument(pos.row, pos.column).column != anchor.column)\n this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange());\n else\n this.multiSelect.mergeOverlappingRanges();\n }\n };\n this.findAll = function(needle, options, additive) {\n options = options || {};\n options.needle = needle || options.needle;\n if (options.needle == undefined) {\n var range = this.selection.isEmpty()\n ? this.selection.getWordRange()\n : this.selection.getRange();\n options.needle = this.session.getTextRange(range);\n } \n this.$search.set(options);\n \n var ranges = this.$search.findAll(this.session);\n if (!ranges.length)\n return 0;\n\n var selection = this.multiSelect;\n\n if (!additive)\n selection.toSingleRange(ranges[0]);\n\n for (var i = ranges.length; i--; )\n selection.addRange(ranges[i], true);\n if (range && selection.rangeList.rangeAtPoint(range.start))\n selection.addRange(range, true);\n \n return ranges.length;\n };\n this.selectMoreLines = function(dir, skip) {\n var range = this.selection.toOrientedRange();\n var isBackwards = range.cursor == range.end;\n\n var screenLead = this.session.documentToScreenPosition(range.cursor);\n if (this.selection.$desiredColumn)\n screenLead.column = this.selection.$desiredColumn;\n\n var lead = this.session.screenToDocumentPosition(screenLead.row + dir, screenLead.column);\n\n if (!range.isEmpty()) {\n var screenAnchor = this.session.documentToScreenPosition(isBackwards ? range.end : range.start);\n var anchor = this.session.screenToDocumentPosition(screenAnchor.row + dir, screenAnchor.column);\n } else {\n var anchor = lead;\n }\n\n if (isBackwards) {\n var newRange = Range.fromPoints(lead, anchor);\n newRange.cursor = newRange.start;\n } else {\n var newRange = Range.fromPoints(anchor, lead);\n newRange.cursor = newRange.end;\n }\n\n newRange.desiredColumn = screenLead.column;\n if (!this.selection.inMultiSelectMode) {\n this.selection.addRange(range);\n } else {\n if (skip)\n var toRemove = range.cursor;\n }\n\n this.selection.addRange(newRange);\n if (toRemove)\n this.selection.substractPoint(toRemove);\n };\n this.transposeSelections = function(dir) {\n var session = this.session;\n var sel = session.multiSelect;\n var all = sel.ranges;\n\n for (var i = all.length; i--; ) {\n var range = all[i];\n if (range.isEmpty()) {\n var tmp = session.getWordRange(range.start.row, range.start.column);\n range.start.row = tmp.start.row;\n range.start.column = tmp.start.column;\n range.end.row = tmp.end.row;\n range.end.column = tmp.end.column;\n }\n }\n sel.mergeOverlappingRanges();\n\n var words = [];\n for (var i = all.length; i--; ) {\n var range = all[i];\n words.unshift(session.getTextRange(range));\n }\n\n if (dir < 0)\n words.unshift(words.pop());\n else\n words.push(words.shift());\n\n for (var i = all.length; i--; ) {\n var range = all[i];\n var tmp = range.clone();\n session.replace(range, words[i]);\n range.start.row = tmp.start.row;\n range.start.column = tmp.start.column;\n }\n sel.fromOrientedRange(sel.ranges[0]);\n };\n this.selectMore = function(dir, skip, stopAtFirst) {\n var session = this.session;\n var sel = session.multiSelect;\n\n var range = sel.toOrientedRange();\n if (range.isEmpty()) {\n range = session.getWordRange(range.start.row, range.start.column);\n range.cursor = dir == -1 ? range.start : range.end;\n this.multiSelect.addRange(range);\n if (stopAtFirst)\n return;\n }\n var needle = session.getTextRange(range);\n\n var newRange = find(session, needle, dir);\n if (newRange) {\n newRange.cursor = dir == -1 ? newRange.start : newRange.end;\n this.session.unfold(newRange);\n this.multiSelect.addRange(newRange);\n this.renderer.scrollCursorIntoView(null, 0.5);\n }\n if (skip)\n this.multiSelect.substractPoint(range.cursor);\n };\n this.alignCursors = function() {\n var session = this.session;\n var sel = session.multiSelect;\n var ranges = sel.ranges;\n var row = -1;\n var sameRowRanges = ranges.filter(function(r) {\n if (r.cursor.row == row)\n return true;\n row = r.cursor.row;\n });\n \n if (!ranges.length || sameRowRanges.length == ranges.length - 1) {\n var range = this.selection.getRange();\n var fr = range.start.row, lr = range.end.row;\n var guessRange = fr == lr;\n if (guessRange) {\n var max = this.session.getLength();\n var line;\n do {\n line = this.session.getLine(lr);\n } while (/[=:]/.test(line) && ++lr < max);\n do {\n line = this.session.getLine(fr);\n } while (/[=:]/.test(line) && --fr > 0);\n \n if (fr < 0) fr = 0;\n if (lr >= max) lr = max - 1;\n }\n var lines = this.session.removeFullLines(fr, lr);\n lines = this.$reAlignText(lines, guessRange);\n this.session.insert({row: fr, column: 0}, lines.join(\"\\n\") + \"\\n\");\n if (!guessRange) {\n range.start.column = 0;\n range.end.column = lines[lines.length - 1].length;\n }\n this.selection.setRange(range);\n } else {\n sameRowRanges.forEach(function(r) {\n sel.substractPoint(r.cursor);\n });\n\n var maxCol = 0;\n var minSpace = Infinity;\n var spaceOffsets = ranges.map(function(r) {\n var p = r.cursor;\n var line = session.getLine(p.row);\n var spaceOffset = line.substr(p.column).search(/\\S/g);\n if (spaceOffset == -1)\n spaceOffset = 0;\n\n if (p.column > maxCol)\n maxCol = p.column;\n if (spaceOffset < minSpace)\n minSpace = spaceOffset;\n return spaceOffset;\n });\n ranges.forEach(function(r, i) {\n var p = r.cursor;\n var l = maxCol - p.column;\n var d = spaceOffsets[i] - minSpace;\n if (l > d)\n session.insert(p, lang.stringRepeat(\" \", l - d));\n else\n session.remove(new Range(p.row, p.column, p.row, p.column - l + d));\n\n r.start.column = r.end.column = maxCol;\n r.start.row = r.end.row = p.row;\n r.cursor = r.end;\n });\n sel.fromOrientedRange(ranges[0]);\n this.renderer.updateCursor();\n this.renderer.updateBackMarkers();\n }\n };\n\n this.$reAlignText = function(lines, forceLeft) {\n var isLeftAligned = true, isRightAligned = true;\n var startW, textW, endW;\n\n return lines.map(function(line) {\n var m = line.match(/(\\s*)(.*?)(\\s*)([=:].*)/);\n if (!m)\n return [line];\n\n if (startW == null) {\n startW = m[1].length;\n textW = m[2].length;\n endW = m[3].length;\n return m;\n }\n\n if (startW + textW + endW != m[1].length + m[2].length + m[3].length)\n isRightAligned = false;\n if (startW != m[1].length)\n isLeftAligned = false;\n\n if (startW > m[1].length)\n startW = m[1].length;\n if (textW < m[2].length)\n textW = m[2].length;\n if (endW > m[3].length)\n endW = m[3].length;\n\n return m;\n }).map(forceLeft ? alignLeft :\n isLeftAligned ? isRightAligned ? alignRight : alignLeft : unAlign);\n\n function spaces(n) {\n return lang.stringRepeat(\" \", n);\n }\n\n function alignLeft(m) {\n return !m[2] ? m[0] : spaces(startW) + m[2]\n + spaces(textW - m[2].length + endW)\n + m[4].replace(/^([=:])\\s+/, \"$1 \");\n }\n function alignRight(m) {\n return !m[2] ? m[0] : spaces(startW + textW - m[2].length) + m[2]\n + spaces(endW)\n + m[4].replace(/^([=:])\\s+/, \"$1 \");\n }\n function unAlign(m) {\n return !m[2] ? m[0] : spaces(startW) + m[2]\n + spaces(endW)\n + m[4].replace(/^([=:])\\s+/, \"$1 \");\n }\n };\n}).call(Editor.prototype);\n\n\nfunction isSamePoint(p1, p2) {\n return p1.row == p2.row && p1.column == p2.column;\n}\nexports.onSessionChange = function(e) {\n var session = e.session;\n if (session && !session.multiSelect) {\n session.$selectionMarkers = [];\n session.selection.$initRangeList();\n session.multiSelect = session.selection;\n }\n this.multiSelect = session && session.multiSelect;\n\n var oldSession = e.oldSession;\n if (oldSession) {\n oldSession.multiSelect.off(\"addRange\", this.$onAddRange);\n oldSession.multiSelect.off(\"removeRange\", this.$onRemoveRange);\n oldSession.multiSelect.off(\"multiSelect\", this.$onMultiSelect);\n oldSession.multiSelect.off(\"singleSelect\", this.$onSingleSelect);\n oldSession.multiSelect.lead.off(\"change\", this.$checkMultiselectChange);\n oldSession.multiSelect.anchor.off(\"change\", this.$checkMultiselectChange);\n }\n\n if (session) {\n session.multiSelect.on(\"addRange\", this.$onAddRange);\n session.multiSelect.on(\"removeRange\", this.$onRemoveRange);\n session.multiSelect.on(\"multiSelect\", this.$onMultiSelect);\n session.multiSelect.on(\"singleSelect\", this.$onSingleSelect);\n session.multiSelect.lead.on(\"change\", this.$checkMultiselectChange);\n session.multiSelect.anchor.on(\"change\", this.$checkMultiselectChange);\n }\n\n if (session && this.inMultiSelectMode != session.selection.inMultiSelectMode) {\n if (session.selection.inMultiSelectMode)\n this.$onMultiSelect();\n else\n this.$onSingleSelect();\n }\n};\nfunction MultiSelect(editor) {\n if (editor.$multiselectOnSessionChange)\n return;\n editor.$onAddRange = editor.$onAddRange.bind(editor);\n editor.$onRemoveRange = editor.$onRemoveRange.bind(editor);\n editor.$onMultiSelect = editor.$onMultiSelect.bind(editor);\n editor.$onSingleSelect = editor.$onSingleSelect.bind(editor);\n editor.$multiselectOnSessionChange = exports.onSessionChange.bind(editor);\n editor.$checkMultiselectChange = editor.$checkMultiselectChange.bind(editor);\n\n editor.$multiselectOnSessionChange(editor);\n editor.on(\"changeSession\", editor.$multiselectOnSessionChange);\n\n editor.on(\"mousedown\", onMouseDown);\n editor.commands.addCommands(commands.defaultCommands);\n\n addAltCursorListeners(editor);\n}\n\nfunction addAltCursorListeners(editor){\n if (!editor.textInput) return;\n var el = editor.textInput.getElement();\n var altCursor = false;\n event.addListener(el, \"keydown\", function(e) {\n var altDown = e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey);\n if (editor.$blockSelectEnabled && altDown) {\n if (!altCursor) {\n editor.renderer.setMouseCursor(\"crosshair\");\n altCursor = true;\n }\n } else if (altCursor) {\n reset();\n }\n }, editor);\n\n event.addListener(el, \"keyup\", reset, editor);\n event.addListener(el, \"blur\", reset, editor);\n function reset(e) {\n if (altCursor) {\n editor.renderer.setMouseCursor(\"\");\n altCursor = false;\n }\n }\n}\n\nexports.MultiSelect = MultiSelect;\n\n\nrequire(\"./config\").defineOptions(Editor.prototype, \"editor\", {\n enableMultiselect: {\n set: function(val) {\n MultiSelect(this);\n if (val) {\n this.on(\"changeSession\", this.$multiselectOnSessionChange);\n this.on(\"mousedown\", onMouseDown);\n } else {\n this.off(\"changeSession\", this.$multiselectOnSessionChange);\n this.off(\"mousedown\", onMouseDown);\n }\n },\n value: true\n },\n enableBlockSelect: {\n set: function(val) {\n this.$blockSelectEnabled = val;\n },\n value: true\n }\n});\n\n\n\n});\n\nace.define(\"ace/mode/folding/fold_mode\",[\"require\",\"exports\",\"module\",\"ace/range\"], function(require, exports, module) {\n\nvar Range = require(\"../../range\").Range;\n\nvar FoldMode = exports.FoldMode = function() {};\n\n(function() {\n\n this.foldingStartMarker = null;\n this.foldingStopMarker = null;\n this.getFoldWidget = function(session, foldStyle, row) {\n var line = session.getLine(row);\n if (this.foldingStartMarker.test(line))\n return \"start\";\n if (foldStyle == \"markbeginend\"\n && this.foldingStopMarker\n && this.foldingStopMarker.test(line))\n return \"end\";\n return \"\";\n };\n\n this.getFoldWidgetRange = function(session, foldStyle, row) {\n return null;\n };\n\n this.indentationBlock = function(session, row, column) {\n var re = /\\S/;\n var line = session.getLine(row);\n var startLevel = line.search(re);\n if (startLevel == -1)\n return;\n\n var startColumn = column || line.length;\n var maxRow = session.getLength();\n var startRow = row;\n var endRow = row;\n\n while (++row < maxRow) {\n var level = session.getLine(row).search(re);\n\n if (level == -1)\n continue;\n\n if (level <= startLevel) {\n var token = session.getTokenAt(row, 0);\n if (!token || token.type !== \"string\")\n break;\n }\n\n endRow = row;\n }\n\n if (endRow > startRow) {\n var endColumn = session.getLine(endRow).length;\n return new Range(startRow, startColumn, endRow, endColumn);\n }\n };\n\n this.openingBracketBlock = function(session, bracket, row, column, typeRe) {\n var start = {row: row, column: column + 1};\n var end = session.$findClosingBracket(bracket, start, typeRe);\n if (!end)\n return;\n\n var fw = session.foldWidgets[end.row];\n if (fw == null)\n fw = session.getFoldWidget(end.row);\n\n if (fw == \"start\" && end.row > start.row) {\n end.row --;\n end.column = session.getLine(end.row).length;\n }\n return Range.fromPoints(start, end);\n };\n\n this.closingBracketBlock = function(session, bracket, row, column, typeRe) {\n var end = {row: row, column: column};\n var start = session.$findOpeningBracket(bracket, end);\n\n if (!start)\n return;\n\n start.column++;\n end.column--;\n\n return Range.fromPoints(start, end);\n };\n}).call(FoldMode.prototype);\n\n});\n\nace.define(\"ace/theme/textmate\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(require, exports, module) {\n\nexports.isDark = false;\nexports.cssClass = \"ace-tm\";\nexports.cssText = \".ace-tm .ace_gutter {\\\nbackground: #f0f0f0;\\\ncolor: #333;\\\n}\\\n.ace-tm .ace_print-margin {\\\nwidth: 1px;\\\nbackground: #e8e8e8;\\\n}\\\n.ace-tm .ace_fold {\\\nbackground-color: #6B72E6;\\\n}\\\n.ace-tm {\\\nbackground-color: #FFFFFF;\\\ncolor: black;\\\n}\\\n.ace-tm .ace_cursor {\\\ncolor: black;\\\n}\\\n.ace-tm .ace_invisible {\\\ncolor: rgb(191, 191, 191);\\\n}\\\n.ace-tm .ace_storage,\\\n.ace-tm .ace_keyword {\\\ncolor: blue;\\\n}\\\n.ace-tm .ace_constant {\\\ncolor: rgb(197, 6, 11);\\\n}\\\n.ace-tm .ace_constant.ace_buildin {\\\ncolor: rgb(88, 72, 246);\\\n}\\\n.ace-tm .ace_constant.ace_language {\\\ncolor: rgb(88, 92, 246);\\\n}\\\n.ace-tm .ace_constant.ace_library {\\\ncolor: rgb(6, 150, 14);\\\n}\\\n.ace-tm .ace_invalid {\\\nbackground-color: rgba(255, 0, 0, 0.1);\\\ncolor: red;\\\n}\\\n.ace-tm .ace_support.ace_function {\\\ncolor: rgb(60, 76, 114);\\\n}\\\n.ace-tm .ace_support.ace_constant {\\\ncolor: rgb(6, 150, 14);\\\n}\\\n.ace-tm .ace_support.ace_type,\\\n.ace-tm .ace_support.ace_class {\\\ncolor: rgb(109, 121, 222);\\\n}\\\n.ace-tm .ace_keyword.ace_operator {\\\ncolor: rgb(104, 118, 135);\\\n}\\\n.ace-tm .ace_string {\\\ncolor: rgb(3, 106, 7);\\\n}\\\n.ace-tm .ace_comment {\\\ncolor: rgb(76, 136, 107);\\\n}\\\n.ace-tm .ace_comment.ace_doc {\\\ncolor: rgb(0, 102, 255);\\\n}\\\n.ace-tm .ace_comment.ace_doc.ace_tag {\\\ncolor: rgb(128, 159, 191);\\\n}\\\n.ace-tm .ace_constant.ace_numeric {\\\ncolor: rgb(0, 0, 205);\\\n}\\\n.ace-tm .ace_variable {\\\ncolor: rgb(49, 132, 149);\\\n}\\\n.ace-tm .ace_xml-pe {\\\ncolor: rgb(104, 104, 91);\\\n}\\\n.ace-tm .ace_entity.ace_name.ace_function {\\\ncolor: #0000A2;\\\n}\\\n.ace-tm .ace_heading {\\\ncolor: rgb(12, 7, 255);\\\n}\\\n.ace-tm .ace_list {\\\ncolor:rgb(185, 6, 144);\\\n}\\\n.ace-tm .ace_meta.ace_tag {\\\ncolor:rgb(0, 22, 142);\\\n}\\\n.ace-tm .ace_string.ace_regex {\\\ncolor: rgb(255, 0, 0)\\\n}\\\n.ace-tm .ace_marker-layer .ace_selection {\\\nbackground: rgb(181, 213, 255);\\\n}\\\n.ace-tm.ace_multiselect .ace_selection.ace_start {\\\nbox-shadow: 0 0 3px 0px white;\\\n}\\\n.ace-tm .ace_marker-layer .ace_step {\\\nbackground: rgb(252, 255, 0);\\\n}\\\n.ace-tm .ace_marker-layer .ace_stack {\\\nbackground: rgb(164, 229, 101);\\\n}\\\n.ace-tm .ace_marker-layer .ace_bracket {\\\nmargin: -1px 0 0 -1px;\\\nborder: 1px solid rgb(192, 192, 192);\\\n}\\\n.ace-tm .ace_marker-layer .ace_active-line {\\\nbackground: rgba(0, 0, 0, 0.07);\\\n}\\\n.ace-tm .ace_gutter-active-line {\\\nbackground-color : #dcdcdc;\\\n}\\\n.ace-tm .ace_marker-layer .ace_selected-word {\\\nbackground: rgb(250, 250, 255);\\\nborder: 1px solid rgb(200, 200, 250);\\\n}\\\n.ace-tm .ace_indent-guide {\\\nbackground: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\\\") right repeat-y;\\\n}\\\n\";\nexports.$id = \"ace/theme/textmate\";\n\nvar dom = require(\"../lib/dom\");\ndom.importCssString(exports.cssText, exports.cssClass);\n});\n\nace.define(\"ace/line_widgets\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"], function(require, exports, module) {\n\nvar dom = require(\"./lib/dom\");\n\nfunction LineWidgets(session) {\n this.session = session;\n this.session.widgetManager = this;\n this.session.getRowLength = this.getRowLength;\n this.session.$getWidgetScreenLength = this.$getWidgetScreenLength;\n this.updateOnChange = this.updateOnChange.bind(this);\n this.renderWidgets = this.renderWidgets.bind(this);\n this.measureWidgets = this.measureWidgets.bind(this);\n this.session._changedWidgets = [];\n this.$onChangeEditor = this.$onChangeEditor.bind(this);\n \n this.session.on(\"change\", this.updateOnChange);\n this.session.on(\"changeFold\", this.updateOnFold);\n this.session.on(\"changeEditor\", this.$onChangeEditor);\n}\n\n(function() {\n this.getRowLength = function(row) {\n var h;\n if (this.lineWidgets)\n h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;\n else \n h = 0;\n if (!this.$useWrapMode || !this.$wrapData[row]) {\n return 1 + h;\n } else {\n return this.$wrapData[row].length + 1 + h;\n }\n };\n\n this.$getWidgetScreenLength = function() {\n var screenRows = 0;\n this.lineWidgets.forEach(function(w){\n if (w && w.rowCount && !w.hidden)\n screenRows += w.rowCount;\n });\n return screenRows;\n }; \n \n this.$onChangeEditor = function(e) {\n this.attach(e.editor);\n };\n \n this.attach = function(editor) {\n if (editor && editor.widgetManager && editor.widgetManager != this)\n editor.widgetManager.detach();\n\n if (this.editor == editor)\n return;\n\n this.detach();\n this.editor = editor;\n \n if (editor) {\n editor.widgetManager = this;\n editor.renderer.on(\"beforeRender\", this.measureWidgets);\n editor.renderer.on(\"afterRender\", this.renderWidgets);\n }\n };\n this.detach = function(e) {\n var editor = this.editor;\n if (!editor)\n return;\n \n this.editor = null;\n editor.widgetManager = null;\n \n editor.renderer.off(\"beforeRender\", this.measureWidgets);\n editor.renderer.off(\"afterRender\", this.renderWidgets);\n var lineWidgets = this.session.lineWidgets;\n lineWidgets && lineWidgets.forEach(function(w) {\n if (w && w.el && w.el.parentNode) {\n w._inDocument = false;\n w.el.parentNode.removeChild(w.el);\n }\n });\n };\n\n this.updateOnFold = function(e, session) {\n var lineWidgets = session.lineWidgets;\n if (!lineWidgets || !e.action)\n return;\n var fold = e.data;\n var start = fold.start.row;\n var end = fold.end.row;\n var hide = e.action == \"add\";\n for (var i = start + 1; i < end; i++) {\n if (lineWidgets[i])\n lineWidgets[i].hidden = hide;\n }\n if (lineWidgets[end]) {\n if (hide) {\n if (!lineWidgets[start])\n lineWidgets[start] = lineWidgets[end];\n else\n lineWidgets[end].hidden = hide;\n } else {\n if (lineWidgets[start] == lineWidgets[end])\n lineWidgets[start] = undefined;\n lineWidgets[end].hidden = hide;\n }\n }\n };\n \n this.updateOnChange = function(delta) {\n var lineWidgets = this.session.lineWidgets;\n if (!lineWidgets) return;\n \n var startRow = delta.start.row;\n var len = delta.end.row - startRow;\n\n if (len === 0) ; else if (delta.action == \"remove\") {\n var removed = lineWidgets.splice(startRow + 1, len);\n if (!lineWidgets[startRow] && removed[removed.length - 1]) {\n lineWidgets[startRow] = removed.pop();\n }\n removed.forEach(function(w) {\n w && this.removeLineWidget(w);\n }, this);\n this.$updateRows();\n } else {\n var args = new Array(len);\n if (lineWidgets[startRow] && lineWidgets[startRow].column != null) {\n if (delta.start.column > lineWidgets[startRow].column)\n startRow++;\n }\n args.unshift(startRow, 0);\n lineWidgets.splice.apply(lineWidgets, args);\n this.$updateRows();\n }\n };\n \n this.$updateRows = function() {\n var lineWidgets = this.session.lineWidgets;\n if (!lineWidgets) return;\n var noWidgets = true;\n lineWidgets.forEach(function(w, i) {\n if (w) {\n noWidgets = false;\n w.row = i;\n while (w.$oldWidget) {\n w.$oldWidget.row = i;\n w = w.$oldWidget;\n }\n }\n });\n if (noWidgets)\n this.session.lineWidgets = null;\n };\n\n this.$registerLineWidget = function(w) {\n if (!this.session.lineWidgets)\n this.session.lineWidgets = new Array(this.session.getLength());\n \n var old = this.session.lineWidgets[w.row];\n if (old) {\n w.$oldWidget = old;\n if (old.el && old.el.parentNode) {\n old.el.parentNode.removeChild(old.el);\n old._inDocument = false;\n }\n }\n \n this.session.lineWidgets[w.row] = w;\n return w;\n };\n \n this.addLineWidget = function(w) {\n this.$registerLineWidget(w);\n w.session = this.session;\n \n if (!this.editor) return w;\n \n var renderer = this.editor.renderer;\n if (w.html && !w.el) {\n w.el = dom.createElement(\"div\");\n w.el.innerHTML = w.html;\n }\n if (w.el) {\n dom.addCssClass(w.el, \"ace_lineWidgetContainer\");\n w.el.style.position = \"absolute\";\n w.el.style.zIndex = 5;\n renderer.container.appendChild(w.el);\n w._inDocument = true;\n \n if (!w.coverGutter) {\n w.el.style.zIndex = 3;\n }\n if (w.pixelHeight == null) {\n w.pixelHeight = w.el.offsetHeight;\n }\n }\n if (w.rowCount == null) {\n w.rowCount = w.pixelHeight / renderer.layerConfig.lineHeight;\n }\n \n var fold = this.session.getFoldAt(w.row, 0);\n w.$fold = fold;\n if (fold) {\n var lineWidgets = this.session.lineWidgets;\n if (w.row == fold.end.row && !lineWidgets[fold.start.row])\n lineWidgets[fold.start.row] = w;\n else\n w.hidden = true;\n }\n \n this.session._emit(\"changeFold\", {data:{start:{row: w.row}}});\n \n this.$updateRows();\n this.renderWidgets(null, renderer);\n this.onWidgetChanged(w);\n return w;\n };\n \n this.removeLineWidget = function(w) {\n w._inDocument = false;\n w.session = null;\n if (w.el && w.el.parentNode)\n w.el.parentNode.removeChild(w.el);\n if (w.editor && w.editor.destroy) try {\n w.editor.destroy();\n } catch(e){}\n if (this.session.lineWidgets) {\n var w1 = this.session.lineWidgets[w.row];\n if (w1 == w) {\n this.session.lineWidgets[w.row] = w.$oldWidget;\n if (w.$oldWidget)\n this.onWidgetChanged(w.$oldWidget);\n } else {\n while (w1) {\n if (w1.$oldWidget == w) {\n w1.$oldWidget = w.$oldWidget;\n break;\n }\n w1 = w1.$oldWidget;\n }\n }\n }\n this.session._emit(\"changeFold\", {data:{start:{row: w.row}}});\n this.$updateRows();\n };\n \n this.getWidgetsAtRow = function(row) {\n var lineWidgets = this.session.lineWidgets;\n var w = lineWidgets && lineWidgets[row];\n var list = [];\n while (w) {\n list.push(w);\n w = w.$oldWidget;\n }\n return list;\n };\n \n this.onWidgetChanged = function(w) {\n this.session._changedWidgets.push(w);\n this.editor && this.editor.renderer.updateFull();\n };\n \n this.measureWidgets = function(e, renderer) {\n var changedWidgets = this.session._changedWidgets;\n var config = renderer.layerConfig;\n \n if (!changedWidgets || !changedWidgets.length) return;\n var min = Infinity;\n for (var i = 0; i < changedWidgets.length; i++) {\n var w = changedWidgets[i];\n if (!w || !w.el) continue;\n if (w.session != this.session) continue;\n if (!w._inDocument) {\n if (this.session.lineWidgets[w.row] != w)\n continue;\n w._inDocument = true;\n renderer.container.appendChild(w.el);\n }\n \n w.h = w.el.offsetHeight;\n \n if (!w.fixedWidth) {\n w.w = w.el.offsetWidth;\n w.screenWidth = Math.ceil(w.w / config.characterWidth);\n }\n \n var rowCount = w.h / config.lineHeight;\n if (w.coverLine) {\n rowCount -= this.session.getRowLineCount(w.row);\n if (rowCount < 0)\n rowCount = 0;\n }\n if (w.rowCount != rowCount) {\n w.rowCount = rowCount;\n if (w.row < min)\n min = w.row;\n }\n }\n if (min != Infinity) {\n this.session._emit(\"changeFold\", {data:{start:{row: min}}});\n this.session.lineWidgetWidth = null;\n }\n this.session._changedWidgets = [];\n };\n \n this.renderWidgets = function(e, renderer) {\n var config = renderer.layerConfig;\n var lineWidgets = this.session.lineWidgets;\n if (!lineWidgets)\n return;\n var first = Math.min(this.firstRow, config.firstRow);\n var last = Math.max(this.lastRow, config.lastRow, lineWidgets.length);\n \n while (first > 0 && !lineWidgets[first])\n first--;\n \n this.firstRow = config.firstRow;\n this.lastRow = config.lastRow;\n\n renderer.$cursorLayer.config = config;\n for (var i = first; i <= last; i++) {\n var w = lineWidgets[i];\n if (!w || !w.el) continue;\n if (w.hidden) {\n w.el.style.top = -100 - (w.pixelHeight || 0) + \"px\";\n continue;\n }\n if (!w._inDocument) {\n w._inDocument = true;\n renderer.container.appendChild(w.el);\n }\n var top = renderer.$cursorLayer.getPixelPosition({row: i, column:0}, true).top;\n if (!w.coverLine)\n top += config.lineHeight * this.session.getRowLineCount(w.row);\n w.el.style.top = top - config.offset + \"px\";\n \n var left = w.coverGutter ? 0 : renderer.gutterWidth;\n if (!w.fixedWidth)\n left -= renderer.scrollLeft;\n w.el.style.left = left + \"px\";\n \n if (w.fullWidth && w.screenWidth) {\n w.el.style.minWidth = config.width + 2 * config.padding + \"px\";\n }\n \n if (w.fixedWidth) {\n w.el.style.right = renderer.scrollBar.getWidth() + \"px\";\n } else {\n w.el.style.right = \"\";\n }\n }\n };\n \n}).call(LineWidgets.prototype);\n\n\nexports.LineWidgets = LineWidgets;\n\n});\n\nace.define(\"ace/ext/error_marker\",[\"require\",\"exports\",\"module\",\"ace/line_widgets\",\"ace/lib/dom\",\"ace/range\"], function(require, exports, module) {\nvar LineWidgets = require(\"../line_widgets\").LineWidgets;\nvar dom = require(\"../lib/dom\");\nvar Range = require(\"../range\").Range;\n\nfunction binarySearch(array, needle, comparator) {\n var first = 0;\n var last = array.length - 1;\n\n while (first <= last) {\n var mid = (first + last) >> 1;\n var c = comparator(needle, array[mid]);\n if (c > 0)\n first = mid + 1;\n else if (c < 0)\n last = mid - 1;\n else\n return mid;\n }\n return -(first + 1);\n}\n\nfunction findAnnotations(session, row, dir) {\n var annotations = session.getAnnotations().sort(Range.comparePoints);\n if (!annotations.length)\n return;\n \n var i = binarySearch(annotations, {row: row, column: -1}, Range.comparePoints);\n if (i < 0)\n i = -i - 1;\n \n if (i >= annotations.length)\n i = dir > 0 ? 0 : annotations.length - 1;\n else if (i === 0 && dir < 0)\n i = annotations.length - 1;\n \n var annotation = annotations[i];\n if (!annotation || !dir)\n return;\n\n if (annotation.row === row) {\n do {\n annotation = annotations[i += dir];\n } while (annotation && annotation.row === row);\n if (!annotation)\n return annotations.slice();\n }\n \n \n var matched = [];\n row = annotation.row;\n do {\n matched[dir < 0 ? \"unshift\" : \"push\"](annotation);\n annotation = annotations[i += dir];\n } while (annotation && annotation.row == row);\n return matched.length && matched;\n}\n\nexports.showErrorMarker = function(editor, dir) {\n var session = editor.session;\n if (!session.widgetManager) {\n session.widgetManager = new LineWidgets(session);\n session.widgetManager.attach(editor);\n }\n \n var pos = editor.getCursorPosition();\n var row = pos.row;\n var oldWidget = session.widgetManager.getWidgetsAtRow(row).filter(function(w) {\n return w.type == \"errorMarker\";\n })[0];\n if (oldWidget) {\n oldWidget.destroy();\n } else {\n row -= dir;\n }\n var annotations = findAnnotations(session, row, dir);\n var gutterAnno;\n if (annotations) {\n var annotation = annotations[0];\n pos.column = (annotation.pos && typeof annotation.column != \"number\"\n ? annotation.pos.sc\n : annotation.column) || 0;\n pos.row = annotation.row;\n gutterAnno = editor.renderer.$gutterLayer.$annotations[pos.row];\n } else if (oldWidget) {\n return;\n } else {\n gutterAnno = {\n text: [\"Looks good!\"],\n className: \"ace_ok\"\n };\n }\n editor.session.unfold(pos.row);\n editor.selection.moveToPosition(pos);\n \n var w = {\n row: pos.row, \n fixedWidth: true,\n coverGutter: true,\n el: dom.createElement(\"div\"),\n type: \"errorMarker\"\n };\n var el = w.el.appendChild(dom.createElement(\"div\"));\n var arrow = w.el.appendChild(dom.createElement(\"div\"));\n arrow.className = \"error_widget_arrow \" + gutterAnno.className;\n \n var left = editor.renderer.$cursorLayer\n .getPixelPosition(pos).left;\n arrow.style.left = left + editor.renderer.gutterWidth - 5 + \"px\";\n \n w.el.className = \"error_widget_wrapper\";\n el.className = \"error_widget \" + gutterAnno.className;\n el.innerHTML = gutterAnno.text.join(\"
\");\n \n el.appendChild(dom.createElement(\"div\"));\n \n var kb = function(_, hashId, keyString) {\n if (hashId === 0 && (keyString === \"esc\" || keyString === \"return\")) {\n w.destroy();\n return {command: \"null\"};\n }\n };\n \n w.destroy = function() {\n if (editor.$mouseHandler.isMousePressed)\n return;\n editor.keyBinding.removeKeyboardHandler(kb);\n session.widgetManager.removeLineWidget(w);\n editor.off(\"changeSelection\", w.destroy);\n editor.off(\"changeSession\", w.destroy);\n editor.off(\"mouseup\", w.destroy);\n editor.off(\"change\", w.destroy);\n };\n \n editor.keyBinding.addKeyboardHandler(kb);\n editor.on(\"changeSelection\", w.destroy);\n editor.on(\"changeSession\", w.destroy);\n editor.on(\"mouseup\", w.destroy);\n editor.on(\"change\", w.destroy);\n \n editor.session.widgetManager.addLineWidget(w);\n \n w.el.onmousedown = editor.focus.bind(editor);\n \n editor.renderer.scrollCursorIntoView(null, 0.5, {bottom: w.el.offsetHeight});\n};\n\n\ndom.importCssString(\"\\\n .error_widget_wrapper {\\\n background: inherit;\\\n color: inherit;\\\n border:none\\\n }\\\n .error_widget {\\\n border-top: solid 2px;\\\n border-bottom: solid 2px;\\\n margin: 5px 0;\\\n padding: 10px 40px;\\\n white-space: pre-wrap;\\\n }\\\n .error_widget.ace_error, .error_widget_arrow.ace_error{\\\n border-color: #ff5a5a\\\n }\\\n .error_widget.ace_warning, .error_widget_arrow.ace_warning{\\\n border-color: #F1D817\\\n }\\\n .error_widget.ace_info, .error_widget_arrow.ace_info{\\\n border-color: #5a5a5a\\\n }\\\n .error_widget.ace_ok, .error_widget_arrow.ace_ok{\\\n border-color: #5aaa5a\\\n }\\\n .error_widget_arrow {\\\n position: absolute;\\\n border: solid 5px;\\\n border-top-color: transparent!important;\\\n border-right-color: transparent!important;\\\n border-left-color: transparent!important;\\\n top: -5px;\\\n }\\\n\", \"\");\n\n});\n\nace.define(\"ace/ace\",[\"require\",\"exports\",\"module\",\"ace/lib/fixoldbrowsers\",\"ace/lib/dom\",\"ace/lib/event\",\"ace/range\",\"ace/editor\",\"ace/edit_session\",\"ace/undomanager\",\"ace/virtual_renderer\",\"ace/worker/worker_client\",\"ace/keyboard/hash_handler\",\"ace/placeholder\",\"ace/multi_select\",\"ace/mode/folding/fold_mode\",\"ace/theme/textmate\",\"ace/ext/error_marker\",\"ace/config\"], function(require, exports, module) {\n\nrequire(\"./lib/fixoldbrowsers\");\n\nvar dom = require(\"./lib/dom\");\nvar event = require(\"./lib/event\");\n\nvar Range = require(\"./range\").Range;\nvar Editor = require(\"./editor\").Editor;\nvar EditSession = require(\"./edit_session\").EditSession;\nvar UndoManager = require(\"./undomanager\").UndoManager;\nvar Renderer = require(\"./virtual_renderer\").VirtualRenderer;\nrequire(\"./worker/worker_client\");\nrequire(\"./keyboard/hash_handler\");\nrequire(\"./placeholder\");\nrequire(\"./multi_select\");\nrequire(\"./mode/folding/fold_mode\");\nrequire(\"./theme/textmate\");\nrequire(\"./ext/error_marker\");\n\nexports.config = require(\"./config\");\nexports.require = require;\n\nif (typeof define === \"function\")\n exports.define = define;\nexports.edit = function(el, options) {\n if (typeof el == \"string\") {\n var _id = el;\n el = document.getElementById(_id);\n if (!el)\n throw new Error(\"ace.edit can't find div #\" + _id);\n }\n\n if (el && el.env && el.env.editor instanceof Editor)\n return el.env.editor;\n\n var value = \"\";\n if (el && /input|textarea/i.test(el.tagName)) {\n var oldNode = el;\n value = oldNode.value;\n el = dom.createElement(\"pre\");\n oldNode.parentNode.replaceChild(el, oldNode);\n } else if (el) {\n value = el.textContent;\n el.innerHTML = \"\";\n }\n\n var doc = exports.createEditSession(value);\n\n var editor = new Editor(new Renderer(el), doc, options);\n\n var env = {\n document: doc,\n editor: editor,\n onResize: editor.resize.bind(editor, null)\n };\n if (oldNode) env.textarea = oldNode;\n event.addListener(window, \"resize\", env.onResize);\n editor.on(\"destroy\", function() {\n event.removeListener(window, \"resize\", env.onResize);\n env.editor.container.env = null; // prevent memory leak on old ie\n });\n editor.container.env = editor.env = env;\n return editor;\n};\nexports.createEditSession = function(text, mode) {\n var doc = new EditSession(text, mode);\n doc.setUndoManager(new UndoManager());\n return doc;\n};\nexports.Range = Range;\nexports.Editor = Editor;\nexports.EditSession = EditSession;\nexports.UndoManager = UndoManager;\nexports.VirtualRenderer = Renderer;\nexports.version = exports.config.version;\n}); (function() {\n ace.require([\"ace/ace\"], function(a) {\n if (a) {\n a.config.init(true);\n a.define = ace.define;\n }\n if (!window.ace)\n window.ace = a;\n for (var key in a) if (a.hasOwnProperty(key))\n window.ace[key] = a[key];\n window.ace[\"default\"] = window.ace;\n if (typeof module == \"object\" && typeof exports == \"object\" && module) {\n module.exports = window.ace;\n }\n });\n })();\n\n/**\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Converts a camelCase property name to a kebab-case attribute name.\r\n */\r\nfunction getAttributeName(propertyName) {\r\n return propertyName\r\n .replace(/[A-Z]+/g, sub => `-${sub}`)\r\n .replace(/^-/, '')\r\n .toLowerCase();\r\n}\r\n/**\r\n * Defines that the target property should be exposed as an attribute, and\r\n * that changes to the attribute should trigger a `notifyPropertyChanged`\r\n * callback.\r\n *\r\n * @param attribute Override the attribute name to use. If ommitted, the\r\n * property name is used (coverted from camelCase, to kebab-case).\r\n */\r\nfunction NotifyAttribute(attribute) {\r\n return function (target, key) {\r\n const attr = attribute || getAttributeName(key);\r\n if (target.addObservedAttribute) {\r\n target.addObservedAttribute(attr);\r\n }\r\n Object.defineProperty(target, key, {\r\n get() {\r\n return this.getAttribute(attr);\r\n },\r\n set(value) {\r\n if (value === null || value === undefined) {\r\n this.removeAttribute(attr);\r\n }\r\n else {\r\n this.setAttribute(attr, value);\r\n }\r\n this.notifyPropertyChanged(key);\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n });\r\n };\r\n}\r\n/**\r\n * Defines that the target property should be exposed as boolean attribute, and\r\n * that changes to the attribute should trigger a `notifyPropertyChanged`\r\n * callback.\r\n *\r\n * @param attribute Override the attribute name to use. If ommitted, the\r\n * property name is used (coverted from camelCase, to snake-case).\r\n */\r\nfunction NotifyBooleanAttribute(attribute) {\r\n return function (target, key) {\r\n const attr = attribute || getAttributeName(key);\r\n if (target.addObservedAttribute) {\r\n target.addObservedAttribute(attr);\r\n }\r\n Object.defineProperty(target, key, {\r\n get() {\r\n return this.hasAttribute(attr);\r\n },\r\n set(value) {\r\n if (value) {\r\n this.setAttribute(attr, '');\r\n }\r\n else {\r\n this.removeAttribute(attr);\r\n }\r\n this.notifyPropertyChanged(key);\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n });\r\n };\r\n}\r\n/**\r\n * Defines that the target property should be exposed as numeric attribute, and\r\n * that changes to the attribute should trigger a `notifyPropertyChanged`\r\n * callback.\r\n *\r\n * @param attribute Override the attribute name to use. If ommitted, the\r\n * property name is used (coverted from camelCase, to snake-case).\r\n */\r\nfunction NotifyNumericAttribute(attribute) {\r\n return function (target, key) {\r\n const attr = attribute || getAttributeName(key);\r\n if (target.addObservedAttribute) {\r\n target.addObservedAttribute(attr);\r\n }\r\n Object.defineProperty(target, key, {\r\n get() {\r\n const value = Number(this.getAttribute(attr));\r\n if (isNaN(value)) {\r\n return undefined;\r\n }\r\n return value;\r\n },\r\n set(value) {\r\n if (value === null || value === undefined) {\r\n this.removeAttribute(attr);\r\n }\r\n else {\r\n this.setAttribute(attr, value);\r\n }\r\n this.notifyPropertyChanged(key);\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n });\r\n };\r\n}\n\nvar name = \"ace-builds\";\nvar version = \"1.4.12\";\n\nvar name$1 = \"ace-custom-element\";\nvar version$1 = \"1.6.5\";\n\n/**\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Returns a new function that delays invocations to the original function\r\n * within a specified wait period. The last invocation within this time period\r\n * gets invoked. All earlier invocations are ignore.\r\n *\r\n * @param func The function to invoke.\r\n * @param wait The time in milliseconds to wait for idle invocations.\r\n */\r\nfunction debounce(func, wait = 0) {\r\n let timeout;\r\n return function (...args) {\r\n window.clearTimeout(timeout);\r\n const later = function () {\r\n timeout = undefined;\r\n return func(...args);\r\n };\r\n return new Promise(resolve => {\r\n timeout = window.setTimeout(() => {\r\n const result = later();\r\n resolve(result);\r\n }, wait);\r\n });\r\n };\r\n}\n\nvar ValueUpdateMode;\r\n(function (ValueUpdateMode) {\r\n ValueUpdateMode[\"start\"] = \"start\";\r\n ValueUpdateMode[\"end\"] = \"end\";\r\n ValueUpdateMode[\"select\"] = \"select\";\r\n})(ValueUpdateMode || (ValueUpdateMode = {}));\r\nfunction getValueUpdateNumber(mode) {\r\n if (mode === ValueUpdateMode.start)\r\n return -1;\r\n if (mode === ValueUpdateMode.end)\r\n return 1;\r\n return 0;\r\n}\r\n/**\r\n * Custom element Ace code editor\r\n */\r\nclass AceEditor extends HTMLElement {\r\n constructor() {\r\n super(...arguments);\r\n this.initializeEditor = debounce(() => {\r\n const basePath = this.basePath || import.meta.url.replace(/[^\\/]+$/, 'ace/');\r\n ace.config.set('basePath', basePath);\r\n const editor = this._editor || ace.edit(this);\r\n this.appendStyles();\r\n editor.session.setMode(this.mode || 'ace/mode/javascript');\r\n editor.setTheme(this.theme || 'ace/theme/eclipse');\r\n const text = editor.getValue() || '';\r\n if (text !== this.value) {\r\n editor.setValue(this.value || '', getValueUpdateNumber(this.valueUpdateMode));\r\n }\r\n editor.getSession().setTabSize(this.tabSize || 2);\r\n editor.getSession().setUseSoftTabs(!!this.softTabs);\r\n editor.renderer.setShowGutter(!this.hideGutter);\r\n editor.renderer.setShowPrintMargin(!this.hidePrintMargin);\r\n editor.setHighlightActiveLine(!this.hideActiveLineHighlight);\r\n editor.setHighlightGutterLine(!this.hideGutterLineHighlight);\r\n editor.setReadOnly(!!this.readonly);\r\n if (this.readonly) {\r\n editor.setHighlightActiveLine(!this.readonly);\r\n editor.setHighlightGutterLine(!this.readonly);\r\n }\r\n editor.getSession().setUseWrapMode(!!this.wrap);\r\n editor.off('change', this.handleChange);\r\n editor.on('change', this.handleChange);\r\n editor.off('blur', this.handleBlur);\r\n editor.on('blur', this.handleBlur);\r\n this.resize();\r\n this._editor = editor;\r\n });\r\n this.handleChange = debounce(() => {\r\n var _a;\r\n const text = ((_a = this._editor) === null || _a === void 0 ? void 0 : _a.getValue()) || '';\r\n if (text !== this.value) {\r\n if (text) {\r\n this.setAttribute('value', text);\r\n }\r\n else {\r\n this.removeAttribute('value');\r\n }\r\n this.dispatch('change', text);\r\n }\r\n });\r\n this.handleBlur = () => {\r\n this.dispatchEvent(new FocusEvent('blur'));\r\n };\r\n }\r\n get editor() {\r\n return this._editor;\r\n }\r\n get version() {\r\n return {\r\n [name$1]: version$1,\r\n [name]: version,\r\n };\r\n }\r\n static get observedAttributes() {\r\n return AceEditor._observedAttributes;\r\n }\r\n /**\r\n * Registers an attribute to be observed.\r\n *\r\n * @param name Attribute name to observe.\r\n * @internal\r\n */\r\n addObservedAttribute(name) {\r\n AceEditor._observedAttributes.push(name);\r\n }\r\n dispatch(type, detail) {\r\n this.dispatchEvent(new CustomEvent(type, {\r\n bubbles: true,\r\n cancelable: false,\r\n detail,\r\n }));\r\n }\r\n appendStyles() {\r\n var _a, _b;\r\n const rootNode = this.getRootNode();\r\n const aceStyleId = `ace_editor.css`;\r\n const customStyleId = `ace-custom-element-style`;\r\n // initialize styles if rendering on the client:\r\n if (rootNode) {\r\n if (!((_a = rootNode.getElementById) === null || _a === void 0 ? void 0 : _a.call(rootNode, customStyleId))) {\r\n const style = document.createElement('style');\r\n style.id = customStyleId;\r\n style.type = 'text/css';\r\n style.innerHTML = `\n ace-editor {\n display: block;\n width: 100%;\n height: 250px;\n }\n `;\r\n if (rootNode instanceof Document && rootNode.head) {\r\n rootNode.head.appendChild(style);\r\n }\r\n else {\r\n rootNode.appendChild(style);\r\n }\r\n }\r\n if (!((_b = rootNode.getElementById) === null || _b === void 0 ? void 0 : _b.call(rootNode, aceStyleId))) {\r\n const editorStyle = document.getElementById(aceStyleId);\r\n if (editorStyle) {\r\n if (rootNode instanceof Document && rootNode.head) {\r\n rootNode.head.appendChild(editorStyle.cloneNode(true));\r\n }\r\n else {\r\n rootNode.appendChild(editorStyle.cloneNode(true));\r\n }\r\n }\r\n }\r\n }\r\n }\r\n connectedCallback() {\r\n this.initializeEditor().then(() => {\r\n this.dispatch('ready', {\r\n editor: this.editor,\r\n });\r\n });\r\n }\r\n disconnectedCallback() {\r\n if (!this._editor)\r\n return;\r\n this._editor.off('change', this.handleChange);\r\n this._editor.off('blur', this.handleBlur);\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n attributeChangedCallback(name) {\r\n this.initializeEditor();\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n notifyPropertyChanged(name) {\r\n this.initializeEditor();\r\n }\r\n resize() {\r\n var _a;\r\n (_a = this._editor) === null || _a === void 0 ? void 0 : _a.resize();\r\n }\r\n}\r\nAceEditor._observedAttributes = [];\r\n__decorate([\r\n NotifyAttribute()\r\n], AceEditor.prototype, \"value\", void 0);\r\n__decorate([\r\n NotifyAttribute()\r\n], AceEditor.prototype, \"mode\", void 0);\r\n__decorate([\r\n NotifyAttribute()\r\n], AceEditor.prototype, \"theme\", void 0);\r\n__decorate([\r\n NotifyNumericAttribute()\r\n], AceEditor.prototype, \"tabSize\", void 0);\r\n__decorate([\r\n NotifyBooleanAttribute()\r\n], AceEditor.prototype, \"readonly\", void 0);\r\n__decorate([\r\n NotifyBooleanAttribute()\r\n], AceEditor.prototype, \"softTabs\", void 0);\r\n__decorate([\r\n NotifyBooleanAttribute()\r\n], AceEditor.prototype, \"wrap\", void 0);\r\n__decorate([\r\n NotifyAttribute()\r\n], AceEditor.prototype, \"valueUpdateMode\", void 0);\r\n__decorate([\r\n NotifyBooleanAttribute()\r\n], AceEditor.prototype, \"hideActiveLineHighlight\", void 0);\r\n__decorate([\r\n NotifyBooleanAttribute()\r\n], AceEditor.prototype, \"hideGutter\", void 0);\r\n__decorate([\r\n NotifyBooleanAttribute()\r\n], AceEditor.prototype, \"hideGutterLineHighlight\", void 0);\r\n__decorate([\r\n NotifyBooleanAttribute()\r\n], AceEditor.prototype, \"hidePrintMargin\", void 0);\r\n__decorate([\r\n NotifyAttribute()\r\n], AceEditor.prototype, \"basePath\", void 0);\r\ncustomElements.define('ace-editor', AceEditor);\n\nexport default AceEditor;\n","/**\n * @license\n * Copyright 2016 Google Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n(() => {\n var _a, _b, _c;\n /* Symbols for private properties */\n const _blockingElements = Symbol();\n const _alreadyInertElements = Symbol();\n const _topElParents = Symbol();\n const _siblingsToRestore = Symbol();\n const _parentMO = Symbol();\n /* Symbols for private static methods */\n const _topChanged = Symbol();\n const _swapInertedSibling = Symbol();\n const _inertSiblings = Symbol();\n const _restoreInertedSiblings = Symbol();\n const _getParents = Symbol();\n const _getDistributedChildren = Symbol();\n const _isInertable = Symbol();\n const _handleMutations = Symbol();\n class BlockingElementsImpl {\n constructor() {\n /**\n * The blocking elements.\n */\n this[_a] = [];\n /**\n * Used to keep track of the parents of the top element, from the element\n * itself up to body. When top changes, the old top might have been removed\n * from the document, so we need to memoize the inerted parents' siblings\n * in order to restore their inerteness when top changes.\n */\n this[_b] = [];\n /**\n * Elements that are already inert before the first blocking element is\n * pushed.\n */\n this[_c] = new Set();\n }\n destructor() {\n // Restore original inertness.\n this[_restoreInertedSiblings](this[_topElParents]);\n // Note we don't want to make these properties nullable on the class,\n // since then we'd need non-null casts in many places. Calling a method on\n // a BlockingElements instance after calling destructor will result in an\n // exception.\n const nullable = this;\n nullable[_blockingElements] = null;\n nullable[_topElParents] = null;\n nullable[_alreadyInertElements] = null;\n }\n get top() {\n const elems = this[_blockingElements];\n return elems[elems.length - 1] || null;\n }\n push(element) {\n if (!element || element === this.top) {\n return;\n }\n // Remove it from the stack, we'll bring it to the top.\n this.remove(element);\n this[_topChanged](element);\n this[_blockingElements].push(element);\n }\n remove(element) {\n const i = this[_blockingElements].indexOf(element);\n if (i === -1) {\n return false;\n }\n this[_blockingElements].splice(i, 1);\n // Top changed only if the removed element was the top element.\n if (i === this[_blockingElements].length) {\n this[_topChanged](this.top);\n }\n return true;\n }\n pop() {\n const top = this.top;\n top && this.remove(top);\n return top;\n }\n has(element) {\n return this[_blockingElements].indexOf(element) !== -1;\n }\n /**\n * Sets `inert` to all document elements except the new top element, its\n * parents, and its distributed content.\n */\n [(_a = _blockingElements, _b = _topElParents, _c = _alreadyInertElements, _topChanged)](newTop) {\n const toKeepInert = this[_alreadyInertElements];\n const oldParents = this[_topElParents];\n // No new top, reset old top if any.\n if (!newTop) {\n this[_restoreInertedSiblings](oldParents);\n toKeepInert.clear();\n this[_topElParents] = [];\n return;\n }\n const newParents = this[_getParents](newTop);\n // New top is not contained in the main document!\n if (newParents[newParents.length - 1].parentNode !== document.body) {\n throw Error('Non-connected element cannot be a blocking element');\n }\n // Cast here because we know we'll call _inertSiblings on newParents\n // below.\n this[_topElParents] = newParents;\n const toSkip = this[_getDistributedChildren](newTop);\n // No previous top element.\n if (!oldParents.length) {\n this[_inertSiblings](newParents, toSkip, toKeepInert);\n return;\n }\n let i = oldParents.length - 1;\n let j = newParents.length - 1;\n // Find common parent. Index 0 is the element itself (so stop before it).\n while (i > 0 && j > 0 && oldParents[i] === newParents[j]) {\n i--;\n j--;\n }\n // If up the parents tree there are 2 elements that are siblings, swap\n // the inerted sibling.\n if (oldParents[i] !== newParents[j]) {\n this[_swapInertedSibling](oldParents[i], newParents[j]);\n }\n // Restore old parents siblings inertness.\n i > 0 && this[_restoreInertedSiblings](oldParents.slice(0, i));\n // Make new parents siblings inert.\n j > 0 && this[_inertSiblings](newParents.slice(0, j), toSkip, null);\n }\n /**\n * Swaps inertness between two sibling elements.\n * Sets the property `inert` over the attribute since the inert spec\n * doesn't specify if it should be reflected.\n * https://html.spec.whatwg.org/multipage/interaction.html#inert\n */\n [_swapInertedSibling](oldInert, newInert) {\n const siblingsToRestore = oldInert[_siblingsToRestore];\n // oldInert is not contained in siblings to restore, so we have to check\n // if it's inertable and if already inert.\n if (this[_isInertable](oldInert) && !oldInert.inert) {\n oldInert.inert = true;\n siblingsToRestore.add(oldInert);\n }\n // If newInert was already between the siblings to restore, it means it is\n // inertable and must be restored.\n if (siblingsToRestore.has(newInert)) {\n newInert.inert = false;\n siblingsToRestore.delete(newInert);\n }\n newInert[_parentMO] = oldInert[_parentMO];\n newInert[_siblingsToRestore] = siblingsToRestore;\n oldInert[_parentMO] = undefined;\n oldInert[_siblingsToRestore] = undefined;\n }\n /**\n * Restores original inertness to the siblings of the elements.\n * Sets the property `inert` over the attribute since the inert spec\n * doesn't specify if it should be reflected.\n * https://html.spec.whatwg.org/multipage/interaction.html#inert\n */\n [_restoreInertedSiblings](elements) {\n for (const element of elements) {\n const mo = element[_parentMO];\n mo.disconnect();\n element[_parentMO] = undefined;\n const siblings = element[_siblingsToRestore];\n for (const sibling of siblings) {\n sibling.inert = false;\n }\n element[_siblingsToRestore] = undefined;\n }\n }\n /**\n * Inerts the siblings of the elements except the elements to skip. Stores\n * the inerted siblings into the element's symbol `_siblingsToRestore`.\n * Pass `toKeepInert` to collect the already inert elements.\n * Sets the property `inert` over the attribute since the inert spec\n * doesn't specify if it should be reflected.\n * https://html.spec.whatwg.org/multipage/interaction.html#inert\n */\n [_inertSiblings](elements, toSkip, toKeepInert) {\n for (const element of elements) {\n // Assume element is not a Document, so it must have a parentNode.\n const parent = element.parentNode;\n const children = parent.children;\n const inertedSiblings = new Set();\n for (let j = 0; j < children.length; j++) {\n const sibling = children[j];\n // Skip the input element, if not inertable or to be skipped.\n if (sibling === element || !this[_isInertable](sibling) ||\n (toSkip && toSkip.has(sibling))) {\n continue;\n }\n // Should be collected since already inerted.\n if (toKeepInert && sibling.inert) {\n toKeepInert.add(sibling);\n }\n else {\n sibling.inert = true;\n inertedSiblings.add(sibling);\n }\n }\n // Store the siblings that were inerted.\n element[_siblingsToRestore] = inertedSiblings;\n // Observe only immediate children mutations on the parent.\n const mo = new MutationObserver(this[_handleMutations].bind(this));\n element[_parentMO] = mo;\n let parentToObserve = parent;\n // If we're using the ShadyDOM polyfill, then our parent could be a\n // shady root, which is an object that acts like a ShadowRoot, but isn't\n // actually a node in the real DOM. Observe the real DOM parent instead.\n const maybeShadyRoot = parentToObserve;\n if (maybeShadyRoot.__shady && maybeShadyRoot.host) {\n parentToObserve = maybeShadyRoot.host;\n }\n mo.observe(parentToObserve, {\n childList: true,\n });\n }\n }\n /**\n * Handles newly added/removed nodes by toggling their inertness.\n * It also checks if the current top Blocking Element has been removed,\n * notifying and removing it.\n */\n [_handleMutations](mutations) {\n const parents = this[_topElParents];\n const toKeepInert = this[_alreadyInertElements];\n for (const mutation of mutations) {\n // If the target is a shadowRoot, get its host as we skip shadowRoots when\n // computing _topElParents.\n const target = mutation.target.host || mutation.target;\n const idx = target === document.body ?\n parents.length :\n parents.indexOf(target);\n const inertedChild = parents[idx - 1];\n const inertedSiblings = inertedChild[_siblingsToRestore];\n // To restore.\n for (let i = 0; i < mutation.removedNodes.length; i++) {\n const sibling = mutation.removedNodes[i];\n if (sibling === inertedChild) {\n console.info('Detected removal of the top Blocking Element.');\n this.pop();\n return;\n }\n if (inertedSiblings.has(sibling)) {\n sibling.inert = false;\n inertedSiblings.delete(sibling);\n }\n }\n // To inert.\n for (let i = 0; i < mutation.addedNodes.length; i++) {\n const sibling = mutation.addedNodes[i];\n if (!this[_isInertable](sibling)) {\n continue;\n }\n if (toKeepInert && sibling.inert) {\n toKeepInert.add(sibling);\n }\n else {\n sibling.inert = true;\n inertedSiblings.add(sibling);\n }\n }\n }\n }\n /**\n * Returns if the element is inertable.\n */\n [_isInertable](element) {\n return false === /^(style|template|script)$/.test(element.localName);\n }\n /**\n * Returns the list of newParents of an element, starting from element\n * (included) up to `document.body` (excluded).\n */\n [_getParents](element) {\n const parents = [];\n let current = element;\n // Stop to body.\n while (current && current !== document.body) {\n // Skip shadow roots.\n if (current.nodeType === Node.ELEMENT_NODE) {\n parents.push(current);\n }\n // ShadowDom v1\n if (current.assignedSlot) {\n // Collect slots from deepest slot to top.\n while (current = current.assignedSlot) {\n parents.push(current);\n }\n // Continue the search on the top slot.\n current = parents.pop();\n continue;\n }\n current = current.parentNode ||\n current.host;\n }\n return parents;\n }\n /**\n * Returns the distributed children of the element's shadow root.\n * Returns null if the element doesn't have a shadow root.\n */\n [_getDistributedChildren](element) {\n const shadowRoot = element.shadowRoot;\n if (!shadowRoot) {\n return null;\n }\n const result = new Set();\n let i;\n let j;\n let nodes;\n const slots = shadowRoot.querySelectorAll('slot');\n if (slots.length && slots[0].assignedNodes) {\n for (i = 0; i < slots.length; i++) {\n nodes = slots[i].assignedNodes({\n flatten: true,\n });\n for (j = 0; j < nodes.length; j++) {\n if (nodes[j].nodeType === Node.ELEMENT_NODE) {\n result.add(nodes[j]);\n }\n }\n }\n // No need to search for .\n }\n return result;\n }\n }\n document.$blockingElements =\n new BlockingElementsImpl();\n})();\n//# sourceMappingURL=blocking-elements.js.map","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory() :\n typeof define === 'function' && define.amd ? define('inert', factory) :\n (factory());\n}(this, (function () { 'use strict';\n\n var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n /**\n * This work is licensed under the W3C Software and Document License\n * (http://www.w3.org/Consortium/Legal/2015/copyright-software-and-document).\n */\n\n (function () {\n // Return early if we're not running inside of the browser.\n if (typeof window === 'undefined') {\n return;\n }\n\n // Convenience function for converting NodeLists.\n /** @type {typeof Array.prototype.slice} */\n var slice = Array.prototype.slice;\n\n /**\n * IE has a non-standard name for \"matches\".\n * @type {typeof Element.prototype.matches}\n */\n var matches = Element.prototype.matches || Element.prototype.msMatchesSelector;\n\n /** @type {string} */\n var _focusableElementsString = ['a[href]', 'area[href]', 'input:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'details', 'summary', 'iframe', 'object', 'embed', '[contenteditable]'].join(',');\n\n /**\n * `InertRoot` manages a single inert subtree, i.e. a DOM subtree whose root element has an `inert`\n * attribute.\n *\n * Its main functions are:\n *\n * - to create and maintain a set of managed `InertNode`s, including when mutations occur in the\n * subtree. The `makeSubtreeUnfocusable()` method handles collecting `InertNode`s via registering\n * each focusable node in the subtree with the singleton `InertManager` which manages all known\n * focusable nodes within inert subtrees. `InertManager` ensures that a single `InertNode`\n * instance exists for each focusable node which has at least one inert root as an ancestor.\n *\n * - to notify all managed `InertNode`s when this subtree stops being inert (i.e. when the `inert`\n * attribute is removed from the root node). This is handled in the destructor, which calls the\n * `deregister` method on `InertManager` for each managed inert node.\n */\n\n var InertRoot = function () {\n /**\n * @param {!HTMLElement} rootElement The HTMLElement at the root of the inert subtree.\n * @param {!InertManager} inertManager The global singleton InertManager object.\n */\n function InertRoot(rootElement, inertManager) {\n _classCallCheck(this, InertRoot);\n\n /** @type {!InertManager} */\n this._inertManager = inertManager;\n\n /** @type {!HTMLElement} */\n this._rootElement = rootElement;\n\n /**\n * @type {!Set}\n * All managed focusable nodes in this InertRoot's subtree.\n */\n this._managedNodes = new Set();\n\n // Make the subtree hidden from assistive technology\n if (this._rootElement.hasAttribute('aria-hidden')) {\n /** @type {?string} */\n this._savedAriaHidden = this._rootElement.getAttribute('aria-hidden');\n } else {\n this._savedAriaHidden = null;\n }\n this._rootElement.setAttribute('aria-hidden', 'true');\n\n // Make all focusable elements in the subtree unfocusable and add them to _managedNodes\n this._makeSubtreeUnfocusable(this._rootElement);\n\n // Watch for:\n // - any additions in the subtree: make them unfocusable too\n // - any removals from the subtree: remove them from this inert root's managed nodes\n // - attribute changes: if `tabindex` is added, or removed from an intrinsically focusable\n // element, make that node a managed node.\n this._observer = new MutationObserver(this._onMutation.bind(this));\n this._observer.observe(this._rootElement, { attributes: true, childList: true, subtree: true });\n }\n\n /**\n * Call this whenever this object is about to become obsolete. This unwinds all of the state\n * stored in this object and updates the state of all of the managed nodes.\n */\n\n\n _createClass(InertRoot, [{\n key: 'destructor',\n value: function destructor() {\n this._observer.disconnect();\n\n if (this._rootElement) {\n if (this._savedAriaHidden !== null) {\n this._rootElement.setAttribute('aria-hidden', this._savedAriaHidden);\n } else {\n this._rootElement.removeAttribute('aria-hidden');\n }\n }\n\n this._managedNodes.forEach(function (inertNode) {\n this._unmanageNode(inertNode.node);\n }, this);\n\n // Note we cast the nulls to the ANY type here because:\n // 1) We want the class properties to be declared as non-null, or else we\n // need even more casts throughout this code. All bets are off if an\n // instance has been destroyed and a method is called.\n // 2) We don't want to cast \"this\", because we want type-aware optimizations\n // to know which properties we're setting.\n this._observer = /** @type {?} */null;\n this._rootElement = /** @type {?} */null;\n this._managedNodes = /** @type {?} */null;\n this._inertManager = /** @type {?} */null;\n }\n\n /**\n * @return {!Set} A copy of this InertRoot's managed nodes set.\n */\n\n }, {\n key: '_makeSubtreeUnfocusable',\n\n\n /**\n * @param {!Node} startNode\n */\n value: function _makeSubtreeUnfocusable(startNode) {\n var _this2 = this;\n\n composedTreeWalk(startNode, function (node) {\n return _this2._visitNode(node);\n });\n\n var activeElement = document.activeElement;\n\n if (!document.body.contains(startNode)) {\n // startNode may be in shadow DOM, so find its nearest shadowRoot to get the activeElement.\n var node = startNode;\n /** @type {!ShadowRoot|undefined} */\n var root = undefined;\n while (node) {\n if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n root = /** @type {!ShadowRoot} */node;\n break;\n }\n node = node.parentNode;\n }\n if (root) {\n activeElement = root.activeElement;\n }\n }\n if (startNode.contains(activeElement)) {\n activeElement.blur();\n // In IE11, if an element is already focused, and then set to tabindex=-1\n // calling blur() will not actually move the focus.\n // To work around this we call focus() on the body instead.\n if (activeElement === document.activeElement) {\n document.body.focus();\n }\n }\n }\n\n /**\n * @param {!Node} node\n */\n\n }, {\n key: '_visitNode',\n value: function _visitNode(node) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n return;\n }\n var element = /** @type {!HTMLElement} */node;\n\n // If a descendant inert root becomes un-inert, its descendants will still be inert because of\n // this inert root, so all of its managed nodes need to be adopted by this InertRoot.\n if (element !== this._rootElement && element.hasAttribute('inert')) {\n this._adoptInertRoot(element);\n }\n\n if (matches.call(element, _focusableElementsString) || element.hasAttribute('tabindex')) {\n this._manageNode(element);\n }\n }\n\n /**\n * Register the given node with this InertRoot and with InertManager.\n * @param {!Node} node\n */\n\n }, {\n key: '_manageNode',\n value: function _manageNode(node) {\n var inertNode = this._inertManager.register(node, this);\n this._managedNodes.add(inertNode);\n }\n\n /**\n * Unregister the given node with this InertRoot and with InertManager.\n * @param {!Node} node\n */\n\n }, {\n key: '_unmanageNode',\n value: function _unmanageNode(node) {\n var inertNode = this._inertManager.deregister(node, this);\n if (inertNode) {\n this._managedNodes['delete'](inertNode);\n }\n }\n\n /**\n * Unregister the entire subtree starting at `startNode`.\n * @param {!Node} startNode\n */\n\n }, {\n key: '_unmanageSubtree',\n value: function _unmanageSubtree(startNode) {\n var _this3 = this;\n\n composedTreeWalk(startNode, function (node) {\n return _this3._unmanageNode(node);\n });\n }\n\n /**\n * If a descendant node is found with an `inert` attribute, adopt its managed nodes.\n * @param {!HTMLElement} node\n */\n\n }, {\n key: '_adoptInertRoot',\n value: function _adoptInertRoot(node) {\n var inertSubroot = this._inertManager.getInertRoot(node);\n\n // During initialisation this inert root may not have been registered yet,\n // so register it now if need be.\n if (!inertSubroot) {\n this._inertManager.setInert(node, true);\n inertSubroot = this._inertManager.getInertRoot(node);\n }\n\n inertSubroot.managedNodes.forEach(function (savedInertNode) {\n this._manageNode(savedInertNode.node);\n }, this);\n }\n\n /**\n * Callback used when mutation observer detects subtree additions, removals, or attribute changes.\n * @param {!Array} records\n * @param {!MutationObserver} self\n */\n\n }, {\n key: '_onMutation',\n value: function _onMutation(records, self) {\n records.forEach(function (record) {\n var target = /** @type {!HTMLElement} */record.target;\n if (record.type === 'childList') {\n // Manage added nodes\n slice.call(record.addedNodes).forEach(function (node) {\n this._makeSubtreeUnfocusable(node);\n }, this);\n\n // Un-manage removed nodes\n slice.call(record.removedNodes).forEach(function (node) {\n this._unmanageSubtree(node);\n }, this);\n } else if (record.type === 'attributes') {\n if (record.attributeName === 'tabindex') {\n // Re-initialise inert node if tabindex changes\n this._manageNode(target);\n } else if (target !== this._rootElement && record.attributeName === 'inert' && target.hasAttribute('inert')) {\n // If a new inert root is added, adopt its managed nodes and make sure it knows about the\n // already managed nodes from this inert subroot.\n this._adoptInertRoot(target);\n var inertSubroot = this._inertManager.getInertRoot(target);\n this._managedNodes.forEach(function (managedNode) {\n if (target.contains(managedNode.node)) {\n inertSubroot._manageNode(managedNode.node);\n }\n });\n }\n }\n }, this);\n }\n }, {\n key: 'managedNodes',\n get: function get() {\n return new Set(this._managedNodes);\n }\n\n /** @return {boolean} */\n\n }, {\n key: 'hasSavedAriaHidden',\n get: function get() {\n return this._savedAriaHidden !== null;\n }\n\n /** @param {?string} ariaHidden */\n\n }, {\n key: 'savedAriaHidden',\n set: function set(ariaHidden) {\n this._savedAriaHidden = ariaHidden;\n }\n\n /** @return {?string} */\n ,\n get: function get() {\n return this._savedAriaHidden;\n }\n }]);\n\n return InertRoot;\n }();\n\n /**\n * `InertNode` initialises and manages a single inert node.\n * A node is inert if it is a descendant of one or more inert root elements.\n *\n * On construction, `InertNode` saves the existing `tabindex` value for the node, if any, and\n * either removes the `tabindex` attribute or sets it to `-1`, depending on whether the element\n * is intrinsically focusable or not.\n *\n * `InertNode` maintains a set of `InertRoot`s which are descendants of this `InertNode`. When an\n * `InertRoot` is destroyed, and calls `InertManager.deregister()`, the `InertManager` notifies the\n * `InertNode` via `removeInertRoot()`, which in turn destroys the `InertNode` if no `InertRoot`s\n * remain in the set. On destruction, `InertNode` reinstates the stored `tabindex` if one exists,\n * or removes the `tabindex` attribute if the element is intrinsically focusable.\n */\n\n\n var InertNode = function () {\n /**\n * @param {!Node} node A focusable element to be made inert.\n * @param {!InertRoot} inertRoot The inert root element associated with this inert node.\n */\n function InertNode(node, inertRoot) {\n _classCallCheck(this, InertNode);\n\n /** @type {!Node} */\n this._node = node;\n\n /** @type {boolean} */\n this._overrodeFocusMethod = false;\n\n /**\n * @type {!Set} The set of descendant inert roots.\n * If and only if this set becomes empty, this node is no longer inert.\n */\n this._inertRoots = new Set([inertRoot]);\n\n /** @type {?number} */\n this._savedTabIndex = null;\n\n /** @type {boolean} */\n this._destroyed = false;\n\n // Save any prior tabindex info and make this node untabbable\n this.ensureUntabbable();\n }\n\n /**\n * Call this whenever this object is about to become obsolete.\n * This makes the managed node focusable again and deletes all of the previously stored state.\n */\n\n\n _createClass(InertNode, [{\n key: 'destructor',\n value: function destructor() {\n this._throwIfDestroyed();\n\n if (this._node && this._node.nodeType === Node.ELEMENT_NODE) {\n var element = /** @type {!HTMLElement} */this._node;\n if (this._savedTabIndex !== null) {\n element.setAttribute('tabindex', this._savedTabIndex);\n } else {\n element.removeAttribute('tabindex');\n }\n\n // Use `delete` to restore native focus method.\n if (this._overrodeFocusMethod) {\n delete element.focus;\n }\n }\n\n // See note in InertRoot.destructor for why we cast these nulls to ANY.\n this._node = /** @type {?} */null;\n this._inertRoots = /** @type {?} */null;\n this._destroyed = true;\n }\n\n /**\n * @type {boolean} Whether this object is obsolete because the managed node is no longer inert.\n * If the object has been destroyed, any attempt to access it will cause an exception.\n */\n\n }, {\n key: '_throwIfDestroyed',\n\n\n /**\n * Throw if user tries to access destroyed InertNode.\n */\n value: function _throwIfDestroyed() {\n if (this.destroyed) {\n throw new Error('Trying to access destroyed InertNode');\n }\n }\n\n /** @return {boolean} */\n\n }, {\n key: 'ensureUntabbable',\n\n\n /** Save the existing tabindex value and make the node untabbable and unfocusable */\n value: function ensureUntabbable() {\n if (this.node.nodeType !== Node.ELEMENT_NODE) {\n return;\n }\n var element = /** @type {!HTMLElement} */this.node;\n if (matches.call(element, _focusableElementsString)) {\n if ( /** @type {!HTMLElement} */element.tabIndex === -1 && this.hasSavedTabIndex) {\n return;\n }\n\n if (element.hasAttribute('tabindex')) {\n this._savedTabIndex = /** @type {!HTMLElement} */element.tabIndex;\n }\n element.setAttribute('tabindex', '-1');\n if (element.nodeType === Node.ELEMENT_NODE) {\n element.focus = function () {};\n this._overrodeFocusMethod = true;\n }\n } else if (element.hasAttribute('tabindex')) {\n this._savedTabIndex = /** @type {!HTMLElement} */element.tabIndex;\n element.removeAttribute('tabindex');\n }\n }\n\n /**\n * Add another inert root to this inert node's set of managing inert roots.\n * @param {!InertRoot} inertRoot\n */\n\n }, {\n key: 'addInertRoot',\n value: function addInertRoot(inertRoot) {\n this._throwIfDestroyed();\n this._inertRoots.add(inertRoot);\n }\n\n /**\n * Remove the given inert root from this inert node's set of managing inert roots.\n * If the set of managing inert roots becomes empty, this node is no longer inert,\n * so the object should be destroyed.\n * @param {!InertRoot} inertRoot\n */\n\n }, {\n key: 'removeInertRoot',\n value: function removeInertRoot(inertRoot) {\n this._throwIfDestroyed();\n this._inertRoots['delete'](inertRoot);\n if (this._inertRoots.size === 0) {\n this.destructor();\n }\n }\n }, {\n key: 'destroyed',\n get: function get() {\n return (/** @type {!InertNode} */this._destroyed\n );\n }\n }, {\n key: 'hasSavedTabIndex',\n get: function get() {\n return this._savedTabIndex !== null;\n }\n\n /** @return {!Node} */\n\n }, {\n key: 'node',\n get: function get() {\n this._throwIfDestroyed();\n return this._node;\n }\n\n /** @param {?number} tabIndex */\n\n }, {\n key: 'savedTabIndex',\n set: function set(tabIndex) {\n this._throwIfDestroyed();\n this._savedTabIndex = tabIndex;\n }\n\n /** @return {?number} */\n ,\n get: function get() {\n this._throwIfDestroyed();\n return this._savedTabIndex;\n }\n }]);\n\n return InertNode;\n }();\n\n /**\n * InertManager is a per-document singleton object which manages all inert roots and nodes.\n *\n * When an element becomes an inert root by having an `inert` attribute set and/or its `inert`\n * property set to `true`, the `setInert` method creates an `InertRoot` object for the element.\n * The `InertRoot` in turn registers itself as managing all of the element's focusable descendant\n * nodes via the `register()` method. The `InertManager` ensures that a single `InertNode` instance\n * is created for each such node, via the `_managedNodes` map.\n */\n\n\n var InertManager = function () {\n /**\n * @param {!Document} document\n */\n function InertManager(document) {\n _classCallCheck(this, InertManager);\n\n if (!document) {\n throw new Error('Missing required argument; InertManager needs to wrap a document.');\n }\n\n /** @type {!Document} */\n this._document = document;\n\n /**\n * All managed nodes known to this InertManager. In a map to allow looking up by Node.\n * @type {!Map}\n */\n this._managedNodes = new Map();\n\n /**\n * All inert roots known to this InertManager. In a map to allow looking up by Node.\n * @type {!Map}\n */\n this._inertRoots = new Map();\n\n /**\n * Observer for mutations on `document.body`.\n * @type {!MutationObserver}\n */\n this._observer = new MutationObserver(this._watchForInert.bind(this));\n\n // Add inert style.\n addInertStyle(document.head || document.body || document.documentElement);\n\n // Wait for document to be loaded.\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', this._onDocumentLoaded.bind(this));\n } else {\n this._onDocumentLoaded();\n }\n }\n\n /**\n * Set whether the given element should be an inert root or not.\n * @param {!HTMLElement} root\n * @param {boolean} inert\n */\n\n\n _createClass(InertManager, [{\n key: 'setInert',\n value: function setInert(root, inert) {\n if (inert) {\n if (this._inertRoots.has(root)) {\n // element is already inert\n return;\n }\n\n var inertRoot = new InertRoot(root, this);\n root.setAttribute('inert', '');\n this._inertRoots.set(root, inertRoot);\n // If not contained in the document, it must be in a shadowRoot.\n // Ensure inert styles are added there.\n if (!this._document.body.contains(root)) {\n var parent = root.parentNode;\n while (parent) {\n if (parent.nodeType === 11) {\n addInertStyle(parent);\n }\n parent = parent.parentNode;\n }\n }\n } else {\n if (!this._inertRoots.has(root)) {\n // element is already non-inert\n return;\n }\n\n var _inertRoot = this._inertRoots.get(root);\n _inertRoot.destructor();\n this._inertRoots['delete'](root);\n root.removeAttribute('inert');\n }\n }\n\n /**\n * Get the InertRoot object corresponding to the given inert root element, if any.\n * @param {!Node} element\n * @return {!InertRoot|undefined}\n */\n\n }, {\n key: 'getInertRoot',\n value: function getInertRoot(element) {\n return this._inertRoots.get(element);\n }\n\n /**\n * Register the given InertRoot as managing the given node.\n * In the case where the node has a previously existing inert root, this inert root will\n * be added to its set of inert roots.\n * @param {!Node} node\n * @param {!InertRoot} inertRoot\n * @return {!InertNode} inertNode\n */\n\n }, {\n key: 'register',\n value: function register(node, inertRoot) {\n var inertNode = this._managedNodes.get(node);\n if (inertNode !== undefined) {\n // node was already in an inert subtree\n inertNode.addInertRoot(inertRoot);\n } else {\n inertNode = new InertNode(node, inertRoot);\n }\n\n this._managedNodes.set(node, inertNode);\n\n return inertNode;\n }\n\n /**\n * De-register the given InertRoot as managing the given inert node.\n * Removes the inert root from the InertNode's set of managing inert roots, and remove the inert\n * node from the InertManager's set of managed nodes if it is destroyed.\n * If the node is not currently managed, this is essentially a no-op.\n * @param {!Node} node\n * @param {!InertRoot} inertRoot\n * @return {?InertNode} The potentially destroyed InertNode associated with this node, if any.\n */\n\n }, {\n key: 'deregister',\n value: function deregister(node, inertRoot) {\n var inertNode = this._managedNodes.get(node);\n if (!inertNode) {\n return null;\n }\n\n inertNode.removeInertRoot(inertRoot);\n if (inertNode.destroyed) {\n this._managedNodes['delete'](node);\n }\n\n return inertNode;\n }\n\n /**\n * Callback used when document has finished loading.\n */\n\n }, {\n key: '_onDocumentLoaded',\n value: function _onDocumentLoaded() {\n // Find all inert roots in document and make them actually inert.\n var inertElements = slice.call(this._document.querySelectorAll('[inert]'));\n inertElements.forEach(function (inertElement) {\n this.setInert(inertElement, true);\n }, this);\n\n // Comment this out to use programmatic API only.\n this._observer.observe(this._document.body || this._document.documentElement, { attributes: true, subtree: true, childList: true });\n }\n\n /**\n * Callback used when mutation observer detects attribute changes.\n * @param {!Array} records\n * @param {!MutationObserver} self\n */\n\n }, {\n key: '_watchForInert',\n value: function _watchForInert(records, self) {\n var _this = this;\n records.forEach(function (record) {\n switch (record.type) {\n case 'childList':\n slice.call(record.addedNodes).forEach(function (node) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n return;\n }\n var inertElements = slice.call(node.querySelectorAll('[inert]'));\n if (matches.call(node, '[inert]')) {\n inertElements.unshift(node);\n }\n inertElements.forEach(function (inertElement) {\n this.setInert(inertElement, true);\n }, _this);\n }, _this);\n break;\n case 'attributes':\n if (record.attributeName !== 'inert') {\n return;\n }\n var target = /** @type {!HTMLElement} */record.target;\n var inert = target.hasAttribute('inert');\n _this.setInert(target, inert);\n break;\n }\n }, this);\n }\n }]);\n\n return InertManager;\n }();\n\n /**\n * Recursively walk the composed tree from |node|.\n * @param {!Node} node\n * @param {(function (!HTMLElement))=} callback Callback to be called for each element traversed,\n * before descending into child nodes.\n * @param {?ShadowRoot=} shadowRootAncestor The nearest ShadowRoot ancestor, if any.\n */\n\n\n function composedTreeWalk(node, callback, shadowRootAncestor) {\n if (node.nodeType == Node.ELEMENT_NODE) {\n var element = /** @type {!HTMLElement} */node;\n if (callback) {\n callback(element);\n }\n\n // Descend into node:\n // If it has a ShadowRoot, ignore all child elements - these will be picked\n // up by the or elements. Descend straight into the\n // ShadowRoot.\n var shadowRoot = /** @type {!HTMLElement} */element.shadowRoot;\n if (shadowRoot) {\n composedTreeWalk(shadowRoot, callback, shadowRoot);\n return;\n }\n\n // If it is a element, descend into distributed elements - these\n // are elements from outside the shadow root which are rendered inside the\n // shadow DOM.\n if (element.localName == 'content') {\n var content = /** @type {!HTMLContentElement} */element;\n // Verifies if ShadowDom v0 is supported.\n var distributedNodes = content.getDistributedNodes ? content.getDistributedNodes() : [];\n for (var i = 0; i < distributedNodes.length; i++) {\n composedTreeWalk(distributedNodes[i], callback, shadowRootAncestor);\n }\n return;\n }\n\n // If it is a element, descend into assigned nodes - these\n // are elements from outside the shadow root which are rendered inside the\n // shadow DOM.\n if (element.localName == 'slot') {\n var slot = /** @type {!HTMLSlotElement} */element;\n // Verify if ShadowDom v1 is supported.\n var _distributedNodes = slot.assignedNodes ? slot.assignedNodes({ flatten: true }) : [];\n for (var _i = 0; _i < _distributedNodes.length; _i++) {\n composedTreeWalk(_distributedNodes[_i], callback, shadowRootAncestor);\n }\n return;\n }\n }\n\n // If it is neither the parent of a ShadowRoot, a element, a \n // element, nor a element recurse normally.\n var child = node.firstChild;\n while (child != null) {\n composedTreeWalk(child, callback, shadowRootAncestor);\n child = child.nextSibling;\n }\n }\n\n /**\n * Adds a style element to the node containing the inert specific styles\n * @param {!Node} node\n */\n function addInertStyle(node) {\n if (node.querySelector('style#inert-style, link#inert-style')) {\n return;\n }\n var style = document.createElement('style');\n style.setAttribute('id', 'inert-style');\n style.textContent = '\\n' + '[inert] {\\n' + ' pointer-events: none;\\n' + ' cursor: default;\\n' + '}\\n' + '\\n' + '[inert], [inert] * {\\n' + ' -webkit-user-select: none;\\n' + ' -moz-user-select: none;\\n' + ' -ms-user-select: none;\\n' + ' user-select: none;\\n' + '}\\n';\n node.appendChild(style);\n }\n\n if (!HTMLElement.prototype.hasOwnProperty('inert')) {\n /** @type {!InertManager} */\n var inertManager = new InertManager(document);\n\n Object.defineProperty(HTMLElement.prototype, 'inert', {\n enumerable: true,\n /** @this {!HTMLElement} */\n get: function get() {\n return this.hasAttribute('inert');\n },\n /** @this {!HTMLElement} */\n set: function set(inert) {\n inertManager.setInert(this, inert);\n }\n });\n }\n })();\n\n})));\n","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nexport var cssClasses = {\n CLOSING: 'mdc-dialog--closing',\n OPEN: 'mdc-dialog--open',\n OPENING: 'mdc-dialog--opening',\n SCROLLABLE: 'mdc-dialog--scrollable',\n SCROLL_LOCK: 'mdc-dialog-scroll-lock',\n STACKED: 'mdc-dialog--stacked',\n FULLSCREEN: 'mdc-dialog--fullscreen',\n // Class for showing a scroll divider on full-screen dialog header element.\n // Should only be displayed on scrollable content, when the dialog content is\n // scrolled \"underneath\" the header.\n SCROLL_DIVIDER_HEADER: 'mdc-dialog-scroll-divider-header',\n // Class for showing a scroll divider on a full-screen dialog footer element.\n // Should only be displayed on scrolalble content, when the dialog content is\n // obscured \"underneath\" the footer.\n SCROLL_DIVIDER_FOOTER: 'mdc-dialog-scroll-divider-footer',\n // The \"surface scrim\" is a scrim covering only the surface of a dialog. This\n // is used in situations where a confirmation dialog is shown over an already\n // opened full-screen dialog. On larger screen-sizes, the full-screen dialog\n // is sized as a modal and so in these situations we display a \"surface scrim\"\n // to prevent a \"double scrim\" (where the scrim from the secondary\n // confirmation dialog would overlap with the scrim from the full-screen\n // dialog).\n SURFACE_SCRIM_SHOWN: 'mdc-dialog__surface-scrim--shown',\n // \"Showing\" animating class for the surface-scrim.\n SURFACE_SCRIM_SHOWING: 'mdc-dialog__surface-scrim--showing',\n // \"Hiding\" animating class for the surface-scrim.\n SURFACE_SCRIM_HIDING: 'mdc-dialog__surface-scrim--hiding',\n // Class to hide a dialog's scrim (used in conjunction with a surface-scrim).\n // Note that we only hide the original scrim rather than removing it entirely\n // to prevent interactions with the content behind this scrim, and to capture\n // scrim clicks.\n SCRIM_HIDDEN: 'mdc-dialog__scrim--hidden',\n};\nexport var strings = {\n ACTION_ATTRIBUTE: 'data-mdc-dialog-action',\n BUTTON_DEFAULT_ATTRIBUTE: 'data-mdc-dialog-button-default',\n BUTTON_SELECTOR: '.mdc-dialog__button',\n CLOSED_EVENT: 'MDCDialog:closed',\n CLOSE_ACTION: 'close',\n CLOSING_EVENT: 'MDCDialog:closing',\n CONTAINER_SELECTOR: '.mdc-dialog__container',\n CONTENT_SELECTOR: '.mdc-dialog__content',\n DESTROY_ACTION: 'destroy',\n INITIAL_FOCUS_ATTRIBUTE: 'data-mdc-dialog-initial-focus',\n OPENED_EVENT: 'MDCDialog:opened',\n OPENING_EVENT: 'MDCDialog:opening',\n SCRIM_SELECTOR: '.mdc-dialog__scrim',\n SUPPRESS_DEFAULT_PRESS_SELECTOR: [\n 'textarea',\n '.mdc-menu .mdc-list-item',\n '.mdc-menu .mdc-deprecated-list-item',\n ].join(', '),\n SURFACE_SELECTOR: '.mdc-dialog__surface',\n};\nexport var numbers = {\n DIALOG_ANIMATION_CLOSE_TIME_MS: 75,\n DIALOG_ANIMATION_OPEN_TIME_MS: 150,\n};\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * AnimationFrame provides a user-friendly abstraction around requesting\n * and canceling animation frames.\n */\nvar AnimationFrame = /** @class */ (function () {\n function AnimationFrame() {\n this.rafIDs = new Map();\n }\n /**\n * Requests an animation frame. Cancels any existing frame with the same key.\n * @param {string} key The key for this callback.\n * @param {FrameRequestCallback} callback The callback to be executed.\n */\n AnimationFrame.prototype.request = function (key, callback) {\n var _this = this;\n this.cancel(key);\n var frameID = requestAnimationFrame(function (frame) {\n _this.rafIDs.delete(key);\n // Callback must come *after* the key is deleted so that nested calls to\n // request with the same key are not deleted.\n callback(frame);\n });\n this.rafIDs.set(key, frameID);\n };\n /**\n * Cancels a queued callback with the given key.\n * @param {string} key The key for this callback.\n */\n AnimationFrame.prototype.cancel = function (key) {\n var rafID = this.rafIDs.get(key);\n if (rafID) {\n cancelAnimationFrame(rafID);\n this.rafIDs.delete(key);\n }\n };\n /**\n * Cancels all queued callback.\n */\n AnimationFrame.prototype.cancelAll = function () {\n var _this = this;\n // Need to use forEach because it's the only iteration method supported\n // by IE11. Suppress the underscore because we don't need it.\n // tslint:disable-next-line:enforce-name-casing\n this.rafIDs.forEach(function (_, key) {\n _this.cancel(key);\n });\n };\n /**\n * Returns the queue of unexecuted callback keys.\n */\n AnimationFrame.prototype.getQueue = function () {\n var queue = [];\n // Need to use forEach because it's the only iteration method supported\n // by IE11. Suppress the underscore because we don't need it.\n // tslint:disable-next-line:enforce-name-casing\n this.rafIDs.forEach(function (_, key) {\n queue.push(key);\n });\n return queue;\n };\n return AnimationFrame;\n}());\nexport { AnimationFrame };\n//# sourceMappingURL=animationframe.js.map","/**\n * @license\n * Copyright 2017 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { AnimationFrame } from '@material/animation/animationframe';\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, numbers, strings } from './constants';\nvar AnimationKeys;\n(function (AnimationKeys) {\n AnimationKeys[\"POLL_SCROLL_POS\"] = \"poll_scroll_position\";\n AnimationKeys[\"POLL_LAYOUT_CHANGE\"] = \"poll_layout_change\";\n})(AnimationKeys || (AnimationKeys = {}));\nvar MDCDialogFoundation = /** @class */ (function (_super) {\n __extends(MDCDialogFoundation, _super);\n function MDCDialogFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCDialogFoundation.defaultAdapter), adapter)) || this;\n _this.dialogOpen = false;\n _this.isFullscreen = false;\n _this.animationFrame = 0;\n _this.animationTimer = 0;\n _this.escapeKeyAction = strings.CLOSE_ACTION;\n _this.scrimClickAction = strings.CLOSE_ACTION;\n _this.autoStackButtons = true;\n _this.areButtonsStacked = false;\n _this.suppressDefaultPressSelector = strings.SUPPRESS_DEFAULT_PRESS_SELECTOR;\n _this.animFrame = new AnimationFrame();\n _this.contentScrollHandler = function () {\n _this.handleScrollEvent();\n };\n _this.windowResizeHandler = function () {\n _this.layout();\n };\n _this.windowOrientationChangeHandler = function () {\n _this.layout();\n };\n return _this;\n }\n Object.defineProperty(MDCDialogFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCDialogFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCDialogFoundation, \"numbers\", {\n get: function () {\n return numbers;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCDialogFoundation, \"defaultAdapter\", {\n get: function () {\n return {\n addBodyClass: function () { return undefined; },\n addClass: function () { return undefined; },\n areButtonsStacked: function () { return false; },\n clickDefaultButton: function () { return undefined; },\n eventTargetMatches: function () { return false; },\n getActionFromEvent: function () { return ''; },\n getInitialFocusEl: function () { return null; },\n hasClass: function () { return false; },\n isContentScrollable: function () { return false; },\n notifyClosed: function () { return undefined; },\n notifyClosing: function () { return undefined; },\n notifyOpened: function () { return undefined; },\n notifyOpening: function () { return undefined; },\n releaseFocus: function () { return undefined; },\n removeBodyClass: function () { return undefined; },\n removeClass: function () { return undefined; },\n reverseButtons: function () { return undefined; },\n trapFocus: function () { return undefined; },\n registerContentEventHandler: function () { return undefined; },\n deregisterContentEventHandler: function () { return undefined; },\n isScrollableContentAtTop: function () { return false; },\n isScrollableContentAtBottom: function () { return false; },\n registerWindowEventHandler: function () { return undefined; },\n deregisterWindowEventHandler: function () { return undefined; },\n };\n },\n enumerable: false,\n configurable: true\n });\n MDCDialogFoundation.prototype.init = function () {\n if (this.adapter.hasClass(cssClasses.STACKED)) {\n this.setAutoStackButtons(false);\n }\n this.isFullscreen = this.adapter.hasClass(cssClasses.FULLSCREEN);\n };\n MDCDialogFoundation.prototype.destroy = function () {\n if (this.animationTimer) {\n clearTimeout(this.animationTimer);\n this.handleAnimationTimerEnd();\n }\n if (this.isFullscreen) {\n this.adapter.deregisterContentEventHandler('scroll', this.contentScrollHandler);\n }\n this.animFrame.cancelAll();\n this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler);\n this.adapter.deregisterWindowEventHandler('orientationchange', this.windowOrientationChangeHandler);\n };\n MDCDialogFoundation.prototype.open = function (dialogOptions) {\n var _this = this;\n this.dialogOpen = true;\n this.adapter.notifyOpening();\n this.adapter.addClass(cssClasses.OPENING);\n if (this.isFullscreen) {\n // A scroll event listener is registered even if the dialog is not\n // scrollable on open, since the window resize event, or orientation\n // change may make the dialog scrollable after it is opened.\n this.adapter.registerContentEventHandler('scroll', this.contentScrollHandler);\n }\n if (dialogOptions && dialogOptions.isAboveFullscreenDialog) {\n this.adapter.addClass(cssClasses.SCRIM_HIDDEN);\n }\n this.adapter.registerWindowEventHandler('resize', this.windowResizeHandler);\n this.adapter.registerWindowEventHandler('orientationchange', this.windowOrientationChangeHandler);\n // Wait a frame once display is no longer \"none\", to establish basis for\n // animation\n this.runNextAnimationFrame(function () {\n _this.adapter.addClass(cssClasses.OPEN);\n _this.adapter.addBodyClass(cssClasses.SCROLL_LOCK);\n _this.layout();\n _this.animationTimer = setTimeout(function () {\n _this.handleAnimationTimerEnd();\n _this.adapter.trapFocus(_this.adapter.getInitialFocusEl());\n _this.adapter.notifyOpened();\n }, numbers.DIALOG_ANIMATION_OPEN_TIME_MS);\n });\n };\n MDCDialogFoundation.prototype.close = function (action) {\n var _this = this;\n if (action === void 0) { action = ''; }\n if (!this.dialogOpen) {\n // Avoid redundant close calls (and events), e.g. from keydown on elements\n // that inherently emit click\n return;\n }\n this.dialogOpen = false;\n this.adapter.notifyClosing(action);\n this.adapter.addClass(cssClasses.CLOSING);\n this.adapter.removeClass(cssClasses.OPEN);\n this.adapter.removeBodyClass(cssClasses.SCROLL_LOCK);\n if (this.isFullscreen) {\n this.adapter.deregisterContentEventHandler('scroll', this.contentScrollHandler);\n }\n this.adapter.deregisterWindowEventHandler('resize', this.windowResizeHandler);\n this.adapter.deregisterWindowEventHandler('orientationchange', this.windowOrientationChangeHandler);\n cancelAnimationFrame(this.animationFrame);\n this.animationFrame = 0;\n clearTimeout(this.animationTimer);\n this.animationTimer = setTimeout(function () {\n _this.adapter.releaseFocus();\n _this.handleAnimationTimerEnd();\n _this.adapter.notifyClosed(action);\n }, numbers.DIALOG_ANIMATION_CLOSE_TIME_MS);\n };\n /**\n * Used only in instances of showing a secondary dialog over a full-screen\n * dialog. Shows the \"surface scrim\" displayed over the full-screen dialog.\n */\n MDCDialogFoundation.prototype.showSurfaceScrim = function () {\n var _this = this;\n this.adapter.addClass(cssClasses.SURFACE_SCRIM_SHOWING);\n this.runNextAnimationFrame(function () {\n _this.adapter.addClass(cssClasses.SURFACE_SCRIM_SHOWN);\n });\n };\n /**\n * Used only in instances of showing a secondary dialog over a full-screen\n * dialog. Hides the \"surface scrim\" displayed over the full-screen dialog.\n */\n MDCDialogFoundation.prototype.hideSurfaceScrim = function () {\n this.adapter.removeClass(cssClasses.SURFACE_SCRIM_SHOWN);\n this.adapter.addClass(cssClasses.SURFACE_SCRIM_HIDING);\n };\n /**\n * Handles `transitionend` event triggered when surface scrim animation is\n * finished.\n */\n MDCDialogFoundation.prototype.handleSurfaceScrimTransitionEnd = function () {\n this.adapter.removeClass(cssClasses.SURFACE_SCRIM_HIDING);\n this.adapter.removeClass(cssClasses.SURFACE_SCRIM_SHOWING);\n };\n MDCDialogFoundation.prototype.isOpen = function () {\n return this.dialogOpen;\n };\n MDCDialogFoundation.prototype.getEscapeKeyAction = function () {\n return this.escapeKeyAction;\n };\n MDCDialogFoundation.prototype.setEscapeKeyAction = function (action) {\n this.escapeKeyAction = action;\n };\n MDCDialogFoundation.prototype.getScrimClickAction = function () {\n return this.scrimClickAction;\n };\n MDCDialogFoundation.prototype.setScrimClickAction = function (action) {\n this.scrimClickAction = action;\n };\n MDCDialogFoundation.prototype.getAutoStackButtons = function () {\n return this.autoStackButtons;\n };\n MDCDialogFoundation.prototype.setAutoStackButtons = function (autoStack) {\n this.autoStackButtons = autoStack;\n };\n MDCDialogFoundation.prototype.getSuppressDefaultPressSelector = function () {\n return this.suppressDefaultPressSelector;\n };\n MDCDialogFoundation.prototype.setSuppressDefaultPressSelector = function (selector) {\n this.suppressDefaultPressSelector = selector;\n };\n MDCDialogFoundation.prototype.layout = function () {\n var _this = this;\n this.animFrame.request(AnimationKeys.POLL_LAYOUT_CHANGE, function () {\n _this.layoutInternal();\n });\n };\n /** Handles click on the dialog root element. */\n MDCDialogFoundation.prototype.handleClick = function (evt) {\n var isScrim = this.adapter.eventTargetMatches(evt.target, strings.SCRIM_SELECTOR);\n // Check for scrim click first since it doesn't require querying ancestors.\n if (isScrim && this.scrimClickAction !== '') {\n this.close(this.scrimClickAction);\n }\n else {\n var action = this.adapter.getActionFromEvent(evt);\n if (action) {\n this.close(action);\n }\n }\n };\n /** Handles keydown on the dialog root element. */\n MDCDialogFoundation.prototype.handleKeydown = function (evt) {\n var isEnter = evt.key === 'Enter' || evt.keyCode === 13;\n if (!isEnter) {\n return;\n }\n var action = this.adapter.getActionFromEvent(evt);\n if (action) {\n // Action button callback is handled in `handleClick`,\n // since space/enter keydowns on buttons trigger click events.\n return;\n }\n // `composedPath` is used here, when available, to account for use cases\n // where a target meant to suppress the default press behaviour\n // may exist in a shadow root.\n // For example, a textarea inside a web component:\n // \n // \n // #shadow-root (open)\n // \n // #shadow-root (open)\n // \n // \n // \n // \n var target = evt.composedPath ? evt.composedPath()[0] : evt.target;\n var isDefault = this.suppressDefaultPressSelector ?\n !this.adapter.eventTargetMatches(target, this.suppressDefaultPressSelector) :\n true;\n if (isEnter && isDefault) {\n this.adapter.clickDefaultButton();\n }\n };\n /** Handles keydown on the document. */\n MDCDialogFoundation.prototype.handleDocumentKeydown = function (evt) {\n var isEscape = evt.key === 'Escape' || evt.keyCode === 27;\n if (isEscape && this.escapeKeyAction !== '') {\n this.close(this.escapeKeyAction);\n }\n };\n /**\n * Handles scroll event on the dialog's content element -- showing a scroll\n * divider on the header or footer based on the scroll position. This handler\n * should only be registered on full-screen dialogs with scrollable content.\n */\n MDCDialogFoundation.prototype.handleScrollEvent = function () {\n var _this = this;\n // Since scroll events can fire at a high rate, we throttle these events by\n // using requestAnimationFrame.\n this.animFrame.request(AnimationKeys.POLL_SCROLL_POS, function () {\n _this.toggleScrollDividerHeader();\n _this.toggleScrollDividerFooter();\n });\n };\n MDCDialogFoundation.prototype.layoutInternal = function () {\n if (this.autoStackButtons) {\n this.detectStackedButtons();\n }\n this.toggleScrollableClasses();\n };\n MDCDialogFoundation.prototype.handleAnimationTimerEnd = function () {\n this.animationTimer = 0;\n this.adapter.removeClass(cssClasses.OPENING);\n this.adapter.removeClass(cssClasses.CLOSING);\n };\n /**\n * Runs the given logic on the next animation frame, using setTimeout to\n * factor in Firefox reflow behavior.\n */\n MDCDialogFoundation.prototype.runNextAnimationFrame = function (callback) {\n var _this = this;\n cancelAnimationFrame(this.animationFrame);\n this.animationFrame = requestAnimationFrame(function () {\n _this.animationFrame = 0;\n clearTimeout(_this.animationTimer);\n _this.animationTimer = setTimeout(callback, 0);\n });\n };\n MDCDialogFoundation.prototype.detectStackedButtons = function () {\n // Remove the class first to let us measure the buttons' natural positions.\n this.adapter.removeClass(cssClasses.STACKED);\n var areButtonsStacked = this.adapter.areButtonsStacked();\n if (areButtonsStacked) {\n this.adapter.addClass(cssClasses.STACKED);\n }\n if (areButtonsStacked !== this.areButtonsStacked) {\n this.adapter.reverseButtons();\n this.areButtonsStacked = areButtonsStacked;\n }\n };\n MDCDialogFoundation.prototype.toggleScrollableClasses = function () {\n // Remove the class first to let us measure the natural height of the\n // content.\n this.adapter.removeClass(cssClasses.SCROLLABLE);\n if (this.adapter.isContentScrollable()) {\n this.adapter.addClass(cssClasses.SCROLLABLE);\n if (this.isFullscreen) {\n // If dialog is full-screen and scrollable, check if a scroll divider\n // should be shown.\n this.toggleScrollDividerHeader();\n this.toggleScrollDividerFooter();\n }\n }\n };\n MDCDialogFoundation.prototype.toggleScrollDividerHeader = function () {\n if (!this.adapter.isScrollableContentAtTop()) {\n this.adapter.addClass(cssClasses.SCROLL_DIVIDER_HEADER);\n }\n else if (this.adapter.hasClass(cssClasses.SCROLL_DIVIDER_HEADER)) {\n this.adapter.removeClass(cssClasses.SCROLL_DIVIDER_HEADER);\n }\n };\n MDCDialogFoundation.prototype.toggleScrollDividerFooter = function () {\n if (!this.adapter.isScrollableContentAtBottom()) {\n this.adapter.addClass(cssClasses.SCROLL_DIVIDER_FOOTER);\n }\n else if (this.adapter.hasClass(cssClasses.SCROLL_DIVIDER_FOOTER)) {\n this.adapter.removeClass(cssClasses.SCROLL_DIVIDER_FOOTER);\n }\n };\n return MDCDialogFoundation;\n}(MDCFoundation));\nexport { MDCDialogFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCDialogFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2019 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * Determine whether the current browser supports passive event listeners, and\n * if so, use them.\n */\nexport function applyPassive(globalObj) {\n if (globalObj === void 0) { globalObj = window; }\n return supportsPassiveOption(globalObj) ?\n { passive: true } :\n false;\n}\nfunction supportsPassiveOption(globalObj) {\n if (globalObj === void 0) { globalObj = window; }\n // See\n // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\n var passiveSupported = false;\n try {\n var options = {\n // This function will be called when the browser\n // attempts to access the passive property.\n get passive() {\n passiveSupported = true;\n return false;\n }\n };\n var handler = function () { };\n globalObj.document.addEventListener('test', handler, options);\n globalObj.document.removeEventListener('test', handler, options);\n }\n catch (err) {\n passiveSupported = false;\n }\n return passiveSupported;\n}\n//# sourceMappingURL=events.js.map","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Specifies an observer callback that is run when the decorated property\n * changes. The observer receives the current and old value as arguments.\n */\nexport const observer = (observer) => \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n(proto, propName) => {\n // if we haven't wrapped `updated` in this class, do so\n if (!proto.constructor\n ._observers) {\n proto.constructor._observers = new Map();\n const userUpdated = proto.updated;\n proto.updated = function (changedProperties) {\n userUpdated.call(this, changedProperties);\n changedProperties.forEach((v, k) => {\n const observers = this.constructor\n ._observers;\n const observer = observers.get(k);\n if (observer !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n observer.call(this, this[k], v);\n }\n });\n };\n // clone any existing observers (superclasses)\n // eslint-disable-next-line no-prototype-builtins\n }\n else if (!proto.constructor.hasOwnProperty('_observers')) {\n const observers = proto.constructor._observers;\n proto.constructor._observers = new Map();\n observers.forEach(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (v, k) => proto.constructor._observers.set(k, v));\n }\n // set this method\n proto.constructor._observers.set(propName, observer);\n};\n//# sourceMappingURL=observer.js.map","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport 'blocking-elements';\nimport 'wicg-inert';\nimport { cssClasses } from '@material/dialog/constants.js';\nimport MDCDialogFoundation from '@material/dialog/foundation.js';\nimport { applyPassive } from '@material/dom/events.js';\nimport { closest, matches } from '@material/dom/ponyfill.js';\nimport { addHasRemoveClass, BaseElement } from '@material/mwc-base/base-element.js';\nimport { observer } from '@material/mwc-base/observer.js';\nimport { html } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nconst blockingElements = document.$blockingElements;\nexport class DialogBase extends BaseElement {\n constructor() {\n super(...arguments);\n this.hideActions = false;\n this.stacked = false;\n this.heading = '';\n this.scrimClickAction = 'close';\n this.escapeKeyAction = 'close';\n this.open = false;\n this.defaultAction = 'close';\n this.actionAttribute = 'dialogAction';\n this.initialFocusAttribute = 'dialogInitialFocus';\n this.initialSupressDefaultPressSelector = '';\n this.mdcFoundationClass = MDCDialogFoundation;\n this.boundHandleClick = null;\n this.boundHandleKeydown = null;\n this.boundHandleDocumentKeydown = null;\n }\n set suppressDefaultPressSelector(selector) {\n if (this.mdcFoundation) {\n this.mdcFoundation.setSuppressDefaultPressSelector(selector);\n }\n else {\n this.initialSupressDefaultPressSelector = selector;\n }\n }\n /**\n * @export\n */\n get suppressDefaultPressSelector() {\n return this.mdcFoundation ?\n this.mdcFoundation.getSuppressDefaultPressSelector() :\n this.initialSupressDefaultPressSelector;\n }\n get primaryButton() {\n let assignedNodes = this.primarySlot.assignedNodes();\n assignedNodes = assignedNodes.filter((node) => node instanceof HTMLElement);\n const button = assignedNodes[0];\n return button ? button : null;\n }\n emitNotification(name, action) {\n const init = { detail: action ? { action } : {} };\n const ev = new CustomEvent(name, init);\n this.dispatchEvent(ev);\n }\n getInitialFocusEl() {\n const initFocusSelector = `[${this.initialFocusAttribute}]`;\n // only search light DOM. This typically handles all the cases\n const lightDomQs = this.querySelector(initFocusSelector);\n if (lightDomQs) {\n return lightDomQs;\n }\n // if not in light dom, search each flattened distributed node.\n const primarySlot = this.primarySlot;\n const primaryNodes = primarySlot.assignedNodes({ flatten: true });\n const primaryFocusElement = this.searchNodeTreesForAttribute(primaryNodes, this.initialFocusAttribute);\n if (primaryFocusElement) {\n return primaryFocusElement;\n }\n const secondarySlot = this.secondarySlot;\n const secondaryNodes = secondarySlot.assignedNodes({ flatten: true });\n const secondaryFocusElement = this.searchNodeTreesForAttribute(secondaryNodes, this.initialFocusAttribute);\n if (secondaryFocusElement) {\n return secondaryFocusElement;\n }\n const contentSlot = this.contentSlot;\n const contentNodes = contentSlot.assignedNodes({ flatten: true });\n const initFocusElement = this.searchNodeTreesForAttribute(contentNodes, this.initialFocusAttribute);\n return initFocusElement;\n }\n searchNodeTreesForAttribute(nodes, attribute) {\n for (const node of nodes) {\n if (!(node instanceof HTMLElement)) {\n continue;\n }\n if (node.hasAttribute(attribute)) {\n return node;\n }\n else {\n const selection = node.querySelector(`[${attribute}]`);\n if (selection) {\n return selection;\n }\n }\n }\n return null;\n }\n createAdapter() {\n return Object.assign(Object.assign({}, addHasRemoveClass(this.mdcRoot)), { addBodyClass: () => document.body.style.overflow = 'hidden', removeBodyClass: () => document.body.style.overflow = '', areButtonsStacked: () => this.stacked, clickDefaultButton: () => {\n const primary = this.primaryButton;\n if (primary) {\n primary.click();\n }\n }, eventTargetMatches: (target, selector) => target ? matches(target, selector) : false, getActionFromEvent: (e) => {\n if (!e.target) {\n return '';\n }\n const element = closest(e.target, `[${this.actionAttribute}]`);\n const action = element && element.getAttribute(this.actionAttribute);\n return action;\n }, getInitialFocusEl: () => {\n return this.getInitialFocusEl();\n }, isContentScrollable: () => {\n const el = this.contentElement;\n return el ? el.scrollHeight > el.offsetHeight : false;\n }, notifyClosed: (action) => this.emitNotification('closed', action), notifyClosing: (action) => {\n if (!this.closingDueToDisconnect) {\n // Don't set our open state to closed just because we were\n // disconnected. That way if we get reconnected, we'll know to\n // re-open.\n this.open = false;\n }\n this.emitNotification('closing', action);\n }, notifyOpened: () => this.emitNotification('opened'), notifyOpening: () => {\n this.open = true;\n this.emitNotification('opening');\n }, reverseButtons: () => { }, releaseFocus: () => {\n blockingElements.remove(this);\n }, trapFocus: (el) => {\n if (!this.isConnected) {\n // this is the case where it is opened and closed and then removed\n // from DOM before the animation has completed. Blocking Elements will\n // throw if this is the case\n return;\n }\n blockingElements.push(this);\n if (el) {\n el.focus();\n }\n }, registerContentEventHandler: (evtType, handler) => {\n const el = this.contentElement;\n el.addEventListener(evtType, handler);\n }, deregisterContentEventHandler: (evtType, handler) => {\n const el = this.contentElement;\n el.removeEventListener(evtType, handler);\n }, isScrollableContentAtTop: () => {\n const el = this.contentElement;\n return el ? el.scrollTop === 0 : false;\n }, isScrollableContentAtBottom: () => {\n const el = this.contentElement;\n return el ?\n Math.ceil(el.scrollHeight - el.scrollTop) === el.clientHeight :\n false;\n }, registerWindowEventHandler: (evtType, handler) => {\n window.addEventListener(evtType, handler, applyPassive());\n }, deregisterWindowEventHandler: (evtType, handler) => {\n window.removeEventListener(evtType, handler, applyPassive());\n } });\n }\n render() {\n const classes = {\n [cssClasses.STACKED]: this.stacked,\n };\n let heading = html ``;\n if (this.heading) {\n heading = this.renderHeading();\n }\n const actionsClasses = {\n 'mdc-dialog__actions': !this.hideActions,\n };\n return html `\n
\n
\n
\n ${heading}\n
\n \n
\n \n \n \n \n \n \n \n \n
\n
\n
\n
`;\n }\n renderHeading() {\n return html `\n

${this.heading}

`;\n }\n firstUpdated() {\n super.firstUpdated();\n this.mdcFoundation.setAutoStackButtons(true);\n if (this.initialSupressDefaultPressSelector) {\n this.suppressDefaultPressSelector =\n this.initialSupressDefaultPressSelector;\n }\n else {\n this.suppressDefaultPressSelector = [\n this.suppressDefaultPressSelector, 'mwc-textarea',\n 'mwc-menu mwc-list-item', 'mwc-select mwc-list-item'\n ].join(', ');\n }\n this.boundHandleClick = this.mdcFoundation.handleClick.bind(this.mdcFoundation);\n this.boundHandleKeydown = this.mdcFoundation.handleKeydown.bind(this.mdcFoundation);\n this.boundHandleDocumentKeydown =\n this.mdcFoundation.handleDocumentKeydown.bind(this.mdcFoundation);\n }\n connectedCallback() {\n super.connectedCallback();\n if (this.open && this.mdcFoundation && !this.mdcFoundation.isOpen()) {\n // We probably got disconnected while we were still open. Re-open,\n // matching the behavior of native .\n this.setEventListeners();\n this.mdcFoundation.open();\n }\n }\n disconnectedCallback() {\n super.disconnectedCallback();\n if (this.open && this.mdcFoundation) {\n // If this dialog is opened and then disconnected, we want to close\n // the foundation, so that 1) any pending timers are cancelled\n // (in particular for trapFocus), and 2) if we reconnect, we can open\n // the foundation again to retrigger animations and focus.\n this.removeEventListeners();\n this.closingDueToDisconnect = true;\n this.mdcFoundation.close(this.currentAction || this.defaultAction);\n this.closingDueToDisconnect = false;\n this.currentAction = undefined;\n // When we close normally, the releaseFocus callback handles removing\n // ourselves from the blocking elements stack. However, that callback\n // happens on a delay, and when we are closing due to a disconnect we\n // need to remove ourselves before the blocking element polyfill's\n // mutation observer notices and logs a warning, since it's not valid to\n // be in the blocking elements stack while disconnected.\n blockingElements.remove(this);\n }\n }\n forceLayout() {\n this.mdcFoundation.layout();\n }\n focus() {\n const initialFocusEl = this.getInitialFocusEl();\n initialFocusEl && initialFocusEl.focus();\n }\n blur() {\n if (!this.shadowRoot) {\n return;\n }\n const activeEl = this.shadowRoot.activeElement;\n if (activeEl) {\n if (activeEl instanceof HTMLElement) {\n activeEl.blur();\n }\n }\n else {\n const root = this.getRootNode();\n const activeEl = root instanceof Document ? root.activeElement : null;\n if (activeEl instanceof HTMLElement) {\n activeEl.blur();\n }\n }\n }\n setEventListeners() {\n if (this.boundHandleClick) {\n this.mdcRoot.addEventListener('click', this.boundHandleClick);\n }\n if (this.boundHandleKeydown) {\n this.mdcRoot.addEventListener('keydown', this.boundHandleKeydown, applyPassive());\n }\n if (this.boundHandleDocumentKeydown) {\n document.addEventListener('keydown', this.boundHandleDocumentKeydown, applyPassive());\n }\n }\n removeEventListeners() {\n if (this.boundHandleClick) {\n this.mdcRoot.removeEventListener('click', this.boundHandleClick);\n }\n if (this.boundHandleKeydown) {\n this.mdcRoot.removeEventListener('keydown', this.boundHandleKeydown);\n }\n if (this.boundHandleDocumentKeydown) {\n document.removeEventListener('keydown', this.boundHandleDocumentKeydown);\n }\n }\n close() {\n this.open = false;\n }\n show() {\n this.open = true;\n }\n}\n__decorate([\n query('.mdc-dialog')\n], DialogBase.prototype, \"mdcRoot\", void 0);\n__decorate([\n query('slot[name=\"primaryAction\"]')\n], DialogBase.prototype, \"primarySlot\", void 0);\n__decorate([\n query('slot[name=\"secondaryAction\"]')\n], DialogBase.prototype, \"secondarySlot\", void 0);\n__decorate([\n query('#contentSlot')\n], DialogBase.prototype, \"contentSlot\", void 0);\n__decorate([\n query('.mdc-dialog__content')\n], DialogBase.prototype, \"contentElement\", void 0);\n__decorate([\n query('.mdc-container')\n], DialogBase.prototype, \"conatinerElement\", void 0);\n__decorate([\n property({ type: Boolean })\n], DialogBase.prototype, \"hideActions\", void 0);\n__decorate([\n property({ type: Boolean }),\n observer(function () {\n this.forceLayout();\n })\n], DialogBase.prototype, \"stacked\", void 0);\n__decorate([\n property({ type: String })\n], DialogBase.prototype, \"heading\", void 0);\n__decorate([\n property({ type: String }),\n observer(function (newAction) {\n this.mdcFoundation.setScrimClickAction(newAction);\n })\n], DialogBase.prototype, \"scrimClickAction\", void 0);\n__decorate([\n property({ type: String }),\n observer(function (newAction) {\n this.mdcFoundation.setEscapeKeyAction(newAction);\n })\n], DialogBase.prototype, \"escapeKeyAction\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true }),\n observer(function (isOpen) {\n // Check isConnected because we could have been disconnected before first\n // update. If we're now closed, then we shouldn't start the MDC foundation\n // opening animation. If we're now closed, then we've already closed the\n // foundation in disconnectedCallback.\n if (this.mdcFoundation && this.isConnected) {\n if (isOpen) {\n this.setEventListeners();\n this.mdcFoundation.open();\n }\n else {\n this.removeEventListeners();\n this.mdcFoundation.close(this.currentAction || this.defaultAction);\n this.currentAction = undefined;\n }\n }\n })\n], DialogBase.prototype, \"open\", void 0);\n__decorate([\n property()\n], DialogBase.prototype, \"defaultAction\", void 0);\n__decorate([\n property()\n], DialogBase.prototype, \"actionAttribute\", void 0);\n__decorate([\n property()\n], DialogBase.prototype, \"initialFocusAttribute\", void 0);\n//# sourceMappingURL=mwc-dialog-base.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-LIcense-Identifier: Apache-2.0\n */\nimport { css } from 'lit';\nexport const styles = css `.mdc-dialog .mdc-dialog__surface{background-color:#fff;background-color:var(--mdc-theme-surface, #fff)}.mdc-dialog .mdc-dialog__scrim{background-color:rgba(0,0,0,.32)}.mdc-dialog .mdc-dialog__surface-scrim{background-color:rgba(0,0,0,.32)}.mdc-dialog .mdc-dialog__title{color:rgba(0,0,0,.87)}.mdc-dialog .mdc-dialog__content{color:rgba(0,0,0,.6)}.mdc-dialog .mdc-dialog__close{color:#000;color:var(--mdc-theme-on-surface, #000)}.mdc-dialog .mdc-dialog__close .mdc-icon-button__ripple::before,.mdc-dialog .mdc-dialog__close .mdc-icon-button__ripple::after{background-color:#000;background-color:var(--mdc-ripple-color, var(--mdc-theme-on-surface, #000))}.mdc-dialog .mdc-dialog__close:hover .mdc-icon-button__ripple::before,.mdc-dialog .mdc-dialog__close.mdc-ripple-surface--hover .mdc-icon-button__ripple::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-dialog .mdc-dialog__close.mdc-ripple-upgraded--background-focused .mdc-icon-button__ripple::before,.mdc-dialog .mdc-dialog__close:not(.mdc-ripple-upgraded):focus .mdc-icon-button__ripple::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-dialog .mdc-dialog__close:not(.mdc-ripple-upgraded) .mdc-icon-button__ripple::after{transition:opacity 150ms linear}.mdc-dialog .mdc-dialog__close:not(.mdc-ripple-upgraded):active .mdc-icon-button__ripple::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-dialog .mdc-dialog__close.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-dialog.mdc-dialog--scrollable .mdc-dialog__title,.mdc-dialog.mdc-dialog--scrollable .mdc-dialog__actions,.mdc-dialog.mdc-dialog--scrollable.mdc-dialog-scroll-divider-footer .mdc-dialog__actions{border-color:rgba(0,0,0,.12)}.mdc-dialog.mdc-dialog--scrollable .mdc-dialog__title{border-bottom:1px solid rgba(0,0,0,.12);margin-bottom:0}.mdc-dialog.mdc-dialog-scroll-divider-header.mdc-dialog--fullscreen .mdc-dialog__header{box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2),0px 2px 2px 0px rgba(0, 0, 0, 0.14),0px 1px 5px 0px rgba(0,0,0,.12)}.mdc-dialog .mdc-dialog__surface{border-radius:4px;border-radius:var(--mdc-shape-medium, 4px)}.mdc-dialog__surface{box-shadow:0px 11px 15px -7px rgba(0, 0, 0, 0.2),0px 24px 38px 3px rgba(0, 0, 0, 0.14),0px 9px 46px 8px rgba(0,0,0,.12)}.mdc-dialog__title{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-headline6-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1.25rem;font-size:var(--mdc-typography-headline6-font-size, 1.25rem);line-height:2rem;line-height:var(--mdc-typography-headline6-line-height, 2rem);font-weight:500;font-weight:var(--mdc-typography-headline6-font-weight, 500);letter-spacing:0.0125em;letter-spacing:var(--mdc-typography-headline6-letter-spacing, 0.0125em);text-decoration:inherit;text-decoration:var(--mdc-typography-headline6-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-headline6-text-transform, inherit)}.mdc-dialog__content{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-body1-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1rem;font-size:var(--mdc-typography-body1-font-size, 1rem);line-height:1.5rem;line-height:var(--mdc-typography-body1-line-height, 1.5rem);font-weight:400;font-weight:var(--mdc-typography-body1-font-weight, 400);letter-spacing:0.03125em;letter-spacing:var(--mdc-typography-body1-letter-spacing, 0.03125em);text-decoration:inherit;text-decoration:var(--mdc-typography-body1-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-body1-text-transform, inherit)}.mdc-elevation-overlay{position:absolute;border-radius:inherit;pointer-events:none;opacity:0;opacity:var(--mdc-elevation-overlay-opacity, 0);transition:opacity 280ms cubic-bezier(0.4, 0, 0.2, 1);background-color:#fff;background-color:var(--mdc-elevation-overlay-color, #fff)}.mdc-dialog,.mdc-dialog__scrim{position:fixed;top:0;left:0;align-items:center;justify-content:center;box-sizing:border-box;width:100%;height:100%}.mdc-dialog{display:none;z-index:7;z-index:var(--mdc-dialog-z-index, 7)}.mdc-dialog .mdc-dialog__content{padding:20px 24px 20px 24px}.mdc-dialog .mdc-dialog__surface{min-width:280px}@media(max-width: 592px){.mdc-dialog .mdc-dialog__surface{max-width:calc(100vw - 32px)}}@media(min-width: 592px){.mdc-dialog .mdc-dialog__surface{max-width:560px}}.mdc-dialog .mdc-dialog__surface{max-height:calc(100% - 32px)}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{max-width:none}@media(max-width: 960px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{max-height:560px;width:560px}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{right:-12px}}@media(max-width: 720px)and (max-width: 672px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{width:calc(100vw - 112px)}}@media(max-width: 720px)and (min-width: 672px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{width:560px}}@media(max-width: 720px)and (max-height: 720px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{max-height:calc(100vh - 160px)}}@media(max-width: 720px)and (min-height: 720px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{max-height:560px}}@media(max-width: 720px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{right:-12px}}@media(max-width: 720px)and (max-height: 400px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{height:100%;max-height:100vh;max-width:100vw;width:100vw;border-radius:0}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{order:-1;left:-12px}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__header{padding:0 16px 9px;justify-content:flex-start}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__title{margin-left:calc(16px - 2 * 12px)}}@media(max-width: 600px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{height:100%;max-height:100vh;max-width:100vw;width:100vw;border-radius:0}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{order:-1;left:-12px}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__header{padding:0 16px 9px;justify-content:flex-start}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__title{margin-left:calc(16px - 2 * 12px)}}@media(min-width: 960px){.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface{width:calc(100vw - 400px)}.mdc-dialog.mdc-dialog--fullscreen .mdc-dialog__surface .mdc-dialog__close{right:-12px}}.mdc-dialog.mdc-dialog__scrim--hidden .mdc-dialog__scrim{opacity:0}.mdc-dialog__scrim{opacity:0;z-index:-1}.mdc-dialog__container{display:flex;flex-direction:row;align-items:center;justify-content:space-around;box-sizing:border-box;height:100%;transform:scale(0.8);opacity:0;pointer-events:none}.mdc-dialog__surface{position:relative;display:flex;flex-direction:column;flex-grow:0;flex-shrink:0;box-sizing:border-box;max-width:100%;max-height:100%;pointer-events:auto;overflow-y:auto}.mdc-dialog__surface .mdc-elevation-overlay{width:100%;height:100%;top:0;left:0}[dir=rtl] .mdc-dialog__surface,.mdc-dialog__surface[dir=rtl]{text-align:right}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-dialog__surface{outline:2px solid windowText}}.mdc-dialog__surface::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:2px solid transparent;border-radius:inherit;content:\"\";pointer-events:none}@media screen and (forced-colors: active){.mdc-dialog__surface::before{border-color:CanvasText}}@media screen and (-ms-high-contrast: active),screen and (-ms-high-contrast: none){.mdc-dialog__surface::before{content:none}}.mdc-dialog__title{display:block;margin-top:0;position:relative;flex-shrink:0;box-sizing:border-box;margin:0 0 1px;padding:0 24px 9px}.mdc-dialog__title::before{display:inline-block;width:0;height:40px;content:\"\";vertical-align:0}[dir=rtl] .mdc-dialog__title,.mdc-dialog__title[dir=rtl]{text-align:right}.mdc-dialog--scrollable .mdc-dialog__title{margin-bottom:1px;padding-bottom:15px}.mdc-dialog--fullscreen .mdc-dialog__header{align-items:baseline;border-bottom:1px solid transparent;display:inline-flex;justify-content:space-between;padding:0 24px 9px;z-index:1}@media screen and (forced-colors: active){.mdc-dialog--fullscreen .mdc-dialog__header{border-bottom-color:CanvasText}}.mdc-dialog--fullscreen .mdc-dialog__header .mdc-dialog__close{right:-12px}.mdc-dialog--fullscreen .mdc-dialog__title{margin-bottom:0;padding:0;border-bottom:0}.mdc-dialog--fullscreen.mdc-dialog--scrollable .mdc-dialog__title{border-bottom:0;margin-bottom:0}.mdc-dialog--fullscreen .mdc-dialog__close{top:5px}.mdc-dialog--fullscreen.mdc-dialog--scrollable .mdc-dialog__actions{border-top:1px solid transparent}@media screen and (forced-colors: active){.mdc-dialog--fullscreen.mdc-dialog--scrollable .mdc-dialog__actions{border-top-color:CanvasText}}.mdc-dialog__content{flex-grow:1;box-sizing:border-box;margin:0;overflow:auto}.mdc-dialog__content>:first-child{margin-top:0}.mdc-dialog__content>:last-child{margin-bottom:0}.mdc-dialog__title+.mdc-dialog__content,.mdc-dialog__header+.mdc-dialog__content{padding-top:0}.mdc-dialog--scrollable .mdc-dialog__title+.mdc-dialog__content{padding-top:8px;padding-bottom:8px}.mdc-dialog__content .mdc-deprecated-list:first-child:last-child{padding:6px 0 0}.mdc-dialog--scrollable .mdc-dialog__content .mdc-deprecated-list:first-child:last-child{padding:0}.mdc-dialog__actions{display:flex;position:relative;flex-shrink:0;flex-wrap:wrap;align-items:center;justify-content:flex-end;box-sizing:border-box;min-height:52px;margin:0;padding:8px;border-top:1px solid transparent}@media screen and (forced-colors: active){.mdc-dialog__actions{border-top-color:CanvasText}}.mdc-dialog--stacked .mdc-dialog__actions{flex-direction:column;align-items:flex-end}.mdc-dialog__button{margin-left:8px;margin-right:0;max-width:100%;text-align:right}[dir=rtl] .mdc-dialog__button,.mdc-dialog__button[dir=rtl]{margin-left:0;margin-right:8px}.mdc-dialog__button:first-child{margin-left:0;margin-right:0}[dir=rtl] .mdc-dialog__button:first-child,.mdc-dialog__button:first-child[dir=rtl]{margin-left:0;margin-right:0}[dir=rtl] .mdc-dialog__button,.mdc-dialog__button[dir=rtl]{text-align:left}.mdc-dialog--stacked .mdc-dialog__button:not(:first-child){margin-top:12px}.mdc-dialog--open,.mdc-dialog--opening,.mdc-dialog--closing{display:flex}.mdc-dialog--opening .mdc-dialog__scrim{transition:opacity 150ms linear}.mdc-dialog--opening .mdc-dialog__container{transition:opacity 75ms linear,transform 150ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-dialog--closing .mdc-dialog__scrim,.mdc-dialog--closing .mdc-dialog__container{transition:opacity 75ms linear}.mdc-dialog--closing .mdc-dialog__container{transform:none}.mdc-dialog--open .mdc-dialog__scrim{opacity:1}.mdc-dialog--open .mdc-dialog__container{transform:none;opacity:1}.mdc-dialog--open.mdc-dialog__surface-scrim--shown .mdc-dialog__surface-scrim{opacity:1;z-index:1}.mdc-dialog--open.mdc-dialog__surface-scrim--hiding .mdc-dialog__surface-scrim{transition:opacity 75ms linear}.mdc-dialog--open.mdc-dialog__surface-scrim--showing .mdc-dialog__surface-scrim{transition:opacity 150ms linear}.mdc-dialog__surface-scrim{display:none;opacity:0;position:absolute;width:100%;height:100%}.mdc-dialog__surface-scrim--shown .mdc-dialog__surface-scrim,.mdc-dialog__surface-scrim--showing .mdc-dialog__surface-scrim,.mdc-dialog__surface-scrim--hiding .mdc-dialog__surface-scrim{display:block}.mdc-dialog-scroll-lock{overflow:hidden}.mdc-dialog--no-content-padding .mdc-dialog__content{padding:0}.mdc-dialog--sheet .mdc-dialog__close{right:12px;top:9px;position:absolute;z-index:1}#actions:not(.mdc-dialog__actions){display:none}.mdc-dialog__surface{box-shadow:var(--mdc-dialog-box-shadow, 0px 11px 15px -7px rgba(0, 0, 0, 0.2), 0px 24px 38px 3px rgba(0, 0, 0, 0.14), 0px 9px 46px 8px rgba(0, 0, 0, 0.12))}@media(min-width: 560px){.mdc-dialog .mdc-dialog__surface{max-width:560px;max-width:var(--mdc-dialog-max-width, 560px)}}.mdc-dialog .mdc-dialog__scrim{background-color:rgba(0, 0, 0, 0.32);background-color:var(--mdc-dialog-scrim-color, rgba(0, 0, 0, 0.32))}.mdc-dialog .mdc-dialog__title{color:rgba(0, 0, 0, 0.87);color:var(--mdc-dialog-heading-ink-color, rgba(0, 0, 0, 0.87))}.mdc-dialog .mdc-dialog__content{color:rgba(0, 0, 0, 0.6);color:var(--mdc-dialog-content-ink-color, rgba(0, 0, 0, 0.6))}.mdc-dialog.mdc-dialog--scrollable .mdc-dialog__title,.mdc-dialog.mdc-dialog--scrollable .mdc-dialog__actions{border-color:rgba(0, 0, 0, 0.12);border-color:var(--mdc-dialog-scroll-divider-color, rgba(0, 0, 0, 0.12))}.mdc-dialog .mdc-dialog__surface{min-width:280px;min-width:var(--mdc-dialog-min-width, 280px)}.mdc-dialog .mdc-dialog__surface{max-height:var(--mdc-dialog-max-height, calc(100% - 32px))}#actions ::slotted(*){margin-left:8px;margin-right:0;max-width:100%;text-align:right}[dir=rtl] #actions ::slotted(*),#actions ::slotted(*[dir=rtl]){margin-left:0;margin-right:8px}[dir=rtl] #actions ::slotted(*),#actions ::slotted(*[dir=rtl]){text-align:left}.mdc-dialog--stacked #actions{flex-direction:column-reverse}.mdc-dialog--stacked #actions *:not(:last-child) ::slotted(*){flex-basis:.000000001px;margin-top:12px}`;\n//# sourceMappingURL=mwc-dialog.css.js.map","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { customElement } from 'lit/decorators.js';\nimport { DialogBase } from './mwc-dialog-base.js';\nimport { styles } from './mwc-dialog.css.js';\nlet Dialog = class Dialog extends DialogBase {\n};\nDialog.styles = [styles];\nDialog = __decorate([\n customElement('mwc-dialog')\n], Dialog);\nexport { Dialog };\n//# sourceMappingURL=mwc-dialog.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-LIcense-Identifier: Apache-2.0\n */\nimport { css } from 'lit';\nexport const styles = css `:host{font-family:var(--mdc-icon-font, \"Material Icons\");font-weight:normal;font-style:normal;font-size:var(--mdc-icon-size, 24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}`;\n//# sourceMappingURL=mwc-icon-host.css.js.map","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { html, LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { styles } from './mwc-icon-host.css.js';\n/** @soyCompatible */\nlet Icon = class Icon extends LitElement {\n /** @soyTemplate */\n render() {\n return html ``;\n }\n};\nIcon.styles = [styles];\nIcon = __decorate([\n customElement('mwc-icon')\n], Icon);\nexport { Icon };\n//# sourceMappingURL=mwc-icon.js.map","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport '@material/mwc-icon/mwc-icon.js';\nimport '@material/mwc-ripple/mwc-ripple.js';\nimport { ariaProperty } from '@material/mwc-base/aria-property.js';\nimport { RippleHandlers } from '@material/mwc-ripple/ripple-handlers.js';\nimport { html, LitElement } from 'lit';\nimport { eventOptions, property, query, queryAsync, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n/** @soyCompatible */\nexport class ButtonBase extends LitElement {\n constructor() {\n super(...arguments);\n this.raised = false;\n this.unelevated = false;\n this.outlined = false;\n this.dense = false;\n this.disabled = false;\n this.trailingIcon = false;\n this.fullwidth = false;\n this.icon = '';\n this.label = '';\n this.expandContent = false;\n this.shouldRenderRipple = false;\n this.rippleHandlers = new RippleHandlers(() => {\n this.shouldRenderRipple = true;\n return this.ripple;\n });\n }\n /** @soyTemplate */\n renderOverlay() {\n return html ``;\n }\n /** @soyTemplate */\n renderRipple() {\n const filled = this.raised || this.unelevated;\n return this.shouldRenderRipple ?\n html `` :\n '';\n }\n focus() {\n const buttonElement = this.buttonElement;\n if (buttonElement) {\n this.rippleHandlers.startFocus();\n buttonElement.focus();\n }\n }\n blur() {\n const buttonElement = this.buttonElement;\n if (buttonElement) {\n this.rippleHandlers.endFocus();\n buttonElement.blur();\n }\n }\n /** @soyTemplate */\n getRenderClasses() {\n return {\n 'mdc-button--raised': this.raised,\n 'mdc-button--unelevated': this.unelevated,\n 'mdc-button--outlined': this.outlined,\n 'mdc-button--dense': this.dense,\n };\n }\n /**\n * @soyTemplate\n * @soyAttributes buttonAttributes: #button\n * @soyClasses buttonClasses: #button\n */\n render() {\n return html `\n \n ${this.renderOverlay()}\n ${this.renderRipple()}\n \n \n ${this.icon && !this.trailingIcon ? this.renderIcon() : ''}\n \n \n ${this.label}\n \n \n \n \n \n ${this.icon && this.trailingIcon ? this.renderIcon() : ''}\n \n \n `;\n }\n /** @soyTemplate */\n renderIcon() {\n return html `\n \n ${this.icon}\n `;\n }\n handleRippleActivate(evt) {\n const onUp = () => {\n window.removeEventListener('mouseup', onUp);\n this.handleRippleDeactivate();\n };\n window.addEventListener('mouseup', onUp);\n this.rippleHandlers.startPress(evt);\n }\n handleRippleDeactivate() {\n this.rippleHandlers.endPress();\n }\n handleRippleMouseEnter() {\n this.rippleHandlers.startHover();\n }\n handleRippleMouseLeave() {\n this.rippleHandlers.endHover();\n }\n handleRippleFocus() {\n this.rippleHandlers.startFocus();\n }\n handleRippleBlur() {\n this.rippleHandlers.endFocus();\n }\n}\nButtonBase.shadowRootOptions = { mode: 'open', delegatesFocus: true };\n__decorate([\n ariaProperty,\n property({ type: String, attribute: 'aria-haspopup' })\n], ButtonBase.prototype, \"ariaHasPopup\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true })\n], ButtonBase.prototype, \"raised\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true })\n], ButtonBase.prototype, \"unelevated\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true })\n], ButtonBase.prototype, \"outlined\", void 0);\n__decorate([\n property({ type: Boolean })\n], ButtonBase.prototype, \"dense\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true })\n], ButtonBase.prototype, \"disabled\", void 0);\n__decorate([\n property({ type: Boolean, attribute: 'trailingicon' })\n], ButtonBase.prototype, \"trailingIcon\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true })\n], ButtonBase.prototype, \"fullwidth\", void 0);\n__decorate([\n property({ type: String })\n], ButtonBase.prototype, \"icon\", void 0);\n__decorate([\n property({ type: String })\n], ButtonBase.prototype, \"label\", void 0);\n__decorate([\n property({ type: Boolean })\n], ButtonBase.prototype, \"expandContent\", void 0);\n__decorate([\n query('#button')\n], ButtonBase.prototype, \"buttonElement\", void 0);\n__decorate([\n queryAsync('mwc-ripple')\n], ButtonBase.prototype, \"ripple\", void 0);\n__decorate([\n state()\n], ButtonBase.prototype, \"shouldRenderRipple\", void 0);\n__decorate([\n eventOptions({ passive: true })\n], ButtonBase.prototype, \"handleRippleActivate\", null);\n//# sourceMappingURL=mwc-button-base.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-LIcense-Identifier: Apache-2.0\n */\nimport { css } from 'lit';\nexport const styles = css `.mdc-button{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-button-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.875rem;font-size:var(--mdc-typography-button-font-size, 0.875rem);line-height:2.25rem;line-height:var(--mdc-typography-button-line-height, 2.25rem);font-weight:500;font-weight:var(--mdc-typography-button-font-weight, 500);letter-spacing:0.0892857143em;letter-spacing:var(--mdc-typography-button-letter-spacing, 0.0892857143em);text-decoration:none;text-decoration:var(--mdc-typography-button-text-decoration, none);text-transform:uppercase;text-transform:var(--mdc-typography-button-text-transform, uppercase)}.mdc-touch-target-wrapper{display:inline}.mdc-elevation-overlay{position:absolute;border-radius:inherit;pointer-events:none;opacity:0;opacity:var(--mdc-elevation-overlay-opacity, 0);transition:opacity 280ms cubic-bezier(0.4, 0, 0.2, 1);background-color:#fff;background-color:var(--mdc-elevation-overlay-color, #fff)}.mdc-button{position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:64px;border:none;outline:none;line-height:inherit;user-select:none;-webkit-appearance:none;overflow:visible;vertical-align:middle;background:transparent}.mdc-button .mdc-elevation-overlay{width:100%;height:100%;top:0;left:0}.mdc-button::-moz-focus-inner{padding:0;border:0}.mdc-button:active{outline:none}.mdc-button:hover{cursor:pointer}.mdc-button:disabled{cursor:default;pointer-events:none}.mdc-button .mdc-button__icon{margin-left:0;margin-right:8px;display:inline-block;position:relative;vertical-align:top}[dir=rtl] .mdc-button .mdc-button__icon,.mdc-button .mdc-button__icon[dir=rtl]{margin-left:8px;margin-right:0}.mdc-button .mdc-button__label{position:relative}.mdc-button .mdc-button__focus-ring{display:none}@media screen and (forced-colors: active){.mdc-button.mdc-ripple-upgraded--background-focused .mdc-button__focus-ring,.mdc-button:not(.mdc-ripple-upgraded):focus .mdc-button__focus-ring{pointer-events:none;border:2px solid transparent;border-radius:6px;box-sizing:content-box;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);height:calc( 100% + 4px );width:calc( 100% + 4px );display:block}}@media screen and (forced-colors: active)and (forced-colors: active){.mdc-button.mdc-ripple-upgraded--background-focused .mdc-button__focus-ring,.mdc-button:not(.mdc-ripple-upgraded):focus .mdc-button__focus-ring{border-color:CanvasText}}@media screen and (forced-colors: active){.mdc-button.mdc-ripple-upgraded--background-focused .mdc-button__focus-ring::after,.mdc-button:not(.mdc-ripple-upgraded):focus .mdc-button__focus-ring::after{content:\"\";border:2px solid transparent;border-radius:8px;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);height:calc(100% + 4px);width:calc(100% + 4px)}}@media screen and (forced-colors: active)and (forced-colors: active){.mdc-button.mdc-ripple-upgraded--background-focused .mdc-button__focus-ring::after,.mdc-button:not(.mdc-ripple-upgraded):focus .mdc-button__focus-ring::after{border-color:CanvasText}}.mdc-button .mdc-button__touch{position:absolute;top:50%;height:48px;left:0;right:0;transform:translateY(-50%)}.mdc-button__label+.mdc-button__icon{margin-left:8px;margin-right:0}[dir=rtl] .mdc-button__label+.mdc-button__icon,.mdc-button__label+.mdc-button__icon[dir=rtl]{margin-left:0;margin-right:8px}svg.mdc-button__icon{fill:currentColor}.mdc-button--touch{margin-top:6px;margin-bottom:6px}.mdc-button{padding:0 8px 0 8px}.mdc-button--unelevated{transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);padding:0 16px 0 16px}.mdc-button--unelevated.mdc-button--icon-trailing{padding:0 12px 0 16px}.mdc-button--unelevated.mdc-button--icon-leading{padding:0 16px 0 12px}.mdc-button--raised{transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);padding:0 16px 0 16px}.mdc-button--raised.mdc-button--icon-trailing{padding:0 12px 0 16px}.mdc-button--raised.mdc-button--icon-leading{padding:0 16px 0 12px}.mdc-button--outlined{border-style:solid;transition:border 280ms cubic-bezier(0.4, 0, 0.2, 1)}.mdc-button--outlined .mdc-button__ripple{border-style:solid;border-color:transparent}.mdc-button{height:36px;border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button:not(:disabled){color:#6200ee;color:var(--mdc-theme-primary, #6200ee)}.mdc-button:disabled{color:rgba(0, 0, 0, 0.38)}.mdc-button .mdc-button__icon{font-size:1.125rem;width:1.125rem;height:1.125rem}.mdc-button .mdc-button__ripple{border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button--raised,.mdc-button--unelevated{height:36px;border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button--raised:not(:disabled),.mdc-button--unelevated:not(:disabled){background-color:#6200ee;background-color:var(--mdc-theme-primary, #6200ee)}.mdc-button--raised:disabled,.mdc-button--unelevated:disabled{background-color:rgba(0, 0, 0, 0.12)}.mdc-button--raised:not(:disabled),.mdc-button--unelevated:not(:disabled){color:#fff;color:var(--mdc-theme-on-primary, #fff)}.mdc-button--raised:disabled,.mdc-button--unelevated:disabled{color:rgba(0, 0, 0, 0.38)}.mdc-button--raised .mdc-button__icon,.mdc-button--unelevated .mdc-button__icon{font-size:1.125rem;width:1.125rem;height:1.125rem}.mdc-button--raised .mdc-button__ripple,.mdc-button--unelevated .mdc-button__ripple{border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button--outlined{height:36px;border-radius:4px;border-radius:var(--mdc-shape-small, 4px);padding:0 15px 0 15px;border-width:1px}.mdc-button--outlined:not(:disabled){color:#6200ee;color:var(--mdc-theme-primary, #6200ee)}.mdc-button--outlined:disabled{color:rgba(0, 0, 0, 0.38)}.mdc-button--outlined .mdc-button__icon{font-size:1.125rem;width:1.125rem;height:1.125rem}.mdc-button--outlined .mdc-button__ripple{border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button--outlined:not(:disabled){border-color:rgba(0, 0, 0, 0.12)}.mdc-button--outlined:disabled{border-color:rgba(0, 0, 0, 0.12)}.mdc-button--outlined.mdc-button--icon-trailing{padding:0 11px 0 15px}.mdc-button--outlined.mdc-button--icon-leading{padding:0 15px 0 11px}.mdc-button--outlined .mdc-button__ripple{top:-1px;left:-1px;bottom:-1px;right:-1px;border-width:1px}.mdc-button--outlined .mdc-button__touch{left:calc(-1 * 1px);width:calc(100% + 2 * 1px)}.mdc-button--raised{box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2),0px 2px 2px 0px rgba(0, 0, 0, 0.14),0px 1px 5px 0px rgba(0,0,0,.12);transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1)}.mdc-button--raised:hover,.mdc-button--raised:focus{box-shadow:0px 2px 4px -1px rgba(0, 0, 0, 0.2),0px 4px 5px 0px rgba(0, 0, 0, 0.14),0px 1px 10px 0px rgba(0,0,0,.12)}.mdc-button--raised:active{box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2),0px 8px 10px 1px rgba(0, 0, 0, 0.14),0px 3px 14px 2px rgba(0,0,0,.12)}.mdc-button--raised:disabled{box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.2),0px 0px 0px 0px rgba(0, 0, 0, 0.14),0px 0px 0px 0px rgba(0,0,0,.12)}:host{display:inline-flex;outline:none;-webkit-tap-highlight-color:transparent;vertical-align:top}:host([fullwidth]){width:100%}:host([raised]),:host([unelevated]){--mdc-ripple-color:#fff;--mdc-ripple-focus-opacity:0.24;--mdc-ripple-hover-opacity:0.08;--mdc-ripple-press-opacity:0.24}.trailing-icon ::slotted(*),.trailing-icon .mdc-button__icon,.leading-icon ::slotted(*),.leading-icon .mdc-button__icon{margin-left:0;margin-right:8px;display:inline-block;position:relative;vertical-align:top;font-size:1.125rem;height:1.125rem;width:1.125rem}[dir=rtl] .trailing-icon ::slotted(*),[dir=rtl] .trailing-icon .mdc-button__icon,[dir=rtl] .leading-icon ::slotted(*),[dir=rtl] .leading-icon .mdc-button__icon,.trailing-icon ::slotted(*[dir=rtl]),.trailing-icon .mdc-button__icon[dir=rtl],.leading-icon ::slotted(*[dir=rtl]),.leading-icon .mdc-button__icon[dir=rtl]{margin-left:8px;margin-right:0}.trailing-icon ::slotted(*),.trailing-icon .mdc-button__icon{margin-left:8px;margin-right:0}[dir=rtl] .trailing-icon ::slotted(*),[dir=rtl] .trailing-icon .mdc-button__icon,.trailing-icon ::slotted(*[dir=rtl]),.trailing-icon .mdc-button__icon[dir=rtl]{margin-left:0;margin-right:8px}.slot-container{display:inline-flex;align-items:center;justify-content:center}.slot-container.flex{flex:auto}.mdc-button{flex:auto;overflow:hidden;padding-left:8px;padding-left:var(--mdc-button-horizontal-padding, 8px);padding-right:8px;padding-right:var(--mdc-button-horizontal-padding, 8px)}.mdc-button--raised{box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12))}.mdc-button--raised:focus{box-shadow:0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-focus, var(--mdc-button-raised-box-shadow-hover, 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12)))}.mdc-button--raised:hover{box-shadow:0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-hover, 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12))}.mdc-button--raised:active{box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-active, 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12))}.mdc-button--raised:disabled{box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-disabled, 0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12))}.mdc-button--raised,.mdc-button--unelevated{padding-left:16px;padding-left:var(--mdc-button-horizontal-padding, 16px);padding-right:16px;padding-right:var(--mdc-button-horizontal-padding, 16px)}.mdc-button--outlined{border-width:1px;border-width:var(--mdc-button-outline-width, 1px);padding-left:calc(16px - 1px);padding-left:calc(var(--mdc-button-horizontal-padding, 16px) - var(--mdc-button-outline-width, 1px));padding-right:calc(16px - 1px);padding-right:calc(var(--mdc-button-horizontal-padding, 16px) - var(--mdc-button-outline-width, 1px))}.mdc-button--outlined:not(:disabled){border-color:rgba(0, 0, 0, 0.12);border-color:var(--mdc-button-outline-color, rgba(0, 0, 0, 0.12))}.mdc-button--outlined .ripple{top:calc(-1 * 1px);top:calc(-1 * var(--mdc-button-outline-width, 1px));left:calc(-1 * 1px);left:calc(-1 * var(--mdc-button-outline-width, 1px));right:initial;right:initial;border-width:1px;border-width:var(--mdc-button-outline-width, 1px);border-style:solid;border-color:transparent}[dir=rtl] .mdc-button--outlined .ripple,.mdc-button--outlined .ripple[dir=rtl]{left:initial;left:initial;right:calc(-1 * 1px);right:calc(-1 * var(--mdc-button-outline-width, 1px))}.mdc-button--dense{height:28px;margin-top:0;margin-bottom:0}.mdc-button--dense .mdc-button__touch{height:100%}:host([disabled]){pointer-events:none}:host([disabled]) .mdc-button{color:rgba(0, 0, 0, 0.38);color:var(--mdc-button-disabled-ink-color, rgba(0, 0, 0, 0.38))}:host([disabled]) .mdc-button--raised,:host([disabled]) .mdc-button--unelevated{background-color:rgba(0, 0, 0, 0.12);background-color:var(--mdc-button-disabled-fill-color, rgba(0, 0, 0, 0.12))}:host([disabled]) .mdc-button--outlined{border-color:rgba(0, 0, 0, 0.12);border-color:var(--mdc-button-disabled-outline-color, rgba(0, 0, 0, 0.12))}`;\n//# sourceMappingURL=styles.css.js.map","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { customElement } from 'lit/decorators.js';\nimport { ButtonBase } from './mwc-button-base.js';\nimport { styles } from './styles.css.js';\n/** @soyCompatible */\nlet Button = class Button extends ButtonBase {\n};\nButton.styles = [styles];\nButton = __decorate([\n customElement('mwc-button')\n], Button);\nexport { Button };\n//# sourceMappingURL=mwc-button.js.map","export function isComplex(edit) {\n return edit instanceof Array;\n}\nexport function isInsert(edit) {\n return edit.parent !== undefined;\n}\nexport function isNamespaced(value) {\n return value !== null && typeof value !== 'string';\n}\nexport function isUpdate(edit) {\n return edit.element !== undefined;\n}\nexport function isRemove(edit) {\n return (edit.parent === undefined && edit.node !== undefined);\n}\nexport function newEditEvent(edit) {\n return new CustomEvent('oscd-edit', {\n composed: true,\n bubbles: true,\n detail: edit,\n });\n}\n/** EDIT HANDLING */\nfunction localAttributeName(attribute) {\n return attribute.includes(':') ? attribute.split(':', 2)[1] : attribute;\n}\nfunction handleInsert({ parent, node, reference, }) {\n try {\n const { parentNode, nextSibling } = node;\n parent.insertBefore(node, reference);\n if (parentNode)\n return {\n node,\n parent: parentNode,\n reference: nextSibling,\n };\n return { node };\n }\n catch (e) {\n // do nothing if insert doesn't work on these nodes\n return [];\n }\n}\nfunction handleUpdate({ element, attributes }) {\n const oldAttributes = { ...attributes };\n Object.entries(attributes)\n .reverse()\n .forEach(([name, value]) => {\n var _a;\n let oldAttribute;\n if (isNamespaced(value))\n oldAttribute = {\n value: element.getAttributeNS(value.namespaceURI, localAttributeName(name)),\n namespaceURI: value.namespaceURI,\n };\n else\n oldAttribute = ((_a = element.getAttributeNode(name)) === null || _a === void 0 ? void 0 : _a.namespaceURI)\n ? {\n value: element.getAttribute(name),\n namespaceURI: element.getAttributeNode(name).namespaceURI,\n }\n : element.getAttribute(name);\n oldAttributes[name] = oldAttribute;\n });\n for (const entry of Object.entries(attributes)) {\n try {\n const [attribute, value] = entry;\n if (isNamespaced(value)) {\n if (value.value === null)\n element.removeAttributeNS(value.namespaceURI, localAttributeName(attribute));\n else\n element.setAttributeNS(value.namespaceURI, attribute, value.value);\n }\n else if (value === null)\n element.removeAttribute(attribute);\n else\n element.setAttribute(attribute, value);\n }\n catch (e) {\n // do nothing if update doesn't work on this attribute\n delete oldAttributes[entry[0]];\n }\n }\n return {\n element,\n attributes: oldAttributes,\n };\n}\nfunction handleRemove({ node }) {\n var _a;\n const { parentNode: parent, nextSibling: reference } = node;\n (_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(node);\n if (parent)\n return {\n node,\n parent,\n reference,\n };\n return [];\n}\nexport function handleEdit(edit) {\n if (isInsert(edit))\n return handleInsert(edit);\n if (isUpdate(edit))\n return handleUpdate(edit);\n if (isRemove(edit))\n return handleRemove(edit);\n if (isComplex(edit))\n return edit.map(handleEdit).reverse();\n return [];\n}\n//# sourceMappingURL=edit-event.js.map","/* eslint-disable no-shadow */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable no-use-before-define */\n/* eslint-disable no-undef */\nimport { TemplateResult } from 'lit';\n\nimport { List } from '@material/mwc-list';\nimport { Select } from '@material/mwc-select';\nimport { TextField } from '@material/mwc-textfield';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { Edit } from '@openscd/open-scd-core';\nimport { SclTextfield } from '../foundation/components/scl-textfield.js';\nimport { SclSelect } from '../foundation/components/scl-select.js';\nimport { SclCheckbox } from '../foundation/components/scl-checkbox.js';\n\n/** Throws an error bearing `message`, never returning. */\nexport function unreachable(message: string): never {\n throw new Error(message);\n}\n\n/** @returns the cartesian product of `arrays` */\nexport function crossProduct(...arrays: T[][]): T[][] {\n return arrays.reduce(\n (a, b) => a.flatMap(d => b.map(e => [d, e].flat())),\n [[]]\n );\n}\n\nexport const wizardInputSelector =\n 'scl-textfield, mwc-textfield, ace-editor, mwc-select, scl-select, scl-checkbox';\nexport type WizardInputElement =\n | SclTextfield\n | TextField\n // TODO(c-dinkel): extend component\n | Select\n | SclSelect;\n\n/** @returns [[`EditorAction`]]s to dispatch on [[`WizardDialog`]] commit. */\nexport type WizardActor = (\n inputs: WizardInputElement[],\n wizard: Element,\n list?: List | null\n) => Edit[];\n\nexport function canCheckValidity(\n type: any\n): type is SclTextfield | SclSelect | TextField | Select {\n return 'checkValidity' in type;\n}\n\n/** @returns the validity of `input` depending on type. */\nexport function checkValidity(input: WizardInputElement): boolean {\n if (canCheckValidity(input)) return input.checkValidity();\n return true;\n}\n\nexport function canReportValidity(\n type: any\n): type is SclTextfield | SclSelect | TextField | Select {\n return 'reportValidity' in type;\n}\n\n/** reports the validity of `input` depending on type. */\nexport function reportValidity(input: WizardInputElement): boolean {\n if (canReportValidity(input)) return input.reportValidity();\n return true;\n}\n\nexport function isInputWithMaybeValue(\n type: any\n): type is SclTextfield | SclCheckbox | SclSelect {\n return 'maybeValue' in type;\n}\n\n/** @returns the `value` or `maybeValue` of `input` depending on type. */\nexport function getValue(input: WizardInputElement): string | null {\n if (isInputWithMaybeValue(input)) return input.maybeValue;\n return input.value ?? null;\n}\n\nexport function isSclTextfield(type: any): type is SclTextfield {\n return 'maybeValue' in type && 'multiplier' in type;\n}\n\n/** @returns the `multiplier` of `input` if available. */\nexport function getMultiplier(input: WizardInputElement): string | null {\n if (isSclTextfield(input)) return input.multiplier;\n return null;\n}\n\n/** @returns [[`WizardAction`]]s to dispatch on [[`WizardDialog`]] menu action. */\nexport type WizardMenuActor = (wizard: Element) => void;\n\n/** User interactions rendered in the wizard-dialog menu */\nexport interface MenuAction {\n label: string;\n icon?: string;\n action: WizardMenuActor;\n}\n\n/** Represents a page of a wizard dialog */\nexport interface WizardPage {\n title: string;\n content?: TemplateResult[];\n primary?: {\n icon: string;\n label: string;\n action: WizardActor;\n auto?: boolean;\n };\n secondary?: {\n icon: string;\n label: string;\n action: WizardActor;\n };\n initial?: boolean;\n menuActions?: MenuAction[];\n}\nexport type Wizard = WizardPage[];\nexport type WizardFactory = () => Wizard;\n\n/** If `wizard === null`, close the current wizard, else queue `wizard`. */\nexport interface WizardDetail {\n wizard: WizardFactory | null;\n subwizard?: boolean;\n}\n\n/** @returns a clone of `element` with attributes set to values from `attrs`. */\nexport function cloneElement(\n element: Element,\n attrs: Record\n): Element {\n const newElement = element.cloneNode(false);\n Object.entries(attrs).forEach(([name, value]) => {\n if (value === null) newElement.removeAttribute(name);\n else newElement.setAttribute(name, value);\n });\n return newElement;\n}\n\n/**\n * Extract the 'name' attribute from the given XML element.\n * @param element - The element to extract name from.\n * @returns the name, or undefined if there is no name.\n */\nexport function getNameAttribute(element: Element): string | undefined {\n const name = element.getAttribute('name');\n return name || undefined;\n}\n\nexport function isPublic(element: Element): boolean {\n return !element.closest('Private');\n}\n\n/** @returns a new [[`tag`]] element owned by [[`doc`]]. */\nexport function createElement(\n doc: Document,\n tag: string,\n attrs: Record\n): Element {\n const element = doc.createElementNS(doc.documentElement.namespaceURI, tag);\n Object.entries(attrs)\n .filter(([_, value]) => value !== null)\n .forEach(([name, value]) => element.setAttribute(name, value!));\n return element;\n}\n\nexport function getChildElementsByTagName(\n element: Element | null | undefined,\n tag: string | null | undefined\n): Element[] {\n if (!element || !tag) return [];\n return Array.from(element.children).filter(\n element => element.tagName === tag\n );\n}\n\nexport function getTypes(element: Element): string[] {\n if (!element.ownerDocument.documentElement) return [];\n\n const scl: Element = element.ownerDocument.documentElement;\n\n const type =\n (scl.getAttribute('version') ?? '2003') +\n (scl.getAttribute('revision') ?? '') +\n (scl.getAttribute('release') ?? '');\n\n if (type === '2003') return pTypes2003;\n\n if (type === '2007B') return pTypes2007B;\n\n return pTypes2007B4;\n}\n\nconst pTypes2003: string[] = [\n 'IP',\n 'IP-SUBNET',\n 'IP-GATEWAY',\n 'OSI-TSEL',\n 'OSI-SSEL',\n 'OSI-PSEL',\n 'OSI-AP-Title',\n 'OSI-AP-Invoke',\n 'OSI-AE-Qualifier',\n 'OSI-AE-Invoke',\n 'OSI-NSAP',\n 'VLAN-ID',\n 'VLAN-PRIORITY',\n];\n\nconst pTypes2007B: string[] = [\n ...pTypes2003,\n 'SNTP-Port',\n 'MMS-Port',\n 'DNSName',\n 'UDP-Port',\n 'TCP-Port',\n 'C37-118-IP-Port',\n];\n\nconst pTypes2007B4: string[] = [\n ...pTypes2007B,\n 'IPv6',\n 'IPv6-SUBNET',\n 'IPv6-GATEWAY',\n 'IPv6FlowLabel',\n 'IPv6ClassOfTraffic',\n 'IPv6-IGMPv3Src',\n 'IP-IGMPv3Sr',\n 'IP-ClassOfTraffic',\n];\n\nconst typeBase = {\n IP: '([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])',\n OSI: '[0-9A-F]+',\n OSId: '[0-9]+',\n OSIAPi: '[0-9\\u002C]+',\n MAC: '([0-9A-F]{2}-){5}[0-9A-F]{2}',\n APPID: '[0-9A-F]{4}',\n VLANp: '[0-7]',\n VLANid: '[0-9A-F]{3}',\n port: '0|([1-9][0-9]{0,3})|([1-5][0-9]{4,4})|(6[0-4][0-9]{3,3})|(65[0-4][0-9]{2,2})|(655[0-2][0-9])|(6553[0-5])',\n IPv6: '([0-9a-f]{1,4}:){7}[0-9a-f]{1,4}',\n IPv6sub: '/[1-9]|/[1-9][0-9]|/1[0-1][0-9]|/12[0-7]',\n};\n\n/** Patterns from IEC 61850-6 for all `P` elements */\nexport const typePattern: Partial> = {\n IP: typeBase.IP,\n 'IP-SUBNET': typeBase.IP,\n 'IP-GATEWAY': typeBase.IP,\n 'OSI-TSEL': typeBase.OSI,\n 'OSI-SSEL': typeBase.OSI,\n 'OSI-PSEL': typeBase.OSI,\n 'OSI-AP-Title': typeBase.OSIAPi,\n 'OSI-AP-Invoke': typeBase.OSId,\n 'OSI-AE-Qualifier': typeBase.OSId,\n 'OSI-AE-Invoke': typeBase.OSId,\n 'MAC-Address': typeBase.MAC,\n APPID: typeBase.APPID,\n 'VLAN-ID': typeBase.VLANid,\n 'VLAN-PRIORITY': typeBase.VLANp,\n 'OSI-NSAP': typeBase.OSI,\n 'SNTP-Port': typeBase.port,\n 'MMS-Port': typeBase.port,\n DNSName: '[^ ]*',\n 'UDP-Port': typeBase.port,\n 'TCP-Port': typeBase.port,\n 'C37-118-IP-Port':\n '102[5-9]|10[3-9][0-9]|1[1-9][0-9][0-9]|[2-9][0-9]{3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]',\n IPv6: typeBase.IPv6,\n 'IPv6-SUBNET': typeBase.IPv6sub,\n 'IPv6-GATEWAY': typeBase.IPv6,\n IPv6FlowLabel: '[0-9a-fA-F]{1,5}',\n IPv6ClassOfTraffic: '[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]',\n 'IPv6-IGMPv3Src': typeBase.IPv6,\n 'IP-IGMPv3Sr': typeBase.IP,\n 'IP-ClassOfTraffic': typeBase.OSI,\n};\n\n/** Whether `P` element is required within `Address` */\nexport const typeNullable: Partial> = {\n IP: false,\n 'IP-SUBNET': false,\n 'IP-GATEWAY': true,\n 'OSI-TSEL': true,\n 'OSI-SSEL': true,\n 'OSI-PSEL': true,\n 'OSI-AP-Title': true,\n 'OSI-AP-Invoke': true,\n 'OSI-AE-Qualifier': true,\n 'OSI-AE-Invoke': true,\n 'OSI-NSAP': true,\n 'MAC-Address': false,\n APPID: false,\n 'VLAN-ID': true,\n 'VLAN-PRIORITY': true,\n 'SNTP-Port': true,\n 'MMS-Port': true,\n DNSName: true,\n 'UDP-Port': true,\n 'TCP-Port': true,\n 'C37-118-IP-Port': true,\n IPv6: true,\n 'IPv6-SUBNET': true,\n 'IPv6-GATEWAY': true,\n IPv6FlowLabel: true,\n IPv6ClassOfTraffic: true,\n 'IPv6-IGMPv3Src': true,\n 'IP-IGMPv3Sr': true,\n 'IP-ClassOfTraffic': true,\n};\n\n/** Max length definition for all `P` element */\nexport const typeMaxLength: Partial> = {\n 'OSI-TSEL': 8,\n 'OSI-SSEL': 16,\n 'OSI-PSEL': 16,\n 'OSI-AP-Invoke': 5,\n 'OSI-AE-Qualifier': 5,\n 'OSI-AE-Invoke': 5,\n 'OSI-NSAP': 40,\n 'IP-ClassOfTraffic': 2,\n};\n\n/** Sorts selected `ListItem`s to the top and disabled ones to the bottom. */\nexport function compareNames(a: Element | string, b: Element | string): number {\n if (typeof a === 'string' && typeof b === 'string') return a.localeCompare(b);\n\n if (typeof a === 'object' && typeof b === 'string')\n return (a.getAttribute('name') ?? '').localeCompare(b);\n\n if (typeof a === 'string' && typeof b === 'object')\n return a.localeCompare(b.getAttribute('name')!);\n\n if (typeof a === 'object' && typeof b === 'object')\n return (a.getAttribute('name') ?? '').localeCompare(\n b.getAttribute('name') ?? ''\n );\n\n return 0;\n}\n\n/** @returns reserved siblings names attributes */\nexport function reservedNames(element: Element, tagName?: string): string[] {\n if (tagName)\n return getChildElementsByTagName(element, tagName).map(\n sibling => sibling.getAttribute('name')!\n );\n\n if (!element.parentElement) return [];\n return getChildElementsByTagName(element.parentElement, element.tagName)\n .filter(sibling => sibling !== element)\n .map(sibling => sibling.getAttribute('name')!);\n}\n","/* eslint-disable no-undef */\ninterface WizardRequestBase {\n subWizard?: boolean;\n}\n\nexport interface EditWizardRequest extends WizardRequestBase {\n element: Element;\n}\n\nexport interface CreateWizardRequest extends WizardRequestBase {\n parent: Element;\n tagName: string;\n}\n\nexport type WizardRequest = EditWizardRequest | CreateWizardRequest;\n\nexport function isEditRequest(wizard: any): wizard is EditWizardRequest {\n return 'element' in wizard && 'tagName' in wizard;\n}\n\nexport function isCreateRequest(wizard: any): wizard is CreateWizardRequest {\n return 'parent' in wizard;\n}\n\ntype EditWizardEvent = CustomEvent;\ntype CreateWizardEvent = CustomEvent;\nexport type WizardEvent = EditWizardEvent | CreateWizardEvent;\n\ntype CloseWizardEvent = CustomEvent;\n\nexport function newEditWizardEvent(\n element: Element,\n subWizard?: boolean,\n eventInitDict?: CustomEventInit>\n): EditWizardEvent {\n return new CustomEvent('oscd-edit-wizard-request', {\n bubbles: true,\n composed: true,\n ...eventInitDict,\n detail: { element, subWizard, ...eventInitDict?.detail },\n });\n}\n\nexport function newCreateWizardEvent(\n parent: Element,\n tagName: string,\n subWizard?: boolean,\n eventInitDict?: CustomEventInit>\n): CreateWizardEvent {\n return new CustomEvent('oscd-create-wizard-request', {\n bubbles: true,\n composed: true,\n ...eventInitDict,\n detail: {\n parent,\n tagName,\n subWizard,\n ...eventInitDict?.detail,\n },\n });\n}\n\nexport function newCloseWizardEvent(\n wizard: WizardRequest,\n eventInitDict?: CustomEventInit>\n): CloseWizardEvent {\n return new CustomEvent('oscd-close-wizard', {\n bubbles: true,\n composed: true,\n ...eventInitDict,\n detail: wizard,\n });\n}\n\ndeclare global {\n interface ElementEventMap {\n ['oscd-edit-wizard-request']: EditWizardRequest;\n ['oscd-create-wizard-request']: CreateWizardRequest;\n ['oscd-close-wizard']: WizardEvent;\n }\n}\n","/* eslint-disable import/no-extraneous-dependencies */\n/* eslint-disable import/no-duplicates */\n/* eslint-disable no-nested-ternary */\n/* eslint-disable no-plusplus */\n/* eslint-disable no-undef */\nimport { LitElement, TemplateResult, css, html } from 'lit';\nimport { customElement, property, queryAll, state } from 'lit/decorators.js';\n\nimport 'ace-custom-element';\nimport '@material/mwc-button';\nimport '@material/mwc-dialog';\nimport { Dialog } from '@material/mwc-dialog';\nimport type { List } from '@material/mwc-list';\n\nimport { newEditEvent } from '@openscd/open-scd-core';\nimport {\n Wizard,\n WizardInputElement,\n WizardPage,\n WizardActor,\n wizardInputSelector,\n checkValidity,\n reportValidity,\n} from '../../wizard-library/foundation.js';\nimport {\n CreateWizardRequest,\n EditWizardRequest,\n newCloseWizardEvent,\n} from '../../foundation.js';\n\nfunction renderWizardInput(input: TemplateResult): TemplateResult {\n return input;\n}\n\nfunction dialogInputs(dialog?: Dialog): WizardInputElement[] {\n return Array.from(dialog?.querySelectorAll(wizardInputSelector) ?? []);\n}\n\nfunction dialogValid(dialog?: Dialog): boolean {\n return dialogInputs(dialog).every(checkValidity);\n}\n\n/** A wizard style dialog consisting of several pages commiting some\n * [[`EditorAction`]] on completion and aborting on dismissal. */\n@customElement('scl-wizard-dialog')\nexport class SclWizardDialog extends LitElement {\n /** The [[`Wizard`]] implemented by this dialog. */\n @property({ type: Array })\n wizard: Wizard = [];\n\n @property({ attribute: false })\n wizardRequest: EditWizardRequest | CreateWizardRequest | null = null;\n\n @property({ attribute: false })\n element?: Element;\n\n /** Index of the currently active [[`WizardPage`]] */\n @state()\n pageIndex = 0;\n\n @queryAll('mwc-dialog') dialogs!: NodeListOf;\n\n @queryAll(wizardInputSelector) inputs!: NodeListOf;\n\n /** The `Dialog` showing the active [[`WizardPage`]]. */\n get dialog(): Dialog | undefined {\n return this.dialogs[this.pageIndex];\n }\n\n /** Checks the inputs of all [[`WizardPage`]]s for validity. */\n checkValidity(): boolean {\n return Array.from(this.inputs).every(checkValidity);\n }\n\n private get firstInvalidPage(): number {\n return Array.from(this.dialogs).findIndex(dialog => !dialogValid(dialog));\n }\n\n prev(): void {\n if (this.pageIndex <= 0) return;\n this.pageIndex--;\n this.dialog?.show();\n }\n\n async next(): Promise {\n if (dialogValid(this.dialog)) {\n if (this.wizard.length > this.pageIndex + 1) this.pageIndex++;\n this.dialog?.show();\n } else {\n this.dialog?.show();\n await this.dialog?.updateComplete;\n dialogInputs(this.dialog).map(reportValidity);\n }\n }\n\n /** Commits `action` if all inputs are valid, reports validity otherwise. */\n async act(action?: WizardActor, primary = true): Promise {\n if (action === undefined) return false;\n const wizardInputs = Array.from(this.inputs);\n const wizardList = (\n this.dialog?.querySelector('filtered-list,mwc-list')\n );\n if (!this.checkValidity()) {\n this.pageIndex = this.firstInvalidPage;\n wizardInputs.map(reportValidity);\n return false;\n }\n\n const wizardActions = action(wizardInputs, this, wizardList);\n if (wizardActions.length > 0) {\n if (primary) this.wizard[this.pageIndex].primary = undefined;\n else this.wizard[this.pageIndex].secondary = undefined;\n this.dispatchEvent(newCloseWizardEvent(this.wizardRequest!));\n }\n wizardActions.forEach(wa => this.dispatchEvent(newEditEvent(wa)));\n return true;\n }\n\n private onClosed(ae: CustomEvent<{ action: string } | null>): void {\n if (!(ae.detail && ae.detail?.action)) return;\n if (ae.detail.action === 'close')\n this.dispatchEvent(newCloseWizardEvent(this.wizardRequest!));\n else if (ae.detail.action === 'prev') this.prev();\n else if (ae.detail.action === 'next') this.next();\n }\n\n constructor() {\n super();\n\n this.act = this.act.bind(this);\n this.renderPage = this.renderPage.bind(this);\n }\n\n updated(changedProperties: Map): void {\n if (changedProperties.has('wizard')) {\n this.pageIndex = 0;\n while (\n this.wizard.findIndex(page => page.initial) > this.pageIndex &&\n dialogValid(this.dialog)\n ) {\n this.dialog?.close();\n this.next();\n }\n this.dialog?.show();\n }\n if (this.wizard[this.pageIndex]?.primary?.auto) {\n this.updateComplete.then(() =>\n this.act(this.wizard[this.pageIndex].primary!.action)\n );\n }\n }\n\n renderPage(page: WizardPage, index: number): TemplateResult {\n return html`\n \n
${page.content?.map(renderWizardInput)}
\n ${index > 0\n ? html``\n : html``}\n ${page.secondary\n ? html` this.act(page.secondary?.action, false)}\n icon=\"${page.secondary.icon}\"\n label=\"${page.secondary.label}\"\n >`\n : html``}\n ${page.primary\n ? html` this.act(page.primary?.action)}\n icon=\"${page.primary.icon}\"\n label=\"${page.primary.label}\"\n trailingIcon\n >`\n : index + 1 < (this.wizard?.length ?? 0)\n ? html``\n : html``}\n `;\n }\n\n render(): TemplateResult {\n return html`${this.wizard.map(this.renderPage)}`;\n }\n\n static styles = css`\n mwc-dialog {\n --mdc-dialog-max-width: 92vw;\n }\n\n mwc-dialog > nav {\n position: absolute;\n top: 8px;\n right: 14px;\n color: var(--base00);\n }\n\n #wizard-content {\n display: flex;\n flex-direction: column;\n }\n\n #wizard-content > * {\n display: block;\n margin-top: 16px;\n }\n\n *[iconTrailing='search'] {\n --mdc-shape-small: 28px;\n }\n `;\n}\n","/* eslint-disable import/no-extraneous-dependencies */\nimport { LitElement, TemplateResult, css, html } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\n\nimport 'ace-custom-element';\nimport '@material/mwc-dialog';\nimport type AceEditor from 'ace-custom-element';\n\nimport { Remove, Insert, newEditEvent } from '@openscd/open-scd-core';\n\nfunction formatXml(xml: string, tab: string = '\\t'): string {\n let formatted = '';\n let indent = '';\n\n xml.split(/>\\s* {\n if (node.match(/^\\/\\w/)) indent = indent.substring(tab!.length);\n formatted += `${indent}<${node}>\\r\\n`;\n if (node.match(/^]*[^/]$/)) indent += tab;\n });\n return formatted.substring(1, formatted.length - 3);\n}\n\nfunction codeEdits(\n oldElement: Element,\n newElementText: string\n): (Remove | Insert)[] {\n const parent = oldElement.parentElement;\n if (!parent) return [];\n\n const remove: Remove = { node: oldElement };\n const insert: Insert = {\n parent: oldElement.parentElement,\n node: new DOMParser().parseFromString(newElementText, 'application/xml')\n .documentElement,\n reference: oldElement.nextSibling,\n };\n\n return [remove, insert];\n}\n\n/** */\n@customElement('code-dialog')\nexport default class CodeDialog extends LitElement {\n @property({ attribute: false })\n element!: Element;\n\n @query('ace-editor') editor!: AceEditor;\n\n save(element: Element) {\n const text = this.editor.value;\n if (!text) return;\n\n const edits = codeEdits(element, text);\n if (!edits.length) return;\n\n this.dispatchEvent(newEditEvent(edits));\n this.dispatchEvent(new CustomEvent('closed'));\n }\n\n onClosed(ae: CustomEvent<{ action: string }>): void {\n if (ae.detail.action === 'save') this.save(this.element);\n if (ae.detail.action === 'close')\n this.dispatchEvent(new CustomEvent('closed'));\n }\n\n updated(): void {\n this.editor.basePath = '';\n this.editor.mode = 'ace/mode/xml';\n }\n\n render(): TemplateResult {\n if (!this.element) return html`No SCL Element`;\n\n return html`\n \n \n Cancel\n Save\n `;\n }\n\n static styles = css`\n mwc-dialog {\n --mdc-dialog-min-width: 85vw;\n --mdc-dialog-max-height: calc(100vh - 200px);\n }\n\n mwc-dialog > nav {\n position: absolute;\n top: 8px;\n right: 14px;\n color: var(--base00);\n }\n `;\n}\n","function updateConnectivityNodes(element, names) {\n const cNodes = Array.from(element.getElementsByTagName(\"ConnectivityNode\"));\n const updates = cNodes.map((cNode) => {\n const cNodeName = cNode.getAttribute(\"name\");\n if (!cNodeName)\n return;\n const newPath = `${names.substation}/${names.voltageLevel}/${names.newBay}/${cNodeName}`;\n return { element: cNode, attributes: { pathName: newPath } };\n });\n return updates.filter((update) => update);\n}\nfunction updateTerminals(element, names) {\n const terminals = Array.from(element\n .closest(\"Substation\")\n .querySelectorAll(`Terminal[substationName=\"${names.substation}\"][voltageLevelName=\"${names.voltageLevel}\"][bayName=\"${names.oldBay}\"]`));\n const updates = terminals.map((terminal) => {\n const connectivityNode = terminal.getAttribute(\"connectivityNode\");\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [substationName, voltageLevelName, _, cNodeName] = (connectivityNode ?? \"\").split(\"/\");\n if (!substationName || !voltageLevelName || !cNodeName)\n return;\n const oldConnectivityNode = `${substationName}/${voltageLevelName}/${names.newBay}/${cNodeName}`;\n return {\n element: terminal,\n attributes: {\n connectivityNode: oldConnectivityNode,\n bayName: names.newBay,\n },\n };\n });\n return updates.filter((update) => update);\n}\n/** Updates `Bay` attributes and cross-referenced elements\n * @param update - update edit on `Bay` attributes\n * @returns Completed update edit array */\nexport function updateBay(update) {\n if (update.element.tagName !== \"Bay\")\n return [update];\n const bay = update.element;\n const attributes = update.attributes;\n if (!attributes.name)\n return [update];\n const oldName = bay.getAttribute(\"name\");\n const substationName = bay.closest(\"Substation\")?.getAttribute(\"name\");\n const voltageLevelName = bay.closest(\"VoltageLevel\")?.getAttribute(\"name\");\n const newName = attributes.name;\n if (!substationName || !voltageLevelName || !oldName || oldName === newName)\n return [update];\n return [update].concat(...updateConnectivityNodes(bay, {\n substation: substationName,\n voltageLevel: voltageLevelName,\n oldBay: oldName,\n newBay: newName,\n }), ...updateTerminals(bay, {\n substation: substationName,\n voltageLevel: voltageLevelName,\n oldBay: oldName,\n newBay: newName,\n }));\n}\n//# sourceMappingURL=updateBay.js.map","function updateConnectivityNodes(element, names) {\n const cNodes = Array.from(element.getElementsByTagName(\"ConnectivityNode\"));\n const updates = cNodes.map((cNode) => {\n const cNodeName = cNode.getAttribute(\"name\");\n const bayName = cNode.parentElement?.getAttribute(\"name\");\n if (!cNodeName || !bayName)\n return;\n const newPath = `${names.substation}/${names.newVoltageLevel}/${bayName}/${cNodeName}`;\n return { element: cNode, attributes: { pathName: newPath } };\n });\n return updates.filter((update) => update);\n}\nfunction updateTerminals(element, names) {\n const terminals = Array.from(element\n .closest(\"Substation\")\n .querySelectorAll(`Terminal[substationName=\"${names.substation}\"][voltageLevelName=\"${names.oldVoltageLevel}\"]`));\n const updates = terminals.map((terminal) => {\n const connectivityNode = terminal.getAttribute(\"connectivityNode\");\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [substationName, _, bayName, cNodeName] = (connectivityNode ?? \"\").split(\"/\");\n if (!substationName || !bayName || !cNodeName)\n return;\n const newConnectivityNode = `${substationName}/${names.newVoltageLevel}/${bayName}/${cNodeName}`;\n return {\n element: terminal,\n attributes: {\n connectivityNode: newConnectivityNode,\n voltageLevelName: names.newVoltageLevel,\n },\n };\n });\n return updates.filter((update) => update);\n}\n/** Updates `VoltageLevel` attributes and cross-referenced elements\n * @param update - update edit on `VoltageLevel` attributes\n * @returns Completed update edit array */\nexport function updateVoltageLevel(update) {\n if (update.element.tagName !== \"VoltageLevel\")\n return [update];\n const voltageLevel = update.element;\n const attributes = update.attributes;\n if (!attributes.name)\n return [update];\n const oldName = voltageLevel.getAttribute(\"name\");\n const substationName = voltageLevel\n .closest(\"Substation\")\n ?.getAttribute(\"name\");\n const newName = attributes.name;\n if (!substationName || !oldName || oldName === newName)\n return [update];\n return [update].concat(...updateConnectivityNodes(voltageLevel, {\n substation: substationName,\n oldVoltageLevel: oldName,\n newVoltageLevel: newName,\n }), ...updateTerminals(voltageLevel, {\n substation: substationName,\n oldVoltageLevel: oldName,\n newVoltageLevel: newName,\n }));\n}\n//# sourceMappingURL=updateVoltageLevel.js.map","function updateConnectivityNodes(substation, newName) {\n const cNodes = Array.from(substation.getElementsByTagName(\"ConnectivityNode\"));\n const updates = cNodes.map((cNode) => {\n const cNodeName = cNode.getAttribute(\"name\");\n const bayName = cNode.parentElement?.getAttribute(\"name\");\n const voltageLevelName = cNode.parentElement?.parentElement?.getAttribute(\"name\");\n if (!cNodeName || !bayName || !voltageLevelName)\n return;\n const newPath = `${newName}/${voltageLevelName}/${bayName}/${cNodeName}`;\n return { element: cNode, attributes: { pathName: newPath } };\n });\n return updates.filter((update) => update);\n}\nfunction updateTerminals(substation, names) {\n const terminals = Array.from(substation.querySelectorAll(`Terminal[substationName=\"${names.oldSubstation}\"]`));\n const updates = terminals.map((terminal) => {\n const connectivityNode = terminal.getAttribute(\"connectivityNode\");\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, voltageLevelName, bayName, cNodeName] = (connectivityNode ?? \"\").split(\"/\");\n if (!voltageLevelName || !bayName || !cNodeName)\n return;\n const newConnectivityNode = `${names.newSubstation}/${voltageLevelName}/${bayName}/${cNodeName}`;\n return {\n element: terminal,\n attributes: {\n connectivityNode: newConnectivityNode,\n substationName: names.newSubstation,\n },\n };\n });\n return updates.filter((update) => update);\n}\n/** Updates `Substation` attributes and cross-referenced elements\n * @param update - update edit on `Substation` attributes\n * @returns Completed update edit array */\nexport function updateSubstation(update) {\n if (update.element.tagName !== \"Substation\")\n return [update];\n const substation = update.element;\n const attributes = update.attributes;\n if (!attributes.name)\n return [update];\n const oldName = substation.getAttribute(\"name\");\n const newName = attributes.name;\n if (!oldName || oldName === newName)\n return [update];\n return [update].concat(...updateConnectivityNodes(substation, newName), ...updateTerminals(substation, {\n oldSubstation: oldName,\n newSubstation: newName,\n }));\n}\n//# sourceMappingURL=updateSubstation.js.map","const tAbstractConductingEquipment = [\n \"TransformerWinding\",\n \"ConductingEquipment\",\n];\nconst tEquipment = [\n \"GeneralEquipment\",\n \"PowerTransformer\",\n ...tAbstractConductingEquipment,\n];\nconst tEquipmentContainer = [\"Substation\", \"VoltageLevel\", \"Bay\"];\nconst tGeneralEquipmentContainer = [\"Process\", \"Line\"];\nconst tAbstractEqFuncSubFunc = [\"EqSubFunction\", \"EqFunction\"];\nconst tPowerSystemResource = [\n \"SubFunction\",\n \"Function\",\n \"TapChanger\",\n \"SubEquipment\",\n ...tEquipment,\n ...tEquipmentContainer,\n ...tGeneralEquipmentContainer,\n ...tAbstractEqFuncSubFunc,\n];\nconst tLNodeContainer = [\"ConnectivityNode\", ...tPowerSystemResource];\nconst tCertificate = [\"GOOSESecurity\", \"SMVSecurity\"];\nconst tNaming = [\"SubNetwork\", ...tCertificate, ...tLNodeContainer];\nconst tAbstractDataAttribute = [\"BDA\", \"DA\"];\nconst tControlWithIEDName = [\"SampledValueControl\", \"GSEControl\"];\nconst tControlWithTriggerOpt = [\"LogControl\", \"ReportControl\"];\nconst tControl = [...tControlWithIEDName, ...tControlWithTriggerOpt];\nconst tControlBlock = [\"GSE\", \"SMV\"];\nconst tUnNaming = [\n \"ConnectedAP\",\n \"PhysConn\",\n \"SDO\",\n \"DO\",\n \"DAI\",\n \"SDI\",\n \"DOI\",\n \"Inputs\",\n \"RptEnabled\",\n \"Server\",\n \"ServerAt\",\n \"SettingControl\",\n \"Communication\",\n \"Log\",\n \"LDevice\",\n \"DataSet\",\n \"AccessPoint\",\n \"IED\",\n \"NeutralPoint\",\n ...tControl,\n ...tControlBlock,\n ...tAbstractDataAttribute,\n];\nconst tAnyLN = [\"LN0\", \"LN\"];\nconst tAnyContentFromOtherNamespace = [\n \"Text\",\n \"Private\",\n \"Hitem\",\n \"AccessControl\",\n];\nconst tCert = [\"Subject\", \"IssuerName\"];\nconst tDurationInMilliSec = [\"MinTime\", \"MaxTime\"];\nconst tIDNaming = [\"LNodeType\", \"DOType\", \"DAType\", \"EnumType\"];\nconst tServiceYesNo = [\n \"FileHandling\",\n \"TimeSyncProt\",\n \"CommProt\",\n \"SGEdit\",\n \"ConfSG\",\n \"GetDirectory\",\n \"GetDataObjectDefinition\",\n \"DataObjectDirectory\",\n \"GetDataSetValue\",\n \"SetDataSetValue\",\n \"DataSetDirectory\",\n \"ReadWrite\",\n \"TimerActivatedControl\",\n \"GetCBValues\",\n \"GSEDir\",\n \"ConfLdName\",\n];\nconst tServiceWithMaxAndMaxAttributes = [\"DynDataSet\", \"ConfDataSet\"];\nconst tServiceWithMax = [\n \"GSSE\",\n \"GOOSE\",\n \"ConfReportControl\",\n \"SMVsc\",\n ...tServiceWithMaxAndMaxAttributes,\n];\nconst tServiceWithMaxNonZero = [\"ConfLogControl\", \"ConfSigRef\"];\nconst tServiceSettings = [\n \"ReportSettings\",\n \"LogSettings\",\n \"GSESettings\",\n \"SMVSettings\",\n];\nconst tBaseElement = [\"SCL\", ...tNaming, ...tUnNaming, ...tIDNaming];\nconst sCLTags = [\n ...tBaseElement,\n ...tAnyContentFromOtherNamespace,\n \"Header\",\n \"LNode\",\n \"Val\",\n \"Voltage\",\n \"Services\",\n ...tCert,\n ...tDurationInMilliSec,\n \"Association\",\n \"FCDA\",\n \"ClientLN\",\n \"IEDName\",\n \"ExtRef\",\n \"Protocol\",\n ...tAnyLN,\n ...tServiceYesNo,\n \"DynAssociation\",\n \"SettingGroups\",\n ...tServiceWithMax,\n ...tServiceWithMaxNonZero,\n ...tServiceSettings,\n \"ConfLNs\",\n \"ClientServices\",\n \"SupSubscription\",\n \"ValueHandling\",\n \"RedProt\",\n \"McSecurity\",\n \"KDC\",\n \"Address\",\n \"P\",\n \"ProtNs\",\n \"EnumVal\",\n \"Terminal\",\n \"BitRate\",\n \"Authentication\",\n \"DataTypeTemplates\",\n \"History\",\n \"OptFields\",\n \"SmvOpts\",\n \"TrgOps\",\n \"SamplesPerSec\",\n \"SmpRate\",\n \"SecPerSamples\",\n];\nconst tBaseNameSequence = [\"Text\", \"Private\"];\nconst tNamingSequence = [...tBaseNameSequence];\nconst tUnNamingSequence = [...tBaseNameSequence];\nconst tIDNamingSequence = [...tBaseNameSequence];\nconst tAbstractDataAttributeSequence = [...tUnNamingSequence, \"Val\"];\nconst tLNodeContainerSequence = [...tNamingSequence, \"LNode\"];\nconst tPowerSystemResourceSequence = [...tLNodeContainerSequence];\nconst tEquipmentSequence = [...tPowerSystemResourceSequence];\nconst tEquipmentContainerSequence = [\n ...tPowerSystemResourceSequence,\n \"PowerTransformer\",\n \"GeneralEquipment\",\n];\nconst tAbstractConductingEquipmentSequence = [\n ...tEquipmentSequence,\n \"Terminal\",\n];\nconst tControlBlockSequence = [...tUnNamingSequence, \"Address\"];\nconst tControlSequence = [...tNamingSequence];\nconst tControlWithIEDNameSequence = [...tControlSequence, \"IEDName\"];\nconst tAnyLNSequence = [\n ...tUnNamingSequence,\n \"DataSet\",\n \"ReportControl\",\n \"LogControl\",\n \"DOI\",\n \"Inputs\",\n \"Log\",\n];\nconst tGeneralEquipmentContainerSequence = [\n ...tPowerSystemResourceSequence,\n \"GeneralEquipment\",\n \"Function\",\n];\nconst tControlWithTriggerOptSequence = [...tControlSequence, \"TrgOps\"];\nconst tAbstractEqFuncSubFuncSequence = [\n ...tPowerSystemResourceSequence,\n \"GeneralEquipment\",\n \"EqSubFunction\",\n];\nexport const tags = {\n AccessControl: {\n parents: [\"LDevice\"],\n children: [],\n },\n AccessPoint: {\n parents: [\"IED\"],\n children: [\n ...tNamingSequence,\n \"Server\",\n \"LN\",\n \"ServerAt\",\n \"Services\",\n \"GOOSESecurity\",\n \"SMVSecurity\",\n ],\n },\n Address: {\n parents: [\"ConnectedAP\", \"GSE\", \"SMV\"],\n children: [\"P\"],\n },\n Association: {\n parents: [\"Server\"],\n children: [],\n },\n Authentication: {\n parents: [\"Server\"],\n children: [],\n },\n BDA: {\n parents: [\"DAType\"],\n children: [...tAbstractDataAttributeSequence],\n },\n BitRate: {\n parents: [\"SubNetwork\"],\n children: [],\n },\n Bay: {\n parents: [\"VoltageLevel\"],\n children: [\n ...tEquipmentContainerSequence,\n \"ConductingEquipment\",\n \"ConnectivityNode\",\n \"Function\",\n ],\n },\n ClientLN: {\n parents: [\"RptEnabled\"],\n children: [],\n },\n ClientServices: {\n parents: [\"Services\"],\n children: [\"TimeSyncProt\", \"McSecurity\"],\n },\n CommProt: {\n parents: [\"Services\"],\n children: [],\n },\n Communication: {\n parents: [\"SCL\"],\n children: [...tUnNamingSequence, \"SubNetwork\"],\n },\n ConductingEquipment: {\n parents: [\"Process\", \"Line\", \"SubFunction\", \"Function\", \"Bay\"],\n children: [\n ...tAbstractConductingEquipmentSequence,\n \"EqFunction\",\n \"SubEquipment\",\n ],\n },\n ConfDataSet: {\n parents: [\"Services\"],\n children: [],\n },\n ConfLdName: {\n parents: [\"Services\"],\n children: [],\n },\n ConfLNs: {\n parents: [\"Services\"],\n children: [],\n },\n ConfLogControl: {\n parents: [\"Services\"],\n children: [],\n },\n ConfReportControl: {\n parents: [\"Services\"],\n children: [],\n },\n ConfSG: {\n parents: [\"SettingGroups\"],\n children: [],\n },\n ConfSigRef: {\n parents: [\"Services\"],\n children: [],\n },\n ConnectedAP: {\n parents: [\"SubNetwork\"],\n children: [...tUnNamingSequence, \"Address\", \"GSE\", \"SMV\", \"PhysConn\"],\n },\n ConnectivityNode: {\n parents: [\"Bay\", \"Line\"],\n children: [...tLNodeContainerSequence],\n },\n DA: {\n parents: [\"DOType\"],\n children: [...tAbstractDataAttributeSequence],\n },\n DAI: {\n parents: [\"DOI\", \"SDI\"],\n children: [...tUnNamingSequence, \"Val\"],\n },\n DAType: {\n parents: [\"DataTypeTemplates\"],\n children: [...tIDNamingSequence, \"BDA\", \"ProtNs\"],\n },\n DO: {\n parents: [\"LNodeType\"],\n children: [...tUnNamingSequence],\n },\n DOI: {\n parents: [...tAnyLN],\n children: [...tUnNamingSequence, \"SDI\", \"DAI\"],\n },\n DOType: {\n parents: [\"DataTypeTemplates\"],\n children: [...tIDNamingSequence, \"SDO\", \"DA\"],\n },\n DataObjectDirectory: {\n parents: [\"Services\"],\n children: [],\n },\n DataSet: {\n parents: [...tAnyLN],\n children: [...tNamingSequence, \"FCDA\"],\n },\n DataSetDirectory: {\n parents: [\"Services\"],\n children: [],\n },\n DataTypeTemplates: {\n parents: [\"SCL\"],\n children: [\"LNodeType\", \"DOType\", \"DAType\", \"EnumType\"],\n },\n DynAssociation: {\n parents: [\"Services\"],\n children: [],\n },\n DynDataSet: {\n parents: [\"Services\"],\n children: [],\n },\n EnumType: {\n parents: [\"DataTypeTemplates\"],\n children: [...tIDNamingSequence, \"EnumVal\"],\n },\n EnumVal: {\n parents: [\"EnumType\"],\n children: [],\n },\n EqFunction: {\n parents: [\n \"GeneralEquipment\",\n \"TapChanger\",\n \"TransformerWinding\",\n \"PowerTransformer\",\n \"SubEquipment\",\n \"ConductingEquipment\",\n ],\n children: [...tAbstractEqFuncSubFuncSequence],\n },\n EqSubFunction: {\n parents: [\"EqSubFunction\", \"EqFunction\"],\n children: [...tAbstractEqFuncSubFuncSequence],\n },\n ExtRef: {\n parents: [\"Inputs\"],\n children: [],\n },\n FCDA: {\n parents: [\"DataSet\"],\n children: [],\n },\n FileHandling: {\n parents: [\"Services\"],\n children: [],\n },\n Function: {\n parents: [\"Bay\", \"VoltageLevel\", \"Substation\", \"Process\", \"Line\"],\n children: [\n ...tPowerSystemResourceSequence,\n \"SubFunction\",\n \"GeneralEquipment\",\n \"ConductingEquipment\",\n ],\n },\n GeneralEquipment: {\n parents: [\n \"SubFunction\",\n \"Function\",\n ...tGeneralEquipmentContainer,\n ...tAbstractEqFuncSubFunc,\n ...tEquipmentContainer,\n ],\n children: [...tEquipmentSequence, \"EqFunction\"],\n },\n GetCBValues: {\n parents: [\"Services\"],\n children: [],\n },\n GetDataObjectDefinition: {\n parents: [\"Services\"],\n children: [],\n },\n GetDataSetValue: {\n parents: [\"Services\"],\n children: [],\n },\n GetDirectory: {\n parents: [\"Services\"],\n children: [],\n },\n GOOSE: {\n parents: [\"Services\"],\n children: [],\n },\n GOOSESecurity: {\n parents: [\"AccessPoint\"],\n children: [...tNamingSequence, \"Subject\", \"IssuerName\"],\n },\n GSE: {\n parents: [\"ConnectedAP\"],\n children: [...tControlBlockSequence, \"MinTime\", \"MaxTime\"],\n },\n GSEDir: {\n parents: [\"Services\"],\n children: [],\n },\n GSEControl: {\n parents: [\"LN0\"],\n children: [...tControlWithIEDNameSequence, \"Protocol\"],\n },\n GSESettings: {\n parents: [\"Services\"],\n children: [],\n },\n GSSE: {\n parents: [\"Services\"],\n children: [],\n },\n Header: {\n parents: [\"SCL\"],\n children: [\"Text\", \"History\"],\n },\n History: {\n parents: [\"Header\"],\n children: [\"Hitem\"],\n },\n Hitem: {\n parents: [\"History\"],\n children: [],\n },\n IED: {\n parents: [\"SCL\"],\n children: [...tUnNamingSequence, \"Services\", \"AccessPoint\", \"KDC\"],\n },\n IEDName: {\n parents: [\"GSEControl\", \"SampledValueControl\"],\n children: [],\n },\n Inputs: {\n parents: [...tAnyLN],\n children: [...tUnNamingSequence, \"ExtRef\"],\n },\n IssuerName: {\n parents: [\"GOOSESecurity\", \"SMVSecurity\"],\n children: [],\n },\n KDC: {\n parents: [\"IED\"],\n children: [],\n },\n LDevice: {\n parents: [\"Server\"],\n children: [...tUnNamingSequence, \"LN0\", \"LN\", \"AccessControl\"],\n },\n LN: {\n parents: [\"AccessPoint\", \"LDevice\"],\n children: [...tAnyLNSequence],\n },\n LN0: {\n parents: [\"LDevice\"],\n children: [\n ...tAnyLNSequence,\n \"GSEControl\",\n \"SampledValueControl\",\n \"SettingControl\",\n ],\n },\n LNode: {\n parents: [...tLNodeContainer],\n children: [...tUnNamingSequence],\n },\n LNodeType: {\n parents: [\"DataTypeTemplates\"],\n children: [...tIDNamingSequence, \"DO\"],\n },\n Line: {\n parents: [\"Process\", \"SCL\"],\n children: [\n ...tGeneralEquipmentContainerSequence,\n \"Voltage\",\n \"ConductingEquipment\",\n ],\n },\n Log: {\n parents: [...tAnyLN],\n children: [...tUnNamingSequence],\n },\n LogControl: {\n parents: [...tAnyLN],\n children: [...tControlWithTriggerOptSequence],\n },\n LogSettings: {\n parents: [\"Services\"],\n children: [],\n },\n MaxTime: {\n parents: [\"GSE\"],\n children: [],\n },\n McSecurity: {\n parents: [\"GSESettings\", \"SMVSettings\", \"ClientServices\"],\n children: [],\n },\n MinTime: {\n parents: [\"GSE\"],\n children: [],\n },\n NeutralPoint: {\n parents: [\"TransformerWinding\"],\n children: [...tUnNamingSequence],\n },\n OptFields: {\n parents: [\"ReportControl\"],\n children: [],\n },\n P: {\n parents: [\"Address\", \"PhysConn\"],\n children: [],\n },\n PhysConn: {\n parents: [\"ConnectedAP\"],\n children: [...tUnNamingSequence, \"P\"],\n },\n PowerTransformer: {\n parents: [...tEquipmentContainer],\n children: [\n ...tEquipmentSequence,\n \"TransformerWinding\",\n \"SubEquipment\",\n \"EqFunction\",\n ],\n },\n Private: {\n parents: [],\n children: [],\n },\n Process: {\n parents: [\"Process\", \"SCL\"],\n children: [\n ...tGeneralEquipmentContainerSequence,\n \"ConductingEquipment\",\n \"Substation\",\n \"Line\",\n \"Process\",\n ],\n },\n ProtNs: {\n parents: [\"DAType\", \"DA\"],\n children: [],\n },\n Protocol: {\n parents: [\"GSEControl\", \"SampledValueControl\"],\n children: [],\n },\n ReadWrite: {\n parents: [\"Services\"],\n children: [],\n },\n RedProt: {\n parents: [\"Services\"],\n children: [],\n },\n ReportControl: {\n parents: [...tAnyLN],\n children: [...tControlWithTriggerOptSequence, \"OptFields\", \"RptEnabled\"],\n },\n ReportSettings: {\n parents: [\"Services\"],\n children: [],\n },\n RptEnabled: {\n parents: [\"ReportControl\"],\n children: [...tUnNamingSequence, \"ClientLN\"],\n },\n SamplesPerSec: {\n parents: [\"SMVSettings\"],\n children: [],\n },\n SampledValueControl: {\n parents: [\"LN0\"],\n children: [...tControlWithIEDNameSequence, \"SmvOpts\"],\n },\n SecPerSamples: {\n parents: [\"SMVSettings\"],\n children: [],\n },\n SCL: {\n parents: [],\n children: [\n ...tBaseNameSequence,\n \"Header\",\n \"Substation\",\n \"Communication\",\n \"IED\",\n \"DataTypeTemplates\",\n \"Line\",\n \"Process\",\n ],\n },\n SDI: {\n parents: [\"DOI\", \"SDI\"],\n children: [...tUnNamingSequence, \"SDI\", \"DAI\"],\n },\n SDO: {\n parents: [\"DOType\"],\n children: [...tNamingSequence],\n },\n Server: {\n parents: [\"AccessPoint\"],\n children: [\n ...tUnNamingSequence,\n \"Authentication\",\n \"LDevice\",\n \"Association\",\n ],\n },\n ServerAt: {\n parents: [\"AccessPoint\"],\n children: [...tUnNamingSequence],\n },\n Services: {\n parents: [\"IED\", \"AccessPoint\"],\n children: [\n \"DynAssociation\",\n \"SettingGroups\",\n \"GetDirectory\",\n \"GetDataObjectDefinition\",\n \"DataObjectDirectory\",\n \"GetDataSetValue\",\n \"SetDataSetValue\",\n \"DataSetDirectory\",\n \"ConfDataSet\",\n \"DynDataSet\",\n \"ReadWrite\",\n \"TimerActivatedControl\",\n \"ConfReportControl\",\n \"GetCBValues\",\n \"ConfLogControl\",\n \"ReportSettings\",\n \"LogSettings\",\n \"GSESettings\",\n \"SMVSettings\",\n \"GSEDir\",\n \"GOOSE\",\n \"GSSE\",\n \"SMVsc\",\n \"FileHandling\",\n \"ConfLNs\",\n \"ClientServices\",\n \"ConfLdName\",\n \"SupSubscription\",\n \"ConfSigRef\",\n \"ValueHandling\",\n \"RedProt\",\n \"TimeSyncProt\",\n \"CommProt\",\n ],\n },\n SetDataSetValue: {\n parents: [\"Services\"],\n children: [],\n },\n SettingControl: {\n parents: [\"LN0\"],\n children: [...tUnNamingSequence],\n },\n SettingGroups: {\n parents: [\"Services\"],\n children: [\"SGEdit\", \"ConfSG\"],\n },\n SGEdit: {\n parents: [\"SettingGroups\"],\n children: [],\n },\n SmpRate: {\n parents: [\"SMVSettings\"],\n children: [],\n },\n SMV: {\n parents: [\"ConnectedAP\"],\n children: [...tControlBlockSequence],\n },\n SmvOpts: {\n parents: [\"SampledValueControl\"],\n children: [],\n },\n SMVsc: {\n parents: [\"Services\"],\n children: [],\n },\n SMVSecurity: {\n parents: [\"AccessPoint\"],\n children: [...tNamingSequence, \"Subject\", \"IssuerName\"],\n },\n SMVSettings: {\n parents: [\"Services\"],\n children: [\"SmpRate\", \"SamplesPerSec\", \"SecPerSamples\", \"McSecurity\"],\n },\n SubEquipment: {\n parents: [\n \"TapChanger\",\n \"PowerTransformer\",\n \"ConductingEquipment\",\n \"TransformerWinding\",\n ...tAbstractConductingEquipment,\n ],\n children: [...tPowerSystemResourceSequence, \"EqFunction\"],\n },\n SubFunction: {\n parents: [\"SubFunction\", \"Function\"],\n children: [\n ...tPowerSystemResourceSequence,\n \"GeneralEquipment\",\n \"ConductingEquipment\",\n \"SubFunction\",\n ],\n },\n SubNetwork: {\n parents: [\"Communication\"],\n children: [...tNamingSequence, \"BitRate\", \"ConnectedAP\"],\n },\n Subject: {\n parents: [\"GOOSESecurity\", \"SMVSecurity\"],\n children: [],\n },\n Substation: {\n parents: [\"SCL\"],\n children: [...tEquipmentContainerSequence, \"VoltageLevel\", \"Function\"],\n },\n SupSubscription: {\n parents: [\"Services\"],\n children: [],\n },\n TapChanger: {\n parents: [\"TransformerWinding\"],\n children: [...tPowerSystemResourceSequence, \"SubEquipment\", \"EqFunction\"],\n },\n Terminal: {\n parents: [...tEquipment],\n children: [...tUnNamingSequence],\n },\n Text: {\n parents: sCLTags.filter((tag) => tag !== \"Text\" && tag !== \"Private\"),\n children: [],\n },\n TimerActivatedControl: {\n parents: [\"Services\"],\n children: [],\n },\n TimeSyncProt: {\n parents: [\"Services\", \"ClientServices\"],\n children: [],\n },\n TransformerWinding: {\n parents: [\"PowerTransformer\"],\n children: [\n ...tAbstractConductingEquipmentSequence,\n \"TapChanger\",\n \"NeutralPoint\",\n \"EqFunction\",\n \"SubEquipment\",\n ],\n },\n TrgOps: {\n parents: [\"ReportControl\"],\n children: [],\n },\n Val: {\n parents: [\"DAI\", \"DA\", \"BDA\"],\n children: [],\n },\n ValueHandling: {\n parents: [\"Services\"],\n children: [],\n },\n Voltage: {\n parents: [\"VoltageLevel\"],\n children: [],\n },\n VoltageLevel: {\n parents: [\"Substation\"],\n children: [...tEquipmentContainerSequence, \"Voltage\", \"Bay\", \"Function\"],\n },\n};\nconst tagSet = new Set(sCLTags);\nexport function isSCLTag(tag) {\n return tagSet.has(tag);\n}\n//# sourceMappingURL=tags.js.map","import { isSCLTag, tags } from \"./tags.js\";\n/**\n * Helper function for to determine schema valid `reference` for OpenSCD\n * core Insert event.\n * !! only valid with Edition 2.1 projects (2007B4)\n * @param parent - The parent element the new child shall be added to\n * @param tag - The `tagName` of the new child\n * @returns Reference for new [[`tag`]] child within [[`parent`]] or `null`\n */\nexport function getReference(parent, tag) {\n if (!isSCLTag(tag))\n return null;\n const parentTag = parent.tagName;\n const children = Array.from(parent.children);\n if (parentTag === \"Services\" ||\n parentTag === \"SettingGroups\" ||\n !isSCLTag(parentTag))\n return children.find((child) => child.tagName === tag) ?? null;\n const sequence = tags[parentTag].children;\n let index = sequence.findIndex((element) => element === tag);\n if (index < 0)\n return null;\n let nextSibling;\n while (index < sequence.length && !nextSibling) {\n // eslint-disable-next-line no-loop-func\n nextSibling = children.find((child) => child.tagName === sequence[index]);\n index += 1;\n }\n return nextSibling ?? null;\n}\n//# sourceMappingURL=getReference.js.map","/** @returns object reference acc. IEC 61850-7-3 for control block elements */\nexport function controlBlockObjRef(ctrlBlock) {\n const iedName = ctrlBlock.closest(\"IED\")?.getAttribute(\"name\");\n const ldInst = ctrlBlock.closest(\"LDevice\")?.getAttribute(\"inst\");\n const parentLn = ctrlBlock.closest(\"LN,LN0\");\n const prefix = parentLn?.getAttribute(\"prefix\") ?? \"\";\n const lnClass = parentLn?.getAttribute(\"lnClass\");\n const lnInst = parentLn?.getAttribute(\"inst\") ?? \"\";\n const cbName = ctrlBlock.getAttribute(\"name\");\n if (!iedName || !ldInst || !lnClass || !cbName)\n return null;\n return `${iedName}${ldInst}/${prefix}${lnClass}${lnInst}.${cbName}`;\n}\n//# sourceMappingURL=controlBlockObjRef.js.map","import { controlBlockObjRef } from \"../tControl/controlBlockObjRef.js\";\nfunction isPublic(element) {\n return !element.closest(\"Private\");\n}\nconst elementsWithIedNameAttribute = [\n \"LNode\",\n \"ConnectedAP\",\n \"KDC\",\n \"ExtRef\",\n \"ClientLN\",\n \"Association\",\n];\nfunction updateIEDNameTextContent(ied, oldIedName, newIedName) {\n return Array.from(ied.ownerDocument.getElementsByTagName(\"IEDName\"))\n .filter(isPublic)\n .filter((iedName) => iedName.textContent === oldIedName)\n .map((iedName) => {\n const node = Array.from(iedName.childNodes).find((node) => node.nodeType === Node.TEXT_NODE);\n return [\n { node },\n { parent: iedName, node: document.createTextNode(newIedName) },\n ];\n });\n}\n/** Valid is:\n * 1. there is an control block in the IED with the name change (ied)\n * 2. this control block is subscribed in otherIED (iedName, srcLDInst and srcCBName match)\n * 3. there is a LGOS/LSVS > ... > setSrcRef holding this control block object reference\n */\nfunction validSubscriptionSupervision(ied, otherIED, oldIedName) {\n // for GSEControl elements\n const lgosVals = Array.from(ied.querySelectorAll(\"GSEControl\"))\n .filter((srcCB) => {\n //filter out all control blocks that are not subscribed in otherIED\n const srcLDInst = srcCB.closest(\"LDevice\")?.getAttribute(\"inst\");\n return !!otherIED.querySelector(`:scope > AccessPoint > Server > LDevice \n ExtRef[iedName=\"${oldIedName}\"][srcLDInst=\"${srcLDInst}\"][srcCBName=\"${srcCB.getAttribute(\"name\")}\"]`);\n })\n .map((srcCB) => {\n const objRef = controlBlockObjRef(srcCB);\n return Array.from(otherIED.querySelectorAll(`:scope > AccessPoint > Server > LDevice > LN[lnClass=\"LGOS\"] > \n DOI[name=\"GoCBRef\"] > DAI[name=\"setSrcRef\"] > Val`)).find((val) => val.textContent === objRef);\n })\n .filter((val) => val);\n // for SampledValueControl elements\n const lsvsVals = Array.from(ied.querySelectorAll(\"SampledValueControl\"))\n .filter((srcCB) => {\n //filter out all control blocks that are not subscribed in otherIED\n const srcLDInst = srcCB.closest(\"LDevice\")?.getAttribute(\"inst\");\n return !!otherIED.querySelector(`:scope > AccessPoint > Server > LDevice \n ExtRef[iedName=\"${oldIedName}\"][srcLDInst=\"${srcLDInst}\"][srcCBName=\"${srcCB.getAttribute(\"name\")}\"]`);\n })\n .map((srcCB) => {\n const objRef = controlBlockObjRef(srcCB);\n return Array.from(otherIED.querySelectorAll(`:scope > AccessPoint > Server > LDevice > LN[lnClass=\"LSVS\"] > \n DOI[name=\"SvCBRef\"] > DAI[name=\"setSrcRef\"] > Val`)).find((val) => val.textContent === objRef);\n })\n .filter((val) => val);\n return [...lgosVals, ...lsvsVals];\n}\nfunction updateSubscriptionSupervision(ied, oldIedName, newIedName) {\n const vals = Array.from(ied.ownerDocument.querySelectorAll(\":root > IED\")).flatMap((otherIED) => validSubscriptionSupervision(ied, otherIED, oldIedName));\n return vals.flatMap((val) => {\n const oldContent = val.textContent;\n const newContent = oldContent.replace(oldIedName, newIedName);\n const newTextNode = document.createTextNode(newContent);\n const node = Array.from(val.childNodes).find((childNode) => childNode.nodeType === Node.TEXT_NODE);\n return [{ node }, { parent: val, node: newTextNode }];\n });\n}\nfunction updateIedNameAttributes(ied, oldIedName, newIedName) {\n const selector = elementsWithIedNameAttribute\n .map((iedNameElement) => `${iedNameElement}[iedName=\"${oldIedName}\"]`)\n .join(\",\");\n return Array.from(ied.ownerDocument.querySelectorAll(selector))\n .filter(isPublic)\n .map((element) => {\n return { element, attributes: { iedName: newIedName } };\n });\n}\n/**\n * Function to schema valid update name and other attribute(s) in IED element\n * (rename IED)\n * ```md\n * The function makes sure to also\n * 1. Update all elements with iedName attribute referenced to the IED.name\n * attribute such as LNode, ClientLN, ExtRef, KDC, Association, ConnectedAP\n * 2. Update all control block object references pointing to the IED\n * 3. Updates IEDName elements text content\n * ```\n * @param update - IED element and attributes to be changed in the IED element\n * @returns - Set of addition edits updating all references SCL elements\n */\nexport function updateIED(update) {\n if (update.element.tagName !== \"IED\")\n return [];\n if (!update.attributes.name)\n return [update];\n const ied = update.element;\n const oldIedName = ied.getAttribute(\"name\");\n const newIedName = update.attributes.name;\n if (!oldIedName)\n return [];\n return [\n update,\n ...updateIedNameAttributes(ied, oldIedName, newIedName),\n ...updateSubscriptionSupervision(ied, oldIedName, newIedName),\n ...updateIEDNameTextContent(ied, oldIedName, newIedName),\n ];\n}\n//# sourceMappingURL=updateIED.js.map","const maxGseMacAddress = 0x010ccd0101ff;\nconst minGseMacAddress = 0x010ccd010000;\nconst maxSmvMacAddress = 0x010ccd0401ff;\nconst minSmvMacAddress = 0x010ccd040000;\nfunction convertToMac(mac) {\n const str = 0 + mac.toString(16).toUpperCase();\n const arr = str.match(/.{1,2}/g);\n return arr.join(\"-\");\n}\nconst gseMacRange = Array(maxGseMacAddress - minGseMacAddress)\n .fill(1)\n .map((_, i) => convertToMac(minGseMacAddress + i));\nconst smvMacRange = Array(maxSmvMacAddress - minSmvMacAddress)\n .fill(1)\n .map((_, i) => convertToMac(minSmvMacAddress + i));\n/** Generator function returning `MAC-Address` within `doc`. Defined once it can\n * generate unique `MAC-address` without the need to update the `doc` in-between:\n * @example\n * ```ts\n * const macGenerator = macAddressGenerator(doc,\"GSE\");\n * const mac1 = macGenerator(); //01-0C-CD-01-00-09\n * const mac2 = macGenerator(); //01-0C-CD-01-00-0A\n * ```\n * @param doc - Project SCL as XMLDocument\n * @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)\n * @returns A function generating increasing unused `MAC-Address` within `doc`\n * on subsequent invocations\n */\nexport function macAddressGenerator(doc, serviceType) {\n const macs = new Set(Array.from(doc.querySelectorAll(`${serviceType} > Address > P[type=\"MAC-Address\"]`)).map((mac) => mac.textContent));\n const range = serviceType === \"SMV\" ? smvMacRange : gseMacRange;\n return () => {\n const uniqueMAC = range.find((mac) => !macs.has(mac));\n if (uniqueMAC)\n macs.add(uniqueMAC);\n return uniqueMAC ?? null;\n };\n}\n//# sourceMappingURL=macAddressGenerator.js.map","const maxGseAppId = 0x3fff;\nconst minGseAppId = 0x0000;\n// APPID range for Type1A(Trip) GOOSE acc. IEC 61850-8-1\nconst maxGseTripAppId = 0xbfff;\nconst minGseTripAppId = 0x8000;\nconst maxSmvAppId = 0x7fff;\nconst minSmvAppId = 0x4000;\nconst gseAppIdRange = Array(maxGseAppId - minGseAppId)\n .fill(1)\n .map((_, i) => (minGseAppId + i).toString(16).toUpperCase().padStart(4, \"0\"));\nconst gseTripAppIdRange = Array(maxGseTripAppId - minGseTripAppId)\n .fill(1)\n .map((_, i) => (minGseTripAppId + i).toString(16).toUpperCase().padStart(4, \"0\"));\nconst smvAppIdRange = Array(maxSmvAppId - minSmvAppId)\n .fill(1)\n .map((_, i) => (minSmvAppId + i).toString(16).toUpperCase().padStart(4, \"0\"));\n/** Generator function returning unique `APPID` within `doc`. Defined once it\n * can generate unique `APPID`s without the need to update the `doc` in-between\n * ```md\n * GSE: 0x0000 - 0x3FFF\n * GSE Type1A: 0x8000 - 0xBFFF\n * SMV: 0x4000 - 0x7FFF\n * ```\n * @example\n * ```ts\n * const appIdGen = appIdGenerator(doc,\"GSE\");\n * const appId1 = appIdGen(); //0001\n * const appId2 = appIdGen(); //000A\n * ```\n * @param doc - Project SCL as XMLDocument\n * @param serviceType - SampledValueControl (SMV) or GSEControl (GSE)\n * @param type1A - Whether the GOOSE is a Trip GOOSE resulting\n * in different APPID range - default false\n * @returns A function generating increasing unused `APPID` within `doc`\n * on subsequent invocations\n */\nexport function appIdGenerator(doc, serviceType, type1A = false) {\n const appIds = new Set(Array.from(doc.querySelectorAll(`${serviceType} > Address > P[type=\"APPID\"]`)).map((appId) => appId.textContent));\n const range = \n // eslint-disable-next-line no-nested-ternary\n serviceType === \"SMV\"\n ? smvAppIdRange\n : type1A\n ? gseTripAppIdRange\n : gseAppIdRange;\n return () => {\n const uniqueAppId = range.find((appId) => !appIds.has(appId));\n if (uniqueAppId)\n appIds.add(uniqueAppId);\n return uniqueAppId ?? null;\n };\n}\n//# sourceMappingURL=appIdGenerator.js.map","export function getChildElementsByTagName(element, tag) {\n return Array.from(element.children).filter((element) => element.tagName === tag);\n}\n/** maximum value for `lnInst` attribute */\nconst maxLnInst = 99;\nconst lnInstRange = Array(maxLnInst)\n .fill(1)\n .map((_, i) => `${i + 1}`);\n/**\n * Generator function returning unique `inst` or `lnInst` attribute for element\n * [[`tagName`]] within [[`parent`]].\n * ```md\n * Valid range for both `inst` and `lnInst` is between 1 and 99\n * ```\n * @param parent - The parent element to be scanned for `inst` or `lnInst`\n * values already in use. Be sure to create a new generator every time the\n * children of this element change in SCL.\n * @param tagName - Tag name of the child elements containing the\n * `lnInst` or `inst` attribute\n * @returns a function generating increasing unused `inst` or `lnInst` values\n * element with [[`tagName`]] within [[`parent`]] on subsequent invocations\n */\nexport function lnInstGenerator(parent, tagName) {\n const generators = new Map();\n const generatedAttribute = tagName === \"LN\" ? \"inst\" : \"lnInst\";\n return (lnClass) => {\n if (!generators.has(lnClass)) {\n const lnInstOrInst = new Set(getChildElementsByTagName(parent, tagName)\n .filter((element) => element.getAttribute(\"lnClass\") === lnClass)\n .map((element) => element.getAttribute(generatedAttribute)));\n generators.set(lnClass, () => {\n const uniqueLnInstOrInst = lnInstRange.find((lnInst) => !lnInstOrInst.has(lnInst));\n if (uniqueLnInstOrInst)\n lnInstOrInst.add(uniqueLnInstOrInst);\n return uniqueLnInstOrInst;\n });\n }\n return generators.get(lnClass)();\n };\n}\n//# sourceMappingURL=lnInstGenerator.js.map","const dataObjects = await fetch(new URL(\"../foundation/nsd.json\", import.meta.url)).then((res) => res.json());\n/**\n * This function returns the common data class `CDC` of the\n * specified data object `pDO` and the basic type of the specified\n * data attribute `pDA`.\n * ```md\n * The `CDC` of a given `pDO` is determined based on NSD files.\n * This function therefore assumes the `pDO` to be a data object defined\n * in the namespace of the IEC 61850-7-4 and IEC 61850-7-3\n * ```\n * @param extRef - The later binding type external reference\n * @returns An object that contains the `cdc` and with existing `pDA`\n * the `bType` or undefined if no valid specification can be returned\n */\nexport function extRefTypeRestrictions(extRef) {\n const [pDO, pDA] = [\"pDO\", \"pDA\"].map((attr) => extRef.getAttribute(attr));\n if (!pDO)\n return;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const dataObject = dataObjects[pDO];\n const cdc = dataObject?.cdc ?? null;\n if (!cdc)\n return;\n if (!pDA && cdc)\n return { cdc };\n const dataAttribute = dataObject.children[pDA];\n const bType = dataAttribute?.bType ?? null;\n if (!bType)\n return;\n return { cdc, bType };\n}\n//# sourceMappingURL=extRefTypeRestrictions.js.map","/* eslint-disable no-use-before-define */\nimport { isSCLTag } from \"./tags.js\";\nfunction hitemIdentity(e) {\n return `${e.getAttribute(\"version\")}\\t${e.getAttribute(\"revision\")}`;\n}\nfunction terminalIdentity(e) {\n return `${identity(e.parentElement)}>${e.getAttribute(\"connectivityNode\")}`;\n}\nfunction lNodeIdentity(e) {\n const [iedName, ldInst, prefix, lnClass, lnInst, lnType] = [\n \"iedName\",\n \"ldInst\",\n \"prefix\",\n \"lnClass\",\n \"lnInst\",\n \"lnType\",\n ].map((name) => e.getAttribute(name));\n if (iedName === \"None\")\n return `${identity(e.parentElement)}>(${lnClass} ${lnType})`;\n return `${iedName} ${ldInst || \"(Client)\"}/${prefix ?? \"\"} ${lnClass} ${lnInst ?? \"\"}`;\n}\nfunction kDCIdentity(e) {\n return `${identity(e.parentElement)}>${e.getAttribute(\"iedName\")} ${e.getAttribute(\"apName\")}`;\n}\nfunction associationIdentity(e) {\n const [iedName, ldInst, prefix, lnClass, lnInst] = [\n \"iedName\",\n \"ldInst\",\n \"prefix\",\n \"lnClass\",\n \"lnInst\",\n \"lnType\",\n ].map((name) => e.getAttribute(name));\n return `${identity(e.parentElement)}>${iedName} ${ldInst}/${prefix ?? \"\"} ${lnClass} ${lnInst ?? \"\"}`;\n}\nfunction lDeviceIdentity(e) {\n return `${identity(e.closest(\"IED\"))}>>${e.getAttribute(\"inst\")}`;\n}\nfunction iEDNameIdentity(e) {\n const iedName = e.textContent;\n const [apRef, ldInst, prefix, lnClass, lnInst] = [\n \"apRef\",\n \"ldInst\",\n \"prefix\",\n \"lnClass\",\n \"lnInst\",\n ].map((name) => e.getAttribute(name));\n return `${identity(e.parentElement)}>${iedName} ${apRef || \"\"} ${ldInst || \"\"}/${prefix ?? \"\"} ${lnClass ?? \"\"} ${lnInst ?? \"\"}`;\n}\nfunction fCDAIdentity(e) {\n const [ldInst, prefix, lnClass, lnInst, doName, daName, fc, ix] = [\n \"ldInst\",\n \"prefix\",\n \"lnClass\",\n \"lnInst\",\n \"doName\",\n \"daName\",\n \"fc\",\n \"ix\",\n ].map((name) => e.getAttribute(name));\n const dataPath = `${ldInst}/${prefix ?? \"\"} ${lnClass} ${lnInst ?? \"\"}.${doName} ${daName || \"\"}`;\n return `${identity(e.parentElement)}>${dataPath} (${fc}${ix ? ` [${ix}]` : \"\"})`;\n}\nfunction extRefIdentity(e) {\n if (!e.parentElement)\n return NaN;\n const parentIdentity = identity(e.parentElement);\n const iedName = e.getAttribute(\"iedName\");\n const intAddr = e.getAttribute(\"intAddr\");\n const intAddrIndex = Array.from(e.parentElement.querySelectorAll(`ExtRef[intAddr=\"${intAddr}\"]`)).indexOf(e);\n if (intAddr)\n return `${parentIdentity}>${intAddr}[${intAddrIndex}]`;\n const [ldInst, prefix, lnClass, lnInst, doName, daName, serviceType, srcLDInst, srcPrefix, srcLNClass, srcLNInst, srcCBName,] = [\n \"ldInst\",\n \"prefix\",\n \"lnClass\",\n \"lnInst\",\n \"doName\",\n \"daName\",\n \"serviceType\",\n \"srcLDInst\",\n \"srcPrefix\",\n \"srcLNClass\",\n \"srcLNInst\",\n \"srcCBName\",\n ].map((name) => e.getAttribute(name));\n const defaultSrcPrefix = \"\";\n const finalSrcPrefix = srcPrefix ?? defaultSrcPrefix;\n const defaultSrcLNInst = \"\";\n const finalSrcLNInst = srcLNInst ?? defaultSrcLNInst;\n const cbPath = srcCBName\n ? `${serviceType}:${srcCBName} ${srcLDInst}/${finalSrcPrefix} ${srcLNClass} ${finalSrcLNInst}`\n : \"\";\n const defaultPrefix = \"\";\n const finalPrefix = prefix ?? defaultPrefix;\n const defaultLnInst = \"\";\n const finalLnInst = lnInst ?? defaultLnInst;\n const defaultDaName = \"\";\n const finalDaName = daName || defaultDaName;\n const dataPath = `${iedName} ${ldInst}/${finalPrefix} ${lnClass} ${finalLnInst} ${doName} ${finalDaName}`;\n return `${parentIdentity}>${cbPath ? `${cbPath} ` : \"\"}${dataPath}`;\n}\nfunction lNIdentity(e) {\n const [prefix, lnClass, inst] = [\"prefix\", \"lnClass\", \"inst\"].map((name) => e.getAttribute(name));\n return `${identity(e.parentElement)}>${prefix ?? \"\"} ${lnClass} ${inst}`;\n}\nfunction clientLNIdentity(e) {\n const [apRef, iedName, ldInst, prefix, lnClass, lnInst] = [\n \"apRef\",\n \"iedName\",\n \"ldInst\",\n \"prefix\",\n \"lnClass\",\n \"lnInst\",\n ].map((name) => e.getAttribute(name));\n return `${identity(e.parentElement)}>${iedName} ${apRef || \"\"} ${ldInst}/${prefix ?? \"\"} ${lnClass} ${lnInst}`;\n}\nfunction ixNamingIdentity(e) {\n const [name, ix] = [\"name\", \"ix\"].map((naming) => e.getAttribute(naming));\n return `${identity(e.parentElement)}>${name}${ix ? `[${ix}]` : \"\"}`;\n}\nfunction valIdentity(e) {\n if (!e.parentElement)\n return NaN;\n const sGroup = e.getAttribute(\"sGroup\");\n const index = Array.from(e.parentElement.children)\n .filter((child) => child.getAttribute(\"sGroup\") === sGroup)\n .findIndex((child) => child.isSameNode(e));\n return `${identity(e.parentElement)}>${sGroup ? `${sGroup}` : \"\"} ${index}`;\n}\nfunction connectedAPIdentity(e) {\n const [iedName, apName] = [\"iedName\", \"apName\"].map((name) => e.getAttribute(name));\n return `${iedName} ${apName}`;\n}\nfunction controlBlockIdentity(e) {\n const [ldInst, cbName] = [\"ldInst\", \"cbName\"].map((name) => e.getAttribute(name));\n return `${ldInst} ${cbName}`;\n}\nfunction physConnIdentity(e) {\n if (!e.parentElement)\n return NaN;\n const pcType = e.getAttribute(\"type\");\n if (e.parentElement.children.length > 1 &&\n pcType !== \"Connection\" &&\n pcType !== \"RedConn\")\n return NaN;\n return `${identity(e.parentElement)}>${pcType}`;\n}\nfunction pIdentity(e) {\n if (!e.parentElement)\n return NaN;\n const eParent = e.parentElement;\n const eType = e.getAttribute(\"type\");\n if (eParent.tagName === \"PhysConn\")\n return `${identity(e.parentElement)}>${eType}`;\n const index = Array.from(e.parentElement.children)\n .filter((child) => child.getAttribute(\"type\") === eType)\n .findIndex((child) => child.isSameNode(e));\n return `${identity(e.parentElement)}>${eType} [${index}]`;\n}\nfunction enumValIdentity(e) {\n return `${identity(e.parentElement)}>${e.getAttribute(\"ord\")}`;\n}\nfunction protNsIdentity(e) {\n if (!e.parentElement)\n return NaN;\n const type = e.getAttribute(\"type\");\n return `${identity(e.parentElement)}>${type || \"8-MMS\"}\\t${e.textContent}`;\n}\nfunction sCLIdentity() {\n return \"\";\n}\nfunction namingIdentity(e) {\n return e.parentElement.tagName === \"SCL\"\n ? e.getAttribute(\"name\")\n : `${identity(e.parentElement)}>${e.getAttribute(\"name\")}`;\n}\nfunction singletonIdentity(e) {\n return identity(e.parentElement).toString();\n}\nfunction idNamingIdentity(e) {\n return `#${e.id}`;\n}\nconst tags = {\n AccessControl: {\n identity: singletonIdentity,\n },\n AccessPoint: {\n identity: namingIdentity,\n },\n Address: {\n identity: singletonIdentity,\n },\n Association: {\n identity: associationIdentity,\n },\n Authentication: {\n identity: singletonIdentity,\n },\n BDA: {\n identity: namingIdentity,\n },\n BitRate: {\n identity: singletonIdentity,\n },\n Bay: {\n identity: namingIdentity,\n },\n ClientLN: {\n identity: clientLNIdentity,\n },\n ClientServices: {\n identity: singletonIdentity,\n },\n CommProt: {\n identity: singletonIdentity,\n },\n Communication: {\n identity: singletonIdentity,\n },\n ConductingEquipment: {\n identity: namingIdentity,\n },\n ConfDataSet: {\n identity: singletonIdentity,\n },\n ConfLdName: {\n identity: singletonIdentity,\n },\n ConfLNs: {\n identity: singletonIdentity,\n },\n ConfLogControl: {\n identity: singletonIdentity,\n },\n ConfReportControl: {\n identity: singletonIdentity,\n },\n ConfSG: {\n identity: singletonIdentity,\n },\n ConfSigRef: {\n identity: singletonIdentity,\n },\n ConnectedAP: {\n identity: connectedAPIdentity,\n },\n ConnectivityNode: {\n identity: namingIdentity,\n },\n DA: {\n identity: namingIdentity,\n },\n DAI: {\n identity: ixNamingIdentity,\n },\n DAType: {\n identity: idNamingIdentity,\n },\n DO: {\n identity: namingIdentity,\n },\n DOI: {\n identity: namingIdentity,\n },\n DOType: {\n identity: idNamingIdentity,\n },\n DataObjectDirectory: {\n identity: singletonIdentity,\n },\n DataSet: {\n identity: namingIdentity,\n },\n DataSetDirectory: {\n identity: singletonIdentity,\n },\n DataTypeTemplates: {\n identity: singletonIdentity,\n },\n DynAssociation: {\n identity: singletonIdentity,\n },\n DynDataSet: {\n identity: singletonIdentity,\n },\n EnumType: {\n identity: idNamingIdentity,\n },\n EnumVal: {\n identity: enumValIdentity,\n },\n EqFunction: {\n identity: namingIdentity,\n },\n EqSubFunction: {\n identity: namingIdentity,\n },\n ExtRef: {\n identity: extRefIdentity,\n },\n FCDA: {\n identity: fCDAIdentity,\n },\n FileHandling: {\n identity: singletonIdentity,\n },\n Function: {\n identity: namingIdentity,\n },\n GeneralEquipment: {\n identity: namingIdentity,\n },\n GetCBValues: {\n identity: singletonIdentity,\n },\n GetDataObjectDefinition: {\n identity: singletonIdentity,\n },\n GetDataSetValue: {\n identity: singletonIdentity,\n },\n GetDirectory: {\n identity: singletonIdentity,\n },\n GOOSE: {\n identity: singletonIdentity,\n },\n GOOSESecurity: {\n identity: namingIdentity,\n },\n GSE: {\n identity: controlBlockIdentity,\n },\n GSEDir: {\n identity: singletonIdentity,\n },\n GSEControl: {\n identity: namingIdentity,\n },\n GSESettings: {\n identity: singletonIdentity,\n },\n GSSE: {\n identity: singletonIdentity,\n },\n Header: {\n identity: singletonIdentity,\n },\n History: {\n identity: singletonIdentity,\n },\n Hitem: {\n identity: hitemIdentity,\n },\n IED: {\n identity: namingIdentity,\n },\n IEDName: {\n identity: iEDNameIdentity,\n },\n Inputs: {\n identity: singletonIdentity,\n },\n IssuerName: {\n identity: singletonIdentity,\n },\n KDC: {\n identity: kDCIdentity,\n },\n LDevice: {\n identity: lDeviceIdentity,\n },\n LN: {\n identity: lNIdentity,\n },\n LN0: {\n identity: singletonIdentity,\n },\n LNode: {\n identity: lNodeIdentity,\n },\n LNodeType: {\n identity: idNamingIdentity,\n },\n Line: {\n identity: namingIdentity,\n },\n Log: {\n identity: namingIdentity,\n },\n LogControl: {\n identity: namingIdentity,\n },\n LogSettings: {\n identity: singletonIdentity,\n },\n MaxTime: {\n identity: singletonIdentity,\n },\n McSecurity: {\n identity: singletonIdentity,\n },\n MinTime: {\n identity: singletonIdentity,\n },\n NeutralPoint: {\n identity: terminalIdentity,\n },\n OptFields: {\n identity: singletonIdentity,\n },\n P: {\n identity: pIdentity,\n },\n PhysConn: {\n identity: physConnIdentity,\n },\n PowerTransformer: {\n identity: namingIdentity,\n },\n Process: {\n identity: namingIdentity,\n },\n ProtNs: {\n identity: protNsIdentity,\n },\n Protocol: {\n identity: singletonIdentity,\n },\n ReadWrite: {\n identity: singletonIdentity,\n },\n RedProt: {\n identity: singletonIdentity,\n },\n ReportControl: {\n identity: namingIdentity,\n },\n ReportSettings: {\n identity: singletonIdentity,\n },\n RptEnabled: {\n identity: singletonIdentity,\n },\n SamplesPerSec: {\n identity: singletonIdentity,\n },\n SampledValueControl: {\n identity: namingIdentity,\n },\n SecPerSamples: {\n identity: singletonIdentity,\n },\n SCL: {\n identity: sCLIdentity,\n },\n SDI: {\n identity: ixNamingIdentity,\n },\n SDO: {\n identity: namingIdentity,\n },\n Server: {\n identity: singletonIdentity,\n },\n ServerAt: {\n identity: singletonIdentity,\n },\n Services: {\n identity: singletonIdentity,\n },\n SetDataSetValue: {\n identity: singletonIdentity,\n },\n SettingControl: {\n identity: singletonIdentity,\n },\n SettingGroups: {\n identity: singletonIdentity,\n },\n SGEdit: {\n identity: singletonIdentity,\n },\n SmpRate: {\n identity: singletonIdentity,\n },\n SMV: {\n identity: controlBlockIdentity,\n },\n SmvOpts: {\n identity: singletonIdentity,\n },\n SMVsc: {\n identity: singletonIdentity,\n },\n SMVSecurity: {\n identity: namingIdentity,\n },\n SMVSettings: {\n identity: singletonIdentity,\n },\n SubEquipment: {\n identity: namingIdentity,\n },\n SubFunction: {\n identity: namingIdentity,\n },\n SubNetwork: {\n identity: namingIdentity,\n },\n Subject: {\n identity: singletonIdentity,\n },\n Substation: {\n identity: namingIdentity,\n },\n SupSubscription: {\n identity: singletonIdentity,\n },\n TapChanger: {\n identity: namingIdentity,\n },\n Terminal: {\n identity: terminalIdentity,\n },\n Text: {\n identity: singletonIdentity,\n },\n TimerActivatedControl: {\n identity: singletonIdentity,\n },\n TimeSyncProt: {\n identity: singletonIdentity,\n },\n TransformerWinding: {\n identity: namingIdentity,\n },\n TrgOps: {\n identity: singletonIdentity,\n },\n Val: {\n identity: valIdentity,\n },\n ValueHandling: {\n identity: singletonIdentity,\n },\n Voltage: {\n identity: singletonIdentity,\n },\n VoltageLevel: {\n identity: namingIdentity,\n },\n};\n/** @returns Identity string for a valid SCL element or NaN */\nexport function identity(e) {\n if (e === null)\n return NaN;\n if (e.closest(\"Private\"))\n return NaN;\n const tag = e.tagName;\n if (isSCLTag(tag))\n return tags[tag].identity(e);\n return NaN;\n}\n//# sourceMappingURL=identity.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport '@material/mwc-ripple/mwc-ripple.js';\nimport { observer } from '@material/mwc-base/observer.js';\nimport { RippleHandlers } from '@material/mwc-ripple/ripple-handlers.js';\nimport { html, LitElement } from 'lit';\nimport { property, query, queryAsync, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n/**\n * @fires request-selected {RequestSelectedDetail}\n * @fires list-item-rendered\n */\nexport class ListItemBase extends LitElement {\n constructor() {\n super(...arguments);\n this.value = '';\n this.group = null;\n this.tabindex = -1;\n this.disabled = false;\n this.twoline = false;\n this.activated = false;\n this.graphic = null;\n this.multipleGraphics = false;\n this.hasMeta = false;\n this.noninteractive = false;\n this.selected = false;\n this.shouldRenderRipple = false;\n this._managingList = null;\n this.boundOnClick = this.onClick.bind(this);\n this._firstChanged = true;\n this._skipPropRequest = false;\n this.rippleHandlers = new RippleHandlers(() => {\n this.shouldRenderRipple = true;\n return this.ripple;\n });\n this.listeners = [\n {\n target: this,\n eventNames: ['click'],\n cb: () => {\n this.onClick();\n },\n },\n {\n target: this,\n eventNames: ['mouseenter'],\n cb: this.rippleHandlers.startHover,\n },\n {\n target: this,\n eventNames: ['mouseleave'],\n cb: this.rippleHandlers.endHover,\n },\n {\n target: this,\n eventNames: ['focus'],\n cb: this.rippleHandlers.startFocus,\n },\n {\n target: this,\n eventNames: ['blur'],\n cb: this.rippleHandlers.endFocus,\n },\n {\n target: this,\n eventNames: ['mousedown', 'touchstart'],\n cb: (e) => {\n const name = e.type;\n this.onDown(name === 'mousedown' ? 'mouseup' : 'touchend', e);\n },\n },\n ];\n }\n get text() {\n const textContent = this.textContent;\n return textContent ? textContent.trim() : '';\n }\n render() {\n const text = this.renderText();\n const graphic = this.graphic ? this.renderGraphic() : html ``;\n const meta = this.hasMeta ? this.renderMeta() : html ``;\n return html `\n ${this.renderRipple()}\n ${graphic}\n ${text}\n ${meta}`;\n }\n renderRipple() {\n if (this.shouldRenderRipple) {\n return html `\n \n `;\n }\n else if (this.activated) {\n return html `
`;\n }\n else {\n return '';\n }\n }\n renderGraphic() {\n const graphicClasses = {\n multi: this.multipleGraphics,\n };\n return html `\n \n \n `;\n }\n renderMeta() {\n return html `\n \n \n `;\n }\n renderText() {\n const inner = this.twoline ? this.renderTwoline() : this.renderSingleLine();\n return html `\n \n ${inner}\n `;\n }\n renderSingleLine() {\n return html ``;\n }\n renderTwoline() {\n return html `\n \n \n \n \n \n \n `;\n }\n onClick() {\n this.fireRequestSelected(!this.selected, 'interaction');\n }\n onDown(upName, evt) {\n const onUp = () => {\n window.removeEventListener(upName, onUp);\n this.rippleHandlers.endPress();\n };\n window.addEventListener(upName, onUp);\n this.rippleHandlers.startPress(evt);\n }\n fireRequestSelected(selected, source) {\n if (this.noninteractive) {\n return;\n }\n const customEv = new CustomEvent('request-selected', { bubbles: true, composed: true, detail: { source, selected } });\n this.dispatchEvent(customEv);\n }\n connectedCallback() {\n super.connectedCallback();\n if (!this.noninteractive) {\n this.setAttribute('mwc-list-item', '');\n }\n for (const listener of this.listeners) {\n for (const eventName of listener.eventNames) {\n listener.target.addEventListener(eventName, listener.cb, { passive: true });\n }\n }\n }\n disconnectedCallback() {\n super.disconnectedCallback();\n for (const listener of this.listeners) {\n for (const eventName of listener.eventNames) {\n listener.target.removeEventListener(eventName, listener.cb);\n }\n }\n if (this._managingList) {\n this._managingList.debouncedLayout ?\n this._managingList.debouncedLayout(true) :\n this._managingList.layout(true);\n }\n }\n // composed flag, event fire through shadow root and up through composed tree\n firstUpdated() {\n const ev = new Event('list-item-rendered', { bubbles: true, composed: true });\n this.dispatchEvent(ev);\n }\n}\n__decorate([\n query('slot')\n], ListItemBase.prototype, \"slotElement\", void 0);\n__decorate([\n queryAsync('mwc-ripple')\n], ListItemBase.prototype, \"ripple\", void 0);\n__decorate([\n property({ type: String })\n], ListItemBase.prototype, \"value\", void 0);\n__decorate([\n property({ type: String, reflect: true })\n], ListItemBase.prototype, \"group\", void 0);\n__decorate([\n property({ type: Number, reflect: true })\n], ListItemBase.prototype, \"tabindex\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true }),\n observer(function (value) {\n if (value) {\n this.setAttribute('aria-disabled', 'true');\n }\n else {\n this.setAttribute('aria-disabled', 'false');\n }\n })\n], ListItemBase.prototype, \"disabled\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true })\n], ListItemBase.prototype, \"twoline\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true })\n], ListItemBase.prototype, \"activated\", void 0);\n__decorate([\n property({ type: String, reflect: true })\n], ListItemBase.prototype, \"graphic\", void 0);\n__decorate([\n property({ type: Boolean })\n], ListItemBase.prototype, \"multipleGraphics\", void 0);\n__decorate([\n property({ type: Boolean })\n], ListItemBase.prototype, \"hasMeta\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true }),\n observer(function (value) {\n if (value) {\n this.removeAttribute('aria-checked');\n this.removeAttribute('mwc-list-item');\n this.selected = false;\n this.activated = false;\n this.tabIndex = -1;\n }\n else {\n this.setAttribute('mwc-list-item', '');\n }\n })\n], ListItemBase.prototype, \"noninteractive\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true }),\n observer(function (value) {\n const role = this.getAttribute('role');\n const isAriaSelectable = role === 'gridcell' || role === 'option' ||\n role === 'row' || role === 'tab';\n if (isAriaSelectable && value) {\n this.setAttribute('aria-selected', 'true');\n }\n else if (isAriaSelectable) {\n this.setAttribute('aria-selected', 'false');\n }\n if (this._firstChanged) {\n this._firstChanged = false;\n return;\n }\n if (this._skipPropRequest) {\n return;\n }\n this.fireRequestSelected(value, 'property');\n })\n], ListItemBase.prototype, \"selected\", void 0);\n__decorate([\n state()\n], ListItemBase.prototype, \"shouldRenderRipple\", void 0);\n__decorate([\n state()\n], ListItemBase.prototype, \"_managingList\", void 0);\n//# sourceMappingURL=mwc-list-item-base.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-LIcense-Identifier: Apache-2.0\n */\nimport { css } from 'lit';\nexport const styles = css `:host{cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent;height:48px;display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;padding:0;padding-left:var(--mdc-list-side-padding, 16px);padding-right:var(--mdc-list-side-padding, 16px);outline:none;height:48px;color:rgba(0,0,0,.87);color:var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87))}:host:focus{outline:none}:host([activated]){color:#6200ee;color:var(--mdc-theme-primary, #6200ee);--mdc-ripple-color: var( --mdc-theme-primary, #6200ee )}:host([activated]) .mdc-deprecated-list-item__graphic{color:#6200ee;color:var(--mdc-theme-primary, #6200ee)}:host([activated]) .fake-activated-ripple::before{position:absolute;display:block;top:0;bottom:0;left:0;right:0;width:100%;height:100%;pointer-events:none;z-index:1;content:\"\";opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12);background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-deprecated-list-item__graphic{flex-shrink:0;align-items:center;justify-content:center;fill:currentColor;display:inline-flex}.mdc-deprecated-list-item__graphic ::slotted(*){flex-shrink:0;align-items:center;justify-content:center;fill:currentColor;width:100%;height:100%;text-align:center}.mdc-deprecated-list-item__meta{width:var(--mdc-list-item-meta-size, 24px);height:var(--mdc-list-item-meta-size, 24px);margin-left:auto;margin-right:0;color:rgba(0, 0, 0, 0.38);color:var(--mdc-theme-text-hint-on-background, rgba(0, 0, 0, 0.38))}.mdc-deprecated-list-item__meta.multi{width:auto}.mdc-deprecated-list-item__meta ::slotted(*){width:var(--mdc-list-item-meta-size, 24px);line-height:var(--mdc-list-item-meta-size, 24px)}.mdc-deprecated-list-item__meta ::slotted(.material-icons),.mdc-deprecated-list-item__meta ::slotted(mwc-icon){line-height:var(--mdc-list-item-meta-size, 24px) !important}.mdc-deprecated-list-item__meta ::slotted(:not(.material-icons):not(mwc-icon)){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.75rem;font-size:var(--mdc-typography-caption-font-size, 0.75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight, 400);letter-spacing:0.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, 0.0333333333em);text-decoration:inherit;text-decoration:var(--mdc-typography-caption-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform, inherit)}[dir=rtl] .mdc-deprecated-list-item__meta,.mdc-deprecated-list-item__meta[dir=rtl]{margin-left:0;margin-right:auto}.mdc-deprecated-list-item__meta ::slotted(*){width:100%;height:100%}.mdc-deprecated-list-item__text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.mdc-deprecated-list-item__text ::slotted([for]),.mdc-deprecated-list-item__text[for]{pointer-events:none}.mdc-deprecated-list-item__primary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin-top:0;line-height:normal;margin-bottom:-20px;display:block}.mdc-deprecated-list-item__primary-text::before{display:inline-block;width:0;height:32px;content:\"\";vertical-align:0}.mdc-deprecated-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:\"\";vertical-align:-20px}.mdc-deprecated-list-item__secondary-text{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-body2-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.875rem;font-size:var(--mdc-typography-body2-font-size, 0.875rem);line-height:1.25rem;line-height:var(--mdc-typography-body2-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-body2-font-weight, 400);letter-spacing:0.0178571429em;letter-spacing:var(--mdc-typography-body2-letter-spacing, 0.0178571429em);text-decoration:inherit;text-decoration:var(--mdc-typography-body2-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-body2-text-transform, inherit);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin-top:0;line-height:normal;display:block}.mdc-deprecated-list-item__secondary-text::before{display:inline-block;width:0;height:20px;content:\"\";vertical-align:0}.mdc-deprecated-list--dense .mdc-deprecated-list-item__secondary-text{font-size:inherit}* ::slotted(a),a{color:inherit;text-decoration:none}:host([twoline]){height:72px}:host([twoline]) .mdc-deprecated-list-item__text{align-self:flex-start}:host([disabled]),:host([noninteractive]){cursor:default;pointer-events:none}:host([disabled]) .mdc-deprecated-list-item__text ::slotted(*){opacity:.38}:host([disabled]) .mdc-deprecated-list-item__text ::slotted(*),:host([disabled]) .mdc-deprecated-list-item__primary-text ::slotted(*),:host([disabled]) .mdc-deprecated-list-item__secondary-text ::slotted(*){color:#000;color:var(--mdc-theme-on-surface, #000)}.mdc-deprecated-list-item__secondary-text ::slotted(*){color:rgba(0, 0, 0, 0.54);color:var(--mdc-theme-text-secondary-on-background, rgba(0, 0, 0, 0.54))}.mdc-deprecated-list-item__graphic ::slotted(*){background-color:transparent;color:rgba(0, 0, 0, 0.38);color:var(--mdc-theme-text-icon-on-background, rgba(0, 0, 0, 0.38))}.mdc-deprecated-list-group__subheader ::slotted(*){color:rgba(0, 0, 0, 0.87);color:var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87))}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic{width:var(--mdc-list-item-graphic-size, 40px);height:var(--mdc-list-item-graphic-size, 40px)}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic.multi{width:auto}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic ::slotted(*){width:var(--mdc-list-item-graphic-size, 40px);line-height:var(--mdc-list-item-graphic-size, 40px)}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic ::slotted(.material-icons),:host([graphic=avatar]) .mdc-deprecated-list-item__graphic ::slotted(mwc-icon){line-height:var(--mdc-list-item-graphic-size, 40px) !important}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic ::slotted(*){border-radius:50%}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic,:host([graphic=medium]) .mdc-deprecated-list-item__graphic,:host([graphic=large]) .mdc-deprecated-list-item__graphic,:host([graphic=control]) .mdc-deprecated-list-item__graphic{margin-left:0;margin-right:var(--mdc-list-item-graphic-margin, 16px)}[dir=rtl] :host([graphic=avatar]) .mdc-deprecated-list-item__graphic,[dir=rtl] :host([graphic=medium]) .mdc-deprecated-list-item__graphic,[dir=rtl] :host([graphic=large]) .mdc-deprecated-list-item__graphic,[dir=rtl] :host([graphic=control]) .mdc-deprecated-list-item__graphic,:host([graphic=avatar]) .mdc-deprecated-list-item__graphic[dir=rtl],:host([graphic=medium]) .mdc-deprecated-list-item__graphic[dir=rtl],:host([graphic=large]) .mdc-deprecated-list-item__graphic[dir=rtl],:host([graphic=control]) .mdc-deprecated-list-item__graphic[dir=rtl]{margin-left:var(--mdc-list-item-graphic-margin, 16px);margin-right:0}:host([graphic=icon]) .mdc-deprecated-list-item__graphic{width:var(--mdc-list-item-graphic-size, 24px);height:var(--mdc-list-item-graphic-size, 24px);margin-left:0;margin-right:var(--mdc-list-item-graphic-margin, 32px)}:host([graphic=icon]) .mdc-deprecated-list-item__graphic.multi{width:auto}:host([graphic=icon]) .mdc-deprecated-list-item__graphic ::slotted(*){width:var(--mdc-list-item-graphic-size, 24px);line-height:var(--mdc-list-item-graphic-size, 24px)}:host([graphic=icon]) .mdc-deprecated-list-item__graphic ::slotted(.material-icons),:host([graphic=icon]) .mdc-deprecated-list-item__graphic ::slotted(mwc-icon){line-height:var(--mdc-list-item-graphic-size, 24px) !important}[dir=rtl] :host([graphic=icon]) .mdc-deprecated-list-item__graphic,:host([graphic=icon]) .mdc-deprecated-list-item__graphic[dir=rtl]{margin-left:var(--mdc-list-item-graphic-margin, 32px);margin-right:0}:host([graphic=avatar]:not([twoLine])),:host([graphic=icon]:not([twoLine])){height:56px}:host([graphic=medium]:not([twoLine])),:host([graphic=large]:not([twoLine])){height:72px}:host([graphic=medium]) .mdc-deprecated-list-item__graphic,:host([graphic=large]) .mdc-deprecated-list-item__graphic{width:var(--mdc-list-item-graphic-size, 56px);height:var(--mdc-list-item-graphic-size, 56px)}:host([graphic=medium]) .mdc-deprecated-list-item__graphic.multi,:host([graphic=large]) .mdc-deprecated-list-item__graphic.multi{width:auto}:host([graphic=medium]) .mdc-deprecated-list-item__graphic ::slotted(*),:host([graphic=large]) .mdc-deprecated-list-item__graphic ::slotted(*){width:var(--mdc-list-item-graphic-size, 56px);line-height:var(--mdc-list-item-graphic-size, 56px)}:host([graphic=medium]) .mdc-deprecated-list-item__graphic ::slotted(.material-icons),:host([graphic=medium]) .mdc-deprecated-list-item__graphic ::slotted(mwc-icon),:host([graphic=large]) .mdc-deprecated-list-item__graphic ::slotted(.material-icons),:host([graphic=large]) .mdc-deprecated-list-item__graphic ::slotted(mwc-icon){line-height:var(--mdc-list-item-graphic-size, 56px) !important}:host([graphic=large]){padding-left:0px}`;\n//# sourceMappingURL=mwc-list-item.css.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { customElement } from 'lit/decorators.js';\nimport { ListItemBase } from './mwc-list-item-base.js';\nimport { styles } from './mwc-list-item.css.js';\nlet ListItem = class ListItem extends ListItemBase {\n};\nListItem.styles = [styles];\nListItem = __decorate([\n customElement('mwc-list-item')\n], ListItem);\nexport { ListItem };\n//# sourceMappingURL=mwc-list-item.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * KEY provides normalized string values for keys.\n */\nexport var KEY = {\n UNKNOWN: 'Unknown',\n BACKSPACE: 'Backspace',\n ENTER: 'Enter',\n SPACEBAR: 'Spacebar',\n PAGE_UP: 'PageUp',\n PAGE_DOWN: 'PageDown',\n END: 'End',\n HOME: 'Home',\n ARROW_LEFT: 'ArrowLeft',\n ARROW_UP: 'ArrowUp',\n ARROW_RIGHT: 'ArrowRight',\n ARROW_DOWN: 'ArrowDown',\n DELETE: 'Delete',\n ESCAPE: 'Escape',\n TAB: 'Tab',\n};\nvar normalizedKeys = new Set();\n// IE11 has no support for new Map with iterable so we need to initialize this\n// by hand.\nnormalizedKeys.add(KEY.BACKSPACE);\nnormalizedKeys.add(KEY.ENTER);\nnormalizedKeys.add(KEY.SPACEBAR);\nnormalizedKeys.add(KEY.PAGE_UP);\nnormalizedKeys.add(KEY.PAGE_DOWN);\nnormalizedKeys.add(KEY.END);\nnormalizedKeys.add(KEY.HOME);\nnormalizedKeys.add(KEY.ARROW_LEFT);\nnormalizedKeys.add(KEY.ARROW_UP);\nnormalizedKeys.add(KEY.ARROW_RIGHT);\nnormalizedKeys.add(KEY.ARROW_DOWN);\nnormalizedKeys.add(KEY.DELETE);\nnormalizedKeys.add(KEY.ESCAPE);\nnormalizedKeys.add(KEY.TAB);\nvar KEY_CODE = {\n BACKSPACE: 8,\n ENTER: 13,\n SPACEBAR: 32,\n PAGE_UP: 33,\n PAGE_DOWN: 34,\n END: 35,\n HOME: 36,\n ARROW_LEFT: 37,\n ARROW_UP: 38,\n ARROW_RIGHT: 39,\n ARROW_DOWN: 40,\n DELETE: 46,\n ESCAPE: 27,\n TAB: 9,\n};\nvar mappedKeyCodes = new Map();\n// IE11 has no support for new Map with iterable so we need to initialize this\n// by hand.\nmappedKeyCodes.set(KEY_CODE.BACKSPACE, KEY.BACKSPACE);\nmappedKeyCodes.set(KEY_CODE.ENTER, KEY.ENTER);\nmappedKeyCodes.set(KEY_CODE.SPACEBAR, KEY.SPACEBAR);\nmappedKeyCodes.set(KEY_CODE.PAGE_UP, KEY.PAGE_UP);\nmappedKeyCodes.set(KEY_CODE.PAGE_DOWN, KEY.PAGE_DOWN);\nmappedKeyCodes.set(KEY_CODE.END, KEY.END);\nmappedKeyCodes.set(KEY_CODE.HOME, KEY.HOME);\nmappedKeyCodes.set(KEY_CODE.ARROW_LEFT, KEY.ARROW_LEFT);\nmappedKeyCodes.set(KEY_CODE.ARROW_UP, KEY.ARROW_UP);\nmappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, KEY.ARROW_RIGHT);\nmappedKeyCodes.set(KEY_CODE.ARROW_DOWN, KEY.ARROW_DOWN);\nmappedKeyCodes.set(KEY_CODE.DELETE, KEY.DELETE);\nmappedKeyCodes.set(KEY_CODE.ESCAPE, KEY.ESCAPE);\nmappedKeyCodes.set(KEY_CODE.TAB, KEY.TAB);\nvar navigationKeys = new Set();\n// IE11 has no support for new Set with iterable so we need to initialize this\n// by hand.\nnavigationKeys.add(KEY.PAGE_UP);\nnavigationKeys.add(KEY.PAGE_DOWN);\nnavigationKeys.add(KEY.END);\nnavigationKeys.add(KEY.HOME);\nnavigationKeys.add(KEY.ARROW_LEFT);\nnavigationKeys.add(KEY.ARROW_UP);\nnavigationKeys.add(KEY.ARROW_RIGHT);\nnavigationKeys.add(KEY.ARROW_DOWN);\n/**\n * normalizeKey returns the normalized string for a navigational action.\n */\nexport function normalizeKey(evt) {\n var key = evt.key;\n // If the event already has a normalized key, return it\n if (normalizedKeys.has(key)) {\n return key;\n }\n // tslint:disable-next-line:deprecation\n var mappedKey = mappedKeyCodes.get(evt.keyCode);\n if (mappedKey) {\n return mappedKey;\n }\n return KEY.UNKNOWN;\n}\n/**\n * isNavigationEvent returns whether the event is a navigation event\n */\nexport function isNavigationEvent(evt) {\n return navigationKeys.has(normalizeKey(evt));\n}\n//# sourceMappingURL=keyboard.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar _a, _b;\nvar cssClasses = {\n LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated',\n LIST_ITEM_CLASS: 'mdc-list-item',\n LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled',\n LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected',\n LIST_ITEM_TEXT_CLASS: 'mdc-list-item__text',\n LIST_ITEM_PRIMARY_TEXT_CLASS: 'mdc-list-item__primary-text',\n ROOT: 'mdc-list',\n};\nvar evolutionClassNameMap = (_a = {},\n _a[\"\" + cssClasses.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-list-item--activated',\n _a[\"\" + cssClasses.LIST_ITEM_CLASS] = 'mdc-list-item',\n _a[\"\" + cssClasses.LIST_ITEM_DISABLED_CLASS] = 'mdc-list-item--disabled',\n _a[\"\" + cssClasses.LIST_ITEM_SELECTED_CLASS] = 'mdc-list-item--selected',\n _a[\"\" + cssClasses.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-list-item__primary-text',\n _a[\"\" + cssClasses.ROOT] = 'mdc-list',\n _a);\nvar deprecatedClassNameMap = (_b = {},\n _b[\"\" + cssClasses.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-deprecated-list-item--activated',\n _b[\"\" + cssClasses.LIST_ITEM_CLASS] = 'mdc-deprecated-list-item',\n _b[\"\" + cssClasses.LIST_ITEM_DISABLED_CLASS] = 'mdc-deprecated-list-item--disabled',\n _b[\"\" + cssClasses.LIST_ITEM_SELECTED_CLASS] = 'mdc-deprecated-list-item--selected',\n _b[\"\" + cssClasses.LIST_ITEM_TEXT_CLASS] = 'mdc-deprecated-list-item__text',\n _b[\"\" + cssClasses.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-deprecated-list-item__primary-text',\n _b[\"\" + cssClasses.ROOT] = 'mdc-deprecated-list',\n _b);\nvar strings = {\n ACTION_EVENT: 'MDCList:action',\n SELECTION_CHANGE_EVENT: 'MDCList:selectionChange',\n ARIA_CHECKED: 'aria-checked',\n ARIA_CHECKED_CHECKBOX_SELECTOR: '[role=\"checkbox\"][aria-checked=\"true\"]',\n ARIA_CHECKED_RADIO_SELECTOR: '[role=\"radio\"][aria-checked=\"true\"]',\n ARIA_CURRENT: 'aria-current',\n ARIA_DISABLED: 'aria-disabled',\n ARIA_ORIENTATION: 'aria-orientation',\n ARIA_ORIENTATION_HORIZONTAL: 'horizontal',\n ARIA_ROLE_CHECKBOX_SELECTOR: '[role=\"checkbox\"]',\n ARIA_SELECTED: 'aria-selected',\n ARIA_INTERACTIVE_ROLES_SELECTOR: '[role=\"listbox\"], [role=\"menu\"]',\n ARIA_MULTI_SELECTABLE_SELECTOR: '[aria-multiselectable=\"true\"]',\n CHECKBOX_RADIO_SELECTOR: 'input[type=\"checkbox\"], input[type=\"radio\"]',\n CHECKBOX_SELECTOR: 'input[type=\"checkbox\"]',\n CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: \"\\n .\" + cssClasses.LIST_ITEM_CLASS + \" button:not(:disabled),\\n .\" + cssClasses.LIST_ITEM_CLASS + \" a,\\n .\" + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + \" button:not(:disabled),\\n .\" + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + \" a\\n \",\n DEPRECATED_SELECTOR: '.mdc-deprecated-list',\n FOCUSABLE_CHILD_ELEMENTS: \"\\n .\" + cssClasses.LIST_ITEM_CLASS + \" button:not(:disabled),\\n .\" + cssClasses.LIST_ITEM_CLASS + \" a,\\n .\" + cssClasses.LIST_ITEM_CLASS + \" input[type=\\\"radio\\\"]:not(:disabled),\\n .\" + cssClasses.LIST_ITEM_CLASS + \" input[type=\\\"checkbox\\\"]:not(:disabled),\\n .\" + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + \" button:not(:disabled),\\n .\" + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + \" a,\\n .\" + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + \" input[type=\\\"radio\\\"]:not(:disabled),\\n .\" + deprecatedClassNameMap[cssClasses.LIST_ITEM_CLASS] + \" input[type=\\\"checkbox\\\"]:not(:disabled)\\n \",\n RADIO_SELECTOR: 'input[type=\"radio\"]',\n SELECTED_ITEM_SELECTOR: '[aria-selected=\"true\"], [aria-current=\"true\"]',\n};\nvar numbers = {\n UNSET_INDEX: -1,\n TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS: 300\n};\nvar evolutionAttribute = 'evolution';\nexport { strings, cssClasses, numbers, deprecatedClassNameMap, evolutionAttribute, evolutionClassNameMap };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { MDCFoundation } from '@material/base/foundation.js';\nimport { normalizeKey } from '@material/dom/keyboard.js';\nimport { numbers, strings } from '@material/list/constants.js';\nconst integerSort = (a, b) => {\n return a - b;\n};\nconst findIndexDiff = (oldSet, newSet) => {\n const oldArr = Array.from(oldSet);\n const newArr = Array.from(newSet);\n const diff = { added: [], removed: [] };\n const oldSorted = oldArr.sort(integerSort);\n const newSorted = newArr.sort(integerSort);\n let i = 0;\n let j = 0;\n while (i < oldSorted.length || j < newSorted.length) {\n const oldVal = oldSorted[i];\n const newVal = newSorted[j];\n if (oldVal === newVal) {\n i++;\n j++;\n continue;\n }\n if (oldVal !== undefined && (newVal === undefined || oldVal < newVal)) {\n diff.removed.push(oldVal);\n i++;\n continue;\n }\n if (newVal !== undefined && (oldVal === undefined || newVal < oldVal)) {\n diff.added.push(newVal);\n j++;\n continue;\n }\n }\n return diff;\n};\nconst ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select'];\nexport function isIndexSet(selectedIndex) {\n return selectedIndex instanceof Set;\n}\nexport function isEventMulti(evt) {\n return isIndexSet(evt.detail.index);\n}\nexport const createSetFromIndex = (index) => {\n const entry = index === numbers.UNSET_INDEX ? new Set() : index;\n return isIndexSet(entry) ? new Set(entry) : new Set([entry]);\n};\nexport class MDCListFoundation extends MDCFoundation {\n constructor(adapter) {\n super(Object.assign(Object.assign({}, MDCListFoundation.defaultAdapter), adapter));\n this.isMulti_ = false;\n this.wrapFocus_ = false;\n this.isVertical_ = true;\n this.selectedIndex_ = numbers.UNSET_INDEX;\n this.focusedItemIndex_ = numbers.UNSET_INDEX;\n this.useActivatedClass_ = false;\n this.ariaCurrentAttrValue_ = null;\n }\n static get strings() {\n return strings;\n }\n static get numbers() {\n return numbers;\n }\n static get defaultAdapter() {\n return {\n focusItemAtIndex: () => undefined,\n getFocusedElementIndex: () => 0,\n getListItemCount: () => 0,\n isFocusInsideList: () => false,\n isRootFocused: () => false,\n notifyAction: () => undefined,\n notifySelected: () => undefined,\n getSelectedStateForElementIndex: () => false,\n setDisabledStateForElementIndex: () => undefined,\n getDisabledStateForElementIndex: () => false,\n setSelectedStateForElementIndex: () => undefined,\n setActivatedStateForElementIndex: () => undefined,\n setTabIndexForElementIndex: () => undefined,\n setAttributeForElementIndex: () => undefined,\n getAttributeForElementIndex: () => null,\n };\n }\n /**\n * Sets the private wrapFocus_ variable.\n */\n setWrapFocus(value) {\n this.wrapFocus_ = value;\n }\n /**\n * Sets the private wrapFocus_ variable.\n */\n setMulti(value) {\n this.isMulti_ = value;\n const currentIndex = this.selectedIndex_;\n if (value) {\n // number to set\n if (!isIndexSet(currentIndex)) {\n const isUnset = currentIndex === numbers.UNSET_INDEX;\n this.selectedIndex_ = isUnset ? new Set() : new Set([currentIndex]);\n }\n }\n else {\n // set to first sorted number in set\n if (isIndexSet(currentIndex)) {\n if (currentIndex.size) {\n const vals = Array.from(currentIndex).sort(integerSort);\n this.selectedIndex_ = vals[0];\n }\n else {\n this.selectedIndex_ = numbers.UNSET_INDEX;\n }\n }\n }\n }\n /**\n * Sets the isVertical_ private variable.\n */\n setVerticalOrientation(value) {\n this.isVertical_ = value;\n }\n /**\n * Sets the useActivatedClass_ private variable.\n */\n setUseActivatedClass(useActivated) {\n this.useActivatedClass_ = useActivated;\n }\n getSelectedIndex() {\n return this.selectedIndex_;\n }\n setSelectedIndex(index) {\n if (!this.isIndexValid_(index)) {\n return;\n }\n if (this.isMulti_) {\n this.setMultiSelectionAtIndex_(createSetFromIndex(index));\n }\n else {\n this.setSingleSelectionAtIndex_(index);\n }\n }\n /**\n * Focus in handler for the list items.\n */\n handleFocusIn(_, listItemIndex) {\n if (listItemIndex >= 0) {\n this.adapter.setTabIndexForElementIndex(listItemIndex, 0);\n }\n }\n /**\n * Focus out handler for the list items.\n */\n handleFocusOut(_, listItemIndex) {\n if (listItemIndex >= 0) {\n this.adapter.setTabIndexForElementIndex(listItemIndex, -1);\n }\n /**\n * Between Focusout & Focusin some browsers do not have focus on any\n * element. Setting a delay to wait till the focus is moved to next element.\n */\n setTimeout(() => {\n if (!this.adapter.isFocusInsideList()) {\n this.setTabindexToFirstSelectedItem_();\n }\n }, 0);\n }\n /**\n * Key handler for the list.\n */\n handleKeydown(event, isRootListItem, listItemIndex) {\n const isArrowLeft = normalizeKey(event) === 'ArrowLeft';\n const isArrowUp = normalizeKey(event) === 'ArrowUp';\n const isArrowRight = normalizeKey(event) === 'ArrowRight';\n const isArrowDown = normalizeKey(event) === 'ArrowDown';\n const isHome = normalizeKey(event) === 'Home';\n const isEnd = normalizeKey(event) === 'End';\n const isEnter = normalizeKey(event) === 'Enter';\n const isSpace = normalizeKey(event) === 'Spacebar';\n if (this.adapter.isRootFocused()) {\n if (isArrowUp || isEnd) {\n event.preventDefault();\n this.focusLastElement();\n }\n else if (isArrowDown || isHome) {\n event.preventDefault();\n this.focusFirstElement();\n }\n return;\n }\n let currentIndex = this.adapter.getFocusedElementIndex();\n if (currentIndex === -1) {\n currentIndex = listItemIndex;\n if (currentIndex < 0) {\n // If this event doesn't have a mdc-deprecated-list-item ancestor from\n // the current list (not from a sublist), return early.\n return;\n }\n }\n let nextIndex;\n if ((this.isVertical_ && isArrowDown) ||\n (!this.isVertical_ && isArrowRight)) {\n this.preventDefaultEvent(event);\n nextIndex = this.focusNextElement(currentIndex);\n }\n else if ((this.isVertical_ && isArrowUp) || (!this.isVertical_ && isArrowLeft)) {\n this.preventDefaultEvent(event);\n nextIndex = this.focusPrevElement(currentIndex);\n }\n else if (isHome) {\n this.preventDefaultEvent(event);\n nextIndex = this.focusFirstElement();\n }\n else if (isEnd) {\n this.preventDefaultEvent(event);\n nextIndex = this.focusLastElement();\n }\n else if (isEnter || isSpace) {\n if (isRootListItem) {\n // Return early if enter key is pressed on anchor element which triggers\n // synthetic MouseEvent event.\n const target = event.target;\n if (target && target.tagName === 'A' && isEnter) {\n return;\n }\n this.preventDefaultEvent(event);\n this.setSelectedIndexOnAction_(currentIndex, true);\n }\n }\n this.focusedItemIndex_ = currentIndex;\n if (nextIndex !== undefined) {\n this.setTabindexAtIndex_(nextIndex);\n this.focusedItemIndex_ = nextIndex;\n }\n }\n /**\n * Click handler for the list.\n */\n handleSingleSelection(index, isInteraction, force) {\n if (index === numbers.UNSET_INDEX) {\n return;\n }\n this.setSelectedIndexOnAction_(index, isInteraction, force);\n this.setTabindexAtIndex_(index);\n this.focusedItemIndex_ = index;\n }\n /**\n * Focuses the next element on the list.\n */\n focusNextElement(index) {\n const count = this.adapter.getListItemCount();\n let nextIndex = index + 1;\n if (nextIndex >= count) {\n if (this.wrapFocus_) {\n nextIndex = 0;\n }\n else {\n // Return early because last item is already focused.\n return index;\n }\n }\n this.adapter.focusItemAtIndex(nextIndex);\n return nextIndex;\n }\n /**\n * Focuses the previous element on the list.\n */\n focusPrevElement(index) {\n let prevIndex = index - 1;\n if (prevIndex < 0) {\n if (this.wrapFocus_) {\n prevIndex = this.adapter.getListItemCount() - 1;\n }\n else {\n // Return early because first item is already focused.\n return index;\n }\n }\n this.adapter.focusItemAtIndex(prevIndex);\n return prevIndex;\n }\n focusFirstElement() {\n this.adapter.focusItemAtIndex(0);\n return 0;\n }\n focusLastElement() {\n const lastIndex = this.adapter.getListItemCount() - 1;\n this.adapter.focusItemAtIndex(lastIndex);\n return lastIndex;\n }\n /**\n * @param itemIndex Index of the list item\n * @param isEnabled Sets the list item to enabled or disabled.\n */\n setEnabled(itemIndex, isEnabled) {\n if (!this.isIndexValid_(itemIndex)) {\n return;\n }\n this.adapter.setDisabledStateForElementIndex(itemIndex, !isEnabled);\n }\n /**\n * Ensures that preventDefault is only called if the containing element\n * doesn't consume the event, and it will cause an unintended scroll.\n */\n preventDefaultEvent(evt) {\n const target = evt.target;\n const tagName = `${target.tagName}`.toLowerCase();\n if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) {\n evt.preventDefault();\n }\n }\n setSingleSelectionAtIndex_(index, isInteraction = true) {\n if (this.selectedIndex_ === index) {\n return;\n }\n // unset previous\n if (this.selectedIndex_ !== numbers.UNSET_INDEX) {\n this.adapter.setSelectedStateForElementIndex(this.selectedIndex_, false);\n if (this.useActivatedClass_) {\n this.adapter.setActivatedStateForElementIndex(this.selectedIndex_, false);\n }\n }\n // set new\n if (isInteraction) {\n this.adapter.setSelectedStateForElementIndex(index, true);\n }\n if (this.useActivatedClass_) {\n this.adapter.setActivatedStateForElementIndex(index, true);\n }\n this.setAriaForSingleSelectionAtIndex_(index);\n this.selectedIndex_ = index;\n this.adapter.notifySelected(index);\n }\n setMultiSelectionAtIndex_(newIndex, isInteraction = true) {\n const oldIndex = createSetFromIndex(this.selectedIndex_);\n const diff = findIndexDiff(oldIndex, newIndex);\n if (!diff.removed.length && !diff.added.length) {\n return;\n }\n for (const removed of diff.removed) {\n if (isInteraction) {\n this.adapter.setSelectedStateForElementIndex(removed, false);\n }\n if (this.useActivatedClass_) {\n this.adapter.setActivatedStateForElementIndex(removed, false);\n }\n }\n for (const added of diff.added) {\n if (isInteraction) {\n this.adapter.setSelectedStateForElementIndex(added, true);\n }\n if (this.useActivatedClass_) {\n this.adapter.setActivatedStateForElementIndex(added, true);\n }\n }\n this.selectedIndex_ = newIndex;\n this.adapter.notifySelected(newIndex, diff);\n }\n /**\n * Sets aria attribute for single selection at given index.\n */\n setAriaForSingleSelectionAtIndex_(index) {\n // Detect the presence of aria-current and get the value only during list\n // initialization when it is in unset state.\n if (this.selectedIndex_ === numbers.UNSET_INDEX) {\n this.ariaCurrentAttrValue_ =\n this.adapter.getAttributeForElementIndex(index, strings.ARIA_CURRENT);\n }\n const isAriaCurrent = this.ariaCurrentAttrValue_ !== null;\n const ariaAttribute = isAriaCurrent ? strings.ARIA_CURRENT : strings.ARIA_SELECTED;\n if (this.selectedIndex_ !== numbers.UNSET_INDEX) {\n this.adapter.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false');\n }\n const ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true';\n this.adapter.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue);\n }\n setTabindexAtIndex_(index) {\n if (this.focusedItemIndex_ === numbers.UNSET_INDEX && index !== 0) {\n // If no list item was selected set first list item's tabindex to -1.\n // Generally, tabindex is set to 0 on first list item of list that has no\n // preselected items.\n this.adapter.setTabIndexForElementIndex(0, -1);\n }\n else if (this.focusedItemIndex_ >= 0 && this.focusedItemIndex_ !== index) {\n this.adapter.setTabIndexForElementIndex(this.focusedItemIndex_, -1);\n }\n this.adapter.setTabIndexForElementIndex(index, 0);\n }\n setTabindexToFirstSelectedItem_() {\n let targetIndex = 0;\n if (typeof this.selectedIndex_ === 'number' &&\n this.selectedIndex_ !== numbers.UNSET_INDEX) {\n targetIndex = this.selectedIndex_;\n }\n else if (isIndexSet(this.selectedIndex_) && this.selectedIndex_.size > 0) {\n targetIndex = Math.min(...this.selectedIndex_);\n }\n this.setTabindexAtIndex_(targetIndex);\n }\n isIndexValid_(index) {\n if (index instanceof Set) {\n if (!this.isMulti_) {\n throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list');\n }\n if (index.size === 0) {\n return true;\n }\n else {\n let isOneInRange = false;\n for (const entry of index) {\n isOneInRange = this.isIndexInRange_(entry);\n if (isOneInRange) {\n break;\n }\n }\n return isOneInRange;\n }\n }\n else if (typeof index === 'number') {\n if (this.isMulti_) {\n throw new Error('MDCListFoundation: Expected array of index for checkbox based list but got number: ' +\n index);\n }\n return index === numbers.UNSET_INDEX || this.isIndexInRange_(index);\n }\n else {\n return false;\n }\n }\n isIndexInRange_(index) {\n const listSize = this.adapter.getListItemCount();\n return index >= 0 && index < listSize;\n }\n /**\n * Sets selected index on user action, toggles checkbox / radio based on\n * toggleCheckbox value. User interaction should not toggle list item(s) when\n * disabled.\n */\n setSelectedIndexOnAction_(index, isInteraction, force) {\n if (this.adapter.getDisabledStateForElementIndex(index)) {\n return;\n }\n let checkedIndex = index;\n if (this.isMulti_) {\n checkedIndex = new Set([index]);\n }\n if (!this.isIndexValid_(checkedIndex)) {\n return;\n }\n if (this.isMulti_) {\n this.toggleMultiAtIndex(index, force, isInteraction);\n }\n else {\n if (isInteraction || force) {\n this.setSingleSelectionAtIndex_(index, isInteraction);\n }\n else {\n const isDeselection = this.selectedIndex_ === index;\n if (isDeselection) {\n this.setSingleSelectionAtIndex_(numbers.UNSET_INDEX);\n }\n }\n }\n if (isInteraction) {\n this.adapter.notifyAction(index);\n }\n }\n toggleMultiAtIndex(index, force, isInteraction = true) {\n let newSelectionValue = false;\n if (force === undefined) {\n newSelectionValue = !this.adapter.getSelectedStateForElementIndex(index);\n }\n else {\n newSelectionValue = force;\n }\n const newSet = createSetFromIndex(this.selectedIndex_);\n if (newSelectionValue) {\n newSet.add(index);\n }\n else {\n newSet.delete(index);\n }\n this.setMultiSelectionAtIndex_(newSet, isInteraction);\n }\n}\n// tslint:disable-next-line:no-default-export Needed for backward compatibility\n// with MDC Web v0.44.0 and earlier.\nexport default MDCListFoundation;\n//# sourceMappingURL=mwc-list-foundation.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport './mwc-list-item.js';\nimport { BaseElement } from '@material/mwc-base/base-element.js';\nimport { observer } from '@material/mwc-base/observer.js';\nimport { deepActiveElementPath, doesElementContainFocus, isNodeElement } from '@material/mwc-base/utils.js';\nimport { html } from 'lit';\nimport { property, query, queryAssignedNodes } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport MDCListFoundation, { isIndexSet } from './mwc-list-foundation.js';\nexport { createSetFromIndex, isEventMulti, isIndexSet } from './mwc-list-foundation.js';\nfunction debounceLayout(callback, waitInMS = 50) {\n let timeoutId;\n // tslint:disable-next-line\n return function (updateItems = true) {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => {\n callback(updateItems);\n }, waitInMS);\n };\n}\nconst isListItem = (element) => {\n return element.hasAttribute('mwc-list-item');\n};\nfunction clearAndCreateItemsReadyPromise() {\n const oldResolver = this.itemsReadyResolver;\n this.itemsReady = new Promise((res) => {\n // TODO(b/175626389): Type '(value: never[] | PromiseLike) => void'\n // is not assignable to type '(value?: never[] | PromiseLike |\n // undefined) => void'.\n return this.itemsReadyResolver = res;\n });\n oldResolver();\n}\n/**\n * @fires selected {SelectedDetail}\n * @fires action {ActionDetail}\n * @fires items-updated\n */\nexport class ListBase extends BaseElement {\n constructor() {\n super();\n this.mdcAdapter = null;\n this.mdcFoundationClass = MDCListFoundation;\n this.activatable = false;\n this.multi = false;\n this.wrapFocus = false;\n this.itemRoles = null;\n this.innerRole = null;\n this.innerAriaLabel = null;\n this.rootTabbable = false;\n this.previousTabindex = null;\n this.noninteractive = false;\n this.itemsReadyResolver = (() => {\n //\n });\n this.itemsReady = Promise.resolve([]);\n // tslint:enable:ban-ts-ignore\n this.items_ = [];\n const debouncedFunction = debounceLayout(this.layout.bind(this));\n this.debouncedLayout = (updateItems = true) => {\n clearAndCreateItemsReadyPromise.call(this);\n debouncedFunction(updateItems);\n };\n }\n // tslint:disable:ban-ts-ignore\n async getUpdateComplete() {\n // @ts-ignore\n const result = await super.getUpdateComplete();\n await this.itemsReady;\n return result;\n }\n get items() {\n return this.items_;\n }\n updateItems() {\n var _a;\n const nodes = (_a = this.assignedElements) !== null && _a !== void 0 ? _a : [];\n const listItems = [];\n for (const node of nodes) {\n if (isListItem(node)) {\n listItems.push(node);\n node._managingList = this;\n }\n if (node.hasAttribute('divider') && !node.hasAttribute('role')) {\n node.setAttribute('role', 'separator');\n }\n }\n this.items_ = listItems;\n const selectedIndices = new Set();\n this.items_.forEach((item, index) => {\n if (this.itemRoles) {\n item.setAttribute('role', this.itemRoles);\n }\n else {\n item.removeAttribute('role');\n }\n if (item.selected) {\n selectedIndices.add(index);\n }\n });\n if (this.multi) {\n this.select(selectedIndices);\n }\n else {\n const index = selectedIndices.size ? selectedIndices.entries().next().value[1] : -1;\n this.select(index);\n }\n const itemsUpdatedEv = new Event('items-updated', { bubbles: true, composed: true });\n this.dispatchEvent(itemsUpdatedEv);\n }\n get selected() {\n const index = this.index;\n if (!isIndexSet(index)) {\n if (index === -1) {\n return null;\n }\n return this.items[index];\n }\n const selected = [];\n for (const entry of index) {\n selected.push(this.items[entry]);\n }\n return selected;\n }\n get index() {\n if (this.mdcFoundation) {\n return this.mdcFoundation.getSelectedIndex();\n }\n return -1;\n }\n render() {\n const role = this.innerRole === null ? undefined : this.innerRole;\n const ariaLabel = this.innerAriaLabel === null ? undefined : this.innerAriaLabel;\n const tabindex = this.rootTabbable ? '0' : '-1';\n return html `\n \n \n \n ${this.renderPlaceholder()}\n \n `;\n }\n renderPlaceholder() {\n var _a;\n const nodes = (_a = this.assignedElements) !== null && _a !== void 0 ? _a : [];\n if (this.emptyMessage !== undefined && nodes.length === 0) {\n return html `\n ${this.emptyMessage}\n `;\n }\n return null;\n }\n firstUpdated() {\n super.firstUpdated();\n if (!this.items.length) {\n // required because this is called before observers\n this.mdcFoundation.setMulti(this.multi);\n // for when children upgrade before list\n this.layout();\n }\n }\n onFocusIn(evt) {\n if (this.mdcFoundation && this.mdcRoot) {\n const index = this.getIndexOfTarget(evt);\n this.mdcFoundation.handleFocusIn(evt, index);\n }\n }\n onFocusOut(evt) {\n if (this.mdcFoundation && this.mdcRoot) {\n const index = this.getIndexOfTarget(evt);\n this.mdcFoundation.handleFocusOut(evt, index);\n }\n }\n onKeydown(evt) {\n if (this.mdcFoundation && this.mdcRoot) {\n const index = this.getIndexOfTarget(evt);\n const target = evt.target;\n const isRootListItem = isListItem(target);\n this.mdcFoundation.handleKeydown(evt, isRootListItem, index);\n }\n }\n onRequestSelected(evt) {\n if (this.mdcFoundation) {\n let index = this.getIndexOfTarget(evt);\n // might happen in shady dom slowness. Recalc children\n if (index === -1) {\n this.layout();\n index = this.getIndexOfTarget(evt);\n // still not found; may not be mwc-list-item. Unsupported case.\n if (index === -1) {\n return;\n }\n }\n const element = this.items[index];\n if (element.disabled) {\n return;\n }\n const selected = evt.detail.selected;\n const source = evt.detail.source;\n this.mdcFoundation.handleSingleSelection(index, source === 'interaction', selected);\n evt.stopPropagation();\n }\n }\n getIndexOfTarget(evt) {\n const elements = this.items;\n const path = evt.composedPath();\n for (const pathItem of path) {\n let index = -1;\n if (isNodeElement(pathItem) && isListItem(pathItem)) {\n index = elements.indexOf(pathItem);\n }\n if (index !== -1) {\n return index;\n }\n }\n return -1;\n }\n createAdapter() {\n this.mdcAdapter = {\n getListItemCount: () => {\n if (this.mdcRoot) {\n return this.items.length;\n }\n return 0;\n },\n getFocusedElementIndex: this.getFocusedItemIndex,\n getAttributeForElementIndex: (index, attr) => {\n const listElement = this.mdcRoot;\n if (!listElement) {\n return '';\n }\n const element = this.items[index];\n return element ? element.getAttribute(attr) : '';\n },\n setAttributeForElementIndex: (index, attr, val) => {\n if (!this.mdcRoot) {\n return;\n }\n const element = this.items[index];\n if (element) {\n element.setAttribute(attr, val);\n }\n },\n focusItemAtIndex: (index) => {\n const element = this.items[index];\n if (element) {\n element.focus();\n }\n },\n setTabIndexForElementIndex: (index, value) => {\n const item = this.items[index];\n if (item) {\n item.tabindex = value;\n }\n },\n notifyAction: (index) => {\n const init = { bubbles: true, composed: true };\n init.detail = { index };\n const ev = new CustomEvent('action', init);\n this.dispatchEvent(ev);\n },\n notifySelected: (index, diff) => {\n const init = { bubbles: true, composed: true };\n init.detail = { index, diff };\n const ev = new CustomEvent('selected', init);\n this.dispatchEvent(ev);\n },\n isFocusInsideList: () => {\n return doesElementContainFocus(this);\n },\n isRootFocused: () => {\n const mdcRoot = this.mdcRoot;\n const root = mdcRoot.getRootNode();\n return root.activeElement === mdcRoot;\n },\n setDisabledStateForElementIndex: (index, value) => {\n const item = this.items[index];\n if (!item) {\n return;\n }\n item.disabled = value;\n },\n getDisabledStateForElementIndex: (index) => {\n const item = this.items[index];\n if (!item) {\n return false;\n }\n return item.disabled;\n },\n setSelectedStateForElementIndex: (index, value) => {\n const item = this.items[index];\n if (!item) {\n return;\n }\n item.selected = value;\n },\n getSelectedStateForElementIndex: (index) => {\n const item = this.items[index];\n if (!item) {\n return false;\n }\n return item.selected;\n },\n setActivatedStateForElementIndex: (index, value) => {\n const item = this.items[index];\n if (!item) {\n return;\n }\n item.activated = value;\n },\n };\n return this.mdcAdapter;\n }\n selectUi(index, activate = false) {\n const item = this.items[index];\n if (item) {\n item.selected = true;\n item.activated = activate;\n }\n }\n deselectUi(index) {\n const item = this.items[index];\n if (item) {\n item.selected = false;\n item.activated = false;\n }\n }\n select(index) {\n if (!this.mdcFoundation) {\n return;\n }\n this.mdcFoundation.setSelectedIndex(index);\n }\n toggle(index, force) {\n if (this.multi) {\n this.mdcFoundation.toggleMultiAtIndex(index, force);\n }\n }\n onListItemConnected(e) {\n const target = e.target;\n this.layout(this.items.indexOf(target) === -1);\n }\n layout(updateItems = true) {\n if (updateItems) {\n this.updateItems();\n }\n const first = this.items[0];\n for (const item of this.items) {\n item.tabindex = -1;\n }\n if (first) {\n if (this.noninteractive) {\n if (!this.previousTabindex) {\n this.previousTabindex = first;\n }\n }\n else {\n first.tabindex = 0;\n }\n }\n this.itemsReadyResolver();\n }\n getFocusedItemIndex() {\n if (!this.mdcRoot) {\n return -1;\n }\n if (!this.items.length) {\n return -1;\n }\n const activeElementPath = deepActiveElementPath();\n if (!activeElementPath.length) {\n return -1;\n }\n for (let i = activeElementPath.length - 1; i >= 0; i--) {\n const activeItem = activeElementPath[i];\n if (isListItem(activeItem)) {\n return this.items.indexOf(activeItem);\n }\n }\n return -1;\n }\n focusItemAtIndex(index) {\n for (const item of this.items) {\n if (item.tabindex === 0) {\n item.tabindex = -1;\n break;\n }\n }\n this.items[index].tabindex = 0;\n this.items[index].focus();\n }\n focus() {\n const root = this.mdcRoot;\n if (root) {\n root.focus();\n }\n }\n blur() {\n const root = this.mdcRoot;\n if (root) {\n root.blur();\n }\n }\n}\n__decorate([\n property({ type: String })\n], ListBase.prototype, \"emptyMessage\", void 0);\n__decorate([\n query('.mdc-deprecated-list')\n], ListBase.prototype, \"mdcRoot\", void 0);\n__decorate([\n queryAssignedNodes('', true, '*')\n], ListBase.prototype, \"assignedElements\", void 0);\n__decorate([\n queryAssignedNodes('', true, '[tabindex=\"0\"]')\n], ListBase.prototype, \"tabbableElements\", void 0);\n__decorate([\n property({ type: Boolean }),\n observer(function (value) {\n if (this.mdcFoundation) {\n this.mdcFoundation.setUseActivatedClass(value);\n }\n })\n], ListBase.prototype, \"activatable\", void 0);\n__decorate([\n property({ type: Boolean }),\n observer(function (newValue, oldValue) {\n if (this.mdcFoundation) {\n this.mdcFoundation.setMulti(newValue);\n }\n if (oldValue !== undefined) {\n this.layout();\n }\n })\n], ListBase.prototype, \"multi\", void 0);\n__decorate([\n property({ type: Boolean }),\n observer(function (value) {\n if (this.mdcFoundation) {\n this.mdcFoundation.setWrapFocus(value);\n }\n })\n], ListBase.prototype, \"wrapFocus\", void 0);\n__decorate([\n property({ type: String }),\n observer(function (_newValue, oldValue) {\n if (oldValue !== undefined) {\n this.updateItems();\n }\n })\n], ListBase.prototype, \"itemRoles\", void 0);\n__decorate([\n property({ type: String })\n], ListBase.prototype, \"innerRole\", void 0);\n__decorate([\n property({ type: String })\n], ListBase.prototype, \"innerAriaLabel\", void 0);\n__decorate([\n property({ type: Boolean })\n], ListBase.prototype, \"rootTabbable\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true }),\n observer(function (value) {\n var _a, _b;\n if (value) {\n const tabbable = (_b = (_a = this.tabbableElements) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : null;\n this.previousTabindex = tabbable;\n if (tabbable) {\n tabbable.setAttribute('tabindex', '-1');\n }\n }\n else if (!value && this.previousTabindex) {\n this.previousTabindex.setAttribute('tabindex', '0');\n this.previousTabindex = null;\n }\n })\n], ListBase.prototype, \"noninteractive\", void 0);\n//# sourceMappingURL=mwc-list-base.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-LIcense-Identifier: Apache-2.0\n */\nimport { css } from 'lit';\nexport const styles = css `@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}:host{display:block}.mdc-deprecated-list{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-subtitle1-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1rem;font-size:var(--mdc-typography-subtitle1-font-size, 1rem);line-height:1.75rem;line-height:var(--mdc-typography-subtitle1-line-height, 1.75rem);font-weight:400;font-weight:var(--mdc-typography-subtitle1-font-weight, 400);letter-spacing:0.009375em;letter-spacing:var(--mdc-typography-subtitle1-letter-spacing, 0.009375em);text-decoration:inherit;text-decoration:var(--mdc-typography-subtitle1-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-subtitle1-text-transform, inherit);line-height:1.5rem;margin:0;padding:8px 0;list-style-type:none;color:rgba(0, 0, 0, 0.87);color:var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87));padding:var(--mdc-list-vertical-padding, 8px) 0}.mdc-deprecated-list:focus{outline:none}.mdc-deprecated-list-item{height:48px}.mdc-deprecated-list--dense{padding-top:4px;padding-bottom:4px;font-size:.812rem}.mdc-deprecated-list ::slotted([divider]){height:0;margin:0;border:none;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgba(0, 0, 0, 0.12)}.mdc-deprecated-list ::slotted([divider][padded]){margin:0 var(--mdc-list-side-padding, 16px)}.mdc-deprecated-list ::slotted([divider][inset]){margin-left:var(--mdc-list-inset-margin, 72px);margin-right:0;width:calc( 100% - var(--mdc-list-inset-margin, 72px) )}[dir=rtl] .mdc-deprecated-list ::slotted([divider][inset]),.mdc-deprecated-list ::slotted([divider][inset][dir=rtl]){margin-left:0;margin-right:var(--mdc-list-inset-margin, 72px)}.mdc-deprecated-list ::slotted([divider][inset][padded]){width:calc( 100% - var(--mdc-list-inset-margin, 72px) - var(--mdc-list-side-padding, 16px) )}.mdc-deprecated-list--dense ::slotted([mwc-list-item]){height:40px}.mdc-deprecated-list--dense ::slotted([mwc-list]){--mdc-list-item-graphic-size: 20px}.mdc-deprecated-list--two-line.mdc-deprecated-list--dense ::slotted([mwc-list-item]),.mdc-deprecated-list--avatar-list.mdc-deprecated-list--dense ::slotted([mwc-list-item]){height:60px}.mdc-deprecated-list--avatar-list.mdc-deprecated-list--dense ::slotted([mwc-list]){--mdc-list-item-graphic-size: 36px}:host([noninteractive]){pointer-events:none;cursor:default}.mdc-deprecated-list--dense ::slotted(.mdc-deprecated-list-item__primary-text){display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-deprecated-list--dense ::slotted(.mdc-deprecated-list-item__primary-text)::before{display:inline-block;width:0;height:24px;content:\"\";vertical-align:0}.mdc-deprecated-list--dense ::slotted(.mdc-deprecated-list-item__primary-text)::after{display:inline-block;width:0;height:20px;content:\"\";vertical-align:-20px}`;\n//# sourceMappingURL=mwc-list.css.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { customElement } from 'lit/decorators.js';\nimport { ListBase } from './mwc-list-base.js';\nimport { styles } from './mwc-list.css.js';\nexport { createSetFromIndex, isEventMulti, isIndexSet } from './mwc-list-foundation.js';\nlet List = class List extends ListBase {\n};\nList.styles = [styles];\nList = __decorate([\n customElement('mwc-list')\n], List);\nexport { List };\n//# sourceMappingURL=mwc-list.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar cssClasses = {\n ANCHOR: 'mdc-menu-surface--anchor',\n ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed',\n ANIMATING_OPEN: 'mdc-menu-surface--animating-open',\n FIXED: 'mdc-menu-surface--fixed',\n IS_OPEN_BELOW: 'mdc-menu-surface--is-open-below',\n OPEN: 'mdc-menu-surface--open',\n ROOT: 'mdc-menu-surface',\n};\n// tslint:disable:object-literal-sort-keys\nvar strings = {\n CLOSED_EVENT: 'MDCMenuSurface:closed',\n CLOSING_EVENT: 'MDCMenuSurface:closing',\n OPENED_EVENT: 'MDCMenuSurface:opened',\n OPENING_EVENT: 'MDCMenuSurface:opening',\n FOCUSABLE_ELEMENTS: [\n 'button:not(:disabled)',\n '[href]:not([aria-disabled=\"true\"])',\n 'input:not(:disabled)',\n 'select:not(:disabled)',\n 'textarea:not(:disabled)',\n '[tabindex]:not([tabindex=\"-1\"]):not([aria-disabled=\"true\"])',\n ].join(', '),\n};\n// tslint:enable:object-literal-sort-keys\nvar numbers = {\n /** Total duration of menu-surface open animation. */\n TRANSITION_OPEN_DURATION: 120,\n /** Total duration of menu-surface close animation. */\n TRANSITION_CLOSE_DURATION: 75,\n /**\n * Margin left to the edge of the viewport when menu-surface is at maximum\n * possible height. Also used as a viewport margin.\n */\n MARGIN_TO_EDGE: 32,\n /**\n * Ratio of anchor width to menu-surface width for switching from corner\n * positioning to center positioning.\n */\n ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67,\n /**\n * Amount of time to wait before restoring focus when closing the menu\n * surface. This is important because if a touch event triggered the menu\n * close, and the subsequent mouse event occurs after focus is restored, then\n * the restored focus would be lost.\n */\n TOUCH_EVENT_WAIT_MS: 30,\n};\n/**\n * Enum for bits in the {@see Corner) bitmap.\n */\nvar CornerBit;\n(function (CornerBit) {\n CornerBit[CornerBit[\"BOTTOM\"] = 1] = \"BOTTOM\";\n CornerBit[CornerBit[\"CENTER\"] = 2] = \"CENTER\";\n CornerBit[CornerBit[\"RIGHT\"] = 4] = \"RIGHT\";\n CornerBit[CornerBit[\"FLIP_RTL\"] = 8] = \"FLIP_RTL\";\n})(CornerBit || (CornerBit = {}));\n/**\n * Enum for representing an element corner for positioning the menu-surface.\n *\n * The START constants map to LEFT if element directionality is left\n * to right and RIGHT if the directionality is right to left.\n * Likewise END maps to RIGHT or LEFT depending on the directionality.\n */\nvar Corner;\n(function (Corner) {\n Corner[Corner[\"TOP_LEFT\"] = 0] = \"TOP_LEFT\";\n Corner[Corner[\"TOP_RIGHT\"] = 4] = \"TOP_RIGHT\";\n Corner[Corner[\"BOTTOM_LEFT\"] = 1] = \"BOTTOM_LEFT\";\n Corner[Corner[\"BOTTOM_RIGHT\"] = 5] = \"BOTTOM_RIGHT\";\n Corner[Corner[\"TOP_START\"] = 8] = \"TOP_START\";\n Corner[Corner[\"TOP_END\"] = 12] = \"TOP_END\";\n Corner[Corner[\"BOTTOM_START\"] = 9] = \"BOTTOM_START\";\n Corner[Corner[\"BOTTOM_END\"] = 13] = \"BOTTOM_END\";\n})(Corner || (Corner = {}));\nexport { cssClasses, strings, numbers, CornerBit, Corner };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends, __values } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { Corner, CornerBit, cssClasses, numbers, strings } from './constants';\nvar MDCMenuSurfaceFoundation = /** @class */ (function (_super) {\n __extends(MDCMenuSurfaceFoundation, _super);\n function MDCMenuSurfaceFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCMenuSurfaceFoundation.defaultAdapter), adapter)) || this;\n _this.isSurfaceOpen = false;\n _this.isQuickOpen = false;\n _this.isHoistedElement = false;\n _this.isFixedPosition = false;\n _this.isHorizontallyCenteredOnViewport = false;\n _this.maxHeight = 0;\n _this.openBottomBias = 0;\n _this.openAnimationEndTimerId = 0;\n _this.closeAnimationEndTimerId = 0;\n _this.animationRequestId = 0;\n _this.anchorCorner = Corner.TOP_START;\n /**\n * Corner of the menu surface to which menu surface is attached to anchor.\n *\n * Anchor corner --->+----------+\n * | ANCHOR |\n * +----------+\n * Origin corner --->+--------------+\n * | |\n * | |\n * | MENU SURFACE |\n * | |\n * | |\n * +--------------+\n */\n _this.originCorner = Corner.TOP_START;\n _this.anchorMargin = { top: 0, right: 0, bottom: 0, left: 0 };\n _this.position = { x: 0, y: 0 };\n return _this;\n }\n Object.defineProperty(MDCMenuSurfaceFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCMenuSurfaceFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCMenuSurfaceFoundation, \"numbers\", {\n get: function () {\n return numbers;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCMenuSurfaceFoundation, \"Corner\", {\n get: function () {\n return Corner;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCMenuSurfaceFoundation, \"defaultAdapter\", {\n /**\n * @see {@link MDCMenuSurfaceAdapter} for typing information on parameters and return types.\n */\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n addClass: function () { return undefined; },\n removeClass: function () { return undefined; },\n hasClass: function () { return false; },\n hasAnchor: function () { return false; },\n isElementInContainer: function () { return false; },\n isFocused: function () { return false; },\n isRtl: function () { return false; },\n getInnerDimensions: function () { return ({ height: 0, width: 0 }); },\n getAnchorDimensions: function () { return null; },\n getWindowDimensions: function () { return ({ height: 0, width: 0 }); },\n getBodyDimensions: function () { return ({ height: 0, width: 0 }); },\n getWindowScroll: function () { return ({ x: 0, y: 0 }); },\n setPosition: function () { return undefined; },\n setMaxHeight: function () { return undefined; },\n setTransformOrigin: function () { return undefined; },\n saveFocus: function () { return undefined; },\n restoreFocus: function () { return undefined; },\n notifyClose: function () { return undefined; },\n notifyClosing: function () { return undefined; },\n notifyOpen: function () { return undefined; },\n notifyOpening: function () { return undefined; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n MDCMenuSurfaceFoundation.prototype.init = function () {\n var _a = MDCMenuSurfaceFoundation.cssClasses, ROOT = _a.ROOT, OPEN = _a.OPEN;\n if (!this.adapter.hasClass(ROOT)) {\n throw new Error(ROOT + \" class required in root element.\");\n }\n if (this.adapter.hasClass(OPEN)) {\n this.isSurfaceOpen = true;\n }\n };\n MDCMenuSurfaceFoundation.prototype.destroy = function () {\n clearTimeout(this.openAnimationEndTimerId);\n clearTimeout(this.closeAnimationEndTimerId);\n // Cancel any currently running animations.\n cancelAnimationFrame(this.animationRequestId);\n };\n /**\n * @param corner Default anchor corner alignment of top-left menu surface\n * corner.\n */\n MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) {\n this.anchorCorner = corner;\n };\n /**\n * Flip menu corner horizontally.\n */\n MDCMenuSurfaceFoundation.prototype.flipCornerHorizontally = function () {\n this.originCorner = this.originCorner ^ CornerBit.RIGHT;\n };\n /**\n * @param margin Set of margin values from anchor.\n */\n MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) {\n this.anchorMargin.top = margin.top || 0;\n this.anchorMargin.right = margin.right || 0;\n this.anchorMargin.bottom = margin.bottom || 0;\n this.anchorMargin.left = margin.left || 0;\n };\n /** Used to indicate if the menu-surface is hoisted to the body. */\n MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) {\n this.isHoistedElement = isHoisted;\n };\n /**\n * Used to set the menu-surface calculations based on a fixed position menu.\n */\n MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) {\n this.isFixedPosition = isFixedPosition;\n };\n /**\n * @return Returns true if menu is in fixed (`position: fixed`) position.\n */\n MDCMenuSurfaceFoundation.prototype.isFixed = function () {\n return this.isFixedPosition;\n };\n /** Sets the menu-surface position on the page. */\n MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) {\n this.position.x = this.isFinite(x) ? x : 0;\n this.position.y = this.isFinite(y) ? y : 0;\n };\n /** Sets whether menu-surface should be horizontally centered to viewport. */\n MDCMenuSurfaceFoundation.prototype.setIsHorizontallyCenteredOnViewport = function (isCentered) {\n this.isHorizontallyCenteredOnViewport = isCentered;\n };\n MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) {\n this.isQuickOpen = quickOpen;\n };\n /**\n * Sets maximum menu-surface height on open.\n * @param maxHeight The desired max-height. Set to 0 (default) to\n * automatically calculate max height based on available viewport space.\n */\n MDCMenuSurfaceFoundation.prototype.setMaxHeight = function (maxHeight) {\n this.maxHeight = maxHeight;\n };\n /**\n * Set to a positive integer to influence the menu to preferentially open\n * below the anchor instead of above.\n * @param bias A value of `x` simulates an extra `x` pixels of available space\n * below the menu during positioning calculations.\n */\n MDCMenuSurfaceFoundation.prototype.setOpenBottomBias = function (bias) {\n this.openBottomBias = bias;\n };\n MDCMenuSurfaceFoundation.prototype.isOpen = function () {\n return this.isSurfaceOpen;\n };\n /**\n * Open the menu surface.\n */\n MDCMenuSurfaceFoundation.prototype.open = function () {\n var _this = this;\n if (this.isSurfaceOpen) {\n return;\n }\n this.adapter.notifyOpening();\n this.adapter.saveFocus();\n if (this.isQuickOpen) {\n this.isSurfaceOpen = true;\n this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);\n this.dimensions = this.adapter.getInnerDimensions();\n this.autoposition();\n this.adapter.notifyOpen();\n }\n else {\n this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);\n this.animationRequestId = requestAnimationFrame(function () {\n _this.dimensions = _this.adapter.getInnerDimensions();\n _this.autoposition();\n _this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);\n _this.openAnimationEndTimerId = setTimeout(function () {\n _this.openAnimationEndTimerId = 0;\n _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);\n _this.adapter.notifyOpen();\n }, numbers.TRANSITION_OPEN_DURATION);\n });\n this.isSurfaceOpen = true;\n }\n };\n /**\n * Closes the menu surface.\n */\n MDCMenuSurfaceFoundation.prototype.close = function (skipRestoreFocus) {\n var _this = this;\n if (skipRestoreFocus === void 0) { skipRestoreFocus = false; }\n if (!this.isSurfaceOpen) {\n return;\n }\n this.adapter.notifyClosing();\n if (this.isQuickOpen) {\n this.isSurfaceOpen = false;\n if (!skipRestoreFocus) {\n this.maybeRestoreFocus();\n }\n this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);\n this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);\n this.adapter.notifyClose();\n return;\n }\n this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);\n requestAnimationFrame(function () {\n _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);\n _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);\n _this.closeAnimationEndTimerId = setTimeout(function () {\n _this.closeAnimationEndTimerId = 0;\n _this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);\n _this.adapter.notifyClose();\n }, numbers.TRANSITION_CLOSE_DURATION);\n });\n this.isSurfaceOpen = false;\n if (!skipRestoreFocus) {\n this.maybeRestoreFocus();\n }\n };\n /** Handle clicks and close if not within menu-surface element. */\n MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) {\n var el = evt.target;\n if (this.adapter.isElementInContainer(el)) {\n return;\n }\n this.close();\n };\n /** Handle keys that close the surface. */\n MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) {\n var keyCode = evt.keyCode, key = evt.key;\n var isEscape = key === 'Escape' || keyCode === 27;\n if (isEscape) {\n this.close();\n }\n };\n MDCMenuSurfaceFoundation.prototype.autoposition = function () {\n var _a;\n // Compute measurements for autoposition methods reuse.\n this.measurements = this.getAutoLayoutmeasurements();\n var corner = this.getoriginCorner();\n var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight(corner);\n var verticalAlignment = this.hasBit(corner, CornerBit.BOTTOM) ? 'bottom' : 'top';\n var horizontalAlignment = this.hasBit(corner, CornerBit.RIGHT) ? 'right' : 'left';\n var horizontalOffset = this.getHorizontalOriginOffset(corner);\n var verticalOffset = this.getVerticalOriginOffset(corner);\n var _b = this.measurements, anchorSize = _b.anchorSize, surfaceSize = _b.surfaceSize;\n var position = (_a = {},\n _a[horizontalAlignment] = horizontalOffset,\n _a[verticalAlignment] = verticalOffset,\n _a);\n // Center align when anchor width is comparable or greater than menu\n // surface, otherwise keep corner.\n if (anchorSize.width / surfaceSize.width >\n numbers.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {\n horizontalAlignment = 'center';\n }\n // If the menu-surface has been hoisted to the body, it's no longer relative\n // to the anchor element\n if (this.isHoistedElement || this.isFixedPosition) {\n this.adjustPositionForHoistedElement(position);\n }\n this.adapter.setTransformOrigin(horizontalAlignment + \" \" + verticalAlignment);\n this.adapter.setPosition(position);\n this.adapter.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : '');\n // If it is opened from the top then add is-open-below class\n if (!this.hasBit(corner, CornerBit.BOTTOM)) {\n this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);\n }\n };\n /**\n * @return Measurements used to position menu surface popup.\n */\n MDCMenuSurfaceFoundation.prototype.getAutoLayoutmeasurements = function () {\n var anchorRect = this.adapter.getAnchorDimensions();\n var bodySize = this.adapter.getBodyDimensions();\n var viewportSize = this.adapter.getWindowDimensions();\n var windowScroll = this.adapter.getWindowScroll();\n if (!anchorRect) {\n // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together\n anchorRect = {\n top: this.position.y,\n right: this.position.x,\n bottom: this.position.y,\n left: this.position.x,\n width: 0,\n height: 0,\n };\n // tslint:enable:object-literal-sort-keys\n }\n return {\n anchorSize: anchorRect,\n bodySize: bodySize,\n surfaceSize: this.dimensions,\n viewportDistance: {\n // tslint:disable:object-literal-sort-keys Positional properties are more readable when they're grouped together\n top: anchorRect.top,\n right: viewportSize.width - anchorRect.right,\n bottom: viewportSize.height - anchorRect.bottom,\n left: anchorRect.left,\n // tslint:enable:object-literal-sort-keys\n },\n viewportSize: viewportSize,\n windowScroll: windowScroll,\n };\n };\n /**\n * Computes the corner of the anchor from which to animate and position the\n * menu surface.\n *\n * Only LEFT or RIGHT bit is used to position the menu surface ignoring RTL\n * context. E.g., menu surface will be positioned from right side on TOP_END.\n */\n MDCMenuSurfaceFoundation.prototype.getoriginCorner = function () {\n var corner = this.originCorner;\n var _a = this.measurements, viewportDistance = _a.viewportDistance, anchorSize = _a.anchorSize, surfaceSize = _a.surfaceSize;\n var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;\n var isAnchoredToBottom = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);\n var availableTop;\n var availableBottom;\n if (isAnchoredToBottom) {\n availableTop =\n viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.bottom;\n availableBottom =\n viewportDistance.bottom - MARGIN_TO_EDGE - this.anchorMargin.bottom;\n }\n else {\n availableTop =\n viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.top;\n availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE +\n anchorSize.height - this.anchorMargin.top;\n }\n var isAvailableBottom = availableBottom - surfaceSize.height > 0;\n if (!isAvailableBottom &&\n availableTop > availableBottom + this.openBottomBias) {\n // Attach bottom side of surface to the anchor.\n corner = this.setBit(corner, CornerBit.BOTTOM);\n }\n var isRtl = this.adapter.isRtl();\n var isFlipRtl = this.hasBit(this.anchorCorner, CornerBit.FLIP_RTL);\n var hasRightBit = this.hasBit(this.anchorCorner, CornerBit.RIGHT) ||\n this.hasBit(corner, CornerBit.RIGHT);\n // Whether surface attached to right side of anchor element.\n var isAnchoredToRight = false;\n // Anchored to start\n if (isRtl && isFlipRtl) {\n isAnchoredToRight = !hasRightBit;\n }\n else {\n // Anchored to right\n isAnchoredToRight = hasRightBit;\n }\n var availableLeft;\n var availableRight;\n if (isAnchoredToRight) {\n availableLeft =\n viewportDistance.left + anchorSize.width + this.anchorMargin.right;\n availableRight = viewportDistance.right - this.anchorMargin.right;\n }\n else {\n availableLeft = viewportDistance.left + this.anchorMargin.left;\n availableRight =\n viewportDistance.right + anchorSize.width - this.anchorMargin.left;\n }\n var isAvailableLeft = availableLeft - surfaceSize.width > 0;\n var isAvailableRight = availableRight - surfaceSize.width > 0;\n var isOriginCornerAlignedToEnd = this.hasBit(corner, CornerBit.FLIP_RTL) &&\n this.hasBit(corner, CornerBit.RIGHT);\n if (isAvailableRight && isOriginCornerAlignedToEnd && isRtl ||\n !isAvailableLeft && isOriginCornerAlignedToEnd) {\n // Attach left side of surface to the anchor.\n corner = this.unsetBit(corner, CornerBit.RIGHT);\n }\n else if (isAvailableLeft && isAnchoredToRight && isRtl ||\n (isAvailableLeft && !isAnchoredToRight && hasRightBit) ||\n (!isAvailableRight && availableLeft >= availableRight)) {\n // Attach right side of surface to the anchor.\n corner = this.setBit(corner, CornerBit.RIGHT);\n }\n return corner;\n };\n /**\n * @param corner Origin corner of the menu surface.\n * @return Maximum height of the menu surface, based on available space. 0\n * indicates should not be set.\n */\n MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight = function (corner) {\n if (this.maxHeight > 0) {\n return this.maxHeight;\n }\n var viewportDistance = this.measurements.viewportDistance;\n var maxHeight = 0;\n var isBottomAligned = this.hasBit(corner, CornerBit.BOTTOM);\n var isBottomAnchored = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);\n var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;\n // When maximum height is not specified, it is handled from CSS.\n if (isBottomAligned) {\n maxHeight = viewportDistance.top + this.anchorMargin.top - MARGIN_TO_EDGE;\n if (!isBottomAnchored) {\n maxHeight += this.measurements.anchorSize.height;\n }\n }\n else {\n maxHeight = viewportDistance.bottom - this.anchorMargin.bottom +\n this.measurements.anchorSize.height - MARGIN_TO_EDGE;\n if (isBottomAnchored) {\n maxHeight -= this.measurements.anchorSize.height;\n }\n }\n return maxHeight;\n };\n /**\n * @param corner Origin corner of the menu surface.\n * @return Horizontal offset of menu surface origin corner from corresponding\n * anchor corner.\n */\n MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset = function (corner) {\n var anchorSize = this.measurements.anchorSize;\n // isRightAligned corresponds to using the 'right' property on the surface.\n var isRightAligned = this.hasBit(corner, CornerBit.RIGHT);\n var avoidHorizontalOverlap = this.hasBit(this.anchorCorner, CornerBit.RIGHT);\n if (isRightAligned) {\n var rightOffset = avoidHorizontalOverlap ?\n anchorSize.width - this.anchorMargin.left :\n this.anchorMargin.right;\n // For hoisted or fixed elements, adjust the offset by the difference\n // between viewport width and body width so when we calculate the right\n // value (`adjustPositionForHoistedElement`) based on the element\n // position, the right property is correct.\n if (this.isHoistedElement || this.isFixedPosition) {\n return rightOffset -\n (this.measurements.viewportSize.width -\n this.measurements.bodySize.width);\n }\n return rightOffset;\n }\n return avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin.right :\n this.anchorMargin.left;\n };\n /**\n * @param corner Origin corner of the menu surface.\n * @return Vertical offset of menu surface origin corner from corresponding\n * anchor corner.\n */\n MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset = function (corner) {\n var anchorSize = this.measurements.anchorSize;\n var isBottomAligned = this.hasBit(corner, CornerBit.BOTTOM);\n var avoidVerticalOverlap = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);\n var y = 0;\n if (isBottomAligned) {\n y = avoidVerticalOverlap ? anchorSize.height - this.anchorMargin.top :\n -this.anchorMargin.bottom;\n }\n else {\n y = avoidVerticalOverlap ?\n (anchorSize.height + this.anchorMargin.bottom) :\n this.anchorMargin.top;\n }\n return y;\n };\n /**\n * Calculates the offsets for positioning the menu-surface when the\n * menu-surface has been hoisted to the body.\n */\n MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement = function (position) {\n var e_1, _a;\n var _b = this.measurements, windowScroll = _b.windowScroll, viewportDistance = _b.viewportDistance, surfaceSize = _b.surfaceSize, viewportSize = _b.viewportSize;\n var props = Object.keys(position);\n try {\n for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {\n var prop = props_1_1.value;\n var value = position[prop] || 0;\n if (this.isHorizontallyCenteredOnViewport &&\n (prop === 'left' || prop === 'right')) {\n position[prop] = (viewportSize.width - surfaceSize.width) / 2;\n continue;\n }\n // Hoisted surfaces need to have the anchor elements location on the page\n // added to the position properties for proper alignment on the body.\n value += viewportDistance[prop];\n // Surfaces that are absolutely positioned need to have additional\n // calculations for scroll and bottom positioning.\n if (!this.isFixedPosition) {\n if (prop === 'top') {\n value += windowScroll.y;\n }\n else if (prop === 'bottom') {\n value -= windowScroll.y;\n }\n else if (prop === 'left') {\n value += windowScroll.x;\n }\n else { // prop === 'right'\n value -= windowScroll.x;\n }\n }\n position[prop] = value;\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (props_1_1 && !props_1_1.done && (_a = props_1.return)) _a.call(props_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n };\n /**\n * The last focused element when the menu surface was opened should regain\n * focus, if the user is focused on or within the menu surface when it is\n * closed.\n */\n MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus = function () {\n var _this = this;\n var isRootFocused = this.adapter.isFocused();\n var ownerDocument = this.adapter.getOwnerDocument ?\n this.adapter.getOwnerDocument() :\n document;\n var childHasFocus = ownerDocument.activeElement &&\n this.adapter.isElementInContainer(ownerDocument.activeElement);\n if (isRootFocused || childHasFocus) {\n // Wait before restoring focus when closing the menu surface. This is\n // important because if a touch event triggered the menu close, and the\n // subsequent mouse event occurs after focus is restored, then the\n // restored focus would be lost.\n setTimeout(function () {\n _this.adapter.restoreFocus();\n }, numbers.TOUCH_EVENT_WAIT_MS);\n }\n };\n MDCMenuSurfaceFoundation.prototype.hasBit = function (corner, bit) {\n return Boolean(corner & bit); // tslint:disable-line:no-bitwise\n };\n MDCMenuSurfaceFoundation.prototype.setBit = function (corner, bit) {\n return corner | bit; // tslint:disable-line:no-bitwise\n };\n MDCMenuSurfaceFoundation.prototype.unsetBit = function (corner, bit) {\n return corner ^ bit;\n };\n /**\n * isFinite that doesn't force conversion to number type.\n * Equivalent to Number.isFinite in ES2015, which is not supported in IE.\n */\n MDCMenuSurfaceFoundation.prototype.isFinite = function (num) {\n return typeof num === 'number' && isFinite(num);\n };\n return MDCMenuSurfaceFoundation;\n}(MDCFoundation));\nexport { MDCMenuSurfaceFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCMenuSurfaceFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\nimport { Corner as CornerEnum, CornerBit } from '@material/menu-surface/constants.js';\nimport MDCMenuSurfaceFoundation from '@material/menu-surface/foundation.js';\nimport { addHasRemoveClass, BaseElement } from '@material/mwc-base/base-element.js';\nimport { observer } from '@material/mwc-base/observer.js';\nimport { deepActiveElementPath, doesElementContainFocus } from '@material/mwc-base/utils.js';\nimport { html } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styleMap } from 'lit/directives/style-map.js';\n// tslint:disable:no-bitwise\n// required for closure compiler\nconst stringToCorner = {\n 'TOP_LEFT': CornerEnum.TOP_LEFT,\n 'TOP_RIGHT': CornerEnum.TOP_RIGHT,\n 'BOTTOM_LEFT': CornerEnum.BOTTOM_LEFT,\n 'BOTTOM_RIGHT': CornerEnum.BOTTOM_RIGHT,\n 'TOP_START': CornerEnum.TOP_START,\n 'TOP_END': CornerEnum.TOP_END,\n 'BOTTOM_START': CornerEnum.BOTTOM_START,\n 'BOTTOM_END': CornerEnum.BOTTOM_END,\n};\n/**\n * @fires opened\n * @fires closed\n */\nexport class MenuSurfaceBase extends BaseElement {\n constructor() {\n super(...arguments);\n this.mdcFoundationClass = MDCMenuSurfaceFoundation;\n this.absolute = false;\n this.fullwidth = false;\n this.fixed = false;\n this.x = null;\n this.y = null;\n // must be defined before open or else race condition in foundation occurs.\n this.quick = false;\n this.open = false;\n this.stayOpenOnBodyClick = false;\n this.bitwiseCorner = CornerEnum.TOP_START;\n this.previousMenuCorner = null;\n // must be defined before observer of anchor corner for initialization\n this.menuCorner = 'START';\n this.corner = 'TOP_START';\n this.styleTop = '';\n this.styleLeft = '';\n this.styleRight = '';\n this.styleBottom = '';\n this.styleMaxHeight = '';\n this.styleTransformOrigin = '';\n this.anchor = null;\n this.previouslyFocused = null;\n this.previousAnchor = null;\n this.onBodyClickBound = () => undefined;\n }\n render() {\n return this.renderSurface();\n }\n renderSurface() {\n const classes = this.getRootClasses();\n const styles = this.getRootStyles();\n return html `\n \n ${this.renderContent()}\n `;\n }\n getRootClasses() {\n return {\n 'mdc-menu-surface': true,\n 'mdc-menu-surface--fixed': this.fixed,\n 'mdc-menu-surface--fullwidth': this.fullwidth,\n };\n }\n getRootStyles() {\n return {\n 'top': this.styleTop,\n 'left': this.styleLeft,\n 'right': this.styleRight,\n 'bottom': this.styleBottom,\n 'max-height': this.styleMaxHeight,\n 'transform-origin': this.styleTransformOrigin,\n };\n }\n renderContent() {\n return html ``;\n }\n createAdapter() {\n return Object.assign(Object.assign({}, addHasRemoveClass(this.mdcRoot)), { hasAnchor: () => {\n return !!this.anchor;\n }, notifyClose: () => {\n const init = { bubbles: true, composed: true };\n const ev = new CustomEvent('closed', init);\n this.open = false;\n this.mdcRoot.dispatchEvent(ev);\n }, notifyClosing: () => {\n const init = { bubbles: true, composed: true };\n const ev = new CustomEvent('closing', init);\n this.mdcRoot.dispatchEvent(ev);\n }, notifyOpen: () => {\n const init = { bubbles: true, composed: true };\n const ev = new CustomEvent('opened', init);\n this.open = true;\n this.mdcRoot.dispatchEvent(ev);\n }, notifyOpening: () => {\n const init = { bubbles: true, composed: true };\n const ev = new CustomEvent('opening', init);\n this.mdcRoot.dispatchEvent(ev);\n }, isElementInContainer: () => false, isRtl: () => {\n if (this.mdcRoot) {\n return getComputedStyle(this.mdcRoot).direction === 'rtl';\n }\n return false;\n }, setTransformOrigin: (origin) => {\n const root = this.mdcRoot;\n if (!root) {\n return;\n }\n this.styleTransformOrigin = origin;\n }, isFocused: () => {\n return doesElementContainFocus(this);\n }, saveFocus: () => {\n const activeElementPath = deepActiveElementPath();\n const pathLength = activeElementPath.length;\n if (!pathLength) {\n this.previouslyFocused = null;\n }\n this.previouslyFocused = activeElementPath[pathLength - 1];\n }, restoreFocus: () => {\n if (!this.previouslyFocused) {\n return;\n }\n if ('focus' in this.previouslyFocused) {\n this.previouslyFocused.focus();\n }\n }, getInnerDimensions: () => {\n const mdcRoot = this.mdcRoot;\n if (!mdcRoot) {\n return { width: 0, height: 0 };\n }\n return { width: mdcRoot.offsetWidth, height: mdcRoot.offsetHeight };\n }, getAnchorDimensions: () => {\n const anchorElement = this.anchor;\n return anchorElement ? anchorElement.getBoundingClientRect() : null;\n }, getBodyDimensions: () => {\n return {\n width: document.body.clientWidth,\n height: document.body.clientHeight,\n };\n }, getWindowDimensions: () => {\n return {\n width: window.innerWidth,\n height: window.innerHeight,\n };\n }, getWindowScroll: () => {\n return {\n x: window.pageXOffset,\n y: window.pageYOffset,\n };\n }, setPosition: (position) => {\n const mdcRoot = this.mdcRoot;\n if (!mdcRoot) {\n return;\n }\n this.styleLeft = 'left' in position ? `${position.left}px` : '';\n this.styleRight = 'right' in position ? `${position.right}px` : '';\n this.styleTop = 'top' in position ? `${position.top}px` : '';\n this.styleBottom = 'bottom' in position ? `${position.bottom}px` : '';\n }, setMaxHeight: async (height) => {\n const mdcRoot = this.mdcRoot;\n if (!mdcRoot) {\n return;\n }\n // must set both for IE support as IE will not set a var\n this.styleMaxHeight = height;\n await this.updateComplete;\n this.styleMaxHeight = `var(--mdc-menu-max-height, ${height})`;\n } });\n }\n onKeydown(evt) {\n if (this.mdcFoundation) {\n this.mdcFoundation.handleKeydown(evt);\n }\n }\n onBodyClick(evt) {\n if (this.stayOpenOnBodyClick) {\n return;\n }\n const path = evt.composedPath();\n if (path.indexOf(this) === -1) {\n this.close();\n }\n }\n registerBodyClick() {\n this.onBodyClickBound = this.onBodyClick.bind(this);\n // capture otherwise listener closes menu after quick menu opens\n document.body.addEventListener('click', this.onBodyClickBound, { passive: true, capture: true });\n }\n deregisterBodyClick() {\n document.body.removeEventListener('click', this.onBodyClickBound, { capture: true });\n }\n onOpenChanged(isOpen, wasOpen) {\n if (this.mdcFoundation) {\n if (isOpen) {\n this.mdcFoundation.open();\n // wasOpen helps with first render (when it is `undefined`) perf\n }\n else if (wasOpen !== undefined) {\n this.mdcFoundation.close();\n }\n }\n }\n close() {\n this.open = false;\n }\n show() {\n this.open = true;\n }\n}\n__decorate([\n query('.mdc-menu-surface')\n], MenuSurfaceBase.prototype, \"mdcRoot\", void 0);\n__decorate([\n query('slot')\n], MenuSurfaceBase.prototype, \"slotElement\", void 0);\n__decorate([\n property({ type: Boolean }),\n observer(function (isAbsolute) {\n if (this.mdcFoundation && !this.fixed) {\n this.mdcFoundation.setIsHoisted(isAbsolute);\n }\n })\n], MenuSurfaceBase.prototype, \"absolute\", void 0);\n__decorate([\n property({ type: Boolean })\n], MenuSurfaceBase.prototype, \"fullwidth\", void 0);\n__decorate([\n property({ type: Boolean }),\n observer(function (isFixed) {\n if (this.mdcFoundation && !this.absolute) {\n this.mdcFoundation.setFixedPosition(isFixed);\n }\n })\n], MenuSurfaceBase.prototype, \"fixed\", void 0);\n__decorate([\n property({ type: Number }),\n observer(function (value) {\n if (this.mdcFoundation && this.y !== null && value !== null) {\n this.mdcFoundation.setAbsolutePosition(value, this.y);\n this.mdcFoundation.setAnchorMargin({ left: value, top: this.y, right: -value, bottom: this.y });\n }\n })\n], MenuSurfaceBase.prototype, \"x\", void 0);\n__decorate([\n property({ type: Number }),\n observer(function (value) {\n if (this.mdcFoundation && this.x !== null && value !== null) {\n this.mdcFoundation.setAbsolutePosition(this.x, value);\n this.mdcFoundation.setAnchorMargin({ left: this.x, top: value, right: -this.x, bottom: value });\n }\n })\n], MenuSurfaceBase.prototype, \"y\", void 0);\n__decorate([\n property({ type: Boolean }),\n observer(function (value) {\n if (this.mdcFoundation) {\n this.mdcFoundation.setQuickOpen(value);\n }\n })\n], MenuSurfaceBase.prototype, \"quick\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true }),\n observer(function (isOpen, wasOpen) {\n this.onOpenChanged(isOpen, wasOpen);\n })\n], MenuSurfaceBase.prototype, \"open\", void 0);\n__decorate([\n property({ type: Boolean })\n], MenuSurfaceBase.prototype, \"stayOpenOnBodyClick\", void 0);\n__decorate([\n state(),\n observer(function (value) {\n if (this.mdcFoundation) {\n if (value) {\n this.mdcFoundation.setAnchorCorner(value);\n }\n else {\n this.mdcFoundation.setAnchorCorner(value);\n }\n }\n })\n], MenuSurfaceBase.prototype, \"bitwiseCorner\", void 0);\n__decorate([\n property({ type: String }),\n observer(function (value) {\n if (this.mdcFoundation) {\n const isValidValue = value === 'START' || value === 'END';\n const isFirstTimeSet = this.previousMenuCorner === null;\n const cornerChanged = !isFirstTimeSet && value !== this.previousMenuCorner;\n const initiallySetToEnd = isFirstTimeSet && value === 'END';\n if (isValidValue && (cornerChanged || initiallySetToEnd)) {\n this.bitwiseCorner = this.bitwiseCorner ^ CornerBit.RIGHT;\n this.mdcFoundation.flipCornerHorizontally();\n this.previousMenuCorner = value;\n }\n }\n })\n], MenuSurfaceBase.prototype, \"menuCorner\", void 0);\n__decorate([\n property({ type: String }),\n observer(function (value) {\n if (this.mdcFoundation) {\n if (value) {\n let newCorner = stringToCorner[value];\n if (this.menuCorner === 'END') {\n newCorner = newCorner ^ CornerBit.RIGHT;\n }\n this.bitwiseCorner = newCorner;\n }\n }\n })\n], MenuSurfaceBase.prototype, \"corner\", void 0);\n__decorate([\n state()\n], MenuSurfaceBase.prototype, \"styleTop\", void 0);\n__decorate([\n state()\n], MenuSurfaceBase.prototype, \"styleLeft\", void 0);\n__decorate([\n state()\n], MenuSurfaceBase.prototype, \"styleRight\", void 0);\n__decorate([\n state()\n], MenuSurfaceBase.prototype, \"styleBottom\", void 0);\n__decorate([\n state()\n], MenuSurfaceBase.prototype, \"styleMaxHeight\", void 0);\n__decorate([\n state()\n], MenuSurfaceBase.prototype, \"styleTransformOrigin\", void 0);\n//# sourceMappingURL=mwc-menu-surface-base.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-LIcense-Identifier: Apache-2.0\n */\nimport { css } from 'lit';\nexport const styles = css `.mdc-menu-surface{display:none;position:absolute;box-sizing:border-box;max-width:calc(100vw - 32px);max-width:var(--mdc-menu-max-width, calc(100vw - 32px));max-height:calc(100vh - 32px);max-height:var(--mdc-menu-max-height, calc(100vh - 32px));margin:0;padding:0;transform:scale(1);transform-origin:top left;opacity:0;overflow:auto;will-change:transform,opacity;z-index:8;transition:opacity .03s linear,transform .12s cubic-bezier(0, 0, 0.2, 1),height 250ms cubic-bezier(0, 0, 0.2, 1);box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2),0px 8px 10px 1px rgba(0, 0, 0, 0.14),0px 3px 14px 2px rgba(0,0,0,.12);background-color:#fff;background-color:var(--mdc-theme-surface, #fff);color:#000;color:var(--mdc-theme-on-surface, #000);border-radius:4px;border-radius:var(--mdc-shape-medium, 4px);transform-origin-left:top left;transform-origin-right:top right}.mdc-menu-surface:focus{outline:none}.mdc-menu-surface--animating-open{display:inline-block;transform:scale(0.8);opacity:0}.mdc-menu-surface--open{display:inline-block;transform:scale(1);opacity:1}.mdc-menu-surface--animating-closed{display:inline-block;opacity:0;transition:opacity .075s linear}[dir=rtl] .mdc-menu-surface,.mdc-menu-surface[dir=rtl]{transform-origin-left:top right;transform-origin-right:top left}.mdc-menu-surface--anchor{position:relative;overflow:visible}.mdc-menu-surface--fixed{position:fixed}.mdc-menu-surface--fullwidth{width:100%}:host(:not([open])){display:none}.mdc-menu-surface{z-index:8;z-index:var(--mdc-menu-z-index, 8);min-width:112px;min-width:var(--mdc-menu-min-width, 112px)}`;\n//# sourceMappingURL=mwc-menu-surface.css.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { customElement } from 'lit/decorators.js';\nimport { MenuSurfaceBase } from './mwc-menu-surface-base.js';\nimport { styles } from './mwc-menu-surface.css.js';\nlet MenuSurface = class MenuSurface extends MenuSurfaceBase {\n};\nMenuSurface.styles = [styles];\nMenuSurface = __decorate([\n customElement('mwc-menu-surface')\n], MenuSurface);\nexport { MenuSurface };\n//# sourceMappingURL=mwc-menu-surface.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar cssClasses = {\n MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected',\n MENU_SELECTION_GROUP: 'mdc-menu__selection-group',\n ROOT: 'mdc-menu',\n};\nvar strings = {\n ARIA_CHECKED_ATTR: 'aria-checked',\n ARIA_DISABLED_ATTR: 'aria-disabled',\n CHECKBOX_SELECTOR: 'input[type=\"checkbox\"]',\n LIST_SELECTOR: '.mdc-list,.mdc-deprecated-list',\n SELECTED_EVENT: 'MDCMenu:selected',\n SKIP_RESTORE_FOCUS: 'data-menu-item-skip-restore-focus',\n};\nvar numbers = {\n FOCUS_ROOT_INDEX: -1,\n};\nvar DefaultFocusState;\n(function (DefaultFocusState) {\n DefaultFocusState[DefaultFocusState[\"NONE\"] = 0] = \"NONE\";\n DefaultFocusState[DefaultFocusState[\"LIST_ROOT\"] = 1] = \"LIST_ROOT\";\n DefaultFocusState[DefaultFocusState[\"FIRST_ITEM\"] = 2] = \"FIRST_ITEM\";\n DefaultFocusState[DefaultFocusState[\"LAST_ITEM\"] = 3] = \"LAST_ITEM\";\n})(DefaultFocusState || (DefaultFocusState = {}));\nexport { cssClasses, strings, numbers, DefaultFocusState };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses as listCssClasses } from '@material/list/constants';\nimport { MDCMenuSurfaceFoundation } from '@material/menu-surface/foundation';\nimport { cssClasses, DefaultFocusState, numbers, strings } from './constants';\nvar MDCMenuFoundation = /** @class */ (function (_super) {\n __extends(MDCMenuFoundation, _super);\n function MDCMenuFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCMenuFoundation.defaultAdapter), adapter)) || this;\n _this.closeAnimationEndTimerId = 0;\n _this.defaultFocusState = DefaultFocusState.LIST_ROOT;\n _this.selectedIndex = -1;\n return _this;\n }\n Object.defineProperty(MDCMenuFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCMenuFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCMenuFoundation, \"numbers\", {\n get: function () {\n return numbers;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCMenuFoundation, \"defaultAdapter\", {\n /**\n * @see {@link MDCMenuAdapter} for typing information on parameters and return types.\n */\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n addClassToElementAtIndex: function () { return undefined; },\n removeClassFromElementAtIndex: function () { return undefined; },\n addAttributeToElementAtIndex: function () { return undefined; },\n removeAttributeFromElementAtIndex: function () { return undefined; },\n getAttributeFromElementAtIndex: function () { return null; },\n elementContainsClass: function () { return false; },\n closeSurface: function () { return undefined; },\n getElementIndex: function () { return -1; },\n notifySelected: function () { return undefined; },\n getMenuItemCount: function () { return 0; },\n focusItemAtIndex: function () { return undefined; },\n focusListRoot: function () { return undefined; },\n getSelectedSiblingOfItemAtIndex: function () { return -1; },\n isSelectableItemAtIndex: function () { return false; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n MDCMenuFoundation.prototype.destroy = function () {\n if (this.closeAnimationEndTimerId) {\n clearTimeout(this.closeAnimationEndTimerId);\n }\n this.adapter.closeSurface();\n };\n MDCMenuFoundation.prototype.handleKeydown = function (evt) {\n var key = evt.key, keyCode = evt.keyCode;\n var isTab = key === 'Tab' || keyCode === 9;\n if (isTab) {\n this.adapter.closeSurface(/** skipRestoreFocus */ true);\n }\n };\n MDCMenuFoundation.prototype.handleItemAction = function (listItem) {\n var _this = this;\n var index = this.adapter.getElementIndex(listItem);\n if (index < 0) {\n return;\n }\n this.adapter.notifySelected({ index: index });\n var skipRestoreFocus = this.adapter.getAttributeFromElementAtIndex(index, strings.SKIP_RESTORE_FOCUS) === 'true';\n this.adapter.closeSurface(skipRestoreFocus);\n // Wait for the menu to close before adding/removing classes that affect styles.\n this.closeAnimationEndTimerId = setTimeout(function () {\n // Recompute the index in case the menu contents have changed.\n var recomputedIndex = _this.adapter.getElementIndex(listItem);\n if (recomputedIndex >= 0 &&\n _this.adapter.isSelectableItemAtIndex(recomputedIndex)) {\n _this.setSelectedIndex(recomputedIndex);\n }\n }, MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION);\n };\n MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () {\n switch (this.defaultFocusState) {\n case DefaultFocusState.FIRST_ITEM:\n this.adapter.focusItemAtIndex(0);\n break;\n case DefaultFocusState.LAST_ITEM:\n this.adapter.focusItemAtIndex(this.adapter.getMenuItemCount() - 1);\n break;\n case DefaultFocusState.NONE:\n // Do nothing.\n break;\n default:\n this.adapter.focusListRoot();\n break;\n }\n };\n /**\n * Sets default focus state where the menu should focus every time when menu\n * is opened. Focuses the list root (`DefaultFocusState.LIST_ROOT`) element by\n * default.\n */\n MDCMenuFoundation.prototype.setDefaultFocusState = function (focusState) {\n this.defaultFocusState = focusState;\n };\n /** @return Index of the currently selected list item within the menu. */\n MDCMenuFoundation.prototype.getSelectedIndex = function () {\n return this.selectedIndex;\n };\n /**\n * Selects the list item at `index` within the menu.\n * @param index Index of list item within the menu.\n */\n MDCMenuFoundation.prototype.setSelectedIndex = function (index) {\n this.validatedIndex(index);\n if (!this.adapter.isSelectableItemAtIndex(index)) {\n throw new Error('MDCMenuFoundation: No selection group at specified index.');\n }\n var prevSelectedIndex = this.adapter.getSelectedSiblingOfItemAtIndex(index);\n if (prevSelectedIndex >= 0) {\n this.adapter.removeAttributeFromElementAtIndex(prevSelectedIndex, strings.ARIA_CHECKED_ATTR);\n this.adapter.removeClassFromElementAtIndex(prevSelectedIndex, cssClasses.MENU_SELECTED_LIST_ITEM);\n }\n this.adapter.addClassToElementAtIndex(index, cssClasses.MENU_SELECTED_LIST_ITEM);\n this.adapter.addAttributeToElementAtIndex(index, strings.ARIA_CHECKED_ATTR, 'true');\n this.selectedIndex = index;\n };\n /**\n * Sets the enabled state to isEnabled for the menu item at the given index.\n * @param index Index of the menu item\n * @param isEnabled The desired enabled state of the menu item.\n */\n MDCMenuFoundation.prototype.setEnabled = function (index, isEnabled) {\n this.validatedIndex(index);\n if (isEnabled) {\n this.adapter.removeClassFromElementAtIndex(index, listCssClasses.LIST_ITEM_DISABLED_CLASS);\n this.adapter.addAttributeToElementAtIndex(index, strings.ARIA_DISABLED_ATTR, 'false');\n }\n else {\n this.adapter.addClassToElementAtIndex(index, listCssClasses.LIST_ITEM_DISABLED_CLASS);\n this.adapter.addAttributeToElementAtIndex(index, strings.ARIA_DISABLED_ATTR, 'true');\n }\n };\n MDCMenuFoundation.prototype.validatedIndex = function (index) {\n var menuSize = this.adapter.getMenuItemCount();\n var isIndexInRange = index >= 0 && index < menuSize;\n if (!isIndexInRange) {\n throw new Error('MDCMenuFoundation: No list item at specified index.');\n }\n };\n return MDCMenuFoundation;\n}(MDCFoundation));\nexport { MDCMenuFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCMenuFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport '@material/mwc-list/mwc-list.js';\nimport './mwc-menu-surface.js';\nimport { DefaultFocusState as DefaultFocusStateEnum } from '@material/menu/constants.js';\nimport MDCMenuFoundation from '@material/menu/foundation.js';\nimport { BaseElement } from '@material/mwc-base/base-element.js';\nimport { observer } from '@material/mwc-base/observer.js';\nimport { html } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nexport { createSetFromIndex, isEventMulti, isIndexSet } from '@material/mwc-list/mwc-list-foundation.js';\n/**\n * @fires selected {SelectedDetail}\n * @fires action {ActionDetail}\n * @fires items-updated\n * @fires opened\n * @fires closed\n */\nexport class MenuBase extends BaseElement {\n constructor() {\n super(...arguments);\n this.mdcFoundationClass = MDCMenuFoundation;\n this.listElement_ = null;\n this.anchor = null;\n this.open = false;\n this.quick = false;\n this.wrapFocus = false;\n this.innerRole = 'menu';\n this.innerAriaLabel = null;\n this.corner = 'TOP_START';\n this.x = null;\n this.y = null;\n this.absolute = false;\n this.multi = false;\n this.activatable = false;\n this.fixed = false;\n this.forceGroupSelection = false;\n this.fullwidth = false;\n this.menuCorner = 'START';\n this.stayOpenOnBodyClick = false;\n this.defaultFocus = 'LIST_ROOT';\n this._listUpdateComplete = null;\n }\n get listElement() {\n if (!this.listElement_) {\n this.listElement_ = this.renderRoot.querySelector('mwc-list');\n return this.listElement_;\n }\n return this.listElement_;\n }\n get items() {\n const listElement = this.listElement;\n if (listElement) {\n return listElement.items;\n }\n return [];\n }\n get index() {\n const listElement = this.listElement;\n if (listElement) {\n return listElement.index;\n }\n return -1;\n }\n get selected() {\n const listElement = this.listElement;\n if (listElement) {\n return listElement.selected;\n }\n return null;\n }\n render() {\n return this.renderSurface();\n }\n renderSurface() {\n const classes = this.getSurfaceClasses();\n return html `\n \n ${this.renderList()}\n `;\n }\n getSurfaceClasses() {\n return {\n 'mdc-menu': true,\n 'mdc-menu-surface': true,\n };\n }\n renderList() {\n const itemRoles = this.innerRole === 'menu' ? 'menuitem' : 'option';\n const classes = this.renderListClasses();\n return html `\n \n \n `;\n }\n renderListClasses() {\n return {\n 'mdc-deprecated-list': true,\n };\n }\n createAdapter() {\n return {\n addClassToElementAtIndex: (index, className) => {\n const listElement = this.listElement;\n if (!listElement) {\n return;\n }\n const element = listElement.items[index];\n if (!element) {\n return;\n }\n if (className === 'mdc-menu-item--selected') {\n if (this.forceGroupSelection && !element.selected) {\n listElement.toggle(index, true);\n }\n }\n else {\n element.classList.add(className);\n }\n },\n removeClassFromElementAtIndex: (index, className) => {\n const listElement = this.listElement;\n if (!listElement) {\n return;\n }\n const element = listElement.items[index];\n if (!element) {\n return;\n }\n if (className === 'mdc-menu-item--selected') {\n if (element.selected) {\n listElement.toggle(index, false);\n }\n }\n else {\n element.classList.remove(className);\n }\n },\n addAttributeToElementAtIndex: (index, attr, value) => {\n const listElement = this.listElement;\n if (!listElement) {\n return;\n }\n const element = listElement.items[index];\n if (!element) {\n return;\n }\n element.setAttribute(attr, value);\n },\n removeAttributeFromElementAtIndex: (index, attr) => {\n const listElement = this.listElement;\n if (!listElement) {\n return;\n }\n const element = listElement.items[index];\n if (!element) {\n return;\n }\n element.removeAttribute(attr);\n },\n getAttributeFromElementAtIndex: (index, attr) => {\n const listElement = this.listElement;\n if (!listElement) {\n return null;\n }\n const element = listElement.items[index];\n if (!element) {\n return null;\n }\n return element.getAttribute(attr);\n },\n elementContainsClass: (element, className) => element.classList.contains(className),\n closeSurface: () => {\n this.open = false;\n },\n getElementIndex: (element) => {\n const listElement = this.listElement;\n if (listElement) {\n return listElement.items.indexOf(element);\n }\n return -1;\n },\n notifySelected: () => { },\n getMenuItemCount: () => {\n const listElement = this.listElement;\n if (!listElement) {\n return 0;\n }\n return listElement.items.length;\n },\n focusItemAtIndex: (index) => {\n const listElement = this.listElement;\n if (!listElement) {\n return;\n }\n const element = listElement.items[index];\n if (element) {\n element.focus();\n }\n },\n focusListRoot: () => {\n if (this.listElement) {\n this.listElement.focus();\n }\n },\n getSelectedSiblingOfItemAtIndex: (index) => {\n const listElement = this.listElement;\n if (!listElement) {\n return -1;\n }\n const elementAtIndex = listElement.items[index];\n if (!elementAtIndex || !elementAtIndex.group) {\n return -1;\n }\n for (let i = 0; i < listElement.items.length; i++) {\n if (i === index) {\n continue;\n }\n const current = listElement.items[i];\n if (current.selected && current.group === elementAtIndex.group) {\n return i;\n }\n }\n return -1;\n },\n isSelectableItemAtIndex: (index) => {\n const listElement = this.listElement;\n if (!listElement) {\n return false;\n }\n const elementAtIndex = listElement.items[index];\n if (!elementAtIndex) {\n return false;\n }\n return elementAtIndex.hasAttribute('group');\n },\n };\n }\n onKeydown(evt) {\n if (this.mdcFoundation) {\n this.mdcFoundation.handleKeydown(evt);\n }\n }\n onAction(evt) {\n const listElement = this.listElement;\n if (this.mdcFoundation && listElement) {\n const index = evt.detail.index;\n const el = listElement.items[index];\n if (el) {\n this.mdcFoundation.handleItemAction(el);\n }\n }\n }\n onOpened() {\n this.open = true;\n if (this.mdcFoundation) {\n this.mdcFoundation.handleMenuSurfaceOpened();\n }\n }\n onClosed() {\n this.open = false;\n }\n // tslint:disable:ban-ts-ignore\n async getUpdateComplete() {\n await this._listUpdateComplete;\n // @ts-ignore\n const result = await super.getUpdateComplete();\n return result;\n }\n // tslint:enable:ban-ts-ignore\n async firstUpdated() {\n super.firstUpdated();\n const listElement = this.listElement;\n if (listElement) {\n this._listUpdateComplete = listElement.updateComplete;\n await this._listUpdateComplete;\n }\n }\n select(index) {\n const listElement = this.listElement;\n if (listElement) {\n listElement.select(index);\n }\n }\n close() {\n this.open = false;\n }\n show() {\n this.open = true;\n }\n getFocusedItemIndex() {\n const listElement = this.listElement;\n if (listElement) {\n return listElement.getFocusedItemIndex();\n }\n return -1;\n }\n focusItemAtIndex(index) {\n const listElement = this.listElement;\n if (listElement) {\n listElement.focusItemAtIndex(index);\n }\n }\n layout(updateItems = true) {\n const listElement = this.listElement;\n if (listElement) {\n listElement.layout(updateItems);\n }\n }\n}\n__decorate([\n query('.mdc-menu')\n], MenuBase.prototype, \"mdcRoot\", void 0);\n__decorate([\n query('slot')\n], MenuBase.prototype, \"slotElement\", void 0);\n__decorate([\n property({ type: Object })\n], MenuBase.prototype, \"anchor\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true })\n], MenuBase.prototype, \"open\", void 0);\n__decorate([\n property({ type: Boolean })\n], MenuBase.prototype, \"quick\", void 0);\n__decorate([\n property({ type: Boolean })\n], MenuBase.prototype, \"wrapFocus\", void 0);\n__decorate([\n property({ type: String })\n], MenuBase.prototype, \"innerRole\", void 0);\n__decorate([\n property({ type: String })\n], MenuBase.prototype, \"innerAriaLabel\", void 0);\n__decorate([\n property({ type: String })\n], MenuBase.prototype, \"corner\", void 0);\n__decorate([\n property({ type: Number })\n], MenuBase.prototype, \"x\", void 0);\n__decorate([\n property({ type: Number })\n], MenuBase.prototype, \"y\", void 0);\n__decorate([\n property({ type: Boolean })\n], MenuBase.prototype, \"absolute\", void 0);\n__decorate([\n property({ type: Boolean })\n], MenuBase.prototype, \"multi\", void 0);\n__decorate([\n property({ type: Boolean })\n], MenuBase.prototype, \"activatable\", void 0);\n__decorate([\n property({ type: Boolean })\n], MenuBase.prototype, \"fixed\", void 0);\n__decorate([\n property({ type: Boolean })\n], MenuBase.prototype, \"forceGroupSelection\", void 0);\n__decorate([\n property({ type: Boolean })\n], MenuBase.prototype, \"fullwidth\", void 0);\n__decorate([\n property({ type: String })\n], MenuBase.prototype, \"menuCorner\", void 0);\n__decorate([\n property({ type: Boolean })\n], MenuBase.prototype, \"stayOpenOnBodyClick\", void 0);\n__decorate([\n property({ type: String }),\n observer(function (value) {\n if (this.mdcFoundation) {\n this.mdcFoundation.setDefaultFocusState(DefaultFocusStateEnum[value]);\n }\n })\n], MenuBase.prototype, \"defaultFocus\", void 0);\n//# sourceMappingURL=mwc-menu-base.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-LIcense-Identifier: Apache-2.0\n */\nimport { css } from 'lit';\nexport const styles = css `mwc-list ::slotted([mwc-list-item]:not([twoline])),mwc-list ::slotted([noninteractive]:not([twoline])){height:var(--mdc-menu-item-height, 48px)}`;\n//# sourceMappingURL=mwc-menu.css.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { customElement } from 'lit/decorators.js';\nimport { MenuBase } from './mwc-menu-base.js';\nimport { styles } from './mwc-menu.css.js';\nexport { createSetFromIndex, isEventMulti, isIndexSet } from '@material/mwc-list/mwc-list-foundation.js';\nlet Menu = class Menu extends MenuBase {\n};\nMenu.styles = [styles];\nMenu = __decorate([\n customElement('mwc-menu')\n], Menu);\nexport { Menu };\n//# sourceMappingURL=mwc-menu.js.map","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nvar _a, _b;\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { property } from 'lit/decorators.js';\nimport { addHasRemoveClass, BaseElement } from './base-element.js';\nexport { addHasRemoveClass, BaseElement };\n// ShadyDOM should submit elements in component internals\nconst USING_SHADY_DOM = (_b = (_a = window.ShadyDOM) === null || _a === void 0 ? void 0 : _a.inUse) !== null && _b !== void 0 ? _b : false;\n/** @soyCompatible */\nexport class FormElement extends BaseElement {\n constructor() {\n super(...arguments);\n /**\n * Disabled state for the component. When `disabled` is set to `true`, the\n * component will not be added to form submission.\n */\n this.disabled = false;\n /**\n * Form element that contains this element\n */\n this.containingForm = null;\n this.formDataListener = (ev) => {\n if (!this.disabled) {\n this.setFormData(ev.formData);\n }\n };\n }\n findFormElement() {\n // If the component internals are not in Shadow DOM, subscribing to form\n // data events could lead to duplicated data, which may not work correctly\n // on the server side.\n if (!this.shadowRoot || USING_SHADY_DOM) {\n return null;\n }\n const root = this.getRootNode();\n const forms = root.querySelectorAll('form');\n for (const form of Array.from(forms)) {\n if (form.contains(this)) {\n return form;\n }\n }\n return null;\n }\n connectedCallback() {\n var _a;\n super.connectedCallback();\n this.containingForm = this.findFormElement();\n (_a = this.containingForm) === null || _a === void 0 ? void 0 : _a.addEventListener('formdata', this.formDataListener);\n }\n disconnectedCallback() {\n var _a;\n super.disconnectedCallback();\n (_a = this.containingForm) === null || _a === void 0 ? void 0 : _a.removeEventListener('formdata', this.formDataListener);\n this.containingForm = null;\n }\n click() {\n if (this.formElement && !this.disabled) {\n this.formElement.focus();\n this.formElement.click();\n }\n }\n firstUpdated() {\n super.firstUpdated();\n if (this.shadowRoot) {\n this.mdcRoot.addEventListener('change', (e) => {\n this.dispatchEvent(new Event('change', e));\n });\n }\n }\n}\nFormElement.shadowRootOptions = { mode: 'open', delegatesFocus: true };\n__decorate([\n property({ type: Boolean })\n], FormElement.prototype, \"disabled\", void 0);\n//# sourceMappingURL=form-element.js.map","/**\n * @license\n * Copyright 2021 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends, __read, __spreadArray, __values } from \"tslib\";\n/**\n * Mixin to add `MDCObserver` functionality to an optional base class.\n *\n * @deprecated Prefer MDCObserverFoundation for stricter closure compliance.\n * @template C Optional base class constructor type.\n * @param baseClass - Optional base class.\n * @return A class that extends the optional base class with `MDCObserver`\n * functionality.\n */\nexport function mdcObserver(baseClass) {\n if (baseClass === void 0) { baseClass = /** @class */ (function () {\n function class_1() {\n }\n return class_1;\n }()); }\n // Mixin classes cannot use private members and Symbol() cannot be used in 3P\n // for IE11.\n var unobserveMap = new WeakMap();\n return /** @class */ (function (_super) {\n __extends(MDCObserver, _super);\n function MDCObserver() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MDCObserver.prototype.observe = function (target, observers) {\n var e_1, _a;\n var _this = this;\n var cleanup = [];\n try {\n for (var _b = __values(Object.keys(observers)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var property = _c.value;\n var observer = observers[property].bind(this);\n cleanup.push(observeProperty(target, property, observer));\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n var unobserve = function () {\n var e_2, _a;\n try {\n for (var cleanup_1 = __values(cleanup), cleanup_1_1 = cleanup_1.next(); !cleanup_1_1.done; cleanup_1_1 = cleanup_1.next()) {\n var cleanupFn = cleanup_1_1.value;\n cleanupFn();\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (cleanup_1_1 && !cleanup_1_1.done && (_a = cleanup_1.return)) _a.call(cleanup_1);\n }\n finally { if (e_2) throw e_2.error; }\n }\n var unobserves = unobserveMap.get(_this) || [];\n var index = unobserves.indexOf(unobserve);\n if (index > -1) {\n unobserves.splice(index, 1);\n }\n };\n var unobserves = unobserveMap.get(this);\n if (!unobserves) {\n unobserves = [];\n unobserveMap.set(this, unobserves);\n }\n unobserves.push(unobserve);\n return unobserve;\n };\n MDCObserver.prototype.setObserversEnabled = function (target, enabled) {\n setObserversEnabled(target, enabled);\n };\n MDCObserver.prototype.unobserve = function () {\n var e_3, _a;\n // Iterate over a copy since unobserve() will remove themselves from the\n // array\n var unobserves = unobserveMap.get(this) || [];\n try {\n for (var _b = __values(__spreadArray([], __read(unobserves))), _c = _b.next(); !_c.done; _c = _b.next()) {\n var unobserve = _c.value;\n unobserve();\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_3) throw e_3.error; }\n }\n };\n return MDCObserver;\n }(baseClass));\n}\n/**\n * Observe a target's property for changes. When a property changes, the\n * provided `Observer` function will be invoked with the properties current and\n * previous values.\n *\n * The returned cleanup function will stop listening to changes for the\n * provided `Observer`.\n *\n * @template T The observed target type.\n * @template K The observed property.\n * @param target - The target to observe.\n * @param property - The property of the target to observe.\n * @param observer - An observer function to invoke each time the property\n * changes.\n * @return A cleanup function that will stop observing changes for the provided\n * `Observer`.\n */\nexport function observeProperty(target, property, observer) {\n var targetObservers = installObserver(target, property);\n var observers = targetObservers.getObservers(property);\n observers.push(observer);\n return function () {\n observers.splice(observers.indexOf(observer), 1);\n };\n}\n/**\n * A Map of all `TargetObservers` that have been installed.\n */\nvar allTargetObservers = new WeakMap();\n/**\n * Installs a `TargetObservers` for the provided target (if not already\n * installed), and replaces the given property with a getter and setter that\n * will respond to changes and call `TargetObservers`.\n *\n * Subsequent calls to `installObserver()` with the same target and property\n * will not override the property's previously installed getter/setter.\n *\n * @template T The observed target type.\n * @template K The observed property to create a getter/setter for.\n * @param target - The target to observe.\n * @param property - The property to create a getter/setter for, if needed.\n * @return The installed `TargetObservers` for the provided target.\n */\nfunction installObserver(target, property) {\n var observersMap = new Map();\n if (!allTargetObservers.has(target)) {\n allTargetObservers.set(target, {\n isEnabled: true,\n getObservers: function (key) {\n var observers = observersMap.get(key) || [];\n if (!observersMap.has(key)) {\n observersMap.set(key, observers);\n }\n return observers;\n },\n installedProperties: new Set()\n });\n }\n var targetObservers = allTargetObservers.get(target);\n if (targetObservers.installedProperties.has(property)) {\n // The getter/setter has already been replaced for this property\n return targetObservers;\n }\n // Retrieve (or create if it's a plain property) the original descriptor from\n // the target...\n var descriptor = getDescriptor(target, property) || {\n configurable: true,\n enumerable: true,\n value: target[property],\n writable: true\n };\n // ...and create a copy that will be used for the observer.\n var observedDescriptor = __assign({}, descriptor);\n var descGet = descriptor.get, descSet = descriptor.set;\n if ('value' in descriptor) {\n // The descriptor is a simple value (not a getter/setter).\n // For our observer descriptor that we copied, delete the value/writable\n // properties, since they are incompatible with the get/set properties\n // for descriptors.\n delete observedDescriptor.value;\n delete observedDescriptor.writable;\n // Set up a simple getter...\n var value_1 = descriptor.value;\n descGet = function () { return value_1; };\n // ...and setter (if the original property was writable).\n if (descriptor.writable) {\n descSet = function (newValue) {\n value_1 = newValue;\n };\n }\n }\n if (descGet) {\n observedDescriptor.get = function () {\n // `this as T` needed for closure conformance\n return descGet.call(this);\n };\n }\n if (descSet) {\n observedDescriptor.set = function (newValue) {\n var e_4, _a;\n // `thus as T` needed for closure conformance\n var previous = descGet ? descGet.call(this) : newValue;\n descSet.call(this, newValue);\n if (targetObservers.isEnabled && (!descGet || newValue !== previous)) {\n try {\n for (var _b = __values(targetObservers.getObservers(property)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var observer = _c.value;\n observer(newValue, previous);\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_4) throw e_4.error; }\n }\n }\n };\n }\n targetObservers.installedProperties.add(property);\n Object.defineProperty(target, property, observedDescriptor);\n return targetObservers;\n}\n/**\n * Retrieves the descriptor for a property from the provided target. This\n * function will walk up the target's prototype chain to search for the\n * descriptor.\n *\n * @template T The target type.\n * @template K The property type.\n * @param target - The target to retrieve a descriptor from.\n * @param property - The name of the property to retrieve a descriptor for.\n * @return the descriptor, or undefined if it does not exist. Keep in mind that\n * plain properties may not have a descriptor defined.\n */\nexport function getDescriptor(target, property) {\n var descriptorTarget = target;\n var descriptor;\n while (descriptorTarget) {\n descriptor = Object.getOwnPropertyDescriptor(descriptorTarget, property);\n if (descriptor) {\n break;\n }\n // Walk up the instance's prototype chain in case the property is declared\n // on a superclass.\n descriptorTarget = Object.getPrototypeOf(descriptorTarget);\n }\n return descriptor;\n}\n/**\n * Enables or disables all observers for a provided target. Changes to observed\n * properties will not call any observers when disabled.\n *\n * @template T The observed target type.\n * @param target - The target to enable or disable observers for.\n * @param enabled - True to enable or false to disable observers.\n */\nexport function setObserversEnabled(target, enabled) {\n var targetObservers = allTargetObservers.get(target);\n if (targetObservers) {\n targetObservers.isEnabled = enabled;\n }\n}\n//# sourceMappingURL=observer.js.map","/**\n * @license\n * Copyright 2021 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends, __read, __spreadArray, __values } from \"tslib\";\nimport { MDCFoundation } from './foundation';\nimport { observeProperty, setObserversEnabled } from './observer';\nvar MDCObserverFoundation = /** @class */ (function (_super) {\n __extends(MDCObserverFoundation, _super);\n function MDCObserverFoundation(adapter) {\n var _this = _super.call(this, adapter) || this;\n /** A set of cleanup functions to unobserve changes. */\n _this.unobserves = new Set();\n return _this;\n }\n MDCObserverFoundation.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.unobserve();\n };\n /**\n * Observe a target's properties for changes using the provided map of\n * property names and observer functions.\n *\n * @template T The target type.\n * @param target - The target to observe.\n * @param observers - An object whose keys are target properties and values\n * are observer functions that are called when the associated property\n * changes.\n * @return A cleanup function that can be called to unobserve the\n * target.\n */\n MDCObserverFoundation.prototype.observe = function (target, observers) {\n var e_1, _a;\n var _this = this;\n var cleanup = [];\n try {\n for (var _b = __values(Object.keys(observers)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var property = _c.value;\n var observer = observers[property].bind(this);\n cleanup.push(this.observeProperty(target, property, observer));\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n var unobserve = function () {\n var e_2, _a;\n try {\n for (var cleanup_1 = __values(cleanup), cleanup_1_1 = cleanup_1.next(); !cleanup_1_1.done; cleanup_1_1 = cleanup_1.next()) {\n var cleanupFn = cleanup_1_1.value;\n cleanupFn();\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (cleanup_1_1 && !cleanup_1_1.done && (_a = cleanup_1.return)) _a.call(cleanup_1);\n }\n finally { if (e_2) throw e_2.error; }\n }\n _this.unobserves.delete(unobserve);\n };\n this.unobserves.add(unobserve);\n return unobserve;\n };\n /**\n * Observe a target's property for changes. When a property changes, the\n * provided `Observer` function will be invoked with the properties current\n * and previous values.\n *\n * The returned cleanup function will stop listening to changes for the\n * provided `Observer`.\n *\n * @template T The observed target type.\n * @template K The observed property.\n * @param target - The target to observe.\n * @param property - The property of the target to observe.\n * @param observer - An observer function to invoke each time the property\n * changes.\n * @return A cleanup function that will stop observing changes for the\n * provided `Observer`.\n */\n MDCObserverFoundation.prototype.observeProperty = function (target, property, observer) {\n return observeProperty(target, property, observer);\n };\n /**\n * Enables or disables all observers for the provided target. Disabling\n * observers will prevent them from being called until they are re-enabled.\n *\n * @param target - The target to enable or disable observers for.\n * @param enabled - Whether or not observers should be called.\n */\n MDCObserverFoundation.prototype.setObserversEnabled = function (target, enabled) {\n setObserversEnabled(target, enabled);\n };\n /**\n * Clean up all observers and stop listening for property changes.\n */\n MDCObserverFoundation.prototype.unobserve = function () {\n var e_3, _a;\n try {\n // Iterate over a copy since unobserve() will remove themselves from the set\n for (var _b = __values(__spreadArray([], __read(this.unobserves))), _c = _b.next(); !_c.done; _c = _b.next()) {\n var unobserve = _c.value;\n unobserve();\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_3) throw e_3.error; }\n }\n };\n return MDCObserverFoundation;\n}(MDCFoundation));\nexport { MDCObserverFoundation };\n//# sourceMappingURL=observer-foundation.js.map","/**\n * @license\n * Copyright 2021 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * CSS classes used for switch.\n */\nexport var CssClasses;\n(function (CssClasses) {\n CssClasses[\"PROCESSING\"] = \"mdc-switch--processing\";\n CssClasses[\"SELECTED\"] = \"mdc-switch--selected\";\n CssClasses[\"UNSELECTED\"] = \"mdc-switch--unselected\";\n})(CssClasses || (CssClasses = {}));\n/**\n * Query selectors used for switch.\n */\nexport var Selectors;\n(function (Selectors) {\n Selectors[\"RIPPLE\"] = \".mdc-switch__ripple\";\n})(Selectors || (Selectors = {}));\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2021 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __extends } from \"tslib\";\nimport { MDCObserverFoundation } from '@material/base/observer-foundation';\nimport { CssClasses } from './constants';\n/**\n * `MDCSwitchFoundation` provides a state-only foundation for a switch\n * component.\n *\n * State observers and event handler entrypoints update a component's adapter's\n * state with the logic needed for switch to function.\n */\nvar MDCSwitchFoundation = /** @class */ (function (_super) {\n __extends(MDCSwitchFoundation, _super);\n function MDCSwitchFoundation(adapter) {\n var _this = _super.call(this, adapter) || this;\n _this.handleClick = _this.handleClick.bind(_this);\n return _this;\n }\n /**\n * Initializes the foundation and starts observing state changes.\n */\n MDCSwitchFoundation.prototype.init = function () {\n this.observe(this.adapter.state, {\n disabled: this.stopProcessingIfDisabled,\n processing: this.stopProcessingIfDisabled,\n });\n };\n /**\n * Event handler for switch click events. Clicking on a switch will toggle its\n * selected state.\n */\n MDCSwitchFoundation.prototype.handleClick = function () {\n if (this.adapter.state.disabled) {\n return;\n }\n this.adapter.state.selected = !this.adapter.state.selected;\n };\n MDCSwitchFoundation.prototype.stopProcessingIfDisabled = function () {\n if (this.adapter.state.disabled) {\n this.adapter.state.processing = false;\n }\n };\n return MDCSwitchFoundation;\n}(MDCObserverFoundation));\nexport { MDCSwitchFoundation };\n/**\n * `MDCSwitchRenderFoundation` provides a state and rendering foundation for a\n * switch component.\n *\n * State observers and event handler entrypoints update a component's\n * adapter's state with the logic needed for switch to function.\n *\n * In response to state changes, the rendering foundation uses the component's\n * render adapter to keep the component's DOM updated with the state.\n */\nvar MDCSwitchRenderFoundation = /** @class */ (function (_super) {\n __extends(MDCSwitchRenderFoundation, _super);\n function MDCSwitchRenderFoundation() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /**\n * Initializes the foundation and starts observing state changes.\n */\n MDCSwitchRenderFoundation.prototype.init = function () {\n _super.prototype.init.call(this);\n this.observe(this.adapter.state, {\n disabled: this.onDisabledChange,\n processing: this.onProcessingChange,\n selected: this.onSelectedChange,\n });\n };\n /**\n * Initializes the foundation from a server side rendered (SSR) component.\n * This will sync the adapter's state with the current state of the DOM.\n *\n * This method should be called after `init()`.\n */\n MDCSwitchRenderFoundation.prototype.initFromDOM = function () {\n // Turn off observers while setting state\n this.setObserversEnabled(this.adapter.state, false);\n this.adapter.state.selected = this.adapter.hasClass(CssClasses.SELECTED);\n // Ensure aria-checked is set if attribute is not present\n this.onSelectedChange();\n this.adapter.state.disabled = this.adapter.isDisabled();\n this.adapter.state.processing =\n this.adapter.hasClass(CssClasses.PROCESSING);\n // Re-observe state\n this.setObserversEnabled(this.adapter.state, true);\n this.stopProcessingIfDisabled();\n };\n MDCSwitchRenderFoundation.prototype.onDisabledChange = function () {\n this.adapter.setDisabled(this.adapter.state.disabled);\n };\n MDCSwitchRenderFoundation.prototype.onProcessingChange = function () {\n this.toggleClass(this.adapter.state.processing, CssClasses.PROCESSING);\n };\n MDCSwitchRenderFoundation.prototype.onSelectedChange = function () {\n this.adapter.setAriaChecked(String(this.adapter.state.selected));\n this.toggleClass(this.adapter.state.selected, CssClasses.SELECTED);\n this.toggleClass(!this.adapter.state.selected, CssClasses.UNSELECTED);\n };\n MDCSwitchRenderFoundation.prototype.toggleClass = function (addClass, className) {\n if (addClass) {\n this.adapter.addClass(className);\n }\n else {\n this.adapter.removeClass(className);\n }\n };\n return MDCSwitchRenderFoundation;\n}(MDCSwitchFoundation));\nexport { MDCSwitchRenderFoundation };\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\nimport '@material/mwc-ripple/mwc-ripple.js';\nimport { ariaProperty } from '@material/mwc-base/aria-property.js';\nimport { FormElement } from '@material/mwc-base/form-element.js';\nimport { RippleHandlers } from '@material/mwc-ripple/ripple-handlers.js';\nimport { MDCSwitchFoundation } from '@material/switch/foundation.js';\nimport { html } from 'lit';\nimport { eventOptions, property, query, queryAsync, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nexport class SwitchBase extends FormElement {\n constructor() {\n super(...arguments);\n // MDCSwitchState\n this.processing = false;\n this.selected = false;\n // Aria\n /** @soyPrefixAttribute */\n this.ariaLabel = '';\n /** @soyPrefixAttribute */\n this.ariaLabelledBy = '';\n this.shouldRenderRipple = false;\n this.rippleHandlers = new RippleHandlers(() => {\n this.shouldRenderRipple = true;\n return this.ripple;\n });\n // FormElement\n this.name = '';\n this.value = 'on';\n this.mdcFoundationClass = MDCSwitchFoundation;\n }\n setFormData(formData) {\n if (this.name && this.selected) {\n formData.append(this.name, this.value);\n }\n }\n click() {\n var _a, _b;\n // Switch uses a hidden input as its form element, but a different \n\n \n `;\n }\n /** @soyTemplate */\n getRenderClasses() {\n return {\n 'mdc-switch--processing': this.processing,\n 'mdc-switch--selected': this.selected,\n 'mdc-switch--unselected': !this.selected,\n };\n }\n /** @soyTemplate */\n renderHandle() {\n return html `\n
\n ${this.renderShadow()}\n ${this.renderRipple()}\n
\n ${this.renderOnIcon()}\n ${this.renderOffIcon()}\n
\n
\n `;\n }\n /** @soyTemplate */\n renderShadow() {\n return html `\n
\n
\n
\n `;\n }\n /** @soyTemplate */\n renderRipple() {\n if (this.shouldRenderRipple) {\n return html `\n
\n \n \n
\n `;\n }\n else {\n return html ``;\n }\n }\n /** @soyTemplate */\n renderOnIcon() {\n return html `\n \n \n \n `;\n }\n /** @soyTemplate */\n renderOffIcon() {\n return html `\n \n \n \n `;\n }\n handleClick() {\n var _a;\n (_a = this.mdcFoundation) === null || _a === void 0 ? void 0 : _a.handleClick();\n }\n handleFocus() {\n this.rippleHandlers.startFocus();\n }\n handleBlur() {\n this.rippleHandlers.endFocus();\n }\n handlePointerDown(event) {\n event.target.setPointerCapture(event.pointerId);\n this.rippleHandlers.startPress(event);\n }\n handlePointerUp() {\n this.rippleHandlers.endPress();\n }\n handlePointerEnter() {\n this.rippleHandlers.startHover();\n }\n handlePointerLeave() {\n this.rippleHandlers.endHover();\n }\n createAdapter() {\n return { state: this };\n }\n}\n__decorate([\n property({ type: Boolean })\n], SwitchBase.prototype, \"processing\", void 0);\n__decorate([\n property({ type: Boolean })\n], SwitchBase.prototype, \"selected\", void 0);\n__decorate([\n ariaProperty,\n property({ type: String, attribute: 'aria-label' })\n], SwitchBase.prototype, \"ariaLabel\", void 0);\n__decorate([\n ariaProperty,\n property({ type: String, attribute: 'aria-labelledby' })\n], SwitchBase.prototype, \"ariaLabelledBy\", void 0);\n__decorate([\n queryAsync('mwc-ripple')\n], SwitchBase.prototype, \"ripple\", void 0);\n__decorate([\n state()\n], SwitchBase.prototype, \"shouldRenderRipple\", void 0);\n__decorate([\n property({ type: String, reflect: true })\n], SwitchBase.prototype, \"name\", void 0);\n__decorate([\n property({ type: String })\n], SwitchBase.prototype, \"value\", void 0);\n__decorate([\n query('input')\n], SwitchBase.prototype, \"formElement\", void 0);\n__decorate([\n query('.mdc-switch')\n], SwitchBase.prototype, \"mdcRoot\", void 0);\n__decorate([\n eventOptions({ passive: true })\n], SwitchBase.prototype, \"handlePointerDown\", null);\n//# sourceMappingURL=mwc-switch-base.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-LIcense-Identifier: Apache-2.0\n */\nimport { css } from 'lit';\nexport const styles = css `.mdc-elevation-overlay{position:absolute;border-radius:inherit;pointer-events:none;opacity:0;opacity:var(--mdc-elevation-overlay-opacity, 0);transition:opacity 280ms cubic-bezier(0.4, 0, 0.2, 1);background-color:#fff;background-color:var(--mdc-elevation-overlay-color, #fff)}.mdc-switch{align-items:center;background:none;border:none;cursor:pointer;display:inline-flex;flex-shrink:0;margin:0;outline:none;overflow:visible;padding:0;position:relative}.mdc-switch:disabled{cursor:default;pointer-events:none}.mdc-switch__track{overflow:hidden;position:relative;width:100%}.mdc-switch__track::before,.mdc-switch__track::after{border:1px solid transparent;border-radius:inherit;box-sizing:border-box;content:\"\";height:100%;left:0;position:absolute;width:100%}@media screen and (forced-colors: active){.mdc-switch__track::before,.mdc-switch__track::after{border-color:currentColor}}.mdc-switch__track::before{transition:transform 75ms 0ms cubic-bezier(0, 0, 0.2, 1);transform:translateX(0)}.mdc-switch__track::after{transition:transform 75ms 0ms cubic-bezier(0.4, 0, 0.6, 1);transform:translateX(-100%)}[dir=rtl] .mdc-switch__track::after,.mdc-switch__track[dir=rtl]::after{transform:translateX(100%)}.mdc-switch--selected .mdc-switch__track::before{transition:transform 75ms 0ms cubic-bezier(0.4, 0, 0.6, 1);transform:translateX(100%)}[dir=rtl] .mdc-switch--selected .mdc-switch__track::before,.mdc-switch--selected .mdc-switch__track[dir=rtl]::before{transform:translateX(-100%)}.mdc-switch--selected .mdc-switch__track::after{transition:transform 75ms 0ms cubic-bezier(0, 0, 0.2, 1);transform:translateX(0)}.mdc-switch__handle-track{height:100%;pointer-events:none;position:absolute;top:0;transition:transform 75ms 0ms cubic-bezier(0.4, 0, 0.2, 1);left:0;right:auto;transform:translateX(0)}[dir=rtl] .mdc-switch__handle-track,.mdc-switch__handle-track[dir=rtl]{left:auto;right:0}.mdc-switch--selected .mdc-switch__handle-track{transform:translateX(100%)}[dir=rtl] .mdc-switch--selected .mdc-switch__handle-track,.mdc-switch--selected .mdc-switch__handle-track[dir=rtl]{transform:translateX(-100%)}.mdc-switch__handle{display:flex;pointer-events:auto;position:absolute;top:50%;transform:translateY(-50%);left:0;right:auto}[dir=rtl] .mdc-switch__handle,.mdc-switch__handle[dir=rtl]{left:auto;right:0}.mdc-switch__handle::before,.mdc-switch__handle::after{border:1px solid transparent;border-radius:inherit;box-sizing:border-box;content:\"\";width:100%;height:100%;left:0;position:absolute;top:0;transition:background-color 75ms 0ms cubic-bezier(0.4, 0, 0.2, 1),border-color 75ms 0ms cubic-bezier(0.4, 0, 0.2, 1);z-index:-1}@media screen and (forced-colors: active){.mdc-switch__handle::before,.mdc-switch__handle::after{border-color:currentColor}}.mdc-switch__shadow{border-radius:inherit;bottom:0;left:0;position:absolute;right:0;top:0}.mdc-elevation-overlay{bottom:0;left:0;right:0;top:0}.mdc-switch__ripple{left:50%;position:absolute;top:50%;transform:translate(-50%, -50%);z-index:-1}.mdc-switch:disabled .mdc-switch__ripple{display:none}.mdc-switch__icons{height:100%;position:relative;width:100%;z-index:1}.mdc-switch__icon{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0;opacity:0;transition:opacity 30ms 0ms cubic-bezier(0.4, 0, 1, 1)}.mdc-switch--selected .mdc-switch__icon--on,.mdc-switch--unselected .mdc-switch__icon--off{opacity:1;transition:opacity 45ms 30ms cubic-bezier(0, 0, 0.2, 1)}:host{display:inline-flex;outline:none}input{display:none}.mdc-switch{width:36px;width:var(--mdc-switch-track-width, 36px)}.mdc-switch.mdc-switch--selected:enabled .mdc-switch__handle::after{background:#6200ee;background:var(--mdc-switch-selected-handle-color, var(--mdc-theme-primary, #6200ee))}.mdc-switch.mdc-switch--selected:enabled:hover:not(:focus):not(:active) .mdc-switch__handle::after{background:#310077;background:var(--mdc-switch-selected-hover-handle-color, #310077)}.mdc-switch.mdc-switch--selected:enabled:focus:not(:active) .mdc-switch__handle::after{background:#310077;background:var(--mdc-switch-selected-focus-handle-color, #310077)}.mdc-switch.mdc-switch--selected:enabled:active .mdc-switch__handle::after{background:#310077;background:var(--mdc-switch-selected-pressed-handle-color, #310077)}.mdc-switch.mdc-switch--selected:disabled .mdc-switch__handle::after{background:#424242;background:var(--mdc-switch-disabled-selected-handle-color, #424242)}.mdc-switch.mdc-switch--unselected:enabled .mdc-switch__handle::after{background:#616161;background:var(--mdc-switch-unselected-handle-color, #616161)}.mdc-switch.mdc-switch--unselected:enabled:hover:not(:focus):not(:active) .mdc-switch__handle::after{background:#212121;background:var(--mdc-switch-unselected-hover-handle-color, #212121)}.mdc-switch.mdc-switch--unselected:enabled:focus:not(:active) .mdc-switch__handle::after{background:#212121;background:var(--mdc-switch-unselected-focus-handle-color, #212121)}.mdc-switch.mdc-switch--unselected:enabled:active .mdc-switch__handle::after{background:#212121;background:var(--mdc-switch-unselected-pressed-handle-color, #212121)}.mdc-switch.mdc-switch--unselected:disabled .mdc-switch__handle::after{background:#424242;background:var(--mdc-switch-disabled-unselected-handle-color, #424242)}.mdc-switch .mdc-switch__handle::before{background:#fff;background:var(--mdc-switch-handle-surface-color, var(--mdc-theme-surface, #fff))}.mdc-switch:enabled .mdc-switch__shadow{--mdc-elevation-box-shadow-for-gss:0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0, 0, 0, 0.12);box-shadow:0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-switch-handle-elevation, var(--mdc-elevation-box-shadow-for-gss))}.mdc-switch:disabled .mdc-switch__shadow{--mdc-elevation-box-shadow-for-gss:0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12);box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-switch-disabled-handle-elevation, var(--mdc-elevation-box-shadow-for-gss))}.mdc-switch .mdc-switch__focus-ring-wrapper,.mdc-switch .mdc-switch__handle{height:20px;height:var(--mdc-switch-handle-height, 20px)}.mdc-switch:disabled .mdc-switch__handle::after{opacity:0.38;opacity:var(--mdc-switch-disabled-handle-opacity, 0.38)}.mdc-switch .mdc-switch__handle{border-radius:10px;border-radius:var(--mdc-switch-handle-shape, 10px)}.mdc-switch .mdc-switch__handle{width:20px;width:var(--mdc-switch-handle-width, 20px)}.mdc-switch .mdc-switch__handle-track{width:calc(100% - 20px);width:calc(100% - var(--mdc-switch-handle-width, 20px))}.mdc-switch.mdc-switch--selected:enabled .mdc-switch__icon{fill:#fff;fill:var(--mdc-switch-selected-icon-color, var(--mdc-theme-on-primary, #fff))}.mdc-switch.mdc-switch--selected:disabled .mdc-switch__icon{fill:#fff;fill:var(--mdc-switch-disabled-selected-icon-color, var(--mdc-theme-on-primary, #fff))}.mdc-switch.mdc-switch--unselected:enabled .mdc-switch__icon{fill:#fff;fill:var(--mdc-switch-unselected-icon-color, var(--mdc-theme-on-primary, #fff))}.mdc-switch.mdc-switch--unselected:disabled .mdc-switch__icon{fill:#fff;fill:var(--mdc-switch-disabled-unselected-icon-color, var(--mdc-theme-on-primary, #fff))}.mdc-switch.mdc-switch--selected:disabled .mdc-switch__icons{opacity:0.38;opacity:var(--mdc-switch-disabled-selected-icon-opacity, 0.38)}.mdc-switch.mdc-switch--unselected:disabled .mdc-switch__icons{opacity:0.38;opacity:var(--mdc-switch-disabled-unselected-icon-opacity, 0.38)}.mdc-switch.mdc-switch--selected .mdc-switch__icon{width:18px;width:var(--mdc-switch-selected-icon-size, 18px);height:18px;height:var(--mdc-switch-selected-icon-size, 18px)}.mdc-switch.mdc-switch--unselected .mdc-switch__icon{width:18px;width:var(--mdc-switch-unselected-icon-size, 18px);height:18px;height:var(--mdc-switch-unselected-icon-size, 18px)}.mdc-switch .mdc-switch__ripple{height:48px;height:var(--mdc-switch-state-layer-size, 48px);width:48px;width:var(--mdc-switch-state-layer-size, 48px)}.mdc-switch .mdc-switch__track{height:14px;height:var(--mdc-switch-track-height, 14px)}.mdc-switch:disabled .mdc-switch__track{opacity:0.12;opacity:var(--mdc-switch-disabled-track-opacity, 0.12)}.mdc-switch:enabled .mdc-switch__track::after{background:#d7bbff;background:var(--mdc-switch-selected-track-color, #d7bbff)}.mdc-switch:enabled:hover:not(:focus):not(:active) .mdc-switch__track::after{background:#d7bbff;background:var(--mdc-switch-selected-hover-track-color, #d7bbff)}.mdc-switch:enabled:focus:not(:active) .mdc-switch__track::after{background:#d7bbff;background:var(--mdc-switch-selected-focus-track-color, #d7bbff)}.mdc-switch:enabled:active .mdc-switch__track::after{background:#d7bbff;background:var(--mdc-switch-selected-pressed-track-color, #d7bbff)}.mdc-switch:disabled .mdc-switch__track::after{background:#424242;background:var(--mdc-switch-disabled-selected-track-color, #424242)}.mdc-switch:enabled .mdc-switch__track::before{background:#e0e0e0;background:var(--mdc-switch-unselected-track-color, #e0e0e0)}.mdc-switch:enabled:hover:not(:focus):not(:active) .mdc-switch__track::before{background:#e0e0e0;background:var(--mdc-switch-unselected-hover-track-color, #e0e0e0)}.mdc-switch:enabled:focus:not(:active) .mdc-switch__track::before{background:#e0e0e0;background:var(--mdc-switch-unselected-focus-track-color, #e0e0e0)}.mdc-switch:enabled:active .mdc-switch__track::before{background:#e0e0e0;background:var(--mdc-switch-unselected-pressed-track-color, #e0e0e0)}.mdc-switch:disabled .mdc-switch__track::before{background:#424242;background:var(--mdc-switch-disabled-unselected-track-color, #424242)}.mdc-switch .mdc-switch__track{border-radius:7px;border-radius:var(--mdc-switch-track-shape, 7px)}.mdc-switch.mdc-switch--selected{--mdc-ripple-focus-state-layer-color:var(--mdc-switch-selected-focus-state-layer-color, var(--mdc-theme-primary, #6200ee));--mdc-ripple-focus-state-layer-opacity:var(--mdc-switch-selected-focus-state-layer-opacity, 0.12);--mdc-ripple-hover-state-layer-color:var(--mdc-switch-selected-hover-state-layer-color, var(--mdc-theme-primary, #6200ee));--mdc-ripple-hover-state-layer-opacity:var(--mdc-switch-selected-hover-state-layer-opacity, 0.04);--mdc-ripple-pressed-state-layer-color:var(--mdc-switch-selected-pressed-state-layer-color, var(--mdc-theme-primary, #6200ee));--mdc-ripple-pressed-state-layer-opacity:var(--mdc-switch-selected-pressed-state-layer-opacity, 0.1)}.mdc-switch.mdc-switch--selected:enabled:focus:not(:active){--mdc-ripple-hover-state-layer-color:var(--mdc-switch-selected-focus-state-layer-color, var(--mdc-theme-primary, #6200ee))}.mdc-switch.mdc-switch--selected:enabled:active{--mdc-ripple-hover-state-layer-color:var(--mdc-switch-selected-pressed-state-layer-color, var(--mdc-theme-primary, #6200ee))}.mdc-switch.mdc-switch--unselected{--mdc-ripple-focus-state-layer-color:var(--mdc-switch-unselected-focus-state-layer-color, #424242);--mdc-ripple-focus-state-layer-opacity:var(--mdc-switch-unselected-focus-state-layer-opacity, 0.12);--mdc-ripple-hover-state-layer-color:var(--mdc-switch-unselected-hover-state-layer-color, #424242);--mdc-ripple-hover-state-layer-opacity:var(--mdc-switch-unselected-hover-state-layer-opacity, 0.04);--mdc-ripple-pressed-state-layer-color:var(--mdc-switch-unselected-pressed-state-layer-color, #424242);--mdc-ripple-pressed-state-layer-opacity:var(--mdc-switch-unselected-pressed-state-layer-opacity, 0.1)}.mdc-switch.mdc-switch--unselected:enabled:focus:not(:active){--mdc-ripple-hover-state-layer-color:var(--mdc-switch-unselected-focus-state-layer-color, #424242)}.mdc-switch.mdc-switch--unselected:enabled:active{--mdc-ripple-hover-state-layer-color:var(--mdc-switch-unselected-pressed-state-layer-color, #424242)}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-switch:disabled .mdc-switch__handle::after{opacity:1;opacity:var(--mdc-switch-disabled-handle-opacity, 1)}.mdc-switch.mdc-switch--selected:enabled .mdc-switch__icon{fill:ButtonText;fill:var(--mdc-switch-selected-icon-color, ButtonText)}.mdc-switch.mdc-switch--selected:disabled .mdc-switch__icon{fill:GrayText;fill:var(--mdc-switch-disabled-selected-icon-color, GrayText)}.mdc-switch.mdc-switch--unselected:enabled .mdc-switch__icon{fill:ButtonText;fill:var(--mdc-switch-unselected-icon-color, ButtonText)}.mdc-switch.mdc-switch--unselected:disabled .mdc-switch__icon{fill:GrayText;fill:var(--mdc-switch-disabled-unselected-icon-color, GrayText)}.mdc-switch.mdc-switch--selected:disabled .mdc-switch__icons{opacity:1;opacity:var(--mdc-switch-disabled-selected-icon-opacity, 1)}.mdc-switch.mdc-switch--unselected:disabled .mdc-switch__icons{opacity:1;opacity:var(--mdc-switch-disabled-unselected-icon-opacity, 1)}.mdc-switch:disabled .mdc-switch__track{opacity:1;opacity:var(--mdc-switch-disabled-track-opacity, 1)}}`;\n//# sourceMappingURL=styles.css.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\nimport { customElement } from 'lit/decorators.js';\nimport { SwitchBase } from './mwc-switch-base.js';\nimport { styles } from './styles.css.js';\n/** @soyCompatible */\nlet Switch = class Switch extends SwitchBase {\n};\nSwitch.styles = [styles];\nSwitch = __decorate([\n customElement('mwc-switch')\n], Switch);\nexport { Switch };\n//# sourceMappingURL=mwc-switch.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar strings = {\n NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch',\n};\nvar numbers = {\n // This should stay in sync with $mdc-notched-outline-padding * 2.\n NOTCH_ELEMENT_PADDING: 8,\n};\nvar cssClasses = {\n NO_LABEL: 'mdc-notched-outline--no-label',\n OUTLINE_NOTCHED: 'mdc-notched-outline--notched',\n OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded',\n};\nexport { cssClasses, numbers, strings };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2017 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses, numbers, strings } from './constants';\nvar MDCNotchedOutlineFoundation = /** @class */ (function (_super) {\n __extends(MDCNotchedOutlineFoundation, _super);\n function MDCNotchedOutlineFoundation(adapter) {\n return _super.call(this, __assign(__assign({}, MDCNotchedOutlineFoundation.defaultAdapter), adapter)) || this;\n }\n Object.defineProperty(MDCNotchedOutlineFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCNotchedOutlineFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCNotchedOutlineFoundation, \"numbers\", {\n get: function () {\n return numbers;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCNotchedOutlineFoundation, \"defaultAdapter\", {\n /**\n * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types.\n */\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n addClass: function () { return undefined; },\n removeClass: function () { return undefined; },\n setNotchWidthProperty: function () { return undefined; },\n removeNotchWidthProperty: function () { return undefined; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Adds the outline notched selector and updates the notch width calculated based off of notchWidth.\n */\n MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) {\n var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;\n if (notchWidth > 0) {\n notchWidth += numbers.NOTCH_ELEMENT_PADDING; // Add padding from left/right.\n }\n this.adapter.setNotchWidthProperty(notchWidth);\n this.adapter.addClass(OUTLINE_NOTCHED);\n };\n /**\n * Removes notched outline selector to close the notch in the outline.\n */\n MDCNotchedOutlineFoundation.prototype.closeNotch = function () {\n var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;\n this.adapter.removeClass(OUTLINE_NOTCHED);\n this.adapter.removeNotchWidthProperty();\n };\n return MDCNotchedOutlineFoundation;\n}(MDCFoundation));\nexport { MDCNotchedOutlineFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCNotchedOutlineFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { BaseElement } from '@material/mwc-base/base-element.js';\nimport { MDCNotchedOutlineFoundation } from '@material/notched-outline/foundation.js';\nimport { html } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nexport class NotchedOutlineBase extends BaseElement {\n constructor() {\n super(...arguments);\n this.mdcFoundationClass = MDCNotchedOutlineFoundation;\n this.width = 0;\n this.open = false;\n this.lastOpen = this.open;\n }\n createAdapter() {\n return {\n addClass: (className) => this.mdcRoot.classList.add(className),\n removeClass: (className) => this.mdcRoot.classList.remove(className),\n setNotchWidthProperty: (width) => this.notchElement.style.setProperty('width', `${width}px`),\n removeNotchWidthProperty: () => this.notchElement.style.removeProperty('width'),\n };\n }\n openOrClose(shouldOpen, width) {\n if (!this.mdcFoundation) {\n return;\n }\n if (shouldOpen && width !== undefined) {\n this.mdcFoundation.notch(width);\n }\n else {\n this.mdcFoundation.closeNotch();\n }\n }\n render() {\n this.openOrClose(this.open, this.width);\n const classes = classMap({\n 'mdc-notched-outline--notched': this.open,\n });\n return html `\n \n \n \n \n \n \n `;\n }\n}\n__decorate([\n query('.mdc-notched-outline')\n], NotchedOutlineBase.prototype, \"mdcRoot\", void 0);\n__decorate([\n property({ type: Number })\n], NotchedOutlineBase.prototype, \"width\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true })\n], NotchedOutlineBase.prototype, \"open\", void 0);\n__decorate([\n query('.mdc-notched-outline__notch')\n], NotchedOutlineBase.prototype, \"notchElement\", void 0);\n//# sourceMappingURL=mwc-notched-outline-base.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-LIcense-Identifier: Apache-2.0\n */\nimport { css } from 'lit';\nexport const styles = css `.mdc-notched-outline{display:flex;position:absolute;top:0;right:0;left:0;box-sizing:border-box;width:100%;max-width:100%;height:100%;text-align:left;pointer-events:none}[dir=rtl] .mdc-notched-outline,.mdc-notched-outline[dir=rtl]{text-align:right}.mdc-notched-outline__leading,.mdc-notched-outline__notch,.mdc-notched-outline__trailing{box-sizing:border-box;height:100%;border-top:1px solid;border-bottom:1px solid;pointer-events:none}.mdc-notched-outline__leading{border-left:1px solid;border-right:none;width:12px}[dir=rtl] .mdc-notched-outline__leading,.mdc-notched-outline__leading[dir=rtl]{border-left:none;border-right:1px solid}.mdc-notched-outline__trailing{border-left:none;border-right:1px solid;flex-grow:1}[dir=rtl] .mdc-notched-outline__trailing,.mdc-notched-outline__trailing[dir=rtl]{border-left:1px solid;border-right:none}.mdc-notched-outline__notch{flex:0 0 auto;width:auto;max-width:calc(100% - 12px * 2)}.mdc-notched-outline .mdc-floating-label{display:inline-block;position:relative;max-width:100%}.mdc-notched-outline .mdc-floating-label--float-above{text-overflow:clip}.mdc-notched-outline--upgraded .mdc-floating-label--float-above{max-width:calc(100% / 0.75)}.mdc-notched-outline--notched .mdc-notched-outline__notch{padding-left:0;padding-right:8px;border-top:none}[dir=rtl] .mdc-notched-outline--notched .mdc-notched-outline__notch,.mdc-notched-outline--notched .mdc-notched-outline__notch[dir=rtl]{padding-left:8px;padding-right:0}.mdc-notched-outline--no-label .mdc-notched-outline__notch{display:none}:host{display:block;position:absolute;right:0;left:0;box-sizing:border-box;width:100%;max-width:100%;height:100%;text-align:left;pointer-events:none}[dir=rtl] :host,:host([dir=rtl]){text-align:right}::slotted(.mdc-floating-label){display:inline-block;position:relative;top:17px;bottom:auto;max-width:100%}::slotted(.mdc-floating-label--float-above){text-overflow:clip}.mdc-notched-outline--upgraded ::slotted(.mdc-floating-label--float-above){max-width:calc(100% / 0.75)}.mdc-notched-outline .mdc-notched-outline__leading{border-top-left-radius:4px;border-top-left-radius:var(--mdc-shape-small, 4px);border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:4px;border-bottom-left-radius:var(--mdc-shape-small, 4px)}[dir=rtl] .mdc-notched-outline .mdc-notched-outline__leading,.mdc-notched-outline .mdc-notched-outline__leading[dir=rtl]{border-top-left-radius:0;border-top-right-radius:4px;border-top-right-radius:var(--mdc-shape-small, 4px);border-bottom-right-radius:4px;border-bottom-right-radius:var(--mdc-shape-small, 4px);border-bottom-left-radius:0}@supports(top: max(0%)){.mdc-notched-outline .mdc-notched-outline__leading{width:max(12px, var(--mdc-shape-small, 4px))}}@supports(top: max(0%)){.mdc-notched-outline .mdc-notched-outline__notch{max-width:calc(100% - max(12px, var(--mdc-shape-small, 4px)) * 2)}}.mdc-notched-outline .mdc-notched-outline__trailing{border-top-left-radius:0;border-top-right-radius:4px;border-top-right-radius:var(--mdc-shape-small, 4px);border-bottom-right-radius:4px;border-bottom-right-radius:var(--mdc-shape-small, 4px);border-bottom-left-radius:0}[dir=rtl] .mdc-notched-outline .mdc-notched-outline__trailing,.mdc-notched-outline .mdc-notched-outline__trailing[dir=rtl]{border-top-left-radius:4px;border-top-left-radius:var(--mdc-shape-small, 4px);border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:4px;border-bottom-left-radius:var(--mdc-shape-small, 4px)}.mdc-notched-outline__leading,.mdc-notched-outline__notch,.mdc-notched-outline__trailing{border-color:var(--mdc-notched-outline-border-color, var(--mdc-theme-primary, #6200ee));border-width:1px;border-width:var(--mdc-notched-outline-stroke-width, 1px)}.mdc-notched-outline--notched .mdc-notched-outline__notch{padding-top:0;padding-top:var(--mdc-notched-outline-notch-offset, 0)}`;\n//# sourceMappingURL=mwc-notched-outline.css.js.map","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { customElement } from 'lit/decorators.js';\nimport { NotchedOutlineBase } from './mwc-notched-outline-base.js';\nimport { styles } from './mwc-notched-outline.css.js';\nlet NotchedOutline = class NotchedOutline extends NotchedOutlineBase {\n};\nNotchedOutline.styles = [styles];\nNotchedOutline = __decorate([\n customElement('mwc-notched-outline')\n], NotchedOutline);\nexport { NotchedOutline };\n//# sourceMappingURL=mwc-notched-outline.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nexport var cssClasses = {\n LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above',\n LABEL_REQUIRED: 'mdc-floating-label--required',\n LABEL_SHAKE: 'mdc-floating-label--shake',\n ROOT: 'mdc-floating-label',\n};\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses } from './constants';\nvar MDCFloatingLabelFoundation = /** @class */ (function (_super) {\n __extends(MDCFloatingLabelFoundation, _super);\n function MDCFloatingLabelFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this;\n _this.shakeAnimationEndHandler = function () {\n _this.handleShakeAnimationEnd();\n };\n return _this;\n }\n Object.defineProperty(MDCFloatingLabelFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCFloatingLabelFoundation, \"defaultAdapter\", {\n /**\n * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types.\n */\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n addClass: function () { return undefined; },\n removeClass: function () { return undefined; },\n getWidth: function () { return 0; },\n registerInteractionHandler: function () { return undefined; },\n deregisterInteractionHandler: function () { return undefined; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n MDCFloatingLabelFoundation.prototype.init = function () {\n this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler);\n };\n MDCFloatingLabelFoundation.prototype.destroy = function () {\n this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler);\n };\n /**\n * Returns the width of the label element.\n */\n MDCFloatingLabelFoundation.prototype.getWidth = function () {\n return this.adapter.getWidth();\n };\n /**\n * Styles the label to produce a shake animation to indicate an error.\n * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class.\n */\n MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) {\n var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;\n if (shouldShake) {\n this.adapter.addClass(LABEL_SHAKE);\n }\n else {\n this.adapter.removeClass(LABEL_SHAKE);\n }\n };\n /**\n * Styles the label to float or dock.\n * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label.\n */\n MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) {\n var _a = MDCFloatingLabelFoundation.cssClasses, LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE, LABEL_SHAKE = _a.LABEL_SHAKE;\n if (shouldFloat) {\n this.adapter.addClass(LABEL_FLOAT_ABOVE);\n }\n else {\n this.adapter.removeClass(LABEL_FLOAT_ABOVE);\n this.adapter.removeClass(LABEL_SHAKE);\n }\n };\n /**\n * Styles the label as required.\n * @param isRequired If true, adds an asterisk to the label, indicating that it is required.\n */\n MDCFloatingLabelFoundation.prototype.setRequired = function (isRequired) {\n var LABEL_REQUIRED = MDCFloatingLabelFoundation.cssClasses.LABEL_REQUIRED;\n if (isRequired) {\n this.adapter.addClass(LABEL_REQUIRED);\n }\n else {\n this.adapter.removeClass(LABEL_REQUIRED);\n }\n };\n MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd = function () {\n var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;\n this.adapter.removeClass(LABEL_SHAKE);\n };\n return MDCFloatingLabelFoundation;\n}(MDCFoundation));\nexport { MDCFloatingLabelFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCFloatingLabelFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { MDCFloatingLabelFoundation } from '@material/floating-label/foundation.js';\nimport { directive, Directive, PartType } from 'lit/directive.js';\nconst createAdapter = (labelElement) => {\n return {\n addClass: (className) => labelElement.classList.add(className),\n removeClass: (className) => labelElement.classList.remove(className),\n getWidth: () => labelElement.scrollWidth,\n registerInteractionHandler: (evtType, handler) => {\n labelElement.addEventListener(evtType, handler);\n },\n deregisterInteractionHandler: (evtType, handler) => {\n labelElement.removeEventListener(evtType, handler);\n },\n };\n};\nclass FloatingLabelDirective extends Directive {\n constructor(partInfo) {\n super(partInfo);\n this.foundation = null;\n this.previousPart = null;\n switch (partInfo.type) {\n // Only allow Attribute and Part bindings\n case PartType.ATTRIBUTE:\n case PartType.PROPERTY:\n break;\n default:\n throw new Error('FloatingLabel directive only support attribute and property parts');\n }\n }\n /**\n * There is no PropertyPart in Lit 2 so far. For more info see:\n * https://github.com/lit/lit/issues/1863\n */\n update(part, [label]) {\n if (part !== this.previousPart) {\n if (this.foundation) {\n this.foundation.destroy();\n }\n this.previousPart = part;\n const labelElement = part.element;\n labelElement.classList.add('mdc-floating-label');\n const adapter = createAdapter(labelElement);\n this.foundation = new MDCFloatingLabelFoundation(adapter);\n this.foundation.init();\n }\n return this.render(label);\n }\n render(_label) {\n return this.foundation;\n }\n}\nexport const floatingLabel = directive(FloatingLabelDirective);\n//# sourceMappingURL=mwc-floating-label-directive.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar cssClasses = {\n LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active',\n LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating',\n};\nexport { cssClasses };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2018 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { cssClasses } from './constants';\nvar MDCLineRippleFoundation = /** @class */ (function (_super) {\n __extends(MDCLineRippleFoundation, _super);\n function MDCLineRippleFoundation(adapter) {\n var _this = _super.call(this, __assign(__assign({}, MDCLineRippleFoundation.defaultAdapter), adapter)) || this;\n _this.transitionEndHandler = function (evt) {\n _this.handleTransitionEnd(evt);\n };\n return _this;\n }\n Object.defineProperty(MDCLineRippleFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCLineRippleFoundation, \"defaultAdapter\", {\n /**\n * See {@link MDCLineRippleAdapter} for typing information on parameters and return types.\n */\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n addClass: function () { return undefined; },\n removeClass: function () { return undefined; },\n hasClass: function () { return false; },\n setStyle: function () { return undefined; },\n registerEventHandler: function () { return undefined; },\n deregisterEventHandler: function () { return undefined; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n MDCLineRippleFoundation.prototype.init = function () {\n this.adapter.registerEventHandler('transitionend', this.transitionEndHandler);\n };\n MDCLineRippleFoundation.prototype.destroy = function () {\n this.adapter.deregisterEventHandler('transitionend', this.transitionEndHandler);\n };\n MDCLineRippleFoundation.prototype.activate = function () {\n this.adapter.removeClass(cssClasses.LINE_RIPPLE_DEACTIVATING);\n this.adapter.addClass(cssClasses.LINE_RIPPLE_ACTIVE);\n };\n MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) {\n this.adapter.setStyle('transform-origin', xCoordinate + \"px center\");\n };\n MDCLineRippleFoundation.prototype.deactivate = function () {\n this.adapter.addClass(cssClasses.LINE_RIPPLE_DEACTIVATING);\n };\n MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) {\n // Wait for the line ripple to be either transparent or opaque\n // before emitting the animation end event\n var isDeactivating = this.adapter.hasClass(cssClasses.LINE_RIPPLE_DEACTIVATING);\n if (evt.propertyName === 'opacity') {\n if (isDeactivating) {\n this.adapter.removeClass(cssClasses.LINE_RIPPLE_ACTIVE);\n this.adapter.removeClass(cssClasses.LINE_RIPPLE_DEACTIVATING);\n }\n }\n };\n return MDCLineRippleFoundation;\n}(MDCFoundation));\nexport { MDCLineRippleFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCLineRippleFoundation;\n//# sourceMappingURL=foundation.js.map","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { MDCLineRippleFoundation } from '@material/line-ripple/foundation.js';\nimport { directive, Directive, PartType } from 'lit/directive.js';\nconst createAdapter = (lineElement) => {\n return {\n addClass: (className) => lineElement.classList.add(className),\n removeClass: (className) => lineElement.classList.remove(className),\n hasClass: (className) => lineElement.classList.contains(className),\n setStyle: (propertyName, value) => lineElement.style.setProperty(propertyName, value),\n registerEventHandler: (evtType, handler) => {\n lineElement.addEventListener(evtType, handler);\n },\n deregisterEventHandler: (evtType, handler) => {\n lineElement.removeEventListener(evtType, handler);\n },\n };\n};\nexport class LineRippleDirective extends Directive {\n constructor(partInfo) {\n super(partInfo);\n this.previousPart = null;\n this.foundation = null;\n switch (partInfo.type) {\n case PartType.ATTRIBUTE:\n case PartType.PROPERTY:\n return;\n default:\n throw new Error('LineRipple only support attribute and property parts.');\n }\n }\n /**\n * There is no PropertyPart in Lit 2 so far. For more info see:\n * https://github.com/lit/lit/issues/1863\n */\n update(part, _params) {\n if (this.previousPart !== part) {\n if (this.foundation) {\n this.foundation.destroy();\n }\n this.previousPart = part;\n const lineElement = part.element;\n lineElement.classList.add('mdc-line-ripple');\n const adapter = createAdapter(lineElement);\n this.foundation = new MDCLineRippleFoundation(adapter);\n this.foundation.init();\n }\n return this.render();\n }\n render() {\n return this.foundation;\n }\n}\nexport const lineRipple = directive(LineRippleDirective);\n//# sourceMappingURL=mwc-line-ripple-directive.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar strings = {\n ARIA_CONTROLS: 'aria-controls',\n ARIA_DESCRIBEDBY: 'aria-describedby',\n INPUT_SELECTOR: '.mdc-text-field__input',\n LABEL_SELECTOR: '.mdc-floating-label',\n LEADING_ICON_SELECTOR: '.mdc-text-field__icon--leading',\n LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',\n OUTLINE_SELECTOR: '.mdc-notched-outline',\n PREFIX_SELECTOR: '.mdc-text-field__affix--prefix',\n SUFFIX_SELECTOR: '.mdc-text-field__affix--suffix',\n TRAILING_ICON_SELECTOR: '.mdc-text-field__icon--trailing'\n};\nvar cssClasses = {\n DISABLED: 'mdc-text-field--disabled',\n FOCUSED: 'mdc-text-field--focused',\n HELPER_LINE: 'mdc-text-field-helper-line',\n INVALID: 'mdc-text-field--invalid',\n LABEL_FLOATING: 'mdc-text-field--label-floating',\n NO_LABEL: 'mdc-text-field--no-label',\n OUTLINED: 'mdc-text-field--outlined',\n ROOT: 'mdc-text-field',\n TEXTAREA: 'mdc-text-field--textarea',\n WITH_LEADING_ICON: 'mdc-text-field--with-leading-icon',\n WITH_TRAILING_ICON: 'mdc-text-field--with-trailing-icon',\n WITH_INTERNAL_COUNTER: 'mdc-text-field--with-internal-counter',\n};\nvar numbers = {\n LABEL_SCALE: 0.75,\n};\n/**\n * Whitelist based off of\n * https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation\n * under the \"Validation-related attributes\" section.\n */\nvar VALIDATION_ATTR_WHITELIST = [\n 'pattern',\n 'min',\n 'max',\n 'required',\n 'step',\n 'minlength',\n 'maxlength',\n];\n/**\n * Label should always float for these types as they show some UI even if value\n * is empty.\n */\nvar ALWAYS_FLOAT_TYPES = [\n 'color',\n 'date',\n 'datetime-local',\n 'month',\n 'range',\n 'time',\n 'week',\n];\nexport { cssClasses, strings, numbers, VALIDATION_ATTR_WHITELIST, ALWAYS_FLOAT_TYPES };\n//# sourceMappingURL=constants.js.map","/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { __assign, __extends, __values } from \"tslib\";\nimport { MDCFoundation } from '@material/base/foundation';\nimport { ALWAYS_FLOAT_TYPES, cssClasses, numbers, strings, VALIDATION_ATTR_WHITELIST } from './constants';\nvar POINTERDOWN_EVENTS = ['mousedown', 'touchstart'];\nvar INTERACTION_EVENTS = ['click', 'keydown'];\nvar MDCTextFieldFoundation = /** @class */ (function (_super) {\n __extends(MDCTextFieldFoundation, _super);\n /**\n * @param adapter\n * @param foundationMap Map from subcomponent names to their subfoundations.\n */\n function MDCTextFieldFoundation(adapter, foundationMap) {\n if (foundationMap === void 0) { foundationMap = {}; }\n var _this = _super.call(this, __assign(__assign({}, MDCTextFieldFoundation.defaultAdapter), adapter)) || this;\n _this.isFocused = false;\n _this.receivedUserInput = false;\n _this.valid = true;\n _this.useNativeValidation = true;\n _this.validateOnValueChange = true;\n _this.helperText = foundationMap.helperText;\n _this.characterCounter = foundationMap.characterCounter;\n _this.leadingIcon = foundationMap.leadingIcon;\n _this.trailingIcon = foundationMap.trailingIcon;\n _this.inputFocusHandler = function () {\n _this.activateFocus();\n };\n _this.inputBlurHandler = function () {\n _this.deactivateFocus();\n };\n _this.inputInputHandler = function () {\n _this.handleInput();\n };\n _this.setPointerXOffset = function (evt) {\n _this.setTransformOrigin(evt);\n };\n _this.textFieldInteractionHandler = function () {\n _this.handleTextFieldInteraction();\n };\n _this.validationAttributeChangeHandler = function (attributesList) {\n _this.handleValidationAttributeChange(attributesList);\n };\n return _this;\n }\n Object.defineProperty(MDCTextFieldFoundation, \"cssClasses\", {\n get: function () {\n return cssClasses;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldFoundation, \"strings\", {\n get: function () {\n return strings;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldFoundation, \"numbers\", {\n get: function () {\n return numbers;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldFoundation.prototype, \"shouldAlwaysFloat\", {\n get: function () {\n var type = this.getNativeInput().type;\n return ALWAYS_FLOAT_TYPES.indexOf(type) >= 0;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldFoundation.prototype, \"shouldFloat\", {\n get: function () {\n return this.shouldAlwaysFloat || this.isFocused || !!this.getValue() ||\n this.isBadInput();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldFoundation.prototype, \"shouldShake\", {\n get: function () {\n return !this.isFocused && !this.isValid() && !!this.getValue();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MDCTextFieldFoundation, \"defaultAdapter\", {\n /**\n * See {@link MDCTextFieldAdapter} for typing information on parameters and\n * return types.\n */\n get: function () {\n // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.\n return {\n addClass: function () { return undefined; },\n removeClass: function () { return undefined; },\n hasClass: function () { return true; },\n setInputAttr: function () { return undefined; },\n removeInputAttr: function () { return undefined; },\n registerTextFieldInteractionHandler: function () { return undefined; },\n deregisterTextFieldInteractionHandler: function () { return undefined; },\n registerInputInteractionHandler: function () { return undefined; },\n deregisterInputInteractionHandler: function () { return undefined; },\n registerValidationAttributeChangeHandler: function () {\n return new MutationObserver(function () { return undefined; });\n },\n deregisterValidationAttributeChangeHandler: function () { return undefined; },\n getNativeInput: function () { return null; },\n isFocused: function () { return false; },\n activateLineRipple: function () { return undefined; },\n deactivateLineRipple: function () { return undefined; },\n setLineRippleTransformOrigin: function () { return undefined; },\n shakeLabel: function () { return undefined; },\n floatLabel: function () { return undefined; },\n setLabelRequired: function () { return undefined; },\n hasLabel: function () { return false; },\n getLabelWidth: function () { return 0; },\n hasOutline: function () { return false; },\n notchOutline: function () { return undefined; },\n closeOutline: function () { return undefined; },\n };\n // tslint:enable:object-literal-sort-keys\n },\n enumerable: false,\n configurable: true\n });\n MDCTextFieldFoundation.prototype.init = function () {\n var e_1, _a, e_2, _b;\n if (this.adapter.hasLabel() && this.getNativeInput().required) {\n this.adapter.setLabelRequired(true);\n }\n if (this.adapter.isFocused()) {\n this.inputFocusHandler();\n }\n else if (this.adapter.hasLabel() && this.shouldFloat) {\n this.notchOutline(true);\n this.adapter.floatLabel(true);\n this.styleFloating(true);\n }\n this.adapter.registerInputInteractionHandler('focus', this.inputFocusHandler);\n this.adapter.registerInputInteractionHandler('blur', this.inputBlurHandler);\n this.adapter.registerInputInteractionHandler('input', this.inputInputHandler);\n try {\n for (var POINTERDOWN_EVENTS_1 = __values(POINTERDOWN_EVENTS), POINTERDOWN_EVENTS_1_1 = POINTERDOWN_EVENTS_1.next(); !POINTERDOWN_EVENTS_1_1.done; POINTERDOWN_EVENTS_1_1 = POINTERDOWN_EVENTS_1.next()) {\n var evtType = POINTERDOWN_EVENTS_1_1.value;\n this.adapter.registerInputInteractionHandler(evtType, this.setPointerXOffset);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (POINTERDOWN_EVENTS_1_1 && !POINTERDOWN_EVENTS_1_1.done && (_a = POINTERDOWN_EVENTS_1.return)) _a.call(POINTERDOWN_EVENTS_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n try {\n for (var INTERACTION_EVENTS_1 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next(); !INTERACTION_EVENTS_1_1.done; INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next()) {\n var evtType = INTERACTION_EVENTS_1_1.value;\n this.adapter.registerTextFieldInteractionHandler(evtType, this.textFieldInteractionHandler);\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (INTERACTION_EVENTS_1_1 && !INTERACTION_EVENTS_1_1.done && (_b = INTERACTION_EVENTS_1.return)) _b.call(INTERACTION_EVENTS_1);\n }\n finally { if (e_2) throw e_2.error; }\n }\n this.validationObserver =\n this.adapter.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler);\n this.setcharacterCounter(this.getValue().length);\n };\n MDCTextFieldFoundation.prototype.destroy = function () {\n var e_3, _a, e_4, _b;\n this.adapter.deregisterInputInteractionHandler('focus', this.inputFocusHandler);\n this.adapter.deregisterInputInteractionHandler('blur', this.inputBlurHandler);\n this.adapter.deregisterInputInteractionHandler('input', this.inputInputHandler);\n try {\n for (var POINTERDOWN_EVENTS_2 = __values(POINTERDOWN_EVENTS), POINTERDOWN_EVENTS_2_1 = POINTERDOWN_EVENTS_2.next(); !POINTERDOWN_EVENTS_2_1.done; POINTERDOWN_EVENTS_2_1 = POINTERDOWN_EVENTS_2.next()) {\n var evtType = POINTERDOWN_EVENTS_2_1.value;\n this.adapter.deregisterInputInteractionHandler(evtType, this.setPointerXOffset);\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (POINTERDOWN_EVENTS_2_1 && !POINTERDOWN_EVENTS_2_1.done && (_a = POINTERDOWN_EVENTS_2.return)) _a.call(POINTERDOWN_EVENTS_2);\n }\n finally { if (e_3) throw e_3.error; }\n }\n try {\n for (var INTERACTION_EVENTS_2 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next(); !INTERACTION_EVENTS_2_1.done; INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next()) {\n var evtType = INTERACTION_EVENTS_2_1.value;\n this.adapter.deregisterTextFieldInteractionHandler(evtType, this.textFieldInteractionHandler);\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (INTERACTION_EVENTS_2_1 && !INTERACTION_EVENTS_2_1.done && (_b = INTERACTION_EVENTS_2.return)) _b.call(INTERACTION_EVENTS_2);\n }\n finally { if (e_4) throw e_4.error; }\n }\n this.adapter.deregisterValidationAttributeChangeHandler(this.validationObserver);\n };\n /**\n * Handles user interactions with the Text Field.\n */\n MDCTextFieldFoundation.prototype.handleTextFieldInteraction = function () {\n var nativeInput = this.adapter.getNativeInput();\n if (nativeInput && nativeInput.disabled) {\n return;\n }\n this.receivedUserInput = true;\n };\n /**\n * Handles validation attribute changes\n */\n MDCTextFieldFoundation.prototype.handleValidationAttributeChange = function (attributesList) {\n var _this = this;\n attributesList.some(function (attributeName) {\n if (VALIDATION_ATTR_WHITELIST.indexOf(attributeName) > -1) {\n _this.styleValidity(true);\n _this.adapter.setLabelRequired(_this.getNativeInput().required);\n return true;\n }\n return false;\n });\n if (attributesList.indexOf('maxlength') > -1) {\n this.setcharacterCounter(this.getValue().length);\n }\n };\n /**\n * Opens/closes the notched outline.\n */\n MDCTextFieldFoundation.prototype.notchOutline = function (openNotch) {\n if (!this.adapter.hasOutline() || !this.adapter.hasLabel()) {\n return;\n }\n if (openNotch) {\n var labelWidth = this.adapter.getLabelWidth() * numbers.LABEL_SCALE;\n this.adapter.notchOutline(labelWidth);\n }\n else {\n this.adapter.closeOutline();\n }\n };\n /**\n * Activates the text field focus state.\n */\n MDCTextFieldFoundation.prototype.activateFocus = function () {\n this.isFocused = true;\n this.styleFocused(this.isFocused);\n this.adapter.activateLineRipple();\n if (this.adapter.hasLabel()) {\n this.notchOutline(this.shouldFloat);\n this.adapter.floatLabel(this.shouldFloat);\n this.styleFloating(this.shouldFloat);\n this.adapter.shakeLabel(this.shouldShake);\n }\n if (this.helperText &&\n (this.helperText.isPersistent() || !this.helperText.isValidation() ||\n !this.valid)) {\n this.helperText.showToScreenReader();\n }\n };\n /**\n * Sets the line ripple's transform origin, so that the line ripple activate\n * animation will animate out from the user's click location.\n */\n MDCTextFieldFoundation.prototype.setTransformOrigin = function (evt) {\n if (this.isDisabled() || this.adapter.hasOutline()) {\n return;\n }\n var touches = evt.touches;\n var targetEvent = touches ? touches[0] : evt;\n var targetClientRect = targetEvent.target.getBoundingClientRect();\n var normalizedX = targetEvent.clientX - targetClientRect.left;\n this.adapter.setLineRippleTransformOrigin(normalizedX);\n };\n /**\n * Handles input change of text input and text area.\n */\n MDCTextFieldFoundation.prototype.handleInput = function () {\n this.autoCompleteFocus();\n this.setcharacterCounter(this.getValue().length);\n };\n /**\n * Activates the Text Field's focus state in cases when the input value\n * changes without user input (e.g. programmatically).\n */\n MDCTextFieldFoundation.prototype.autoCompleteFocus = function () {\n if (!this.receivedUserInput) {\n this.activateFocus();\n }\n };\n /**\n * Deactivates the Text Field's focus state.\n */\n MDCTextFieldFoundation.prototype.deactivateFocus = function () {\n this.isFocused = false;\n this.adapter.deactivateLineRipple();\n var isValid = this.isValid();\n this.styleValidity(isValid);\n this.styleFocused(this.isFocused);\n if (this.adapter.hasLabel()) {\n this.notchOutline(this.shouldFloat);\n this.adapter.floatLabel(this.shouldFloat);\n this.styleFloating(this.shouldFloat);\n this.adapter.shakeLabel(this.shouldShake);\n }\n if (!this.shouldFloat) {\n this.receivedUserInput = false;\n }\n };\n MDCTextFieldFoundation.prototype.getValue = function () {\n return this.getNativeInput().value;\n };\n /**\n * @param value The value to set on the input Element.\n */\n MDCTextFieldFoundation.prototype.setValue = function (value) {\n // Prevent Safari from moving the caret to the end of the input when the\n // value has not changed.\n if (this.getValue() !== value) {\n this.getNativeInput().value = value;\n }\n this.setcharacterCounter(value.length);\n if (this.validateOnValueChange) {\n var isValid = this.isValid();\n this.styleValidity(isValid);\n }\n if (this.adapter.hasLabel()) {\n this.notchOutline(this.shouldFloat);\n this.adapter.floatLabel(this.shouldFloat);\n this.styleFloating(this.shouldFloat);\n if (this.validateOnValueChange) {\n this.adapter.shakeLabel(this.shouldShake);\n }\n }\n };\n /**\n * @return The custom validity state, if set; otherwise, the result of a\n * native validity check.\n */\n MDCTextFieldFoundation.prototype.isValid = function () {\n return this.useNativeValidation ? this.isNativeInputValid() : this.valid;\n };\n /**\n * @param isValid Sets the custom validity state of the Text Field.\n */\n MDCTextFieldFoundation.prototype.setValid = function (isValid) {\n this.valid = isValid;\n this.styleValidity(isValid);\n var shouldShake = !isValid && !this.isFocused && !!this.getValue();\n if (this.adapter.hasLabel()) {\n this.adapter.shakeLabel(shouldShake);\n }\n };\n /**\n * @param shouldValidate Whether or not validity should be updated on\n * value change.\n */\n MDCTextFieldFoundation.prototype.setValidateOnValueChange = function (shouldValidate) {\n this.validateOnValueChange = shouldValidate;\n };\n /**\n * @return Whether or not validity should be updated on value change. `true`\n * by default.\n */\n MDCTextFieldFoundation.prototype.getValidateOnValueChange = function () {\n return this.validateOnValueChange;\n };\n /**\n * Enables or disables the use of native validation. Use this for custom\n * validation.\n * @param useNativeValidation Set this to false to ignore native input\n * validation.\n */\n MDCTextFieldFoundation.prototype.setUseNativeValidation = function (useNativeValidation) {\n this.useNativeValidation = useNativeValidation;\n };\n MDCTextFieldFoundation.prototype.isDisabled = function () {\n return this.getNativeInput().disabled;\n };\n /**\n * @param disabled Sets the text-field disabled or enabled.\n */\n MDCTextFieldFoundation.prototype.setDisabled = function (disabled) {\n this.getNativeInput().disabled = disabled;\n this.styleDisabled(disabled);\n };\n /**\n * @param content Sets the content of the helper text.\n */\n MDCTextFieldFoundation.prototype.setHelperTextContent = function (content) {\n if (this.helperText) {\n this.helperText.setContent(content);\n }\n };\n /**\n * Sets the aria label of the leading icon.\n */\n MDCTextFieldFoundation.prototype.setLeadingIconAriaLabel = function (label) {\n if (this.leadingIcon) {\n this.leadingIcon.setAriaLabel(label);\n }\n };\n /**\n * Sets the text content of the leading icon.\n */\n MDCTextFieldFoundation.prototype.setLeadingIconContent = function (content) {\n if (this.leadingIcon) {\n this.leadingIcon.setContent(content);\n }\n };\n /**\n * Sets the aria label of the trailing icon.\n */\n MDCTextFieldFoundation.prototype.setTrailingIconAriaLabel = function (label) {\n if (this.trailingIcon) {\n this.trailingIcon.setAriaLabel(label);\n }\n };\n /**\n * Sets the text content of the trailing icon.\n */\n MDCTextFieldFoundation.prototype.setTrailingIconContent = function (content) {\n if (this.trailingIcon) {\n this.trailingIcon.setContent(content);\n }\n };\n /**\n * Sets character counter values that shows characters used and the total\n * character limit.\n */\n MDCTextFieldFoundation.prototype.setcharacterCounter = function (currentLength) {\n if (!this.characterCounter) {\n return;\n }\n var maxLength = this.getNativeInput().maxLength;\n if (maxLength === -1) {\n throw new Error('MDCTextFieldFoundation: Expected maxlength html property on text input or textarea.');\n }\n this.characterCounter.setCounterValue(currentLength, maxLength);\n };\n /**\n * @return True if the Text Field input fails in converting the user-supplied\n * value.\n */\n MDCTextFieldFoundation.prototype.isBadInput = function () {\n // The badInput property is not supported in IE 11 💩.\n return this.getNativeInput().validity.badInput || false;\n };\n /**\n * @return The result of native validity checking (ValidityState.valid).\n */\n MDCTextFieldFoundation.prototype.isNativeInputValid = function () {\n return this.getNativeInput().validity.valid;\n };\n /**\n * Styles the component based on the validity state.\n */\n MDCTextFieldFoundation.prototype.styleValidity = function (isValid) {\n var INVALID = MDCTextFieldFoundation.cssClasses.INVALID;\n if (isValid) {\n this.adapter.removeClass(INVALID);\n }\n else {\n this.adapter.addClass(INVALID);\n }\n if (this.helperText) {\n this.helperText.setValidity(isValid);\n // We dynamically set or unset aria-describedby for validation helper text\n // only, based on whether the field is valid\n var helperTextValidation = this.helperText.isValidation();\n if (!helperTextValidation) {\n return;\n }\n var helperTextVisible = this.helperText.isVisible();\n var helperTextId = this.helperText.getId();\n if (helperTextVisible && helperTextId) {\n this.adapter.setInputAttr(strings.ARIA_DESCRIBEDBY, helperTextId);\n }\n else {\n this.adapter.removeInputAttr(strings.ARIA_DESCRIBEDBY);\n }\n }\n };\n /**\n * Styles the component based on the focused state.\n */\n MDCTextFieldFoundation.prototype.styleFocused = function (isFocused) {\n var FOCUSED = MDCTextFieldFoundation.cssClasses.FOCUSED;\n if (isFocused) {\n this.adapter.addClass(FOCUSED);\n }\n else {\n this.adapter.removeClass(FOCUSED);\n }\n };\n /**\n * Styles the component based on the disabled state.\n */\n MDCTextFieldFoundation.prototype.styleDisabled = function (isDisabled) {\n var _a = MDCTextFieldFoundation.cssClasses, DISABLED = _a.DISABLED, INVALID = _a.INVALID;\n if (isDisabled) {\n this.adapter.addClass(DISABLED);\n this.adapter.removeClass(INVALID);\n }\n else {\n this.adapter.removeClass(DISABLED);\n }\n if (this.leadingIcon) {\n this.leadingIcon.setDisabled(isDisabled);\n }\n if (this.trailingIcon) {\n this.trailingIcon.setDisabled(isDisabled);\n }\n };\n /**\n * Styles the component based on the label floating state.\n */\n MDCTextFieldFoundation.prototype.styleFloating = function (isFloating) {\n var LABEL_FLOATING = MDCTextFieldFoundation.cssClasses.LABEL_FLOATING;\n if (isFloating) {\n this.adapter.addClass(LABEL_FLOATING);\n }\n else {\n this.adapter.removeClass(LABEL_FLOATING);\n }\n };\n /**\n * @return The native text input element from the host environment, or an\n * object with the same shape for unit tests.\n */\n MDCTextFieldFoundation.prototype.getNativeInput = function () {\n // this.adapter may be undefined in foundation unit tests. This happens when\n // testdouble is creating a mock object and invokes the\n // shouldShake/shouldFloat getters (which in turn call getValue(), which\n // calls this method) before init() has been called from the MDCTextField\n // constructor. To work around that issue, we return a dummy object.\n var nativeInput = this.adapter ? this.adapter.getNativeInput() : null;\n return nativeInput || {\n disabled: false,\n maxLength: -1,\n required: false,\n type: 'input',\n validity: {\n badInput: false,\n valid: true,\n },\n value: '',\n };\n };\n return MDCTextFieldFoundation;\n}(MDCFoundation));\nexport { MDCTextFieldFoundation };\n// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.\nexport default MDCTextFieldFoundation;\n//# sourceMappingURL=foundation.js.map","import{_$LH as o}from\"./lit-html.js\";\n/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const{I:l}=o,t=o=>null===o||\"object\"!=typeof o&&\"function\"!=typeof o,i={HTML:1,SVG:2},n=(o,l)=>void 0===l?void 0!==(null==o?void 0:o._$litType$):(null==o?void 0:o._$litType$)===l,d=o=>void 0!==(null==o?void 0:o._$litDirective$),v=o=>null==o?void 0:o._$litDirective$,e=o=>void 0===o.strings,c=()=>document.createComment(\"\"),r=(o,t,i)=>{var n;const d=o._$AA.parentNode,v=void 0===t?o._$AB:t._$AA;if(void 0===i){const t=d.insertBefore(c(),v),n=d.insertBefore(c(),v);i=new l(t,n,o,o.options)}else{const l=i._$AB.nextSibling,t=i._$AM,e=t!==o;if(e){let l;null===(n=i._$AQ)||void 0===n||n.call(i,o),i._$AM=o,void 0!==i._$AP&&(l=o._$AU)!==t._$AU&&i._$AP(l)}if(l!==v||e){let o=i._$AA;for(;o!==l;){const l=o.nextSibling;d.insertBefore(o,v),o=l}}}return i},u=(o,l,t=o)=>(o._$AI(l,t),o),f={},s=(o,l=f)=>o._$AH=l,m=o=>o._$AH,p=o=>{var l;null===(l=o._$AP)||void 0===l||l.call(o,!1,!0);let t=o._$AA;const i=o._$AB.nextSibling;for(;t!==i;){const o=t.nextSibling;t.remove(),t=o}},a=o=>{o._$AR()};export{i as TemplateResultType,a as clearPart,m as getCommittedValue,v as getDirectiveClass,r as insertPart,d as isDirectiveResult,t as isPrimitive,e as isSingleExpression,n as isTemplateResult,p as removePart,u as setChildPartValue,s as setCommittedValue};\n//# sourceMappingURL=directive-helpers.js.map\n","import{noChange as r,nothing as e}from\"../lit-html.js\";import{directive as i,Directive as t,PartType as n}from\"../directive.js\";import{isSingleExpression as o,setCommittedValue as s}from\"../directive-helpers.js\";\n/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const l=i(class extends t{constructor(r){if(super(r),r.type!==n.PROPERTY&&r.type!==n.ATTRIBUTE&&r.type!==n.BOOLEAN_ATTRIBUTE)throw Error(\"The `live` directive is not allowed on child or event bindings\");if(!o(r))throw Error(\"`live` bindings can only contain a single expression\")}render(r){return r}update(i,[t]){if(t===r||t===e)return t;const o=i.element,l=i.name;if(i.type===n.PROPERTY){if(t===o[l])return r}else if(i.type===n.BOOLEAN_ATTRIBUTE){if(!!t===o.hasAttribute(l))return r}else if(i.type===n.ATTRIBUTE&&o.getAttribute(l)===t+\"\")return r;return s(i),t}});export{l as live};\n//# sourceMappingURL=live.js.map\n","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport '@material/mwc-notched-outline/mwc-notched-outline.js';\nimport { addHasRemoveClass, FormElement } from '@material/mwc-base/form-element.js';\nimport { observer } from '@material/mwc-base/observer.js';\nimport { floatingLabel } from '@material/mwc-floating-label/mwc-floating-label-directive.js';\nimport { lineRipple } from '@material/mwc-line-ripple/mwc-line-ripple-directive.js';\nimport MDCTextFieldFoundation from '@material/textfield/foundation.js';\nimport { html } from 'lit';\nimport { eventOptions, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nconst passiveEvents = ['touchstart', 'touchmove', 'scroll', 'mousewheel'];\nconst createValidityObj = (customValidity = {}) => {\n /*\n * We need to make ValidityState an object because it is readonly and\n * we cannot use the spread operator. Also, we don't export\n * `CustomValidityState` because it is a leaky implementation and the user\n * already has access to `ValidityState` in lib.dom.ts. Also an interface\n * {a: Type} can be casted to {readonly a: Type} so passing any object\n * should be fine.\n */\n const objectifiedCustomValidity = {};\n // eslint-disable-next-line guard-for-in\n for (const propName in customValidity) {\n /*\n * Casting is needed because ValidityState's props are all readonly and\n * thus cannot be set on `onjectifiedCustomValidity`. In the end, the\n * interface is the same as ValidityState (but not readonly), but the\n * function signature casts the output to ValidityState (thus readonly).\n */\n objectifiedCustomValidity[propName] =\n customValidity[propName];\n }\n return Object.assign({ badInput: false, customError: false, patternMismatch: false, rangeOverflow: false, rangeUnderflow: false, stepMismatch: false, tooLong: false, tooShort: false, typeMismatch: false, valid: true, valueMissing: false }, objectifiedCustomValidity);\n};\n/** @soyCompatible */\nexport class TextFieldBase extends FormElement {\n constructor() {\n super(...arguments);\n this.mdcFoundationClass = MDCTextFieldFoundation;\n this.value = '';\n this.type = 'text';\n this.placeholder = '';\n this.label = '';\n this.icon = '';\n this.iconTrailing = '';\n this.disabled = false;\n this.required = false;\n this.minLength = -1;\n this.maxLength = -1;\n this.outlined = false;\n this.helper = '';\n this.validateOnInitialRender = false;\n this.validationMessage = '';\n this.autoValidate = false;\n this.pattern = '';\n this.min = '';\n this.max = '';\n /**\n * step can be a number or the keyword \"any\".\n *\n * Use `String` typing to pass down the value as a string and let the native\n * input cast internally as needed.\n */\n this.step = null;\n this.size = null;\n this.helperPersistent = false;\n this.charCounter = false;\n this.endAligned = false;\n this.prefix = '';\n this.suffix = '';\n this.name = '';\n this.readOnly = false;\n this.autocapitalize = '';\n this.outlineOpen = false;\n this.outlineWidth = 0;\n this.isUiValid = true;\n this.focused = false;\n this._validity = createValidityObj();\n this.validityTransform = null;\n }\n get validity() {\n this._checkValidity(this.value);\n return this._validity;\n }\n get willValidate() {\n return this.formElement.willValidate;\n }\n get selectionStart() {\n return this.formElement.selectionStart;\n }\n get selectionEnd() {\n return this.formElement.selectionEnd;\n }\n focus() {\n const focusEvt = new CustomEvent('focus');\n this.formElement.dispatchEvent(focusEvt);\n this.formElement.focus();\n }\n blur() {\n const blurEvt = new CustomEvent('blur');\n this.formElement.dispatchEvent(blurEvt);\n this.formElement.blur();\n }\n select() {\n this.formElement.select();\n }\n setSelectionRange(selectionStart, selectionEnd, selectionDirection) {\n this.formElement.setSelectionRange(selectionStart, selectionEnd, selectionDirection);\n }\n update(changedProperties) {\n if (changedProperties.has('autoValidate') && this.mdcFoundation) {\n this.mdcFoundation.setValidateOnValueChange(this.autoValidate);\n }\n if (changedProperties.has('value') && typeof this.value !== 'string') {\n this.value = `${this.value}`;\n }\n super.update(changedProperties);\n }\n setFormData(formData) {\n if (this.name) {\n formData.append(this.name, this.value);\n }\n }\n /** @soyTemplate */\n render() {\n const shouldRenderCharCounter = this.charCounter && this.maxLength !== -1;\n const shouldRenderHelperText = !!this.helper || !!this.validationMessage || shouldRenderCharCounter;\n /** @classMap */\n const classes = {\n 'mdc-text-field--disabled': this.disabled,\n 'mdc-text-field--no-label': !this.label,\n 'mdc-text-field--filled': !this.outlined,\n 'mdc-text-field--outlined': this.outlined,\n 'mdc-text-field--with-leading-icon': this.icon,\n 'mdc-text-field--with-trailing-icon': this.iconTrailing,\n 'mdc-text-field--end-aligned': this.endAligned,\n };\n return html `\n \n ${this.renderHelperText(shouldRenderHelperText, shouldRenderCharCounter)}\n `;\n }\n updated(changedProperties) {\n if (changedProperties.has('value') &&\n changedProperties.get('value') !== undefined) {\n this.mdcFoundation.setValue(this.value);\n if (this.autoValidate) {\n this.reportValidity();\n }\n }\n }\n /** @soyTemplate */\n renderRipple() {\n return this.outlined ? '' : html `\n \n `;\n }\n /** @soyTemplate */\n renderOutline() {\n return !this.outlined ? '' : html `\n \n ${this.renderLabel()}\n `;\n }\n /** @soyTemplate */\n renderLabel() {\n return !this.label ?\n '' :\n html `\n ${this.label}\n `;\n }\n /** @soyTemplate */\n renderLeadingIcon() {\n return this.icon ? this.renderIcon(this.icon) : '';\n }\n /** @soyTemplate */\n renderTrailingIcon() {\n return this.iconTrailing ? this.renderIcon(this.iconTrailing, true) : '';\n }\n /** @soyTemplate */\n renderIcon(icon, isTrailingIcon = false) {\n /** @classMap */\n const classes = {\n 'mdc-text-field__icon--leading': !isTrailingIcon,\n 'mdc-text-field__icon--trailing': isTrailingIcon\n };\n return html `${icon}`;\n }\n /** @soyTemplate */\n renderPrefix() {\n return this.prefix ? this.renderAffix(this.prefix) : '';\n }\n /** @soyTemplate */\n renderSuffix() {\n return this.suffix ? this.renderAffix(this.suffix, true) : '';\n }\n /** @soyTemplate */\n renderAffix(content, isSuffix = false) {\n /** @classMap */\n const classes = {\n 'mdc-text-field__affix--prefix': !isSuffix,\n 'mdc-text-field__affix--suffix': isSuffix\n };\n return html `\n ${content}`;\n }\n /** @soyTemplate */\n renderInput(shouldRenderHelperText) {\n const minOrUndef = this.minLength === -1 ? undefined : this.minLength;\n const maxOrUndef = this.maxLength === -1 ? undefined : this.maxLength;\n const autocapitalizeOrUndef = this.autocapitalize ?\n this.autocapitalize :\n undefined;\n const showValidationMessage = this.validationMessage && !this.isUiValid;\n const ariaLabelledbyOrUndef = !!this.label ? 'label' : undefined;\n const ariaControlsOrUndef = shouldRenderHelperText ? 'helper-text' : undefined;\n const ariaDescribedbyOrUndef = this.focused || this.helperPersistent || showValidationMessage ?\n 'helper-text' :\n undefined;\n // TODO: live() directive needs casting for lit-analyzer\n // https://github.com/runem/lit-analyzer/pull/91/files\n // TODO: lit-analyzer labels min/max as (number|string) instead of string\n return html `\n `;\n }\n /** @soyTemplate */\n renderLineRipple() {\n return this.outlined ?\n '' :\n html `\n \n `;\n }\n /** @soyTemplate */\n renderHelperText(shouldRenderHelperText, shouldRenderCharCounter) {\n const showValidationMessage = this.validationMessage && !this.isUiValid;\n /** @classMap */\n const classes = {\n 'mdc-text-field-helper-text--persistent': this.helperPersistent,\n 'mdc-text-field-helper-text--validation-msg': showValidationMessage,\n };\n const ariaHiddenOrUndef = this.focused || this.helperPersistent || showValidationMessage ?\n undefined :\n 'true';\n const helperText = showValidationMessage ? this.validationMessage : this.helper;\n return !shouldRenderHelperText ? '' : html `\n
\n
${helperText}
\n ${this.renderCharCounter(shouldRenderCharCounter)}\n
`;\n }\n /** @soyTemplate */\n renderCharCounter(shouldRenderCharCounter) {\n const length = Math.min(this.value.length, this.maxLength);\n return !shouldRenderCharCounter ? '' : html `\n ${length} / ${this.maxLength}`;\n }\n onInputFocus() {\n this.focused = true;\n }\n onInputBlur() {\n this.focused = false;\n this.reportValidity();\n }\n checkValidity() {\n const isValid = this._checkValidity(this.value);\n if (!isValid) {\n const invalidEvent = new Event('invalid', { bubbles: false, cancelable: true });\n this.dispatchEvent(invalidEvent);\n }\n return isValid;\n }\n reportValidity() {\n const isValid = this.checkValidity();\n this.mdcFoundation.setValid(isValid);\n this.isUiValid = isValid;\n return isValid;\n }\n _checkValidity(value) {\n const nativeValidity = this.formElement.validity;\n let validity = createValidityObj(nativeValidity);\n if (this.validityTransform) {\n const customValidity = this.validityTransform(value, validity);\n validity = Object.assign(Object.assign({}, validity), customValidity);\n this.mdcFoundation.setUseNativeValidation(false);\n }\n else {\n this.mdcFoundation.setUseNativeValidation(true);\n }\n this._validity = validity;\n return this._validity.valid;\n }\n setCustomValidity(message) {\n this.validationMessage = message;\n this.formElement.setCustomValidity(message);\n }\n handleInputChange() {\n this.value = this.formElement.value;\n }\n createAdapter() {\n return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.getRootAdapterMethods()), this.getInputAdapterMethods()), this.getLabelAdapterMethods()), this.getLineRippleAdapterMethods()), this.getOutlineAdapterMethods());\n }\n getRootAdapterMethods() {\n return Object.assign({ registerTextFieldInteractionHandler: (evtType, handler) => this.addEventListener(evtType, handler), deregisterTextFieldInteractionHandler: (evtType, handler) => this.removeEventListener(evtType, handler), registerValidationAttributeChangeHandler: (handler) => {\n const getAttributesList = (mutationsList) => {\n return mutationsList.map((mutation) => mutation.attributeName)\n .filter((attributeName) => attributeName);\n };\n const observer = new MutationObserver((mutationsList) => {\n handler(getAttributesList(mutationsList));\n });\n const config = { attributes: true };\n observer.observe(this.formElement, config);\n return observer;\n }, deregisterValidationAttributeChangeHandler: (observer) => observer.disconnect() }, addHasRemoveClass(this.mdcRoot));\n }\n getInputAdapterMethods() {\n return {\n getNativeInput: () => this.formElement,\n // since HelperTextFoundation is not used, aria-describedby a11y logic\n // is implemented in render method instead of these adapter methods\n setInputAttr: () => undefined,\n removeInputAttr: () => undefined,\n isFocused: () => this.shadowRoot ?\n this.shadowRoot.activeElement === this.formElement :\n false,\n registerInputInteractionHandler: (evtType, handler) => this.formElement.addEventListener(evtType, handler, { passive: evtType in passiveEvents }),\n deregisterInputInteractionHandler: (evtType, handler) => this.formElement.removeEventListener(evtType, handler),\n };\n }\n getLabelAdapterMethods() {\n return {\n floatLabel: (shouldFloat) => this.labelElement &&\n this.labelElement.floatingLabelFoundation.float(shouldFloat),\n getLabelWidth: () => {\n return this.labelElement ?\n this.labelElement.floatingLabelFoundation.getWidth() :\n 0;\n },\n hasLabel: () => Boolean(this.labelElement),\n shakeLabel: (shouldShake) => this.labelElement &&\n this.labelElement.floatingLabelFoundation.shake(shouldShake),\n setLabelRequired: (isRequired) => {\n if (this.labelElement) {\n this.labelElement.floatingLabelFoundation.setRequired(isRequired);\n }\n },\n };\n }\n getLineRippleAdapterMethods() {\n return {\n activateLineRipple: () => {\n if (this.lineRippleElement) {\n this.lineRippleElement.lineRippleFoundation.activate();\n }\n },\n deactivateLineRipple: () => {\n if (this.lineRippleElement) {\n this.lineRippleElement.lineRippleFoundation.deactivate();\n }\n },\n setLineRippleTransformOrigin: (normalizedX) => {\n if (this.lineRippleElement) {\n this.lineRippleElement.lineRippleFoundation.setRippleCenter(normalizedX);\n }\n },\n };\n }\n // tslint:disable:ban-ts-ignore\n async getUpdateComplete() {\n var _a;\n // @ts-ignore\n const result = await super.getUpdateComplete();\n await ((_a = this.outlineElement) === null || _a === void 0 ? void 0 : _a.updateComplete);\n return result;\n }\n // tslint:enable:ban-ts-ignore\n firstUpdated() {\n var _a;\n super.firstUpdated();\n this.mdcFoundation.setValidateOnValueChange(this.autoValidate);\n if (this.validateOnInitialRender) {\n this.reportValidity();\n }\n // wait for the outline element to render to update the notch width\n (_a = this.outlineElement) === null || _a === void 0 ? void 0 : _a.updateComplete.then(() => {\n var _a;\n // `foundation.notchOutline()` assumes the label isn't floating and\n // multiplies by a constant, but the label is already is floating at this\n // stage, therefore directly set the outline width to the label width\n this.outlineWidth =\n ((_a = this.labelElement) === null || _a === void 0 ? void 0 : _a.floatingLabelFoundation.getWidth()) || 0;\n });\n }\n getOutlineAdapterMethods() {\n return {\n closeOutline: () => this.outlineElement && (this.outlineOpen = false),\n hasOutline: () => Boolean(this.outlineElement),\n notchOutline: (labelWidth) => {\n const outlineElement = this.outlineElement;\n if (outlineElement && !this.outlineOpen) {\n this.outlineWidth = labelWidth;\n this.outlineOpen = true;\n }\n }\n };\n }\n async layout() {\n await this.updateComplete;\n const labelElement = this.labelElement;\n if (!labelElement) {\n this.outlineOpen = false;\n return;\n }\n const shouldFloat = !!this.label && !!this.value;\n labelElement.floatingLabelFoundation.float(shouldFloat);\n if (!this.outlined) {\n return;\n }\n this.outlineOpen = shouldFloat;\n await this.updateComplete;\n /* When the textfield automatically notches due to a value and label\n * being defined, the textfield may be set to `display: none` by the user.\n * this means that the notch is of size 0px. We provide this function so\n * that the user may manually resize the notch to the floated label's\n * width.\n */\n const labelWidth = labelElement.floatingLabelFoundation.getWidth();\n if (this.outlineOpen) {\n this.outlineWidth = labelWidth;\n await this.updateComplete;\n }\n }\n}\n__decorate([\n query('.mdc-text-field')\n], TextFieldBase.prototype, \"mdcRoot\", void 0);\n__decorate([\n query('input')\n], TextFieldBase.prototype, \"formElement\", void 0);\n__decorate([\n query('.mdc-floating-label')\n], TextFieldBase.prototype, \"labelElement\", void 0);\n__decorate([\n query('.mdc-line-ripple')\n], TextFieldBase.prototype, \"lineRippleElement\", void 0);\n__decorate([\n query('mwc-notched-outline')\n], TextFieldBase.prototype, \"outlineElement\", void 0);\n__decorate([\n query('.mdc-notched-outline__notch')\n], TextFieldBase.prototype, \"notchElement\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"value\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"type\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"placeholder\", void 0);\n__decorate([\n property({ type: String }),\n observer(function (_newVal, oldVal) {\n if (oldVal !== undefined && this.label !== oldVal) {\n this.layout();\n }\n })\n], TextFieldBase.prototype, \"label\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"icon\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"iconTrailing\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true })\n], TextFieldBase.prototype, \"disabled\", void 0);\n__decorate([\n property({ type: Boolean })\n], TextFieldBase.prototype, \"required\", void 0);\n__decorate([\n property({ type: Number })\n], TextFieldBase.prototype, \"minLength\", void 0);\n__decorate([\n property({ type: Number })\n], TextFieldBase.prototype, \"maxLength\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true }),\n observer(function (_newVal, oldVal) {\n if (oldVal !== undefined && this.outlined !== oldVal) {\n this.layout();\n }\n })\n], TextFieldBase.prototype, \"outlined\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"helper\", void 0);\n__decorate([\n property({ type: Boolean })\n], TextFieldBase.prototype, \"validateOnInitialRender\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"validationMessage\", void 0);\n__decorate([\n property({ type: Boolean })\n], TextFieldBase.prototype, \"autoValidate\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"pattern\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"min\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"max\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"step\", void 0);\n__decorate([\n property({ type: Number })\n], TextFieldBase.prototype, \"size\", void 0);\n__decorate([\n property({ type: Boolean })\n], TextFieldBase.prototype, \"helperPersistent\", void 0);\n__decorate([\n property({ type: Boolean })\n], TextFieldBase.prototype, \"charCounter\", void 0);\n__decorate([\n property({ type: Boolean })\n], TextFieldBase.prototype, \"endAligned\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"prefix\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"suffix\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"name\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"inputMode\", void 0);\n__decorate([\n property({ type: Boolean })\n], TextFieldBase.prototype, \"readOnly\", void 0);\n__decorate([\n property({ type: String })\n], TextFieldBase.prototype, \"autocapitalize\", void 0);\n__decorate([\n state()\n], TextFieldBase.prototype, \"outlineOpen\", void 0);\n__decorate([\n state()\n], TextFieldBase.prototype, \"outlineWidth\", void 0);\n__decorate([\n state()\n], TextFieldBase.prototype, \"isUiValid\", void 0);\n__decorate([\n state()\n], TextFieldBase.prototype, \"focused\", void 0);\n__decorate([\n eventOptions({ passive: true })\n], TextFieldBase.prototype, \"handleInputChange\", null);\n//# sourceMappingURL=mwc-textfield-base.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-LIcense-Identifier: Apache-2.0\n */\nimport { css } from 'lit';\nexport const styles = css `.mdc-floating-label{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-subtitle1-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1rem;font-size:var(--mdc-typography-subtitle1-font-size, 1rem);font-weight:400;font-weight:var(--mdc-typography-subtitle1-font-weight, 400);letter-spacing:0.009375em;letter-spacing:var(--mdc-typography-subtitle1-letter-spacing, 0.009375em);text-decoration:inherit;text-decoration:var(--mdc-typography-subtitle1-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-subtitle1-text-transform, inherit);position:absolute;left:0;-webkit-transform-origin:left top;transform-origin:left top;line-height:1.15rem;text-align:left;text-overflow:ellipsis;white-space:nowrap;cursor:text;overflow:hidden;will-change:transform;transition:transform 150ms cubic-bezier(0.4, 0, 0.2, 1),color 150ms cubic-bezier(0.4, 0, 0.2, 1)}[dir=rtl] .mdc-floating-label,.mdc-floating-label[dir=rtl]{right:0;left:auto;-webkit-transform-origin:right top;transform-origin:right top;text-align:right}.mdc-floating-label--float-above{cursor:auto}.mdc-floating-label--required::after{margin-left:1px;margin-right:0px;content:\"*\"}[dir=rtl] .mdc-floating-label--required::after,.mdc-floating-label--required[dir=rtl]::after{margin-left:0;margin-right:1px}.mdc-floating-label--float-above{transform:translateY(-106%) scale(0.75)}.mdc-floating-label--shake{animation:mdc-floating-label-shake-float-above-standard 250ms 1}@keyframes mdc-floating-label-shake-float-above-standard{0%{transform:translateX(calc(0 - 0%)) translateY(-106%) scale(0.75)}33%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(calc(4% - 0%)) translateY(-106%) scale(0.75)}66%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(calc(-4% - 0%)) translateY(-106%) scale(0.75)}100%{transform:translateX(calc(0 - 0%)) translateY(-106%) scale(0.75)}}.mdc-line-ripple::before,.mdc-line-ripple::after{position:absolute;bottom:0;left:0;width:100%;border-bottom-style:solid;content:\"\"}.mdc-line-ripple::before{border-bottom-width:1px}.mdc-line-ripple::before{z-index:1}.mdc-line-ripple::after{transform:scaleX(0);border-bottom-width:2px;opacity:0;z-index:2}.mdc-line-ripple::after{transition:transform 180ms cubic-bezier(0.4, 0, 0.2, 1),opacity 180ms cubic-bezier(0.4, 0, 0.2, 1)}.mdc-line-ripple--active::after{transform:scaleX(1);opacity:1}.mdc-line-ripple--deactivating::after{opacity:0}.mdc-notched-outline{display:flex;position:absolute;top:0;right:0;left:0;box-sizing:border-box;width:100%;max-width:100%;height:100%;text-align:left;pointer-events:none}[dir=rtl] .mdc-notched-outline,.mdc-notched-outline[dir=rtl]{text-align:right}.mdc-notched-outline__leading,.mdc-notched-outline__notch,.mdc-notched-outline__trailing{box-sizing:border-box;height:100%;border-top:1px solid;border-bottom:1px solid;pointer-events:none}.mdc-notched-outline__leading{border-left:1px solid;border-right:none;width:12px}[dir=rtl] .mdc-notched-outline__leading,.mdc-notched-outline__leading[dir=rtl]{border-left:none;border-right:1px solid}.mdc-notched-outline__trailing{border-left:none;border-right:1px solid;flex-grow:1}[dir=rtl] .mdc-notched-outline__trailing,.mdc-notched-outline__trailing[dir=rtl]{border-left:1px solid;border-right:none}.mdc-notched-outline__notch{flex:0 0 auto;width:auto;max-width:calc(100% - 12px * 2)}.mdc-notched-outline .mdc-floating-label{display:inline-block;position:relative;max-width:100%}.mdc-notched-outline .mdc-floating-label--float-above{text-overflow:clip}.mdc-notched-outline--upgraded .mdc-floating-label--float-above{max-width:calc(100% / 0.75)}.mdc-notched-outline--notched .mdc-notched-outline__notch{padding-left:0;padding-right:8px;border-top:none}[dir=rtl] .mdc-notched-outline--notched .mdc-notched-outline__notch,.mdc-notched-outline--notched .mdc-notched-outline__notch[dir=rtl]{padding-left:8px;padding-right:0}.mdc-notched-outline--no-label .mdc-notched-outline__notch{display:none}@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-text-field--filled{--mdc-ripple-fg-size: 0;--mdc-ripple-left: 0;--mdc-ripple-top: 0;--mdc-ripple-fg-scale: 1;--mdc-ripple-fg-translate-end: 0;--mdc-ripple-fg-translate-start: 0;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:transform,opacity}.mdc-text-field--filled .mdc-text-field__ripple::before,.mdc-text-field--filled .mdc-text-field__ripple::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:\"\"}.mdc-text-field--filled .mdc-text-field__ripple::before{transition:opacity 15ms linear,background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-text-field--filled .mdc-text-field__ripple::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-text-field--filled.mdc-ripple-upgraded .mdc-text-field__ripple::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-text-field--filled.mdc-ripple-upgraded .mdc-text-field__ripple::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-text-field--filled.mdc-ripple-upgraded--unbounded .mdc-text-field__ripple::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-text-field--filled.mdc-ripple-upgraded--foreground-activation .mdc-text-field__ripple::after{animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}.mdc-text-field--filled.mdc-ripple-upgraded--foreground-deactivation .mdc-text-field__ripple::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-text-field--filled .mdc-text-field__ripple::before,.mdc-text-field--filled .mdc-text-field__ripple::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-text-field--filled.mdc-ripple-upgraded .mdc-text-field__ripple::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-text-field__ripple{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.mdc-text-field{border-top-left-radius:4px;border-top-left-radius:var(--mdc-shape-small, 4px);border-top-right-radius:4px;border-top-right-radius:var(--mdc-shape-small, 4px);border-bottom-right-radius:0;border-bottom-left-radius:0;display:inline-flex;align-items:baseline;padding:0 16px;position:relative;box-sizing:border-box;overflow:hidden;will-change:opacity,transform,color}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-floating-label{color:rgba(0, 0, 0, 0.6)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__input{color:rgba(0, 0, 0, 0.87)}@media all{.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__input::placeholder{color:rgba(0, 0, 0, 0.54)}}@media all{.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__input:-ms-input-placeholder{color:rgba(0, 0, 0, 0.54)}}.mdc-text-field .mdc-text-field__input{caret-color:#6200ee;caret-color:var(--mdc-theme-primary, #6200ee)}.mdc-text-field:not(.mdc-text-field--disabled)+.mdc-text-field-helper-line .mdc-text-field-helper-text{color:rgba(0, 0, 0, 0.6)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field-character-counter,.mdc-text-field:not(.mdc-text-field--disabled)+.mdc-text-field-helper-line .mdc-text-field-character-counter{color:rgba(0, 0, 0, 0.6)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__icon--leading{color:rgba(0, 0, 0, 0.54)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__icon--trailing{color:rgba(0, 0, 0, 0.54)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__affix--prefix{color:rgba(0, 0, 0, 0.6)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__affix--suffix{color:rgba(0, 0, 0, 0.6)}.mdc-text-field .mdc-floating-label{top:50%;transform:translateY(-50%);pointer-events:none}.mdc-text-field__input{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-subtitle1-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1rem;font-size:var(--mdc-typography-subtitle1-font-size, 1rem);font-weight:400;font-weight:var(--mdc-typography-subtitle1-font-weight, 400);letter-spacing:0.009375em;letter-spacing:var(--mdc-typography-subtitle1-letter-spacing, 0.009375em);text-decoration:inherit;text-decoration:var(--mdc-typography-subtitle1-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-subtitle1-text-transform, inherit);height:28px;transition:opacity 150ms 0ms cubic-bezier(0.4, 0, 0.2, 1);width:100%;min-width:0;border:none;border-radius:0;background:none;appearance:none;padding:0}.mdc-text-field__input::-ms-clear{display:none}.mdc-text-field__input::-webkit-calendar-picker-indicator{display:none}.mdc-text-field__input:focus{outline:none}.mdc-text-field__input:invalid{box-shadow:none}@media all{.mdc-text-field__input::placeholder{transition:opacity 67ms 0ms cubic-bezier(0.4, 0, 0.2, 1);opacity:0}}@media all{.mdc-text-field__input:-ms-input-placeholder{transition:opacity 67ms 0ms cubic-bezier(0.4, 0, 0.2, 1);opacity:0}}@media all{.mdc-text-field--no-label .mdc-text-field__input::placeholder,.mdc-text-field--focused .mdc-text-field__input::placeholder{transition-delay:40ms;transition-duration:110ms;opacity:1}}@media all{.mdc-text-field--no-label .mdc-text-field__input:-ms-input-placeholder,.mdc-text-field--focused .mdc-text-field__input:-ms-input-placeholder{transition-delay:40ms;transition-duration:110ms;opacity:1}}.mdc-text-field__affix{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-subtitle1-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1rem;font-size:var(--mdc-typography-subtitle1-font-size, 1rem);font-weight:400;font-weight:var(--mdc-typography-subtitle1-font-weight, 400);letter-spacing:0.009375em;letter-spacing:var(--mdc-typography-subtitle1-letter-spacing, 0.009375em);text-decoration:inherit;text-decoration:var(--mdc-typography-subtitle1-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-subtitle1-text-transform, inherit);height:28px;transition:opacity 150ms 0ms cubic-bezier(0.4, 0, 0.2, 1);opacity:0;white-space:nowrap}.mdc-text-field--label-floating .mdc-text-field__affix,.mdc-text-field--no-label .mdc-text-field__affix{opacity:1}@supports(-webkit-hyphens: none){.mdc-text-field--outlined .mdc-text-field__affix{align-items:center;align-self:center;display:inline-flex;height:100%}}.mdc-text-field__affix--prefix{padding-left:0;padding-right:2px}[dir=rtl] .mdc-text-field__affix--prefix,.mdc-text-field__affix--prefix[dir=rtl]{padding-left:2px;padding-right:0}.mdc-text-field--end-aligned .mdc-text-field__affix--prefix{padding-left:0;padding-right:12px}[dir=rtl] .mdc-text-field--end-aligned .mdc-text-field__affix--prefix,.mdc-text-field--end-aligned .mdc-text-field__affix--prefix[dir=rtl]{padding-left:12px;padding-right:0}.mdc-text-field__affix--suffix{padding-left:12px;padding-right:0}[dir=rtl] .mdc-text-field__affix--suffix,.mdc-text-field__affix--suffix[dir=rtl]{padding-left:0;padding-right:12px}.mdc-text-field--end-aligned .mdc-text-field__affix--suffix{padding-left:2px;padding-right:0}[dir=rtl] .mdc-text-field--end-aligned .mdc-text-field__affix--suffix,.mdc-text-field--end-aligned .mdc-text-field__affix--suffix[dir=rtl]{padding-left:0;padding-right:2px}.mdc-text-field--filled{height:56px}.mdc-text-field--filled .mdc-text-field__ripple::before,.mdc-text-field--filled .mdc-text-field__ripple::after{background-color:rgba(0, 0, 0, 0.87);background-color:var(--mdc-ripple-color, rgba(0, 0, 0, 0.87))}.mdc-text-field--filled:hover .mdc-text-field__ripple::before,.mdc-text-field--filled.mdc-ripple-surface--hover .mdc-text-field__ripple::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-text-field--filled.mdc-ripple-upgraded--background-focused .mdc-text-field__ripple::before,.mdc-text-field--filled:not(.mdc-ripple-upgraded):focus .mdc-text-field__ripple::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-text-field--filled::before{display:inline-block;width:0;height:40px;content:\"\";vertical-align:0}.mdc-text-field--filled:not(.mdc-text-field--disabled){background-color:whitesmoke}.mdc-text-field--filled:not(.mdc-text-field--disabled) .mdc-line-ripple::before{border-bottom-color:rgba(0, 0, 0, 0.42)}.mdc-text-field--filled:not(.mdc-text-field--disabled):hover .mdc-line-ripple::before{border-bottom-color:rgba(0, 0, 0, 0.87)}.mdc-text-field--filled .mdc-line-ripple::after{border-bottom-color:#6200ee;border-bottom-color:var(--mdc-theme-primary, #6200ee)}.mdc-text-field--filled .mdc-floating-label{left:16px;right:initial}[dir=rtl] .mdc-text-field--filled .mdc-floating-label,.mdc-text-field--filled .mdc-floating-label[dir=rtl]{left:initial;right:16px}.mdc-text-field--filled .mdc-floating-label--float-above{transform:translateY(-106%) scale(0.75)}.mdc-text-field--filled.mdc-text-field--no-label .mdc-text-field__input{height:100%}.mdc-text-field--filled.mdc-text-field--no-label .mdc-floating-label{display:none}.mdc-text-field--filled.mdc-text-field--no-label::before{display:none}@supports(-webkit-hyphens: none){.mdc-text-field--filled.mdc-text-field--no-label .mdc-text-field__affix{align-items:center;align-self:center;display:inline-flex;height:100%}}.mdc-text-field--outlined{height:56px;overflow:visible}.mdc-text-field--outlined .mdc-floating-label--float-above{transform:translateY(-37.25px) scale(1)}.mdc-text-field--outlined .mdc-floating-label--float-above{font-size:.75rem}.mdc-text-field--outlined.mdc-notched-outline--upgraded .mdc-floating-label--float-above,.mdc-text-field--outlined .mdc-notched-outline--upgraded .mdc-floating-label--float-above{transform:translateY(-34.75px) scale(0.75)}.mdc-text-field--outlined.mdc-notched-outline--upgraded .mdc-floating-label--float-above,.mdc-text-field--outlined .mdc-notched-outline--upgraded .mdc-floating-label--float-above{font-size:1rem}.mdc-text-field--outlined .mdc-floating-label--shake{animation:mdc-floating-label-shake-float-above-text-field-outlined 250ms 1}@keyframes mdc-floating-label-shake-float-above-text-field-outlined{0%{transform:translateX(calc(0 - 0%)) translateY(-34.75px) scale(0.75)}33%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(calc(4% - 0%)) translateY(-34.75px) scale(0.75)}66%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(calc(-4% - 0%)) translateY(-34.75px) scale(0.75)}100%{transform:translateX(calc(0 - 0%)) translateY(-34.75px) scale(0.75)}}.mdc-text-field--outlined .mdc-text-field__input{height:100%}.mdc-text-field--outlined:not(.mdc-text-field--disabled) .mdc-notched-outline__leading,.mdc-text-field--outlined:not(.mdc-text-field--disabled) .mdc-notched-outline__notch,.mdc-text-field--outlined:not(.mdc-text-field--disabled) .mdc-notched-outline__trailing{border-color:rgba(0, 0, 0, 0.38)}.mdc-text-field--outlined:not(.mdc-text-field--disabled):not(.mdc-text-field--focused):hover .mdc-notched-outline .mdc-notched-outline__leading,.mdc-text-field--outlined:not(.mdc-text-field--disabled):not(.mdc-text-field--focused):hover .mdc-notched-outline .mdc-notched-outline__notch,.mdc-text-field--outlined:not(.mdc-text-field--disabled):not(.mdc-text-field--focused):hover .mdc-notched-outline .mdc-notched-outline__trailing{border-color:rgba(0, 0, 0, 0.87)}.mdc-text-field--outlined:not(.mdc-text-field--disabled).mdc-text-field--focused .mdc-notched-outline__leading,.mdc-text-field--outlined:not(.mdc-text-field--disabled).mdc-text-field--focused .mdc-notched-outline__notch,.mdc-text-field--outlined:not(.mdc-text-field--disabled).mdc-text-field--focused .mdc-notched-outline__trailing{border-color:#6200ee;border-color:var(--mdc-theme-primary, #6200ee)}.mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__leading{border-top-left-radius:4px;border-top-left-radius:var(--mdc-shape-small, 4px);border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:4px;border-bottom-left-radius:var(--mdc-shape-small, 4px)}[dir=rtl] .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__leading,.mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__leading[dir=rtl]{border-top-left-radius:0;border-top-right-radius:4px;border-top-right-radius:var(--mdc-shape-small, 4px);border-bottom-right-radius:4px;border-bottom-right-radius:var(--mdc-shape-small, 4px);border-bottom-left-radius:0}@supports(top: max(0%)){.mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__leading{width:max(12px, var(--mdc-shape-small, 4px))}}@supports(top: max(0%)){.mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__notch{max-width:calc(100% - max(12px, var(--mdc-shape-small, 4px)) * 2)}}.mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__trailing{border-top-left-radius:0;border-top-right-radius:4px;border-top-right-radius:var(--mdc-shape-small, 4px);border-bottom-right-radius:4px;border-bottom-right-radius:var(--mdc-shape-small, 4px);border-bottom-left-radius:0}[dir=rtl] .mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__trailing,.mdc-text-field--outlined .mdc-notched-outline .mdc-notched-outline__trailing[dir=rtl]{border-top-left-radius:4px;border-top-left-radius:var(--mdc-shape-small, 4px);border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:4px;border-bottom-left-radius:var(--mdc-shape-small, 4px)}@supports(top: max(0%)){.mdc-text-field--outlined{padding-left:max(16px, calc(var(--mdc-shape-small, 4px) + 4px))}}@supports(top: max(0%)){.mdc-text-field--outlined{padding-right:max(16px, var(--mdc-shape-small, 4px))}}@supports(top: max(0%)){.mdc-text-field--outlined+.mdc-text-field-helper-line{padding-left:max(16px, calc(var(--mdc-shape-small, 4px) + 4px))}}@supports(top: max(0%)){.mdc-text-field--outlined+.mdc-text-field-helper-line{padding-right:max(16px, var(--mdc-shape-small, 4px))}}.mdc-text-field--outlined.mdc-text-field--with-leading-icon{padding-left:0}@supports(top: max(0%)){.mdc-text-field--outlined.mdc-text-field--with-leading-icon{padding-right:max(16px, var(--mdc-shape-small, 4px))}}[dir=rtl] .mdc-text-field--outlined.mdc-text-field--with-leading-icon,.mdc-text-field--outlined.mdc-text-field--with-leading-icon[dir=rtl]{padding-right:0}@supports(top: max(0%)){[dir=rtl] .mdc-text-field--outlined.mdc-text-field--with-leading-icon,.mdc-text-field--outlined.mdc-text-field--with-leading-icon[dir=rtl]{padding-left:max(16px, var(--mdc-shape-small, 4px))}}.mdc-text-field--outlined.mdc-text-field--with-trailing-icon{padding-right:0}@supports(top: max(0%)){.mdc-text-field--outlined.mdc-text-field--with-trailing-icon{padding-left:max(16px, calc(var(--mdc-shape-small, 4px) + 4px))}}[dir=rtl] .mdc-text-field--outlined.mdc-text-field--with-trailing-icon,.mdc-text-field--outlined.mdc-text-field--with-trailing-icon[dir=rtl]{padding-left:0}@supports(top: max(0%)){[dir=rtl] .mdc-text-field--outlined.mdc-text-field--with-trailing-icon,.mdc-text-field--outlined.mdc-text-field--with-trailing-icon[dir=rtl]{padding-right:max(16px, calc(var(--mdc-shape-small, 4px) + 4px))}}.mdc-text-field--outlined.mdc-text-field--with-leading-icon.mdc-text-field--with-trailing-icon{padding-left:0;padding-right:0}.mdc-text-field--outlined .mdc-notched-outline--notched .mdc-notched-outline__notch{padding-top:1px}.mdc-text-field--outlined .mdc-text-field__ripple::before,.mdc-text-field--outlined .mdc-text-field__ripple::after{background-color:transparent;background-color:var(--mdc-ripple-color, transparent)}.mdc-text-field--outlined .mdc-floating-label{left:4px;right:initial}[dir=rtl] .mdc-text-field--outlined .mdc-floating-label,.mdc-text-field--outlined .mdc-floating-label[dir=rtl]{left:initial;right:4px}.mdc-text-field--outlined .mdc-text-field__input{display:flex;border:none !important;background-color:transparent}.mdc-text-field--outlined .mdc-notched-outline{z-index:1}.mdc-text-field--textarea{flex-direction:column;align-items:center;width:auto;height:auto;padding:0;transition:none}.mdc-text-field--textarea .mdc-floating-label{top:19px}.mdc-text-field--textarea .mdc-floating-label:not(.mdc-floating-label--float-above){transform:none}.mdc-text-field--textarea .mdc-text-field__input{flex-grow:1;height:auto;min-height:1.5rem;overflow-x:hidden;overflow-y:auto;box-sizing:border-box;resize:none;padding:0 16px;line-height:1.5rem}.mdc-text-field--textarea.mdc-text-field--filled::before{display:none}.mdc-text-field--textarea.mdc-text-field--filled .mdc-floating-label--float-above{transform:translateY(-10.25px) scale(0.75)}.mdc-text-field--textarea.mdc-text-field--filled .mdc-floating-label--shake{animation:mdc-floating-label-shake-float-above-textarea-filled 250ms 1}@keyframes mdc-floating-label-shake-float-above-textarea-filled{0%{transform:translateX(calc(0 - 0%)) translateY(-10.25px) scale(0.75)}33%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(calc(4% - 0%)) translateY(-10.25px) scale(0.75)}66%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(calc(-4% - 0%)) translateY(-10.25px) scale(0.75)}100%{transform:translateX(calc(0 - 0%)) translateY(-10.25px) scale(0.75)}}.mdc-text-field--textarea.mdc-text-field--filled .mdc-text-field__input{margin-top:23px;margin-bottom:9px}.mdc-text-field--textarea.mdc-text-field--filled.mdc-text-field--no-label .mdc-text-field__input{margin-top:16px;margin-bottom:16px}.mdc-text-field--textarea.mdc-text-field--outlined .mdc-notched-outline--notched .mdc-notched-outline__notch{padding-top:0}.mdc-text-field--textarea.mdc-text-field--outlined .mdc-floating-label--float-above{transform:translateY(-27.25px) scale(1)}.mdc-text-field--textarea.mdc-text-field--outlined .mdc-floating-label--float-above{font-size:.75rem}.mdc-text-field--textarea.mdc-text-field--outlined.mdc-notched-outline--upgraded .mdc-floating-label--float-above,.mdc-text-field--textarea.mdc-text-field--outlined .mdc-notched-outline--upgraded .mdc-floating-label--float-above{transform:translateY(-24.75px) scale(0.75)}.mdc-text-field--textarea.mdc-text-field--outlined.mdc-notched-outline--upgraded .mdc-floating-label--float-above,.mdc-text-field--textarea.mdc-text-field--outlined .mdc-notched-outline--upgraded .mdc-floating-label--float-above{font-size:1rem}.mdc-text-field--textarea.mdc-text-field--outlined .mdc-floating-label--shake{animation:mdc-floating-label-shake-float-above-textarea-outlined 250ms 1}@keyframes mdc-floating-label-shake-float-above-textarea-outlined{0%{transform:translateX(calc(0 - 0%)) translateY(-24.75px) scale(0.75)}33%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(calc(4% - 0%)) translateY(-24.75px) scale(0.75)}66%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(calc(-4% - 0%)) translateY(-24.75px) scale(0.75)}100%{transform:translateX(calc(0 - 0%)) translateY(-24.75px) scale(0.75)}}.mdc-text-field--textarea.mdc-text-field--outlined .mdc-text-field__input{margin-top:16px;margin-bottom:16px}.mdc-text-field--textarea.mdc-text-field--outlined .mdc-floating-label{top:18px}.mdc-text-field--textarea.mdc-text-field--with-internal-counter .mdc-text-field__input{margin-bottom:2px}.mdc-text-field--textarea.mdc-text-field--with-internal-counter .mdc-text-field-character-counter{align-self:flex-end;padding:0 16px}.mdc-text-field--textarea.mdc-text-field--with-internal-counter .mdc-text-field-character-counter::after{display:inline-block;width:0;height:16px;content:\"\";vertical-align:-16px}.mdc-text-field--textarea.mdc-text-field--with-internal-counter .mdc-text-field-character-counter::before{display:none}.mdc-text-field__resizer{align-self:stretch;display:inline-flex;flex-direction:column;flex-grow:1;max-height:100%;max-width:100%;min-height:56px;min-width:fit-content;min-width:-moz-available;min-width:-webkit-fill-available;overflow:hidden;resize:both}.mdc-text-field--filled .mdc-text-field__resizer{transform:translateY(-1px)}.mdc-text-field--filled .mdc-text-field__resizer .mdc-text-field__input,.mdc-text-field--filled .mdc-text-field__resizer .mdc-text-field-character-counter{transform:translateY(1px)}.mdc-text-field--outlined .mdc-text-field__resizer{transform:translateX(-1px) translateY(-1px)}[dir=rtl] .mdc-text-field--outlined .mdc-text-field__resizer,.mdc-text-field--outlined .mdc-text-field__resizer[dir=rtl]{transform:translateX(1px) translateY(-1px)}.mdc-text-field--outlined .mdc-text-field__resizer .mdc-text-field__input,.mdc-text-field--outlined .mdc-text-field__resizer .mdc-text-field-character-counter{transform:translateX(1px) translateY(1px)}[dir=rtl] .mdc-text-field--outlined .mdc-text-field__resizer .mdc-text-field__input,[dir=rtl] .mdc-text-field--outlined .mdc-text-field__resizer .mdc-text-field-character-counter,.mdc-text-field--outlined .mdc-text-field__resizer .mdc-text-field__input[dir=rtl],.mdc-text-field--outlined .mdc-text-field__resizer .mdc-text-field-character-counter[dir=rtl]{transform:translateX(-1px) translateY(1px)}.mdc-text-field--with-leading-icon{padding-left:0;padding-right:16px}[dir=rtl] .mdc-text-field--with-leading-icon,.mdc-text-field--with-leading-icon[dir=rtl]{padding-left:16px;padding-right:0}.mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label{max-width:calc(100% - 48px);left:48px;right:initial}[dir=rtl] .mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label,.mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label[dir=rtl]{left:initial;right:48px}.mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label--float-above{max-width:calc(100% / 0.75 - 64px / 0.75)}.mdc-text-field--with-leading-icon.mdc-text-field--outlined .mdc-floating-label{left:36px;right:initial}[dir=rtl] .mdc-text-field--with-leading-icon.mdc-text-field--outlined .mdc-floating-label,.mdc-text-field--with-leading-icon.mdc-text-field--outlined .mdc-floating-label[dir=rtl]{left:initial;right:36px}.mdc-text-field--with-leading-icon.mdc-text-field--outlined :not(.mdc-notched-outline--notched) .mdc-notched-outline__notch{max-width:calc(100% - 60px)}.mdc-text-field--with-leading-icon.mdc-text-field--outlined .mdc-floating-label--float-above{transform:translateY(-37.25px) translateX(-32px) scale(1)}[dir=rtl] .mdc-text-field--with-leading-icon.mdc-text-field--outlined .mdc-floating-label--float-above,.mdc-text-field--with-leading-icon.mdc-text-field--outlined .mdc-floating-label--float-above[dir=rtl]{transform:translateY(-37.25px) translateX(32px) scale(1)}.mdc-text-field--with-leading-icon.mdc-text-field--outlined .mdc-floating-label--float-above{font-size:.75rem}.mdc-text-field--with-leading-icon.mdc-text-field--outlined.mdc-notched-outline--upgraded .mdc-floating-label--float-above,.mdc-text-field--with-leading-icon.mdc-text-field--outlined .mdc-notched-outline--upgraded .mdc-floating-label--float-above{transform:translateY(-34.75px) translateX(-32px) scale(0.75)}[dir=rtl] .mdc-text-field--with-leading-icon.mdc-text-field--outlined.mdc-notched-outline--upgraded .mdc-floating-label--float-above,[dir=rtl] .mdc-text-field--with-leading-icon.mdc-text-field--outlined .mdc-notched-outline--upgraded .mdc-floating-label--float-above,.mdc-text-field--with-leading-icon.mdc-text-field--outlined.mdc-notched-outline--upgraded .mdc-floating-label--float-above[dir=rtl],.mdc-text-field--with-leading-icon.mdc-text-field--outlined .mdc-notched-outline--upgraded .mdc-floating-label--float-above[dir=rtl]{transform:translateY(-34.75px) translateX(32px) scale(0.75)}.mdc-text-field--with-leading-icon.mdc-text-field--outlined.mdc-notched-outline--upgraded .mdc-floating-label--float-above,.mdc-text-field--with-leading-icon.mdc-text-field--outlined .mdc-notched-outline--upgraded .mdc-floating-label--float-above{font-size:1rem}.mdc-text-field--with-leading-icon.mdc-text-field--outlined .mdc-floating-label--shake{animation:mdc-floating-label-shake-float-above-text-field-outlined-leading-icon 250ms 1}@keyframes mdc-floating-label-shake-float-above-text-field-outlined-leading-icon{0%{transform:translateX(calc(0 - 32px)) translateY(-34.75px) scale(0.75)}33%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(calc(4% - 32px)) translateY(-34.75px) scale(0.75)}66%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(calc(-4% - 32px)) translateY(-34.75px) scale(0.75)}100%{transform:translateX(calc(0 - 32px)) translateY(-34.75px) scale(0.75)}}[dir=rtl] .mdc-text-field--with-leading-icon.mdc-text-field--outlined .mdc-floating-label--shake,.mdc-text-field--with-leading-icon.mdc-text-field--outlined[dir=rtl] .mdc-floating-label--shake{animation:mdc-floating-label-shake-float-above-text-field-outlined-leading-icon 250ms 1}@keyframes mdc-floating-label-shake-float-above-text-field-outlined-leading-icon-rtl{0%{transform:translateX(calc(0 - -32px)) translateY(-34.75px) scale(0.75)}33%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(calc(4% - -32px)) translateY(-34.75px) scale(0.75)}66%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(calc(-4% - -32px)) translateY(-34.75px) scale(0.75)}100%{transform:translateX(calc(0 - -32px)) translateY(-34.75px) scale(0.75)}}.mdc-text-field--with-trailing-icon{padding-left:16px;padding-right:0}[dir=rtl] .mdc-text-field--with-trailing-icon,.mdc-text-field--with-trailing-icon[dir=rtl]{padding-left:0;padding-right:16px}.mdc-text-field--with-trailing-icon.mdc-text-field--filled .mdc-floating-label{max-width:calc(100% - 64px)}.mdc-text-field--with-trailing-icon.mdc-text-field--filled .mdc-floating-label--float-above{max-width:calc(100% / 0.75 - 64px / 0.75)}.mdc-text-field--with-trailing-icon.mdc-text-field--outlined :not(.mdc-notched-outline--notched) .mdc-notched-outline__notch{max-width:calc(100% - 60px)}.mdc-text-field--with-leading-icon.mdc-text-field--with-trailing-icon{padding-left:0;padding-right:0}.mdc-text-field--with-leading-icon.mdc-text-field--with-trailing-icon.mdc-text-field--filled .mdc-floating-label{max-width:calc(100% - 96px)}.mdc-text-field--with-leading-icon.mdc-text-field--with-trailing-icon.mdc-text-field--filled .mdc-floating-label--float-above{max-width:calc(100% / 0.75 - 96px / 0.75)}.mdc-text-field-helper-line{display:flex;justify-content:space-between;box-sizing:border-box}.mdc-text-field+.mdc-text-field-helper-line{padding-right:16px;padding-left:16px}.mdc-form-field>.mdc-text-field+label{align-self:flex-start}.mdc-text-field--focused:not(.mdc-text-field--disabled) .mdc-floating-label{color:rgba(98, 0, 238, 0.87)}.mdc-text-field--focused .mdc-notched-outline__leading,.mdc-text-field--focused .mdc-notched-outline__notch,.mdc-text-field--focused .mdc-notched-outline__trailing{border-width:2px}.mdc-text-field--focused+.mdc-text-field-helper-line .mdc-text-field-helper-text:not(.mdc-text-field-helper-text--validation-msg){opacity:1}.mdc-text-field--focused.mdc-text-field--outlined .mdc-notched-outline--notched .mdc-notched-outline__notch{padding-top:2px}.mdc-text-field--focused.mdc-text-field--outlined.mdc-text-field--textarea .mdc-notched-outline--notched .mdc-notched-outline__notch{padding-top:0}.mdc-text-field--invalid:not(.mdc-text-field--disabled):hover .mdc-line-ripple::before{border-bottom-color:#b00020;border-bottom-color:var(--mdc-theme-error, #b00020)}.mdc-text-field--invalid:not(.mdc-text-field--disabled) .mdc-line-ripple::after{border-bottom-color:#b00020;border-bottom-color:var(--mdc-theme-error, #b00020)}.mdc-text-field--invalid:not(.mdc-text-field--disabled) .mdc-floating-label{color:#b00020;color:var(--mdc-theme-error, #b00020)}.mdc-text-field--invalid:not(.mdc-text-field--disabled).mdc-text-field--invalid+.mdc-text-field-helper-line .mdc-text-field-helper-text--validation-msg{color:#b00020;color:var(--mdc-theme-error, #b00020)}.mdc-text-field--invalid .mdc-text-field__input{caret-color:#b00020;caret-color:var(--mdc-theme-error, #b00020)}.mdc-text-field--invalid:not(.mdc-text-field--disabled) .mdc-text-field__icon--trailing{color:#b00020;color:var(--mdc-theme-error, #b00020)}.mdc-text-field--invalid:not(.mdc-text-field--disabled) .mdc-line-ripple::before{border-bottom-color:#b00020;border-bottom-color:var(--mdc-theme-error, #b00020)}.mdc-text-field--invalid:not(.mdc-text-field--disabled) .mdc-notched-outline__leading,.mdc-text-field--invalid:not(.mdc-text-field--disabled) .mdc-notched-outline__notch,.mdc-text-field--invalid:not(.mdc-text-field--disabled) .mdc-notched-outline__trailing{border-color:#b00020;border-color:var(--mdc-theme-error, #b00020)}.mdc-text-field--invalid:not(.mdc-text-field--disabled):not(.mdc-text-field--focused):hover .mdc-notched-outline .mdc-notched-outline__leading,.mdc-text-field--invalid:not(.mdc-text-field--disabled):not(.mdc-text-field--focused):hover .mdc-notched-outline .mdc-notched-outline__notch,.mdc-text-field--invalid:not(.mdc-text-field--disabled):not(.mdc-text-field--focused):hover .mdc-notched-outline .mdc-notched-outline__trailing{border-color:#b00020;border-color:var(--mdc-theme-error, #b00020)}.mdc-text-field--invalid:not(.mdc-text-field--disabled).mdc-text-field--focused .mdc-notched-outline__leading,.mdc-text-field--invalid:not(.mdc-text-field--disabled).mdc-text-field--focused .mdc-notched-outline__notch,.mdc-text-field--invalid:not(.mdc-text-field--disabled).mdc-text-field--focused .mdc-notched-outline__trailing{border-color:#b00020;border-color:var(--mdc-theme-error, #b00020)}.mdc-text-field--invalid+.mdc-text-field-helper-line .mdc-text-field-helper-text--validation-msg{opacity:1}.mdc-text-field--disabled{pointer-events:none}.mdc-text-field--disabled .mdc-text-field__input{color:rgba(0, 0, 0, 0.38)}@media all{.mdc-text-field--disabled .mdc-text-field__input::placeholder{color:rgba(0, 0, 0, 0.38)}}@media all{.mdc-text-field--disabled .mdc-text-field__input:-ms-input-placeholder{color:rgba(0, 0, 0, 0.38)}}.mdc-text-field--disabled .mdc-floating-label{color:rgba(0, 0, 0, 0.38)}.mdc-text-field--disabled+.mdc-text-field-helper-line .mdc-text-field-helper-text{color:rgba(0, 0, 0, 0.38)}.mdc-text-field--disabled .mdc-text-field-character-counter,.mdc-text-field--disabled+.mdc-text-field-helper-line .mdc-text-field-character-counter{color:rgba(0, 0, 0, 0.38)}.mdc-text-field--disabled .mdc-text-field__icon--leading{color:rgba(0, 0, 0, 0.3)}.mdc-text-field--disabled .mdc-text-field__icon--trailing{color:rgba(0, 0, 0, 0.3)}.mdc-text-field--disabled .mdc-text-field__affix--prefix{color:rgba(0, 0, 0, 0.38)}.mdc-text-field--disabled .mdc-text-field__affix--suffix{color:rgba(0, 0, 0, 0.38)}.mdc-text-field--disabled .mdc-line-ripple::before{border-bottom-color:rgba(0, 0, 0, 0.06)}.mdc-text-field--disabled .mdc-notched-outline__leading,.mdc-text-field--disabled .mdc-notched-outline__notch,.mdc-text-field--disabled .mdc-notched-outline__trailing{border-color:rgba(0, 0, 0, 0.06)}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-text-field--disabled .mdc-text-field__input::placeholder{color:GrayText}}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-text-field--disabled .mdc-text-field__input:-ms-input-placeholder{color:GrayText}}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-text-field--disabled .mdc-floating-label{color:GrayText}}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-text-field--disabled+.mdc-text-field-helper-line .mdc-text-field-helper-text{color:GrayText}}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-text-field--disabled .mdc-text-field-character-counter,.mdc-text-field--disabled+.mdc-text-field-helper-line .mdc-text-field-character-counter{color:GrayText}}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-text-field--disabled .mdc-text-field__icon--leading{color:GrayText}}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-text-field--disabled .mdc-text-field__icon--trailing{color:GrayText}}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-text-field--disabled .mdc-text-field__affix--prefix{color:GrayText}}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-text-field--disabled .mdc-text-field__affix--suffix{color:GrayText}}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-text-field--disabled .mdc-line-ripple::before{border-bottom-color:GrayText}}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-text-field--disabled .mdc-notched-outline__leading,.mdc-text-field--disabled .mdc-notched-outline__notch,.mdc-text-field--disabled .mdc-notched-outline__trailing{border-color:GrayText}}@media screen and (forced-colors: active){.mdc-text-field--disabled .mdc-text-field__input{background-color:Window}.mdc-text-field--disabled .mdc-floating-label{z-index:1}}.mdc-text-field--disabled .mdc-floating-label{cursor:default}.mdc-text-field--disabled.mdc-text-field--filled{background-color:#fafafa}.mdc-text-field--disabled.mdc-text-field--filled .mdc-text-field__ripple{display:none}.mdc-text-field--disabled .mdc-text-field__input{pointer-events:auto}.mdc-text-field--end-aligned .mdc-text-field__input{text-align:right}[dir=rtl] .mdc-text-field--end-aligned .mdc-text-field__input,.mdc-text-field--end-aligned .mdc-text-field__input[dir=rtl]{text-align:left}[dir=rtl] .mdc-text-field--ltr-text .mdc-text-field__input,[dir=rtl] .mdc-text-field--ltr-text .mdc-text-field__affix,.mdc-text-field--ltr-text[dir=rtl] .mdc-text-field__input,.mdc-text-field--ltr-text[dir=rtl] .mdc-text-field__affix{direction:ltr}[dir=rtl] .mdc-text-field--ltr-text .mdc-text-field__affix--prefix,.mdc-text-field--ltr-text[dir=rtl] .mdc-text-field__affix--prefix{padding-left:0;padding-right:2px}[dir=rtl] .mdc-text-field--ltr-text .mdc-text-field__affix--suffix,.mdc-text-field--ltr-text[dir=rtl] .mdc-text-field__affix--suffix{padding-left:12px;padding-right:0}[dir=rtl] .mdc-text-field--ltr-text .mdc-text-field__icon--leading,.mdc-text-field--ltr-text[dir=rtl] .mdc-text-field__icon--leading{order:1}[dir=rtl] .mdc-text-field--ltr-text .mdc-text-field__affix--suffix,.mdc-text-field--ltr-text[dir=rtl] .mdc-text-field__affix--suffix{order:2}[dir=rtl] .mdc-text-field--ltr-text .mdc-text-field__input,.mdc-text-field--ltr-text[dir=rtl] .mdc-text-field__input{order:3}[dir=rtl] .mdc-text-field--ltr-text .mdc-text-field__affix--prefix,.mdc-text-field--ltr-text[dir=rtl] .mdc-text-field__affix--prefix{order:4}[dir=rtl] .mdc-text-field--ltr-text .mdc-text-field__icon--trailing,.mdc-text-field--ltr-text[dir=rtl] .mdc-text-field__icon--trailing{order:5}[dir=rtl] .mdc-text-field--ltr-text.mdc-text-field--end-aligned .mdc-text-field__input,.mdc-text-field--ltr-text.mdc-text-field--end-aligned[dir=rtl] .mdc-text-field__input{text-align:right}[dir=rtl] .mdc-text-field--ltr-text.mdc-text-field--end-aligned .mdc-text-field__affix--prefix,.mdc-text-field--ltr-text.mdc-text-field--end-aligned[dir=rtl] .mdc-text-field__affix--prefix{padding-right:12px}[dir=rtl] .mdc-text-field--ltr-text.mdc-text-field--end-aligned .mdc-text-field__affix--suffix,.mdc-text-field--ltr-text.mdc-text-field--end-aligned[dir=rtl] .mdc-text-field__affix--suffix{padding-left:2px}.mdc-text-field-helper-text{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.75rem;font-size:var(--mdc-typography-caption-font-size, 0.75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight, 400);letter-spacing:0.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, 0.0333333333em);text-decoration:inherit;text-decoration:var(--mdc-typography-caption-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform, inherit);display:block;margin-top:0;line-height:normal;margin:0;opacity:0;will-change:opacity;transition:opacity 150ms 0ms cubic-bezier(0.4, 0, 0.2, 1)}.mdc-text-field-helper-text::before{display:inline-block;width:0;height:16px;content:\"\";vertical-align:0}.mdc-text-field-helper-text--persistent{transition:none;opacity:1;will-change:initial}.mdc-text-field-character-counter{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.75rem;font-size:var(--mdc-typography-caption-font-size, 0.75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight, 400);letter-spacing:0.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, 0.0333333333em);text-decoration:inherit;text-decoration:var(--mdc-typography-caption-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform, inherit);display:block;margin-top:0;line-height:normal;margin-left:auto;margin-right:0;padding-left:16px;padding-right:0;white-space:nowrap}.mdc-text-field-character-counter::before{display:inline-block;width:0;height:16px;content:\"\";vertical-align:0}[dir=rtl] .mdc-text-field-character-counter,.mdc-text-field-character-counter[dir=rtl]{margin-left:0;margin-right:auto}[dir=rtl] .mdc-text-field-character-counter,.mdc-text-field-character-counter[dir=rtl]{padding-left:0;padding-right:16px}.mdc-text-field__icon{align-self:center;cursor:pointer}.mdc-text-field__icon:not([tabindex]),.mdc-text-field__icon[tabindex=\"-1\"]{cursor:default;pointer-events:none}.mdc-text-field__icon svg{display:block}.mdc-text-field__icon--leading{margin-left:16px;margin-right:8px}[dir=rtl] .mdc-text-field__icon--leading,.mdc-text-field__icon--leading[dir=rtl]{margin-left:8px;margin-right:16px}.mdc-text-field__icon--trailing{padding:12px;margin-left:0px;margin-right:0px}[dir=rtl] .mdc-text-field__icon--trailing,.mdc-text-field__icon--trailing[dir=rtl]{margin-left:0px;margin-right:0px}.material-icons{font-family:var(--mdc-icon-font, \"Material Icons\");font-weight:normal;font-style:normal;font-size:var(--mdc-icon-size, 24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}:host{display:inline-flex;flex-direction:column;outline:none}.mdc-text-field{width:100%}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-line-ripple::before{border-bottom-color:rgba(0, 0, 0, 0.42);border-bottom-color:var(--mdc-text-field-idle-line-color, rgba(0, 0, 0, 0.42))}.mdc-text-field:not(.mdc-text-field--disabled):hover .mdc-line-ripple::before{border-bottom-color:rgba(0, 0, 0, 0.87);border-bottom-color:var(--mdc-text-field-hover-line-color, rgba(0, 0, 0, 0.87))}.mdc-text-field.mdc-text-field--disabled .mdc-line-ripple::before{border-bottom-color:rgba(0, 0, 0, 0.06);border-bottom-color:var(--mdc-text-field-disabled-line-color, rgba(0, 0, 0, 0.06))}.mdc-text-field.mdc-text-field--invalid:not(.mdc-text-field--disabled) .mdc-line-ripple::before{border-bottom-color:#b00020;border-bottom-color:var(--mdc-theme-error, #b00020)}.mdc-text-field__input{direction:inherit}mwc-notched-outline{--mdc-notched-outline-border-color: var( --mdc-text-field-outlined-idle-border-color, rgba(0, 0, 0, 0.38) )}:host(:not([disabled]):hover) :not(.mdc-text-field--invalid):not(.mdc-text-field--focused) mwc-notched-outline{--mdc-notched-outline-border-color: var( --mdc-text-field-outlined-hover-border-color, rgba(0, 0, 0, 0.87) )}:host(:not([disabled])) .mdc-text-field:not(.mdc-text-field--outlined){background-color:var(--mdc-text-field-fill-color, whitesmoke)}:host(:not([disabled])) .mdc-text-field.mdc-text-field--invalid mwc-notched-outline{--mdc-notched-outline-border-color: var( --mdc-text-field-error-color, var(--mdc-theme-error, #b00020) )}:host(:not([disabled])) .mdc-text-field.mdc-text-field--invalid+.mdc-text-field-helper-line .mdc-text-field-character-counter,:host(:not([disabled])) .mdc-text-field.mdc-text-field--invalid .mdc-text-field__icon{color:var(--mdc-text-field-error-color, var(--mdc-theme-error, #b00020))}:host(:not([disabled])) .mdc-text-field:not(.mdc-text-field--invalid):not(.mdc-text-field--focused) .mdc-floating-label,:host(:not([disabled])) .mdc-text-field:not(.mdc-text-field--invalid):not(.mdc-text-field--focused) .mdc-floating-label::after{color:var(--mdc-text-field-label-ink-color, rgba(0, 0, 0, 0.6))}:host(:not([disabled])) .mdc-text-field.mdc-text-field--focused mwc-notched-outline{--mdc-notched-outline-stroke-width: 2px}:host(:not([disabled])) .mdc-text-field.mdc-text-field--focused:not(.mdc-text-field--invalid) mwc-notched-outline{--mdc-notched-outline-border-color: var( --mdc-text-field-focused-label-color, var(--mdc-theme-primary, rgba(98, 0, 238, 0.87)) )}:host(:not([disabled])) .mdc-text-field.mdc-text-field--focused:not(.mdc-text-field--invalid) .mdc-floating-label{color:#6200ee;color:var(--mdc-theme-primary, #6200ee)}:host(:not([disabled])) .mdc-text-field .mdc-text-field__input{color:var(--mdc-text-field-ink-color, rgba(0, 0, 0, 0.87))}:host(:not([disabled])) .mdc-text-field .mdc-text-field__input::placeholder{color:var(--mdc-text-field-label-ink-color, rgba(0, 0, 0, 0.6))}:host(:not([disabled])) .mdc-text-field-helper-line .mdc-text-field-helper-text:not(.mdc-text-field-helper-text--validation-msg),:host(:not([disabled])) .mdc-text-field-helper-line:not(.mdc-text-field--invalid) .mdc-text-field-character-counter{color:var(--mdc-text-field-label-ink-color, rgba(0, 0, 0, 0.6))}:host([disabled]) .mdc-text-field:not(.mdc-text-field--outlined){background-color:var(--mdc-text-field-disabled-fill-color, #fafafa)}:host([disabled]) .mdc-text-field.mdc-text-field--outlined mwc-notched-outline{--mdc-notched-outline-border-color: var( --mdc-text-field-outlined-disabled-border-color, rgba(0, 0, 0, 0.06) )}:host([disabled]) .mdc-text-field:not(.mdc-text-field--invalid):not(.mdc-text-field--focused) .mdc-floating-label,:host([disabled]) .mdc-text-field:not(.mdc-text-field--invalid):not(.mdc-text-field--focused) .mdc-floating-label::after{color:var(--mdc-text-field-disabled-ink-color, rgba(0, 0, 0, 0.38))}:host([disabled]) .mdc-text-field .mdc-text-field__input,:host([disabled]) .mdc-text-field .mdc-text-field__input::placeholder{color:var(--mdc-text-field-disabled-ink-color, rgba(0, 0, 0, 0.38))}:host([disabled]) .mdc-text-field-helper-line .mdc-text-field-helper-text,:host([disabled]) .mdc-text-field-helper-line .mdc-text-field-character-counter{color:var(--mdc-text-field-disabled-ink-color, rgba(0, 0, 0, 0.38))}`;\n//# sourceMappingURL=mwc-textfield.css.js.map","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { customElement } from 'lit/decorators.js';\nimport { TextFieldBase } from './mwc-textfield-base.js';\nimport { styles } from './mwc-textfield.css.js';\n/** @soyCompatible */\nlet TextField = class TextField extends TextFieldBase {\n};\nTextField.styles = [styles];\nTextField = __decorate([\n customElement('mwc-textfield')\n], TextField);\nexport { TextField };\n//# sourceMappingURL=mwc-textfield.js.map","import { html } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\n\nimport '@material/mwc-icon-button';\nimport '@material/mwc-list/mwc-list-item';\nimport '@material/mwc-menu';\nimport '@material/mwc-switch';\nimport type { IconButton } from '@material/mwc-icon-button';\nimport type { Menu } from '@material/mwc-menu';\nimport { SingleSelectedEvent } from '@material/mwc-list/mwc-list-foundation';\nimport type { Switch } from '@material/mwc-switch';\nimport { TextField } from '@material/mwc-textfield';\n\n/** A potentially `nullable` `TextField` that allows for selection of an SI\n * `multiplier` if an SI `unit` is given.\n *\n * NB: Use `maybeValue: string | null` instead of `value` if `nullable`! */\n@customElement('scl-textfield')\nexport class SclTextfield extends TextField {\n /** Whether [[`maybeValue`]] may be `null` */\n @property({ type: Boolean })\n nullable = false;\n\n /** Selectable SI multipliers for a non-empty [[`unit`]]. */\n @property({ type: Array })\n multipliers = [null, ''];\n\n private multiplierIndex = 0;\n\n @property({ type: String })\n get multiplier(): string | null {\n if (this.unit === '') return null;\n return (\n this.multipliers[this.multiplierIndex] ?? this.multipliers[0] ?? null\n );\n }\n\n set multiplier(value: string | null) {\n const index = this.multipliers.indexOf(value);\n if (index >= 0) this.multiplierIndex = index;\n this.suffix = (this.multiplier ?? '') + this.unit;\n }\n\n /** SI Unit, must be non-empty to allow for selecting a [[`multiplier`]].\n * Overrides `suffix`. */\n @property({ type: String })\n unit = '';\n\n private isNull = false;\n\n @state()\n private get null(): boolean {\n return this.nullable && this.isNull;\n }\n\n private set null(value: boolean) {\n if (!this.nullable || value === this.isNull) return;\n this.isNull = value;\n if (this.null) this.disable();\n else this.enable();\n }\n\n /** Replacement for `value`, can only be `null` if [[`nullable`]]. */\n @property({ type: String })\n get maybeValue(): string | null {\n return this.null ? null : this.value;\n }\n\n set maybeValue(value: string | null) {\n if (value === null) this.null = true;\n else {\n this.null = false;\n this.value = value;\n }\n }\n\n /** The default `value` displayed if [[`maybeValue`]] is `null`. */\n @property({ type: String })\n defaultValue = '';\n\n /** Additional values that cause validation to fail. */\n @property({ type: Array })\n reservedValues: string[] = [];\n\n // FIXME: workaround to allow disable of the whole component - need basic refactor\n private disabledSwitch = false;\n\n @query('mwc-switch') nullSwitch?: Switch;\n\n @query('mwc-menu') multiplierMenu?: Menu;\n\n @query('mwc-icon-button') multiplierButton?: IconButton;\n\n private nulled: string | null = null;\n\n private selectMultiplier(se: SingleSelectedEvent): void {\n this.multiplier = this.multipliers[se.detail.index];\n }\n\n private enable(): void {\n if (this.nulled === null) return;\n this.value = this.nulled;\n this.nulled = null;\n this.helperPersistent = false;\n this.disabled = false;\n }\n\n private disable(): void {\n if (this.nulled !== null) return;\n this.nulled = this.value;\n this.value = this.defaultValue;\n this.helperPersistent = true;\n this.disabled = true;\n }\n\n async firstUpdated(): Promise {\n await super.firstUpdated();\n if (this.multiplierMenu)\n this.multiplierMenu.anchor = this.multiplierButton ?? null;\n }\n\n checkValidity(): boolean {\n if (\n this.reservedValues &&\n this.reservedValues.some(array => array === this.value)\n ) {\n this.setCustomValidity('Value already used');\n return false;\n }\n this.setCustomValidity('');\n return super.checkValidity();\n }\n\n constructor() {\n super();\n\n // eslint-disable-next-line wc/no-constructor-attributes\n this.disabledSwitch = this.hasAttribute('disabled');\n }\n\n renderUnitSelector() {\n if (this.multipliers.length && this.unit)\n return html`
\n this.multiplierMenu?.show()}\n >\n ${this.renderMulplierList()}\n
`;\n\n return html``;\n }\n\n renderMulplierList() {\n return html`${this.multipliers.map(\n multiplier =>\n html`${multiplier === null\n ? 'Nulled multiplier'\n : multiplier}`\n )}`;\n }\n\n renderSwitch() {\n if (this.nullable) {\n return html` {\n this.null = !this.nullSwitch!.selected;\n this.dispatchEvent(new Event('input'));\n }}\n >`;\n }\n return html``;\n }\n\n render() {\n return html`\n
\n
${super.render()}
\n ${this.renderUnitSelector()}\n
\n ${this.renderSwitch()}\n
\n
\n `;\n }\n}\n","const tAbstractConductingEquipment = [\n 'TransformerWinding',\n 'ConductingEquipment',\n] as const;\n\nconst tEquipment = [\n 'GeneralEquipment',\n 'PowerTransformer',\n ...tAbstractConductingEquipment,\n] as const;\nconst tEquipmentContainer = ['Substation', 'VoltageLevel', 'Bay'] as const;\nconst tGeneralEquipmentContainer = ['Process', 'Line'] as const;\nconst tAbstractEqFuncSubFunc = ['EqSubFunction', 'EqFunction'] as const;\n\nconst tPowerSystemResource = [\n 'SubFunction',\n 'Function',\n 'TapChanger',\n 'SubEquipment',\n ...tEquipment,\n ...tEquipmentContainer,\n ...tGeneralEquipmentContainer,\n ...tAbstractEqFuncSubFunc,\n] as const;\nconst tLNodeContainer = ['ConnectivityNode', ...tPowerSystemResource] as const;\nconst tCertificate = ['GOOSESecurity', 'SMVSecurity'] as const;\nconst tNaming = ['SubNetwork', ...tCertificate, ...tLNodeContainer] as const;\n\nconst tAbstractDataAttribute = ['BDA', 'DA'] as const;\nconst tControlWithIEDName = ['SampledValueControl', 'GSEControl'] as const;\nconst tControlWithTriggerOpt = ['LogControl', 'ReportControl'] as const;\nconst tControl = [...tControlWithIEDName, ...tControlWithTriggerOpt] as const;\nconst tControlBlock = ['GSE', 'SMV'] as const;\nconst tUnNaming = [\n 'ConnectedAP',\n 'PhysConn',\n 'SDO',\n 'DO',\n 'DAI',\n 'SDI',\n 'DOI',\n 'Inputs',\n 'RptEnabled',\n 'Server',\n 'ServerAt',\n 'SettingControl',\n 'Communication',\n 'Log',\n 'LDevice',\n 'DataSet',\n 'AccessPoint',\n 'IED',\n 'NeutralPoint',\n ...tControl,\n ...tControlBlock,\n ...tAbstractDataAttribute,\n] as const;\n\nconst tAnyLN = ['LN0', 'LN'] as const;\n\nconst tAnyContentFromOtherNamespace = [\n 'Text',\n 'Private',\n 'Hitem',\n 'AccessControl',\n] as const;\n\nconst tCert = ['Subject', 'IssuerName'] as const;\nconst tDurationInMilliSec = ['MinTime', 'MaxTime'] as const;\n\nconst tIDNaming = ['LNodeType', 'DOType', 'DAType', 'EnumType'] as const;\n\nconst tServiceYesNo = [\n 'FileHandling',\n 'TimeSyncProt',\n 'CommProt',\n 'SGEdit',\n 'ConfSG',\n 'GetDirectory',\n 'GetDataObjectDefinition',\n 'DataObjectDirectory',\n 'GetDataSetValue',\n 'SetDataSetValue',\n 'DataSetDirectory',\n 'ReadWrite',\n 'TimerActivatedControl',\n 'GetCBValues',\n 'GSEDir',\n 'ConfLdName',\n] as const;\n\nconst tServiceWithMaxAndMaxAttributes = ['DynDataSet', 'ConfDataSet'] as const;\n\nconst tServiceWithMax = [\n 'GSSE',\n 'GOOSE',\n 'ConfReportControl',\n 'SMVsc',\n ...tServiceWithMaxAndMaxAttributes,\n] as const;\n\nconst tServiceWithMaxNonZero = ['ConfLogControl', 'ConfSigRef'] as const;\n\nconst tServiceSettings = [\n 'ReportSettings',\n 'LogSettings',\n 'GSESettings',\n 'SMVSettings',\n] as const;\n\nconst tBaseElement = ['SCL', ...tNaming, ...tUnNaming, ...tIDNaming] as const;\n\nconst sCLTags = [\n ...tBaseElement,\n ...tAnyContentFromOtherNamespace,\n 'Header',\n 'LNode',\n 'Val',\n 'Voltage',\n 'Services',\n ...tCert,\n ...tDurationInMilliSec,\n 'Association',\n 'FCDA',\n 'ClientLN',\n 'IEDName',\n 'ExtRef',\n 'Protocol',\n ...tAnyLN,\n ...tServiceYesNo,\n 'DynAssociation',\n 'SettingGroups',\n ...tServiceWithMax,\n ...tServiceWithMaxNonZero,\n ...tServiceSettings,\n 'ConfLNs',\n 'ClientServices',\n 'SupSubscription',\n 'ValueHandling',\n 'RedProt',\n 'McSecurity',\n 'KDC',\n 'Address',\n 'P',\n 'ProtNs',\n 'EnumVal',\n 'Terminal',\n 'BitRate',\n 'Authentication',\n 'DataTypeTemplates',\n 'History',\n 'OptFields',\n 'SmvOpts',\n 'TrgOps',\n 'SamplesPerSec',\n 'SmpRate',\n 'SecPerSamples',\n] as const;\n\nexport type SCLTag = (typeof sCLTags)[number];\n\nconst tagSet = new Set(sCLTags);\n\nexport function isSCLTag(tag: string): tag is SCLTag {\n return tagSet.has(tag);\n}\n\nconst tBaseNameSequence = ['Text', 'Private'] as const;\nconst tNamingSequence = [...tBaseNameSequence] as const;\nconst tUnNamingSequence = [...tBaseNameSequence] as const;\nconst tIDNamingSequence = [...tBaseNameSequence] as const;\n\nconst tAbstractDataAttributeSequence = [...tUnNamingSequence, 'Val'] as const;\nconst tLNodeContainerSequence = [...tNamingSequence, 'LNode'] as const;\nconst tPowerSystemResourceSequence = [...tLNodeContainerSequence] as const;\nconst tEquipmentSequence = [...tPowerSystemResourceSequence] as const;\nconst tEquipmentContainerSequence = [\n ...tPowerSystemResourceSequence,\n 'PowerTransformer',\n 'GeneralEquipment',\n] as const;\nconst tAbstractConductingEquipmentSequence = [\n ...tEquipmentSequence,\n 'Terminal',\n] as const;\nconst tControlBlockSequence = [...tUnNamingSequence, 'Address'] as const;\nconst tControlSequence = [...tNamingSequence] as const;\nconst tControlWithIEDNameSequence = [...tControlSequence, 'IEDName'] as const;\nconst tAnyLNSequence = [\n ...tUnNamingSequence,\n 'DataSet',\n 'ReportControl',\n 'LogControl',\n 'DOI',\n 'Inputs',\n 'Log',\n] as const;\nconst tGeneralEquipmentContainerSequence = [\n ...tPowerSystemResourceSequence,\n 'GeneralEquipment',\n 'Function',\n] as const;\nconst tControlWithTriggerOptSequence = [...tControlSequence, 'TrgOps'] as const;\nconst tAbstractEqFuncSubFuncSequence = [\n ...tPowerSystemResourceSequence,\n 'GeneralEquipment',\n 'EqSubFunction',\n] as const;\n\nexport const relatives: Record<\n SCLTag,\n {\n parents: SCLTag[];\n children: SCLTag[];\n }\n> = {\n AccessControl: {\n parents: ['LDevice'],\n children: [],\n },\n AccessPoint: {\n parents: ['IED'],\n children: [\n ...tNamingSequence,\n 'Server',\n 'LN',\n 'ServerAt',\n 'Services',\n 'GOOSESecurity',\n 'SMVSecurity',\n ],\n },\n Address: {\n parents: ['ConnectedAP', 'GSE', 'SMV'],\n children: ['P'],\n },\n Association: {\n parents: ['Server'],\n children: [],\n },\n Authentication: {\n parents: ['Server'],\n children: [],\n },\n BDA: {\n parents: ['DAType'],\n children: [...tAbstractDataAttributeSequence],\n },\n BitRate: {\n parents: ['SubNetwork'],\n children: [],\n },\n Bay: {\n parents: ['VoltageLevel'],\n children: [\n ...tEquipmentContainerSequence,\n 'ConductingEquipment',\n 'ConnectivityNode',\n 'Function',\n ],\n },\n ClientLN: {\n parents: ['RptEnabled'],\n children: [],\n },\n ClientServices: {\n parents: ['Services'],\n children: ['TimeSyncProt', 'McSecurity'],\n },\n CommProt: {\n parents: ['Services'],\n children: [],\n },\n Communication: {\n parents: ['SCL'],\n children: [...tUnNamingSequence, 'SubNetwork'],\n },\n ConductingEquipment: {\n parents: ['Process', 'Line', 'SubFunction', 'Function', 'Bay'],\n children: [\n ...tAbstractConductingEquipmentSequence,\n 'EqFunction',\n 'SubEquipment',\n ],\n },\n ConfDataSet: {\n parents: ['Services'],\n children: [],\n },\n ConfLdName: {\n parents: ['Services'],\n children: [],\n },\n ConfLNs: {\n parents: ['Services'],\n children: [],\n },\n ConfLogControl: {\n parents: ['Services'],\n children: [],\n },\n ConfReportControl: {\n parents: ['Services'],\n children: [],\n },\n ConfSG: {\n parents: ['SettingGroups'],\n children: [],\n },\n ConfSigRef: {\n parents: ['Services'],\n children: [],\n },\n ConnectedAP: {\n parents: ['SubNetwork'],\n children: [...tUnNamingSequence, 'Address', 'GSE', 'SMV', 'PhysConn'],\n },\n ConnectivityNode: {\n parents: ['Bay', 'Line'],\n children: [...tLNodeContainerSequence],\n },\n DA: {\n parents: ['DOType'],\n children: [...tAbstractDataAttributeSequence],\n },\n DAI: {\n parents: ['DOI', 'SDI'],\n children: [...tUnNamingSequence, 'Val'],\n },\n DAType: {\n parents: ['DataTypeTemplates'],\n children: [...tIDNamingSequence, 'BDA', 'ProtNs'],\n },\n DO: {\n parents: ['LNodeType'],\n children: [...tUnNamingSequence],\n },\n DOI: {\n parents: [...tAnyLN],\n children: [...tUnNamingSequence, 'SDI', 'DAI'],\n },\n DOType: {\n parents: ['DataTypeTemplates'],\n children: [...tIDNamingSequence, 'SDO', 'DA'],\n },\n DataObjectDirectory: {\n parents: ['Services'],\n children: [],\n },\n DataSet: {\n parents: [...tAnyLN],\n children: [...tNamingSequence, 'FCDA'],\n },\n DataSetDirectory: {\n parents: ['Services'],\n children: [],\n },\n DataTypeTemplates: {\n parents: ['SCL'],\n children: ['LNodeType', 'DOType', 'DAType', 'EnumType'],\n },\n DynAssociation: {\n parents: ['Services'],\n children: [],\n },\n DynDataSet: {\n parents: ['Services'],\n children: [],\n },\n EnumType: {\n parents: ['DataTypeTemplates'],\n children: [...tIDNamingSequence, 'EnumVal'],\n },\n EnumVal: {\n parents: ['EnumType'],\n children: [],\n },\n EqFunction: {\n parents: [\n 'GeneralEquipment',\n 'TapChanger',\n 'TransformerWinding',\n 'PowerTransformer',\n 'SubEquipment',\n 'ConductingEquipment',\n ],\n children: [...tAbstractEqFuncSubFuncSequence],\n },\n EqSubFunction: {\n parents: ['EqSubFunction', 'EqFunction'],\n children: [...tAbstractEqFuncSubFuncSequence],\n },\n ExtRef: {\n parents: ['Inputs'],\n children: [],\n },\n FCDA: {\n parents: ['DataSet'],\n children: [],\n },\n FileHandling: {\n parents: ['Services'],\n children: [],\n },\n Function: {\n parents: ['Bay', 'VoltageLevel', 'Substation', 'Process', 'Line'],\n children: [\n ...tPowerSystemResourceSequence,\n 'SubFunction',\n 'GeneralEquipment',\n 'ConductingEquipment',\n ],\n },\n GeneralEquipment: {\n parents: [\n 'SubFunction',\n 'Function',\n ...tGeneralEquipmentContainer,\n ...tAbstractEqFuncSubFunc,\n ...tEquipmentContainer,\n ],\n children: [...tEquipmentSequence, 'EqFunction'],\n },\n GetCBValues: {\n parents: ['Services'],\n children: [],\n },\n GetDataObjectDefinition: {\n parents: ['Services'],\n children: [],\n },\n GetDataSetValue: {\n parents: ['Services'],\n children: [],\n },\n GetDirectory: {\n parents: ['Services'],\n children: [],\n },\n GOOSE: {\n parents: ['Services'],\n children: [],\n },\n GOOSESecurity: {\n parents: ['AccessPoint'],\n children: [...tNamingSequence, 'Subject', 'IssuerName'],\n },\n GSE: {\n parents: ['ConnectedAP'],\n children: [...tControlBlockSequence, 'MinTime', 'MaxTime'],\n },\n GSEDir: {\n parents: ['Services'],\n children: [],\n },\n GSEControl: {\n parents: ['LN0'],\n children: [...tControlWithIEDNameSequence, 'Protocol'],\n },\n GSESettings: {\n parents: ['Services'],\n children: [],\n },\n GSSE: {\n parents: ['Services'],\n children: [],\n },\n Header: {\n parents: ['SCL'],\n children: ['Text', 'History'],\n },\n History: {\n parents: ['Header'],\n children: ['Hitem'],\n },\n Hitem: {\n parents: ['History'],\n children: [],\n },\n IED: {\n parents: ['SCL'],\n children: [...tUnNamingSequence, 'Services', 'AccessPoint', 'KDC'],\n },\n IEDName: {\n parents: ['GSEControl', 'SampledValueControl'],\n children: [],\n },\n Inputs: {\n parents: [...tAnyLN],\n children: [...tUnNamingSequence, 'ExtRef'],\n },\n IssuerName: {\n parents: ['GOOSESecurity', 'SMVSecurity'],\n children: [],\n },\n KDC: {\n parents: ['IED'],\n children: [],\n },\n LDevice: {\n parents: ['Server'],\n children: [...tUnNamingSequence, 'LN0', 'LN', 'AccessControl'],\n },\n LN: {\n parents: ['AccessPoint', 'LDevice'],\n children: [...tAnyLNSequence],\n },\n LN0: {\n parents: ['LDevice'],\n children: [\n ...tAnyLNSequence,\n 'GSEControl',\n 'SampledValueControl',\n 'SettingControl',\n ],\n },\n LNode: {\n parents: [...tLNodeContainer],\n children: [...tUnNamingSequence],\n },\n LNodeType: {\n parents: ['DataTypeTemplates'],\n children: [...tIDNamingSequence, 'DO'],\n },\n Line: {\n parents: ['Process', 'SCL'],\n children: [\n ...tGeneralEquipmentContainerSequence,\n 'Voltage',\n 'ConductingEquipment',\n ],\n },\n Log: {\n parents: [...tAnyLN],\n children: [...tUnNamingSequence],\n },\n LogControl: {\n parents: [...tAnyLN],\n children: [...tControlWithTriggerOptSequence],\n },\n LogSettings: {\n parents: ['Services'],\n children: [],\n },\n MaxTime: {\n parents: ['GSE'],\n children: [],\n },\n McSecurity: {\n parents: ['GSESettings', 'SMVSettings', 'ClientServices'],\n children: [],\n },\n MinTime: {\n parents: ['GSE'],\n children: [],\n },\n NeutralPoint: {\n parents: ['TransformerWinding'],\n children: [...tUnNamingSequence],\n },\n OptFields: {\n parents: ['ReportControl'],\n children: [],\n },\n P: {\n parents: ['Address', 'PhysConn'],\n children: [],\n },\n PhysConn: {\n parents: ['ConnectedAP'],\n children: [...tUnNamingSequence, 'P'],\n },\n PowerTransformer: {\n parents: [...tEquipmentContainer],\n children: [\n ...tEquipmentSequence,\n 'TransformerWinding',\n 'SubEquipment',\n 'EqFunction',\n ],\n },\n Private: {\n parents: [],\n children: [],\n },\n Process: {\n parents: ['Process', 'SCL'],\n children: [\n ...tGeneralEquipmentContainerSequence,\n 'ConductingEquipment',\n 'Substation',\n 'Line',\n 'Process',\n ],\n },\n ProtNs: {\n parents: ['DAType', 'DA'],\n children: [],\n },\n Protocol: {\n parents: ['GSEControl', 'SampledValueControl'],\n children: [],\n },\n ReadWrite: {\n parents: ['Services'],\n children: [],\n },\n RedProt: {\n parents: ['Services'],\n children: [],\n },\n ReportControl: {\n parents: [...tAnyLN],\n children: [...tControlWithTriggerOptSequence, 'OptFields', 'RptEnabled'],\n },\n ReportSettings: {\n parents: ['Services'],\n children: [],\n },\n RptEnabled: {\n parents: ['ReportControl'],\n children: [...tUnNamingSequence, 'ClientLN'],\n },\n SamplesPerSec: {\n parents: ['SMVSettings'],\n children: [],\n },\n SampledValueControl: {\n parents: ['LN0'],\n children: [...tControlWithIEDNameSequence, 'SmvOpts'],\n },\n SecPerSamples: {\n parents: ['SMVSettings'],\n children: [],\n },\n SCL: {\n parents: [],\n children: [\n ...tBaseNameSequence,\n 'Header',\n 'Substation',\n 'Communication',\n 'IED',\n 'DataTypeTemplates',\n 'Line',\n 'Process',\n ],\n },\n SDI: {\n parents: ['DOI', 'SDI'],\n children: [...tUnNamingSequence, 'SDI', 'DAI'],\n },\n SDO: {\n parents: ['DOType'],\n children: [...tNamingSequence],\n },\n Server: {\n parents: ['AccessPoint'],\n children: [\n ...tUnNamingSequence,\n 'Authentication',\n 'LDevice',\n 'Association',\n ],\n },\n ServerAt: {\n parents: ['AccessPoint'],\n children: [...tUnNamingSequence],\n },\n Services: {\n parents: ['IED', 'AccessPoint'],\n children: [\n 'DynAssociation',\n 'SettingGroups',\n 'GetDirectory',\n 'GetDataObjectDefinition',\n 'DataObjectDirectory',\n 'GetDataSetValue',\n 'SetDataSetValue',\n 'DataSetDirectory',\n 'ConfDataSet',\n 'DynDataSet',\n 'ReadWrite',\n 'TimerActivatedControl',\n 'ConfReportControl',\n 'GetCBValues',\n 'ConfLogControl',\n 'ReportSettings',\n 'LogSettings',\n 'GSESettings',\n 'SMVSettings',\n 'GSEDir',\n 'GOOSE',\n 'GSSE',\n 'SMVsc',\n 'FileHandling',\n 'ConfLNs',\n 'ClientServices',\n 'ConfLdName',\n 'SupSubscription',\n 'ConfSigRef',\n 'ValueHandling',\n 'RedProt',\n 'TimeSyncProt',\n 'CommProt',\n ],\n },\n SetDataSetValue: {\n parents: ['Services'],\n children: [],\n },\n SettingControl: {\n parents: ['LN0'],\n children: [...tUnNamingSequence],\n },\n SettingGroups: {\n parents: ['Services'],\n children: ['SGEdit', 'ConfSG'],\n },\n SGEdit: {\n parents: ['SettingGroups'],\n children: [],\n },\n SmpRate: {\n parents: ['SMVSettings'],\n children: [],\n },\n SMV: {\n parents: ['ConnectedAP'],\n children: [...tControlBlockSequence],\n },\n SmvOpts: {\n parents: ['SampledValueControl'],\n children: [],\n },\n SMVsc: {\n parents: ['Services'],\n children: [],\n },\n SMVSecurity: {\n parents: ['AccessPoint'],\n children: [...tNamingSequence, 'Subject', 'IssuerName'],\n },\n SMVSettings: {\n parents: ['Services'],\n children: ['SmpRate', 'SamplesPerSec', 'SecPerSamples', 'McSecurity'],\n },\n SubEquipment: {\n parents: [\n 'TapChanger',\n 'PowerTransformer',\n 'ConductingEquipment',\n 'TransformerWinding',\n ...tAbstractConductingEquipment,\n ],\n children: [...tPowerSystemResourceSequence, 'EqFunction'],\n },\n SubFunction: {\n parents: ['SubFunction', 'Function'],\n children: [\n ...tPowerSystemResourceSequence,\n 'GeneralEquipment',\n 'ConductingEquipment',\n 'SubFunction',\n ],\n },\n SubNetwork: {\n parents: ['Communication'],\n children: [...tNamingSequence, 'BitRate', 'ConnectedAP'],\n },\n Subject: {\n parents: ['GOOSESecurity', 'SMVSecurity'],\n children: [],\n },\n Substation: {\n parents: ['SCL'],\n children: [...tEquipmentContainerSequence, 'VoltageLevel', 'Function'],\n },\n SupSubscription: {\n parents: ['Services'],\n children: [],\n },\n TapChanger: {\n parents: ['TransformerWinding'],\n children: [...tPowerSystemResourceSequence, 'SubEquipment', 'EqFunction'],\n },\n Terminal: {\n parents: [...tEquipment],\n children: [...tUnNamingSequence],\n },\n Text: {\n parents: sCLTags.filter(tag => tag !== 'Text' && tag !== 'Private'),\n children: [],\n },\n TimerActivatedControl: {\n parents: ['Services'],\n children: [],\n },\n TimeSyncProt: {\n parents: ['Services', 'ClientServices'],\n children: [],\n },\n TransformerWinding: {\n parents: ['PowerTransformer'],\n children: [\n ...tAbstractConductingEquipmentSequence,\n 'TapChanger',\n 'NeutralPoint',\n 'EqFunction',\n 'SubEquipment',\n ],\n },\n TrgOps: {\n parents: ['ReportControl'],\n children: [],\n },\n Val: {\n parents: ['DAI', 'DA', 'BDA'],\n children: [],\n },\n ValueHandling: {\n parents: ['Services'],\n children: [],\n },\n Voltage: {\n parents: ['VoltageLevel'],\n children: [],\n },\n VoltageLevel: {\n parents: ['Substation'],\n children: [...tEquipmentContainerSequence, 'Voltage', 'Bay', 'Function'],\n },\n};\n\nexport function getReference(parent: Element, tag: SCLTag): Element | null {\n const parentTag = parent.tagName;\n const children = Array.from(parent.children);\n\n if (\n parentTag === 'Services' ||\n parentTag === 'SettingGroups' ||\n !isSCLTag(parentTag)\n )\n return children.find(child => child.tagName === tag) ?? null;\n\n const sequence = relatives[parentTag]?.children ?? [];\n let index = sequence.findIndex(element => element === tag);\n\n if (index < 0) return null;\n\n let nextSibling: Element | undefined;\n while (index < sequence.length && !nextSibling) {\n // eslint-disable-next-line no-loop-func\n nextSibling = children.find(child => child.tagName === sequence[index]);\n // eslint-disable-next-line no-plusplus\n index++;\n }\n\n return nextSibling ?? null;\n}\n","/* eslint-disable import/no-extraneous-dependencies */\nimport { html, TemplateResult } from 'lit';\n\nimport { Edit } from '@openscd/open-scd-core';\nimport { updateBay } from '@openenergytools/scl-lib';\n\nimport '../../foundation/components/scl-textfield.js';\n\nimport {\n createElement,\n getValue,\n reservedNames,\n Wizard,\n WizardActor,\n WizardInputElement,\n} from '../foundation.js';\nimport { getReference } from '../../foundation/utils/scldata.js';\n\ntype RenderOptions = {\n name: string | null;\n reservedValues: string[];\n desc: string | null;\n};\n\nexport function renderBayWizard(options: RenderOptions): TemplateResult[] {\n return [\n html``,\n html``,\n ];\n}\n\nexport function createAction(parent: Element): WizardActor {\n return (inputs: WizardInputElement[]): Edit[] => {\n const name = getValue(inputs.find(i => i.label === 'name')!);\n const desc = getValue(inputs.find(i => i.label === 'desc')!);\n const node = createElement(parent.ownerDocument, 'Bay', {\n name,\n desc,\n });\n\n const action = {\n parent,\n node,\n reference: getReference(parent, 'Bay'),\n };\n\n return [action];\n };\n}\n\nexport function createBayWizard(parent: Element): Wizard {\n return [\n {\n title: 'Add Bay',\n primary: {\n icon: '',\n label: 'add',\n action: createAction(parent),\n },\n content: renderBayWizard({\n name: '',\n reservedValues: reservedNames(parent, 'Bay'),\n desc: '',\n }),\n },\n ];\n}\n\nexport function updateAction(element: Element): WizardActor {\n return (inputs: WizardInputElement[]): Edit[] => {\n const name = inputs.find(i => i.label === 'name')!.value!;\n const desc = getValue(inputs.find(i => i.label === 'desc')!);\n\n if (\n name === element.getAttribute('name') &&\n desc === element.getAttribute('desc')\n )\n return [];\n\n return updateBay({ element, attributes: { name, desc } });\n };\n}\n\nexport function editBayWizard(element: Element): Wizard {\n return [\n {\n title: 'Edit Bay',\n primary: {\n icon: 'edit',\n label: 'save',\n action: updateAction(element),\n },\n content: renderBayWizard({\n name: element.getAttribute('name'),\n reservedValues: reservedNames(element),\n desc: element.getAttribute('desc'),\n }),\n },\n ];\n}\n","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nvar ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select'];\n/**\n * Ensures that preventDefault is only called if the containing element\n * doesn't consume the event, and it will cause an unintended scroll.\n *\n * @param evt keyboard event to be prevented.\n */\nexport var preventDefaultEvent = function (evt) {\n var target = evt.target;\n if (!target) {\n return;\n }\n var tagName = (\"\" + target.tagName).toLowerCase();\n if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) {\n evt.preventDefault();\n }\n};\n//# sourceMappingURL=events.js.map","/**\n * @license\n * Copyright 2020 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nimport { normalizeKey } from '@material/dom/keyboard';\nimport { numbers } from './constants';\nimport { preventDefaultEvent } from './events';\n/**\n * Initializes a state object for typeahead. Use the same reference for calls to\n * typeahead functions.\n *\n * @return The current state of the typeahead process. Each state reference\n * represents a typeahead instance as the reference is typically mutated\n * in-place.\n */\nexport function initState() {\n var state = {\n bufferClearTimeout: 0,\n currentFirstChar: '',\n sortedIndexCursor: 0,\n typeaheadBuffer: '',\n };\n return state;\n}\n/**\n * Initializes typeahead state by indexing the current list items by primary\n * text into the sortedIndexByFirstChar data structure.\n *\n * @param listItemCount numer of items in the list\n * @param getPrimaryTextByItemIndex function that returns the primary text at a\n * given index\n *\n * @return Map that maps the first character of the primary text to the full\n * list text and it's index\n */\nexport function initSortedIndex(listItemCount, getPrimaryTextByItemIndex) {\n var sortedIndexByFirstChar = new Map();\n // Aggregate item text to index mapping\n for (var i = 0; i < listItemCount; i++) {\n var primaryText = getPrimaryTextByItemIndex(i).trim();\n if (!primaryText) {\n continue;\n }\n var firstChar = primaryText[0].toLowerCase();\n if (!sortedIndexByFirstChar.has(firstChar)) {\n sortedIndexByFirstChar.set(firstChar, []);\n }\n sortedIndexByFirstChar.get(firstChar).push({ text: primaryText.toLowerCase(), index: i });\n }\n // Sort the mapping\n // TODO(b/157162694): Investigate replacing forEach with Map.values()\n sortedIndexByFirstChar.forEach(function (values) {\n values.sort(function (first, second) {\n return first.index - second.index;\n });\n });\n return sortedIndexByFirstChar;\n}\n/**\n * Given the next desired character from the user, it attempts to find the next\n * list option matching the buffer. Wraps around if at the end of options.\n *\n * @param opts Options and accessors\n * - nextChar - the next character to match against items\n * - sortedIndexByFirstChar - output of `initSortedIndex(...)`\n * - focusedItemIndex - the index of the currently focused item\n * - focusItemAtIndex - function that focuses a list item at given index\n * - skipFocus - whether or not to focus the matched item\n * - isItemAtIndexDisabled - function that determines whether an item at a\n * given index is disabled\n * @param state The typeahead state instance. See `initState`.\n *\n * @return The index of the matched item, or -1 if no match.\n */\nexport function matchItem(opts, state) {\n var nextChar = opts.nextChar, focusItemAtIndex = opts.focusItemAtIndex, sortedIndexByFirstChar = opts.sortedIndexByFirstChar, focusedItemIndex = opts.focusedItemIndex, skipFocus = opts.skipFocus, isItemAtIndexDisabled = opts.isItemAtIndexDisabled;\n clearTimeout(state.bufferClearTimeout);\n state.bufferClearTimeout = setTimeout(function () {\n clearBuffer(state);\n }, numbers.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS);\n state.typeaheadBuffer = state.typeaheadBuffer + nextChar;\n var index;\n if (state.typeaheadBuffer.length === 1) {\n index = matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state);\n }\n else {\n index = matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state);\n }\n if (index !== -1 && !skipFocus) {\n focusItemAtIndex(index);\n }\n return index;\n}\n/**\n * Matches the user's single input character in the buffer to the\n * next option that begins with such character. Wraps around if at\n * end of options. Returns -1 if no match is found.\n */\nfunction matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state) {\n var firstChar = state.typeaheadBuffer[0];\n var itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar);\n if (!itemsMatchingFirstChar) {\n return -1;\n }\n // Has the same firstChar been recently matched?\n // Also, did starting index remain the same between key presses?\n // If both hold true, simply increment index.\n if (firstChar === state.currentFirstChar &&\n itemsMatchingFirstChar[state.sortedIndexCursor].index ===\n focusedItemIndex) {\n state.sortedIndexCursor =\n (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length;\n var newIndex = itemsMatchingFirstChar[state.sortedIndexCursor].index;\n if (!isItemAtIndexDisabled(newIndex)) {\n return newIndex;\n }\n }\n // If we're here, it means one of the following happened:\n // - either firstChar or startingIndex has changed, invalidating the\n // cursor.\n // - The next item of typeahead is disabled, so we have to look further.\n state.currentFirstChar = firstChar;\n var newCursorPosition = -1;\n var cursorPosition;\n // Find the first non-disabled item as a fallback.\n for (cursorPosition = 0; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) {\n if (!isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) {\n newCursorPosition = cursorPosition;\n break;\n }\n }\n // Advance cursor to first item matching the firstChar that is positioned\n // after starting item. Cursor is unchanged from fallback if there's no\n // such item.\n for (; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) {\n if (itemsMatchingFirstChar[cursorPosition].index > focusedItemIndex &&\n !isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) {\n newCursorPosition = cursorPosition;\n break;\n }\n }\n if (newCursorPosition !== -1) {\n state.sortedIndexCursor = newCursorPosition;\n return itemsMatchingFirstChar[state.sortedIndexCursor].index;\n }\n return -1;\n}\n/**\n * Attempts to find the next item that matches all of the typeahead buffer.\n * Wraps around if at end of options. Returns -1 if no match is found.\n */\nfunction matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state) {\n var firstChar = state.typeaheadBuffer[0];\n var itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar);\n if (!itemsMatchingFirstChar) {\n return -1;\n }\n // Do nothing if text already matches\n var startingItem = itemsMatchingFirstChar[state.sortedIndexCursor];\n if (startingItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0 &&\n !isItemAtIndexDisabled(startingItem.index)) {\n return startingItem.index;\n }\n // Find next item that matches completely; if no match, we'll eventually\n // loop around to same position\n var cursorPosition = (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length;\n var nextCursorPosition = -1;\n while (cursorPosition !== state.sortedIndexCursor) {\n var currentItem = itemsMatchingFirstChar[cursorPosition];\n var matches = currentItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0;\n var isEnabled = !isItemAtIndexDisabled(currentItem.index);\n if (matches && isEnabled) {\n nextCursorPosition = cursorPosition;\n break;\n }\n cursorPosition = (cursorPosition + 1) % itemsMatchingFirstChar.length;\n }\n if (nextCursorPosition !== -1) {\n state.sortedIndexCursor = nextCursorPosition;\n return itemsMatchingFirstChar[state.sortedIndexCursor].index;\n }\n return -1;\n}\n/**\n * Whether or not the given typeahead instaance state is currently typing.\n *\n * @param state The typeahead state instance. See `initState`.\n */\nexport function isTypingInProgress(state) {\n return state.typeaheadBuffer.length > 0;\n}\n/**\n * Clears the typeahaed buffer so that it resets item matching to the first\n * character.\n *\n * @param state The typeahead state instance. See `initState`.\n */\nexport function clearBuffer(state) {\n state.typeaheadBuffer = '';\n}\n/**\n * Given a keydown event, it calculates whether or not to automatically focus a\n * list item depending on what was typed mimicing the typeahead functionality of\n * a standard \n
\n \n \n \n
\n
\n ${this.renderRipple()}\n `;\n }\n setFormData(formData) {\n if (this.name && this.checked) {\n formData.append(this.name, this.value);\n }\n }\n handleFocus() {\n this.focused = true;\n this.handleRippleFocus();\n }\n handleBlur() {\n this.focused = false;\n this.handleRippleBlur();\n }\n handleRippleMouseDown(event) {\n const onUp = () => {\n window.removeEventListener('mouseup', onUp);\n this.handleRippleDeactivate();\n };\n window.addEventListener('mouseup', onUp);\n this.rippleHandlers.startPress(event);\n }\n handleRippleTouchStart(event) {\n this.rippleHandlers.startPress(event);\n }\n handleRippleDeactivate() {\n this.rippleHandlers.endPress();\n }\n handleRippleMouseEnter() {\n this.rippleHandlers.startHover();\n }\n handleRippleMouseLeave() {\n this.rippleHandlers.endHover();\n }\n handleRippleFocus() {\n this.rippleHandlers.startFocus();\n }\n handleRippleBlur() {\n this.rippleHandlers.endFocus();\n }\n handleChange() {\n this.checked = this.formElement.checked;\n this.indeterminate = this.formElement.indeterminate;\n }\n resetAnimationClass() {\n this.animationClass = '';\n }\n get isRippleActive() {\n var _a;\n return ((_a = this.rippleElement) === null || _a === void 0 ? void 0 : _a.isActive) || false;\n }\n}\n__decorate([\n query('.mdc-checkbox')\n], CheckboxBase.prototype, \"mdcRoot\", void 0);\n__decorate([\n query('input')\n], CheckboxBase.prototype, \"formElement\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true })\n], CheckboxBase.prototype, \"checked\", void 0);\n__decorate([\n property({ type: Boolean })\n], CheckboxBase.prototype, \"indeterminate\", void 0);\n__decorate([\n property({ type: Boolean, reflect: true })\n], CheckboxBase.prototype, \"disabled\", void 0);\n__decorate([\n property({ type: String, reflect: true })\n], CheckboxBase.prototype, \"name\", void 0);\n__decorate([\n property({ type: String })\n], CheckboxBase.prototype, \"value\", void 0);\n__decorate([\n ariaProperty,\n property({ type: String, attribute: 'aria-label' })\n], CheckboxBase.prototype, \"ariaLabel\", void 0);\n__decorate([\n ariaProperty,\n property({ type: String, attribute: 'aria-labelledby' })\n], CheckboxBase.prototype, \"ariaLabelledBy\", void 0);\n__decorate([\n ariaProperty,\n property({ type: String, attribute: 'aria-describedby' })\n], CheckboxBase.prototype, \"ariaDescribedBy\", void 0);\n__decorate([\n property({ type: Boolean })\n], CheckboxBase.prototype, \"reducedTouchTarget\", void 0);\n__decorate([\n state()\n], CheckboxBase.prototype, \"animationClass\", void 0);\n__decorate([\n state()\n], CheckboxBase.prototype, \"shouldRenderRipple\", void 0);\n__decorate([\n state()\n], CheckboxBase.prototype, \"focused\", void 0);\n__decorate([\n queryAsync('mwc-ripple')\n], CheckboxBase.prototype, \"ripple\", void 0);\n__decorate([\n eventOptions({ passive: true })\n], CheckboxBase.prototype, \"handleRippleTouchStart\", null);\n//# sourceMappingURL=mwc-checkbox-base.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-LIcense-Identifier: Apache-2.0\n */\nimport { css } from 'lit';\nexport const styles = css `.mdc-checkbox{padding:calc((40px - 18px) / 2);padding:calc((var(--mdc-checkbox-ripple-size, 40px) - 18px) / 2);margin:calc((40px - 40px) / 2);margin:calc((var(--mdc-checkbox-touch-target-size, 40px) - 40px) / 2)}.mdc-checkbox .mdc-checkbox__ripple::before,.mdc-checkbox .mdc-checkbox__ripple::after{background-color:#000;background-color:var(--mdc-ripple-color, #000)}.mdc-checkbox:hover .mdc-checkbox__ripple::before,.mdc-checkbox.mdc-ripple-surface--hover .mdc-checkbox__ripple::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-checkbox.mdc-ripple-upgraded--background-focused .mdc-checkbox__ripple::before,.mdc-checkbox:not(.mdc-ripple-upgraded):focus .mdc-checkbox__ripple::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-checkbox:not(.mdc-ripple-upgraded) .mdc-checkbox__ripple::after{transition:opacity 150ms linear}.mdc-checkbox:not(.mdc-ripple-upgraded):active .mdc-checkbox__ripple::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-checkbox.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-checkbox.mdc-checkbox--selected .mdc-checkbox__ripple::before,.mdc-checkbox.mdc-checkbox--selected .mdc-checkbox__ripple::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-checkbox.mdc-checkbox--selected:hover .mdc-checkbox__ripple::before,.mdc-checkbox.mdc-checkbox--selected.mdc-ripple-surface--hover .mdc-checkbox__ripple::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-checkbox.mdc-checkbox--selected.mdc-ripple-upgraded--background-focused .mdc-checkbox__ripple::before,.mdc-checkbox.mdc-checkbox--selected:not(.mdc-ripple-upgraded):focus .mdc-checkbox__ripple::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-checkbox.mdc-checkbox--selected:not(.mdc-ripple-upgraded) .mdc-checkbox__ripple::after{transition:opacity 150ms linear}.mdc-checkbox.mdc-checkbox--selected:not(.mdc-ripple-upgraded):active .mdc-checkbox__ripple::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-checkbox.mdc-checkbox--selected.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-checkbox.mdc-ripple-upgraded--background-focused.mdc-checkbox--selected .mdc-checkbox__ripple::before,.mdc-checkbox.mdc-ripple-upgraded--background-focused.mdc-checkbox--selected .mdc-checkbox__ripple::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-checkbox .mdc-checkbox__background{top:calc((40px - 18px) / 2);top:calc((var(--mdc-checkbox-ripple-size, 40px) - 18px) / 2);left:calc((40px - 18px) / 2);left:calc((var(--mdc-checkbox-ripple-size, 40px) - 18px) / 2)}.mdc-checkbox .mdc-checkbox__native-control{top:calc((40px - 40px) / 2);top:calc((40px - var(--mdc-checkbox-touch-target-size, 40px)) / 2);right:calc((40px - 40px) / 2);right:calc((40px - var(--mdc-checkbox-touch-target-size, 40px)) / 2);left:calc((40px - 40px) / 2);left:calc((40px - var(--mdc-checkbox-touch-target-size, 40px)) / 2);width:40px;width:var(--mdc-checkbox-touch-target-size, 40px);height:40px;height:var(--mdc-checkbox-touch-target-size, 40px)}.mdc-checkbox .mdc-checkbox__native-control:enabled:not(:checked):not(:indeterminate):not([data-indeterminate=true])~.mdc-checkbox__background{border-color:rgba(0, 0, 0, 0.54);border-color:var(--mdc-checkbox-unchecked-color, rgba(0, 0, 0, 0.54));background-color:transparent}.mdc-checkbox .mdc-checkbox__native-control:enabled:checked~.mdc-checkbox__background,.mdc-checkbox .mdc-checkbox__native-control:enabled:indeterminate~.mdc-checkbox__background,.mdc-checkbox .mdc-checkbox__native-control[data-indeterminate=true]:enabled~.mdc-checkbox__background{border-color:#018786;border-color:var(--mdc-checkbox-checked-color, var(--mdc-theme-secondary, #018786));background-color:#018786;background-color:var(--mdc-checkbox-checked-color, var(--mdc-theme-secondary, #018786))}@keyframes mdc-checkbox-fade-in-background-8A000000FF01878600000000FF018786{0%{border-color:rgba(0, 0, 0, 0.54);border-color:var(--mdc-checkbox-unchecked-color, rgba(0, 0, 0, 0.54));background-color:transparent}50%{border-color:#018786;border-color:var(--mdc-checkbox-checked-color, var(--mdc-theme-secondary, #018786));background-color:#018786;background-color:var(--mdc-checkbox-checked-color, var(--mdc-theme-secondary, #018786))}}@keyframes mdc-checkbox-fade-out-background-8A000000FF01878600000000FF018786{0%,80%{border-color:#018786;border-color:var(--mdc-checkbox-checked-color, var(--mdc-theme-secondary, #018786));background-color:#018786;background-color:var(--mdc-checkbox-checked-color, var(--mdc-theme-secondary, #018786))}100%{border-color:rgba(0, 0, 0, 0.54);border-color:var(--mdc-checkbox-unchecked-color, rgba(0, 0, 0, 0.54));background-color:transparent}}.mdc-checkbox.mdc-checkbox--anim-unchecked-checked .mdc-checkbox__native-control:enabled~.mdc-checkbox__background,.mdc-checkbox.mdc-checkbox--anim-unchecked-indeterminate .mdc-checkbox__native-control:enabled~.mdc-checkbox__background{animation-name:mdc-checkbox-fade-in-background-8A000000FF01878600000000FF018786}.mdc-checkbox.mdc-checkbox--anim-checked-unchecked .mdc-checkbox__native-control:enabled~.mdc-checkbox__background,.mdc-checkbox.mdc-checkbox--anim-indeterminate-unchecked .mdc-checkbox__native-control:enabled~.mdc-checkbox__background{animation-name:mdc-checkbox-fade-out-background-8A000000FF01878600000000FF018786}.mdc-checkbox .mdc-checkbox__native-control[disabled]:not(:checked):not(:indeterminate):not([data-indeterminate=true])~.mdc-checkbox__background{border-color:rgba(0, 0, 0, 0.38);border-color:var(--mdc-checkbox-disabled-color, rgba(0, 0, 0, 0.38));background-color:transparent}.mdc-checkbox .mdc-checkbox__native-control[disabled]:checked~.mdc-checkbox__background,.mdc-checkbox .mdc-checkbox__native-control[disabled]:indeterminate~.mdc-checkbox__background,.mdc-checkbox .mdc-checkbox__native-control[data-indeterminate=true][disabled]~.mdc-checkbox__background{border-color:transparent;background-color:rgba(0, 0, 0, 0.38);background-color:var(--mdc-checkbox-disabled-color, rgba(0, 0, 0, 0.38))}.mdc-checkbox .mdc-checkbox__native-control:enabled~.mdc-checkbox__background .mdc-checkbox__checkmark{color:#fff;color:var(--mdc-checkbox-ink-color, #fff)}.mdc-checkbox .mdc-checkbox__native-control:enabled~.mdc-checkbox__background .mdc-checkbox__mixedmark{border-color:#fff;border-color:var(--mdc-checkbox-ink-color, #fff)}.mdc-checkbox .mdc-checkbox__native-control:disabled~.mdc-checkbox__background .mdc-checkbox__checkmark{color:#fff;color:var(--mdc-checkbox-ink-color, #fff)}.mdc-checkbox .mdc-checkbox__native-control:disabled~.mdc-checkbox__background .mdc-checkbox__mixedmark{border-color:#fff;border-color:var(--mdc-checkbox-ink-color, #fff)}.mdc-touch-target-wrapper{display:inline}@keyframes mdc-checkbox-unchecked-checked-checkmark-path{0%,50%{stroke-dashoffset:29.7833385}50%{animation-timing-function:cubic-bezier(0, 0, 0.2, 1)}100%{stroke-dashoffset:0}}@keyframes mdc-checkbox-unchecked-indeterminate-mixedmark{0%,68.2%{transform:scaleX(0)}68.2%{animation-timing-function:cubic-bezier(0, 0, 0, 1)}100%{transform:scaleX(1)}}@keyframes mdc-checkbox-checked-unchecked-checkmark-path{from{animation-timing-function:cubic-bezier(0.4, 0, 1, 1);opacity:1;stroke-dashoffset:0}to{opacity:0;stroke-dashoffset:-29.7833385}}@keyframes mdc-checkbox-checked-indeterminate-checkmark{from{animation-timing-function:cubic-bezier(0, 0, 0.2, 1);transform:rotate(0deg);opacity:1}to{transform:rotate(45deg);opacity:0}}@keyframes mdc-checkbox-indeterminate-checked-checkmark{from{animation-timing-function:cubic-bezier(0.14, 0, 0, 1);transform:rotate(45deg);opacity:0}to{transform:rotate(360deg);opacity:1}}@keyframes mdc-checkbox-checked-indeterminate-mixedmark{from{animation-timing-function:mdc-animation-deceleration-curve-timing-function;transform:rotate(-45deg);opacity:0}to{transform:rotate(0deg);opacity:1}}@keyframes mdc-checkbox-indeterminate-checked-mixedmark{from{animation-timing-function:cubic-bezier(0.14, 0, 0, 1);transform:rotate(0deg);opacity:1}to{transform:rotate(315deg);opacity:0}}@keyframes mdc-checkbox-indeterminate-unchecked-mixedmark{0%{animation-timing-function:linear;transform:scaleX(1);opacity:1}32.8%,100%{transform:scaleX(0);opacity:0}}.mdc-checkbox{display:inline-block;position:relative;flex:0 0 18px;box-sizing:content-box;width:18px;height:18px;line-height:0;white-space:nowrap;cursor:pointer;vertical-align:bottom}.mdc-checkbox.mdc-ripple-upgraded--background-focused .mdc-checkbox__focus-ring,.mdc-checkbox:not(.mdc-ripple-upgraded):focus .mdc-checkbox__focus-ring{pointer-events:none;border:2px solid transparent;border-radius:6px;box-sizing:content-box;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);height:100%;width:100%}@media screen and (forced-colors: active){.mdc-checkbox.mdc-ripple-upgraded--background-focused .mdc-checkbox__focus-ring,.mdc-checkbox:not(.mdc-ripple-upgraded):focus .mdc-checkbox__focus-ring{border-color:CanvasText}}.mdc-checkbox.mdc-ripple-upgraded--background-focused .mdc-checkbox__focus-ring::after,.mdc-checkbox:not(.mdc-ripple-upgraded):focus .mdc-checkbox__focus-ring::after{content:\"\";border:2px solid transparent;border-radius:8px;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);height:calc(100% + 4px);width:calc(100% + 4px)}@media screen and (forced-colors: active){.mdc-checkbox.mdc-ripple-upgraded--background-focused .mdc-checkbox__focus-ring::after,.mdc-checkbox:not(.mdc-ripple-upgraded):focus .mdc-checkbox__focus-ring::after{border-color:CanvasText}}@media all and (-ms-high-contrast: none){.mdc-checkbox .mdc-checkbox__focus-ring{display:none}}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-checkbox__mixedmark{margin:0 1px}}.mdc-checkbox--disabled{cursor:default;pointer-events:none}.mdc-checkbox__background{display:inline-flex;position:absolute;align-items:center;justify-content:center;box-sizing:border-box;width:18px;height:18px;border:2px solid currentColor;border-radius:2px;background-color:transparent;pointer-events:none;will-change:background-color,border-color;transition:background-color 90ms 0ms cubic-bezier(0.4, 0, 0.6, 1),border-color 90ms 0ms cubic-bezier(0.4, 0, 0.6, 1)}.mdc-checkbox__checkmark{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;opacity:0;transition:opacity 180ms 0ms cubic-bezier(0.4, 0, 0.6, 1)}.mdc-checkbox--upgraded .mdc-checkbox__checkmark{opacity:1}.mdc-checkbox__checkmark-path{transition:stroke-dashoffset 180ms 0ms cubic-bezier(0.4, 0, 0.6, 1);stroke:currentColor;stroke-width:3.12px;stroke-dashoffset:29.7833385;stroke-dasharray:29.7833385}.mdc-checkbox__mixedmark{width:100%;height:0;transform:scaleX(0) rotate(0deg);border-width:1px;border-style:solid;opacity:0;transition:opacity 90ms 0ms cubic-bezier(0.4, 0, 0.6, 1),transform 90ms 0ms cubic-bezier(0.4, 0, 0.6, 1)}.mdc-checkbox--anim-unchecked-checked .mdc-checkbox__background,.mdc-checkbox--anim-unchecked-indeterminate .mdc-checkbox__background,.mdc-checkbox--anim-checked-unchecked .mdc-checkbox__background,.mdc-checkbox--anim-indeterminate-unchecked .mdc-checkbox__background{animation-duration:180ms;animation-timing-function:linear}.mdc-checkbox--anim-unchecked-checked .mdc-checkbox__checkmark-path{animation:mdc-checkbox-unchecked-checked-checkmark-path 180ms linear 0s;transition:none}.mdc-checkbox--anim-unchecked-indeterminate .mdc-checkbox__mixedmark{animation:mdc-checkbox-unchecked-indeterminate-mixedmark 90ms linear 0s;transition:none}.mdc-checkbox--anim-checked-unchecked .mdc-checkbox__checkmark-path{animation:mdc-checkbox-checked-unchecked-checkmark-path 90ms linear 0s;transition:none}.mdc-checkbox--anim-checked-indeterminate .mdc-checkbox__checkmark{animation:mdc-checkbox-checked-indeterminate-checkmark 90ms linear 0s;transition:none}.mdc-checkbox--anim-checked-indeterminate .mdc-checkbox__mixedmark{animation:mdc-checkbox-checked-indeterminate-mixedmark 90ms linear 0s;transition:none}.mdc-checkbox--anim-indeterminate-checked .mdc-checkbox__checkmark{animation:mdc-checkbox-indeterminate-checked-checkmark 500ms linear 0s;transition:none}.mdc-checkbox--anim-indeterminate-checked .mdc-checkbox__mixedmark{animation:mdc-checkbox-indeterminate-checked-mixedmark 500ms linear 0s;transition:none}.mdc-checkbox--anim-indeterminate-unchecked .mdc-checkbox__mixedmark{animation:mdc-checkbox-indeterminate-unchecked-mixedmark 300ms linear 0s;transition:none}.mdc-checkbox__native-control:checked~.mdc-checkbox__background,.mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background,.mdc-checkbox__native-control[data-indeterminate=true]~.mdc-checkbox__background{transition:border-color 90ms 0ms cubic-bezier(0, 0, 0.2, 1),background-color 90ms 0ms cubic-bezier(0, 0, 0.2, 1)}.mdc-checkbox__native-control:checked~.mdc-checkbox__background .mdc-checkbox__checkmark-path,.mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background .mdc-checkbox__checkmark-path,.mdc-checkbox__native-control[data-indeterminate=true]~.mdc-checkbox__background .mdc-checkbox__checkmark-path{stroke-dashoffset:0}.mdc-checkbox__native-control{position:absolute;margin:0;padding:0;opacity:0;cursor:inherit}.mdc-checkbox__native-control:disabled{cursor:default;pointer-events:none}.mdc-checkbox--touch{margin:calc((48px - 40px) / 2);margin:calc((var(--mdc-checkbox-state-layer-size, 48px) - var(--mdc-checkbox-state-layer-size, 40px)) / 2)}.mdc-checkbox--touch .mdc-checkbox__native-control{top:calc((40px - 48px) / 2);top:calc((var(--mdc-checkbox-state-layer-size, 40px) - var(--mdc-checkbox-state-layer-size, 48px)) / 2);right:calc((40px - 48px) / 2);right:calc((var(--mdc-checkbox-state-layer-size, 40px) - var(--mdc-checkbox-state-layer-size, 48px)) / 2);left:calc((40px - 48px) / 2);left:calc((var(--mdc-checkbox-state-layer-size, 40px) - var(--mdc-checkbox-state-layer-size, 48px)) / 2);width:48px;width:var(--mdc-checkbox-state-layer-size, 48px);height:48px;height:var(--mdc-checkbox-state-layer-size, 48px)}.mdc-checkbox__native-control:checked~.mdc-checkbox__background .mdc-checkbox__checkmark{transition:opacity 180ms 0ms cubic-bezier(0, 0, 0.2, 1),transform 180ms 0ms cubic-bezier(0, 0, 0.2, 1);opacity:1}.mdc-checkbox__native-control:checked~.mdc-checkbox__background .mdc-checkbox__mixedmark{transform:scaleX(1) rotate(-45deg)}.mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background .mdc-checkbox__checkmark,.mdc-checkbox__native-control[data-indeterminate=true]~.mdc-checkbox__background .mdc-checkbox__checkmark{transform:rotate(45deg);opacity:0;transition:opacity 90ms 0ms cubic-bezier(0.4, 0, 0.6, 1),transform 90ms 0ms cubic-bezier(0.4, 0, 0.6, 1)}.mdc-checkbox__native-control:indeterminate~.mdc-checkbox__background .mdc-checkbox__mixedmark,.mdc-checkbox__native-control[data-indeterminate=true]~.mdc-checkbox__background .mdc-checkbox__mixedmark{transform:scaleX(1) rotate(0deg);opacity:1}.mdc-checkbox.mdc-checkbox--upgraded .mdc-checkbox__background,.mdc-checkbox.mdc-checkbox--upgraded .mdc-checkbox__checkmark,.mdc-checkbox.mdc-checkbox--upgraded .mdc-checkbox__checkmark-path,.mdc-checkbox.mdc-checkbox--upgraded .mdc-checkbox__mixedmark{transition:none}:host{outline:none;display:inline-flex;-webkit-tap-highlight-color:transparent}:host([checked]),:host([indeterminate]){--mdc-ripple-color:var(--mdc-theme-secondary, #018786)}.mdc-checkbox .mdc-checkbox__background::before{content:none}`;\n//# sourceMappingURL=mwc-checkbox.css.js.map","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { customElement } from 'lit/decorators.js';\nimport { CheckboxBase } from './mwc-checkbox-base.js';\nimport { styles } from './mwc-checkbox.css.js';\n/** @soyCompatible */\nlet Checkbox = class Checkbox extends CheckboxBase {\n};\nCheckbox.styles = [styles];\nCheckbox = __decorate([\n customElement('mwc-checkbox')\n], Checkbox);\nexport { Checkbox };\n//# sourceMappingURL=mwc-checkbox.js.map","import { customElement, property, query, state } from 'lit/decorators.js';\n\nimport '@material/mwc-formfield';\nimport '@material/mwc-switch';\nimport '@material/mwc-checkbox';\nimport type { Checkbox } from '@material/mwc-checkbox';\nimport type { Switch } from '@material/mwc-switch';\nimport { html, LitElement } from 'lit';\n\n/** A potentially `nullable` labelled checkbox. */\n@customElement('scl-checkbox')\nexport class SclCheckbox extends LitElement {\n @property({ type: String })\n label = '';\n\n /** Parenthetical information rendered after the label: `label (helper)` */\n @property({ type: String })\n helper = '';\n\n /** Whether [[`maybeValue`]] may be `null` */\n @property({ type: Boolean })\n nullable = false;\n\n /** The default `checked` state while [[`maybeValue`]] is `null`. */\n @property({ type: Boolean })\n defaultChecked = false;\n\n /** Is `\"true\"` when checked, `\"false\"` un-checked, `null` if [[`nullable`]]. */\n @property({ type: String })\n get maybeValue(): string | null {\n // eslint-disable-next-line no-nested-ternary\n return this.null ? null : this.checked ? 'true' : 'false';\n }\n\n set maybeValue(check: string | null) {\n if (check === null) this.null = true;\n else {\n this.null = false;\n this.checked = check === 'true';\n }\n }\n\n /** Disables component including null switch */\n @property({ type: Boolean })\n disabled = false;\n\n private isNull = false;\n\n @state()\n private get null(): boolean {\n return this.nullable && this.isNull;\n }\n\n private set null(value: boolean) {\n if (!this.nullable || value === this.isNull) return;\n this.isNull = value;\n if (this.null) this.disable();\n else this.enable();\n }\n\n private initChecked = false;\n\n @state()\n get checked(): boolean {\n return this.checkbox?.checked ?? this.initChecked;\n }\n\n set checked(value: boolean) {\n if (this.checkbox) this.checkbox.checked = value;\n else this.initChecked = value;\n }\n\n @state()\n private deactivateCheckbox = false;\n\n @state()\n get formfieldLabel(): string {\n return this.helper ? `${this.helper} (${this.label})` : this.label;\n }\n\n @query('mwc-switch') nullSwitch?: Switch;\n\n @query('mwc-checkbox') checkbox?: Checkbox;\n\n // eslint-disable-next-line class-methods-use-this\n checkValidity(): boolean {\n return true;\n }\n\n private nulled: boolean | null = null;\n\n private enable(): void {\n if (this.nulled === null) return;\n this.checked = this.nulled;\n this.nulled = null;\n this.deactivateCheckbox = false;\n }\n\n private disable(): void {\n if (this.nulled !== null) return;\n this.nulled = this.checked;\n this.checked = this.defaultChecked;\n this.deactivateCheckbox = true;\n }\n\n firstUpdated(): void {\n this.requestUpdate();\n }\n\n renderSwitch() {\n if (this.nullable) {\n return html` {\n this.null = !this.nullSwitch!.selected;\n this.dispatchEvent(new Event('input'));\n }}\n >`;\n }\n return html``;\n }\n\n render() {\n return html`\n
\n
\n this.dispatchEvent(new Event('input'))}\n >\n
\n
\n ${this.renderSwitch()}\n
\n
\n `;\n }\n}\n","const nameStartChar =\n '[:_A-Za-z]|[\\u00C0-\\u00D6]|[\\u00D8-\\u00F6]|[\\u00F8-\\u02FF]|[\\u0370-\\u037D]' +\n '|[\\u037F-\\u1FFF]|[\\u200C-\\u200D]|[\\u2070-\\u218F]|[\\u2C00-\\u2FEF]' +\n '|[\\u3001-\\uD7FF]|[\\uF900-\\uFDCF]|[\\uFDF0-\\uFFFD]';\nconst nameChar = `${nameStartChar}|[.0-9\\\\-]|\\u00B7|[\\u0300-\\u036F]|[\\u203F-\\u2040]`;\nconst name = `${nameStartChar}(${nameChar})*`;\nconst nmToken = `(${nameChar})+`;\n\nexport const patterns = {\n string:\n '([\\u0009-\\u000A]|[\\u000D]|[\\u0020-\\u007E]|[\\u0085]|[\\u00A0-\\uD7FF]' +\n '|[\\uE000-\\uFFFD])*',\n normalizedString:\n '([\\u0020-\\u007E]|[\\u0085]|[\\u00A0-\\uD7FF]|[\\uE000-\\uFFFD])*',\n name,\n nmToken,\n names: `${name}( ${name})*`,\n nmTokens: `${nmToken}( ${nmToken})*`,\n decimal: '[+\\\\-]?[0-9]+(([.][0-9]*)?|([.][0-9]+))',\n unsigned: '[+]?[0-9]+(([.][0-9]*)?|([.][0-9]+))',\n integer: '[+\\\\-]?[0-9]+([0-9]*)',\n alphanumericFirstUpperCase: '[A-Z][0-9,A-Z,a-z]*',\n alphanumericFirstLowerCase: '[a-z][0-9,A-Z,a-z]*',\n lnClass: '(LLN0)|[A-Z]{4,4}',\n abstractDataAttributeName:\n '((T)|(Test)|(Check)|(SIUnit)|(Oper)|(SBO)|(SBOw)|(Cancel)|[a-z][0-9A-Za-z]*)',\n cdc:\n '(SPS)|(DPS)|(INS)|(ENS)|(ACT)|(ACD)|(SEC)|(BCR)|(HST)|(VSS)|(MV)|(CMV)|(SAV)|' +\n '(WYE)|(DEL)|(SEQ)|(HMV)|(HWYE)|(HDEL)|(SPC)|(DPC)|(INC)|(ENC)|(BSC)|(ISC)|(APC)|(BAC)|' +\n '(SPG)|(ING)|(ENG)|(ORG)|(TSG)|(CUG)|(VSG)|(ASG)|(CURVE)|(CSG)|(DPL)|(LPL)|(CSD)|(CST)|' +\n '(BTS)|(UTS)|(LTS)|(GTS)|(MTS)|(NTS)|(STS)|(CTS)|(OTS)|(VSD)',\n};\n\nexport const maxLength = {\n cbName: 32,\n abstracDaName: 60,\n};\n\nexport const predefinedBasicTypeEnum = [\n 'BOOLEAN',\n 'INT8',\n 'INT16',\n 'INT24',\n 'INT32',\n 'INT64',\n 'INT128',\n 'INT8U',\n 'INT16U',\n 'INT24U',\n 'INT32U',\n 'FLOAT32',\n 'FLOAT64',\n 'Enum',\n 'Dbpos',\n 'Tcmd',\n 'Quality',\n 'Timestamp',\n 'VisString32',\n 'VisString64',\n 'VisString65',\n 'VisString129',\n 'VisString255',\n 'Octet64',\n 'Unicode255',\n 'Struct',\n 'EntryTime',\n 'Check',\n 'ObjRef',\n 'Currency',\n 'PhyComAddr',\n 'TrgOps',\n 'OptFlds',\n 'SvOptFlds',\n 'LogOptFlds',\n 'EntryID',\n 'Octet6',\n 'Octet16',\n];\n\nexport const valKindEnum = ['Spec', 'Conf', 'RO', 'Set'];\n\nexport const functionalConstraintEnum = [\n 'ST',\n 'MX',\n 'SP',\n 'SV',\n 'CF',\n 'DC',\n 'SG',\n 'SE',\n 'SR',\n 'OR',\n 'BL',\n 'EX',\n 'CO',\n];\n","/* eslint-disable import/no-extraneous-dependencies */\nimport { TemplateResult, html, render } from 'lit';\n\nimport { Edit } from '@openscd/open-scd-core';\n\nimport '@material/mwc-list/mwc-list-item';\nimport type { ListItem } from '@material/mwc-list/mwc-list-item';\nimport { SelectedEvent } from '@material/mwc-list/mwc-list-foundation';\n\nimport '../../foundation/components/scl-textfield.js';\nimport '../../foundation/components/scl-select.js';\nimport '../../foundation/components/scl-checkbox.js';\nimport type { SclSelect } from '../../foundation/components/scl-select.js';\nimport type { SclTextfield } from '../../foundation/components/scl-textfield.js';\n\nimport { createElement } from '../foundation.js';\nimport {\n maxLength,\n patterns,\n predefinedBasicTypeEnum,\n valKindEnum,\n} from './patterns.js';\nimport { getReference } from '../../foundation/utils/scldata.js';\n\nfunction selectType(e: SelectedEvent, data: Element, Val: string | null): void {\n if (!e.target || !(e.target as SclSelect).parentElement) return;\n\n const typeSelected = (e.target).selected?.value;\n const selectedBType = ((\n (e.target).parentElement!.querySelector(\n 'scl-select[label=\"bType\"]'\n )!\n )).value;\n\n if (selectedBType !== 'Enum') return;\n\n const enumVals = Array.from(\n data.querySelectorAll(`EnumType[id=\"${typeSelected}\"] > EnumVal`)\n ).map(\n enumval =>\n html`${enumval.textContent?.trim()}`\n );\n\n const selectValOptionUI = (\n (e.target).parentElement!.querySelector(\n 'scl-select[label=\"Val\"]'\n )!\n );\n render(html`${enumVals}`, selectValOptionUI);\n selectValOptionUI.requestUpdate();\n}\n\nfunction selectBType(\n e: SelectedEvent,\n bType: string | null,\n type: string | null\n): void {\n const bTypeSelected = (e.target).selected!.value;\n\n const typeUI = (\n (e.target).parentElement!.querySelector(\n 'scl-select[label=\"type\"]'\n )!\n );\n typeUI.disabled = !(bTypeSelected === 'Enum' || bTypeSelected === 'Struct');\n const enabledItems: ListItem[] = [];\n Array.from(typeUI.children).forEach(child => {\n const childItem = child;\n childItem.disabled = !child.classList.contains(bTypeSelected);\n childItem.noninteractive = !child.classList.contains(bTypeSelected);\n childItem.style.display = !child.classList.contains(bTypeSelected)\n ? 'none'\n : '';\n if (!childItem.disabled) enabledItems.push(childItem);\n });\n if (type && bType === bTypeSelected) typeUI.value = type;\n else typeUI.value = enabledItems.length ? enabledItems[0].value : '';\n\n const selectValOptionUI = (\n (e.target).parentElement!.querySelector(\n 'scl-select[label=\"Val\"]'\n )!\n );\n if (bTypeSelected === 'Enum') selectValOptionUI.style.display = '';\n else selectValOptionUI.style.display = 'none';\n\n const textfieldValOptionUI = (\n (e.target).parentElement!.querySelector(\n 'scl-textfield[label=\"Val\"]'\n )!\n );\n if (bTypeSelected === 'Enum' || bTypeSelected === 'Struct')\n textfieldValOptionUI.style.display = 'none';\n else textfieldValOptionUI.style.display = '';\n\n selectValOptionUI.requestUpdate();\n textfieldValOptionUI.requestUpdate();\n typeUI.requestUpdate();\n}\n\nexport function renderAbstractDataAttributeContent(\n name: string | null,\n desc: string | null,\n bType: string,\n types: Element[],\n type: string | null,\n sAddr: string | null,\n valKind: string | null,\n valImport: string | null,\n Val: string | null,\n data: Element\n): TemplateResult[] {\n return [\n html`\n >`,\n html``,\n html` selectBType(e, bType, type)}\n >${predefinedBasicTypeEnum.map(\n redefinedBType =>\n html`${redefinedBType}`\n )}`,\n html` selectType(e, data, Val)}\n >${types.map(\n dataType =>\n html`${dataType.id}`\n )}`,\n html``,\n html`${valKindEnum.map(\n valKindOption =>\n html`${valKindOption}`\n )}`,\n html``,\n html`${Array.from(\n data.querySelectorAll(`EnumType > EnumVal[id=\"${type}\"]`)\n ).map(\n enumVal =>\n html`${enumVal.textContent?.trim()}`\n )}`,\n html``,\n ];\n}\n\nexport function getValAction(\n oldVal: Element | null,\n Val: string | null,\n abstractda: Element\n): Edit[] {\n if (oldVal === null) {\n const element = createElement(abstractda.ownerDocument, 'Val', {});\n element.textContent = Val;\n return [\n {\n parent: abstractda,\n node: element,\n reference: abstractda.firstElementChild,\n },\n ];\n }\n\n if (Val === null) return [{ node: oldVal }];\n\n const newVal = oldVal.cloneNode(false);\n newVal.textContent = Val;\n return [\n {\n parent: oldVal.parentElement!,\n node: newVal,\n reference: getReference(oldVal.parentElement!, 'Val'),\n },\n { node: oldVal },\n ];\n}\n","/* eslint-disable import/no-extraneous-dependencies */\n\nimport { Edit } from '@openscd/open-scd-core';\n\nimport {\n createElement,\n getValue,\n isPublic,\n Wizard,\n WizardActor,\n WizardInputElement,\n} from '../foundation.js';\nimport {\n getValAction,\n renderAbstractDataAttributeContent,\n} from './abstractda.js';\nimport { getReference } from '../../foundation/utils/scldata.js';\n\nfunction createBDaAction(parent: Element): WizardActor {\n return (inputs: WizardInputElement[]): Edit[] => {\n const name = getValue(inputs.find(i => i.label === 'name')!)!;\n const desc = getValue(inputs.find(i => i.label === 'desc')!);\n const bType = getValue(inputs.find(i => i.label === 'bType')!)!;\n const type =\n bType === 'Enum' || bType === 'Struct'\n ? getValue(inputs.find(i => i.label === 'type')!)\n : null;\n const sAddr = getValue(inputs.find(i => i.label === 'sAddr')!);\n const valKind =\n getValue(inputs.find(i => i.label === 'valKind')!) !== ''\n ? getValue(inputs.find(i => i.label === 'valKind')!)\n : null;\n const valImport =\n getValue(inputs.find(i => i.label === 'valImport')!) !== ''\n ? getValue(inputs.find(i => i.label === 'valImport')!)\n : null;\n\n const valField = inputs.find(\n i => i.label === 'Val' && i.style.display !== 'none'\n );\n const Val = valField ? getValue(valField) : null;\n\n const element = createElement(parent.ownerDocument, 'BDA', {\n name,\n desc,\n bType,\n type,\n sAddr,\n valKind,\n valImport,\n });\n\n if (Val !== null) {\n const valElement = createElement(parent.ownerDocument, 'Val', {});\n valElement.textContent = Val;\n element.appendChild(valElement);\n }\n\n return [\n {\n parent,\n node: element,\n reference: getReference(parent, 'BDA'),\n },\n ];\n };\n}\n\nexport function createBDaWizard(element: Element): Wizard {\n const doc = element.ownerDocument;\n\n const name = '';\n const desc = null;\n const bType = '';\n const type = null;\n const sAddr = null;\n const Val = null;\n const valKind = null;\n const valImport = null;\n\n const doOrEnumTypes = Array.from(\n doc.querySelectorAll('DAType, EnumType')\n ).filter(doOrEnumType => doOrEnumType.getAttribute('id'));\n\n const data = element.closest('DataTypeTemplates')!;\n\n return [\n {\n title: 'Add BDA',\n primary: {\n icon: '',\n label: 'save',\n action: createBDaAction(element),\n },\n content: [\n ...renderAbstractDataAttributeContent(\n name,\n desc,\n bType,\n doOrEnumTypes,\n type,\n sAddr,\n valKind,\n valImport,\n Val,\n data\n ),\n ],\n },\n ];\n}\n\nfunction updateBDaAction(element: Element): WizardActor {\n return (inputs: WizardInputElement[]): Edit[] => {\n const name = getValue(inputs.find(i => i.label === 'name')!)!;\n const desc = getValue(inputs.find(i => i.label === 'desc')!);\n const bType = getValue(inputs.find(i => i.label === 'bType')!)!;\n const type =\n bType === 'Enum' || bType === 'Struct'\n ? getValue(inputs.find(i => i.label === 'type')!)\n : null;\n const sAddr = getValue(inputs.find(i => i.label === 'sAddr')!);\n const valKind = getValue(inputs.find(i => i.label === 'valKind')!);\n const valImport = getValue(inputs.find(i => i.label === 'valImport')!);\n const valField = inputs.find(\n i => i.label === 'Val' && i.style.display !== 'none'\n );\n const Val = valField ? getValue(valField) : null;\n\n let bdaAction: Edit | null;\n const valAction: Edit = [];\n\n if (\n name === element.getAttribute('name') &&\n desc === element.getAttribute('desc') &&\n bType === element.getAttribute('bType') &&\n type === element.getAttribute('type') &&\n sAddr === element.getAttribute('sAddr') &&\n valKind === element.getAttribute('valKind') &&\n valImport === element.getAttribute('valImprot')\n ) {\n bdaAction = null;\n } else {\n bdaAction = {\n element,\n attributes: {\n name,\n desc,\n bType,\n type,\n sAddr,\n valKind,\n valImport,\n },\n };\n }\n\n if (Val !== (element.querySelector('Val')?.textContent?.trim() ?? null)) {\n valAction.push(\n getValAction(\n element.querySelector('Val'),\n Val,\n bdaAction?.element ?? element\n )\n );\n }\n\n const actions: Edit[] = [];\n if (bdaAction) actions.push(bdaAction);\n if (valAction) actions.push(...valAction);\n return actions;\n };\n}\n\nexport function editBDaWizard(element: Element): Wizard {\n const doc = element.ownerDocument;\n const type = element.getAttribute('type');\n const name = element.getAttribute('name');\n const desc = element.getAttribute('desc');\n const bType = element.getAttribute('bType') ?? '';\n const sAddr = element.getAttribute('sAddr');\n const Val = element.querySelector('Val')?.innerHTML.trim() ?? null;\n const valKind = element.getAttribute('valKind');\n const valImport = element.getAttribute('valImport');\n\n const daOrEnumTypes = Array.from(doc.querySelectorAll('DAType, EnumType'))\n .filter(isPublic)\n .filter(daOrEnumType => daOrEnumType.getAttribute('id'));\n\n const data = element.closest('DataTypeTemplates')!;\n\n return [\n {\n title: 'Edit BDA',\n primary: {\n icon: '',\n label: 'save',\n action: updateBDaAction(element),\n },\n content: [\n ...renderAbstractDataAttributeContent(\n name,\n desc,\n bType,\n daOrEnumTypes,\n type,\n sAddr,\n valKind,\n valImport,\n Val,\n data\n ),\n ],\n },\n ];\n}\n","/* eslint-disable import/no-extraneous-dependencies */\nimport { html, TemplateResult } from 'lit';\n\nimport '@material/mwc-list/mwc-list-item';\nimport '@material/mwc-select';\n\nimport '../../foundation/components/scl-textfield.js';\nimport { Edit } from '@openscd/open-scd-core';\n\nimport {\n createElement,\n crossProduct,\n getValue,\n reservedNames,\n Wizard,\n WizardActor,\n WizardInputElement,\n} from '../foundation.js';\nimport { getReference } from '../../foundation/utils/scldata.js';\n\nconst types: Partial> = {\n // standard\n CBR: 'Circuit Breaker',\n DIS: 'Disconnector',\n // custom\n ERS: 'Earth Switch',\n CTR: 'Current Transformer',\n VTR: 'Voltage Transformer',\n AXN: 'Auxiliary Network',\n BAT: 'Battery',\n BSH: 'Bushing',\n CAP: 'Capacitor Bank',\n CON: 'Converter',\n EFN: 'Earth Fault Neutralizer',\n FAN: 'Fan',\n GIL: 'Gas Insulated Line',\n GEN: 'Generator',\n IFL: 'Infeeding Line',\n MOT: 'Motor',\n RES: 'Neutral Resistor',\n REA: 'Reactor',\n PSH: 'Power Shunt',\n CAB: 'Power Cable',\n PMP: 'Pump',\n LIN: 'Power Overhead Line',\n RRC: 'Rotating Reactive Component',\n SCR: 'Semiconductor Controlled Rectifier',\n SAR: 'Surge Arrester',\n SMC: 'Synchronous Machine',\n TCF: 'Thyristor Controlled Frequency Converter',\n TCR: 'Thyristor Controlled Reactive Component',\n};\n\nfunction getLogicalNodeInstance(lNode: Element | null): Element | null {\n if (!lNode) return null;\n const [lnInst, lnClass, iedName, ldInst, prefix] = [\n 'lnInst',\n 'lnClass',\n 'iedName',\n 'ldInst',\n 'prefix',\n ].map(attribute => lNode?.getAttribute(attribute));\n const iedSelector = [`IED[name=\"${iedName}\"]`, 'IED'];\n const lDevicePath = ['AccessPoint > Server'];\n const lNSelector = [\n `LDevice[inst=\"${ldInst}\"] > LN[inst=\"${lnInst}\"][lnClass=\"${lnClass}\"]`,\n ];\n const lNPrefixSelector =\n prefix && prefix !== ''\n ? [`[prefix=\"${prefix}\"]`]\n : ['[prefix=\"\"]', ':not(prefix)'];\n return lNode.ownerDocument.querySelector(\n crossProduct(\n iedSelector,\n [' > '],\n lDevicePath,\n [' > '],\n lNSelector,\n lNPrefixSelector\n )\n .map(strings => strings.join(''))\n .join(',')\n );\n}\n\nfunction getSwitchTypeValueFromDTT(lNorlNode: Element): string | undefined {\n const rootNode = lNorlNode?.ownerDocument;\n const lNodeType = lNorlNode.getAttribute('lnType');\n const lnClass = lNorlNode.getAttribute('lnClass');\n const dObj = rootNode.querySelector(\n `DataTypeTemplates > LNodeType[id=\"${lNodeType}\"][lnClass=\"${lnClass}\"] > DO[name=\"SwTyp\"]`\n );\n if (dObj) {\n const dORef = dObj.getAttribute('type');\n return rootNode\n .querySelector(\n `DataTypeTemplates > DOType[id=\"${dORef}\"] > DA[name=\"stVal\"] > Val`\n )\n ?.innerHTML.trim();\n }\n\n return undefined;\n}\n\nfunction getSwitchTypeValue(lN: Element): string | undefined {\n const daInstantiated = lN.querySelector(\n 'DOI[name=\"SwTyp\"] > DAI[name=\"stVal\"]'\n );\n\n if (daInstantiated)\n return daInstantiated.querySelector('Val')?.innerHTML.trim();\n\n return getSwitchTypeValueFromDTT(lN);\n}\n\nfunction containsGroundedTerminal(condEq: Element): boolean {\n return Array.from(condEq.querySelectorAll('Terminal')).some(\n t => t.getAttribute('cNodeName') === 'grounded'\n );\n}\n\nfunction containsEarthSwitchDefinition(condEq: Element): boolean {\n const lNodeXSWI = condEq.querySelector('LNode[lnClass=\"XSWI\"]');\n const lN = getLogicalNodeInstance(lNodeXSWI);\n let swTypVal;\n if (lN) {\n swTypVal = getSwitchTypeValue(lN);\n } else if (lNodeXSWI) {\n swTypVal = getSwitchTypeValueFromDTT(lNodeXSWI);\n }\n return swTypVal\n ? ['Earthing Switch', 'High Speed Earthing Switch'].includes(swTypVal)\n : false;\n}\n\nfunction typeStr(condEq: Element): string {\n if (\n condEq.getAttribute('type') === 'DIS' &&\n (containsGroundedTerminal(condEq) || containsEarthSwitchDefinition(condEq))\n ) {\n return 'ERS';\n }\n\n return condEq.getAttribute('type') ?? '';\n}\n\nfunction typeName(condEq: Element): string {\n return types[typeStr(condEq)] ?? 'Unknown Type';\n}\n\nfunction renderTypeSelector(\n option: 'edit' | 'create',\n type: string\n): TemplateResult {\n return option === 'create'\n ? html`\n ${Object.keys(types).map(\n v => html`${types[v]}`\n )}\n `\n : html`\n ${type}\n `;\n}\n\ntype RenderOptions = {\n name: string | null;\n desc: string | null;\n option: 'edit' | 'create';\n type: string;\n reservedValues: string[];\n};\n\nfunction renderConductingEquipmentWizard(\n options: RenderOptions\n): TemplateResult[] {\n return [\n renderTypeSelector(options.option, options.type),\n html``,\n html``,\n ];\n}\n\nfunction createAction(parent: Element): WizardActor {\n return (inputs: WizardInputElement[]): Edit[] => {\n const name = getValue(inputs.find(i => i.label === 'name')!);\n const desc = getValue(inputs.find(i => i.label === 'desc')!);\n const proxyType = getValue(inputs.find(i => i.label === 'type')!);\n const type = proxyType === 'ERS' ? 'DIS' : proxyType;\n\n const element = createElement(parent.ownerDocument, 'ConductingEquipment', {\n name,\n type,\n desc,\n });\n const action = {\n parent,\n node: element,\n reference: getReference(parent, 'ConductingEquipment'),\n };\n\n if (proxyType !== 'ERS') return [action];\n\n const groundNode = parent\n .closest('VoltageLevel')\n ?.querySelector('ConnectivityNode[name=\"grounded\"]');\n\n const substationName = groundNode\n ? groundNode.closest('Substation')?.getAttribute('name') ?? null\n : parent.closest('Substation')?.getAttribute('name') ?? null;\n const voltageLevelName = groundNode\n ? groundNode.closest('VoltageLevel')?.getAttribute('name') ?? null\n : parent.closest('VoltageLevel')?.getAttribute('name') ?? null;\n const bayName = groundNode\n ? groundNode.closest('Bay')?.getAttribute('name') ?? null\n : parent.closest('Bay')?.getAttribute('name') ?? null;\n const connectivityNode =\n bayName && voltageLevelName && substationName\n ? `${substationName}/${voltageLevelName}/${bayName}/grounded`\n : null;\n\n const groundTerminal = createElement(parent.ownerDocument, 'Terminal', {\n name: 'T1',\n cNodeName: 'grounded',\n substationName,\n voltageLevelName,\n bayName,\n connectivityNode,\n });\n\n const terminalAction = {\n parent: element,\n node: groundTerminal,\n reference: getReference(element, 'Terminal'),\n };\n if (groundNode) return [action, terminalAction];\n\n const cNodeElement = createElement(\n parent.ownerDocument,\n 'ConnectivityNode',\n {\n name: 'grounded',\n pathName: connectivityNode,\n }\n );\n\n const cNodeAction = {\n parent,\n node: cNodeElement,\n reference: getReference(parent, 'ConnectivityNode'),\n };\n return [action, terminalAction, cNodeAction];\n };\n}\n\nexport function createConductingEquipmentWizard(parent: Element): Wizard {\n return [\n {\n title: 'Add ConductingEquipment',\n primary: {\n icon: 'add',\n label: 'add',\n action: createAction(parent),\n },\n content: renderConductingEquipmentWizard({\n name: '',\n desc: '',\n option: 'create',\n type: '',\n reservedValues: reservedNames(parent, 'ConductingEquipment'),\n }),\n },\n ];\n}\n\nfunction updateAction(element: Element): WizardActor {\n return (inputs: WizardInputElement[]): Edit[] => {\n const name = getValue(inputs.find(i => i.label === 'name')!)!;\n const desc = getValue(inputs.find(i => i.label === 'desc')!);\n\n if (\n name === element.getAttribute('name') &&\n desc === element.getAttribute('desc')\n ) {\n return [];\n }\n\n return [{ element, attributes: { name, desc } }];\n };\n}\n\nexport function editConductingEquipmentWizard(element: Element): Wizard {\n return [\n {\n title: 'Edit ConductingEquipment',\n primary: {\n icon: 'edit',\n label: 'save',\n action: updateAction(element),\n },\n content: renderConductingEquipmentWizard({\n name: element.getAttribute('name'),\n desc: element.getAttribute('desc'),\n option: 'edit',\n type: typeName(element),\n reservedValues: reservedNames(element),\n }),\n },\n ];\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport '@material/mwc-checkbox/mwc-checkbox.js';\nimport { html } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ListItemBase } from './mwc-list-item-base.js';\nexport class CheckListItemBase extends ListItemBase {\n constructor() {\n super(...arguments);\n this.left = false;\n this.graphic = 'control';\n }\n render() {\n const checkboxClasses = {\n 'mdc-deprecated-list-item__graphic': this.left,\n 'mdc-deprecated-list-item__meta': !this.left,\n };\n const text = this.renderText();\n const graphic = this.graphic && this.graphic !== 'control' && !this.left ?\n this.renderGraphic() :\n html ``;\n const meta = this.hasMeta && this.left ? this.renderMeta() : html ``;\n const ripple = this.renderRipple();\n return html `\n ${ripple}\n ${graphic}\n ${this.left ? '' : text}\n \n \n \n \n ${this.left ? text : ''}\n ${meta}`;\n }\n async onChange(evt) {\n const checkbox = evt.target;\n const changeFromProp = this.selected === checkbox.checked;\n if (!changeFromProp) {\n this._skipPropRequest = true;\n this.selected = checkbox.checked;\n await this.updateComplete;\n this._skipPropRequest = false;\n }\n }\n}\n__decorate([\n query('slot')\n], CheckListItemBase.prototype, \"slotElement\", void 0);\n__decorate([\n query('mwc-checkbox')\n], CheckListItemBase.prototype, \"checkboxElement\", void 0);\n__decorate([\n property({ type: Boolean })\n], CheckListItemBase.prototype, \"left\", void 0);\n__decorate([\n property({ type: String, reflect: true })\n], CheckListItemBase.prototype, \"graphic\", void 0);\n//# sourceMappingURL=mwc-check-list-item-base.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-LIcense-Identifier: Apache-2.0\n */\nimport { css } from 'lit';\nexport const styles = css `:host(:not([twoline])){height:56px}:host(:not([left])) .mdc-deprecated-list-item__meta{height:40px;width:40px}`;\n//# sourceMappingURL=mwc-control-list-item.css.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { __decorate } from \"tslib\";\n// Style preference for leading underscores.\n// tslint:disable:strip-private-property-underscore\nimport { customElement } from 'lit/decorators.js';\nimport { CheckListItemBase } from './mwc-check-list-item-base.js';\nimport { styles as controlStyle } from './mwc-control-list-item.css.js';\nimport { styles } from './mwc-list-item.css.js';\nlet CheckListItem = class CheckListItem extends CheckListItemBase {\n};\nCheckListItem.styles = [styles, controlStyle];\nCheckListItem = __decorate([\n customElement('mwc-check-list-item')\n], CheckListItem);\nexport { CheckListItem };\n//# sourceMappingURL=mwc-check-list-item.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n window.customElements.polyfillWrapFlushCallback !==\n undefined;\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes = (container, start, end = null, before = null) => {\n while (start !== end) {\n const n = start.nextSibling;\n container.insertBefore(start, before);\n start = n;\n }\n};\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes = (container, start, end = null) => {\n while (start !== end) {\n const n = start.nextSibling;\n container.removeChild(start);\n start = n;\n }\n};\n//# sourceMappingURL=dom.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = ``;\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n constructor(result, element) {\n this.parts = [];\n this.element = element;\n const nodesToRemove = [];\n const stack = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(element.content, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const { strings, values: { length } } = result;\n while (partIndex < length) {\n const node = walker.nextNode();\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n continue;\n }\n index++;\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if (node.hasAttributes()) {\n const attributes = node.attributes;\n const { length } = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)[2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName = name.toLowerCase() + boundAttributeSuffix;\n const attributeValue = node.getAttribute(attributeLookupName);\n node.removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({ type: 'attribute', index, name, strings: statics });\n partIndex += statics.length - 1;\n }\n }\n if (node.tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n }\n else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = node.data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n }\n else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({ type: 'node', index: ++index });\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n }\n else {\n node.data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n }\n else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if (node.data === marker) {\n const parent = node.parentNode;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({ type: 'node', index });\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n node.data = '';\n }\n else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n }\n else {\n let i = -1;\n while ((i = node.data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({ type: 'node', index: -1 });\n partIndex++;\n }\n }\n }\n }\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode.removeChild(n);\n }\n }\n}\nconst endsWith = (str, suffix) => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\nexport const isTemplatePartActive = (part) => part.index !== -1;\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex = \n// eslint-disable-next-line no-control-regex\n/([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n//# sourceMappingURL=template.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { isTemplatePartActive } from './template.js';\nconst walkerNodeFilter = 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */;\n/**\n * Removes the list of nodes from a Template safely. In addition to removing\n * nodes from the Template, the Template part indices are updated to match\n * the mutated Template DOM.\n *\n * As the template is walked the removal state is tracked and\n * part indices are adjusted as needed.\n *\n * div\n * div#1 (remove) <-- start removing (removing node is div#1)\n * div\n * div#2 (remove) <-- continue removing (removing node is still div#1)\n * div\n * div <-- stop removing since previous sibling is the removing node (div#1,\n * removed 4 nodes)\n */\nexport function removeNodesFromTemplate(template, nodesToRemove) {\n const { element: { content }, parts } = template;\n const walker = document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let part = parts[partIndex];\n let nodeIndex = -1;\n let removeCount = 0;\n const nodesToRemoveInTemplate = [];\n let currentRemovingNode = null;\n while (walker.nextNode()) {\n nodeIndex++;\n const node = walker.currentNode;\n // End removal if stepped past the removing node\n if (node.previousSibling === currentRemovingNode) {\n currentRemovingNode = null;\n }\n // A node to remove was found in the template\n if (nodesToRemove.has(node)) {\n nodesToRemoveInTemplate.push(node);\n // Track node we're removing\n if (currentRemovingNode === null) {\n currentRemovingNode = node;\n }\n }\n // When removing, increment count by which to adjust subsequent part indices\n if (currentRemovingNode !== null) {\n removeCount++;\n }\n while (part !== undefined && part.index === nodeIndex) {\n // If part is in a removed node deactivate it by setting index to -1 or\n // adjust the index as needed.\n part.index = currentRemovingNode !== null ? -1 : part.index - removeCount;\n // go to the next active part.\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n part = parts[partIndex];\n }\n }\n nodesToRemoveInTemplate.forEach((n) => n.parentNode.removeChild(n));\n}\nconst countNodes = (node) => {\n let count = (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */) ? 0 : 1;\n const walker = document.createTreeWalker(node, walkerNodeFilter, null, false);\n while (walker.nextNode()) {\n count++;\n }\n return count;\n};\nconst nextActiveIndexInTemplateParts = (parts, startIndex = -1) => {\n for (let i = startIndex + 1; i < parts.length; i++) {\n const part = parts[i];\n if (isTemplatePartActive(part)) {\n return i;\n }\n }\n return -1;\n};\n/**\n * Inserts the given node into the Template, optionally before the given\n * refNode. In addition to inserting the node into the Template, the Template\n * part indices are updated to match the mutated Template DOM.\n */\nexport function insertNodeIntoTemplate(template, node, refNode = null) {\n const { element: { content }, parts } = template;\n // If there's no refNode, then put node at end of template.\n // No part indices need to be shifted in this case.\n if (refNode === null || refNode === undefined) {\n content.appendChild(node);\n return;\n }\n const walker = document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let insertCount = 0;\n let walkerIndex = -1;\n while (walker.nextNode()) {\n walkerIndex++;\n const walkerNode = walker.currentNode;\n if (walkerNode === refNode) {\n insertCount = countNodes(node);\n refNode.parentNode.insertBefore(node, refNode);\n }\n while (partIndex !== -1 && parts[partIndex].index === walkerIndex) {\n // If we've inserted the node, simply adjust all subsequent parts\n if (insertCount > 0) {\n while (partIndex !== -1) {\n parts[partIndex].index += insertCount;\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n return;\n }\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n }\n}\n//# sourceMappingURL=modify-template.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nconst directives = new WeakMap();\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`
    <${repeat(items, (item) => html`
  • ${item}
  • `)}
`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = (f) => ((...args) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n});\nexport const isDirective = (o) => {\n return typeof o === 'function' && directives.has(o);\n};\n//# sourceMappingURL=directive.js.map","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n//# sourceMappingURL=part.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { isCEPolyfill } from './dom.js';\nimport { isTemplatePartActive } from './template.js';\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n constructor(template, processor, options) {\n this.__parts = [];\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n update(values) {\n let i = 0;\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n _clone() {\n // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) :\n document.importNode(this.template.element.content, true);\n const stack = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(fragment, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node.nodeName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n node = walker.nextNode();\n }\n }\n // We've arrived at our part's node.\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node.previousSibling);\n this.__parts.push(part);\n }\n else {\n this.__parts.push(...this.processor.handleAttributeExpressions(node, part.name, part.strings, this.options));\n }\n partIndex++;\n }\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n//# sourceMappingURL=template-instance.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * @module lit-html\n */\nimport { reparentNodes } from './dom.js';\nimport { boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker } from './template.js';\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n trustedTypes.createPolicy('lit-html', { createHTML: (s) => s });\nconst commentMarker = ` ${marker} `;\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n constructor(strings, values, type, processor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n /**\n * Returns a string of HTML used to create a `