var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.taskRnvStart=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _betterOpn=_interopRequireDefault(require("better-opn"));
var _common=require("../../core/common");
var _platformManager=require("../../core/platformManager");
var _logger=require("../../core/systemManager/logger");
var _constants=require("../../core/constants");












var _sdkWebpack=require("../../sdk-webpack");
var _engineManager=require("../../core/engineManager");

var taskRnvStart=function taskRnvStart(c,parentTask,originTask){var platform,port,hosted,bundleAssets,isWeinreEnabled;return _regenerator.default.async(function taskRnvStart$(_context){while(1){switch(_context.prev=_context.next){case 0:
platform=c.platform;
port=c.runtime.port;
hosted=c.program.hosted;

(0,_logger.logTask)('taskRnvStart',"parent:"+parentTask+" port:"+port+" hosted:"+!!hosted);if(

parentTask){_context.next=7;break;}_context.next=7;return _regenerator.default.awrap(
(0,_engineManager.executeTask)(c,_constants.TASK_CONFIGURE,_constants.TASK_START,originTask));case 7:


if(hosted){
(0,_sdkWebpack.waitForWebpack)(c).
then(function(){return(0,_betterOpn.default)("http://"+c.runtime.localhost+":"+port+"/");}).
catch(_logger.logError);
}
bundleAssets=(0,_common.getConfigProp)(c,c.platform,'bundleAssets');
isWeinreEnabled=_constants.WEINRE_ENABLED_PLATFORMS.includes(platform)&&!bundleAssets&&!hosted;_context.t0=

platform;_context.next=_context.t0===
_constants.WEB?13:_context.t0===
_constants.TIZEN?13:_context.t0===
_constants.WEBOS?13:_context.t0===
_constants.TIZEN_MOBILE?13:_context.t0===
_constants.TIZEN_WATCH?13:14;break;case 13:return _context.abrupt("return",

(0,_sdkWebpack.runWebpackServer)(c,isWeinreEnabled));case 14:if(!

hosted){_context.next=16;break;}return _context.abrupt("return",
(0,_logger.logError)(
'This platform does not support hosted mode',
true));case 16:return _context.abrupt("return",


(0,_platformManager.logErrorPlatform)(c));case 17:case"end":return _context.stop();}}},null,null,null,Promise);};exports.taskRnvStart=taskRnvStart;var _default=



{
description:'Starts bundler / server',
fn:taskRnvStart,
task:'start',
params:_constants.PARAMS.withBase(_constants.PARAMS.withConfigure()),
platforms:[
_constants.WEB,
_constants.TIZEN,
_constants.WEBOS,
_constants.TIZEN_MOBILE,
_constants.TIZEN_WATCH,
_constants.KAIOS,
_constants.FIREFOX_OS,
_constants.FIREFOX_TV,
_constants.CHROMECAST]};exports.default=_default;
//# sourceMappingURL=task.rnv.start.js.map