const packageName = "WXServerlessDevSetting";
var path = require('path');
var fs = require('fs');
Editor.Panel.extend({
style: `
.box{
height:400px;
}
.titleBar{display:none;}
.statusBar{
height:50px;
bottom: 0;
}
.ctrlBar{margin:5px 0;}
:host { margin: 5px; }
h2 { color: #00b26a; }
.containerDiv{
height:200px;
overflow-y: auto;
}
.btnAdd{
float: right;
margin:0 15px;
}
.btnDel{float: right; margin:0 5px;}
.btnFile{
float: right;
margin:0 5px;
}
`,
template: `
<div class="box">
<div class="titleBar">
<h2>微信小游戏云开发配置
<svg width=15 version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 490.5 490.5" style="enable-background:new 0 0 490.5 490.5;" xml:space="preserve">
<g>
<g>
<path d="M381.15,101.6c-5.3-26.2-18.8-50.2-38.8-68.4C318.95,11.8,288.55,0,256.75,0c-24.5,0-48.3,7-68.8,20.3
c-15.8,10.2-29,23.7-38.8,39.5c-3.1-0.4-6.2-0.6-9.4-0.6c-39.9,0-72.4,32.5-72.4,72.4c0,3.7,0.3,7.3,0.8,10.9
c-23.2,18.4-37.1,46.7-37.1,76.7c0,25.2,9.4,49.8,26.5,69.2c17.6,20,41.1,31.7,66,33.1c0.3,0,0.7,0,1,0h45.5c9.9,0,18-8.1,18-18
c0-9.9-8.1-18-18-18h-45c-31.5-2-58.1-32.3-58.1-66.3c0-21.9,11.8-42.3,30.7-53.4c7.6-4.4,10.8-13.6,7.8-21.8
c-1.4-3.9-2.2-8-2.2-12.4c0-20,16.3-36.4,36.4-36.4c4.3,0,8.5,0.7,12.3,2.2c8.8,3.3,18.6-0.7,22.5-9.2
c14.9-31.6,47.2-52.1,82.2-52.1c47.1,0,85.9,35.2,90.4,82c0.8,8.1,6.9,14.7,14.9,16c35,6,61.3,38.3,61.3,75.3
c0,39.1-30.6,73.1-68.4,76.1h-109.7c-9.9,0-18,8.1-18,18v79.2c-16.1,5.5-28.9,18.3-34.4,34.4H86.05c-9.9,0-18,8.1-18,18
c0,9.9,8.1,18,18,18h106.7c7.5,21.8,28.1,37.4,52.4,37.4s44.9-15.7,52.4-37.4h106.7c9.9,0,18-8.1,18-18c0-9.9-8.1-18-18-18h-121.7
c-9.9,0-18,8.1-18,18c0,10.7-8.7,19.4-19.4,19.4s-19.4-8.7-19.4-19.4c0-10.9,8.7-19.6,19.4-19.6c9.9,0,18-8.1,18-18v-76.2h92.5
c0.4,0,0.8,0,1.3,0c27.7-2,53.6-14.7,72.9-35.9c19.1-21,29.6-48,29.6-76.1C459.45,159.7,426.55,115.6,381.15,101.6z" fill="#00b26a"/>
</g>
</g>
</svg></h2>
</div>
<div class="ctrlBar">
<div>指定云开发文件夹: <ui-input id="txtRootPath" placeholder="输入指定路径" :value="yunFuncsRootPath"></ui-input></div>
<ui-button id="btnPath">确定</ui-button>
<hr />
<div>当前云开发文件夹: <span id="label">{{yunFuncsRootPath}}</span>
<template v-if="isAdd">
<ui-button id="btnAddFunc" class="btnAdd tiny" title="添加云函数" disabled>
<svg width="15" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="si-glyph si-glyph-folder-plus">
<!-- Generator: Sketch 3.0.3 (7891) - http://www.bohemiancoding.com/sketch -->
<title>939</title>
<defs></defs>
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g transform="translate(0.000000, 2.000000)" fill="#434343">
<path d="M5.787,0.042 L2.02,0.042 L2.02,1.063 L0.022,1.063 L0.022,10.976 L1.042,10.976 L1.044,11.976 L15.946,11.976 L15.967,3 L7.349,3 L5.787,0.042 L5.787,0.042 Z M7.979,4.979 L9.041,4.979 L9.041,7 L11.062,7 L11.062,8.062 L9.041,8.062 L9.041,10.083 L7.979,10.083 L7.979,8.062 L5.958,8.062 L5.958,7 L7.979,7 L7.979,4.979 L7.979,4.979 Z" fill="#ccc" class="si-glyph-fill"></path>
<path d="M13.964,1.982 L13.964,1.042 L8.024,1.042 L8.354,1.982 L13.964,1.982 Z" class="si-glyph-fill"></path>
</g>
</g>
</svg>
</ui-button>
</template>
<template v-else>
<ui-button title="添加云函数" class="btnAdd tiny green " @confirm="addYunFunc">
<svg width="15" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="si-glyph si-glyph-folder-plus">
<!-- Generator: Sketch 3.0.3 (7891) - http://www.bohemiancoding.com/sketch -->
<title>939</title>
<defs></defs>
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g transform="translate(0.000000, 2.000000)" fill="#434343">
<path d="M5.787,0.042 L2.02,0.042 L2.02,1.063 L0.022,1.063 L0.022,10.976 L1.042,10.976 L1.044,11.976 L15.946,11.976 L15.967,3 L7.349,3 L5.787,0.042 L5.787,0.042 Z M7.979,4.979 L9.041,4.979 L9.041,7 L11.062,7 L11.062,8.062 L9.041,8.062 L9.041,10.083 L7.979,10.083 L7.979,8.062 L5.958,8.062 L5.958,7 L7.979,7 L7.979,4.979 L7.979,4.979 Z" fill="#fff" class="si-glyph-fill"></path>
<path d="M13.964,1.982 L13.964,1.042 L8.024,1.042 L8.354,1.982 L13.964,1.982 Z" class="si-glyph-fill"></path>
</g>
</g>
</svg>
</ui-button>
</template>
</div>
<hr />
</div>
<div class="containerDiv">
<ui-box-container v-for="item in yunFuncs" :key="item.name">
<svg width=10 version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 490.5 490.5" style="enable-background:new 0 0 490.5 490.5;" xml:space="preserve">
<g>
<g>
<path d="M381.15,101.6c-5.3-26.2-18.8-50.2-38.8-68.4C318.95,11.8,288.55,0,256.75,0c-24.5,0-48.3,7-68.8,20.3
c-15.8,10.2-29,23.7-38.8,39.5c-3.1-0.4-6.2-0.6-9.4-0.6c-39.9,0-72.4,32.5-72.4,72.4c0,3.7,0.3,7.3,0.8,10.9
c-23.2,18.4-37.1,46.7-37.1,76.7c0,25.2,9.4,49.8,26.5,69.2c17.6,20,41.1,31.7,66,33.1c0.3,0,0.7,0,1,0h45.5c9.9,0,18-8.1,18-18
c0-9.9-8.1-18-18-18h-45c-31.5-2-58.1-32.3-58.1-66.3c0-21.9,11.8-42.3,30.7-53.4c7.6-4.4,10.8-13.6,7.8-21.8
c-1.4-3.9-2.2-8-2.2-12.4c0-20,16.3-36.4,36.4-36.4c4.3,0,8.5,0.7,12.3,2.2c8.8,3.3,18.6-0.7,22.5-9.2
c14.9-31.6,47.2-52.1,82.2-52.1c47.1,0,85.9,35.2,90.4,82c0.8,8.1,6.9,14.7,14.9,16c35,6,61.3,38.3,61.3,75.3
c0,39.1-30.6,73.1-68.4,76.1h-109.7c-9.9,0-18,8.1-18,18v79.2c-16.1,5.5-28.9,18.3-34.4,34.4H86.05c-9.9,0-18,8.1-18,18
c0,9.9,8.1,18,18,18h106.7c7.5,21.8,28.1,37.4,52.4,37.4s44.9-15.7,52.4-37.4h106.7c9.9,0,18-8.1,18-18c0-9.9-8.1-18-18-18h-121.7
c-9.9,0-18,8.1-18,18c0,10.7-8.7,19.4-19.4,19.4s-19.4-8.7-19.4-19.4c0-10.9,8.7-19.6,19.4-19.6c9.9,0,18-8.1,18-18v-76.2h92.5
c0.4,0,0.8,0,1.3,0c27.7-2,53.6-14.7,72.9-35.9c19.1-21,29.6-48,29.6-76.1C459.45,159.7,426.55,115.6,381.15,101.6z" fill="#00b26a"/>
</g>
</g>
</svg>
<span id="{{item.name}}">{{item.name}}</span>
<ui-button id="{{'btnDel-'+item.name}}"class="red tiny btnDel" title="删除云函数" data-folder="{{item.name}}" @confirm="delFolder">
<svg width="15" viewBox="0 0 17 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="si-glyph si-glyph-folder-error">
<!-- Generator: Sketch 3.0.3 (7891) - http://www.bohemiancoding.com/sketch -->
<title>938</title>
<defs></defs>
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g transform="translate(1.000000, 2.000000)" fill="#434343">
<path d="M7.35,3 L5.788,0.042 L2.021,0.042 L2.021,1.063 L0.023,1.063 L0.023,10.976 L1.043,10.976 L1.045,11.976 L15.947,11.976 L15.968,3 L7.35,3 L7.35,3 Z M10.918,9.109 L10.09,9.938 L8.512,8.361 L6.934,9.938 L6.104,9.109 L7.682,7.531 L6.104,5.953 L6.934,5.125 L8.512,6.701 L10.088,5.125 L10.918,5.953 L9.34,7.531 L10.918,9.109 L10.918,9.109 Z" fill="#fff" class="si-glyph-fill"></path>
<path d="M13.964,1.982 L13.964,1.042 L8.024,1.042 L8.354,1.982 L13.964,1.982 Z"