/*******************************************************************************
 * @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) 2010, 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) 2013 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) 2010, 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) 2013 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(c,j){typeof define==="function"&&define.amd?define("orion/Deferred",j):typeof exports==="object"?module.exports=j():(c.orion=c.orion||{},c.orion.Deferred=j())})(this,function(){function c(){for(var a;a=e.shift();)a();d=!1}function j(a){e.push(a);d||(d=!0,setTimeout(c,0))}function a(a){return function(){a.apply(void 0,arguments)}}function b(){function h(){for(var o;o=g.shift();){var b=o.deferred,d=i==="fulfilled"?"resolve":"reject";if(typeof o[d]==="function")try{var h=(0,o[d])(k),f=h&&(typeof h===
"object"||typeof h==="function")&&h.then;if(typeof f==="function")if(h===b.promise)b.reject(new TypeError);else{var c=h.cancel;typeof c==="function"?b._protected(e).parentCancel=c.bind(h):delete b._protected(e).parentCancel;f.call(h,a(b.resolve),a(b.reject),a(b.progress))}else b.resolve(h)}catch(l){b.reject(l)}else b[d](k)}}function d(b){delete m.parentCancel;i="rejected";k=b;g.length&&j(h)}function l(a){function e(u){return function(a){c||(c=!0,u(a))}}var c=!1;delete m.parentCancel;try{var n=a&&
(typeof a==="object"||typeof a==="function")&&a.then;if(typeof n==="function")if(a===f)d(new TypeError);else{i="assumed";var r=a&&a.cancel;if(typeof r!=="function"){var p=new b,a=p.promise;try{n(p.resolve,p.reject,p.progress)}catch(q){p.reject(q)}r=a.cancel;n=a.then}k=a;n.call(a,e(l),e(d));m.parentCancel=r.bind(a)}else i="fulfilled",k=a,g.length&&j(h)}catch(u){e(d)(u)}}function c(){var a=m.parentCancel;if(a)delete m.parentCancel,a();else if(!i)a=Error("Cancel"),a.name="Cancel",d(a)}var k,i,g=[],f=
this,m={};Object.defineProperty(this,"_protected",{value:function(a){if(a!==e)throw Error("protected");return m}});this.resolve=function(a){i||l(a);return f};this.reject=function(a){i||d(a);return f};this.progress=function(a){i||g.forEach(function(b){if(b.progress)try{b.progress(a)}catch(e){}});return f.promise};this.cancel=function(){m.parentCancel?setTimeout(c,0):c();return f};this.then=function(a,d,c){a={resolve:a,reject:d,progress:c,deferred:new b};g.push(a);a.deferred._protected(e).parentCancel=
f.promise.cancel.bind(f);(i==="fulfilled"||i==="rejected")&&j(h);return a.deferred.promise};this.promise={then:f.then,cancel:f.cancel}}var e=[],d=!1;b.all=function(a,e){function d(a,b){g||(i[a]=b,--k===0&&f.resolve(i))}function c(a,b){if(!g){if(e)try{d(a,e(b));return}catch(h){b=h}f.reject(b)}}var k=a.length,i=[],g=!1,f=new b;f.then(void 0,function(){g=!0;a.forEach(function(a){a.cancel&&a.cancel()})});k===0?f.resolve(i):a.forEach(function(a,b){a.then(d.bind(void 0,b),c.bind(void 0,b))});return f.promise};
b.when=function(a,e,d,c){var k;if(!(a&&typeof a.then==="function"))k=new b,k.resolve(a),a=k.promise;return a.then(e,d,c)};return b});
(function(c,j){typeof define==="function"&&define.amd?define("orion/plugin",["orion/Deferred"],j):typeof exports==="object"?module.exports=j(require("orion/Deferred")):(c.orion=c.orion||{},c.orion.PluginProvider=j(c.orion.Deferred))})(this,function(c){function j(a,b){this.__objectId=a;this.__methods=b}return function(a){function b(a){f&&(typeof ArrayBuffer==="undefined"&&(a=JSON.stringify(a)),f===self?f.postMessage(a):f.postMessage(a,"*"))}function e(){var a=[];Object.keys(p).forEach(function(b){var e=
p[b];a.push({serviceId:b,names:e.names,methods:e.methods,properties:e.properties})});return{headers:i||{},services:a}}function d(a,b){if(b&&b instanceof XMLHttpRequest){var e,d;try{e=b.status,d=b.statusText}catch(c){e=0,d=""}return{status:e||0,statusText:d}}return b}function h(a){var b=a?JSON.parse(JSON.stringify(a,d)):a;if(a instanceof Error)b.__isError=!0,b.message=b.message||a.message,b.name=b.name||a.name;return b}function w(a){if(!f)return(new c).reject(Error("plugin not connected"));a.id=String(m++);
var b=new c;t[a.id]=b;b.then(null,function(b){g&&b instanceof Error&&b.name==="Cancel"&&q({requestId:a.id,method:"cancel",params:b.message?[b.message]:[]})});var e=Object.prototype.toString;a.params.forEach(function(d,c){if(e.call(d)==="[object Object]"&&!(d instanceof j)){var h,f;for(h in d)e.call(d[h])==="[object Function]"&&(f=f||[],f.push(h));if(f){var g=o++;r[g]=d;h=function(){delete r[g]};b.then(h,h);a.params[c]=new j(g,f)}}});q(a);return b.promise}function l(a,b){a||a===0?q({id:a,result:null,
error:b}):console.log(b)}function n(a,b,e,d){d.forEach(function(a,b){if(a&&typeof a.__objectId!=="undefined"){var e={};a.__methods.forEach(function(b){e[b]=function(){return w({objectId:a.__objectId,method:b,params:Array.prototype.slice.call(arguments)})}});d[b]=e}});var c=typeof a===void 0?null:{id:a,result:null,error:null};try{var f=e.apply(b,d);if(c)f&&typeof f.then==="function"?(s[a]=f,f.then(function(b){delete s[a];c.result=b;q(c)},function(b){if(s[a])delete s[a],c.error=h(b),q(c)},function(){q({responseId:a,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(c.result=f,q(c))}catch(g){if(c)c.error=h(g),q(c)}}function k(a){if(a.source===f){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 d=p[a.serviceId];d||l(a.id,"service not found");d=d.implementation;b in d?n(a.id,d,d[b],e):l(a.id,"method not found")}else if("objectId"in a){var c=r[a.objectId];c||l(a.id,"object not found");!b in c?n(a.id,c,c[b],e):l(a.id,"method not found")}else if("requestId"in
a){var h=s[a.requestId];h&&b==="cancel"&&h.cancel&&h.cancel.apply(h,e)}else if("responseId"in a){var g=t[a.responseId];g&&b==="progress"&&g.progress&&g.progress.apply(g,e)}else throw Error("Bad method: "+a.method);}else{var i=t[String(a.id)];delete t[String(a.id)];a.error?i.reject(a.error):i.resolve(a.result)}}catch(k){console.log("Plugin._messageHandler "+k)}}}var i=a,g=!1,f=null,m=0,o=0,v=0,s={},t={},r={},p={},q=b;this.updateHeaders=function(a){if(g)throw Error("Cannot update headers. Plugin Provider is connected");
i=a};this.registerServiceProvider=this.registerService=function(a,b,e){if(g)throw Error("Cannot register service. Plugin Provider is connected");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var d=null,c=[];for(d in b)typeof b[d]==="function"&&c.push(d);p[v++]={names:a,methods:c,implementation:b,properties:e||{},listeners:{}}};this.connect=function(a,d){if(!g){if(typeof window==="undefined")f=self;else if(window!==window.parent)f=window.parent;else if(window.opener!==null)f=window.opener;else{d&&
d("No valid plugin target");return}addEventListener("message",k,!1);var c={method:"plugin",params:[e()]};b(c);g=!0}a&&a()};this.disconnect=function(){g&&(removeEventListener("message",k),f=null,g=!1)}}});
define("orion/editor/templates",[],function(){function c(a,b,e,d){this.prefix=a;this.description=b;this.template=e;this.name=d;this._parse()}function j(a,b){this._keywords=a||[];this._templates=[];this.addTemplates(b||[])}c.prototype={getProposal:function(a,b,e){var a=b-a.length,b={},d,c=e.delimiter!==void 0?e.delimiter:"\n";e.indentation&&(c+=e.indentation);for(var j=e.tab!==void 0?e.tab:"\t",l=0,n=this.variables,k=this.segments,e=[],i=0;i<k.length;i++){var g=k[i],f=n[g];if(f!==void 0)switch(g){case "${tab}":g=
j;break;case "${delimiter}":g=c;break;case "${cursor}":g="";d=l;break;default:var m=b[g];m||(m=b[g]={data:f.data,positions:[]});g=f.substitution;m.data&&m.data.values&&(g=m.data.values[0]);m.positions.push({offset:a+l,length:g.length})}e.push(g);l+=g.length}var c=[],o;for(o in b)b.hasOwnProperty(o)&&c.push(b[o]);e=e.join("");if(d===void 0)d=e.length;return{proposal:e,name:this.name,description:this.description,groups:c,escapePosition:a+d,style:"noemphasis"}},match:function(a){return this.prefix.indexOf(a)===
0},_parse:function(){var a=this.template,b=[],e={},d,c=0,a=a.replace(/\n/g,"${delimiter}"),a=a.replace(/\t/g,"${tab}");a.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(j,l,n){var k=j.substring(2,j.length-1),l=j,i=k,g=null,f=i.indexOf(":");f!==-1&&(i=i.substring(0,f),l="${"+i+"}",g=JSON.parse(k.substring(f+1).replace("\\}","}").trim()));(k=e[l])||(k=e[l]={});k.substitution=i;if(g)k.data=g;(d=a.substring(c,n))&&b.push(d);b.push(l);c=n+j.length;return i});(d=a.substring(c,a.length))&&b.push(d);this.segments=
b;this.variables=e}};j.prototype={addTemplates:function(a){for(var b=this.getTemplates(),e=0;e<a.length;e++)b.push(new c(a[e].prefix,a[e].description,a[e].template,a[e].name))},computeProposals:function(a,b,e){var d=this.getPrefix(a,b,e),c=[];this.isValid(d,a,b,e)&&(c=c.concat(this.getTemplateProposals(d,b,e)),c=c.concat(this.getKeywordProposals(d)));return c},getKeywords:function(){return this._keywords},getKeywordProposals:function(a){var b=[],c=this.getKeywords();if(c){for(var d=0;d<c.length;d++)c[d].indexOf(a)===
0&&b.push({proposal:c[d].substring(a.length),description:c[d],style:"noemphasis_keyword"});0<b.length&&b.splice(0,0,{proposal:"",description:"Keywords",style:"noemphasis_title_keywords",unselectable:!0})}return b},getPrefix:function(a,b,c){return c.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(a,b,c){for(var d=[],h=this.getTemplates(),j=0;j<h.length;j++){var l=h[j];l.match(a)&&(l=l.getProposal(a,b,c),this.removePrefix(a,l),d.push(l))}0<d.length&&(d.sort(function(a,
b){return a.name<b.name?-1:a.name>b.name?1:0}),d.splice(0,0,{proposal:"",description:"Templates",style:"noemphasis_title",unselectable:!0}));return d},removePrefix:function(a,b){if(!(b.overwrite=b.proposal.substring(0,a.length)!==a))b.proposal=b.proposal.substring(a.length)},isValid:function(){return!0}};return{Template:c,TemplateContentAssist:j}});
define('built-webEditingPlugin.js',["orion/plugin","orion/editor/templates"],function(c){c=new c({name:"Orion Web Editing Plugin",version:"1.0",description:"This plugin provides editor link support for the navigator."});c.registerService("orion.core.contenttype",{},{contentTypes:[{id:"text/plain",name:"Text",extension:["txt"],imageClass:"file-sprite-text modelDecorationSprite"},{id:"application/xml","extends":"text/plain",name:"XML",extension:["xml"],imageClass:"file-sprite-xml"},{id:"text/x-markdown",
"extends":"text/plain",name:"Markdown",extension:["md"]},{id:"text/conf","extends":"text/plain",name:"Conf",extension:["conf"]},{id:"text/sh","extends":"text/plain",name:"sh",extension:["sh"]},{id:"image/gif",name:"GIF",extension:["gif"],imageClass:"file-sprite-image modelDecorationSprite"},{id:"image/jpeg",name:"JPG",extension:["jpg","jpeg","jpe"],imageClass:"file-sprite-image modelDecorationSprite"},{id:"image/ico",name:"ICO",extension:["ico"],imageClass:"file-sprite-image modelDecorationSprite"},
{id:"image/png",name:"PNG",extension:["png"],imageClass:"file-sprite-image modelDecorationSprite"},{id:"image/tiff",name:"TIFF",extension:["tif","tiff"],imageClass:"file-sprite-image modelDecorationSprite"},{id:"image/svg",name:"SVG",extension:["svg"],imageClass:"file-sprite-image modelDecorationSprite"}]});c.registerService("orion.edit.editor",{},{id:"orion.editor","default":!0,nameKey:"Orion Editor",nls:"orion/nls/messages",uriTemplate:"../edit/edit.html#{,Location,params*}",orionTemplate:"../edit/edit.html#{,Location,params*}",
validationProperties:[{source:"!Projects"}]});c.registerService("orion.navigate.openWith",{},{editor:"orion.editor",excludedContentTypes:["image/*"]});c.registerService("orion.edit.editor",{},{id:"orion.viewer.markdown",nameKey:"Orion Markdown Viewer",nls:"orion/nls/messages",uriTemplate:"../edit/edit.html#{,Location,params*},editor=orion.viewer.markdown"});c.registerService("orion.navigate.openWith",{},{editor:"orion.viewer.markdown",contentType:["text/x-markdown"]});c.registerService("orion.edit.editor",
{},{id:"orion.viewer.raw",nameKey:"Browser",nls:"orion/nls/messages",uriTemplate:"{+Location}",validationProperties:[{source:"!Projects"}]});c.connect()});