(function(c,n){"function"===typeof define&&define.amd?define("orion/Deferred",n):"object"===typeof exports?module.exports=n():(c.orion=c.orion||{},c.orion.Deferred=n())})(this,function(){function c(){for(var b;b=a.shift();)b();d=!1}function n(b){a.push(b);d||(d=!0,l())}function b(a){return function(b){a(b)}}function e(){function a(){for(var e;e=p.shift();){var g=e.deferred,h="fulfilled"===f?"resolve":"reject";e=e[h];if("function"===typeof e)try{var d=e(q),c=d&&("object"===typeof d||"function"===typeof d)&&
d.then;if("function"===typeof c)if(d===g.promise)g.reject(new TypeError);else{var k=d.cancel;"function"===typeof k?g._parentCancel=k.bind(d):delete g._parentCancel;c.call(d,b(g.resolve),b(g.reject),b(g.progress))}else g.resolve(d)}catch(m){g.reject(m)}else g[h](q)}}function h(b){delete m._parentCancel;f="rejected";q=b;p.length&&n(a)}function d(b){function c(a){return function(b){(!f||"assumed"===f)&&a(b)}}delete m._parentCancel;try{var k=b&&("object"===typeof b||"function"===typeof b)&&b.then;if("function"===
typeof k)if(b===m)h(new TypeError);else{f="assumed";var l=b&&b.cancel;if("function"!==typeof l){var t=new e;b=t.promise;try{k(t.resolve,t.reject,t.progress)}catch(u){t.reject(u)}l=b.cancel;k=b.then}q=b;k.call(b,c(d),c(h));m._parentCancel=l.bind(b)}else f="fulfilled",q=b,p.length&&n(a)}catch(r){c(h)(r)}}function c(){var a=m._parentCancel;a?(delete m._parentCancel,a()):f||(a=Error("Cancel"),a.name="Cancel",h(a))}var q,f,p=[],m=this;this.resolve=function(a){f||d(a);return m};this.reject=function(a){f||
h(a);return m};this.progress=function(a){f||p.forEach(function(b){if(b.progress)try{b.progress(a)}catch(e){}});return m.promise};this.cancel=function(){m._parentCancel?setTimeout(c,0):c();return m};this.then=function(b,d,h){var c=new e;c._parentCancel=m.promise.cancel;p.push({resolve:b,reject:d,progress:h,deferred:c});("fulfilled"===f||"rejected"===f)&&n(a);return c.promise};this.promise={then:m.then,cancel:m.cancel}}var a=[],d=!1,l=function(){if("undefined"!==typeof process&&"function"===typeof process.nextTick){var a=
process.nextTick;return function(){a(c)}}if("function"===typeof MutationObserver){var b=document.createElement("div");(new MutationObserver(c)).observe(b,{attributes:!0});return function(){b.setAttribute("class","_tick")}}return function(){setTimeout(c,0)}}();e.all=function(a,b){function d(a,b){p||(f[a]=b,0===--l&&m.resolve(f))}function c(a,e){if(!p){if(b)try{d(a,b(e));return}catch(g){e=g}m.reject(e)}}var l=a.length,f=[],p=!1,m=new e;m.then(void 0,function(){p=!0;a.forEach(function(a){a.cancel&&a.cancel()})});
0===l?m.resolve(f):a.forEach(function(a,b){a.then(d.bind(void 0,b),c.bind(void 0,b))});return m.promise};e.when=function(a,b,d,c){var l;a&&"function"===typeof a.then||(l=new e,l.resolve(a),a=l.promise);return a.then(b,d,c)};return e});
(function(c,n){"function"===typeof define&&define.amd?define("orion/plugin",["orion/Deferred"],n):"object"===typeof exports?module.exports=n(require("orion/Deferred")):(c.orion=c.orion||{},c.orion.PluginProvider=n(c.orion.Deferred))})(this,function(c){function n(b,e){this.__objectId=b;this.__methods=e}return function(b){function e(a){p&&("undefined"===typeof ArrayBuffer&&(a=JSON.stringify(a)),p===self?p.postMessage(a):p.postMessage(a,"*"))}function a(){var a=[];Object.keys(u).forEach(function(b){var e=
u[b];a.push({serviceId:b,names:e.names,methods:e.methods,properties:e.properties})});return{headers:q||{},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 l(a){var b=a?JSON.parse(JSON.stringify(a,d)):a;a instanceof Error&&(b.__isError=!0,b.message=b.message||a.message,b.name=b.name||a.name);return b}function g(a){if(!p)return(new c).reject(Error("plugin not connected"));a.id=String(m++);
var b=new c;x[a.id]=b;b.then(null,function(b){f&&b instanceof Error&&"Cancel"===b.name&&r({requestId:a.id,method:"cancel",params:b.message?[b.message]:[]})});var e=Object.prototype.toString;a.params.forEach(function(d,c){if("[object Object]"===e.call(d)&&!(d instanceof n)){var g,f;for(g in d)"[object Function]"===e.call(d[g])&&(f=f||[],f.push(g));if(f){var h=v++;t[h]=d;g=function(){delete t[h]};b.then(g,g);a.params[c]=new n(h,f)}}});r(a);return b.promise}function h(a,b){a||0===a?r({id:a,result:null,
error:b}):console.log(b)}function s(a,b,e,d){d.forEach(function(a,b){if(a&&"undefined"!==typeof a.__objectId){var e={};a.__methods.forEach(function(b){e[b]=function(){return g({objectId:a.__objectId,method:b,params:Array.prototype.slice.call(arguments)})}});d[b]=e}});var c=void 0===typeof a?null:{id:a,result:null,error:null};try{var f=e.apply(b,d);c&&(f&&"function"===typeof f.then?(w[a]=f,f.then(function(b){delete w[a];c.result=b;r(c)},function(b){w[a]&&(delete w[a],c.error=l(b),r(c))},function(){r({responseId:a,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(c.result=f,r(c)))}catch(h){c&&(c.error=l(h),r(c))}}function k(a){if(!(a.source!==p&&"undefined"!==typeof window)){a="string"!==typeof a.data?a.data:JSON.parse(a.data);try{if(a.method){var b=a.method,e=a.params||[];if("serviceId"in a){var d=u[a.serviceId];d||h(a.id,"service not found");d=d.implementation;b in d?s(a.id,d,d[b],e):h(a.id,"method not found")}else if("objectId"in a){var c=t[a.objectId];c||h(a.id,"object not found");!b in
c?s(a.id,c,c[b],e):h(a.id,"method not found")}else if("requestId"in a){var f=w[a.requestId];f&&"cancel"===b&&f.cancel&&f.cancel.apply(f,e)}else if("responseId"in a){var g=x[a.responseId];g&&"progress"===b&&g.progress&&g.progress.apply(g,e)}else throw Error("Bad method: "+a.method);}else{var l=x[String(a.id)];delete x[String(a.id)];a.error?l.reject(a.error):l.resolve(a.result)}}catch(k){console.log("Plugin._messageHandler "+k)}}}var q=b,f=!1,p=null,m=0,v=0,y=0,w={},x={},t={},u={},r=e;this.updateHeaders=
function(a){if(f)throw Error("Cannot update headers. Plugin Provider is connected");q=a};this.registerServiceProvider=this.registerService=function(a,b,e){if(f)throw Error("Cannot register service. Plugin Provider is connected");"string"===typeof a?a=[a]:Array.isArray(a)||(a=[]);var d=null,c=[];for(d in b)"function"===typeof b[d]&&c.push(d);u[y++]={names:a,methods:c,implementation:b,properties:e||{},listeners:{}}};this.connect=function(b,d){if(!f){if("undefined"===typeof window)p=self;else if(window!==
window.parent)p=window.parent;else if(null!==window.opener)p=window.opener;else{d&&d("No valid plugin target");return}addEventListener("message",k,!1);var c={method:"plugin",params:[a()]};e(c);f=!0}b&&b()};this.disconnect=function(){f&&(removeEventListener("message",k),p=null,f=!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_css/syntax",["orion/editor/stylers/lib/syntax"],function(c){var n="alignment-adjust alignment-baseline animation-delay animation-direction animation-duration animation-iteration-count animation-name animation-play-state animation-timing-function animation appearance azimuth backface-visibility background-attachment background-clip background-color background-image background-origin background-position background-repeat background-size background baseline-shift binding bleed bookmark-label bookmark-level bookmark-state bookmark-target border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-bottom border-collapse border-color border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-image border-left-color border-left-style border-left-width border-left border-radius border-right-color border-right-style border-right-width border-right border-spacing border-style border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-top border-width border bottom box-align box-decoration-break box-direction box-flex-group box-flex box-lines box-ordinal-group box-orient box-pack box-shadow box-sizing break-after break-before break-inside caption-side clear clip color-profile color column-count column-fill column-gap column-rule-color column-rule-style column-rule-width column-rule column-span column-width columns content counter-increment counter-reset crop cue-after cue-before cue cursor direction display dominant-baseline drop-initial-after-adjust drop-initial-after-align drop-initial-before-adjust drop-initial-before-align drop-initial-size drop-initial-value elevation empty-cells fit-position fit flex-align flex-flow flex-inline-pack flex-order flex-pack float-offset float font-family font-size font-size-adjust font-stretch font-style font-variant font-weight font grid-columns grid-rows hanging-punctuation height hyphenate-after hyphenate-before hyphenate-character hyphenate-lines hyphenate-resource hyphens icon image-orientation image-rendering image-resolution inline-box-align left letter-spacing line-height line-stacking-ruby line-stacking-shift line-stacking-strategy line-stacking list-style-image list-style-position list-style-type list-style margin-bottom margin-left margin-right margin-top margin mark-after mark-before mark marker-offset marks marquee-direction marquee-loop marquee-play-count marquee-speed marquee-style max-height max-width min-height min-width move-to nav-down nav-index nav-left nav-right nav-up opacity orphans outline-color outline-offset outline-style outline-width outline overflow-style overflow-x overflow-y overflow padding-bottom padding-left padding-right padding-top padding page-break-after page-break-before page-break-inside page-policy page pause-after pause-before pause perspective-origin perspective phonemes pitch-range pitch play-during position presentation-level punctuation-trim quotes rendering-intent resize rest-after rest-before rest richness right rotation-point rotation ruby-align ruby-overhang ruby-position ruby-span size speak-header speak-numeral speak-punctuation speak speech-rate stress string-set table-layout target-name target-new target-position target text-align-last text-align text-decoration text-emphasis text-height text-indent text-justify text-outline text-shadow text-transform text-wrap top transform-origin transform-style transform transition-delay transition-duration transition-property transition-timing-function transition unicode-bidi vertical-align visibility voice-balance voice-duration voice-family voice-pitch-range voice-pitch voice-rate voice-stress voice-volume volume white-space-collapse white-space widows width word-break word-spacing word-wrap z-index".split(" ");c=
c.grammars;c.push({id:"orion.css",contentTypes:["text/css"],patterns:[{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.css"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.css"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_block"},{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:"#number_hex"},{match:"(?i)\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:%|em|ex|ch|rem|vw|vh|vmin|vmax|in|cm|mm|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?\\b",name:"constant.numeric.value.css"},{match:"(?:-webkit-|-moz-|-ms-|\\b)(?:"+n.join("|")+")\\b",name:"keyword.control.css"}],repository:{number_hex:{match:"#[0-9A-Fa-f]+\\b",name:"constant.numeric.hex.css"}}});
return{id:c[c.length-1].id,grammars:c,keywords:n}});
define("orion/editor/templates",[],function(){function c(b,e,a,d){this.prefix=b;this.description=e;this.template=a;this.name=d;this._parse()}function n(b,e){this._keywords=b||[];this._templates=[];this.addTemplates(e||[])}c.prototype={getProposal:function(b,e,a){b=e-b.length;e={};var d,c=void 0!==a.delimiter?a.delimiter:"\n";a.indentation&&(c+=a.indentation);var g=void 0!==a.tab?a.tab:"\t",h=0,n=this.variables,k=this.segments;a=[];for(var q=0;q<k.length;q++){var f=k[q],p=n[f];if(void 0!==p)switch(f){case "${tab}":f=
g;break;case "${delimiter}":f=c;break;case "${cursor}":f="";d=h;break;default:var m=e[f];m||(m=e[f]={data:p.data,positions:[]});f=p.substitution;m.data&&m.data.values&&(f=m.data.values[0]);m.positions.push({offset:b+h,length:f.length})}a.push(f);h+=f.length}var c=[],v;for(v in e)e.hasOwnProperty(v)&&c.push(e[v]);a=a.join("");void 0===d&&(d=a.length);return{proposal:a,name:this.name,description:this.description,groups:c,escapePosition:b+d,style:"noemphasis"}},match:function(b){return 0===this.prefix.indexOf(b)},
_parse:function(){var b=this.template,e=[],a={},d,c=0,b=b.replace(/\n/g,"${delimiter}"),b=b.replace(/\t/g,"${tab}");b.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(g,h,n){var k=g.substring(2,g.length-1);h=g;var q=k,f=null,p=q.indexOf(":");-1!==p&&(q=q.substring(0,p),h="${"+q+"}",f=JSON.parse(k.substring(p+1).replace("\\}","}").trim()));(k=a[h])||(k=a[h]={});k.substitution=q;f&&(k.data=f);(d=b.substring(c,n))&&e.push(d);e.push(h);c=n+g.length;return q});(d=b.substring(c,b.length))&&e.push(d);this.segments=
e;this.variables=a}};n.prototype={addTemplates:function(b){for(var e=this.getTemplates(),a=0;a<b.length;a++)e.push(new c(b[a].prefix,b[a].description,b[a].template,b[a].name))},computeProposals:function(b,c,a){var d=this.getPrefix(b,c,a),l=[];this.isValid(d,b,c,a)&&(l=l.concat(this.getTemplateProposals(d,c,a)),l=l.concat(this.getKeywordProposals(d)));return l},getKeywords:function(){return this._keywords},getKeywordProposals:function(b){var c=[],a=this.getKeywords();if(a){for(var d=0;d<a.length;d++)0===
a[d].indexOf(b)&&c.push({proposal:a[d].substring(b.length),description:a[d],style:"noemphasis_keyword"});0<c.length&&c.splice(0,0,{proposal:"",description:"Keywords",style:"noemphasis_title_keywords",unselectable:!0})}return c},getPrefix:function(b,c,a){return a.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(b,c,a){for(var d=[],l=this.getTemplates(),g=0;g<l.length;g++){var h=l[g];h.match(b)&&(h=h.getProposal(b,c,a),this.removePrefix(b,h),d.push(h))}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(b,c){if(!(c.overwrite=c.proposal.substring(0,b.length)!==b))c.proposal=c.proposal.substring(b.length)},isValid:function(b,c,a,d){return!0}};return{Template:c,TemplateContentAssist:n}});
define("orion/editor/cssContentAssist",["orion/editor/templates","orion/editor/stylers/text_css/syntax"],function(c,n){function b(a){return JSON.stringify(a).replace("}","\\}")}function e(){}for(var a={type:"link",values:"visible hidden scroll auto no-display no-content".split(" ")},d={type:"link",values:"solid dashed dotted double groove ridge inset outset".split(" ")},l={type:"link",values:[]},g=0;10>g;g++)l.values.push(g.toString());for(var h={type:"link",values:"black white red green blue magenta yellow cyan grey darkred darkgreen darkblue darkmagenta darkcyan darkyellow darkgray lightgray".split(" ")},
s=[{prefix:"rule",description:"rule - class selector rule",template:".${class} {\n\t${cursor}\n}"},{prefix:"rule",description:"rule - id selector rule",template:"#${id} {\n\t${cursor}\n}"},{prefix:"outline",description:"outline - outline style",template:"outline: ${color:"+b(h)+"} ${style:"+b(d)+"} ${width:"+b(l)+"}px;"},{prefix:"background-image",description:"background-image - image style",template:'background-image: url("${uri}");'},{prefix:"url",description:"url - url image",template:'url("${uri}");'},
{prefix:"rgb",description:"rgb - rgb color",template:"rgb(${red},${green},${blue});"},{prefix:"@",description:"import - import style sheet",template:'@import "${uri}";'}],k=[{prop:"display",values:{type:"link",values:"none block box flex inline inline-block inline-flex inline-table list-item table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group inherit".split(" ")}},{prop:"overflow",values:a},{prop:"overflow-x",values:a},{prop:"overflow-y",
values:a},{prop:"float",values:{type:"link",values:["left","right","none","inherit"]}},{prop:"position",values:{type:"link",values:["absolute","fixed","relative","static","inherit"]}},{prop:"cursor",values:{type:"link",values:"auto crosshair default e-resize help move n-resize ne-resize nw-resize pointer progress s-resize se-resize sw-resize text w-resize wait inherit".split(" ")}},{prop:"color",values:h},{prop:"border-top-color",values:h},{prop:"border-bottom-color",values:h},{prop:"border-right-color",
values:h},{prop:"border-left-color",values:h},{prop:"background-color",values:h},{prop:"font-style",values:{type:"link",values:["italic","normal","oblique","inherit"]}},{prop:"font-weight",values:{type:"link",values:"bold normal bolder lighter 100 200 300 400 500 600 700 800 900 inherit".split(" ")}},{prop:"white-space",values:{type:"link",values:"pre pre-line pre-wrap nowrap normal inherit".split(" ")}},{prop:"word-wrap",values:{type:"link",values:["normal","break-word"]}},{prop:"visibility",values:{type:"link",
values:["hidden","visible","collapse","inherit"]}}],g=0;g<k.length;g++)a=k[g],s.push({prefix:a.prop,description:a.prop+" - "+a.prop+" style",template:a.prop+": ${value:"+b(a.values)+"};"});k="width height top bottom left right min-width min-height max-width max-height margin padding padding-left padding-right padding-top padding-bottom margin-left margin-top margin-bottom margin-right".split(" ");for(g=0;g<k.length;g++)a=k[g],s.push({prefix:a,description:a+" - "+a+" pixel style",template:a+": ${value}px;"});
k=["padding","margin"];for(g=0;g<k.length;g++)a=k[g],s.push({prefix:a,description:a+" - "+a+" top right bottom left style",template:a+": ${top}px ${left}px ${bottom}px ${right}px;"}),s.push({prefix:a,description:a+" - "+a+" top right,left bottom style",template:a+": ${top}px ${right_left}px ${bottom}px;"}),s.push({prefix:a,description:a+" - "+a+" top,bottom right,left style",template:a+": ${top_bottom}px ${right_left}px"});k=["border","border-top","border-bottom","border-left","border-right"];for(g=
0;g<k.length;g++)a=k[g],s.push({prefix:a,description:a+" - "+a+" style",template:a+": ${width:"+b(l)+"}px ${style:"+b(d)+"} ${color:"+b(h)+"};"});e.prototype=new c.TemplateContentAssist(n.keywords,s);e.prototype.getPrefix=function(a,b,c){for(c=b;c&&/[A-Za-z\-\@]/.test(a.charAt(c-1));)c--;return c?a.substring(c,b):""};return{CssContentAssistProvider:e}});
define("built-cssPlugin.js",["orion/plugin","orion/editor/stylers/text_css/syntax","orion/editor/cssContentAssist"],function(c,n,b){c=new c({name:"Orion CSS Tool Support",version:"1.0",description:"This plugin provides CSS tools support for Orion."});c.registerServiceProvider("orion.core.contenttype",{},{contentTypes:[{id:"text/css","extends":"text/plain",name:"CSS",extension:["css"],imageClass:"file-sprite-css modelDecorationSprite"}]});c.registerService("orion.edit.contentassist",new b.CssContentAssistProvider,
{name:"CSS content assist",contentType:["text/css"]});c.registerServiceProvider("orion.edit.highlighter",{},n.grammars[n.grammars.length-1]);c.connect()});
//@ sourceMappingURL=built-cssPlugin.js.map