/*

 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,c){"function"===typeof define&&define.amd?define("orion/Deferred",c):"object"===typeof exports?module.exports=c():(a.orion=a.orion||{},a.orion.Deferred=c())})(this,function(){function a(){for(var a;a=w.shift();)a();t=!1}function c(a){w.push(a);t||(t=!0,x())}function f(a){return function(c){a(c)}}function n(){function a(){for(var b;b=h.shift();){var k=b.deferred,c="fulfilled"===d?"resolve":"reject";b=b[c];if("function"===typeof b)try{var e=b(m),l=e&&("object"===typeof e||"function"===typeof e)&&
e.then;if("function"===typeof l)if(e===k.promise)k.reject(new TypeError);else{var v=e.cancel;"function"===typeof v?k._parentCancel=v.bind(e):delete k._parentCancel;l.call(e,f(k.resolve),f(k.reject),f(k.progress))}else k.resolve(e)}catch(n){k.reject(n)}else k[c](m)}}function l(b){delete e._parentCancel;d="rejected";m=b;h.length&&c(a)}function u(b){function k(g){return function(b){(!d||"assumed"===d)&&g(b)}}delete e._parentCancel;try{var q=b&&("object"===typeof b||"function"===typeof b)&&b.then;if("function"===
typeof q)if(b===e)l(new TypeError);else{d="assumed";var s=b&&b.cancel;if("function"!==typeof s){var f=new n;b=f.promise;try{q(f.resolve,f.reject,f.progress)}catch(p){f.reject(p)}s=b.cancel;q=b.then}m=b;q.call(b,k(u),k(l));e._parentCancel=s.bind(b)}else d="fulfilled",m=b,h.length&&c(a)}catch(r){k(l)(r)}}function p(){var b=e._parentCancel;b?(delete e._parentCancel,b()):d||(b=Error("Cancel"),b.name="Cancel",l(b))}var m,d,h=[],e=this;this.resolve=function(b){d||u(b);return e};this.reject=function(b){d||
l(b);return e};this.progress=function(b){d||h.forEach(function(a){if(a.progress)try{a.progress(b)}catch(e){}});return e.promise};this.cancel=function(){e._parentCancel?setTimeout(p,0):p();return e};this.then=function(b,k,l){var f=new n;f._parentCancel=e.promise.cancel;h.push({resolve:b,reject:k,progress:l,deferred:f});("fulfilled"===d||"rejected"===d)&&c(a);return f.promise};this.promise={then:e.then,cancel:e.cancel}}var w=[],t=!1,x=function(){if("undefined"!==typeof process&&"function"===typeof process.nextTick){var c=
process.nextTick;return function(){c(a)}}if("function"===typeof MutationObserver){var l=document.createElement("div");(new MutationObserver(a)).observe(l,{attributes:!0});return function(){l.setAttribute("class","_tick")}}return function(){setTimeout(a,0)}}();n.all=function(a,c){function f(b,a){h||(d[b]=a,0===--m&&e.resolve(d))}function p(b,a){if(!h){if(c)try{f(b,c(a));return}catch(d){a=d}e.reject(a)}}var m=a.length,d=[],h=!1,e=new n;e.then(void 0,function(){h=!0;a.forEach(function(b){b.cancel&&b.cancel()})});
0===m?e.resolve(d):a.forEach(function(b,a){b.then(f.bind(void 0,a),p.bind(void 0,a))});return e.promise};n.when=function(a,c,f,p){var m;a&&"function"===typeof a.then||(m=new n,m.resolve(a),a=m.promise);return a.then(c,f,p)};return n});
(function(a,c){"function"===typeof define&&define.amd?define("orion/plugin",["orion/Deferred"],c):"object"===typeof exports?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(f){function n(g){h&&("undefined"===typeof ArrayBuffer&&(g=JSON.stringify(g)),h===self?h.postMessage(g):h.postMessage(g,"*"))}function w(){var g=[];Object.keys(y).forEach(function(a){var b=
y[a];g.push({serviceId:a,names:b.names,methods:b.methods,properties:b.properties})});return{headers:m||{},services:g}}function t(g,a){if(a&&a instanceof XMLHttpRequest){var b,c;try{b=a.status,c=a.statusText}catch(e){b=0,c=""}return{status:b||0,statusText:c}}return a}function x(g){var a=g?JSON.parse(JSON.stringify(g,t)):g;g instanceof Error&&(a.__isError=!0,a.message=a.message||g.message,a.name=a.name||g.name);return a}function v(g){if(!h)return(new a).reject(Error("plugin not connected"));g.id=String(e++);
var f=new a;s[g.id]=f;f.then(null,function(a){d&&(a instanceof Error&&"Cancel"===a.name)&&r({requestId:g.id,method:"cancel",params:a.message?[a.message]:[]})});var l=Object.prototype.toString;g.params.forEach(function(a,e){if("[object Object]"===l.call(a)&&!(a instanceof c)){var d,h;for(d in a)"[object Function]"===l.call(a[d])&&(h=h||[],h.push(d));if(h){var k=b++;z[k]=a;d=function(){delete z[k]};f.then(d,d);g.params[e]=new c(k,h)}}});r(g);return f.promise}function l(a,b){a||0===a?r({id:a,result:null,
error:b}):console.log(b)}function u(a,b,c,e){e.forEach(function(a,g){if(a&&"undefined"!==typeof a.__objectId){var b={};a.__methods.forEach(function(g){b[g]=function(){return v({objectId:a.__objectId,method:g,params:Array.prototype.slice.call(arguments)})}});e[g]=b}});var d=void 0===typeof a?null:{id:a,result:null,error:null};try{var f=c.apply(b,e);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=x(b),r(d))},function(){r({responseId:a,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(d.result=f,r(d)))}catch(h){d&&(d.error=x(h),r(d))}}function p(a){if(!(a.source!==h&&"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=y[a.serviceId];c||l(a.id,"service not found");c=c.implementation;b in c?u(a.id,c,c[b],d):l(a.id,"method not found")}else if("objectId"in a){var e=z[a.objectId];e||l(a.id,"object not found");!b in
e?u(a.id,e,e[b],d):l(a.id,"method not found")}else if("requestId"in a){var f=q[a.requestId];f&&("cancel"===b&&f.cancel)&&f.cancel.apply(f,d)}else if("responseId"in a){var k=s[a.responseId];k&&("progress"===b&&k.progress)&&k.progress.apply(k,d)}else throw Error("Bad method: "+a.method);}else{var m=s[String(a.id)];delete s[String(a.id)];a.error?m.reject(a.error):m.resolve(a.result)}}catch(n){console.log("Plugin._messageHandler "+n)}}}var m=f,d=!1,h=null,e=0,b=0,k=0,q={},s={},z={},y={},r=n;this.updateHeaders=
function(a){if(d)throw Error("Cannot update headers. Plugin Provider is connected");m=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);y[k++]={names:a,methods:f,implementation:b,properties:c||{},listeners:{}}};this.connect=function(a,b){if(!d){if("undefined"===typeof window)h=self;else if(window!==
window.parent)h=window.parent;else if(null!==window.opener)h=window.opener;else{b&&b("No valid plugin target");return}addEventListener("message",p,!1);var c={method:"plugin",params:[w()]};n(c);d=!0}a&&a()};this.disconnect=function(){d&&(removeEventListener("message",p),h=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/text_x-c__src/syntax",["orion/editor/stylers/lib/syntax"],function(a){var c="alignas alignof asm and_eq and auto bitand bitor bool break case catch char16_t char32_t char class compl constexpr const_cast const continue decltype default delete double do dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new noexcept not_eq not nullptr operator or_eq or private protected public register reinterpret_cast return short signed sizeof static_assert static_cast static struct switch template this thread_local throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while xor_eq xor".split(" ");a=
a.grammars;a.push({id:"orion.cpp",contentTypes:["text/x-c++src","text/x-c++"],patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"#directive"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},
{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+c.join("|")+")\\b",name:"keyword.control.cpp"}],repository:{directive:{match:"(#\\s*(?:define|elif|else|endif|error|ifdef|ifndef|if|include|line|pragma|undef))\\b",name:"keyword.control.directive.c++"}}});return{id:a[a.length-1].id,grammars:a,keywords:c}});
define("plugins/languages/cpp/cppPlugin",["orion/plugin","orion/editor/stylers/text_x-c__src/syntax"],function(a,c){var f=new a({name:"Orion C++ Tool Support",version:"1.0",description:"This plugin provides C++ tools support for Orion."});f.registerServiceProvider("orion.core.contenttype",{},{contentTypes:[{id:"text/x-c++src","extends":"text/plain",name:"C++",extension:["cpp","h"]}]});f.registerServiceProvider("orion.edit.highlighter",{},c.grammars[c.grammars.length-1]);f.connect()});
//@ sourceMappingURL=cppPlugin.js.map