/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 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
 *******************************************************************************/

/*******************************************************************************
 * @license
 * 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
 ******************************************************************************/

/*******************************************************************************
 * @license
 * 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) 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, 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) 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,c){typeof define==="function"&&define.amd?define("orion/Deferred",c):typeof exports==="object"?module.exports=c():(a.orion=a.orion||{},a.orion.Deferred=c())})(this,function(){function a(){for(var f;f=m.shift();)f();r=!1}function c(f){m.push(f);r||(r=!0,setTimeout(a,0))}function i(f){return function(){f.apply(void 0,arguments)}}function n(){function f(){for(var b;b=e.shift();){var a=b.deferred,d=g==="fulfilled"?"resolve":"reject";if(typeof b[d]==="function")try{var f=(0,b[d])(j),k=f&&(typeof f===
"object"||typeof f==="function")&&f.then;if(typeof k==="function")if(f===a.promise)a.reject(new TypeError);else{var c=f.cancel;typeof c==="function"?a._protected(m).parentCancel=c.bind(f):delete a._protected(m).parentCancel;k.call(f,i(a.resolve),i(a.reject),i(a.progress))}else a.resolve(f)}catch(n){a.reject(n)}else a[d](j)}}function a(b){delete k.parentCancel;g="rejected";j=b;e.length&&c(f)}function q(b){function s(h){return function(b){i||(i=!0,h(b))}}var i=!1;delete k.parentCancel;try{var l=b&&
(typeof b==="object"||typeof b==="function")&&b.then;if(typeof l==="function")if(b===d)a(new TypeError);else{g="assumed";var m=b&&b.cancel;if(typeof m!=="function"){var o=new n,b=o.promise;try{l(o.resolve,o.reject,o.progress)}catch(p){o.reject(p)}m=b.cancel;l=b.then}j=b;l.call(b,s(q),s(a));k.parentCancel=m.bind(b)}else g="fulfilled",j=b,e.length&&c(f)}catch(h){s(a)(h)}}function l(){var b=k.parentCancel;if(b)delete k.parentCancel,b();else if(!g)b=Error("Cancel"),b.name="Cancel",a(b)}var j,g,e=[],d=
this,k={};Object.defineProperty(this,"_protected",{value:function(b){if(b!==m)throw Error("protected");return k}});this.resolve=function(b){g||q(b);return d};this.reject=function(b){g||a(b);return d};this.progress=function(b){g||e.forEach(function(a){if(a.progress)try{a.progress(b)}catch(f){}});return d.promise};this.cancel=function(){k.parentCancel?setTimeout(l,0):l();return d};this.then=function(b,a,k){b={resolve:b,reject:a,progress:k,deferred:new n};e.push(b);b.deferred._protected(m).parentCancel=
d.promise.cancel.bind(d);(g==="fulfilled"||g==="rejected")&&c(f);return b.deferred.promise};this.promise={then:d.then,cancel:d.cancel}}var m=[],r=!1;n.all=function(a,c){function i(a,b){e||(g[a]=b,--j===0&&d.resolve(g))}function l(a,b){if(!e){if(c)try{i(a,c(b));return}catch(f){b=f}d.reject(b)}}var j=a.length,g=[],e=!1,d=new n;d.then(void 0,function(){e=!0;a.forEach(function(a){a.cancel&&a.cancel()})});j===0?d.resolve(g):a.forEach(function(a,b){a.then(i.bind(void 0,b),l.bind(void 0,b))});return d.promise};
n.when=function(a,c,i,l){var j;if(!(a&&typeof a.then==="function"))j=new n,j.resolve(a),a=j.promise;return a.then(c,i,l)};return n});
(function(a,c){typeof define==="function"&&define.amd?define("orion/plugin",["orion/Deferred"],c):typeof exports==="object"?module.exports=c(require("orion/Deferred")):(a.orion=a.orion||{},a.orion.PluginProvider=c(a.orion.Deferred))})(this,function(a){function c(a,c){this.__objectId=a;this.__methods=c}return function(i){function n(h){d&&(typeof ArrayBuffer==="undefined"&&(h=JSON.stringify(h)),d===self?d.postMessage(h):d.postMessage(h,"*"))}function m(){var h=[];Object.keys(o).forEach(function(a){var b=
o[a];h.push({serviceId:a,names:b.names,methods:b.methods,properties:b.properties})});return{headers:g||{},services:h}}function r(h,a){if(a&&a instanceof XMLHttpRequest){var b,d;try{b=a.status,d=a.statusText}catch(c){b=0,d=""}return{status:b||0,statusText:d}}return a}function f(h){var a=h?JSON.parse(JSON.stringify(h,r)):h;if(h instanceof Error)a.__isError=!0,a.message=a.message||h.message,a.name=a.name||h.name;return a}function w(h){if(!d)return(new a).reject(Error("plugin not connected"));h.id=String(k++);
var f=new a;u[h.id]=f;f.then(null,function(a){e&&a instanceof Error&&a.name==="Cancel"&&p({requestId:h.id,method:"cancel",params:a.message?[a.message]:[]})});var i=Object.prototype.toString;h.params.forEach(function(a,d){if(i.call(a)==="[object Object]"&&!(a instanceof c)){var e,g;for(e in a)i.call(a[e])==="[object Function]"&&(g=g||[],g.push(e));if(g){var j=b++;v[j]=a;e=function(){delete v[j]};f.then(e,e);h.params[d]=new c(j,g)}}});p(h);return f.promise}function q(a,b){a||a===0?p({id:a,result:null,
error:b}):console.log(b)}function l(a,b,d,c){c.forEach(function(a,b){if(a&&typeof a.__objectId!=="undefined"){var h={};a.__methods.forEach(function(b){h[b]=function(){return w({objectId:a.__objectId,method:b,params:Array.prototype.slice.call(arguments)})}});c[b]=h}});var e=typeof a===void 0?null:{id:a,result:null,error:null};try{var g=d.apply(b,c);if(e)g&&typeof g.then==="function"?(t[a]=g,g.then(function(b){delete t[a];e.result=b;p(e)},function(b){if(t[a])delete t[a],e.error=f(b),p(e)},function(){p({responseId:a,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(e.result=g,p(e))}catch(i){if(e)e.error=f(i),p(e)}}function j(a){if(a.source===d){a=typeof a.data!=="string"?a.data:JSON.parse(a.data);try{if(a.method){var b=a.method,e=a.params||[];if("serviceId"in a){var c=o[a.serviceId];c||q(a.id,"service not found");c=c.implementation;b in c?l(a.id,c,c[b],e):q(a.id,"method not found")}else if("objectId"in a){var f=v[a.objectId];f||q(a.id,"object not found");!b in f?l(a.id,f,f[b],e):q(a.id,"method not found")}else if("requestId"in
a){var g=t[a.requestId];g&&b==="cancel"&&g.cancel&&g.cancel.apply(g,e)}else if("responseId"in a){var i=u[a.responseId];i&&b==="progress"&&i.progress&&i.progress.apply(i,e)}else throw Error("Bad method: "+a.method);}else{var j=u[String(a.id)];delete u[String(a.id)];a.error?j.reject(a.error):j.resolve(a.result)}}catch(k){console.log("Plugin._messageHandler "+k)}}}var g=i,e=!1,d=null,k=0,b=0,s=0,t={},u={},v={},o={},p=n;this.updateHeaders=function(a){if(e)throw Error("Cannot update headers. Plugin Provider is connected");
g=a};this.registerServiceProvider=this.registerService=function(a,b,c){if(e)throw Error("Cannot register service. Plugin Provider is connected");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var d=null,f=[];for(d in b)typeof b[d]==="function"&&f.push(d);o[s++]={names:a,methods:f,implementation:b,properties:c||{},listeners:{}}};this.connect=function(a,b){if(!e){if(typeof window==="undefined")d=self;else if(window!==window.parent)d=window.parent;else if(window.opener!==null)d=window.opener;else{b&&
b("No valid plugin target");return}addEventListener("message",j,!1);var c={method:"plugin",params:[m()]};n(c);e=!0}a&&a()};this.disconnect=function(){e&&(removeEventListener("message",j),d=null,e=!1)}}});
define("orion/editor/stylers/lib/syntax",[],function(){return{id:"orion.lib",grammars:[{id:"orion.lib",patterns:[{include:"#brace_open"},{include:"#brace_close"},{include:"#bracket_open"},{include:"#bracket_close"},{include:"#parenthesis_open"},{include:"#parenthesis_close"},{include:"#number_decimal"},{include:"#number_hex"},{include:"#string_doubleQuote"},{include:"#string_singleQuote"}],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:"/\\*\\*",end:"\\*/",name:"comment.block.documentation",patterns:[{match:"@(?:(?!\\*/)\\S)*",name:"keyword.other.documentation.tag"},{match:"\\<\\S*\\>",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",patterns:[{include:"orion.lib"},{include:"#comment_singleLine"},{include:"#comment_block"}],repository:{comment_singleLine:{match:"//.*",name:"comment.line.double-slash",patterns:[{include:"orion.lib#todo_comment_singleLine"}]},comment_block:{begin:"/\\*",end:"\\*/",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"},{begin:"</?[A-Za-z0-9]+",end:"/?>",captures:{0:{name:"entity.name.tag.xml"}},name:"meta.tag.xml",patterns:[{include:"#comment"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}]},{match:"&lt;|&gt;|&amp;",
name:"constant.character"}],repository:{comment:{begin:"<\!--",end:"--\>",name:"comment.block.xml",patterns:[{match:"(\\b)(TODO)(\\b)(((?!--\>).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.line"}}}]},doctype:{begin:"<!(?:doctype|DOCTYPE)",end:">",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"}]},
xmlDeclaration:{begin:"<\\?xml",end:"\\?>",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('built-xmlPlugin.js',["orion/plugin","orion/editor/stylers/application_xml/syntax"],function(a,c){var i=new a({name:"Orion XML Tool Support",version:"1.0",description:"This plugin provides XML tools support for Orion."});i.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"}]});i.registerServiceProvider("orion.edit.highlighter",{},c.grammars[c.grammars.length-1]);i.connect()});