"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,o,r){void 0===r&&(r=o);var i=Object.getOwnPropertyDescriptor(t,o);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,r,i)}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&__createBinding(t,e,o);return __setModuleDefault(t,e),t};Object.defineProperty(exports,"__esModule",{value:!0});const protocol_1=require("../../../protocol"),protocol_2=require("../../../types/protocol"),Error_1=__importStar(require("../../../common/Error")),api_1=require("../../../config/api");class BlockUtilsBase{constructor(e){this.availableBlockHosts=this.getAvailableBlockHost(),this.execute=e.execute}chooseHost(){return this.execute(protocol_2.ModuleName.ui,protocol_1.UICmdEnum.pick,this.availableBlockHosts,"Please choose host")}checkHost(e){if(!this.availableBlockHosts.find(t=>t.value===e))throw new Error_1.default({code:Error_1.CoreErrorCode.PARAM_ERROR,message:"currently not support "+e,advise:"Please check feature visibility"})}static returnSuccess(e,t){return{code:e,msg:"",data:t}}async getAppMeta(e){return(await this.execute(protocol_2.ModuleName.service,protocol_1.ServiceCmdEnum.Request,api_1.API.getBlockMeta,{lark_version:"",lang:"zh_CN",app_queries:[{extension_queries:[{extension_type:"block",extension_id:e}]}]})).app_metas[0]}}exports.default=BlockUtilsBase;