diff --git a/Distributed/DistributeDatabaseDrawEts/README.md b/Distributed/DistributeDatabaseDrawEts/README.md
deleted file mode 100644
index 6745afcebb639970b2490fbf52f1b389ca5fdbbd..0000000000000000000000000000000000000000
--- a/Distributed/DistributeDatabaseDrawEts/README.md
+++ /dev/null
@@ -1,944 +0,0 @@
-# 1.介绍
-
-本篇Codelab是用基于TS扩展的声明式开发范式开发一个分布式手写板应用。涉及的OS特性有分布式拉起和分布式数据管理,使用这两个特性实现不同设备间拉起与笔迹同步,即每台设备在书写的时候,连接的其他设备都能实时同步笔迹,效果图如下:
-
-
-
-
-
-> **说明:**
->本示例涉及使用系统接口,需要手动替换Full SDK才能编译通过,具体操作可参考[替换指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md)。
-
-
-# 2.相关概念
-
-[Canvas组件](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md)
-
-[CanvasRenderingContext2D对象](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md)
-
-[分布式数据库](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md)
-
-[FeatureAbility](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-ability-featureAbility.md)
-
-# 3.搭建OpenHarmony环境
-
-完成本篇Codelab我们首先要完成开发环境的搭建,本示例以**Hi3516DV300**开发板为例,参照以下步骤进行:
-
-1. [获取OpenHarmony系统版本](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md#%E8%8E%B7%E5%8F%96%E6%96%B9%E5%BC%8F3%E4%BB%8E%E9%95%9C%E5%83%8F%E7%AB%99%E7%82%B9%E8%8E%B7%E5%8F%96):标准系统解决方案(二进制)。
-
- 以3.0版本为例:
-
- 
-
-2. 搭建烧录环境。
- 1. [完成DevEco Device Tool的安装](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-ide-env-win.md)
- 2. [完成Hi3516开发板的烧录](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-ide-3516-burn.md)
-
-3. 搭建烧录环境。
- 1. 开始前请参考[工具准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/start-overview.md#%E5%B7%A5%E5%85%B7%E5%87%86%E5%A4%87),完成DevEco Studio的安装和开发环境配置。
- 2. 开发环境配置完成后,请参考[使用工程向导](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/start-with-ets-fa.md#%E5%88%9B%E5%BB%BAets%E5%B7%A5%E7%A8%8B)创建工程(模板选择“Empty Ability”),选择JS或者eTS语言开发。
- 3. 工程创建完成后,选择使用[真机进行调测](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/start-with-ets-fa.md#%E4%BD%BF%E7%94%A8%E7%9C%9F%E6%9C%BA%E8%BF%90%E8%A1%8C%E5%BA%94%E7%94%A8)。
-
-# 4.分布式组网
-
-本章节以系统自带的音乐播放器为例(具体以实际的应用为准),介绍如何完成两台设备的分布式组网。
-
-1. 硬件准备:准备两台烧录相同的版本系统的**Hi3516DV300**开发板A、B。
-
-2. 开发板A、B连接同一个WiFi网络。
-
- 打开设置--\>WLAN--\>点击右侧WiFi开关--\>点击目标WiFi并输入密码。
-
- 
-
-3. 将设备A,B设置为互相信任的设备。
-
- - 找到系统应用“音乐”。
- 
-
- - 设备A打开音乐,点击左下角流转按钮,弹出列表框,在列表中会展示远端设备的id。
-
- 
-
- - 选择远端设备B的id,另一台开发板(设备B)会弹出验证的选项框。
-
- 
-
- - 设备B点击允许,设备B将会弹出随机PIN码,将设备B的PIN码输入到设备A的PIN码填入框中。
- 
- 
-
- 配网完毕。
-
-# 5.代码结构解读
-
-本篇Codelab只对核心代码进行讲解,对于完整代码,我们会在[参考](https://gitee.com/openharmony/codelabs/tree/master/Distributed/DistributeDatabaseDrawEts)中提供下载方式,整个工程的代码结构如下:
-
-
-
-- common:存放公共资源
-
- media:存放图片
-
-- model:存放数据模型类
-
-- KvStoreModel.ts:分布式数据存储类
-
-- RemoteDeviceModel.ts:远程设备类
-
-- pages:存放页面
-
- index.ets:主页面
-
-- config.json:配置文件
-
-# 6.编写数据类对象
-
-1. 编写分布式数据类对象
-
- 我们需要创建RemoteDeviceModel类来完成远程设备管理的初始化,RemoteDeviceModel .ts代码如下:
-
- ```
- import deviceManager from '@ohos.distributedHardware.deviceManager';
- var SUBSCRIBE_ID = 100;
- export default class RemoteDeviceModel {
- // 设备列表
- deviceList: any[] = []
- // 回调
- callback: any
- // 设备管理Manager
- #deviceManager: any
- // 构造方法
- constructor() {
- }
- //注册设备回调方法
- registerDeviceListCallback(callback) {
- if (typeof (this.#deviceManager) === 'undefined') {
- let self = this;
- deviceManager.createDeviceManager('com.ohos.distributedRemoteStartFA', (error, value) => {
- if (error) {
- console.error('createDeviceManager failed.');
- return;
- }
- self.#deviceManager = value;
- self.registerDeviceListCallback_(callback);
- });
- } else {
- this.registerDeviceListCallback_(callback);
- }
- }
- //注册设备回调方法
- registerDeviceListCallback_(callback) {
- this.callback = callback;
- if (this.#deviceManager == undefined) {
- this.callback();
- return;
- }
-
- console.info('CookBook[RemoteDeviceModel] getTrustedDeviceListSync begin');
- var list = this.#deviceManager.getTrustedDeviceListSync();
- if (typeof (list) != 'undefined' && typeof (list.length) != 'undefined') {
- this.deviceList = list;
- }
- this.callback();
- let self = this;
- this.#deviceManager.on('deviceStateChange', (data) => {
- switch (data.action) {
- case 0:
- self.deviceList[self.deviceList.length] = data.device;
- self.callback();
- if (self.authCallback != null) {
- self.authCallback();
- self.authCallback = null;
- }
- break;
- case 2:
- if (self.deviceList.length > 0) {
- for (var i = 0; i < self.deviceList.length; i++) {
- if (self.deviceList[i].deviceId === data.device.deviceId) {
- self.deviceList[i] = data.device;
- break;
- }
- }
- }
- self.callback();
- break;
- case 1:
- if (self.deviceList.length > 0) {
- var list = [];
- for (var i = 0; i < self.deviceList.length; i++) {
- if (self.deviceList[i].deviceId != data.device.deviceId) {
- list[i] = data.device;
- }
- }
- self.deviceList = list;
- }
- self.callback();
- break;
- default:
- break;
- }
- });
- this.#deviceManager.on('deviceFound', (data) => {
- console.info('CookBook[RemoteDeviceModel] deviceFound data=' + JSON.stringify(data));
- console.info('CookBook[RemoteDeviceModel] deviceFound self.deviceList=' + self.deviceList);
- console.info('CookBook[RemoteDeviceModel] deviceFound self.deviceList.length=' + self.deviceList.length);
- for (var i = 0; i < self.discoverList.length; i++) {
- if (self.discoverList[i].deviceId === data.device.deviceId) {
- console.info('CookBook[RemoteDeviceModel] device founded, ignored');
- return;
- }
- }
- self.discoverList[self.discoverList.length] = data.device;
- self.callback();
- });
- this.#deviceManager.on('discoverFail', (data) => {
- console.info('CookBook[RemoteDeviceModel] discoverFail data=' + JSON.stringify(data));
- });
- this.#deviceManager.on('serviceDie', () => {
- console.error('CookBook[RemoteDeviceModel] serviceDie');
- });
-
- SUBSCRIBE_ID = Math.floor(65536 * Math.random());
- var info = {
- subscribeId: SUBSCRIBE_ID,
- mode: 0xAA,
- medium: 2,
- freq: 2,
- isSameAccount: false,
- isWakeRemote: true,
- capability: 0
- };
- console.info('CookBook[RemoteDeviceModel] startDeviceDiscovery ' + SUBSCRIBE_ID);
- this.#deviceManager.startDeviceDiscovery(info);
- }
- //身份验证
- authDevice(deviceId, callback) {
- console.info('CookBook[RemoteDeviceModel] authDevice ' + deviceId);
- for (var i = 0; i < this.discoverList.length; i++) {
- if (this.discoverList[i].deviceId === deviceId) {
- console.info('CookBook[RemoteDeviceModel] device founded, ignored');
- let extraInfo = {
- "targetPkgName": 'com.ohos.distributedRemoteStartFA',
- "appName": 'demo',
- "appDescription": 'demo application',
- "business": '0'
- };
- let authParam = {
- "authType": 1,
- "appIcon": '',
- "appThumbnail": '',
- "extraInfo": extraInfo
- };
- console.info('CookBook[RemoteDeviceModel] authenticateDevice ' + JSON.stringify(this.discoverList[i]));
- let self = this;
- this.#deviceManager.authenticateDevice(this.discoverList[i], authParam, (err, data) => {
- if (err) {
- console.info('CookBook[RemoteDeviceModel] authenticateDevice failed, err=' + JSON.stringify(err));
- self.authCallback = null;
- } else {
- console.info('CookBook[RemoteDeviceModel] authenticateDevice succeed, data=' + JSON.stringify(data));
- self.authCallback = callback;
- }
- });
- }
- }
- }
- //取消注册设备回调方法
- unregisterDeviceListCallback() {
- console.info('CookBook[RemoteDeviceModel] stopDeviceDiscovery ' + SUBSCRIBE_ID);
- this.#deviceManager.stopDeviceDiscovery(SUBSCRIBE_ID);
- this.#deviceManager.off('deviceStateChange');
- this.#deviceManager.off('deviceFound');
- this.#deviceManager.off('discoverFail');
- this.#deviceManager.off('serviceDie');
- this.deviceList = [];
- }
- }
- ```
-
-2. 编写远程设备类对象
-
- 我们需要创建KvStoreModel类来完成[分布式数据管理](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md)的初始化工作。首先调用distributedData.createKVManager接口创建一个KVManager对象实例,用于管理数据库对象。然后调用KVManager.getKVStore接口创建并获取KVStore数据库。最后对外提供put、setDataChangeListener方法用于数据写入和订阅数据更新通知。KvStoreModel.ts代码如下:
-
- ```
- import distributedData from '@ohos.data.distributedData';
-
- const STORE_ID = 'DrawBoard_kvstore';
-
- export default class KvStoreModel {
- kvManager: any;
- kvStore: any;
- constructor() {
- }
- createKvStore(callback: any) {
- if (typeof (this.kvStore) === 'undefined') {
- var config = {
- bundleName: 'com.huawei.cookbook',
- userInfo: {
- userId: '0',
- userType: 0
- }
- };
- let self = this;
- console.info('DrawBoard[KvStoreModel] createKVManager begin');
- distributedData.createKVManager(config).then((manager) => {
- console.info('DrawBoard[KvStoreModel] createKVManager success, kvManager=' + JSON.stringify(manager));
- self.kvManager = manager;
- let options = {
- createIfMissing: true,
- encrypt: false,
- backup: false,
- autoSync: true,
- kvStoreType: 0,
- schema: '',
- securityLevel: 1,
- };
- console.info('DrawBoard[KvStoreModel] kvManager.getKVStore begin');
- self.kvManager.getKVStore(STORE_ID, options).then((store) => {
- console.info('DrawBoard[KvStoreModel] getKVStore success, kvStore=' + store);
- self.kvStore = store;
- try {
- self.kvStore.enableSync(true).then((err) => {
- console.log('enableSync success');
- }).catch((err) => {
- console.log('enableSync fail ' + JSON.stringify(err));
- });
- }catch(e) {
- console.log('EnableSync e ' + e);
- }
- callback();
- });
- console.info('DrawBoard[KvStoreModel] kvManager.getKVStore end');
- });
- console.info('DrawBoard[KvStoreModel] createKVManager end');
- } else {
- console.info('DrawBoard[KvStoreModel] KVManager is exist');
- callback();
- }
- }
-
- broadcastMessage(msg: any) {
- console.info('DrawBoard[KvStoreModel] broadcastMessage ' + msg);
- var num = Math.random();
- let self = this;
- this.createKvStore(() => {
- self.put(msg, num);
- });
- }
-
- put(key: any, value: any) {
- if (typeof (this.kvStore) === 'undefined') {
- return;
- }
- console.info('DrawBoard[KvStoreModel] kvStore.put ' + key + '=' + value);
- this.kvStore.put(key, value).then((data: any) => {
- this.kvStore.get(key).then((data:any) => {
- console.info('DrawBoard[KvStoreModel] kvStore.get ' + key + '=' + JSON.stringify(data));
- });
- console.info('DrawBoard[KvStoreModel] kvStore.put ' + key + ' finished, data=' + JSON.stringify(data));
- }).catch((err: JSON) => {
- console.error('DrawBoard[KvStoreModel] kvStore.put ' + key + ' failed, ' + JSON.stringify(err));
- });
- }
-
- get(key: any,callback: any) {
- this.createKvStore(() => {
- this.kvStore.get(key, function (err: any ,data: any) {
- console.log("get success data: " + data);
- callback(data);
- });
- })
- }
-
- setOnMessageReceivedListener(callback: any) {
- console.info('DrawBoard[KvStoreModel] setOnMessageReceivedListener ');
- let self = this;
- this.createKvStore(() => {
- console.info('DrawBoard[KvStoreModel] kvStore.on(dataChange) begin');
- self.kvStore.on('dataChange', 2, (data: any) => {
- console.info('DrawBoard[KvStoreModel] dataChange, ' + JSON.stringify(data));
- console.info('DrawBoard[KvStoreModel] dataChange, insert ' + data.insertEntries.length + ' udpate '
- + data.updateEntries.length);
- if (data.insertEntries.length < 1 && data.updateEntries.length < 1) {
- return;
- }
-
- callback(data);
- });
- console.info('DrawBoard[KvStoreModel] kvStore.on(dataChange) end');
- });
- }
- setDataChangeListener(callback) {
- console.info('DrawBoard[KvStoreModel] setDataChangeListener come in');
- let self = this;
- this.createKvStore(() => {
- console.info('DrawBoard[KvStoreModel] setDataChangeListener createKvStore');
- self.kvStore.on('dataChange',2, (data: any) => {
- console.info('DrawBoard[KvStoreModel] setDataChangeListener kvStore.on');
- if (data.updateEntries.length > 0) {
- console.info('DrawBoard[KvStoreModel] setDataChangeListener callback');
- callback(data);
- }
- });
- });
- }
- }
- ```
-
-# 7.页面设计
-
-分布式手写板页面主要由全屏Path绘制区、顶部操作栏组成。为了实现弹框选择设备的效果,在最外层添加了自定义弹框组件。Path组件设置为全屏显示,根据手指触摸的屏幕坐标直接通过Path绘制轨迹;顶部操作栏加入撤回图标、设备选择图标;自定义弹框加入标题、设备列表。页面样式请在具体代码中查看,页面布局在index.ets中实现。
-
-在index.ets中按照如下步骤编写:
-
-1. 页面整体布局
-
- ```
- @Entry
- @Component
- struct Index {
- build() {
- Column({ space: 1 }) {
- // 用于标题栏布局
- Row() {
- }.backgroundColor(Color.Grey).width('100%').height('10%')
- // 用于Path绘制区布局
- Row() {
- }.width('100%').height('90%')
- }.height('100%').width('100%')
- }
- ```
-
-2. 标题栏布局
-
- ```
- @Entry
- @Component
- struct Index {
- build() {
- Column({ space: 1 }) {
- Row() {
- Image($r('app.media.goback')).width(100).height(100).margin({left:10})
- Blank()
- Image($r('app.media.ic_hop')).width(100).height(100).margin({right:10})
- }.backgroundColor(Color.Grey).width('100%').height('10%')
- ...
- }.height('100%').width('100%')
- }
- }
- ```
-
-3. Canvas绘制区布局
-
- ```
- @Entry
- @Component
- struct Index {
- build() {
- Column({ space: 1 }) {
- Row() {
- ...
- }.backgroundColor(Color.Grey).width('100%').height('10%')
- Row() {
- Canvas(this.context)
- .width('100%')
- .height('100%')
- .backgroundColor('#FFFFFF')
- }.width('100%').height('90%')
- }.height('100%').width('100%')
- }
- ```
-
-4. 自定义弹框设计并引入到主页面中
- 1. 自定义弹框设计
-
- ```
- @CustomDialog
- struct CustomDialogExample {
- controller: CustomDialogController
- cancel: () => void
- confirm: (deviceId, deviceName) => void
- startAbility: (deviceId, deviceName, positionList) => void
- deviceList:() => void
- positionList:() => void
- private selectedIndex: number = 0
- build() {
- Column() {
- Text('选择设备')
- .fontSize(20)
- .width('100%')
- .textAlign(TextAlign.Center)
- .fontColor(Color.Black)
- .fontWeight(FontWeight.Bold)
- List() {
- ForEach(this.deviceList, (item, index) => {
- ListItem() {
- Row() {
- Text(item.name)
- .fontSize(20)
- .width('90%')
- .fontColor(Color.Black)
- if (this.deviceList.indexOf(item) == this.selectedIndex) {
- Image($r('app.media.checked'))
- .width('8%')
- .objectFit(ImageFit.Contain)
- } else {
- Image($r('app.media.uncheck'))
- .width('8%')
- .objectFit(ImageFit.Contain)
- }
- }
- .height(55)
- .onClick(() =>{
- this.selectedIndex = index
- this.controller.close();
- this.startAbility(item.id, item.name, this.positionList)
- })
- }
- }, item => item.id)
- }
-
- Button() {
- Text('取消')
- .fontColor('#0D9FFB')
- .width('90%')
- .textAlign(TextAlign.Center)
- .fontSize(20)
- }
- .type(ButtonType.Capsule)
- .backgroundColor(Color.White)
- .onClick(() => {
- this.controller.close()
- })
- }
- .backgroundColor(Color.White)
- .border({ color: Color.White, radius: 20 })
- .padding(10)
- }
- }
- ```
-
- 2. 引入到主页面
-
- ```
- @Entry
- @Component
- struct Index {
- ...
- dialogController: CustomDialogController = new CustomDialogController({
- builder: CustomDialogExample({ cancel: this.onCancel, confirm: this.onAccept, deviceList: this.deviceList,positionList: this.positionList,startAbility: this.startAbilityContinuation }),
- cancel: this.existApp,
- autoCancel: true,
- deviceList: this.deviceList,
- positionList: this.positionList
- })
- onCancel() {
- console.info('Callback when the first button is clicked')
- }
- onAccept() {
- console.info('Click when confirm')
- }
- existApp() {
- console.info('Click the callback in the blank area')
- }
- build() {
- ...
- }
- }
- ```
-
-5. 为页面设置原始数据
- 1. 在index.ets文件的顶部设置常量数据
-
- ```
- // 默认设备
- var DEVICE_LIST_LOCALHOST = { name: '本机', id: 'localhost' };
- // 用于存放点位信息的key值常量
- const CHANGE_POSITION = 'change_position';
- ```
-
- 2. 在Index组件(Component)中设置基本参数
-
- ```
- @Entry
- @Component
- struct Index {
- // 触控起始位置X轴坐标
- @State startX: number = 0
- // 触控起始位置Y轴坐标
- @State startY: number = 0
- // 触控移动后的位置X轴坐标
- @State moveX: number = 0
- // 触控移动后的位置Y轴坐标
- @State moveY: number = 0
- // 触控结束后的位置X轴坐标
- @State endX: number = 0
- // 触控结束后的位置Y轴坐标
- @State endY: number = 0
- // 设备列表
- @State deviceList: any[] = []
- // BUNDLE_NAME
- private BUNDLE_NAME: string = "com.huawei.cookbook";
- // 分布式数据库类对象
- private kvStoreModel: KvStoreModel = new KvStoreModel()
- // 远程设备类对象
- private remoteDeviceModel: RemoteDeviceModel = new RemoteDeviceModel()
- // 点位集合
- @State positionList: any[] = []
- // 初始化数据
- @State initialData: any[] = []
- // 画布组件
- private settings: RenderingContextSettings = new RenderingContextSettings(true)
- // CanvasRenderingContext2D对象
- private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
- ...
- build() {
- ...
- }
- }
- ```
-
-# 8.设备拉起
-
-点击操作栏“分享图标”,弹出设备选择列表,选中设备后拉起该设备的手写板页面。这里使用[FeatureAbility](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-ability-featureAbility.md)实现设备拉起功能,首先调用FeatureAbility.getDeviceList接口获取设备信息列表,然后调用FeatureAbility.startAbility接口拉起目标设备的FA。此功能在index.js中实现。
-
-
-
-1. config.json中添加分布式权限
-
- ```
- {
- ...
- "module": {
- ...
- "reqPermissions": [{
- "name": "ohos.permission.DISTRIBUTED_DATASYNC"
- }]
- }
- }
- ```
-
-2. 初始化方法中添加动态权限申请代码
-
- ```
- async aboutToAppear() {
- this.grantPermission()
- ...
- }
- grantPermission() {
- console.log('MusicPlayer[IndexPage] grantPermission')
- let context = featureAbility.getContext()
- context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666, function (result) {
- console.log(`MusicPlayer[IndexPage] grantPermission,requestPermissionsFromUser,result.requestCode=${result.requestCode}`)
- })
- }
-
- ```
-
-3. 分享图标添加点击事件
-
- ```
- Image($r('app.media.ic_hop')).width(100).height(100).margin({right:10})
- .onClick(() =>{
- this.onContinueAbilityClick()
- })
- ```
-
-4. 分布式拉起方法实现
-
- ```
- onContinueAbilityClick() {
- console.info('DrawBoard[IndexPage] onContinueAbilityClick');
- let self = this;
- this.remoteDeviceModel.registerDeviceListCallback(() => {
- console.info('DrawBoard[IndexPage] registerDeviceListCallback, callback entered');
- var list = [];
- list[0] = DEVICE_LIST_LOCALHOST
- var deviceList = self.remoteDeviceModel.deviceList;
- console.info('DrawBoard[IndexPage] on remote device updated, count=' + deviceList.length);
- for (var i = 0; i < deviceList.length; i++) {
- console.info('DrawBoard[IndexPage] device ' + i + '/' + deviceList.length + ' deviceId='
- + deviceList[i].deviceId + ' deviceName=' + deviceList[i].deviceName + ' deviceType='
- + deviceList[i].deviceType);
- list[i + 1] = {
- name: deviceList[i].deviceName,
- id: deviceList[i].deviceId,
- };
- }
- self.deviceList = list;
- self.dialogController.open()
- });
- }
- ```
-
-# 9.笔记绘制
-
-Path组件所在的Flex容器组件添加点击事件,并实现记录触控点位信息,绘制轨迹的功能。
-
-1. 添加点击事件
-
- ```
- Row() {
- Canvas(this.context)
- .width('100%')
- .height('100%')
- .backgroundColor('#FFFFFF')
- }.onTouch((event: TouchEvent) => {
- this.onTouchEvent(event)
- }).width('100%').height('90%')
- ```
-
-2. 现记录触控点位信息的方法
-
- ```
- onTouchEvent(event: TouchEvent) {
- let position = {};
- switch(event.type){
- case TouchType.Down:
- this.startX = event.touches[0].x
- this.startY = event.touches[0].y
- position.isFirstPosition = true;
- position.positionX = this.startX;
- position.positionY = this.startY;
- position.isEndPosition = false
- this.context.beginPath()
- this.context.lineWidth = 4
- this.context.lineJoin = 'miter'
- this.context.moveTo(this.startX, this.startY)
- this.pushData(position);
- break;
- case TouchType.Move:
- this.moveX = event.touches[0].x
- this.moveY = event.touches[0].y
- position.isFirstPosition = false;
- position.positionX = this.moveX;
- position.positionY = this.moveY;
- position.isEndPosition = false
- this.context.lineTo(this.moveX, this.moveY)
- this.pushData(position);
- break;
- case TouchType.Up:
- this.endX = event.touches[0].x
- this.endY = event.touches[0].y
- position.isFirstPosition = false;
- position.positionX = this.endX;
- position.positionY = this.endY;
- position.isEndPosition = true
- this.context.stroke()
- this.pushData(position);
- break;
- default:
- break;
- }
- }
- ```
-
-# 10.笔记撤回
-
-笔迹绘制时已经记录了所有笔迹上的坐标点,点击“撤回”按钮后,对记录的坐标点进行倒序删除,当删除最后一笔绘制的起始点坐标后停止删除,然后清空画布对剩余的坐标点进行重新绘制,至此撤回操作完成。此功能在index.ets中实现,代码如下:
-
-1. 添加撤回事件
-
- ```
- Image($r('app.media.goback')).width(100).height(100).margin({left:10})
- .onClick(() =>{
- this.goBack()
- })
- ```
-
-2. 编写撤回事件
-
- ```
- // 撤回上一笔绘制
- goBack() {
- if (this.positionList.length > 0) {
- for (let i = this.positionList.length - 1; i > -1; i--) {
- if (this.positionList[i].isFirstPosition) {
- this.positionList.pop();
- this.redraw();
- break;
- } else {
- this.positionList.pop();
- }
- }
- // 保存点位信息
- this.kvStoreModel.put(CHANGE_POSITION, JSON.stringify(this.positionList));
- }
- }
- ```
-
-# 11.轨迹同步
-
-在设备拉起、笔迹绘制、笔迹撤回时我们需要将对应数据同步到其他设备。
-
-
-
-1. 设备拉起时,通过positionList将笔迹数据发送给目标设备,目标设备在aboutToAppear时将接收到的笔迹数据用Canvas绘制出来,从而实现笔迹的同步。此功能在index.ets中实现,关键代码如下:
-
- 发送端
-
- ```
- startAbilityContinuation(deviceId: string, deviceName: string,positionList: any[] ) {
- // 参数
- var params = {
- // 点位集合
- positionList: JSON.stringify(positionList)
- }
- // 拉起的设备、ability信息等
- var wantValue = {
- bundleName: 'com.huawei.cookbook',
- abilityName: 'com.huawei.distributedatabasedrawetsopenh.MainAbility',
- deviceId: deviceId,
- parameters: params
- };
- // 分布式拉起
- featureAbility.startAbility({
- want: wantValue
- }).then((data) => {
- console.info('DrawBoard[IndexPage] featureAbility.startAbility finished, ' + JSON.stringify(data));
- });
- }
- ```
-
- 接收端
-
- ```
- //函数在创建自定义组件的新实例后,在执行其build函数之前执行
- async aboutToAppear() {
- // 申请分布式权限
- this.grantPermission()
- console.log('DrawBoard[IndexPage] aboutToAppear begin');
- this.initialData = []
- let self = this
- //获取初被拉起时候传来的点位信息
- await featureAbility.getWant()
- .then((Want) => {
- self.positionList = JSON.parse(Want.parameters.positionList)
- console.log('Operation successful. self.positionList: ' + JSON.stringify(self.positionList.length));
- }).catch((error) => {
- console.error('Operation failed. Cause: ' + JSON.stringify(error));
- })
- console.log('DrawBoard[IndexPage] aboutToAppear positionList length=' + self.positionList.length);
- if (self.positionList.length > 0) {
- self.positionList.forEach((num) => {
- self.initialData.push(num);
- });
- console.log('DrawBoard[IndexPage] aboutToAppear initialData='+JSON.stringify(self.initialData))
- // 根军传来的点位信息初始化画布中的手写笔画路径
- self.initDraw();
- }
- console.log('DrawBoard[IndexPage] setDataChangeListener out setDataChangeListener')
- // 监听分布式数据库中数据变化,并根据数据变化重新绘制路径
- self.kvStoreModel.setDataChangeListener((data) => {
- console.log('DrawBoard[IndexPage] setDataChangeListener come in')
- self.positionList = [];
- data.updateEntries.forEach((num) => {
- const list = JSON.parse(num.value.value);
- console.log('DrawBoard[IndexPage] setDataChangeListener list=' + JSON.stringify(list))
- if(list.length === 0) {
- console.log('DrawBoard[IndexPage] setDataChangeListener list.length === 0')
- } else{
- list.forEach((num) => {
- self.positionList.push(num);
- })
- console.log('DrawBoard[IndexPage] setDataChangeListener positionList=' + JSON.stringify(self.positionList))
- }
- self.redraw();
- });
- });
- }
- ...
- // 初始化画板轨迹
- initDraw() {
- this.initialData.forEach((point)=>{
- if(point.isFirstPosition) {
- this.context.beginPath()
- this.context.lineWidth = 4
- this.context.lineJoin = 'miter'
- this.context.moveTo(point.positionX, point.positionY)
- } else{
- this.context.lineTo(point.positionX, point.positionY)
- if(point.isEndPosition) {
- this.context.stroke()
- console.log('DrawBoard[IndexPage] initDraw context.stroke')
- }
- }
- })
- }
- ```
-
-2. 笔迹绘制时,为了避免分布式数据库写入过于频繁,我们设置为每画完一笔,将点位数据提交到数据库。其他设备通过订阅分布式数据更新通知来获取最新的笔迹数据,然后重新绘制笔迹,从而实现笔迹同步。此功能在index.js中实现,关键代码如下:
-
- 发送端
-
- ```
- // 将绘制笔迹写入分布式数据库
- pushData(position: any) {
- this.positionList.push(position);
- console.log('DrawBoard[IndexPage] pushData positionList 1 =' + JSON.stringify(this.positionList.length));
- // 如果为最后手指离开屏幕的点,则写入数据库
- if(position.isEndPosition){
- this.kvStoreModel.put(CHANGE_POSITION, JSON.stringify(this.positionList));
- console.log('DrawBoard[IndexPage] pushData positionList 2 =' + JSON.stringify(this.positionList.length));
- }
- }
- ```
-
- 接收端:
-
- ```
- onInit() {
- ...
- // 订阅分布式数据更新通知
- this.kvStoreModel.setDataChangeListener((data) => {
- console.log('DrawBoard[IndexPage] setDataChangeListener come in')
- self.positionList = [];
- data.updateEntries.forEach((num) => {
- const list = JSON.parse(num.value.value);
- console.log('DrawBoard[IndexPage] setDataChangeListener list=' + JSON.stringify(list))
- if(list.length === 0) {
- console.log('DrawBoard[IndexPage] setDataChangeListener list.length === 0')
- } else{
- list.forEach((num) => {
- self.positionList.push(num);
- })
- console.log('DrawBoard[IndexPage] setDataChangeListener positionList=' + JSON.stringify(self.positionList))
- }
- self.redraw();
- });
- });
- },
- // 重新绘制笔迹
- redraw() {
- console.log('DrawBoard[IndexPage] redraw positionList= ' + JSON.stringify(this.positionList))
- this.context.clearRect(0,0, this.context.width,this.context.height)
- if (this.positionList.length > 0 ) {
- this.positionList.forEach((num) => {
- console.log('DrawBoard[IndexPage] redraw num=')
- console.log('DrawBoard[IndexPage] redraw out isFirstPosition=' + num.isFirstPosition)
- if (num.isFirstPosition) {
- console.log('DrawBoard[IndexPage] redraw isFirstPosition=' + num.isFirstPosition)
- this.context.beginPath()
- this.context.lineWidth = 4
- this.context.lineJoin = 'miter'
- this.context.moveTo(num.positionX, num.positionY)
- console.log('DrawBoard[IndexPage] redraw context.moveTo' + num.positionX+','+ num.positionY)
- } else {
- this.context.lineTo(num.positionX, num.positionY)
- console.log('DrawBoard[IndexPage] redraw context.lineTo' + num.positionX+','+ num.positionY)
- if(num.isEndPosition) {
- this.context.stroke()
- console.log('DrawBoard[IndexPage] redraw context.stroke')
- }
- }
- });
- }
- }
- ```
-
-3. 笔迹撤回时,直接将撤回后的笔迹数据写入分布式数据库,其他设备也是通过订阅分布式数据更新通知来获取最新的笔迹数据,最终实现笔迹同步,这里不再做讲解。
-
-# 12.恭喜您
-
-通过本教程的学习,您已经学会使用基于TS扩展的声明式开发范式中的分布式数据管理和分布式拉起以及利用Canvas组件绘制图形。
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/package.json b/Distributed/DistributeDatabaseDrawEts/entry/package.json
deleted file mode 100644
index 992c771b9e6be8904ce4204f075df58a9b0902cc..0000000000000000000000000000000000000000
--- a/Distributed/DistributeDatabaseDrawEts/entry/package.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "license":"ISC",
- "devDependencies":{},
- "name":"entry",
- "ohos":{
- "org":"huawei",
- "directoryLevel":"module",
- "buildTool":"hvigor"
- },
- "description":"example description",
- "repository":{},
- "version":"1.0.0",
- "dependencies":{}
-}
\ No newline at end of file
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/src/main/config.json b/Distributed/DistributeDatabaseDrawEts/entry/src/main/config.json
deleted file mode 100644
index 2f9ca25e764bf58fe957c1f6e562125fdb20b640..0000000000000000000000000000000000000000
--- a/Distributed/DistributeDatabaseDrawEts/entry/src/main/config.json
+++ /dev/null
@@ -1,69 +0,0 @@
-{
- "app": {
- "bundleName": "com.huawei.cookbook",
- "vendor": "huawei",
- "version": {
- "code": 1000000,
- "name": "1.0.0"
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.huawei.distributedatabasedrawetsopenh",
- "name": ".MyApplication",
- "mainAbility": ".MainAbility",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry",
- "installationFree": false
- },
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "orientation": "unspecified",
- "visible": true,
- "srcPath": "MainAbility",
- "name": ".MainAbility",
- "srcLanguage": "ets",
- "icon": "$media:icon",
- "description": "$string:description_mainability",
- "formsEnabled": false,
- "label": "$string:entry_MainAbility",
- "type": "page",
- "launchType": "standard"
- }
- ],
- "js": [
- {
- "mode": {
- "syntax": "ets",
- "type": "pageAbility"
- },
- "pages": [
- "pages/index"
- ],
- "name": ".MainAbility",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": false
- }
- }
- ],
- "reqPermissions": [{
- "name": "ohos.permission.DISTRIBUTED_DATASYNC"
- }]
- }
-}
\ No newline at end of file
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/app.ets b/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/app.ets
deleted file mode 100644
index b7a0995c8e441cac86e21e06e7c9071664482b1c..0000000000000000000000000000000000000000
--- a/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/app.ets
+++ /dev/null
@@ -1,8 +0,0 @@
-export default {
- onCreate() {
- console.info('Application onCreate')
- },
- onDestroy() {
- console.info('Application onDestroy')
- },
-}
\ No newline at end of file
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/common/media/ic_hop.svg b/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/common/media/ic_hop.svg
deleted file mode 100644
index a3c9baade44146810d8b91691934ab4b7bf98adf..0000000000000000000000000000000000000000
--- a/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/common/media/ic_hop.svg
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
\ No newline at end of file
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/model/KvStoreModel.ts b/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/model/KvStoreModel.ts
deleted file mode 100644
index 4c407fc0dc651b2d0e89e9329dc3ad74a560fbdb..0000000000000000000000000000000000000000
--- a/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/model/KvStoreModel.ts
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import distributedData from '@ohos.data.distributedData';
-
-const STORE_ID = 'DrawBoard_kvstore';
-
-export default class KvStoreModel {
- kvManager: any;
- kvStore: any;
-
- constructor() {
- }
-
- createKvStore(callback: any) {
- if (typeof (this.kvStore) === 'undefined') {
- var config = {
- bundleName: 'com.huawei.cookbook',
- userInfo: {
- userId: '0',
- userType: 0
- }
- };
- let self = this;
- console.info('DrawBoard[KvStoreModel] createKVManager begin');
- distributedData.createKVManager(config).then((manager) => {
- console.info('DrawBoard[KvStoreModel] createKVManager success, kvManager=' + JSON.stringify(manager));
- self.kvManager = manager;
- let options = {
- createIfMissing: true,
- encrypt: false,
- backup: false,
- autoSync: true,
- kvStoreType: 0,
- schema: '',
- securityLevel: 1,
- };
- console.info('DrawBoard[KvStoreModel] kvManager.getKVStore begin');
- self.kvManager.getKVStore(STORE_ID, options).then((store) => {
- console.info('DrawBoard[KvStoreModel] getKVStore success, kvStore=' + store);
- self.kvStore = store;
- try {
- self.kvStore.enableSync(true).then((err) => {
- console.log('enableSync success');
- }).catch((err) => {
- console.log('enableSync fail ' + JSON.stringify(err));
- });
- }catch(e) {
- console.log('EnableSync e ' + e);
- }
- callback();
- });
- console.info('DrawBoard[KvStoreModel] kvManager.getKVStore end');
- });
- console.info('DrawBoard[KvStoreModel] createKVManager end');
- } else {
- console.info('DrawBoard[KvStoreModel] KVManager is exist');
- callback();
- }
- }
-
- broadcastMessage(msg: any) {
- console.info('DrawBoard[KvStoreModel] broadcastMessage ' + msg);
- var num = Math.random();
- let self = this;
- this.createKvStore(() => {
- self.put(msg, num);
- });
- }
-
- put(key: any, value: any) {
- if (typeof (this.kvStore) === 'undefined') {
- return;
- }
- console.info('DrawBoard[KvStoreModel] kvStore.put ' + key + '=' + value);
- this.kvStore.put(key, value).then((data: any) => {
- this.kvStore.get(key).then((data:any) => {
- console.info('DrawBoard[KvStoreModel] kvStore.get ' + key + '=' + JSON.stringify(data));
- });
- console.info('DrawBoard[KvStoreModel] kvStore.put ' + key + ' finished, data=' + JSON.stringify(data));
- }).catch((err: JSON) => {
- console.error('DrawBoard[KvStoreModel] kvStore.put ' + key + ' failed, ' + JSON.stringify(err));
- });
- }
-
- get(key: any,callback: any) {
- this.createKvStore(() => {
- this.kvStore.get(key, function (err: any ,data: any) {
- console.log("get success data: " + data);
- callback(data);
- });
- })
- }
-
- setOnMessageReceivedListener(callback: any) {
- console.info('DrawBoard[KvStoreModel] setOnMessageReceivedListener ');
- let self = this;
- this.createKvStore(() => {
- console.info('DrawBoard[KvStoreModel] kvStore.on(dataChange) begin');
- self.kvStore.on('dataChange', 2, (data: any) => {
- console.info('DrawBoard[KvStoreModel] dataChange, ' + JSON.stringify(data));
- console.info('DrawBoard[KvStoreModel] dataChange, insert ' + data.insertEntries.length + ' udpate '
- + data.updateEntries.length);
- if (data.insertEntries.length < 1 && data.updateEntries.length < 1) {
- return;
- }
-
- callback(data);
- });
- console.info('DrawBoard[KvStoreModel] kvStore.on(dataChange) end');
- });
- }
- setDataChangeListener(callback) {
- console.info('DrawBoard[KvStoreModel] setDataChangeListener come in');
- let self = this;
- this.createKvStore(() => {
- console.info('DrawBoard[KvStoreModel] setDataChangeListener createKvStore');
- self.kvStore.on('dataChange',2, (data: any) => {
- console.info('DrawBoard[KvStoreModel] setDataChangeListener kvStore.on');
- if (data.updateEntries.length > 0) {
- console.info('DrawBoard[KvStoreModel] setDataChangeListener callback');
- callback(data);
- }
- });
- });
- }
-}
\ No newline at end of file
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/model/RemoteDeviceModel.ts b/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/model/RemoteDeviceModel.ts
deleted file mode 100644
index 0e1451b16ccc7299f37345dac37f3039d8de1e41..0000000000000000000000000000000000000000
--- a/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/model/RemoteDeviceModel.ts
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2021 Huawei Device Co., Ltd.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import deviceManager from '@ohos.distributedHardware.deviceManager';
-
-var SUBSCRIBE_ID = 100;
-
-export default class RemoteDeviceModel {
- deviceList: any[] = []
- callback: any
- #deviceManager: any
- discoverList = [];
- authCallback = null;
-
- constructor() {
- }
-
- registerDeviceListCallback(callback: any) {
- if (typeof (this.#deviceManager) === 'undefined') {
- console.log('DrawBoard[RemoteDeviceModel] deviceManager.createDeviceManager begin');
- let self = this;
- deviceManager.createDeviceManager('com.ohos.distributedDrawBoard', (error, value) => {
- if (error) {
- console.error('createDeviceManager failed.');
- return;
- }
- self.#deviceManager = value;
- self.registerDeviceListCallback_(callback);
- console.log('DrawBoard[RemoteDeviceModel] createDeviceManager callback returned, error=' + error + ' value=' + value);
- });
- console.log('DrawBoard[RemoteDeviceModel] deviceManager.createDeviceManager end');
- } else {
- this.registerDeviceListCallback_(callback);
- }
- }
-
- registerDeviceListCallback_(callback) {
- console.info('MusicPlayer[RemoteDeviceModel] registerDeviceListCallback');
- this.callback = callback;
- if (this.#deviceManager == undefined) {
- console.error('MusicPlayer[RemoteDeviceModel] deviceManager has not initialized');
- this.callback();
- return;
- }
-
- console.info('MusicPlayer[RemoteDeviceModel] getTrustedDeviceListSync begin');
- var list = this.#deviceManager.getTrustedDeviceListSync();
- console.info('MusicPlayer[RemoteDeviceModel] getTrustedDeviceListSync end, deviceList=' + JSON.stringify(list));
- if (typeof (list) != 'undefined' && typeof (list.length) != 'undefined') {
- this.deviceList = list;
- }
- this.callback();
- console.info('MusicPlayer[RemoteDeviceModel] callback finished');
-
- let self = this;
- this.#deviceManager.on('deviceStateChange', (data) => {
- console.info('MusicPlayer[RemoteDeviceModel] deviceStateChange data=' + JSON.stringify(data));
- switch (data.action) {
- case 0:
- self.deviceList[self.deviceList.length] = data.device;
- console.info('MusicPlayer[RemoteDeviceModel] online, updated device list=' + JSON.stringify(self.deviceList));
- self.callback();
- if (self.authCallback != null) {
- self.authCallback();
- self.authCallback = null;
- }
- break;
- case 2:
- if (self.deviceList.length > 0) {
- for (var i = 0; i < self.deviceList.length; i++) {
- if (self.deviceList[i].deviceId === data.device.deviceId) {
- self.deviceList[i] = data.device;
- break;
- }
- }
- }
- console.info('MusicPlayer[RemoteDeviceModel] change, updated device list=' + JSON.stringify(self.deviceList));
- self.callback();
- break;
- case 1:
- if (self.deviceList.length > 0) {
- var list = [];
- for (var i = 0; i < self.deviceList.length; i++) {
- if (self.deviceList[i].deviceId != data.device.deviceId) {
- list[i] = data.device;
- }
- }
- self.deviceList = list;
- }
- console.info('MusicPlayer[RemoteDeviceModel] offline, updated device list=' + JSON.stringify(data.device));
- self.callback();
- break;
- default:
- break;
- }
- });
- this.#deviceManager.on('deviceFound', (data) => {
- console.info('MusicPlayer[RemoteDeviceModel] deviceFound data=' + JSON.stringify(data));
- console.info('MusicPlayer[RemoteDeviceModel] deviceFound self.deviceList=' + self.deviceList);
- console.info('MusicPlayer[RemoteDeviceModel] deviceFound self.deviceList.length=' + self.deviceList.length);
- for (var i = 0; i < self.discoverList.length; i++) {
- if (self.discoverList[i].deviceId === data.device.deviceId) {
- console.info('MusicPlayer[RemoteDeviceModel] device founded, ignored');
- return;
- }
- }
- self.discoverList[self.discoverList.length] = data.device;
- self.callback();
- });
- this.#deviceManager.on('discoverFail', (data) => {
- console.info('MusicPlayer[RemoteDeviceModel] discoverFail data=' + JSON.stringify(data));
- });
- this.#deviceManager.on('serviceDie', () => {
- console.error('MusicPlayer[RemoteDeviceModel] serviceDie');
- });
-
- SUBSCRIBE_ID = Math.floor(65536 * Math.random());
- var info = {
- subscribeId: SUBSCRIBE_ID,
- mode: 0xAA,
- medium: 2,
- freq: 2,
- isSameAccount: false,
- isWakeRemote: true,
- capability: 0
- };
- console.info('MusicPlayer[RemoteDeviceModel] startDeviceDiscovery ' + SUBSCRIBE_ID);
- this.#deviceManager.startDeviceDiscovery(info);
- }
-
- unregisterDeviceListCallback() {
- console.info('DrawBoard[RemoteDeviceModel] stopDeviceDiscovery ' + SUBSCRIBE_ID);
- this.#deviceManager.stopDeviceDiscovery(SUBSCRIBE_ID);
- this.#deviceManager.off('deviceStateChange');
- this.#deviceManager.off('deviceFound');
- this.#deviceManager.off('discoverFail');
- this.#deviceManager.off('authResult');
- this.#deviceManager.off('serviceDie');
- this.deviceList = [];
- }
-}
\ No newline at end of file
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/pages/index.ets b/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/pages/index.ets
deleted file mode 100644
index 88d663e81749f2634f3adb0f7f3bd5bfe377d2e5..0000000000000000000000000000000000000000
--- a/Distributed/DistributeDatabaseDrawEts/entry/src/main/ets/MainAbility/pages/index.ets
+++ /dev/null
@@ -1,331 +0,0 @@
-// @ts-nocheck
-import featureAbility from '@ohos.ability.featureAbility';
-import KvStoreModel from '../model/KvStoreModel';
-import RemoteDeviceModel from '../model/RemoteDeviceModel';
-var DEVICE_LIST_LOCALHOST = { name: '本机', id: 'localhost' };
-const CHANGE_POSITION = 'change_position';
-
-@CustomDialog
-struct CustomDialogExample {
- controller: CustomDialogController
- cancel: () => void
- confirm: (deviceId, deviceName) => void
- startAbility: (deviceId, deviceName, positionList) => void
- deviceList:() => void
- positionList:() => void
- private selectedIndex: number = 0
- build() {
- Column() {
- Text('选择设备')
- .fontSize(20)
- .width('100%')
- .textAlign(TextAlign.Center)
- .fontColor(Color.Black)
- .fontWeight(FontWeight.Bold)
- List() {
- ForEach(this.deviceList, (item, index) => {
- ListItem() {
- Row() {
- Text(item.name)
- .fontSize(20)
- .width('90%')
- .fontColor(Color.Black)
- if (this.deviceList.indexOf(item) == this.selectedIndex) {
- Image($r('app.media.checked'))
- .width('8%')
- .objectFit(ImageFit.Contain)
- } else {
- Image($r('app.media.uncheck'))
- .width('8%')
- .objectFit(ImageFit.Contain)
- }
- }
- .height(55)
- .onClick(() =>{
- this.selectedIndex = index
- this.controller.close();
- this.startAbility(item.id, item.name, this.positionList)
- })
- }
- }, item => item.id)
- }
-
- Button() {
- Text('取消')
- .fontColor('#0D9FFB')
- .width('90%')
- .textAlign(TextAlign.Center)
- .fontSize(20)
- }
- .type(ButtonType.Capsule)
- .backgroundColor(Color.White)
- .onClick(() => {
- this.controller.close()
- })
- }
- .backgroundColor(Color.White)
- .border({ color: Color.White, radius: 20 })
- .padding(10)
- }
-}
-
-@Entry
-@Component
-struct Index {
- private startX: number = 0
- private startY: number = 0
- private moveX: number = 0
- private moveY: number = 0
- private endX: number = 0
- private endY: number = 0
- @State deviceList: any[] = []
- private BUNDLE_NAME: string = "com.huawei.cookbook";
- private kvStoreModel: KvStoreModel = new KvStoreModel()
- private remoteDeviceModel: RemoteDeviceModel = new RemoteDeviceModel()
- private positionList: any[] = []
- private initialData: any[] = []
- private settings: RenderingContextSettings = new RenderingContextSettings(true)
- private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
-
- dialogController: CustomDialogController = new CustomDialogController({
- builder: CustomDialogExample({ cancel: this.onCancel, confirm: this.onAccept, deviceList: this.deviceList,positionList: this.positionList,startAbility: this.startAbilityContinuation }),
- cancel: this.existApp,
- autoCancel: true,
- deviceList: this.deviceList,
- positionList: this.positionList
- })
- onCancel() {
- console.log('Callback when the first button is clicked')
- }
- onAccept() {
- console.log('Click when confirm')
- }
- existApp() {
- console.log('Click the callback in the blank area')
- }
-
- build() {
- Column({ space: 1 }) {
- Row() {
- Image($r('app.media.goback')).width(100).height(100).margin({left:10})
- .onClick(() =>{
- this.goBack()
- })
- Blank()
- Image($r('app.media.ic_hop')).width(100).height(100).margin({right:10})
- .onClick(() =>{
- this.onContinueAbilityClick()
- })
- }.backgroundColor(Color.Grey).width('100%').height('10%')
- Row() {
- Canvas(this.context)
- .width('100%')
- .height('100%')
- .backgroundColor('#FFFFFF')
- }.onTouch((event: TouchEvent) => {
- this.onTouchEvent(event)
- }).width('100%').height('90%')
- }.height('100%').width('100%')
- }
- // 函数在创建自定义组件的新实例后,在执行其build函数之前执行
- async aboutToAppear() {
- this.grantPermission()
- console.log('DrawBoard[IndexPage] aboutToAppear begin');
- this.initialData = []
- let self = this
- await featureAbility.getWant()
- .then((Want) => {
- self.positionList = JSON.parse(Want.parameters.positionList)
- console.log('Operation successful. self.positionList: ' + JSON.stringify(self.positionList.length));
- }).catch((error) => {
- console.error('Operation failed. Cause: ' + JSON.stringify(error));
- })
- console.log('DrawBoard[IndexPage] aboutToAppear positionList length=' + self.positionList.length);
- if (self.positionList.length > 0) {
- self.positionList.forEach((num) => {
- self.initialData.push(num);
- });
- console.log('DrawBoard[IndexPage] aboutToAppear initialData='+JSON.stringify(self.initialData))
- self.initDraw();
- }
- console.log('DrawBoard[IndexPage] setDataChangeListener out setDataChangeListener')
- self.kvStoreModel.setDataChangeListener((data) => {
- console.log('DrawBoard[IndexPage] setDataChangeListener come in')
- self.positionList = [];
- data.updateEntries.forEach((num) => {
- const list = JSON.parse(num.value.value);
- console.log('DrawBoard[IndexPage] setDataChangeListener list=' + JSON.stringify(list))
- if(list.length === 0) {
- console.log('DrawBoard[IndexPage] setDataChangeListener list.length === 0')
- } else{
- list.forEach((num) => {
- self.positionList.push(num);
- })
- console.log('DrawBoard[IndexPage] setDataChangeListener positionList=' + JSON.stringify(self.positionList))
- }
- self.redraw();
- });
- });
- }
- grantPermission() {
- console.log('MusicPlayer[IndexPage] grantPermission')
- let context = featureAbility.getContext()
- context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666, function (result) {
- console.log(`MusicPlayer[IndexPage] grantPermission,requestPermissionsFromUser,result.requestCode=${result.requestCode}`)
- })
- }
- // 初始化画板轨迹
- initDraw() {
- this.initialData.forEach((point)=>{
- if(point.isFirstPosition) {
- this.context.beginPath()
- this.context.lineWidth = 4
- this.context.lineJoin = 'miter'
- this.context.moveTo(point.positionX, point.positionY)
- } else{
- this.context.lineTo(point.positionX, point.positionY)
- if(point.isEndPosition) {
- this.context.stroke()
- console.log('DrawBoard[IndexPage] initDraw context.stroke')
- }
- }
- })
- }
- // 轨迹重绘制
- redraw() {
- console.log('DrawBoard[IndexPage] redraw positionList= ' + JSON.stringify(this.positionList))
- this.context.clearRect(0,0, this.context.width,this.context.height)
- if (this.positionList.length > 0 ) {
- this.positionList.forEach((num) => {
- console.log('DrawBoard[IndexPage] redraw num=')
- console.log('DrawBoard[IndexPage] redraw out isFirstPosition=' + num.isFirstPosition)
- if (num.isFirstPosition) {
- console.log('DrawBoard[IndexPage] redraw isFirstPosition=' + num.isFirstPosition)
- this.context.beginPath()
- this.context.lineWidth = 4
- this.context.lineJoin = 'miter'
- this.context.moveTo(num.positionX, num.positionY)
- console.log('DrawBoard[IndexPage] redraw context.moveTo' + num.positionX+','+ num.positionY)
- } else {
- this.context.lineTo(num.positionX, num.positionY)
- console.log('DrawBoard[IndexPage] redraw context.lineTo' + num.positionX+','+ num.positionY)
- if(num.isEndPosition) {
- this.context.stroke()
- console.log('DrawBoard[IndexPage] redraw context.stroke')
- }
- }
- });
- }
- }
-
- // 撤回上一笔绘制
- goBack() {
- if (this.positionList.length > 0) {
- for (let i = this.positionList.length - 1; i > -1; i--) {
- if (this.positionList[i].isFirstPosition) {
- this.positionList.pop();
- break;
- } else {
- this.positionList.pop();
- }
- }
- this.kvStoreModel.put(CHANGE_POSITION, JSON.stringify(this.positionList));
- }
- }
-
- onContinueAbilityClick() {
- console.log('DrawBoard[IndexPage] onContinueAbilityClick');
- let self = this;
- this.remoteDeviceModel.registerDeviceListCallback(() => {
- console.log('DrawBoard[IndexPage] registerDeviceListCallback, callback entered');
- var list = [];
- list[0] = DEVICE_LIST_LOCALHOST
- var deviceList = self.remoteDeviceModel.deviceList;
- console.log('DrawBoard[IndexPage] on remote device updated, count=' + deviceList.length);
- for (var i = 0; i < deviceList.length; i++) {
- console.log('DrawBoard[IndexPage] device ' + i + '/' + deviceList.length + ' deviceId='
- + deviceList[i].deviceId + ' deviceName=' + deviceList[i].deviceName + ' deviceType='
- + deviceList[i].deviceType);
- list[i + 1] = {
- name: deviceList[i].deviceName,
- id: deviceList[i].deviceId,
- };
- }
- self.deviceList = list;
- self.dialogController.open()
- });
- }
-
- startAbilityContinuation(deviceId: string, deviceName: string,positionList: any[] ) {
- var params = {
- positionList: JSON.stringify(positionList)
- }
- console.log('DrawBoard[IndexPage] featureAbility.startAbility positionList=' + JSON.stringify(positionList))
- console.log('DrawBoard[IndexPage] featureAbility.startAbility deviceId=' + deviceId
- + ' deviceName=' + deviceName);
- var wantValue = {
- bundleName: 'com.huawei.cookbook',
- abilityName: 'com.huawei.distributedatabasedrawetsopenh.MainAbility',
- deviceId: deviceId,
- parameters: params
- };
-
- featureAbility.startAbility({
- want: wantValue
- }).then((data) => {
- console.log('DrawBoard[IndexPage] featureAbility.startAbility finished, ' + JSON.stringify(data));
- });
- console.log('DrawBoard[IndexPage] featureAbility.startAbility want=' + JSON.stringify(wantValue));
- console.log('DrawBoard[IndexPage] featureAbility.startAbility end');
- }
-
-
- onTouchEvent(event: TouchEvent) {
- let position = {};
- switch(event.type){
- case TouchType.Down:
- this.startX = event.touches[0].x
- this.startY = event.touches[0].y
- position.isFirstPosition = true;
- position.positionX = this.startX;
- position.positionY = this.startY;
- position.isEndPosition = false
- this.context.beginPath()
- this.context.lineWidth = 4
- this.context.lineJoin = 'miter'
- this.context.moveTo(this.startX, this.startY)
- this.pushData(position);
- break;
- case TouchType.Move:
- this.moveX = event.touches[0].x
- this.moveY = event.touches[0].y
- position.isFirstPosition = false;
- position.positionX = this.moveX;
- position.positionY = this.moveY;
- position.isEndPosition = false
- this.context.lineTo(this.moveX, this.moveY)
- this.pushData(position);
- break;
- case TouchType.Up:
- this.endX = event.touches[0].x
- this.endY = event.touches[0].y
- position.isFirstPosition = false;
- position.positionX = this.endX;
- position.positionY = this.endY;
- position.isEndPosition = true
- this.context.stroke()
- this.pushData(position);
- break;
- default:
- break;
- }
- }
- pushData(position: any) {
- this.positionList.push(position);
- console.log('DrawBoard[IndexPage] pushData positionList 1 =' + JSON.stringify(this.positionList.length));
- if(position.isEndPosition){
- this.kvStoreModel.put(CHANGE_POSITION, JSON.stringify(this.positionList));
- console.log('DrawBoard[IndexPage] pushData positionList 2 =' + JSON.stringify(this.positionList.length));
- }
- }
-}
\ No newline at end of file
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/element/string.json b/Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/element/string.json
deleted file mode 100644
index c2b942aa7bd1269253e383b5da168ab147d765f5..0000000000000000000000000000000000000000
--- a/Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "entry_MainAbility",
- "value": "分布式手写板ETS"
- },
- {
- "name": "description_mainability",
- "value": "ETS_Empty Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/media/goback.png b/Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/media/goback.png
deleted file mode 100644
index 276b223df989c6cc6d6bbb8481fb9d35dc99fa82..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/media/goback.png and /dev/null differ
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/media/ic_hop.svg b/Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/media/ic_hop.svg
deleted file mode 100644
index a3c9baade44146810d8b91691934ab4b7bf98adf..0000000000000000000000000000000000000000
--- a/Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/media/ic_hop.svg
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
\ No newline at end of file
diff --git a/Distributed/DistributeDatabaseDrawEts/figures/1-0.gif b/Distributed/DistributeDatabaseDrawEts/figures/1-0.gif
deleted file mode 100644
index 48827a27bb63fdea1ef0638aa0cf2162992a8120..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/figures/1-0.gif and /dev/null differ
diff --git a/Distributed/DistributeDatabaseDrawEts/figures/1.gif b/Distributed/DistributeDatabaseDrawEts/figures/1.gif
deleted file mode 100644
index 48827a27bb63fdea1ef0638aa0cf2162992a8120..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/figures/1.gif and /dev/null differ
diff --git a/Distributed/DistributeDatabaseDrawEts/figures/2-1.gif b/Distributed/DistributeDatabaseDrawEts/figures/2-1.gif
deleted file mode 100644
index 380b6e53d5b5239243b42c3aba5b51d29a157840..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/figures/2-1.gif and /dev/null differ
diff --git a/Distributed/DistributeDatabaseDrawEts/figures/2.gif b/Distributed/DistributeDatabaseDrawEts/figures/2.gif
deleted file mode 100644
index 380b6e53d5b5239243b42c3aba5b51d29a157840..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/figures/2.gif and /dev/null differ
diff --git a/Distributed/DistributeDatabaseDrawEts/figures/IMG_20211213_103011.jpg b/Distributed/DistributeDatabaseDrawEts/figures/IMG_20211213_103011.jpg
deleted file mode 100644
index e5c162aaab1e9421bc1b7d2571728a840b85897d..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/figures/IMG_20211213_103011.jpg and /dev/null differ
diff --git a/Distributed/DistributeDatabaseDrawEts/figures/IMG_20211217_144057.jpg b/Distributed/DistributeDatabaseDrawEts/figures/IMG_20211217_144057.jpg
deleted file mode 100644
index 157e7be6e99ec8de3693331d74adae9b057298e5..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/figures/IMG_20211217_144057.jpg and /dev/null differ
diff --git a/Distributed/DistributeDatabaseDrawEts/figures/pin.png b/Distributed/DistributeDatabaseDrawEts/figures/pin.png
deleted file mode 100644
index 06badab0e9ffd8c87cc82e9f448f351a0d6f5bae..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/figures/pin.png and /dev/null differ
diff --git a/Distributed/DistributeDatabaseDrawEts/figures/zh-cn_image_0000001192614852.png b/Distributed/DistributeDatabaseDrawEts/figures/zh-cn_image_0000001192614852.png
deleted file mode 100644
index fbfc88b5e8e9e3beb192317f9a6a6be989e2d408..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/figures/zh-cn_image_0000001192614852.png and /dev/null differ
diff --git "a/Distributed/DistributeDatabaseDrawEts/figures/\344\277\241.png" "b/Distributed/DistributeDatabaseDrawEts/figures/\344\277\241.png"
deleted file mode 100644
index 49074a428c2308a29171362bf46171d80c8927f0..0000000000000000000000000000000000000000
Binary files "a/Distributed/DistributeDatabaseDrawEts/figures/\344\277\241.png" and /dev/null differ
diff --git "a/Distributed/DistributeDatabaseDrawEts/figures/\345\217\226\347\211\210\346\234\254.png" "b/Distributed/DistributeDatabaseDrawEts/figures/\345\217\226\347\211\210\346\234\254.png"
deleted file mode 100644
index 9a4203fdba7d630c4d6cf0b60685f27afd85d28a..0000000000000000000000000000000000000000
Binary files "a/Distributed/DistributeDatabaseDrawEts/figures/\345\217\226\347\211\210\346\234\254.png" and /dev/null differ
diff --git "a/Distributed/DistributeDatabaseDrawEts/figures/\346\210\252\345\233\276.png" "b/Distributed/DistributeDatabaseDrawEts/figures/\346\210\252\345\233\276.png"
deleted file mode 100644
index 3ce177f4d3e03464a38d31472b80e82775c68874..0000000000000000000000000000000000000000
Binary files "a/Distributed/DistributeDatabaseDrawEts/figures/\346\210\252\345\233\276.png" and /dev/null differ
diff --git "a/Distributed/DistributeDatabaseDrawEts/figures/\347\241\256\350\256\244.png" "b/Distributed/DistributeDatabaseDrawEts/figures/\347\241\256\350\256\244.png"
deleted file mode 100644
index 4e8a02292e7dfdc20865a8befb3e23ecf0053222..0000000000000000000000000000000000000000
Binary files "a/Distributed/DistributeDatabaseDrawEts/figures/\347\241\256\350\256\244.png" and /dev/null differ
diff --git "a/Distributed/DistributeDatabaseDrawEts/figures/\351\237\263\344\271\220.png" "b/Distributed/DistributeDatabaseDrawEts/figures/\351\237\263\344\271\220.png"
deleted file mode 100644
index a473a3a4a39363f60b6b36cdd930b23aeeab9445..0000000000000000000000000000000000000000
Binary files "a/Distributed/DistributeDatabaseDrawEts/figures/\351\237\263\344\271\220.png" and /dev/null differ
diff --git a/Distributed/DistributeDatabaseDrawEts/package.json b/Distributed/DistributeDatabaseDrawEts/package.json
deleted file mode 100644
index a7bb6cf087e1399719a500ccb9cdac851251697d..0000000000000000000000000000000000000000
--- a/Distributed/DistributeDatabaseDrawEts/package.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "license":"ISC",
- "devDependencies":{},
- "name":"myapplication",
- "ohos":{
- "org":"huawei",
- "directoryLevel":"project",
- "buildTool":"hvigor"
- },
- "description":"example description",
- "repository":{},
- "version":"1.0.0",
- "dependencies":{
- "@ohos/hvigor-ohos-plugin":"1.0.6",
- "hypium":"^1.0.0",
- "@ohos/hvigor":"1.0.6"
- }
-}
\ No newline at end of file
diff --git a/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-caution.gif b/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-caution.gif
deleted file mode 100644
index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-caution.gif and /dev/null differ
diff --git a/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-danger.gif b/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-danger.gif
deleted file mode 100644
index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-danger.gif and /dev/null differ
diff --git a/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-note.gif b/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-note.gif
deleted file mode 100644
index 6314297e45c1de184204098efd4814d6dc8b1cda..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-note.gif and /dev/null differ
diff --git a/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-notice.gif b/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-notice.gif
deleted file mode 100644
index 86024f61b691400bea99e5b1f506d9d9aef36e27..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-notice.gif and /dev/null differ
diff --git a/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-tip.gif b/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-tip.gif
deleted file mode 100644
index 93aa72053b510e456b149f36a0972703ea9999b7..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-tip.gif and /dev/null differ
diff --git a/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-warning.gif b/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-warning.gif
deleted file mode 100644
index 6e90d7cfc2193e39e10bb58c38d01a23f045d571..0000000000000000000000000000000000000000
Binary files a/Distributed/DistributeDatabaseDrawEts/public_sys-resources/icon-warning.gif and /dev/null differ
diff --git a/Distributed/DistributeDraw/AppScope/app.json5 b/Distributed/DistributeDraw/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b210f9190085d39bc1be67a6dd6cfb8a591ce225
--- /dev/null
+++ b/Distributed/DistributeDraw/AppScope/app.json5
@@ -0,0 +1,10 @@
+{
+ "app": {
+ "bundleName": "com.example.distributedraw",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/Distributed/DistributeDraw/AppScope/resources/base/element/string.json b/Distributed/DistributeDraw/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..6b3f4e808122033a6205bac5c8823cfffa114ebc
--- /dev/null
+++ b/Distributed/DistributeDraw/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "DistributeDraw"
+ }
+ ]
+}
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/media/icon.png b/Distributed/DistributeDraw/AppScope/resources/base/media/app_icon.png
similarity index 100%
rename from Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/media/icon.png
rename to Distributed/DistributeDraw/AppScope/resources/base/media/app_icon.png
diff --git a/Distributed/DistributeDatabaseDrawEts/LICENSE b/Distributed/DistributeDraw/LICENSE
similarity index 99%
rename from Distributed/DistributeDatabaseDrawEts/LICENSE
rename to Distributed/DistributeDraw/LICENSE
index 80576ef141485b36eea4aebf25af97020bc2de44..0210352ae2ade0dd7b4c841cb6e8ba08b4780038 100644
--- a/Distributed/DistributeDatabaseDrawEts/LICENSE
+++ b/Distributed/DistributeDraw/LICENSE
@@ -1,4 +1,4 @@
- Copyright (c) 2021 Huawei Device Co., Ltd. All rights reserved.
+ Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/Distributed/DistributeDraw/README.md b/Distributed/DistributeDraw/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..95fa881bd2e0ef9a2ab6766eb4b0afc8e4bea910
--- /dev/null
+++ b/Distributed/DistributeDraw/README.md
@@ -0,0 +1,636 @@
+# 分布式手写板(ArkTS)
+
+## 介绍
+
+本篇Codelab使用设备管理及分布式键值数据库能力,实现多设备之间手写板应用拉起及同步书写内容的功能。操作流程:
+
+1. 设备连接同一无线网络,安装分布式手写板应用。进入应用,点击允许使用多设备协同,点击主页上查询设备按钮,显示附近设备。
+2. 选择设备确认,若已建立连接,启动对方设备上的手写板应用,否则提示建立连接。输入PIN码建立连接后再次点击查询设备按钮,选择设备提交,启动对方设备应用。
+3. 建立连接前绘制的内容在启动对方设备后同步,此时设备上绘制的内容会在另一端同步绘制。
+4. 点击撤销按钮,两侧设备绘制内容同步撤销。
+
+
+
+### 相关概念
+
+- [设备管理](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-device-manager.md):模块提供分布式设备管理能力。
+- [分布式键值数据库](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-distributedKVStore.md):分布式键值数据库为应用程序提供不同设备间数据库的分布式协同能力。
+
+### 相关权限
+
+本篇Codelab使用了设备管理及分布式键值数据库能力,需要手动替换full-SDK,并在配置文件module.json5文件requestPermissions属性中添加如下权限:
+
+- [分布式设备认证组网权限](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/permission-list.md#ohospermissionaccess_service_dm):ohos.permission.ACCESS\_SERVICE\_DM。
+- [设备间的数据交换权限](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/permission-list.md#ohospermissiondistributed_datasync):ohos.permission.DISTRIBUTED\_DATASYNC。
+
+### 约束与限制
+
+1. 本篇Codelab部分能力依赖于系统API,需下载full-SDK并替换DevEco Studio自动下载的public-SDK。具体操作可参考指南[《如何替换full-SDK》](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/faqs/full-sdk-switch-guide.md)。
+2. 本篇Codelab使用的部分API仅系统应用可用,需要提升应用等级。具体可参考指南[《访问控制授权申请指导》](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/accesstoken-overview.md#%E5%BA%94%E7%94%A8apl%E7%AD%89%E7%BA%A7%E8%AF%B4%E6%98%8E)。
+
+## 环境搭建
+
+### 软件要求
+
+- [DevEco Studio](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/start-overview.md#%E5%B7%A5%E5%85%B7%E5%87%86%E5%A4%87)版本:DevEco Studio 3.1 Release及以上版本。
+- OpenHarmony SDK版本:API version 10及以上版本。
+
+### 硬件要求
+
+- 开发板类型:[润和RK3568开发板](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-appendix-rk3568.md)。
+- OpenHarmony系统:4.0 Beta1及以上版本。
+
+### 环境搭建
+
+完成本篇Codelab我们首先要完成开发环境的搭建,本示例以**RK3568**开发板为例,参照以下步骤进行:
+
+1. [获取OpenHarmony系统版本](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md#%E8%8E%B7%E5%8F%96%E6%96%B9%E5%BC%8F3%E4%BB%8E%E9%95%9C%E5%83%8F%E7%AB%99%E7%82%B9%E8%8E%B7%E5%8F%96):标准系统解决方案(二进制)。以4.0 Beta1版本为例:
+
+ 
+
+2. 搭建烧录环境。
+ 1. [完成DevEco Device Tool的安装](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-ide-env-win.md)
+ 2. [完成RK3568开发板的烧录](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-ide-3568-burn.md)
+
+3. 搭建开发环境。
+ 1. 开始前请参考[工具准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/start-overview.md#%E5%B7%A5%E5%85%B7%E5%87%86%E5%A4%87),完成DevEco Studio的安装和开发环境配置。
+ 2. 开发环境配置完成后,请参考[使用工程向导](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/start-with-ets-stage.md#创建arkts工程)创建工程(模板选择“Empty Ability”)。
+ 3. 工程创建完成后,选择使用[真机进行调测](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/start-with-ets-stage.md#使用真机运行应用)。
+
+## 代码结构解读
+
+本篇Codelab只对核心代码进行讲解,对于完整代码,我们会在gitee中提供。
+
+```
+├──entry/src/main/ets // 代码区
+│ ├──common
+│ │ ├──bean
+│ │ │ └──Position.ets // 绘制位置信息类
+│ │ ├──constants
+│ │ │ └──CommonConstants.ets // 公共常量类
+│ │ └──utils
+│ │ ├──Logger.ets // 日志打印类
+│ │ └──RemoteDeviceUtil.ets // 设备管理类
+│ ├──entryability
+│ │ └──EntryAbility.ets // 程序入口类
+│ ├──pages
+│ │ └──Index.ets // 主界面
+│ ├──view
+│ │ └──CustomDialogComponent.ets // 自定义弹窗组件类
+│ └──viewmodel
+│ └──KvStoreModel.ets // 分布式键值数据库管理类
+└──entry/src/main/resources // 资源文件目录
+```
+
+## 界面设计
+
+主界面由导航栏及绘制区域组成,导航栏包含撤回按钮及查询设备按钮。绘制区域使用Canvas画布组件展示绘制效果。Index.ets文件完成界面实现,使用Column及Row容器组件进行布局。
+
+
+
+``` typescript
+// Index.ets
+let storage = LocalStorage.GetShared();
+@Entry(storage)
+@Component
+struct Index {
+ ...
+ build() {
+ Column() {
+ Row() {
+ // 撤回按钮
+ Image($r('app.media.ic_back'))
+ .width($r('app.float.ic_back_width'))
+ .height($r('app.float.ic_back_height'))
+ Blank()
+ // 查找设备按钮
+ Image($r('app.media.ic_hop'))
+ .width($r('app.float.ic_hop_width'))
+ .height($r('app.float.ic_hop_height'))
+ }
+ .width(CommonConstants.FULL_PERCENT)
+ .height(CommonConstants.TITLE_HEIGHT)
+
+ Row() {
+ // 绘制区域
+ Canvas(this.canvasContext)
+ .width(CommonConstants.FULL_PERCENT)
+ .height(CommonConstants.FULL_PERCENT)
+ }
+ .width(CommonConstants.FULL_PERCENT)
+ .layoutWeight(CommonConstants.NUMBER_ONE)
+ }
+ .height(CommonConstants.FULL_PERCENT)
+ .width(CommonConstants.FULL_PERCENT)
+ }
+ ...
+}
+```
+
+## 分布式组网
+
+### 准备分布式环境
+
+创建设备管理器。设备管理器创建完成后注册设备上线离线监听,信任设备上线离线时触发。执行获取本地设备信息,获取信任设备列表,初始化展示设备列表等方法。其中deviceManager类需使用full-SDK。
+
+``` typescript
+// RemoteDeviceModel.ets
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+
+class RemoteDeviceModel {
+ ...
+ async createDeviceManager(): Promise {
+ ...
+ await new Promise((resolve, reject) => {
+ try {
+ // 创建设备管理器
+ deviceManager.createDeviceManager(CommonConstants.BUNDLE_NAME, (error, value) => {
+ ...
+ this.myDeviceManager = value;
+ // 注册信任设备上线离线监听
+ this.registerDeviceStateListener();
+ // 获取本地设备信息
+ this.getLocalDeviceInfo();
+ // 获取信任设备列表
+ this.getTrustedDeviceList();
+ // 初始化展示设备列表
+ this.initDeviceList();
+ resolve();
+ });
+ } catch (error) {
+ Logger.error('RemoteDeviceModel',
+ `createDeviceManager failed, error code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ });
+ }
+ ...
+}
+```
+
+注册设备状态监听。已验证设备上线或有新设备验证通过时状态类型为ONLINE,将设备添加至信任设备列表。设备离线时状态类型为OFFLINE,将设备从信任列表中移除。
+
+``` typescript
+// RemoteDeviceModel.ets
+class RemoteDeviceModel {
+ ...
+ // 注册设备状态改变监听
+ registerDeviceStateListener(): void {
+ ...
+ try {
+ // 注册监听
+ this.myDeviceManager.on('deviceStateChange', (data) => {
+ ...
+ switch (data.action) {
+ // 设备上线
+ case deviceManager.DeviceStateChangeAction.ONLINE: {
+ this.deviceStateChangeActionOnline(data.device);
+ break;
+ }
+ // 设备离线
+ case deviceManager.DeviceStateChangeAction.OFFLINE: {
+ this.deviceStateChangeActionOffline(data.device);
+ break;
+ }
+ ...
+ }
+ });
+ } catch (error) {
+ Logger.error('RemoteDeviceModel',
+ `registerDeviceStateListener on('deviceStateChange') failed, code=${error.code}, msg=${error.message}`);
+ }
+ }
+
+ // 设备上线,加入信任列表及展示列表
+ deviceStateChangeActionOnline(device: deviceManager.DeviceInfo): void {
+ this.trustedDeviceList[this.trustedDeviceList.length] = device;
+ this.addToDeviceList(device);
+ }
+
+ // 设备下线,将设备移出信任列表和展示列表
+ deviceStateChangeActionOffline(device: deviceManager.DeviceInfo): void {
+ let list: deviceManager.DeviceInfo[] = [];
+ for (let i: number = 0; i < this.trustedDeviceList.length; i++) {
+ if (this.trustedDeviceList[i].networkId !== device.networkId) {
+ list.push(this.trustedDeviceList[i]);
+ continue;
+ }
+ }
+ this.deleteFromDeviceList(device);
+ this.trustedDeviceList = list;
+ }
+ ...
+}
+```
+
+### 建立分布式连接
+
+点击主界面的查询设备按钮,执行发现设备方法,注册设备发现监听任务,同时拉起弹窗展示设备列表。当弹窗关闭时,执行停止发现设备方法,注销监听任务。
+
+
+
+``` typescript
+// RemoteDeviceModel.ets
+class RemoteDeviceModel {
+ ...
+ startDeviceDiscovery(): void {
+ ...
+ try {
+ // 注册发现设备监听
+ this.myDeviceManager.on('deviceFound', (data) => {
+ ...
+ // 处理发现的设备
+ this.deviceFound(data);
+ });
+ ...
+ // 发现周边设备
+ this.myDeviceManager.startDeviceDiscovery(info);
+ } catch (error) {
+ Logger.error('RemoteDeviceModel',
+ `startDeviceDiscovery failed code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ }
+
+ // 处理新发现的设备
+ deviceFound(data): void {
+ for (let i: number = 0; i < this.discoverList.length; i++) {
+ if (this.discoverList[i].deviceId === data.device.deviceId) {
+ Logger.info('RemoteDeviceModel', `deviceFound device exist=${JSON.stringify(data)}`);
+ return;
+ }
+ }
+ this.discoverList[this.discoverList.length] = data.device;
+ this.addToDeviceList(data.device);
+ }
+
+ // 停止发现设备
+ stopDeviceDiscovery(): void {
+ ...
+ try {
+ // 停止发现设备
+ this.myDeviceManager.stopDeviceDiscovery(this.subscribeId);
+ // 注销监听任务
+ this.myDeviceManager.off('deviceFound');
+ } catch (error) {
+ Logger.error('RemoteDeviceModel',
+ `stopDeviceDiscovery failed code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ }
+ ...
+}
+```
+
+选择弹窗内的设备项提交后,执行设备验证。
+
+1. 若设备在信任设备列表,执行startAbility\(\)方法启动连接设备上的应用,将当前的绘制信息作为参数发送至连接设备。
+2. 若设备不是信任设备,执行authenticateDevice()方法启动验证。此时连接设备提示是否接受,接收连接后连接设备展示PIN码,本地设备输入PIN码确认后连接成功。再次点击查询设备按钮,选择已连接设备,点击确认启动连接设备上的应用。
+
+``` typescript
+// RemoteDeviceModel.ets
+class RemoteDeviceModel {
+ ...
+ // 设备验证
+ authenticateDevice(context: common.UIAbilityContext, device: deviceManager.DeviceInfo, positionList: Position[]): void {
+ // 设备为信任设备,启动连接设备上的应用
+ let tmpList = this.trustedDeviceList.filter((item: deviceManager.DeviceInfo) => device.deviceId === item.deviceId);
+ if (tmpList.length > 0) {
+ this.startAbility(context, device, positionList);
+ return;
+ }
+ ...
+ try {
+ // 执行设备认证,启动验证相关弹窗,接受信任,显示PIN码,输入PIN码等
+ this.myDeviceManager.authenticateDevice(device, authParam, (err, data) => {
+ ...
+ })
+ } catch (error) {
+ Logger.error('RemoteDeviceModel',
+ `authenticateDevice failed code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ }
+
+ // 启动连接设备上的应用
+ startAbility(context: common.UIAbilityContext, device: deviceManager.DeviceInfo, positionList: Position[]): void {
+ ...
+ // 启动连接设备上的应用
+ context.startAbility(wantValue).then(() => {
+ Logger.info('RemoteDeviceModel', `startAbility finished wantValue=${JSON.stringify(wantValue)}`);
+ }).catch((error) => {
+ Logger.error('RemoteDeviceModel', `startAbility failed,code=${error.code},msg=${JSON.stringify(error.message)}`);
+ })
+ }
+ ...
+}
+```
+
+### 资源释放
+
+程序关闭时,注销设备状态监听任务,并释放DeviceManager实例。
+
+``` typescript
+// RemoteDeviceModel.ets
+class RemoteDeviceModel {
+ ...
+ // 注销监听任务
+ unregisterDeviceListCallback(): void {
+ ...
+ try {
+ // 注销设备状态监听
+ this.myDeviceManager.off('deviceStateChange');
+ // 释放DeviceManager实例
+ this.myDeviceManager.release();
+ } catch (err) {
+ Logger.error('RemoteDeviceModel',
+ `unregisterDeviceListCallback stopDeviceDiscovery failed, code=${err.code}, msg=${err.message}`);
+ }
+ }
+ ...
+}
+```
+
+## 绘制功能
+
+Canvas组件区域监听触摸事件,按照按下、移动、抬起等触摸事件,记录绘制的起点、中间点以及终点。触摸事件触发时,使用CanvasRenderingContext2D对象的绘制方法根据位置信息进行绘制。绘制结束后,将当前位置信息列表存入分布式键值数据库。
+
+``` typescript
+// Index.ets
+let storage = LocalStorage.getShared();
+@Entry(storage)
+@Component
+struct Index {
+ ...
+ build() {
+ Column() {
+ ...
+ Row() {
+ Canvas(this.canvasContext)
+ }
+ .onTouch((event: TouchEvent) => {
+ this.onTouchEvent(event);
+ })
+ }
+ }
+
+ // 绘制事件
+ onTouchEvent(event: TouchEvent): void {
+ let positionX:number = event.touches[0].x;
+ let positionY:number = event.touches[0].y;
+ switch (event.type) {
+ // 手指按下
+ case TouchType.Down: {
+ this.canvasContext.beginPath();
+ this.canvasContext.lineWidth = CommonConstants.CANVAS_LINE_WIDTH;
+ this.canvasContext.lineJoin = CommonConstants.CANVAS_LINE_JOIN;
+ this.canvasContext.moveTo(positionX, positionY);
+ this.pushData(false, false, positionX, positionY);
+ break;
+ }
+ // 手指移动
+ case TouchType.Move: {
+ this.canvasContext.lineTo(positionX, positionY);
+ this.pushData(false, false, positionX, positionY);
+ break;
+ }
+ // 手指抬起
+ case TouchType.Up: {
+ this.canvasContext.lineTo(positionX, positionY);
+ this.canvasContext.stroke();
+ this.pushData(false, true, positionX, positionY);
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+
+ pushData(isFirstPosition: boolean, isEndPosition, positionX: number, positionY: number): void {
+ let position = new Position(isFirstPosition, isEndPosition, positionX, positionY);
+ // 存入位置信息列表
+ this.positionList.push(position);
+ if (position.isEndPosition) {
+ // 当前位置为终点时,将位置信息列表存入分布式键值数据库
+ this.kvStoreModel.put(CommonConstants.CHANGE_POSITION, JSON.stringify(this.positionList));
+ }
+ }
+}
+```
+
+点击撤销按钮时,从位置列表中后序遍历移除位置信息,直到找到轨迹的初始位置,完成移除上一次绘制的轨迹。移除完成后将位置信息列表存入分布式键值数据库中。执行redraw\(\)方法,清空画板上的内容,遍历位置信息列表,重新绘制。
+
+
+
+``` typescript
+// Index.ets
+let storage = LocalStorage.getShared();
+@Entry(storage)
+@Component
+struct Index {
+ @LocalStorageProp('positionList') positionList: Position[] = [];
+ build() {
+ Column() {
+ Row() {
+ // 撤销按钮
+ Image($r('app.media.ic_back'))
+ .width($r('app.float.ic_back_width'))
+ .height($r('app.float.ic_back_height'))
+ .margin({ left: CommonConstants.ICON_MARGIN_LEFT })
+ .onClick(() => {
+ this.goBack();
+ })
+ ...
+ }
+ .width(CommonConstants.FULL_PERCENT)
+ .height(CommonConstants.TITLE_HEIGHT)
+ ...
+ }
+
+ // 撤回上一笔绘制
+ goBack() {
+ if (this.positionList.length === 0) {
+ return;
+ }
+ // 移除位置信息直到位置起始位置
+ for (let i: number = this.positionList.length - 1; i >= 0; i--) {
+ if (this.positionList[i].isFirstPosition) {
+ this.positionList.pop();
+ break;
+ } else {
+ this.positionList.pop();
+ }
+ }
+ this.redraw();
+ this.kvStoreModel.put(CommonConstants.CHANGE_POSITION, JSON.stringify(this.positionList));
+ }
+
+ redraw() {
+ // 删除画布内的绘制内容
+ this.canvasContext.clearRect(0, 0, this.canvasContext.width, this.canvasContext.height);
+ // 使用当前记录的位置信息,重新绘制
+ this.positionList.forEach((position) => {
+ if (position.isFirstPosition) {
+ this.canvasContext.beginPath();
+ this.canvasContext.lineWidth = CommonConstants.CANVAS_LINE_WIDTH;
+ this.canvasContext.lineJoin = CommonConstants.CANVAS_LINE_JOIN;
+ this.canvasContext.moveTo(position.positionX, position.positionY);
+ } else {
+ this.canvasContext.lineTo(position.positionX, position.positionY);
+ if (position.isEndPosition) {
+ this.canvasContext.stroke();
+ }
+ }
+ });
+ }
+}
+```
+
+## 分布式键值数据库
+
+使用分布式键值数据库需申请数据交换权限:ohos.permission.DISTRIBUTED\_DATASYNC,指导参考[向用户申请授权](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/accesstoken-guidelines.md#%E5%90%91%E7%94%A8%E6%88%B7%E7%94%B3%E8%AF%B7%E6%8E%88%E6%9D%83)。
+
+应用启动时创建分布式键值数据库,设置数据库数据改变监听。数据改变时执行回调,获取插入或更新数据列表,遍历列表,匹配位置信息列表的设置key,更新位置列表后重新绘制。
+
+``` typescript
+// Index.ets
+import KvStoreModel from '../viewmodel/KvStoreModel';
+let storage = LocalStorage.getShared();
+@Entry(storage)
+@Component
+struct Index {
+ private kvStoreModel: KvStoreModel = new KvStoreModel();
+ ...
+ aboutToAppear() {
+ this.createKVStore();
+ }
+
+ createKVStore(): void {
+ this.context = getContext(this) as common.UIAbilityContext;
+ // 创建分布式键值数据库
+ this.kvStoreModel.createKvStore(this.context, (data: distributedKVStore.ChangeNotification) => {
+ // 使用分布式键值数据库内的内容重置位置信息列表
+ this.positionList = [];
+ let entries: distributedKVStore.Entry[] = data.insertEntries.length > 0 ? data.insertEntries : data.updateEntries;
+ entries.forEach((entry: distributedKVStore.Entry) => {
+ if (CommonConstants.CHANGE_POSITION === entry.key) {
+ this.positionList = JSON.parse((entry.value.value) as string);
+ // 位置信息列表更新后,重新绘制
+ this.redraw();
+ }
+ });
+ });
+ }
+ ...
+}
+```
+
+创建分布式键值数据库。设置数据库类型为KVStoreType.SINGLE\_VERSION单版本数据库,其他配置参考[创建数据库配置信息](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md#options)。创建数据库成功后,调用enableSync\(\)方法开启同步,调用setDataChangeListener\(\)方法订阅数据变更通知。
+
+``` typescript
+// KvStoreModel.ets
+export default class KvStoreModel {
+ kvStore: distributedKVStore.SingleKVStore;
+ ...
+ createKvStore(context: common.UIAbilityContext, callback: (data: distributedKVStore.ChangeNotification) => void): void {
+ ...
+ try {
+ // 创建一个KVManager对象实例,用于管理数据库对象
+ this.kvManager = distributedKVStore.createKVManager(config);
+ } catch (error) {
+ Logger.error('KvStoreModel',
+ `createKvStore createKVManager failed, code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ return;
+ }
+
+ // 创建数据库的配置信息
+ let options: distributedKVStore.Options = {
+ ...
+ kvStoreType: distributedKVStore.KVStoreType.SINGLE_VERSION
+ };
+
+ // 获取分布式键值数据库
+ this.kvManager.getKVStore(CommonConstants.KVSTORE_ID, options).then((store: distributedKVStore.SingleKVStore) => {
+ ...
+ this.kvStore = store;
+ // 开启同步
+ this.kvStore.enableSync(true);
+ // 订阅数据变更通知
+ this.setDataChangeListener(callback);
+ }).catch((error) => {
+ Logger.error('getKVStore',
+ `createKvStore getKVStore failed, code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ })
+ }
+ ...
+}
+```
+
+订阅数据变更通知。创建分布式键值数据库,设置数据变更订阅,订阅类型为全部,当更新数据集或插入数据集大于0时,执行传入的callback\(\)方法。
+
+``` typescript
+// KvStoreModel.ets
+export default class KvStoreModel {
+ kvStore: distributedKVStore.SingleKVStore;
+ ...
+ setDataChangeListener(callback: (data: distributedKVStore.ChangeNotification) => void): void {
+ ...
+ try {
+ // 订阅数据变更通知
+ this.kvStore.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_ALL,
+ (data: distributedKVStore.ChangeNotification) => {
+ if ((data.updateEntries.length > 0) || (data.insertEntries.length > 0)) {
+ callback(data);
+ }
+ });
+ } catch (error) {
+ Logger.error('KvStoreModel',
+ `setDataChangeListener on('dataChange') failed, code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ }
+ ...
+}
+```
+
+应用退出时,分布式键值数据库取消数据改变监听。
+
+``` typescript
+// Index.ets
+import KvStoreModel from '../viewmodel/KvStoreModel';
+let storage = LocalStorage.getShared();
+@Entry(storage)
+@Component
+struct Index {
+ private kvStoreModel: KvStoreModel = new KvStoreModel();
+ ...
+ aboutToDisappear() {
+ this.kvStoreModel.removeDataChangeListener();
+ }
+ ...
+}
+
+// KvStoreModel.ets
+export default class KvStoreModel {
+ kvStore: distributedKVStore.SingleKVStore;
+ ...
+ removeDataChangeListener(): void {
+ ...
+ try {
+ // 取消数据改变监听
+ this.kvStore.off('dataChange');
+ } catch (error) {
+ Logger.error('KvStoreModel',
+ `removeDataChangeListener off('dataChange') failed, code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ }
+ ...}
+```
+
+## 总结
+
+您已经完成了本次Codelab的学习,并了解到以下知识点:
+
+1. 申请分布式相关权限的流程。
+2. 建立分布式连接的方法。
+3. Canvas组件的使用。
+4. 分布式键值数据库的使用。
+
+
+
diff --git a/Distributed/DistributeDatabaseDrawEts/build-profile.json5 b/Distributed/DistributeDraw/build-profile.json5
similarity index 63%
rename from Distributed/DistributeDatabaseDrawEts/build-profile.json5
rename to Distributed/DistributeDraw/build-profile.json5
index 3854f71fc436e7d67fb03828698562f4dc8a3abb..163138c16ef4b0acbd90f1d43415a227d6422fdb 100644
--- a/Distributed/DistributeDatabaseDrawEts/build-profile.json5
+++ b/Distributed/DistributeDraw/build-profile.json5
@@ -1,12 +1,21 @@
{
"app": {
"signingConfigs": [],
- "compileSdkVersion": 8,
- "compatibleSdkVersion": 8,
"products": [
{
"name": "default",
"signingConfig": "default",
+ "compileSdkVersion": 10,
+ "compatibleSdkVersion": 10,
+ "runtimeOS": "OpenHarmony"
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug"
+ },
+ {
+ "name": "release"
}
]
},
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/build-profile.json5 b/Distributed/DistributeDraw/entry/build-profile.json5
similarity index 40%
rename from Distributed/DistributeDatabaseDrawEts/entry/build-profile.json5
rename to Distributed/DistributeDraw/entry/build-profile.json5
index ae58d1d0a70c602c9cfe1909b00dfec899ba1944..befa10141dfc5999e35f60a36a9f948e664732b1 100644
--- a/Distributed/DistributeDatabaseDrawEts/entry/build-profile.json5
+++ b/Distributed/DistributeDraw/entry/build-profile.json5
@@ -1,13 +1,10 @@
{
- "apiType": 'faMode',
+ "apiType": 'stageMode',
"buildOption": {
},
"targets": [
{
- "name": "default",
- },
- {
- "name": "ohosTest",
+ "name": "default"
}
]
}
\ No newline at end of file
diff --git a/Distributed/DistributeDatabaseDrawEts/hvigorfile.js b/Distributed/DistributeDraw/entry/hvigorfile.ts
similarity index 61%
rename from Distributed/DistributeDatabaseDrawEts/hvigorfile.js
rename to Distributed/DistributeDraw/entry/hvigorfile.ts
index cff9f0dfcf8cb00cca34e7f50d61380cf5496868..80e4ec5b81689f238c34614b167a0b9e9c83e8d9 100644
--- a/Distributed/DistributeDatabaseDrawEts/hvigorfile.js
+++ b/Distributed/DistributeDraw/entry/hvigorfile.ts
@@ -1,2 +1,2 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
-module.exports = require('@ohos/hvigor-ohos-plugin').legacyAppTasks
\ No newline at end of file
+export { hapTasks } from '@ohos/hvigor-ohos-plugin';
diff --git a/Distributed/DistributeDraw/entry/oh-package.json5 b/Distributed/DistributeDraw/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..225946cb11a2c405c8dc81eea89c22f923556638
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/oh-package.json5
@@ -0,0 +1,10 @@
+{
+ "license": "",
+ "devDependencies": {},
+ "author": "",
+ "name": "entry",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "version": "1.0.0",
+ "dependencies": {}
+}
diff --git a/Distributed/DistributeDraw/entry/src/main/ets/common/bean/Position.ets b/Distributed/DistributeDraw/entry/src/main/ets/common/bean/Position.ets
new file mode 100644
index 0000000000000000000000000000000000000000..34387ff3ec9ef0f26db98c5e27bd82e175edbcd0
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/ets/common/bean/Position.ets
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default class Position {
+ /**
+ * Indicates whether the position is the start position.
+ */
+ isFirstPosition: boolean;
+
+ /**
+ * Indicates whether the position is the end position.
+ */
+ isEndPosition: boolean;
+
+ /**
+ * Position x.
+ */
+ positionX: number;
+
+ /**
+ * Position y.
+ */
+ positionY: number;
+
+ constructor(isFirstPosition: boolean, isEndPosition, positionX: number, positionY: number) {
+ this.isFirstPosition = isFirstPosition;
+ this.isEndPosition = isEndPosition;
+ this.positionX = positionX;
+ this.positionY = positionY;
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/entry/src/main/ets/common/constants/CommonConstants.ets b/Distributed/DistributeDraw/entry/src/main/ets/common/constants/CommonConstants.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1b2bcd6c218928149092dba4ea19f9ac3a4768b9
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/ets/common/constants/CommonConstants.ets
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Common constants for all features.
+ */
+export default class CommonConstants {
+ /**
+ * KvStore key.
+ */
+ static readonly CHANGE_POSITION: string = 'change_position';
+
+ /**
+ * KvStore id.
+ */
+ static readonly KVSTORE_ID: string = 'draw_board_kvstore';
+
+ /**
+ * One hundred percent.
+ */
+ static readonly FULL_PERCENT: string = '100%';
+
+ /**
+ * Icon margin left.
+ */
+ static readonly ICON_MARGIN_LEFT: string = '6.7%';
+
+ /**
+ * Title height.
+ */
+ static readonly TITLE_HEIGHT: string = '10%';
+
+ /**
+ * Number one.
+ */
+ static readonly NUMBER_ONE: number = 1;
+
+ /**
+ * Canvas line width.
+ */
+ static readonly CANVAS_LINE_WIDTH: number = 4;
+
+ /**
+ * Canvas line join.
+ */
+ static readonly CANVAS_LINE_JOIN: 'bevel' | 'miter' | 'round' = 'miter';
+
+ /**
+ * Localhost name.
+ */
+ static readonly LOCALHOST_NAME: string = '本机';
+
+ /**
+ * Font weight.
+ */
+ static readonly FONT_WEIGHT_500: number = 500;
+
+ /**
+ * Invalid Index.
+ */
+ static readonly INVALID_INDEX: number = -1;
+
+ /**
+ * Device name width.
+ */
+ static readonly DEVICE_NAME_WIDTH: string = '78%';
+
+ /**
+ * Select icon width.
+ */
+ static readonly SELECT_ICON_WIDTH: string = '8%';
+
+ /**
+ * Subscribe ID range.
+ */
+ static readonly SUBSCRIBE_ID_RANGE: number = 65536;
+
+ /**
+ * Ability name.
+ */
+ static readonly ABILITY_NAME: string = 'EntryAbility';
+
+ /**
+ * Subscribe mode.
+ */
+ static readonly SUBSCRIBE_MODE: number = 0xAA;
+
+ /**
+ * Subscribe medium.
+ */
+ static readonly SUBSCRIBE_MEDIUM: number = 0;
+
+ /**
+ * Subscribe freq.
+ */
+ static readonly SUBSCRIBE_FREQ: number = 2;
+
+ /**
+ * Subscribe capability.
+ */
+ static readonly SUBSCRIBE_CAPABILITY: number = 0;
+
+ /**
+ * Auth type.
+ */
+ static readonly AUTH_TYPE: number = 1;
+
+ /**
+ * App description.
+ */
+ static readonly APP_DESCRIPTION: string = 'Distribute Draw Ability';
+
+ /**
+ * Business type.
+ */
+ static readonly BUSINESS_TYPE: string = '0';
+
+ /**
+ * Bundle name.
+ */
+ static readonly BUNDLE_NAME: string = 'com.example.distributedraw';
+}
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/entry/src/main/ets/common/utils/Logger.ets b/Distributed/DistributeDraw/entry/src/main/ets/common/utils/Logger.ets
new file mode 100644
index 0000000000000000000000000000000000000000..01d1fce855fcbb89243a084cd414470bf24e1ec4
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/ets/common/utils/Logger.ets
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hilog from '@ohos.hilog';
+
+export class Logger {
+ /**
+ * Indicates the log color
+ */
+ private domain: number;
+
+ /**
+ * Indicates the log prefix string.
+ */
+ private prefix: string;
+
+ /**
+ * Indicates the log format string.
+ */
+ private format: string = '%{public}s, %{public}s';
+
+ /**
+ * Constructor.
+ *
+ * @param prefix Identifies the log tag.
+ * @param domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
+ */
+ constructor(prefix: string = 'DistributeDraw', domain: number = 0xFF00) {
+ this.prefix = prefix;
+ this.domain = domain;
+ }
+
+ debug(...args: any[]): void {
+ hilog.debug(this.domain, this.prefix, this.format, args);
+ }
+
+ info(...args: any[]): void {
+ hilog.info(this.domain, this.prefix, this.format, args);
+ }
+
+ warn(...args: any[]): void {
+ hilog.warn(this.domain, this.prefix, this.format, args);
+ }
+
+ error(...args: any[]): void {
+ hilog.error(this.domain, this.prefix, this.format, args);
+ }
+}
+
+export default new Logger();
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets b/Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets
new file mode 100644
index 0000000000000000000000000000000000000000..04fc2453d46139a688900fd3606ebfe1063a7258
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets
@@ -0,0 +1,389 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+import common from '@ohos.app.ability.common';
+import Want from '@ohos.app.ability.Want';
+import CommonConstants from '../constants/CommonConstants';
+import Position from '../bean/Position';
+import Logger from './Logger';
+
+class RemoteDeviceModel {
+ private static dmInstance: RemoteDeviceModel = null;
+ private myDeviceManager: deviceManager.DeviceManager = null;
+ private deviceList: deviceManager.DeviceInfo[] = [];
+ private trustedDeviceList: deviceManager.DeviceInfo[] = [];
+ private localDevice: deviceManager.DeviceInfo = null;
+ private discoverList: deviceManager.DeviceInfo[] = [];
+ private subscribeId: number = Math.floor(CommonConstants.SUBSCRIBE_ID_RANGE * Math.random());
+
+ /**
+ * Obtaining a class instance.
+ *
+ * @returns Class instance.
+ */
+ static getInstance(): RemoteDeviceModel {
+ if (this.dmInstance === null) {
+ this.dmInstance = new RemoteDeviceModel();
+ }
+ return this.dmInstance;
+ }
+
+ /**
+ * Create a device manager.
+ */
+ async createDeviceManager() {
+ if (this.myDeviceManager !== null) {
+ Logger.info('RemoteDeviceModel', 'createDeviceManager myDeviceManager exist');
+ return;
+ }
+
+ await new Promise((resolve, reject) => {
+ try {
+ deviceManager.createDeviceManager(CommonConstants.BUNDLE_NAME, (error, value) => {
+ if (error) {
+ reject(error);
+ Logger.error('RemoteDeviceModel',
+ `createDeviceManager failed, code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ return;
+ }
+ this.myDeviceManager = value;
+ // Registered trusted device online and offline listening.
+ this.registerDeviceStateListener();
+ this.getLocalDeviceInfo();
+ this.getTrustedDeviceList();
+ this.initDeviceList();
+ resolve(value);
+ });
+ } catch (error) {
+ Logger.error('RemoteDeviceModel',
+ `createDeviceManager failed, error code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ });
+ }
+
+ /**
+ * Obtains local device information.
+ */
+ getLocalDeviceInfo(): void {
+ if (this.myDeviceManager === null) {
+ Logger.error('RemoteDeviceModel', 'getLocalDeviceInfo deviceManager has not initialized');
+ return;
+ }
+
+ try {
+ this.localDevice = this.myDeviceManager.getLocalDeviceInfoSync();
+ this.localDevice.deviceName = CommonConstants.LOCALHOST_NAME;
+ } catch (error) {
+ Logger.error('RemoteDeviceModel',
+ `getLocalDeviceInfo failed, code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ }
+
+ /**
+ * Obtain the list of trusted devices.
+ */
+ getTrustedDeviceList(): void {
+ if (this.myDeviceManager === null) {
+ Logger.error('RemoteDeviceModel', 'getTrustedDeviceList deviceManager has not initialized');
+ return;
+ }
+
+ try {
+ this.trustedDeviceList = this.myDeviceManager.getTrustedDeviceListSync();
+ } catch (error) {
+ Logger.error('RemoteDeviceModel',
+ `getTrustedDeviceList failed code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ }
+
+ /**
+ * Initialize the device list.
+ */
+ initDeviceList(): void {
+ this.deviceList = [];
+ this.addToDeviceList(this.localDevice)
+ this.trustedDeviceList.forEach((item: deviceManager.DeviceInfo) => {
+ this.addToDeviceList(item);
+ })
+ }
+
+ /**
+ * Register the device status listener.
+ */
+ registerDeviceStateListener(): void {
+ if (this.myDeviceManager === null) {
+ Logger.error('RemoteDeviceModel', 'registerDeviceStateListener deviceManager has not initialized');
+ return;
+ }
+
+ try {
+ // Registering a device status change listener.
+ this.myDeviceManager.on('deviceStateChange', (data) => {
+ if (data === null) {
+ return;
+ }
+ switch (data.action) {
+ case deviceManager.DeviceStateChangeAction.ONLINE: {
+ this.deviceStateChangeActionOnline(data.device);
+ break;
+ }
+ case deviceManager.DeviceStateChangeAction.OFFLINE: {
+ this.deviceStateChangeActionOffline(data.device);
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ });
+ } catch (error) {
+ Logger.error('RemoteDeviceModel',
+ `registerDeviceStateListener on('deviceStateChange') failed, code=${error.code}, msg=${error.message}`);
+ }
+ }
+
+ /**
+ * The device goes online and is added to the trust list.
+ *
+ * @param device Information about online devices.
+ */
+ deviceStateChangeActionOnline(device: deviceManager.DeviceInfo): void {
+ this.trustedDeviceList[this.trustedDeviceList.length] = device;
+ this.addToDeviceList(device);
+ }
+
+ /**
+ * Device offline.
+ *
+ * @param device Information about offline devices.
+ */
+ deviceStateChangeActionOffline(device: deviceManager.DeviceInfo): void {
+ let list: deviceManager.DeviceInfo[] = [];
+ for (let i: number = 0; i < this.trustedDeviceList.length; i++) {
+ if (this.trustedDeviceList[i].networkId !== device.networkId) {
+ list.push(this.trustedDeviceList[i]);
+ continue;
+ }
+ }
+ this.deleteFromDeviceList(device);
+ this.trustedDeviceList = list;
+ }
+
+ /**
+ * Disabling the listening event.
+ */
+ unregisterDeviceListCallback(): void {
+ if (this.myDeviceManager === null) {
+ Logger.error('RemoteDeviceModel', 'unregisterDeviceListCallback deviceManager has not initialized');
+ return;
+ }
+
+ try {
+ this.myDeviceManager.off('deviceStateChange');
+ this.myDeviceManager.release();
+ } catch (err) {
+ Logger.error('RemoteDeviceModel',
+ `unregisterDeviceListCallback stopDeviceDiscovery failed, code=${err.code}, msg=${err.message}`);
+ }
+ }
+
+ /**
+ * Device connection verification.
+ *
+ * @param context Ability context.
+ * @param device Device information.
+ * @param positionList Position List.
+ */
+ authenticateDevice(
+ context: common.UIAbilityContext,
+ device: deviceManager.DeviceInfo,
+ positionList: Position[]
+ ): void {
+ let tmpList = this.trustedDeviceList.filter((item: deviceManager.DeviceInfo) => device.deviceId === item.deviceId);
+ if (tmpList.length > 0) {
+ this.startAbility(context, device, positionList);
+ return;
+ }
+
+ if (this.myDeviceManager === null) {
+ Logger.error('RemoteDeviceModel', 'authenticateDevice deviceManager has not initialized');
+ return;
+ }
+
+ let extraInfo = {
+ 'targetPkgName': context.abilityInfo.bundleName,
+ 'appName': context.abilityInfo.applicationInfo.name,
+ 'appDescription': CommonConstants.APP_DESCRIPTION,
+ 'business': CommonConstants.BUSINESS_TYPE
+ };
+ let authParam: deviceManager.AuthParam = {
+ 'authType': CommonConstants.AUTH_TYPE,
+ 'extraInfo': extraInfo
+ };
+ try {
+ this.myDeviceManager.authenticateDevice(device, authParam, (err, data) => {
+ if (err) {
+ Logger.error('RemoteDeviceModel',
+ `authenticateDevice error code=${err.code}, msg=${JSON.stringify(err.message)}`);
+ return;
+ }
+ })
+ } catch (error) {
+ Logger.error('RemoteDeviceModel',
+ `authenticateDevice failed code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ }
+
+ /**
+ * Start Ability.
+ *
+ * @param context Ability context.
+ * @param device Device information.
+ * @param positionList Position list.
+ */
+ startAbility(context: common.UIAbilityContext, device: deviceManager.DeviceInfo, positionList: Position[]): void {
+ let wantValue: Want = {
+ bundleName: context.abilityInfo.bundleName,
+ abilityName: CommonConstants.ABILITY_NAME,
+ deviceId: device.networkId,
+ parameters: {
+ positionList: JSON.stringify(positionList)
+ }
+ };
+
+ context.startAbility(wantValue).then(() => {
+ Logger.info('RemoteDeviceModel', `startAbility finished wantValue=${JSON.stringify(wantValue)}`);
+ }).catch((error) => {
+ Logger.error('RemoteDeviceModel', `startAbility failed,code=${error.code},msg=${JSON.stringify(error.message)}`);
+ })
+ }
+
+ /**
+ * Discover the device.
+ *
+ * @param data Device information.
+ */
+ deviceFound(data): void {
+ for (let i: number = 0; i < this.discoverList.length; i++) {
+ if (this.discoverList[i].deviceId === data.device.deviceId) {
+ Logger.info('RemoteDeviceModel', `deviceFound device exist=${JSON.stringify(data)}`);
+ return;
+ }
+ }
+ this.discoverList[this.discoverList.length] = data.device;
+ this.addToDeviceList(data.device);
+ }
+
+ /**
+ * Start discovering devices.
+ */
+ startDeviceDiscovery(): void {
+ this.discoverList = [];
+ this.initDeviceList();
+ if (this.myDeviceManager === null) {
+ Logger.error('RemoteDeviceModel', 'startDeviceDiscovery deviceManager has not initialized');
+ return;
+ }
+
+ try {
+ this.myDeviceManager.on('deviceFound', (data) => {
+ if (data === null) {
+ return;
+ }
+ Logger.info('RemoteDeviceModel', `startDeviceDiscovery deviceFound data=${JSON.stringify(data)}`);
+ this.deviceFound(data);
+ });
+ this.myDeviceManager.on('discoverFail', (data) => {
+ if (data === null) {
+ return;
+ }
+ Logger.info('RemoteDeviceModel', `startDeviceDiscovery discoverFail data=${JSON.stringify(data)}`);
+ });
+
+ let info: deviceManager.SubscribeInfo = {
+ subscribeId: this.subscribeId,
+ mode: CommonConstants.SUBSCRIBE_MODE,
+ medium: CommonConstants.SUBSCRIBE_MEDIUM,
+ freq: CommonConstants.SUBSCRIBE_FREQ,
+ isSameAccount: false,
+ isWakeRemote: true,
+ capability: CommonConstants.SUBSCRIBE_CAPABILITY
+ };
+
+ this.myDeviceManager.startDeviceDiscovery(info);
+ } catch (error) {
+ Logger.error('RemoteDeviceModel',
+ `startDeviceDiscovery failed code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ }
+
+ /**
+ * Stop discovering devices.
+ */
+ stopDeviceDiscovery(): void {
+ if (this.myDeviceManager === null) {
+ Logger.error('RemoteDeviceModel', 'stopDeviceDiscovery deviceManager has not initialized');
+ return;
+ }
+
+ try {
+ this.myDeviceManager.stopDeviceDiscovery(this.subscribeId);
+ this.myDeviceManager.off('deviceFound');
+ this.myDeviceManager.off('discoverFail');
+ } catch (error) {
+ Logger.error('RemoteDeviceModel',
+ `stopDeviceDiscovery failed code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ }
+
+ /**
+ * Add a device to the device list.
+ *
+ * @param device Device information.
+ */
+ addToDeviceList(device: deviceManager.DeviceInfo): void {
+ let isExist: boolean = false;
+ for (let i: number = 0; i < this.deviceList.length; i++) {
+ if (device.deviceId === this.deviceList[i].deviceId) {
+ this.deviceList[i] = device;
+ isExist = true;
+ break;
+ }
+ }
+ if (!isExist) {
+ this.deviceList.push(device);
+ }
+
+ AppStorage.setOrCreate('deviceList', this.deviceList);
+ }
+
+ /**
+ * Deletes a device from the device list.
+ *
+ * @param device Device information.
+ */
+ deleteFromDeviceList(device: deviceManager.DeviceInfo): void {
+ for (let i: number = 0; i < this.deviceList.length; i++) {
+ if (device.deviceId === this.deviceList[i].deviceId) {
+ this.deviceList.splice(i, 1);
+ break;
+ }
+ }
+ AppStorage.setOrCreate('deviceList', this.deviceList);
+ }
+}
+
+export default RemoteDeviceModel.getInstance();
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/entry/src/main/ets/entryability/EntryAbility.ets b/Distributed/DistributeDraw/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a983c7e7ea377cd98d1d46288b3fd568b284cbf7
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbilityConstant from '@ohos.app.ability.AbilityConstant';
+import UIAbility from '@ohos.app.ability.UIAbility';
+import Want from '@ohos.app.ability.Want';
+import window from '@ohos.window';
+import bundleManager from '@ohos.bundle.bundleManager';
+import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
+import Logger from '../common/utils/Logger';
+import remoteDeviceModel from '../common/utils/RemoteDeviceUtil';
+import Position from '../common/bean/Position';
+
+const permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC'];
+
+export default class EntryAbility extends UIAbility {
+ storage: LocalStorage = new LocalStorage();
+ want: Want;
+
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) {
+ this.want = want;
+ globalThis.context = this.context;
+ Logger.info('EntryAbility',
+ `onCreate want=${JSON.stringify(this.want)}, launchParam=${JSON.stringify(launchParam)}`);
+ remoteDeviceModel.createDeviceManager();
+ }
+
+ onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam) {
+ this.want = want;
+ Logger.info('EntryAbility',
+ `onNewWant want=${JSON.stringify(this.want)}, launchParam=${JSON.stringify(launchParam)}`);
+
+ if (this.want?.parameters?.positionList) {
+ let positionList: Position[] = JSON.parse((this.want.parameters.positionList) as string);
+ this.storage.setOrCreate('positionList', positionList);
+ this.storage.setOrCreate('updateCanvas', true);
+ }
+ }
+
+ onDestroy() {
+ Logger.info('EntryAbility', 'onDestroy execute');
+ remoteDeviceModel.unregisterDeviceListCallback();
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage) {
+ Logger.info('EntryAbility', 'onWindowStageCreate start');
+
+ if (this.want?.parameters?.positionList) {
+ let positionList: Position[] = JSON.parse((this.want.parameters.positionList) as string);
+ this.storage.setOrCreate('positionList', positionList);
+ }
+
+ checkPermissions();
+
+ try {
+ windowStage.loadContent('pages/Index', this.storage, (err) => {
+ if (err) {
+ Logger.error('EntryAbility',
+ `onWindowStageCreate Failed to load the content. code=${err.code}, msg=${JSON.stringify(err.message)}`);
+ return;
+ }
+ Logger.info('EntryAbility', 'onWindowStageCreate Succeeded in loading the content');
+ });
+ } catch (error) {
+ Logger.error('EntryAbility',
+ `onWindowStageCreate failed. code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ }
+}
+
+/**
+ * Check the permission status.
+ */
+async function checkPermissions() {
+ let grantStatus: abilityAccessCtrl.GrantStatus = await checkAccessToken();
+ if (grantStatus !== abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
+ // Applying for the distributed data synchronization permission.
+ let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
+ atManager.requestPermissionsFromUser(globalThis.context, permissions).then((data) => {
+ let grantStatus: Array = data.authResults;
+ let length: number = grantStatus.length;
+ for (let i: number = 0; i < length; i++) {
+ if (grantStatus[i] === 0) {
+ Logger.info('EntryAbility', `checkPermissions request permission ${permissions[i]} success`);
+ } else {
+ Logger.error('EntryAbility',
+ `checkPermissions request fail permission=${permissions[i]}, grantStatus=${grantStatus[i]}`);
+ return;
+ }
+ }
+ }).catch((err) => {
+ Logger.error('EntryAbility',
+ `checkPermissions request permissions failed, code=${err.code}, msg=${JSON.stringify(err.message)}`);
+ })
+ }
+}
+
+/**
+ * Obtains the authorization status.
+ *
+ * @returns Grant status.
+ */
+async function checkAccessToken() {
+ let atManager = abilityAccessCtrl.createAtManager();
+ let tokenId: number;
+ try {
+ let bundleInfo: bundleManager.BundleInfo = await bundleManager
+ .getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
+ let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo;
+ tokenId = appInfo.accessTokenId;
+ } catch (err) {
+ Logger.error('EntryAbility',
+ `checkAccessToken Failed to get bundle info for self. code is ${err.code}, message is ${err.message}`);
+ }
+
+ let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;
+ try {
+ grantStatus = await atManager.checkAccessToken(tokenId, 'ohos.permission.DISTRIBUTED_DATASYNC');
+ } catch (err) {
+ Logger.error('EntryAbility',
+ `checkAccessToken Failed to check access token. code is ${err.code}, message is ${err.message}`);
+ }
+
+ return grantStatus;
+}
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/entry/src/main/ets/pages/Index.ets b/Distributed/DistributeDraw/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..2178f95a2f626610484eafc63e215cbd5cacfc82
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import common from '@ohos.app.ability.common';
+import distributedKVStore from '@ohos.data.distributedKVStore';
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+import CommonConstants from '../common/constants/CommonConstants';
+import Position from '../common/bean/Position';
+import KvStoreModel from '../viewmodel/KvStoreModel';
+import remoteDeviceModel from '../common/utils/RemoteDeviceUtil';
+import DeviceListDialogComponent from '../view/CustomDialogComponent';
+import Logger from '../common/utils/Logger';
+
+let storage = LocalStorage.getShared();
+
+@Entry(storage)
+@Component
+struct Index {
+ @StorageLink('deviceList') deviceList: deviceManager.DeviceInfo[] = [];
+ @LocalStorageProp('positionList') positionList: Position[] = [];
+ @LocalStorageProp('updateCanvas') @Watch('updateCanvas') update: boolean = false;
+ private settings: RenderingContextSettings = new RenderingContextSettings(true);
+ private canvasContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
+ private kvStoreModel: KvStoreModel = new KvStoreModel();
+ private context: common.UIAbilityContext = null;
+ private dialogController: CustomDialogController = new CustomDialogController({
+ builder: DeviceListDialogComponent({
+ startAbility: this.startAbilityContinuation,
+ deviceList: this.deviceList,
+ positionList: this.positionList,
+ cancel: this.onCancel
+ }),
+ alignment: DialogAlignment.Bottom,
+ cancel: this.onCancel,
+ autoCancel: true,
+ offset: {
+ dx: $r('app.float.dialog_offset_dx'),
+ dy: $r('app.float.dialog_offset_dy')
+ }
+ });
+
+ aboutToAppear() {
+ Logger.info('Index', 'aboutToAppear begin');
+ this.createKVStore();
+ }
+
+ aboutToDisappear() {
+ this.kvStoreModel.removeDataChangeListener();
+ }
+
+ /**
+ * Callback for closing a pop-up window.
+ */
+ onCancel(): void {
+ remoteDeviceModel.stopDeviceDiscovery();
+ }
+
+ /**
+ * Update canvas.
+ */
+ updateCanvas(): void {
+ this.redraw();
+ }
+
+ build() {
+ Column() {
+ Row() {
+ Image($r('app.media.ic_back'))
+ .width($r('app.float.ic_back_width'))
+ .height($r('app.float.ic_back_height'))
+ .margin({ left: CommonConstants.ICON_MARGIN_LEFT })
+ .onClick(() => {
+ this.goBack();
+ })
+ Blank()
+ Image($r('app.media.ic_hop'))
+ .width($r('app.float.ic_hop_width'))
+ .height($r('app.float.ic_hop_height'))
+ .margin({ right: CommonConstants.ICON_MARGIN_LEFT })
+ .onClick(() => {
+ this.onContinueAbilityClick();
+ })
+ }
+ .width(CommonConstants.FULL_PERCENT)
+ .height(CommonConstants.TITLE_HEIGHT)
+
+ Row() {
+ Canvas(this.canvasContext)
+ .width(CommonConstants.FULL_PERCENT)
+ .height(CommonConstants.FULL_PERCENT)
+ .backgroundColor($r('app.color.start_window_background'))
+ .onReady(() => {
+ this.redraw();
+ })
+ }
+ .onTouch((event: TouchEvent) => {
+ this.onTouchEvent(event);
+ })
+ .width(CommonConstants.FULL_PERCENT)
+ .layoutWeight(CommonConstants.NUMBER_ONE)
+ }
+ .height(CommonConstants.FULL_PERCENT)
+ .width(CommonConstants.FULL_PERCENT)
+ }
+
+ /**
+ * Create a distributed key-value database.
+ */
+ createKVStore(): void {
+ this.context = getContext(this) as common.UIAbilityContext;
+ this.kvStoreModel.createKvStore(this.context, (data: distributedKVStore.ChangeNotification) => {
+ this.positionList = [];
+ let entries: distributedKVStore.Entry[] = data.insertEntries.length > 0 ? data.insertEntries : data.updateEntries;
+ entries.forEach((entry: distributedKVStore.Entry) => {
+ if (CommonConstants.CHANGE_POSITION === entry.key) {
+ this.positionList = JSON.parse((entry.value.value) as string);
+ this.redraw();
+ }
+ });
+ });
+ }
+
+ onPageShow(): void {
+ this.redraw();
+ }
+
+ /**
+ * Redraw the track.
+ */
+ redraw(): void {
+ this.canvasContext.clearRect(0, 0, this.canvasContext.width, this.canvasContext.height);
+ this.positionList.forEach((position) => {
+ Logger.info('Index', `redraw position=${JSON.stringify(position)}`);
+ if (position.isFirstPosition) {
+ this.canvasContext.beginPath();
+ this.canvasContext.lineWidth = CommonConstants.CANVAS_LINE_WIDTH;
+ this.canvasContext.lineJoin = CommonConstants.CANVAS_LINE_JOIN;
+ this.canvasContext.moveTo(position.positionX, position.positionY);
+ } else {
+ this.canvasContext.lineTo(position.positionX, position.positionY);
+ if (position.isEndPosition) {
+ this.canvasContext.stroke();
+ }
+ }
+ });
+ }
+
+ /**
+ * Retract the previous stroke.
+ */
+ goBack(): void {
+ if (this.positionList.length === 0) {
+ return;
+ }
+
+ for (let i: number = this.positionList.length - 1; i >= 0; i--) {
+ let position: Position = this.positionList.pop();
+ if (position.isFirstPosition) {
+ break;
+ }
+ }
+ this.redraw();
+ this.kvStoreModel.put(CommonConstants.CHANGE_POSITION, JSON.stringify(this.positionList));
+ }
+
+ /**
+ * Draw events.
+ *
+ * @param event Touch event.
+ */
+ onTouchEvent(event: TouchEvent): void {
+ let positionX:number = event.touches[0].x;
+ let positionY:number = event.touches[0].y;
+ switch (event.type) {
+ case TouchType.Down: {
+ this.canvasContext.beginPath();
+ this.canvasContext.lineWidth = CommonConstants.CANVAS_LINE_WIDTH;
+ this.canvasContext.lineJoin = CommonConstants.CANVAS_LINE_JOIN;
+ this.canvasContext.moveTo(positionX, positionY);
+ this.pushData(true, false, positionX, positionY);
+ break;
+ }
+ case TouchType.Move: {
+ this.canvasContext.lineTo(positionX, positionY);
+ this.pushData(false, false, positionX, positionY);
+ break;
+ }
+ case TouchType.Up: {
+ this.canvasContext.lineTo(positionX, positionY);
+ this.canvasContext.stroke();
+ this.pushData(false, true, positionX, positionY);
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+
+ /**
+ * Add position to position list.
+ *
+ * @param isFirstPosition Indicates whether the position is the start position of the track.
+ * @param isEndPosition Indicates whether the position is the end position of the track.
+ * @param positionX Horizontal coordinate information.
+ * @param positionY Indicates the vertical coordinate information.
+ */
+ pushData(isFirstPosition: boolean, isEndPosition, positionX: number, positionY: number): void {
+ let position = new Position(isFirstPosition, isEndPosition, positionX, positionY);
+ this.positionList.push(position);
+ if (position.isEndPosition) {
+ this.kvStoreModel.put(CommonConstants.CHANGE_POSITION, JSON.stringify(this.positionList));
+ }
+ }
+
+ /**
+ * Click the transfer button to display nearby devices and open the pop-up window.
+ */
+ onContinueAbilityClick(): void {
+ remoteDeviceModel.startDeviceDiscovery();
+ this.dialogController.open();
+ }
+
+ /**
+ * Select a device from the list in the pop-up window.
+ * @param context Ability context.
+ * @param device Device information.
+ * @param positionList Position list.
+ */
+ startAbilityContinuation(
+ context: common.UIAbilityContext,
+ device: deviceManager.DeviceInfo,
+ positionList: Position[]
+ ): void {
+ remoteDeviceModel.authenticateDevice(context, device, positionList);
+ remoteDeviceModel.stopDeviceDiscovery();
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/entry/src/main/ets/view/CustomDialogComponent.ets b/Distributed/DistributeDraw/entry/src/main/ets/view/CustomDialogComponent.ets
new file mode 100644
index 0000000000000000000000000000000000000000..28269369fcec7dd5555116b5f753db6ed753ebb8
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/ets/view/CustomDialogComponent.ets
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import common from '@ohos.app.ability.common';
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+import prompt from '@ohos.promptAction';
+import CommonConstants from '../common/constants/CommonConstants';
+import Position from '../common/bean/Position';
+
+@Extend(Text) function ButtonTextStyle() {
+ .fontColor($r('app.color.button_text_color'))
+ .fontSize($r('app.float.button_font_size'))
+ .fontWeight(CommonConstants.FONT_WEIGHT_500)
+}
+
+@CustomDialog
+export default struct DeviceListDialogComponent {
+ @State selectedIndex: number = CommonConstants.INVALID_INDEX;
+ @Link positionList: Position[];
+ @Link deviceList: deviceManager.DeviceInfo[];
+ controller: CustomDialogController = null;
+ startAbility: (context: common.UIAbilityContext,device: deviceManager.DeviceInfo, positionList: Position[]) => void;
+ cancel: () => void;
+
+ build() {
+ Column() {
+ Row() {
+ Text($r('app.string.select_device'))
+ .fontSize($r('app.float.dialog_title_font_size'))
+ .width(CommonConstants.FULL_PERCENT)
+ .textAlign(TextAlign.Start)
+ .fontColor(Color.Black)
+ .fontWeight(FontWeight.Bold)
+ }
+ .padding({
+ left: $r('app.float.dialog_title_padding_left'),
+ right: $r('app.float.dialog_title_padding_left'),
+ top: $r('app.float.dialog_title_padding_top')
+ })
+ .height($r('app.float.dialog_title_height'))
+
+ List() {
+ ForEach(this.deviceList, (item: deviceManager.DeviceInfo, index: number) => {
+ ListItem() {
+ Column() {
+ Row() {
+ Row() {
+ Row() {
+ Image(this.getDeviceTypeIcon(item.deviceType))
+ .opacity($r('app.float.device_icon_opacity'))
+ }
+ .width($r('app.float.device_icon_width'))
+ .aspectRatio(CommonConstants.NUMBER_ONE)
+
+ Text(item.deviceName)
+ .fontSize($r('app.float.device_name_font_size'))
+ .width(CommonConstants.DEVICE_NAME_WIDTH)
+ .fontColor(Color.Black)
+ .margin({ left: $r('app.float.device_name_margin_left') })
+ .maxLines(CommonConstants.NUMBER_ONE)
+ .textOverflow({ overflow: TextOverflow.Ellipsis })
+ .textAlign(TextAlign.Start)
+ }
+ .justifyContent(FlexAlign.Start)
+
+ if (index === this.selectedIndex) {
+ Image($r('app.media.ic_checked'))
+ .width(CommonConstants.SELECT_ICON_WIDTH)
+ .objectFit(ImageFit.Contain)
+ } else {
+ Image($r('app.media.ic_uncheck'))
+ .width(CommonConstants.SELECT_ICON_WIDTH)
+ .objectFit(ImageFit.Contain)
+ .opacity($r('app.float.icon_uncheck_opacity'))
+ }
+ }
+ .height($r('app.float.device_info_height'))
+ .onClick(() => {
+ this.selectedIndex = index;
+ })
+ .padding({
+ left: $r('app.float.device_info_padding'),
+ right: $r('app.float.device_info_padding')
+ })
+ .width(CommonConstants.FULL_PERCENT)
+ .justifyContent(FlexAlign.SpaceBetween)
+
+ if (index !== this.deviceList.length - 1) {
+ Row() {
+ Divider()
+ .width(CommonConstants.FULL_PERCENT)
+ .height($r('app.float.device_info_divider_height'))
+ .opacity($r('app.float.device_info_divider_opacity'))
+ }
+ .padding({
+ left: $r('app.float.device_info_divider_padding_left'),
+ right: $r('app.float.device_info_divider_padding_right')
+ })
+ .width(CommonConstants.FULL_PERCENT)
+ }
+ }
+ }
+ }, (item) => item.deviceId )
+ }
+ .width(CommonConstants.FULL_PERCENT)
+
+ Row() {
+ Column() {
+ Text($r('app.string.cancel'))
+ .ButtonTextStyle()
+ }
+ .layoutWeight(CommonConstants.NUMBER_ONE)
+ .justifyContent(FlexAlign.Center)
+ .height($r('app.float.button_line_height'))
+ .onClick(() => {
+ this.controller.close();
+ this.cancel();
+ })
+
+ Divider()
+ .vertical(true)
+ .height($r('app.float.button_line_divider_height'))
+ .color($r('app.color.button_line_divider_color'))
+ .width($r('app.float.button_line_divider_width'))
+
+ Column() {
+ Text($r('app.string.confirm'))
+ .ButtonTextStyle()
+ }
+ .layoutWeight(CommonConstants.NUMBER_ONE)
+ .justifyContent(FlexAlign.Center)
+ .height($r('app.float.button_line_height'))
+ .onClick(() => {
+ if (CommonConstants.INVALID_INDEX === this.selectedIndex) {
+ prompt.showToast({
+ message: $r('app.string.please_select_device')
+ });
+ } else {
+ this.controller.close();
+ this.startAbility(getContext(this) as common.UIAbilityContext, this.deviceList[this.selectedIndex],
+ this.positionList);
+ }
+ })
+ }
+ .backgroundColor(Color.White)
+ .border({
+ color: Color.White,
+ radius: $r('app.float.button_line_radius')
+ })
+ .padding($r('app.float.button_line_padding'))
+ .margin({ top: $r("app.float.button_line_margin_top") })
+ }
+ }
+
+ /**
+ * Obtains the device type icon.
+ *
+ * @param deviceType Device type.
+ * @returns Icon resource.
+ */
+ getDeviceTypeIcon(deviceType): Resource {
+ if ((deviceType === deviceManager.DeviceType.PHONE) || (deviceType === deviceManager.DeviceType.UNKNOWN_TYPE)) {
+ return $r('app.media.ic_public_devices_phone');
+ } else if (deviceType === deviceManager.DeviceType.TV) {
+ return $r('app.media.ic_smartscreen');
+ } else {
+ return $r('app.media.ic_smartscreen');
+ }
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/entry/src/main/ets/viewmodel/KvStoreModel.ets b/Distributed/DistributeDraw/entry/src/main/ets/viewmodel/KvStoreModel.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c42e5068f71bf997e7229fb7b65c904889291202
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/ets/viewmodel/KvStoreModel.ets
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import distributedKVStore from '@ohos.data.distributedKVStore';
+import common from '@ohos.app.ability.common';
+import CommonConstants from '../common/constants//CommonConstants';
+import Logger from '../common/utils/Logger';
+
+export default class KvStoreModel {
+ kvManager: distributedKVStore.KVManager = null;
+ kvStore: distributedKVStore.SingleKVStore = null;
+
+ /**
+ * Create a distributed key-value database.
+ *
+ * @param context Ability context.
+ * @param callback Callback.
+ */
+ createKvStore(
+ context: common.UIAbilityContext,
+ callback: (data: distributedKVStore.ChangeNotification) => void
+ ): void {
+ if (this.kvStore !== null) {
+ Logger.info('KvStoreModel', 'createKvStore KVManager is exist');
+ return;
+ }
+
+ let config: distributedKVStore.KVManagerConfig = {
+ bundleName: context.abilityInfo.bundleName,
+ context: context
+ };
+ try {
+ this.kvManager = distributedKVStore.createKVManager(config);
+ } catch (error) {
+ Logger.error('KvStoreModel',
+ `createKvStore createKVManager failed, code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ return;
+ }
+
+ let options: distributedKVStore.Options = {
+ createIfMissing: true,
+ encrypt: false,
+ backup: false,
+ autoSync: true,
+ kvStoreType: distributedKVStore.KVStoreType.SINGLE_VERSION,
+ securityLevel: distributedKVStore.SecurityLevel.S1
+ };
+
+ this.kvManager.getKVStore(CommonConstants.KVSTORE_ID, options).then((store: distributedKVStore.SingleKVStore) => {
+ if (store === null) {
+ Logger.error('KvStoreModel', `createKvStore getKVStore store is null`);
+ return;
+ }
+ this.kvStore = store;
+ this.kvStore.enableSync(true).then(() => {
+ Logger.info('KvStoreModel', 'createKvStore enableSync success');
+ }).catch((error) => {
+ Logger.error('KvStoreModel',
+ `createKvStore enableSync fail, code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ });
+ this.setDataChangeListener(callback);
+ }).catch((error) => {
+ Logger.error('getKVStore',
+ `createKvStore getKVStore failed, code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ })
+ }
+
+ /**
+ * Add data to the distributed key-value database.
+ *
+ * @param key Store key name.
+ * @param value Store value.
+ */
+ put(key: string, value: string): void {
+ if (this.kvStore === null) {
+ return;
+ }
+
+ this.kvStore.put(key, value).then(() => {
+ Logger.info('KvStoreModel', `kvStore.put key=${key} finished}`);
+ }).catch((error) => {
+ Logger.error('KvStoreModel',
+ `kvStore.put key=${key} failed, code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ });
+ }
+
+ /**
+ * Set the data change listening function.
+ *
+ * @param callback Callback.
+ */
+ setDataChangeListener(callback: (data: distributedKVStore.ChangeNotification) => void): void {
+ if (this.kvStore === null) {
+ Logger.error('KvStoreModel', 'setDataChangeListener kvStore is null');
+ return;
+ }
+
+ try {
+ this.kvStore.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_ALL,
+ (data: distributedKVStore.ChangeNotification) => {
+ if ((data.updateEntries.length > 0) || (data.insertEntries.length > 0)) {
+ callback(data);
+ }
+ });
+ } catch (error) {
+ Logger.error('KvStoreModel',
+ `setDataChangeListener on('dataChange') failed, code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ }
+
+ /**
+ * Remove the data change listener.
+ */
+ removeDataChangeListener(): void {
+ if (this.kvStore === null) {
+ return;
+ }
+
+ try {
+ this.kvStore.off('dataChange');
+ } catch (error) {
+ Logger.error('KvStoreModel',
+ `removeDataChangeListener off('dataChange') failed, code=${error.code}, msg=${JSON.stringify(error.message)}`);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/entry/src/main/module.json5 b/Distributed/DistributeDraw/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..cfa39126c4aca17b670d0bf7114549ab28aa132f
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/module.json5
@@ -0,0 +1,58 @@
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:icon",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:icon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.ACCESS_SERVICE_DM",
+ "reason": "$string:access_service_dm_reason",
+ "usedScene": {
+ "abilities": [
+ "EntryAbility"
+ ],
+ "when": "inuse"
+ }
+ },
+ {
+ "name": "ohos.permission.DISTRIBUTED_DATASYNC",
+ "reason": "$string:distributed_datasync_reason",
+ "usedScene": {
+ "abilities": [
+ "EntryAbility"
+ ],
+ "when": "inuse"
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/entry/src/main/resources/base/element/color.json b/Distributed/DistributeDraw/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..edaefa20e434fce40573ea48d85c89c6fa07a8d8
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,16 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ },
+ {
+ "name": "button_text_color",
+ "value": "#007DFF"
+ },
+ {
+ "name": "button_line_divider_color",
+ "value": "#C7C7C7"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/entry/src/main/resources/base/element/float.json b/Distributed/DistributeDraw/entry/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..e6c4ef620e3374a21a70fe067bf70993755c26a5
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/resources/base/element/float.json
@@ -0,0 +1,116 @@
+{
+ "float": [
+ {
+ "name": "dialog_offset_dx",
+ "value": "0vp"
+ },
+ {
+ "name": "dialog_offset_dy",
+ "value": "-12vp"
+ },
+ {
+ "name": "ic_back_width",
+ "value": "24vp"
+ },
+ {
+ "name": "ic_back_height",
+ "value": "21vp"
+ },
+ {
+ "name": "ic_hop_width",
+ "value": "24vp"
+ },
+ {
+ "name": "ic_hop_height",
+ "value": "24vp"
+ },
+ {
+ "name": "button_font_size",
+ "value": "16fp"
+ },
+ {
+ "name": "dialog_title_font_size",
+ "value": "20fp"
+ },
+ {
+ "name": "dialog_title_padding_left",
+ "value": "24vp"
+ },
+ {
+ "name": "dialog_title_padding_top",
+ "value": "24vp"
+ },
+ {
+ "name": "dialog_title_height",
+ "value": "56vp"
+ },
+ {
+ "name": "device_icon_opacity",
+ "value": "0.9"
+ },
+ {
+ "name": "icon_uncheck_opacity",
+ "value": "0.5"
+ },
+ {
+ "name": "device_icon_width",
+ "value": "24vp"
+ },
+ {
+ "name": "device_name_font_size",
+ "value": "16fp"
+ },
+ {
+ "name": "device_name_margin_left",
+ "value": "16vp"
+ },
+ {
+ "name": "device_info_height",
+ "value": "56vp"
+ },
+ {
+ "name": "device_info_padding",
+ "value": "24vp"
+ },
+ {
+ "name": "device_info_divider_height",
+ "value": "1vp"
+ },
+ {
+ "name": "device_info_divider_opacity",
+ "value": "0.1"
+ },
+ {
+ "name": "device_info_divider_padding_left",
+ "value": "64vp"
+ },
+ {
+ "name": "device_info_divider_padding_right",
+ "value": "24vp"
+ },
+ {
+ "name": "button_line_height",
+ "value": "40vp"
+ },
+ {
+ "name": "button_line_divider_height",
+ "value": "22vp"
+ },
+ {
+ "name": "button_line_divider_width",
+ "value": "1vp"
+ },
+ {
+ "name": "button_line_radius",
+ "value": "20vp"
+ },
+ {
+ "name": "button_line_margin_top",
+ "value": "8vp"
+ },
+ {
+ "name": "button_line_padding",
+ "value": "10vp"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/entry/src/main/resources/base/element/string.json b/Distributed/DistributeDraw/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..4c0cbfe5e41d49363641a54554c4b02dc178f4f6
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,40 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "DistributeDraw"
+ },
+ {
+ "name": "cancel",
+ "value": "Cancel"
+ },
+ {
+ "name": "confirm",
+ "value": "Confirm"
+ },
+ {
+ "name": "please_select_device",
+ "value": "Please select a device"
+ },
+ {
+ "name": "select_device",
+ "value": "Select device"
+ },
+ {
+ "name": "access_service_dm_reason",
+ "value": "request for device manager"
+ },
+ {
+ "name": "distributed_datasync_reason",
+ "value": "request for distribute store"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_back.png b/Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_back.png
new file mode 100644
index 0000000000000000000000000000000000000000..73813c3b2775a6d10bf26bed88f4b08c1737641a
Binary files /dev/null and b/Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_back.png differ
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/media/checked.png b/Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_checked.png
similarity index 100%
rename from Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/media/checked.png
rename to Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_checked.png
diff --git a/Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_hop.png b/Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_hop.png
new file mode 100644
index 0000000000000000000000000000000000000000..6a94d911327119a053a4d20402a52ecf5ba567bf
Binary files /dev/null and b/Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_hop.png differ
diff --git a/Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_public_devices_phone.svg b/Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_public_devices_phone.svg
new file mode 100644
index 0000000000000000000000000000000000000000..035c293b62071a45a29b39d7ab040f3aa4ffe1fe
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_public_devices_phone.svg
@@ -0,0 +1,18 @@
+
+
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_smartscreen.png b/Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_smartscreen.png
new file mode 100644
index 0000000000000000000000000000000000000000..595c68d4dbaad9799c84da3c42073bb69db64ea2
Binary files /dev/null and b/Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_smartscreen.png differ
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/media/uncheck.png b/Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_uncheck.png
similarity index 100%
rename from Distributed/DistributeDatabaseDrawEts/entry/src/main/resources/base/media/uncheck.png
rename to Distributed/DistributeDraw/entry/src/main/resources/base/media/ic_uncheck.png
diff --git a/Distributed/DistributeDraw/entry/src/main/resources/base/media/icon.png b/Distributed/DistributeDraw/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/Distributed/DistributeDraw/entry/src/main/resources/base/media/icon.png differ
diff --git a/Distributed/DistributeDraw/entry/src/main/resources/base/profile/main_pages.json b/Distributed/DistributeDraw/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/Distributed/DistributeDraw/entry/src/main/resources/en_US/element/string.json b/Distributed/DistributeDraw/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..4c0cbfe5e41d49363641a54554c4b02dc178f4f6
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,40 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "DistributeDraw"
+ },
+ {
+ "name": "cancel",
+ "value": "Cancel"
+ },
+ {
+ "name": "confirm",
+ "value": "Confirm"
+ },
+ {
+ "name": "please_select_device",
+ "value": "Please select a device"
+ },
+ {
+ "name": "select_device",
+ "value": "Select device"
+ },
+ {
+ "name": "access_service_dm_reason",
+ "value": "request for device manager"
+ },
+ {
+ "name": "distributed_datasync_reason",
+ "value": "request for distribute store"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/entry/src/main/resources/zh_CN/element/string.json b/Distributed/DistributeDraw/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..edbcab820f73cac4ea7ed1b473ff988d8acfff5b
--- /dev/null
+++ b/Distributed/DistributeDraw/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,40 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "分布式手写板"
+ },
+ {
+ "name": "cancel",
+ "value": "取消"
+ },
+ {
+ "name": "confirm",
+ "value": "确认"
+ },
+ {
+ "name": "please_select_device",
+ "value": "请选择一个设备"
+ },
+ {
+ "name": "select_device",
+ "value": "选择设备"
+ },
+ {
+ "name": "access_service_dm_reason",
+ "value": "设备管理申请权限"
+ },
+ {
+ "name": "distributed_datasync_reason",
+ "value": "分布式键值数据库申请权限"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/figures/homePage.png b/Distributed/DistributeDraw/figures/homePage.png
new file mode 100644
index 0000000000000000000000000000000000000000..72a4ca8b17d5d5f77fe10e53130383d414becda1
Binary files /dev/null and b/Distributed/DistributeDraw/figures/homePage.png differ
diff --git a/Distributed/DistributeDraw/figures/zh-cn_image_0000001569348576.gif b/Distributed/DistributeDraw/figures/zh-cn_image_0000001569348576.gif
new file mode 100644
index 0000000000000000000000000000000000000000..b01960785e6c7ff1291d9aa3abc5b83bb982c18c
Binary files /dev/null and b/Distributed/DistributeDraw/figures/zh-cn_image_0000001569348576.gif differ
diff --git a/Distributed/DistributeDraw/figures/zh-cn_image_0000001621561354.png b/Distributed/DistributeDraw/figures/zh-cn_image_0000001621561354.png
new file mode 100644
index 0000000000000000000000000000000000000000..5f5952c218ac04352c724c51093072329037fe42
Binary files /dev/null and b/Distributed/DistributeDraw/figures/zh-cn_image_0000001621561354.png differ
diff --git a/Distributed/DistributeDraw/figures/zh-cn_image_0000001635345443.png b/Distributed/DistributeDraw/figures/zh-cn_image_0000001635345443.png
new file mode 100644
index 0000000000000000000000000000000000000000..72a4ca8b17d5d5f77fe10e53130383d414becda1
Binary files /dev/null and b/Distributed/DistributeDraw/figures/zh-cn_image_0000001635345443.png differ
diff --git a/Distributed/DistributeDraw/figures/zh-cn_image_0000001635972445.gif b/Distributed/DistributeDraw/figures/zh-cn_image_0000001635972445.gif
new file mode 100644
index 0000000000000000000000000000000000000000..0d4a2fc153a9ae074efdb8d8f7579ad73501a98c
Binary files /dev/null and b/Distributed/DistributeDraw/figures/zh-cn_image_0000001635972445.gif differ
diff --git a/Distributed/DistributeDraw/figures/zh-cn_image_0000001635987634.png b/Distributed/DistributeDraw/figures/zh-cn_image_0000001635987634.png
new file mode 100644
index 0000000000000000000000000000000000000000..1844083702959f21ec7673841398fd8cc18f15f6
Binary files /dev/null and b/Distributed/DistributeDraw/figures/zh-cn_image_0000001635987634.png differ
diff --git a/Distributed/DistributeDraw/figures/zh-cn_image_0000001635987786.png b/Distributed/DistributeDraw/figures/zh-cn_image_0000001635987786.png
new file mode 100644
index 0000000000000000000000000000000000000000..8e623d7f89b4a1e881ddc9d9e9e7a31636ec65b3
Binary files /dev/null and b/Distributed/DistributeDraw/figures/zh-cn_image_0000001635987786.png differ
diff --git a/Distributed/DistributeDraw/hvigor/hvigor-config.json5 b/Distributed/DistributeDraw/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..28f85c1467c07bcebd848b16b46348ffc6761057
--- /dev/null
+++ b/Distributed/DistributeDraw/hvigor/hvigor-config.json5
@@ -0,0 +1,6 @@
+{
+ "hvigorVersion": "2.3.0",
+ "dependencies": {
+ "@ohos/hvigor-ohos-plugin": "2.3.0"
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/hvigor/hvigor-wrapper.js b/Distributed/DistributeDraw/hvigor/hvigor-wrapper.js
new file mode 100644
index 0000000000000000000000000000000000000000..994f22987bd0739b9faa07c966b066c2d9218602
--- /dev/null
+++ b/Distributed/DistributeDraw/hvigor/hvigor-wrapper.js
@@ -0,0 +1,2 @@
+"use strict";var e=require("fs"),t=require("path"),n=require("os"),r=require("crypto"),u=require("child_process"),o=require("constants"),i=require("stream"),s=require("util"),c=require("assert"),a=require("tty"),l=require("zlib"),f=require("net");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var D=d(e),p=d(t),E=d(n),m=d(r),h=d(u),y=d(o),C=d(i),F=d(s),g=d(c),A=d(a),v=d(l),S=d(f),w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},O={},b={},_={},B=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_,"__esModule",{value:!0}),_.isMac=_.isLinux=_.isWindows=void 0;const P=B(E.default),k="Windows_NT",x="Linux",N="Darwin";_.isWindows=function(){return P.default.type()===k},_.isLinux=function(){return P.default.type()===x},_.isMac=function(){return P.default.type()===N};var I={},T=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),R=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),M=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&T(t,e,n);return R(t,e),t};Object.defineProperty(I,"__esModule",{value:!0}),I.hash=void 0;const L=M(m.default);I.hash=function(e,t="md5"){return L.createHash(t).update(e,"utf-8").digest("hex")},function(e){var t=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var u in e)"default"!==u&&Object.prototype.hasOwnProperty.call(e,u)&&t(r,e,u);return n(r,e),r};Object.defineProperty(e,"__esModule",{value:!0}),e.HVIGOR_BOOT_JS_FILE_PATH=e.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=e.HVIGOR_PROJECT_DEPENDENCIES_HOME=e.HVIGOR_PROJECT_WRAPPER_HOME=e.HVIGOR_PROJECT_NAME=e.HVIGOR_PROJECT_ROOT_DIR=e.HVIGOR_PROJECT_CACHES_HOME=e.HVIGOR_PNPM_STORE_PATH=e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=e.HVIGOR_WRAPPER_TOOLS_HOME=e.HVIGOR_USER_HOME=e.DEFAULT_PACKAGE_JSON=e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=e.PNPM=e.HVIGOR=e.NPM_TOOL=e.PNPM_TOOL=e.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const u=r(p.default),o=r(E.default),i=_,s=I;e.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",e.PNPM_TOOL=(0,i.isWindows)()?"pnpm.cmd":"pnpm",e.NPM_TOOL=(0,i.isWindows)()?"npm.cmd":"npm",e.HVIGOR="hvigor",e.PNPM="pnpm",e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",e.DEFAULT_PACKAGE_JSON="package.json",e.HVIGOR_USER_HOME=u.resolve(o.homedir(),".hvigor"),e.HVIGOR_WRAPPER_TOOLS_HOME=u.resolve(e.HVIGOR_USER_HOME,"wrapper","tools"),e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=u.resolve(e.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",e.PNPM_TOOL),e.HVIGOR_PNPM_STORE_PATH=u.resolve(e.HVIGOR_USER_HOME,"caches"),e.HVIGOR_PROJECT_CACHES_HOME=u.resolve(e.HVIGOR_USER_HOME,"project_caches"),e.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),e.HVIGOR_PROJECT_NAME=u.basename((0,s.hash)(e.HVIGOR_PROJECT_ROOT_DIR)),e.HVIGOR_PROJECT_WRAPPER_HOME=u.resolve(e.HVIGOR_PROJECT_ROOT_DIR,e.HVIGOR),e.HVIGOR_PROJECT_DEPENDENCIES_HOME=u.resolve(e.HVIGOR_PROJECT_CACHES_HOME,e.HVIGOR_PROJECT_NAME,"workspace"),e.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=u.resolve(e.HVIGOR_PROJECT_DEPENDENCIES_HOME,e.DEFAULT_PACKAGE_JSON),e.HVIGOR_BOOT_JS_FILE_PATH=u.resolve(e.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js")}(b);var j={},$={};Object.defineProperty($,"__esModule",{value:!0}),$.logInfoPrintConsole=$.logErrorAndExit=void 0,$.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},$.logInfoPrintConsole=function(e){console.log(e)};var H=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),J=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),G=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&H(t,e,n);return J(t,e),t},V=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0}),j.isFileExists=j.offlinePluginConversion=j.executeCommand=j.getNpmPath=j.hasNpmPackInPaths=void 0;const U=h.default,W=G(p.default),z=b,K=$,q=V(D.default);j.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},j.getNpmPath=function(){const e=process.execPath;return W.join(W.dirname(e),z.NPM_TOOL)},j.executeCommand=function(e,t,n){0!==(0,U.spawnSync)(e,t,n).status&&(0,K.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},j.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?W.resolve(e,z.HVIGOR,t.replace("file:","")):t},j.isFileExists=function(e){return q.default.existsSync(e)&&q.default.statSync(e).isFile()},function(e){var t=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var u in e)"default"!==u&&Object.prototype.hasOwnProperty.call(e,u)&&t(r,e,u);return n(r,e),r},u=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.executeInstallPnpm=e.isPnpmAvailable=e.environmentHandler=e.checkNpmConifg=e.PNPM_VERSION=void 0;const o=r(D.default),i=b,s=j,c=r(p.default),a=$,l=h.default,f=u(E.default);e.PNPM_VERSION="7.30.0",e.checkNpmConifg=function(){const e=c.resolve(i.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=c.resolve(f.default.homedir(),".npmrc");if((0,s.isFileExists)(e)||(0,s.isFileExists)(t))return;const n=(0,s.getNpmPath)(),r=(0,l.spawnSync)(n,["config","get","prefix"],{cwd:i.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,a.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=c.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,s.isFileExists)(u)||(0,a.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},e.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},e.isPnpmAvailable=function(){return!!o.existsSync(i.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,s.hasNpmPackInPaths)("pnpm",[i.HVIGOR_WRAPPER_TOOLS_HOME])},e.executeInstallPnpm=function(){(0,a.logInfoPrintConsole)(`Installing pnpm@${e.PNPM_VERSION}...`);const t=(0,s.getNpmPath)();!function(){const t=c.resolve(i.HVIGOR_WRAPPER_TOOLS_HOME,i.DEFAULT_PACKAGE_JSON);try{o.existsSync(i.HVIGOR_WRAPPER_TOOLS_HOME)||o.mkdirSync(i.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const n={dependencies:{}};n.dependencies[i.PNPM]=e.PNPM_VERSION,o.writeFileSync(t,JSON.stringify(n))}catch(e){(0,a.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${t} failed.`)}}(),(0,s.executeCommand)(t,["install","pnpm"],{cwd:i.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,a.logInfoPrintConsole)("Pnpm install success.")}}(O);var Y={},X={},Z={},Q={};Object.defineProperty(Q,"__esModule",{value:!0}),Q.Unicode=void 0;class ee{}Q.Unicode=ee,ee.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ee.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ee.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Z,"__esModule",{value:!0}),Z.JudgeUtil=void 0;const te=Q;Z.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&te.Unicode.Space_Separator.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||te.Unicode.ID_Start.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||""===e||""===e||te.Unicode.ID_Continue.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ne={},re={fromCallback:function(e){return Object.defineProperty((function(...t){if("function"!=typeof t[t.length-1])return new Promise(((n,r)=>{e.call(this,...t,((e,t)=>null!=e?r(e):n(t)))}));e.apply(this,t)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(...t){const n=t[t.length-1];if("function"!=typeof n)return e.apply(this,t);e.apply(this,t.slice(0,-1)).then((e=>n(null,e)),n)}),"name",{value:e.name})}},ue=y.default,oe=process.cwd,ie=null,se=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ie||(ie=oe.call(process)),ie};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var ce=process.chdir;process.chdir=function(e){ie=null,ce.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ce)}var ae=function(e){ue.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,ue.O_WRONLY|ue.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,ue.O_WRONLY|ue.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){ue.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,ue.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,ue.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===se&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,d){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var le=C.default.Stream,fe=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);le.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);le.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var de=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:De(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},De=Object.getPrototypeOf||function(e){return e.__proto__};var pe,Ee,me=D.default,he=ae,ye=fe,Ce=de,Fe=F.default;function ge(e,t){Object.defineProperty(e,pe,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(pe=Symbol.for("graceful-fs.queue"),Ee=Symbol.for("graceful-fs.previous")):(pe="___graceful-fs.queue",Ee="___graceful-fs.previous");var Ae=function(){};if(Fe.debuglog?Ae=Fe.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ae=function(){var e=Fe.format.apply(Fe,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!me[pe]){var ve=w[pe]||[];ge(me,ve),me.close=function(e){function t(t,n){return e.call(me,t,(function(e){e||_e(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,Ee,{value:e}),t}(me.close),me.closeSync=function(e){function t(t){e.apply(me,arguments),_e()}return Object.defineProperty(t,Ee,{value:e}),t}(me.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){Ae(me[pe]),g.default.equal(me[pe].length,0)}))}w[pe]||ge(w,me[pe]);var Se,we=Oe(Ce(me));function Oe(e){he(e),e.gracefulify=Oe,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):be([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):be([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=ye(e);d=s.ReadStream,D=s.WriteStream}var c=e.ReadStream;c&&(d.prototype=Object.create(c.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(D.prototype=Object.create(a.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0});var l=d;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=D;function d(e,t){return this instanceof d?(c.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}function D(e,t){return this instanceof D?(a.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):be([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function be(e){Ae("ENQUEUE",e[0].name,e[1]),me[pe].push(e),Be()}function _e(){for(var e=Date.now(),t=0;t2&&(me[pe][t][3]=e,me[pe][t][4]=e);Be()}function Be(){if(clearTimeout(Se),Se=void 0,0!==me[pe].length){var e=me[pe].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)Ae("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){Ae("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(Ae("RETRY",t.name,n),t.apply(null,n.concat([u]))):me[pe].push(e)}void 0===Se&&(Se=setTimeout(Be,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!me.__patched&&(we=Oe(me),me.__patched=!0),function(e){const t=re.fromCallback,n=we,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.assign(e,n),r.forEach((r=>{e[r]=t(n[r])})),e.realpath.native=t(n.realpath.native),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.writev&&(e.writev=function(e,t,...r){return"function"==typeof r[r.length-1]?n.writev(e,t,...r):new Promise(((u,o)=>{n.writev(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffers:n})}))}))})}(ne);var Pe={},ke={};const xe=p.default;ke.checkPath=function(e){if("win32"===process.platform){if(/[<>:"|?*]/.test(e.replace(xe.parse(e).root,""))){const t=new Error(`Path contains invalid characters: ${e}`);throw t.code="EINVAL",t}}};const Ne=ne,{checkPath:Ie}=ke,Te=e=>"number"==typeof e?e:{mode:511,...e}.mode;Pe.makeDir=async(e,t)=>(Ie(e),Ne.mkdir(e,{mode:Te(t),recursive:!0})),Pe.makeDirSync=(e,t)=>(Ie(e),Ne.mkdirSync(e,{mode:Te(t),recursive:!0}));const Re=re.fromPromise,{makeDir:Me,makeDirSync:Le}=Pe,je=Re(Me);var $e={mkdirs:je,mkdirsSync:Le,mkdirp:je,mkdirpSync:Le,ensureDir:je,ensureDirSync:Le};const He=re.fromPromise,Je=ne;var Ge={pathExists:He((function(e){return Je.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:Je.existsSync};const Ve=we;var Ue=function(e,t,n,r){Ve.open(e,"r+",((e,u)=>{if(e)return r(e);Ve.futimes(u,t,n,(e=>{Ve.close(u,(t=>{r&&r(e||t)}))}))}))},We=function(e,t,n){const r=Ve.openSync(e,"r+");return Ve.futimesSync(r,t,n),Ve.closeSync(r)};const ze=ne,Ke=p.default,qe=F.default;function Ye(e,t,n){const r=n.dereference?e=>ze.stat(e,{bigint:!0}):e=>ze.lstat(e,{bigint:!0});return Promise.all([r(e),r(t).catch((e=>{if("ENOENT"===e.code)return null;throw e}))]).then((([e,t])=>({srcStat:e,destStat:t})))}function Xe(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function Ze(e,t){const n=Ke.resolve(e).split(Ke.sep).filter((e=>e)),r=Ke.resolve(t).split(Ke.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Qe(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var et={checkPaths:function(e,t,n,r,u){qe.callbackify(Ye)(e,t,r,((r,o)=>{if(r)return u(r);const{srcStat:i,destStat:s}=o;if(s){if(Xe(i,s)){const r=Ke.basename(e),o=Ke.basename(t);return"move"===n&&r!==o&&r.toLowerCase()===o.toLowerCase()?u(null,{srcStat:i,destStat:s,isChangingCase:!0}):u(new Error("Source and destination must not be the same."))}if(i.isDirectory()&&!s.isDirectory())return u(new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`));if(!i.isDirectory()&&s.isDirectory())return u(new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`))}return i.isDirectory()&&Ze(e,t)?u(new Error(Qe(e,t,n))):u(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n,r){const{srcStat:u,destStat:o}=function(e,t,n){let r;const u=n.dereference?e=>ze.statSync(e,{bigint:!0}):e=>ze.lstatSync(e,{bigint:!0}),o=u(e);try{r=u(t)}catch(e){if("ENOENT"===e.code)return{srcStat:o,destStat:null};throw e}return{srcStat:o,destStat:r}}(e,t,r);if(o){if(Xe(u,o)){const r=Ke.basename(e),i=Ke.basename(t);if("move"===n&&r!==i&&r.toLowerCase()===i.toLowerCase())return{srcStat:u,destStat:o,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(u.isDirectory()&&!o.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!u.isDirectory()&&o.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(u.isDirectory()&&Ze(e,t))throw new Error(Qe(e,t,n));return{srcStat:u,destStat:o}},checkParentPaths:function e(t,n,r,u,o){const i=Ke.resolve(Ke.dirname(t)),s=Ke.resolve(Ke.dirname(r));if(s===i||s===Ke.parse(s).root)return o();ze.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):Xe(n,c)?o(new Error(Qe(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=Ke.resolve(Ke.dirname(t)),i=Ke.resolve(Ke.dirname(r));if(i===o||i===Ke.parse(i).root)return;let s;try{s=ze.statSync(i,{bigint:!0})}catch(e){if("ENOENT"===e.code)return;throw e}if(Xe(n,s))throw new Error(Qe(t,r,u));return e(t,n,i,u)},isSrcSubdir:Ze,areIdentical:Xe};const tt=we,nt=p.default,rt=$e.mkdirs,ut=Ge.pathExists,ot=Ue,it=et;function st(e,t,n,r,u){const o=nt.dirname(n);ut(o,((i,s)=>i?u(i):s?at(e,t,n,r,u):void rt(o,(o=>o?u(o):at(e,t,n,r,u)))))}function ct(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function at(e,t,n,r,u){(r.dereference?tt.stat:tt.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){return t?Dt(n,r,u,o):function(e,t,n,r,u){tt.mkdir(n,(o=>{if(o)return u(o);Dt(t,n,r,(t=>t?u(t):dt(n,e,u)))}))}(e.mode,n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();tt.unlink(n,(o=>o?u(o):lt(e,t,n,r,u)))}(e,n,r,u,o):lt(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){tt.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=nt.resolve(process.cwd(),o)),e?void tt.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?tt.symlink(o,n,u):u(t):(r.dereference&&(i=nt.resolve(process.cwd(),i)),it.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&it.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){tt.unlink(t,(r=>r?n(r):tt.symlink(e,t,n)))}(o,n,u)))):tt.symlink(o,n,u))))}(e,t,n,r,u):i.isSocket()?u(new Error(`Cannot copy a socket file: ${t}`)):i.isFIFO()?u(new Error(`Cannot copy a FIFO pipe: ${t}`)):u(new Error(`Unknown file: ${t}`))))}function lt(e,t,n,r,u){tt.copyFile(t,n,(o=>o?u(o):r.preserveTimestamps?function(e,t,n,r){if(function(e){return 0==(128&e)}(e))return function(e,t,n){return dt(e,128|t,n)}(n,e,(u=>u?r(u):ft(e,t,n,r)));return ft(e,t,n,r)}(e.mode,t,n,u):dt(n,e.mode,u)))}function ft(e,t,n,r){!function(e,t,n){tt.stat(e,((e,r)=>e?n(e):ot(t,r.atime,r.mtime,n)))}(t,n,(t=>t?r(t):dt(n,e,r)))}function dt(e,t,n){return tt.chmod(e,t,n)}function Dt(e,t,n,r){tt.readdir(e,((u,o)=>u?r(u):pt(o,e,t,n,r)))}function pt(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=nt.join(n,t),s=nt.join(r,t);it.checkPaths(i,s,"copy",u,((t,c)=>{if(t)return o(t);const{destStat:a}=c;!function(e,t,n,r,u){r.filter?ct(at,e,t,n,r,u):at(e,t,n,r,u)}(a,i,s,u,(t=>t?o(t):pt(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var Et=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),it.checkPaths(e,t,"copy",n,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;it.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?ct(st,s,e,t,n,r):st(s,e,t,n,r)))}))};const mt=we,ht=p.default,yt=$e.mkdirsSync,Ct=We,Ft=et;function gt(e,t,n,r){const u=(r.dereference?mt.statSync:mt.lstatSync)(t);if(u.isDirectory())return function(e,t,n,r,u){return t?St(n,r,u):function(e,t,n,r){return mt.mkdirSync(n),St(t,n,r),vt(n,e)}(e.mode,n,r,u)}(u,e,t,n,r);if(u.isFile()||u.isCharacterDevice()||u.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return mt.unlinkSync(n),At(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):At(e,n,r,u)}(u,e,t,n,r);if(u.isSymbolicLink())return function(e,t,n,r){let u=mt.readlinkSync(t);r.dereference&&(u=ht.resolve(process.cwd(),u));if(e){let e;try{e=mt.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return mt.symlinkSync(u,n);throw e}if(r.dereference&&(e=ht.resolve(process.cwd(),e)),Ft.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(mt.statSync(n).isDirectory()&&Ft.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return mt.unlinkSync(t),mt.symlinkSync(e,t)}(u,n)}return mt.symlinkSync(u,n)}(e,t,n,r);if(u.isSocket())throw new Error(`Cannot copy a socket file: ${t}`);if(u.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${t}`);throw new Error(`Unknown file: ${t}`)}function At(e,t,n,r){return mt.copyFileSync(t,n),r.preserveTimestamps&&function(e,t,n){(function(e){return 0==(128&e)})(e)&&function(e,t){vt(e,128|t)}(n,e);(function(e,t){const n=mt.statSync(e);Ct(t,n.atime,n.mtime)})(t,n)}(e.mode,t,n),vt(n,e.mode)}function vt(e,t){return mt.chmodSync(e,t)}function St(e,t,n){mt.readdirSync(e).forEach((r=>function(e,t,n,r){const u=ht.join(t,e),o=ht.join(n,e),{destStat:i}=Ft.checkPathsSync(u,o,"copy",r);return function(e,t,n,r){if(!r.filter||r.filter(t,n))return gt(e,t,n,r)}(i,u,o,r)}(r,e,t,n)))}var wt=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=Ft.checkPathsSync(e,t,"copy",n);return Ft.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=ht.dirname(n);mt.existsSync(u)||yt(u);return gt(e,t,n,r)}(u,e,t,n)};var Ot={copy:(0,re.fromCallback)(Et),copySync:wt};const bt=we,_t=p.default,Bt=g.default,Pt="win32"===process.platform;function kt(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||bt[t],e[t+="Sync"]=e[t]||bt[t]})),e.maxBusyTries=e.maxBusyTries||3}function xt(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),Bt(e,"rimraf: missing path"),Bt.strictEqual(typeof e,"string","rimraf: path should be a string"),Bt.strictEqual(typeof n,"function","rimraf: callback function required"),Bt(t,"rimraf: invalid options argument provided"),Bt.strictEqual(typeof t,"object","rimraf: options should be object"),kt(t),Nt(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rNt(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Nt(e,t,n){Bt(e),Bt(t),Bt("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&Pt?It(e,t,r,n):u&&u.isDirectory()?Rt(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return Pt?It(e,t,r,n):Rt(e,t,r,n);if("EISDIR"===r.code)return Rt(e,t,r,n)}return n(r)}))))}function It(e,t,n,r){Bt(e),Bt(t),Bt("function"==typeof r),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Rt(e,t,n,r):t.unlink(e,r)}))}))}function Tt(e,t,n){let r;Bt(e),Bt(t);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Lt(e,t,n):t.unlinkSync(e)}function Rt(e,t,n,r){Bt(e),Bt(t),Bt("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){Bt(e),Bt(t),Bt("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{xt(_t.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function Mt(e,t){let n;kt(t=t||{}),Bt(e,"rimraf: missing path"),Bt.strictEqual(typeof e,"string","rimraf: path should be a string"),Bt(t,"rimraf: missing options"),Bt.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&Pt&&Tt(e,t,n)}try{n&&n.isDirectory()?Lt(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return Pt?Tt(e,t,n):Lt(e,t,n);if("EISDIR"!==n.code)throw n;Lt(e,t,n)}}function Lt(e,t,n){Bt(e),Bt(t);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(Bt(e),Bt(t),t.readdirSync(e).forEach((n=>Mt(_t.join(e,n),t))),!Pt){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch{}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var jt=xt;xt.sync=Mt;const $t=we,Ht=re.fromCallback,Jt=jt;var Gt={remove:Ht((function(e,t){if($t.rm)return $t.rm(e,{recursive:!0,force:!0},t);Jt(e,t)})),removeSync:function(e){if($t.rmSync)return $t.rmSync(e,{recursive:!0,force:!0});Jt.sync(e)}};const Vt=re.fromPromise,Ut=ne,Wt=p.default,zt=$e,Kt=Gt,qt=Vt((async function(e){let t;try{t=await Ut.readdir(e)}catch{return zt.mkdirs(e)}return Promise.all(t.map((t=>Kt.remove(Wt.join(e,t)))))}));function Yt(e){let t;try{t=Ut.readdirSync(e)}catch{return zt.mkdirsSync(e)}t.forEach((t=>{t=Wt.join(e,t),Kt.removeSync(t)}))}var Xt={emptyDirSync:Yt,emptydirSync:Yt,emptyDir:qt,emptydir:qt};const Zt=re.fromCallback,Qt=p.default,en=we,tn=$e;var nn={createFile:Zt((function(e,t){function n(){en.writeFile(e,"",(e=>{if(e)return t(e);t()}))}en.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Qt.dirname(e);en.stat(o,((e,r)=>{if(e)return"ENOENT"===e.code?tn.mkdirs(o,(e=>{if(e)return t(e);n()})):t(e);r.isDirectory()?n():en.readdir(o,(e=>{if(e)return t(e)}))}))}))})),createFileSync:function(e){let t;try{t=en.statSync(e)}catch{}if(t&&t.isFile())return;const n=Qt.dirname(e);try{en.statSync(n).isDirectory()||en.readdirSync(n)}catch(e){if(!e||"ENOENT"!==e.code)throw e;tn.mkdirsSync(n)}en.writeFileSync(e,"")}};const rn=re.fromCallback,un=p.default,on=we,sn=$e,cn=Ge.pathExists,{areIdentical:an}=et;var ln={createLink:rn((function(e,t,n){function r(e,t){on.link(e,t,(e=>{if(e)return n(e);n(null)}))}on.lstat(t,((u,o)=>{on.lstat(e,((u,i)=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);if(o&&an(i,o))return n(null);const s=un.dirname(t);cn(s,((u,o)=>u?n(u):o?r(e,t):void sn.mkdirs(s,(u=>{if(u)return n(u);r(e,t)}))))}))}))})),createLinkSync:function(e,t){let n;try{n=on.lstatSync(t)}catch{}try{const t=on.lstatSync(e);if(n&&an(t,n))return}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const r=un.dirname(t);return on.existsSync(r)||sn.mkdirsSync(r),on.linkSync(e,t)}};const fn=p.default,dn=we,Dn=Ge.pathExists;var pn={symlinkPaths:function(e,t,n){if(fn.isAbsolute(e))return dn.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=fn.dirname(t),u=fn.join(r,e);return Dn(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):dn.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:fn.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(fn.isAbsolute(e)){if(n=dn.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=fn.dirname(t),u=fn.join(r,e);if(n=dn.existsSync(u),n)return{toCwd:u,toDst:e};if(n=dn.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:fn.relative(r,e)}}}};const En=we;var mn={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);En.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=En.lstatSync(e)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}};const hn=re.fromCallback,yn=p.default,Cn=ne,Fn=$e.mkdirs,gn=$e.mkdirsSync,An=pn.symlinkPaths,vn=pn.symlinkPathsSync,Sn=mn.symlinkType,wn=mn.symlinkTypeSync,On=Ge.pathExists,{areIdentical:bn}=et;function _n(e,t,n,r){An(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,Sn(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=yn.dirname(t);On(o,((n,i)=>n?r(n):i?Cn.symlink(e,t,u,r):void Fn(o,(n=>{if(n)return r(n);Cn.symlink(e,t,u,r)}))))}))}))}var Bn={createSymlink:hn((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Cn.lstat(t,((u,o)=>{!u&&o.isSymbolicLink()?Promise.all([Cn.stat(e),Cn.stat(t)]).then((([u,o])=>{if(bn(u,o))return r(null);_n(e,t,n,r)})):_n(e,t,n,r)}))})),createSymlinkSync:function(e,t,n){let r;try{r=Cn.lstatSync(t)}catch{}if(r&&r.isSymbolicLink()){const n=Cn.statSync(e),r=Cn.statSync(t);if(bn(n,r))return}const u=vn(e,t);e=u.toDst,n=wn(u.toCwd,n);const o=yn.dirname(t);return Cn.existsSync(o)||gn(o),Cn.symlinkSync(e,t,n)}};const{createFile:Pn,createFileSync:kn}=nn,{createLink:xn,createLinkSync:Nn}=ln,{createSymlink:In,createSymlinkSync:Tn}=Bn;var Rn={createFile:Pn,createFileSync:kn,ensureFile:Pn,ensureFileSync:kn,createLink:xn,createLinkSync:Nn,ensureLink:xn,ensureLinkSync:Nn,createSymlink:In,createSymlinkSync:Tn,ensureSymlink:In,ensureSymlinkSync:Tn};var Mn={stringify:function(e,{EOL:t="\n",finalEOL:n=!0,replacer:r=null,spaces:u}={}){const o=n?t:"";return JSON.stringify(e,r,u).replace(/\n/g,t)+o},stripBom:function(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}};let Ln;try{Ln=we}catch(e){Ln=D.default}const jn=re,{stringify:$n,stripBom:Hn}=Mn;const Jn=jn.fromPromise((async function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ln,r=!("throws"in t)||t.throws;let u,o=await jn.fromCallback(n.readFile)(e,t);o=Hn(o);try{u=JSON.parse(o,t?t.reviver:null)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}return u}));const Gn=jn.fromPromise((async function(e,t,n={}){const r=n.fs||Ln,u=$n(t,n);await jn.fromCallback(r.writeFile)(e,u,n)}));const Vn={readFile:Jn,readFileSync:function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ln,r=!("throws"in t)||t.throws;try{let r=n.readFileSync(e,t);return r=Hn(r),JSON.parse(r,t.reviver)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}},writeFile:Gn,writeFileSync:function(e,t,n={}){const r=n.fs||Ln,u=$n(t,n);return r.writeFileSync(e,u,n)}};var Un={readJson:Vn.readFile,readJsonSync:Vn.readFileSync,writeJson:Vn.writeFile,writeJsonSync:Vn.writeFileSync};const Wn=re.fromCallback,zn=we,Kn=p.default,qn=$e,Yn=Ge.pathExists;var Xn={outputFile:Wn((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Kn.dirname(e);Yn(u,((o,i)=>o?r(o):i?zn.writeFile(e,t,n,r):void qn.mkdirs(u,(u=>{if(u)return r(u);zn.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Kn.dirname(e);if(zn.existsSync(n))return zn.writeFileSync(e,...t);qn.mkdirsSync(n),zn.writeFileSync(e,...t)}};const{stringify:Zn}=Mn,{outputFile:Qn}=Xn;var er=async function(e,t,n={}){const r=Zn(t,n);await Qn(e,r,n)};const{stringify:tr}=Mn,{outputFileSync:nr}=Xn;var rr=function(e,t,n){const r=tr(t,n);nr(e,r,n)};const ur=re.fromPromise,or=Un;or.outputJson=ur(er),or.outputJsonSync=rr,or.outputJSON=or.outputJson,or.outputJSONSync=or.outputJsonSync,or.writeJSON=or.writeJson,or.writeJSONSync=or.writeJsonSync,or.readJSON=or.readJson,or.readJSONSync=or.readJsonSync;var ir=or;const sr=we,cr=p.default,ar=Ot.copy,lr=Gt.remove,fr=$e.mkdirp,dr=Ge.pathExists,Dr=et;function pr(e,t,n,r,u){return r?Er(e,t,n,u):n?lr(t,(r=>r?u(r):Er(e,t,n,u))):void dr(t,((r,o)=>r?u(r):o?u(new Error("dest already exists.")):Er(e,t,n,u)))}function Er(e,t,n,r){sr.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};ar(e,t,u,(t=>t?r(t):lr(e,r)))}(e,t,n,r):r()))}var mr=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Dr.checkPaths(e,t,"move",n,((n,o)=>{if(n)return r(n);const{srcStat:i,isChangingCase:s=!1}=o;Dr.checkParentPaths(e,i,t,"move",(n=>n?r(n):function(e){const t=cr.dirname(e);return cr.parse(t).root===t}(t)?pr(e,t,u,s,r):void fr(cr.dirname(t),(n=>n?r(n):pr(e,t,u,s,r)))))}))};const hr=we,yr=p.default,Cr=Ot.copySync,Fr=Gt.removeSync,gr=$e.mkdirpSync,Ar=et;function vr(e,t,n){try{hr.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Cr(e,t,r),Fr(e)}(e,t,n)}}var Sr=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u,isChangingCase:o=!1}=Ar.checkPathsSync(e,t,"move",n);return Ar.checkParentPathsSync(e,u,t,"move"),function(e){const t=yr.dirname(e);return yr.parse(t).root===t}(t)||gr(yr.dirname(t)),function(e,t,n,r){if(r)return vr(e,t,n);if(n)return Fr(t),vr(e,t,n);if(hr.existsSync(t))throw new Error("dest already exists.");return vr(e,t,n)}(e,t,r,o)};var wr,Or,br,_r,Br,Pr={move:(0,re.fromCallback)(mr),moveSync:Sr},kr={...ne,...Ot,...Xt,...Rn,...ir,...$e,...Pr,...Xn,...Ge,...Gt},xr={},Nr={exports:{}},Ir={exports:{}};function Tr(){if(Or)return wr;Or=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return wr=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function Rr(){if(_r)return br;return _r=1,br=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=function(){if($r)return jr;$r=1;const e=E.default,t=A.default,n=Vr(),{env:r}=process;let u;function o(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function i(t,o){if(0===u)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(t&&!o&&void 0===u)return 0;const i=u||0;if("dumb"===r.TERM)return i;if("win32"===process.platform){const t=e.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in r))||"codeship"===r.CI_NAME?1:i;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:i}return n("no-color")||n("no-colors")||n("color=false")||n("color=never")?u=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=1),"FORCE_COLOR"in r&&(u="true"===r.FORCE_COLOR?1:"false"===r.FORCE_COLOR?0:0===r.FORCE_COLOR.length?1:Math.min(parseInt(r.FORCE_COLOR,10),3)),jr={supportsColor:function(e){return o(i(e,e&&e.isTTY))},stdout:o(i(!0,t.isatty(1))),stderr:o(i(!0,t.isatty(2)))}}();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=Rr()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Gr,Gr.exports)),Gr.exports}Jr=Nr,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?Jr.exports=(Br||(Br=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Rr()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Ir,Ir.exports)),Ir.exports):Jr.exports=Ur();var Wr=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=zr(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=zr(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,Qr=e=>e&&"object"==typeof e&&!Array.isArray(e),eu=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${Kr.inspect(e,{depth:5})}) - ${n}`)}))};var tu={configure:e=>{qr("New configuration to be validated: ",e),eu(e,Zr(Qr(e)),"must be an object."),qr(`Calling pre-processing listeners (${Yr.length})`),Yr.forEach((t=>t(e))),qr("Configuration pre-processing finished."),qr(`Calling configuration listeners (${Xr.length})`),Xr.forEach((t=>t(e))),qr("Configuration finished.")},addListener:e=>{Xr.push(e),qr(`Added listener, now ${Xr.length} listeners`)},addPreProcessingListener:e=>{Yr.push(e),qr(`Added pre-processing listener, now ${Yr.length} listeners`)},throwExceptionIf:eu,anObject:Qr,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:Zr},nu={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),d=n(u.getSeconds()),D=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,d).replace(/SSS/g,D).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(nu);const ru=nu.exports,uu=E.default,ou=F.default,iu=p.default,su={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function cu(e){return e?`[${su[e][0]}m`:""}function au(e){return e?`[${su[e][1]}m`:""}function lu(e,t){return n=ou.format("[%s] [%s] %s - ",ru.asString(e.startTime),e.level.toString(),e.categoryName),cu(r=t)+n+au(r);var n,r}function fu(e){return lu(e)+ou.format(...e.data)}function du(e){return lu(e,e.level.colour)+ou.format(...e.data)}function Du(e){return ou.format(...e.data)}function pu(e){return e.data[0]}function Eu(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflos%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(iu.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.substr(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.substr(1),10);t.lengthDu,basic:()=>fu,colored:()=>du,coloured:()=>du,pattern:e=>Eu(e&&e.pattern,e&&e.tokens),dummy:()=>pu};var hu={basicLayout:fu,messagePassThroughLayout:Du,patternLayout:Eu,colouredLayout:du,coloredLayout:du,dummyLayout:pu,addLayout(e,t){mu[e]=t},layout:(e,t)=>mu[e]&&mu[e](t)};const yu=tu,Cu=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Fu{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Fu?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Fu[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Fu[n]=new Fu(e[t].value,n,e[t].colour);const r=Fu.levels.findIndex((e=>e.levelStr===n));r>-1?Fu.levels[r]=Fu[n]:Fu.levels.push(Fu[n])})),Fu.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level===e.level}}Fu.levels=[],Fu.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),yu.addListener((e=>{const t=e.levels;if(t){yu.throwExceptionIf(e,yu.not(yu.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{yu.throwExceptionIf(e,yu.not(yu.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),yu.throwExceptionIf(e,yu.not(yu.anObject(t[n])),`level "${n}" must be an object`),yu.throwExceptionIf(e,yu.not(t[n].value),`level "${n}" must have a 'value' property`),yu.throwExceptionIf(e,yu.not(yu.anInteger(t[n].value)),`level "${n}".value must have an integer value`),yu.throwExceptionIf(e,yu.not(t[n].colour),`level "${n}" must have a 'colour' property`),yu.throwExceptionIf(e,yu.not(Cu.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Cu.join(", ")}`)}))}})),yu.addListener((e=>{Fu.addLevels(e.levels)}));var gu=Fu,Au={exports:{}},vu={};/*! (c) 2020 Andrea Giammarchi */
+const{parse:Su,stringify:wu}=JSON,{keys:Ou}=Object,bu=String,_u="string",Bu={},Pu="object",ku=(e,t)=>t,xu=e=>e instanceof bu?bu(e):e,Nu=(e,t)=>typeof t===_u?new bu(t):t,Iu=(e,t,n,r)=>{const u=[];for(let o=Ou(n),{length:i}=o,s=0;s{const r=bu(t.push(n)-1);return e.set(n,r),r},Ru=(e,t)=>{const n=Su(e,Nu).map(xu),r=n[0],u=t||ku,o=typeof r===Pu&&r?Iu(n,new Set,r,u):r;return u.call({"":o},"",o)};vu.parse=Ru;const Mu=(e,t,n)=>{const r=t&&typeof t===Pu?(e,n)=>""===e||-1Su(Mu(e));vu.fromJSON=e=>Ru(wu(e));const Lu=vu,ju=gu;class $u{constructor(e,t,n,r,u){this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,u&&(this.functionName=u.functionName,this.fileName=u.fileName,this.lineNumber=u.lineNumber,this.columnNumber=u.columnNumber,this.callStack=u.callStack)}serialise(){const e=this.data.map((e=>(e&&e.message&&e.stack&&(e=Object.assign({message:e.message,stack:e.stack},e)),e)));return this.data=e,Lu.stringify(this)}static deserialise(e){let t;try{const n=Lu.parse(e);n.data=n.data.map((e=>{if(e&&e.message&&e.stack){const t=new Error(e);Object.keys(e).forEach((n=>{t[n]=e[n]})),e=t}return e})),t=new $u(n.categoryName,ju.getLevel(n.level.levelStr),n.data,n.context),t.startTime=new Date(n.startTime),t.pid=n.pid,t.cluster=n.cluster}catch(n){t=new $u("log4js",ju.ERROR,["Unable to parse log:",e,"because: ",n])}return t}}var Hu=$u;const Ju=Nr.exports("log4js:clustering"),Gu=Hu,Vu=tu;let Uu=!1,Wu=null;try{Wu=require("cluster")}catch(e){Ju("cluster module not present"),Uu=!0}const zu=[];let Ku=!1,qu="NODE_APP_INSTANCE";const Yu=()=>Ku&&"0"===process.env[qu],Xu=()=>Uu||Wu.isMaster||Yu(),Zu=e=>{zu.forEach((t=>t(e)))},Qu=(e,t)=>{if(Ju("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Ju("received message: ",t.data);const e=Gu.deserialise(t.data);Zu(e)}};Uu||Vu.addListener((e=>{zu.length=0,({pm2:Ku,disableClustering:Uu,pm2InstanceVar:qu="NODE_APP_INSTANCE"}=e),Ju(`clustering disabled ? ${Uu}`),Ju(`cluster.isMaster ? ${Wu&&Wu.isMaster}`),Ju(`pm2 enabled ? ${Ku}`),Ju(`pm2InstanceVar = ${qu}`),Ju(`process.env[${qu}] = ${process.env[qu]}`),Ku&&process.removeListener("message",Qu),Wu&&Wu.removeListener&&Wu.removeListener("message",Qu),Uu||e.disableClustering?Ju("Not listening for cluster messages, because clustering disabled."):Yu()?(Ju("listening for PM2 broadcast messages"),process.on("message",Qu)):Wu.isMaster?(Ju("listening for cluster messages"),Wu.on("message",Qu)):Ju("not listening for messages, because we are not a master process")}));var eo={onlyOnMaster:(e,t)=>Xu()?e():t,isMaster:Xu,send:e=>{Xu()?Zu(e):(Ku||(e.cluster={workerId:Wu.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{zu.push(e)}},to={};function no(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.substr(e.length-1).toLocaleUpperCase(),u=e.substring(0,e.length-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function ro(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:no},e)}const uo={file:ro,fileSync:ro};to.modifyConfig=e=>uo[e.type]?uo[e.type](e):e;var oo={};const io=console.log.bind(console);oo.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{io(e(n,t))}}(n,e.timezoneOffset)};var so={};so.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var co={};co.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var ao={};ao.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;t.isGreaterThanOrEqualTo(u)&&t.isLessThanOrEqualTo(o)&&n(e)}}(e.level,e.maxLevel,u,r)};var lo={};const fo=Nr.exports("log4js:categoryFilter");lo.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{fo(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(fo("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var Do={};const po=Nr.exports("log4js:noLogFilter");Do.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{po(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(po("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var Eo={},mo={exports:{}},ho={},yo={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}};!function(e){const t=yo.fromCallback,n=we,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(ho);const Co=p.default;function Fo(e){return(e=Co.normalize(Co.resolve(e)).split(Co.sep)).length>0?e[0]:null}const go=/[<>:"|?*]/;var Ao=function(e){const t=Fo(e);return e=e.replace(t,""),go.test(e)};const vo=we,So=p.default,wo=Ao,Oo=parseInt("0777",8);var bo=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&wo(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||vo;void 0===o&&(o=Oo&~process.umask()),u||(u=null),r=r||function(){},t=So.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(So.dirname(t)===t)return r(o);e(So.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const _o=we,Bo=p.default,Po=Ao,ko=parseInt("0777",8);var xo=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||_o;if("win32"===process.platform&&Po(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=ko&~process.umask()),r||(r=null),t=Bo.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Bo.dirname(t)===t)throw u;r=e(Bo.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const No=(0,yo.fromCallback)(bo);var Io={mkdirs:No,mkdirsSync:xo,mkdirp:No,mkdirpSync:xo,ensureDir:No,ensureDirSync:xo};const To=we;E.default,p.default;var Ro=function(e,t,n,r){To.open(e,"r+",((e,u)=>{if(e)return r(e);To.futimes(u,t,n,(e=>{To.close(u,(t=>{r&&r(e||t)}))}))}))},Mo=function(e,t,n){const r=To.openSync(e,"r+");return To.futimesSync(r,t,n),To.closeSync(r)};const Lo=we,jo=p.default,$o=10,Ho=5,Jo=0,Go=process.versions.node.split("."),Vo=Number.parseInt(Go[0],10),Uo=Number.parseInt(Go[1],10),Wo=Number.parseInt(Go[2],10);function zo(){if(Vo>$o)return!0;if(Vo===$o){if(Uo>Ho)return!0;if(Uo===Ho&&Wo>=Jo)return!0}return!1}function Ko(e,t){const n=jo.resolve(e).split(jo.sep).filter((e=>e)),r=jo.resolve(t).split(jo.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function qo(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Yo,Xo,Zo={checkPaths:function(e,t,n,r){!function(e,t,n){zo()?Lo.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);Lo.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):Lo.stat(e,((e,r)=>{if(e)return n(e);Lo.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&Ko(e,t)?r(new Error(qo(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=zo()?Lo.statSync(e,{bigint:!0}):Lo.statSync(e);try{r=zo()?Lo.statSync(t,{bigint:!0}):Lo.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&Ko(e,t))throw new Error(qo(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=jo.resolve(jo.dirname(t)),s=jo.resolve(jo.dirname(r));if(s===i||s===jo.parse(s).root)return o();zo()?Lo.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(qo(t,r,u))):e(t,n,s,u,o))):Lo.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(qo(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=jo.resolve(jo.dirname(t)),i=jo.resolve(jo.dirname(r));if(i===o||i===jo.parse(i).root)return;let s;try{s=zo()?Lo.statSync(i,{bigint:!0}):Lo.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(qo(t,r,u));return e(t,n,i,u)},isSrcSubdir:Ko};const Qo=we,ei=p.default,ti=Io.mkdirsSync,ni=Mo,ri=Zo;function ui(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Qo.statSync:Qo.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Qo.mkdirSync(n),ii(t,n,r),Qo.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return ii(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Qo.unlinkSync(n),oi(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):oi(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Qo.readlinkSync(t);r.dereference&&(u=ei.resolve(process.cwd(),u));if(e){let e;try{e=Qo.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Qo.symlinkSync(u,n);throw e}if(r.dereference&&(e=ei.resolve(process.cwd(),e)),ri.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Qo.statSync(n).isDirectory()&&ri.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Qo.unlinkSync(t),Qo.symlinkSync(e,t)}(u,n)}return Qo.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function oi(e,t,n,r){return"function"==typeof Qo.copyFileSync?(Qo.copyFileSync(t,n),Qo.chmodSync(n,e.mode),r.preserveTimestamps?ni(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Xo?Yo:(Xo=1,Yo=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Qo.openSync(t,"r"),s=Qo.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=ei.join(t,e),o=ei.join(n,e),{destStat:i}=ri.checkPathsSync(u,o,"copy");return ui(i,u,o,r)}(r,e,t,n)))}var si=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=ri.checkPathsSync(e,t,"copy");return ri.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=ei.dirname(n);Qo.existsSync(u)||ti(u);return ui(e,t,n,r)}(u,e,t,n)},ci={copySync:si};const ai=yo.fromPromise,li=ho;var fi={pathExists:ai((function(e){return li.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:li.existsSync};const di=we,Di=p.default,pi=Io.mkdirs,Ei=fi.pathExists,mi=Ro,hi=Zo;function yi(e,t,n,r,u){const o=Di.dirname(n);Ei(o,((i,s)=>i?u(i):s?Fi(e,t,n,r,u):void pi(o,(o=>o?u(o):Fi(e,t,n,r,u)))))}function Ci(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function Fi(e,t,n,r,u){return r.filter?Ci(gi,e,t,n,r,u):gi(e,t,n,r,u)}function gi(e,t,n,r,u){(r.dereference?di.stat:di.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){di.mkdir(n,(o=>{if(o)return u(o);Si(t,n,r,(t=>t?u(t):di.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return Si(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();di.unlink(n,(o=>o?u(o):Ai(e,t,n,r,u)))}(e,n,r,u,o):Ai(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){di.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Di.resolve(process.cwd(),o)),e?void di.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?di.symlink(o,n,u):u(t):(r.dereference&&(i=Di.resolve(process.cwd(),i)),hi.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&hi.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){di.unlink(t,(r=>r?n(r):di.symlink(e,t,n)))}(o,n,u)))):di.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function Ai(e,t,n,r,u){return"function"==typeof di.copyFile?di.copyFile(t,n,(t=>t?u(t):vi(e,n,r,u))):function(e,t,n,r,u){const o=di.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=di.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>vi(e,n,r,u)))}))}(e,t,n,r,u)}function vi(e,t,n,r){di.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?mi(t,e.atime,e.mtime,r):r()))}function Si(e,t,n,r){di.readdir(e,((u,o)=>u?r(u):wi(o,e,t,n,r)))}function wi(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Di.join(n,t),s=Di.join(r,t);hi.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;Fi(a,i,s,u,(t=>t?o(t):wi(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var Oi=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),hi.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;hi.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?Ci(yi,s,e,t,n,r):yi(s,e,t,n,r)))}))};var bi={copy:(0,yo.fromCallback)(Oi)};const _i=we,Bi=p.default,Pi=g.default,ki="win32"===process.platform;function xi(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||_i[t],e[t+="Sync"]=e[t]||_i[t]})),e.maxBusyTries=e.maxBusyTries||3}function Ni(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),Pi(e,"rimraf: missing path"),Pi.strictEqual(typeof e,"string","rimraf: path should be a string"),Pi.strictEqual(typeof n,"function","rimraf: callback function required"),Pi(t,"rimraf: invalid options argument provided"),Pi.strictEqual(typeof t,"object","rimraf: options should be object"),xi(t),Ii(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rIi(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Ii(e,t,n){Pi(e),Pi(t),Pi("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&ki?Ti(e,t,r,n):u&&u.isDirectory()?Mi(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return ki?Ti(e,t,r,n):Mi(e,t,r,n);if("EISDIR"===r.code)return Mi(e,t,r,n)}return n(r)}))))}function Ti(e,t,n,r){Pi(e),Pi(t),Pi("function"==typeof r),n&&Pi(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Mi(e,t,n,r):t.unlink(e,r)}))}))}function Ri(e,t,n){let r;Pi(e),Pi(t),n&&Pi(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?ji(e,t,n):t.unlinkSync(e)}function Mi(e,t,n,r){Pi(e),Pi(t),n&&Pi(n instanceof Error),Pi("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){Pi(e),Pi(t),Pi("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{Ni(Bi.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function Li(e,t){let n;xi(t=t||{}),Pi(e,"rimraf: missing path"),Pi.strictEqual(typeof e,"string","rimraf: path should be a string"),Pi(t,"rimraf: missing options"),Pi.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&ki&&Ri(e,t,n)}try{n&&n.isDirectory()?ji(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return ki?Ri(e,t,n):ji(e,t,n);if("EISDIR"!==n.code)throw n;ji(e,t,n)}}function ji(e,t,n){Pi(e),Pi(t),n&&Pi(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(Pi(e),Pi(t),t.readdirSync(e).forEach((n=>Li(Bi.join(e,n),t))),!ki){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var $i=Ni;Ni.sync=Li;const Hi=$i;var Ji={remove:(0,yo.fromCallback)(Hi),removeSync:Hi.sync};const Gi=yo.fromCallback,Vi=we,Ui=p.default,Wi=Io,zi=Ji,Ki=Gi((function(e,t){t=t||function(){},Vi.readdir(e,((n,r)=>{if(n)return Wi.mkdirs(e,t);r=r.map((t=>Ui.join(e,t))),function e(){const n=r.pop();if(!n)return t();zi.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function qi(e){let t;try{t=Vi.readdirSync(e)}catch(t){return Wi.mkdirsSync(e)}t.forEach((t=>{t=Ui.join(e,t),zi.removeSync(t)}))}var Yi={emptyDirSync:qi,emptydirSync:qi,emptyDir:Ki,emptydir:Ki};const Xi=yo.fromCallback,Zi=p.default,Qi=we,es=Io,ts=fi.pathExists;var ns={createFile:Xi((function(e,t){function n(){Qi.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Qi.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Zi.dirname(e);ts(o,((e,r)=>e?t(e):r?n():void es.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Qi.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=Zi.dirname(e);Qi.existsSync(n)||es.mkdirsSync(n),Qi.writeFileSync(e,"")}};const rs=yo.fromCallback,us=p.default,os=we,is=Io,ss=fi.pathExists;var cs={createLink:rs((function(e,t,n){function r(e,t){os.link(e,t,(e=>{if(e)return n(e);n(null)}))}ss(t,((u,o)=>u?n(u):o?n(null):void os.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=us.dirname(t);ss(o,((u,i)=>u?n(u):i?r(e,t):void is.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(os.existsSync(t))return;try{os.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=us.dirname(t);return os.existsSync(n)||is.mkdirsSync(n),os.linkSync(e,t)}};const as=p.default,ls=we,fs=fi.pathExists;var ds={symlinkPaths:function(e,t,n){if(as.isAbsolute(e))return ls.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=as.dirname(t),u=as.join(r,e);return fs(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):ls.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:as.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(as.isAbsolute(e)){if(n=ls.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=as.dirname(t),u=as.join(r,e);if(n=ls.existsSync(u),n)return{toCwd:u,toDst:e};if(n=ls.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:as.relative(r,e)}}}};const Ds=we;var ps={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Ds.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Ds.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Es=yo.fromCallback,ms=p.default,hs=we,ys=Io.mkdirs,Cs=Io.mkdirsSync,Fs=ds.symlinkPaths,gs=ds.symlinkPathsSync,As=ps.symlinkType,vs=ps.symlinkTypeSync,Ss=fi.pathExists;var ws={createSymlink:Es((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Ss(t,((u,o)=>u?r(u):o?r(null):void Fs(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,As(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=ms.dirname(t);Ss(o,((n,i)=>n?r(n):i?hs.symlink(e,t,u,r):void ys(o,(n=>{if(n)return r(n);hs.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(hs.existsSync(t))return;const r=gs(e,t);e=r.toDst,n=vs(r.toCwd,n);const u=ms.dirname(t);return hs.existsSync(u)||Cs(u),hs.symlinkSync(e,t,n)}};var Os,bs={createFile:ns.createFile,createFileSync:ns.createFileSync,ensureFile:ns.createFile,ensureFileSync:ns.createFileSync,createLink:cs.createLink,createLinkSync:cs.createLinkSync,ensureLink:cs.createLink,ensureLinkSync:cs.createLinkSync,createSymlink:ws.createSymlink,createSymlinkSync:ws.createSymlinkSync,ensureSymlink:ws.createSymlink,ensureSymlinkSync:ws.createSymlinkSync};try{Os=we}catch(e){Os=D.default}function _s(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Bs(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var Ps={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||Os,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Bs(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||Os,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Bs(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||Os,o="";try{o=_s(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||Os,u=_s(t,n);return r.writeFileSync(e,u,n)}},ks=Ps;const xs=yo.fromCallback,Ns=ks;var Is={readJson:xs(Ns.readFile),readJsonSync:Ns.readFileSync,writeJson:xs(Ns.writeFile),writeJsonSync:Ns.writeFileSync};const Ts=p.default,Rs=Io,Ms=fi.pathExists,Ls=Is;var js=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=Ts.dirname(e);Ms(u,((o,i)=>o?r(o):i?Ls.writeJson(e,t,n,r):void Rs.mkdirs(u,(u=>{if(u)return r(u);Ls.writeJson(e,t,n,r)}))))};const $s=we,Hs=p.default,Js=Io,Gs=Is;var Vs=function(e,t,n){const r=Hs.dirname(e);$s.existsSync(r)||Js.mkdirsSync(r),Gs.writeJsonSync(e,t,n)};const Us=yo.fromCallback,Ws=Is;Ws.outputJson=Us(js),Ws.outputJsonSync=Vs,Ws.outputJSON=Ws.outputJson,Ws.outputJSONSync=Ws.outputJsonSync,Ws.writeJSON=Ws.writeJson,Ws.writeJSONSync=Ws.writeJsonSync,Ws.readJSON=Ws.readJson,Ws.readJSONSync=Ws.readJsonSync;var zs=Ws;const Ks=we,qs=p.default,Ys=ci.copySync,Xs=Ji.removeSync,Zs=Io.mkdirpSync,Qs=Zo;function ec(e,t,n){try{Ks.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Ys(e,t,r),Xs(e)}(e,t,n)}}var tc=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Qs.checkPathsSync(e,t,"move");return Qs.checkParentPathsSync(e,u,t,"move"),Zs(qs.dirname(t)),function(e,t,n){if(n)return Xs(t),ec(e,t,n);if(Ks.existsSync(t))throw new Error("dest already exists.");return ec(e,t,n)}(e,t,r)},nc={moveSync:tc};const rc=we,uc=p.default,oc=bi.copy,ic=Ji.remove,sc=Io.mkdirp,cc=fi.pathExists,ac=Zo;function lc(e,t,n,r){rc.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};oc(e,t,u,(t=>t?r(t):ic(e,r)))}(e,t,n,r):r()))}var fc=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;ac.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;ac.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);sc(uc.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return ic(t,(u=>u?r(u):lc(e,t,n,r)));cc(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):lc(e,t,n,r)))}(e,t,u,r)))}))}))};var dc={move:(0,yo.fromCallback)(fc)};const Dc=yo.fromCallback,pc=we,Ec=p.default,mc=Io,hc=fi.pathExists;var yc={outputFile:Dc((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Ec.dirname(e);hc(u,((o,i)=>o?r(o):i?pc.writeFile(e,t,n,r):void mc.mkdirs(u,(u=>{if(u)return r(u);pc.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Ec.dirname(e);if(pc.existsSync(n))return pc.writeFileSync(e,...t);mc.mkdirsSync(n),pc.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},ho,ci,bi,Yi,bs,zs,Io,nc,dc,yc,fi,Ji);const t=D.default;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(mo);const Cc=Nr.exports("streamroller:fileNameFormatter"),Fc=p.default;const gc=Nr.exports("streamroller:fileNameParser"),Ac=nu.exports;const vc=Nr.exports("streamroller:moveAndMaybeCompressFile"),Sc=mo.exports,wc=v.default;var Oc=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return vc(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await Sc.pathExists(e))if(vc(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=Sc.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=Sc.createReadStream(e).on("open",(()=>{t.pipe(wc.createGzip()).pipe(i)})).on("error",(t=>{vc(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{vc(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),Sc.unlink(e).then(r).catch((t=>{vc(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),Sc.truncate(e).then(r).catch((t=>{vc(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(vc(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),Sc.unlink(t).then((()=>{u(e)})).catch((e=>{vc(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(vc(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{vc(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await Sc.move(e,t,{overwrite:!0})}catch(n){if(vc(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){vc("moveAndMaybeCompressFile: trying copy+truncate instead");try{await Sc.copy(e,t,{overwrite:!0}),await Sc.truncate(e)}catch(e){vc("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else vc("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const bc=Nr.exports("streamroller:RollingFileWriteStream"),_c=mo.exports,Bc=p.default,Pc=E.default,kc=()=>new Date,xc=nu.exports,{Writable:Nc}=C.default,Ic=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=Fc.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,d=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(Cc(`_formatFileName: date=${e}, index=${t}`),d.reduce(((n,r)=>r(n,t,e)),s))},Tc=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(gc("it is gzipped"),t.isCompressed=!0,e.slice(0,-1*".gz".length)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(gc("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(gc("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];gc("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),gc(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=Ac.parse(n,i,new Date(0,0));return Ac.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return gc(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(gc("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},Rc=Oc;var Mc=class extends Nc{constructor(e,t){if(bc(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Bc.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Bc.sep}`)&&(e=e.replace("~",Pc.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Bc.parse(e),""===this.fileObject.dir&&(this.fileObject=Bc.parse(Bc.join(process.cwd(),e))),this.fileFormatter=Ic({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return bc(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{bc(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(bc(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==xc(this.options.pattern,kc())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return bc("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){bc(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await Rc(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?xc(this.options.pattern,kc()):null,bc(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await _c.readdir(this.fileObject.dir).catch((()=>[]));bc(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:kc().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return _c.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Bc.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(_c.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;_c.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=_c.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(bc(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),bc("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Bc.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,bc(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>_c.unlink(e).catch((t=>{bc(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Lc=Mc;var jc=class extends Lc{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const $c=Mc;var Hc={RollingFileWriteStream:Mc,RollingFileStream:jc,DateRollingFileStream:class extends $c{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Jc=Nr.exports("log4js:file"),Gc=p.default,Vc=Hc,Uc=E.default.EOL;let Wc=!1;const zc=new Set;function Kc(){zc.forEach((e=>{e.sighupHandler()}))}function qc(e,t,n,r){const u=new Vc.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}Eo.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){e=Gc.normalize(e),Jc("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let i=qc(e,n,r,u);const s=function(e){if(i.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}i.write(t(e,o)+Uc,"utf8")||process.emit("log4js:pause",!0)}};return s.reopen=function(){i.end((()=>{i=qc(e,n,r,u)}))},s.sighupHandler=function(){Jc("SIGHUP handler called."),s.reopen()},s.shutdown=function(e){zc.delete(s),0===zc.size&&Wc&&(process.removeListener("SIGHUP",Kc),Wc=!1),i.end("","utf-8",e)},zc.add(s),Wc||(process.on("SIGHUP",Kc),Wc=!0),s}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var Yc={};const Xc=Hc,Zc=E.default.EOL;function Qc(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new Xc.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Zc,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}Yc.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Qc(e.filename,e.pattern,n,e,e.timezoneOffset)};var ea={};const ta=Nr.exports("log4js:fileSync"),na=p.default,ra=D.default,ua=E.default.EOL||"\n";function oa(e,t){if(ra.existsSync(e))return;const n=ra.openSync(e,t.flags,t.mode);ra.closeSync(n)}class ia{constructor(e,t,n,r){ta("In RollingFileStream"),function(){if(!e||!t||t<=0)throw new Error("You must specify a filename and file size")}(),this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=ra.statSync(e).size}catch(t){oa(e,r)}return t}(this.filename)}shouldRoll(){return ta("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${na.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.substring(`${na.basename(e)}.`.length),10)||0}function o(e,t){return u(e)>u(t)?1:u(e) ${e}.${r+1}`),ra.renameSync(na.join(na.dirname(e),n),`${e}.${r+1}`)}}ta("Rolling, rolling, rolling"),ta("Renaming the old files"),ra.readdirSync(na.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;ta("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),ta("writing the chunk to the file"),n.currentSize+=e.length,ra.appendFileSync(n.filename,e)}}ea.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){ta("fileSync appender created");const i=function(e,t,n){let r;var u;return t?r=new ia(e,t,n,o):(oa(u=e,o),r={write(e){ra.appendFileSync(u,e)}}),r}(e=na.normalize(e),n,r=r||0===r?r:5);return e=>{i.write(t(e,u)+ua)}}(e.filename,n,e.maxLogSize,e.backups,e.timezoneOffset,r)};var sa={};const ca=Nr.exports("log4js:tcp"),aa=S.default;sa.configure=function(e,t){ca(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){ca("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(ca("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(ca("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){ca(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=aa.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{ca("socket connected"),c(),n=!0})),u.on("drain",(()=>{ca("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{ca("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){ca("shutdown called"),r.length&&o?(ca("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const la=p.default,fa=Nr.exports("log4js:appenders"),da=tu,Da=eo,pa=gu,Ea=hu,ma=to,ha=new Map;ha.set("console",oo),ha.set("stdout",so),ha.set("stderr",co),ha.set("logLevelFilter",ao),ha.set("categoryFilter",lo),ha.set("noLogFilter",Do),ha.set("file",Eo),ha.set("dateFile",Yc),ha.set("fileSync",ea),ha.set("tcp",sa);const ya=new Map,Ca=(e,t)=>{fa("Loading module from ",e);try{return require(e)}catch(n){return void da.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},Fa=new Set,ga=(e,t)=>{if(ya.has(e))return ya.get(e);if(!t.appenders[e])return!1;if(Fa.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);Fa.add(e),fa(`Creating appender ${e}`);const n=Aa(e,t);return Fa.delete(e),ya.set(e,n),n},Aa=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ha.get(e)||Ca(`./${e}`,t)||Ca(e,t)||require.main&&Ca(la.join(la.dirname(require.main.filename),e),t)||Ca(la.join(process.cwd(),e),t))(n.type,t);return da.throwExceptionIf(t,da.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&fa(`DEPRECATION: Appender ${n.type} exports an appender function.`),r.shutdown&&fa(`DEPRECATION: Appender ${n.type} exports a shutdown function.`),fa(`${e}: clustering.isMaster ? ${Da.isMaster()}`),fa(`${e}: appenderModule is ${F.default.inspect(r)}`),Da.onlyOnMaster((()=>(fa(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ma.modifyConfig(n),Ea,(e=>ga(e,t)),pa))),(()=>{}))},va=e=>{ya.clear(),Fa.clear();const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type)&&ga(n,e)}))},Sa=()=>{va({appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"trace"}}})};Sa(),da.addListener((e=>{da.throwExceptionIf(e,da.not(da.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);da.throwExceptionIf(e,da.not(t.length),"must define at least one appender."),t.forEach((t=>{da.throwExceptionIf(e,da.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),da.addListener(va),Au.exports=ya,Au.exports.init=Sa;var wa={exports:{}};!function(e){const t=Nr.exports("log4js:categories"),n=tu,r=gu,u=Au.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.substring(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{o.clear();Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c({categories:{default:{appenders:["out"],level:"OFF"}}})};a(),n.addListener(c);const l=e=>(t(`configForCategory: searching for config for ${e}`),o.has(e)?(t(`configForCategory: ${e} exists in config, returning it`),o.get(e)):e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, searching for parents`),l(e.substring(0,e.lastIndexOf(".")))):(t("configForCategory: returning config for default category"),l("default")));e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,n)=>{let r=o.get(e);if(t(`setLevelForCategory: found ${r} for ${e}`),!r){const n=l(e);t(`setLevelForCategory: no config found for category, found ${n} for parents of ${e}`),r={appenders:n.appenders}}r.level=n,o.set(e,r)},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(wa);const Oa=Nr.exports("log4js:logger"),ba=Hu,_a=gu,Ba=eo,Pa=wa.exports,ka=tu,xa=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function Na(e,t=4){const n=e.stack.split("\n").slice(t),r=xa.exec(n[0]);return r&&6===r.length?{functionName:r[1],fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n")}:null}class Ia{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.parseCallStack=Na,Oa(`Logger created (${this.category}, ${this.level})`)}get level(){return _a.getLevel(Pa.getLevelForCategory(this.category),_a.TRACE)}set level(e){Pa.setLevelForCategory(this.category,_a.getLevel(e,this.level))}get useCallStack(){return Pa.getEnableCallStackForCategory(this.category)}set useCallStack(e){Pa.setEnableCallStackForCategory(this.category,!0===e)}log(e,...t){let n=_a.getLevel(e);n||(this._log(_a.WARN,"log4js:logger.log: invalid value for log-level as first parameter given: ",e),n=_a.INFO),this.isLevelEnabled(n)&&this._log(n,t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){Oa(`sending log data (${e}) to appenders`);const n=new ba(this.category,e,t,this.context,this.useCallStack&&this.parseCallStack(new Error));Ba.send(n)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){this.parseCallStack=e}}function Ta(e){const t=_a.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Ia.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Ia.prototype[n]=function(...e){this.log(t,...e)}}_a.levels.forEach(Ta),ka.addListener((()=>{_a.levels.forEach(Ta)}));var Ra=Ia;const Ma=gu;function La(e){return e.originalUrl||e.url}function ja(e,t){for(let n=0;ne.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);return(e,i,s)=>{if(e._logging)return s();if(o&&o.test(e.originalUrl))return s();if(n.isLevelEnabled(r)||"auto"===t.level){const o=new Date,{writeHead:s}=i;e._logging=!0,i.writeHead=(e,t)=>{i.writeHead=s,i.writeHead(e,t),i.__statusCode=e,i.__headers=t||{}},i.on("finish",(()=>{i.responseTime=new Date-o,i.statusCode&&"auto"===t.level&&(r=Ma.INFO,i.statusCode>=300&&(r=Ma.WARN),i.statusCode>=400&&(r=Ma.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ma.getLevel(t.level,r))}return r}(i.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:La(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eja(e,s)));t&&n.log(r,t)}else n.log(r,ja(u,s));t.context&&n.removeContext("res")}))}return s()}},nl=Va;let rl=!1;function ul(e){if(!rl)return;Ua("Received log event ",e);Za.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function ol(e){rl&&il();let t=e;return"string"==typeof t&&(t=function(e){Ua(`Loading configuration from ${e}`);try{return JSON.parse(Wa.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ua(`Configuration is ${t}`),Ka.configure(za(t)),el.onMessage(ul),rl=!0,sl}function il(e){Ua("Shutdown called. Disabling all log writing."),rl=!1;const t=Array.from(Xa.values());Xa.init(),Za.init();const n=t.reduceRight(((e,t)=>t.shutdown?e+1:e),0);if(0===n)return Ua("No appenders with shutdown functions found."),void 0!==e&&e();let r,u=0;function o(t){r=r||t,u+=1,Ua(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ua("All shutdown functions completed."),e&&e(r))}return Ua(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o))),null}const sl={getLogger:function(e){return rl||ol(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Qa(e||"default")},configure:ol,shutdown:il,connectLogger:tl,levels:Ya,addLayout:qa.addLayout,recording:function(){return nl}};var cl=sl,al={};Object.defineProperty(al,"__esModule",{value:!0}),al.levelMap=al.getLevel=al.setCategoriesLevel=al.getConfiguration=al.setConfiguration=void 0;const ll=cl;let fl={appenders:{debug:{type:"stdout",layout:{type:"pattern",pattern:"[%d] > hvigor %p %c %[%m%]"}},info:{type:"stdout",layout:{type:"pattern",pattern:"[%d] > hvigor %[%m%]"}},"no-pattern-info":{type:"stdout",layout:{type:"pattern",pattern:"%m"}},wrong:{type:"stderr",layout:{type:"pattern",pattern:"[%d] > hvigor %[%p: %m%]"}},"just-debug":{type:"logLevelFilter",appender:"debug",level:"debug",maxLevel:"debug"},"just-info":{type:"logLevelFilter",appender:"info",level:"info",maxLevel:"info"},"just-wrong":{type:"logLevelFilter",appender:"wrong",level:"warn",maxLevel:"error"}},categories:{default:{appenders:["just-debug","just-info","just-wrong"],level:"debug"},"no-pattern-info":{appenders:["no-pattern-info"],level:"info"}}};al.setConfiguration=e=>{fl=e};al.getConfiguration=()=>fl;let dl=ll.levels.DEBUG;al.setCategoriesLevel=(e,t)=>{dl=e;const n=fl.categories;for(const r in n)(null==t?void 0:t.includes(r))||Object.prototype.hasOwnProperty.call(n,r)&&(n[r].level=e.levelStr)};al.getLevel=()=>dl,al.levelMap=new Map([["ALL",ll.levels.ALL],["MARK",ll.levels.MARK],["TRACE",ll.levels.TRACE],["DEBUG",ll.levels.DEBUG],["INFO",ll.levels.INFO],["WARN",ll.levels.WARN],["ERROR",ll.levels.ERROR],["FATAL",ll.levels.FATAL],["OFF",ll.levels.OFF]]);var Dl=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),pl=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),El=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Dl(t,e,n);return pl(t,e),t};Object.defineProperty(xr,"__esModule",{value:!0}),xr.evaluateLogLevel=xr.HvigorLogger=void 0;const ml=El(cl),hl=cl,yl=El(F.default),Cl=al;class Fl{constructor(e){ml.configure((0,Cl.getConfiguration)()),this._logger=ml.getLogger(e),this._logger.level=(0,Cl.getLevel)()}static getLogger(e){return new Fl(e)}log(e,...t){this._logger.log(e,...t)}debug(e,...t){this._logger.debug(e,...t)}info(e,...t){this._logger.info(e,...t)}warn(e,...t){void 0!==e&&""!==e&&this._logger.warn(e,...t)}error(e,...t){this._logger.error(e,...t)}_printTaskExecuteInfo(e,t){this.info(`Finished :${e}... after ${t}`)}_printFailedTaskInfo(e){this.error(`Failed :${e}... `)}_printDisabledTaskInfo(e){this.info(`Disabled :${e}... `)}_printUpToDateTaskInfo(e){this.info(`UP-TO-DATE :${e}... `)}errorMessageExit(e,...t){throw new Error(yl.format(e,...t))}errorExit(e,t,...n){t&&this._logger.error(t,n),this._logger.error(e.stack)}setLevel(e,t){(0,Cl.setCategoriesLevel)(e,t),ml.shutdown(),ml.configure((0,Cl.getConfiguration)())}getLevel(){return this._logger.level}configure(e){const t=(0,Cl.getConfiguration)(),n={appenders:{...t.appenders,...e.appenders},categories:{...t.categories,...e.categories}};(0,Cl.setConfiguration)(n),ml.shutdown(),ml.configure(n)}}xr.HvigorLogger=Fl,xr.evaluateLogLevel=function(e,t){t.debug?e.setLevel(hl.levels.DEBUG):t.warn?e.setLevel(hl.levels.WARN):t.error?e.setLevel(hl.levels.ERROR):e.setLevel(hl.levels.INFO)};var gl=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(X,"__esModule",{value:!0}),X.parseJsonText=X.parseJsonFile=void 0;const Al=Z,vl=gl(kr),Sl=gl(p.default),wl=gl(E.default),Ol=xr.HvigorLogger.getLogger("parse-json-util");var bl;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(bl||(bl={}));let _l,Bl,Pl,kl,xl,Nl,Il="start",Tl=[],Rl=0,Ml=1,Ll=0,jl=!1,$l="default",Hl="'",Jl=1;function Gl(e,t=!1){Bl=String(e),Il="start",Tl=[],Rl=0,Ml=1,Ll=0,kl=void 0,jl=t;do{_l=Vl(),Xl[Il]()}while("eof"!==_l.type);return kl}function Vl(){for($l="default",xl="",Hl="'",Jl=1;;){Nl=Ul();const e=zl[$l]();if(e)return e}}function Ul(){if(Bl[Rl])return String.fromCodePoint(Bl.codePointAt(Rl))}function Wl(){const e=Ul();return"\n"===e?(Ml++,Ll=0):e?Ll+=e.length:Ll++,e&&(Rl+=e.length),e}X.parseJsonFile=function(e,t=!1,n="utf-8"){const r=vl.default.readFileSync(Sl.default.resolve(e),{encoding:n});try{return Gl(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");2===n.length&&Ol.errorMessageExit(`${n[0].trim()}${wl.default.EOL}\t at ${e}:${n[1].trim()}`)}Ol.errorMessageExit(`${e} is not in valid JSON/JSON5 format.`)}},X.parseJsonText=Gl;const zl={default(){switch(Nl){case"/":return Wl(),void($l="comment");case void 0:return Wl(),Kl("eof")}if(!Al.JudgeUtil.isIgnoreChar(Nl)&&!Al.JudgeUtil.isSpaceSeparator(Nl))return zl[Il]();Wl()},start(){$l="value"},beforePropertyName(){switch(Nl){case"$":case"_":return xl=Wl(),void($l="identifierName");case"\\":return Wl(),void($l="identifierNameStartEscape");case"}":return Kl("punctuator",Wl());case'"':case"'":return Hl=Nl,Wl(),void($l="string")}if(Al.JudgeUtil.isIdStartChar(Nl))return xl+=Wl(),void($l="identifierName");throw tf(bl.Char,Wl())},afterPropertyName(){if(":"===Nl)return Kl("punctuator",Wl());throw tf(bl.Char,Wl())},beforePropertyValue(){$l="value"},afterPropertyValue(){switch(Nl){case",":case"}":return Kl("punctuator",Wl())}throw tf(bl.Char,Wl())},beforeArrayValue(){if("]"===Nl)return Kl("punctuator",Wl());$l="value"},afterArrayValue(){switch(Nl){case",":case"]":return Kl("punctuator",Wl())}throw tf(bl.Char,Wl())},end(){throw tf(bl.Char,Wl())},comment(){switch(Nl){case"*":return Wl(),void($l="multiLineComment");case"/":return Wl(),void($l="singleLineComment")}throw tf(bl.Char,Wl())},multiLineComment(){switch(Nl){case"*":return Wl(),void($l="multiLineCommentAsterisk");case void 0:throw tf(bl.Char,Wl())}Wl()},multiLineCommentAsterisk(){switch(Nl){case"*":return void Wl();case"/":return Wl(),void($l="default");case void 0:throw tf(bl.Char,Wl())}Wl(),$l="multiLineComment"},singleLineComment(){switch(Nl){case"\n":case"\r":case"\u2028":case"\u2029":return Wl(),void($l="default");case void 0:return Wl(),Kl("eof")}Wl()},value(){switch(Nl){case"{":case"[":return Kl("punctuator",Wl());case"n":return Wl(),ql("ull"),Kl("null",null);case"t":return Wl(),ql("rue"),Kl("boolean",!0);case"f":return Wl(),ql("alse"),Kl("boolean",!1);case"-":case"+":return"-"===Wl()&&(Jl=-1),void($l="numerical");case".":case"0":case"I":case"N":return void($l="numerical");case'"':case"'":return Hl=Nl,Wl(),xl="",void($l="string")}if(void 0===Nl||!Al.JudgeUtil.isDigitWithoutZero(Nl))throw tf(bl.Char,Wl());$l="numerical"},numerical(){switch(Nl){case".":return xl=Wl(),void($l="decimalPointLeading");case"0":return xl=Wl(),void($l="zero");case"I":return Wl(),ql("nfinity"),Kl("numeric",Jl*(1/0));case"N":return Wl(),ql("aN"),Kl("numeric",NaN)}if(void 0!==Nl&&Al.JudgeUtil.isDigitWithoutZero(Nl))return xl=Wl(),void($l="decimalInteger");throw tf(bl.Char,Wl())},zero(){switch(Nl){case".":case"e":case"E":return void($l="decimal");case"x":case"X":return xl+=Wl(),void($l="hexadecimal")}return Kl("numeric",0)},decimalInteger(){switch(Nl){case".":case"e":case"E":return void($l="decimal")}if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},decimal(){switch(Nl){case".":xl+=Wl(),$l="decimalFraction";break;case"e":case"E":xl+=Wl(),$l="decimalExponent"}},decimalPointLeading(){if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalFraction");throw tf(bl.Char,Wl())},decimalFraction(){switch(Nl){case"e":case"E":return xl+=Wl(),void($l="decimalExponent")}if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},decimalExponent(){switch(Nl){case"+":case"-":return xl+=Wl(),void($l="decimalExponentSign")}if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalExponentInteger");throw tf(bl.Char,Wl())},decimalExponentSign(){if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalExponentInteger");throw tf(bl.Char,Wl())},decimalExponentInteger(){if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},hexadecimal(){if(Al.JudgeUtil.isHexDigit(Nl))return xl+=Wl(),void($l="hexadecimalInteger");throw tf(bl.Char,Wl())},hexadecimalInteger(){if(!Al.JudgeUtil.isHexDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},identifierNameStartEscape(){if("u"!==Nl)throw tf(bl.Char,Wl());Wl();const e=Yl();switch(e){case"$":case"_":break;default:if(!Al.JudgeUtil.isIdStartChar(e))throw tf(bl.Identifier)}xl+=e,$l="identifierName"},identifierName(){switch(Nl){case"$":case"_":case"":case"":return void(xl+=Wl());case"\\":return Wl(),void($l="identifierNameEscape")}if(!Al.JudgeUtil.isIdContinueChar(Nl))return Kl("identifier",xl);xl+=Wl()},identifierNameEscape(){if("u"!==Nl)throw tf(bl.Char,Wl());Wl();const e=Yl();switch(e){case"$":case"_":case"":case"":break;default:if(!Al.JudgeUtil.isIdContinueChar(e))throw tf(bl.Identifier)}xl+=e,$l="identifierName"},string(){switch(Nl){case"\\":return Wl(),void(xl+=function(){const e=Ul(),t=function(){switch(Ul()){case"b":return Wl(),"\b";case"f":return Wl(),"\f";case"n":return Wl(),"\n";case"r":return Wl(),"\r";case"t":return Wl(),"\t";case"v":return Wl(),"\v"}return}();if(t)return t;switch(e){case"0":if(Wl(),Al.JudgeUtil.isDigit(Ul()))throw tf(bl.Char,Wl());return"\0";case"x":return Wl(),function(){let e="",t=Ul();if(!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());if(e+=Wl(),t=Ul(),!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());return e+=Wl(),String.fromCodePoint(parseInt(e,16))}();case"u":return Wl(),Yl();case"\n":case"\u2028":case"\u2029":return Wl(),"";case"\r":return Wl(),"\n"===Ul()&&Wl(),""}if(void 0===e||Al.JudgeUtil.isDigitWithoutZero(e))throw tf(bl.Char,Wl());return Wl()}());case'"':case"'":if(Nl===Hl){const e=Kl("string",xl);return Wl(),e}return void(xl+=Wl());case"\n":case"\r":case void 0:throw tf(bl.Char,Wl());case"\u2028":case"\u2029":!function(e){Ol.warn(`JSON5: '${ef(e)}' in strings is not valid ECMAScript; consider escaping.`)}(Nl)}xl+=Wl()}};function Kl(e,t){return{type:e,value:t,line:Ml,column:Ll}}function ql(e){for(const t of e){if(Ul()!==t)throw tf(bl.Char,Wl());Wl()}}function Yl(){let e="",t=4;for(;t-- >0;){const t=Ul();if(!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());e+=Wl()}return String.fromCodePoint(parseInt(e,16))}const Xl={start(){if("eof"===_l.type)throw tf(bl.EOF);Zl()},beforePropertyName(){switch(_l.type){case"identifier":case"string":return Pl=_l.value,void(Il="afterPropertyName");case"punctuator":return void Ql();case"eof":throw tf(bl.EOF)}},afterPropertyName(){if("eof"===_l.type)throw tf(bl.EOF);Il="beforePropertyValue"},beforePropertyValue(){if("eof"===_l.type)throw tf(bl.EOF);Zl()},afterPropertyValue(){if("eof"===_l.type)throw tf(bl.EOF);switch(_l.value){case",":return void(Il="beforePropertyName");case"}":Ql()}},beforeArrayValue(){if("eof"===_l.type)throw tf(bl.EOF);"punctuator"!==_l.type||"]"!==_l.value?Zl():Ql()},afterArrayValue(){if("eof"===_l.type)throw tf(bl.EOF);switch(_l.value){case",":return void(Il="beforeArrayValue");case"]":Ql()}},end(){}};function Zl(){const e=function(){let e;switch(_l.type){case"punctuator":switch(_l.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=_l.value}return e}();if(jl&&"object"==typeof e&&(e._line=Ml,e._column=Ll),void 0===kl)kl=e;else{const t=Tl[Tl.length-1];Array.isArray(t)?jl&&"object"!=typeof e?t.push({value:e,_line:Ml,_column:Ll}):t.push(e):t[Pl]=jl&&"object"!=typeof e?{value:e,_line:Ml,_column:Ll}:e}!function(e){if(e&&"object"==typeof e)Tl.push(e),Il=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Tl[Tl.length-1];Il=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ql(){Tl.pop();const e=Tl[Tl.length-1];Il=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function ef(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function tf(e,t){let n="";switch(e){case bl.Char:n=void 0===t?`JSON5: invalid end of input at ${Ml}:${Ll}`:`JSON5: invalid character '${ef(t)}' at ${Ml}:${Ll}`;break;case bl.EOF:n=`JSON5: invalid end of input at ${Ml}:${Ll}`;break;case bl.Identifier:Ll-=5,n=`JSON5: invalid identifier character at ${Ml}:${Ll}`}const r=new nf(n);return r.lineNumber=Ml,r.columnNumber=Ll,r}class nf extends SyntaxError{}var rf=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),uf=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),of=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&rf(t,e,n);return uf(t,e),t};Object.defineProperty(Y,"__esModule",{value:!0});var sf=Y.cleanWorkSpace=Ff=Y.executeInstallHvigor=yf=Y.isHvigorInstalled=mf=Y.isAllDependenciesInstalled=void 0;const cf=of(D.default),af=of(p.default),lf=b,ff=j,df=$,Df=X;let pf,Ef;var mf=Y.isAllDependenciesInstalled=function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}if(pf=gf(),Ef=Af(),e(pf)+1!==e(Ef))return!1;for(const e in null==pf?void 0:pf.dependencies)if(!(0,ff.hasNpmPackInPaths)(e,[lf.HVIGOR_PROJECT_DEPENDENCIES_HOME])||!hf(e,pf,Ef))return!1;return!0};function hf(e,t,n){return void 0!==n.dependencies&&(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===n.dependencies[e]}var yf=Y.isHvigorInstalled=function(){return pf=gf(),Ef=Af(),(0,ff.hasNpmPackInPaths)(lf.HVIGOR_ENGINE_PACKAGE_NAME,[lf.HVIGOR_PROJECT_DEPENDENCIES_HOME])&&(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,pf.hvigorVersion)===Ef.dependencies[lf.HVIGOR_ENGINE_PACKAGE_NAME]};const Cf={cwd:lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,stdio:["inherit","inherit","inherit"]};var Ff=Y.executeInstallHvigor=function(){(0,df.logInfoPrintConsole)("Hvigor installing...");const e={dependencies:{}};e.dependencies[lf.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,pf.hvigorVersion);try{cf.mkdirSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,{recursive:!0});const t=af.resolve(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,lf.DEFAULT_PACKAGE_JSON);cf.writeFileSync(t,JSON.stringify(e))}catch(e){(0,df.logErrorAndExit)(e)}!function(){const e=["config","set","store-dir",lf.HVIGOR_PNPM_STORE_PATH];(0,ff.executeCommand)(lf.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,Cf)}(),(0,ff.executeCommand)(lf.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,["install"],Cf)};function gf(){const e=af.resolve(lf.HVIGOR_PROJECT_WRAPPER_HOME,lf.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);return cf.existsSync(e)||(0,df.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`),(0,Df.parseJsonFile)(e)}function Af(){return cf.existsSync(lf.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH)?(0,Df.parseJsonFile)(lf.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH):{dependencies:{}}}sf=Y.cleanWorkSpace=function(){if((0,df.logInfoPrintConsole)("Hvigor cleaning..."),!cf.existsSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME))return;const e=cf.readdirSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME);if(e&&0!==e.length){cf.existsSync(lf.HVIGOR_BOOT_JS_FILE_PATH)&&(0,ff.executeCommand)(process.argv[0],[lf.HVIGOR_BOOT_JS_FILE_PATH,"--stop-daemon"],{});try{e.forEach((e=>{cf.rmSync(af.resolve(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,e),{recursive:!0})}))}catch(e){(0,df.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${lf.HVIGOR_PROJECT_DEPENDENCIES_HOME}.`)}}};var vf={},Sf=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),wf=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Of=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Sf(t,e,n);return wf(t,e),t};Object.defineProperty(vf,"__esModule",{value:!0});var bf=vf.executeBuild=void 0;const _f=b,Bf=Of(D.default),Pf=Of(p.default),kf=$;bf=vf.executeBuild=function(){const e=Pf.resolve(_f.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const t=Bf.realpathSync(e);require(t)}catch(t){(0,kf.logErrorAndExit)(`Error: ENOENT: no such file ${e},delete ${_f.HVIGOR_PROJECT_DEPENDENCIES_HOME} and retry.`)}},function(){if(O.checkNpmConifg(),O.environmentHandler(),O.isPnpmAvailable()||O.executeInstallPnpm(),yf()&&mf())bf();else{sf();try{Ff()}catch(e){return void sf()}bf()}}();
\ No newline at end of file
diff --git a/Distributed/DistributeDatabaseDrawEts/entry/hvigorfile.js b/Distributed/DistributeDraw/hvigorfile.ts
similarity index 61%
rename from Distributed/DistributeDatabaseDrawEts/entry/hvigorfile.js
rename to Distributed/DistributeDraw/hvigorfile.ts
index bcec4c99653062cbf17702c40a2dd2a7b809b81a..6478186902c0c1ad7c966a929c7d6b7d8ae7a9f3 100644
--- a/Distributed/DistributeDatabaseDrawEts/entry/hvigorfile.js
+++ b/Distributed/DistributeDraw/hvigorfile.ts
@@ -1,2 +1,2 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
-module.exports = require('@ohos/hvigor-ohos-plugin').legacyHapTasks
+export { appTasks } from '@ohos/hvigor-ohos-plugin';
\ No newline at end of file
diff --git a/Distributed/DistributeDraw/oh-package.json5 b/Distributed/DistributeDraw/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..571eed008807a6d8cbf52713bcffac90bc7df2ca
--- /dev/null
+++ b/Distributed/DistributeDraw/oh-package.json5
@@ -0,0 +1,12 @@
+{
+ "license": "",
+ "devDependencies": {
+ "@ohos/hypium": "1.0.6"
+ },
+ "author": "",
+ "name": "distributedraw",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "version": "1.0.0",
+ "dependencies": {}
+}
diff --git a/Distributed/DistributedNewsClient/AppScope/app.json5 b/Distributed/DistributedNewsClient/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..f5e3ccfe2edf4dacf6e4f3449c8733c1a394b3c3
--- /dev/null
+++ b/Distributed/DistributedNewsClient/AppScope/app.json5
@@ -0,0 +1,10 @@
+{
+ "app": {
+ "bundleName": "com.huawei.distributednews",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/Distributed/DistributedNewsClient/AppScope/resources/base/element/string.json b/Distributed/DistributedNewsClient/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..ad631a92005b0aff114a3597cc196461d1f9d8dd
--- /dev/null
+++ b/Distributed/DistributedNewsClient/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "DistributedNews"
+ }
+ ]
+}
diff --git a/Distributed/DistributedNewsClient/AppScope/resources/base/media/app_icon.png b/Distributed/DistributedNewsClient/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/Distributed/DistributedNewsClient/AppScope/resources/base/media/app_icon.png differ
diff --git a/Distributed/DistributedNewsClient/LICENSE b/Distributed/DistributedNewsClient/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..0210352ae2ade0dd7b4c841cb6e8ba08b4780038
--- /dev/null
+++ b/Distributed/DistributedNewsClient/LICENSE
@@ -0,0 +1,78 @@
+ Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+Apache License, Version 2.0
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License.
+
+Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License.
+
+Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.
+
+You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+1.You must give any other recipients of the Work or Derivative Works a copy of this License; and
+2.You must cause any modified files to carry prominent notices stating that You changed the files; and
+3.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+4.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+
+You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions.
+
+Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks.
+
+This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty.
+
+Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability.
+
+In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability.
+
+While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/README.md b/Distributed/DistributedNewsClient/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..cf583105ac6ddfd8113f1c334b3f5f3cde1eaf47
--- /dev/null
+++ b/Distributed/DistributedNewsClient/README.md
@@ -0,0 +1,551 @@
+# 分布式新闻客户端(ArkTS)
+
+## 介绍
+
+本篇Codelab基于栅格布局、设备管理和多端协同,实现一次开发,多端部署的分布式新闻客户端页面。主要包含以下功能:
+
+1. 展示新闻列表以及左右滑动切换新闻Tab。
+2. 点击新闻展示新闻详情页。
+3. 点击新闻详情页底部的分享按钮,发现周边处在同一无线网络下的设备并进行可信认证连接。
+4. 可信认证后,再次点击分享按钮,选择已连接的设备进行跨设备启动UIAbility。
+
+最终效果图如下:
+
+
+
+### 相关概念
+
+- [栅格布局](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/ui/arkts-layout-development-grid-layout.md):一种通用的辅助定位工具,解决多尺寸多设备的动态布局问题。
+- [设备管理](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-device-manager.md):模块提供分布式设备管理能力。
+- [跨设备启动UIAbility](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/application-models/hop-multi-device-collaboration.md):多端上的不同UIAbility/ServiceExtensionAbility同时运行、或者交替运行实现完整的业务。
+- [Tabs组件](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-container-tabs.md):通过页签进行内容视图切换的容器组件,每个页签对应一个内容视图。
+
+### 相关权限
+
+本篇Codelab使用了设备管理及跨设备实现多端协同能力,需要手动替换full-SDK,并在配置文件module.json5文件requestPermissions属性中添加如下权限:
+
+- [分布式设备认证组网权限](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/permission-list.md#ohospermissionaccess_service_dm):ohos.permission.ACCESS_SERVICE_DM。
+- [设备间的数据交换权限](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/permission-list.md#ohospermissiondistributed_datasync):ohos.permission.DISTRIBUTED_DATASYNC。
+
+### 约束与限制
+
+1. 本篇Codelab部分能力依赖于系统API,需下载full-SDK并替换DevEco Studio自动下载的public-SDK。具体操作可参考指南[《如何替换full-SDK》](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/faqs/full-sdk-switch-guide.md)。
+2. 本篇Codelab使用的部分API仅系统应用可用,需要提升应用等级。具体可参考指南[《访问控制授权申请指导》](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/accesstoken-overview.md#%E5%BA%94%E7%94%A8apl%E7%AD%89%E7%BA%A7%E8%AF%B4%E6%98%8E)。
+
+## 环境搭建
+
+### 软件要求
+
+- [DevEco Studio](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/start-overview.md#%E5%B7%A5%E5%85%B7%E5%87%86%E5%A4%87)版本:DevEco Studio 3.1 Release及以上版本。
+- OpenHarmony SDK版本:API version 10及以上版本。
+
+### 硬件要求
+
+- 开发板类型:[润和RK3568开发板](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-appendix-rk3568.md)。
+- OpenHarmony系统:4.0 Beta1及以上版本。
+
+### 环境搭建
+
+完成本篇Codelab我们首先要完成开发环境的搭建,本示例以**RK3568**开发板为例,参照以下步骤进行:
+
+1. [获取OpenHarmony系统版本](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md#%E8%8E%B7%E5%8F%96%E6%96%B9%E5%BC%8F3%E4%BB%8E%E9%95%9C%E5%83%8F%E7%AB%99%E7%82%B9%E8%8E%B7%E5%8F%96):标准系统解决方案(二进制)。以4.0 Beta1版本为例:
+
+
+
+2. 搭建烧录环境。
+ 1. [完成DevEco Device Tool的安装](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-ide-env-win.md)
+ 2. [完成RK3568开发板的烧录](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-ide-3568-burn.md)
+
+3. 搭建开发环境。
+ 1. 开始前请参考[工具准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/start-overview.md#%E5%B7%A5%E5%85%B7%E5%87%86%E5%A4%87),完成DevEco Studio的安装和开发环境配置。
+ 2. 开发环境配置完成后,请参考[使用工程向导](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/start-with-ets-stage.md#创建arkts工程)创建工程(模板选择“Empty Ability”)。
+ 3. 工程创建完成后,选择使用[真机进行调测](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/start-with-ets-stage.md#使用真机运行应用)。
+
+## 代码结构解读
+
+本篇Codelab只对核心代码进行讲解,对于完整代码,我们会在gitee中提供。
+
+```txt
+├──entry/src/main/ets // 代码区
+│ ├──common
+│ │ ├──bean
+│ │ │ └──NewsData.ets // 新闻数据类
+│ │ ├──constants
+│ │ │ └──CommonConstants.ets // 常量类
+│ │ └──utils
+│ │ ├──Logger.ets // 日志工具类
+│ │ └──PromptUtil.ets // 弹窗工具类
+│ ├──entryability
+│ │ └──EntryAbility.ets // 程序入口类
+│ ├──model
+│ │ └──RemoteDeviceModel.ets // 设备管理类
+│ ├──pages
+│ │ ├──Index.ets // 新闻列表页
+│ │ └──NewsDetail.ets // 新闻详情页
+│ ├──view
+│ │ ├──DetailFooter.ets // 详情页页脚
+│ │ ├──DetailHeadContent.ets // 新闻详情
+│ │ ├──DeviceListDialog.ets // 设备列表弹窗
+│ │ ├──NewsList.ets // 新闻列表
+│ │ └──NewsTab.ets // 新闻页签
+│ └──viewmodel
+│ └──NewsDataModel.ets // 新闻数据处理
+└──entry/src/main/resources // 资源文件目录
+```
+
+## 构建新闻列表页
+
+新闻列表页由页签区域和新闻列表区域组成,页签区域为自定义布局TabBuilder,新闻列表区域为Tabs组件嵌套List组件,并适配不同尺寸设备对应的栅格。新闻列表页能够左右滑动或点击页签切换新闻Tab,并设置点击新闻跳转至新闻详情页。
+
+
+
+```typescript
+// NewsTab.ets
+@Component
+export default struct NewsTab {
+ @State currentIndex: number = 0;
+ @State currentBreakpoint: string = CommonConstants.BREAKPOINT_SM;
+ private newsItems: NewsData[];
+
+ // 自定义页签栏
+ @Builder TabBuilder(title: Resource, index: number) {
+ Row() {
+ Text(title)
+ .fontSize(this.currentIndex === index ? $r('app.float.lager_font_size') : $r('app.float.middle_font_size'))
+ .fontWeight(this.currentIndex === index ? CommonConstants.FONT_WEIGHT_500 : FontWeight.Normal)
+ .fontColor(this.currentIndex === index ? $r('app.color.tab_font_select') : $r('app.color.font_color_gray'))
+ }
+ .layoutWeight(1)
+ .margin({
+ right: $r('app.float.news_tab_margin_right'),
+ left: (this.currentBreakpoint === CommonConstants.BREAKPOINT_SM && index === 0) ?
+ $r('app.float.news_tab_margin_left') : 0
+ })
+ .height(this.currentIndex === index ? $r('app.float.news_tab_current_height') : $r('app.float.news_tab_height'))
+ }
+
+ build() {
+ ...
+ Tabs() {
+ ForEach(CommonConstants.ALL_TITLE, (title: string, index: number) => {
+ TabContent() {
+ // 新闻内容列表
+ NewsList({ newsItems: NewsDataModel.getNewsByType(this.newsItems, title) })
+ }
+ .tabBar(this.TabBuilder(NewsDataModel.getTypeByStr(title), index))
+ }, (title, index) => index + JSON.stringify(title))
+ }
+ .barHeight($r('app.float.news_tab_bar_height'))
+ .barWidth(CommonConstants.FULL_COMPONENT)
+ .barMode(this.currentBreakpoint === CommonConstants.BREAKPOINT_SM ? BarMode.Scrollable : BarMode.Fixed)
+ .onChange((index: number) => {
+ this.currentIndex = index;
+ })
+ ...
+ }
+}
+
+// NewsList.ets
+@Component
+export default struct NewsList {
+ private newsItems: NewsData[];
+
+ build() {
+ List() {
+ ForEach(this.newsItems, (item: NewsData, index: number) => {
+ ListItem() {
+ // 栅格布局
+ GridRow({
+ columns: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.TWELVE_COLUMN
+ },
+ breakpoints: {
+ value: [
+ CommonConstants.SMALL_DEVICE_TYPE,
+ CommonConstants.MIDDLE_DEVICE_TYPE,
+ CommonConstants.LARGE_DEVICE_TYPE
+ ]
+ },
+ gutter: { x: $r('app.float.grid_row_gutter') }
+ }) {
+ GridCol({
+ span: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.EIGHT_COLUMN
+ },
+ offset: {
+ sm: CommonConstants.ZERO_COLUMN,
+ md: CommonConstants.ZERO_COLUMN,
+ lg: CommonConstants.TWO_COLUMN
+ }
+ }) {
+ NewsItem({ newsItem: item, isLast: index === this.newsItems.length - 1 })
+ }
+ }
+ }
+ }, (item, index) => index + JSON.stringify(item))
+ }
+ .height(CommonConstants.FULL_COMPONENT)
+ }
+}
+```
+
+## 构建新闻详情页
+
+### 新闻详情页
+
+新闻详情页由新闻内容区域和页脚区域组成,其中新闻内容区域为Scroll组件嵌套栅格组件展示新闻详情,页脚区域为栅格布局,包含TextInput组件和三个按钮图标。
+
+
+
+```typescript
+// DetailHeadContent.ets
+build() {
+ Column() {
+ ...
+ // 可滚动的容器组件
+ Scroll() {
+ // 栅格布局
+ GridRow({
+ columns: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.TWELVE_COLUMN
+ },
+ breakpoints: {
+ value: [
+ CommonConstants.SMALL_DEVICE_TYPE,
+ CommonConstants.MIDDLE_DEVICE_TYPE,
+ CommonConstants.LARGE_DEVICE_TYPE
+ ]
+ },
+ gutter: { x: $r('app.float.grid_row_gutter') }
+ }) {
+ GridCol({
+ span: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.EIGHT_COLUMN
+ },
+ offset: {
+ sm: CommonConstants.ZERO_COLUMN,
+ md: CommonConstants.ZERO_COLUMN,
+ lg: CommonConstants.TWO_COLUMN
+ }
+ }) {
+ ...
+ }
+ ...
+ }
+ }
+ .padding({
+ bottom: $r('app.float.news_detail_padding_bottom')
+ })
+ .scrollBar(BarState.Off)
+ }
+ .margin({
+ left: $r('app.float.news_detail_margin'),
+ right: $r('app.float.news_detail_margin')
+ })
+ .height(CommonConstants.FULL_COMPONENT)
+ .alignItems(HorizontalAlign.Start)
+}
+
+// DetailFooter.ets
+build() {
+ Column() {
+ // 分割线
+ Divider()
+ .color($r('app.color.detail_divider_color'))
+ .width(CommonConstants.FULL_COMPONENT)
+
+ //栅格布局
+ GridRow({
+ columns: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.TWELVE_COLUMN
+ },
+ breakpoints: {
+ value: [
+ CommonConstants.SMALL_DEVICE_TYPE,
+ CommonConstants.MIDDLE_DEVICE_TYPE,
+ CommonConstants.LARGE_DEVICE_TYPE
+ ]
+ },
+ gutter: { x: $r('app.float.grid_row_gutter') }
+ }) {
+ GridCol({
+ span: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.EIGHT_COLUMN
+ },
+ offset: {
+ sm: CommonConstants.ZERO_COLUMN,
+ md: CommonConstants.ZERO_COLUMN,
+ lg: CommonConstants.TWO_COLUMN
+ }
+ }) {
+ ...
+ }
+ .margin({
+ left: this.currentBreakpoint === CommonConstants.BREAKPOINT_SM ? $r('app.float.footer_margin_sm') :
+ $r('app.float.footer_margin_other'),
+ right: this.currentBreakpoint === CommonConstants.BREAKPOINT_SM ? $r('app.float.footer_margin_sm') :
+ $r('app.float.footer_margin_other')
+ })
+ }
+ .backgroundColor($r('app.color.bg_color_gray'))
+ .height($r('app.float.footer_height'))
+ .width(CommonConstants.FULL_COMPONENT)
+ .onBreakpointChange((breakpoints) => {
+ ...
+ })
+ }
+}
+```
+
+### 分享按钮弹窗
+
+页脚点击分享按钮,弹出自定义弹窗DeviceListDialog,用于多端协同拉起应用。DeviceListDialog由两个标题栏和两个List组件构成,其中List组件使用ForEach循环渲染设备数据。
+
+
+
+```typescript
+// DeviceListDialog.ets
+build() {
+ Column() {
+ Row() {
+ ...
+ }
+ .height($r('app.float.choose_device_row_height'))
+ .width(CommonConstants.FULL_COMPONENT)
+ .padding({
+ left: $r('app.float.dialog_padding'),
+ right: $r('app.float.dialog_padding')
+ })
+
+ // 信任设备列表
+ List() {
+ ForEach(this.trustedDeviceList, (item: deviceManager.DeviceInfo, index: number) => {
+ ListItem() {
+ ...
+ }
+ }, (item, index) => index + JSON.stringify(item))
+ }
+
+ Row() {
+ ...
+ }
+ .height($r('app.float.choose_device_row_height'))
+ .width(CommonConstants.FULL_COMPONENT)
+ .padding({
+ left: $r('app.float.dialog_padding'),
+ right: $r('app.float.dialog_padding')
+ })
+
+ // 发现设备列表
+ List() {
+ ForEach(this.discoverDeviceList, (item: deviceManager.DeviceInfo, index: number) => {
+ ListItem() {
+ ...
+ }
+ }, (item, index) => index + JSON.stringify(item))
+ }
+
+ Row() {
+ ...
+ }
+ .height($r('app.float.dialog_button_row_height'))
+ .padding({
+ top: $r('app.float.dialog_button_padding_top'),
+ bottom: $r('app.float.dialog_button_padding_bottom'),
+ left: $r('app.float.dialog_padding'),
+ right: $r('app.float.dialog_padding')
+ })
+ .width(CommonConstants.FULL_COMPONENT)
+ }
+ .borderRadius($r('app.float.dialog_border_radius'))
+ .backgroundColor($r('app.color.device_dialog_background'))
+ .width(CommonConstants.FULL_COMPONENT)
+}
+```
+
+## 多端协同拉起应用
+
+### 创建设备管理器
+
+应用创建时创建一个设备管理器实例,注册设备状态监听和获取信任的设备列表。其中deviceManager类需使用full-SDK。
+
+```typescript
+// EntryAbility.ets
+onCreate(want) {
+ ...
+ // 创建设备管理器
+ RemoteDeviceModel.createDeviceManager();
+}
+
+// RemoteDeviceModel.ets
+async createDeviceManager(): Promise {
+ if (this.deviceManager !== undefined) {
+ return;
+ }
+ await new Promise((resolve, reject) => {
+ deviceManager.createDeviceManager(this.context.abilityInfo.bundleName, (err, value) => {
+ if (err) {
+ reject(err);
+ logger.error('createDeviceManager failed.');
+ return;
+ }
+ this.deviceManager = value;
+ // 注册设备状态监听
+ this.registerDeviceStateListener();
+ // 获取信任设备列表
+ this.getTrustedDeviceList();
+ resolve(value);
+ })
+ })
+}
+```
+
+### 发现设备
+
+用户点击新闻详情页底部的分享按钮,调用startDeviceDiscovery()方法,发现周边处在同一无线网络下的设备并添加设备至已发现的设备列表。
+
+```typescript
+// RemoteDeviceModel.ets
+startDeviceDiscovery(): void {
+ if (this.deviceManager === undefined) {
+ logger.error('deviceManager has not initialized');
+ this.showToast($r('app.string.no_device_manager'));
+ return;
+ }
+ this.deviceManager.on('deviceFound', (data) => {
+ if (data === null) {
+ return;
+ }
+ // 监听设备发现
+ this.deviceFound(data);
+ })
+ this.deviceManager.on('discoverFail', (data) => {
+ logger.error(`discoverFail data = ${JSON.stringify(data)}`);
+ })
+ this.deviceManager.on('serviceDie', () => {
+ logger.error('serviceDie');
+ })
+
+ let info: deviceManager.SubscribeInfo = {
+ subscribeId: SUBSCRIBE_ID,
+ mode: CommonConstants.INFO_MODE,
+ medium: 0,
+ freq: CommonConstants.INFO_FREQ,
+ isSameAccount: false,
+ isWakeRemote: true,
+ capability: 0
+ };
+ // 添加设备至发现列表
+ this.discoverList = [];
+ AppStorage.SetOrCreate(CommonConstants.DISCOVER_DEVICE_LIST, this.discoverList);
+
+ try {
+ this.deviceManager.startDeviceDiscovery(info);
+ } catch (err) {
+ logger.error(`startDeviceDiscovery failed. Code is ${err.code}, message is ${err.message}`);
+ }
+}
+```
+
+### 进行可信认证连接
+
+在已发现的设备列表中选择设备,调用authenticateDevice()方法进行可信认证,输入PIN码,连接设备,将设备改为信任状态,添加至已信任设备列表。
+
+```typescript
+// RemoteDeviceModel.ets
+authenticateDevice(device: deviceManager.DeviceInfo, context: common.UIAbilityContext): void {
+ if (this.deviceManager === undefined) {
+ logger.error('deviceManager has not initialized');
+ this.showToast($r('app.string.no_device_manager'));
+ return;
+ }
+
+ for (let i: number = 0; i < this.discoverList.length; i++) {
+ if (this.discoverList[i].deviceId !== device.deviceId) {
+ continue;
+ }
+ let extraInfo: any = {
+ 'targetPkgName': context.abilityInfo.bundleName,
+ 'appName': context.applicationInfo.name,
+ 'appDescription': context.applicationInfo.description,
+ 'business': CommonConstants.ZERO
+ };
+ let authParam: deviceManager.AuthParam = {
+ 'authType': CommonConstants.ONE,
+ 'extraInfo': extraInfo
+ };
+ try {
+ // 可信认证
+ this.deviceManager.authenticateDevice(device, authParam, (err) => {
+ if (err) {
+ logger.error(`authenticateDevice error. Code is ${err.code}, message is ${err.message}`);
+ return;
+ }
+ })
+ } catch (err) {
+ logger.error(`authenticateDevice failed. Code is ${err.code}, message is ${err.message}`);
+ }
+ }
+}
+```
+
+### 跨设备启动UIAbility
+
+可信认证后,用户再次点击分享按钮,选择已信任设备列表中的设备,调用startAbilityContinuation()方法进行拉起应用,在另一设备中触发aboutToAppear()方法渲染当前的新闻详情页,实现跨设备启动UIAbility。
+
+```typescript
+// DeviceListDialog.ets
+function startAbilityContinuation(deviceId: string, newsId: string, context: common.UIAbilityContext): void {
+ let want: Want = {
+ deviceId: deviceId,
+ bundleName: context.abilityInfo.bundleName,
+ abilityName: CommonConstants.ABILITY_NAME,
+ parameters: {
+ 'url': CommonConstants.NEWS_DETAIL_PAGE,
+ 'newsId': newsId
+ }
+ };
+ // 拉起应用
+ globalThis.context.startAbility(want).catch((err) => {
+ Logger.error(`startAbilityContinuation error. Code is ${err.code}, message is ${err.message}`);
+ prompt.showToast({
+ message: $r('app.string.start_ability_continuation_error')
+ });
+ })
+}
+
+// NewsDetail.ets
+aboutToAppear() {
+ const params: any = router.getParams();
+ if (params) {
+ ...
+ } else {
+ // 读取跨设备传递的参数信息
+ const want = globalThis.newWant;
+ const newsId = want.parameters.newsId;
+ this.newsData = this.newsItems.filter(item => (item.newsId === newsId))[0];
+ }
+}
+```
+
+## 总结
+
+您已经完成了本次Codelab的学习,并了解到以下知识点:
+
+1. 构建分布式新闻客户端页面。
+2. 实现应用的一次开发,多端部署。
+3. 使用跨设备启动UIAbility拉起应用。
+
+
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/build-profile.json5 b/Distributed/DistributedNewsClient/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..a007f9fea0c51107fedddba74e069033ae6dce37
--- /dev/null
+++ b/Distributed/DistributedNewsClient/build-profile.json5
@@ -0,0 +1,36 @@
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compileSdkVersion": 10,
+ "compatibleSdkVersion": 10,
+ "runtimeOS": "OpenHarmony"
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/build-profile.json5 b/Distributed/DistributedNewsClient/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..befa10141dfc5999e35f60a36a9f948e664732b1
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/build-profile.json5
@@ -0,0 +1,10 @@
+{
+ "apiType": 'stageMode',
+ "buildOption": {
+ },
+ "targets": [
+ {
+ "name": "default"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/hvigorfile.ts b/Distributed/DistributedNewsClient/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..80e4ec5b81689f238c34614b167a0b9e9c83e8d9
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/hvigorfile.ts
@@ -0,0 +1,2 @@
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { hapTasks } from '@ohos/hvigor-ohos-plugin';
diff --git a/Distributed/DistributedNewsClient/entry/oh-package.json5 b/Distributed/DistributedNewsClient/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..225946cb11a2c405c8dc81eea89c22f923556638
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/oh-package.json5
@@ -0,0 +1,10 @@
+{
+ "license": "",
+ "devDependencies": {},
+ "author": "",
+ "name": "entry",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "version": "1.0.0",
+ "dependencies": {}
+}
diff --git a/Distributed/DistributedNewsClient/entry/src/main/ets/common/bean/NewsData.ets b/Distributed/DistributedNewsClient/entry/src/main/ets/common/bean/NewsData.ets
new file mode 100644
index 0000000000000000000000000000000000000000..3537cdfc836e09ea506a4ce395f4ff16b4636de0
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/ets/common/bean/NewsData.ets
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export class NewsData {
+ /**
+ * The Id of news.
+ */
+ newsId: string;
+
+ /**
+ * The title of news.
+ */
+ title: Resource;
+
+ /**
+ * The type string of news.
+ */
+ newsTypeStr: string;
+
+ /**
+ * The type of news.
+ */
+ newsType: Resource;
+
+ /**
+ * The image url of news.
+ */
+ imgUrl: Resource;
+
+ /**
+ * The reads of news.
+ */
+ reads: string;
+
+ /**
+ * The likes of news.
+ */
+ likes: string;
+
+ /**
+ * The content of news.
+ */
+ content: Resource;
+
+ /**
+ * The label of news.
+ */
+ label: Resource;
+
+ /**
+ * The color of label.
+ */
+ redLabel: boolean;
+
+ /**
+ * The from of news.
+ */
+ from: Resource;
+
+ constructor(newsId: string, title: Resource, newsTypeStr: string, newsType: Resource, imgUrl: Resource, reads: string,
+ likes: string, content: Resource, label: Resource, redLabel: boolean, from: Resource) {
+ this.newsId = newsId;
+ this.title = title;
+ this.newsTypeStr = newsTypeStr;
+ this.newsType = newsType;
+ this.imgUrl = imgUrl;
+ this.reads = reads;
+ this.likes = likes;
+ this.content = content;
+ this.label = label;
+ this.redLabel = redLabel;
+ this.from = from;
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/ets/common/constants/CommonConstants.ets b/Distributed/DistributedNewsClient/entry/src/main/ets/common/constants/CommonConstants.ets
new file mode 100644
index 0000000000000000000000000000000000000000..d32c301525cf7a4338daf52669f65d0c7b85c047
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/ets/common/constants/CommonConstants.ets
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default class CommonConstants {
+ /**
+ * One.
+ */
+ static readonly ONE: number = 1;
+
+ /**
+ * The max lines of news.
+ */
+ static readonly NEWS_MAX_LINES: number = 2;
+
+ /**
+ * Full percent of component.
+ */
+ static readonly FULL_COMPONENT: string = '100%';
+
+ /**
+ * The weight of font.
+ */
+ static readonly FONT_WEIGHT_500: number = 500;
+
+ /**
+ * Ability name.
+ */
+ static readonly ABILITY_NAME: string = 'EntryAbility';
+
+ /**
+ * News detail page.
+ */
+ static readonly NEWS_DETAIL_PAGE: string = 'pages/NewsDetail';
+
+ /**
+ * Zero.
+ */
+ static readonly ZERO: string = '0';
+
+ /**
+ * All tabs title name.
+ */
+ static readonly ALL_TITLE: string[] = ['全部', '健康', '金融', '科技', '体育', '网络', '游戏'];
+
+ /**
+ * Zero column width.
+ */
+ static readonly ZERO_COLUMN: number = 0;
+
+ /**
+ * Four column width.
+ */
+ static readonly TWO_COLUMN: number = 2;
+
+ /**
+ * Four column width.
+ */
+ static readonly FOUR_COLUMN: number = 4;
+
+ /**
+ * Six column width.
+ */
+ static readonly SIX_COLUMN: number = 6;
+
+ /**
+ * Eight column width.
+ */
+ static readonly EIGHT_COLUMN: number = 8;
+
+ /**
+ * Twelve column width.
+ */
+ static readonly TWELVE_COLUMN: number = 12;
+
+ /**
+ * The width of small devices.
+ */
+ static readonly SMALL_DEVICE_TYPE: string = '320vp';
+
+ /**
+ * The width of middle devices.
+ */
+ static readonly MIDDLE_DEVICE_TYPE: string = '600vp';
+
+ /**
+ * The width of large devices.
+ */
+ static readonly LARGE_DEVICE_TYPE: string = '840vp';
+
+ /**
+ * The opacity of list divider.
+ */
+ static readonly DIVIDER_OPACITY: number = 0.05;
+
+ /**
+ * Breakpoints that represent small device types.
+ */
+ static readonly BREAKPOINT_SM: string = 'sm';
+
+ /**
+ * Trusted device list.
+ */
+ static readonly TRUSTED_DEVICE_LIST: string = 'trustedDeviceList';
+
+ /**
+ * Discover device list.
+ */
+ static readonly DISCOVER_DEVICE_LIST: string = 'discoverDeviceList';
+
+ /**
+ * The mode of start device discovery info.
+ */
+ static readonly INFO_MODE: number = 0xAA;
+
+ /**
+ * The frequency of start device discovery info.
+ */
+ static readonly INFO_FREQ: number = 2;
+
+ /**
+ * News id.
+ */
+ static readonly NEWS_ID: string[] = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15',
+ '16', '17', '18', '19'];
+
+ /**
+ * News reads.
+ */
+ static readonly NEWS_READS: string[] = ['54', '100', '74', '44', '73', '100', '123', '754', '631', '53', '1500',
+ '7451', '445', '734', '1010', '1243', '7574', '6311', '6341'];
+
+ /**
+ * News likes.
+ */
+ static readonly NEWS_LIKES: string[] = ['81', '354', '91', '82', '888', '354', '911', '149', '714', '824', '3542',
+ '9511', '872', '8788', '3534', '9141', '1439', '7114', '7164'];
+
+ /**
+ * Number of titles.
+ */
+ static readonly TITLES_NUMBER: number = 6;
+
+ /**
+ * Number of images.
+ */
+ static readonly IMAGES_NUMBER: number = 4;
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/ets/common/utils/Logger.ets b/Distributed/DistributedNewsClient/entry/src/main/ets/common/utils/Logger.ets
new file mode 100644
index 0000000000000000000000000000000000000000..ae92ac9d97dbe89dc30d6eba2f9a70344275512d
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/ets/common/utils/Logger.ets
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import hilog from '@ohos.hilog';
+
+export class Logger {
+ private domain: number;
+ private prefix: string;
+ private format: string = '%{public}s, %{public}s';
+
+ constructor(prefix: string = 'MyApp', domain: number = 0xFF00) {
+ this.prefix = prefix;
+ this.domain = domain;
+ }
+
+ debug(...args: any[]) {
+ hilog.debug(this.domain, this.prefix, this.format, args);
+ }
+
+ info(...args: any[]) {
+ hilog.info(this.domain, this.prefix, this.format, args);
+ }
+
+ warn(...args: any[]) {
+ hilog.warn(this.domain, this.prefix, this.format, args);
+ }
+
+ error(...args: any[]) {
+ hilog.error(this.domain, this.prefix, this.format, args);
+ }
+}
+export default new Logger();
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/ets/entryability/EntryAbility.ets b/Distributed/DistributedNewsClient/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..ea396fcdec3a77d9619181d3c4730f8ecca110bb
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import UIAbility from '@ohos.app.ability.UIAbility';
+import window from '@ohos.window';
+import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
+import bundleManager from '@ohos.bundle.bundleManager';
+import RemoteDeviceModel from '../model/RemoteDeviceModel';
+import logger from '../common/utils/Logger';
+
+export default class EntryAbility extends UIAbility {
+ onNewWant(want, launchParams) {
+ globalThis.newWant = want;
+ logger.info(` onNewWant launchParam: ${JSON.stringify(launchParams) ?? ''}`);
+ this.onWindowStageCreate(globalThis.windowStage);
+ }
+
+ onCreate(want) {
+ globalThis.newWant = want;
+ globalThis.context = this.context;
+ logger.info('Ability onCreate');
+ RemoteDeviceModel.createDeviceManager(this.context);
+ }
+
+ onDestroy() {
+ logger.info('Ability onDestroy');
+ RemoteDeviceModel.unregisterDeviceListCallback();
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage) {
+ globalThis.windowStage = windowStage;
+ // Main window is created, set main page for this ability.
+ logger.info('Ability onWindowStageCreate');
+
+ if (globalThis.newWant?.parameters?.url) {
+ windowStage.loadContent(globalThis.newWant.parameters.url, (err, data) => {
+ if (err) {
+ logger.error(`Failed to load the content. Code is ${err.code}, message is ${err.message}`);
+ return;
+ }
+ logger.info(`Succeeded in loading the content. Data: ${JSON.stringify(data) ?? ''}`);
+ });
+ return;
+ }
+ windowStage.loadContent('pages/Index', (err, data) => {
+ if (err) {
+ logger.error(`Failed to load the content. Cause: Code is ${err.code}, message is ${err.message}`);
+ return;
+ }
+ logger.info(`Succeeded in loading the content. Data: ${JSON.stringify(data) ?? ''}`);
+ });
+ checkPermissions();
+ }
+
+ onWindowStageDestroy() {
+ // Main window is destroyed, release UI related resources.
+ logger.info('Ability onWindowStageDestroy');
+ }
+
+ onForeground() {
+ // Ability has brought to foreground.
+ logger.info('Ability onForeground');
+ }
+
+ onBackground() {
+ // Ability has back to background.
+ logger.info('Ability onBackground');
+ }
+}
+
+async function checkPermissions(): Promise {
+ let grantStatus: abilityAccessCtrl.GrantStatus = await checkAccessToken();
+
+ if (grantStatus !== abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
+ // Applying for the distributed data synchronization permission.
+ let atManager = abilityAccessCtrl.createAtManager();
+ let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC'];
+ try {
+ atManager.requestPermissionsFromUser(globalThis.context, permissions);
+ } catch (err) {
+ logger.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`);
+ }
+ }
+}
+
+async function checkAccessToken() {
+ let atManager = abilityAccessCtrl.createAtManager();
+ let grantStatus: abilityAccessCtrl.GrantStatus;
+ let tokenId: number;
+ try {
+ let bundleInfo: bundleManager.BundleInfo = await bundleManager
+ .getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
+ let appInfo: bundleManager.ApplicationInfo = bundleInfo.appInfo;
+ tokenId = appInfo.accessTokenId;
+ } catch (err) {
+ logger.error(`Failed to get bundle info for self. Code is ${err.code}, message is ${err.message}`);
+ }
+
+ try {
+ grantStatus = await atManager.checkAccessToken(tokenId, 'ohos.permission.DISTRIBUTED_DATASYNC');
+ } catch (err) {
+ logger.error(`Failed to check access token. Code is ${err.code}, message is ${err.message}`);
+ }
+ return grantStatus;
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/ets/model/RemoteDeviceModel.ets b/Distributed/DistributedNewsClient/entry/src/main/ets/model/RemoteDeviceModel.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f106ffe9a9ca58565230dc687f2fddbb476b0d0d
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/ets/model/RemoteDeviceModel.ets
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+import prompt from '@ohos.promptAction';
+import common from '@ohos.app.ability.common';
+import CommonConstants from '../common/constants/CommonConstants';
+import logger from '../common/utils/Logger';
+
+// the value is in scope [0, 65535]
+const SUBSCRIBE_ID = 100;
+
+class RemoteDeviceModel {
+ private static dmInstance: RemoteDeviceModel = undefined;
+ private trustedDeviceList: deviceManager.DeviceInfo[] = [];
+ private discoverList: deviceManager.DeviceInfo[] = [];
+ private deviceManager: deviceManager.DeviceManager;
+
+ static getInstance(): RemoteDeviceModel {
+ if (this.dmInstance === undefined) {
+ this.dmInstance = new RemoteDeviceModel();
+ }
+ return this.dmInstance;
+ }
+
+ showToast(message: Resource): void {
+ prompt.showToast({
+ message: message
+ });
+ }
+
+ async createDeviceManager(context: common.UIAbilityContext): Promise {
+ if (this.deviceManager !== undefined) {
+ return;
+ }
+ await new Promise((resolve, reject) => {
+ deviceManager.createDeviceManager(context.abilityInfo.bundleName, (err, value) => {
+ if (err) {
+ reject(err);
+ logger.error('createDeviceManager failed.');
+ return;
+ }
+ this.deviceManager = value;
+ this.registerDeviceStateListener();
+ this.getTrustedDeviceList();
+ resolve(value);
+ })
+ })
+ }
+
+ getTrustedDeviceList(): void {
+ if (this.deviceManager === undefined) {
+ logger.error('deviceManager has not initialized');
+ this.showToast($r('app.string.no_device_manager'));
+ return;
+ }
+
+ try {
+ this.trustedDeviceList = this.deviceManager.getTrustedDeviceListSync();
+ AppStorage.SetOrCreate(CommonConstants.TRUSTED_DEVICE_LIST, this.trustedDeviceList);
+ } catch (err) {
+ logger.error(`getTrustedDeviceList error. Code is ${err.code}, message is ${err.message}`);
+ this.showToast($r('app.string.get_trusted_device_list_failed'));
+ }
+ }
+
+ deviceStateChangeActionOnline(device: deviceManager.DeviceInfo): void {
+ this.trustedDeviceList[this.trustedDeviceList.length] = device;
+ for (let j: number = 0; j < this.trustedDeviceList.length; j++) {
+ if (this.trustedDeviceList[j].deviceId === device.deviceId) {
+ this.trustedDeviceList[j] = device;
+ break;
+ }
+ }
+ AppStorage.SetOrCreate(CommonConstants.TRUSTED_DEVICE_LIST, this.trustedDeviceList);
+ }
+
+ deviceStateChangeActionOffline(device: deviceManager.DeviceInfo): void {
+ let list: deviceManager.DeviceInfo[] = [];
+ for (let i: number = 0; i < this.trustedDeviceList.length; i++) {
+ if (this.trustedDeviceList[i].deviceId !== device.deviceId) {
+ list.push(this.trustedDeviceList[i]);
+ }
+ }
+ this.trustedDeviceList = list;
+ AppStorage.SetOrCreate(CommonConstants.TRUSTED_DEVICE_LIST, this.trustedDeviceList);
+ }
+
+ registerDeviceStateListener(): void {
+ if (this.deviceManager === undefined) {
+ logger.error('deviceManager has not initialized');
+ this.showToast($r('app.string.no_device_manager'));
+ return;
+ }
+
+ this.deviceManager.on('deviceStateChange', (data) => {
+ if (data === null) {
+ return;
+ }
+ switch (data.action) {
+ case deviceManager.DeviceStateChangeAction.ONLINE:
+ this.deviceStateChangeActionOnline(data.device);
+ break;
+ case deviceManager.DeviceStateChangeAction.OFFLINE:
+ this.deviceStateChangeActionOffline(data.device);
+ break;
+ default:
+ break;
+ }
+ })
+ }
+
+ deviceFound(data): void {
+ for (let i: number = 0; i < this.discoverList.length; i++) {
+ if (this.discoverList[i].deviceId === data.device.deviceId) {
+ return;
+ }
+ }
+ this.discoverList[this.discoverList.length] = data.device;
+ AppStorage.SetOrCreate(CommonConstants.DISCOVER_DEVICE_LIST, this.discoverList);
+ }
+
+ startDeviceDiscovery(): void {
+ if (this.deviceManager === undefined) {
+ logger.error('deviceManager has not initialized');
+ this.showToast($r('app.string.no_device_manager'));
+ return;
+ }
+ this.deviceManager.on('deviceFound', (data) => {
+ if (data === null) {
+ return;
+ }
+ this.deviceFound(data);
+ })
+ this.deviceManager.on('discoverFail', (data) => {
+ logger.error(`discoverFail data = ${JSON.stringify(data)}`);
+ })
+ this.deviceManager.on('serviceDie', () => {
+ logger.error('serviceDie');
+ })
+
+ let info: deviceManager.SubscribeInfo = {
+ subscribeId: SUBSCRIBE_ID,
+ mode: CommonConstants.INFO_MODE,
+ medium: 0,
+ freq: CommonConstants.INFO_FREQ,
+ isSameAccount: false,
+ isWakeRemote: true,
+ capability: 0
+ };
+ this.discoverList = [];
+ AppStorage.SetOrCreate(CommonConstants.DISCOVER_DEVICE_LIST, this.discoverList);
+
+ try {
+ this.deviceManager.startDeviceDiscovery(info);
+ } catch (err) {
+ logger.error(`startDeviceDiscovery failed. Code is ${err.code}, message is ${err.message}`);
+ }
+ }
+
+ stopDeviceDiscovery(): void {
+ if (this.deviceManager === undefined) {
+ logger.error('deviceManager has not initialized');
+ this.showToast($r('app.string.no_device_manager'));
+ return;
+ }
+ try {
+ this.deviceManager.stopDeviceDiscovery(SUBSCRIBE_ID);
+ this.deviceManager.off('deviceFound');
+ this.deviceManager.off('discoverFail');
+ } catch (err) {
+ logger.error(`stopDeviceDiscovery failed. Code is ${err.code}, message is ${err.message}`);
+ }
+ }
+
+ unregisterDeviceListCallback(): void {
+ if (this.deviceManager === undefined) {
+ logger.error('deviceManager has not initialized');
+ this.showToast($r('app.string.no_device_manager'));
+ return;
+ }
+ try {
+ this.deviceManager.off('deviceStateChange');
+ this.deviceManager.off('serviceDie');
+ this.deviceManager.release();
+ this.trustedDeviceList = [];
+ this.discoverList = [];
+ } catch (err) {
+ logger.error(`stopDeviceDiscovery failed. Code is ${err.code}, message is ${err.message}` );
+ }
+ }
+
+ authenticateDevice(device: deviceManager.DeviceInfo, context: common.UIAbilityContext): void {
+ if (this.deviceManager === undefined) {
+ logger.error('deviceManager has not initialized');
+ this.showToast($r('app.string.no_device_manager'));
+ return;
+ }
+
+ for (let i: number = 0; i < this.discoverList.length; i++) {
+ if (this.discoverList[i].deviceId !== device.deviceId) {
+ continue;
+ }
+ let extraInfo: any = {
+ 'targetPkgName': context.abilityInfo.bundleName,
+ 'appName': context.applicationInfo.name,
+ 'appDescription': context.applicationInfo.description,
+ 'business': CommonConstants.ZERO
+ };
+ let authParam: deviceManager.AuthParam = {
+ 'authType': CommonConstants.ONE,
+ 'extraInfo': extraInfo
+ };
+ try {
+ this.deviceManager.authenticateDevice(device, authParam, (err) => {
+ if (err) {
+ logger.error(`authenticateDevice error. Code is ${err.code}, message is ${err.message}`);
+ return;
+ }
+ })
+ } catch (err) {
+ logger.error(`authenticateDevice failed. Code is ${err.code}, message is ${err.message}`);
+ }
+ }
+ }
+}
+
+export default RemoteDeviceModel.getInstance();
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/ets/pages/Index.ets b/Distributed/DistributedNewsClient/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1b746700ef787ca271bbabb37e065d0f483df4a7
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { NewsData } from '../common/bean/NewsData';
+import { NewsDataModel } from '../viewmodel/NewsDataModel';
+import NewsTab from '../view/NewsTab';
+import CommonConstants from '../common/constants/CommonConstants';
+
+@Entry
+@Component
+struct Index {
+ private newsItems: NewsData[] = NewsDataModel.getNewsComposition();
+
+ build() {
+ Row() {
+ Column() {
+ NewsTab({ newsItems: this.newsItems })
+ }
+ .backgroundColor($r('app.color.bg_color_gray'))
+ .width(CommonConstants.FULL_COMPONENT)
+ .height(CommonConstants.FULL_COMPONENT)
+ }
+ .width(CommonConstants.FULL_COMPONENT)
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/ets/pages/NewsDetail.ets b/Distributed/DistributedNewsClient/entry/src/main/ets/pages/NewsDetail.ets
new file mode 100644
index 0000000000000000000000000000000000000000..029d61acefb227deb8f4ed700062b2e3b709f4d8
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/ets/pages/NewsDetail.ets
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import router from '@ohos.router';
+import { NewsData } from '../common/bean/NewsData';
+import { NewsDataModel } from '../viewmodel/NewsDataModel';
+import CommonConstants from '../common/constants/CommonConstants';
+import DetailHeadContent from '../view/DetailHeadContent';
+import DetailFooter from '../view/DetailFooter';
+
+@Entry
+@Component
+struct NewsDetail {
+ @Provide newsData: NewsData = null;
+ private newsItems: NewsData[] = NewsDataModel.getNewsComposition();
+
+ build() {
+ Column() {
+ Stack({ alignContent: Alignment.Bottom }) {
+ DetailHeadContent()
+ DetailFooter()
+ }
+ .height(CommonConstants.FULL_COMPONENT)
+ .width(CommonConstants.FULL_COMPONENT)
+ }
+ .backgroundColor($r('app.color.bg_color_gray'))
+ .height(CommonConstants.FULL_COMPONENT)
+ .width(CommonConstants.FULL_COMPONENT)
+ }
+
+ aboutToAppear() {
+ const params: any = router.getParams();
+ if (params) {
+ this.newsData = params.newsItem;
+ } else {
+ const want = globalThis.newWant;
+ const newsId = want.parameters.newsId;
+ this.newsData = this.newsItems.filter(item => (item.newsId === newsId))[0];
+ }
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/ets/view/DetailFooter.ets b/Distributed/DistributedNewsClient/entry/src/main/ets/view/DetailFooter.ets
new file mode 100644
index 0000000000000000000000000000000000000000..fe456bba656f183145718a57d43e4d75b0937663
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/ets/view/DetailFooter.ets
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+import { NewsData } from '../common/bean/NewsData';
+import CommonConstants from '../common/constants/CommonConstants';
+import RemoteDeviceModel from '../model/RemoteDeviceModel';
+import { DeviceListDialog } from './DeviceListDialog';
+
+@Extend(Image) function imageStyle() {
+ .width($r('app.float.footer_icon_size'))
+ .height($r('app.float.footer_icon_size'))
+}
+
+@Component
+export default struct DetailFooter {
+ @StorageLink('discoverDeviceList') discoverDeviceList: deviceManager.DeviceInfo[] = [];
+ @StorageLink('trustedDeviceList') trustedDeviceList: deviceManager.DeviceInfo[] = [];
+ @Consume newsData: NewsData;
+ @Provide currentBreakpoint: string = CommonConstants.BREAKPOINT_SM;
+ private dialogController: CustomDialogController;
+
+ build() {
+ Column() {
+ Divider()
+ .color($r('app.color.detail_divider_color'))
+ .width(CommonConstants.FULL_COMPONENT)
+
+ GridRow({
+ columns: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.TWELVE_COLUMN
+ },
+ breakpoints: {
+ value: [
+ CommonConstants.SMALL_DEVICE_TYPE,
+ CommonConstants.MIDDLE_DEVICE_TYPE,
+ CommonConstants.LARGE_DEVICE_TYPE
+ ]
+ },
+ gutter: { x: $r('app.float.grid_row_gutter') }
+ }) {
+ GridCol({
+ span: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.EIGHT_COLUMN
+ },
+ offset: {
+ sm: CommonConstants.ZERO_COLUMN,
+ md: CommonConstants.ZERO_COLUMN,
+ lg: CommonConstants.TWO_COLUMN
+ }
+ }) {
+ Row() {
+ Row() {
+ TextInput({ placeholder: $r('app.string.write_note') })
+ .height($r('app.float.text_input_height'))
+ .backgroundColor($r('app.color.white'))
+ .layoutWeight(1)
+ .fontSize($r('app.float.normal_font_size'))
+ .placeholderFont({ weight: FontWeight.Normal })
+ .placeholderColor($r('app.color.font_color_gray'))
+ .enableKeyboardOnFocus(false)
+
+ Image($r('app.media.ic_icon_message'))
+ .imageStyle()
+ .margin({
+ right: $r('app.float.message_margin_right'),
+ left: $r('app.float.message_margin_left')
+ })
+ }
+ .height($r('app.float.text_input_height'))
+ .layoutWeight(1)
+ .borderRadius($r('app.float.text_input_border_radius'))
+ .backgroundColor($r('app.color.white'))
+
+ Column() {
+ Image($r('app.media.ic_icon_good'))
+ .imageStyle()
+ }
+ .width($r('app.float.footer_icon_column_width'))
+ .height(CommonConstants.FULL_COMPONENT)
+ .justifyContent(FlexAlign.Center)
+ .alignItems(HorizontalAlign.Center)
+
+ Column() {
+ Image($r('app.media.ic_icon_star'))
+ .imageStyle()
+ }
+ .width($r('app.float.footer_icon_column_width'))
+ .height(CommonConstants.FULL_COMPONENT)
+ .justifyContent(FlexAlign.Center)
+ .alignItems(HorizontalAlign.Center)
+
+ Column() {
+ Image($r('app.media.ic_icon_share'))
+ .imageStyle()
+ .onClick(() => {
+ // Discover devices.
+ RemoteDeviceModel.startDeviceDiscovery();
+ this.dialogController.open();
+ })
+ }
+ .width($r('app.float.footer_icon_column_width'))
+ .height(CommonConstants.FULL_COMPONENT)
+ .justifyContent(FlexAlign.Center)
+ .alignItems(HorizontalAlign.Center)
+ }
+ .height($r('app.float.footer_height'))
+ }
+ .margin({
+ left: this.currentBreakpoint === CommonConstants.BREAKPOINT_SM ? $r('app.float.footer_margin_sm') :
+ $r('app.float.footer_margin_other'),
+ right: this.currentBreakpoint === CommonConstants.BREAKPOINT_SM ? $r('app.float.footer_margin_sm') :
+ $r('app.float.footer_margin_other')
+ })
+ }
+ .backgroundColor($r('app.color.bg_color_gray'))
+ .height($r('app.float.footer_height'))
+ .width(CommonConstants.FULL_COMPONENT)
+ .onBreakpointChange((breakpoints) => {
+ this.currentBreakpoint = breakpoints;
+ this.dialogController = new CustomDialogController({
+ builder: DeviceListDialog({
+ confirm: (device: deviceManager.DeviceInfo) => {
+ // Connect the device.
+ RemoteDeviceModel.authenticateDevice(device, globalThis.context);
+ RemoteDeviceModel.stopDeviceDiscovery();
+ }
+ }),
+ cancel: () => {
+ RemoteDeviceModel.stopDeviceDiscovery();
+ },
+ autoCancel: true,
+ gridCount: CommonConstants.FOUR_COLUMN,
+ alignment: this.currentBreakpoint === CommonConstants.BREAKPOINT_SM ? DialogAlignment.Bottom :
+ DialogAlignment.Center,
+ offset: {
+ dx: 0,
+ dy: this.currentBreakpoint === CommonConstants.BREAKPOINT_SM ? $r('app.float.dialog_offset_y') : 0
+ }
+ });
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/ets/view/DetailHeadContent.ets b/Distributed/DistributedNewsClient/entry/src/main/ets/view/DetailHeadContent.ets
new file mode 100644
index 0000000000000000000000000000000000000000..54826b98df9765df236cd96ac3c7cd11f84537e1
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/ets/view/DetailHeadContent.ets
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import router from '@ohos.router';
+import CommonConstants from '../common/constants/CommonConstants';
+import { NewsData } from '../common/bean/NewsData';
+
+@Extend(Text) function textStyle() {
+ .fontSize($r('app.float.small_font_size'))
+ .fontWeight(FontWeight.Normal)
+ .fontColor($r('app.color.font_color_gray'))
+}
+
+@Component
+export default struct DetailHeadContent {
+ @Consume newsData: NewsData;
+
+ build() {
+ Column() {
+ Row() {
+ Image($r('app.media.ic_back'))
+ .width($r('app.float.back_size'))
+ .height($r('app.float.back_size'))
+ .margin({
+ top: $r('app.float.back_margin'),
+ bottom: $r('app.float.back_margin')
+ })
+ .onClick(() => {
+ router.back();
+ })
+ }
+ .height($r('app.float.back_row_height'))
+ .width(CommonConstants.FULL_COMPONENT)
+
+ Scroll() {
+ GridRow({
+ columns: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.TWELVE_COLUMN
+ },
+ breakpoints: {
+ value: [
+ CommonConstants.SMALL_DEVICE_TYPE,
+ CommonConstants.MIDDLE_DEVICE_TYPE,
+ CommonConstants.LARGE_DEVICE_TYPE
+ ]
+ },
+ gutter: { x: $r('app.float.grid_row_gutter') }
+ }) {
+ GridCol({
+ span: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.EIGHT_COLUMN
+ },
+ offset: {
+ sm: CommonConstants.ZERO_COLUMN,
+ md: CommonConstants.ZERO_COLUMN,
+ lg: CommonConstants.TWO_COLUMN
+ }
+ }) {
+ Column() {
+ Text(this.newsData.title)
+ .fontSize($r('app.float.news_detail_title_font_size'))
+ .fontWeight(CommonConstants.FONT_WEIGHT_500)
+
+ Row() {
+ Text($r('app.string.read_count'))
+ .textStyle()
+ Text(this.newsData.reads)
+ .textStyle()
+ Text($r('app.string.like'))
+ .textStyle()
+ .margin({ left: $r('app.float.like_margin_right') })
+ Text(this.newsData.likes)
+ .textStyle()
+ }
+ .margin({ top: $r('app.float.read_like_margin_top') })
+ }
+ .width(CommonConstants.FULL_COMPONENT)
+ .alignItems(HorizontalAlign.Start)
+ }
+
+ GridCol({
+ span: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.FOUR_COLUMN,
+ lg: CommonConstants.FOUR_COLUMN
+ },
+ offset: {
+ sm: CommonConstants.ZERO_COLUMN,
+ md: CommonConstants.TWO_COLUMN,
+ lg: CommonConstants.SIX_COLUMN
+ }
+ }) {
+ Image(this.newsData.imgUrl)
+ .borderRadius($r('app.float.news_detail_image_border_radius'))
+ .margin({
+ top: $r('app.float.head_image_margin'),
+ bottom: $r('app.float.head_image_margin')
+ })
+ .objectFit(ImageFit.Fill)
+ .height($r('app.float.news_detail_image_height'))
+ .width(CommonConstants.FULL_COMPONENT)
+ }
+
+ GridCol({
+ span: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.EIGHT_COLUMN
+ },
+ offset: {
+ sm: CommonConstants.ZERO_COLUMN,
+ md: CommonConstants.TWO_COLUMN,
+ lg: CommonConstants.SIX_COLUMN
+ }
+ }) {
+ Text(this.newsData.content)
+ .textStyle()
+ .lineHeight($r('app.float.news_content_line_height'))
+ }
+ }
+ }
+ .padding({
+ bottom: $r('app.float.news_detail_padding_bottom')
+ })
+ .scrollBar(BarState.Off)
+ }
+ .margin({
+ left: $r('app.float.news_detail_margin'),
+ right: $r('app.float.news_detail_margin')
+ })
+ .height(CommonConstants.FULL_COMPONENT)
+ .alignItems(HorizontalAlign.Start)
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/ets/view/DeviceListDialog.ets b/Distributed/DistributedNewsClient/entry/src/main/ets/view/DeviceListDialog.ets
new file mode 100644
index 0000000000000000000000000000000000000000..5490dc87b414b7c112d9c06fc201d237eab7c038
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/ets/view/DeviceListDialog.ets
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+import Want from '@ohos.app.ability.Want';
+import prompt from '@ohos.promptAction';
+import common from '@ohos.app.ability.common';
+import CommonConstants from '../common/constants/CommonConstants';
+import { NewsData } from '../common/bean/NewsData';
+import RemoteDeviceModel from '../model/RemoteDeviceModel';
+import Logger from '../common/utils/Logger';
+
+@Extend(Text) function textStyle() {
+ .fontColor($r('app.color.dialog_button_font'))
+ .fontSize($r('app.float.normal_font_size'))
+ .fontWeight(CommonConstants.FONT_WEIGHT_500)
+}
+
+@CustomDialog
+
+export struct DeviceListDialog {
+ @StorageLink('discoverDeviceList') discoverDeviceList: deviceManager.DeviceInfo[] = [];
+ @StorageLink('trustedDeviceList') trustedDeviceList: deviceManager.DeviceInfo[] = [];
+ @Consume newsData: NewsData;
+ private selectedDevice: deviceManager.DeviceInfo;
+ private confirm: (device: deviceManager.DeviceInfo) => void;
+ private isTrusted: boolean;
+ private controller: CustomDialogController;
+ private context: common.UIAbilityContext;
+
+ aboutToAppear() {
+ this.context = getContext(this) as common.UIAbilityContext;
+ }
+
+ getDeviceTypeIcon(deviceType): Resource {
+ if (deviceType === deviceManager.DeviceType.TABLET) {
+ return $r('app.media.ic_pad');
+ } else if (deviceType === deviceManager.DeviceType.PHONE) {
+ return $r('app.media.ic_phone');
+ } else if (deviceType === deviceManager.DeviceType.UNKNOWN_TYPE) {
+ return $r('app.media.ic_pc');
+ } else {
+ return $r('app.media.ic_pc');
+ }
+ }
+
+ build() {
+ Column() {
+ Row() {
+ Text($r('app.string.trusted_device'))
+ .fontWeight(CommonConstants.FONT_WEIGHT_500)
+ .fontSize($r('app.float.small_font_size'))
+ .fontColor($r('app.color.font_color_gray'))
+ .lineHeight($r('app.float.choose_device_line_height'))
+ .margin({
+ top: $r('app.float.choose_device_margin_top'),
+ bottom: $r('app.float.dialog_icon_margin_bottom')
+ })
+ .width(CommonConstants.FULL_COMPONENT)
+ }
+ .height($r('app.float.choose_device_row_height'))
+ .width(CommonConstants.FULL_COMPONENT)
+ .padding({
+ left: $r('app.float.dialog_padding'),
+ right: $r('app.float.dialog_padding')
+ })
+
+ List() {
+ ForEach(this.trustedDeviceList, (item: deviceManager.DeviceInfo, index: number) => {
+ ListItem() {
+ Column() {
+ Row() {
+ Image(this.getDeviceTypeIcon(item.deviceType))
+ .width($r('app.float.dialog_icon_size'))
+ .height($r('app.float.dialog_icon_size'))
+ .margin({ right: $r('app.float.dialog_icon_margin_right') })
+
+ Column() {
+ Row() {
+ Text(item.deviceName)
+ .fontSize($r('app.float.normal_font_size'))
+ .lineHeight($r('app.float.device_list_line_height'))
+ .layoutWeight(CommonConstants.ONE)
+ .fontWeight(CommonConstants.FONT_WEIGHT_500)
+ .textOverflow({ overflow: TextOverflow.Ellipsis })
+
+ Radio({ value: item.deviceName, group: this.context.applicationInfo.name })
+ .size({
+ width: $r('app.float.dialog_radio_size'),
+ height: $r('app.float.dialog_radio_size')
+ })
+ .margin({ left: $r('app.float.radio_margin_left') })
+ .onChange((isChecked: boolean) => {
+ if (isChecked) {
+ this.selectedDevice = item;
+ this.isTrusted = true;
+ } else {
+ this.selectedDevice = null;
+ this.isTrusted = null;
+ }
+ })
+ }
+ .width(CommonConstants.FULL_COMPONENT)
+ .height($r('app.float.device_list_column_height'))
+
+ Divider()
+ .opacity(CommonConstants.DIVIDER_OPACITY)
+ .color($r('app.color.list_divider'))
+ .width(CommonConstants.FULL_COMPONENT)
+ .visibility(index === this.trustedDeviceList.length - 1 ? Visibility.None : Visibility.Visible)
+ }
+ .layoutWeight(CommonConstants.ONE)
+ }
+ .width(CommonConstants.FULL_COMPONENT)
+ .height($r('app.float.device_list_row_height'))
+ .justifyContent(FlexAlign.Start)
+ .alignItems(VerticalAlign.Center)
+ }
+ .padding({
+ left: $r('app.float.dialog_padding'),
+ right: $r('app.float.dialog_padding')
+ })
+ .width(CommonConstants.FULL_COMPONENT)
+ }
+ }, item => item.deviceId)
+ }
+
+ Row() {
+ Text($r('app.string.select_device'))
+ .fontWeight(CommonConstants.FONT_WEIGHT_500)
+ .fontSize($r('app.float.small_font_size'))
+ .fontColor($r('app.color.font_color_gray'))
+ .lineHeight($r('app.float.choose_device_line_height'))
+ .margin({
+ top: $r('app.float.choose_device_margin_top'),
+ bottom: $r('app.float.dialog_icon_margin_bottom')
+ })
+ .width(CommonConstants.FULL_COMPONENT)
+ }
+ .height($r('app.float.choose_device_row_height'))
+ .width(CommonConstants.FULL_COMPONENT)
+ .padding({
+ left: $r('app.float.dialog_padding'),
+ right: $r('app.float.dialog_padding')
+ })
+
+ List() {
+ ForEach(this.discoverDeviceList, (item: deviceManager.DeviceInfo, index: number) => {
+ ListItem() {
+ Column() {
+ Row() {
+ Image(this.getDeviceTypeIcon(item.deviceType))
+ .width($r('app.float.dialog_icon_size'))
+ .height($r('app.float.dialog_icon_size'))
+ .margin({ right: $r('app.float.dialog_icon_margin_right') })
+
+ Column() {
+ Row() {
+ Text(item.deviceName)
+ .fontSize($r('app.float.normal_font_size'))
+ .lineHeight($r('app.float.device_list_line_height'))
+ .layoutWeight(CommonConstants.ONE)
+ .fontWeight(CommonConstants.FONT_WEIGHT_500)
+ .textOverflow({ overflow: TextOverflow.Ellipsis })
+
+ Radio({ value: item.deviceName, group: this.context.applicationInfo.name })
+ .size({
+ width: $r('app.float.dialog_radio_size'),
+ height: $r('app.float.dialog_radio_size')
+ })
+ .onChange((isChecked: boolean) => {
+ if (isChecked) {
+ this.selectedDevice = item;
+ this.isTrusted = false;
+ } else {
+ this.selectedDevice = null;
+ this.isTrusted = null;
+ }
+ })
+ .margin({ left: $r('app.float.radio_margin_left') })
+ }
+ .layoutWeight(CommonConstants.ONE)
+ .height($r('app.float.device_list_column_height'))
+
+ Divider()
+ .opacity(CommonConstants.DIVIDER_OPACITY)
+ .color($r('app.color.list_divider'))
+ .width(CommonConstants.FULL_COMPONENT)
+ .visibility(index === this.discoverDeviceList.length - 1 ? Visibility.None : Visibility.Visible)
+ }
+ .layoutWeight(CommonConstants.ONE)
+ }
+ .width(CommonConstants.FULL_COMPONENT)
+ .height($r('app.float.device_list_row_height'))
+ .justifyContent(FlexAlign.Start)
+ .alignItems(VerticalAlign.Center)
+ }
+ .padding({
+ left: $r('app.float.dialog_padding'),
+ right: $r('app.float.dialog_padding')
+ })
+ .width(CommonConstants.FULL_COMPONENT)
+ }
+ }, item => item.deviceId)
+ }
+
+ Row() {
+ Column() {
+ Text($r('app.string.cancel'))
+ .textStyle()
+ .onClick(() => {
+ RemoteDeviceModel.stopDeviceDiscovery();
+ this.controller.close();
+ })
+ }
+ .layoutWeight(CommonConstants.ONE)
+ .justifyContent(FlexAlign.Center)
+ .height($r('app.float.dialog_button_height'))
+
+ Divider()
+ .opacity(CommonConstants.DIVIDER_OPACITY)
+ .color($r('app.color.list_divider'))
+ .vertical(true)
+ .height($r('app.float.dialog_button_height'))
+
+ Column() {
+ Text($r('app.string.ok'))
+ .textStyle()
+ .onClick(() => {
+ if ((this.selectedDevice === null)) {
+ prompt.showToast({
+ message: $r('app.string.please_select_device')
+ });
+ return;
+ }
+ if (this.isTrusted === false) {
+ // Connect the device.
+ this.confirm(this.selectedDevice);
+ this.controller.close();
+ } else {
+ // Start the app.
+ startAbilityContinuation(this.selectedDevice.networkId, this.newsData.newsId, this.context);
+ this.controller.close();
+ }
+ })
+ }
+ .layoutWeight(CommonConstants.ONE)
+ .justifyContent(FlexAlign.Center)
+ .height($r('app.float.dialog_button_height'))
+ }
+ .height($r('app.float.dialog_button_row_height'))
+ .padding({
+ top: $r('app.float.dialog_button_padding_top'),
+ bottom: $r('app.float.dialog_button_padding_bottom'),
+ left: $r('app.float.dialog_padding'),
+ right: $r('app.float.dialog_padding')
+ })
+ .width(CommonConstants.FULL_COMPONENT)
+ }
+ .borderRadius($r('app.float.dialog_border_radius'))
+ .backgroundColor($r('app.color.device_dialog_background'))
+ .width(CommonConstants.FULL_COMPONENT)
+ }
+}
+
+function startAbilityContinuation(deviceId: string, newsId: string, context: common.UIAbilityContext): void {
+ let want: Want = {
+ deviceId: deviceId,
+ bundleName: context.abilityInfo.bundleName,
+ abilityName: CommonConstants.ABILITY_NAME,
+ parameters: {
+ 'url': CommonConstants.NEWS_DETAIL_PAGE,
+ 'newsId': newsId
+ }
+ };
+ globalThis.context.startAbility(want).catch((err) => {
+ Logger.error(`startAbilityContinuation error. Code is ${err.code}, message is ${err.message}`);
+ prompt.showToast({
+ message: $r('app.string.start_ability_continuation_error')
+ });
+ })
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/ets/view/NewsList.ets b/Distributed/DistributedNewsClient/entry/src/main/ets/view/NewsList.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f08342cbcd5b214cd8214cc82aea863044b564be
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/ets/view/NewsList.ets
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import router from '@ohos.router';
+import CommonConstants from '../common/constants/CommonConstants';
+import { NewsData } from '../common/bean/NewsData';
+import Logger from '../common/utils/Logger';
+
+@Component
+export default struct NewsList {
+ private newsItems: NewsData[];
+
+ build() {
+ List() {
+ ForEach(this.newsItems, (item: NewsData, index: number) => {
+ ListItem() {
+ GridRow({
+ columns: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.TWELVE_COLUMN
+ },
+ breakpoints: {
+ value: [
+ CommonConstants.SMALL_DEVICE_TYPE,
+ CommonConstants.MIDDLE_DEVICE_TYPE,
+ CommonConstants.LARGE_DEVICE_TYPE
+ ]
+ },
+ gutter: { x: $r('app.float.grid_row_gutter') }
+ }) {
+ GridCol({
+ span: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.EIGHT_COLUMN
+ },
+ offset: {
+ sm: CommonConstants.ZERO_COLUMN,
+ md: CommonConstants.ZERO_COLUMN,
+ lg: CommonConstants.TWO_COLUMN
+ }
+ }) {
+ NewsItem({ newsItem: item, isLast: index === this.newsItems.length - 1 })
+ }
+ }
+ }
+ }, (item, index) => index + JSON.stringify(item))
+ }
+ .height(CommonConstants.FULL_COMPONENT)
+ }
+}
+
+@Component
+struct NewsItem {
+ private newsItem: NewsData;
+ private isLast: boolean;
+
+ build() {
+ Column() {
+ Row() {
+ Column() {
+ Row() {
+ Text(this.newsItem.title)
+ .fontSize($r('app.float.middle_font_size'))
+ .height($r('app.float.news_item_title_height'))
+ .maxLines(CommonConstants.NEWS_MAX_LINES)
+ .textOverflow({ overflow: TextOverflow.Ellipsis })
+ .align(Alignment.Top)
+ }
+ .alignItems(VerticalAlign.Top)
+ .margin({ bottom: $r('app.float.list_title_margin_bottom') })
+ .height($r('app.float.news_item_title_height'))
+ .width(CommonConstants.FULL_COMPONENT)
+
+ Row() {
+ Text(this.newsItem.label)
+ .fontSize($r('app.float.small_font_size'))
+ .fontColor(this.newsItem.redLabel ? Color.Red : $r('app.color.font_color_gray'))
+ .fontWeight(FontWeight.Normal)
+ .margin({ right: $r('app.float.news_label_margin_right') })
+ Text(this.newsItem.from)
+ .fontSize($r('app.float.small_font_size'))
+ .fontColor($r('app.color.font_color_gray'))
+ .fontWeight(FontWeight.Normal)
+ }
+ .padding({ bottom: $r('app.float.list_label_padding_bottom') })
+ .width(CommonConstants.FULL_COMPONENT)
+ }
+ .justifyContent(FlexAlign.Start)
+ .padding({ right: $r('app.float.news_item_padding_right') })
+ .height(CommonConstants.FULL_COMPONENT)
+ .layoutWeight(CommonConstants.ONE)
+
+ Image(this.newsItem.imgUrl)
+ .height($r('app.float.news_item_image_height'))
+ .width($r('app.float.news_item_image_width'))
+ .borderRadius($r('app.float.list_image_border_radius'))
+ }
+ .padding({ top: $r('app.float.list_row_padding_top') })
+ .width(CommonConstants.FULL_COMPONENT)
+ .alignItems(VerticalAlign.Top)
+
+ Divider()
+ .color($r('app.color.detail_divider_color'))
+ .opacity(CommonConstants.DIVIDER_OPACITY)
+ .visibility(this.isLast ? Visibility.None : Visibility.Visible)
+ }
+ .height($r('app.float.news_item_column_height'))
+ .padding({
+ left: $r('app.float.news_list_padding'),
+ right: $r('app.float.news_list_padding')
+ })
+ .width(CommonConstants.FULL_COMPONENT)
+ .onClick(() => {
+ router.pushUrl({
+ url: CommonConstants.NEWS_DETAIL_PAGE,
+ params: {
+ newsItem: this.newsItem
+ }
+ }).catch((err) => {
+ Logger.error(`router pushUrl failed. Code is ${err.code}, message is ${err.message}`);
+ })
+ })
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/ets/view/NewsTab.ets b/Distributed/DistributedNewsClient/entry/src/main/ets/view/NewsTab.ets
new file mode 100644
index 0000000000000000000000000000000000000000..63af125db7d3c52d2ce00852ac8c22b5c8258a14
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/ets/view/NewsTab.ets
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import NewsList from './NewsList';
+import CommonConstants from '../common/constants/CommonConstants';
+import { NewsData } from '../common/bean/NewsData';
+import { NewsDataModel } from '../viewmodel/NewsDataModel';
+
+@Component
+export default struct NewsTab {
+ @State currentIndex: number = 0;
+ @State currentBreakpoint: string = CommonConstants.BREAKPOINT_SM;
+ private newsItems: NewsData[];
+
+ @Builder TabBuilder(title: Resource, index: number) {
+ Row() {
+ Text(title)
+ .fontSize(this.currentIndex === index ? $r('app.float.lager_font_size') : $r('app.float.middle_font_size'))
+ .fontWeight(this.currentIndex === index ? CommonConstants.FONT_WEIGHT_500 : FontWeight.Normal)
+ .fontColor(this.currentIndex === index ? $r('app.color.tab_font_select') : $r('app.color.font_color_gray'))
+ }
+ .layoutWeight(1)
+ .margin({
+ right: $r('app.float.news_tab_margin_right'),
+ left: (this.currentBreakpoint === CommonConstants.BREAKPOINT_SM && index === 0) ?
+ $r('app.float.news_tab_margin_left') : 0
+ })
+ .height(this.currentIndex === index ? $r('app.float.news_tab_current_height') : $r('app.float.news_tab_height'))
+ }
+
+ build() {
+ GridRow({
+ columns: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.TWELVE_COLUMN
+ },
+ breakpoints: {
+ value: [
+ CommonConstants.SMALL_DEVICE_TYPE,
+ CommonConstants.MIDDLE_DEVICE_TYPE,
+ CommonConstants.LARGE_DEVICE_TYPE
+ ]
+ },
+ gutter: { x: $r('app.float.grid_row_gutter') }
+ }) {
+ GridCol({
+ span: {
+ sm: CommonConstants.FOUR_COLUMN,
+ md: CommonConstants.EIGHT_COLUMN,
+ lg: CommonConstants.TWELVE_COLUMN
+ },
+ offset: {
+ sm: CommonConstants.ZERO_COLUMN,
+ md: CommonConstants.ZERO_COLUMN,
+ lg: CommonConstants.ZERO_COLUMN
+ }
+ }) {
+ Tabs() {
+ ForEach(CommonConstants.ALL_TITLE, (title: string, index: number) => {
+ TabContent() {
+ NewsList({ newsItems: NewsDataModel.getNewsByType(this.newsItems, title) })
+ }
+ .tabBar(this.TabBuilder(NewsDataModel.getTypeByStr(title), index))
+ }, (title, index) => index + JSON.stringify(title))
+ }
+ .barHeight($r('app.float.news_tab_bar_height'))
+ .barWidth(CommonConstants.FULL_COMPONENT)
+ .barMode(this.currentBreakpoint === CommonConstants.BREAKPOINT_SM ? BarMode.Scrollable : BarMode.Fixed)
+ .onChange((index: number) => {
+ this.currentIndex = index;
+ })
+ }
+ }
+ .onBreakpointChange((breakpoints) => {
+ this.currentBreakpoint = breakpoints;
+ })
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/ets/viewmodel/NewsDataModel.ets b/Distributed/DistributedNewsClient/entry/src/main/ets/viewmodel/NewsDataModel.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f62077d3b7483d34534554892f27bb03c2cc723e
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/ets/viewmodel/NewsDataModel.ets
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2023 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import CommonConstants from '../common/constants/CommonConstants';
+import { NewsData } from '../common/bean/NewsData';
+
+export class NewsDataModel {
+ static getNewsByType(news: NewsData[], type: string): NewsData[] {
+ if (type === CommonConstants.ALL_TITLE[0]) {
+ return news;
+ }
+ return news.filter(item => (item.newsTypeStr === type));
+ }
+
+ static getTypeByStr(type: string): Resource {
+ let newsType: Resource;
+ switch (type) {
+ case CommonConstants.ALL_TITLE[0]:
+ newsType = $r('app.string.tabs_all');
+ break;
+ case CommonConstants.ALL_TITLE[1]:
+ newsType = $r('app.string.tabs_health');
+ break;
+ case CommonConstants.ALL_TITLE[2]:
+ newsType = $r('app.string.tabs_finance');
+ break;
+ case CommonConstants.ALL_TITLE[3]:
+ newsType = $r('app.string.tabs_technology');
+ break;
+ case CommonConstants.ALL_TITLE[4]:
+ newsType = $r('app.string.tabs_sports');
+ break;
+ case CommonConstants.ALL_TITLE[5]:
+ newsType = $r('app.string.tabs_internet');
+ break;
+ case CommonConstants.ALL_TITLE[6]:
+ newsType = $r('app.string.tabs_game');
+ break;
+ default:
+ break;
+ }
+ return newsType;
+ }
+
+ static getNewsComposition(): NewsData[] {
+ let newsComposition: NewsData[] = [];
+ for (let i: number = 0; i < CommonConstants.NEWS_ID.length; i++) {
+ let newsId: string = CommonConstants.NEWS_ID[i];
+ let newsTypeStr: string = CommonConstants.ALL_TITLE[i % CommonConstants.TITLES_NUMBER + 1];
+ let newsType: Resource = this.getTypeByStr(newsTypeStr);
+ let title: Resource;
+ let content: Resource;
+ let imgUrl: Resource;
+ let label: Resource;
+ let redLabel: boolean;
+ let from: Resource;
+ switch (i % CommonConstants.IMAGES_NUMBER) {
+ case 0:
+ imgUrl = $r('app.media.ic_news_image1');
+ label = $r('app.string.news_label_top');
+ from = $r('app.string.xxx_daily');
+ redLabel = true;
+ break;
+ case 1:
+ imgUrl = $r('app.media.ic_news_image2');
+ label = $r('app.string.news_label_more_comment');
+ from = $r('app.string.xx_daily');
+ redLabel = true;
+ break;
+ case 2:
+ imgUrl = $r('app.media.ic_news_image3');
+ label = $r('app.string.news_label_recommend');
+ from = $r('app.string.xx_com');
+ redLabel = false;
+ break;
+ case 3:
+ imgUrl = $r('app.media.ic_news_image4');
+ label = $r('app.string.news_label_recommend');
+ from = $r('app.string.news_client');
+ redLabel = false;
+ break;
+ default:
+ break;
+ }
+ switch (i % CommonConstants.NEWS_ID.length) {
+ case 0:
+ title = $r('app.string.news_1_title');
+ content = $r('app.string.news_1_content');
+ break;
+ case 1:
+ title = $r('app.string.news_2_title');
+ content = $r('app.string.news_2_content');
+ break;
+ case 2:
+ title = $r('app.string.news_3_title');
+ content = $r('app.string.news_3_content');
+ break;
+ case 3:
+ title = $r('app.string.news_4_title');
+ content = $r('app.string.news_4_content');
+ break;
+ case 4:
+ title = $r('app.string.news_5_title');
+ content = $r('app.string.news_5_content');
+ break;
+ case 5:
+ title = $r('app.string.news_6_title');
+ content = $r('app.string.news_6_content');
+ break;
+ case 6:
+ title = $r('app.string.news_7_title');
+ content = $r('app.string.news_7_content');
+ break;
+ case 7:
+ title = $r('app.string.news_8_title');
+ content = $r('app.string.news_8_content');
+ break;
+ case 8:
+ title = $r('app.string.news_9_title');
+ content = $r('app.string.news_9_content');
+ break;
+ case 9:
+ title = $r('app.string.news_10_title');
+ content = $r('app.string.news_10_content');
+ break;
+ case 10:
+ title = $r('app.string.news_11_title');
+ content = $r('app.string.news_11_content');
+ break;
+ case 11:
+ title = $r('app.string.news_12_title');
+ content = $r('app.string.news_12_content');
+ break;
+ case 12:
+ title = $r('app.string.news_13_title');
+ content = $r('app.string.news_13_content');
+ break;
+ case 13:
+ title = $r('app.string.news_14_title');
+ content = $r('app.string.news_14_content');
+ break;
+ case 14:
+ title = $r('app.string.news_15_title');
+ content = $r('app.string.news_15_content');
+ break;
+ case 15:
+ title = $r('app.string.news_16_title');
+ content = $r('app.string.news_16_content');
+ break;
+ case 16:
+ title = $r('app.string.news_17_title');
+ content = $r('app.string.news_17_content');
+ break;
+ case 17:
+ title = $r('app.string.news_18_title');
+ content = $r('app.string.news_18_content');
+ break;
+ case 18:
+ title = $r('app.string.news_19_title');
+ content = $r('app.string.news_19_content');
+ break;
+ default:
+ break;
+ }
+
+ let reads: string = CommonConstants.NEWS_READS[i];
+ let likes: string = CommonConstants.NEWS_LIKES[i];
+ let newsItem: NewsData = new NewsData(newsId, title, newsTypeStr, newsType, imgUrl, reads, likes, content, label,
+ redLabel, from);
+ newsComposition.push(newsItem);
+ }
+ return newsComposition;
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/module.json5 b/Distributed/DistributedNewsClient/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b017dc98540fe8844bbc746a6db9996be5e7351b
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/module.json5
@@ -0,0 +1,59 @@
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:icon",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:icon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.ACCESS_SERVICE_DM",
+ "reason": "$string:dependency_reason_1",
+ "usedScene": {
+ "abilities": [
+ "EntryAbility"
+ ],
+ "when": "inuse"
+ }
+ },
+ {
+ "name": "ohos.permission.DISTRIBUTED_DATASYNC",
+ "reason": "$string:dependency_reason_2",
+ "usedScene": {
+ "abilities": [
+ "EntryAbility"
+ ],
+ "when": "inuse"
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/element/color.json b/Distributed/DistributedNewsClient/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..8df8244f1b22eb45e8823740498357ef946ff208
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,40 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ },
+ {
+ "name": "white",
+ "value": "#FFFFFF"
+ },
+ {
+ "name": "bg_color_gray",
+ "value": "#F1F3F5"
+ },
+ {
+ "name": "font_color_gray",
+ "value": "#99000000"
+ },
+ {
+ "name": "tab_font_select",
+ "value": "#E6000000"
+ },
+ {
+ "name": "dialog_button_font",
+ "value": "#FF007DFF"
+ },
+ {
+ "name": "detail_divider_color",
+ "value": "#33182431"
+ },
+ {
+ "name": "list_divider",
+ "value": "#FF000000"
+ },
+ {
+ "name": "device_dialog_background",
+ "value": "#D8FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/element/float.json b/Distributed/DistributedNewsClient/entry/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..93f1ea1558e1af3a70c73a158706dd41afe9e4ca
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/resources/base/element/float.json
@@ -0,0 +1,244 @@
+{
+ "float": [
+ {
+ "name": "news_label_margin_right",
+ "value": "5vp"
+ },
+ {
+ "name": "list_image_border_radius",
+ "value": "8vp"
+ },
+ {
+ "name": "message_margin_left",
+ "value": "8vp"
+ },
+ {
+ "name": "dialog_button_padding_top",
+ "value": "8vp"
+ },
+ {
+ "name": "dialog_icon_margin_bottom",
+ "value": "9.5vp"
+ },
+ {
+ "name": "footer_margin_sm",
+ "value": "12vp"
+ },
+ {
+ "name": "footer_margin_other",
+ "value": "24vp"
+ },
+ {
+ "name": "like_margin_right",
+ "value": "12vp"
+ },
+ {
+ "name": "read_like_margin_top",
+ "value": "12vp"
+ },
+ {
+ "name": "head_image_margin",
+ "value": "12vp"
+ },
+ {
+ "name": "list_title_margin_bottom",
+ "value": "12vp"
+ },
+ {
+ "name": "list_row_padding_top",
+ "value": "12vp"
+ },
+ {
+ "name": "list_label_padding_bottom",
+ "value": "13vp"
+ },
+ {
+ "name": "dialog_offset_y",
+ "value": "-12vp"
+ },
+ {
+ "name": "small_font_size",
+ "value": "14fp"
+ },
+ {
+ "name": "message_margin_right",
+ "value": "16vp"
+ },
+ {
+ "name": "back_margin",
+ "value": "16vp"
+ },
+ {
+ "name": "dialog_icon_margin_right",
+ "value": "16vp"
+ },
+ {
+ "name": "radio_margin_left",
+ "value": "16vp"
+ },
+ {
+ "name": "dialog_button_padding_bottom",
+ "value": "16vp"
+ },
+ {
+ "name": "news_list_padding",
+ "value": "16vp"
+ },
+ {
+ "name": "news_tab_margin_right",
+ "value": "16vp"
+ },
+ {
+ "name": "normal_font_size",
+ "value": "16fp"
+ },
+ {
+ "name": "middle_font_size",
+ "value": "18fp"
+ },
+ {
+ "name": "choose_device_line_height",
+ "value": "19vp"
+ },
+ {
+ "name": "choose_device_margin_top",
+ "value": "19.5vp"
+ },
+ {
+ "name": "text_input_border_radius",
+ "value": "20vp"
+ },
+ {
+ "name": "device_list_line_height",
+ "value": "22vp"
+ },
+ {
+ "name": "footer_icon_size",
+ "value": "24vp"
+ },
+ {
+ "name": "grid_row_gutter",
+ "value": "24vp"
+ },
+ {
+ "name": "back_size",
+ "value": "24vp"
+ },
+ {
+ "name": "news_detail_title_font_size",
+ "value": "24fp"
+ },
+ {
+ "name": "news_detail_image_border_radius",
+ "value": "24vp"
+ },
+ {
+ "name": "news_detail_margin",
+ "value": "24vp"
+ },
+ {
+ "name": "dialog_padding",
+ "value": "24vp"
+ },
+ {
+ "name": "dialog_icon_size",
+ "value": "24vp"
+ },
+ {
+ "name": "dialog_radio_size",
+ "value": "24vp"
+ },
+ {
+ "name": "dialog_border_radius",
+ "value": "24vp"
+ },
+ {
+ "name": "news_item_padding_right",
+ "value": "24vp"
+ },
+ {
+ "name": "news_tab_margin_left",
+ "value": "24vp"
+ },
+ {
+ "name": "news_tab_height",
+ "value": "24vp"
+ },
+ {
+ "name": "lager_font_size",
+ "value": "24fp"
+ },
+ {
+ "name": "news_content_line_height",
+ "value": "25vp"
+ },
+ {
+ "name": "news_tab_current_height",
+ "value": "32vp"
+ },
+ {
+ "name": "text_input_height",
+ "value": "40vp"
+ },
+ {
+ "name": "dialog_button_height",
+ "value": "40vp"
+ },
+ {
+ "name": "choose_device_row_height",
+ "value": "48vp"
+ },
+ {
+ "name": "news_item_title_height",
+ "value": "52vp"
+ },
+ {
+ "name": "device_list_column_height",
+ "value": "55.5vp"
+ },
+ {
+ "name": "footer_height",
+ "value": "56vp"
+ },
+ {
+ "name": "back_row_height",
+ "value": "56vp"
+ },
+ {
+ "name": "device_list_row_height",
+ "value": "56vp"
+ },
+ {
+ "name": "dialog_button_row_height",
+ "value": "56vp"
+ },
+ {
+ "name": "news_tab_bar_height",
+ "value": "56vp"
+ },
+ {
+ "name": "footer_icon_column_width",
+ "value": "60vp"
+ },
+ {
+ "name": "news_item_image_height",
+ "value": "80vp"
+ },
+ {
+ "name": "news_item_column_height",
+ "value": "103vp"
+ },
+ {
+ "name": "news_item_image_width",
+ "value": "106vp"
+ },
+ {
+ "name": "news_detail_padding_bottom",
+ "value": "124vp"
+ },
+ {
+ "name": "news_detail_image_height",
+ "value": "176vp"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/element/string.json b/Distributed/DistributedNewsClient/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..c79ebab51ff8801c0d1f7821be00b6719e1229c6
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,276 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "distribute news client"
+ },
+ {
+ "name": "read_count",
+ "value": "reads:"
+ },
+ {
+ "name": "like",
+ "value": "like:"
+ },
+ {
+ "name": "write_note",
+ "value": "write note"
+ },
+ {
+ "name": "cancel",
+ "value": "Cancel"
+ },
+ {
+ "name": "ok",
+ "value": "Ok"
+ },
+ {
+ "name": "select_device",
+ "value": "Select device"
+ },
+ {
+ "name": "trusted_device",
+ "value": "Trusted device"
+ },
+ {
+ "name": "please_select_device",
+ "value": "Please select device."
+ },
+ {
+ "name": "news_label_top",
+ "value": "Top"
+ },
+ {
+ "name": "news_label_more_comment",
+ "value": "More than 10000 posts"
+ },
+ {
+ "name": "news_label_recommend",
+ "value": "Recommend"
+ },
+ {
+ "name": "xx_daily",
+ "value": "XX Daily"
+ },
+ {
+ "name": "xxx_daily",
+ "value": "XXX Daily"
+ },
+ {
+ "name": "xx_com",
+ "value": "XX COM"
+ },
+ {
+ "name": "news_client",
+ "value": "News Client"
+ },
+ {
+ "name": "news_1_title",
+ "value": "The results of the exam are announced! Who's the champion?"
+ },
+ {
+ "name": "news_2_title",
+ "value": "College entrance examination students rushed to the examination room, we cheered for them together."
+ },
+ {
+ "name": "news_3_title",
+ "value": "Openness and Cooperation Helps Industry Upgrade"
+ },
+ {
+ "name": "news_4_title",
+ "value": "XX Community Mid-Autumn Festival benefits, hurry to receive"
+ },
+ {
+ "name": "news_5_title",
+ "value": "XX Mall big promotion!"
+ },
+ {
+ "name": "news_6_title",
+ "value": "The next decade in the computer industry"
+ },
+ {
+ "name": "news_7_title",
+ "value": "The city's basketball competition is hot."
+ },
+ {
+ "name": "news_8_title",
+ "value": "Enterprise Data Center Upgrade"
+ },
+ {
+ "name": "news_9_title",
+ "value": "A fiber optic lights up a green smart room"
+ },
+ {
+ "name": "news_10_title",
+ "value": "How do you spend Singles' Day?"
+ },
+ {
+ "name": "news_11_title",
+ "value": "Trust technology, embrace openness, and share technology"
+ },
+ {
+ "name": "news_12_title",
+ "value": "Influence of Transportation Efficiency on Residents' Life Rhythm"
+ },
+ {
+ "name": "news_13_title",
+ "value": "Enterprise executives get involved to accelerate revenue growth."
+ },
+ {
+ "name": "news_14_title",
+ "value": "Down! CPI released in November! These things are cheap"
+ },
+ {
+ "name": "news_15_title",
+ "value": "Spring Festival Movies Set New Year's Day"
+ },
+ {
+ "name": "news_16_title",
+ "value": "Three living things are smart"
+ },
+ {
+ "name": "news_17_title",
+ "value": "Realize your own value"
+ },
+ {
+ "name": "news_18_title",
+ "value": "Tree planting activities are launched on Arbor Planting Day in XX Primary School, with parents and students participating."
+ },
+ {
+ "name": "news_19_title",
+ "value": "Clean up!"
+ },
+ {
+ "name": "news_1_content",
+ "value": "The results of the exam are announced! Who's the champion? The results of the exam are announced! Who's the champion? The results of the exam are announced! Who's the champion? The results of the exam are announced! Who's the champion? The results of the exam are announced! Who's the champion?"
+ },
+ {
+ "name": "news_2_content",
+ "value": "College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads. College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads. College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads. College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads. College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads. College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads. College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads. College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads."
+ },
+ {
+ "name": "news_3_content",
+ "value": "Open cooperation helps industry upgrade. Open cooperation helps industry upgrade. Open cooperation helps industry upgrade. Open cooperation helps industry upgrade. Open cooperation helps industry upgrade. Open cooperation helps industry upgrade. Open cooperation helps industry upgrade. Open cooperation helps industry upgrade."
+ },
+ {
+ "name": "news_4_content",
+ "value": "XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left."
+ },
+ {
+ "name": "news_5_content",
+ "value": "XX mall big promotion! XX mall big promotion!XX mall big promotion! XX mall big promotion!XX mall big promotion! XX mall big promotion!XX mall big promotion! XX mall big promotion!XX mall big promotion! XX mall big promotion!"
+ },
+ {
+ "name": "news_6_content",
+ "value": "The Computer Industry's Next Decade: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical analysis."
+ },
+ {
+ "name": "news_7_content",
+ "value": "The city's basketball competition is hot, the top three rewards are generous, come and invite the little friends to participate together. The city's basketball competition is hot, the top three rewards are generous, come and invite the little friends to participate together. The city's basketball competition is hot, the top three rewards are generous, come and invite the little friends to participate together. The city's basketball competition is hot, the top three rewards are generous, come and invite the little friends to participate together."
+ },
+ {
+ "name": "news_8_content",
+ "value": "Enterprise data center upgrade. Enterprise data center upgrade. Enterprise data center upgrade. Enterprise data center upgrade. Enterprise data center upgrade."
+ },
+ {
+ "name": "news_9_content",
+ "value": "A fiber optic lights up a green smart room. A fiber optic lights up a green smart room. A fiber optic lights up a green smart room. A fiber optic lights up a green smart room. A fiber optic lights up a green smart room."
+ },
+ {
+ "name": "news_10_content",
+ "value": "How do you spend Singles' Day? How do you spend Singles' Day? How do you spend Singles' Day? How do you spend Singles' Day? How do you spend Singles' Day? How do you spend Singles' Day? How do you spend Singles' Day? How do you spend Singles' Day?"
+ },
+ {
+ "name": "news_11_content",
+ "value": "Trust technology, embrace openness, and share technology. Trust technology, embrace openness, and share technology. Trust technology, embrace openness, and share technology."
+ },
+ {
+ "name": "news_12_content",
+ "value": "What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents?"
+ },
+ {
+ "name": "news_13_content",
+ "value": "Enterprise executives are involved, and revenue growth is accelerated. Enterprise executives are involved, and revenue growth is accelerated. Enterprise executives are involved, and revenue growth is accelerated. Enterprise executives are involved, and revenue growth is accelerated. Enterprise executives are involved, and revenue growth is accelerated. Enterprise executives are involved, and revenue growth is accelerated."
+ },
+ {
+ "name": "news_14_content",
+ "value": "Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap."
+ },
+ {
+ "name": "news_15_content",
+ "value": "Spring Festival movie set for New Year! Spring Festival movie set for New Year! Spring Festival movie set for New Year! Spring Festival movie set for New Year! Spring Festival movie set for New Year! Spring Festival movie set for New Year! Spring Festival movie set for New Year!"
+ },
+ {
+ "name": "news_16_content",
+ "value": "Three intelligent creatures. Three intelligent creatures. Three intelligent creatures."
+ },
+ {
+ "name": "news_17_content",
+ "value": "Realize their own value, tap their own potential, and strive to contribute to the society!"
+ },
+ {
+ "name": "news_18_content",
+ "value": "Tree planting activities are carried out on Arbor Planting Day in XX primary school, with parents and students participating. Tree planting activities are carried out on Arbor Planting Day in XX primary school, with parents and students participating. Tree planting activities are carried out on Arbor Planting Day in XX primary school, with parents and students participating."
+ },
+ {
+ "name": "news_19_content",
+ "value": "Clean up!!! cleaning up!!! cleaning up!!! cleaning up!!! Clean up!!!"
+ },
+ {
+ "name": "tabs_all",
+ "value": "All"
+ },
+ {
+ "name": "tabs_health",
+ "value": "Health"
+ },
+ {
+ "name": "tabs_finance",
+ "value": "Finance"
+ },
+ {
+ "name": "tabs_technology",
+ "value": "Technology"
+ },
+ {
+ "name": "tabs_sports",
+ "value": "Sports"
+ },
+ {
+ "name": "tabs_internet",
+ "value": "Internet"
+ },
+ {
+ "name": "tabs_game",
+ "value": "Game"
+ },
+ {
+ "name": "dependency_reason_1",
+ "value": "Provides distributed device management capabilities."
+ },
+ {
+ "name": "dependency_reason_2",
+ "value": "Supports multi-device collaboration and cross-device application startup."
+ },
+ {
+ "name": "no_device_manager",
+ "value": "deviceManager has not initialized"
+ },
+ {
+ "name": "get_trusted_device_list_failed",
+ "value": "getTrustedDeviceList failed"
+ },
+ {
+ "name": "start_ability_continuation_error",
+ "value": "startAbilityContinuation error "
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_back.png b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_back.png
new file mode 100644
index 0000000000000000000000000000000000000000..6cbe911b6b33e467fe20c4fbe305f2bc7022d29d
Binary files /dev/null and b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_back.png differ
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_function.png b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_function.png
new file mode 100644
index 0000000000000000000000000000000000000000..b593f05456a954453712b1ef1ba76338fbdee20b
Binary files /dev/null and b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_function.png differ
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_icon_good.png b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_icon_good.png
new file mode 100644
index 0000000000000000000000000000000000000000..5aaefa86fe091ab0c0d93ebb6739401275a220b8
Binary files /dev/null and b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_icon_good.png differ
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_icon_message.png b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_icon_message.png
new file mode 100644
index 0000000000000000000000000000000000000000..3912e30375c5f824e376a57eb7e16c6ab0a1101b
Binary files /dev/null and b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_icon_message.png differ
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_icon_share.png b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_icon_share.png
new file mode 100644
index 0000000000000000000000000000000000000000..61c4dec3cd3e54ecf6a901a78ce491efac0af6ae
Binary files /dev/null and b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_icon_share.png differ
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_icon_star.png b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_icon_star.png
new file mode 100644
index 0000000000000000000000000000000000000000..2129949a193f084c22c94ca4821ba611e3c9c0ca
Binary files /dev/null and b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_icon_star.png differ
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_news_image1.png b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_news_image1.png
new file mode 100644
index 0000000000000000000000000000000000000000..3b6b9ab02181671ae9efd21d3f4897a7e3a05475
Binary files /dev/null and b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_news_image1.png differ
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_news_image2.png b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_news_image2.png
new file mode 100644
index 0000000000000000000000000000000000000000..447ad9194bdac00e2eea174f1003974e52591f49
Binary files /dev/null and b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_news_image2.png differ
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_news_image3.png b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_news_image3.png
new file mode 100644
index 0000000000000000000000000000000000000000..0c88af0cee69022b7953db1da6e5aa69e60e073c
Binary files /dev/null and b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_news_image3.png differ
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_news_image4.png b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_news_image4.png
new file mode 100644
index 0000000000000000000000000000000000000000..811709100d29ca9f671fabe65489d78cf4e9b07b
Binary files /dev/null and b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_news_image4.png differ
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_pad.svg b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_pad.svg
new file mode 100644
index 0000000000000000000000000000000000000000..ad1e0df3ebdad7ce6260c6bac927ec5f25bcc362
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_pad.svg
@@ -0,0 +1,7 @@
+
+
+
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_pc.svg b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_pc.svg
new file mode 100644
index 0000000000000000000000000000000000000000..e1544b2ef050766ce0c27d72e12931df473e21a1
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_pc.svg
@@ -0,0 +1,9 @@
+
+
+
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_phone.svg b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_phone.svg
new file mode 100644
index 0000000000000000000000000000000000000000..8f09bf06a5dade08f4d021afdb6790a86ee36495
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/ic_phone.svg
@@ -0,0 +1,13 @@
+
+
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/icon.png b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/Distributed/DistributedNewsClient/entry/src/main/resources/base/media/icon.png differ
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/base/profile/main_pages.json b/Distributed/DistributedNewsClient/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..d561c3d0b6142eef96fc68ad8c3adeef45c687de
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,6 @@
+{
+ "src": [
+ "pages/Index",
+ "pages/NewsDetail"
+ ]
+}
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/en_US/element/string.json b/Distributed/DistributedNewsClient/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..c79ebab51ff8801c0d1f7821be00b6719e1229c6
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,276 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "distribute news client"
+ },
+ {
+ "name": "read_count",
+ "value": "reads:"
+ },
+ {
+ "name": "like",
+ "value": "like:"
+ },
+ {
+ "name": "write_note",
+ "value": "write note"
+ },
+ {
+ "name": "cancel",
+ "value": "Cancel"
+ },
+ {
+ "name": "ok",
+ "value": "Ok"
+ },
+ {
+ "name": "select_device",
+ "value": "Select device"
+ },
+ {
+ "name": "trusted_device",
+ "value": "Trusted device"
+ },
+ {
+ "name": "please_select_device",
+ "value": "Please select device."
+ },
+ {
+ "name": "news_label_top",
+ "value": "Top"
+ },
+ {
+ "name": "news_label_more_comment",
+ "value": "More than 10000 posts"
+ },
+ {
+ "name": "news_label_recommend",
+ "value": "Recommend"
+ },
+ {
+ "name": "xx_daily",
+ "value": "XX Daily"
+ },
+ {
+ "name": "xxx_daily",
+ "value": "XXX Daily"
+ },
+ {
+ "name": "xx_com",
+ "value": "XX COM"
+ },
+ {
+ "name": "news_client",
+ "value": "News Client"
+ },
+ {
+ "name": "news_1_title",
+ "value": "The results of the exam are announced! Who's the champion?"
+ },
+ {
+ "name": "news_2_title",
+ "value": "College entrance examination students rushed to the examination room, we cheered for them together."
+ },
+ {
+ "name": "news_3_title",
+ "value": "Openness and Cooperation Helps Industry Upgrade"
+ },
+ {
+ "name": "news_4_title",
+ "value": "XX Community Mid-Autumn Festival benefits, hurry to receive"
+ },
+ {
+ "name": "news_5_title",
+ "value": "XX Mall big promotion!"
+ },
+ {
+ "name": "news_6_title",
+ "value": "The next decade in the computer industry"
+ },
+ {
+ "name": "news_7_title",
+ "value": "The city's basketball competition is hot."
+ },
+ {
+ "name": "news_8_title",
+ "value": "Enterprise Data Center Upgrade"
+ },
+ {
+ "name": "news_9_title",
+ "value": "A fiber optic lights up a green smart room"
+ },
+ {
+ "name": "news_10_title",
+ "value": "How do you spend Singles' Day?"
+ },
+ {
+ "name": "news_11_title",
+ "value": "Trust technology, embrace openness, and share technology"
+ },
+ {
+ "name": "news_12_title",
+ "value": "Influence of Transportation Efficiency on Residents' Life Rhythm"
+ },
+ {
+ "name": "news_13_title",
+ "value": "Enterprise executives get involved to accelerate revenue growth."
+ },
+ {
+ "name": "news_14_title",
+ "value": "Down! CPI released in November! These things are cheap"
+ },
+ {
+ "name": "news_15_title",
+ "value": "Spring Festival Movies Set New Year's Day"
+ },
+ {
+ "name": "news_16_title",
+ "value": "Three living things are smart"
+ },
+ {
+ "name": "news_17_title",
+ "value": "Realize your own value"
+ },
+ {
+ "name": "news_18_title",
+ "value": "Tree planting activities are launched on Arbor Planting Day in XX Primary School, with parents and students participating."
+ },
+ {
+ "name": "news_19_title",
+ "value": "Clean up!"
+ },
+ {
+ "name": "news_1_content",
+ "value": "The results of the exam are announced! Who's the champion? The results of the exam are announced! Who's the champion? The results of the exam are announced! Who's the champion? The results of the exam are announced! Who's the champion? The results of the exam are announced! Who's the champion?"
+ },
+ {
+ "name": "news_2_content",
+ "value": "College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads. College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads. College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads. College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads. College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads. College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads. College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads. College entrance examination students rushed to the examination room, we refueled for them together, the urban area bypassed these roads."
+ },
+ {
+ "name": "news_3_content",
+ "value": "Open cooperation helps industry upgrade. Open cooperation helps industry upgrade. Open cooperation helps industry upgrade. Open cooperation helps industry upgrade. Open cooperation helps industry upgrade. Open cooperation helps industry upgrade. Open cooperation helps industry upgrade. Open cooperation helps industry upgrade."
+ },
+ {
+ "name": "news_4_content",
+ "value": "XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left. XX community Mid-Autumn Festival benefits, hurry to receive, time only 3 days left."
+ },
+ {
+ "name": "news_5_content",
+ "value": "XX mall big promotion! XX mall big promotion!XX mall big promotion! XX mall big promotion!XX mall big promotion! XX mall big promotion!XX mall big promotion! XX mall big promotion!XX mall big promotion! XX mall big promotion!"
+ },
+ {
+ "name": "news_6_content",
+ "value": "The Computer Industry's Next Decade: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical Analysis. The Next Decade of Computer Industry: A Worrying Future? The future can be expected? Dialectical analysis."
+ },
+ {
+ "name": "news_7_content",
+ "value": "The city's basketball competition is hot, the top three rewards are generous, come and invite the little friends to participate together. The city's basketball competition is hot, the top three rewards are generous, come and invite the little friends to participate together. The city's basketball competition is hot, the top three rewards are generous, come and invite the little friends to participate together. The city's basketball competition is hot, the top three rewards are generous, come and invite the little friends to participate together."
+ },
+ {
+ "name": "news_8_content",
+ "value": "Enterprise data center upgrade. Enterprise data center upgrade. Enterprise data center upgrade. Enterprise data center upgrade. Enterprise data center upgrade."
+ },
+ {
+ "name": "news_9_content",
+ "value": "A fiber optic lights up a green smart room. A fiber optic lights up a green smart room. A fiber optic lights up a green smart room. A fiber optic lights up a green smart room. A fiber optic lights up a green smart room."
+ },
+ {
+ "name": "news_10_content",
+ "value": "How do you spend Singles' Day? How do you spend Singles' Day? How do you spend Singles' Day? How do you spend Singles' Day? How do you spend Singles' Day? How do you spend Singles' Day? How do you spend Singles' Day? How do you spend Singles' Day?"
+ },
+ {
+ "name": "news_11_content",
+ "value": "Trust technology, embrace openness, and share technology. Trust technology, embrace openness, and share technology. Trust technology, embrace openness, and share technology."
+ },
+ {
+ "name": "news_12_content",
+ "value": "What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents? What is the impact of transportation efficiency on the pace of life of residents?"
+ },
+ {
+ "name": "news_13_content",
+ "value": "Enterprise executives are involved, and revenue growth is accelerated. Enterprise executives are involved, and revenue growth is accelerated. Enterprise executives are involved, and revenue growth is accelerated. Enterprise executives are involved, and revenue growth is accelerated. Enterprise executives are involved, and revenue growth is accelerated. Enterprise executives are involved, and revenue growth is accelerated."
+ },
+ {
+ "name": "news_14_content",
+ "value": "Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap.Down! CPI released in November! These things are cheap."
+ },
+ {
+ "name": "news_15_content",
+ "value": "Spring Festival movie set for New Year! Spring Festival movie set for New Year! Spring Festival movie set for New Year! Spring Festival movie set for New Year! Spring Festival movie set for New Year! Spring Festival movie set for New Year! Spring Festival movie set for New Year!"
+ },
+ {
+ "name": "news_16_content",
+ "value": "Three intelligent creatures. Three intelligent creatures. Three intelligent creatures."
+ },
+ {
+ "name": "news_17_content",
+ "value": "Realize their own value, tap their own potential, and strive to contribute to the society!"
+ },
+ {
+ "name": "news_18_content",
+ "value": "Tree planting activities are carried out on Arbor Planting Day in XX primary school, with parents and students participating. Tree planting activities are carried out on Arbor Planting Day in XX primary school, with parents and students participating. Tree planting activities are carried out on Arbor Planting Day in XX primary school, with parents and students participating."
+ },
+ {
+ "name": "news_19_content",
+ "value": "Clean up!!! cleaning up!!! cleaning up!!! cleaning up!!! Clean up!!!"
+ },
+ {
+ "name": "tabs_all",
+ "value": "All"
+ },
+ {
+ "name": "tabs_health",
+ "value": "Health"
+ },
+ {
+ "name": "tabs_finance",
+ "value": "Finance"
+ },
+ {
+ "name": "tabs_technology",
+ "value": "Technology"
+ },
+ {
+ "name": "tabs_sports",
+ "value": "Sports"
+ },
+ {
+ "name": "tabs_internet",
+ "value": "Internet"
+ },
+ {
+ "name": "tabs_game",
+ "value": "Game"
+ },
+ {
+ "name": "dependency_reason_1",
+ "value": "Provides distributed device management capabilities."
+ },
+ {
+ "name": "dependency_reason_2",
+ "value": "Supports multi-device collaboration and cross-device application startup."
+ },
+ {
+ "name": "no_device_manager",
+ "value": "deviceManager has not initialized"
+ },
+ {
+ "name": "get_trusted_device_list_failed",
+ "value": "getTrustedDeviceList failed"
+ },
+ {
+ "name": "start_ability_continuation_error",
+ "value": "startAbilityContinuation error "
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/entry/src/main/resources/zh_CN/element/string.json b/Distributed/DistributedNewsClient/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..0f588f980137fd858b9109ef4dba26d57ced3018
--- /dev/null
+++ b/Distributed/DistributedNewsClient/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,276 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "分布式新闻"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "分布式新闻"
+ },
+ {
+ "name": "read_count",
+ "value": "阅读量:"
+ },
+ {
+ "name": "like",
+ "value": "喜欢:"
+ },
+ {
+ "name": "write_note",
+ "value": "写跟贴"
+ },
+ {
+ "name": "cancel",
+ "value": "取消"
+ },
+ {
+ "name": "ok",
+ "value": "确定"
+ },
+ {
+ "name": "select_device",
+ "value": "选择设备"
+ },
+ {
+ "name": "trusted_device",
+ "value": "已连接设备"
+ },
+ {
+ "name": "please_select_device",
+ "value": "选择一个设备"
+ },
+ {
+ "name": "news_label_top",
+ "value": "置顶"
+ },
+ {
+ "name": "news_label_more_comment",
+ "value": "跟帖过万"
+ },
+ {
+ "name": "news_label_recommend",
+ "value": "推荐"
+ },
+ {
+ "name": "xx_daily",
+ "value": "xx日报"
+ },
+ {
+ "name": "xxx_daily",
+ "value": "xxx日报"
+ },
+ {
+ "name": "xx_com",
+ "value": "xx网"
+ },
+ {
+ "name": "news_client",
+ "value": "新闻客户端"
+ },
+ {
+ "name": "news_1_title",
+ "value": "中考成绩公布!状元究竟花落谁家!"
+ },
+ {
+ "name": "news_2_title",
+ "value": "高考学子奔赴考场,我们一起为他们加油"
+ },
+ {
+ "name": "news_3_title",
+ "value": "开放合作助力产业升级"
+ },
+ {
+ "name": "news_4_title",
+ "value": "xx社区中秋节发放福利,抓紧领取"
+ },
+ {
+ "name": "news_5_title",
+ "value": "xx商场大促销!"
+ },
+ {
+ "name": "news_6_title",
+ "value": "计算机行业的未来十年"
+ },
+ {
+ "name": "news_7_title",
+ "value": "全市篮球大赛火热举行中"
+ },
+ {
+ "name": "news_8_title",
+ "value": "企业数据中心大升级"
+ },
+ {
+ "name": "news_9_title",
+ "value": "一根光纤点亮绿色智能房间"
+ },
+ {
+ "name": "news_10_title",
+ "value": "男女差异,光棍节你如何度过?"
+ },
+ {
+ "name": "news_11_title",
+ "value": "信任技术,拥抱开放,分享技术"
+ },
+ {
+ "name": "news_12_title",
+ "value": "运输效率高低对居民生活节奏的影响"
+ },
+ {
+ "name": "news_13_title",
+ "value": "企业高层介入,收入增长提速"
+ },
+ {
+ "name": "news_14_title",
+ "value": "下跌!11月CPI公布!这些东西很便宜"
+ },
+ {
+ "name": "news_15_title",
+ "value": "春节电影定档贺岁"
+ },
+ {
+ "name": "news_16_title",
+ "value": "三只聪明的生物"
+ },
+ {
+ "name": "news_17_title",
+ "value": "实现自身价值"
+ },
+ {
+ "name": "news_18_title",
+ "value": "xx小学植树节开展植树活动,家长同学齐参与"
+ },
+ {
+ "name": "news_19_title",
+ "value": "大扫除!"
+ },
+ {
+ "name": "news_1_content",
+ "value": "中考成绩公布!状元究竟花落谁家!中考成绩公布!状元究竟花落谁家!中考成绩公布!状元究竟花落谁家!中考成绩公布!状元究竟花落谁家!中考成绩公布!状元究竟花落谁家!"
+ },
+ {
+ "name": "news_2_content",
+ "value": "高考学子奔赴考场,我们一起为他们加油,市区绕开这些路段通行。高考学子奔赴考场,我们一起为他们加油,市区绕开这些路段通行。高考学子奔赴考场,我们一起为他们加油,市区绕开这些路段通行。高考学子奔赴考场,我们一起为他们加油,市区绕开这些路段通行。高考学子奔赴考场,我们一起为他们加油,市区绕开这些路段通行。高考学子奔赴考场,我们一起为他们加油,市区绕开这些路段通行。高考学子奔赴考场,我们一起为他们加油,市区绕开这些路段通行。高考学子奔赴考场,我们一起为他们加油,市区绕开这些路段通行。"
+ },
+ {
+ "name": "news_3_content",
+ "value": "开放合作助力产业升级。开放合作助力产业升级。开放合作助力产业升级。开放合作助力产业升级。开放合作助力产业升级。开放合作助力产业升级。开放合作助力产业升级。开放合作助力产业升级。"
+ },
+ {
+ "name": "news_4_content",
+ "value": "xx社区中秋节发放福利,抓紧领取,时间仅剩3天。xx社区中秋节发放福利,抓紧领取,时间仅剩3天。xx社区中秋节发放福利,抓紧领取,时间仅剩3天。xx社区中秋节发放福利,抓紧领取,时间仅剩3天。xx社区中秋节发放福利,抓紧领取,时间仅剩3天。xx社区中秋节发放福利,抓紧领取,时间仅剩3天。xx社区中秋节发放福利,抓紧领取,时间仅剩3天。xx社区中秋节发放福利,抓紧领取,时间仅剩3天。xx社区中秋节发放福利,抓紧领取,时间仅剩3天。"
+ },
+ {
+ "name": "news_5_content",
+ "value": "xx商场大促销!xx商场大促销!xx商场大促销!xx商场大促销!xx商场大促销!xx商场大促销!xx商场大促销!xx商场大促销!xx商场大促销!xx商场大促销!"
+ },
+ {
+ "name": "news_6_content",
+ "value": "计算机行业的未来十年:前途堪忧?未来可期?辩证分析。计算机行业的未来十年:前途堪忧?未来可期?辩证分析。计算机行业的未来十年:前途堪忧?未来可期?辩证分析。计算机行业的未来十年:前途堪忧?未来可期?辩证分析。计算机行业的未来十年:前途堪忧?未来可期?辩证分析。计算机行业的未来十年:前途堪忧?未来可期?辩证分析。计算机行业的未来十年:前途堪忧?未来可期?辩证分析。计算机行业的未来十年:前途堪忧?未来可期?辩证分析。计算机行业的未来十年:前途堪忧?未来可期?辩证分析。计算机行业的未来十年:前途堪忧?未来可期?辩证分析。"
+ },
+ {
+ "name": "news_7_content",
+ "value": "全市篮球大赛火热举行中,前三名奖励丰厚,快来邀请小伙伴一同参赛。全市篮球大赛火热举行中,前三名奖励丰厚,快来邀请小伙伴一同参赛。全市篮球大赛火热举行中,前三名奖励丰厚,快来邀请小伙伴一同参赛。全市篮球大赛火热举行中,前三名奖励丰厚,快来邀请小伙伴一同参赛。"
+ },
+ {
+ "name": "news_8_content",
+ "value": "企业数据中心大升级。企业数据中心大升级。企业数据中心大升级。企业数据中心大升级。企业数据中心大升级。"
+ },
+ {
+ "name": "news_9_content",
+ "value": "一根光纤点亮绿色智能房间。一根光纤点亮绿色智能房间。一根光纤点亮绿色智能房间。一根光纤点亮绿色智能房间。一根光纤点亮绿色智能房间。"
+ },
+ {
+ "name": "news_10_content",
+ "value": "男女差异,光棍节你如何度过?男女差异,光棍节你如何度过?男女差异,光棍节你如何度过?男女差异,光棍节你如何度过?男女差异,光棍节你如何度过?男女差异,光棍节你如何度过?男女差异,光棍节你如何度过?男女差异,光棍节你如何度过?"
+ },
+ {
+ "name": "news_11_content",
+ "value": "信任技术,拥抱开放,分享技术。信任技术,拥抱开放,分享技术。信任技术,拥抱开放,分享技术。"
+ },
+ {
+ "name": "news_12_content",
+ "value": "运输效率高低对居民生活节奏带来什么样的影响?运输效率高低对居民生活节奏带来什么样的影响?运输效率高低对居民生活节奏带来什么样的影响?运输效率高低对居民生活节奏带来什么样的影响?运输效率高低对居民生活节奏带来什么样的影响?运输效率高低对居民生活节奏带来什么样的影响?运输效率高低对居民生活节奏带来什么样的影响?运输效率高低对居民生活节奏带来什么样的影响?运输效率高低对居民生活节奏带来什么样的影响?"
+ },
+ {
+ "name": "news_13_content",
+ "value": "企业高层介入,收入增长提速。企业高层介入,收入增长提速。企业高层介入,收入增长提速。企业高层介入,收入增长提速。企业高层介入,收入增长提速。企业高层介入,收入增长提速。"
+ },
+ {
+ "name": "news_14_content",
+ "value": "下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。下跌! 11月CPI公布! 这些东西很便宜。"
+ },
+ {
+ "name": "news_15_content",
+ "value": "春节电影定档贺岁!春节电影定档贺岁!春节电影定档贺岁!春节电影定档贺岁!春节电影定档贺岁!春节电影定档贺岁!春节电影定档贺岁!"
+ },
+ {
+ "name": "news_16_content",
+ "value": "三只聪明的生物。三只聪明的生物。三只聪明的生物。"
+ },
+ {
+ "name": "news_17_content",
+ "value": "实现自身价值,挖掘自身潜能,努力为社会做出贡献!"
+ },
+ {
+ "name": "news_18_content",
+ "value": "xx小学植树节开展植树活动,家长同学齐参与。xx小学植树节开展植树活动,家长同学齐参与。xx小学植树节开展植树活动,家长同学齐参与。"
+ },
+ {
+ "name": "news_19_content",
+ "value": "大扫除!!!大扫除!!!大扫除!!!大扫除!!!大扫除!!!"
+ },
+ {
+ "name": "tabs_all",
+ "value": "全部"
+ },
+ {
+ "name": "tabs_health",
+ "value": "健康"
+ },
+ {
+ "name": "tabs_finance",
+ "value": "金融"
+ },
+ {
+ "name": "tabs_technology",
+ "value": "科技"
+ },
+ {
+ "name": "tabs_sports",
+ "value": "运动"
+ },
+ {
+ "name": "tabs_internet",
+ "value": "网络"
+ },
+ {
+ "name": "tabs_game",
+ "value": "游戏"
+ },
+ {
+ "name": "dependency_reason_1",
+ "value": "提供分布式设备管理能力"
+ },
+ {
+ "name": "dependency_reason_2",
+ "value": "提供多端协同跨设备启动应用能力"
+ },
+ {
+ "name": "no_device_manager",
+ "value": "deviceManager尚未初始化。"
+ },
+ {
+ "name": "get_trusted_device_list_failed",
+ "value": "获取信任设备列表失败。"
+ },
+ {
+ "name": "start_ability_continuation_error",
+ "value": "跨设备启动应用失败"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/figures/distributedNews.gif b/Distributed/DistributedNewsClient/figures/distributedNews.gif
new file mode 100644
index 0000000000000000000000000000000000000000..21dbf4ec5042e2fea0f54d2f51899f31f2d19d7b
Binary files /dev/null and b/Distributed/DistributedNewsClient/figures/distributedNews.gif differ
diff --git a/Distributed/DistributedNewsClient/figures/homePage1.png b/Distributed/DistributedNewsClient/figures/homePage1.png
new file mode 100644
index 0000000000000000000000000000000000000000..2d86d551509121f95b0ae3e30365cd6c8497783f
Binary files /dev/null and b/Distributed/DistributedNewsClient/figures/homePage1.png differ
diff --git a/Distributed/DistributedNewsClient/figures/homePage2.png b/Distributed/DistributedNewsClient/figures/homePage2.png
new file mode 100644
index 0000000000000000000000000000000000000000..70470a3f74aed35aae38a65ed7b5abdd3577e070
Binary files /dev/null and b/Distributed/DistributedNewsClient/figures/homePage2.png differ
diff --git a/Distributed/DistributedNewsClient/figures/homePage3.png b/Distributed/DistributedNewsClient/figures/homePage3.png
new file mode 100644
index 0000000000000000000000000000000000000000..6ce269475747cebd9615d472b661071882c88432
Binary files /dev/null and b/Distributed/DistributedNewsClient/figures/homePage3.png differ
diff --git a/Distributed/DistributedNewsClient/figures/summarize.gif b/Distributed/DistributedNewsClient/figures/summarize.gif
new file mode 100644
index 0000000000000000000000000000000000000000..0d4a2fc153a9ae074efdb8d8f7579ad73501a98c
Binary files /dev/null and b/Distributed/DistributedNewsClient/figures/summarize.gif differ
diff --git a/Distributed/DistributedNewsClient/figures/systemVersion.png b/Distributed/DistributedNewsClient/figures/systemVersion.png
new file mode 100644
index 0000000000000000000000000000000000000000..5f5952c218ac04352c724c51093072329037fe42
Binary files /dev/null and b/Distributed/DistributedNewsClient/figures/systemVersion.png differ
diff --git a/Distributed/DistributedNewsClient/hvigor/hvigor-config.json5 b/Distributed/DistributedNewsClient/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..28f85c1467c07bcebd848b16b46348ffc6761057
--- /dev/null
+++ b/Distributed/DistributedNewsClient/hvigor/hvigor-config.json5
@@ -0,0 +1,6 @@
+{
+ "hvigorVersion": "2.3.0",
+ "dependencies": {
+ "@ohos/hvigor-ohos-plugin": "2.3.0"
+ }
+}
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/hvigor/hvigor-wrapper.js b/Distributed/DistributedNewsClient/hvigor/hvigor-wrapper.js
new file mode 100644
index 0000000000000000000000000000000000000000..994f22987bd0739b9faa07c966b066c2d9218602
--- /dev/null
+++ b/Distributed/DistributedNewsClient/hvigor/hvigor-wrapper.js
@@ -0,0 +1,2 @@
+"use strict";var e=require("fs"),t=require("path"),n=require("os"),r=require("crypto"),u=require("child_process"),o=require("constants"),i=require("stream"),s=require("util"),c=require("assert"),a=require("tty"),l=require("zlib"),f=require("net");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var D=d(e),p=d(t),E=d(n),m=d(r),h=d(u),y=d(o),C=d(i),F=d(s),g=d(c),A=d(a),v=d(l),S=d(f),w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},O={},b={},_={},B=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_,"__esModule",{value:!0}),_.isMac=_.isLinux=_.isWindows=void 0;const P=B(E.default),k="Windows_NT",x="Linux",N="Darwin";_.isWindows=function(){return P.default.type()===k},_.isLinux=function(){return P.default.type()===x},_.isMac=function(){return P.default.type()===N};var I={},T=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),R=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),M=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&T(t,e,n);return R(t,e),t};Object.defineProperty(I,"__esModule",{value:!0}),I.hash=void 0;const L=M(m.default);I.hash=function(e,t="md5"){return L.createHash(t).update(e,"utf-8").digest("hex")},function(e){var t=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var u in e)"default"!==u&&Object.prototype.hasOwnProperty.call(e,u)&&t(r,e,u);return n(r,e),r};Object.defineProperty(e,"__esModule",{value:!0}),e.HVIGOR_BOOT_JS_FILE_PATH=e.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=e.HVIGOR_PROJECT_DEPENDENCIES_HOME=e.HVIGOR_PROJECT_WRAPPER_HOME=e.HVIGOR_PROJECT_NAME=e.HVIGOR_PROJECT_ROOT_DIR=e.HVIGOR_PROJECT_CACHES_HOME=e.HVIGOR_PNPM_STORE_PATH=e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=e.HVIGOR_WRAPPER_TOOLS_HOME=e.HVIGOR_USER_HOME=e.DEFAULT_PACKAGE_JSON=e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=e.PNPM=e.HVIGOR=e.NPM_TOOL=e.PNPM_TOOL=e.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const u=r(p.default),o=r(E.default),i=_,s=I;e.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",e.PNPM_TOOL=(0,i.isWindows)()?"pnpm.cmd":"pnpm",e.NPM_TOOL=(0,i.isWindows)()?"npm.cmd":"npm",e.HVIGOR="hvigor",e.PNPM="pnpm",e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",e.DEFAULT_PACKAGE_JSON="package.json",e.HVIGOR_USER_HOME=u.resolve(o.homedir(),".hvigor"),e.HVIGOR_WRAPPER_TOOLS_HOME=u.resolve(e.HVIGOR_USER_HOME,"wrapper","tools"),e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=u.resolve(e.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",e.PNPM_TOOL),e.HVIGOR_PNPM_STORE_PATH=u.resolve(e.HVIGOR_USER_HOME,"caches"),e.HVIGOR_PROJECT_CACHES_HOME=u.resolve(e.HVIGOR_USER_HOME,"project_caches"),e.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),e.HVIGOR_PROJECT_NAME=u.basename((0,s.hash)(e.HVIGOR_PROJECT_ROOT_DIR)),e.HVIGOR_PROJECT_WRAPPER_HOME=u.resolve(e.HVIGOR_PROJECT_ROOT_DIR,e.HVIGOR),e.HVIGOR_PROJECT_DEPENDENCIES_HOME=u.resolve(e.HVIGOR_PROJECT_CACHES_HOME,e.HVIGOR_PROJECT_NAME,"workspace"),e.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=u.resolve(e.HVIGOR_PROJECT_DEPENDENCIES_HOME,e.DEFAULT_PACKAGE_JSON),e.HVIGOR_BOOT_JS_FILE_PATH=u.resolve(e.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js")}(b);var j={},$={};Object.defineProperty($,"__esModule",{value:!0}),$.logInfoPrintConsole=$.logErrorAndExit=void 0,$.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},$.logInfoPrintConsole=function(e){console.log(e)};var H=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),J=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),G=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&H(t,e,n);return J(t,e),t},V=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0}),j.isFileExists=j.offlinePluginConversion=j.executeCommand=j.getNpmPath=j.hasNpmPackInPaths=void 0;const U=h.default,W=G(p.default),z=b,K=$,q=V(D.default);j.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},j.getNpmPath=function(){const e=process.execPath;return W.join(W.dirname(e),z.NPM_TOOL)},j.executeCommand=function(e,t,n){0!==(0,U.spawnSync)(e,t,n).status&&(0,K.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},j.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?W.resolve(e,z.HVIGOR,t.replace("file:","")):t},j.isFileExists=function(e){return q.default.existsSync(e)&&q.default.statSync(e).isFile()},function(e){var t=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var u in e)"default"!==u&&Object.prototype.hasOwnProperty.call(e,u)&&t(r,e,u);return n(r,e),r},u=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.executeInstallPnpm=e.isPnpmAvailable=e.environmentHandler=e.checkNpmConifg=e.PNPM_VERSION=void 0;const o=r(D.default),i=b,s=j,c=r(p.default),a=$,l=h.default,f=u(E.default);e.PNPM_VERSION="7.30.0",e.checkNpmConifg=function(){const e=c.resolve(i.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=c.resolve(f.default.homedir(),".npmrc");if((0,s.isFileExists)(e)||(0,s.isFileExists)(t))return;const n=(0,s.getNpmPath)(),r=(0,l.spawnSync)(n,["config","get","prefix"],{cwd:i.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,a.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=c.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,s.isFileExists)(u)||(0,a.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},e.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},e.isPnpmAvailable=function(){return!!o.existsSync(i.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,s.hasNpmPackInPaths)("pnpm",[i.HVIGOR_WRAPPER_TOOLS_HOME])},e.executeInstallPnpm=function(){(0,a.logInfoPrintConsole)(`Installing pnpm@${e.PNPM_VERSION}...`);const t=(0,s.getNpmPath)();!function(){const t=c.resolve(i.HVIGOR_WRAPPER_TOOLS_HOME,i.DEFAULT_PACKAGE_JSON);try{o.existsSync(i.HVIGOR_WRAPPER_TOOLS_HOME)||o.mkdirSync(i.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const n={dependencies:{}};n.dependencies[i.PNPM]=e.PNPM_VERSION,o.writeFileSync(t,JSON.stringify(n))}catch(e){(0,a.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${t} failed.`)}}(),(0,s.executeCommand)(t,["install","pnpm"],{cwd:i.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,a.logInfoPrintConsole)("Pnpm install success.")}}(O);var Y={},X={},Z={},Q={};Object.defineProperty(Q,"__esModule",{value:!0}),Q.Unicode=void 0;class ee{}Q.Unicode=ee,ee.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ee.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ee.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Z,"__esModule",{value:!0}),Z.JudgeUtil=void 0;const te=Q;Z.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&te.Unicode.Space_Separator.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||te.Unicode.ID_Start.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||""===e||""===e||te.Unicode.ID_Continue.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ne={},re={fromCallback:function(e){return Object.defineProperty((function(...t){if("function"!=typeof t[t.length-1])return new Promise(((n,r)=>{e.call(this,...t,((e,t)=>null!=e?r(e):n(t)))}));e.apply(this,t)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(...t){const n=t[t.length-1];if("function"!=typeof n)return e.apply(this,t);e.apply(this,t.slice(0,-1)).then((e=>n(null,e)),n)}),"name",{value:e.name})}},ue=y.default,oe=process.cwd,ie=null,se=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ie||(ie=oe.call(process)),ie};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var ce=process.chdir;process.chdir=function(e){ie=null,ce.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ce)}var ae=function(e){ue.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,ue.O_WRONLY|ue.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,ue.O_WRONLY|ue.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){ue.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,ue.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,ue.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===se&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,d){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var le=C.default.Stream,fe=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);le.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);le.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var de=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:De(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},De=Object.getPrototypeOf||function(e){return e.__proto__};var pe,Ee,me=D.default,he=ae,ye=fe,Ce=de,Fe=F.default;function ge(e,t){Object.defineProperty(e,pe,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(pe=Symbol.for("graceful-fs.queue"),Ee=Symbol.for("graceful-fs.previous")):(pe="___graceful-fs.queue",Ee="___graceful-fs.previous");var Ae=function(){};if(Fe.debuglog?Ae=Fe.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ae=function(){var e=Fe.format.apply(Fe,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!me[pe]){var ve=w[pe]||[];ge(me,ve),me.close=function(e){function t(t,n){return e.call(me,t,(function(e){e||_e(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,Ee,{value:e}),t}(me.close),me.closeSync=function(e){function t(t){e.apply(me,arguments),_e()}return Object.defineProperty(t,Ee,{value:e}),t}(me.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){Ae(me[pe]),g.default.equal(me[pe].length,0)}))}w[pe]||ge(w,me[pe]);var Se,we=Oe(Ce(me));function Oe(e){he(e),e.gracefulify=Oe,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):be([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):be([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=ye(e);d=s.ReadStream,D=s.WriteStream}var c=e.ReadStream;c&&(d.prototype=Object.create(c.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(D.prototype=Object.create(a.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0});var l=d;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=D;function d(e,t){return this instanceof d?(c.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}function D(e,t){return this instanceof D?(a.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):be([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function be(e){Ae("ENQUEUE",e[0].name,e[1]),me[pe].push(e),Be()}function _e(){for(var e=Date.now(),t=0;t2&&(me[pe][t][3]=e,me[pe][t][4]=e);Be()}function Be(){if(clearTimeout(Se),Se=void 0,0!==me[pe].length){var e=me[pe].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)Ae("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){Ae("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(Ae("RETRY",t.name,n),t.apply(null,n.concat([u]))):me[pe].push(e)}void 0===Se&&(Se=setTimeout(Be,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!me.__patched&&(we=Oe(me),me.__patched=!0),function(e){const t=re.fromCallback,n=we,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.assign(e,n),r.forEach((r=>{e[r]=t(n[r])})),e.realpath.native=t(n.realpath.native),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.writev&&(e.writev=function(e,t,...r){return"function"==typeof r[r.length-1]?n.writev(e,t,...r):new Promise(((u,o)=>{n.writev(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffers:n})}))}))})}(ne);var Pe={},ke={};const xe=p.default;ke.checkPath=function(e){if("win32"===process.platform){if(/[<>:"|?*]/.test(e.replace(xe.parse(e).root,""))){const t=new Error(`Path contains invalid characters: ${e}`);throw t.code="EINVAL",t}}};const Ne=ne,{checkPath:Ie}=ke,Te=e=>"number"==typeof e?e:{mode:511,...e}.mode;Pe.makeDir=async(e,t)=>(Ie(e),Ne.mkdir(e,{mode:Te(t),recursive:!0})),Pe.makeDirSync=(e,t)=>(Ie(e),Ne.mkdirSync(e,{mode:Te(t),recursive:!0}));const Re=re.fromPromise,{makeDir:Me,makeDirSync:Le}=Pe,je=Re(Me);var $e={mkdirs:je,mkdirsSync:Le,mkdirp:je,mkdirpSync:Le,ensureDir:je,ensureDirSync:Le};const He=re.fromPromise,Je=ne;var Ge={pathExists:He((function(e){return Je.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:Je.existsSync};const Ve=we;var Ue=function(e,t,n,r){Ve.open(e,"r+",((e,u)=>{if(e)return r(e);Ve.futimes(u,t,n,(e=>{Ve.close(u,(t=>{r&&r(e||t)}))}))}))},We=function(e,t,n){const r=Ve.openSync(e,"r+");return Ve.futimesSync(r,t,n),Ve.closeSync(r)};const ze=ne,Ke=p.default,qe=F.default;function Ye(e,t,n){const r=n.dereference?e=>ze.stat(e,{bigint:!0}):e=>ze.lstat(e,{bigint:!0});return Promise.all([r(e),r(t).catch((e=>{if("ENOENT"===e.code)return null;throw e}))]).then((([e,t])=>({srcStat:e,destStat:t})))}function Xe(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function Ze(e,t){const n=Ke.resolve(e).split(Ke.sep).filter((e=>e)),r=Ke.resolve(t).split(Ke.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Qe(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var et={checkPaths:function(e,t,n,r,u){qe.callbackify(Ye)(e,t,r,((r,o)=>{if(r)return u(r);const{srcStat:i,destStat:s}=o;if(s){if(Xe(i,s)){const r=Ke.basename(e),o=Ke.basename(t);return"move"===n&&r!==o&&r.toLowerCase()===o.toLowerCase()?u(null,{srcStat:i,destStat:s,isChangingCase:!0}):u(new Error("Source and destination must not be the same."))}if(i.isDirectory()&&!s.isDirectory())return u(new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`));if(!i.isDirectory()&&s.isDirectory())return u(new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`))}return i.isDirectory()&&Ze(e,t)?u(new Error(Qe(e,t,n))):u(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n,r){const{srcStat:u,destStat:o}=function(e,t,n){let r;const u=n.dereference?e=>ze.statSync(e,{bigint:!0}):e=>ze.lstatSync(e,{bigint:!0}),o=u(e);try{r=u(t)}catch(e){if("ENOENT"===e.code)return{srcStat:o,destStat:null};throw e}return{srcStat:o,destStat:r}}(e,t,r);if(o){if(Xe(u,o)){const r=Ke.basename(e),i=Ke.basename(t);if("move"===n&&r!==i&&r.toLowerCase()===i.toLowerCase())return{srcStat:u,destStat:o,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(u.isDirectory()&&!o.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!u.isDirectory()&&o.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(u.isDirectory()&&Ze(e,t))throw new Error(Qe(e,t,n));return{srcStat:u,destStat:o}},checkParentPaths:function e(t,n,r,u,o){const i=Ke.resolve(Ke.dirname(t)),s=Ke.resolve(Ke.dirname(r));if(s===i||s===Ke.parse(s).root)return o();ze.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):Xe(n,c)?o(new Error(Qe(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=Ke.resolve(Ke.dirname(t)),i=Ke.resolve(Ke.dirname(r));if(i===o||i===Ke.parse(i).root)return;let s;try{s=ze.statSync(i,{bigint:!0})}catch(e){if("ENOENT"===e.code)return;throw e}if(Xe(n,s))throw new Error(Qe(t,r,u));return e(t,n,i,u)},isSrcSubdir:Ze,areIdentical:Xe};const tt=we,nt=p.default,rt=$e.mkdirs,ut=Ge.pathExists,ot=Ue,it=et;function st(e,t,n,r,u){const o=nt.dirname(n);ut(o,((i,s)=>i?u(i):s?at(e,t,n,r,u):void rt(o,(o=>o?u(o):at(e,t,n,r,u)))))}function ct(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function at(e,t,n,r,u){(r.dereference?tt.stat:tt.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){return t?Dt(n,r,u,o):function(e,t,n,r,u){tt.mkdir(n,(o=>{if(o)return u(o);Dt(t,n,r,(t=>t?u(t):dt(n,e,u)))}))}(e.mode,n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();tt.unlink(n,(o=>o?u(o):lt(e,t,n,r,u)))}(e,n,r,u,o):lt(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){tt.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=nt.resolve(process.cwd(),o)),e?void tt.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?tt.symlink(o,n,u):u(t):(r.dereference&&(i=nt.resolve(process.cwd(),i)),it.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&it.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){tt.unlink(t,(r=>r?n(r):tt.symlink(e,t,n)))}(o,n,u)))):tt.symlink(o,n,u))))}(e,t,n,r,u):i.isSocket()?u(new Error(`Cannot copy a socket file: ${t}`)):i.isFIFO()?u(new Error(`Cannot copy a FIFO pipe: ${t}`)):u(new Error(`Unknown file: ${t}`))))}function lt(e,t,n,r,u){tt.copyFile(t,n,(o=>o?u(o):r.preserveTimestamps?function(e,t,n,r){if(function(e){return 0==(128&e)}(e))return function(e,t,n){return dt(e,128|t,n)}(n,e,(u=>u?r(u):ft(e,t,n,r)));return ft(e,t,n,r)}(e.mode,t,n,u):dt(n,e.mode,u)))}function ft(e,t,n,r){!function(e,t,n){tt.stat(e,((e,r)=>e?n(e):ot(t,r.atime,r.mtime,n)))}(t,n,(t=>t?r(t):dt(n,e,r)))}function dt(e,t,n){return tt.chmod(e,t,n)}function Dt(e,t,n,r){tt.readdir(e,((u,o)=>u?r(u):pt(o,e,t,n,r)))}function pt(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=nt.join(n,t),s=nt.join(r,t);it.checkPaths(i,s,"copy",u,((t,c)=>{if(t)return o(t);const{destStat:a}=c;!function(e,t,n,r,u){r.filter?ct(at,e,t,n,r,u):at(e,t,n,r,u)}(a,i,s,u,(t=>t?o(t):pt(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var Et=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),it.checkPaths(e,t,"copy",n,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;it.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?ct(st,s,e,t,n,r):st(s,e,t,n,r)))}))};const mt=we,ht=p.default,yt=$e.mkdirsSync,Ct=We,Ft=et;function gt(e,t,n,r){const u=(r.dereference?mt.statSync:mt.lstatSync)(t);if(u.isDirectory())return function(e,t,n,r,u){return t?St(n,r,u):function(e,t,n,r){return mt.mkdirSync(n),St(t,n,r),vt(n,e)}(e.mode,n,r,u)}(u,e,t,n,r);if(u.isFile()||u.isCharacterDevice()||u.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return mt.unlinkSync(n),At(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):At(e,n,r,u)}(u,e,t,n,r);if(u.isSymbolicLink())return function(e,t,n,r){let u=mt.readlinkSync(t);r.dereference&&(u=ht.resolve(process.cwd(),u));if(e){let e;try{e=mt.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return mt.symlinkSync(u,n);throw e}if(r.dereference&&(e=ht.resolve(process.cwd(),e)),Ft.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(mt.statSync(n).isDirectory()&&Ft.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return mt.unlinkSync(t),mt.symlinkSync(e,t)}(u,n)}return mt.symlinkSync(u,n)}(e,t,n,r);if(u.isSocket())throw new Error(`Cannot copy a socket file: ${t}`);if(u.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${t}`);throw new Error(`Unknown file: ${t}`)}function At(e,t,n,r){return mt.copyFileSync(t,n),r.preserveTimestamps&&function(e,t,n){(function(e){return 0==(128&e)})(e)&&function(e,t){vt(e,128|t)}(n,e);(function(e,t){const n=mt.statSync(e);Ct(t,n.atime,n.mtime)})(t,n)}(e.mode,t,n),vt(n,e.mode)}function vt(e,t){return mt.chmodSync(e,t)}function St(e,t,n){mt.readdirSync(e).forEach((r=>function(e,t,n,r){const u=ht.join(t,e),o=ht.join(n,e),{destStat:i}=Ft.checkPathsSync(u,o,"copy",r);return function(e,t,n,r){if(!r.filter||r.filter(t,n))return gt(e,t,n,r)}(i,u,o,r)}(r,e,t,n)))}var wt=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=Ft.checkPathsSync(e,t,"copy",n);return Ft.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=ht.dirname(n);mt.existsSync(u)||yt(u);return gt(e,t,n,r)}(u,e,t,n)};var Ot={copy:(0,re.fromCallback)(Et),copySync:wt};const bt=we,_t=p.default,Bt=g.default,Pt="win32"===process.platform;function kt(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||bt[t],e[t+="Sync"]=e[t]||bt[t]})),e.maxBusyTries=e.maxBusyTries||3}function xt(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),Bt(e,"rimraf: missing path"),Bt.strictEqual(typeof e,"string","rimraf: path should be a string"),Bt.strictEqual(typeof n,"function","rimraf: callback function required"),Bt(t,"rimraf: invalid options argument provided"),Bt.strictEqual(typeof t,"object","rimraf: options should be object"),kt(t),Nt(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rNt(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Nt(e,t,n){Bt(e),Bt(t),Bt("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&Pt?It(e,t,r,n):u&&u.isDirectory()?Rt(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return Pt?It(e,t,r,n):Rt(e,t,r,n);if("EISDIR"===r.code)return Rt(e,t,r,n)}return n(r)}))))}function It(e,t,n,r){Bt(e),Bt(t),Bt("function"==typeof r),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Rt(e,t,n,r):t.unlink(e,r)}))}))}function Tt(e,t,n){let r;Bt(e),Bt(t);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Lt(e,t,n):t.unlinkSync(e)}function Rt(e,t,n,r){Bt(e),Bt(t),Bt("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){Bt(e),Bt(t),Bt("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{xt(_t.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function Mt(e,t){let n;kt(t=t||{}),Bt(e,"rimraf: missing path"),Bt.strictEqual(typeof e,"string","rimraf: path should be a string"),Bt(t,"rimraf: missing options"),Bt.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&Pt&&Tt(e,t,n)}try{n&&n.isDirectory()?Lt(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return Pt?Tt(e,t,n):Lt(e,t,n);if("EISDIR"!==n.code)throw n;Lt(e,t,n)}}function Lt(e,t,n){Bt(e),Bt(t);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(Bt(e),Bt(t),t.readdirSync(e).forEach((n=>Mt(_t.join(e,n),t))),!Pt){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch{}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var jt=xt;xt.sync=Mt;const $t=we,Ht=re.fromCallback,Jt=jt;var Gt={remove:Ht((function(e,t){if($t.rm)return $t.rm(e,{recursive:!0,force:!0},t);Jt(e,t)})),removeSync:function(e){if($t.rmSync)return $t.rmSync(e,{recursive:!0,force:!0});Jt.sync(e)}};const Vt=re.fromPromise,Ut=ne,Wt=p.default,zt=$e,Kt=Gt,qt=Vt((async function(e){let t;try{t=await Ut.readdir(e)}catch{return zt.mkdirs(e)}return Promise.all(t.map((t=>Kt.remove(Wt.join(e,t)))))}));function Yt(e){let t;try{t=Ut.readdirSync(e)}catch{return zt.mkdirsSync(e)}t.forEach((t=>{t=Wt.join(e,t),Kt.removeSync(t)}))}var Xt={emptyDirSync:Yt,emptydirSync:Yt,emptyDir:qt,emptydir:qt};const Zt=re.fromCallback,Qt=p.default,en=we,tn=$e;var nn={createFile:Zt((function(e,t){function n(){en.writeFile(e,"",(e=>{if(e)return t(e);t()}))}en.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Qt.dirname(e);en.stat(o,((e,r)=>{if(e)return"ENOENT"===e.code?tn.mkdirs(o,(e=>{if(e)return t(e);n()})):t(e);r.isDirectory()?n():en.readdir(o,(e=>{if(e)return t(e)}))}))}))})),createFileSync:function(e){let t;try{t=en.statSync(e)}catch{}if(t&&t.isFile())return;const n=Qt.dirname(e);try{en.statSync(n).isDirectory()||en.readdirSync(n)}catch(e){if(!e||"ENOENT"!==e.code)throw e;tn.mkdirsSync(n)}en.writeFileSync(e,"")}};const rn=re.fromCallback,un=p.default,on=we,sn=$e,cn=Ge.pathExists,{areIdentical:an}=et;var ln={createLink:rn((function(e,t,n){function r(e,t){on.link(e,t,(e=>{if(e)return n(e);n(null)}))}on.lstat(t,((u,o)=>{on.lstat(e,((u,i)=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);if(o&&an(i,o))return n(null);const s=un.dirname(t);cn(s,((u,o)=>u?n(u):o?r(e,t):void sn.mkdirs(s,(u=>{if(u)return n(u);r(e,t)}))))}))}))})),createLinkSync:function(e,t){let n;try{n=on.lstatSync(t)}catch{}try{const t=on.lstatSync(e);if(n&&an(t,n))return}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const r=un.dirname(t);return on.existsSync(r)||sn.mkdirsSync(r),on.linkSync(e,t)}};const fn=p.default,dn=we,Dn=Ge.pathExists;var pn={symlinkPaths:function(e,t,n){if(fn.isAbsolute(e))return dn.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=fn.dirname(t),u=fn.join(r,e);return Dn(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):dn.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:fn.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(fn.isAbsolute(e)){if(n=dn.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=fn.dirname(t),u=fn.join(r,e);if(n=dn.existsSync(u),n)return{toCwd:u,toDst:e};if(n=dn.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:fn.relative(r,e)}}}};const En=we;var mn={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);En.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=En.lstatSync(e)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}};const hn=re.fromCallback,yn=p.default,Cn=ne,Fn=$e.mkdirs,gn=$e.mkdirsSync,An=pn.symlinkPaths,vn=pn.symlinkPathsSync,Sn=mn.symlinkType,wn=mn.symlinkTypeSync,On=Ge.pathExists,{areIdentical:bn}=et;function _n(e,t,n,r){An(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,Sn(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=yn.dirname(t);On(o,((n,i)=>n?r(n):i?Cn.symlink(e,t,u,r):void Fn(o,(n=>{if(n)return r(n);Cn.symlink(e,t,u,r)}))))}))}))}var Bn={createSymlink:hn((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Cn.lstat(t,((u,o)=>{!u&&o.isSymbolicLink()?Promise.all([Cn.stat(e),Cn.stat(t)]).then((([u,o])=>{if(bn(u,o))return r(null);_n(e,t,n,r)})):_n(e,t,n,r)}))})),createSymlinkSync:function(e,t,n){let r;try{r=Cn.lstatSync(t)}catch{}if(r&&r.isSymbolicLink()){const n=Cn.statSync(e),r=Cn.statSync(t);if(bn(n,r))return}const u=vn(e,t);e=u.toDst,n=wn(u.toCwd,n);const o=yn.dirname(t);return Cn.existsSync(o)||gn(o),Cn.symlinkSync(e,t,n)}};const{createFile:Pn,createFileSync:kn}=nn,{createLink:xn,createLinkSync:Nn}=ln,{createSymlink:In,createSymlinkSync:Tn}=Bn;var Rn={createFile:Pn,createFileSync:kn,ensureFile:Pn,ensureFileSync:kn,createLink:xn,createLinkSync:Nn,ensureLink:xn,ensureLinkSync:Nn,createSymlink:In,createSymlinkSync:Tn,ensureSymlink:In,ensureSymlinkSync:Tn};var Mn={stringify:function(e,{EOL:t="\n",finalEOL:n=!0,replacer:r=null,spaces:u}={}){const o=n?t:"";return JSON.stringify(e,r,u).replace(/\n/g,t)+o},stripBom:function(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}};let Ln;try{Ln=we}catch(e){Ln=D.default}const jn=re,{stringify:$n,stripBom:Hn}=Mn;const Jn=jn.fromPromise((async function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ln,r=!("throws"in t)||t.throws;let u,o=await jn.fromCallback(n.readFile)(e,t);o=Hn(o);try{u=JSON.parse(o,t?t.reviver:null)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}return u}));const Gn=jn.fromPromise((async function(e,t,n={}){const r=n.fs||Ln,u=$n(t,n);await jn.fromCallback(r.writeFile)(e,u,n)}));const Vn={readFile:Jn,readFileSync:function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ln,r=!("throws"in t)||t.throws;try{let r=n.readFileSync(e,t);return r=Hn(r),JSON.parse(r,t.reviver)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}},writeFile:Gn,writeFileSync:function(e,t,n={}){const r=n.fs||Ln,u=$n(t,n);return r.writeFileSync(e,u,n)}};var Un={readJson:Vn.readFile,readJsonSync:Vn.readFileSync,writeJson:Vn.writeFile,writeJsonSync:Vn.writeFileSync};const Wn=re.fromCallback,zn=we,Kn=p.default,qn=$e,Yn=Ge.pathExists;var Xn={outputFile:Wn((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Kn.dirname(e);Yn(u,((o,i)=>o?r(o):i?zn.writeFile(e,t,n,r):void qn.mkdirs(u,(u=>{if(u)return r(u);zn.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Kn.dirname(e);if(zn.existsSync(n))return zn.writeFileSync(e,...t);qn.mkdirsSync(n),zn.writeFileSync(e,...t)}};const{stringify:Zn}=Mn,{outputFile:Qn}=Xn;var er=async function(e,t,n={}){const r=Zn(t,n);await Qn(e,r,n)};const{stringify:tr}=Mn,{outputFileSync:nr}=Xn;var rr=function(e,t,n){const r=tr(t,n);nr(e,r,n)};const ur=re.fromPromise,or=Un;or.outputJson=ur(er),or.outputJsonSync=rr,or.outputJSON=or.outputJson,or.outputJSONSync=or.outputJsonSync,or.writeJSON=or.writeJson,or.writeJSONSync=or.writeJsonSync,or.readJSON=or.readJson,or.readJSONSync=or.readJsonSync;var ir=or;const sr=we,cr=p.default,ar=Ot.copy,lr=Gt.remove,fr=$e.mkdirp,dr=Ge.pathExists,Dr=et;function pr(e,t,n,r,u){return r?Er(e,t,n,u):n?lr(t,(r=>r?u(r):Er(e,t,n,u))):void dr(t,((r,o)=>r?u(r):o?u(new Error("dest already exists.")):Er(e,t,n,u)))}function Er(e,t,n,r){sr.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};ar(e,t,u,(t=>t?r(t):lr(e,r)))}(e,t,n,r):r()))}var mr=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Dr.checkPaths(e,t,"move",n,((n,o)=>{if(n)return r(n);const{srcStat:i,isChangingCase:s=!1}=o;Dr.checkParentPaths(e,i,t,"move",(n=>n?r(n):function(e){const t=cr.dirname(e);return cr.parse(t).root===t}(t)?pr(e,t,u,s,r):void fr(cr.dirname(t),(n=>n?r(n):pr(e,t,u,s,r)))))}))};const hr=we,yr=p.default,Cr=Ot.copySync,Fr=Gt.removeSync,gr=$e.mkdirpSync,Ar=et;function vr(e,t,n){try{hr.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Cr(e,t,r),Fr(e)}(e,t,n)}}var Sr=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u,isChangingCase:o=!1}=Ar.checkPathsSync(e,t,"move",n);return Ar.checkParentPathsSync(e,u,t,"move"),function(e){const t=yr.dirname(e);return yr.parse(t).root===t}(t)||gr(yr.dirname(t)),function(e,t,n,r){if(r)return vr(e,t,n);if(n)return Fr(t),vr(e,t,n);if(hr.existsSync(t))throw new Error("dest already exists.");return vr(e,t,n)}(e,t,r,o)};var wr,Or,br,_r,Br,Pr={move:(0,re.fromCallback)(mr),moveSync:Sr},kr={...ne,...Ot,...Xt,...Rn,...ir,...$e,...Pr,...Xn,...Ge,...Gt},xr={},Nr={exports:{}},Ir={exports:{}};function Tr(){if(Or)return wr;Or=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return wr=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function Rr(){if(_r)return br;return _r=1,br=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=function(){if($r)return jr;$r=1;const e=E.default,t=A.default,n=Vr(),{env:r}=process;let u;function o(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function i(t,o){if(0===u)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(t&&!o&&void 0===u)return 0;const i=u||0;if("dumb"===r.TERM)return i;if("win32"===process.platform){const t=e.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in r))||"codeship"===r.CI_NAME?1:i;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:i}return n("no-color")||n("no-colors")||n("color=false")||n("color=never")?u=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=1),"FORCE_COLOR"in r&&(u="true"===r.FORCE_COLOR?1:"false"===r.FORCE_COLOR?0:0===r.FORCE_COLOR.length?1:Math.min(parseInt(r.FORCE_COLOR,10),3)),jr={supportsColor:function(e){return o(i(e,e&&e.isTTY))},stdout:o(i(!0,t.isatty(1))),stderr:o(i(!0,t.isatty(2)))}}();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=Rr()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Gr,Gr.exports)),Gr.exports}Jr=Nr,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?Jr.exports=(Br||(Br=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Rr()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Ir,Ir.exports)),Ir.exports):Jr.exports=Ur();var Wr=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=zr(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=zr(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,Qr=e=>e&&"object"==typeof e&&!Array.isArray(e),eu=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${Kr.inspect(e,{depth:5})}) - ${n}`)}))};var tu={configure:e=>{qr("New configuration to be validated: ",e),eu(e,Zr(Qr(e)),"must be an object."),qr(`Calling pre-processing listeners (${Yr.length})`),Yr.forEach((t=>t(e))),qr("Configuration pre-processing finished."),qr(`Calling configuration listeners (${Xr.length})`),Xr.forEach((t=>t(e))),qr("Configuration finished.")},addListener:e=>{Xr.push(e),qr(`Added listener, now ${Xr.length} listeners`)},addPreProcessingListener:e=>{Yr.push(e),qr(`Added pre-processing listener, now ${Yr.length} listeners`)},throwExceptionIf:eu,anObject:Qr,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:Zr},nu={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),d=n(u.getSeconds()),D=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,d).replace(/SSS/g,D).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(nu);const ru=nu.exports,uu=E.default,ou=F.default,iu=p.default,su={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function cu(e){return e?`[${su[e][0]}m`:""}function au(e){return e?`[${su[e][1]}m`:""}function lu(e,t){return n=ou.format("[%s] [%s] %s - ",ru.asString(e.startTime),e.level.toString(),e.categoryName),cu(r=t)+n+au(r);var n,r}function fu(e){return lu(e)+ou.format(...e.data)}function du(e){return lu(e,e.level.colour)+ou.format(...e.data)}function Du(e){return ou.format(...e.data)}function pu(e){return e.data[0]}function Eu(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflos%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(iu.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.substr(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.substr(1),10);t.lengthDu,basic:()=>fu,colored:()=>du,coloured:()=>du,pattern:e=>Eu(e&&e.pattern,e&&e.tokens),dummy:()=>pu};var hu={basicLayout:fu,messagePassThroughLayout:Du,patternLayout:Eu,colouredLayout:du,coloredLayout:du,dummyLayout:pu,addLayout(e,t){mu[e]=t},layout:(e,t)=>mu[e]&&mu[e](t)};const yu=tu,Cu=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Fu{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Fu?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Fu[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Fu[n]=new Fu(e[t].value,n,e[t].colour);const r=Fu.levels.findIndex((e=>e.levelStr===n));r>-1?Fu.levels[r]=Fu[n]:Fu.levels.push(Fu[n])})),Fu.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level===e.level}}Fu.levels=[],Fu.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),yu.addListener((e=>{const t=e.levels;if(t){yu.throwExceptionIf(e,yu.not(yu.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{yu.throwExceptionIf(e,yu.not(yu.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),yu.throwExceptionIf(e,yu.not(yu.anObject(t[n])),`level "${n}" must be an object`),yu.throwExceptionIf(e,yu.not(t[n].value),`level "${n}" must have a 'value' property`),yu.throwExceptionIf(e,yu.not(yu.anInteger(t[n].value)),`level "${n}".value must have an integer value`),yu.throwExceptionIf(e,yu.not(t[n].colour),`level "${n}" must have a 'colour' property`),yu.throwExceptionIf(e,yu.not(Cu.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Cu.join(", ")}`)}))}})),yu.addListener((e=>{Fu.addLevels(e.levels)}));var gu=Fu,Au={exports:{}},vu={};/*! (c) 2020 Andrea Giammarchi */
+const{parse:Su,stringify:wu}=JSON,{keys:Ou}=Object,bu=String,_u="string",Bu={},Pu="object",ku=(e,t)=>t,xu=e=>e instanceof bu?bu(e):e,Nu=(e,t)=>typeof t===_u?new bu(t):t,Iu=(e,t,n,r)=>{const u=[];for(let o=Ou(n),{length:i}=o,s=0;s{const r=bu(t.push(n)-1);return e.set(n,r),r},Ru=(e,t)=>{const n=Su(e,Nu).map(xu),r=n[0],u=t||ku,o=typeof r===Pu&&r?Iu(n,new Set,r,u):r;return u.call({"":o},"",o)};vu.parse=Ru;const Mu=(e,t,n)=>{const r=t&&typeof t===Pu?(e,n)=>""===e||-1Su(Mu(e));vu.fromJSON=e=>Ru(wu(e));const Lu=vu,ju=gu;class $u{constructor(e,t,n,r,u){this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,u&&(this.functionName=u.functionName,this.fileName=u.fileName,this.lineNumber=u.lineNumber,this.columnNumber=u.columnNumber,this.callStack=u.callStack)}serialise(){const e=this.data.map((e=>(e&&e.message&&e.stack&&(e=Object.assign({message:e.message,stack:e.stack},e)),e)));return this.data=e,Lu.stringify(this)}static deserialise(e){let t;try{const n=Lu.parse(e);n.data=n.data.map((e=>{if(e&&e.message&&e.stack){const t=new Error(e);Object.keys(e).forEach((n=>{t[n]=e[n]})),e=t}return e})),t=new $u(n.categoryName,ju.getLevel(n.level.levelStr),n.data,n.context),t.startTime=new Date(n.startTime),t.pid=n.pid,t.cluster=n.cluster}catch(n){t=new $u("log4js",ju.ERROR,["Unable to parse log:",e,"because: ",n])}return t}}var Hu=$u;const Ju=Nr.exports("log4js:clustering"),Gu=Hu,Vu=tu;let Uu=!1,Wu=null;try{Wu=require("cluster")}catch(e){Ju("cluster module not present"),Uu=!0}const zu=[];let Ku=!1,qu="NODE_APP_INSTANCE";const Yu=()=>Ku&&"0"===process.env[qu],Xu=()=>Uu||Wu.isMaster||Yu(),Zu=e=>{zu.forEach((t=>t(e)))},Qu=(e,t)=>{if(Ju("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Ju("received message: ",t.data);const e=Gu.deserialise(t.data);Zu(e)}};Uu||Vu.addListener((e=>{zu.length=0,({pm2:Ku,disableClustering:Uu,pm2InstanceVar:qu="NODE_APP_INSTANCE"}=e),Ju(`clustering disabled ? ${Uu}`),Ju(`cluster.isMaster ? ${Wu&&Wu.isMaster}`),Ju(`pm2 enabled ? ${Ku}`),Ju(`pm2InstanceVar = ${qu}`),Ju(`process.env[${qu}] = ${process.env[qu]}`),Ku&&process.removeListener("message",Qu),Wu&&Wu.removeListener&&Wu.removeListener("message",Qu),Uu||e.disableClustering?Ju("Not listening for cluster messages, because clustering disabled."):Yu()?(Ju("listening for PM2 broadcast messages"),process.on("message",Qu)):Wu.isMaster?(Ju("listening for cluster messages"),Wu.on("message",Qu)):Ju("not listening for messages, because we are not a master process")}));var eo={onlyOnMaster:(e,t)=>Xu()?e():t,isMaster:Xu,send:e=>{Xu()?Zu(e):(Ku||(e.cluster={workerId:Wu.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{zu.push(e)}},to={};function no(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.substr(e.length-1).toLocaleUpperCase(),u=e.substring(0,e.length-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function ro(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:no},e)}const uo={file:ro,fileSync:ro};to.modifyConfig=e=>uo[e.type]?uo[e.type](e):e;var oo={};const io=console.log.bind(console);oo.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{io(e(n,t))}}(n,e.timezoneOffset)};var so={};so.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var co={};co.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var ao={};ao.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;t.isGreaterThanOrEqualTo(u)&&t.isLessThanOrEqualTo(o)&&n(e)}}(e.level,e.maxLevel,u,r)};var lo={};const fo=Nr.exports("log4js:categoryFilter");lo.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{fo(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(fo("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var Do={};const po=Nr.exports("log4js:noLogFilter");Do.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{po(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(po("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var Eo={},mo={exports:{}},ho={},yo={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}};!function(e){const t=yo.fromCallback,n=we,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(ho);const Co=p.default;function Fo(e){return(e=Co.normalize(Co.resolve(e)).split(Co.sep)).length>0?e[0]:null}const go=/[<>:"|?*]/;var Ao=function(e){const t=Fo(e);return e=e.replace(t,""),go.test(e)};const vo=we,So=p.default,wo=Ao,Oo=parseInt("0777",8);var bo=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&wo(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||vo;void 0===o&&(o=Oo&~process.umask()),u||(u=null),r=r||function(){},t=So.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(So.dirname(t)===t)return r(o);e(So.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const _o=we,Bo=p.default,Po=Ao,ko=parseInt("0777",8);var xo=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||_o;if("win32"===process.platform&&Po(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=ko&~process.umask()),r||(r=null),t=Bo.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Bo.dirname(t)===t)throw u;r=e(Bo.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const No=(0,yo.fromCallback)(bo);var Io={mkdirs:No,mkdirsSync:xo,mkdirp:No,mkdirpSync:xo,ensureDir:No,ensureDirSync:xo};const To=we;E.default,p.default;var Ro=function(e,t,n,r){To.open(e,"r+",((e,u)=>{if(e)return r(e);To.futimes(u,t,n,(e=>{To.close(u,(t=>{r&&r(e||t)}))}))}))},Mo=function(e,t,n){const r=To.openSync(e,"r+");return To.futimesSync(r,t,n),To.closeSync(r)};const Lo=we,jo=p.default,$o=10,Ho=5,Jo=0,Go=process.versions.node.split("."),Vo=Number.parseInt(Go[0],10),Uo=Number.parseInt(Go[1],10),Wo=Number.parseInt(Go[2],10);function zo(){if(Vo>$o)return!0;if(Vo===$o){if(Uo>Ho)return!0;if(Uo===Ho&&Wo>=Jo)return!0}return!1}function Ko(e,t){const n=jo.resolve(e).split(jo.sep).filter((e=>e)),r=jo.resolve(t).split(jo.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function qo(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Yo,Xo,Zo={checkPaths:function(e,t,n,r){!function(e,t,n){zo()?Lo.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);Lo.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):Lo.stat(e,((e,r)=>{if(e)return n(e);Lo.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&Ko(e,t)?r(new Error(qo(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=zo()?Lo.statSync(e,{bigint:!0}):Lo.statSync(e);try{r=zo()?Lo.statSync(t,{bigint:!0}):Lo.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&Ko(e,t))throw new Error(qo(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=jo.resolve(jo.dirname(t)),s=jo.resolve(jo.dirname(r));if(s===i||s===jo.parse(s).root)return o();zo()?Lo.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(qo(t,r,u))):e(t,n,s,u,o))):Lo.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(qo(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=jo.resolve(jo.dirname(t)),i=jo.resolve(jo.dirname(r));if(i===o||i===jo.parse(i).root)return;let s;try{s=zo()?Lo.statSync(i,{bigint:!0}):Lo.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(qo(t,r,u));return e(t,n,i,u)},isSrcSubdir:Ko};const Qo=we,ei=p.default,ti=Io.mkdirsSync,ni=Mo,ri=Zo;function ui(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Qo.statSync:Qo.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Qo.mkdirSync(n),ii(t,n,r),Qo.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return ii(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Qo.unlinkSync(n),oi(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):oi(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Qo.readlinkSync(t);r.dereference&&(u=ei.resolve(process.cwd(),u));if(e){let e;try{e=Qo.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Qo.symlinkSync(u,n);throw e}if(r.dereference&&(e=ei.resolve(process.cwd(),e)),ri.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Qo.statSync(n).isDirectory()&&ri.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Qo.unlinkSync(t),Qo.symlinkSync(e,t)}(u,n)}return Qo.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function oi(e,t,n,r){return"function"==typeof Qo.copyFileSync?(Qo.copyFileSync(t,n),Qo.chmodSync(n,e.mode),r.preserveTimestamps?ni(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Xo?Yo:(Xo=1,Yo=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Qo.openSync(t,"r"),s=Qo.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=ei.join(t,e),o=ei.join(n,e),{destStat:i}=ri.checkPathsSync(u,o,"copy");return ui(i,u,o,r)}(r,e,t,n)))}var si=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=ri.checkPathsSync(e,t,"copy");return ri.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=ei.dirname(n);Qo.existsSync(u)||ti(u);return ui(e,t,n,r)}(u,e,t,n)},ci={copySync:si};const ai=yo.fromPromise,li=ho;var fi={pathExists:ai((function(e){return li.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:li.existsSync};const di=we,Di=p.default,pi=Io.mkdirs,Ei=fi.pathExists,mi=Ro,hi=Zo;function yi(e,t,n,r,u){const o=Di.dirname(n);Ei(o,((i,s)=>i?u(i):s?Fi(e,t,n,r,u):void pi(o,(o=>o?u(o):Fi(e,t,n,r,u)))))}function Ci(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function Fi(e,t,n,r,u){return r.filter?Ci(gi,e,t,n,r,u):gi(e,t,n,r,u)}function gi(e,t,n,r,u){(r.dereference?di.stat:di.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){di.mkdir(n,(o=>{if(o)return u(o);Si(t,n,r,(t=>t?u(t):di.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return Si(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();di.unlink(n,(o=>o?u(o):Ai(e,t,n,r,u)))}(e,n,r,u,o):Ai(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){di.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Di.resolve(process.cwd(),o)),e?void di.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?di.symlink(o,n,u):u(t):(r.dereference&&(i=Di.resolve(process.cwd(),i)),hi.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&hi.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){di.unlink(t,(r=>r?n(r):di.symlink(e,t,n)))}(o,n,u)))):di.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function Ai(e,t,n,r,u){return"function"==typeof di.copyFile?di.copyFile(t,n,(t=>t?u(t):vi(e,n,r,u))):function(e,t,n,r,u){const o=di.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=di.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>vi(e,n,r,u)))}))}(e,t,n,r,u)}function vi(e,t,n,r){di.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?mi(t,e.atime,e.mtime,r):r()))}function Si(e,t,n,r){di.readdir(e,((u,o)=>u?r(u):wi(o,e,t,n,r)))}function wi(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Di.join(n,t),s=Di.join(r,t);hi.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;Fi(a,i,s,u,(t=>t?o(t):wi(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var Oi=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),hi.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;hi.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?Ci(yi,s,e,t,n,r):yi(s,e,t,n,r)))}))};var bi={copy:(0,yo.fromCallback)(Oi)};const _i=we,Bi=p.default,Pi=g.default,ki="win32"===process.platform;function xi(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||_i[t],e[t+="Sync"]=e[t]||_i[t]})),e.maxBusyTries=e.maxBusyTries||3}function Ni(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),Pi(e,"rimraf: missing path"),Pi.strictEqual(typeof e,"string","rimraf: path should be a string"),Pi.strictEqual(typeof n,"function","rimraf: callback function required"),Pi(t,"rimraf: invalid options argument provided"),Pi.strictEqual(typeof t,"object","rimraf: options should be object"),xi(t),Ii(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rIi(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Ii(e,t,n){Pi(e),Pi(t),Pi("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&ki?Ti(e,t,r,n):u&&u.isDirectory()?Mi(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return ki?Ti(e,t,r,n):Mi(e,t,r,n);if("EISDIR"===r.code)return Mi(e,t,r,n)}return n(r)}))))}function Ti(e,t,n,r){Pi(e),Pi(t),Pi("function"==typeof r),n&&Pi(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Mi(e,t,n,r):t.unlink(e,r)}))}))}function Ri(e,t,n){let r;Pi(e),Pi(t),n&&Pi(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?ji(e,t,n):t.unlinkSync(e)}function Mi(e,t,n,r){Pi(e),Pi(t),n&&Pi(n instanceof Error),Pi("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){Pi(e),Pi(t),Pi("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{Ni(Bi.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function Li(e,t){let n;xi(t=t||{}),Pi(e,"rimraf: missing path"),Pi.strictEqual(typeof e,"string","rimraf: path should be a string"),Pi(t,"rimraf: missing options"),Pi.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&ki&&Ri(e,t,n)}try{n&&n.isDirectory()?ji(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return ki?Ri(e,t,n):ji(e,t,n);if("EISDIR"!==n.code)throw n;ji(e,t,n)}}function ji(e,t,n){Pi(e),Pi(t),n&&Pi(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(Pi(e),Pi(t),t.readdirSync(e).forEach((n=>Li(Bi.join(e,n),t))),!ki){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var $i=Ni;Ni.sync=Li;const Hi=$i;var Ji={remove:(0,yo.fromCallback)(Hi),removeSync:Hi.sync};const Gi=yo.fromCallback,Vi=we,Ui=p.default,Wi=Io,zi=Ji,Ki=Gi((function(e,t){t=t||function(){},Vi.readdir(e,((n,r)=>{if(n)return Wi.mkdirs(e,t);r=r.map((t=>Ui.join(e,t))),function e(){const n=r.pop();if(!n)return t();zi.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function qi(e){let t;try{t=Vi.readdirSync(e)}catch(t){return Wi.mkdirsSync(e)}t.forEach((t=>{t=Ui.join(e,t),zi.removeSync(t)}))}var Yi={emptyDirSync:qi,emptydirSync:qi,emptyDir:Ki,emptydir:Ki};const Xi=yo.fromCallback,Zi=p.default,Qi=we,es=Io,ts=fi.pathExists;var ns={createFile:Xi((function(e,t){function n(){Qi.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Qi.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Zi.dirname(e);ts(o,((e,r)=>e?t(e):r?n():void es.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Qi.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=Zi.dirname(e);Qi.existsSync(n)||es.mkdirsSync(n),Qi.writeFileSync(e,"")}};const rs=yo.fromCallback,us=p.default,os=we,is=Io,ss=fi.pathExists;var cs={createLink:rs((function(e,t,n){function r(e,t){os.link(e,t,(e=>{if(e)return n(e);n(null)}))}ss(t,((u,o)=>u?n(u):o?n(null):void os.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=us.dirname(t);ss(o,((u,i)=>u?n(u):i?r(e,t):void is.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(os.existsSync(t))return;try{os.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=us.dirname(t);return os.existsSync(n)||is.mkdirsSync(n),os.linkSync(e,t)}};const as=p.default,ls=we,fs=fi.pathExists;var ds={symlinkPaths:function(e,t,n){if(as.isAbsolute(e))return ls.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=as.dirname(t),u=as.join(r,e);return fs(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):ls.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:as.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(as.isAbsolute(e)){if(n=ls.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=as.dirname(t),u=as.join(r,e);if(n=ls.existsSync(u),n)return{toCwd:u,toDst:e};if(n=ls.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:as.relative(r,e)}}}};const Ds=we;var ps={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Ds.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Ds.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Es=yo.fromCallback,ms=p.default,hs=we,ys=Io.mkdirs,Cs=Io.mkdirsSync,Fs=ds.symlinkPaths,gs=ds.symlinkPathsSync,As=ps.symlinkType,vs=ps.symlinkTypeSync,Ss=fi.pathExists;var ws={createSymlink:Es((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Ss(t,((u,o)=>u?r(u):o?r(null):void Fs(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,As(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=ms.dirname(t);Ss(o,((n,i)=>n?r(n):i?hs.symlink(e,t,u,r):void ys(o,(n=>{if(n)return r(n);hs.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(hs.existsSync(t))return;const r=gs(e,t);e=r.toDst,n=vs(r.toCwd,n);const u=ms.dirname(t);return hs.existsSync(u)||Cs(u),hs.symlinkSync(e,t,n)}};var Os,bs={createFile:ns.createFile,createFileSync:ns.createFileSync,ensureFile:ns.createFile,ensureFileSync:ns.createFileSync,createLink:cs.createLink,createLinkSync:cs.createLinkSync,ensureLink:cs.createLink,ensureLinkSync:cs.createLinkSync,createSymlink:ws.createSymlink,createSymlinkSync:ws.createSymlinkSync,ensureSymlink:ws.createSymlink,ensureSymlinkSync:ws.createSymlinkSync};try{Os=we}catch(e){Os=D.default}function _s(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Bs(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var Ps={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||Os,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Bs(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||Os,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Bs(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||Os,o="";try{o=_s(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||Os,u=_s(t,n);return r.writeFileSync(e,u,n)}},ks=Ps;const xs=yo.fromCallback,Ns=ks;var Is={readJson:xs(Ns.readFile),readJsonSync:Ns.readFileSync,writeJson:xs(Ns.writeFile),writeJsonSync:Ns.writeFileSync};const Ts=p.default,Rs=Io,Ms=fi.pathExists,Ls=Is;var js=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=Ts.dirname(e);Ms(u,((o,i)=>o?r(o):i?Ls.writeJson(e,t,n,r):void Rs.mkdirs(u,(u=>{if(u)return r(u);Ls.writeJson(e,t,n,r)}))))};const $s=we,Hs=p.default,Js=Io,Gs=Is;var Vs=function(e,t,n){const r=Hs.dirname(e);$s.existsSync(r)||Js.mkdirsSync(r),Gs.writeJsonSync(e,t,n)};const Us=yo.fromCallback,Ws=Is;Ws.outputJson=Us(js),Ws.outputJsonSync=Vs,Ws.outputJSON=Ws.outputJson,Ws.outputJSONSync=Ws.outputJsonSync,Ws.writeJSON=Ws.writeJson,Ws.writeJSONSync=Ws.writeJsonSync,Ws.readJSON=Ws.readJson,Ws.readJSONSync=Ws.readJsonSync;var zs=Ws;const Ks=we,qs=p.default,Ys=ci.copySync,Xs=Ji.removeSync,Zs=Io.mkdirpSync,Qs=Zo;function ec(e,t,n){try{Ks.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Ys(e,t,r),Xs(e)}(e,t,n)}}var tc=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Qs.checkPathsSync(e,t,"move");return Qs.checkParentPathsSync(e,u,t,"move"),Zs(qs.dirname(t)),function(e,t,n){if(n)return Xs(t),ec(e,t,n);if(Ks.existsSync(t))throw new Error("dest already exists.");return ec(e,t,n)}(e,t,r)},nc={moveSync:tc};const rc=we,uc=p.default,oc=bi.copy,ic=Ji.remove,sc=Io.mkdirp,cc=fi.pathExists,ac=Zo;function lc(e,t,n,r){rc.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};oc(e,t,u,(t=>t?r(t):ic(e,r)))}(e,t,n,r):r()))}var fc=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;ac.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;ac.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);sc(uc.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return ic(t,(u=>u?r(u):lc(e,t,n,r)));cc(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):lc(e,t,n,r)))}(e,t,u,r)))}))}))};var dc={move:(0,yo.fromCallback)(fc)};const Dc=yo.fromCallback,pc=we,Ec=p.default,mc=Io,hc=fi.pathExists;var yc={outputFile:Dc((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Ec.dirname(e);hc(u,((o,i)=>o?r(o):i?pc.writeFile(e,t,n,r):void mc.mkdirs(u,(u=>{if(u)return r(u);pc.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Ec.dirname(e);if(pc.existsSync(n))return pc.writeFileSync(e,...t);mc.mkdirsSync(n),pc.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},ho,ci,bi,Yi,bs,zs,Io,nc,dc,yc,fi,Ji);const t=D.default;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(mo);const Cc=Nr.exports("streamroller:fileNameFormatter"),Fc=p.default;const gc=Nr.exports("streamroller:fileNameParser"),Ac=nu.exports;const vc=Nr.exports("streamroller:moveAndMaybeCompressFile"),Sc=mo.exports,wc=v.default;var Oc=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return vc(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await Sc.pathExists(e))if(vc(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=Sc.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=Sc.createReadStream(e).on("open",(()=>{t.pipe(wc.createGzip()).pipe(i)})).on("error",(t=>{vc(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{vc(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),Sc.unlink(e).then(r).catch((t=>{vc(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),Sc.truncate(e).then(r).catch((t=>{vc(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(vc(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),Sc.unlink(t).then((()=>{u(e)})).catch((e=>{vc(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(vc(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{vc(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await Sc.move(e,t,{overwrite:!0})}catch(n){if(vc(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){vc("moveAndMaybeCompressFile: trying copy+truncate instead");try{await Sc.copy(e,t,{overwrite:!0}),await Sc.truncate(e)}catch(e){vc("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else vc("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const bc=Nr.exports("streamroller:RollingFileWriteStream"),_c=mo.exports,Bc=p.default,Pc=E.default,kc=()=>new Date,xc=nu.exports,{Writable:Nc}=C.default,Ic=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=Fc.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,d=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(Cc(`_formatFileName: date=${e}, index=${t}`),d.reduce(((n,r)=>r(n,t,e)),s))},Tc=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(gc("it is gzipped"),t.isCompressed=!0,e.slice(0,-1*".gz".length)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(gc("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(gc("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];gc("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),gc(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=Ac.parse(n,i,new Date(0,0));return Ac.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return gc(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(gc("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},Rc=Oc;var Mc=class extends Nc{constructor(e,t){if(bc(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Bc.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Bc.sep}`)&&(e=e.replace("~",Pc.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Bc.parse(e),""===this.fileObject.dir&&(this.fileObject=Bc.parse(Bc.join(process.cwd(),e))),this.fileFormatter=Ic({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return bc(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{bc(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(bc(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==xc(this.options.pattern,kc())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return bc("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){bc(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await Rc(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?xc(this.options.pattern,kc()):null,bc(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await _c.readdir(this.fileObject.dir).catch((()=>[]));bc(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:kc().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return _c.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Bc.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(_c.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;_c.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=_c.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(bc(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),bc("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Bc.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,bc(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>_c.unlink(e).catch((t=>{bc(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Lc=Mc;var jc=class extends Lc{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const $c=Mc;var Hc={RollingFileWriteStream:Mc,RollingFileStream:jc,DateRollingFileStream:class extends $c{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Jc=Nr.exports("log4js:file"),Gc=p.default,Vc=Hc,Uc=E.default.EOL;let Wc=!1;const zc=new Set;function Kc(){zc.forEach((e=>{e.sighupHandler()}))}function qc(e,t,n,r){const u=new Vc.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}Eo.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){e=Gc.normalize(e),Jc("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let i=qc(e,n,r,u);const s=function(e){if(i.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}i.write(t(e,o)+Uc,"utf8")||process.emit("log4js:pause",!0)}};return s.reopen=function(){i.end((()=>{i=qc(e,n,r,u)}))},s.sighupHandler=function(){Jc("SIGHUP handler called."),s.reopen()},s.shutdown=function(e){zc.delete(s),0===zc.size&&Wc&&(process.removeListener("SIGHUP",Kc),Wc=!1),i.end("","utf-8",e)},zc.add(s),Wc||(process.on("SIGHUP",Kc),Wc=!0),s}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var Yc={};const Xc=Hc,Zc=E.default.EOL;function Qc(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new Xc.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Zc,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}Yc.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Qc(e.filename,e.pattern,n,e,e.timezoneOffset)};var ea={};const ta=Nr.exports("log4js:fileSync"),na=p.default,ra=D.default,ua=E.default.EOL||"\n";function oa(e,t){if(ra.existsSync(e))return;const n=ra.openSync(e,t.flags,t.mode);ra.closeSync(n)}class ia{constructor(e,t,n,r){ta("In RollingFileStream"),function(){if(!e||!t||t<=0)throw new Error("You must specify a filename and file size")}(),this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=ra.statSync(e).size}catch(t){oa(e,r)}return t}(this.filename)}shouldRoll(){return ta("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${na.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.substring(`${na.basename(e)}.`.length),10)||0}function o(e,t){return u(e)>u(t)?1:u(e) ${e}.${r+1}`),ra.renameSync(na.join(na.dirname(e),n),`${e}.${r+1}`)}}ta("Rolling, rolling, rolling"),ta("Renaming the old files"),ra.readdirSync(na.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;ta("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),ta("writing the chunk to the file"),n.currentSize+=e.length,ra.appendFileSync(n.filename,e)}}ea.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){ta("fileSync appender created");const i=function(e,t,n){let r;var u;return t?r=new ia(e,t,n,o):(oa(u=e,o),r={write(e){ra.appendFileSync(u,e)}}),r}(e=na.normalize(e),n,r=r||0===r?r:5);return e=>{i.write(t(e,u)+ua)}}(e.filename,n,e.maxLogSize,e.backups,e.timezoneOffset,r)};var sa={};const ca=Nr.exports("log4js:tcp"),aa=S.default;sa.configure=function(e,t){ca(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){ca("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(ca("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(ca("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){ca(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=aa.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{ca("socket connected"),c(),n=!0})),u.on("drain",(()=>{ca("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{ca("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){ca("shutdown called"),r.length&&o?(ca("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const la=p.default,fa=Nr.exports("log4js:appenders"),da=tu,Da=eo,pa=gu,Ea=hu,ma=to,ha=new Map;ha.set("console",oo),ha.set("stdout",so),ha.set("stderr",co),ha.set("logLevelFilter",ao),ha.set("categoryFilter",lo),ha.set("noLogFilter",Do),ha.set("file",Eo),ha.set("dateFile",Yc),ha.set("fileSync",ea),ha.set("tcp",sa);const ya=new Map,Ca=(e,t)=>{fa("Loading module from ",e);try{return require(e)}catch(n){return void da.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},Fa=new Set,ga=(e,t)=>{if(ya.has(e))return ya.get(e);if(!t.appenders[e])return!1;if(Fa.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);Fa.add(e),fa(`Creating appender ${e}`);const n=Aa(e,t);return Fa.delete(e),ya.set(e,n),n},Aa=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ha.get(e)||Ca(`./${e}`,t)||Ca(e,t)||require.main&&Ca(la.join(la.dirname(require.main.filename),e),t)||Ca(la.join(process.cwd(),e),t))(n.type,t);return da.throwExceptionIf(t,da.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&fa(`DEPRECATION: Appender ${n.type} exports an appender function.`),r.shutdown&&fa(`DEPRECATION: Appender ${n.type} exports a shutdown function.`),fa(`${e}: clustering.isMaster ? ${Da.isMaster()}`),fa(`${e}: appenderModule is ${F.default.inspect(r)}`),Da.onlyOnMaster((()=>(fa(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ma.modifyConfig(n),Ea,(e=>ga(e,t)),pa))),(()=>{}))},va=e=>{ya.clear(),Fa.clear();const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type)&&ga(n,e)}))},Sa=()=>{va({appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"trace"}}})};Sa(),da.addListener((e=>{da.throwExceptionIf(e,da.not(da.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);da.throwExceptionIf(e,da.not(t.length),"must define at least one appender."),t.forEach((t=>{da.throwExceptionIf(e,da.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),da.addListener(va),Au.exports=ya,Au.exports.init=Sa;var wa={exports:{}};!function(e){const t=Nr.exports("log4js:categories"),n=tu,r=gu,u=Au.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.substring(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{o.clear();Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c({categories:{default:{appenders:["out"],level:"OFF"}}})};a(),n.addListener(c);const l=e=>(t(`configForCategory: searching for config for ${e}`),o.has(e)?(t(`configForCategory: ${e} exists in config, returning it`),o.get(e)):e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, searching for parents`),l(e.substring(0,e.lastIndexOf(".")))):(t("configForCategory: returning config for default category"),l("default")));e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,n)=>{let r=o.get(e);if(t(`setLevelForCategory: found ${r} for ${e}`),!r){const n=l(e);t(`setLevelForCategory: no config found for category, found ${n} for parents of ${e}`),r={appenders:n.appenders}}r.level=n,o.set(e,r)},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(wa);const Oa=Nr.exports("log4js:logger"),ba=Hu,_a=gu,Ba=eo,Pa=wa.exports,ka=tu,xa=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function Na(e,t=4){const n=e.stack.split("\n").slice(t),r=xa.exec(n[0]);return r&&6===r.length?{functionName:r[1],fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n")}:null}class Ia{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.parseCallStack=Na,Oa(`Logger created (${this.category}, ${this.level})`)}get level(){return _a.getLevel(Pa.getLevelForCategory(this.category),_a.TRACE)}set level(e){Pa.setLevelForCategory(this.category,_a.getLevel(e,this.level))}get useCallStack(){return Pa.getEnableCallStackForCategory(this.category)}set useCallStack(e){Pa.setEnableCallStackForCategory(this.category,!0===e)}log(e,...t){let n=_a.getLevel(e);n||(this._log(_a.WARN,"log4js:logger.log: invalid value for log-level as first parameter given: ",e),n=_a.INFO),this.isLevelEnabled(n)&&this._log(n,t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){Oa(`sending log data (${e}) to appenders`);const n=new ba(this.category,e,t,this.context,this.useCallStack&&this.parseCallStack(new Error));Ba.send(n)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){this.parseCallStack=e}}function Ta(e){const t=_a.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Ia.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Ia.prototype[n]=function(...e){this.log(t,...e)}}_a.levels.forEach(Ta),ka.addListener((()=>{_a.levels.forEach(Ta)}));var Ra=Ia;const Ma=gu;function La(e){return e.originalUrl||e.url}function ja(e,t){for(let n=0;ne.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);return(e,i,s)=>{if(e._logging)return s();if(o&&o.test(e.originalUrl))return s();if(n.isLevelEnabled(r)||"auto"===t.level){const o=new Date,{writeHead:s}=i;e._logging=!0,i.writeHead=(e,t)=>{i.writeHead=s,i.writeHead(e,t),i.__statusCode=e,i.__headers=t||{}},i.on("finish",(()=>{i.responseTime=new Date-o,i.statusCode&&"auto"===t.level&&(r=Ma.INFO,i.statusCode>=300&&(r=Ma.WARN),i.statusCode>=400&&(r=Ma.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ma.getLevel(t.level,r))}return r}(i.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:La(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eja(e,s)));t&&n.log(r,t)}else n.log(r,ja(u,s));t.context&&n.removeContext("res")}))}return s()}},nl=Va;let rl=!1;function ul(e){if(!rl)return;Ua("Received log event ",e);Za.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function ol(e){rl&&il();let t=e;return"string"==typeof t&&(t=function(e){Ua(`Loading configuration from ${e}`);try{return JSON.parse(Wa.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ua(`Configuration is ${t}`),Ka.configure(za(t)),el.onMessage(ul),rl=!0,sl}function il(e){Ua("Shutdown called. Disabling all log writing."),rl=!1;const t=Array.from(Xa.values());Xa.init(),Za.init();const n=t.reduceRight(((e,t)=>t.shutdown?e+1:e),0);if(0===n)return Ua("No appenders with shutdown functions found."),void 0!==e&&e();let r,u=0;function o(t){r=r||t,u+=1,Ua(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ua("All shutdown functions completed."),e&&e(r))}return Ua(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o))),null}const sl={getLogger:function(e){return rl||ol(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Qa(e||"default")},configure:ol,shutdown:il,connectLogger:tl,levels:Ya,addLayout:qa.addLayout,recording:function(){return nl}};var cl=sl,al={};Object.defineProperty(al,"__esModule",{value:!0}),al.levelMap=al.getLevel=al.setCategoriesLevel=al.getConfiguration=al.setConfiguration=void 0;const ll=cl;let fl={appenders:{debug:{type:"stdout",layout:{type:"pattern",pattern:"[%d] > hvigor %p %c %[%m%]"}},info:{type:"stdout",layout:{type:"pattern",pattern:"[%d] > hvigor %[%m%]"}},"no-pattern-info":{type:"stdout",layout:{type:"pattern",pattern:"%m"}},wrong:{type:"stderr",layout:{type:"pattern",pattern:"[%d] > hvigor %[%p: %m%]"}},"just-debug":{type:"logLevelFilter",appender:"debug",level:"debug",maxLevel:"debug"},"just-info":{type:"logLevelFilter",appender:"info",level:"info",maxLevel:"info"},"just-wrong":{type:"logLevelFilter",appender:"wrong",level:"warn",maxLevel:"error"}},categories:{default:{appenders:["just-debug","just-info","just-wrong"],level:"debug"},"no-pattern-info":{appenders:["no-pattern-info"],level:"info"}}};al.setConfiguration=e=>{fl=e};al.getConfiguration=()=>fl;let dl=ll.levels.DEBUG;al.setCategoriesLevel=(e,t)=>{dl=e;const n=fl.categories;for(const r in n)(null==t?void 0:t.includes(r))||Object.prototype.hasOwnProperty.call(n,r)&&(n[r].level=e.levelStr)};al.getLevel=()=>dl,al.levelMap=new Map([["ALL",ll.levels.ALL],["MARK",ll.levels.MARK],["TRACE",ll.levels.TRACE],["DEBUG",ll.levels.DEBUG],["INFO",ll.levels.INFO],["WARN",ll.levels.WARN],["ERROR",ll.levels.ERROR],["FATAL",ll.levels.FATAL],["OFF",ll.levels.OFF]]);var Dl=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),pl=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),El=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Dl(t,e,n);return pl(t,e),t};Object.defineProperty(xr,"__esModule",{value:!0}),xr.evaluateLogLevel=xr.HvigorLogger=void 0;const ml=El(cl),hl=cl,yl=El(F.default),Cl=al;class Fl{constructor(e){ml.configure((0,Cl.getConfiguration)()),this._logger=ml.getLogger(e),this._logger.level=(0,Cl.getLevel)()}static getLogger(e){return new Fl(e)}log(e,...t){this._logger.log(e,...t)}debug(e,...t){this._logger.debug(e,...t)}info(e,...t){this._logger.info(e,...t)}warn(e,...t){void 0!==e&&""!==e&&this._logger.warn(e,...t)}error(e,...t){this._logger.error(e,...t)}_printTaskExecuteInfo(e,t){this.info(`Finished :${e}... after ${t}`)}_printFailedTaskInfo(e){this.error(`Failed :${e}... `)}_printDisabledTaskInfo(e){this.info(`Disabled :${e}... `)}_printUpToDateTaskInfo(e){this.info(`UP-TO-DATE :${e}... `)}errorMessageExit(e,...t){throw new Error(yl.format(e,...t))}errorExit(e,t,...n){t&&this._logger.error(t,n),this._logger.error(e.stack)}setLevel(e,t){(0,Cl.setCategoriesLevel)(e,t),ml.shutdown(),ml.configure((0,Cl.getConfiguration)())}getLevel(){return this._logger.level}configure(e){const t=(0,Cl.getConfiguration)(),n={appenders:{...t.appenders,...e.appenders},categories:{...t.categories,...e.categories}};(0,Cl.setConfiguration)(n),ml.shutdown(),ml.configure(n)}}xr.HvigorLogger=Fl,xr.evaluateLogLevel=function(e,t){t.debug?e.setLevel(hl.levels.DEBUG):t.warn?e.setLevel(hl.levels.WARN):t.error?e.setLevel(hl.levels.ERROR):e.setLevel(hl.levels.INFO)};var gl=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(X,"__esModule",{value:!0}),X.parseJsonText=X.parseJsonFile=void 0;const Al=Z,vl=gl(kr),Sl=gl(p.default),wl=gl(E.default),Ol=xr.HvigorLogger.getLogger("parse-json-util");var bl;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(bl||(bl={}));let _l,Bl,Pl,kl,xl,Nl,Il="start",Tl=[],Rl=0,Ml=1,Ll=0,jl=!1,$l="default",Hl="'",Jl=1;function Gl(e,t=!1){Bl=String(e),Il="start",Tl=[],Rl=0,Ml=1,Ll=0,kl=void 0,jl=t;do{_l=Vl(),Xl[Il]()}while("eof"!==_l.type);return kl}function Vl(){for($l="default",xl="",Hl="'",Jl=1;;){Nl=Ul();const e=zl[$l]();if(e)return e}}function Ul(){if(Bl[Rl])return String.fromCodePoint(Bl.codePointAt(Rl))}function Wl(){const e=Ul();return"\n"===e?(Ml++,Ll=0):e?Ll+=e.length:Ll++,e&&(Rl+=e.length),e}X.parseJsonFile=function(e,t=!1,n="utf-8"){const r=vl.default.readFileSync(Sl.default.resolve(e),{encoding:n});try{return Gl(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");2===n.length&&Ol.errorMessageExit(`${n[0].trim()}${wl.default.EOL}\t at ${e}:${n[1].trim()}`)}Ol.errorMessageExit(`${e} is not in valid JSON/JSON5 format.`)}},X.parseJsonText=Gl;const zl={default(){switch(Nl){case"/":return Wl(),void($l="comment");case void 0:return Wl(),Kl("eof")}if(!Al.JudgeUtil.isIgnoreChar(Nl)&&!Al.JudgeUtil.isSpaceSeparator(Nl))return zl[Il]();Wl()},start(){$l="value"},beforePropertyName(){switch(Nl){case"$":case"_":return xl=Wl(),void($l="identifierName");case"\\":return Wl(),void($l="identifierNameStartEscape");case"}":return Kl("punctuator",Wl());case'"':case"'":return Hl=Nl,Wl(),void($l="string")}if(Al.JudgeUtil.isIdStartChar(Nl))return xl+=Wl(),void($l="identifierName");throw tf(bl.Char,Wl())},afterPropertyName(){if(":"===Nl)return Kl("punctuator",Wl());throw tf(bl.Char,Wl())},beforePropertyValue(){$l="value"},afterPropertyValue(){switch(Nl){case",":case"}":return Kl("punctuator",Wl())}throw tf(bl.Char,Wl())},beforeArrayValue(){if("]"===Nl)return Kl("punctuator",Wl());$l="value"},afterArrayValue(){switch(Nl){case",":case"]":return Kl("punctuator",Wl())}throw tf(bl.Char,Wl())},end(){throw tf(bl.Char,Wl())},comment(){switch(Nl){case"*":return Wl(),void($l="multiLineComment");case"/":return Wl(),void($l="singleLineComment")}throw tf(bl.Char,Wl())},multiLineComment(){switch(Nl){case"*":return Wl(),void($l="multiLineCommentAsterisk");case void 0:throw tf(bl.Char,Wl())}Wl()},multiLineCommentAsterisk(){switch(Nl){case"*":return void Wl();case"/":return Wl(),void($l="default");case void 0:throw tf(bl.Char,Wl())}Wl(),$l="multiLineComment"},singleLineComment(){switch(Nl){case"\n":case"\r":case"\u2028":case"\u2029":return Wl(),void($l="default");case void 0:return Wl(),Kl("eof")}Wl()},value(){switch(Nl){case"{":case"[":return Kl("punctuator",Wl());case"n":return Wl(),ql("ull"),Kl("null",null);case"t":return Wl(),ql("rue"),Kl("boolean",!0);case"f":return Wl(),ql("alse"),Kl("boolean",!1);case"-":case"+":return"-"===Wl()&&(Jl=-1),void($l="numerical");case".":case"0":case"I":case"N":return void($l="numerical");case'"':case"'":return Hl=Nl,Wl(),xl="",void($l="string")}if(void 0===Nl||!Al.JudgeUtil.isDigitWithoutZero(Nl))throw tf(bl.Char,Wl());$l="numerical"},numerical(){switch(Nl){case".":return xl=Wl(),void($l="decimalPointLeading");case"0":return xl=Wl(),void($l="zero");case"I":return Wl(),ql("nfinity"),Kl("numeric",Jl*(1/0));case"N":return Wl(),ql("aN"),Kl("numeric",NaN)}if(void 0!==Nl&&Al.JudgeUtil.isDigitWithoutZero(Nl))return xl=Wl(),void($l="decimalInteger");throw tf(bl.Char,Wl())},zero(){switch(Nl){case".":case"e":case"E":return void($l="decimal");case"x":case"X":return xl+=Wl(),void($l="hexadecimal")}return Kl("numeric",0)},decimalInteger(){switch(Nl){case".":case"e":case"E":return void($l="decimal")}if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},decimal(){switch(Nl){case".":xl+=Wl(),$l="decimalFraction";break;case"e":case"E":xl+=Wl(),$l="decimalExponent"}},decimalPointLeading(){if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalFraction");throw tf(bl.Char,Wl())},decimalFraction(){switch(Nl){case"e":case"E":return xl+=Wl(),void($l="decimalExponent")}if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},decimalExponent(){switch(Nl){case"+":case"-":return xl+=Wl(),void($l="decimalExponentSign")}if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalExponentInteger");throw tf(bl.Char,Wl())},decimalExponentSign(){if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalExponentInteger");throw tf(bl.Char,Wl())},decimalExponentInteger(){if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},hexadecimal(){if(Al.JudgeUtil.isHexDigit(Nl))return xl+=Wl(),void($l="hexadecimalInteger");throw tf(bl.Char,Wl())},hexadecimalInteger(){if(!Al.JudgeUtil.isHexDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},identifierNameStartEscape(){if("u"!==Nl)throw tf(bl.Char,Wl());Wl();const e=Yl();switch(e){case"$":case"_":break;default:if(!Al.JudgeUtil.isIdStartChar(e))throw tf(bl.Identifier)}xl+=e,$l="identifierName"},identifierName(){switch(Nl){case"$":case"_":case"":case"":return void(xl+=Wl());case"\\":return Wl(),void($l="identifierNameEscape")}if(!Al.JudgeUtil.isIdContinueChar(Nl))return Kl("identifier",xl);xl+=Wl()},identifierNameEscape(){if("u"!==Nl)throw tf(bl.Char,Wl());Wl();const e=Yl();switch(e){case"$":case"_":case"":case"":break;default:if(!Al.JudgeUtil.isIdContinueChar(e))throw tf(bl.Identifier)}xl+=e,$l="identifierName"},string(){switch(Nl){case"\\":return Wl(),void(xl+=function(){const e=Ul(),t=function(){switch(Ul()){case"b":return Wl(),"\b";case"f":return Wl(),"\f";case"n":return Wl(),"\n";case"r":return Wl(),"\r";case"t":return Wl(),"\t";case"v":return Wl(),"\v"}return}();if(t)return t;switch(e){case"0":if(Wl(),Al.JudgeUtil.isDigit(Ul()))throw tf(bl.Char,Wl());return"\0";case"x":return Wl(),function(){let e="",t=Ul();if(!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());if(e+=Wl(),t=Ul(),!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());return e+=Wl(),String.fromCodePoint(parseInt(e,16))}();case"u":return Wl(),Yl();case"\n":case"\u2028":case"\u2029":return Wl(),"";case"\r":return Wl(),"\n"===Ul()&&Wl(),""}if(void 0===e||Al.JudgeUtil.isDigitWithoutZero(e))throw tf(bl.Char,Wl());return Wl()}());case'"':case"'":if(Nl===Hl){const e=Kl("string",xl);return Wl(),e}return void(xl+=Wl());case"\n":case"\r":case void 0:throw tf(bl.Char,Wl());case"\u2028":case"\u2029":!function(e){Ol.warn(`JSON5: '${ef(e)}' in strings is not valid ECMAScript; consider escaping.`)}(Nl)}xl+=Wl()}};function Kl(e,t){return{type:e,value:t,line:Ml,column:Ll}}function ql(e){for(const t of e){if(Ul()!==t)throw tf(bl.Char,Wl());Wl()}}function Yl(){let e="",t=4;for(;t-- >0;){const t=Ul();if(!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());e+=Wl()}return String.fromCodePoint(parseInt(e,16))}const Xl={start(){if("eof"===_l.type)throw tf(bl.EOF);Zl()},beforePropertyName(){switch(_l.type){case"identifier":case"string":return Pl=_l.value,void(Il="afterPropertyName");case"punctuator":return void Ql();case"eof":throw tf(bl.EOF)}},afterPropertyName(){if("eof"===_l.type)throw tf(bl.EOF);Il="beforePropertyValue"},beforePropertyValue(){if("eof"===_l.type)throw tf(bl.EOF);Zl()},afterPropertyValue(){if("eof"===_l.type)throw tf(bl.EOF);switch(_l.value){case",":return void(Il="beforePropertyName");case"}":Ql()}},beforeArrayValue(){if("eof"===_l.type)throw tf(bl.EOF);"punctuator"!==_l.type||"]"!==_l.value?Zl():Ql()},afterArrayValue(){if("eof"===_l.type)throw tf(bl.EOF);switch(_l.value){case",":return void(Il="beforeArrayValue");case"]":Ql()}},end(){}};function Zl(){const e=function(){let e;switch(_l.type){case"punctuator":switch(_l.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=_l.value}return e}();if(jl&&"object"==typeof e&&(e._line=Ml,e._column=Ll),void 0===kl)kl=e;else{const t=Tl[Tl.length-1];Array.isArray(t)?jl&&"object"!=typeof e?t.push({value:e,_line:Ml,_column:Ll}):t.push(e):t[Pl]=jl&&"object"!=typeof e?{value:e,_line:Ml,_column:Ll}:e}!function(e){if(e&&"object"==typeof e)Tl.push(e),Il=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Tl[Tl.length-1];Il=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ql(){Tl.pop();const e=Tl[Tl.length-1];Il=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function ef(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function tf(e,t){let n="";switch(e){case bl.Char:n=void 0===t?`JSON5: invalid end of input at ${Ml}:${Ll}`:`JSON5: invalid character '${ef(t)}' at ${Ml}:${Ll}`;break;case bl.EOF:n=`JSON5: invalid end of input at ${Ml}:${Ll}`;break;case bl.Identifier:Ll-=5,n=`JSON5: invalid identifier character at ${Ml}:${Ll}`}const r=new nf(n);return r.lineNumber=Ml,r.columnNumber=Ll,r}class nf extends SyntaxError{}var rf=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),uf=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),of=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&rf(t,e,n);return uf(t,e),t};Object.defineProperty(Y,"__esModule",{value:!0});var sf=Y.cleanWorkSpace=Ff=Y.executeInstallHvigor=yf=Y.isHvigorInstalled=mf=Y.isAllDependenciesInstalled=void 0;const cf=of(D.default),af=of(p.default),lf=b,ff=j,df=$,Df=X;let pf,Ef;var mf=Y.isAllDependenciesInstalled=function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}if(pf=gf(),Ef=Af(),e(pf)+1!==e(Ef))return!1;for(const e in null==pf?void 0:pf.dependencies)if(!(0,ff.hasNpmPackInPaths)(e,[lf.HVIGOR_PROJECT_DEPENDENCIES_HOME])||!hf(e,pf,Ef))return!1;return!0};function hf(e,t,n){return void 0!==n.dependencies&&(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===n.dependencies[e]}var yf=Y.isHvigorInstalled=function(){return pf=gf(),Ef=Af(),(0,ff.hasNpmPackInPaths)(lf.HVIGOR_ENGINE_PACKAGE_NAME,[lf.HVIGOR_PROJECT_DEPENDENCIES_HOME])&&(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,pf.hvigorVersion)===Ef.dependencies[lf.HVIGOR_ENGINE_PACKAGE_NAME]};const Cf={cwd:lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,stdio:["inherit","inherit","inherit"]};var Ff=Y.executeInstallHvigor=function(){(0,df.logInfoPrintConsole)("Hvigor installing...");const e={dependencies:{}};e.dependencies[lf.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,pf.hvigorVersion);try{cf.mkdirSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,{recursive:!0});const t=af.resolve(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,lf.DEFAULT_PACKAGE_JSON);cf.writeFileSync(t,JSON.stringify(e))}catch(e){(0,df.logErrorAndExit)(e)}!function(){const e=["config","set","store-dir",lf.HVIGOR_PNPM_STORE_PATH];(0,ff.executeCommand)(lf.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,Cf)}(),(0,ff.executeCommand)(lf.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,["install"],Cf)};function gf(){const e=af.resolve(lf.HVIGOR_PROJECT_WRAPPER_HOME,lf.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);return cf.existsSync(e)||(0,df.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`),(0,Df.parseJsonFile)(e)}function Af(){return cf.existsSync(lf.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH)?(0,Df.parseJsonFile)(lf.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH):{dependencies:{}}}sf=Y.cleanWorkSpace=function(){if((0,df.logInfoPrintConsole)("Hvigor cleaning..."),!cf.existsSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME))return;const e=cf.readdirSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME);if(e&&0!==e.length){cf.existsSync(lf.HVIGOR_BOOT_JS_FILE_PATH)&&(0,ff.executeCommand)(process.argv[0],[lf.HVIGOR_BOOT_JS_FILE_PATH,"--stop-daemon"],{});try{e.forEach((e=>{cf.rmSync(af.resolve(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,e),{recursive:!0})}))}catch(e){(0,df.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${lf.HVIGOR_PROJECT_DEPENDENCIES_HOME}.`)}}};var vf={},Sf=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),wf=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Of=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Sf(t,e,n);return wf(t,e),t};Object.defineProperty(vf,"__esModule",{value:!0});var bf=vf.executeBuild=void 0;const _f=b,Bf=Of(D.default),Pf=Of(p.default),kf=$;bf=vf.executeBuild=function(){const e=Pf.resolve(_f.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const t=Bf.realpathSync(e);require(t)}catch(t){(0,kf.logErrorAndExit)(`Error: ENOENT: no such file ${e},delete ${_f.HVIGOR_PROJECT_DEPENDENCIES_HOME} and retry.`)}},function(){if(O.checkNpmConifg(),O.environmentHandler(),O.isPnpmAvailable()||O.executeInstallPnpm(),yf()&&mf())bf();else{sf();try{Ff()}catch(e){return void sf()}bf()}}();
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/hvigorfile.ts b/Distributed/DistributedNewsClient/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6478186902c0c1ad7c966a929c7d6b7d8ae7a9f3
--- /dev/null
+++ b/Distributed/DistributedNewsClient/hvigorfile.ts
@@ -0,0 +1,2 @@
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { appTasks } from '@ohos/hvigor-ohos-plugin';
\ No newline at end of file
diff --git a/Distributed/DistributedNewsClient/oh-package.json5 b/Distributed/DistributedNewsClient/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b041e9578f047a484a5b6014a3a508cb5933a4ef
--- /dev/null
+++ b/Distributed/DistributedNewsClient/oh-package.json5
@@ -0,0 +1,12 @@
+{
+ "license": "",
+ "devDependencies": {
+ "@ohos/hypium": "1.0.6"
+ },
+ "author": "",
+ "name": "distributednews",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "version": "1.0.0",
+ "dependencies": {}
+}
diff --git a/README.md b/README.md
index 44e19382a0fee7787c126be0b9deb3994a9969bc..5bd4cd29c1ce39fcd5c253893ea647174206b6f6 100644
--- a/README.md
+++ b/README.md
@@ -72,7 +72,8 @@
- [用户首选项(JS)(API 9)](https://gitee.com/openharmony/codelabs/tree/master/Data/PreferenceJS)
- [分布式数据库(JS)(API 8)](https://gitee.com/openharmony/codelabs/tree/master/Data/JsDistributedData)
- 分布式
- - [分布式手写板(ArkTS)(Full SDK)(API 8)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/DistributeDatabaseDrawEts)
+ - [分布式手写板(ArkTS)(Full SDK)(API 10)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/DistributeDraw)
+ - [分布式新闻客户端(ArkTS)(Full SDK)(API 10)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/DistributedNewsClient)
- [分布式游戏手柄(ArkTS)(Full SDK)(API 8)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/HandleGameApplication)
- [分布式邮件(ArkTS)(Full SDK)(API 8)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/OHMailETS)
- [分布式亲子早教系统(ArkTS)(Full SDK)(API 8)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/OpenHarmonyPictureGame)