#!/usr/bin/env node
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function c(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,c)}u((n=n.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};exports.__esModule=!0;var Command=require("commander").Command,inquirer=require("inquirer"),init_1=__importDefault(require("./prompts/init")),create_1=__importDefault(require("./prompts/create")),init_2=__importDefault(require("./commandActions/init")),create_2=__importDefault(require("./commandActions/create")),pack_1=__importDefault(require("./commandActions/pack")),start_1=__importDefault(require("./commandActions/start")),guiService_1=__importDefault(require("./services/guiService")),_a=require("./utils/paths"),version=require("./package.json").version,program=new Command;program.version(version,"-v,--VERSION","view cli version"),program.command("init").description("init a new project").action((function(){inquirer.prompt(init_1.default).then((function(e){(0,init_2.default)(e)}))})),program.command("create").description("create a new project powered by canvas-cli").action((function(){inquirer.prompt(create_1.default).then((function(e){(0,create_2.default)(e)}))})),program.command("start").description("server a component or component list").action((function(){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,(0,start_1.default)()];case 1:return e.sent(),[2]}}))}))})),program.command("gui").description("open a operatial graphical user interface").action((function(){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,(0,guiService_1.default)()];case 1:return e.sent(),[2]}}))}))})),program.command("pack [name]").description("pack canvas component").action((function(e){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,(0,pack_1.default)(e)];case 1:return t.sent(),[2]}}))}))})),program.parse();