/*

 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 p(){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(p){k.reject(p)}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 f=b&&b.cancel;if("function"!==typeof f){var n=new p;b=n.promise;try{q(n.resolve,n.reject,n.progress)}catch(s){n.reject(s)}f=b.cancel;q=b.then}m=b;q.call(b,k(u),k(l));e._parentCancel=f.bind(b)}else d="fulfilled",m=b,h.length&&c(a)}catch(r){k(l)(r)}}function n(){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(n,0):n();return e};this.then=function(b,k,l){var f=new p;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)}}();p.all=function(a,c){function f(b,a){h||(d[b]=a,0===--m&&e.resolve(d))}function n(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 p;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),n.bind(void 0,a))});return e.promise};p.when=function(a,c,f,n){var m;a&&"function"===typeof a.then||(m=new p,m.resolve(a),a=m.promise);return a.then(c,f,n)};return p});
(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 p(g){h&&("undefined"===typeof ArrayBuffer&&(g=JSON.stringify(g)),h===self?h.postMessage(g):h.postMessage(g,"*"))}function w(){var g=[];Object.keys(s).forEach(function(a){var b=
s[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;y[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 n(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=s[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=y[a.responseId];k&&("progress"===b&&k.progress)&&k.progress.apply(k,d)}else throw Error("Bad method: "+a.method);}else{var m=y[String(a.id)];delete y[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={},y={},z={},s={},r=p;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);s[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",n,!1);var c={method:"plugin",params:[w()]};p(c);d=!0}a&&a()};this.disconnect=function(){d&&(removeEventListener("message",n),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-csrc/syntax",["orion/editor/stylers/lib/syntax"],function(a){var c="auto break case char const continue default double do else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while".split(" "),f="define elif else endif error ifdef ifndef if include line pragma undef".split(" ");a=a.grammars;a.push({id:"orion.c",contentTypes:["text/x-csrc","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.c"}],repository:{directive:{match:"(#\\s*(?:"+f.join("|")+"))\\b",name:"keyword.control.directive.c"}}});return{id:a[a.length-1].id,grammars:a,keywords:c.concat(f)}});
define("plugins/languages/c/cPlugin",["orion/plugin","orion/editor/stylers/text_x-csrc/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-csrc","extends":"text/plain",name:"C",extension:["c"]}]});f.registerServiceProvider("orion.edit.highlighter",{},c.grammars[c.grammars.length-1]);f.connect()});
//@ sourceMappingURL=cPlugin.js.map