/*

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
     IBM Corporation - initial API and implementation
*/
(function(a,e){"function"===typeof define&&define.amd?define("orion/Deferred",e):"object"===typeof exports?module.exports=e():(a.orion=a.orion||{},a.orion.Deferred=e())})(this,function(){function a(){for(var a;a=v.shift();)a();t=!1}function e(a){v.push(a);t||(t=!0,w())}function k(a){return function(f){a(f)}}function p(){function a(){for(var b;b=l.shift();){var m=b.deferred,c="fulfilled"===d?"resolve":"reject";b=b[c];if("function"===typeof b)try{var g=b(n),f=g&&("object"===typeof g||"function"===typeof g)&&
g.then;if("function"===typeof f)if(g===m.promise)m.reject(new TypeError);else{var e=g.cancel;"function"===typeof e?m._parentCancel=e.bind(g):delete m._parentCancel;f.call(g,k(m.resolve),k(m.reject),k(m.progress))}else m.resolve(g)}catch(y){m.reject(y)}else m[c](n)}}function f(b){delete c._parentCancel;d="rejected";n=b;l.length&&e(a)}function u(b){function m(h){return function(b){(!d||"assumed"===d)&&h(b)}}delete c._parentCancel;try{var q=b&&("object"===typeof b||"function"===typeof b)&&b.then;if("function"===
typeof q)if(b===c)f(new TypeError);else{d="assumed";var g=b&&b.cancel;if("function"!==typeof g){var k=new p;b=k.promise;try{q(k.resolve,k.reject,k.progress)}catch(s){k.reject(s)}g=b.cancel;q=b.then}n=b;q.call(b,m(u),m(f));c._parentCancel=g.bind(b)}else d="fulfilled",n=b,l.length&&e(a)}catch(r){m(f)(r)}}function s(){var b=c._parentCancel;b?(delete c._parentCancel,b()):d||(b=Error("Cancel"),b.name="Cancel",f(b))}var n,d,l=[],c=this;this.resolve=function(b){d||u(b);return c};this.reject=function(b){d||
f(b);return c};this.progress=function(b){d||l.forEach(function(a){if(a.progress)try{a.progress(b)}catch(c){}});return c.promise};this.cancel=function(){c._parentCancel?setTimeout(s,0):s();return c};this.then=function(b,m,f){var g=new p;g._parentCancel=c.promise.cancel;l.push({resolve:b,reject:m,progress:f,deferred:g});("fulfilled"===d||"rejected"===d)&&e(a);return g.promise};this.promise={then:c.then,cancel:c.cancel}}var v=[],t=!1,w=function(){if("undefined"!==typeof process&&"function"===typeof process.nextTick){var e=
process.nextTick;return function(){e(a)}}if("function"===typeof MutationObserver){var f=document.createElement("div");(new MutationObserver(a)).observe(f,{attributes:!0});return function(){f.setAttribute("class","_tick")}}return function(){setTimeout(a,0)}}();p.all=function(a,f){function e(b,a){l||(d[b]=a,0===--n&&c.resolve(d))}function k(b,a){if(!l){if(f)try{e(b,f(a));return}catch(d){a=d}c.reject(a)}}var n=a.length,d=[],l=!1,c=new p;c.then(void 0,function(){l=!0;a.forEach(function(b){b.cancel&&b.cancel()})});
0===n?c.resolve(d):a.forEach(function(b,a){b.then(e.bind(void 0,a),k.bind(void 0,a))});return c.promise};p.when=function(a,e,k,s){var n;a&&"function"===typeof a.then||(n=new p,n.resolve(a),a=n.promise);return a.then(e,k,s)};return p});
(function(a,e){"function"===typeof define&&define.amd?define("orion/plugin",["orion/Deferred"],e):"object"===typeof exports?module.exports=e(require("orion/Deferred")):(a.orion=a.orion||{},a.orion.PluginProvider=e(a.orion.Deferred))})(this,function(a){function e(a,e){this.__objectId=a;this.__methods=e}return function(k){function p(h){l&&("undefined"===typeof ArrayBuffer&&(h=JSON.stringify(h)),l===self?l.postMessage(h):l.postMessage(h,"*"))}function v(){var h=[];Object.keys(x).forEach(function(a){var b=
x[a];h.push({serviceId:a,names:b.names,methods:b.methods,properties:b.properties})});return{headers:n||{},services:h}}function t(h,a){if(a&&a instanceof XMLHttpRequest){var b,e;try{b=a.status,e=a.statusText}catch(d){b=0,e=""}return{status:b||0,statusText:e}}return a}function w(h){var a=h?JSON.parse(JSON.stringify(h,t)):h;h instanceof Error&&(a.__isError=!0,a.message=a.message||h.message,a.name=a.name||h.name);return a}function y(h){if(!l)return(new a).reject(Error("plugin not connected"));h.id=String(c++);
var f=new a;g[h.id]=f;f.then(null,function(a){d&&(a instanceof Error&&"Cancel"===a.name)&&r({requestId:h.id,method:"cancel",params:a.message?[a.message]:[]})});var k=Object.prototype.toString;h.params.forEach(function(a,d){if("[object Object]"===k.call(a)&&!(a instanceof e)){var c,g;for(c in a)"[object Function]"===k.call(a[c])&&(g=g||[],g.push(c));if(g){var l=b++;z[l]=a;c=function(){delete z[l]};f.then(c,c);h.params[d]=new e(l,g)}}});r(h);return f.promise}function f(a,b){a||0===a?r({id:a,result:null,
error:b}):console.log(b)}function u(a,b,e,c){c.forEach(function(a,h){if(a&&"undefined"!==typeof a.__objectId){var b={};a.__methods.forEach(function(h){b[h]=function(){return y({objectId:a.__objectId,method:h,params:Array.prototype.slice.call(arguments)})}});c[h]=b}});var d=void 0===typeof a?null:{id:a,result:null,error:null};try{var f=e.apply(b,c);d&&(f&&"function"===typeof f.then?(q[a]=f,f.then(function(b){delete q[a];d.result=b;r(d)},function(b){q[a]&&(delete q[a],d.error=w(b),r(d))},function(){r({responseId:a,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(d.result=f,r(d)))}catch(g){d&&(d.error=w(g),r(d))}}function s(a){if(!(a.source!==l&&"undefined"!==typeof window)){a="string"!==typeof a.data?a.data:JSON.parse(a.data);try{if(a.method){var b=a.method,d=a.params||[];if("serviceId"in a){var c=x[a.serviceId];c||f(a.id,"service not found");c=c.implementation;b in c?u(a.id,c,c[b],d):f(a.id,"method not found")}else if("objectId"in a){var e=z[a.objectId];e||f(a.id,"object not found");!b in
e?u(a.id,e,e[b],d):f(a.id,"method not found")}else if("requestId"in a){var k=q[a.requestId];k&&("cancel"===b&&k.cancel)&&k.cancel.apply(k,d)}else if("responseId"in a){var m=g[a.responseId];m&&("progress"===b&&m.progress)&&m.progress.apply(m,d)}else throw Error("Bad method: "+a.method);}else{var n=g[String(a.id)];delete g[String(a.id)];a.error?n.reject(a.error):n.resolve(a.result)}}catch(p){console.log("Plugin._messageHandler "+p)}}}var n=k,d=!1,l=null,c=0,b=0,m=0,q={},g={},z={},x={},r=p;this.updateHeaders=
function(a){if(d)throw Error("Cannot update headers. Plugin Provider is connected");n=a};this.registerServiceProvider=this.registerService=function(a,b,c){if(d)throw Error("Cannot register service. Plugin Provider is connected");"string"===typeof a?a=[a]:Array.isArray(a)||(a=[]);var e=null,f=[];for(e in b)"function"===typeof b[e]&&f.push(e);x[m++]={names:a,methods:f,implementation:b,properties:c||{},listeners:{}}};this.connect=function(a,b){if(!d){if("undefined"===typeof window)l=self;else if(window!==
window.parent)l=window.parent;else if(null!==window.opener)l=window.opener;else{b&&b("No valid plugin target");return}addEventListener("message",s,!1);var c={method:"plugin",params:[v()]};p(c);d=!0}a&&a()};this.disconnect=function(){d&&(removeEventListener("message",s),l=null,d=!1)}}});
define("orion/editor/stylers/lib/syntax",[],function(){return{id:"orion.lib",grammars:[{id:"orion.lib",repository:{brace_open:{match:"{",name:"punctuation.section.block.begin"},brace_close:{match:"}",name:"punctuation.section.block.end"},bracket_open:{match:"\\[",name:"punctuation.section.bracket.begin"},bracket_close:{match:"\\]",name:"punctuation.section.bracket.end"},parenthesis_open:{match:"\\(",name:"punctuation.section.parens.begin"},parenthesis_close:{match:"\\)",name:"punctuation.section.parens.end"},
doc_block:{begin:{match:"/\\*\\*",literal:"/**"},end:{match:"\\*/",literal:"*/"},name:"comment.block.documentation",patterns:[{match:"@(?:(?!\\*/)\\S)*",name:"keyword.other.documentation.tag"},{match:"\\\x3c\\S*\\\x3e",name:"keyword.other.documentation.markup"},{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]},number_decimal:{match:"\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:[eE][+-]?\\d+)?\\b",name:"constant.numeric.number"},
number_hex:{match:"\\b0[xX][0-9A-Fa-f]+\\b",name:"constant.numeric.hex"},string_doubleQuote:{match:'"(?:\\\\.|[^"])*"?',name:"string.quoted.double"},string_singleQuote:{match:"'(?:\\\\.|[^'])*'?",name:"string.quoted.single"},todo_comment_singleLine:{match:"(\\b)(TODO)(\\b)(.*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.line"}}}}},{id:"orion.c-like",repository:{comment_singleLine:{match:{match:"//.*",literal:"//"},name:"comment.line.double-slash",
patterns:[{include:"orion.lib#todo_comment_singleLine"}]},comment_block:{begin:{match:"/\\*",literal:"/*"},end:{match:"\\*/",literal:"*/"},name:"comment.block",patterns:[{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]}}}],keywords:[]}});
define("orion/editor/stylers/application_xml/syntax",["orion/editor/stylers/lib/syntax"],function(a){a=a.grammars;a.push({id:"orion.xml",contentTypes:["application/xml","application/xhtml+xml"],patterns:[{include:"#comment"},{include:"#doctype"},{include:"#xmlDeclaration"},{include:"#tag"},{include:"#ampersandEscape"}],repository:{ampersandEscape:{match:"\x26lt;|\x26gt;|\x26amp;",name:"constant.character"},comment:{begin:{match:"\x3c!--",literal:"\x3c!--"},end:{match:"--\x3e",literal:"--\x3e"},name:"comment.block.xml",
patterns:[{match:"(\\b)(TODO)(\\b)(((?!--\x3e).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.line"}}}]},doctype:{begin:"\x3c!(?:doctype|DOCTYPE)",end:"\x3e",name:"meta.tag.doctype.xml",captures:{0:{name:"entity.name.tag.doctype.xml"}},patterns:[{include:"#comment"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}]},tag:{begin:"\x3c/?[A-Za-z0-9]+",end:"/?\x3e",captures:{0:{name:"entity.name.tag.xml"}},name:"meta.tag.xml",
patterns:[{include:"#comment"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}]},xmlDeclaration:{begin:"\x3c\\?xml",end:"\\?\x3e",captures:{0:{name:"entity.name.tag.declaration.xml"}},patterns:[{include:"#comment"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}],name:"meta.tag.declaration.xml"}}});return{id:a[a.length-1].id,grammars:a,keywords:[]}});
define("plugins/languages/xml/xmlPlugin",["orion/plugin","orion/editor/stylers/application_xml/syntax"],function(a,e){var k=new a({name:"Orion XML Tool Support",version:"1.0",description:"This plugin provides XML tools support for Orion."});k.registerServiceProvider("orion.core.contenttype",{},{contentTypes:[{id:"application/xml","extends":"text/plain",name:"XML",extension:["xml"],imageClass:"file-sprite-xml"},{id:"application/xhtml+xml","extends":"text/plain",name:"XHTML",extension:["xhtml","xht"],
imageClass:"file-sprite-xml"}]});k.registerServiceProvider("orion.edit.highlighter",{},e.grammars[e.grammars.length-1]);k.connect()});
//@ sourceMappingURL=xmlPlugin.js.map