Your IP : 216.73.217.154


Current Path : /home/ereika83/public_html/wp-content/plugins/microthemer/js-min/ace/
Upload File :
Current File : /home/ereika83/public_html/wp-content/plugins/microthemer/js-min/ace/ext-emmet.js

ace.define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"],function(e,o,t){"use strict";var n=e("./lib/dom"),i=e("./lib/oop"),r=e("./lib/event_emitter").EventEmitter,h=e("./lib/lang"),u=e("./range").Range,l=e("./range_list").RangeList,s=e("./keyboard/hash_handler").HashHandler,a=e("./tokenizer").Tokenizer,c=e("./clipboard"),p={CURRENT_WORD:function(e){return e.session.getTextRange(e.session.getWordRange())},SELECTION:function(e,t,n){e=e.session.getTextRange();return n?e.replace(/\n\r?([ \t]*\S)/g,"\n"+n+"$1"):e},CURRENT_LINE:function(e){return e.session.getLine(e.getCursorPosition().row)},PREV_LINE:function(e){return e.session.getLine(e.getCursorPosition().row-1)},LINE_INDEX:function(e){return e.getCursorPosition().row},LINE_NUMBER:function(e){return e.getCursorPosition().row+1},SOFT_TABS:function(e){return e.session.getUseSoftTabs()?"YES":"NO"},TAB_SIZE:function(e){return e.session.getTabSize()},CLIPBOARD:function(e){return c.getText&&c.getText()},FILENAME:function(e){return/[^/\\]*$/.exec(this.FILEPATH(e))[0]},FILENAME_BASE:function(e){return/[^/\\]*$/.exec(this.FILEPATH(e))[0].replace(/\.[^.]*$/,"")},DIRECTORY:function(e){return this.FILEPATH(e).replace(/[^/\\]*$/,"")},FILEPATH:function(e){return"/not implemented.txt"},WORKSPACE_NAME:function(){return"Unknown"},FULLNAME:function(){return"Unknown"},BLOCK_COMMENT_START:function(e){e=e.session.$mode||{};return e.blockComment&&e.blockComment.start||""},BLOCK_COMMENT_END:function(e){e=e.session.$mode||{};return e.blockComment&&e.blockComment.end||""},LINE_COMMENT:function(e){return(e.session.$mode||{}).lineCommentStart||""},CURRENT_YEAR:d.bind(null,{year:"numeric"}),CURRENT_YEAR_SHORT:d.bind(null,{year:"2-digit"}),CURRENT_MONTH:d.bind(null,{month:"numeric"}),CURRENT_MONTH_NAME:d.bind(null,{month:"long"}),CURRENT_MONTH_NAME_SHORT:d.bind(null,{month:"short"}),CURRENT_DATE:d.bind(null,{day:"2-digit"}),CURRENT_DAY_NAME:d.bind(null,{weekday:"long"}),CURRENT_DAY_NAME_SHORT:d.bind(null,{weekday:"short"}),CURRENT_HOUR:d.bind(null,{hour:"2-digit",hour12:!1}),CURRENT_MINUTE:d.bind(null,{minute:"2-digit"}),CURRENT_SECOND:d.bind(null,{second:"2-digit"})};function d(e){e=(new Date).toLocaleString("en-us",e);return 1==e.length?"0"+e:e}p.SELECTED_TEXT=p.SELECTION;function g(){this.snippetMap={},this.snippetNameMap={}}!function(){i.implement(this,r),this.getTokenizer=function(){return g.$tokenizer||this.createTokenizer()},this.createTokenizer=function(){function i(e){return e=e.substr(1),/^\d+$/.test(e)?[{tabstopId:parseInt(e,10)}]:[{text:e}]}function e(e){return"(?:[^\\\\"+e+"]|\\\\.)"}var t={regex:"/("+e("/")+"+)/",onMatch:function(e,t,n){n=n[0];return n.fmtString=!0,n.guard=e.slice(1,-1),n.flag=""},next:"formatString"};return g.$tokenizer=new a({start:[{regex:/\\./,onMatch:function(e,t,n){var i=e[1];return[e="}"==i&&n.length||-1!="`$\\".indexOf(i)?i:e]}},{regex:/}/,onMatch:function(e,t,n){return[n.length?n.shift():e]}},{regex:/\$(?:\d+|\w+)/,onMatch:i},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(e,t,n){e=i(e.substr(1));return n.unshift(e[0]),e},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+e("\\|")+"*\\|",onMatch:function(e,t,n){e=e.slice(1,-1).replace(/\\[,|\\]|,/g,function(e){return 2==e.length?e[1]:"\0"}).split("\0").map(function(e){return{value:e}});return[(n[0].choices=e)[0]]},next:"start"},t,{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:/:/,onMatch:function(e,t,n){return n.length&&n[0].expectElse?(n[0].expectElse=!1,n[0].ifEnd={elseEnd:n[0]},[n[0].ifEnd]):":"}},{regex:/\\./,onMatch:function(e,t,n){var i=e[1];return"}"==i&&n.length||-1!="`$\\".indexOf(i)?e=i:"n"==i?e="\n":"t"==i?e="\t":-1!="ulULE".indexOf(i)&&(e={changeCase:i,local:"a"<i}),[e]}},{regex:"/\\w*}",onMatch:function(e,t,n){n=n.shift();return n&&(n.flag=e.slice(1,-1)),this.next=n&&n.tabstopId?"start":"",[n||e]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(e,t,n){return[{text:e.slice(1)}]}},{regex:/\${\w+/,onMatch:function(e,t,n){e={text:e.slice(2)};return n.unshift(e),[e]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(e,t,n){n=n.shift();return this.next=n&&n.tabstopId?"start":"",[n||e]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(e,t,n){return n[0].formatFunction=e.slice(2,-1),[n.shift()]},next:"formatString"},t,{regex:/:[\?\-+]?/,onMatch:function(e,t,n){"+"==e[1]&&(n[0].ifEnd=n[0]),"?"==e[1]&&(n[0].expectElse=!0)},next:"formatString"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"formatString"}]})},this.tokenizeTmSnippet=function(e,t){return this.getTokenizer().getLineTokens(e,t).tokens.map(function(e){return e.value||e})},this.getVariableValue=function(e,t,n){if(/^\d+$/.test(t))return(this.variables.__||{})[t]||"";if(/^[A-Z]\d+$/.test(t))return(this.variables[t[0]+"__"]||{})[t.substr(1)]||"";if(t=t.replace(/^TM_/,""),!this.variables.hasOwnProperty(t))return"";var i=this.variables[t];return null==(i="function"==typeof i?this.variables[t](e,t,n):i)?"":i},this.variables=p,this.tmStrFormat=function(e,t,o){if(!t.fmt)return e;var n=t.flag||"",i=t.guard,i=new RegExp(i,n.replace(/[^gim]/g,"")),a="string"==typeof t.fmt?this.tokenizeTmSnippet(t.fmt,"formatString"):t.fmt,c=this;return e.replace(i,function(){var e=c.variables.__;c.variables.__=[].slice.call(arguments);for(var t=c.resolveVariables(a,o),n="E",i=0;i<t.length;i++){var r,s=t[i];"object"==typeof s?(t[i]="",s.changeCase&&s.local?(r=t[i+1])&&"string"==typeof r&&("u"==s.changeCase?t[i]=r[0].toUpperCase():t[i]=r[0].toLowerCase(),t[i+1]=r.substr(1)):s.changeCase&&(n=s.changeCase)):"U"==n?t[i]=s.toUpperCase():"L"==n&&(t[i]=s.toLowerCase())}return c.variables.__=e,t.join("")})},this.tmFormatFunction=function(e,t,n){return"upcase"==t.formatFunction?e.toUpperCase():"downcase"==t.formatFunction?e.toLowerCase():e},this.resolveVariables=function(t,e){for(var n=[],i="",r=!0,s=0;s<t.length;s++){var o,a=t[s];"string"!=typeof a?a&&(r=!1,a.fmtString&&(-1==(o=t.indexOf(a,s+1))&&(o=t.length),a.fmt=t.slice(s+1,o),s=o),a.text?(o=this.getVariableValue(e,a.text,i)+"",a.fmtString&&(o=this.tmStrFormat(o,a,e)),(o=a.formatFunction?this.tmFormatFunction(o,a,e):o)&&!a.ifEnd?(n.push(o),c(a)):!o&&a.ifEnd&&c(a.ifEnd)):a.elseEnd?c(a.elseEnd):null==a.tabstopId&&null==a.changeCase||n.push(a)):(n.push(a),"\n"==a?(r=!0,i=""):r&&(i=/^\t*/.exec(a)[0],r=/\S/.test(a)))}function c(e){e=t.indexOf(e,s+1);-1!=e&&(s=e)}return n},this.insertSnippetForSelection=function(e,t){var n=e.getCursorPosition(),i=e.session.getLine(n.row),r=e.session.getTabString(),s=i.match(/^\s*/)[0];n.column<s.length&&(s=s.slice(0,n.column)),t=t.replace(/\r/g,"");var o=this.tokenizeTmSnippet(t);o=(o=this.resolveVariables(o,e)).map(function(e){return"\n"==e?e+s:"string"==typeof e?e.replace(/\t/g,r):e});var a=[];o.forEach(function(e,t){var n,i;"object"==typeof e&&(n=e.tabstopId,(i=a[n])||((i=a[n]=[]).index=n,i.value="",i.parents={}),-1===i.indexOf(e)&&(e.choices&&!i.choices&&(i.choices=e.choices),i.push(e),-1!==(e=o.indexOf(e,t+1))&&((e=o.slice(t+1,e)).some(function(e){return"object"==typeof e})&&!i.value?i.value=e:!e.length||i.value&&"string"==typeof i.value||(i.value=e.join("")))))}),a.forEach(function(e){e.length=0});var c={};for(var h=0;h<o.length;h++){var u,l,p,d=o[h];"object"==typeof d&&(p=d.tabstopId,u=a[p],l=o.indexOf(d,h+1),c[p]?c[p]===d&&(delete c[p],Object.keys(c).forEach(function(e){u.parents[e]=!0})):(c[p]=d,"string"!=typeof(p=u.value)?p=function(e){for(var t=[],n=0;n<e.length;n++){if("object"==typeof(i=e[n])){if(c[i.tabstopId])continue;var i=t[e.lastIndexOf(i,n-1)]||{tabstopId:i.tabstopId}}t[n]=i}return t}(p):d.fmt&&(p=this.tmStrFormat(p,d,e)),o.splice.apply(o,[h+1,Math.max(0,l-h)].concat(p,d)),-1===u.indexOf(d)&&u.push(d)))}var g=0,f=0,m="";o.forEach(function(e){var t;"string"==typeof e?(1<(t=e.split("\n")).length?(f=t[t.length-1].length,g+=t.length-1):f+=e.length,m+=e):e&&(e.start?e.end={row:g,column:f}:e.start={row:g,column:f})});var b=e.getSelectionRange(),i=e.session.replace(b,m),n=new x(e),t=e.inVirtualSelectionMode&&e.selection.index;n.addTabstops(a,b.start,i,t)},this.insertSnippet=function(e,t){var n=this;if(e.inVirtualSelectionMode)return n.insertSnippetForSelection(e,t);e.forEachSelection(function(){n.insertSnippetForSelection(e,t)},null,{keepOrder:!0}),e.tabstopManager&&e.tabstopManager.tabNext()},this.$getScope=function(e){var t,n=e.session.$mode.$id||"";return"html"!==(n=n.split("/").pop())&&"php"!==n||("php"!==n||e.session.$mode.inlinePhp||(n="html"),t=e.getCursorPosition(),(t="object"==typeof(t=e.session.getState(t.row))?t[0]:t).substring&&("js-"==t.substring(0,3)?n="javascript":"css-"==t.substring(0,4)?n="css":"php-"==t.substring(0,4)&&(n="php"))),n},this.getActiveScopes=function(e){var t=this.$getScope(e),n=[t],e=this.snippetMap;return e[t]&&e[t].includeScopes&&n.push.apply(n,e[t].includeScopes),n.push("_"),n},this.expandWithTab=function(e,t){var n=this,i=e.forEachSelection(function(){return n.expandSnippetForSelection(e,t)},null,{keepOrder:!0});return i&&e.tabstopManager&&e.tabstopManager.tabNext(),i},this.expandSnippetForSelection=function(e,t){var n,i=e.getCursorPosition(),r=e.session.getLine(i.row),s=r.substring(0,i.column),o=r.substr(i.column),a=this.snippetMap;return this.getActiveScopes(e).some(function(e){e=a[e];return!!(n=e?this.findMatchingSnippet(e,s,o):n)},this),!!n&&(!(!t||!t.dryRun)||(e.session.doc.removeInLine(i.row,i.column-n.replaceBefore.length,i.column+n.replaceAfter.length),this.variables.M__=n.matchBefore,this.variables.T__=n.matchAfter,this.insertSnippetForSelection(e,n.content),!(this.variables.M__=this.variables.T__=null)))},this.findMatchingSnippet=function(e,t,n){for(var i=e.length;i--;){var r=e[i];if((!r.startRe||r.startRe.test(t))&&((!r.endRe||r.endRe.test(n))&&(r.startRe||r.endRe)))return r.matchBefore=r.startRe?r.startRe.exec(t):[""],r.matchAfter=r.endRe?r.endRe.exec(n):[""],r.replaceBefore=r.triggerRe?r.triggerRe.exec(t)[0]:"",r.replaceAfter=r.endTriggerRe?r.endTriggerRe.exec(n)[0]:"",r}},this.snippetMap={},this.snippetNameMap={},this.register=function(t,i){var r=this.snippetMap,s=this.snippetNameMap,o=this;function a(e){return(e=e&&!/^\^?\(.*\)\$?$|^\\b$/.test(e)?"(?:"+e+")":e)||""}function c(e,t,n){return e=a(e),t=a(t),n?(e=t+e)&&"$"!=e[e.length-1]&&(e+="$"):(e+=t)&&"^"!=e[0]&&(e="^"+e),new RegExp(e)}function n(e){e.scope||(e.scope=i||"_"),i=e.scope,r[i]||(r[i]=[],s[i]={});var t,n=s[i];e.name&&((t=n[e.name])&&o.unregister(t),n[e.name]=e),r[i].push(e),e.prefix&&(e.tabTrigger=e.prefix),!e.content&&e.body&&(e.content=Array.isArray(e.body)?e.body.join("\n"):e.body),e.tabTrigger&&!e.trigger&&(!e.guard&&/^\w/.test(e.tabTrigger)&&(e.guard="\\b"),e.trigger=h.escapeRegExp(e.tabTrigger)),(e.trigger||e.guard||e.endTrigger||e.endGuard)&&(e.startRe=c(e.trigger,e.guard,!0),e.triggerRe=new RegExp(e.trigger),e.endRe=c(e.endTrigger,e.endGuard,!0),e.endTriggerRe=new RegExp(e.endTrigger))}t=t||[],Array.isArray(t)?t.forEach(n):Object.keys(t).forEach(function(e){n(t[e])}),this._signal("registerSnippets",{scope:i})},this.unregister=function(e,n){var i=this.snippetMap,r=this.snippetNameMap;function t(e){var t=r[e.scope||n];t&&t[e.name]&&(delete t[e.name],0<=(e=(t=i[e.scope||n])&&t.indexOf(e))&&t.splice(e,1))}e.content?t(e):Array.isArray(e)&&e.forEach(t)},this.parseSnippetFile=function(e){e=e.replace(/\r/g,"");for(var t,n,i,r=[],s={},o=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;i=o.exec(e);){if(i[1])try{s=JSON.parse(i[1]),r.push(s)}catch(e){}i[4]?(s.content=i[4].replace(/^\t/gm,""),r.push(s),s={}):(t=i[2],n=i[3],"regex"==t?(s.guard=(i=/\/((?:[^\/\\]|\\.)*)|$/g).exec(n)[1],s.trigger=i.exec(n)[1],s.endTrigger=i.exec(n)[1],s.endGuard=i.exec(n)[1]):"snippet"==t?(s.tabTrigger=n.match(/^\S*/)[0],s.name||(s.name=n)):t&&(s[t]=n))}return r},this.getSnippetByName=function(t,e){var n,i=this.snippetNameMap;return this.getActiveScopes(e).some(function(e){e=i[e];return!!(n=e?e[t]:n)},this),n}}.call(g.prototype);var x=function(e){if(e.tabstopManager)return e.tabstopManager;(e.tabstopManager=this).$onChange=this.onChange.bind(this),this.$onChangeSelection=h.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(e)};!function(){this.attach=function(e){this.index=0,this.ranges=[],this.tabstops=[],this.$openTabstops=null,this.selectedTabstop=null,this.editor=e,this.editor.on("change",this.$onChange),this.editor.on("changeSelection",this.$onChangeSelection),this.editor.on("changeSession",this.$onChangeSession),this.editor.commands.on("afterExec",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},this.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges=null,this.tabstops=null,this.selectedTabstop=null,this.editor.removeListener("change",this.$onChange),this.editor.removeListener("changeSelection",this.$onChangeSelection),this.editor.removeListener("changeSession",this.$onChangeSession),this.editor.commands.removeListener("afterExec",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.editor=null},this.onChange=function(e){for(var t="r"==e.action[0],n=this.selectedTabstop||{},i=n.parents||{},r=(this.tabstops||[]).slice(),s=0;s<r.length;s++){var o=r[s],a=o==n||i[o.index];if(o.rangeList.$bias=a?0:1,"remove"==e.action&&o!==n)for(var c=o.parents&&o.parents[n.index],a=(a=o.rangeList.pointIndex(e.start,c))<0?-a-1:a+1,c=o.rangeList.pointIndex(e.end,c),h=o.rangeList.ranges.slice(a,c=c<0?-c-1:c-1),u=0;u<h.length;u++)this.removeRange(h[u]);o.rangeList.$onChange(e)}var l=this.editor.session;this.$inChange||!t||1!=l.getLength()||l.getValue()||this.detach()},this.updateLinkedFields=function(){var e=this.selectedTabstop;if(e&&e.hasLinkedRanges&&e.firstNonLinked){this.$inChange=!0;for(var t=this.editor.session,n=t.getTextRange(e.firstNonLinked),i=0;i<e.length;i++){var r,s=e[i];s.linked&&(r=s.original,r=o.snippetManager.tmStrFormat(n,r,this.editor),t.replace(s,r))}this.$inChange=!1}},this.onAfterExec=function(e){e.command&&!e.command.readOnly&&this.updateLinkedFields()},this.onChangeSelection=function(){if(this.editor){for(var e=this.editor.selection.lead,t=this.editor.selection.anchor,n=this.editor.selection.isEmpty(),i=0;i<this.ranges.length;i++)if(!this.ranges[i].linked){var r=this.ranges[i].contains(e.row,e.column),s=n||this.ranges[i].contains(t.row,t.column);if(r&&s)return}this.detach()}},this.onChangeSession=function(){this.detach()},this.tabNext=function(e){var t=this.tabstops.length,e=this.index+(e||1),e=Math.min(Math.max(e,1),t);this.selectTabstop(e=e==t?0:e),0===e&&this.detach()},this.selectTabstop=function(e){this.$openTabstops=null;var t=this.tabstops[this.index];if(t&&this.addTabstopMarkers(t),this.index=e,(t=this.tabstops[this.index])&&t.length){e=(this.selectedTabstop=t).firstNonLinked||t;if(t.choices&&(e.cursor=e.start),this.editor.inVirtualSelectionMode)this.editor.selection.fromOrientedRange(e);else{var n=this.editor.multiSelect;n.toSingleRange(e);for(var i=0;i<t.length;i++)t.hasLinkedRanges&&t[i].linked||n.addRange(t[i].clone(),!0)}this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler),this.selectedTabstop&&this.selectedTabstop.choices&&this.editor.execCommand("startAutocomplete",{matches:this.selectedTabstop.choices})}},this.addTabstops=function(e,o,t){var a=this.useLink||!this.editor.getOption("enableMultiselect");this.$openTabstops||(this.$openTabstops=[]),e[0]||(t=u.fromPoints(t,t),m(t.start,o),m(t.end,o),e[0]=[t],e[0].index=0);var c=[this.index+1,0],h=this.ranges;e.forEach(function(e,t){for(var n=this.$openTabstops[t]||e,i=0;i<e.length;i++){var r=e[i],s=u.fromPoints(r.start,r.end||r.start);f(s.start,o),f(s.end,o),s.original=r,s.tabstop=n,h.push(s),n!=e?n.unshift(s):n[i]=s,r.fmtString||n.firstNonLinked&&a?(s.linked=!0,n.hasLinkedRanges=!0):n.firstNonLinked||(n.firstNonLinked=s)}n.firstNonLinked||(n.hasLinkedRanges=!1),n===e&&(c.push(n),this.$openTabstops[t]=n),this.addTabstopMarkers(n),n.rangeList=n.rangeList||new l,n.rangeList.$bias=0,n.rangeList.addList(n)},this),2<c.length&&(this.tabstops.length&&c.push(c.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,c))},this.addTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){e.markerId||(e.markerId=t.addMarker(e,"ace_snippet-marker","text"))})},this.removeTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){t.removeMarker(e.markerId),e.markerId=null})},this.removeRange=function(e){var t=e.tabstop.indexOf(e);-1!=t&&e.tabstop.splice(t,1),-1!=(t=this.ranges.indexOf(e))&&this.ranges.splice(t,1),-1!=(t=e.tabstop.rangeList.ranges.indexOf(e))&&e.tabstop.splice(t,1),this.editor.session.removeMarker(e.markerId),e.tabstop.length||(-1!=(t=this.tabstops.indexOf(e.tabstop))&&this.tabstops.splice(t,1),this.tabstops.length||this.detach())},this.keyboardHandler=new s,this.keyboardHandler.bindKeys({Tab:function(e){o.snippetManager&&o.snippetManager.expandWithTab(e)||(e.tabstopManager.tabNext(1),e.renderer.scrollCursorIntoView())},"Shift-Tab":function(e){e.tabstopManager.tabNext(-1),e.renderer.scrollCursorIntoView()},Esc:function(e){e.tabstopManager.detach()}})}.call(x.prototype);var f=function(e,t){0==e.row&&(e.column+=t.column),e.row+=t.row},m=function(e,t){e.row==t.row&&(e.column-=t.column),e.row-=t.row};n.importCssString(".ace_snippet-marker {    -moz-box-sizing: border-box;    box-sizing: border-box;    background: rgba(194, 193, 208, 0.09);    border: 1px dotted rgba(211, 208, 235, 0.62);    position: absolute;}","snippets.css",!1),o.snippetManager=new g;e=e("./editor").Editor;!function(){this.insertSnippet=function(e,t){return o.snippetManager.insertSnippet(this,e,t)},this.expandSnippet=function(e){return o.snippetManager.expandWithTab(this,e)}}.call(e.prototype)}),ace.define("ace/ext/emmet",["require","exports","module","ace/keyboard/hash_handler","ace/editor","ace/snippets","ace/range","ace/config","resources","resources","tabStops","resources","utils","actions"],function(e,s,t){"use strict";var c,n,i=e("../keyboard/hash_handler").HashHandler,r=e("../editor").Editor,o=e("../snippets").snippetManager,a=e("../range").Range,h=e("../config");function u(){}u.prototype={setupContext:function(e){this.ace=e,this.indentation=e.session.getTabString(),((c=c||window.emmet).resources||c.require("resources")).setVariable("indentation",this.indentation),this.$syntax=null,this.$syntax=this.getSyntax()},getSelectionRange:function(){var e=this.ace.getSelectionRange(),t=this.ace.session.doc;return{start:t.positionToIndex(e.start),end:t.positionToIndex(e.end)}},createSelection:function(e,t){var n=this.ace.session.doc;this.ace.selection.setRange({start:n.indexToPosition(e),end:n.indexToPosition(t)})},getCurrentLineRange:function(){var e=this.ace,t=e.getCursorPosition().row,n=e.session.getLine(t).length,t=e.session.doc.positionToIndex({row:t,column:0});return{start:t,end:t+n}},getCaretPos:function(){var e=this.ace.getCursorPosition();return this.ace.session.doc.positionToIndex(e)},setCaretPos:function(e){e=this.ace.session.doc.indexToPosition(e);this.ace.selection.moveToPosition(e)},getCurrentLine:function(){var e=this.ace.getCursorPosition().row;return this.ace.session.getLine(e)},replaceContent:function(e,t,n,i){null==n&&(n=null==t?this.getContent().length:t);var r=this.ace,s=r.session.doc,n=a.fromPoints(s.indexToPosition(t=null==t?0:t),s.indexToPosition(n));r.session.remove(n),n.end=n.start,e=this.$updateTabstops(e),o.insertSnippet(r,e)},getContent:function(){return this.ace.getValue()},getSyntax:function(){if(this.$syntax)return this.$syntax;var e,t=this.ace.session.$modeId.split("/").pop();return"html"!=t&&"php"!=t||(e=this.ace.getCursorPosition(),(e="string"!=typeof(e=this.ace.session.getState(e.row))?e[0]:e)&&(1<(e=e.split("-")).length?t=e[0]:"php"==t&&(t="html"))),t},getProfileName:function(){var e=c.resources||c.require("resources");switch(this.getSyntax()){case"css":return"css";case"xml":case"xsl":return"xml";case"html":return e.getVariable("profile")||(-1!=this.ace.session.getLines(0,2).join("").search(/<!DOCTYPE[^>]+XHTML/i)?"xhtml":"html");default:var t=this.ace.session.$mode;return t.emmetConfig&&t.emmetConfig.profile||"xhtml"}},prompt:function(e){return prompt(e)},getSelection:function(){return this.ace.session.getTextRange()},getFilePath:function(){return""},$updateTabstops:function(e){var r=0,s=null,o=c.tabStops||c.require("tabStops"),t=(c.resources||c.require("resources")).getVocabulary("user"),a={tabstop:function(e){var t=parseInt(e.group,10),n=0===t;n?t=++r:t+=1e3;var i=e.placeholder,i="${"+t+((i=i&&o.processText(i,a))?":"+i:"")+"}";return n&&(s=[e.start,i]),i},escape:function(e){return"$"==e?"\\$":"\\"==e?"\\\\":e}};return e=o.processText(e,a),t.variables.insert_final_tabstop&&!/\$\{0\}$/.test(e)?e+="${0}":s&&(e=(c.utils?c.utils.common:c.require("utils")).replaceSubstring(e,"${0}",s[0],s[1])),e}};var l,p={expand_abbreviation:{mac:"ctrl+alt+e",win:"alt+e"},match_pair_outward:{mac:"ctrl+d",win:"ctrl+,"},match_pair_inward:{mac:"ctrl+j",win:"ctrl+shift+0"},matching_pair:{mac:"ctrl+alt+j",win:"alt+j"},next_edit_point:"alt+right",prev_edit_point:"alt+left",toggle_comment:{mac:"command+/",win:"ctrl+/"},split_join_tag:{mac:"shift+command+'",win:"shift+ctrl+`"},remove_tag:{mac:"command+'",win:"shift+ctrl+;"},evaluate_math_expression:{mac:"shift+command+y",win:"shift+ctrl+y"},increment_number_by_1:"ctrl+up",decrement_number_by_1:"ctrl+down",increment_number_by_01:"alt+up",decrement_number_by_01:"alt+down",increment_number_by_10:{mac:"alt+command+up",win:"shift+alt+up"},decrement_number_by_10:{mac:"alt+command+down",win:"shift+alt+down"},select_next_item:{mac:"shift+command+.",win:"shift+ctrl+."},select_previous_item:{mac:"shift+command+,",win:"shift+ctrl+,"},reflect_css_value:{mac:"shift+command+r",win:"shift+ctrl+r"},encode_decode_data_url:{mac:"shift+ctrl+d",win:"ctrl+'"},expand_abbreviation_with_tab:"Tab",wrap_with_abbreviation:{mac:"shift+ctrl+a",win:"shift+ctrl+a"}},d=new u;for(l in s.commands=new i,s.runEmmetCommand=function t(n){if("expand_abbreviation_with_tab"==this.action){if(!n.selection.isEmpty())return!1;var i=n.selection.lead,i=n.session.getTokenAt(i.row,i.column);if(i&&/\btag\b/.test(i.type))return!1}try{d.setupContext(n);var e=c.actions||c.require("actions");if("wrap_with_abbreviation"==this.action)return setTimeout(function(){e.run("wrap_with_abbreviation",d)},0);var r=e.run(this.action,d)}catch(e){if(!c){i=s.load(t.bind(this,n));return"expand_abbreviation_with_tab"==this.action?!1:i}n._signal("changeStatus","string"==typeof e?e:e.message),h.warn(e),r=!1}return r},p)s.commands.addCommand({name:"emmet:"+l,action:l,bindKey:p[l],exec:s.runEmmetCommand,multiSelectAction:"forEach"});s.updateCommands=function(e,t){t?e.keyBinding.addKeyboardHandler(s.commands):e.keyBinding.removeKeyboardHandler(s.commands)},s.isSupportedMode=function(e){if(!e)return!1;if(e.emmetConfig)return!0;e=e.$id||e;return/css|less|scss|sass|stylus|html|php|twig|ejs|handlebars/.test(e)},s.isAvailable=function(e,t){if(/(evaluate_math_expression|expand_abbreviation)$/.test(t))return!0;var n=e.session.$mode,t=s.isSupportedMode(n);if(t&&n.$modes)try{d.setupContext(e),/js|php/.test(d.getSyntax())&&(t=!1)}catch(e){}return t};function g(e,t){var n=t;n&&(t=s.isSupportedMode(n.session.$mode),(t=!1===e.enableEmmet?!1:t)&&s.load(),s.updateCommands(n,t))}s.load=function(e){return"string"!=typeof n?(h.warn("script for emmet-core is not loaded"),!1):(h.loadModule(n,function(){n=null,e&&e()}),!0)},s.AceEmmetEditor=u,h.defineOptions(r.prototype,"editor",{enableEmmet:{set:function(e){this[e?"on":"removeListener"]("changeMode",g),g({enableEmmet:!!e},this)},value:!0}}),s.setCore=function(e){"string"==typeof e?n=e:c=e}}),ace.require(["ace/ext/emmet"],function(e){"object"==typeof module&&"object"==typeof exports&&module&&(module.exports=e)});